<?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 D77hT; Vf19Z: Admin::addInfoLog(Admin::id(), L('Clear Cache')); goto ijl2j; bBw0i: return Response::jsonSuccess(L('Operate Success')); goto FzY0I; Y5CcA: $w2cO0 = Artisan::call('view:clear'); goto SWa4h; ijl2j: $w2cO0 = Artisan::call('cache:clear'); goto Fjnmt; NBC4q: ModStart::clearCache(); goto bBw0i; Fjnmt: if (0 != $w2cO0) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " cache:clear ExitCode({$w2cO0})"); } goto Y5CcA; liyC1: AdminPermission::permitCheck('SystemManage'); goto Vf19Z; D77hT: AdminPermission::demoCheck(); goto liyC1; SWa4h: if (0 != $w2cO0) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " view:clear ExitCode({$w2cO0})"); } goto NBC4q; FzY0I: } public function securityFix(AdminDialogPage $BcS7S) { goto r2nri; CJV8o: switch ($bOB5d) { case 'installLock': goto H3flq; uCfsf: return Response::json(0, L('Operate Success'), null, '[reload]'); goto XDf9G; H3flq: AdminPermission::demoCheck(); goto KAbO8; KAbO8: if (!file_exists(storage_path('install.lock'))) { file_put_contents(storage_path('install.lock'), 'ok'); } goto JZJac; JZJac: if (!file_exists(storage_path('install.lock'))) { return Response::json(-1, L('Operate Failed')); } goto uCfsf; XDf9G: case 'installScript': goto r__J2; V3jGW: if (file_exists(public_path('install.php'))) { return Response::json(-1, L('Operate Failed')); } goto Wdp0h; r__J2: AdminPermission::demoCheck(); goto vv4qs; vv4qs: if (file_exists(public_path('install.php'))) { @unlink(public_path('install.php')); } goto V3jGW; Wdp0h: return Response::json(0, L('Operate Success'), null, '[reload]'); goto uXCmi; uXCmi: case 'appDebug': goto hsplp; Kc97i: return Response::json(0, L('Operate Success'), null, '[reload]'); goto eCPLU; hsplp: AdminPermission::demoCheck(); goto qbLS2; Yj1rj: $rFmqf = preg_replace('/APP_DEBUG\\s*=\\s*true/', 'APP_DEBUG=false', $rFmqf); goto LUM34; LUM34: file_put_contents(base_path('.env'), $rFmqf); goto Kc97i; qbLS2: $rFmqf = file_get_contents(base_path('.env')); goto Yj1rj; eCPLU: case 'adminPath': goto gg4fU; ARHcp: if (Request::isPost()) { return $u4AHU->formRequest(function (Form $u4AHU) { AdminPermission::demoCheck(); $EdQjV = $u4AHU->dataForming(); $XVT8B = $EdQjV['newPath']; if (!Str::startsWith($XVT8B, '/') || !Str::endsWith($XVT8B, '/')) { return Response::generateError(L('Url must start with / and end with /')); } if (!preg_match('/^\\/[a-zA-Z0-9_]+\\/$/', $XVT8B)) { return Response::generateError(L('Admin url only contains a-zA-Z0-9_')); } $rFmqf = file_get_contents(base_path('.env')); $rFmqf = preg_replace('/ADMIN_PATH\\s*=\\s*.*?\\n/', "ADMIN_PATH={$XVT8B}\n", $rFmqf); try { file_put_contents(base_path('.env'), $rFmqf); return Response::json(0, L('Operate Success'), null, '[js]parent.location.href="' . $XVT8B . '"'); } catch (\Exception $SXS9c) { return Response::jsonError(L('No Permission')); } }); } goto XgLT0; XgLT0: return $BcS7S->pageTitle(L('Change Admin Url'))->body($u4AHU); goto vvLk6; gg4fU: $u4AHU = new Form(DynamicModel::class); goto PIOnt; PIOnt: $u4AHU->text('oldPath', L('Current Path'))->rules('required')->value(config('env.ADMIN_PATH', '/admin/'))->readonly(true); goto pRhTm; pRhTm: $u4AHU->text('newPath', L('New Path'))->rules('required')->value('/admin_' . RandomUtil::lowerReadableString(6) . '/'); goto Yp3su; Yp3su: $u4AHU->showSubmit(false)->showReset(false); goto ARHcp; vvLk6: } goto eJXEY; zB95R: $bOB5d = $H2Do2->getTrimString('type'); goto CJV8o; r2nri: AdminPermission::permitCheck('SystemManage'); goto TtYcj; TtYcj: $H2Do2 = InputPackage::buildFromInput(); goto zB95R; eJXEY: return Response::sendError('Unknown Type'); goto TM10L; TM10L: } }