From ad85fa7c2292d9092241c84a3ce31bf681208869 Mon Sep 17 00:00:00 2001 From: net909 Date: Fri, 26 Apr 2024 23:16:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Auth.php | 5 +- app/controller/Index.php | 2 +- app/lib/dns/dnsla.php | 3 + app/view/domain/domain.html | 5 + app/view/exception.tpl | 502 ++++++++++++++++++++++++++++++++++++ config/app.php | 3 +- 6 files changed, 517 insertions(+), 3 deletions(-) create mode 100644 app/view/exception.tpl diff --git a/app/controller/Auth.php b/app/controller/Auth.php index 2341ea7..e744ad1 100644 --- a/app/controller/Auth.php +++ b/app/controller/Auth.php @@ -36,7 +36,7 @@ class Auth extends BaseController } if (file_exists($login_limit_file)) { $login_limit = unserialize(file_get_contents($login_limit_file)); - if ($login_limit['count'] >= $login_limit_count && $login_limit['time'] > time() - 86400) { + if ($login_limit['count'] >= $login_limit_count && $login_limit['time'] > time() - 7200) { exit(json_encode(['code' => -1, 'msg' => '多次登录失败,暂时禁止登录。可删除/runtime/@login.lock文件解除限制', 'vcode'=>1])); } } @@ -49,6 +49,9 @@ class Auth extends BaseController $expiretime = time()+2562000; $token = authcode("user\t{$user['id']}\t{$session}\t{$expiretime}", 'ENCODE', env('app.sys_key')); cookie('user_token', $token, ['expire' => $expiretime, 'httponly' => true]); + if (file_exists($login_limit_file)) { + unlink($login_limit_file); + } return json(['code'=>0]); }else{ if($user){ diff --git a/app/controller/Index.php b/app/controller/Index.php index 0c95680..a904d8f 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -72,7 +72,7 @@ class Index extends BaseController cookie('admin_skin', null); } config_set('admin_skin', $skin); - Cache::delete('configs'); + Cache::delete('configs'); }else{ cookie('admin_skin', $skin); } diff --git a/app/lib/dns/dnsla.php b/app/lib/dns/dnsla.php index 41025da..21dad00 100644 --- a/app/lib/dns/dnsla.php +++ b/app/lib/dns/dnsla.php @@ -196,6 +196,9 @@ class dnsla implements DnsInterface { } $response = $this->curl($method, $path, $header); } + if(!$response){ + return false; + } $arr=json_decode($response,true); if($arr){ if($arr['code'] == 200){ diff --git a/app/view/domain/domain.html b/app/view/domain/domain.html index db29a81..219d85c 100644 --- a/app/view/domain/domain.html +++ b/app/view/domain/domain.html @@ -357,5 +357,10 @@ function getDomainList(){ function loading(){ layer.load(2); } +document.addEventListener("visibilitychange", function() { + if (document.visibilityState === "visible") { + layer.closeAll(); + } +}); {/block} \ No newline at end of file diff --git a/app/view/exception.tpl b/app/view/exception.tpl new file mode 100644 index 0000000..72872ed --- /dev/null +++ b/app/view/exception.tpl @@ -0,0 +1,502 @@ +'.end($names).''; + } +} + +if (!function_exists('parse_file')) { + function parse_file($file, $line) + { + return ''.basename($file)." line {$line}".''; + } +} + +if (!function_exists('parse_args')) { + function parse_args($args) + { + $result = []; + foreach ($args as $key => $item) { + switch (true) { + case is_object($item): + $value = sprintf('object(%s)', parse_class(get_class($item))); + break; + case is_array($item): + if (count($item) > 3) { + $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); + } else { + $value = sprintf('[%s]', parse_args($item)); + } + break; + case is_string($item): + if (strlen($item) > 20) { + $value = sprintf( + '\'%s...\'', + htmlentities($item), + htmlentities(substr($item, 0, 20)) + ); + } else { + $value = sprintf("'%s'", htmlentities($item)); + } + break; + case is_int($item): + case is_float($item): + $value = $item; + break; + case is_null($item): + $value = 'null'; + break; + case is_bool($item): + $value = '' . ($item ? 'true' : 'false') . ''; + break; + case is_resource($item): + $value = 'resource'; + break; + default: + $value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); + break; + } + + $result[] = is_int($key) ? $value : "'{$key}' => {$value}"; + } + + return implode(', ', $result); + } +} +if (!function_exists('echo_value')) { + function echo_value($val) + { + if (is_array($val) || is_object($val)) { + echo htmlentities(json_encode($val, JSON_PRETTY_PRINT)); + } elseif (is_bool($val)) { + echo $val ? 'true' : 'false'; + } elseif (is_scalar($val)) { + echo htmlentities($val); + } else { + echo 'Resource'; + } + } +} +?> + + + + + 系统发生错误 + + + + + + $trace) { ?> +
+
+
+
+

+
+

+
+
+ +
+
    $value) { ?>
  1. ">
+
+ +
+

Call Stack

+
    +
  1. + +
  2. + +
  3. + +
+
+
+ + +
+

+
+ + + +
+

Exception Datas

+ $value) { ?> + + + + + + + $val) { ?> + + + + + + + +
empty
+ +
+ + + +
+

Environment Variables

+ $value) { ?> + + + + + + + $val) { ?> + + + + + + + +
empty
+ +
+ + + + + + + + diff --git a/config/app.php b/config/app.php index 216bf42..c7d9e11 100644 --- a/config/app.php +++ b/config/app.php @@ -28,7 +28,8 @@ return [ // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => true, + 'exception_tmpl' => \think\facade\App::getAppPath() . 'view/exception.tpl', 'version' => '1004',