diff --git a/README.md b/README.md index d784aa2..9aa8333 100755 --- a/README.md +++ b/README.md @@ -103,9 +103,12 @@ $HTTP["url"] =~ "^/(i|public)/" {
点击查看2.0版更新日志 -* 2022-3-2 v2.5.5 +* 2022-3-4 v2.5.5 - 增加设置页面检测是否开启登录上传 - 将footer固定在底部 +- 移除function_API.php +- 修复TimThumb不支持bmp格式的bug +- 修复TimThumb不支持webp动态图片bug * 2022-2-29 v2.5.4 - 增加Token有效期 diff --git a/admin/admin.inc.php b/admin/admin.inc.php index 021af34..cfdc845 100755 --- a/admin/admin.inc.php +++ b/admin/admin.inc.php @@ -4,10 +4,8 @@ * 2022-1-24 05:57:35 */ -require_once __DIR__ . '/../application/function.php'; +require_once __DIR__ . '/../application/header.php'; require_once APP_ROOT . '/config/api_key.php'; -require_once APP_ROOT . '/api/function_API.php'; -require_once APP_ROOT . '/application/header.php'; require_once APP_ROOT . '/config/config.guest.php'; // 检查登录 @@ -86,7 +84,6 @@ if (isset($_GET['stop_token'])) { header("refresh:2;url=" . $config['domain'] . "/admin/admin.inc.php"); } - // 删除guset.config.php数组对 if (isset($_GET['delete_guest'])) { unset($guestConfig[$_GET['delete_guest']]); @@ -185,809 +182,807 @@ if (isset($_GET['recycle_reimg'])) { } } ?> -
-
-
- -
目录保存以 年/月/日/ 递进,非必要请勿修改! 否则会导致部分操作不可用;
-
本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途;
-
请为本人博客blog.png.cm加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如: 本人博客,邮箱等)。
- - - - 打赏作者 - 打赏作者 -
- -
-
-
-
- - +
+
+ +
目录保存以 年/月/日/ 递进,非必要请勿修改! 否则会导致部分操作不可用;
+
本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途;
+
请为本人博客blog.png.cm加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如: 本人博客,邮箱等)。
+ + + + 打赏作者 + 打赏作者 +
+ +
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + > +
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- - > - -
- -
-
-
- -
-
- id="thumbnail0"> -
-
- id="thumbnail1"> -
-
- id="thumbnail2"> -
-
-
- " placeholder="隐藏的保存"> -
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-

前端裁剪压缩 - 优点:服务器无压力 缺点:略增加用户端压力,仅支持JPG

-
-
- - > - -
-
-
- - -
-
- - -
-
-
- - > - -
-
-
-
- - > - -
-
-
- - -
-

后端压缩 - 优点:避免用户端欺骗,效果更好 缺点:增加服务器压力

-
-
- - data-toggle="tooltip" title=" 轻微有损压缩图片, 此压缩有可能使图片变大! 特别是小图片 也有一定概率改变图片方向"> - -
-
-
- - -
-
- " placeholder="隐藏的保存"> -
- -
-
-
-
-
-
- - > - -
-
-
- - -
-
-
- - > - -
-
-
- - -
-
- " placeholder="隐藏的保存"> -
- -
-
-
-
-

-
- - -
- -
-
-
- - -
- -
-
-
- - + +
+
+
+
- + id="thumbnail0">
- + id="thumbnail1">
-
-
-
- - -
-
-
外部KEY
-
-
- - - " placeholder="隐藏的保存"> -
-
- - -
-
- - +
+ id="thumbnail2">
+
+
" placeholder="隐藏的保存"> - - -
-
上传Token
- + + + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+

前端裁剪压缩 - 优点:服务器无压力 缺点:略增加用户端压力,仅支持JPG

+
+
+ + > + +
+
+
+ + +
+
+ + +
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+ + +
+

后端压缩 - 优点:避免用户端欺骗,效果更好 缺点:增加服务器压力

+
+
+ + data-toggle="tooltip" title=" 轻微有损压缩图片, 此压缩有可能使图片变大! 特别是小图片 也有一定概率改变图片方向"> + +
+
+
+ + +
+
+ " placeholder="隐藏的保存"> +
+ + +
+
+
+
+
+ + > + +
+
+
+ + +
+
+
+ + > + +
+
+
+ + +
+
+ " placeholder="隐藏的保存"> +
+ + +
+
+
+

