pull/141/head
icret 2023-03-09 02:42:50 +08:00
parent ba4905122f
commit 74bc2f401d
57 changed files with 4735 additions and 4739 deletions

View File

@ -3,7 +3,7 @@
* 简单图床设置页面 * 简单图床设置页面
* 2022-1-24 05:57:35 * 2022-1-24 05:57:35
*/ */
require_once __DIR__ . '/../application/header.php'; require_once __DIR__ . '/../app/header.php';
require_once APP_ROOT . '/config/api_key.php'; require_once APP_ROOT . '/config/api_key.php';
require_once APP_ROOT . '/config/config.guest.php'; require_once APP_ROOT . '/config/config.guest.php';
@ -15,7 +15,7 @@ if (!is_who_login('admin')) {
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show();</script>'; }).show();</script>';
header("refresh:2;url=" . $config['domain'] . "/admin/index.php"); header("refresh:2;url=" . $config['domain'] . "/admin/index.php");
require_once APP_ROOT . '/application/footer.php'; require_once APP_ROOT . '/app/footer.php';
exit; exit;
} }
@ -499,7 +499,7 @@ auto_delete(); //定时删除
</form> </form>
</div> </div>
<div class="tab-pane fade " id="Content4"> <div class="tab-pane fade " id="Content4">
<form action="../application/compressing.php" method="post" target="_blank"> <form action="../app/compressing.php" method="post" target="_blank">
<h5 class="header-dividing">压缩文件夹</h5> <h5 class="header-dividing">压缩文件夹</h5>
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
@ -568,7 +568,7 @@ auto_delete(); //定时删除
<div class="col-md-12"> <div class="col-md-12">
<div class="col-md-4"> <div class="col-md-4">
<h5 class="header-dividing">上传日志 <small>需要开启上传日志</small></h5> <h5 class="header-dividing">上传日志 <small>需要开启上传日志</small></h5>
<form class="form-inline" action="../application/viewlog.php" method="post" target="_blank"> <form class="form-inline" action="../app/viewlog.php" method="post" target="_blank">
<div class="form-group"> <div class="form-group">
<label for="logDate" class="text-primary">月份: </label> <label for="logDate" class="text-primary">月份: </label>
<input type="text" class="form-control logDate" id="logDate" name="logDate" value="<?php echo date('Y-m'); ?>" required="required" readonly> <input type="text" class="form-control logDate" id="logDate" name="logDate" value="<?php echo date('Y-m'); ?>" required="required" readonly>
@ -579,7 +579,7 @@ auto_delete(); //定时删除
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<h5 class="header-dividing">登录日志 <small>仅显示当月</small></h5> <h5 class="header-dividing">登录日志 <small>仅显示当月</small></h5>
<button type="button" class="btn btn-primary" data-toggle="modal" data-title="登录日志 - 仅显示当月" data-icon="book" data-moveable="true" data-width="60%" data-type="ajax" data-url="../application/viewlog.php?login_log&sign=<?php echo md5($config['password'] . date('ymdh')); ?>">查看</button> <button type="button" class="btn btn-primary" data-toggle="modal" data-title="登录日志 - 仅显示当月" data-icon="book" data-moveable="true" data-width="60%" data-type="ajax" data-url="../app/viewlog.php?login_log&sign=<?php echo md5($config['password'] . date('ymdh')); ?>">查看</button>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<h5 class="header-dividing" data-toggle="tooltip" title="仅限存储分类路径为 Y/m/d/ 格式<br/>且每天需要访问一次后台才执行<br/>先重命名要删除文件夹作为备份<br/>超过定时日期的2倍后再彻底删除重命名的文件夹<br/>超过定时日期前和开启分离的文件夹不删除">定时删除 <small>数值为<code>0</code>时关闭</small></h5> <h5 class="header-dividing" data-toggle="tooltip" title="仅限存储分类路径为 Y/m/d/ 格式<br/>且每天需要访问一次后台才执行<br/>先重命名要删除文件夹作为备份<br/>超过定时日期的2倍后再彻底删除重命名的文件夹<br/>超过定时日期前和开启分离的文件夹不删除">定时删除 <small>数值为<code>0</code>时关闭</small></h5>
@ -890,7 +890,7 @@ auto_delete(); //定时删除
$file_size = getDistUsed(filesize($file_cache_path)); // 大小 $file_size = getDistUsed(filesize($file_cache_path)); // 大小
$filen_name = $cache_file[$i]; // 名称 $filen_name = $cache_file[$i]; // 名称
$url = $config['domain'] . $file_path; // 网络连接 $url = $config['domain'] . $file_path; // 网络连接
$unlink_img = $config['domain'] . '/application/del.php?url=' . $file_path; // 删除连接 $unlink_img = $config['domain'] . '/app/del.php?url=' . $file_path; // 删除连接
?> ?>
<tr> <tr>
<td><?php echo $i; ?></td> <td><?php echo $i; ?></td>
@ -899,7 +899,7 @@ auto_delete(); //定时删除
<td><?php echo $file_size; ?></td> <td><?php echo $file_size; ?></td>
<td> <td>
<a class="btn btn-mini" href="<?php echo $url; ?>" target="_blank">查看</a> <a class="btn btn-mini" href="<?php echo $url; ?>" target="_blank">查看</a>
<a class="btn btn-mini" href="/application/info.php?img=<?php echo $file_path; ?>" target="_blank">信息</a> <a class="btn btn-mini" href="/app/info.php?img=<?php echo $file_path; ?>" target="_blank">信息</a>
<a class="btn btn-mini btn-success" href="?suspic_reimg=<?php echo $filen_name; ?>">恢复</a> <a class="btn btn-mini btn-success" href="?suspic_reimg=<?php echo $filen_name; ?>">恢复</a>
<a class="btn btn-mini btn-danger" href="<?php echo $unlink_img; ?>" target="_blank">删除</a> <a class="btn btn-mini btn-danger" href="<?php echo $unlink_img; ?>" target="_blank">删除</a>
</td> </td>
@ -984,7 +984,7 @@ auto_delete(); //定时删除
Ip2region (2.0 - xdb) 是一个离线 IP 数据管理框架和定位库,支持亿级别的数据段,10微秒级别的查询性能,提供了许多主流编程语言的 xdb 数据管理引擎的实现。 Ip2region (2.0 - xdb) 是一个离线 IP 数据管理框架和定位库,支持亿级别的数据段,10微秒级别的查询性能,提供了许多主流编程语言的 xdb 数据管理引擎的实现。
每个 ip 数据段的 region 信息都固定了格式:国家|区域|省份|城市|ISP, 只有中国的数据绝大部分精确到了城市, 其他国家部分数据只能定位到国家, 后前的选项全部是0。 每个 ip 数据段的 region 信息都固定了格式:国家|区域|省份|城市|ISP, 只有中国的数据绝大部分精确到了城市, 其他国家部分数据只能定位到国家, 后前的选项全部是0。
</p> </p>
<h6>* 下载 <a href="https://raw.githubusercontent.com/lionsoul2014/ip2region/master/data/ip2region.xdb" target="_blank">ip2region.xdb</a> IP数据库上传到 <small style="color: black;">/application/ip2region/</small> 文件夹, 如遇到下载失败可访问开源地址下载: [ <a href="https://github.com/lionsoul2014/ip2region" target="_blank"><small style="color: black;">Github</small></a> | <a href="https://gitee.com/lionsoul/ip2region" target="_blank"><small style="color: black;">Gitee</small></a> ] 更新方法与此相同。</h6> <h6>* 下载 <a href="https://raw.githubusercontent.com/lionsoul2014/ip2region/master/data/ip2region.xdb" target="_blank">ip2region.xdb</a> IP数据库上传到 <small style="color: black;">/app/ip2region/</small> 文件夹, 如遇到下载失败可访问开源地址下载: [ <a href="https://github.com/lionsoul2014/ip2region" target="_blank"><small style="color: black;">Github</small></a> | <a href="https://gitee.com/lionsoul/ip2region" target="_blank"><small style="color: black;">Gitee</small></a> ] 更新方法与此相同。</h6>
</div> </div>
</div> </div>
<?php if (getVersion() !== get_current_version()) : ?> <?php if (getVersion() !== get_current_version()) : ?>
@ -1135,7 +1135,7 @@ auto_delete(); //定时删除
<li>直接输入账号和密码即可完成修改</li> <li>直接输入账号和密码即可完成修改</li>
<li>更改后会立即生效并重新登录,请务必牢记账号和密码! </li> <li>更改后会立即生效并重新登录,请务必牢记账号和密码! </li>
<li>如果忘记账号可以打开-><code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'user'=><strong>admin</strong>'">user</code>对应的键值->填入</li> <li>如果忘记账号可以打开-><code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'user'=><strong>admin</strong>'">user</code>对应的键值->填入</li>
<li>如果忘记密码请将密码->转换成SHA256-><a href="<?php echo $config['domain'] . '/application/reset_password.php'; ?>" target="_blank" class="text-purple">转换网址</a>->打开<code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'password'=>'<strong>e6e0612609</strong>'">password</code>对应的键值->填入</li> <li>如果忘记密码请将密码->转换成SHA256-><a href="<?php echo $config['domain'] . '/app/reset_password.php'; ?>" target="_blank" class="text-purple">转换网址</a>->打开<code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'password'=>'<strong>e6e0612609</strong>'">password</code>对应的键值->填入</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -1232,7 +1232,7 @@ auto_delete(); //定时删除
$file_size = getDistUsed(filesize($file_cache_path)); // 大小 $file_size = getDistUsed(filesize($file_cache_path)); // 大小
$filen_name = $cache_file[$i]; // 名称 $filen_name = $cache_file[$i]; // 名称
$url = $config['domain'] . $file_path; // 网络连接 $url = $config['domain'] . $file_path; // 网络连接
$unlink_img = $config['domain'] . '/application/del.php?url=' . $file_path; // 删除连接 $unlink_img = $config['domain'] . '/app/del.php?url=' . $file_path; // 删除连接
?> ?>
<tr> <tr>
<td><?php echo $i; ?></td> <td><?php echo $i; ?></td>
@ -1241,7 +1241,7 @@ auto_delete(); //定时删除
<td><?php echo $file_size; ?></td> <td><?php echo $file_size; ?></td>
<td> <td>
<a class="btn btn-mini" href="<?php echo $url; ?>" target="_blank">查看</a> <a class="btn btn-mini" href="<?php echo $url; ?>" target="_blank">查看</a>
<a class="btn btn-mini" href="/application/info.php?img=<?php echo $file_path; ?>" target="_blank">信息</a> <a class="btn btn-mini" href="/app/info.php?img=<?php echo $file_path; ?>" target="_blank">信息</a>
<a class="btn btn-mini btn-success" href="?recycle_reimg=<?php echo $filen_name; ?>">恢复</a> <a class="btn btn-mini btn-success" href="?recycle_reimg=<?php echo $filen_name; ?>">恢复</a>
<a class="btn btn-mini btn-danger" href="<?php echo $unlink_img; ?>" target="_blank">删除</a> <a class="btn btn-mini btn-danger" href="<?php echo $unlink_img; ?>" target="_blank">删除</a>
</td> </td>
@ -1365,7 +1365,7 @@ auto_delete(); //定时删除
<a class="btn btn-mini btn-primary" href="/admin/manager.php?p=<?php echo date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用Tinyfilemanager管理文件"><i class="icon icon-folder-open"> 文件管理</i></a> <a class="btn btn-mini btn-primary" href="/admin/manager.php?p=<?php echo date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用Tinyfilemanager管理文件"><i class="icon icon-folder-open"> 文件管理</i></a>
<a class="btn btn-mini btn-primary" href="/i/manag.php?path=<?php echo date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用web-indexr管理文件"><i class="icon icon-folder-close"> 文件管理</i></a> <a class="btn btn-mini btn-primary" href="/i/manag.php?path=<?php echo date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用web-indexr管理文件"><i class="icon icon-folder-close"> 文件管理</i></a>
<h5 class="header-dividing">删除文件 <small>* 删除后不可恢复</small></h5> <h5 class="header-dividing">删除文件 <small>* 删除后不可恢复</small></h5>
<form class="form-inline" method="get" action="../application/del.php" id="form" name="delForm" target="_blank" style="margin-bottom: 5px;"> <form class="form-inline" method="get" action="../app/del.php" id="form" name="delForm" target="_blank" style="margin-bottom: 5px;">
<p id="delimgurl"></p> <p id="delimgurl"></p>
<div class="form-group"> <div class="form-group">
<label for="del" class="text-warning">删除单张图片文件: </label> <label for="del" class="text-warning">删除单张图片文件: </label>
@ -1641,11 +1641,11 @@ auto_delete(); //定时删除
guestMyDataGrid.sortBy('add_time', 'desc'); guestMyDataGrid.sortBy('add_time', 'desc');
/** 引入设置页面检测文件 */ /** 引入设置页面检测文件 */
<?php if ($config['checkEnv']) require_once APP_ROOT . '/application/check_admin.inc.php'; ?> <?php if ($config['checkEnv']) require_once APP_ROOT . '/app/check_admin.inc.php'; ?>
// 更改网页标题 // 更改网页标题
document.title = "图床设置 - <?php echo $config['title']; ?>" document.title = "图床设置 - <?php echo $config['title']; ?>"
</script> </script>
<?php <?php
/** 引入底部 */ /** 引入底部 */
require_once APP_ROOT . '/application/footer.php'; require_once APP_ROOT . '/app/footer.php';

View File

@ -2,8 +2,8 @@
/* /*
* 统计中心 * 统计中心
*/ */
require_once '../application/header.php'; require_once '../app/header.php';
require_once APP_ROOT . '/application/chart.php'; require_once APP_ROOT . '/app/chart.php';
// 检测登录和是否开启统计 // 检测登录和是否开启统计
if (!$config['chart_on'] && !is_who_login('admin')) exit(header('Location: ' . $config['domain'] . '?hart#closed')); if (!$config['chart_on'] && !is_who_login('admin')) exit(header('Location: ' . $config['domain'] . '?hart#closed'));
@ -320,4 +320,4 @@ if (is_array($char_data)) {
document.title = "图床统计信息 - <?php echo $config['title']; ?>" document.title = "图床统计信息 - <?php echo $config['title']; ?>"
</script> </script>
<?php require_once APP_ROOT . '/application/footer.php'; <?php require_once APP_ROOT . '/app/footer.php';

View File

@ -2,8 +2,8 @@
/* /*
* 登录页面 * 登录页面
*/ */
require_once __DIR__ . '/../application/function.php'; require_once __DIR__ . '/../app/function.php';
require_once APP_ROOT . '/application/header.php'; require_once APP_ROOT . '/app/header.php';
require_once APP_ROOT . '/config/config.guest.php'; require_once APP_ROOT . '/config/config.guest.php';
// 退出 // 退出
@ -36,7 +36,7 @@ if (isset($_GET['login'])) {
'; ';
} }
} }
exit(require_once APP_ROOT . '/application/footer.php'); exit(require_once APP_ROOT . '/app/footer.php');
} }
// 提交登录 // 提交登录
@ -52,7 +52,7 @@ if (isset($_POST['password']) and isset($_POST['user'])) {
// 延时2s跳转 // 延时2s跳转
window.setTimeout("window.location=\'./index.php\'",2000); window.setTimeout("window.location=\'./index.php\'",2000);
</script>'; </script>';
exit(require_once APP_ROOT . '/application/footer.php'); exit(require_once APP_ROOT . '/app/footer.php');
} else { } else {
session_start(); session_start();
if (strtolower($_REQUEST['code']) !== $_SESSION['code']) { if (strtolower($_REQUEST['code']) !== $_SESSION['code']) {
@ -63,7 +63,7 @@ if (isset($_POST['password']) and isset($_POST['user'])) {
// 延时2s跳转 // 延时2s跳转
window.setTimeout("window.location=\'./index.php\'",2000); window.setTimeout("window.location=\'./index.php\'",2000);
</script>'; </script>';
exit(require_once APP_ROOT . '/application/footer.php'); exit(require_once APP_ROOT . '/app/footer.php');
} }
} }
} }
@ -108,7 +108,7 @@ if (isset($_POST['password']) and isset($_POST['user'])) {
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p class="text-primary">忘记账号可以打开<code>/config/config.php</code>文件找到<code data-toggle="tooltip" title="'user'=><strong>admin</strong>'">user</code>对应的键值->填入</p> <p class="text-primary">忘记账号可以打开<code>/config/config.php</code>文件找到<code data-toggle="tooltip" title="'user'=><strong>admin</strong>'">user</code>对应的键值->填入</p>
<p class="text-success">忘记密码请将密码转换成SHA256(<a href="<?php echo $config['domain'] . '/application/reset_password.php'; ?>" target="_blank" class="text-purple">转换网址</a>)->打开<code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'password'=>'<strong>e6e0612609</strong>'">password</code>对应的键值->填入</p> <p class="text-success">忘记密码请将密码转换成SHA256(<a href="<?php echo $config['domain'] . '/app/reset_password.php'; ?>" target="_blank" class="text-purple">转换网址</a>)->打开<code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'password'=>'<strong>e6e0612609</strong>'">password</code>对应的键值->填入</p>
<h4 class="text-danger">更改后会立即生效并重新登录,请务必牢记账号和密码! </h4> <h4 class="text-danger">更改后会立即生效并重新登录,请务必牢记账号和密码! </h4>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -134,7 +134,7 @@ if (isset($_POST['password']) and isset($_POST['user'])) {
<input class="form-control" type="text" name="code" value="" placeholder="请输入验证码" autocomplete="off" required="required" /> <input class="form-control" type="text" name="code" value="" placeholder="请输入验证码" autocomplete="off" required="required" />
<div class="form-group"> <div class="form-group">
<div class="col"> <div class="col">
<label><img src="../application/captcha.php" width="185px" onClick="this.src='../application/captcha.php?nocache='+Math.random()" title="点击换一张" /></label> <label><img src="../app/captcha.php" width="185px" onClick="this.src='../app/captcha.php?nocache='+Math.random()" title="点击换一张" /></label>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -176,4 +176,4 @@ if (isset($_POST['password']) and isset($_POST['user'])) {
container.classList.toggle('active'); container.classList.toggle('active');
} }
</script> </script>
<?php require_once APP_ROOT . '/application/footer.php'; <?php require_once APP_ROOT . '/app/footer.php';

View File

@ -2,23 +2,23 @@
//Default Configuration //Default Configuration
$CONFIG = '{"lang":"zh-CN","error_reporting":false,"show_hidden":true,"hide_Cols":false,"calc_folder":true,"theme":"light"}'; $CONFIG = '{"lang":"zh-CN","error_reporting":false,"show_hidden":true,"hide_Cols":false,"calc_folder":true,"theme":"light"}';
require_once __DIR__ . '/../application/function.php'; require_once __DIR__ . '/../app/function.php';
// 是否管理员登录 // 是否管理员登录
if(!is_who_login('admin')){ if(!is_who_login('admin')){
require_once APP_ROOT.'/application/header.php'; require_once APP_ROOT.'/app/header.php';
echo '<div class="alert alert-danger">还没有登陆哦~~</div>'; echo '<div class="alert alert-danger">还没有登陆哦~~</div>';
header("refresh:3;url=" . $config['domain'] . "/admin/index.php"); header("refresh:3;url=" . $config['domain'] . "/admin/index.php");
require_once APP_ROOT.'/application/footer.php'; require_once APP_ROOT.'/app/footer.php';
exit; exit;
} }
// 开启tinyfilemanager图片管理 // 开启tinyfilemanager图片管理
if (!$config['file_manage']) { if (!$config['file_manage']) {
require_once APP_ROOT.'/application/header.php'; require_once APP_ROOT.'/app/header.php';
echo '<div class="alert alert-danger">图片管理已关闭~~</div>'; echo '<div class="alert alert-danger">图片管理已关闭~~</div>';
header("refresh:3;url=" . $_SERVER["HTTP_REFERER"] . '?manager-closed'); header("refresh:3;url=" . $_SERVER["HTTP_REFERER"] . '?manager-closed');
require_once APP_ROOT.'/application/footer.php'; require_once APP_ROOT.'/app/footer.php';
exit; exit;
} }
@ -2108,7 +2108,7 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
if (in_array(strtolower(pathinfo($f, PATHINFO_EXTENSION)), array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))): ?> if (in_array(strtolower(pathinfo($f, PATHINFO_EXTENSION)), array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))): ?>
<?php $imagePreview = fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f); ?> <?php $imagePreview = fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f); ?>
<!-- 分组图片浏览 --> <!-- 分组图片浏览 -->
<a href="<?php echo $imagePreview;?>" data-toggle="lightbox" data-group="manager-group"><img src="/application/thumb.php?img=<?php echo parse_url($imagePreview)['path'];?>" class="img-rounded" width="100px" height="100px" alt="<?php echo fm_enc($f);?>"></a> <a href="<?php echo $imagePreview;?>" data-toggle="lightbox" data-group="manager-group"><img src="/app/thumb.php?img=<?php echo parse_url($imagePreview)['path'];?>" class="img-rounded" width="100px" height="100px" alt="<?php echo fm_enc($f);?>"></a>
<?php else: ?> <?php else: ?>
<a href="<?php echo $filelink ?>" title="<?php echo $f ?>"> <a href="<?php echo $filelink ?>" title="<?php echo $f ?>">
<?php endif; ?> <?php endif; ?>

View File

@ -2,7 +2,7 @@
/* /*
* 使用条款页面 * 使用条款页面
*/ */
require_once __DIR__ . '/../application/header.php'; require_once __DIR__ . '/../app/header.php';
/** 顶部广告 */ /** 顶部广告 */
if ($config['ad_top']) echo $config['ad_top_info']; if ($config['ad_top']) echo $config['ad_top_info'];
@ -25,4 +25,4 @@ if ($config['ad_bot']) echo $config['ad_bot_info'];
</script> </script>
<?php <?php
require_once __DIR__ . '/../application/footer.php'; require_once __DIR__ . '/../app/footer.php';

View File

