From 75141e192dda29bd4b2c2940f29764b297f675f2 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 5 Aug 2021 16:03:24 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3huamn=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=A0=BC=E5=BC=8F=E6=9C=AA=E6=9D=A5=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/lang/zh-cn.php | 7 +++++++ extend/fast/Date.php | 28 ++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 2d537adb..337a38a5 100755 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -114,6 +114,13 @@ return [ '%d week%s ago' => '%d周前', '%d month%s ago' => '%d月前', '%d year%s ago' => '%d年前', + '%d second%s after' => '%d秒后', + '%d minute%s after' => '%d分钟后', + '%d hour%s after' => '%d小时后', + '%d day%s after' => '%d天后', + '%d week%s after' => '%d周后', + '%d month%s after' => '%d月后', + '%d year%s after' => '%d年后', 'Set to normal' => '设为正常', 'Set to hidden' => '设为隐藏', 'Recycle bin' => '回收站', diff --git a/extend/fast/Date.php b/extend/fast/Date.php index c4e4c312..2b4ad62d 100644 --- a/extend/fast/Date.php +++ b/extend/fast/Date.php @@ -124,25 +124,29 @@ class Date */ public static function human($remote, $local = null) { - $timediff = (is_null($local) || $local ? time() : $local) - $remote; - $chunks = array( - array(60 * 60 * 24 * 365, 'year'), - array(60 * 60 * 24 * 30, 'month'), - array(60 * 60 * 24 * 7, 'week'), - array(60 * 60 * 24, 'day'), - array(60 * 60, 'hour'), - array(60, 'minute'), - array(1, 'second') - ); + $time_diff = (is_null($local) || $local ? time() : $local) - $remote; + $tense = $time_diff < 0 ? 'after' : 'ago'; + $time_diff = abs($time_diff); + $chunks = [ + [60 * 60 * 24 * 365, 'year'], + [60 * 60 * 24 * 30, 'month'], + [60 * 60 * 24 * 7, 'week'], + [60 * 60 * 24, 'day'], + [60 * 60, 'hour'], + [60, 'minute'], + [1, 'second'] + ]; + $name = 'second'; + $count = 0; for ($i = 0, $j = count($chunks); $i < $j; $i++) { $seconds = $chunks[$i][0]; $name = $chunks[$i][1]; - if (($count = floor($timediff / $seconds)) != 0) { + if (($count = floor($time_diff / $seconds)) != 0) { break; } } - return __("%d {$name}%s ago", $count, ($count > 1 ? 's' : '')); + return __("%d $name%s $tense", $count, ($count > 1 ? 's' : '')); } /** From 3f1cac43e4e31e968ff44fa18c58394ba33ba6cb Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 5 Aug 2021 16:23:57 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=86=E7=A0=81=E7=B1=BB=E5=9E=8B=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/lang/zh-cn/general/config.php | 1 + application/admin/view/general/config/index.html | 3 +++ application/common/model/Config.php | 1 + 3 files changed, 5 insertions(+) diff --git a/application/admin/lang/zh-cn/general/config.php b/application/admin/lang/zh-cn/general/config.php index 6a2b95d6..b21ef4e4 100644 --- a/application/admin/lang/zh-cn/general/config.php +++ b/application/admin/lang/zh-cn/general/config.php @@ -15,6 +15,7 @@ return [ 'Example' => '示例分组', 'Extend' => '扩展属性', 'String' => '字符', + 'Password' => '密码', 'Text' => '文本', 'Editor' => '编辑器', 'Number' => '数字', diff --git a/application/admin/view/general/config/index.html b/application/admin/view/general/config/index.html index 14e16e23..b0faf30f 100644 --- a/application/admin/view/general/config/index.html +++ b/application/admin/view/general/config/index.html @@ -71,6 +71,9 @@ {case string} {/case} + {case password} + + {/case} {case text} {/case} diff --git a/application/common/model/Config.php b/application/common/model/Config.php index 050a6ad7..195506bf 100644 --- a/application/common/model/Config.php +++ b/application/common/model/Config.php @@ -33,6 +33,7 @@ class Config extends Model { $typeList = [ 'string' => __('String'), + 'password' => __('Password'), 'text' => __('Text'), 'editor' => __('Editor'), 'number' => __('Number'), From 683d837d2077f95f1082c4dfdf6f8db16fcb90d9 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 5 Aug 2021 16:45:49 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=86=E7=A0=81=E7=B1=BB=E5=9E=8B=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/addon/config.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/admin/view/addon/config.html b/application/admin/view/addon/config.html index ca91c775..2ea47f39 100644 --- a/application/admin/view/addon/config.html +++ b/application/admin/view/addon/config.html @@ -23,6 +23,9 @@ {case string} {/case} + {case password} + + {/case} {case text} {/case} From 9cf930a9324008072b4405b82aedbb7616e47975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=81=E9=BE=8D?= <695798354@qq.com> Date: Tue, 24 Aug 2021 06:48:39 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E6=A0=BCBETWEEN?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=20=E5=80=BC=E4=B8=BA0=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=AD=9B=E9=80=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Backend.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index d25f7b59..b680b5a6 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -362,7 +362,9 @@ class Backend extends Controller case 'BETWEEN': case 'NOT BETWEEN': $arr = array_slice(explode(',', $v), 0, 2); - if (stripos($v, ',') === false || !array_filter($arr)) { + if (stripos($v, ',') === false || !array_filter($arr, function($v){ + return $v != '' && $v !== false && $v !== null; + })) { continue 2; } //当出现一边为空时改变操作符 From 3a0352e183fdf2b4fe7183b3545239b93d29e1ca Mon Sep 17 00:00:00 2001 From: T2cc <404094862@qq.com> Date: Fri, 10 Sep 2021 01:44:42 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E7=A7=B0=E4=B8=BA=E4=B8=AD=E6=96=87=E6=97=B6?= =?UTF-8?q?=E6=88=AA=E6=96=AD=E5=AF=BC=E8=87=B4=E7=9A=84=E4=B9=B1=E7=A0=81?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/common/library/Upload.php b/application/common/library/Upload.php index 66afc1dc..bbc2446c 100644 --- a/application/common/library/Upload.php +++ b/application/common/library/Upload.php @@ -358,7 +358,7 @@ class Upload $params = array( 'admin_id' => (int)session('admin.id'), 'user_id' => (int)$auth->id, - 'filename' => substr(htmlspecialchars(strip_tags($this->fileInfo['name'])), 0, 100), + 'filename' => mb_substr(htmlspecialchars(strip_tags($this->fileInfo['name'])), 0, 100), 'category' => $category, 'filesize' => $this->fileInfo['size'], 'imagewidth' => $this->fileInfo['imagewidth'], From e7ae8fb4d18b3a4582fa5d7bed772c7811b29bb5 Mon Sep 17 00:00:00 2001 From: simon429 <1095568674@qq.com> Date: Fri, 1 Oct 2021 23:22:54 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=85=B3=E9=97=AD=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=97=B6=EF=BC=8C=E6=8A=A5=E9=94=99=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=A1=B5=E9=93=BE=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/index/controller/User.php b/application/index/controller/User.php index 112a1f9f..098bdffa 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -28,7 +28,7 @@ class User extends Frontend $auth = $this->auth; if (!Config::get('fastadmin.usercenter')) { - $this->error(__('User center already closed')); + $this->error(__('User center already closed'), '/'); } //监听注册登录退出的事件