pull/141/head
icret 2022-05-09 06:37:58 +00:00
parent b7ab0ffed9
commit e7d6ed0274
10 changed files with 141 additions and 101 deletions

View File

@ -180,9 +180,11 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary>点击查看2.0版更新日志</summary> <details><summary>点击查看2.0版更新日志</summary>
* 2022-05-05 v2.6.3 * 2022-05-05 v2.6.3 deving
- 修复广场-信息中无法显示Exif - 增加广场浏览往日限制
- 更改广场-信息中图片长宽获取方式 - 有助于防爬虫抓取
- 修复广场->信息中无法显示Exif
- 更改广场->信息中图片长宽获取方式
- 优化广场UI - 优化广场UI
* 2022-05-04 v2.6.2 * 2022-05-04 v2.6.2

View File

@ -240,13 +240,11 @@ if (isset($_GET['recycle_reimg'])) {
<div class="alert alert-primary alert-dismissable"> <div class="alert alert-primary alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button>
<h5>目录保存以 /// 递进,非必要请勿修改! 否则会导致部分操作不可用;</h5> <h5>目录保存以 /// 递进,非必要请勿修改! 否则会导致部分操作不可用;</h5>
<h5>本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途;</h5> <h5>本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途 请勿用于非法用途;</h5>
<h5>请为本人博客<a class="alert-link" href="https://blog.png.cm/" target="_blank">blog.png.cm</a>加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如: <a class="alert-link" href="https://blog.png.cm/">本人博客</a>,邮箱等)</h5> <h5>作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中作者信息。</h5>
<a href="https://png.cm/" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-external-link"></i> 演示网站</button></a> <a href="https://png.cm/?admin.inc" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-external-link"></i> 演示网站</button></a>
<a href="https://www.kancloud.cn/easyimage/easyimage/content" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-hand-right"></i> 使用手册</button></a> <a href="https://www.kancloud.cn/easyimage/easyimage/content" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-hand-right"></i> 使用手册</button></a>
<!-- <a href="https://support.qq.com/products/367633" target="_blank"><button type="button" class="btn btn-mini hidden-xs inline-block"><i class="icon icon-bug"></i> 问题反馈</button></a> --> <a href="https://t.me/Easy_Image" target="_blank" data-toggle="tooltip" title="EasyImage Telegram Group"><button type="button" class="btn btn-mini"><i class="icon icon-plane"></i> Telegram</button></a>
<a href="https://jq.qq.com/?_wv=1027&k=OBIlf2y7" target="_blank" data-toggle="tooltip" title="954441002"><button type="button" class="btn btn-mini"><i class="icon icon-qq"></i> QQ群</button></a>
<a href="https://t.me/Easy_Image" target="_blank" data-toggle="tooltip" title="EasyImage 简单图床TG群"><button type="button" class="btn btn-mini hidden-xs inline-block"><i class="icon icon-plane"></i> Telegram</button></a>
<a href="../public/images/wechat.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;"><i class="icon icon-wechat"></i> 打赏作者</a> <a href="../public/images/wechat.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;"><i class="icon icon-wechat"></i> 打赏作者</a>
<a href="../public/images/alipay.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini hidden-xs inline-block" style="color:#1970fc;"><i class="icon icon-zhifubao"></i> 打赏作者</a> <a href="../public/images/alipay.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini hidden-xs inline-block" style="color:#1970fc;"><i class="icon icon-zhifubao"></i> 打赏作者</a>
</div> </div>
@ -276,7 +274,7 @@ if (isset($_GET['recycle_reimg'])) {
<input type="url" class="form-control" name="domain" required="required" value="<?php echo $config['domain']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')"> <input type="url" class="form-control" name="domain" required="required" value="<?php echo $config['domain']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div> </div>
<div class="form-group"> <div class="form-group">
<label data-toggle="tooltip" title="支持多个域名随机选择<br />* 多个域名请以英文 , 分割 <br />* 最后一个域名不要加<br/>* 只有一个域名请与上边一致">图片域名 | 末尾不加'/'</label> <label data-toggle="tooltip" title="支持多个域名随机选择<br/>* 只有一个域名请与上边一致<br />* 多个域名请以英文 , 分割 <br />* 最后一个域名不要加,">图片域名 | 末尾不加'/'</label>
<input type="text" class="form-control" name="imgurl" required="required" value="<?php echo $config['imgurl']; ?>" placeholder="末尾不加/" onkeyup="this.value=this.value.replace(/\s/g,'')" title="网站域名与图片链接域名可以不同,比如A域名上传,可以返回B域名图片链接,A、B需绑定到同一空间下"> <input type="text" class="form-control" name="imgurl" required="required" value="<?php echo $config['imgurl']; ?>" placeholder="末尾不加/" onkeyup="this.value=this.value.replace(/\s/g,'')" title="网站域名与图片链接域名可以不同,比如A域名上传,可以返回B域名图片链接,A、B需绑定到同一空间下">
</div> </div>
<div class="form-group"> <div class="form-group">
@ -456,37 +454,37 @@ if (isset($_GET['recycle_reimg'])) {
<h5 class="page-header">Token列表: <?php if (!$config['token_path_status']) echo '<small>* 部分按钮需开启Token分离才能激活, 删除后不可恢复</small>'; ?></h5> <h5 class="page-header">Token列表: <?php if (!$config['token_path_status']) echo '<small>* 部分按钮需开启Token分离才能激活, 删除后不可恢复</small>'; ?></h5>
<p class="text-primary">API调用地址: <code><?php echo $config['domain']; ?>/api/index.php</code></p> <p class="text-primary">API调用地址: <code><?php echo $config['domain']; ?>/api/index.php</code></p>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-condensed table-hover table-bordered visible-xs visible-sm" style="margin-top: 10px;"> <table class="table table-condensed table-hover table-bordered visible-xs visible-sm" style="margin-top: 10px;">
<thead> <thead>
<tr>
<th>ID</th>
<th>列表</th>
<th>添加时间</th>
<th>有效期至</th>
<th>上传数量</th>
<th>管理Token</th>
</tr>
</thead>
<tbody>
<?php foreach ($tokenList as $key => $value) :
$expired = $value['expired'] < time() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y年m月d日 H:i:s', $value['expired']) . '</p>';
?>
<tr> <tr>
<td><?php echo $value['id']; ?></td> <th>ID</th>
<td><?php echo $key; ?></td> <th>列表</th>
<td><?php echo date('Y年m月d日 H:i:s', $value['add_time']); ?></td> <th>添加时间</th>
<td><?php echo get_file_by_glob(APP_ROOT . $config['path'] . $value['id'], $type = 'number'); ?></td> <th>有效期至</th>
<td><?php echo $expired; ?></td> <th>上传数量</th>
<td> <th>管理Token</th>
<a href='/admin/manager.php?p=<?php echo $value['id']; ?>' target='_blank' class='btn btn-mini btn-primary <?php if (!$config['token_path_status']) echo 'disabled'; ?>'>文件</a>
<a href='admin.inc.php?stop_token=<?php echo $key; ?>' class='btn btn-mini btn-danger'>禁用</a>
<a href='admin.inc.php?delete_token=<?php echo $key; ?>' class='btn btn-mini btn-danger'>删除</a>
<a href='admin.inc.php?delDir=<?php echo $value['id']; ?>' class='btn btn-mini btn-primary <?php if (!$config['token_path_status']) echo 'disabled'; ?>'>删除上传</a>
</td>
</tr> </tr>
<?php endforeach; ?> </thead>
</tbody> <tbody>
</table> <?php foreach ($tokenList as $key => $value) :
$expired = $value['expired'] < time() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y-m-d H:i:s', $value['expired']) . '</p>';
?>
<tr>
<td><?php echo $value['id']; ?></td>
<td><?php echo $key; ?></td>
<td><?php echo date('Y年m月d日 H:i:s', $value['add_time']); ?></td>
<td><?php echo get_file_by_glob(APP_ROOT . $config['path'] . $value['id'], $type = 'number'); ?></td>
<td><?php echo $expired; ?></td>
<td>
<a href='/admin/manager.php?p=<?php echo $value['id']; ?>' target='_blank' class='btn btn-mini btn-primary <?php if (!$config['token_path_status']) echo 'disabled'; ?>'>文件</a>
<a href='admin.inc.php?stop_token=<?php echo $key; ?>' class='btn btn-mini btn-danger'>禁用</a>
<a href='admin.inc.php?delete_token=<?php echo $key; ?>' class='btn btn-mini btn-danger'>删除</a>
<a href='admin.inc.php?delDir=<?php echo $value['id']; ?>' class='btn btn-mini btn-primary <?php if (!$config['token_path_status']) echo 'disabled'; ?>'>删除上传</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div> </div>
<div id="myDataGrid" class="datagrid table-bordered visible-md visible-lg"> <div id="myDataGrid" class="datagrid table-bordered visible-md visible-lg">
<div class="input-control search-box search-box-circle has-icon-left has-icon-right" id="searchboxExample2" style="margin-bottom: 10px;"> <div class="input-control search-box search-box-circle has-icon-left has-icon-right" id="searchboxExample2" style="margin-bottom: 10px;">
@ -884,14 +882,21 @@ if (isset($_GET['recycle_reimg'])) {
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="login_bg" data-toggle="tooltip" title="图片地址可以是相对路径或网址">登录背景</label> <label for="login_bg" data-toggle="tooltip" title="图片地址可以是相对路径或网址">登录背景</label>
<input type="text" class="form-control" id="login_bg" name="login_bg" value="<? if ($config['login_bg']) echo $config['login_bg']; ?>" placeholder="图片地址可以是相对路径或网址" onkeyup="this.value=this.value.replace(/\s/g,'')"> <input type="text" class="form-control" id="login_bg" name="login_bg" value="<? if ($config['login_bg']) echo $config['login_bg']; ?>" required="required" placeholder="图片地址可以是相对路径或网址" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>广场默认浏览数量 | 当前: </label>
<label id="listNumber"><?php echo $config['listNumber']; ?>张</label> <div class="col-md-9">
<input type="range" class="form-control" name="listNumber" value="<?php echo $config['listNumber']; ?>" min="10" max="100" step="10" onchange="document.getElementById('listNumber').innerHTML=value" data-toggle="tooltip" title="可在网址后填写参数实时更改预览数量 如: https://png.cm/application/list.php?num=3"> <label data-toggle="tooltip" title="可在网址后填写参数更改预览数量 eg: /list.php?num=3">广场默认浏览数量 | 当前: </label>
<label id="listNumber"><?php echo $config['listNumber']; ?>张</label>
<input type="range" class="form-control" name="listNumber" value="<?php echo $config['listNumber']; ?>" min="10" max="100" step="10" onchange="document.getElementById('listNumber').innerHTML=value">
</div>
<div class="col-md-3">
<label id="listDate" data-toggle="tooltip" title="有助于防爬虫抓取<br />建议不超10天,超过可能导致排版混乱">广场浏览往日限制 | 当前: <?php echo $config['listDate']; ?>天</label>
<input type="number" class="form-control input-sm" id="listDate" name="listDate" value="<? if ($config['listDate']) echo $config['listDate']; ?>" min="1" max="100" required="required" placeholder="有助于防爬虫抓取 建议不超10天" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div>
</div> </div>
<div class="form-group"> <div class="form-group col-md-12">
<input type="hidden" class="form-control" name="update" value="<?php echo date("Y-m-d H:i:s"); ?>" placeholder="隐藏的保存"> <input type="hidden" class="form-control" name="update" value="<?php echo date("Y-m-d H:i:s"); ?>" placeholder="隐藏的保存">
</div> </div>
<button type="submit" class="btn btn-primary">保存</button> <button type="submit" class="btn btn-primary">保存</button>
@ -903,11 +908,11 @@ if (isset($_GET['recycle_reimg'])) {
<h5 class="header-dividing">管理员账号<small> 不更改账号或者密码就不要保存</small></h5> <h5 class="header-dividing">管理员账号<small> 不更改账号或者密码就不要保存</small></h5>
<div class="form-group"> <div class="form-group">
<div class="input-control has-icon-left"> <div class="input-control has-icon-left">
<input type="text" name="user" id="account" class="form-control" value="<?php echo $config['user']; ?>" placeholder="更改管理账号" onkeyup="this.value=this.value.replace(/\s/g,'')"> <input type="text" name="user" id="account" class="form-control" value="<?php echo $config['user']; ?>" required="required" placeholder="更改管理账号" onkeyup="this.value=this.value.replace(/\s/g,'')">
<label for="account" class="input-control-icon-left"><i class="icon icon-user "></i></label> <label for="account" class="input-control-icon-left"><i class="icon icon-user "></i></label>
</div> </div>
<div class="input-control has-icon-left" style="margin-top: 10px;" data-toggle="tooltip" title="当前显示的是经过MD5加密的"> <div class="input-control has-icon-left" style="margin-top: 10px;" data-toggle="tooltip" title="当前显示的是经过MD5加密的">
<input type="text" name="password" id="password" class="form-control" value="<?php echo $config['password']; ?>" placeholder="更改管理密码" onkeyup="this.value=this.value.replace(/\s/g,'')"> <input type="text" name="password" id="password" class="form-control" value="<?php echo $config['password']; ?>" required="required" placeholder="更改管理密码" onkeyup="this.value=this.value.replace(/\s/g,'')">
<input type="hidden" name="password" id="md5_password"> <input type="hidden" name="password" id="md5_password">
<label for="password" class="input-control-icon-left"><i class="icon icon-key"></i></label> <label for="password" class="input-control-icon-left"><i class="icon icon-key"></i></label>
</div> </div>
@ -974,7 +979,7 @@ if (isset($_GET['recycle_reimg'])) {
</thead> </thead>
<tbody> <tbody>
<?php foreach ($guestConfig as $key => $value) : <?php foreach ($guestConfig as $key => $value) :
$expired = $value['expired'] < time() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y年m月d日 H:i:s', $value['expired']) . '</p>'; $expired = $value['expired'] < time() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y-m-d H:i:s', $value['expired']) . '</p>';
?> ?>
<tr> <tr>
<td><?php echo $key; ?></td> <td><?php echo $key; ?></td>
@ -1170,7 +1175,7 @@ if (isset($_GET['recycle_reimg'])) {
<p id="delimgurl"></p> <p id="delimgurl"></p>
<div class="form-group"> <div class="form-group">
<label for="del" class="text-primary">删除单张图片文件: </label> <label for="del" class="text-primary">删除单张图片文件: </label>
<input type="url" name="url_admin_inc" class="form-control input-sm" id="del" placeholder="请输入图片链接"> <input type="url" name="url_admin_inc" class="form-control input-sm" id="del" required="required" placeholder="请输入图片链接">
</div> </div>
<button type="submit" class="btn btn-sm btn-primary" onClick="return confirm('确认要删除?\n* 删除文件后将无法恢复! ');">删除单文件</button> <button type="submit" class="btn btn-sm btn-primary" onClick="return confirm('确认要删除?\n* 删除文件后将无法恢复! ');">删除单文件</button>
</form> </form>
@ -1318,7 +1323,7 @@ if (isset($_GET['recycle_reimg'])) {
], ],
array: [ array: [
<?php foreach ($tokenList as $key => $value) : <?php foreach ($tokenList as $key => $value) :
$expired = $value['expired'] < time() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y年m月d日 H:i:s', $value['expired']) . '</p>'; ?> { $expired = $value['expired'] < time() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y-m-d H:i:s', $value['expired']) . '</p>'; ?> {
id: '<?php echo $value['id']; ?>', id: '<?php echo $value['id']; ?>',
list: '<?php echo $key; ?>', list: '<?php echo $key; ?>',
add_time: '<?php echo date('Y年m月d日 H:i:s', $value['add_time']); ?>', add_time: '<?php echo date('Y年m月d日 H:i:s', $value['add_time']); ?>',

View File

@ -8,33 +8,35 @@ require_once APP_ROOT . '/config/api_key.php';
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
// 无文件
if (empty($_FILES['image'])) {
exit(json_encode(
array(
"result" => "failed",
"code" => 204,
"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:205 未授权IP
exit(json_encode(array( exit(json_encode(array(
"result" => "failed", "result" => "failed",
"code" => 401, "code" => 205,
"message" => "黑名单内或白名单外用户不允许上传", "message" => "黑名单内或白名单外用户不允许上传",
))); )));
} }
} }
$token = preg_replace('/[\W]/', '', $_POST['token']); // 获取Token并过滤非字母数字删除空格; $token = preg_replace('/[\W]/', '', $_POST['token']); // 获取Token并过滤非字母数字删除空格;
// 检查api合法性 // 检查api合法性
check_api($token); check_api($token);
$tokenID = $tokenList[$token]['id']; $tokenID = $tokenList[$token]['id'];
if (empty($_FILES['image'])) {
exit(json_encode(
array(
"result" => "NoFile",
"code" => 402,
"message" => "没有选择上传的文件",
)
));
}
$handle = new Upload($_FILES['image'], 'zh_CN'); $handle = new Upload($_FILES['image'], 'zh_CN');
if ($handle->uploaded) { if ($handle->uploaded) {
@ -141,10 +143,10 @@ if ($handle->uploaded) {
echo json_encode($reJson, JSON_UNESCAPED_UNICODE); echo json_encode($reJson, JSON_UNESCAPED_UNICODE);
$handle->clean(); $handle->clean();
} else { } else {
// 上传错误 code:400 客户端文件有问题 // 上传错误 code:206 客户端文件有问题
$reJson = array( $reJson = array(
"result" => "failed", "result" => "failed",
"code" => 400, "code" => 206,
"message" => $handle->error, "message" => $handle->error,
); );

View File

@ -1237,8 +1237,8 @@ function privateToken($length = 32)
/** /**
* 检查Token * 检查Token
* @param $token 要检查的Token * @param $token 要检查的Token
* code:201 访问成功但是服务端关闭API上传 * @return string 201 访问成功但是服务端关闭API上传
* code:202 访问成功但是Token错误 * @return string 202 访问成功但是Token错误
*/ */
function check_api($token) function check_api($token)
{ {
@ -1256,7 +1256,7 @@ function check_api($token)
} }
if (!in_array($tokenList[$token], $tokenList)) { if (!in_array($tokenList[$token], $tokenList)) {
// Token 存在 // Token 存在
$reJson = array( $reJson = array(
"result" => 'failed', "result" => 'failed',
'code' => 202, 'code' => 202,
@ -1278,7 +1278,7 @@ function check_api($token)
/** /**
* 判断webp是否为动态图片 * 判断webp是否为动态图片
* @param $src 图像文件 * @param string $src 图像文件
* @return bool | * @return bool |
*/ */
function isWebpAnimated($src) function isWebpAnimated($src)
@ -1298,7 +1298,7 @@ function isWebpAnimated($src)
/** /**
* 根据URL判断是否本地局域网访问(PHP代码函数) * 根据URL判断是否本地局域网访问(PHP代码函数)
* https://blog.csdn.net/monxinmonxin0/article/details/44854383 * https://blog.csdn.net/monxinmonxin0/article/details/44854383
* @param $url 要判断的网址 * @param string $url 要判断的网址
* @return bool | * @return bool |
*/ */
function is_local($url) function is_local($url)
@ -1311,7 +1311,7 @@ function is_local($url)
/** /**
* 将图片域名转换为数组并随即输出 * 将图片域名转换为数组并随即输出
* @param $text 字符串 * @param string $text 字符串
* @return String 随机网址 * @return String 随机网址
*/ */
function rand_imgurl($text = null) function rand_imgurl($text = null)
@ -1330,7 +1330,7 @@ function rand_imgurl($text = null)
function isAnimatedGifWebp($src) function isAnimatedGifWebp($src)
{ {
$ext = pathinfo($src)['extension']; $ext = pathinfo($src)['extension'];
if ($ext == 'webp') { if ($ext == 'webp') {
$webpContents = file_get_contents($src); $webpContents = file_get_contents($src);
$where = strpos($webpContents, "ANMF"); $where = strpos($webpContents, "ANMF");

View File

@ -2,6 +2,7 @@
/** 广场页面 */ /** 广场页面 */
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'];
?> ?>
@ -12,7 +13,25 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<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');
else : else :
$path = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/'); // 获取指定目录 // $path = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/'); // 获取指定目录
/* 限制GET浏览日期 有助于防止爬虫*/
$listDate = $config['listDate']; // 配置限制日期
$path = date('Y/m/d/'); // 当前日期
if (isset($_GET['date'])) {
if ($_GET['date'] < date('Y/m/d/', strtotime("- $listDate day"))) { // GET日期小于配置日期时返回当前日期
$path = date('Y/m/d/');
echo '
<script>
new $.zui.Messager("已超出浏览页数, 返回今日上传列表", {
type: "info", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标
}).show();
</script>';
} else {
$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)); // 过滤非数字,删除空格
@ -77,9 +96,9 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<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 配置的倒退日期
for ($x = 2; $x <= 6; $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('m月d日', 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')) : ?>
@ -131,7 +150,7 @@ if ($config['ad_top']) echo $config['ad_top_info'];
</form> </form>
</div> </div>
<!-- 返回顶部--> <!-- 返回顶部-->
<div class="btn btn-primary btn-back-to-top"><i class="icon icon-arrow-up"></i></div> <div class="btn btn-sm 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">

View File

@ -28,6 +28,17 @@ if ($config['check_ip']) {
} }
} }
// 无文件
if (empty($_FILES['file'])) {
exit(json_encode(
array(
"result" => "failed",
"code" => 204,
"message" => "没有选择上传的文件",
)
));
}
$handle = new Upload($_FILES['file'], 'zh_CN'); $handle = new Upload($_FILES['file'], 'zh_CN');
if ($handle->uploaded) { if ($handle->uploaded) {
@ -150,10 +161,10 @@ if ($handle->uploaded) {
echo json_encode($reJson); echo json_encode($reJson);
$handle->clean(); $handle->clean();
} else { } else {
// 上传错误 code:400 客户端文件有问题 // 上传错误 code:206 客户端文件有问题
$reJson = array( $reJson = array(
"result" => "failed", "result" => "failed",
"code" => 400, "code" => 206,
"message" => $handle->error, "message" => $handle->error,
); );
unset($handle); unset($handle);

View File

@ -54,6 +54,7 @@ $config=Array
'showSwitch'=>1, 'showSwitch'=>1,
'showSort'=>1, 'showSort'=>1,
'listNumber'=>20, 'listNumber'=>20,
'listDate'=>10,
'customize'=>'', 'customize'=>'',
'checkEnv'=>1, 'checkEnv'=>1,
'upload_logs'=>1, 'upload_logs'=>1,
@ -92,7 +93,7 @@ $config=Array
'token_path_status'=>0, 'token_path_status'=>0,
'admin_path'=>'u', 'admin_path'=>'u',
'version'=>'2.6.2', 'version'=>'2.6.2',
'update'=>'2022-05-05 07:00:52', 'update'=>'2022-05-09 00:40:59',
'footer'=>'<a href="/admin/terms.php" target="_blank">请勿上传违反中国政策的图片</a> 'footer'=>'<a href="/admin/terms.php" target="_blank">请勿上传违反中国政策的图片</a>
<script> <script>
var _hmt = _hmt || []; var _hmt = _hmt || [];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

View File

@ -3,7 +3,7 @@
* 简单图床-复制 * 简单图床-复制
*/ */
var copyBtn = document.getElementsByClassName('copyBtn1')[0]; var copyBtn = document.getElementsByClassName('copyBtn1')[0];
copyBtn.onclick = function () { copyBtn.onclick = function() {
var copyVal = document.getElementById("links"); var copyVal = document.getElementById("links");
copyVal.select(); copyVal.select();
try { try {
@ -11,7 +11,7 @@ copyBtn.onclick = function () {
//success info //success info
new $.zui.Messager("复制成功", { new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题 type: "primary", // 定义颜色主题
icon: 'ok-sign' // 定义消息图标 icon: "ok-sign" // 定义消息图标
}).show(); }).show();
console.log("复制成功"); console.log("复制成功");
} else { } else {
@ -25,7 +25,7 @@ copyBtn.onclick = function () {
} }
var copyBtn = document.getElementsByClassName('copyBtn2')[0]; var copyBtn = document.getElementsByClassName('copyBtn2')[0];
copyBtn.onclick = function () { copyBtn.onclick = function() {
var copyVal = document.getElementById("bbscode"); var copyVal = document.getElementById("bbscode");
copyVal.select(); copyVal.select();
try { try {
@ -47,7 +47,7 @@ copyBtn.onclick = function () {
} }
var copyBtn = document.getElementsByClassName('copyBtn3')[0]; var copyBtn = document.getElementsByClassName('copyBtn3')[0];
copyBtn.onclick = function () { copyBtn.onclick = function() {
var copyVal = document.getElementById("markdown"); var copyVal = document.getElementById("markdown");
copyVal.select(); copyVal.select();
try { try {
@ -69,7 +69,7 @@ copyBtn.onclick = function () {
} }
var copyBtn = document.getElementsByClassName('copyBtn4')[0]; var copyBtn = document.getElementsByClassName('copyBtn4')[0];
copyBtn.onclick = function () { copyBtn.onclick = function() {
var copyVal = document.getElementById("html"); var copyVal = document.getElementById("html");
copyVal.select(); copyVal.select();
try { try {
@ -91,7 +91,7 @@ copyBtn.onclick = function () {
} }
var copyBtn = document.getElementsByClassName('copyBtn5')[0]; var copyBtn = document.getElementsByClassName('copyBtn5')[0];
copyBtn.onclick = function () { copyBtn.onclick = function() {
var copyVal = document.getElementById("del"); var copyVal = document.getElementById("del");
copyVal.select(); copyVal.select();
try { try {
@ -113,60 +113,60 @@ copyBtn.onclick = function () {
} }
// btn状态 // btn状态
$('#btnLinks').on('click', function () { $('#btnLinks').on('click', function() {
var $btn = $(this); var $btn = $(this);
$btn.button('loading'); $btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑 // 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () { setTimeout(function() {
$btn.button('reset'); $btn.button('reset');
}, 2000); }, 2000);
}); });
$('#btnBbscode').on('click', function () { $('#btnBbscode').on('click', function() {
var $btn = $(this); var $btn = $(this);
$btn.button('loading'); $btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑 // 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () { setTimeout(function() {
$btn.button('reset'); $btn.button('reset');
}, 2000); }, 2000);
}); });
$('#btnMarkDown').on('click', function () { $('#btnMarkDown').on('click', function() {
var $btn = $(this); var $btn = $(this);
$btn.button('loading'); $btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑 // 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () { setTimeout(function() {
$btn.button('reset'); $btn.button('reset');
}, 2000); }, 2000);
}); });
$('#btnHtml').on('click', function () { $('#btnHtml').on('click', function() {
var $btn = $(this); var $btn = $(this);
$btn.button('loading'); $btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑 // 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () { setTimeout(function() {
$btn.button('reset'); $btn.button('reset');
}, 2000); }, 2000);
}); });
$('#btndel').on('click', function () { $('#btndel').on('click', function() {
var $btn = $(this); var $btn = $(this);
$btn.button('loading'); $btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑 // 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () { setTimeout(function() {
$btn.button('reset'); $btn.button('reset');
}, 2000); }, 2000);
}); });
/**************************************************************** /****************************************************************
* 复制截图 简单图床修改版 * 复制截图 简单图床修改版
*/ */
(function () { (function() {
document.addEventListener('paste', function (e) { document.addEventListener('paste', function(e) {
var items = ((e.clipboardData || window.clipboardData).items) || []; var items = ((e.clipboardData || window.clipboardData).items) || [];
var file = null; var file = null;
@ -187,7 +187,7 @@ $('#btndel').on('click', function () {
formData.append('file', file); formData.append('file', file);
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onload = function () { xhr.onload = function() {
try { try {
var result = JSON.parse(this.responseText); var result = JSON.parse(this.responseText);
if (result.result === 'success') { if (result.result === 'success') {
@ -213,7 +213,7 @@ $('#btndel').on('click', function () {
alert('上传失败2'); alert('上传失败2');
} }
}; };
xhr.onerror = function () { xhr.onerror = function() {
alert('上传失败3'); alert('上传失败3');
}; };
xhr.open('POST', './application/upload.php', true); xhr.open('POST', './application/upload.php', true);
@ -222,7 +222,7 @@ $('#btndel').on('click', function () {
})(); })();
/******************************************************************/ /******************************************************************/
var _hmt = _hmt || []; var _hmt = _hmt || [];
(function () { (function() {
var hm = document.createElement("script"); var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c790ac2bdc2f385757ecd0183206108d"; hm.src = "https://hm.baidu.com/hm.js?c790ac2bdc2f385757ecd0183206108d";
var s = document.getElementsByTagName("script")[0]; var s = document.getElementsByTagName("script")[0];