@ -2,8 +2,8 @@
/* /*
* 统计中心 * 统计中心
*/ */
require_once '../application/header.php'; require_once '../app/header.php';
require_once APP_ROOT . '/application/chart.php'; require_once APP_ROOT . '/app/chart.php';
// 检测是否开启统计 // 检测是否开启统计
if (!$config['chart_on']) exit(header('Location: ' . $config['domain'] . '?chart#closed')); if (!$config['chart_on']) exit(header('Location: ' . $config['domain'] . '?chart#closed'));
@ -11,7 +11,7 @@ if (!$config['chart_on']) exit(header('Location: ' . $config['domain'] . '?chart
// 检测登录 // 检测登录
if (!is_who_login('admin')) { if (!is_who_login('admin')) {
checkLogin(); checkLogin();
exit(require_once APP_ROOT . '/application/footer.php'); exit(require_once APP_ROOT . '/app/footer.php');
} }
// 删除统计文件 // 删除统计文件
if (isset($_POST['del_total'])) { if (isset($_POST['del_total'])) {
@ -238,4 +238,4 @@ if (is_array($char_data)) {
document.title = "图床统计信息 - <?php echo $config['title']; ?>"; document.title = "图床统计信息 - <?php echo $config['title']; ?>";
</script> </script>
<?php require_once APP_ROOT . '/application/footer.php'; <?php require_once APP_ROOT . '/app/footer.php';

View File

@ -2,8 +2,8 @@
namespace Verot\Upload; namespace Verot\Upload;
require_once __DIR__ . '/../application/function.php'; require_once __DIR__ . '/../app/function.php';
require_once APP_ROOT . '/application/class.upload.php'; require_once APP_ROOT . '/app/class.upload.php';
require_once APP_ROOT . '/config/api_key.php'; require_once APP_ROOT . '/config/api_key.php';
// 允许跨域 https://stackoverflow.com/questions/8719276/cross-origin-request-headerscors-with-php-headers // 允许跨域 https://stackoverflow.com/questions/8719276/cross-origin-request-headerscors-with-php-headers
@ -141,18 +141,18 @@ if ($handle->uploaded) {
// 源图保护 key值是由crc32加密的hide_key // 源图保护 key值是由crc32加密的hide_key
if ($config['hide'] == 1) { if ($config['hide'] == 1) {
$imageUrl = $config['domain'] . '/application/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['hide_key'])); $imageUrl = $config['domain'] . '/app/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['hide_key']));
} }
// 删除文件链接 // 删除文件链接
if ($config['show_user_hash_del']) { if ($config['show_user_hash_del']) {
$delUrl = $config['domain'] . '/application/del.php?hash=' . urlHash($pathIMG, 0); $delUrl = $config['domain'] . '/app/del.php?hash=' . urlHash($pathIMG, 0);
} else { } else {
$delUrl = "Admin closed user delete"; $delUrl = "Admin closed user delete";
} }
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-30 // 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-30
$handleThumb = $config['domain'] . '/application/thumb.php?img=' . $pathIMG; $handleThumb = $config['domain'] . '/app/thumb.php?img=' . $pathIMG;
if ($config['thumbnail'] == 2) { if ($config['thumbnail'] == 2) {
// 自定义缩略图长宽 // 自定义缩略图长宽
$handle->image_resize = true; $handle->image_resize = true;

View File

@ -5,8 +5,8 @@
* 2022年2月22日11:41:38 * 2022年2月22日11:41:38
* @author Icret * @author Icret
*/ */
require_once '../application/function.php'; require_once '../app/function.php';
require_once '../application/chart.php'; require_once '../app/chart.php';
// 检查是否开启查询 // 检查是否开启查询
if ($config['public'] == 0) die('开放数据接口已关闭!'); if ($config['public'] == 0) die('开放数据接口已关闭!');

0
application/TimThumb.php → app/TimThumb.php Executable file → Normal file
View File

714
application/WaterMask.php → app/WaterMask.php Executable file → Normal file
View File

@ -1,357 +1,357 @@
<?php <?php
// https://blog.csdn.net/MyDream229/article/details/80009012 // https://blog.csdn.net/MyDream229/article/details/80009012
class Imgs class Imgs
{ {
/** /**
* 取得图片宽 * 取得图片宽
* @param string $src 图片相对路径或绝对路径 * @param string $src 图片相对路径或绝对路径
*/ */
public static function get_width($src) public static function get_width($src)
{ {
return imagesx($src); return imagesx($src);
} }
/** /**
* 取得图片高 * 取得图片高
* @param string $src 图片相对路径或绝对路径 * @param string $src 图片相对路径或绝对路径
*/ */
public static function get_height($src) public static function get_height($src)
{ {
return imagesy($src); return imagesy($src);
} }
/** /**
* 图片缩放函数 * 图片缩放函数
* @param string $src 图片相对路径或绝对路径 * @param string $src 图片相对路径或绝对路径
* @param int $w 缩略图宽 * @param int $w 缩略图宽
* @param int $h 缩略图高 * @param int $h 缩略图高
* @return array code状态。msg提示信息 * @return array code状态。msg提示信息
**/ **/
public static function thumb($src, $w = null, $h = null) public static function thumb($src, $w = null, $h = null)
{ {
if (empty($src)) { if (empty($src)) {
return array('code' => false, 'msg' => '请指定$src'); return array('code' => false, 'msg' => '请指定$src');
} }
$temp = pathinfo($src); $temp = pathinfo($src);
# 文件名 # 文件名
$name = $temp["basename"]; $name = $temp["basename"];
# 文件所在的文件夹 # 文件所在的文件夹
$dir = $temp["dirname"]; $dir = $temp["dirname"];
# 文件扩展名 # 文件扩展名
$extension = $temp["extension"]; $extension = $temp["extension"];
# 缩略图保存路径,新的文件名为*.thumb.jpg # 缩略图保存路径,新的文件名为*.thumb.jpg
$savepath = "{$dir}/thumb_{$name}"; $savepath = "{$dir}/thumb_{$name}";
# 获取图片的基本信息 # 获取图片的基本信息
$info = getimagesize($src); $info = getimagesize($src);
# 获取图片宽度 # 获取图片宽度
$width = $info[0]; $width = $info[0];
# 获取图片高度 # 获取图片高度
$height = $info[1]; $height = $info[1];
if (!empty($w)) { if (!empty($w)) {
$temp_w = $w; # 计算原图缩放后的宽度 $temp_w = $w; # 计算原图缩放后的宽度
$temp_h = intval($height * ($w / $width)); # 计算原图缩放后的高度 $temp_h = intval($height * ($w / $width)); # 计算原图缩放后的高度
} else { } else {
$temp_w = intval($width * ($h / $height)); # 计算原图缩放后的宽度 $temp_w = intval($width * ($h / $height)); # 计算原图缩放后的宽度
$temp_h = $h; # 计算原图缩放后的高度 $temp_h = $h; # 计算原图缩放后的高度
} }
# 创建画布 # 创建画布
$temp_img = imagecreatetruecolor($temp_w, $temp_h); $temp_img = imagecreatetruecolor($temp_w, $temp_h);
@imagealphablending($temp_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2 @imagealphablending($temp_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2
@imagesavealpha($temp_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3 @imagesavealpha($temp_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3
switch ($info[2]) { switch ($info[2]) {
case 1: case 1:
$im = imagecreatefromgif($src); $im = imagecreatefromgif($src);
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagegif($temp_img, $savepath, 100); imagegif($temp_img, $savepath, 100);
break; break;
case 2: case 2:
$im = imagecreatefromjpeg($src); $im = imagecreatefromjpeg($src);
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagejpeg($temp_img, $savepath, 100); imagejpeg($temp_img, $savepath, 100);
break; break;
case 3: case 3:
$im = imagecreatefrompng($src); $im = imagecreatefrompng($src);
imagesavealpha($im, true); //这里很重要;3-1 imagesavealpha($im, true); //这里很重要;3-1
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagepng($temp_img, $savepath, 100); imagepng($temp_img, $savepath, 100);
break; break;
case 6: case 6:
$im = imagecreatefrombmp($src); $im = imagecreatefrombmp($src);
imagesavealpha($im, true); //这里很重要;3-1 imagesavealpha($im, true); //这里很重要;3-1
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagebmp($temp_img, $savepath, 100); imagebmp($temp_img, $savepath, 100);
break; break;
case 18: case 18:
$im = imagecreatefromwebp($src); $im = imagecreatefromwebp($src);
imagesavealpha($im, true); //这里很重要;3-1 imagesavealpha($im, true); //这里很重要;3-1
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagewebp($temp_img, $savepath, 100); imagewebp($temp_img, $savepath, 100);
break; break;
} }
imagedestroy($im); imagedestroy($im);
return $savepath; return $savepath;
} }
/** /**
* 图片添加水印 * 图片添加水印
* @param string $src 1、图片相对路径或绝对路径 2、以逗号隔开的宽高值('800,600' * @param string $src 1、图片相对路径或绝对路径 2、以逗号隔开的宽高值('800,600'
* @param array 属性值: * @param array 属性值:
* res水印资源1、图片相对路径或绝对路径2、字符串 * res水印资源1、图片相对路径或绝对路径2、字符串
* pos图片水印添加的位置取值范围0~9 * pos图片水印添加的位置取值范围0~9
* 0随机位置在1~8之间随机选取一个位置 * 0随机位置在1~8之间随机选取一个位置
* 1:顶部居左 2:顶部居中 * 1:顶部居左 2:顶部居中
* 3:顶部居右 4:左边居中 * 3:顶部居右 4:左边居中
* 5:图片中心 6:右边居中 * 5:图片中心 6:右边居中
* 7:底部居左 8:底部居中 * 7:底部居左 8:底部居中
* 9:底部居右 * 9:底部居右
* font 字体库(相对路径或绝对路径) * font 字体库(相对路径或绝对路径)
* fontSize文字大小 * fontSize文字大小
* color 水印文字的字体颜色255,255,255 * color 水印文字的字体颜色255,255,255
* name 图片保存名称 * name 图片保存名称
* @return array code状态、 msg提示信息、 url:图片地址 * @return array code状态、 msg提示信息、 url:图片地址
**/ **/
public static function setWater($src, $arr = array()) public static function setWater($src, $arr = array())
{ {
if (empty($src)) { if (empty($src)) {
return array('code' => false, 'msg' => '请指定$src'); return array('code' => false, 'msg' => '请指定$src');
} }
$def = array( $def = array(
'res' => '小川编程', 'res' => '小川编程',
'pos' => 7, 'pos' => 7,
'font' => './1.ttf', 'font' => './1.ttf',
'fontSize' => 24, 'fontSize' => 24,
'color' => '255,255,255,0', 'color' => '255,255,255,0',
'name' => null, 'name' => null,
); );
$def = array_merge($def, $arr); $def = array_merge($def, $arr);
/** /**
* 判断$src是不是图片不是就创建画布 * 判断$src是不是图片不是就创建画布
*/ */
if (!file_exists($src)) { if (!file_exists($src)) {
if (empty($def['name'])) { if (empty($def['name'])) {
return array('code' => false, 'msg' => '请指定图片名称'); return array('code' => false, 'msg' => '请指定图片名称');
} }
# 计算画布宽高 # 计算画布宽高
$obj = explode(',', $src); $obj = explode(',', $src);
if (count($obj) != 2) { if (count($obj) != 2) {
return array( return array(
'code' => false, 'code' => false,
'msg' => '请给正确的宽高,或你给的不是一个有效的地址!' 'msg' => '请给正确的宽高,或你给的不是一个有效的地址!'
); );
} }
$srcImg_w = is_numeric($obj[0]) ? $obj[0] : 400; $srcImg_w = is_numeric($obj[0]) ? $obj[0] : 400;
$srcImg_h = is_numeric($obj[1]) ? $obj[1] : 300; $srcImg_h = is_numeric($obj[1]) ? $obj[1] : 300;
# 创建透明画布 一共3个步骤在下边有标记 # 创建透明画布 一共3个步骤在下边有标记
$dst_img = @imagecreatetruecolor($srcImg_w, $srcImg_h); $dst_img = @imagecreatetruecolor($srcImg_w, $srcImg_h);
@imagealphablending($dst_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2 @imagealphablending($dst_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2
@imagesavealpha($dst_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3 @imagesavealpha($dst_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3
} else { } else {
# 获取图片信息 # 获取图片信息
$srcInfo = @getimagesize($src); $srcInfo = @getimagesize($src);
$srcImg_w = $srcInfo[0]; $srcImg_w = $srcInfo[0];
$srcImg_h = $srcInfo[1]; $srcImg_h = $srcInfo[1];
if (empty($def['name'])) { if (empty($def['name'])) {
$def['name'] = $src; $def['name'] = $src;
} }
# 动态的把图片导入内存中 # 动态的把图片导入内存中
switch ($srcInfo[2]) { switch ($srcInfo[2]) {
case 1: case 1:
$dst_img = imagecreatefromgif($src); $dst_img = imagecreatefromgif($src);
break; break;
case 2: case 2:
$dst_img = imagecreatefromjpeg($src); $dst_img = imagecreatefromjpeg($src);
break; break;
case 3: case 3:
$dst_img = imagecreatefrompng($src); $dst_img = imagecreatefrompng($src);
imagesavealpha($dst_img, true); //这里很重要;3-1 imagesavealpha($dst_img, true); //这里很重要;3-1
break; break;
case 6: case 6:
$dst_img = imagecreatefrombmp($src); $dst_img = imagecreatefrombmp($src);
imagesavealpha($dst_img, true); //这里很重要;3-1 imagesavealpha($dst_img, true); //这里很重要;3-1
break; break;
case 18: case 18:
$dst_img = imagecreatefromwebp($src); $dst_img = imagecreatefromwebp($src);
imagesavealpha($dst_img, true); //这里很重要;3-1 imagesavealpha($dst_img, true); //这里很重要;3-1
break; break;
default: default:
return array('code' => false, 'msg' => '目标图片类型错误'); return array('code' => false, 'msg' => '目标图片类型错误');
exit; exit;
} }
} }
/** /**
* 计算出水印宽高 * 计算出水印宽高
*/ */
if (!file_exists($def['res'])) { if (!file_exists($def['res'])) {
if (!file_exists($def['font'])) { if (!file_exists($def['font'])) {
return array('code' => false, 'msg' => '字体库不存在'); return array('code' => false, 'msg' => '字体库不存在');
} }
$box = @imagettfbbox($def['fontSize'], 0, $def['font'], $def['res']); $box = @imagettfbbox($def['fontSize'], 0, $def['font'], $def['res']);
$logow = max($box[2], $box[4]) - min($box[0], $box[6]); $logow = max($box[2], $box[4]) - min($box[0], $box[6]);
$logoh = max($box[1], $box[3]) - min($box[5], $box[7]); $logoh = max($box[1], $box[3]) - min($box[5], $box[7]);
} else { } else {
$resInfo = @getimagesize($def['res']); $resInfo = @getimagesize($def['res']);
$res_w = $resInfo[0]; $res_w = $resInfo[0];
$res_h = $resInfo[1]; $res_h = $resInfo[1];
if ($srcImg_w < $res_w || $srcImg_h < $res_h) { if ($srcImg_w < $res_w || $srcImg_h < $res_h) {
return array('code' => false, 'msg' => '水印图片过大'); return array('code' => false, 'msg' => '水印图片过大');
} }
# 动态的把图片导入内存中 # 动态的把图片导入内存中
switch ($resInfo[2]) { switch ($resInfo[2]) {
case 1: case 1:
$markim = imagecreatefromgif($def['res']); $markim = imagecreatefromgif($def['res']);
break; break;
case 2: case 2:
$markim = imagecreatefromjpeg($def['res']); $markim = imagecreatefromjpeg($def['res']);
break; break;
case 3: case 3:
$markim = imagecreatefrompng($def['res']); $markim = imagecreatefrompng($def['res']);
break; break;
case 6: case 6:
$markim = imagecreatefrombmp($def['res']); $markim = imagecreatefrombmp($def['res']);
break; break;
case 18: case 18:
$markim = imagecreatefromwebp($def['res']); $markim = imagecreatefromwebp($def['res']);
break; break;
default: default:
return array('code' => false, 'msg' => '水印图片类型错误'); return array('code' => false, 'msg' => '水印图片类型错误');
exit; exit;
} }
$logow = $res_w; $logow = $res_w;
$logoh = $res_h; $logoh = $res_h;
} }
/** /**
* 计算水印显示位置 * 计算水印显示位置
*/ */
if ($def['pos'] == 0) { if ($def['pos'] == 0) {
$def['pos'] = rand(1, 9); $def['pos'] = rand(1, 9);
} }
switch ($def['pos']) { switch ($def['pos']) {
case 1: case 1:
$x = +10; $x = +10;
$y = +10 + $def['fontSize']; $y = +10 + $def['fontSize'];
break; break;
case 2: case 2:
$x = ($srcImg_w - $logow) / 2; $x = ($srcImg_w - $logow) / 2;
$y = +10 + $def['fontSize']; $y = +10 + $def['fontSize'];
break; break;
case 3: case 3:
$x = $srcImg_w - $logow - 10; $x = $srcImg_w - $logow - 10;
$y = +10 + $def['fontSize']; $y = +10 + $def['fontSize'];
break; break;
case 4: case 4:
$x = +10; $x = +10;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize']; $y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break; break;
case 5: case 5:
$x = ($srcImg_w - $logow) / 2; $x = ($srcImg_w - $logow) / 2;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize']; $y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break; break;
case 6: case 6:
$x = $srcImg_w - $logow - 10; $x = $srcImg_w - $logow - 10;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize']; $y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break; break;
case 7: case 7:
$x = +10; $x = +10;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10; $y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break; break;
case 8: case 8:
$x = ($srcImg_w - $logow) / 2; $x = ($srcImg_w - $logow) / 2;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10; $y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break; break;
case 9: case 9:
$x = $srcImg_w - $logow - 10; $x = $srcImg_w - $logow - 10;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10; $y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break; break;
default: default:
return array('code' => false, 'msg' => '水印位置不支持'); return array('code' => false, 'msg' => '水印位置不支持');
exit; exit;
} }
/** /**
* 把图片水印或文字水印,加到目标图片中 * 把图片水印或文字水印,加到目标图片中
*/ */
if (file_exists($def['res'])) { if (file_exists($def['res'])) {
imagecopy($dst_img, $markim, $x, $y, 0, 0, $logow, $logoh); imagecopy($dst_img, $markim, $x, $y, 0, 0, $logow, $logoh);
imagedestroy($markim); imagedestroy($markim);
} else { } else {
$rgb = explode(',', $def['color']); $rgb = explode(',', $def['color']);
if (count($rgb) != 4) { if (count($rgb) != 4) {
return array('code' => false, 'msg' => '请给正确的字体颜色'); return array('code' => false, 'msg' => '请给正确的字体颜色');
} }
if (!is_numeric($rgb[0]) || !is_numeric($rgb[1]) || !is_numeric($rgb[2]) || !is_numeric($rgb[3])) { if (!is_numeric($rgb[0]) || !is_numeric($rgb[1]) || !is_numeric($rgb[2]) || !is_numeric($rgb[3])) {
return array('code' => false, 'msg' => '请给正确的字体颜色'); return array('code' => false, 'msg' => '请给正确的字体颜色');
} }
if ($rgb[0] > 255 || $rgb[1] > 255 || $rgb[2] > 255 || $rgb[3] > 127) { if ($rgb[0] > 255 || $rgb[1] > 255 || $rgb[2] > 255 || $rgb[3] > 127) {
return array('code' => false, 'msg' => '请给正确的字体颜色'); return array('code' => false, 'msg' => '请给正确的字体颜色');
} }
// ceil(127 - 127 * $rgb[3]) 将CSS中的Alpha 0-1 转换为PHP Alpha 127-0 并取整 // ceil(127 - 127 * $rgb[3]) 将CSS中的Alpha 0-1 转换为PHP Alpha 127-0 并取整
$def['color'] = imagecolorallocatealpha($dst_img, $rgb[0], $rgb[1], $rgb[2], ceil(127 - 127 * $rgb[3])); $def['color'] = imagecolorallocatealpha($dst_img, $rgb[0], $rgb[1], $rgb[2], ceil(127 - 127 * $rgb[3]));
imagettftext( imagettftext(
$dst_img, $dst_img,
$def['fontSize'], $def['fontSize'],
0, 0,
$x, $x,
$y, $y,
$def['color'], $def['color'],
$def['font'], $def['font'],
$def['res'] $def['res']
); );
} }
/** /**
* 保存处理过的图片(有水印了的图片) * 保存处理过的图片(有水印了的图片)
*/ */
$name = explode('.', $def['name']); $name = explode('.', $def['name']);
$num = count($name) - 1; $num = count($name) - 1;
switch (strtolower($name[$num])) { switch (strtolower($name[$num])) {
case 'jpeg': case 'jpeg':
imagejpeg($dst_img, $def['name']); imagejpeg($dst_img, $def['name']);
break; break;
case 'jpg': case 'jpg':
imagejpeg($dst_img, $def['name']); imagejpeg($dst_img, $def['name']);
break; break;
case 'png': case 'png':
imagepng($dst_img, $def['name']); imagepng($dst_img, $def['name']);
break; break;
case 'gif': case 'gif':
imagegif($dst_img, $def['name']); imagegif($dst_img, $def['name']);
break; break;
case 'bmp': case 'bmp':
imagebmp($dst_img, $def['name']); imagebmp($dst_img, $def['name']);
break; break;
case 'webp': case 'webp':
imagewebp($dst_img, $def['name']); imagewebp($dst_img, $def['name']);
break; break;
default: default:
return array('code' => false, 'msg' => '保存图片类型有误'); return array('code' => false, 'msg' => '保存图片类型有误');
break; break;
} }
# 销毁图片内存资源 # 销毁图片内存资源
imagedestroy($dst_img); imagedestroy($dst_img);
return array('code' => true, 'msg' => '添加水印成功', 'url' => $def['name']); return array('code' => true, 'msg' => '添加水印成功', 'url' => $def['name']);
} }
} }

View File

@ -5,12 +5,12 @@
* 作者mengkun (mkblog.cn) * 作者mengkun (mkblog.cn)
* 日期2016/12/23 * 日期2016/12/23
* 修改Icret * 修改Icret
* 修改日期2023-01-30 * 修改日期2023-03-09
*/ */
include_once __DIR__ . '/function.php';
include_once APP_ROOT . '/config/config.php';
include_once '../config/config.php'; $path = APP_ROOT . $config['path'] . $config['delDir']; // 设置图片缓存文件夹
$path = '..' . $config['path'] . $config['delDir']; // 设置图片缓存文件夹
$filename = date("Ymd") . '.jpg'; // 用年月日来命名新的文件名 $filename = date("Ymd") . '.jpg'; // 用年月日来命名新的文件名
if (file_exists($path . $filename)) // 如果文件不存在,则说明今天还没有进行缓存 if (file_exists($path . $filename)) // 如果文件不存在,则说明今天还没有进行缓存
{ {

122
application/captcha.php → app/captcha.php Executable file → Normal file
View File

@ -1,61 +1,61 @@
<?php <?php
session_start(); //设置session session_start(); //设置session
require __DIR__ . "/function.php"; require __DIR__ . "/function.php";
//创建背景画布 //创建背景画布
$img_w = 305; $img_w = 305;
/*宽*/ /*宽*/
$img_h = 54; $img_h = 54;
$img = imagecreatetruecolor($img_w, $img_h); $img = imagecreatetruecolor($img_w, $img_h);
$bg_color = imagecolorallocate($img, 0xcc, 0xcc, 0xcc); $bg_color = imagecolorallocate($img, 0xcc, 0xcc, 0xcc);
imagefill($img, 0, 0, $bg_color); imagefill($img, 0, 0, $bg_color);
//生成验证码 //生成验证码
$count = 4; $count = 4;
$code = ""; $code = "";
/*生成的验证码内容范围*/ /*生成的验证码内容范围*/
$charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; $charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$str_len = strlen($charset) - 1; $str_len = strlen($charset) - 1;
/*for循环打印输出验证码*/ /*for循环打印输出验证码*/
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
$code .= $charset[rand(0, $str_len)]; $code .= $charset[rand(0, $str_len)];
} }
/*strtolower函数将输入的验证码自动转换为小写用户不需要特意区分大小写*/ /*strtolower函数将输入的验证码自动转换为小写用户不需要特意区分大小写*/
$_SESSION['code'] = strtolower($code); $_SESSION['code'] = strtolower($code);
/*字体大小*/ /*字体大小*/
$font_size = 24; $font_size = 24;
/*字体文件位置*/ /*字体文件位置*/
$fontfile = APP_ROOT . $config['textFont']; $fontfile = APP_ROOT . $config['textFont'];
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
$font_color = imagecolorallocate($img, mt_rand(0, 100), mt_rand(0, 50), mt_rand(0, 255)); $font_color = imagecolorallocate($img, mt_rand(0, 100), mt_rand(0, 50), mt_rand(0, 255));
imagettftext( imagettftext(
$img, $img,
$font_size, $font_size,
mt_rand(0, 20) - mt_rand(0, 25), mt_rand(0, 20) - mt_rand(0, 25),
($img_w * $i / 4) + mt_rand(0, 15), ($img_w * $i / 4) + mt_rand(0, 15),
mt_rand($img_h / 2, $img_h), mt_rand($img_h / 2, $img_h),
$font_color, $font_color,
realpath($fontfile), realpath($fontfile),
$code[$i] $code[$i]
); );
} }
/*背景干扰点点*/ /*背景干扰点点*/
for ($i = 0; $i < 300; $i++) { for ($i = 0; $i < 300; $i++) {
$color = imagecolorallocate($img, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)); $color = imagecolorallocate($img, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
imagesetpixel($img, mt_rand(0, $img_w), mt_rand(0, $img_h), $color); imagesetpixel($img, mt_rand(0, $img_w), mt_rand(0, $img_h), $color);
} }
/*干扰线条*/ /*干扰线条*/
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 5; $i++) {
$color = imagecolorallocate($img, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)); $color = imagecolorallocate($img, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
imageline($img, mt_rand(0, $img_w), 0, mt_rand(0, $img_h), $img_h, $color); imageline($img, mt_rand(0, $img_w), 0, mt_rand(0, $img_h), $img_h, $color);
imagesetpixel($img, mt_rand(0, $img_w), mt_rand(0, $img_h), $color); imagesetpixel($img, mt_rand(0, $img_w), mt_rand(0, $img_h), $color);
} }
// 因为有些浏览器访问的content-type会是文本型所以我们需要设置成图片的格式类型 // 因为有些浏览器访问的content-type会是文本型所以我们需要设置成图片的格式类型
header("content-type:image/png"); header("content-type:image/png");
imagepng($img); //建立png函数 imagepng($img); //建立png函数
imagedestroy($image); imagedestroy($image);

200
application/chart.php → app/chart.php Executable file → Normal file
View File

@ -1,100 +1,100 @@
<?php <?php
require_once __DIR__ . '/function.php'; require_once __DIR__ . '/function.php';
require_once __DIR__ . '/total_files.php'; require_once __DIR__ . '/total_files.php';
/** 统计最近一个月上传文件数与空间占用 */ /** 统计最近一个月上传文件数与空间占用 */
// 获取最近一周,一个月,一年 https://www.cnblogs.com/-mrl/p/7680700.html // 获取最近一周,一个月,一年 https://www.cnblogs.com/-mrl/p/7680700.html
function getLatelyTime($type = '') function getLatelyTime($type = '')
{ {
$now = time(); $now = time();
$result = []; $result = [];
if ($type == 'week') { if ($type == 'week') {
//最近一周 //最近一周
for ($i = 0; $i < 7; $i++) { for ($i = 0; $i < 7; $i++) {
$result[] = date('Y/m/d/', strtotime('-' . $i . ' day', $now)); $result[] = date('Y/m/d/', strtotime('-' . $i . ' day', $now));
} }
} elseif ($type == 'month') { } elseif ($type == 'month') {
//最近一个月 //最近一个月
for ($i = 0; $i < 30; $i++) { for ($i = 0; $i < 30; $i++) {
$result[] = date('Y/m/d/', strtotime('-' . $i . ' day', $now)); $result[] = date('Y/m/d/', strtotime('-' . $i . ' day', $now));
} }
} elseif ($type == 'year') { } elseif ($type == 'year') {
//最近一年 //最近一年
for ($i = 0; $i < 12; $i++) { for ($i = 0; $i < 12; $i++) {
$result[] = date('Y/m/', strtotime('-' . $i . ' month', $now)); $result[] = date('Y/m/', strtotime('-' . $i . ' month', $now));
} }
} }
return $result; return $result;
} }
$total_contents = APP_ROOT . $config['path']; // 获取用户自定义的上传目录 $total_contents = APP_ROOT . $config['path']; // 获取用户自定义的上传目录
$chart_total_file_md5 = strval(md5_file(APP_ROOT . '/config/config.php')); // 以config.php文件的md5命名 $chart_total_file_md5 = strval(md5_file(APP_ROOT . '/config/config.php')); // 以config.php文件的md5命名
$chart_total_file = APP_ROOT . "/admin/logs/counts/chart-$chart_total_file_md5.php"; // 文件绝对目录 $chart_total_file = APP_ROOT . "/admin/logs/counts/chart-$chart_total_file_md5.php"; // 文件绝对目录
function write_chart_total() function write_chart_total()
{ {
global $total_contents; global $total_contents;
global $chart_total_file; global $chart_total_file;
global $chart_total_file_md5; global $chart_total_file_md5;
$count_day = getLatelyTime('month'); $count_day = getLatelyTime('month');
$count_contents['filename'] = $chart_total_file_md5; // 文件名称 $count_contents['filename'] = $chart_total_file_md5; // 文件名称
$count_contents['total_time'] = date('Y-m-d H:i:s'); // 统计时间 $count_contents['total_time'] = date('Y-m-d H:i:s'); // 统计时间
$count_contents['date'] = date('YmdH'); // 校对时间 $count_contents['date'] = date('YmdH'); // 校对时间
for ($i = 0; $i < count($count_day); $i++) { for ($i = 0; $i < count($count_day); $i++) {
// 统计每日上传数量 // 统计每日上传数量
$count_contents['chart_data'][] = [$count_day[$i] => getFileNumber($total_contents . $count_day[$i])]; $count_contents['chart_data'][] = [$count_day[$i] => getFileNumber($total_contents . $count_day[$i])];
} }
for ($i = 0; $i < count($count_day); $i++) { for ($i = 0; $i < count($count_day); $i++) {
// 统计每日占用空间 // 统计每日占用空间
$count_contents['chart_disk'][] = [$count_day[$i] => getDirectorySize($total_contents . $count_day[$i])]; $count_contents['chart_disk'][] = [$count_day[$i] => getDirectorySize($total_contents . $count_day[$i])];
} }
if (!is_dir(APP_ROOT . '/admin/logs/counts/')) { if (!is_dir(APP_ROOT . '/admin/logs/counts/')) {
mkdir(APP_ROOT . '/admin/logs/counts/', 0755, true); mkdir(APP_ROOT . '/admin/logs/counts/', 0755, true);
} }
$count_contents = json_encode($count_contents, true); $count_contents = json_encode($count_contents, true);
file_put_contents($chart_total_file, $count_contents); // 存储文件 file_put_contents($chart_total_file, $count_contents); // 存储文件
} }
function read_chart_total() function read_chart_total()
{ {
global $chart_total_file; global $chart_total_file;
global $config; global $config;
$cache_freq = $config['cache_freq']; $cache_freq = $config['cache_freq'];
if (file_exists($chart_total_file)) { if (file_exists($chart_total_file)) {
$read_chart_file = file_get_contents($chart_total_file); $read_chart_file = file_get_contents($chart_total_file);
$read_chart_file = json_decode($read_chart_file, true); $read_chart_file = json_decode($read_chart_file, true);
} else { } else {
write_chart_total(); write_chart_total();
$read_chart_file = file_get_contents($chart_total_file); $read_chart_file = file_get_contents($chart_total_file);
$read_chart_file = json_decode($read_chart_file, true); $read_chart_file = json_decode($read_chart_file, true);
} }
if ((date('YmdH') - $read_chart_file['date']) > $cache_freq) { if ((date('YmdH') - $read_chart_file['date']) > $cache_freq) {
write_chart_total(); write_chart_total();
$read_chart_file = file_get_contents($chart_total_file); $read_chart_file = file_get_contents($chart_total_file);
$read_chart_file = json_decode($read_chart_file, true); $read_chart_file = json_decode($read_chart_file, true);
} }
for ($i = 0; $i < count($read_chart_file['chart_data']); $i++) { for ($i = 0; $i < count($read_chart_file['chart_data']); $i++) {
// 读取每日上传数量 // 读取每日上传数量
foreach ($read_chart_file['chart_data'][$i] as $key => $value) { foreach ($read_chart_file['chart_data'][$i] as $key => $value) {
$chart_data_date[] = '"' . $key . '" ,'; $chart_data_date[] = '"' . $key . '" ,';
$chart_data_num[] = '"' . $value . '" ,'; $chart_data_num[] = '"' . $value . '" ,';
} }
foreach ($read_chart_file['chart_disk'][$i] as $value) { foreach ($read_chart_file['chart_disk'][$i] as $value) {
$value = round($value / 1024 / 1024, 2); $value = round($value / 1024 / 1024, 2);
$chart_total_disk[] = '"' . $value . '" ,'; $chart_total_disk[] = '"' . $value . '" ,';
} }
} }
return array('filename' => $read_chart_file['filename'], 'date' => $chart_data_date, 'number' => $chart_data_num, 'disk' => $chart_total_disk, 'total_time' => $read_chart_file['total_time']); return array('filename' => $read_chart_file['filename'], 'date' => $chart_data_date, 'number' => $chart_data_num, 'disk' => $chart_total_disk, 'total_time' => $read_chart_file['total_time']);
} }

182
application/check.php → app/check.php Executable file → Normal file
View File

@ -1,92 +1,92 @@
<?php <?php
require_once __DIR__ . '/function.php'; require_once __DIR__ . '/function.php';
// 跳转安装 // 跳转安装
if (!is_file(APP_ROOT . '/config/install.lock') and is_file(APP_ROOT . '/install/install.php')) { if (!is_file(APP_ROOT . '/config/install.lock') and is_file(APP_ROOT . '/install/install.php')) {
exit('<script type="text/javascript">window.location.href="' . get_whole_url('/') . '/install/index.php"</script>'); exit('<script type="text/javascript">window.location.href="' . get_whole_url('/') . '/install/index.php"</script>');
} }
/** 检测弹窗 */ /** 检测弹窗 */
if (is_file(APP_ROOT . '/config/EasyIamge.lock')) return; // 查询锁定弹窗文件是否存在 if (is_file(APP_ROOT . '/config/EasyIamge.lock')) return; // 查询锁定弹窗文件是否存在
file_put_contents(APP_ROOT . '/config/EasyIamge.lock', '安装环境检测锁定文件,如需再次展示请删除此文件!', FILE_APPEND | LOCK_EX); file_put_contents(APP_ROOT . '/config/EasyIamge.lock', '安装环境检测锁定文件,如需再次展示请删除此文件!', FILE_APPEND | LOCK_EX);
?> ?>
<div class="modal fade" id="myModal-1"> <div class="modal fade" id="myModal-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title"> <h4 class="modal-title">
<i class="icon icon-heart"> </i><a href="https://github.com/icret/EasyImages2.0" target="_blank">简单图床-EasyImage2.0</a> 安装环境检测 <i class="icon icon-heart"> </i><a href="https://github.com/icret/EasyImages2.0" target="_blank">简单图床-EasyImage2.0</a> 安装环境检测
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<h4>说明:</h4> <h4>说明:</h4>
<h5>1. 建议使用<span class="text-red">PHP7.0</span>及以上版本;</h5> <h5>1. 建议使用<span class="text-red">PHP7.0</span>及以上版本;</h5>
<h5>2. 上传失败大部分是由于<span class="text-red">upload_max_filesize、post_max_size、文件权限</span>设置不正确;</h5> <h5>2. 上传失败大部分是由于<span class="text-red">upload_max_filesize、post_max_size、文件权限</span>设置不正确;</h5>
<h5>3. 主要用到<span class="text-red">Fileinfo、GD、Openssl</span>扩展,如果缺失会导致无法访问管理面板以及上传/删除图片。</h5> <h5>3. 主要用到<span class="text-red">Fileinfo、GD、Openssl</span>扩展,如果缺失会导致无法访问管理面板以及上传/删除图片。</h5>
<hr /> <hr />
<h4>EasyImage2.0 基础检测:</h4> <h4>EasyImage2.0 基础检测:</h4>
<p>当前PHP版本:<sapn class="text-green"><?php echo phpversion() ?></sapn> <p>当前PHP版本:<sapn class="text-green"><?php echo phpversion() ?></sapn>
</p> </p>
<p>PHP最大上传: <sapn class="text-green"><?php echo ini_get('upload_max_filesize'); ?></sapn> <p>PHP最大上传: <sapn class="text-green"><?php echo ini_get('upload_max_filesize'); ?></sapn>
</p> </p>
<p>POST最大上传: <sapn class="text-green"><?php echo ini_get('post_max_size'); ?></sapn> <p>POST最大上传: <sapn class="text-green"><?php echo ini_get('post_max_size'); ?></sapn>
</p> </p>
<?php <?php
// 扩展检测 取消检测imagick扩展 // 扩展检测 取消检测imagick扩展
$expand = array('fileinfo', 'openssl', 'gd'); $expand = array('fileinfo', 'openssl', 'gd');
foreach ($expand as $val) { foreach ($expand as $val) {
if (extension_loaded($val)) { if (extension_loaded($val)) {
echo "<p class='text-green'> $val - 已安装</p>"; echo "<p class='text-green'> $val - 已安装</p>";
} else { } else {
echo "<script language='javascript'>alert($val - 未安装)</script>"; echo "<script language='javascript'>alert($val - 未安装)</script>";
echo "<p class='text-red'> $val- 未安装</p>"; echo "<p class='text-red'> $val- 未安装</p>";
} }
} }
// 文件权限检测 // 文件权限检测
$quanxian = substr(base_convert(fileperms(APP_ROOT . "/application/upload.php"), 10, 8), 3); $quanxian = substr(base_convert(fileperms(APP_ROOT . "/app/upload.php"), 10, 8), 3);
if (IS_WIN) { if (IS_WIN) {
echo ' echo '
<p class="text-green">upload.php 文件可执行</p> <p class="text-green">upload.php 文件可执行</p>
<p class="text-green">' . $config['path'] . ' 目录可读写</p> <p class="text-green">' . $config['path'] . ' 目录可读写</p>
'; ';
} }
if (!IS_WIN) { if (!IS_WIN) {
if ($quanxian !== '755' and !is_writable(APP_ROOT . $config['path'])) { if ($quanxian !== '755' and !is_writable(APP_ROOT . $config['path'])) {
echo ' echo '
<p class="text-red">upload.php 文件不可执行</font>> <p class="text-red">upload.php 文件不可执行</font>>
<p class="text-red">' . $config['path'] . ' 目录可读写</font>> <p class="text-red">' . $config['path'] . ' 目录可读写</font>>
'; ';
} else { } else {
echo ' echo '
<p class="text-green">upload.php 文件可执行</p> <p class="text-green">upload.php 文件可执行</p>
<p class="text-green">' . $config['path'] . ' 目录可读写</p> <p class="text-green">' . $config['path'] . ' 目录可读写</p>
'; ';
} }
} }
echo '<p class="text-green">当前支持图片格式:'; echo '<p class="text-green">当前支持图片格式:';
foreach (gd_info() as $k => $v) { foreach (gd_info() as $k => $v) {
$k = str_ireplace(array('Support', 'Create', 'Read', 'Linkage', 'GD Version', 'FreeType', 'Font', 'JIS-mapped', 'Japanese'), '', $k); $k = str_ireplace(array('Support', 'Create', 'Read', 'Linkage', 'GD Version', 'FreeType', 'Font', 'JIS-mapped', 'Japanese'), '', $k);
if ($v) { if ($v) {
printf("%s", $k); printf("%s", $k);
} else { } else {
printf("%s", $k); printf("%s", $k);
} }
} }
echo '</p>'; echo '</p>';
?> ?>
</div> </div>
<div class="modal-footer" style="text-align:left"> <div class="modal-footer" style="text-align:left">
<p class="text-primary">安装环境检测弹窗仅在第一次访问主页时展示,弹出后会在<code>config</code>目录下生成<code>EasyIamge.lock</code>文件,如需再次弹出请删除<code>EasyIamge.lock</code>文件。</p> <p class="text-primary">安装环境检测弹窗仅在第一次访问主页时展示,弹出后会在<code>config</code>目录下生成<code>EasyIamge.lock</code>文件,如需再次弹出请删除<code>EasyIamge.lock</code>文件。</p>
<p class="text-primary">刷新或<kbd>ESC</kbd>关闭安装环境检测弹窗。</p> <p class="text-primary">刷新或<kbd>ESC</kbd>关闭安装环境检测弹窗。</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
$("#myModal-1").modal({ $("#myModal-1").modal({
keyboard: true, keyboard: true,
moveable: true, moveable: true,
backdrop: "static", //点击空白处不关闭对话框 backdrop: "static", //点击空白处不关闭对话框
show: true show: true
}) })
alert("初次打开会检测环境配置,请仔细看!!"); alert("初次打开会检测环境配置,请仔细看!!");
</script> </script>

View File

@ -1,154 +1,154 @@
<?php <?php
/* /*
// 检查当前PHP版本是否大于7.0 // 检查当前PHP版本是否大于7.0
if (PHP_VERSION < 7) { if (PHP_VERSION < 7) {
echo ' echo '
new $.zui.Messager("当前PHP版本<7.0, 部分功能受限!",{ new $.zui.Messager("当前PHP版本<7.0, 部分功能受限!",{
type: "primary", // 定义颜色主题 type: "primary", // 定义颜色主题
time:3000 time:3000
}).show(); }).show();
'; ';
} }
*/ */
// 扩展检测 // 扩展检测
$expand = array('fileinfo', 'iconv', 'gd', 'mbstring', 'openssl',); $expand = array('fileinfo', 'iconv', 'gd', 'mbstring', 'openssl',);
foreach ($expand as $val) { foreach ($expand as $val) {
if (!extension_loaded($val)) { if (!extension_loaded($val)) {
echo ' echo '
new $.zui.Messager("扩展:' . $val . '- 未安装,可能导致图片上传失败! 请尽快修复。",{ new $.zui.Messager("扩展:' . $val . '- 未安装,可能导致图片上传失败! 请尽快修复。",{
type: "black", // 定义颜色主题 type: "black", // 定义颜色主题
icon: "exclamation-sign", // 定义消息图标 icon: "exclamation-sign", // 定义消息图标
time:3500 time:3500
}).show(); }).show();
'; ';
} }
} }
// 检测是否修改默认密码 // 检测是否修改默认密码
if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') { if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') {
echo ' echo '
new $.zui.Messager("请修改默认密码,否则会有泄露风险! ",{ new $.zui.Messager("请修改默认密码,否则会有泄露风险! ",{
type: "warning", // 定义颜色主题 type: "warning", // 定义颜色主题
time:4000 time:4000
}).show(); }).show();
'; ';
} }
// 检测是否局域网访问 // 检测是否局域网访问
if (is_local($config['domain']) || is_local($config['imgurl'])) { if (is_local($config['domain']) || is_local($config['imgurl'])) {
echo ' echo '
new $.zui.Messager("当前使用局域网,可能会导致外网访问异常!",{ new $.zui.Messager("当前使用局域网,可能会导致外网访问异常!",{
type: "black", // 定义颜色主题 type: "black", // 定义颜色主题
time:4500 time:4500
}).show(); }).show();
'; ';
} }
// 检测是否存在.user.ini // 检测是否存在.user.ini
if (file_exists(APP_ROOT . '/.user.ini')) { if (file_exists(APP_ROOT . '/.user.ini')) {
echo ' echo '
new $.zui.Messager("请关闭防跨目录读写或删除.user.ini文件",{ new $.zui.Messager("请关闭防跨目录读写或删除.user.ini文件",{
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
time:5000 time:5000
}).show(); }).show();
'; ';
} }
// 检测是否存在 IP数据库文件 ip2region.xdb // 检测是否存在 IP数据库文件 ip2region.xdb
if (!file_exists(__DIR__ . '/ip2region/ip2region.xdb')) { if (!file_exists(__DIR__ . '/ip2region/ip2region.xdb')) {
echo ' echo '
new $.zui.Messager("IP 数据库不存在, 请在系统信息中查看 Ip2region",{ new $.zui.Messager("IP 数据库不存在, 请在系统信息中查看 Ip2region",{
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
time:5500 time:5500
}).show(); }).show();
'; ';
} }
// 检查当前版本与GitHub版本 // 检查当前版本与GitHub版本
if (getVersion() !== get_current_version()) { if (getVersion() !== get_current_version()) {
echo ' echo '
new $.zui.Messager("当前版本与GitHub不一致,请检查当前是否最新版本!",{ new $.zui.Messager("当前版本与GitHub不一致,请检查当前是否最新版本!",{
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
time:6000 time:6000
}).show(); }).show();
'; ';
} }
// 检测是否开启登录上传 // 检测是否开启登录上传
if ($config['mustLogin']) { if ($config['mustLogin']) {
echo ' echo '
$.zui.browser.tip("请注意: 当前已开启登录上传,游客不能上传图片!"); $.zui.browser.tip("请注意: 当前已开启登录上传,游客不能上传图片!");
'; ';
} }
// 检测水印图片是否存在 // 检测水印图片是否存在
if (!is_file(APP_ROOT . $config['waterImg'])) { if (!is_file(APP_ROOT . $config['waterImg'])) {
echo ' echo '
new $.zui.Messager("水印图片不存在,请检测路径或者文件是否存在!",{ new $.zui.Messager("水印图片不存在,请检测路径或者文件是否存在!",{
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
time:6500 time:6500
}).show(); }).show();
'; ';
} }
// 检测水印字体是否存在 // 检测水印字体是否存在
if (!is_file(APP_ROOT . $config['textFont'])) { if (!is_file(APP_ROOT . $config['textFont'])) {
echo ' echo '
new $.zui.Messager("水印字体不存在,请检测路径或者文件是否存在!",{ new $.zui.Messager("水印字体不存在,请检测路径或者文件是否存在!",{
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
time:6500 time:6500
}).show(); }).show();
'; ';
} }
// 检测监黄接口是否可以访问 // 检测监黄接口是否可以访问
if ($config['checkImg'] !== 0) { if ($config['checkImg'] !== 0) {
if ($config['checkImg'] == 1) { if ($config['checkImg'] == 1) {
if (!@IP_URL_Ping('api.moderatecontent.com', 80, 1)) { if (!@IP_URL_Ping('api.moderatecontent.com', 80, 1)) {
echo ' echo '
new $.zui.Messager("moderatecontent 鉴黄接口无法ping通! ",{ new $.zui.Messager("moderatecontent 鉴黄接口无法ping通! ",{
type: "warning", // 定义颜色主题 type: "warning", // 定义颜色主题
time:7000 time:7000
}).show(); }).show();
'; ';
} }
} }
if ($config['checkImg'] == 2) { if ($config['checkImg'] == 2) {
$ip = parse_url($config['nsfwjs_url'])['host']; $ip = parse_url($config['nsfwjs_url'])['host'];
$port = parse_url($config['nsfwjs_url'])['port']; $port = parse_url($config['nsfwjs_url'])['port'];
if (filter_var($ip, FILTER_VALIDATE_IP)) { if (filter_var($ip, FILTER_VALIDATE_IP)) {
if (!@IP_URL_Ping($ip, $port, 1)) { if (!@IP_URL_Ping($ip, $port, 1)) {
echo ' echo '
new $.zui.Messager("' . $ip . $port . ' 鉴黄接口无法ping通! ",{ new $.zui.Messager("' . $ip . $port . ' 鉴黄接口无法ping通! ",{
type: "warning", // 定义颜色主题 type: "warning", // 定义颜色主题
time:7000 time:7000
}).show(); }).show();
'; ';
} }
} else { } else {
if (!@IP_URL_Ping($ip, 80, 1)) { if (!@IP_URL_Ping($ip, 80, 1)) {
echo ' echo '
new $.zui.Messager("' . $ip . ' 鉴黄接口无法ping通! ",{ new $.zui.Messager("' . $ip . ' 鉴黄接口无法ping通! ",{
type: "warning", // 定义颜色主题 type: "warning", // 定义颜色主题
time:7000 time:7000
}).show(); }).show();
'; ';
} }
} }
} }
} }
if (!function_exists('fastcgi_finish_request')) { if (!function_exists('fastcgi_finish_request')) {
echo ' echo '
new $.zui.Messager("开启 fastcgi_finish_request 处理数据会更快喔!",{ new $.zui.Messager("开启 fastcgi_finish_request 处理数据会更快喔!",{
type: "primary", // 定义颜色主题 type: "primary", // 定义颜色主题
time:7000 time:7000
}).show(); }).show();
'; ';
} }

View File

@ -1,45 +1,45 @@
<?php <?php
/** /**
* 分布式 id 生成类 组成: <毫秒级时间戳+机器id+序列号> * 分布式 id 生成类 组成: <毫秒级时间戳+机器id+序列号>
* 默认情况下41bit的时间戳可以支持该算法使用到2082年10bit的工作机器id可以支持1023台机器序列号支持1毫秒产生4095个自增序列id * 默认情况下41bit的时间戳可以支持该算法使用到2082年10bit的工作机器id可以支持1023台机器序列号支持1毫秒产生4095个自增序列id
* @author zhangqi * @author zhangqi
* @link https://www.cnblogs.com/njccqx/p/13402169.html * @link https://www.cnblogs.com/njccqx/p/13402169.html
*/ */
class SnowFlake class SnowFlake
{ {
const EPOCH = 1479533469598; //开始时间,固定一个小于当前时间的毫秒数 const EPOCH = 1479533469598; //开始时间,固定一个小于当前时间的毫秒数
const max12bit = 4095; const max12bit = 4095;
const max41bit = 1099511627775; const max41bit = 1099511627775;
static $machineId = 1; // 机器id static $machineId = 1; // 机器id
public static function machineId($mId = 0) public static function machineId($mId = 0)
{ {
self::$machineId = $mId; self::$machineId = $mId;
} }
public static function createOnlyId() public static function createOnlyId()
{ {
// 时间戳 42字节 // 时间戳 42字节
$time = floor(microtime(true) * 1000); $time = floor(microtime(true) * 1000);
// 当前时间 与 开始时间 差值 // 当前时间 与 开始时间 差值
$time -= self::EPOCH; $time -= self::EPOCH;
// 二进制的 毫秒级时间戳 // 二进制的 毫秒级时间戳
$base = decbin(self::max41bit + $time); $base = decbin(self::max41bit + $time);
// 机器id 10 字节 // 机器id 10 字节
if (!self::$machineId) { if (!self::$machineId) {
$machineid = self::$machineId; $machineid = self::$machineId;
} else { } else {
$machineid = str_pad(decbin(self::$machineId), 10, "0", STR_PAD_LEFT); $machineid = str_pad(decbin(self::$machineId), 10, "0", STR_PAD_LEFT);
} }
// 序列数 12字节 // 序列数 12字节
$random = str_pad(decbin(mt_rand(0, self::max12bit)), 12, "0", STR_PAD_LEFT); $random = str_pad(decbin(mt_rand(0, self::max12bit)), 12, "0", STR_PAD_LEFT);
// 拼接 // 拼接
$base = $base . $machineid . $random; $base = $base . $machineid . $random;
// 转化为 十进制 返回 // 转化为 十进制 返回
return bindec($base); return bindec($base);
} }
} }
// SnowFlake::machineId("1"); //机器编号 // SnowFlake::machineId("1"); //机器编号
// echo SnowFlake::createOnlyId();//分布式id // echo SnowFlake::createOnlyId();//分布式id

0
application/class.thumb.php → app/class.thumb.php Executable file → Normal file
View File

0
application/class.upload.php → app/class.upload.php Executable file → Normal file
View File

172
application/class.version.php → app/class.version.php Executable file → Normal file
View File

@ -1,87 +1,87 @@
<?php <?php
/** /**
* @author Icret * @author Icret
* 获取GitHub最新版本号 * 获取GitHub最新版本号
* EasyImage2.0 简单图床 创建时间: 2021-5-10 14:17:25 * EasyImage2.0 简单图床 创建时间: 2021-5-10 14:17:25
* 修改时间: 2023-02-10 11:23:30 * 修改时间: 2023-02-10 11:23:30
* @param int 864000 10天的unix时间,既每隔十天获取一次版本 * @param int 864000 10天的unix时间,既每隔十天获取一次版本
*/ */
error_reporting(0); // 关闭所有PHP错误报告 error_reporting(0); // 关闭所有PHP错误报告
class getVersion class getVersion
{ {
private $url; private $url;
private $dir; //文件所在文件夹 private $dir; //文件所在文件夹
private $filePath; //文件绝对路径 private $filePath; //文件绝对路径
private $fileName; //文件名称 private $fileName; //文件名称
private $fileModifiTime; // 文件最后修改时间 private $fileModifiTime; // 文件最后修改时间
private $time; // 当前时间 private $time; // 当前时间
public function __construct($url) public function __construct($url)
{ {
$this->url = $url; $this->url = $url;
$this->dir = __DIR__ . '/../admin/logs/version/'; $this->dir = __DIR__ . '/../admin/logs/version/';
$this->fileName = 'version.json'; $this->fileName = 'version.json';
$this->filePath = $this->dir . $this->fileName; $this->filePath = $this->dir . $this->fileName;
$this->fileModifiTime = filemtime($this->filePath); $this->fileModifiTime = filemtime($this->filePath);
$this->time = time(); $this->time = time();
} }
public function readJson($name = 'tag_name') public function readJson($name = 'tag_name')
{ {
if (is_file($this->filePath)) { if (is_file($this->filePath)) {
if ($this->time - $this->fileModifiTime > 864000) { if ($this->time - $this->fileModifiTime > 864000) {
$this->downJson(); $this->downJson();
} else { } else {
$file = fopen($this->filePath, 'r'); $file = fopen($this->filePath, 'r');
$test = fread($file, filesize($this->filePath)); $test = fread($file, filesize($this->filePath));
$version = json_decode($test, true); $version = json_decode($test, true);
return $version[$name]; return $version[$name];
fclose($file); fclose($file);
} }
} else { } else {
$this->downJson(); $this->downJson();
} }
} }
public function downJson() public function downJson()
{ {
if (!is_dir($this->dir)) { if (!is_dir($this->dir)) {
mkdir($this->dir, 0755, true); mkdir($this->dir, 0755, true);
} }
$version = $this->geturl($this->url); $version = $this->geturl($this->url);
$version = json_decode($version, true); $version = json_decode($version, true);
$file = fopen($this->filePath, 'w+'); $file = fopen($this->filePath, 'w+');
fwrite($file, $version); fwrite($file, $version);
fclose($file); fclose($file);
} }
public function geturl($url) public function geturl($url)
{ {
$headerArray = array("Content-type:application/json;", "Accept:application/json"); $headerArray = array("Content-type:application/json;", "Accept:application/json");
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 666); // 超时时间 curl_setopt($ch, CURLOPT_TIMEOUT_MS, 666); // 超时时间
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray); curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36');
$output = curl_exec($ch); $output = curl_exec($ch);
curl_close($ch); curl_close($ch);
$output = json_encode($output, true); $output = json_encode($output, true);
return $output; return $output;
} }
} }
/////////// TEST ///////// /////////// TEST /////////
/* /*
$url = "https://api.github.com/repositories/188228357/releases/latest"; $url = "https://api.github.com/repositories/188228357/releases/latest";
$test = new getVersion($url); $test = new getVersion($url);
echo $test->readJson(); echo $test->readJson();
*/ */

View File

@ -1,123 +1,123 @@
<?php <?php
/** /**
* @param string $src 源图 * @param string $src 源图
* @param float $percent 压缩比例 * @param float $percent 压缩比例
* 简单图床修改版 * 简单图床修改版
* 此类压缩单文件 * 此类压缩单文件
* https://www.cnblogs.com/jiji/p/12928028.html * https://www.cnblogs.com/jiji/p/12928028.html
*/ */
class Imgcompress class Imgcompress
{ {
private $src; private $src;
private $image; private $image;
private $imageinfo; private $imageinfo;
private $percent = 0.5; private $percent = 0.5;
/** /**
* 图片压缩 * 图片压缩
* @param string $src 源图 * @param string $src 源图
* @param float $percent 压缩比例 * @param float $percent 压缩比例
*/ */
public function __construct($src, $percent = 1) public function __construct($src, $percent = 1)
{ {
$this->src = $src; $this->src = $src;
$this->percent = $percent; $this->percent = $percent;
} }
/** 高清压缩图片 /** 高清压缩图片
* @param string $saveName 提供图片名(可不带扩展名,用源图扩展名)用于保存。或不提供文件名直接显示 * @param string $saveName 提供图片名(可不带扩展名,用源图扩展名)用于保存。或不提供文件名直接显示
*/ */
public function compressImg($saveName = '') public function compressImg($saveName = '')
{ {
$this->_openImage(); $this->_openImage();
if (!empty($saveName)) $this->_saveImage($saveName); //保存 if (!empty($saveName)) $this->_saveImage($saveName); //保存
else $this->_showImage(); else $this->_showImage();
} }
/** /**
* 内部:打开图片 * 内部:打开图片
*/ */
private function _openImage() private function _openImage()
{ {
list($width, $height, $type, $attr) = getimagesize($this->src); list($width, $height, $type, $attr) = getimagesize($this->src);
$this->imageinfo = array( $this->imageinfo = array(
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
'type' => image_type_to_extension($type, false), 'type' => image_type_to_extension($type, false),
'attr' => $attr 'attr' => $attr
); );
$fun = "imagecreatefrom" . $this->imageinfo['type']; $fun = "imagecreatefrom" . $this->imageinfo['type'];
$this->image = $fun($this->src); $this->image = $fun($this->src);
$this->_thumpImage(); $this->_thumpImage();
} }
/** /**
* 内部:操作图片 * 内部:操作图片
*/ */
private function _thumpImage() private function _thumpImage()
{ {
$new_width = $this->imageinfo['width'] * $this->percent; $new_width = $this->imageinfo['width'] * $this->percent;
$new_height = $this->imageinfo['height'] * $this->percent; $new_height = $this->imageinfo['height'] * $this->percent;
$image_thump = imagecreatetruecolor($new_width, $new_height); $image_thump = imagecreatetruecolor($new_width, $new_height);
/** /**
* 保留图片透明通道 * 保留图片透明通道
* 简单图床 EasyImage 2.0 2021-5-9 21:48:59 * 简单图床 EasyImage 2.0 2021-5-9 21:48:59
* 参考: https://www.imooc.com/wenda/detail/581249 * 参考: https://www.imooc.com/wenda/detail/581249
*/ */
imagealphablending($image_thump, false); imagealphablending($image_thump, false);
imagesavealpha($image_thump, true); imagesavealpha($image_thump, true);
//将原图复制带图片载体上面,并且按照一定比例压缩,极大的保持了清晰度 //将原图复制带图片载体上面,并且按照一定比例压缩,极大的保持了清晰度
imagecopyresampled($image_thump, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->imageinfo['width'], $this->imageinfo['height']); imagecopyresampled($image_thump, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->imageinfo['width'], $this->imageinfo['height']);
imagedestroy($this->image); imagedestroy($this->image);
$this->image = $image_thump; $this->image = $image_thump;
} }
/** /**
* 输出图片:保存图片则用saveImage() * 输出图片:保存图片则用saveImage()
*/ */
private function _showImage() private function _showImage()
{ {
header('Content-Type: image/' . $this->imageinfo['type']); header('Content-Type: image/' . $this->imageinfo['type']);
$funcs = "image" . $this->imageinfo['type']; $funcs = "image" . $this->imageinfo['type'];
$funcs($this->image); $funcs($this->image);
} }
/** /**
* 保存图片到硬盘: * 保存图片到硬盘:
* @param string $dstImgName 1、可指定字符串不带后缀的名称,使用源图扩展名 。2、直接指定目标图片名带扩展名。 * @param string $dstImgName 1、可指定字符串不带后缀的名称,使用源图扩展名 。2、直接指定目标图片名带扩展名。
*/ */
private function _saveImage($dstImgName) private function _saveImage($dstImgName)
{ {
if (empty($dstImgName)) return false; if (empty($dstImgName)) return false;
$allowImgs = array('.jpg', '.jpeg', '.png', '.bmp', '.wbmp', '.gif','.webp'); // 如果目标图片名有后缀就用目标图片扩展名 后缀,如果没有,则用源图的扩展名 $allowImgs = array('.jpg', '.jpeg', '.png', '.bmp', '.wbmp', '.gif','.webp'); // 如果目标图片名有后缀就用目标图片扩展名 后缀,如果没有,则用源图的扩展名
$dstExt = strrchr($dstImgName, "."); $dstExt = strrchr($dstImgName, ".");
$sourseExt = strrchr($this->src, "."); $sourseExt = strrchr($this->src, ".");
if (!empty($dstExt)) $dstExt = strtolower($dstExt); if (!empty($dstExt)) $dstExt = strtolower($dstExt);
if (!empty($sourseExt)) $sourseExt = strtolower($sourseExt); if (!empty($sourseExt)) $sourseExt = strtolower($sourseExt);
//有指定目标名扩展名 //有指定目标名扩展名
if (!empty($dstExt) && in_array($dstExt, $allowImgs)) { if (!empty($dstExt) && in_array($dstExt, $allowImgs)) {
$dstName = $dstImgName; $dstName = $dstImgName;
} elseif (!empty($sourseExt) && in_array($sourseExt, $allowImgs)) { } elseif (!empty($sourseExt) && in_array($sourseExt, $allowImgs)) {
$dstName = $dstImgName . $sourseExt; $dstName = $dstImgName . $sourseExt;
} else { } else {
$dstName = $dstImgName . $this->imageinfo['type']; $dstName = $dstImgName . $this->imageinfo['type'];
} }
$funcs = "image" . $this->imageinfo['type']; $funcs = "image" . $this->imageinfo['type'];
$funcs($this->image, $dstName); $funcs($this->image, $dstName);
} }
/** /**
* 销毁图片 * 销毁图片
*/ */
public function __destruct() public function __destruct()
{ {
imagedestroy($this->image); imagedestroy($this->image);
} }
} }

View File

@ -1,76 +1,76 @@
<?php <?php
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User: Zhang He * User: Zhang He
* Date: 2015/6/8 * Date: 2015/6/8
* Time: 10:14 * Time: 10:14
* https://www.cnblogs.com/CheeseZH/p/4566068.html * https://www.cnblogs.com/CheeseZH/p/4566068.html
*/ */
class TinyImg class TinyImg
{ {
/*Compress all images in folder $inputFolder and save final images in folder $outputFolder*/ /*Compress all images in folder $inputFolder and save final images in folder $outputFolder*/
public function compressImgsFolder($key, $inputFolder, $outputFolder) public function compressImgsFolder($key, $inputFolder, $outputFolder)
{ {
$images = $this->getFiles($inputFolder); $images = $this->getFiles($inputFolder);
if (empty($images)) { if (empty($images)) {
return false; return false;
} }
foreach ($images as $image) { foreach ($images as $image) {
$input = $inputFolder . $image; $input = $inputFolder . $image;
$output = $outputFolder . $image; $output = $outputFolder . $image;
print($input . " => 源文件<br>"); print($input . " => 源文件<br>");
print($output . " => 成功文件<br>"); print($output . " => 成功文件<br>");
$this->compressImg($key, $input, $output); $this->compressImg($key, $input, $output);
} }
return true; return true;
} }
/*Compress one image $input and save as $output*/ /*Compress one image $input and save as $output*/
public function compressImg($key, $input, $output) public function compressImg($key, $input, $output)
{ {
$url = "https://api.tinify.com/shrink"; $url = "https://api.tinify.com/shrink";
$options = array( $options = array(
"http" => array( "http" => array(
"method" => "POST", "method" => "POST",
"header" => array( "header" => array(
"Content-type: image/png", "Content-type: image/png",
"Authorization: Basic " . base64_encode("api:$key") "Authorization: Basic " . base64_encode("api:$key")
), ),
"content" => file_get_contents($input) "content" => file_get_contents($input)
), ),
"ssl" => array( "ssl" => array(
/* Uncomment below if you have trouble validating our SSL certificate. /* Uncomment below if you have trouble validating our SSL certificate.
Download cacert.pem from: http://curl.haxx.se/ca/cacert.pem */ Download cacert.pem from: http://curl.haxx.se/ca/cacert.pem */
"cafile" => __DIR__ . "/cacert.pem", "cafile" => __DIR__ . "/cacert.pem",
"verify_peer" => true "verify_peer" => true
) )
); );
$result = fopen($url, "r", false, stream_context_create($options)); $result = fopen($url, "r", false, stream_context_create($options));
if ($result) { if ($result) {
/* Compression was successful, retrieve output from Location header. */ /* Compression was successful, retrieve output from Location header. */
foreach ($http_response_header as $header) { foreach ($http_response_header as $header) {
if (strtolower(substr($header, 0, 10)) === "location: ") { if (strtolower(substr($header, 0, 10)) === "location: ") {
file_put_contents($output, fopen(substr($header, 10), "rb", false)); file_put_contents($output, fopen(substr($header, 10), "rb", false));
} }
} }
} else { } else {
/* Something went wrong! */ /* Something went wrong! */
print("Compression failed<br>"); print("Compression failed<br>");
} }
} }
//get all files' fullname in $filedir //get all files' fullname in $filedir
public function getFiles($filedir) public function getFiles($filedir)
{ {
$files = []; $files = [];
$dir = @dir($filedir); $dir = @dir($filedir);
while (($file = $dir->read()) != false) { while (($file = $dir->read()) != false) {
if ($file != "." and $file != "..") { if ($file != "." and $file != "..") {
$files[] = $file; $files[] = $file;
} }
} }
$dir->close(); $dir->close();
return $files; return $files;
} }
} }

View File

@ -1,54 +1,54 @@
<?php <?php
/** /**
* 压缩文件函数调用位置 * 压缩文件函数调用位置
*/ */
require_once __DIR__ . '/../function.php'; require_once __DIR__ . '/../function.php';
require_once APP_ROOT . '/application/compress/Imagick/class.Imgcompress.php'; require_once APP_ROOT . '/app/compress/Imagick/class.Imgcompress.php';
require_once APP_ROOT . '/application/compress/TinyImg/TinyImg.php'; require_once APP_ROOT . '/app/compress/TinyImg/TinyImg.php';
require_once APP_ROOT . '/config/api_key.php'; require_once APP_ROOT . '/config/api_key.php';
/** /**
* @param string $floder 文件夹 * @param string $floder 文件夹
* @param string 压缩方式Imgcompress / TinyPng * @param string 压缩方式Imgcompress / TinyPng
*/ */
function compress($floder, $type = 'Imgcompress', $source = '') function compress($floder, $type = 'Imgcompress', $source = '')
{ {
global $config; global $config;
ini_set('max_execution_time', '0'); // 脚本运行的时间以秒为单位0不限制 ini_set('max_execution_time', '0'); // 脚本运行的时间以秒为单位0不限制
if ($type == 'Imgcompress') { if ($type == 'Imgcompress') {
$pic = getFile($floder); // 文件夹路径 $pic = getFile($floder); // 文件夹路径
$percent = $config['compress_ratio'] / 100; // 压缩率 $percent = $config['compress_ratio'] / 100; // 压缩率
foreach ($pic as $value) { foreach ($pic as $value) {
$boxImg = $floder . $value; $boxImg = $floder . $value;
// 跳过动态图片 // 跳过动态图片
if (!isGifAnimated($boxImg)) { if (!isGifAnimated($boxImg)) {
$img = new Imgcompress($boxImg, $percent); $img = new Imgcompress($boxImg, $percent);
$img->compressImg($boxImg); $img->compressImg($boxImg);
echo '<pre>' . $boxImg . '</pre><br />'; echo '<pre>' . $boxImg . '</pre><br />';
// 释放 // 释放
ob_flush(); ob_flush();
} }
} }
} }
if ($type == 'TinyPng') { if ($type == 'TinyPng') {
if (empty($config['TinyPng_key'])) { if (empty($config['TinyPng_key'])) {
exit('请先申请TinyPng key并保存再试!'); exit('请先申请TinyPng key并保存再试!');
} }
$folder = '..' . $config['path'] . $source; $folder = '..' . $config['path'] . $source;
$tinyImg = new TinyImg(); $tinyImg = new TinyImg();
$key = $config['TinyPng_key']; $key = $config['TinyPng_key'];
$input = $folder; //这个文件夹下的文件会被压缩 $input = $folder; //这个文件夹下的文件会被压缩
$output = $folder; //压缩的结果会被保存到这个文件夹中 $output = $folder; //压缩的结果会被保存到这个文件夹中
$tinyImg->compressImgsFolder($key, $input, $output); $tinyImg->compressImgsFolder($key, $input, $output);
} }
} }
/* Test /* Test
$floder = 'D:/phpStudy/WWW/i/2021/05/09/'; $floder = 'D:/phpStudy/WWW/i/2021/05/09/';
compress($floder, 'TinyImg'); compress($floder, 'TinyImg');
echo 666; echo 666;
*/ */

138
application/compressing.php → app/compressing.php Executable file → Normal file
View File

@ -1,69 +1,69 @@
<?php <?php
/** /**
* 压缩状态页面 * 压缩状态页面
*/ */
require_once 'header.php'; require_once 'header.php';
require_once APP_ROOT . '/application/compress/function.compress.php'; require_once APP_ROOT . '/app/compress/function.compress.php';
// 检测登录 // 检测登录
if (!is_who_login('admin')) { if (!is_who_login('admin')) {
checkLogin(); checkLogin();
echo '<div class="alert alert-info">未登陆~~</div>'; echo '<div class="alert alert-info">未登陆~~</div>';
exit(require_once APP_ROOT . '/application/footer.php'); exit(require_once APP_ROOT . '/app/footer.php');
} }
// 文件夹压缩 // 文件夹压缩
if (isset($_POST['folder'])) { if (isset($_POST['folder'])) {
$getFolder = urldecode($_POST['folder']); $getFolder = urldecode($_POST['folder']);
$source = $_POST['folder']; $source = $_POST['folder'];
$type = $_POST['type']; $type = $_POST['type'];
$folder = '..' . $config['path'] . $getFolder; $folder = '..' . $config['path'] . $getFolder;
if (!is_dir($folder)) { if (!is_dir($folder)) {
exit($folder . '<script> new $.zui.Messager("没有这个文件夹!", { exit($folder . '<script> new $.zui.Messager("没有这个文件夹!", {
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show();</script>'); }).show();</script>');
} }
// 压缩前 // 压缩前
$sizeBefor = getDirectorySize($folder); $sizeBefor = getDirectorySize($folder);
compress($folder, $type, $source); compress($folder, $type, $source);
echo ' echo '
<script> new $.zui.Messager("压缩完毕!", { <script> new $.zui.Messager("压缩完毕!", {
type: "success", // 定义颜色主题 type: "success", // 定义颜色主题
icon: "ok-sign" // 定义消息图标 icon: "ok-sign" // 定义消息图标
}).show();</script>'; }).show();</script>';
} else { } else {
$folder = 0; $folder = 0;
$sizeBefor = 0; $sizeBefor = 0;
} }
// 压缩后 // 压缩后
$sizeAfter = getDirectorySize($folder); $sizeAfter = getDirectorySize($folder);
?> ?>
<h2 style="text-align:center">压缩完毕</h2> <h2 style="text-align:center">压缩完毕</h2>
<h4 style="text-align:center;">压缩前:<font color="red"><?php echo getDistUsed($sizeBefor); ?></font>压缩后:<font color="green"><?php echo getDistUsed($sizeAfter); ?></font> <h4 style="text-align:center;">压缩前:<font color="red"><?php echo getDistUsed($sizeBefor); ?></font>压缩后:<font color="green"><?php echo getDistUsed($sizeAfter); ?></font>
</h4> </h4>
<pre> <pre>
无论使用哪种压缩均为不可逆操作,并且非常占用硬件资源。 无论使用哪种压缩均为不可逆操作,并且非常占用硬件资源。
如机器配置过低可能会导致CPU、内存飙升! 如机器配置过低可能会导致CPU、内存飙升!
<font color="red">Imgcompress</font> 自带压缩为轻微有损压缩图片 此压缩有可能使图片变大,特别是小图片!也有一定概率改变图片方向。 <font color="red">Imgcompress</font> 自带压缩为轻微有损压缩图片 此压缩有可能使图片变大,特别是小图片!也有一定概率改变图片方向。
<font color="red">Imgcompress</font> 对自身机器要求高,如图片过多会导致脚本崩溃或者超时(已经预处理超时和脚本崩溃处理,但是有概率重现)! <font color="red">Imgcompress</font> 对自身机器要求高,如图片过多会导致脚本崩溃或者超时(已经预处理超时和脚本崩溃处理,但是有概率重现)!
<font color="red">TinyPng</font> https://tinify.cn/ 提供的API,需要自行申请,对服务器要求较低,但是对网络要求高!如在国内可能导致非常慢而超时崩溃(已预处理,但是有概率重现) <font color="red">TinyPng</font> https://tinify.cn/ 提供的API,需要自行申请,对服务器要求较低,但是对网络要求高!如在国内可能导致非常慢而超时崩溃(已预处理,但是有概率重现)
获取TinyPng key https://tinify.cn/developers 并填入 <font color="red">API 设置->TinyPng Key</font> 文件。 获取TinyPng key https://tinify.cn/developers 并填入 <font color="red">API 设置->TinyPng Key</font> 文件。
</pre> </pre>
<script> <script>
// 更改网页标题 // 更改网页标题
document.title = "图片压缩" document.title = "图片压缩"
</script> </script>
<?php <?php
/** 底部广告 */ /** 底部广告 */
if ($config['ad_bot']) echo $config['ad_bot_info']; if ($config['ad_bot']) echo $config['ad_bot_info'];
/** 引入底部 */ /** 引入底部 */
include APP_ROOT . '/application/footer.php'; include APP_ROOT . '/app/footer.php';

280
application/del.php → app/del.php Executable file → Normal file
View File

@ -1,142 +1,138 @@
<?php <?php
/** /**
* 删除文件页面 * 删除文件页面
*/ */
require_once './header.php'; require_once __DIR__ . '/header.php';
if (empty($_REQUEST)) { if (empty($_REQUEST)) {
echo ' echo '
<script> <script>
new $.zui.Messager("没有要删除的图片!", { new $.zui.Messager("没有要删除的图片!", {
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show(); }).show();
</script> </script>
'; ';
} }
$img = rand_imgurl() . '/public/images/404.png'; $img = rand_imgurl() . '/public/images/404.png';
if (isset($_GET['url'])) { if (isset($_GET['url'])) {
$img = strip_tags($_GET['url']); $img = strip_tags($_GET['url']);
} }
// 解密删除 // 解密删除
if (isset($_GET['hash'])) { if (isset($_GET['hash'])) {
$delHash = strip_tags($_GET['hash']); $delHash = $_GET['hash'];
$delHash = urlHash($delHash, 1); $delHash = urlHash($delHash, 1);
if ($config['image_recycl']) { if ($config['image_recycl']) {
// 如果开启回收站则进入回收站 // 如果开启回收站则进入回收站
if (checkImg($delHash, 3, 'recycle/') == true) { if (checkImg($delHash, 3, 'recycle/') == true) {
echo ' echo '
<script> <script>
new $.zui.Messager("删除成功", { new $.zui.Messager("删除成功", {
type: "success", // 定义颜色主题 type: "success", // 定义颜色主题
icon: "ok-sign" // 定义消息图标 icon: "ok-sign" // 定义消息图标
}).show(); }).show();
</script> </script>
'; ';
} else { } else {
echo ' echo '
<script> <script>
new $.zui.Messager("文件不存在!", { new $.zui.Messager("文件不存在!", {
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show(); }).show();
</script> </script>
'; ';
} }
} else { } else {
// 否则直接删除 // 否则直接删除
getDel($delHash, 'url'); getDel($delHash, 'url');
} }
// FTP }
// any_upload($delHash, null, 'delete');
} // 检查登录后再处理url删除请求
if (is_who_login('admin')) {
// 检查登录后再处理url删除请求
if (is_who_login('admin')) { // 广场页面删除
if (isset($_GET['url'])) {
// 广场页面删除 getDel($img, 'url');
if (isset($_GET['url'])) { }
getDel(strip_tags($_GET['url']), 'url');
// FTP // 从管理页面删除
// any_upload(parse_url($_GET['url'])['path'], null, 'delete'); if (isset($_GET['url_admin_inc'])) {
} $del_url = $_GET['url_admin_inc'];
if ($config['hide_path']) {
// 从管理页面删除 $del_url = $config['domain'] . $config['path'] . parse_url($del_url)['path'];
if (isset($_GET['url_admin_inc'])) { }
$del_url = strip_tags($_GET['url_admin_inc']); getDel($del_url, 'url');
if ($config['hide_path']) { }
$del_url = $config['domain'] . $config['path'] . parse_url($del_url)['path']; // 回收
} if (isset($_GET['recycle_url'])) {
getDel($del_url, 'url'); $recycle_url = $_GET['recycle_url'];
// FTP $recycle_url = parse_url($recycle_url)['path'];
// any_upload(parse_url($del_url)['path'], null, 'delete'); if (file_exists(APP_ROOT . $recycle_url)) {
} checkImg($recycle_url, 3);
// 回收 echo '
if (isset($_GET['recycle_url'])) { <script>
$recycle_url = strip_tags($_GET['recycle_url']); new $.zui.Messager("已放入回收站!", {
$recycle_url = parse_url($recycle_url)['path']; type: "success", // 定义颜色主题
if (file_exists(APP_ROOT . $recycle_url)) { icon: "ok" // 定义消息图标
checkImg($recycle_url, 3); }).show();
echo ' </script>
<script> ';
new $.zui.Messager("已放入回收站!", { } else {
type: "success", // 定义颜色主题 echo '
icon: "ok" // 定义消息图标 <script>
}).show(); new $.zui.Messager("文件不存在!", {
</script> type: "danger", // 定义颜色主题
'; icon: "exclamation-sign" // 定义消息图标
} else { }).show();
echo ' </script>
<script> ';
new $.zui.Messager("文件不存在!", { }
type: "danger", // 定义颜色主题 }
icon: "exclamation-sign" // 定义消息图标 } else {
}).show(); if (isset($_GET['url'])) {
</script> echo '
'; <script>
} new $.zui.Messager("请使用管理员账号登录再删除!", {
} type: "danger", // 定义颜色主题
} else { icon: "exclamation-sign" // 定义消息图标
echo ' }).show();
<script> // 延时2s跳转
new $.zui.Messager("请使用管理员账号登录再删除!", { window.setTimeout("window.location=\'/../admin/index.php \'",3000);
type: "danger", // 定义颜色主题 </script>
icon: "exclamation-sign" // 定义消息图标 ';
}).show(); }
// 延时2s跳转 }
window.setTimeout("window.location=\'/../admin/index.php \'",3000); ?>
</script> <div class="col-md-4 col-md-offset-4">
'; <a href="<?php echo $img; ?>" target="_blank"><img src="<?php echo $img; ?>" alt="简单图床-EasyImage" class="img-thumbnail"></a>
} <form class="form-inline" method="get" action="<?php $_SERVER['SCRIPT_NAME']; ?>" id="form" name="delForm" onSubmit="getStr();">
?> <div class="form-group">
<div class="col-md-4 col-md-offset-4"> <label for="exampleInputInviteCode3">删除图片-格式:</label>
<a href="<?php echo $img; ?>" target="_blank"><img src="<?php echo $img; ?>" alt="简单图床-EasyImage" class="img-thumbnail"></a> <input type="text" class="form-control" id="exampleInputInviteCode3" name="url" placeholder="https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg">
<form class="form-inline" method="get" action="<?php $_SERVER['SCRIPT_NAME']; ?>" id="form" name="delForm" onSubmit="getStr();"> </div>
<div class="form-group"> <button type="submit" class="btn btn-danger">删除</button>
<label for="exampleInputInviteCode3">删除图片-格式:</label> </form>
<input type="text" class="form-control" id="exampleInputInviteCode3" name="url" placeholder="https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg"> </div>
</div> <script>
<button type="submit" class="btn btn-danger">删除</button> // 修改网页标题
</form> document.title = "删除图片 - <?php echo $config['title']; ?>";
</div>
<script> var oBtn = document.getElementById('del');
// 修改网页标题 var oTi = document.getElementById('title');
document.title = "删除图片 - <?php echo $config['title']; ?>"; if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
var oBtn = document.getElementById('del'); } else {
var oTi = document.getElementById('title'); oBtn.onpropertychange = getWord;
if ('oninput' in oBtn) { }
oBtn.addEventListener("input", getWord, false);
} else { function getWord() {
oBtn.onpropertychange = getWord; oTi.innerHTML = '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
} }
</script>
function getWord() { <?php require_once __DIR__ . '/footer.php';
oTi.innerHTML = '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
</script>
<?php require_once APP_ROOT . '/application/footer.php';

106
application/down.php → app/down.php Executable file → Normal file
View File

@ -1,53 +1,53 @@
<?php <?php
/** /**
* 下载文件 * 下载文件
* https://www.php.cn/php-weizijiaocheng-394566.html * https://www.php.cn/php-weizijiaocheng-394566.html
*/ */
//获取要下载的文件名 //获取要下载的文件名
require_once __DIR__ . '/function.php'; require_once __DIR__ . '/function.php';
// 空GET // 空GET
if (empty($_GET)) { if (empty($_GET)) {
exit('No file path'); exit('No file path');
} }
// 获取下载路径 // 获取下载路径
if (isset($_GET['dw'])) { if (isset($_GET['dw'])) {
$dw = '../' . $_GET['dw']; $dw = '../' . $_GET['dw'];
// 检查文件是否存在 // 检查文件是否存在
if (!is_file($dw)) { if (!is_file($dw)) {
exit('No File'); exit('No File');
} }
} }
// 历史上传记录的路径 // 历史上传记录的路径
if (isset(($_GET['history']))) { if (isset(($_GET['history']))) {
$dw = '../' . $_GET['history']; $dw = '../' . $_GET['history'];
if ($config['hide_path']) { if ($config['hide_path']) {
$dw = '../' . $config['path'] . $_GET['history']; $dw = '../' . $config['path'] . $_GET['history'];
} }
} }
// 检查文件是否存在 // 检查文件是否存在
if (!is_file($dw)) { if (!is_file($dw)) {
exit('No File'); exit('No File');
} }
// 过滤下载非指定上传文件格式 // 过滤下载非指定上传文件格式
$dw_extension = pathinfo($dw, PATHINFO_EXTENSION); $dw_extension = pathinfo($dw, PATHINFO_EXTENSION);
$filter_extensions = explode(',', $config['extensions']); $filter_extensions = explode(',', $config['extensions']);
// 过滤下载其他格式 // 过滤下载其他格式
$filter_other = array('php', 'json', 'log', 'lock'); $filter_other = array('php', 'json', 'log', 'lock');
// 先过滤后下载 // 先过滤后下载
if (in_array($dw_extension, $filter_extensions) && !in_array($dw_extension, $filter_other)) { if (in_array($dw_extension, $filter_extensions) && !in_array($dw_extension, $filter_other)) {
//设置头信息 //设置头信息
header('Content-Disposition:attachment;filename=' . basename($dw)); header('Content-Disposition:attachment;filename=' . basename($dw));
header('Content-Length:' . filesize($dw)); header('Content-Length:' . filesize($dw));
//读取文件并写入到输出缓冲 //读取文件并写入到输出缓冲
readfile($dw); readfile($dw);
exit; exit;
} else { } else {
exit('Downfile Type Error'); exit('Downfile Type Error');
} }

412
application/footer.php → app/footer.php Executable file → Normal file
View File

@ -1,207 +1,207 @@
<?php <?php
/** 禁止直接访问 */ /** 禁止直接访问 */
defined('APP_ROOT') ?: exit; defined('APP_ROOT') ?: exit;
/** 弹窗公告 */ /** 弹窗公告 */
if ($config['notice_status'] > 0) : ?> if ($config['notice_status'] > 0) : ?>
<div class="modal fade" id="notice"> <div class="modal fade" id="notice">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal"> <button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">x</span> <span aria-hidden="true">x</span>
<span class="sr-only">关闭</span></button> <span class="sr-only">关闭</span></button>
<p class="modal-title icon icon-bell" style="text-align: center"> 网站公告</p> <p class="modal-title icon icon-bell" style="text-align: center"> 网站公告</p>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<?php echo $config['notice']; ?> <?php echo $config['notice']; ?>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-mini btn-primary" data-dismiss="modal">了解</button> <button type="button" class="btn btn-mini btn-primary" data-dismiss="modal">了解</button>
</div> </div>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<!-- 二维码 --> <!-- 二维码 -->
<div class="modal fade" id="qr"> <div class="modal fade" id="qr">
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal"> <button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">x</span> <span aria-hidden="true">x</span>
<span class="sr-only">关闭</span></button> <span class="sr-only">关闭</span></button>
<p class="modal-title icon icon-mobile" style="text-align: center">扫描二维码使用手机上传</p> <p class="modal-title icon icon-mobile" style="text-align: center">扫描二维码使用手机上传</p>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p id="qrcode"></p> <p id="qrcode"></p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- 占位符 --> <!-- 占位符 -->
<div class="col-md-12 clo-xs-12" style="margin-bottom: 108px;position:relative;"></div> <div class="col-md-12 clo-xs-12" style="margin-bottom: 108px;position:relative;"></div>
<footer class="container text-muted small navbar-fixed-bottom" style="text-align: center;background-color:rgba(255,255,255,0.7);z-index: 0;"> <footer class="container text-muted small navbar-fixed-bottom" style="text-align: center;background-color:rgba(255,255,255,0.7);z-index: 0;">
<hr> <hr>
<?php /** 页脚自定义代码 */ echo $config['footer']; ?> <?php /** 页脚自定义代码 */ echo $config['footer']; ?>
<p> <p>
<!-- 页脚信息 --> <!-- 页脚信息 -->
<a href="https://github.com/icret/EasyImages2.0" target="_blank" rel="nofollow" data-toggle="tooltip" title="Github">© Since 2018</a> <a href="https://github.com/icret/EasyImages2.0" target="_blank" rel="nofollow" data-toggle="tooltip" title="Github">© Since 2018</a>
<a href="https://png.cm/" target="_blank" data-toggle="tooltip" title="EasyImage2.0 简单图床">EasyImage</a> <a href="https://png.cm/" target="_blank" data-toggle="tooltip" title="EasyImage2.0 简单图床">EasyImage</a>
<a href="/admin/terms.php" target="_blank" data-toggle="tooltip" title="使用协议">DMCA</a> <a href="/admin/terms.php" target="_blank" data-toggle="tooltip" title="使用协议">DMCA</a>
<!-- 二维码按钮 --> <!-- 二维码按钮 -->
<a data-toggle="modal" href="#qr"><i class="icon icon-qrcode hidden-xs inline-block" data-toggle="tooltip" title="二维码"></i></a> <a data-toggle="modal" href="#qr"><i class="icon icon-qrcode hidden-xs inline-block" data-toggle="tooltip" title="二维码"></i></a>
<?php /** 暗黑模式 */ if ($config['dark-mode']) : ?> <?php /** 暗黑模式 */ if ($config['dark-mode']) : ?>
<a id="dark" data-toggle="tooltip" title="暗黑模式"><i class="icon icon-lightbulb" id="dark_ico"></i></a> <a id="dark" data-toggle="tooltip" title="暗黑模式"><i class="icon icon-lightbulb" id="dark_ico"></i></a>
<?php endif; ?> <?php endif; ?>
<?php /**登录与退出 */ if (is_who_login('admin') || is_who_login('guest')) : ?> <?php /**登录与退出 */ if (is_who_login('admin') || is_who_login('guest')) : ?>
<a href="<?php echo $config['domain']; ?>/admin/index.php?login=logout" data-toggle="tooltip" title="退出账号"><i class="icon icon-signout"></i></a> <a href="<?php echo $config['domain']; ?>/admin/index.php?login=logout" data-toggle="tooltip" title="退出账号"><i class="icon icon-signout"></i></a>
<?php else : ?> <?php else : ?>
<a href="<?php echo $config['domain']; ?>/admin/index.php" data-toggle="tooltip" title="账号登录"><i class="icon icon-user"></i></a> <a href="<?php echo $config['domain']; ?>/admin/index.php" data-toggle="tooltip" title="账号登录"><i class="icon icon-user"></i></a>
<?php endif; ?> <?php endif; ?>
</p> </p>
</footer> </footer>
<link href="<?php static_cdn(); ?>/public/static/nprogress/nprogress.min.css" rel="stylesheet"> <link href="<?php static_cdn(); ?>/public/static/nprogress/nprogress.min.css" rel="stylesheet">
<script src="<?php static_cdn(); ?>/public/static/nprogress/nprogress.min.js"></script> <script src="<?php static_cdn(); ?>/public/static/nprogress/nprogress.min.js"></script>
<script src="<?php static_cdn(); ?>/public/static/qrcode/qrcode.min.js"></script> <script src="<?php static_cdn(); ?>/public/static/qrcode/qrcode.min.js"></script>
<script> <script>
// NProgress // NProgress
NProgress.start(); NProgress.start();
NProgress.done(); NProgress.done();
// 导航状态 // 导航状态
$('.nav-pills').find('a').each(function() { $('.nav-pills').find('a').each(function() {
// console.log(document.location); // console.log(document.location);
if (this.pathname == document.location.pathname) { if (this.pathname == document.location.pathname) {
$(this).parent().addClass('active'); $(this).parent().addClass('active');
} }
}); });
// js 获取当前网址二维码 // js 获取当前网址二维码
var qrcode = new QRCode(document.getElementById("qrcode"), { var qrcode = new QRCode(document.getElementById("qrcode"), {
text: window.location.href, text: window.location.href,
width: 265, width: 265,
height: 256, height: 256,
colorDark: "#353535", colorDark: "#353535",
colorLight: "#F1F1F1", colorLight: "#F1F1F1",
correctLevel: QRCode.CorrectLevel.H correctLevel: QRCode.CorrectLevel.H
}); });
// 二维码对话框属性 // 二维码对话框属性
$('#qr').modal({ $('#qr').modal({
moveable: true, moveable: true,
moveable: "inside", moveable: "inside",
backdrop: true, backdrop: true,
show: false, show: false,
}) })
<?php /** 弹窗公告控制 */ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?> <?php /** 弹窗公告控制 */ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?>
if (document.cookie.indexOf("noticed=") == -1) { if (document.cookie.indexOf("noticed=") == -1) {
$('#notice').modal({ $('#notice').modal({
backdrop: false, backdrop: false,
loadingIcon: "icon-spin", loadingIcon: "icon-spin",
scrollInside: true, scrollInside: true,
moveable: "inside", moveable: "inside",
rememberPos: true, rememberPos: true,
scrollInside: true scrollInside: true
}).on('hidden.zui.modal', function() { }).on('hidden.zui.modal', function() {
// 只有用户手动关闭才会存储cookie,避免不看公告直接刷新 // 只有用户手动关闭才会存储cookie,避免不看公告直接刷新
document.cookie = "noticed = 1"; document.cookie = "noticed = 1";
console.log('网站公告已显示完毕') console.log('网站公告已显示完毕')
}) })
} }
<?php endif; ?> <?php endif; ?>
<?php /** 简繁转换 */ if ($config['language'] == 1) : ?> <?php /** 简繁转换 */ if ($config['language'] == 1) : ?>
$.getScript("<?php static_cdn(); ?>/public/static/i18n/jquery.s2t.js", function() { //加载成功后,并执行回调函数 $.getScript("<?php static_cdn(); ?>/public/static/i18n/jquery.s2t.js", function() { //加载成功后,并执行回调函数
$('*').s2t(); $('*').s2t();
}); });
<?php endif; ?> <?php endif; ?>
<?php /** 暗黑模式 */ if ($config['dark-mode']) : ?> <?php /** 暗黑模式 */ if ($config['dark-mode']) : ?>
// cookie 操作封装 https://www.jb51.net/article/94456.htm // cookie 操作封装 https://www.jb51.net/article/94456.htm
var cookieUtil = { var cookieUtil = {
// 设置cookie // 设置cookie
setItem: function(name, value, days) { setItem: function(name, value, days) {
var date = new Date(); var date = new Date();
date.setDate(date.getDate() + days); date.setDate(date.getDate() + days);
document.cookie = name + '=' + value + ';expires=' + date + ';path=' + '/'; document.cookie = name + '=' + value + ';expires=' + date + ';path=' + '/';
}, },
// 获取cookie // 获取cookie
getItem: function(name) { getItem: function(name) {
var arr = document.cookie.replace(/\s/g, "").split(';'); var arr = document.cookie.replace(/\s/g, "").split(';');
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var tempArr = arr[i].split('='); var tempArr = arr[i].split('=');
if (tempArr[0] == name) { if (tempArr[0] == name) {
return decodeURIComponent(tempArr[1]); return decodeURIComponent(tempArr[1]);
} }
} }
return ''; return '';
}, },
// 删除cookie // 删除cookie
removeItem: function(name) { removeItem: function(name) {
this.setItem(name, '1', -1); this.setItem(name, '1', -1);
}, },
// 检查是否含有某cookie // 检查是否含有某cookie
hasItem: function(name) { hasItem: function(name) {
return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(name).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie); return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(name).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
}, },
// 获取全部的cookie列表 // 获取全部的cookie列表
getAllItems: function() { getAllItems: function() {
var cookieArr = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/); var cookieArr = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
for (var nIdx = 0; nIdx < cookieArr.length; nIdx++) { for (var nIdx = 0; nIdx < cookieArr.length; nIdx++) {
cookieArr[nIdx] = decodeURIComponent(cookieArr[nIdx]); cookieArr[nIdx] = decodeURIComponent(cookieArr[nIdx]);
} }
return cookieArr; return cookieArr;
} }
}; };
// 暗黑操作 // 暗黑操作
let styleLabel = document.createElement('style'); let styleLabel = document.createElement('style');
document.getElementById('dark').onclick = function() { document.getElementById('dark').onclick = function() {
if (cookieUtil.getItem('dark-mode') == null) { if (cookieUtil.getItem('dark-mode') == null) {
const style = 'html{filter: invert(80%) hue-rotate(180deg);} img,video {filter: invert(100%) hue-rotate(180deg);}'; const style = 'html{filter: invert(80%) hue-rotate(180deg);} img,video {filter: invert(100%) hue-rotate(180deg);}';
styleLabel.appendChild(document.createTextNode(style)); styleLabel.appendChild(document.createTextNode(style));
document.head.appendChild(styleLabel); document.head.appendChild(styleLabel);
cookieUtil.setItem('dark-mode', 1, 1); cookieUtil.setItem('dark-mode', 1, 1);
} else { } else {
if (cookieUtil.getItem('dark-mode') == 1) { if (cookieUtil.getItem('dark-mode') == 1) {
document.head.removeChild(styleLabel); document.head.removeChild(styleLabel);
cookieUtil.setItem('dark-mode', 0, 1); cookieUtil.setItem('dark-mode', 0, 1);
} else { } else {
const style = 'html{filter: invert(80%) hue-rotate(180deg);} img,video {filter: invert(100%) hue-rotate(180deg);}'; const style = 'html{filter: invert(80%) hue-rotate(180deg);} img,video {filter: invert(100%) hue-rotate(180deg);}';
styleLabel.appendChild(document.createTextNode(style)); styleLabel.appendChild(document.createTextNode(style));
document.head.appendChild(styleLabel); document.head.appendChild(styleLabel);
cookieUtil.setItem('dark-mode', 1, 1); cookieUtil.setItem('dark-mode', 1, 1);
} }
} }
} }
if (cookieUtil.getItem('dark-mode') == 1) { if (cookieUtil.getItem('dark-mode') == 1) {
const style = 'html{filter: invert(80%) hue-rotate(180deg);} img,video {filter: invert(100%) hue-rotate(180deg);}'; const style = 'html{filter: invert(80%) hue-rotate(180deg);} img,video {filter: invert(100%) hue-rotate(180deg);}';
styleLabel.appendChild(document.createTextNode(style)); styleLabel.appendChild(document.createTextNode(style));
document.head.appendChild(styleLabel); document.head.appendChild(styleLabel);
} }
if (cookieUtil.getItem('dark-mode') == null) { if (cookieUtil.getItem('dark-mode') == null) {
document.head.removeChild(styleLabel); document.head.removeChild(styleLabel);
} }
<?php endif; ?> <?php endif; ?>
// tips提示 // tips提示
$('[data-toggle="tooltip"]').tooltip({ $('[data-toggle="tooltip"]').tooltip({
tipClass: 'tooltip', tipClass: 'tooltip',
placement: 'auto', placement: 'auto',
html: true, html: true,
delay: { delay: {
show: 50, show: 50,
hide: 0.5 hide: 0.5
} }
}); });
// console // console
console.log("%cEasyImage <?php echo get_current_version(); ?>", "background: rgba(252,234,187,1);background: -moz-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%,rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -webkit-gradient(left top, right top, color-stop(0%, rgba(252,234,187,1)), color-stop(12%, rgba(175,250,77,1)), color-stop(28%, rgba(0,247,49,1)), color-stop(39%, rgba(0,210,247,1)), color-stop(51%, rgba(0,189,247,1)), color-stop(64%, rgba(133,108,217,1)), color-stop(78%, rgba(177,0,247,1)), color-stop(87%, rgba(247,0,189,1)), color-stop(0.5%, rgba(245,22,52,1)));background: -webkit-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -o-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -ms-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: linear-gradient(to right, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fceabb', endColorstr='#f51634', GradientType=1 );font-size:2.34em;font-weight:bold") console.log("%cEasyImage <?php echo get_current_version(); ?>", "background: rgba(252,234,187,1);background: -moz-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%,rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -webkit-gradient(left top, right top, color-stop(0%, rgba(252,234,187,1)), color-stop(12%, rgba(175,250,77,1)), color-stop(28%, rgba(0,247,49,1)), color-stop(39%, rgba(0,210,247,1)), color-stop(51%, rgba(0,189,247,1)), color-stop(64%, rgba(133,108,217,1)), color-stop(78%, rgba(177,0,247,1)), color-stop(87%, rgba(247,0,189,1)), color-stop(0.5%, rgba(245,22,52,1)));background: -webkit-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -o-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -ms-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: linear-gradient(to right, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fceabb', endColorstr='#f51634', GradientType=1 );font-size:2.34em;font-weight:bold")
console.log('%c图床作者及演示网站: https://png.cm\n作为开发者你可以对相应的后台功能进行扩展(增删改相应代码), 但请保留代码中相关来源信息(例如: 本人博客, 邮箱等);\n本程序由 Icret 独自开发并完全开源, 碰到收费发布的请不要轻易付款; 本人仅为程序开源创作, 如非法网站使用与本人无关, 请勿用于非法用途.%c ', 'color: #eaad1a; padding:5px 0; border:1px solid #448ef6; font-size:12px;', ''); console.log('%c图床作者及演示网站: https://png.cm\n作为开发者你可以对相应的后台功能进行扩展(增删改相应代码), 但请保留代码中相关来源信息(例如: 本人博客, 邮箱等);\n本程序由 Icret 独自开发并完全开源, 碰到收费发布的请不要轻易付款; 本人仅为程序开源创作, 如非法网站使用与本人无关, 请勿用于非法用途.%c ', 'color: #eaad1a; padding:5px 0; border:1px solid #448ef6; font-size:12px;', '');
</script> </script>
</body> </body>
</html> </html>

3521
application/function.php → app/function.php Executable file → Normal file

File diff suppressed because it is too large Load Diff

116
application/header.php → app/header.php Executable file → Normal file
View File

@ -1,59 +1,59 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-cn"> <html lang="zh-cn">
<?php require_once __DIR__ . '/function.php'; ?> <?php require_once __DIR__ . '/function.php'; ?>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit" /> <meta name="renderer" content="webkit" />
<meta name="force-rendering" content="webkit" /> <meta name="force-rendering" content="webkit" />
<meta name="author" content="Icret EasyImage2.0"> <meta name="author" content="Icret EasyImage2.0">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<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 static_cdn(); ?>/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>
<script src="<?php static_cdn(); ?>/public/static/zui/js/zui.min.js"></script> <script src="<?php static_cdn(); ?>/public/static/zui/js/zui.min.js"></script>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/ieonly/html5shiv.js"></script> <script src="<?php static_cdn(); ?>/public/static/zui/lib/ieonly/html5shiv.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/ieonly/respond.js"></script> <script src="<?php static_cdn(); ?>/public/static/zui/lib/ieonly/respond.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/ieonly/excanvas.js"></script> <script src="<?php static_cdn(); ?>/public/static/zui/lib/ieonly/excanvas.js"></script>
<![endif]--> <![endif]-->
<?php /** 页头自定义代码 */ echo $config['customize']; ?> <?php /** 页头自定义代码 */ echo $config['customize']; ?>
</head> </head>
<body class="container"> <body class="container">
<div class="page-header"> <div class="page-header">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-EasyImage"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-EasyImage">
<span class="icon icon-bars"></span> <span class="icon icon-bars"></span>
</button> </button>
</div> </div>
<div class="collapse navbar-collapse navbar-collapse-EasyImage"> <div class="collapse navbar-collapse navbar-collapse-EasyImage">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li><a href="<?php echo $config['domain']; ?>"><i class="icon icon-home"></i> 首页</a></li> <li><a href="<?php echo $config['domain']; ?>"><i class="icon icon-home"></i> 首页</a></li>
<?php /** 非管理或未开启不显示广场 */ if ($config['showSwitch'] || is_who_login('admin')) : ?> <?php /** 非管理或未开启不显示广场 */ if ($config['showSwitch'] || is_who_login('admin')) : ?>
<li><a href="<?php echo $config['domain']; ?>/application/list.php"><i class="icon icon-th"></i> 广场<span class="label label-badge label-primary"><?php echo get_file_by_glob(APP_ROOT . config_path(), 'number'); ?></span></a></li> <li><a href="<?php echo $config['domain']; ?>/app/list.php"><i class="icon icon-th"></i> 广场<span class="label label-badge label-primary"><?php echo get_file_by_glob(APP_ROOT . config_path(), 'number'); ?></span></a></li>
<?php endif; ?> <?php endif; ?>
<?php /** 非管理或未开启不显示上传历史 */ if ($config['history'] || is_who_login('admin')) : ?> <?php /** 非管理或未开启不显示上传历史 */ if ($config['history'] || is_who_login('admin')) : ?>
<li><a href="<?php $config['domain']; ?>/application/history.php"><i class="icon icon-history"></i> 历史<span class="label label-badge label-primary"></span></a></li> <li><a href="<?php $config['domain']; ?>/app/history.php"><i class="icon icon-history"></i> 历史<span class="label label-badge label-primary"></span></a></li>
<?php endif; ?> <?php endif; ?>
<?php /** 非管理不显示设置 */ if (is_who_login('admin')) : ?> <?php /** 非管理不显示设置 */ if (is_who_login('admin')) : ?>
<li><a href="<?php echo $config['domain']; ?>/admin/admin.inc.php"><i class="icon icon-cogs"></i> 设置</a></li> <li><a href="<?php echo $config['domain']; ?>/admin/admin.inc.php"><i class="icon icon-cogs"></i> 设置</a></li>
<?php endif; ?> <?php endif; ?>
<?php /** 非管理或未开启不显示统计 */ if ($config['chart_on'] && is_who_login('admin')) : ?> <?php /** 非管理或未开启不显示统计 */ if ($config['chart_on'] && is_who_login('admin')) : ?>
<li><a href="<?php echo $config['domain']; ?>/admin/chart.php"><i class="icon icon-pie-chart"></i> 统计</a></li> <li><a href="<?php echo $config['domain']; ?>/admin/chart.php"><i class="icon icon-pie-chart"></i> 统计</a></li>
<?php endif; ?> <?php endif; ?>
<?php /** 账号登录 */ if (is_who_login('status')) : ?> <?php /** 账号登录 */ if (is_who_login('status')) : ?>
<!-- 右侧的导航项目 --> <!-- 右侧的导航项目 -->
<li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php?login=logout">您好:<?php echo json_decode($_COOKIE['auth'])[0]; ?> <i class="icon icon-signout"></i></a></li> <li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php?login=logout">您好:<?php echo json_decode($_COOKIE['auth'])[0]; ?> <i class="icon icon-signout"></i></a></li>
<?php else : ?> <?php else : ?>
<li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php"><i class="icon icon-user"> 登录</i></a></li> <li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php"><i class="icon icon-user"> 登录</i></a></li>
<?php endif; ?> <?php endif; ?>
</ul> </ul>
</div> </div>
</div> </div>
<!-- 顶部导航栏END --> <!-- 顶部导航栏END -->

66
application/hide.php → app/hide.php Executable file → Normal file
View File

@ -1,33 +1,33 @@
<?php <?php
/** /**
* Program: EasyImage2.0 * Program: EasyImage2.0
* Author: Icret * Author: Icret
* Date: 2022/3/13 20:11 * Date: 2022/3/13 20:11
* For: 源图保护解密 * For: 源图保护解密
*/ */
require_once __DIR__ . '/function.php'; require_once __DIR__ . '/function.php';
if (isset($_GET['key'])) { if (isset($_GET['key'])) {
$hide_original = $_GET['key']; $hide_original = $_GET['key'];
$real_path = APP_ROOT . urlHash($hide_original, 1, crc32($config['hide_key'])); $real_path = APP_ROOT . urlHash($hide_original, 1, crc32($config['hide_key']));
} else { } else {
$real_path = APP_ROOT . '/public/images/404.png'; $real_path = APP_ROOT . '/public/images/404.png';
} }
// 文件不存在 // 文件不存在
if (!is_file($real_path)) { if (!is_file($real_path)) {
$real_path = APP_ROOT . '/public/images/404.png'; $real_path = APP_ROOT . '/public/images/404.png';
} }
// 获取文件后缀 // 获取文件后缀
$ex = pathinfo($real_path, PATHINFO_EXTENSION); $ex = pathinfo($real_path, PATHINFO_EXTENSION);
// 设置头 // 设置头
header("Content-Type: image/" . $ex . ";text/html; charset=utf-8"); header("Content-Type: image/" . $ex . ";text/html; charset=utf-8");
//输出文件 //输出文件
echo file_get_contents($real_path); echo file_get_contents($real_path);
exit; exit;

View File

@ -93,4 +93,4 @@ include_once __DIR__ . "/header.php";
</script> </script>
<?php <?php
/** 引入底部 */ /** 引入底部 */
require_once APP_ROOT . '/application/footer.php'; require_once __DIR__ . '/footer.php';

650
application/info.php → app/info.php Executable file → Normal file
View File

@ -1,325 +1,325 @@
<?php <?php
include_once __DIR__ . "/header.php"; include_once __DIR__ . "/header.php";
if (!$config['show_exif_info'] && !is_who_login('admin')) exit(header('Location: ' . $config['domain'] . '?exif#closed')); if (!$config['show_exif_info'] && !is_who_login('admin')) exit(header('Location: ' . $config['domain'] . '?exif#closed'));
// 获取图片地址 // 获取图片地址
if (isset($_GET['img'])) { if (isset($_GET['img'])) {
// 过滤特殊符号 // 过滤特殊符号
$getIMG = strip_tags($_GET['img']); $getIMG = strip_tags($_GET['img']);
$del_url = $config['domain'] . $getIMG; $del_url = $config['domain'] . $getIMG;
} elseif (isset($_GET['history'])) { } elseif (isset($_GET['history'])) {
// 过滤特殊符号 // 过滤特殊符号
if ($config['hide_path']) { if ($config['hide_path']) {
$getIMG = $config['path'] . ltrim(strip_tags($_GET['history']), '/'); $getIMG = $config['path'] . ltrim(strip_tags($_GET['history']), '/');
} else { } else {
$getIMG = strip_tags($_GET['history']); $getIMG = strip_tags($_GET['history']);
} }
$del_url = $config['domain'] . $getIMG; $del_url = $config['domain'] . $getIMG;
} else { } else {
// 未获取到图片地址 // 未获取到图片地址
$getIMG = "/public/images/404.png"; $getIMG = "/public/images/404.png";
$del_url = "#"; $del_url = "#";
} }
// 开启隐藏上传目录 // 开启隐藏上传目录
if ($config['hide_path']) { if ($config['hide_path']) {
$img_url = rand_imgurl() . str_replace($config['path'], '/', $getIMG); $img_url = rand_imgurl() . str_replace($config['path'], '/', $getIMG);
// 获取当前图片日志文件 // 获取当前图片日志文件
$logs = str_replace('/', '-', substr(parse_url($img_url, PHP_URL_PATH), 1, 7)); $logs = str_replace('/', '-', substr(parse_url($img_url, PHP_URL_PATH), 1, 7));
} else { } else {
// 关闭隐藏上传目录 // 关闭隐藏上传目录
$img_url = rand_imgurl() . $getIMG; $img_url = rand_imgurl() . $getIMG;
// 获取当前图片日志文件 // 获取当前图片日志文件
$logs = str_replace('/', '-', substr(str_replace($config['path'], '', parse_url($img_url, PHP_URL_PATH)), 0, 7)); $logs = str_replace('/', '-', substr(str_replace($config['path'], '', parse_url($img_url, PHP_URL_PATH)), 0, 7));
} }
// 导入日志文件 // 导入日志文件
$logsName = basename($img_url); $logsName = basename($img_url);
if (is_file(APP_ROOT . '/admin/logs/upload/' . $logs . '.php')) { if (is_file(APP_ROOT . '/admin/logs/upload/' . $logs . '.php')) {
include APP_ROOT . '/admin/logs/upload/' . $logs . '.php'; include APP_ROOT . '/admin/logs/upload/' . $logs . '.php';
} else { } else {
$logs = array($logsName => array('source' => '日志文件不存在, 请在图床安全中开启上传日志!', 'date' => '日志文件不存在, 请在图床安全中开启上传日志!', 'ip' => '0.0.0.0', 'port' => '0', 'user_agent' => '日志文件不存在, 请在图床安全中开启上传日志!', 'path' => '日志文件不存在, 请在图床安全中开启上传日志!', 'size' => '日志文件不存在, 请在图床安全中开启上传日志!', 'md5' => '日志文件不存在, 请在图床安全中开启上传日志!', 'checkImg' => '日志文件不存在, 请在图床安全中开启上传日志!', 'from' => '日志文件不存在, 请在图床安全中开启上传日志!')); $logs = array($logsName => array('source' => '请在图床安全中开启上传日志!', 'date' => '请在图床安全中开启上传日志!', 'ip' => '0.0.0.0', 'port' => '0', 'user_agent' => '请在图床安全中开启上传日志!', 'path' => '请在图床安全中开启上传日志!', 'size' => '请在图床安全中开启上传日志!', 'md5' => '请在图床安全中开启上传日志!', 'checkImg' => '请在图床安全中开启上传日志!', 'from' => '请在图床安全中开启上传日志!'));
} }
if (empty($logs[$logsName])) { if (empty($logs[$logsName])) {
$logs = array($logsName => array('source' => '日志不存在', 'date' => '日志不存在', 'ip' => '0.0.0.0', 'port' => '0', 'user_agent' => '日志不存在', 'path' => '日志不存在', 'size' => '日志不存在', 'md5' => '日志不存在', 'checkImg' => '日志不存在', 'from' => '日志不存在')); $logs = array($logsName => array('source' => '日志不存在', 'date' => '日志不存在', 'ip' => '0.0.0.0', 'port' => '0', 'user_agent' => '日志不存在', 'path' => '日志不存在', 'size' => '日志不存在', 'md5' => '日志不存在', 'checkImg' => '日志不存在', 'from' => '日志不存在'));
} }
// 图片真实路径 // 图片真实路径
$imgABPath = APP_ROOT . $getIMG; $imgABPath = APP_ROOT . $getIMG;
// 图片是否存在 // 图片是否存在
if (!is_file($imgABPath)) { if (!is_file($imgABPath)) {
$imgABPath = APP_ROOT . "/public/images/404.png"; $imgABPath = APP_ROOT . "/public/images/404.png";
$img_url = $config['domain'] . "/public/images/404.png"; $img_url = $config['domain'] . "/public/images/404.png";
} }
// 图片尺寸 // 图片尺寸
$imgSize = filesize($imgABPath); $imgSize = filesize($imgABPath);
// 上传时间 // 上传时间
$upTime = filemtime($imgABPath); $upTime = filemtime($imgABPath);
// 广告 // 广告
if ($config['ad_top']) echo $config['ad_top_info']; if ($config['ad_top']) echo $config['ad_top_info'];
?> ?>
<div class="col-md-12"> <div class="col-md-12">
<div class="col-md-5" style="text-align: center;"> <div class="col-md-5" style="text-align: center;">
<img data-toggle="lightbox" src="<?php echo $img_url; ?>" id="img1" class="img-rounded" height="432px" data-caption="<?php echo pathinfo($img_url, PATHINFO_FILENAME); ?>的详细信息" alt="<?php echo $img_url; ?>" /> <img data-toggle="lightbox" src="<?php echo $img_url; ?>" id="img1" class="img-rounded" height="432px" data-caption="<?php echo pathinfo($img_url, PATHINFO_FILENAME); ?>的详细信息" alt="<?php echo $img_url; ?>" />
</div> </div>
<div class="col-md-6 table-responsive table-condensed" style="margin-top: 10px;"> <div class="col-md-6 table-responsive table-condensed" style="margin-top: 10px;">
<table class="table table-hover table-striped table-bordered text-nowrap"> <table class="table table-hover table-striped table-bordered text-nowrap">
<tbody> <tbody>
<tr> <tr>
<td>图片名称</td> <td>图片名称</td>
<td> <?php echo basename($getIMG); ?></td> <td> <?php echo basename($getIMG); ?></td>
</tr> </tr>
<tr> <tr>
<td>图片大小</td> <td>图片大小</td>
<td><?php echo getDistUsed($imgSize); ?></td> <td><?php echo getDistUsed($imgSize); ?></td>
</tr> </tr>
<tr> <tr>
<td>图片类型</td> <td>图片类型</td>
<td>image/<?php echo pathinfo($getIMG, PATHINFO_EXTENSION); ?></td> <td>image/<?php echo pathinfo($getIMG, PATHINFO_EXTENSION); ?></td>
</tr> </tr>
<tr> <tr>
<td>图片宽高</td> <td>图片宽高</td>
<td><span id="wh"></span>px</td> <td><span id="wh"></span>px</td>
</tr> </tr>
<tr> <tr>
<td>上传时间</td> <td>上传时间</td>
<td><?php echo $logs[$logsName]['date']; ?></td> <td><?php echo $logs[$logsName]['date']; ?></td>
</tr> </tr>
<?php if (is_who_login('admin')) : ?> <?php if (is_who_login('admin')) : ?>
<tr class="text-primary"> <tr class="text-primary">
<td>原始名称</td> <td>原始名称</td>
<td><?php echo $logs[$logsName]['source']; ?></td> <td><?php echo $logs[$logsName]['source']; ?></td>
</tr> </tr>
<tr class="text-primary"> <tr class="text-primary">
<td>原始大小</td> <td>原始大小</td>
<td><?php echo $logs[$logsName]['size']; ?></td> <td><?php echo $logs[$logsName]['size']; ?></td>
</tr> </tr>
<tr class="text-primary"> <tr class="text-primary">
<td>上传者IP</td> <td>上传者IP</td>
<td><?php echo $logs[$logsName]['ip'] . ':' . $logs[$logsName]['port']; ?></td> <td><?php echo $logs[$logsName]['ip'] . ':' . $logs[$logsName]['port']; ?></td>
</tr> </tr>
<tr class="text-primary"> <tr class="text-primary">
<td>上传地址</td> <td>上传地址</td>
<td><?php echo Ip2Region($logs[$logsName]['ip']); ?></td> <td><?php echo Ip2Region($logs[$logsName]['ip']); ?></td>
</tr> </tr>
<tr class="text-primary"> <tr class="text-primary">
<td>监黄状态</td> <td>监黄状态</td>
<td><?php echo strstr('OFF', $logs[$logsName]['checkImg']) ? '未开启' : '已通过'; ?></td> <td><?php echo strstr('OFF', $logs[$logsName]['checkImg']) ? '未开启' : '已通过'; ?></td>
</tr> </tr>
<tr class="text-primary"> <tr class="text-primary">
<td>上传方式</td> <td>上传方式</td>
<td><?php echo is_numeric($logs[$logsName]['from']) ? '通过API | Token ID: ' . $logs[$logsName]['from'] : "通过网页"; ?></td> <td><?php echo is_numeric($logs[$logsName]['from']) ? '通过API | Token ID: ' . $logs[$logsName]['from'] : "通过网页"; ?></td>
</tr> </tr>
<tr class="text-primary"> <tr class="text-primary">
<td>文件路径</td> <td>文件路径</td>
<td><?php echo $logs[$logsName]['path']; ?></td> <td><?php echo $logs[$logsName]['path']; ?></td>
</tr> </tr>
<tr class="text-primary"> <tr class="text-primary">
<td>文件MD5</td> <td>文件MD5</td>
<td><?php echo $logs[$logsName]['md5']; ?></td> <td><?php echo $logs[$logsName]['md5']; ?></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr> <tr>
<td>文件操作</td> <td>文件操作</td>
<td> <td>
<a class="btn btn-mini btn-primary" href="<?php echo $img_url; ?>" target="_blank"><i class="icon icon-picture"> 查看</i></a> <a class="btn btn-mini btn-primary" href="<?php echo $img_url; ?>" target="_blank"><i class="icon icon-picture"> 查看</i></a>
<a class="btn btn-mini btn-primary" href="" onclick="window.location.replace;"><i class="icon icon-spin icon-refresh"></i> 刷新</a> <a class="btn btn-mini btn-primary" href="" onclick="window.location.replace;"><i class="icon icon-spin icon-refresh"></i> 刷新</a>
<a class="btn btn-mini btn-primary" href="/application/down.php?dw=<?php echo $getIMG; ?>" target="_blank"><i class="icon icon-cloud-download"> 下载</i></a> <a class="btn btn-mini btn-primary" href="/app/down.php?dw=<?php echo $getIMG; ?>" target="_blank"><i class="icon icon-cloud-download"> 下载</i></a>
<?php if (!empty($config['report']) && !is_who_login('admin')) : ?> <?php if (!empty($config['report']) && !is_who_login('admin')) : ?>
<a class="btn btn-mini btn-warning" href="<?php echo $config['report'] . '?Website1=' . $img_url; ?>" target="_blank"><i class="icon icon-question-sign"> 举报</i></a> <a class="btn btn-mini btn-warning" href="<?php echo $config['report'] . '?Website1=' . $img_url; ?>" target="_blank"><i class="icon icon-question-sign"> 举报</i></a>
<?php endif; ?> <?php endif; ?>
<?php if (is_who_login('admin')) : ?> <?php if (is_who_login('admin')) : ?>
<a class="btn btn-mini btn-warning" href="/application/del.php?recycle_url=<?php echo $getIMG; ?>" target="_blank"><i class="icon icon-undo"> 回收</i></a> <a class="btn btn-mini btn-warning" href="/app/del.php?recycle_url=<?php echo $getIMG; ?>" target="_blank"><i class="icon icon-undo"> 回收</i></a>
<a class="btn btn-mini btn-warning" href="/application/del.php?url=<?php echo $del_url; ?>" target="_blank"><i class="icon icon-trash"> 删除</i></a> <a class="btn btn-mini btn-warning" href="/app/del.php?url=<?php echo $del_url; ?>" target="_blank"><i class="icon icon-trash"> 删除</i></a>
<?php endif; ?> <?php endif; ?>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h4 class="with-padding hl-gray"><i class="icon icon-info-sign"> 此图片来自网友上传, 不代表<a href="/admin/terms.php" target="_blank">本站立场</a>, 若有侵权, 请举报或联系管理员!</i></h4> <h4 class="with-padding hl-gray"><i class="icon icon-info-sign"> 此图片来自网友上传, 不代表<a href="/admin/terms.php" target="_blank">本站立场</a>, 若有侵权, 请举报或联系管理员!</i></h4>
</div> </div>
</div> </div>
<div class="col-md-12" style="padding-bottom: 10px;"> <div class="col-md-12" style="padding-bottom: 10px;">
<div class="col-md-6" style="padding-bottom: 10px;"> <div class="col-md-6" style="padding-bottom: 10px;">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="icon icon-link"></i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="input-group-addon"><i class="icon icon-link"></i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<input type="text" class="form-control" id="links" onclick="copyText()" value="<?php echo $img_url; ?>"> <input type="text" class="form-control" id="links" onclick="copyText()" value="<?php echo $img_url; ?>">
<span class="input-group-btn"><button class="btn btn-default copyBtn1" type="button">复制</button></span> <span class="input-group-btn"><button class="btn btn-default copyBtn1" type="button">复制</button></span>
</div> </div>
</div> </div>
<div class="col-md-6" style="padding-bottom: 10px;"> <div class="col-md-6" style="padding-bottom: 10px;">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="icon icon-chat"></i> 论坛代码&nbsp;&nbsp;&nbsp;</span> <span class="input-group-addon"><i class="icon icon-chat"></i> 论坛代码&nbsp;&nbsp;&nbsp;</span>
<input type="text" class="form-control" id="bbscode" value="[img]<?php echo $img_url; ?>[/img]"> <input type="text" class="form-control" id="bbscode" value="[img]<?php echo $img_url; ?>[/img]">
<span class="input-group-btn"><button class="btn btn-default copyBtn2" type="button">复制</button></span> <span class="input-group-btn"><button class="btn btn-default copyBtn2" type="button">复制</button></span>
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-12" style="padding-bottom: 10px;"> <div class="col-md-12" style="padding-bottom: 10px;">
<div class="col-md-6" style="padding-bottom: 10px;"> <div class="col-md-6" style="padding-bottom: 10px;">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="icon icon-code"></i> MarkDown</span> <span class="input-group-addon"><i class="icon icon-code"></i> MarkDown</span>
<input type="text" class="form-control" id="markdown" value="![简单图床 - EasyImage](<?php echo $img_url; ?>)"> <input type="text" class="form-control" id="markdown" value="![简单图床 - EasyImage](<?php echo $img_url; ?>)">
<span class="input-group-btn"><button class="btn btn-default copyBtn3" type="button">复制</button></span> <span class="input-group-btn"><button class="btn btn-default copyBtn3" type="button">复制</button></span>
</div> </div>
</div> </div>
<div class="col-md-6" style="padding-bottom: 10px;"> <div class="col-md-6" style="padding-bottom: 10px;">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="icon icon-html5"></i> HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="input-group-addon"><i class="icon icon-html5"></i> HTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<input type="text" class="form-control" id="html" value='<img src="<?php echo $img_url; ?>" alt="简单图床 - EasyImage" />'> <input type="text" class="form-control" id="html" value='<img src="<?php echo $img_url; ?>" alt="简单图床 - EasyImage" />'>
<span class="input-group-btn"><button class="btn btn-default copyBtn4" type="button">复制</button></span> <span class="input-group-btn"><button class="btn btn-default copyBtn4" type="button">复制</button></span>
</div> </div>
</div> </div>
</div> </div>
<?php /** 底部广告 */ if ($config['ad_bot']) echo $config['ad_bot_info']; ?> <?php /** 底部广告 */ if ($config['ad_bot']) echo $config['ad_bot_info']; ?>
<!-- 随机图片 --> <!-- 随机图片 -->
<?php if ($config['info_rand_pic']) : ?> <?php if ($config['info_rand_pic']) : ?>
<div class="col-md-12" style="padding-bottom: 10px;"> <div class="col-md-12" style="padding-bottom: 10px;">
<h4 class="header-dividing">当月随机图片:</h4> <h4 class="header-dividing">当月随机图片:</h4>
<div class="cards cards-borderless"> <div class="cards cards-borderless">
<?php if ($logs[$logsName]['port'] != 0) : for ($i = 0; $i <= 7; $i++) : $randName = array_rand($logs, 1) ?> <?php if ($logs[$logsName]['port'] != 0) : for ($i = 0; $i <= 7; $i++) : $randName = array_rand($logs, 1) ?>
<div class="col-md-4 col-sm-6 col-lg-3"> <div class="col-md-4 col-sm-6 col-lg-3">
<a class="card" href="?img=<?php echo $logs[$randName]['path']; ?>" target="_blank"> <a class="card" href="?img=<?php echo $logs[$randName]['path']; ?>" target="_blank">
<img src="thumb.php?img=<?php echo $logs[$randName]['path']; ?>"> <img src="thumb.php?img=<?php echo $logs[$randName]['path']; ?>">
<div class="caption"><?php echo $logs[$randName]['source']; ?></div> <div class="caption"><?php echo $logs[$randName]['source']; ?></div>
</a> </a>
</div> </div>
<?php endfor; ?> <?php endfor; ?>
<?php else : ?> <?php else : ?>
<h3 class="alert alert-danger">本月没有上传图片或上传日志不存在~~</h3> <h3 class="alert alert-danger">本月没有上传图片或上传日志不存在~~</h3>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<script src="<?php static_cdn(); ?>/public/static/EasyImage.js"></script> <script src="<?php static_cdn(); ?>/public/static/EasyImage.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js"></script> <script src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js"></script>
<script> <script>
// 获取图片长宽 https://www.cnblogs.com/houxianzhou/p/14807983.html // 获取图片长宽 https://www.cnblogs.com/houxianzhou/p/14807983.html
var imgReady = (function() { var imgReady = (function() {
var list = [], var list = [],
intervalId = null, intervalId = null,
// 用来执行队列 // 用来执行队列
tick = function() { tick = function() {
var i = 0; var i = 0;
for (; i < list.length; i++) { for (; i < list.length; i++) {
list[i].end ? list.splice(i--, 1) : list[i](); list[i].end ? list.splice(i--, 1) : list[i]();
}; };
!list.length && stop(); !list.length && stop();
}, },
// 停止所有定时器队列 // 停止所有定时器队列
stop = function() { stop = function() {
clearInterval(intervalId); clearInterval(intervalId);
intervalId = null; intervalId = null;
}; };
return function(url, ready, load, error) { return function(url, ready, load, error) {
var onready, width, height, newWidth, newHeight, var onready, width, height, newWidth, newHeight,
img = new Image(); img = new Image();
img.src = url; img.src = url;
// 如果图片被缓存,则直接返回缓存数据 // 如果图片被缓存,则直接返回缓存数据
if (img.complete) { if (img.complete) {
ready.call(img); ready.call(img);
load && load.call(img); load && load.call(img);
return; return;
}; };
width = img.width; width = img.width;
height = img.height; height = img.height;
// 加载错误后的事件 // 加载错误后的事件
img.onerror = function() { img.onerror = function() {
error && error.call(img); error && error.call(img);
onready.end = true; onready.end = true;
img = img.onload = img.onerror = null; img = img.onload = img.onerror = null;
}; };
// 图片尺寸就绪 // 图片尺寸就绪
onready = function() { onready = function() {
newWidth = img.width; newWidth = img.width;
newHeight = img.height; newHeight = img.height;
if (newWidth !== width || newHeight !== height || newWidth * newHeight > 1024) { if (newWidth !== width || newHeight !== height || newWidth * newHeight > 1024) {
// 如果图片已经在其他地方加载可使用面积检测 // 如果图片已经在其他地方加载可使用面积检测
ready.call(img); ready.call(img);
onready.end = true; onready.end = true;
}; };
}; };
onready(); onready();
// 完全加载完毕的事件 // 完全加载完毕的事件
img.onload = function() { img.onload = function() {
// onload在定时器时间差范围内可能比onready快 // onload在定时器时间差范围内可能比onready快
// 这里进行检查并保证onready优先执行 // 这里进行检查并保证onready优先执行
!onready.end && onready(); !onready.end && onready();
load && load.call(img); load && load.call(img);
// IE gif动画会循环执行onload置空onload即可 // IE gif动画会循环执行onload置空onload即可
img = img.onload = img.onerror = null; img = img.onload = img.onerror = null;
}; };
// 加入队列中定期执行 // 加入队列中定期执行
if (!onready.end) { if (!onready.end) {
list.push(onready); list.push(onready);
// 无论何时只允许出现一个定时器,减少浏览器性能损耗 // 无论何时只允许出现一个定时器,减少浏览器性能损耗
if (intervalId === null) intervalId = setInterval(tick, 40); if (intervalId === null) intervalId = setInterval(tick, 40);
}; };
}; };
})(); })();
imgReady('<?php echo $img_url; ?>', function() { imgReady('<?php echo $img_url; ?>', function() {
// alert('size ready: width=' + this.width + '; height=' + this.height); // alert('size ready: width=' + this.width + '; height=' + this.height);
var hw = document.getElementById("wh"); var hw = document.getElementById("wh");
hw.innerHTML = this.width + "x" + this.height hw.innerHTML = this.width + "x" + this.height
}); });
// Exif信息 // Exif信息
/* /*
window.onload = getExif; window.onload = getExif;
function getExif() { function getExif() {
var img1 = document.getElementById("img1"); var img1 = document.getElementById("img1");
EXIF.getData(img1, function() { EXIF.getData(img1, function() {
var make = EXIF.getTag(this, "Make"); var make = EXIF.getTag(this, "Make");
var model = EXIF.getTag(this, "Model"); var model = EXIF.getTag(this, "Model");
var makeAndModel = document.getElementById("makeAndModel"); var makeAndModel = document.getElementById("makeAndModel");
makeAndModel.innerHTML = `${make} ${model}`; makeAndModel.innerHTML = `${make} ${model}`;
}); });
var img2 = document.getElementById("img1"); var img2 = document.getElementById("img1");
EXIF.getData(img2, function() { EXIF.getData(img2, function() {
var allMetaData = EXIF.getAllTags(this); var allMetaData = EXIF.getAllTags(this);
var allMetaDataSpan = document.getElementById("allMetaDataSpan"); var allMetaDataSpan = document.getElementById("allMetaDataSpan");
allMetaDataSpan.innerHTML = EXIF.pretty(this);; allMetaDataSpan.innerHTML = EXIF.pretty(this);;
}); });
} }
*/ */
//禁用右键 //禁用右键
document.onkeydown = function() { document.onkeydown = function() {
var e = window.event || arguments[0]; var e = window.event || arguments[0];
if (e.keyCode == 123) { if (e.keyCode == 123) {
// alert('禁止F12'); // alert('禁止F12');
return false; return false;
} else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) { } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) {
// alert('禁止Ctrl+Shift+I'); // alert('禁止Ctrl+Shift+I');
return false; return false;
} else if ((e.ctrlKey) && (e.keyCode == 85)) { } else if ((e.ctrlKey) && (e.keyCode == 85)) {
// alert('禁止Ctrl+u'); // alert('禁止Ctrl+u');
return false; return false;
} else if ((e.ctrlKey) && (e.keyCode == 83)) { } else if ((e.ctrlKey) && (e.keyCode == 83)) {
// alert('禁止Ctrl+s'); // alert('禁止Ctrl+s');
return false; return false;
} }
} }
// 屏蔽鼠标右键 // 屏蔽鼠标右键
document.oncontextmenu = function() { document.oncontextmenu = function() {
new $.zui.Messager("正在查看图片详细信息", { new $.zui.Messager("正在查看图片详细信息", {
type: "success", // 定义颜色主题 type: "success", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show(); }).show();
return false; return false;
} }
// 更改网页标题 // 更改网页标题
document.title = "图片<?php echo basename($getIMG); ?>的详细信息 - <?php echo $config['title']; ?>" document.title = "图片<?php echo basename($getIMG); ?>的详细信息 - <?php echo $config['title']; ?>"
</script> </script>
<?php <?php
/** 引入底部 */ /** 引入底部 */
require_once APP_ROOT . '/application/footer.php'; require_once APP_ROOT . '/app/footer.php';

760
application/list.php → app/list.php Executable file → Normal file
View File

@ -1,380 +1,380 @@
<?php <?php
/** 广场页面 */ /** 广场页面 */
require_once __DIR__ . '/header.php'; require_once __DIR__ . '/header.php';
/** 顶部广告 */ /** 顶部广告 */
if ($config['ad_top']) echo $config['ad_top_info']; if ($config['ad_top']) echo $config['ad_top_info'];
?> ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<?php <?php
if (!$config['showSwitch'] && !is_who_login('admin')) : ?> if (!$config['showSwitch'] && !is_who_login('admin')) : ?>
<div class="alert alert-info">管理员关闭了预览哦~~</div> <div class="alert alert-info">管理员关闭了预览哦~~</div>
<?php exit(require_once __DIR__ . '/footer.php'); ?> <?php exit(require_once __DIR__ . '/footer.php'); ?>
<?php else : <?php else :
// $path = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/'); // 获取指定目录 // $path = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/'); // 获取指定目录
/* 限制GET浏览日期 有助于防止爬虫*/ /* 限制GET浏览日期 有助于防止爬虫*/
$listDate = $config['listDate']; // 配置限制日期 $listDate = $config['listDate']; // 配置限制日期
$path = date('Y/m/d/'); // 当前日期 $path = date('Y/m/d/'); // 当前日期
if (isset($_GET['date'])) { if (isset($_GET['date'])) {
if ($_GET['date'] < date('Y/m/d/', strtotime("- $listDate day"))) { // GET日期小于配置日期时返回当前日期 if ($_GET['date'] < date('Y/m/d/', strtotime("- $listDate day"))) { // GET日期小于配置日期时返回当前日期
$path = date('Y/m/d/'); $path = date('Y/m/d/');
echo ' echo '
<script> <script>
new $.zui.Messager("已超出浏览页数, 返回今日上传列表", { new $.zui.Messager("已超出浏览页数, 返回今日上传列表", {
type: "info", // 定义颜色主题 type: "info", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show(); }).show();
</script>'; </script>';
} else { } else {
$path = $_GET['date']; // 如果不小于则返回当前GET日期 $path = $_GET['date']; // 如果不小于则返回当前GET日期
} }
} }
$path = preg_replace("/^d{4}-d{2}-d{2} d{2}:d{2}:d{2}$/s", "", trim($path)); // 过滤非日期,删除空格 $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']; // 获取指定浏览数量 $keyNum = isset($_GET['num']) ? $_GET['num'] : $config['listNumber']; // 获取指定浏览数量
$keyNum = preg_replace("/[\W]/", "", trim($keyNum)); // 过滤非数字,删除空格 $keyNum = preg_replace("/[\W]/", "", trim($keyNum)); // 过滤非数字,删除空格
// $fileArr = getFile(APP_ROOT . config_path($path)); // 获取当日上传列表 // $fileArr = getFile(APP_ROOT . config_path($path)); // 获取当日上传列表
$fileType = isset($_GET['search']) ? '*.' . preg_replace("/[\W]/", "", $_GET['search']) : '*.*'; // 按照图片格式 $fileType = isset($_GET['search']) ? '*.' . preg_replace("/[\W]/", "", $_GET['search']) : '*.*'; // 按照图片格式
$fileArr = get_file_by_glob(APP_ROOT . config_path($path) . $fileType, 'list'); // 获取当日上传列表 $fileArr = get_file_by_glob(APP_ROOT . config_path($path) . $fileType, 'list'); // 获取当日上传列表
$allUploud = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/'); $allUploud = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/');
$allUploud = get_file_by_glob(APP_ROOT . $config['path'] . $allUploud, 'number'); // 当前日期全部上传 $allUploud = get_file_by_glob(APP_ROOT . $config['path'] . $allUploud, 'number'); // 当前日期全部上传
$httpUrl = array('date' => $path, 'num' => getFileNumber(APP_ROOT . config_path($path))); // 组合url $httpUrl = array('date' => $path, 'num' => getFileNumber(APP_ROOT . config_path($path))); // 组合url
// 隐藏path目录获取图片复制与原图地址 // 隐藏path目录获取图片复制与原图地址
if ($config['hide_path']) { if ($config['hide_path']) {
$config_path = str_replace($config['path'], '/', config_path($path)); $config_path = str_replace($config['path'], '/', config_path($path));
} else { } else {
$config_path = config_path($path); $config_path = config_path($path);
} }
if (empty($fileArr[0])) : ?> if (empty($fileArr[0])) : ?>
<div class="alert alert-danger">今天还没有上传的图片哟~~ <br />快来上传第一张吧~!</div> <div class="alert alert-danger">今天还没有上传的图片哟~~ <br />快来上传第一张吧~!</div>
<?php else : ?> <?php else : ?>
<ul id="viewjs"> <ul id="viewjs">
<div class="cards listNum"> <div class="cards listNum">
<?php foreach ($fileArr as $key => $value) { <?php foreach ($fileArr as $key => $value) {
if ($key < $keyNum) { if ($key < $keyNum) {
$relative_path = config_path($path) . $value; // 相对路径 $relative_path = config_path($path) . $value; // 相对路径
$imgUrl = $config['domain'] . $relative_path; // 图片地址 $imgUrl = $config['domain'] . $relative_path; // 图片地址
$linkUrl = rand_imgurl() . $config_path . $value; // 图片复制与原图地址 $linkUrl = rand_imgurl() . $config_path . $value; // 图片复制与原图地址
?> ?>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12"> <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="card"> <div class="card">
<li><img src="<?php static_cdn(); ?>/public/images/loading.svg" data-image="<?php echo creat_thumbnail_by_list($imgUrl); ?>" data-original="<?php echo $imgUrl; ?>" alt="简单图床-EasyImage"></li> <li><img src="<?php static_cdn(); ?>/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"> <div class="bottom-bar">
<a href="<?php echo $linkUrl; ?>" target="_blank"><i class="icon icon-picture" data-toggle="tooltip" title="打开" style="margin-left:10px;"></i></a> <a href="<?php echo $linkUrl; ?>" 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 $linkUrl; ?>" data-toggle="tooltip" title="复制链接" style="margin-left:10px;"><i class="icon icon-copy"></i></a> <a href="#" class="copy" data-clipboard-text="<?php echo $linkUrl; ?>" data-toggle="tooltip" title="复制链接" style="margin-left:10px;"><i class="icon icon-copy"></i></a>
<?php if ($config['show_exif_info'] || is_who_login('admin')) : ?> <?php if ($config['show_exif_info'] || is_who_login('admin')) : ?>
<a href="/application/info.php?img=<?php echo $relative_path; ?>" data-toggle="tooltip" title="详细信息" target="_blank" style="margin-left:10px;"><i class="icon icon-info-sign"></i></a> <a href="/app/info.php?img=<?php echo $relative_path; ?>" data-toggle="tooltip" title="详细信息" target="_blank" style="margin-left:10px;"><i class="icon icon-info-sign"></i></a>
<?php endif; ?> <?php endif; ?>
<a href="/application/down.php?dw=<?php echo $relative_path; ?>" data-toggle="tooltip" title="下载文件" target="_blank" style="margin-left:10px;"><i class="icon icon-cloud-download"></i></a> <a href="/app/down.php?dw=<?php echo $relative_path; ?>" data-toggle="tooltip" title="下载文件" target="_blank" style="margin-left:10px;"><i class="icon icon-cloud-download"></i></a>
<?php if (!empty($config['report'])) : ?> <?php if (!empty($config['report'])) : ?>
<a href="<?php echo $config['report'] . '?Website1=' . $linkUrl; ?>" target="_blank"><i class="icon icon-question-sign" data-toggle="tooltip" title="举报文件" style="margin-left:10px;"></i></a> <a href="<?php echo $config['report'] . '?Website1=' . $linkUrl; ?>" target="_blank"><i class="icon icon-question-sign" data-toggle="tooltip" title="举报文件" style="margin-left:10px;"></i></a>
<?php endif; ?> <?php endif; ?>
<?php if (is_who_login('admin')) : ?> <?php if (is_who_login('admin')) : ?>
<a href="/application/del.php?recycle_url=<?php echo $relative_path; ?>" target="_blank" data-toggle="tooltip" title="回收文件" style="margin-left:10px;"><i class="icon icon-undo"></i></a> <a href="/app/del.php?recycle_url=<?php echo $relative_path; ?>" target="_blank" data-toggle="tooltip" title="回收文件" style="margin-left:10px;"><i class="icon icon-undo"></i></a>
<a href="/application/del.php?url=<?php echo $relative_path; ?>" target="_blank" data-toggle="tooltip" title="删除文件" style="margin-left:10px;"><i class="icon icon-trash"></i></a> <a href="/app/del.php?url=<?php echo $relative_path; ?>" target="_blank" data-toggle="tooltip" title="删除文件" style="margin-left:10px;"><i class="icon icon-trash"></i></a>
<label class="text-primary"><input type="checkbox" id="url" name="checkbox" value="<?php echo $relative_path; ?>"> 选择</label> <label class="text-primary"><input type="checkbox" id="url" name="checkbox" value="<?php echo $relative_path; ?>"> 选择</label>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
} }
} }
?> ?>
</div> </div>
</ul> </ul>
<?php <?php
endif; endif;
endif; endif;
/** 底部广告 */ /** 底部广告 */
if ($config['ad_bot']) echo $config['ad_bot_info']; ?> if ($config['ad_bot']) echo $config['ad_bot_info']; ?>
</div> </div>
<div class="col-md-12" style="margin-bottom: 5em;"> <div class="col-md-12" style="margin-bottom: 5em;">
<hr /> <hr />
<div class="col-md-8 col-xs-12" style="padding-bottom:5px"> <div class="col-md-8 col-xs-12" style="padding-bottom:5px">
<div class="btn-toolbar"> <div class="btn-toolbar">
<div class="btn-group"> <div class="btn-group">
<a class="btn btn-danger btn-mini" href="?<?php echo http_build_query($httpUrl); ?>">当前<?php echo $allUploud; ?></a> <a class="btn btn-danger btn-mini" href="?<?php echo http_build_query($httpUrl); ?>">当前<?php echo $allUploud; ?></a>
<a class="btn btn-primary btn-mini" href="list.php">今日<?php echo get_file_by_glob(APP_ROOT . config_path() . '*.*', 'number'); ?></a> <a class="btn btn-primary btn-mini" href="list.php">今日<?php echo get_file_by_glob(APP_ROOT . config_path() . '*.*', 'number'); ?></a>
<a class="btn btn-mini" href="?date=<?php echo date("Y/m/d/", strtotime("-1 day")) ?>">昨日<?php echo get_file_by_glob(APP_ROOT . $config['path'] . date("Y/m/d/", strtotime("-1 day")), 'number'); ?></a> <a class="btn btn-mini" href="?date=<?php echo date("Y/m/d/", strtotime("-1 day")) ?>">昨日<?php echo get_file_by_glob(APP_ROOT . $config['path'] . date("Y/m/d/", strtotime("-1 day")), 'number'); ?></a>
<?php <?php
// 倒推日期显示上传图片 @param $listDate 配置的倒退日期 // 倒推日期显示上传图片 @param $listDate 配置的倒退日期
for ($x = 2; $x <= $listDate; $x++) for ($x = 2; $x <= $listDate; $x++)
echo '<a class="btn btn-mini hidden-xs inline-block" href="?date=' . date('Y/m/d/', strtotime("-$x day")) . '">' . date('j号', strtotime("-$x day")) . '</a>'; echo '<a class="btn btn-mini hidden-xs inline-block" href="?date=' . date('Y/m/d/', strtotime("-$x day")) . '">' . date('j号', strtotime("-$x day")) . '</a>';
?> ?>
</div> </div>
<?php if (is_who_login('admin')) : ?> <?php if (is_who_login('admin')) : ?>
<div class="btn-group"> <div class="btn-group">
<a class="btn btn-mini" onclick="opcheckboxed('checkbox', 'checkall')">全选</a> <a class="btn btn-mini" onclick="opcheckboxed('checkbox', 'checkall')">全选</a>
<a class="btn btn-mini" onclick="opcheckboxed('checkbox', 'reversecheck')">反选</a> <a class="btn btn-mini" onclick="opcheckboxed('checkbox', 'reversecheck')">反选</a>
<a class="btn btn-mini" onclick="opcheckboxed('checkbox', 'uncheckall')">取消</a> <a class="btn btn-mini" onclick="opcheckboxed('checkbox', 'uncheckall')">取消</a>
<a class="btn btn-mini" onclick="recycle_img()">回收</a> <a class="btn btn-mini" onclick="recycle_img()">回收</a>
<a class="btn btn-mini" onclick="delete_img()">删除</a> <a class="btn btn-mini" onclick="delete_img()">删除</a>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
<!-- 按格式 --> <!-- 按格式 -->
<!-- <div class="row"> <!-- <div class="row">
<div class="col-md-2 col-xs-6"> <div class="col-md-2 col-xs-6">
<form action="<php echo '?' . http_build_query($httpUrl) . '&'; ?>" method="get"> <form action="<php echo '?' . http_build_query($httpUrl) . '&'; ?>" method="get">
<div class="input-group"> <div class="input-group">
<select name="search" class="form-control input-sm"> <select name="search" class="form-control input-sm">
<option value="jpg">JPG</option> <option value="jpg">JPG</option>
<option value="png">PNG</option> <option value="png">PNG</option>
<option value="gif">Gif</option> <option value="gif">Gif</option>
<option value="webp">WEBP</option> <option value="webp">WEBP</option>
</select> </select>
<span class="input-group-btn"> <span class="input-group-btn">
<input type="submit" value="按格式" class="btn btn-primary input-sm" /> <input type="submit" value="按格式" class="btn btn-primary input-sm" />
</span> </span>
</div> </div>
</form> </form>
</div> --> </div> -->
<div class="col-md-2 col-xs-7"> <div class="col-md-2 col-xs-7">
<div class="btn-group"> <div class="btn-group">
<a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=jpg'; ?>">JPG</a> <a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=jpg'; ?>">JPG</a>
<a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=png'; ?>">PNG</a> <a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=png'; ?>">PNG</a>
<a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=gif'; ?>">GIF</a> <a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=gif'; ?>">GIF</a>
<a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=webp'; ?>">Webp</a> <a class="btn btn-mini" href="<?php echo '?' . http_build_query($httpUrl) . '&search=webp'; ?>">Webp</a>
</div> </div>
</div> </div>
<!-- 按日期--> <!-- 按日期-->
<div class="col-md-2 col-xs-5"> <div class="col-md-2 col-xs-5">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="get"> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="get">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon fix-border fix-padding"></span> <span class="input-group-addon fix-border fix-padding"></span>
<input type="text" class="form-control form-date input-sm" name="date" value="<?php echo date('Y/m/d/'); ?>" readonly="readonly"> <input type="text" class="form-control form-date input-sm" name="date" value="<?php echo date('Y/m/d/'); ?>" readonly="readonly">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" class="btn btn-primary input-sm">按日期</button> <button type="submit" class="btn btn-primary input-sm">按日期</button>
</span> </span>
</div> </div>
</form> </form>
<!-- 返回顶部--> <!-- 返回顶部-->
<div class="btn btn-mini btn-primary btn-back-to-top"><i class="icon icon-arrow-up"></i></div> <div class="btn btn-mini btn-primary btn-back-to-top"><i class="icon icon-arrow-up"></i></div>
</div> </div>
</div> </div>
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/EasyImage.css"> <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/viewjs/viewer.min.css">
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.css"> <link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.css">
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/zui/lib/bootbox/bootbox.min.css"> <link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/zui/lib/bootbox/bootbox.min.css">
<style> <style>
/* 返回顶部 */ /* 返回顶部 */
.btn-back-to-top { .btn-back-to-top {
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
position: fixed; position: fixed;
right: 2rem; right: 2rem;
bottom: 1rem; bottom: 1rem;
z-index: 2; z-index: 2;
-webkit-transition: -webkit-transform 0.2s ease; -webkit-transition: -webkit-transform 0.2s ease;
transition: transform 0.2s ease; transition: transform 0.2s ease;
-webkit-transform: translateY(200%); -webkit-transform: translateY(200%);
transform: translateY(200%); transform: translateY(200%);
} }
.btn-back-to-top.scrolled { .btn-back-to-top.scrolled {
-webkit-transform: translateY(0); -webkit-transform: translateY(0);
transform: translateY(0); transform: translateY(0);
} }
</style> </style>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/bootbox/bootbox.min.js"></script> <script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/bootbox/bootbox.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/lazyload/lazyload.min.js"></script> <script type="application/javascript" src="<?php static_cdn(); ?>/public/static/lazyload/lazyload.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/viewjs/viewer.min.js"></script> <script type="application/javascript" src="<?php static_cdn(); ?>/public/static/viewjs/viewer.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js"></script> <script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script> <script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<script> <script>
// viewjs // viewjs
new Viewer(document.getElementById('viewjs'), { new Viewer(document.getElementById('viewjs'), {
url: 'data-original', url: 'data-original',
}); });
// 复制url // 复制url
var clipboard = new Clipboard('.copy'); var clipboard = new Clipboard('.copy');
clipboard.on('success', function(e) { clipboard.on('success', function(e) {
new $.zui.Messager("复制直链成功", { new $.zui.Messager("复制直链成功", {
type: "success", // 定义颜色主题 type: "success", // 定义颜色主题
icon: "ok-sign" // 定义消息图标 icon: "ok-sign" // 定义消息图标
}).show(); }).show();
}); });
clipboard.on('error', function(e) { clipboard.on('error', function(e) {
document.querySelector('.copy'); document.querySelector('.copy');
new $.zui.Messager("复制失败", { new $.zui.Messager("复制失败", {
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show(); }).show();
}); });
// 取消/全选文件 // 取消/全选文件
function opcheckboxed(objName, type) { function opcheckboxed(objName, type) {
var objNameList = document.getElementsByName(objName); var objNameList = document.getElementsByName(objName);
if (null != objNameList) { if (null != objNameList) {
for (var i = 0; i < objNameList.length; i++) { for (var i = 0; i < objNameList.length; i++) {
if (objNameList[i].checked == true) { if (objNameList[i].checked == true) {
if (type != 'checkall') { // 非全选 if (type != 'checkall') { // 非全选
objNameList[i].checked = false; objNameList[i].checked = false;
} }
} else { } else {
if (type != 'uncheckall') { // 非取消全选 if (type != 'uncheckall') { // 非取消全选
objNameList[i].checked = true; objNameList[i].checked = true;
} }
} }
} }
} }
} }
// 回收图片 // 回收图片
function recycle_img() { function recycle_img() {
bootbox.confirm({ bootbox.confirm({
message: "确认要放入回收站? <br /> 可在可疑图片中恢复!", message: "确认要放入回收站? <br /> 可在可疑图片中恢复!",
buttons: { buttons: {
confirm: { confirm: {
label: '确定', label: '确定',
className: 'btn-success' className: 'btn-success'
}, },
cancel: { cancel: {
label: '取消', label: '取消',
className: 'btn-danger' className: 'btn-danger'
} }
}, },
callback: function(result) { callback: function(result) {
if (result == true) { if (result == true) {
obj = document.getElementsByName("checkbox"); obj = document.getElementsByName("checkbox");
check_val = []; check_val = [];
for (k in obj) { for (k in obj) {
//判断复选框是否被选中 //判断复选框是否被选中
if (obj[k].checked) if (obj[k].checked)
//获取被选中的复选框的值 //获取被选中的复选框的值
check_val.push(obj[k].value); check_val.push(obj[k].value);
console.log(check_val); console.log(check_val);
} }
$.post("./post_del.php", { $.post("./post_del.php", {
'recycle_url_array': check_val 'recycle_url_array': check_val
}, ); }, );
new $.zui.Messager("放入回收站成功", { new $.zui.Messager("放入回收站成功", {
type: "success", // 定义颜色主题 type: "success", // 定义颜色主题
icon: "ok-sign" // 定义消息图标 icon: "ok-sign" // 定义消息图标
}).show(); }).show();
// 延时2秒刷新 // 延时2秒刷新
window.setTimeout(function() { window.setTimeout(function() {
window.location.reload(); window.location.reload();
}, 1500) }, 1500)
} else { } else {
new $.zui.Messager("取消回收", { new $.zui.Messager("取消回收", {
type: "primary", // 定义颜色主题 type: "primary", // 定义颜色主题
icon: "info-sign" // 定义消息图标 icon: "info-sign" // 定义消息图标
}).show(); }).show();
} }
console.log('是否回收图片: ' + result); console.log('是否回收图片: ' + result);
} }
}); });
} }
// 删除图片 // 删除图片
function delete_img() { function delete_img() {
bootbox.confirm({ bootbox.confirm({
message: "确认要删除?<br />* 删除文件夹后将无法恢复!", message: "确认要删除?<br />* 删除文件夹后将无法恢复!",
buttons: { buttons: {
confirm: { confirm: {
label: '确定', label: '确定',
className: 'btn-success' className: 'btn-success'
}, },
cancel: { cancel: {
label: '取消', label: '取消',
className: 'btn-danger' className: 'btn-danger'
} }
}, },
callback: function(result) { callback: function(result) {
if (result == true) { if (result == true) {
obj = document.getElementsByName("checkbox"); obj = document.getElementsByName("checkbox");
check_val = []; check_val = [];
for (k in obj) { for (k in obj) {
//判断复选框是否被选中 //判断复选框是否被选中
if (obj[k].checked) if (obj[k].checked)
//获取被选中的复选框的值 //获取被选中的复选框的值
check_val.push(obj[k].value); check_val.push(obj[k].value);
console.log(check_val); console.log(check_val);
} }
$.post("./post_del.php", { $.post("./post_del.php", {
'del_url_array': check_val 'del_url_array': check_val
}, },
function(data) { function(data) {
if (data.search('success') > 0) { if (data.search('success') > 0) {
new $.zui.Messager("删除成功", { new $.zui.Messager("删除成功", {
type: "success", // 定义颜色主题 type: "success", // 定义颜色主题
icon: "ok-sign" // 定义消息图标 icon: "ok-sign" // 定义消息图标
}).show(); }).show();
// 延时2秒刷新 // 延时2秒刷新
window.setTimeout(function() { window.setTimeout(function() {
window.location.reload(); window.location.reload();
}, 1500) }, 1500)
} else { } else {
new $.zui.Messager("删除失败 请登录后再删除!", { new $.zui.Messager("删除失败 请登录后再删除!", {
type: "danger", // 定义颜色主题 type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标 icon: "exclamation-sign" // 定义消息图标
}).show(); }).show();
// 延时2s跳转 // 延时2s跳转
window.setTimeout("window.location=\'/../admin/index.php \'", 2000); window.setTimeout("window.location=\'/../admin/index.php \'", 2000);
} }
}); });
} else { } else {
new $.zui.Messager("取消删除", { new $.zui.Messager("取消删除", {
type: "primary", // 定义颜色主题 type: "primary", // 定义颜色主题
icon: "info-sign" // 定义消息图标 icon: "info-sign" // 定义消息图标
}).show(); }).show();
} }
console.log('是否删除图片: ' + result); console.log('是否删除图片: ' + result);
} }
}); });
} }
// 返回顶部 // 返回顶部
var back_to_top_button = jQuery('.btn-back-to-top'); var back_to_top_button = jQuery('.btn-back-to-top');
jQuery(window).scroll(function() { jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > 100 && !back_to_top_button.hasClass('scrolled')) { if (jQuery(this).scrollTop() > 100 && !back_to_top_button.hasClass('scrolled')) {
back_to_top_button.addClass('scrolled'); back_to_top_button.addClass('scrolled');
} else if (jQuery(this).scrollTop() < 100 && back_to_top_button.hasClass('scrolled')) { } else if (jQuery(this).scrollTop() < 100 && back_to_top_button.hasClass('scrolled')) {
back_to_top_button.removeClass('scrolled'); back_to_top_button.removeClass('scrolled');
} }
}); });
// 返回顶部 // 返回顶部
back_to_top_button.click(function() { back_to_top_button.click(function() {
jQuery('html, body').animate({ jQuery('html, body').animate({
scrollTop: 0 scrollTop: 0
}, 800); }, 800);
return false; return false;
}); });
//懒加载 //懒加载
var lazy = new Lazy({ var lazy = new Lazy({
onload: function(elem) { onload: function(elem) {
console.log(elem) console.log(elem)
}, },
delay: 300, delay: 300,
}) })
// 按日期浏览 // 按日期浏览
$(".form-date").datetimepicker({ $(".form-date").datetimepicker({
weekStart: 1, weekStart: 1,
todayBtn: 1, todayBtn: 1,
autoclose: 1, autoclose: 1,
todayHighlight: 1, todayHighlight: 1,
startView: 2, startView: 2,
minView: 2, minView: 2,
forceParse: 0, forceParse: 0,
pickerPosition: "top-right", pickerPosition: "top-right",
format: "yyyy/mm/dd/", format: "yyyy/mm/dd/",
endDate: new Date() // 只能选当前日期之前 endDate: new Date() // 只能选当前日期之前
}); });
// 更改网页标题 // 更改网页标题
document.title = "图床广场 - 今日上传<?php echo get_file_by_glob(APP_ROOT . config_path(), 'number'); ?>张 昨日<?php echo get_file_by_glob(APP_ROOT . $config['path'] . date("Y/m/d/", strtotime("-1 day")) . '*.*', 'number'); ?>张 - <?php echo $config['title']; ?>" document.title = "图床广场 - 今日上传<?php echo get_file_by_glob(APP_ROOT . config_path(), 'number'); ?>张 昨日<?php echo get_file_by_glob(APP_ROOT . $config['path'] . date("Y/m/d/", strtotime("-1 day")) . '*.*', 'number'); ?>张 - <?php echo $config['title']; ?>"
</script> </script>
<?php <?php
/** 引入底部 */ /** 引入底部 */
require_once APP_ROOT . '/application/footer.php'; require_once __DIR__ . '/footer.php';

64
application/post_del.php → app/post_del.php Executable file → Normal file
View File

@ -1,32 +1,32 @@
<?php <?php
/** /**
* 删除/回收文件页面 * 删除/回收文件页面
* @author Icret * @author Icret
* 2022-2-23 11:01:52 * 2022-2-23 11:01:52
*/ */
require_once __DIR__ . '/function.php'; require_once __DIR__ . '/function.php';
if (!is_who_login('admin')) { if (!is_who_login('admin')) {
exit('Not Logged!'); exit('Not Logged!');
} }
// 删除文件 // 删除文件
if (isset($_POST['del_url_array'])) { if (isset($_POST['del_url_array'])) {
$del_url_array = $_POST['del_url_array']; $del_url_array = $_POST['del_url_array'];
$del_num = count($del_url_array); $del_num = count($del_url_array);
for ($i = 0; $i < $del_num; $i++) { for ($i = 0; $i < $del_num; $i++) {
getDel($del_url_array[$i], 'url'); getDel($del_url_array[$i], 'url');
// FTP // FTP
// any_upload($del_url_array[$i], null, 'delete'); // any_upload($del_url_array[$i], null, 'delete');
} }
} }
// 回收文件 // 回收文件
if (isset($_POST['recycle_url_array'])) { if (isset($_POST['recycle_url_array'])) {
$recycle_url_array = $_POST['recycle_url_array']; $recycle_url_array = $_POST['recycle_url_array'];
$del_num = count($recycle_url_array); $del_num = count($recycle_url_array);
for ($i = 0; $i < $del_num; $i++) { for ($i = 0; $i < $del_num; $i++) {
checkImg($recycle_url_array[$i], 3); checkImg($recycle_url_array[$i], 3);
} }
} }

View File

@ -10,7 +10,7 @@ if (isset($_POST['md5'])) {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<p class="text-primary">忘记账号可以打开<code>/config/config.php</code>文件找到<code data-toggle="tooltip" title="'user'=><strong>admin</strong>'">user</code>对应的键值->填入</p> <p class="text-primary">忘记账号可以打开<code>/config/config.php</code>文件找到<code data-toggle="tooltip" title="'user'=><strong>admin</strong>'">user</code>对应的键值->填入</p>
<p class="text-success">忘记密码请将密码转换成SHA256(<a href="<?php echo $config['domain'] . '/application/reset_password.php'; ?>" target="_blank" class="text-purple">转换网址</a>)->打开<code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'password'=>'<strong>e6e0612609</strong>'">password</code>对应的键值->填入</p> <p class="text-success">忘记密码请将密码转换成SHA256(<a href="<?php echo $config['domain'] . '/app/reset_password.php'; ?>" target="_blank" class="text-purple">转换网址</a>)->打开<code>/config/config.php</code>文件->找到<code data-toggle="tooltip" title="'password'=>'<strong>e6e0612609</strong>'">password</code>对应的键值->填入</p>
<h4 class="text-danger">更改后会立即生效并重新登录,请务必牢记账号和密码! </h4> <h4 class="text-danger">更改后会立即生效并重新登录,请务必牢记账号和密码! </h4>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">

266
application/thumb.php → app/thumb.php Executable file → Normal file
View File

@ -1,133 +1,133 @@
<?php <?php
/* /*
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 把大图缩略到缩略图指定的范围内,不留白(原图会剪切掉不符合比例的右边和下边) // | 把大图缩略到缩略图指定的范围内,不留白(原图会剪切掉不符合比例的右边和下边)
// | https://www.php.cn/php-ask-458473.html // | https://www.php.cn/php-ask-458473.html
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
require_once __DIR__ . '/function.php'; require_once __DIR__ . '/function.php';
require_once __DIR__ . '/class.thumb.php'; require_once __DIR__ . '/class.thumb.php';
$src = isset($_GET['img']) ? APP_ROOT . $_GET['img'] : APP_ROOT . '/public/images/404.png'; // 原图路径 $src = isset($_GET['img']) ? APP_ROOT . $_GET['img'] : APP_ROOT . '/public/images/404.png'; // 原图路径
if (!file_exists($src)) { if (!file_exists($src)) {
exit('image does not exist'); exit('image does not exist');
} }
$w = isset($_GET['width']) ? $_GET['width'] : 258; // 预生成缩略图的宽 $w = isset($_GET['width']) ? $_GET['width'] : 258; // 预生成缩略图的宽
$h = isset($_GET['height']) ? $_GET['height'] : 258; // 预生成缩略图的高 $h = isset($_GET['height']) ? $_GET['height'] : 258; // 预生成缩略图的高
Thumb::show($src, $w, $h); Thumb::show($src, $w, $h);
*/ */
/** /**
* 使用新的TimThumb.php生成缩略图 * 使用新的TimThumb.php生成缩略图
* TimThumb.php EasyImage修改版 by Icret * TimThumb.php EasyImage修改版 by Icret
* form https://github.com/podipod/TimThumb * form https://github.com/podipod/TimThumb
* 2022-1-30 06:35:08 * 2022-1-30 06:35:08
* *
* TimThumb参数指南 * TimThumb参数指南
* 命令 作用 参数 描述 * 命令 作用 参数 描述
* src 图像URL 告诉TimThumb调整哪个图片 * src 图像URL 告诉TimThumb调整哪个图片
* w 宽度 宽度调整 调整输出图像的宽度 * w 宽度 宽度调整 调整输出图像的宽度
* h 高度 高度调整 调整输出图像的高度 * h 高度 高度调整 调整输出图像的高度
* q 质量 0 - 100 压缩质量值越大质量越高。不建议高于95 * q 质量 0 - 100 压缩质量值越大质量越高。不建议高于95
* a 对齐 c, t, l, r, b, tl, tr, bl, br 图像对齐。 c = center, t = top, b = bottom, r = right, l = left。 可以创建对角位置 * a 对齐 c, t, l, r, b, tl, tr, bl, br 图像对齐。 c = center, t = top, b = bottom, r = right, l = left。 可以创建对角位置
* zc 缩放/裁剪 0、1、2、3 0:根据传入的值进行缩放(不裁剪), 1:以最合适的比例裁剪和调整大小(裁剪), 2按比例调整大小并添加边框裁剪3按比例调整大小不添加边框裁剪 * zc 缩放/裁剪 0、1、2、3 0:根据传入的值进行缩放(不裁剪), 1:以最合适的比例裁剪和调整大小(裁剪), 2按比例调整大小并添加边框裁剪3按比例调整大小不添加边框裁剪
* f 过滤器 太多了 可以改变亮度/对比度;甚至模糊图像 * f 过滤器 太多了 可以改变亮度/对比度;甚至模糊图像
* s 锐化 锐化 使得按比例缩小图片看起来有点;更清晰 * s 锐化 锐化 使得按比例缩小图片看起来有点;更清晰
* cc 画布上的颜色 十六进制的颜色值(# ffffff) 改变背景颜色。 大多数更改缩放和作物设置时使用,进而可以添加图像边界。 * cc 画布上的颜色 十六进制的颜色值(# ffffff) 改变背景颜色。 大多数更改缩放和作物设置时使用,进而可以添加图像边界。
* ct 画布的透明度 true (1) 使用透明而忽略背景颜色 * ct 画布的透明度 true (1) 使用透明而忽略背景颜色
*/ */
require_once __DIR__ . '/function.php'; require_once __DIR__ . '/function.php';
// 缓存时间 // 缓存时间
$cache_freq = $config['cache_freq'] * 60 * 60; $cache_freq = $config['cache_freq'] * 60 * 60;
// 中文翻译 https://my.oschina.net/whrlmc/blog/81739 // 中文翻译 https://my.oschina.net/whrlmc/blog/81739
define('LOCAL_FILE_BASE_DIRECTORY', APP_ROOT); define('LOCAL_FILE_BASE_DIRECTORY', APP_ROOT);
define('MEMORY_LIMIT', '256M'); define('MEMORY_LIMIT', '256M');
define('DEFAULT_WIDTH', $config['thumbnail_w']); define('DEFAULT_WIDTH', $config['thumbnail_w']);
define('DEFAULT_HEIGHT', $config['thumbnail_h']); define('DEFAULT_HEIGHT', $config['thumbnail_h']);
define('FILE_CACHE_PREFIX', 'EasyImage'); define('FILE_CACHE_PREFIX', 'EasyImage');
define('DEFAULT_ZC', 0); define('DEFAULT_ZC', 0);
define('MAX_WIDTH', 10240); define('MAX_WIDTH', 10240);
define('MAX_HEIGHT', 10240); define('MAX_HEIGHT', 10240);
define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'cache/'); define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'cache/');
define('NOT_FOUND_IMAGE', $config['domain'] . '/public/images/404.png'); define('NOT_FOUND_IMAGE', $config['domain'] . '/public/images/404.png');
define('ERROR_IMAGE', $config['domain'] . '/public/images/404.png'); define('ERROR_IMAGE', $config['domain'] . '/public/images/404.png');
define('DISPLAY_ERROR_MESSAGES', false); define('DISPLAY_ERROR_MESSAGES', false);
define('MAX_FILE_SIZE', $config['maxSize']); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。 define('MAX_FILE_SIZE', $config['maxSize']); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。
define('FILE_CACHE_TIME_BETWEEN_CLEANS', $cache_freq); // 多久清理一次缓存 define('FILE_CACHE_TIME_BETWEEN_CLEANS', $cache_freq); // 多久清理一次缓存
define('FILE_CACHE_MAX_FILE_AGE', $cache_freq); // 文件必须从缓存中删除多长时间 define('FILE_CACHE_MAX_FILE_AGE', $cache_freq); // 文件必须从缓存中删除多长时间
define('BROWSER_CACHE_MAX_AGE', $cache_freq); // 浏览器缓存时间 define('BROWSER_CACHE_MAX_AGE', $cache_freq); // 浏览器缓存时间
global $ALLOWED_SITES; global $ALLOWED_SITES;
$ALLOWED_SITES = array( $ALLOWED_SITES = array(
$config['domain'], $config['domain'],
$config['imgurl'], $config['imgurl'],
); );
/** /**
* 修复无法生成生成webp动态图片的缩略图bug * 修复无法生成生成webp动态图片的缩略图bug
*/ */
if (isset($_GET['img'])) { if (isset($_GET['img'])) {
// 引入文件 // 引入文件
require_once __DIR__ . '/TimThumb.php'; require_once __DIR__ . '/TimThumb.php';
$src = $_GET['img']; $src = $_GET['img'];
// 重定向不包含存储路径的缩略图地址 // 重定向不包含存储路径的缩略图地址
if (!stristr($src, $config['path'])) { if (!stristr($src, $config['path'])) {
$src = $config['path'] . $src; $src = $config['path'] . $src;
header("Location:thumb.php?img=$src"); header("Location:thumb.php?img=$src");
exit(); exit();
} }
// 图片绝对路径 // 图片绝对路径
$src = APP_ROOT . $_GET['img']; $src = APP_ROOT . $_GET['img'];
// 获取文件后缀 // 获取文件后缀
$ext = pathinfo($src)['extension']; $ext = pathinfo($src)['extension'];
// 404 文件 // 404 文件
$i404 = APP_ROOT . '/public/images/404.png'; $i404 = APP_ROOT . '/public/images/404.png';
// 文件不存在 // 文件不存在
if (!is_file($src)) { if (!is_file($src)) {
// 输出404 // 输出404
header("Content-type: image/png"); header("Content-type: image/png");
exit(file_get_contents($i404, true)); exit(file_get_contents($i404, true));
} }
switch ($ext) { switch ($ext) {
case 'ico': case 'ico':
header("Content-type: image/jpeg"); header("Content-type: image/jpeg");
exit(file_get_contents($src, true)); exit(file_get_contents($src, true));
break; break;
case 'svg': case 'svg':
header('Content-Type:image/svg+xml'); header('Content-Type:image/svg+xml');
exit(file_get_contents($src, true)); exit(file_get_contents($src, true));
break; break;
case 'webp': case 'webp':
if (isWebpAnimated($src)) { if (isWebpAnimated($src)) {
// 输出动态的webp // 输出动态的webp
header("Content-type: image/webp"); header("Content-type: image/webp");
exit(file_get_contents($src, true)); exit(file_get_contents($src, true));
} else { } else {
timthumb::start(); timthumb::start();
} }
break; break;
default: default:
timthumb::start(); timthumb::start();
} }
} else { } else {
// 输出404 // 输出404
header("Content-type: image/png"); header("Content-type: image/png");
exit(file_get_contents($i404, true)); exit(file_get_contents($i404, true));
} }

188
application/total_files.php → app/total_files.php Executable file → Normal file
View File

@ -1,94 +1,94 @@
<?php <?php
/** /**
* 统计文件 * 统计文件
* *
* 递归函数实现遍历指定文件下的目录与文件数量 * 递归函数实现遍历指定文件下的目录与文件数量
* $dirname=指定目录,$dirnum=目录总数,$filen=文件总数 * $dirname=指定目录,$dirnum=目录总数,$filen=文件总数
*/ */
require_once __DIR__ . '/../config/config.php'; require_once __DIR__ . '/../config/config.php';
$dirn = 0; //目录数 $dirn = 0; //目录数
$filen = 0; //文件数 $filen = 0; //文件数
//用来统计一个目录下的文件和目录的个数 //用来统计一个目录下的文件和目录的个数
function total_files($file) function total_files($file)
{ {
global $dirn; global $dirn;
global $filen; global $filen;
$dir = opendir($file); $dir = opendir($file);
while ($filename = readdir($dir)) { while ($filename = readdir($dir)) {
if ($filename != "." && $filename != "..") { if ($filename != "." && $filename != "..") {
$filename = $file . "/" . $filename; $filename = $file . "/" . $filename;
if (is_dir($filename)) { if (is_dir($filename)) {
$dirn++; $dirn++;
total_files($filename); //递归,就可以查看所有子目录 total_files($filename); //递归,就可以查看所有子目录
} else { } else {
$filen++; $filen++;
} }
} }
} }
closedir($dir); closedir($dir);
} }
$total_file_path = APP_ROOT . $config['path']; // 获取用户自定义的上传目录 $total_file_path = APP_ROOT . $config['path']; // 获取用户自定义的上传目录
$totalJsonMD5 = strval(md5_file(APP_ROOT . '/config/config.php')); // 以config.php文件的md5命名 $totalJsonMD5 = strval(md5_file(APP_ROOT . '/config/config.php')); // 以config.php文件的md5命名
$totalJsonName = APP_ROOT . "/admin/logs/counts/total-files-$totalJsonMD5.php"; // 文件绝对目录 $totalJsonName = APP_ROOT . "/admin/logs/counts/total-files-$totalJsonMD5.php"; // 文件绝对目录
function creat_json() // 创建json文件 function creat_json() // 创建json文件
{ {
global $dirn; global $dirn;
global $filen; global $filen;
global $totalJsonName; global $totalJsonName;
global $config; global $config;
global $total_file_path; global $total_file_path;
global $totalJsonMD5; global $totalJsonMD5;
total_files($total_file_path); total_files($total_file_path);
$usage_space = getDistUsed(getDirectorySize(APP_ROOT . $config['path'])); $usage_space = getDistUsed(getDirectorySize(APP_ROOT . $config['path']));
$todayUpload = getFileNumber(APP_ROOT . config_path()); // 今日上传数量 $todayUpload = getFileNumber(APP_ROOT . config_path()); // 今日上传数量
$yestUpload = getFileNumber(APP_ROOT . $config['path'] . date("Y/m/d/", strtotime("-1 day"))); // 昨日上传数量 $yestUpload = getFileNumber(APP_ROOT . $config['path'] . date("Y/m/d/", strtotime("-1 day"))); // 昨日上传数量
$totalJsonInfo = [ $totalJsonInfo = [
'filename' => $totalJsonMD5, // 统计文件名称 'filename' => $totalJsonMD5, // 统计文件名称
'date' => date('YmdH'), // 识别日期格式 'date' => date('YmdH'), // 识别日期格式
'total_time' => date('Y-m-d H:i:s'), // 统计时间 'total_time' => date('Y-m-d H:i:s'), // 统计时间
'dirnum' => $dirn, // 文件夹数量 'dirnum' => $dirn, // 文件夹数量
'filenum' => $filen, // 文件数量 'filenum' => $filen, // 文件数量
'usage_space' => $usage_space, // 占用空间 'usage_space' => $usage_space, // 占用空间
'todayUpload' => $todayUpload, // 今日上传数量 'todayUpload' => $todayUpload, // 今日上传数量
'yestUpload' => $yestUpload // 昨日上传数量 'yestUpload' => $yestUpload // 昨日上传数量
]; ];
$totalJsonInfo = json_encode($totalJsonInfo, true); $totalJsonInfo = json_encode($totalJsonInfo, true);
if (is_dir(APP_ROOT . '/admin/logs/counts/')) { if (is_dir(APP_ROOT . '/admin/logs/counts/')) {
file_put_contents($totalJsonName, $totalJsonInfo); file_put_contents($totalJsonName, $totalJsonInfo);
} else { } else {
mkdir(APP_ROOT . '/admin/logs/counts/', 0777, true); // 创建cache目录 mkdir(APP_ROOT . '/admin/logs/counts/', 0777, true); // 创建cache目录
file_put_contents($totalJsonName, $totalJsonInfo); file_put_contents($totalJsonName, $totalJsonInfo);
} }
} }
function read_total_json($total) // 读取json文件 function read_total_json($total) // 读取json文件
{ {
global $totalJsonFile; global $totalJsonFile;
global $totalJsonName; global $totalJsonName;
global $config; global $config;
$cache_freq = $config['cache_freq']; $cache_freq = $config['cache_freq'];
if (file_exists($totalJsonName)) { if (file_exists($totalJsonName)) {
$totalJsonFile = file_get_contents($totalJsonName); $totalJsonFile = file_get_contents($totalJsonName);
$totalJsonFile = json_decode($totalJsonFile, true); $totalJsonFile = json_decode($totalJsonFile, true);
} else { } else {
creat_json(); creat_json();
$totalJsonFile = file_get_contents($totalJsonName); $totalJsonFile = file_get_contents($totalJsonName);
$totalJsonFile = json_decode($totalJsonFile, true); $totalJsonFile = json_decode($totalJsonFile, true);
} }
if ((date('YmdH') - $totalJsonFile['date']) > $cache_freq) { if ((date('YmdH') - $totalJsonFile['date']) > $cache_freq) {
creat_json(); creat_json();
$totalJsonFile = file_get_contents($totalJsonName); $totalJsonFile = file_get_contents($totalJsonName);
$totalJsonFile = json_decode($totalJsonFile, true); $totalJsonFile = json_decode($totalJsonFile, true);
} }
return $totalJsonFile[$total]; return $totalJsonFile[$total];
} }

470
application/upload.php → app/upload.php Executable file → Normal file
View File

@ -1,235 +1,235 @@
<?php <?php
namespace Verot\Upload; namespace Verot\Upload;
require __DIR__ . '/function.php'; require __DIR__ . '/function.php';
require __DIR__ . '/class.upload.php'; require __DIR__ . '/class.upload.php';
// 检查登录 // 检查登录
if ($config['mustLogin']) { if ($config['mustLogin']) {
if (!is_who_login('status')) { if (!is_who_login('status')) {
exit(json_encode(array( exit(json_encode(array(
"result" => "failed", "result" => "failed",
"code" => 401, "code" => 401,
"message" => "本站已开启登陆上传,您尚未登陆", "message" => "本站已开启登陆上传,您尚未登陆",
))); )));
} }
} }
// 无文件 // 无文件
if (empty($_FILES['file'])) { if (empty($_FILES['file'])) {
exit(json_encode( exit(json_encode(
array( array(
"result" => "failed", "result" => "failed",
"code" => 204, "code" => 204,
"message" => "没有选择上传的文件", "message" => "没有选择上传的文件",
) )
)); ));
} }
// sign // sign
if (empty($_REQUEST['sign']) || $_REQUEST['sign'] !== date('YmdH')) { if (empty($_REQUEST['sign']) || $_REQUEST['sign'] !== date('YmdH')) {
exit(json_encode(array( exit(json_encode(array(
"result" => "failed", "result" => "failed",
"code" => 403, "code" => 403,
"message" => "签名错误,请刷新重试", "message" => "签名错误,请刷新重试",
))); )));
} }
// 黑/白IP名单上传 // 黑/白IP名单上传
if ($config['check_ip']) { if ($config['check_ip']) {
if (checkIP(null, $config['check_ip_list'], $config['check_ip_model'])) { if (checkIP(null, $config['check_ip_list'], $config['check_ip_model'])) {
// 上传错误 code:403 未授权IP // 上传错误 code:403 未授权IP
exit(json_encode(array( exit(json_encode(array(
"result" => "failed", "result" => "failed",
"code" => 403, "code" => 403,
"message" => "黑名单内或白名单外用户不允许上传", "message" => "黑名单内或白名单外用户不允许上传",
))); )));
} }
} }
// 根据IP限制游客每日上传数量 // 根据IP限制游客每日上传数量
if ($config['ip_upload_counts'] > 0 && !is_who_login('status')) { if ($config['ip_upload_counts'] > 0 && !is_who_login('status')) {
if (false == get_ip_upload_log_counts(real_ip())) { if (false == get_ip_upload_log_counts(real_ip())) {
exit(json_encode( exit(json_encode(
array( array(
"result" => "failed", "result" => "failed",
"code" => 403, "code" => 403,
"message" => sprintf("游客限制每日上传 %d 张", $config['ip_upload_counts']), "message" => sprintf("游客限制每日上传 %d 张", $config['ip_upload_counts']),
) )
)); ));
} }
} }
$handle = new Upload($_FILES['file'], 'zh_CN'); $handle = new Upload($_FILES['file'], 'zh_CN');
if ($handle->uploaded) { if ($handle->uploaded) {
// 允许上传的mime类型 // 允许上传的mime类型
if ($config['allowed'] === 1) { if ($config['allowed'] === 1) {
$handle->allowed = array('image/*'); $handle->allowed = array('image/*');
} }
// 检查svg是否存在script和a标签代码 // 检查svg是否存在script和a标签代码
if ($handle->file_src_name_ext === 'svg') { if ($handle->file_src_name_ext === 'svg') {
$svg = file_get_contents($handle->file_src_pathname); $svg = file_get_contents($handle->file_src_pathname);
if (preg_match('/<script[\s\S]*?<\/script>/', $svg) || stripos($svg, 'href=')) { if (preg_match('/<script[\s\S]*?<\/script>/', $svg) || stripos($svg, 'href=')) {
exit(json_encode( exit(json_encode(
array( array(
"result" => "failed", "result" => "failed",
"code" => 205, "code" => 205,
"message" => "请勿上传非法文件", "message" => "请勿上传非法文件",
) )
)); ));
} }
} }
// 文件命名 // 文件命名
$handle->file_new_name_body = imgName($handle->file_src_name_body); $handle->file_new_name_body = imgName($handle->file_src_name_body);
// 最大上传限制 // 最大上传限制
$handle->file_max_size = $config['maxSize']; $handle->file_max_size = $config['maxSize'];
// 最大宽度 // 最大宽度
$handle->image_max_width = $config['maxWidth']; $handle->image_max_width = $config['maxWidth'];
// 最大高度 // 最大高度
$handle->image_max_height = $config['maxHeight']; $handle->image_max_height = $config['maxHeight'];
// 最小宽度 // 最小宽度
$handle->image_min_width = $config['minWidth']; $handle->image_min_width = $config['minWidth'];
// 最小高度 // 最小高度
$handle->image_min_height = $config['minHeight']; $handle->image_min_height = $config['minHeight'];
// 2023-01-06 转换图片为指定格式 只转换非webp格式和非动态图片 // 2023-01-06 转换图片为指定格式 只转换非webp格式和非动态图片
if ($handle->file_src_name_ext !== 'webp' && !isGifAnimated($handle->file_src_pathname)) { if ($handle->file_src_name_ext !== 'webp' && !isGifAnimated($handle->file_src_pathname)) {
$handle->image_convert = $config['imgConvert']; $handle->image_convert = $config['imgConvert'];
} }
// 2023-01-06 PNG 图像的压缩级别,介于 1快速但大文件和 9慢但较小文件之间 // 2023-01-06 PNG 图像的压缩级别,介于 1快速但大文件和 9慢但较小文件之间
$handle->png_compression = 9 - round($config['compress_ratio'] / 11.2); $handle->png_compression = 9 - round($config['compress_ratio'] / 11.2);
// WEBP 图像的压缩质量 1-100 // WEBP 图像的压缩质量 1-100
$handle->webp_quality = $config['compress_ratio']; $handle->webp_quality = $config['compress_ratio'];
// JPEG 图像的压缩质量 1-100 // JPEG 图像的压缩质量 1-100
$handle->jpeg_quality = $config['compress_ratio']; $handle->jpeg_quality = $config['compress_ratio'];
/* 等比例缩减图片 放到前端了*/ /* 等比例缩减图片 放到前端了*/
/* /*
if ($config['imgRatio']) { if ($config['imgRatio']) {
$handle->image_resize = true; $handle->image_resize = true;
$handle->image_x = $config['image_x']; $handle->image_x = $config['image_x'];
$handle->image_y = $config['image_y']; $handle->image_y = $config['image_y'];
// 如果调整后的图像大于原始图像,则取消调整大小,以防止放大 // 如果调整后的图像大于原始图像,则取消调整大小,以防止放大
$handle->image_no_enlarging = true; $handle->image_no_enlarging = true;
} }
*/ */
/** /**
* 为管理员和登陆用户创建自定义上传目录 * 为管理员和登陆用户创建自定义上传目录
* 管理员上传目录为自定义目录 * 管理员上传目录为自定义目录
* 上传者目录为其用户名 * 上传者目录为其用户名
* 2022年5月1日 * 2022年5月1日
*/ */
// 默认目录 // 默认目录
$Img_path = config_path(); $Img_path = config_path();
// 开启管理员自定义目录 // 开启管理员自定义目录
if ($config['admin_path_status']) { if ($config['admin_path_status']) {
if (checkLogin() == 204) { if (checkLogin() == 204) {
$Img_path = config_path($config['admin_path'] . date('/Y/m/d/')); $Img_path = config_path($config['admin_path'] . date('/Y/m/d/'));
} }
} }
// 开启上传者单独目录 // 开启上传者单独目录
if ($config['guest_path_status']) { if ($config['guest_path_status']) {
if (checkLogin() == 205) { if (checkLogin() == 205) {
$getCok = json_decode($_COOKIE['auth']); $getCok = json_decode($_COOKIE['auth']);
$Img_path = config_path($getCok[0] . date('/Y/m/d/')); $Img_path = config_path($getCok[0] . date('/Y/m/d/'));
} }
} }
// 存储图片路径:i/201807/ // 存储图片路径:i/201807/
$handle->process(APP_ROOT . $Img_path); $handle->process(APP_ROOT . $Img_path);
// 图片完整相对路径:/i/2021/05/03/k88e7p.jpg // 图片完整相对路径:/i/2021/05/03/k88e7p.jpg
if ($handle->processed) { if ($handle->processed) {
header('Content-type:text/json'); header('Content-type:text/json');
// 图片相对路径 // 图片相对路径
$pathIMG = $Img_path . $handle->file_dst_name; $pathIMG = $Img_path . $handle->file_dst_name;
// 图片访问网址 // 图片访问网址
$imageUrl = rand_imgurl() . $pathIMG; $imageUrl = rand_imgurl() . $pathIMG;
// 后续处理地址 // 后续处理地址
$processUrl = $config['domain'] . $pathIMG; $processUrl = $config['domain'] . $pathIMG;
// 隐藏config文件中的path目录,需要搭配网站设置 // 隐藏config文件中的path目录,需要搭配网站设置
if ($config['hide_path'] == 1) { if ($config['hide_path'] == 1) {
$imageUrl = str_replace($config['path'], '/', $imageUrl); $imageUrl = str_replace($config['path'], '/', $imageUrl);
} }
// 源图保护 key值是由crc32加密的hide_key // 源图保护 key值是由crc32加密的hide_key
// $hide_original = $config['hide'] == 1 ? $config['domain'] . '/application/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['hide_key'])) : $imageUrl; // $hide_original = $config['hide'] == 1 ? $config['domain'] . '/app/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['hide_key'])) : $imageUrl;
if ($config['hide'] == 1) { if ($config['hide'] == 1) {
$imageUrl = $config['domain'] . '/application/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['hide_key'])); $imageUrl = $config['domain'] . '/app/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['hide_key']));
} }
// 删除文件链接 // 删除文件链接
if ($config['show_user_hash_del']) { if ($config['show_user_hash_del']) {
$delUrl = $config['domain'] . '/application/del.php?hash=' . urlHash($pathIMG, 0); $delUrl = $config['domain'] . '/app/del.php?hash=' . urlHash($pathIMG, 0);
} else { } else {
$delUrl = "Admin closed user delete"; $delUrl = "Admin closed user delete";
} }
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-30 // 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-30
$handleThumb = $config['domain'] . '/application/thumb.php?img=' . $pathIMG; $handleThumb = $config['domain'] . '/app/thumb.php?img=' . $pathIMG;
if ($config['thumbnail'] == 2) { if ($config['thumbnail'] == 2) {
// 自定义缩略图长宽 // 自定义缩略图长宽
$handle->image_resize = true; $handle->image_resize = true;
$handle->image_x = $config['thumbnail_w']; $handle->image_x = $config['thumbnail_w'];
$handle->image_y = $config['thumbnail_h']; $handle->image_y = $config['thumbnail_h'];
// 如果调整后的图像大于原始图像,则取消调整大小,以防止放大 // 如果调整后的图像大于原始图像,则取消调整大小,以防止放大
$handle->image_no_enlarging = true; $handle->image_no_enlarging = true;
$handle->file_new_name_body = date('Y_m_d_') . $handle->file_dst_name_body; $handle->file_new_name_body = date('Y_m_d_') . $handle->file_dst_name_body;
$handle->process(APP_ROOT . $config['path'] . 'cache/'); $handle->process(APP_ROOT . $config['path'] . 'cache/');
$handleThumb = $config['domain'] . $config['path'] . 'cache/' . $handle->file_dst_name; $handleThumb = $config['domain'] . $config['path'] . 'cache/' . $handle->file_dst_name;
} }
// 上传成功后返回json数据 // 上传成功后返回json数据
$reJson = array( $reJson = array(
"result" => "success", "result" => "success",
"code" => 200, "code" => 200,
"url" => $imageUrl, "url" => $imageUrl,
"srcName" => $handle->file_src_name_body, "srcName" => $handle->file_src_name_body,
"thumb" => $handleThumb, "thumb" => $handleThumb,
"del" => $delUrl, "del" => $delUrl,
// "memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12 // "memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12
); );
echo json_encode($reJson); echo json_encode($reJson);
$handle->clean(); // 如果取消上传生成缩略图需要恢复此选项功能 $handle->clean(); // 如果取消上传生成缩略图需要恢复此选项功能
} else { } else {
// 上传错误 code:206 客户端文件有问题 // 上传错误 code:206 客户端文件有问题
$reJson = array( $reJson = array(
"result" => "failed", "result" => "failed",
"code" => 206, "code" => 206,
"message" => $handle->error, "message" => $handle->error,
"memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12 "memory" => getDistUsed(memory_get_peak_usage()), // 占用内存 2023-02-12
// 'log' => $handle->log, // 仅用作调试用 // 'log' => $handle->log, // 仅用作调试用
); );
unset($handle); unset($handle);
header('Content-Type:application/json; charset=utf-8'); header('Content-Type:application/json; charset=utf-8');
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE)); exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
} }
/** 后续处理 */ /** 后续处理 */
// 使用fastcgi_finish_request操作 // 使用fastcgi_finish_request操作
if (function_exists('fastcgi_finish_request')) fastcgi_finish_request(); if (function_exists('fastcgi_finish_request')) fastcgi_finish_request();
// 同IP上传日志 // 同IP上传日志
@write_ip_upload_count_logs(); @write_ip_upload_count_logs();
// 日志 // 日志
@write_upload_logs($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size); @write_upload_logs($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
// 鉴黄 // 鉴黄
@process_checkImg($processUrl); @process_checkImg($processUrl);
// 水印 // 水印
@water($handle->file_dst_pathname); @water($handle->file_dst_pathname);
// 压缩 // 压缩
@process_compress($handle->file_dst_pathname); @process_compress($handle->file_dst_pathname);
// 上传至其他位置 // 上传至其他位置
// @any_upload($pathIMG, APP_ROOT . $pathIMG, 'upload'); // @any_upload($pathIMG, APP_ROOT . $pathIMG, 'upload');
unset($handle); unset($handle);
} }

View File

@ -24,7 +24,7 @@ if (isset($_GET['login_log'])) {
} }
// 上传日志 // 上传日志
require_once APP_ROOT . '/application/header.php'; require_once APP_ROOT . '/app/header.php';
if (isset($_POST['logDate'])) { if (isset($_POST['logDate'])) {
$logFile = APP_ROOT . '/admin/logs/upload/' . $_POST['logDate'] . '.php'; $logFile = APP_ROOT . '/admin/logs/upload/' . $_POST['logDate'] . '.php';
@ -43,7 +43,7 @@ try {
} }
} catch (Exception $e) { } catch (Exception $e) {
echo $e->getMessage(); echo $e->getMessage();
require_once APP_ROOT . '/application/footer.php'; require_once APP_ROOT . '/app/footer.php';
exit; exit;
} }
?> ?>
@ -155,7 +155,7 @@ try {
size: '<?php echo $v['size']; ?>', size: '<?php echo $v['size']; ?>',
checkImg: '<?php echo strstr('OFF', $v['checkImg']) ? '' : ''; ?>', checkImg: '<?php echo strstr('OFF', $v['checkImg']) ? '' : ''; ?>',
from: '<?php echo is_string($v['from']) ? "网页" : 'API: ' . $v['from']; ?>', from: '<?php echo is_string($v['from']) ? "网页" : 'API: ' . $v['from']; ?>',
manage: "<div class='btn-group'><a href='<?php echo $config['domain'] . $v['path']; ?>' target='_blank' class='btn btn-mini btn-success'>查看</a> <a href='/application/info.php?img=<?php echo $v['path']; ?>' target='_blank' class='btn btn-mini'>信息</a> <a href='/application/del.php?recycle_url=<?php echo $v['path']; ?>' target='_blank' class='btn btn-mini btn-info'>回收</a> <a href='/application/del.php?url=<?php echo $v['path']; ?>' target='_blank' class='btn btn-mini btn-danger'>删除</a></div>", manage: "<div class='btn-group'><a href='<?php echo $config['domain'] . $v['path']; ?>' target='_blank' class='btn btn-mini btn-success'>查看</a> <a href='/app/info.php?img=<?php echo $v['path']; ?>' target='_blank' class='btn btn-mini'>信息</a> <a href='/app/del.php?recycle_url=<?php echo $v['path']; ?>' target='_blank' class='btn btn-mini btn-info'>回收</a> <a href='/app/del.php?url=<?php echo $v['path']; ?>' target='_blank' class='btn btn-mini btn-danger'>删除</a></div>",
}, },
<?php endforeach; ?> <?php endforeach; ?>
] ]
@ -191,4 +191,4 @@ try {
document.title = "<?php echo pathinfo($logFile, PATHINFO_FILENAME); ?>月上传日志 - <?php echo $config['title']; ?>" document.title = "<?php echo pathinfo($logFile, PATHINFO_FILENAME); ?>月上传日志 - <?php echo $config['title']; ?>"
</script> </script>
<?php <?php
require_once APP_ROOT . '/application/footer.php'; require_once APP_ROOT . '/app/footer.php';

View File

@ -99,7 +99,7 @@ $config=Array
9=>'month' 9=>'month'
), ),
'language'=>0, 'language'=>0,
'login_bg'=>'../application/bing.php', 'login_bg'=>'../app/bing.php',
'report'=>'', 'report'=>'',
'image_recycl'=>1, 'image_recycl'=>1,
'tinyfilemanager'=>1, 'tinyfilemanager'=>1,

View File

@ -1,6 +1,7 @@
* 2023-03-06 v2.7.8 * 2023-03-06 v2.7.8
- 增加WEB端上传签名 - 增加WEB端上传签名
- 修复一处漏洞 - 修改目录命名 `applicaton->app`
- 修复两处漏洞
* 2023-03-05 v2.7.7 * 2023-03-05 v2.7.7
- 增加登录日志 - 增加登录日志

View File

@ -7,15 +7,15 @@
session_start(); session_start();
/**开始 - 自定义修改 */ /**开始 - 自定义修改 */
require_once __DIR__ . '/../application/function.php'; require_once __DIR__ . '/../app/function.php';
require_once APP_ROOT . '/config/config.php'; require_once APP_ROOT . '/config/config.php';
// 开启tinyfilemanager文件管理 // 开启tinyfilemanager文件管理
if (!$config['file_manage']) { if (!$config['file_manage']) {
require_once APP_ROOT . '/application/header.php'; require_once APP_ROOT . '/app/header.php';
echo '<h4 class="alert alert-danger">文件管理已关闭~~</h4>'; echo '<h4 class="alert alert-danger">文件管理已关闭~~</h4>';
header("refresh:3;url=" . $config['domain'] . '?manag-closed'); header("refresh:3;url=" . $config['domain'] . '?manag-closed');
require_once APP_ROOT . '/application/footer.php'; require_once APP_ROOT . '/app/footer.php';
exit; exit;
} }
@ -215,7 +215,7 @@ class RExplorer
if (RexHelper::file_catetory($srpath) == 'image') { if (RexHelper::file_catetory($srpath) == 'image') {
echo ' echo '
<td> <td>
<img data-toggle="lightbox" src="/../application/thumb.php?img=', $srpath, '" data-image="' . $srpath . '" data-caption="查看原图" class="img-thumbnail" alt="查看原图" width="80"> <img data-toggle="lightbox" src="/../app/thumb.php?img=', $srpath, '" data-image="' . $srpath . '" data-caption="查看原图" class="img-thumbnail" alt="查看原图" width="80">
</td>'; </td>';
} else { } else {
echo ' echo '
@ -328,7 +328,7 @@ class RExplorer
return; return;
case 'image': case 'image':
echo ' echo '
<img data-toggle="lightbox" src="/../application/thumb.php?img=', $path, '" data-image="' . $path . '" data-caption="小图看大图" class="img-thumbnail" alt="" width="200"> <img data-toggle="lightbox" src="/../app/thumb.php?img=', $path, '" data-image="' . $path . '" data-caption="小图看大图" class="img-thumbnail" alt="" width="200">
<div class="card-body"> <div class="card-body">
<a href="', $path, '" target="_blank">查看原图</a> <a href="', $path, '" target="_blank">查看原图</a>
</div> </div>
@ -1080,8 +1080,8 @@ class ZipHelper
} }
/** 环境检测 */ /** 环境检测 */
if ($config['checkEnv']) require_once APP_ROOT . '/application/check.php'; if ($config['checkEnv']) require_once APP_ROOT . '/app/check.php';
/** 底部广告 */ /** 底部广告 */
if ($config['ad_bot']) echo $config['ad_bot_info']; if ($config['ad_bot']) echo $config['ad_bot_info'];
/** 引入底部 */ /** 引入底部 */
require_once APP_ROOT . '/application/footer.php'; require_once APP_ROOT . '/app/footer.php';

View File

@ -1,5 +1,5 @@
<?php <?php
require_once 'application/header.php'; require_once __DIR__ . '/app/header.php';
/** 顶部广告 */ /** 顶部广告 */
if ($config['ad_top']) echo $config['ad_top_info']; if ($config['ad_top']) echo $config['ad_top_info'];
/** 检查登陆 */ /** 检查登陆 */
@ -16,7 +16,7 @@ mustLogin();
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div id='upShowID' class="uploader col-md-12 clo-xs-12" data-ride="uploader" data-url="/application/upload.php"> <div id='upShowID' class="uploader col-md-12 clo-xs-12" data-ride="uploader" data-url="/app/upload.php">
<div class="uploader-message text-center"> <div class="uploader-message text-center">
<div class="content"></div> <div class="content"></div>
<button type="button" class="close">x</button> <button type="button" class="close">x</button>
@ -117,7 +117,7 @@ mustLogin();
// 自动上传 // 自动上传
autoUpload: false, autoUpload: false,
// 文件上传提交地址 // 文件上传提交地址
url: './application/upload.php', url: './app/upload.php',
// 最大支持的上传文件 // 最大支持的上传文件
max_file_size: <?php echo $config['maxSize']; ?>, max_file_size: <?php echo $config['maxSize']; ?>,
// 分片上传 0为不分片 分片容易使图片上传失败 // 分片上传 0为不分片 分片容易使图片上传失败
@ -187,8 +187,8 @@ mustLogin();
</script> </script>
<?php <?php
/** 环境检测 */ /** 环境检测 */
if ($config['checkEnv']) require_once APP_ROOT . '/application/check.php'; if ($config['checkEnv']) require_once APP_ROOT . '/app/check.php';
/** 底部广告 */ /** 底部广告 */
if ($config['ad_bot']) echo $config['ad_bot_info']; if ($config['ad_bot']) echo $config['ad_bot_info'];
/** 引入底部 */ /** 引入底部 */
require_once APP_ROOT . '/application/footer.php'; require_once __DIR__ . '/app/footer.php';

View File

@ -1,5 +1,5 @@
<?php <?php
require_once __DIR__ . '/../application/function.php'; require_once __DIR__ . '/../app/function.php';
if (file_exists(APP_ROOT . '/config/install.lock')) { if (file_exists(APP_ROOT . '/config/install.lock')) {
exit(header("Location:/../index.php")); exit(header("Location:/../index.php"));

View File

@ -1,5 +1,5 @@
<?php <?php
require_once __DIR__ . '/../application/function.php'; require_once __DIR__ . '/../app/function.php';
clearstatcache(); clearstatcache();
// 存在程序锁则跳转主页 // 存在程序锁则跳转主页
if (file_exists(APP_ROOT . '/config/install.lock')) { if (file_exists(APP_ROOT . '/config/install.lock')) {
@ -10,7 +10,7 @@ $fileinfo = extension_loaded('fileinfo') ? true : false;
$gd = extension_loaded('gd') ? true : false; $gd = extension_loaded('gd') ? true : false;
$openssl = extension_loaded('openssl') ? true : false; $openssl = extension_loaded('openssl') ? true : false;
$file = substr(base_convert(fileperms(APP_ROOT . "/application/upload.php"), 10, 8), 3); $file = substr(base_convert(fileperms(APP_ROOT . "/app/upload.php"), 10, 8), 3);
if (IS_WIN) { if (IS_WIN) {
$file_php = true; $file_php = true;
$i_wjj = true; $i_wjj = true;

View File

@ -1,5 +1,5 @@
<?php <?php
require_once __DIR__ . '/../application/function.php'; require_once __DIR__ . '/../app/function.php';
// 存在程序锁则跳转主页 // 存在程序锁则跳转主页
if (file_exists(APP_ROOT . '/config/install.lock')) { if (file_exists(APP_ROOT . '/config/install.lock')) {
exit(header("Location:/../index.php")); exit(header("Location:/../index.php"));