<?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 CdJro; bUjLU: $O8Opn = Artisan::call('cache:clear'); goto cAInY; HE3JO: ModStart::clearCache(); goto BWAsU; E93_7: Admin::addInfoLog(Admin::id(), L('Clear Cache')); goto bUjLU; lUTc2: $O8Opn = Artisan::call('view:clear'); goto PXNbg; cAInY: if (0 != $O8Opn) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " cache:clear ExitCode({$O8Opn})"); } goto lUTc2; PXNbg: if (0 != $O8Opn) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " view:clear ExitCode({$O8Opn})"); } goto HE3JO; BWAsU: return Response::jsonSuccess(L('Operate Success')); goto d8QGc; kn34_: AdminPermission::permitCheck('SystemManage'); goto E93_7; CdJro: AdminPermission::demoCheck(); goto kn34_; d8QGc: } public function securityFix(AdminDialogPage $ho3D1) { goto G16zW; WYGO6: switch ($pW0Nz) { case 'installLock': goto vqo0x; EUyIh: return Response::json(0, L('Operate Success'), null, '[reload]'); goto r3l68; U4yH7: if (!file_exists(storage_path('install.lock'))) { file_put_contents(storage_path('install.lock'), 'ok'); } goto dG1SV; dG1SV: if (!file_exists(storage_path('install.lock'))) { return Response::json(-1, L('Operate Failed')); } goto EUyIh; vqo0x: AdminPermission::demoCheck(); goto U4yH7; r3l68: case 'installScript': goto LGEu4; EexJY: if (file_exists(public_path('install.php'))) { @unlink(public_path('install.php')); } goto FppQx; LGEu4: AdminPermission::demoCheck(); goto EexJY; FppQx: if (file_exists(public_path('install.php'))) { return Response::json(-1, L('Operate Failed')); } goto YGj3T; YGj3T: return Response::json(0, L('Operate Success'), null, '[reload]'); goto rCseq; rCseq: case 'appDebug': goto bq7Qu; y3mkf: $vVYCS = preg_replace('/APP_DEBUG\\s*=\\s*true/', 'APP_DEBUG=false', $vVYCS); goto Sf4SC; Sf4SC: file_put_contents(base_path('.env'), $vVYCS); goto EQPS_; EQPS_: return Response::json(0, L('Operate Success'), null, '[reload]'); goto gVHw3; bq7Qu: AdminPermission::demoCheck(); goto M4Een; M4Een: $vVYCS = file_get_contents(base_path('.env')); goto y3mkf; gVHw3: case 'adminPath': goto vW9HQ; QeVt9: $SKFwZ->text('oldPath', L('Current Path'))->rules('required')->value(config('env.ADMIN_PATH', '/admin/'))->readonly(true); goto PHmGr; vW9HQ: $SKFwZ = new Form(DynamicModel::class); goto QeVt9; GgnA1: return $ho3D1->pageTitle(L('Change Admin Url'))->body($SKFwZ); goto RmWzK; PHmGr: $SKFwZ->text('newPath', L('New Path'))->rules('required')->value('/admin_' . RandomUtil::lowerReadableString(6) . '/'); goto zPczo; CPlFJ: if (Request::isPost()) { return $SKFwZ->formRequest(function (Form $SKFwZ) { AdminPermission::demoCheck(); $zvN10 = $SKFwZ->dataForming(); $qjAir = $zvN10['newPath']; if (!Str::startsWith($qjAir, '/') || !Str::endsWith($qjAir, '/')) { return Response::generateError(L('Url must start with / and end with /')); } if (!preg_match('/^\\/[a-zA-Z0-9_]+\\/$/', $qjAir)) { return Response::generateError(L('Admin url only contains a-zA-Z0-9_')); } $vVYCS = file_get_contents(base_path('.env')); $vVYCS = preg_replace('/ADMIN_PATH\\s*=\\s*.*?\\n/', "ADMIN_PATH={$qjAir}\n", $vVYCS); try { file_put_contents(base_path('.env'), $vVYCS); return Response::json(0, L('Operate Success'), null, '[js]parent.location.href="' . $qjAir . '"'); } catch (\Exception $Xlb8r) { return Response::jsonError(L('No Permission')); } }); } goto GgnA1; zPczo: $SKFwZ->showSubmit(false)->showReset(false); goto CPlFJ; RmWzK: } goto UGZgX; UGZgX: return Response::sendError('Unknown Type'); goto C2OT6; ugIJD: $pW0Nz = $vrSVj->getTrimString('type'); goto WYGO6; G16zW: AdminPermission::permitCheck('SystemManage'); goto dR_1T; dR_1T: $vrSVj = InputPackage::buildFromInput(); goto ugIJD; C2OT6: } }