From 7b000b0ebf988a0049205cc4b9e0228b4f54d6a3 Mon Sep 17 00:00:00 2001 From: icret Date: Sun, 5 Feb 2023 02:45:00 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=E6=89=8B=E5=8A=A8=E5=8E=8B=E7=BC=A9=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +- admin/admin.inc.php | 166 ++++++++++++++++++++------------------- api/index.php | 20 ++--- application/function.php | 23 ++++-- application/upload.php | 30 +++---- config/config.php | 2 +- 6 files changed, 134 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index a2010df..c75edf3 100755 --- a/README.md +++ b/README.md @@ -229,8 +229,11 @@ $HTTP["url"] =~ "^/(i|public)/" { ## 更新日志
点击查看2.0版更新日志 +* 2023-02-05 v2.7.2 +- 修复设置中手动压缩失败! +- 优化排版 -* 2023-02-04 v2.7.2 +* 2023-02-05 v2.7.2 - 增加删除单条历史上传记录 - 增加 [web-indexr](https://github.com/rehiy/web-indexr) 文件管理, 正在实验中 - - 作为 [Tinyfilemanager](https://github.com/prasathmani/tinyfilemanager) 的替代品 更轻量化 简单化 @@ -241,7 +244,7 @@ $HTTP["url"] =~ "^/(i|public)/" { * 2023-02-01 v2.7.1 - 更新版本号 -* 2023-02-01 v2.7.0 dev +* 2023-02-01 v2.7.0 - 增加限制游客上传 - 增加上传历史记录 - 增加粘贴上传状态 diff --git a/admin/admin.inc.php b/admin/admin.inc.php index 1b48fe6..15524e8 100755 --- a/admin/admin.inc.php +++ b/admin/admin.inc.php @@ -153,7 +153,7 @@ if (isset($_POST['uploader_form'])) { type: "danger", // 定义颜色主题 icon: "exclamation-sign" // 定义消息图标 }).show(); - + '; exit(header("refresh:1;")); } @@ -300,19 +300,19 @@ if (isset($_POST['del_version_file'])) {
- +
- +
- +
- +
@@ -354,11 +354,11 @@ if (isset($_POST['del_version_file'])) {
- +
- +
- +
- @@ -386,7 +386,7 @@ if (isset($_POST['del_version_file'])) {
- @@ -461,20 +461,26 @@ if (isset($_POST['del_version_file'])) {
-
-
压缩文件夹
- +
压缩文件夹
+
+
+ +
-
- +
+
+ +
+
+ +
-
- +
+
+
+
+
-
-
-
-
@@ -482,25 +488,25 @@ if (isset($_POST['del_version_file'])) {
- + " placeholder="隐藏的保存">
- +
- +
" placeholder="隐藏的保存"> - +

API调用地址: /api/index.php

@@ -509,33 +515,33 @@ if (isset($_POST['del_version_file'])) {
- +
- +
- +
+
+
清理缓存 已缓存:
+
+ +
+
上传日志 需要开启上传日志
- +
- -
-
-
-
清理缓存 已缓存:
-
- +
@@ -543,32 +549,32 @@ if (isset($_POST['del_version_file'])) {
缩略图
-
+
- 生成模式 -
-
+
- - - px - - - px + + + px + + + px
- +
@@ -576,7 +582,7 @@ if (isset($_POST['del_version_file'])) { >
- +
@@ -777,7 +783,7 @@ if (isset($_POST['del_version_file'])) {
游客上传限制 - +
@@ -785,8 +791,8 @@ if (isset($_POST['del_version_file'])) {
- 图片鉴黄 - @@ -1000,14 +1006,14 @@ if (isset($_POST['del_version_file'])) {
-
- @@ -1023,7 +1029,7 @@ if (isset($_POST['del_version_file'])) {
- +
@@ -1033,7 +1039,7 @@ if (isset($_POST['del_version_file'])) {
- +
@@ -1049,21 +1055,21 @@ if (isset($_POST['del_version_file'])) {
- +
- + - +
-
+
" placeholder="隐藏的保存"> - +
@@ -1082,27 +1088,27 @@ if (isset($_POST['del_version_file'])) {
- - + +
- + - +
- 有效期 - - + 有效期 + +
" placeholder="隐藏的保存"> - +
@@ -1118,7 +1124,7 @@ if (isset($_POST['del_version_file'])) {
* 开启用户分离后删除上传按钮激活, 删除后不可恢复
@@ -1129,13 +1135,13 @@ if (isset($_POST['del_version_file'])) {
源图保护Key * 设定后请勿更改,否则所有加密链接失效
- +
" placeholder="隐藏的保存"> - +
@@ -1193,7 +1199,7 @@ if (isset($_POST['del_version_file'])) {
- @@ -1201,7 +1207,7 @@ if (isset($_POST['del_version_file'])) {
- @@ -1218,21 +1224,21 @@ if (isset($_POST['del_version_file'])) {
- +
- +
- +
- +
@@ -1257,11 +1263,11 @@ if (isset($_POST['del_version_file'])) {
- +
- +
diff --git a/api/index.php b/api/index.php index 001788d..a2d30d3 100755 --- a/api/index.php +++ b/api/index.php @@ -188,29 +188,29 @@ if ($handle->uploaded) { /** 后续处理 */ // 使用fastcgi_finish_request操作 - if (function_exists('fastcgi_finish_request')) { + if (function_exists('fastcgi_finish_request')) { // fastcgi_finish_request 模式 fastcgi_finish_request(); + // 记录同IP上传次数 + @ip_upload_counts(); + // 上传日志 + if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size, $tokenID); // 鉴黄 @process_checkImg($processUrl); - // 日志 - if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size, $tokenID); // 水印 @water($handle->file_dst_pathname); // 压缩 - @compress($handle->file_dst_pathname); + @process_compress($handle->file_dst_pathname); + } else { // 普通模式 // 记录同IP上传次数 @ip_upload_counts(); - } else { + // 上传日志 + if ($config['upload_logs']) write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size, $tokenID); // 鉴黄 @process_checkImg($processUrl); - // 日志 - if ($config['upload_logs']) write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size, $tokenID); // 水印 @water($handle->file_dst_pathname); // 压缩 - @compress($handle->file_dst_pathname); - // 记录同IP上传次数 - @ip_upload_counts(); + @process_compress($handle->file_dst_pathname); } unset($handle); diff --git a/application/function.php b/application/function.php index a284f1a..b11527b 100755 --- a/application/function.php +++ b/application/function.php @@ -1518,12 +1518,14 @@ function get_current_version($file = '/admin/version.php') return 'file does not exist'; } -// 压缩图片与图片鉴黄 -function compress($absolutePath) +/** + * 压缩图片 process 模式 + * @param String $absolutePath 图片绝对路径 + */ +function process_compress($absolutePath) { global $config; - // 压缩图片 后压缩模式,不影响前台输出速度 if ($config['compress']) { if (!is_Gif_Webp_Animated($absolutePath)) { require_once __DIR__ . '/compress/Imagick/class.Imgcompress.php'; @@ -1537,7 +1539,10 @@ function compress($absolutePath) } } -// 设置水印 +/** + * 设置水印 process 模式 + * @param String $source 图片路径 + */ function water($source) { global $config; @@ -1577,11 +1582,14 @@ function water($source) } } } - +/** + * 图片违规检查 process + * @param String $imgurl 图片链接 + */ function process_checkImg($imgurl) { global $config; - // 图片违规检查 + if ($config['checkImg'] == 1) { checkImg($imgurl, 1); } @@ -1666,6 +1674,7 @@ function write_log($filePath, $sourceName, $absolutePath, $fileSize, $from = "we /** * IP地址查询 + * @param int $ip IP地址 */ function ip2region(String $IP) { @@ -1705,7 +1714,7 @@ function ip2region(String $IP) } /** - * 记录同IP每日上传次数 + * 记录同IP每日上传次数 process */ function ip_upload_counts() { diff --git a/application/upload.php b/application/upload.php index 74dbda6..9017e59 100755 --- a/application/upload.php +++ b/application/upload.php @@ -208,29 +208,31 @@ if ($handle->uploaded) { /** 后续处理 */ // 使用fastcgi_finish_request操作 - if (function_exists('fastcgi_finish_request')) { + if (function_exists('fastcgi_finish_request')) { // fastcgi_finish_request 模式 fastcgi_finish_request(); - // 普通模式鉴黄 + // 同IP上传日志 + @ip_upload_counts(); + // 日志 + if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size); + // 鉴黄 @process_checkImg($processUrl); // 日志 if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size); - // 水印 - @water($handle->file_dst_pathname); - // 压缩 - @compress($handle->file_dst_pathname); - // 记录同IP上传次数 - @ip_upload_counts(); - } else { - // 普通模式鉴黄 - @process_checkImg($processUrl); - // 日志 - if ($config['upload_logs']) write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size); // 水印 @water($handle->file_dst_pathname); // 压缩 - @compress($handle->file_dst_pathname); + @ip_upload_counts(); + } else { // 普通模式 // 记录同IP上传次数 @ip_upload_counts(); + // 日志 + if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size); + // 鉴黄 + @process_checkImg($processUrl); + // 水印 + @water($handle->file_dst_pathname); + // 压缩 + @process_compress($handle->file_dst_pathname); } unset($handle); diff --git a/config/config.php b/config/config.php index d0d1cac..c5d4323 100755 --- a/config/config.php +++ b/config/config.php @@ -115,7 +115,7 @@ $config=Array 'guest_path_status'=>0, 'token_path_status'=>0, 'admin_path'=>'u', - 'update'=>'2023-02-05 00:34:20', + 'update'=>'2023-02-05 02:23:46', 'footer'=>'© Since 2018 EasyImage DMCA