<?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 lg34r; uK48x: if (0 != $Lhh0b) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " view:clear ExitCode({$Lhh0b})"); } goto KxSZ_; lg34r: AdminPermission::demoCheck(); goto Skqj8; GQhSw: return Response::jsonSuccess(L('Operate Success')); goto MmZeF; IwFrH: if (0 != $Lhh0b) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " cache:clear ExitCode({$Lhh0b})"); } goto Kix8N; Skqj8: AdminPermission::permitCheck('SystemManage'); goto SydtQ; ljpDt: $Lhh0b = Artisan::call('cache:clear'); goto IwFrH; KxSZ_: ModStart::clearCache(); goto GQhSw; SydtQ: Admin::addInfoLog(Admin::id(), L('Clear Cache')); goto ljpDt; Kix8N: $Lhh0b = Artisan::call('view:clear'); goto uK48x; MmZeF: } public function securityFix(AdminDialogPage $z5B9p) { goto l2t92; T2izE: $Zxpx_ = InputPackage::buildFromInput(); goto D6hYb; Sr2ZX: switch ($XcezL) { case 'installLock': goto wHIFv; cDvAO: return Response::json(0, L('Operate Success'), null, '[reload]'); goto BJLKA; wHIFv: AdminPermission::demoCheck(); goto oD3bA; XDSsO: if (!file_exists(storage_path('install.lock'))) { return Response::json(-1, L('Operate Failed')); } goto cDvAO; oD3bA: if (!file_exists(storage_path('install.lock'))) { file_put_contents(storage_path('install.lock'), 'ok'); } goto XDSsO; BJLKA: case 'installScript': goto gb24u; ewSyp: if (file_exists(public_path('install.php'))) { @unlink(public_path('install.php')); } goto V0JIV; gb24u: AdminPermission::demoCheck(); goto ewSyp; V0JIV: if (file_exists(public_path('install.php'))) { return Response::json(-1, L('Operate Failed')); } goto SSntm; SSntm: return Response::json(0, L('Operate Success'), null, '[reload]'); goto Euq4m; Euq4m: case 'appDebug': goto Fkf9Q; qKvM9: return Response::json(0, L('Operate Success'), null, '[reload]'); goto qIxkK; Fkf9Q: AdminPermission::demoCheck(); goto pSKsQ; pSKsQ: $DTnPC = file_get_contents(base_path('.env')); goto hhlsP; hhlsP: $DTnPC = preg_replace('/APP_DEBUG\\s*=\\s*true/', 'APP_DEBUG=false', $DTnPC); goto szZHJ; szZHJ: file_put_contents(base_path('.env'), $DTnPC); goto qKvM9; qIxkK: case 'adminPath': goto O92VO; Fpn0k: if (Request::isPost()) { return $tzSkY->formRequest(function (Form $tzSkY) { AdminPermission::demoCheck(); $OTBPk = $tzSkY->dataForming(); $krtOR = $OTBPk['newPath']; if (!Str::startsWith($krtOR, '/') || !Str::endsWith($krtOR, '/')) { return Response::generateError(L('Url must start with / and end with /')); } if (!preg_match('/^\\/[a-zA-Z0-9_]+\\/$/', $krtOR)) { return Response::generateError(L('Admin url only contains a-zA-Z0-9_')); } $DTnPC = file_get_contents(base_path('.env')); $DTnPC = preg_replace('/ADMIN_PATH\\s*=\\s*.*?\\n/', "ADMIN_PATH={$krtOR}\n", $DTnPC); try { file_put_contents(base_path('.env'), $DTnPC); return Response::json(0, L('Operate Success'), null, '[js]parent.location.href="' . $krtOR . '"'); } catch (\Exception $Y5fnH) { return Response::jsonError(L('No Permission')); } }); } goto ad4dN; O92VO: $tzSkY = new Form(DynamicModel::class); goto u3q7X; mHrw3: $tzSkY->showSubmit(false)->showReset(false); goto Fpn0k; ad4dN: return $z5B9p->pageTitle(L('Change Admin Url'))->body($tzSkY); goto Gk0Vz; u3q7X: $tzSkY->text('oldPath', L('Current Path'))->rules('required')->value(config('env.ADMIN_PATH', '/admin/'))->readonly(true); goto z3nhm; z3nhm: $tzSkY->text('newPath', L('New Path'))->rules('required')->value('/admin_' . RandomUtil::lowerReadableString(6) . '/'); goto mHrw3; Gk0Vz: } goto Qq2n8; Qq2n8: return Response::sendError('Unknown Type'); goto Bc002; l2t92: AdminPermission::permitCheck('SystemManage'); goto T2izE; D6hYb: $XcezL = $Zxpx_->getTrimString('type'); goto Sr2ZX; Bc002: } }