fix PHP8.0

This commit is contained in:
icret 2022-04-02 18:10:17 +08:00
parent 22842e24ea
commit bbfb384311
9 changed files with 168 additions and 160 deletions

0
README.md Executable file → Normal file
View File

View File

@ -67,7 +67,9 @@ if (isset($_GET['stop_token'])) {
$stop_token = $_GET['stop_token'];
$postArr = array(
$stop_token => array(
'id' => 0, 'expired' => time()
'id' => 0,
'expired' => time(),
'add_time' => $tokenList[$stop_token]['add_time']
)
);
$new_config = array_replace($tokenList, $postArr);
@ -728,13 +730,14 @@ if (isset($_GET['recycle_reimg'])) {
<?php
// 获取被隔离的文件
$cache_dir = APP_ROOT . $config['path'] . 'recycle/'; // cache目录
$cache_file = get_file_by_glob($cache_dir . '*.*'); // 获取所有文件
@$cache_num = count($cache_file); // 统计目录文件个数
$cache_num = count($cache_file); // 统计目录文件个数
for ($i = 0; $i < $cache_num and $i < 21; $i++) : // 循环输出文件
$file_cache_path = APP_ROOT . $config['path'] . 'recycle/' . $cache_file[$i]; // 图片绝对路径
$file_path = $config['path'] . 'recycle/' . $cache_file[$i]; // 图片相对路径
@$file_size = getDistUsed(filesize($file_cache_path)); // 图片大小
@$filen_name = $cache_file[$i]; // 图片名称
$file_size = getDistUsed(filesize($file_cache_path)); // 图片大小
$filen_name = $cache_file[$i]; // 图片名称
$url = $config['imgurl'] . $config['path'] . 'recycle/' . $cache_file[$i]; // 图片网络连接
$unlink_img = $config['domain'] . '/application/del.php?url=' . $url; // 图片删除连接
?>
@ -778,12 +781,12 @@ if (isset($_GET['recycle_reimg'])) {
// 获取被隔离的文件
$cache_dir = APP_ROOT . $config['path'] . 'suspic/'; // cache目录
$cache_file = get_file_by_glob($cache_dir . '*.*'); // 获取所有文件
@$cache_num = count($cache_file); // 统计目录文件个数
$cache_num = count($cache_file); // 统计目录文件个数
for ($i = 0; $i < $cache_num and $i < 21; $i++) : // 循环输出文件
$file_cache_path = APP_ROOT . $config['path'] . 'suspic/' . $cache_file[$i]; // 图片绝对路径
$file_path = $config['path'] . 'suspic/' . $cache_file[$i]; // 图片相对路径
@$file_size = getDistUsed(filesize($file_cache_path)); // 图片大小
@$filen_name = $cache_file[$i]; // 图片名称
$file_size = getDistUsed(filesize($file_cache_path)); // 图片大小
$filen_name = $cache_file[$i]; // 图片名称
$url = $config['imgurl'] . $config['path'] . 'suspic/' . $cache_file[$i]; // 图片网络连接
$unlink_img = $config['domain'] . '/application/del.php?url=' . $url; // 图片删除连接
?>

View File

@ -51,11 +51,11 @@ if (is_local($config['domain'])) {
}
// 检测监黄接口是否可以访问
if ($configp['checkImg'] !== 0) {
if ($config['checkImg'] !== 0) {
if ($config['checkImg'] == 1) {
if (!@IP_URL_Ping('api.moderatecontent.com', 80, 1)) {
if (!IP_URL_Ping('api.moderatecontent.com', 80, 1)) {
echo '
<script>
new $.zui.Messager("moderatecontent 鉴黄接口无法ping通! ",{

View File

@ -263,7 +263,7 @@ function getFileNumber($dir)
* @return mixed
* @example getDir("./dir")
*/
function getDir($dir)
function getDirList($dir)
{
$dirArray[] = NULL;
if (false != ($handle = opendir($dir))) {
@ -321,32 +321,41 @@ function getFile($dir)
function get_file_by_glob($dir_fileName_suffix, $type = 'list')
{
global $config;
$glob = glob($dir_fileName_suffix, GLOB_BRACE);
// 获取所有文件
if ($type == 'list') {
foreach ($glob as $v) {
if (is_file($v)) $res[] = basename($v);
}
// 排序
if ($res) {
switch ($config['showSort']) {
case 1:
$res = array_reverse($res);
break;
$glob = glob($dir_fileName_suffix, GLOB_BRACE);
if ($glob) {
foreach ($glob as $v) {
if (is_file($v)) $res[] = basename($v);
}
// 排序
if ($res) {
switch ($config['showSort']) {
case 1:
$res = array_reverse($res);
break;
}
}
} else {
$res = array();
}
}
if ($type == 'number') {
$res = 0;
$glob = glob($dir_fileName_suffix); //把该路径下所有的文件存到一个数组里面;
foreach ($glob as $v) {
if (is_file($v)) {
$res++;
} else {
$res += get_file_by_glob($v . "/*", $type = 'number');
if ($glob) {
foreach ($glob as $v) {
if (is_file($v)) {
$res++;
} else {
$res += get_file_by_glob($v . "/*", $type = 'number');
}
}
}else{
$res = 0;
}
}
return $res;

View File

@ -1,105 +1,11 @@
<?php require_once __DIR__ . '/header.php'; ?>
<style>
/** 图片列表*/
@media screen and (min-width:960px) {
.listNum img {
width: 258px;
height: 258px;
}
}
@media screen and (max-width:960px) {
.listNum img {
width: 358px;
height: 258px;
}
}
/** 返回顶部*/
* {
list-style: none;
border: 0;
}
#rocket-to-top div {
left: 0;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
top: 0;
width: 110px;
}
#rocket-to-top .level-2 {
background: url("../public/images/rocket_button_up.png") no-repeat scroll -149px 0 transparent;
display: none;
height: 250px;
opacity: 0;
z-index: 1;
}
#rocket-to-top .level-3 {
background: none repeat scroll 0 0 transparent;
cursor: pointer;
display: block;
height: 150px;
z-index: 2;
}
#rocket-to-top {
background: url("../public/images/rocket_button_up.png") no-repeat scroll 0 0 transparent;
cursor: default;
display: block;
height: 250px;
margin: -125px 0 0;
overflow: hidden;
padding: 0;
position: fixed;
right: 0;
top: 80%;
width: 110px;
z-index: 11;
}
.cards {
padding-top: 0px;
padding-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
.card {
box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
border-radius: 5px 5px 5px 5px;
}
img {
cursor: pointer;
transition: all 0.8s;
}
img:hover {
transform: scale(1.5);
position: relative;
z-index: 100;
}
.bottom-bar {
width: 100%;
position: absolute;
bottom: -4px;
background-color: rgba(0, 0, 0, 0.2);
}
</style>
<div class="row" style="margin-bottom:100px">
<div class="col-md-12">
<?php
if (!$config['showSwitch'] && !is_who_login('admin')) {
echo '<div class="alert alert-info">管理员关闭了预览哦~~</div>';
} else {
if (!$config['showSwitch'] && !is_who_login('admin')) : ?>
<div class="alert alert-info">管理员关闭了预览哦~~</div>
<?php exit(require_once __DIR__ . '/footer.php');
else :
$path = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/'); // 获取指定目录
$path = preg_replace("/^d{4}-d{2}-d{2} d{2}:d{2}:d{2}$/s", "", trim($path)); // 过滤非日期,删除空格
$keyNum = isset($_GET['num']) ? $_GET['num'] : $config['listNumber']; // 获取指定浏览数量
@ -107,42 +13,38 @@
// $fileArr = getFile(APP_ROOT . config_path($path)); // 获取当日上传列表
$fileType = isset($_GET['search']) ? '*.' . preg_replace("/[\W]/", "", $_GET['search']) : '*.*'; // 按照图片格式
$fileArr = get_file_by_glob(APP_ROOT . config_path($path) . $fileType, 'list'); // 获取当日上传列表
echo '
<ul id="viewjs">
<div class="cards listNum">';
if ($fileArr[0]) {
foreach ($fileArr as $key => $value) {
if ($key < $keyNum) {
$imgUrl = $config['imgurl'] . config_path($path) . $value;
echo '
<div class="col-md-4 col-sm-6 col-lg-3">
<div class="card">
<li><img src="../public/images/loading.svg" data-image="' . creat_thumbnail_by_list($imgUrl) . '" data-original="' . $imgUrl . '" alt="简单图床-EasyImage"></li>
<div class="bottom-bar">
<a href="' . $imgUrl . '" target="_blank"><i class="icon icon-picture" data-toggle="tooltip" title="原图" style="margin-left:10px;"></i></a>
<a href="#" class="copy" data-clipboard-text="' . $imgUrl . '" data-toggle="tooltip" title="复制" style="margin-left:10px;"><i class="icon icon-copy"></i></a>
<a href="/application/info.php?img=' . $imgUrl . '" data-toggle="tooltip" title="信息" target="_blank" style="margin-left:10px;"><i class="icon icon-info-sign"></i></a>
<a href="' . $config['domain'] . '/application/del.php?recycle_url=' . $imgUrl . '" target="_blank" data-toggle="tooltip" title="回收" style="margin-left:10px;"><i class="icon icon-undo"></i></a>
<a href="' . $config['domain'] . '/application/del.php?url=' . $imgUrl . '" target="_blank" data-toggle="tooltip" title="删除" style="margin-left:10px;"><i class="icon icon-trash"></i></a>
<label style="margin-left:10px;" class="text-primary"><input type="checkbox" style="margin: left 200px;" id="url" name="checkbox" value="' . $imgUrl . '"> 选择</label>
</div>
$allUploud = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/');
$allUploud = get_file_by_glob(APP_ROOT . $config['path'] . $allUploud, 'number'); // 当前日期全部上传
$httpUrl = array('date' => $path, 'num' => getFileNumber(APP_ROOT . config_path($path))); // 组合url
if (empty($fileArr[0])) : ?>
<div class="alert alert-danger">今天还没有上传的图片哟~~ <br />快来上传第一张吧~!</div>
<?php else : ?>
<ul id="viewjs">
<div class="cards listNum">
<?php
foreach ($fileArr as $key => $value) :
if ($key < $keyNum) {
$imgUrl = $config['imgurl'] . config_path($path) . $value;
}
?>
<div class="col-md-4 col-sm-6 col-lg-3">
<div class="card">
<li><img src="../public/images/loading.svg" data-image="<?php echo creat_thumbnail_by_list($imgUrl); ?>" data-original="<?php echo $imgUrl; ?>" alt="简单图床-EasyImage"></li>
<div class="bottom-bar">
<a href="<?php echo $imgUrl; ?>" target="_blank"><i class="icon icon-picture" data-toggle="tooltip" title="原图" style="margin-left:10px;"></i></a>
<a href="#" class="copy" data-clipboard-text="<?php echo $imgUrl; ?>" data-toggle="tooltip" title="复制" style="margin-left:10px;"><i class="icon icon-copy"></i></a>
<a href="/application/info.php?img=<?php echo $imgUrl; ?>" data-toggle="tooltip" title="信息" target="_blank" style="margin-left:10px;"><i class="icon icon-info-sign"></i></a>
<a href="<?php echo $config['domain']; ?>/application/del.php?recycle_url=<?php echo $imgUrl; ?>" target="_blank" data-toggle="tooltip" title="回收" style="margin-left:10px;"><i class="icon icon-undo"></i></a>
<a href="<?php echo $config['domain']; ?>/application/del.php?url=<?php echo $imgUrl; ?>" target="_blank" data-toggle="tooltip" title="删除" style="margin-left:10px;"><i class="icon icon-trash"></i></a>
<label style="margin-left:10px;" class="text-primary"><input type="checkbox" style="margin: left 200px;" id="url" name="checkbox" value="<?php echo $imgUrl; ?>"> 选择</label>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
';
}
}
echo '</div>';
} else {
echo '<div class="alert alert-danger">今天还没有上传的图片哟~~ <br />快来上传第一张吧~!</div>';
}
echo '</ul>';
}
// 当前日期全部上传
$allUploud = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/');
$allUploud = get_file_by_glob(APP_ROOT . $config['path'] . $allUploud, 'number');
// 组合url
@$httpUrl = array('date' => $path, 'num' => getFileNumber(APP_ROOT . config_path($path)));
?>
</ul>
<?php endif;
endif; ?>
</div>
<div class="col-md-12">
<hr />
@ -212,6 +114,7 @@
<div class="level-3"></div>
</div>
</div>
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/EasyImage.css">
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/viewjs/viewer.min.css">
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.css">
<script src="<?php static_cdn(); ?>/public/static/lazyload/lazyload.js"></script>

View File

@ -1,4 +1,4 @@
<?php
<?php
$tokenList=Array
(
'8337effca0ddfcd9c5899f3509b23657'=>Array
@ -16,6 +16,7 @@ $tokenList=Array
'3e2246984b5047c25dcf08dc41c367b8'=>Array
(
'id'=>0,
'expired'=>1645765606
'expired'=>1645765606,
'add_time'=>1645722743
)
);

0
config/config.php Executable file → Normal file
View File

0
i/.htaccess Executable file → Normal file
View File

View File

@ -0,0 +1,92 @@
/** 图片列表*/
@media screen and (min-width:960px) {
.listNum img {
width: 258px;
height: 258px;
}
}
@media screen and (max-width:960px) {
.listNum img {
width: 358px;
height: 258px;
}
}
/** 返回顶部*/
* {
list-style: none;
border: 0;
}
#rocket-to-top div {
left: 0;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
top: 0;
width: 110px;
}
#rocket-to-top .level-2 {
background: url("../public/images/rocket_button_up.png") no-repeat scroll -149px 0 transparent;
display: none;
height: 250px;
opacity: 0;
z-index: 1;
}
#rocket-to-top .level-3 {
background: none repeat scroll 0 0 transparent;
cursor: pointer;
display: block;
height: 150px;
z-index: 2;
}
#rocket-to-top {
background: url("../public/images/rocket_button_up.png") no-repeat scroll 0 0 transparent;
cursor: default;
display: block;
height: 250px;
margin: -125px 0 0;
overflow: hidden;
padding: 0;
position: fixed;
right: 0;
top: 80%;
width: 110px;
z-index: 11;
}
.cards {
padding-top: 0px;
padding-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
.card {
box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
border-radius: 5px 5px 5px 5px;
}
img {
cursor: pointer;
transition: all 0.8s;
}
img:hover {
transform: scale(1.5);
position: relative;
z-index: 100;
}
.bottom-bar {
width: 100%;
position: absolute;
bottom: -4px;
background-color: rgba(0, 0, 0, 0.2);
}