+
+ + +
+ + +
+
+ + +
+ + +
+
+ + +
+
+ +
+
+ +
+
+
+
+ + +
+
+
外部KEY
+
+
+ + + " placeholder="隐藏的保存"> +
+
+ + +
+ + " placeholder="隐藏的保存"> + + +
+
上传Token
+
+ + + + + + + + + + + $value) : + $expired = $value['expired'] < time() ? '

已过期

' : '

' . date('Y年m月d日 H:i:s', $value['expired']) . '

'; + ?> + + + + + + + + +
ID列表添加时间有效期至禁用
禁用 +
+
+ +
+
+ +
+
+ + +
+
+ + + +
+ + +
+
+
+
+
+ +
+
+
+
+ + +
+
+ + + +
+
+ + + +
+
+
+ + > + +
+ + + +
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+ + + + + + + + + + +
+
+ " placeholder="隐藏的保存"> +
+ +
+
+
+
用户上传后自行删除的会显示在这个页面
+

为了访问速度,仅显示最近20张图片;图片回收需要在图床安全->图片回收中开启

+
+ - - - - - + + + + + - $value) : - $expired = $value['expired'] < time() ? '

已过期

' : '

' . date('Y年m月d日 H:i:s', $value['expired']) . '

'; + - + + + + + + + + +
ID列表添加时间有效期至禁用序号缩略图文件名文件大小文件操作
+ 新窗口 + 恢复 + 删除 +
+
+
+ + +
+
+
+

为了访问速度,仅显示最近20张图片;鉴黄需要在图床安全->图片鉴黄中开启

+

key申请地址: https://client.moderatecontent.com/

+

获得key后打开->API 设置->Moderate Key->填入

+
+ + + + + + + + + + + + + + + + + + + + + +
序号缩略图文件名文件大小文件操作
+ 新窗口 + 恢复 + 删除 +
+
+
+ + +
+
+
+
+
系统信息
+
+

操作系统: ' . php_uname() . ''; ?>

+

Web 服务:

+

服务器IP:

+

系统时间:

+

已用磁盘:

+

剩余磁盘:

+
PHP信息
+
+

PHP Version:

+

GD Version:

+

PHP最大上传:

+

POST最大上传:

+

PHP最长执行时间:

+

PHP允许占用内存:

+
我的信息
+
+

浏览器:

+

我的IP:

+
图床信息
+
+

+ + TinyPng Key
+ + TinyPng Key
+ + + moderatecontent key
+ + Moderatecontent Key
+ +

+

最新版本:

+

当前版本:

+
+
+
+
+
+ + +
+
+ + +
+
+
上传首选显示
+ + + + + +
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+
+ + > + +
+
+
+ + + + +
+
+ " placeholder="隐藏的保存"> +
+ +
+
+
+
+
管理员账号管理 | 不变就不要保存更改
+
+
+ + +
+
+ + + +
+
+
+ " placeholder="隐藏的保存"> +
+ +
+ +
+

直接输入账号和密码即可完成修改.

+

更改后会立即生效并重新登录,请务必牢记账号和密码!

+

如果忘记账号可以打开->/config/config.php文件->找到user对应的键值->填入

+

如果忘记密码请将密码->转换成MD5小写->转换网址->打开/config/config.php文件->找到password对应的键值->填入

+
+
+
+ +
+
+
上传者账号管理 | 开启登录上传后可添加
+
+
+ + +
+
+ + + +
+
+
+ " placeholder="隐藏的保存"> +
+ +
+ +
+

开启登录上传后,可以添加一些只能上传的账号.

+

更改后会立即生效并重新登录,请将账号和密码发给使用者.

+

上传用户的配置文件在config.guest.php

+

如果忘记密码请填入账号并填写新的密码即可更正密码 | 与更改管理 账号/密码不同!

+
+
+
+
当前所有上传者账号与密码 | 所有密码均经过MD5加密 | 账号guest的MD5为: 084e0343a0486ff05530df6c705c8bb4
+
+ + + + + + + + + + $value) : ?> + - - - +
登录账号登录密码删除密码
禁用 + 删除
-
- -
-
- -
-
- - -
-
- - - -
- - -
-
-
-
-
- -
-
-
-
- - -
-
- - - -
-
- - - -
-
-
- - > - -
- - - -
-
-
- - > - -
-
-
-
- - > - -
-
-
-
- - > - -
-
-
-
- - > - -
-
-
-
- - > - -
-
-
-
- - > - -
-
-
- - - - - - - - - - -
-
- " placeholder="隐藏的保存"> -
- -
-
-
-
用户上传后自行删除的会显示在这个页面
-

为了访问速度,仅显示最近20张图片;图片回收需要在图床安全->图片回收中开启

