From 4dd2c30455f3598eb102f2db5521385efafddf06 Mon Sep 17 00:00:00 2001 From: icret Date: Tue, 31 Jan 2023 00:05:15 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E5=A2=9E=E5=8A=A0=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 2023-01-31 v2.7.0 dev - 增加上传历史记录 - 增加粘贴上传状态 - 增加广场非图片图标 - 增加前端显示缩略图链接 - 增加每日获取Bing图片背景 - 增加图片详细信息管理登录后显示更多信息 - 修复图片详细信息中随机图片排版混乱 - 替换访问生成缩略图代码 - 更新一些组件 - 优化代码 --- README.md | 7 ++- admin/admin.inc.php | 30 ++++++----- admin/chart.php | 11 ++-- admin/{verson.php => version.php} | 0 admin/zui.chart.php | 2 +- api/index.php | 6 +-- application/bing.php | 76 ++++++++++++++++++++++++++++ application/chart.php | 4 +- application/check.php | 4 +- application/check_admin.inc.php | 2 +- application/footer.php | 20 ++++---- application/function.php | 11 ++-- application/header.php | 24 ++++----- application/hide.php | 2 - application/history.php | 84 +++++++++++++++++++++++++++++++ application/info.php | 20 ++++---- application/list.php | 10 ++-- application/randPic.php | 5 +- application/upload.php | 2 +- config/config.php | 53 +++++++++---------- index.php | 12 ++++- install/index.php | 2 +- install/install.php | 2 +- public/static/EasyImage.js | 63 ++++++++++++++++++++--- 24 files changed, 334 insertions(+), 118 deletions(-) rename admin/{verson.php => version.php} (100%) create mode 100644 application/bing.php create mode 100644 application/history.php diff --git a/README.md b/README.md index 0a535de..183e326 100755 --- a/README.md +++ b/README.md @@ -231,11 +231,14 @@ $HTTP["url"] =~ "^/(i|public)/" {
点击查看2.0版更新日志 -* 2023-01-30 v2.7.0 dev +* 2023-01-31 v2.7.0 dev + +- 增加上传历史记录 - 增加粘贴上传状态 - 增加广场非图片图标 - 增加前端显示缩略图链接 -- 增加图片详细信息登录后显示更多信息 +- 增加每日获取Bing图片背景 +- 增加图片详细信息管理登录后显示更多信息 - 修复图片详细信息中随机图片排版混乱 - 替换访问生成缩略图代码 - 更新一些组件 diff --git a/admin/admin.inc.php b/admin/admin.inc.php index ba6d3ea..ab51774 100755 --- a/admin/admin.inc.php +++ b/admin/admin.inc.php @@ -830,8 +830,8 @@ if (isset($_GET['recycle_reimg'])) { ZUI Verot Tinyfilemanager - - + + GPL-2.0 @@ -888,12 +888,16 @@ if (isset($_GET['recycle_reimg'])) { > -
>
+
+ + > + +
> @@ -1312,25 +1316,25 @@ if (isset($_GET['recycle_reimg'])) { cols: [{ name: 'id', label: 'ID', - width: 0.02 + width: 0.05 }, { name: 'token', label: 'Token', html: true, - width: 0.28 + width: 0.25 }, { name: 'add_time', label: '添加时间', html: true, - width: 0.2 + width: 0.15 }, { name: 'expired', label: '有效期至', html: true, - width: 0.2 + width: 0.15 }, { name: 'number', @@ -1342,7 +1346,7 @@ if (isset($_GET['recycle_reimg'])) { name: 'manage', label: '管理', html: true, - width: 0.25 + width: 0.3 }, ], array: [ @@ -1350,7 +1354,7 @@ if (isset($_GET['recycle_reimg'])) { $expired = $value['expired'] < time() ? '

已过期

' : '

' . date('Y-m-d H:i:s', $value['expired']) . '

'; ?> { id: '', token: '', - add_time: '', + add_time: '', expired: '', number: , manage: "' target='_blank' class='btn btn-mini btn-success '>文件 禁用 删除 ' class='btn btn-mini btn-primary '>删除上传" @@ -1393,20 +1397,20 @@ if (isset($_GET['recycle_reimg'])) { label: '密码(md5)', name: 'password', html: true, - width: 0.1 + width: 0.2 }, { label: '添加时间', name: 'add_time', html: true, - width: 0.2 + width: 0.15 }, { label: '有效期至', name: 'expired', html: true, - width: 0.2 + width: 0.15 }, { label: '上传数量', @@ -1427,7 +1431,7 @@ if (isset($_GET['recycle_reimg'])) { $expired = $v['expired'] < time() ? '

已过期

' : '

' . date('Y-m-d H:i:s', $v['expired']) . '

'; ?> { guest: '', password: '', - add_time: '', + add_time: '', expired: '', files: , manage: "'>文件 禁用 删除 ' href='admin.inc.php?delDir='>删除上传", diff --git a/admin/chart.php b/admin/chart.php index f834e7f..d5e613b 100755 --- a/admin/chart.php +++ b/admin/chart.php @@ -5,14 +5,9 @@ require_once '../application/header.php'; require_once APP_ROOT . '/application/chart.php'; -// 检测是否开启统计 -if (!$config['chart_on']) exit(header('Location: ' . $config['domain'] . '?chart#closed')); +// 检测登录和是否开启统计 +if (!$config['chart_on'] && !is_who_login('admin')) exit(header('Location: ' . $config['domain'] . '?hart#closed')); -// 检测登录 -if (!is_who_login('admin')) { - checkLogin(); - exit(require_once APP_ROOT . '/application/footer.php'); -} // 删除统计文件 if (isset($_POST['del_total'])) { @deldir($_POST['del_total']); @@ -127,7 +122,7 @@ if (is_array($char_data)) {
当前版本
- +
diff --git a/admin/verson.php b/admin/version.php similarity index 100% rename from admin/verson.php rename to admin/version.php diff --git a/admin/zui.chart.php b/admin/zui.chart.php index 1cbe9a4..b5f214d 100755 --- a/admin/zui.chart.php +++ b/admin/zui.chart.php @@ -120,7 +120,7 @@ if (is_array($char_data)) {
当前版本
- +
diff --git a/api/index.php b/api/index.php index 131e4d6..015555d 100755 --- a/api/index.php +++ b/api/index.php @@ -160,10 +160,10 @@ if ($handle->uploaded) { "result" => "failed", "code" => 206, "message" => $handle->error, - // 'up_log' => $handle->log,(仅用作调试用) - + // 'log' => $handle->log,(仅用作调试用) ); - + unset($handle); + header('Content-Type:application/json; charset=utf-8'); exit(json_encode($reJson, JSON_UNESCAPED_UNICODE)); } diff --git a/application/bing.php b/application/bing.php new file mode 100644 index 0000000..aae74d3 --- /dev/null +++ b/application/bing.php @@ -0,0 +1,76 @@ + $imgurl, "copyright" => $copyright, "startdate" => $startdate, + "fullstartdate" => $fullstartdate, "enddate" => $enddate, "urlbase" => $urlbase, + "copyrightlink" => $copyrightlink, "quiz" => $quiz, "wp" => $wp, + "hsh" => $hsh, "drk" => $drk, "top" => $top, "bot" => $bot + ); //将相关信息放进数组中 + fwrite($handle, json_encode($tempArr) . "\r\n"); //最终以json格式保存在文本文档中 + fclose($handle); + } + */ +} +/** + * 远程抓取图片并保存 + * @param $url 图片url + * @param $filename 保存名称和路径 + */ +function grabImage($url, $filename = "") +{ + if ($url == "") return false; //如果$url地址为空,直接退出 + if ($filename == "") //如果没有指定新的文件名 + { + $ext = strrchr($url, "."); //得到$url的图片格式 + $filename = date("Ymd") . $ext; //用天月面时分秒来命名新的文件名 + } + ob_start(); //打开输出 + readfile($url); //输出图片文件 + $img = ob_get_contents(); //得到浏览器输出 + ob_end_clean(); //清除输出并关闭 + $size = strlen($img); //得到图片大小 + $fp2 = @fopen($filename, "a"); + fwrite($fp2, $img); //向当前目录写入图片文件,并重新命名 + fclose($fp2); + return $filename; //返回新的文件名 +} + +header("Content-type: image/jpeg"); +exit(file_get_contents($path . $filename, true)); diff --git a/application/chart.php b/application/chart.php index 8825323..7fb50db 100755 --- a/application/chart.php +++ b/application/chart.php @@ -2,9 +2,7 @@ require_once __DIR__ . '/function.php'; require_once __DIR__ . '/total_files.php'; -/** - * 统计最近一个月上传文件数与空间占用 - */ +/** 统计最近一个月上传文件数与空间占用 */ // 获取最近一周,一个月,一年 https://www.cnblogs.com/-mrl/p/7680700.html function getLatelyTime($type = '') diff --git a/application/check.php b/application/check.php index eba637f..ce96793 100755 --- a/application/check.php +++ b/application/check.php @@ -4,9 +4,7 @@ require_once __DIR__ . '/function.php'; if (!is_file(APP_ROOT . '/install/install.lock') and is_file(APP_ROOT . '/install/install.php')) { exit(''); } -/** - * 检测弹窗 - */ +/** 检测弹窗 */ if (file_exists(APP_ROOT . '/admin/EasyIamge.lock')) return; // 查询锁定弹窗文件是否存在 file_put_contents(APP_ROOT . '/admin/EasyIamge.lock', '安装环境检测锁定文件,如需再次展示请删除此文件!', FILE_APPEND | LOCK_EX); ?> diff --git a/application/check_admin.inc.php b/application/check_admin.inc.php index 96a4fe8..947ecff 100755 --- a/application/check_admin.inc.php +++ b/application/check_admin.inc.php @@ -62,7 +62,7 @@ if (file_exists(APP_ROOT . '/.user.ini')) { } // 检查当前版本与GitHub版本 -if (getVersion() !== get_current_verson()) { +if (getVersion() !== get_current_version()) { echo ' diff --git a/application/function.php b/application/function.php index 051af10..7868823 100755 --- a/application/function.php +++ b/application/function.php @@ -1149,7 +1149,7 @@ function get_online_thumbnail($imgUrl) */ function creat_thumbnail_by_list($imgUrl) { - + global $config; ini_set('max_execution_time', '300'); // 脚本运行的时间(以秒为单位)0不限制 @@ -1160,7 +1160,7 @@ function creat_thumbnail_by_list($imgUrl) // 其他格式直接返回指定图标 return '../public/images/file.svg'; } - + switch ($config['thumbnail']) { // 输出原图 case 0: @@ -1173,7 +1173,7 @@ function creat_thumbnail_by_list($imgUrl) } // 将网址图片转换为相对路径 - $pathName = parse_url($imgUrl,PHP_URL_PATH); + $pathName = parse_url($imgUrl, PHP_URL_PATH); // 图片绝对路径 $abPathName = APP_ROOT . $pathName; // 将网址中的/i/去除 @@ -1505,14 +1505,13 @@ function rand_imgurl($text = null) * @return String 内容信息 */ -function get_current_verson($file = '/admin/verson.php') +function get_current_version($file = '/admin/version.php') { $file = APP_ROOT . $file; if (is_file($file)) { - return file_get_contents($file); } - + return 'No Verson File'; } diff --git a/application/header.php b/application/header.php index 1882c71..242cb60 100755 --- a/application/header.php +++ b/application/header.php @@ -29,18 +29,18 @@ diff --git a/application/hide.php b/application/hide.php index 2222107..1d7d3f5 100755 --- a/application/hide.php +++ b/application/hide.php @@ -9,8 +9,6 @@ require_once __DIR__ . '/function.php'; - - if (isset($_GET['key'])) { $hide_original = $_GET['key']; $real_path = APP_ROOT . urlHash($hide_original, 1, crc32($config['hide_key'])); diff --git a/application/history.php b/application/history.php new file mode 100644 index 0000000..b374591 --- /dev/null +++ b/application/history.php @@ -0,0 +1,84 @@ + + + +
+
+
    +
    + +
    +
+
+
+
+
+ + + + + + 原始名称 - + 原始大小 - 上传者IP - + 上传用户 + 是否监黄 - + 上传来源 - + 文件路径 @@ -115,7 +115,7 @@ if ($config['ad_top']) echo $config['ad_top_info']; 查看 刷新 下载 - + 举报 @@ -161,9 +161,7 @@ if ($config['ad_top']) echo $config['ad_top_info'];
- -
@@ -171,7 +169,8 @@ if ($config['ad_top']) echo $config['ad_top_info']; - - + ', 'ad_top'=>0, 'ad_top_info'=>' diff --git a/index.php b/index.php index 1cfdd51..8d5d0d8 100755 --- a/index.php +++ b/index.php @@ -150,8 +150,8 @@ mustLogin(); , responseHandler: function(responseObject, file) { var obj = JSON.parse(responseObject.response); //由JSON字符串转换为JSON对象 - console.log(obj); // 输出log - console.log(file); // 输出log + console.log(file); // 输出上传log + console.log(obj); // 输出回传log if (obj.result === 'success') { document.getElementById("links").innerHTML += obj.url + "\r\n"; document.getElementById("bbscode").innerHTML += "[img]" + obj.url + "[/img]\r\n"; @@ -159,6 +159,7 @@ mustLogin(); document.getElementById("html").innerHTML += '' + obj.srcName + '\r\n'; document.getElementById("thumb").innerHTML += obj.thumb + "\r\n"; document.getElementById("del").innerHTML += obj.del + "\r\n"; + new $.zui.Messager(obj.srcName + "上传成功", { type: "primary", // 定义颜色主题 placement: 'bottom-right', @@ -167,6 +168,13 @@ mustLogin(); } else { return '上传失败,错误信息:' + obj.message; } + + try { // 储存上传历史 + console.log('localStorage ok!'); + $.zui.store.set(obj.srcName, obj) + } catch (err) { + console.log('localStorage failed:' + err); + } } }); diff --git a/install/index.php b/install/index.php index 12299c7..a0bdf56 100755 --- a/install/index.php +++ b/install/index.php @@ -191,7 +191,7 @@ function checkPASS($name)
EasyImage By - Icret Version: + Icret Version: diff --git a/install/install.php b/install/install.php index f4603d0..e6cd959 100755 --- a/install/install.php +++ b/install/install.php @@ -181,7 +181,7 @@ if ($state !== 'checked') { EasyImage By - Icret Version: + Icret Version: diff --git a/public/static/EasyImage.js b/public/static/EasyImage.js index a668a1f..533d131 100755 --- a/public/static/EasyImage.js +++ b/public/static/EasyImage.js @@ -232,9 +232,60 @@ $('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('clic }); })(); -/** 导航状态 */ -$('.nav-pills').find('a').each(function () { - if (this.href == document.location.href) { - $(this).parent().addClass('active'); // this.className = 'active'; - } -}); \ No newline at end of file +/** javascript parseUrl函数解析url获取网址url参数 + * https://www.cnblogs.com/lazb/p/10144471.html +*/ + +function parseURL(url) { + var a = document.createElement('a'); + a.href = url; + return { + source: url, + protocol: a.protocol.replace(':', ''), + host: a.hostname, + port: a.port, + query: a.search, + params: (function () { + var ret = {}, + seg = a.search.replace(/^\?/, '').split('&'), + len = seg.length, i = 0, s; + for (; i < len; i++) { + if (!seg[i]) { continue; } + s = seg[i].split('='); + ret[s[0]] = s[1]; + } + return ret; + })(), + file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1], + hash: a.hash.replace('#', ''), + path: a.pathname.replace(/^([^\/])/, '/$1'), + relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1], + segments: a.pathname.replace(/^\//, '').split('/') + }; +} + +/** +使用实例: +var myURL = parseURL('http://abc.com:8080/dir/index.html?id=255&m=hello#top'); +myURL.file; // = 'index.html' +myURL.hash; // = 'top' +myURL.host; // = 'abc.com' +myURL.query; // = '?id=255&m=hello' +myURL.params; // = Object = { id: 255, m: hello } +myURL.path; // = '/dir/index.html' +myURL.segments; // = Array = ['dir', 'index.html'] +myURL.port; // = '8080' +myURL.protocol; // = 'http' +myURL.source; // = 'http://abc.com:8080/dir/index.html?id=255&m=hello#top' +*/ + + +/** jQuery 读取文件 readTxt('../admin/version.php'); */ +function readTxt(filePath) { + $.get(filePath, function (data) { + var lines = data.split("\n"); //按行读取 + $.each(lines, function (i, v) { + console.log(v); + }); + }); +} \ No newline at end of file