<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Admin\Controller; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Str; use ModStart\Admin\Auth\Admin; use ModStart\Admin\Auth\AdminPermission; use ModStart\Admin\Layout\AdminDialogPage; use ModStart\Core\Dao\DynamicModel; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Core\Util\RandomUtil; use ModStart\Form\Form; use ModStart\ModStart; class SystemController extends Controller { public function clearCache() { goto jQvSd; osXZQ: ModStart::clearCache(); goto m4HAH; Y6jIO: if (0 != $d6Iac) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " cache:clear ExitCode({$d6Iac})"); } goto PsXL6; K9Pjo: if (0 != $d6Iac) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " view:clear ExitCode({$d6Iac})"); } goto osXZQ; m4HAH: return Response::jsonSuccess(L('Operate Success')); goto kYwBK; UH8WB: AdminPermission::permitCheck('SystemManage'); goto Ga4vp; PsXL6: $d6Iac = Artisan::call('view:clear'); goto K9Pjo; L96K8: $d6Iac = Artisan::call('cache:clear'); goto Y6jIO; jQvSd: AdminPermission::demoCheck(); goto UH8WB; Ga4vp: Admin::addInfoLog(Admin::id(), L('Clear Cache')); goto L96K8; kYwBK: } public function securityFix(AdminDialogPage $S_qaA) { goto e_1CG; kJnW3: $FDNZs = $HoUFw->getTrimString('type'); goto Kb2m3; e_1CG: AdminPermission::permitCheck('SystemManage'); goto KGa3O; bNCs4: return Response::sendError('Unknown Type'); goto mwCxF; KGa3O: $HoUFw = InputPackage::buildFromInput(); goto kJnW3; Kb2m3: switch ($FDNZs) { case 'installLock': goto BRa61; haC1r: return Response::json(0, L('Operate Success'), null, '[reload]'); goto k2KIP; BRa61: AdminPermission::demoCheck(); goto z1pxg; z1pxg: if (!file_exists(storage_path('install.lock'))) { file_put_contents(storage_path('install.lock'), 'ok'); } goto SB8pP; SB8pP: if (!file_exists(storage_path('install.lock'))) { return Response::json(-1, L('Operate Failed')); } goto haC1r; k2KIP: case 'installScript': goto vxErd; lOI_O: if (file_exists(public_path('install.php'))) { return Response::json(-1, L('Operate Failed')); } goto WeCMH; STx3p: if (file_exists(public_path('install.php'))) { @unlink(public_path('install.php')); } goto lOI_O; vxErd: AdminPermission::demoCheck(); goto STx3p; WeCMH: return Response::json(0, L('Operate Success'), null, '[reload]'); goto tpWf9; tpWf9: case 'appDebug': goto yfnft; gLStT: return Response::json(0, L('Operate Success'), null, '[reload]'); goto mcctT; A82Kc: $cgjRu = file_get_contents(base_path('.env')); goto fOSYW; fOSYW: $cgjRu = preg_replace('/APP_DEBUG\\s*=\\s*true/', 'APP_DEBUG=false', $cgjRu); goto q6_Gp; yfnft: AdminPermission::demoCheck(); goto A82Kc; q6_Gp: file_put_contents(base_path('.env'), $cgjRu); goto gLStT; mcctT: case 'adminPath': goto siHlD; RElgm: $LEyIF->showSubmit(false)->showReset(false); goto Ij49X; PtCxT: $LEyIF->text('newPath', L('New Path'))->rules('required')->value('/admin_' . RandomUtil::lowerReadableString(6) . '/'); goto RElgm; e4m7i: return $S_qaA->pageTitle(L('Change Admin Url'))->body($LEyIF); goto MI2tk; TY1Fv: $LEyIF->text('oldPath', L('Current Path'))->rules('required')->value(config('env.ADMIN_PATH', '/admin/'))->readonly(true); goto PtCxT; Ij49X: if (Request::isPost()) { return $LEyIF->formRequest(function (Form $LEyIF) { AdminPermission::demoCheck(); $SjN8A = $LEyIF->dataForming(); $qVxSR = $SjN8A['newPath']; if (!Str::startsWith($qVxSR, '/') || !Str::endsWith($qVxSR, '/')) { return Response::generateError(L('Url must start with / and end with /')); } if (!preg_match('/^\\/[a-zA-Z0-9_]+\\/$/', $qVxSR)) { return Response::generateError(L('Admin url only contains a-zA-Z0-9_')); } $cgjRu = file_get_contents(base_path('.env')); $cgjRu = preg_replace('/ADMIN_PATH\\s*=\\s*.*?\\n/', "ADMIN_PATH={$qVxSR}\n", $cgjRu); try { file_put_contents(base_path('.env'), $cgjRu); return Response::json(0, L('Operate Success'), null, '[js]parent.location.href="' . $qVxSR . '"'); } catch (\Exception $xpJqz) { return Response::jsonError(L('No Permission')); } }); } goto e4m7i; siHlD: $LEyIF = new Form(DynamicModel::class); goto TY1Fv; MI2tk: } goto bNCs4; mwCxF: } }