-
- - - - - - - - - - - - - - - - - - - - - -
序号缩略图文件名文件大小文件操作
- 新窗口 - 恢复 - 删除 -
-
-
- - -
-
-
-

为了访问速度,仅显示最近20张图片;鉴黄需要在图床安全->图片鉴黄中开启

-

key申请地址: https://client.moderatecontent.com/

-

获得key后打开->API 设置->Moderate Key->填入

-
- - - - - - - - - - - - - - - - - - - - - -
序号缩略图文件名文件大小文件操作
- 新窗口 - 恢复 - 删除 -
-
-
- - -
-
-
-
-
系统信息
-
-

操作系统: ' . php_uname() . ''; ?>

-

Web 服务:

-

服务器IP:

-

系统时间:

-

已用磁盘:

-

剩余磁盘:

-
PHP信息
-
-

PHP Version:

-

GD Version:

-

PHP最大上传:

-

POST最大上传:

-

PHP最长执行时间:

-

PHP允许占用内存:

-
我的信息
-
-

浏览器:

-

我的IP:

-
图床信息
-
-

- - TinyPng Key
- - TinyPng Key
- - - moderatecontent key
- - Moderatecontent Key
- -

-

最新版本:

-

当前版本:

-
-
-
-
-
- - -
-
- - -
-
-
上传首选显示
- - - - - -
-
-
- - > - -
-
-
-
- - > - -
-
-
-
- - > - -
-
-
-
- - > - -
-
-
-
- - > - -
-
-
- - - - -
-
- " placeholder="隐藏的保存"> -
- -
-
-
-
-
管理员账号管理 | 不变就不要保存更改
-
-
- - -
-
- - - -
-
-
- " placeholder="隐藏的保存"> -
- -
- -
-

直接输入账号和密码即可完成修改.

-

更改后会立即生效并重新登录,请务必牢记账号和密码!

-

如果忘记账号可以打开->/config/config.php文件->找到user对应的键值->填入

-

如果忘记密码请将密码->转换成MD5小写->转换网址->打开/config/config.php文件->找到password对应的键值->填入

-
-
-
- -
-
-
上传者账号管理 | 开启登录上传后可添加
-
-
- - -
-
- - - -
-
-
- " placeholder="隐藏的保存"> -
- -
- -
-

开启登录上传后,可以添加一些只能上传的账号.

-

更改后会立即生效并重新登录,请将账号和密码发给使用者.

-

上传用户的配置文件在config.guest.php

-

如果忘记密码请填入账号并填写新的密码即可更正密码 | 与更改管理 账号/密码不同!

