Browse Source

Merge branch 'develop' of gitee.com:karson/fastadmin into develop

Karson 4 years ago
parent
commit
9d1d1248e9

+ 7 - 0
application/admin/lang/zh-cn.php

@@ -114,6 +114,13 @@ return [
     '%d week%s ago'                                         => '%d周前',
     '%d week%s ago'                                         => '%d周前',
     '%d month%s ago'                                        => '%d月前',
     '%d month%s ago'                                        => '%d月前',
     '%d year%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 normal'                                         => '设为正常',
     'Set to hidden'                                         => '设为隐藏',
     'Set to hidden'                                         => '设为隐藏',
     'Recycle bin'                                           => '回收站',
     'Recycle bin'                                           => '回收站',

+ 1 - 0
application/admin/lang/zh-cn/general/config.php

@@ -15,6 +15,7 @@ return [
     'Example'                     => '示例分组',
     'Example'                     => '示例分组',
     'Extend'                      => '扩展属性',
     'Extend'                      => '扩展属性',
     'String'                      => '字符',
     'String'                      => '字符',
+    'Password'                    => '密码',
     'Text'                        => '文本',
     'Text'                        => '文本',
     'Editor'                      => '编辑器',
     'Editor'                      => '编辑器',
     'Number'                      => '数字',
     'Number'                      => '数字',

+ 3 - 0
application/admin/view/addon/config.html

@@ -23,6 +23,9 @@
                         {case string}
                         {case string}
                         <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
                         <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
                         {/case}
                         {/case}
+                        {case password}
+                        <input {$item.extend} type="password" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
+                        {/case}
                         {case text}
                         {case text}
                         <textarea {$item.extend} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
                         <textarea {$item.extend} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
                         {/case}
                         {/case}

+ 3 - 0
application/admin/view/general/config/index.html

@@ -71,6 +71,9 @@
                                             {case string}
                                             {case string}
                                             <input {$item.extend_html} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
                                             <input {$item.extend_html} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
                                             {/case}
                                             {/case}
+                                            {case password}
+                                            <input {$item.extend_html} type="password" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
+                                            {/case}
                                             {case text}
                                             {case text}
                                             <textarea {$item.extend_html} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
                                             <textarea {$item.extend_html} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
                                             {/case}
                                             {/case}

+ 3 - 1
application/common/controller/Backend.php

@@ -362,7 +362,9 @@ class Backend extends Controller
                 case 'BETWEEN':
                 case 'BETWEEN':
                 case 'NOT BETWEEN':
                 case 'NOT BETWEEN':
                     $arr = array_slice(explode(',', $v), 0, 2);
                     $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;
                         continue 2;
                     }
                     }
                     //当出现一边为空时改变操作符
                     //当出现一边为空时改变操作符

+ 1 - 1
application/common/library/Upload.php

@@ -362,7 +362,7 @@ class Upload
         $params = array(
         $params = array(
             'admin_id'    => (int)session('admin.id'),
             'admin_id'    => (int)session('admin.id'),
             'user_id'     => (int)$auth->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,
             'category'    => $category,
             'filesize'    => $this->fileInfo['size'],
             'filesize'    => $this->fileInfo['size'],
             'imagewidth'  => $this->fileInfo['imagewidth'],
             'imagewidth'  => $this->fileInfo['imagewidth'],

+ 1 - 0
application/common/model/Config.php

@@ -33,6 +33,7 @@ class Config extends Model
     {
     {
         $typeList = [
         $typeList = [
             'string'        => __('String'),
             'string'        => __('String'),
+            'password'      => __('Password'),
             'text'          => __('Text'),
             'text'          => __('Text'),
             'editor'        => __('Editor'),
             'editor'        => __('Editor'),
             'number'        => __('Number'),
             'number'        => __('Number'),

+ 1 - 1
application/index/controller/User.php

@@ -28,7 +28,7 @@ class User extends Frontend
         $auth = $this->auth;
         $auth = $this->auth;
 
 
         if (!Config::get('fastadmin.usercenter')) {
         if (!Config::get('fastadmin.usercenter')) {
-            $this->error(__('User center already closed'));
+            $this->error(__('User center already closed'), '/');
         }
         }
 
 
         //监听注册登录退出的事件
         //监听注册登录退出的事件

+ 16 - 12
extend/fast/Date.php

@@ -124,25 +124,29 @@ class Date
      */
      */
     public static function human($remote, $local = null)
     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++) {
         for ($i = 0, $j = count($chunks); $i < $j; $i++) {
             $seconds = $chunks[$i][0];
             $seconds = $chunks[$i][0];
             $name = $chunks[$i][1];
             $name = $chunks[$i][1];
-            if (($count = floor($timediff / $seconds)) != 0) {
+            if (($count = floor($time_diff / $seconds)) != 0) {
                 break;
                 break;
             }
             }
         }
         }
-        return __("%d {$name}%s ago", $count, ($count > 1 ? 's' : ''));
+        return __("%d $name%s $tense", $count, ($count > 1 ? 's' : ''));
     }
     }
 
 
     /**
     /**