From 4b7d34fc4f86f8b06f4f6c8a1ee9d530df77a04b Mon Sep 17 00:00:00 2001 From: WispX <1591788658@qq.com> Date: Wed, 8 Jan 2020 11:08:44 +0800 Subject: [PATCH] :arrow_up: Upgrading dependencies. --- .env.example | 3 +++ application/index/controller/Upload.php | 27 +++++++++---------------- application/index/view/index/index.html | 8 -------- config/naming.php | 12 ----------- config/site.php | 2 +- 5 files changed, 13 insertions(+), 39 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..917da860 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +[app] +debug = false +trace = false diff --git a/application/index/controller/Upload.php b/application/index/controller/Upload.php index abce7c8b..60485bcb 100755 --- a/application/index/controller/Upload.php +++ b/application/index/controller/Upload.php @@ -209,29 +209,20 @@ class Upload extends Base $naming = Config::pull('naming'); $pathRule = $this->config['path_naming_rule']; $fileRule = $this->config['file_naming_rule']; - - if ($pathRule === '{input}') { - $path = trim(input('album'), '/'); - } elseif ($pathRule === '{input_with_user}') { - $path = trim($this->user->username . '/' . input('album'), '/'); - } else { - $path = trim(str_replace( - array_column($naming['path'], 'name'), - array_column($naming['path'], 'value'), - $pathRule - ), '/'); - } - + $path = trim(str_replace( + array_column($naming['path'], 'name'), + array_column($naming['path'], 'value'), + $pathRule + ), '/'); if ($fileRule === '{original}') { $file = $name; } else { $file = trim(str_replace( - array_column($naming['file'], 'name'), - array_column($naming['file'], 'value'), - $fileRule - ), '/') . '.' . get_file_ext($name); + array_column($naming['file'], 'name'), + array_column($naming['file'], 'value'), + $fileRule + ), '/') . '.' . get_file_ext($name); } - return $path . '/' . $file; } } diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html index e78c5920..1209cc3f 100755 --- a/application/index/view/index/index.html +++ b/application/index/view/index/index.html @@ -24,8 +24,6 @@
-
-
@@ -102,12 +100,6 @@ //browseClass: "btn btn-file", maxFileSize: "{$config.upload_max_size / 1024}",// kb maxFileCount: "{$config.upload_single_num}", - uploadExtraData: function(previewId, index) { - var data = { - album : $('#album').val(), - }; - return data; - }, showCaption: true, dropZoneEnabled: true, browseIcon: " ", diff --git a/config/naming.php b/config/naming.php index 3fe11ad9..366339a9 100755 --- a/config/naming.php +++ b/config/naming.php @@ -87,18 +87,6 @@ return [ 'explain' => '16位随机字符串', 'value' => str_rand(), ], - [ - 'name' => '{input}', - 'example' => 'life、宠物', - 'explain' => '上传到相册名字,上传时由用户输入指定,比如上传时输入 life,则会上传到 path-store/life/文件夹下', - 'value' => $md5, - ], - [ - 'name' => '{input_with_user}', - 'example' => 'life、宠物', - 'explain' => '上传到相册名字,上传时由用户输入指定,路径带有当前用户名前缀,比如上传时输入 life,则会上传到: path-store/username/life/文件夹下', - 'value' => $md5, - ], ], 'file' => [ [ diff --git a/config/site.php b/config/site.php index 469f3670..d00e5b99 100644 --- a/config/site.php +++ b/config/site.php @@ -7,6 +7,6 @@ */ return [ - // 色情图片是否直接拦截 + // 违规图片是否直接拦截 'intercept_salacity' => false, ];