<?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 mgKCY; iBB96: if (0 != $fGOaN) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " cache:clear ExitCode({$fGOaN})"); } goto Fa1Ol; iH0KL: ModStart::clearCache(); goto CB25J; P_A1j: if (0 != $fGOaN) { return Response::send(-1, L('Clear Cache') . ' ' . L('Error') . " view:clear ExitCode({$fGOaN})"); } goto iH0KL; M3SsR: AdminPermission::permitCheck('SystemManage'); goto FbxOv; FbxOv: Admin::addInfoLog(Admin::id(), L('Clear Cache')); goto j4e6h; Fa1Ol: $fGOaN = Artisan::call('view:clear'); goto P_A1j; mgKCY: AdminPermission::demoCheck(); goto M3SsR; j4e6h: $fGOaN = Artisan::call('cache:clear'); goto iBB96; CB25J: return Response::jsonSuccess(L('Operate Success')); goto F1xQI; F1xQI: } public function securityFix(AdminDialogPage $FGtwZ) { goto CXSBb; W9q58: switch ($aHcWY) { case 'installLock': goto PfRiN; PfRiN: AdminPermission::demoCheck(); goto SSmNI; EJMm8: if (!file_exists(storage_path('install.lock'))) { return Response::json(-1, L('Operate Failed')); } goto DKjmY; DKjmY: return Response::json(0, L('Operate Success'), null, '[reload]'); goto d7r5h; SSmNI: if (!file_exists(storage_path('install.lock'))) { file_put_contents(storage_path('install.lock'), 'ok'); } goto EJMm8; d7r5h: case 'installScript': goto X0E9A; X0E9A: AdminPermission::demoCheck(); goto v5eYs; v5eYs: if (file_exists(public_path('install.php'))) { @unlink(public_path('install.php')); } goto U7Mom; W4mlI: return Response::json(0, L('Operate Success'), null, '[reload]'); goto Af3Z2; U7Mom: if (file_exists(public_path('install.php'))) { return Response::json(-1, L('Operate Failed')); } goto W4mlI; Af3Z2: case 'appDebug': goto vxo9T; d6mBl: file_put_contents(base_path('.env'), $Afv_G); goto c0jgM; zDZkg: $Afv_G = file_get_contents(base_path('.env')); goto LKwip; c0jgM: return Response::json(0, L('Operate Success'), null, '[reload]'); goto ZECg5; vxo9T: AdminPermission::demoCheck(); goto zDZkg; LKwip: $Afv_G = preg_replace('/APP_DEBUG\\s*=\\s*true/', 'APP_DEBUG=false', $Afv_G); goto d6mBl; ZECg5: case 'adminPath': goto W3q8K; RzYtq: $aDbJm->text('oldPath', L('Current Path'))->rules('required')->value(config('env.ADMIN_PATH', '/admin/'))->readonly(true); goto lI5tB; fmyWU: return $FGtwZ->pageTitle(L('Change Admin Url'))->body($aDbJm); goto wWfA8; lI5tB: $aDbJm->text('newPath', L('New Path'))->rules('required')->value('/admin_' . RandomUtil::lowerReadableString(6) . '/'); goto t8B0c; W3q8K: $aDbJm = new Form(DynamicModel::class); goto RzYtq; vdeY2: if (Request::isPost()) { return $aDbJm->formRequest(function (Form $aDbJm) { AdminPermission::demoCheck(); $CnWtd = $aDbJm->dataForming(); $pVGEp = $CnWtd['newPath']; if (!Str::startsWith($pVGEp, '/') || !Str::endsWith($pVGEp, '/')) { return Response::generateError(L('Url must start with / and end with /')); } if (!preg_match('/^\\/[a-zA-Z0-9_]+\\/$/', $pVGEp)) { return Response::generateError(L('Admin url only contains a-zA-Z0-9_')); } $Afv_G = file_get_contents(base_path('.env')); $Afv_G = preg_replace('/ADMIN_PATH\\s*=\\s*.*?\\n/', "ADMIN_PATH={$pVGEp}\n", $Afv_G); try { file_put_contents(base_path('.env'), $Afv_G); return Response::json(0, L('Operate Success'), null, '[js]parent.location.href="' . $pVGEp . '"'); } catch (\Exception $WVwSN) { return Response::jsonError(L('No Permission')); } }); } goto fmyWU; t8B0c: $aDbJm->showSubmit(false)->showReset(false); goto vdeY2; wWfA8: } goto VsXxN; bft7b: $kFc4w = InputPackage::buildFromInput(); goto ASpSU; ASpSU: $aHcWY = $kFc4w->getTrimString('type'); goto W9q58; VsXxN: return Response::sendError('Unknown Type'); goto ZnDi4; CXSBb: AdminPermission::permitCheck('SystemManage'); goto bft7b; ZnDi4: } }