pull/141/head
icret 2022-03-07 12:34:04 +08:00
parent 5f2ffb5c7b
commit 8b05affa30
10 changed files with 134 additions and 111 deletions

2
.github/FUNDING.yml vendored
View File

@ -1 +1 @@
custom: ['https://png.cm/sponsor/images/wechat.jpg'] custom: ['https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.5.5/public/images/wechat.jpg']

View File

@ -22,7 +22,7 @@
>本人善写bug 发现bug可提交 [issues](https://github.com/icret/EasyImages2.0/issues) 追求稳定请下载 [稳定版](https://github.com/icret/EasyImages2.0/releases) >本人善写bug 发现bug可提交 [issues](https://github.com/icret/EasyImages2.0/issues) 追求稳定请下载 [稳定版](https://github.com/icret/EasyImages2.0/releases)
## 目录 ## 目录
[特点](#特点)  [使用注意](#使用注意)  [安装](#安装)  [程序升级](#程序升级)  [安全配置](#安全配置)  [更新日志](#更新日志)  [支持开发者](#支持开发者)  [界面演示](#界面演示)  [兼容](#兼容)  [鸣谢](#鸣谢)  [开源许可](#开源许可)   [特点](#特点)  [使用注意](#使用注意)  [安装](#安装)  [程序升级](#程序升级)  [安全配置](#安全配置)  [更新日志](#更新日志)  [支持开发者](#支持开发者)  [界面演示](#界面演示)  [兼容](#兼容)  [鸣谢](#鸣谢)  [开源许可](#开源许可)  
## 特点 ## 特点
@ -68,7 +68,7 @@
## 程序升级 ## 程序升级
- 备份`config`(没有增加上传用户和api可以只保留`config.php`文件)目录和`上传目录` - 备份`config`目录(没有增加上传用户和api可以只保留`config.php`文件)和`图片目录`
- 将新程序下载至网站目录解压覆盖,然后将备份的文件替换既完成升级 - 将新程序下载至网站目录解压覆盖,然后将备份的文件替换既完成升级
## 安全配置 ## 安全配置
@ -104,6 +104,9 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary><mark>点击查看2.0版更新日志</mark></summary> <details><summary><mark>点击查看2.0版更新日志</mark></summary>
* 2022-3-7 v2.5.6 dev
- 修复加密删除后不能正确提示
* 2022-3-4 v2.5.5 * 2022-3-4 v2.5.5
- 增加设置页面检测是否开启登录上传 - 增加设置页面检测是否开启登录上传
- 将footer固定在底部 - 将footer固定在底部

View File

@ -28,9 +28,9 @@ file_put_contents(APP_ROOT . '/config/EasyIamge.lock', '安装环境检测锁定
<h4>EasyImage2.0 基础检测:</h4> <h4>EasyImage2.0 基础检测:</h4>
<p>当前PHP版本:<sapn style="color:green"><?php echo phpversion() ?></sapn> <p>当前PHP版本:<sapn style="color:green"><?php echo phpversion() ?></sapn>
</p> </p>
<p>upload_max_filesize - PHP上传最大值:<sapn style="color:green"><?php echo ini_get('upload_max_filesize'); ?></sapn> <p>PHP最大上传: <sapn style="color:green"><?php echo ini_get('upload_max_filesize'); ?></sapn>
</p> </p>
<p>post_max_size - POST上传最大值:<sapn style="color:green"><?php echo ini_get('post_max_size'); ?></sapn> <p>POST最大上传: <sapn style="color:green"><?php echo ini_get('post_max_size'); ?></sapn>
</p> </p>
<?php <?php
// 扩展检测 取消检测imagick扩展 // 扩展检测 取消检测imagick扩展
@ -49,19 +49,19 @@ file_put_contents(APP_ROOT . '/config/EasyIamge.lock', '安装环境检测锁定
if (IS_WIN) { if (IS_WIN) {
echo ' echo '
<p style="color:green">upload.php 文件可执行</p> <p style="color:green">upload.php 文件可执行</p>
<p style="color:green">/i 目录可读写</p> <p style="color:green">' . $config['path'] . ' 目录可读写</p>
'; ';
} }
if (!IS_WIN) { if (!IS_WIN) {
if ($quanxian !== '755' and !is_writable(APP_ROOT . '/i/')) { if ($quanxian !== '755' and !is_writable(APP_ROOT . $config['path'])) {
echo ' echo '
<p style="color:red">upload.php 文件不可执行</font>> <p style="color:red">upload.php 文件不可执行</font>>
<p style="color:red">/i 目录可读写</font>> <p style="color:red">' . $config['path'] . ' 目录可读写</font>>
'; ';
} else { } else {
echo ' echo '
<p style="color:green">upload.php 文件可执行</p> <p style="color:green">upload.php 文件可执行</p>
<p style="color:green">/i 目录可读写</p> <p style="color:green">' . $config['path'] . ' 目录可读写</p>
'; ';
} }
} }

View File

@ -44,8 +44,8 @@ if (isset($_GET['hash'])) {
if ($config['image_recycl']) { if ($config['image_recycl']) {
// 如果开启回收站则进入回收站 // 如果开启回收站则进入回收站
checkImg($delHash, 3, 'recycle/'); if (checkImg($delHash, 3, 'recycle/') == true) {
echo ' echo '
<script> <script>
new $.zui.Messager("删除成功", { new $.zui.Messager("删除成功", {
type: "success", // 定义颜色主题 type: "success", // 定义颜色主题
@ -53,6 +53,16 @@ if (isset($_GET['hash'])) {
}).show(); }).show();
</script> </script>
'; ';
} else {
echo '
<script>
new $.zui.Messager("文件不存在!", {
type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标
}).show();
</script>
';
}
} else { } else {
// 否则直接删除 // 否则直接删除
getDel($delHash, 'url'); getDel($delHash, 'url');

View File

@ -6,7 +6,7 @@ require_once APP_ROOT . '/config/config.guest.php';
/** /**
* 判断GIF图片是否为动态 * 判断GIF图片是否为动态
* @param $filename string 文件 * @param $filename string 文件
* @return int * @return int |
*/ */
function isAnimatedGif($filename) function isAnimatedGif($filename)
{ {
@ -155,18 +155,20 @@ function static_cdn()
echo $config['domain']; echo $config['domain'];
} }
} }
/*
// 获取允许上传的扩展名 /**
* 获取允许上传的扩展名
*/
function getExtensions() function getExtensions()
{ {
global $config; global $config;
$arr = explode(',', $config['extensions']);
$mime = ''; $mime = '';
for ($i = 0; $i < count($config['extensions']); $i++) { for ($i = 0; $i < count($arr); $i++) {
$mime .= $config['extensions'][$i] . ','; $mime .= $arr . ',';
} }
return rtrim($mime, ','); return rtrim($mime, ',');
} }
*/
/** /**
* 获取目录大小 如果目录文件较多将很费时 * 获取目录大小 如果目录文件较多将很费时
@ -656,7 +658,10 @@ function nsfwjs_json($url, $data = '')
/** /**
* 检查图片是否违规 * 检查图片是否违规
* @param $imageUrl string 图片url * @param $imageUrl 图片链接
* @param int $type 模式: 1|moderatecontent 2|nsfwjs 3|移入回收站
* @param string $dir 移入的目录
* @return bool
*/ */
function checkImg($imageUrl, $type = 1, $dir = 'suspic/') function checkImg($imageUrl, $type = 1, $dir = 'suspic/')
{ {
@ -730,13 +735,18 @@ function checkImg($imageUrl, $type = 1, $dir = 'suspic/')
if ($bad_pic == true) { if ($bad_pic == true) {
$old_path = APP_ROOT . str_replace($config['imgurl'], '', $imageUrl); // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png $old_path = APP_ROOT . str_replace($config['imgurl'], '', $imageUrl); // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png
$name = date('Y_m_d') . '_' . basename($imageUrl); // 文件名 2021_10_30_p8vypd.png $name = date('Y_m_d') . '_' . basename($imageUrl); // 文件名 2021_10_30_p8vypd.png
$new_path = APP_ROOT . $config['path'] . $dir . $name; // 新路径含文件名 $new_path = APP_ROOT . $config['path'] . $dir . $name; // 新路径含文件名
$suspic_dir = APP_ROOT . $config['path'] . $dir; // suspic路径 $suspic_dir = APP_ROOT . $config['path'] . $dir; // suspic路径
if (!is_dir($suspic_dir)) { // 创建suspic目录并移动 if (!is_dir($suspic_dir)) { // 创建suspic目录并移动
mkdir($suspic_dir, 0777, true); mkdir($suspic_dir, 0777, true);
} }
rename($old_path, $new_path); if (is_file($old_path)) {
rename($old_path, $new_path);
return true;
} else {
return false;
}
} }
} }
@ -1105,7 +1115,7 @@ function check_api($token)
global $tokenList; global $tokenList;
if (!$config['apiStatus']) { if (!$config['apiStatus']) {
// API关闭 服务端关闭API上传 // 关闭API
$reJson = array( $reJson = array(
"result" => 'failed', "result" => 'failed',
'code' => 201, 'code' => 201,
@ -1115,7 +1125,7 @@ function check_api($token)
} }
if (!in_array($tokenList[$token], $tokenList)) { if (!in_array($tokenList[$token], $tokenList)) {
// Token 是否存在 // Token 存在
$reJson = array( $reJson = array(
"result" => 'failed', "result" => 'failed',
'code' => 202, 'code' => 202,
@ -1125,7 +1135,7 @@ function check_api($token)
} }
if ($tokenList[$token]['expired'] < time()) { if ($tokenList[$token]['expired'] < time()) {
// Token 是否过期 // Token 过期
$reJson = array( $reJson = array(
"result" => 'failed', "result" => 'failed',
'code' => 203, 'code' => 203,

View File

@ -12,7 +12,7 @@
<title><?php echo $config['title']; ?></title> <title><?php echo $config['title']; ?></title>
<meta name="keywords" content="<?php echo $config['keywords']; ?>" /> <meta name="keywords" content="<?php echo $config['keywords']; ?>" />
<meta name="description" content="<?php echo $config['description']; ?>" /> <meta name="description" content="<?php echo $config['description']; ?>" />
<link rel="shortcut icon" href="<?php echo $config['domain']; ?>/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="<?php static_cdn(); ?>/favicon.ico" type="image/x-icon" />
<link href="<?php static_cdn(); ?>/public/static/zui/css/zui.min.css" rel="stylesheet"> <link href="<?php static_cdn(); ?>/public/static/zui/css/zui.min.css" rel="stylesheet">
<link href="<?php static_cdn(); ?>/public/static/zui/theme/zui-theme-<?php echo $config['theme']; ?>.css" rel="stylesheet"> <link href="<?php static_cdn(); ?>/public/static/zui/theme/zui-theme-<?php echo $config['theme']; ?>.css" rel="stylesheet">
<script src="<?php static_cdn(); ?>/public/static/zui/lib/jquery/jquery-3.6.0.min.js"></script> <script src="<?php static_cdn(); ?>/public/static/zui/lib/jquery/jquery-3.6.0.min.js"></script>

View File

@ -12,7 +12,7 @@ $config=Array
'user'=>'admin', 'user'=>'admin',
'password'=>'e6e061838856bf47e1de730719fb2609', 'password'=>'e6e061838856bf47e1de730719fb2609',
'mustLogin'=>0, 'mustLogin'=>0,
'apiStatus'=>1, 'apiStatus'=>0,
'path'=>'/i/', 'path'=>'/i/',
'imgName'=>'default', 'imgName'=>'default',
'maxSize'=>10485760, 'maxSize'=>10485760,
@ -41,7 +41,7 @@ $config=Array
'imgRatio_preserve_headers'=>1, 'imgRatio_preserve_headers'=>1,
'static_cdn'=>1, 'static_cdn'=>1,
'theme'=>'default', 'theme'=>'default',
'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0', 'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.5.5',
'TinyPng_key'=>'', 'TinyPng_key'=>'',
'checkImg'=>0, 'checkImg'=>0,
'checkImg_value'=>50, 'checkImg_value'=>50,
@ -99,7 +99,7 @@ var _hmt = _hmt || [];
'image_recycl'=>1, 'image_recycl'=>1,
'delDir'=>'thumbnails/', 'delDir'=>'thumbnails/',
'version'=>'2.5.5', 'version'=>'2.5.5',
'update'=>'2022-03-05 10:45:32', 'update'=>'2022-03-07 12:32:21',
'terms'=>'<div class="container"> 'terms'=>'<div class="container">
<div class="row"> <div class="row">
<div class="col-xs-3"> <div class="col-xs-3">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB