From 1ccb28e2e905769f1d65f2f9fd0d1d49c34b9375 Mon Sep 17 00:00:00 2001 From: icret Date: Wed, 16 Mar 2022 15:18:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E9=9D=99=E6=80=81=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 ++-- admin/admin.inc.php | 20 ++-- application/check_admin.inc.php | 36 +++++-- application/function.php | 48 +++++++-- application/list.php | 9 +- application/thumb.php | 8 +- config/config.php | 174 ++++++++++++++++---------------- 7 files changed, 179 insertions(+), 136 deletions(-) diff --git a/README.md b/README.md index a7a1587..87c89a5 100755 --- a/README.md +++ b/README.md @@ -3,13 +3,6 @@ 演示地址:[https://png.cm/](https://png.cm/) 之前一直用的图床程序是:[PHP多图长传程序2.4.3](https://www.jb51.net/codes/40544.html) 由于版本过老并且使用falsh上传,在当前html5流行大势所趋下,遂利用基础知识新写了一个以html5为默认上传并且支持flash,向下兼容至IE9。 -> - -[演示](https://png.cm/)   -[Chrome/Edge 插件](https://github.com/icret/EasyImage-Browser-Extension)   -[使用手册](https://www.kancloud.cn/easyimage/easyimage/)   -[问题反馈](https://support.qq.com/products/367633)   -[QQ群](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f) [![PHP](https://img.shields.io/badge/PHP->=5.6-orange.svg)](http://php.net) [![Release](https://img.shields.io/github/v/release/icret/EasyImages2.0)](https://github.com/icret/EasyImages2.0/releases) @@ -18,7 +11,10 @@ [![jsdelivr](https://data.jsdelivr.com/v1/package/gh/icret/EasyImages2.0/badge)](https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@EasyImage2.0/) [![Code size](https://img.shields.io/github/languages/code-size/icret/EasyImages2.0?color=blueviolet)](https://github.com/icret/EasyImages2.0) [![License](https://img.shields.io/badge/license-GPL_V2.0-yellowgreen.svg)](https://github.com/icret/EasyImages2.0/blob/master/LICENSE) +[![QQ group](https://pub.idqqimg.com/wpa/images/group.png)](https://qm.qq.com/cgi-bin/qm/qr?k=TmGoIK7BXij_CR3lqZoJZu3_trPwtJ09&jump_from=webapi) +>[演示](https://png.cm/) | [Chrome/Edge 插件](https://github.com/icret/EasyImage-Browser-Extension) | [使用手册](https://www.kancloud.cn/easyimage/easyimage/) +> >本人善写bug 发现bug可提交 [issues](https://github.com/icret/EasyImages2.0/issues) 追求稳定请下载 [稳定版](https://github.com/icret/EasyImages2.0/releases) ## 目录 @@ -55,8 +51,8 @@ 9. `upload File size exceeds the maximum value` 调整`PHP`上传大小 10. `undefined function imagecreatefromwebp()`GD没安装webp, 以此类推 11. `Warning: is_dir(): open_basedir restriction in effect`解决方法同`3` -12. 出现`Fatal error: Allowed memory size......`主机内存或分配给PHP的内存不够 解决方法百度 -13. 如果开启原图保护功后打开图片链接显示`404`是因为`nginx`或`Apache`页面缓存导致的,`Nginx`解决办法: +12. `Fatal error: Allowed memory size......`主机内存或分配给PHP的内存不够 解决方法百度 +13. 开启原图保护功能后打开图片链接显示`404`是因为`nginx`或`Apache`页面缓存导致的,`Nginx`解决办法: ```Nginx # 把Nginx这段配置删掉 @@ -81,7 +77,6 @@ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ - 备份`config`目录(没有增加上传用户和api可以只保留`config.php`文件)和`上传文件目录` - 将新程序下载至网站目录解压覆盖,然后将备份的文件替换既完成升级 - 如果出现错误请在设置中把所有底部设置点击一次`保存` -- ## 安全配置 @@ -116,7 +111,10 @@ $HTTP["url"] =~ "^/(i|public)/" {
点击查看2.0版更新日志 -* 2022-3-13 v2.5.6 dev +* 2022-3-15 v2.5.7 dev +- 检测更改域名改为检测局域网 + +* 2022-3-13 v2.5.6 - 修复加密删除后不能正确提示 - 修复webp转换其他格式失败 - 修复文字水印透明度不生效 diff --git a/admin/admin.inc.php b/admin/admin.inc.php index 72a4644..aeb534b 100755 --- a/admin/admin.inc.php +++ b/admin/admin.inc.php @@ -290,14 +290,15 @@ if (isset($_GET['recycle_reimg'])) {
@@ -818,7 +819,8 @@ if (isset($_GET['recycle_reimg'])) {

当前版本: - 最新版本:

+ 最新版本: +

diff --git a/application/check_admin.inc.php b/application/check_admin.inc.php index be1b9da..dcac8ad 100755 --- a/application/check_admin.inc.php +++ b/application/check_admin.inc.php @@ -13,16 +13,7 @@ foreach ($expand as $val) { '; } } -// 检测是否更改默认域名 -if (strstr('localhost|127.0.0.1', $_SERVER['HTTP_HOST'])) { - echo ' - - '; -} + // 检测是否修改默认密码 if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') { echo ' @@ -34,6 +25,31 @@ if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') { '; } + +/* +// 检测是否更改默认域名 +if (strstr('localhost|127.0.0.1|192.168.', $_SERVER['HTTP_HOST'])) { + echo ' + + '; +} +*/ + +// 检测是否局域网访问 +if (is_local($config['domain'])) { + echo ' + + '; +} + // 检测监黄接口是否可以访问 if ($configp['checkImg'] !== 0) { diff --git a/application/function.php b/application/function.php index dfcba74..cd0438b 100755 --- a/application/function.php +++ b/application/function.php @@ -112,34 +112,47 @@ function imgName($source = null) return trim(com_create_guid(), '{}'); } - return strtolower(sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535))); + return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)); } switch ($config['imgName']) { - case "source": // 以上传文件名称 例:微信图片_20211228214754 + + case "source": + // 以上传文件名称 例:微信图片_20211228214754 // 过滤非法名称 $source = preg_replace("/\/|\~|\!|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\_|\+|\{|\}|\:|\<|\>|\?|\[|\]|\,|\.|\/|\;|\'|\`|\-|\=|\\\|\|/","",$source); return $source; break; - case "date": // 以上传时间 例:192704 + case "date": + // 以上传时间 例:192704 return date("His"); break; - case "unix": // 以Unix时间 例:1635074840 + case "unix": + // 以Unix时间 例:1635074840 return time(); break; - case "uniqid": // 基于以微秒计的当前时间 例:6175436c73418 + case "uniqid": + // 基于以微秒计的当前时间 例:6175436c73418 return uniqid(true); break; - case "guid": // 全球唯一标识符 例:6EDAD0CC-AB0C-4F61-BCCA-05FAD65BF0FA + case "guid": + // 全球唯一标识符 例:6EDAD0CC-AB0C-4F61-BCCA-05FAD65BF0FA return create_guid(); break; - case "md5": // md5加密时间 例:3888aa69eb321a2b61fcc63520bf6c82 + case "md5": + // md5加密时间 例:3888aa69eb321a2b61fcc63520bf6c82 return md5(microtime()); break; - case "sha1": // sha1加密微秒 例:654faac01499e0cb5fb0e9d78b21e234c63d842a + case "sha1": + // sha1加密微秒 例:654faac01499e0cb5fb0e9d78b21e234c63d842a return sha1(microtime()); break; + case "crc32": + // crc32加密微秒 例:2495551279 + return crc32(microtime()); + break; default: - return base_convert(date('His') . mt_rand(1001, 9999), 10, 36); // 将上传时间+随机数转换为36进制 例:vx77yu + // 将上传时间+随机数转换为36进制 例:vx77yu + return base_convert(date('His') . mt_rand(1001, 9999), 10, 36); } } @@ -1163,8 +1176,23 @@ function isWebpAnimated($src) // animated $isAnimated = true; } else { - // non animated + // not animated $isAnimated = false; } return $isAnimated; } + +/** + * 根据URL判断是否本地局域网访问(PHP代码函数) + * https://blog.csdn.net/monxinmonxin0/article/details/44854383 + * @param $url 要判断的网址 + * @return bool 是|否 + */ +function is_local($url) +{ + if (stristr($url, 'localhost') || stristr($url, '127.') || stristr($url, '192.')) { + return true; + } else { + return false; + } +} diff --git a/application/list.php b/application/list.php index 3311a15..6cdb459 100755 --- a/application/list.php +++ b/application/list.php @@ -73,12 +73,12 @@ .card { box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px; - border-radius: 10px; + border-radius: 5px 5px 5px 5px; } img { cursor: pointer; - transition: all 0.6s; + transition: all 0.8s; } img:hover { @@ -90,9 +90,8 @@ .bottom-bar { width: 100%; position: absolute; - left: 0; - bottom: 0px; - background-color: rgba(0, 0, 0, 0.5); + bottom: -4px; + background-color: rgba(0, 0, 0, 0.4); }
diff --git a/application/thumb.php b/application/thumb.php index 17e9418..47fe606 100755 --- a/application/thumb.php +++ b/application/thumb.php @@ -48,7 +48,7 @@ Thumb::show($src, $w, $h); require_once __DIR__ . '/function.php'; // 中文翻译 https://my.oschina.net/whrlmc/blog/81739 define('LOCAL_FILE_BASE_DIRECTORY', APP_ROOT); -define('MEMORY_LIMIT', '128M'); +define('MEMORY_LIMIT', '256M'); define('DEFAULT_WIDTH', 258); define('DEFAULT_HEIGHT', 258); define('FILE_CACHE_PREFIX', 'EasyImage'); @@ -60,10 +60,10 @@ define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'thumbnails'); define('NOT_FOUND_IMAGE', $config['imgurl'] . '/public/images/404.png'); define('ERROR_IMAGE', $config['imgurl'] . '/public/images/404.png'); define('DISPLAY_ERROR_MESSAGES', false); -define('MAX_FILE_SIZE', 10485760); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。 +define('MAX_FILE_SIZE', 10485760); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。 define('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400); // 多久清理一次缓存 -define('FILE_CACHE_MAX_FILE_AGE', 86400); // 文件必须从缓存中删除多长时间 -define('BROWSER_CACHE_MAX_AGE', 864000); // 浏览器缓存时间 +define('FILE_CACHE_MAX_FILE_AGE', 86400); // 文件必须从缓存中删除多长时间 +define('BROWSER_CACHE_MAX_AGE', 864000); // 浏览器缓存时间 global $ALLOWED_SITES; $ALLOWED_SITES = array( diff --git a/config/config.php b/config/config.php index 91b7b01..fd7d41d 100755 --- a/config/config.php +++ b/config/config.php @@ -1,52 +1,52 @@ '简单图床 - EasyImage', - 'keywords'=>'简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制', - 'description'=>'简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序,最新html5自适应页面兼容手机电脑,上传后返回图片直链,markdown图片,论坛贴图bbscode链接,简单方便支持一键复制,支持多域名,api上传。', - 'tips'=>'
  • 单文件≤10M,单次上传≤30张
  • +$config=Array + ( + 'title'=>'简单图床 - EasyImage', + 'keywords'=>'简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制', + 'description'=>'简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序,最新html5自适应页面兼容手机电脑,上传后返回图片直链,markdown图片,论坛贴图bbscode链接,简单方便支持一键复制,支持多域名,api上传', + 'tips'=>'
  • 单文件≤10M,单次上传≤30张
  • 简单图床是一款开源图床, 支持多文件上传无数据库 - 如果你喜欢这种图床风格就下载喔 (๑•̀ㅂ•́)و✧', - 'domain'=>'http://127.0.0.1', - 'imgurl'=>'http://127.0.0.1', - 'user'=>'admin', - 'password'=>'e6e061838856bf47e1de730719fb2609', - 'mustLogin'=>0, - 'apiStatus'=>0, - 'path'=>'/i/', - 'imgName'=>'default', - 'maxSize'=>10485760, - 'maxUploadFiles'=>100, - 'watermark'=>0, - 'waterText'=>'简单图床 - png.cm', - 'waterPosition'=>5, - 'textColor'=>'rgba(0,255,0,0.5)', - 'textSize'=>50, - 'textFont'=>'/public/static/hkxzy.ttf', - 'waterImg'=>'/public/images/watermark.png', - 'extensions'=>'gif,jpeg,png,tif,bmp,tif,svg,webp,jpg,tga,svg,ico', - 'compress'=>0, - 'compress_ratio'=>80, - 'thumbnail'=>1, - 'imgConvert'=>'', - 'maxWidth'=>10240, - 'maxHeight'=>10240, - 'minWidth'=>5, - 'minHeight'=>5, - 'imgRatio'=>0, - 'image_x'=>0, - 'image_y'=>0, - 'imgRatio_quality'=>80, - 'imgRatio_crop'=>0, - 'imgRatio_preserve_headers'=>1, - 'static_cdn'=>0, - 'theme'=>'default', - 'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.5.6', - 'TinyPng_key'=>'', - 'checkImg'=>0, - 'checkImg_value'=>50, - 'moderatecontent_key'=>'', - 'nsfwjs_url'=>'', + 如果你喜欢这种图床风格就下载喔 (๑•̀ㅂ•́)و✧', + 'domain'=>'http://127.0.0.1', + 'imgurl'=>'http://127.0.0.1', + 'user'=>'admin', + 'password'=>'e6e061838856bf47e1de730719fb2609', + 'mustLogin'=>0, + 'apiStatus'=>0, + 'path'=>'/i/', + 'imgName'=>'default', + 'maxSize'=>10485760, + 'maxUploadFiles'=>100, + 'watermark'=>0, + 'waterText'=>'简单图床 - png.cm', + 'waterPosition'=>5, + 'textColor'=>'rgba(0,255,0,0.5)', + 'textSize'=>50, + 'textFont'=>'/public/static/hkxzy.ttf', + 'waterImg'=>'/public/images/watermark.png', + 'extensions'=>'gif,jpeg,png,tif,bmp,tif,svg,webp,jpg,tga,svg,ico', + 'compress'=>0, + 'compress_ratio'=>80, + 'thumbnail'=>1, + 'imgConvert'=>'', + 'maxWidth'=>10240, + 'maxHeight'=>10240, + 'minWidth'=>5, + 'minHeight'=>5, + 'imgRatio'=>0, + 'image_x'=>0, + 'image_y'=>0, + 'imgRatio_quality'=>80, + 'imgRatio_crop'=>0, + 'imgRatio_preserve_headers'=>1, + 'static_cdn'=>0, + 'theme'=>'default', + 'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.5.6', + 'TinyPng_key'=>'', + 'checkImg'=>0, + 'checkImg_value'=>50, + 'moderatecontent_key'=>'', + 'nsfwjs_url'=>'', 'footer'=>'请勿上传违反中国政策的图片 ', - 'ad_top'=>0, +', + 'ad_top'=>0, 'ad_top_info'=>'
    -
    ', - 'ad_bot'=>0, +
    ', + 'ad_bot'=>0, 'ad_bot_info'=>'', - 'showSwitch'=>1, - 'showSort'=>1, - 'listNumber'=>20, - 'customize'=>'', - 'checkEnv'=>1, - 'upload_logs'=>1, - 'cache_freq'=>2, - 'upload_first_show'=>1, - 'show_user_hash_del'=>1, - 'show_exif_info'=>1, - 'chart_on'=>1, - 'check_ip'=>0, - 'check_ip_model'=>0, - 'check_ip_list'=>'', - 'public'=>0, - 'public_list'=>Array - ( - 0=>'time', - 1=>'today', - 2=>'yesterday', - 3=>'total_space', - 4=>'used_space', - 5=>'free_space', - 6=>'image_used', - 7=>'file', - 8=>'dir', - 9=>'month' - ), - 'language'=>0, - 'image_recycl'=>1, - 'delDir'=>'thumbnails/', - 'hide'=>0, - 'version'=>'2.5.6', - 'update'=>'2022-03-14 17:48:22', +
    ', + 'showSwitch'=>1, + 'showSort'=>1, + 'listNumber'=>20, + 'customize'=>'', + 'checkEnv'=>1, + 'upload_logs'=>1, + 'cache_freq'=>2, + 'upload_first_show'=>1, + 'show_user_hash_del'=>1, + 'show_exif_info'=>1, + 'chart_on'=>1, + 'check_ip'=>0, + 'check_ip_model'=>0, + 'check_ip_list'=>'', + 'public'=>0, + 'public_list'=>Array + ( + 0=>'time', + 1=>'today', + 2=>'yesterday', + 3=>'total_space', + 4=>'used_space', + 5=>'free_space', + 6=>'image_used', + 7=>'file', + 8=>'dir', + 9=>'month' + ), + 'language'=>0, + 'image_recycl'=>1, + 'delDir'=>'thumbnails/', + 'hide'=>0, + 'version'=>'2.5.6', + 'update'=>'2022-03-16 01:57:25', 'terms'=>'
    @@ -184,5 +184,5 @@ var _hmt = _hmt || [];
    -' +' ); \ No newline at end of file