-
-
-
-
当前所有上传者账号与密码 | 所有密码均经过MD5加密 | 账号guest的MD5为: 084e0343a0486ff05530df6c705c8bb4
-
- - - - - - - - - - $value) : ?> - - - - - - - -
登录账号登录密码删除密码
删除
-
@@ -998,9 +993,6 @@ if (isset($_GET['recycle_reimg'])) { - - - \ No newline at end of file diff --git a/admin/chart.php b/admin/chart.php index c3369cb..4cbe8dd 100755 --- a/admin/chart.php +++ b/admin/chart.php @@ -3,8 +3,6 @@ * 统计中心 */ require_once '../application/header.php'; -require_once APP_ROOT . '/config/api_key.php'; -require_once APP_ROOT . '/api/function_API.php'; require_once APP_ROOT . '/application/chart.php'; // 检测是否开启统计 @@ -67,7 +65,7 @@ if (is_array($char_data)) { box-shadow: 3px 2px 3px 2px rgba(19, 17, 36, 0.5); } -
+
diff --git a/admin/zui.chart.php b/admin/zui.chart.php index 7bb3700..5241af8 100755 --- a/admin/zui.chart.php +++ b/admin/zui.chart.php @@ -3,8 +3,6 @@ * 统计中心 */ require_once '../application/header.php'; -require_once APP_ROOT . '/config/api_key.php'; -require_once APP_ROOT . '/api/function_API.php'; require_once APP_ROOT . '/application/chart.php'; // 检测是否开启统计 diff --git a/api/function_API.php b/api/function_API.php deleted file mode 100755 index cf4872f..0000000 --- a/api/function_API.php +++ /dev/null @@ -1,80 +0,0 @@ -= 0) { - return $key; - } else { - return ('没有这个用户ID'); - } -} - -// 通过ID查找用户Token -function getIDToken($id) -{ - global $tokenList; - $id = preg_replace('/[\W]/', '', $id); // 过滤非字母数字,删除空格 - foreach ($tokenList as $key => $value) { - if ($key == $id) { - return $value; - } - } -} - -/** - * 检查是否开启api上传 - * code:201 访问成功但是服务端关闭API上传 - * code:202 访问成功但是Token错误 - */ -function check_api($token) -{ - global $config; - global $tokenList; - - if (!$config['apiStatus']) { - // API关闭 服务端关闭API上传 - $reJson = array( - "result" => 'failed', - 'code' => 201, - 'message' => 'API Closed', - ); - exit(json_encode($reJson, JSON_UNESCAPED_UNICODE)); - } - - if (!in_array($tokenList[$token], $tokenList)) { - // Token 是否存在 - $reJson = array( - "result" => 'failed', - 'code' => 202, - 'message' => 'Token Error', - ); - exit(json_encode($reJson, JSON_UNESCAPED_UNICODE)); - } - - if ($tokenList[$token]['expired'] < time()) { - // Token 是否过期 - $reJson = array( - "result" => 'failed', - 'code' => 203, - 'message' => 'Token Expired', - ); - exit(json_encode($reJson, JSON_UNESCAPED_UNICODE)); - } -} diff --git a/api/index.php b/api/index.php index 99a3602..99c4a3f 100755 --- a/api/index.php +++ b/api/index.php @@ -1,6 +1,5 @@ isURL ? '_ext_' : '_int_'); if ($this->isURL) { - $arr = explode('&', $_SERVER ['QUERY_STRING']); + $arr = explode('&', $_SERVER['QUERY_STRING']); asort($arr); $this->cachefile = $this->cacheDirectory . '/' . FILE_CACHE_PREFIX . $cachePrefix . md5($this->salt . implode('', $arr) . $this->fileCacheVersion) . FILE_CACHE_SUFFIX; } else { @@ -333,7 +333,7 @@ class timthumb $this->debug(1, "Local image path is {$this->localImage}"); $this->localImageMTime = @filemtime($this->localImage); //We include the mtime of the local file in case in changes on disk. - $this->cachefile = $this->cacheDirectory . '/' . FILE_CACHE_PREFIX . $cachePrefix . md5($this->salt . $this->localImageMTime . $_SERVER ['QUERY_STRING'] . $this->fileCacheVersion) . FILE_CACHE_SUFFIX; + $this->cachefile = $this->cacheDirectory . '/' . FILE_CACHE_PREFIX . $cachePrefix . md5($this->salt . $this->localImageMTime . $_SERVER['QUERY_STRING'] . $this->fileCacheVersion) . FILE_CACHE_SUFFIX; } $this->debug(2, "Cache file is: " . $this->cachefile); @@ -580,7 +580,7 @@ class timthumb $mimeType = $sData['mime']; $this->debug(3, "Mime type of image is $mimeType"); - if (!preg_match('/^image\/(?:gif|jpg|jpeg|png|webp)$/i', $mimeType)) { + if (!preg_match('/^image\/(?:gif|jpg|jpeg|png|webp|bmp)$/i', $mimeType)) { return $this->error("The image being resized is not a valid gif, jpg or png."); } @@ -828,8 +828,11 @@ class timthumb $imgType = 'gif'; imagegif($canvas, $tempfile); } else if (preg_match('/^image\/webp$/i', $mimeType)) { - $imgType = 'WEBP'; + $imgType = 'webp'; imagewebp($canvas, $tempfile); + } else if (preg_match('/^image\/bmp$/i', $mimeType)) { + $imgType = 'bmp'; + imagebmp($canvas, $tempfile); } else { return $this->sanityFail("Could not match mime type after verifying it previously."); } @@ -876,9 +879,9 @@ class timthumb $tempfile4 = tempnam($this->cacheDirectory, 'timthumb_tmpimg_'); $context = stream_context_create(); $fp = fopen($tempfile, 'r', 0, $context); - if(strlen($imgType) == 3) { + if (strlen($imgType) == 3) { file_put_contents($tempfile4, $this->filePrependSecurityBlock . $imgType . ' ?' . '>'); //7 extra bytes, first 3 being image type - }elseif (strlen($imgType) == 4){ + } elseif (strlen($imgType) == 4) { file_put_contents($tempfile4, $this->filePrependSecurityBlock . $imgType . ' ?' . '>'); //7 extra bytes, first 4 being image type } file_put_contents($tempfile4, $fp, FILE_APPEND); @@ -1096,7 +1099,7 @@ class timthumb } $mimeType = $this->getMimeType($tempfile); - if (!preg_match("/^image\/(?:jpg|jpeg|gif|png|webp)$/i", $mimeType)) { + if (!preg_match("/^image\/(?:jpg|jpeg|gif|png|webp|bmp)$/i", $mimeType)) { $this->debug(3, "Remote file has invalid mime type: $mimeType"); @unlink($this->cachefile); touch($this->cachefile); @@ -1171,6 +1174,9 @@ class timthumb if (strtolower($mimeType) == 'image/webp') { $mimeType = 'image/webp'; } + if (strtolower($mimeType) == 'image/bmp') { + $mimeType = 'image/bmp'; + } $gmdate_expires = gmdate('D, d M Y H:i:s', strtotime('now +10 days')) . ' GMT'; $gmdate_modified = gmdate('D, d M Y H:i:s') . ' GMT'; // send content headers then display image @@ -1193,7 +1199,6 @@ class timthumb protected function securityChecks() { - } protected function param($property, $default = '') @@ -1215,6 +1220,10 @@ class timthumb case 'image/webp': $image = imagecreatefromwebp($src); break; + + case 'image/bmp': + $image = imagecreatefrombmp($src); + break; case 'image/png': $image = imagecreatefrompng($src); @@ -1412,5 +1421,4 @@ class timthumb { return $this->is404; } - } diff --git a/application/chart.php b/application/chart.php index c4da4c3..8825323 100755 --- a/application/chart.php +++ b/application/chart.php @@ -56,8 +56,8 @@ function write_chart_total() $count_contents['chart_disk'][] = [$count_day[$i] => getDirectorySize($total_contents . $count_day[$i])]; } - if(!is_dir(APP_ROOT.'/admin/logs/counts/')){ - mkdir(APP_ROOT.'/admin/logs/counts/',0755,true); + if (!is_dir(APP_ROOT . '/admin/logs/counts/')) { + mkdir(APP_ROOT . '/admin/logs/counts/', 0755, true); } $count_contents = json_encode($count_contents, true); diff --git a/application/footer.php b/application/footer.php index 0c9d1ea..68f2398 100755 --- a/application/footer.php +++ b/application/footer.php @@ -43,9 +43,6 @@ if ($config['ad_bot']) echo $config['ad_bot_info']; // 底部广告 @@ -293,7 +295,7 @@ }).show(); } } - // 删除图片 + // 删除图片 function delete_img() { var r = confirm("确认要删除?\n* 删除文件夹后将无法恢复!") if (r == true) { diff --git a/application/thumb.php b/application/thumb.php index 68c746b..17e9418 100755 --- a/application/thumb.php +++ b/application/thumb.php @@ -83,5 +83,25 @@ $ALLOWED_SITES = array( 'mindsharestudios.com' ); -require_once __DIR__ . '/TimThumb.php'; -timthumb::start(); +/** + * 修复无法生成生成webp动态图片的缩略图bug + */ +if (isset($_GET['img'])) { + // 获取图片后缀后4位 + $ext = substr($_GET['img'], -4); + // 图片绝对路径 + $src = APP_ROOT . $_GET['img']; + // 检测图片 + if ($ext == 'webp' && isWebpAnimated($src)) { + // 输出动态的webp + header("Content-type: image/webp"); + exit(file_get_contents($src, true)); + } + // 非动态webp输出 + require_once __DIR__ . '/TimThumb.php'; + timthumb::start(); +} else { + // 输出404 + header("Content-type: image/webp"); + exit(file_get_contents(APP_ROOT . '/public/images/404.png', true)); +} diff --git a/config/config.php b/config/config.php index 50d75b3..2287869 100755 --- a/config/config.php +++ b/config/config.php @@ -39,9 +39,9 @@ $config=Array 'imgRatio_quality'=>80, 'imgRatio_crop'=>0, 'imgRatio_preserve_headers'=>1, - 'static_cdn'=>0, + 'static_cdn'=>1, 'theme'=>'default', - 'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.5.4', + 'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0', 'TinyPng_key'=>'', 'checkImg'=>0, 'checkImg_value'=>50, @@ -62,7 +62,7 @@ var _hmt = _hmt || [];
', - 'ad_bot'=>1, + 'ad_bot'=>0, 'ad_bot_info'=>'
打赏作者 打赏作者 @@ -98,7 +98,7 @@ var _hmt = _hmt || []; 'language'=>0, 'image_recycl'=>1, 'version'=>'2.5.4', - 'update'=>'2022-03-02 18:12:15', + 'update'=>'2022-03-04 20:52:07', 'terms'=>'
diff --git a/index.php b/index.php index 751b0e3..839a4dc 100755 --- a/index.php +++ b/index.php @@ -78,6 +78,27 @@ mustLogin();