* 增加上传历史记录

* 2023-01-31 v2.7.0 dev

- 增加上传历史记录
- 增加粘贴上传状态
- 增加广场非图片图标
- 增加前端显示缩略图链接
- 增加每日获取Bing图片背景
- 增加图片详细信息管理登录后显示更多信息
- 修复图片详细信息中随机图片排版混乱
- 替换访问生成缩略图代码
- 更新一些组件
- 优化代码
pull/141/head
icret 2023-01-31 00:05:15 +08:00
parent c0dee49656
commit 4dd2c30455
24 changed files with 334 additions and 118 deletions

View File

@ -231,11 +231,14 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary>点击查看2.0版更新日志</summary>
* 2023-01-30 v2.7.0 dev
* 2023-01-31 v2.7.0 dev
- 增加上传历史记录
- 增加粘贴上传状态
- 增加广场非图片图标
- 增加前端显示缩略图链接
- 增加图片详细信息登录后显示更多信息
- 增加每日获取Bing图片背景
- 增加图片详细信息管理登录后显示更多信息
- 修复图片详细信息中随机图片排版混乱
- 替换访问生成缩略图代码
- 更新一些组件

View File

@ -830,8 +830,8 @@ if (isset($_GET['recycle_reimg'])) {
<a href="https://www.openzui.com/" target="_blank"><span class="label label-badge label-success" data-toggle="tooltip" title="前端框架">ZUI</span></a>
<a href="https://github.com/verot/class.upload.php" target="_blank"><span class="label label-badge label-success" data-toggle="tooltip" title="图像处理类">Verot</span></a>
<a href="https://tinyfilemanager.github.io/" target="_blank"><span class="label label-badge label-success" data-toggle="tooltip" title="文件管理">Tinyfilemanager</span></a>
<span class="label label-badge label-success" data-toggle="tooltip" title="当前版本"><?php echo get_current_verson(); ?></span>
<?php if (getVersion() !== get_current_verson()) : ?>
<span class="label label-badge label-success" data-toggle="tooltip" title="当前版本"><?php echo get_current_version(); ?></span>
<?php if (getVersion() !== get_current_version()) : ?>
<a href="#NewVersion" data-toggle="collapse" class="label label-badge label-warning" title="Github有更新"><?php echo getVersion(); ?></span><i class="icon icon-angle-down"></i></a>
<?php endif; ?>
<a href="https://github.com/icret/EasyImages2.0/blob/master/LICENSE" target="_blank"><span class="label label-badge" data-toggle="tooltip" title="许可证">GPL-2.0</span></a>
@ -888,12 +888,16 @@ if (isset($_GET['recycle_reimg'])) {
<input type="checkbox" name="showSwitch" value="1" <?php if ($config['showSwitch']) echo 'checked="checked"'; ?>>
<label style="font-weight: bold">广场</label>
</div>
<div class="switch switch-inline" data-toggle="tooltip" title="广场图片详细信息按钮">
<input type="hidden" name="show_exif_info" value="0">
<input type="checkbox" name="show_exif_info" value="1" <?php if ($config['show_exif_info']) echo 'checked="checked"'; ?>>
<label style="font-weight: bold">详情页</label>
</div>
<div class="switch switch-inline" data-toggle="tooltip" title="非上传记录|清空缓存|浏览器版本低不显示">
<input type="hidden" name="history" value="0">
<input type="checkbox" name="history" value="1" <?php if ($config['history']) echo 'checked="checked"'; ?>>
<label style="font-weight: bold">历史记录</label>
</div>
<div class="switch switch-inline" data-toggle="tooltip" title="图片详细信息显示随机图片">
<input type="hidden" name="info_rand_pic" value="0">
<input type="checkbox" name="info_rand_pic" value="1" <?php if ($config['info_rand_pic']) echo 'checked="checked"'; ?>>
@ -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() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y-m-d H:i:s', $value['expired']) . '</p>'; ?> {
id: '<?php echo $value['id']; ?>',
token: '<input class="form-control input-sm" type="text" value="<?php echo $key; ?>" readonly>',
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']); ?>',
expired: '<?php echo $expired; ?>',
number: <?php echo get_file_by_glob(APP_ROOT . $config['path'] . $value['id'], $type = 'number'); ?>,
manage: "<a href='/admin/manager.php?p=<?php echo $value['id']; ?>' target='_blank' class='btn btn-mini btn-success <?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>"
@ -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() ? '<p class="text-gray">已过期</p>' : '<p class="text-green">' . date('Y-m-d H:i:s', $v['expired']) . '</p>'; ?> {
guest: '<?php echo $k; ?>',
password: '<input class="form-control input-sm" type="text" value="<?php echo $v['password']; ?>" readonly>',
add_time: '<?php echo date('Y年m月d日 H:i:s', $v['add_time']); ?>',
add_time: '<?php echo date('Y-m-d H:i:s', $v['add_time']); ?>',
expired: '<?php echo $expired; ?>',
files: <?php echo get_file_by_glob(APP_ROOT . $config['path'] . $k, $type = 'number'); ?>,
manage: "<a href='/admin/manager.php?p=<?php echo $k; ?>' target='_blank' class='btn btn-mini btn-success <?php if (!$config['guest_path_status']) echo 'disabled'; ?>'>文件</a> <a href='admin.inc.php?stop_guest=<?php echo $k; ?>' class='btn btn-mini btn-danger'>禁用</a> <a class='btn btn-mini btn-danger' href='admin.inc.php?delete_guest=<?php echo $k; ?>'>删除</a> <a class='btn btn-mini btn-primary <?php if (!$config['guest_path_status']) echo 'disabled'; ?>' href='admin.inc.php?delDir=<?php echo $k; ?>'>删除上传</a>",

View File

@ -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)) {
<div class="col-xs-3 alert alert-primary autoshadow">
当前版本
<hr />
<?php echo get_current_verson(); ?>
<?php echo get_current_version(); ?>
</div>
</div>
<div class="col-md-12 col-xs-12">

View File

@ -120,7 +120,7 @@ if (is_array($char_data)) {
<div class="col-xs-3 alert alert-primary autoshadow">
当前版本
<hr />
<?php echo get_current_verson(); ?>
<?php echo get_current_version(); ?>
</div>
</div>
<div class="col-md-12 col-xs-12">

View File

@ -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));
}

76
application/bing.php Normal file
View File

@ -0,0 +1,76 @@
<?php
/**
* php抓取bing每日图片并保存到服务器
* 作者mengkun (mkblog.cn)
* 日期2016/12/23
* 修改Icret
* 修改日期2023-01-30
*/
include_once '../config/config.php';
$path = __DIR__ . '/..' . $config['path'] . $config['delDir']; // 设置图片缓存文件夹
$filename = date("Ymd") . '.jpg'; // 用年月日来命名新的文件名
if (!file_exists($path . $filename)) // 如果文件不存在,则说明今天还没有进行缓存
{
if (!file_exists($path)) //如果目录不存在
{
mkdir($path, 0777); //创建缓存目录
}
$str = file_get_contents('http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'); //读取必应api获得相应数据
$str = json_decode($str, true);
$imgurl = 'http://cn.bing.com' . $str['images'][0]['url']; //获取图片url
$img = grabImage($imgurl, $path . $filename); //读取并保存图片
/*
$handle = fopen("dat.txt", "a"); //用于存放图片信息,如果不需要保存图片的相关信息,可以把下面这些去掉。
if ($handle) {
$copyright = $str['images'][0]['copyright']; //说明
$startdate = $str['images'][0]['startdate'];
$fullstartdate = $str['images'][0]['fullstartdate'];
$enddate = $str['images'][0]['enddate'];
$urlbase = $str['images'][0]['urlbase'];
$copyrightlink = $str['images'][0]['copyrightlink'];
$quiz = $str['images'][0]['quiz'];
$wp = $str['images'][0]['wp'];
$hsh = $str['images'][0]['hsh'];
$drk = $str['images'][0]['drk'];
$top = $str['images'][0]['top'];
$bot = $str['images'][0]['bot'];
$tempArr = array(
"imgurl" => $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));

View File

@ -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 = '')

View File

@ -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('<script type="text/javascript">window.location.href="' . get_whole_url('/') . '/install/index.php"</script>');
}
/**
* 检测弹窗
*/
/** 检测弹窗 */
if (file_exists(APP_ROOT . '/admin/EasyIamge.lock')) return; // 查询锁定弹窗文件是否存在
file_put_contents(APP_ROOT . '/admin/EasyIamge.lock', '安装环境检测锁定文件,如需再次展示请删除此文件!', FILE_APPEND | LOCK_EX);
?>

View File

@ -62,7 +62,7 @@ if (file_exists(APP_ROOT . '/.user.ini')) {
}
// 检查当前版本与GitHub版本
if (getVersion() !== get_current_verson()) {
if (getVersion() !== get_current_version()) {
echo '
<script>
new $.zui.Messager("当前版本与GitHub不一致,请检查当前是否最新版本!",{

View File

@ -47,11 +47,10 @@ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?>
<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']) : ?>
<a id="dark" data-toggle="tooltip" title="暗黑模式"><i class="icon icon-lightbulb" id="dark_ico"></i></a>
<?php endif;
// 登录与退出
if (is_who_login('admin') || is_who_login('guest')) : ?>
<?php endif; ?>
<?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>
<? else : ?>
<?php else : ?>
<a href="<?php echo $config['domain']; ?>/admin/index.php" data-toggle="tooltip" title="账号登录"><i class="icon icon-user"></i></a>
<?php endif; ?>
</p>
@ -98,20 +97,21 @@ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?>
moveable: "inside",
rememberPos: true,
scrollInside: true
}).on('hidden.zui.modal', function() {
// 只有用户手动关闭才会存储cookie,避免不看公告直接刷新
document.cookie = "noticed = 1";
console.log('网站公告已显示完毕')
})
}
<?php endif;
/** 简繁转换 */ if ($config['language'] == 1) : ?>
<?php endif; ?>
<?php /** 简繁转换 */ if ($config['language'] == 1) : ?>
$.getScript("<?php static_cdn(); ?>/public/static/i18n/jquery.s2t.js", function() { //加载成功后,并执行回调函数
$('*').s2t();
});
<?php endif;
/** 暗黑模式 */ if ($config['dark-mode']) : ?>
<?php endif; ?>
<?php /** 暗黑模式 */ if ($config['dark-mode']) : ?>
// cookie 操作封装 https://www.jb51.net/article/94456.htm
var cookieUtil = {
// 设置cookie
@ -192,7 +192,7 @@ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?>
});
// console
console.log("%cEasyImage<?php echo get_current_verson(); ?>", "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;', '');
</script>
</body>

View File

@ -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';
}

View File

@ -29,18 +29,18 @@
<div class="page-header">
<ul class="nav nav-pills">
<li><a href="<?php echo $config['domain']; ?>"><i class="icon icon-home"></i> 首页</a></li>
<?php // 关闭广场非登录状态不显示广场导航
if ($config['showSwitch'] || is_who_login('admin')) echo '
<li><a href="' . $config['domain'] . '/application/list.php"><i class="icon icon-th"></i> 广场<span class="label label-badge label-primary">' . get_file_by_glob(APP_ROOT . config_path(), 'number') . '</span></a></li>';
// 登陆状态显示设置页面
if (is_who_login('admin')) {
echo '
<li><a href="' . $config['domain'] . '/admin/admin.inc.php' . '"><i class="icon icon-cogs"></i> 设置</a></li>';
// 登陆状态下开启统计页面与导航
if ($config['chart_on']) echo '
<li><a href="' . $config['domain'] . '/admin/chart.php' . '"><i class="icon icon-pie-chart"></i> 统计</a>
</li>';
} ?>
<?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>
<?php endif; ?>
<?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>
<?php endif; ?>
<?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>
<?php endif; ?>
<?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>
<?php endif; ?>
</ul>
</div>

View File

@ -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']));

84
application/history.php Normal file
View File

@ -0,0 +1,84 @@
<?php
include_once __DIR__ . "/header.php";
?>
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/EasyImage.css">
<link rel="stylesheet" href="<?php static_cdn(); ?>/public/static/viewjs/viewer.min.css">
<div class="row">
<div class="col-md-12">
<ul id="viewjs">
<div class="cards listNum">
<!-- 历史上传列表 -->
</div>
</ul>
</div>
</div>
<div class="col-md-12 history_clear">
</div>
<script src="<?php static_cdn(); ?>/public/static/EasyImage.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/lazyload/lazyload.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>
if ($.zui.store.length() > 0) {
$.zui.store.forEach(function(key, value) { // 遍历所有本地存储的条目
console.log('saved: ' + $.zui.store.length())
console.log('url list: ' + value['url'])
if (value['url'] !== undefined) {
let v_url = parseURL(value['url']); // 获取链接路径 console.log(parseURL(value['url']).path);
$('.listNum').append('<div class="col-md-4 col-sm-6 col-lg-3"><div class="card"><li><img src="../public/images/loading.svg" data-image="' + value['thumb'] + '" data-original="" alt="简单图床-EasyImage"></li><div class="bottom-bar"><a href="' + value['url'] + '" target="_blank"><i class="icon icon-picture" data-toggle="tooltip" title="打开" style="margin-left:10px;"></i></a><a href="#" class="copy" data-clipboard-text="' + value['url'] + '" data-toggle="tooltip" title="复制" style="margin-left:10px;"><i class="icon icon-copy"></i></a><a href="info.php?img=' + v_url.path + '" data-toggle="tooltip" title="信息" target="_blank" style="margin-left:10px;"><i class="icon icon-info-sign"></i></a><a href="down.php?dw=' + v_url.path + '" data-toggle="tooltip" title="下载" target="_blank" style="margin-left:10px;"><i class="icon icon-cloud-download"></i></a><a href="' + value['del'] + '" target="_blank"><i class="icon icon-trash" data-toggle="tooltip" title="删除" style="margin-left:10px;"></i></a><a href="#" data-toggle="tooltip" title="文件名" class="copy text-ellipsis" data-clipboard-text="' + value['srcName'] + '" style="margin-left:10px;">' + value['srcName'] + '</a></div></div></div>')
}
})
$('.history_clear').append('<h3 class="header-dividing" style="text-align: center;" data-toggle="tooltip" title="非上传记录|清空缓存|浏览器版本低不显示<br/>点击清空历史上传记录"><button class="btn btn-mini btn-primary" type="button"><i class="icon icon-eye-close"></i> 历史上传记录</button></h3>');
} else {
$('.listNum').append('<h2 class="alert alert-danger">上传历史记录不存在~~ <br /><small>非上传记录 | 清空缓存 | 浏览器版本低不显示~!</small></h2>');
};
// 清空所有本地存储的条目
$('button').on('click', function() {
new $.zui.Messager('已清空' + $.zui.store.length() + "条历史记录", {
type: "success", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
$.zui.store.clear(); // 清空上传记录
setTimeout(location.reload.bind(location), 2000); // 延迟2秒刷新
})
// viewjs
new Viewer(document.getElementById('viewjs'), {
url: 'data-original',
});
// 复制url
var clipboard = new Clipboard('.copy');
clipboard.on('success', function(e) {
new $.zui.Messager("复制成功", {
type: "success", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
});
clipboard.on('error', function(e) {
document.querySelector('.copy');
new $.zui.Messager("复制失败", {
type: "danger", // 定义颜色主题
icon: "exclamation-sign" // 定义消息图标
}).show();
});
//懒加载
var lazy = new Lazy({
onload: function(elem) {
console.log(elem)
},
delay: 300
})
// 更改网页标题
document.title = "上传记录 - <?php echo $config['title']; ?>"
</script>
<?php
/** 引入底部 */
require_once APP_ROOT . '/application/footer.php';

View File

@ -1,7 +1,7 @@
<?php
include_once __DIR__ . "/header.php";
if (!$config['show_exif_info']) 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'])) {
@ -82,23 +82,23 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<?php if (is_who_login('admin')) : ?>
<tr class="text-primary">
<td>原始名称</td>
<td> <?php echo pathinfo($logs[$logsName]['source'], PATHINFO_FILENAME); ?></td>
<td> <?php echo pathinfo($logs[$logsName]['source'], PATHINFO_BASENAME); ?></td>
</tr>
<tr class="text-primary">
<td>原始大小</td>
<td><?php echo $logs[$logsName]['size']; ?></td>
</tr>
<tr class="text-primary">
<td>上传者IP</td>
<td><?php echo $logs[$logsName]['ip']; ?></td>
<td>上传用户</td>
<td><?php echo $logs[$logsName]['ip'] . ':' . $logs[$logsName]['port']; ?></td>
</tr>
<tr class="text-primary">
<td>是否监黄</td>
<td><?php echo $logs[$logsName]['checkImg']; ?></td>
<td><?php if ($logs[$logsName]['checkImg'] == 'OFF') {echo "关闭";} else {echo '开启';} ?></td>
</tr>
<tr class="text-primary">
<td>上传来源</td>
<td><?php echo $logs[$logsName]['from']; ?></td>
<td><?php if ($logs[$logsName]['from'] == 'web') {echo "通过网页";} else {echo '通过API';} ?></td>
</tr>
<tr class="text-primary">
<td>文件路径</td>
@ -115,7 +115,7 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<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="/application/down.php?dw=<?php echo $getIMG; ?>" target="_blank"><i class="icon icon-cloud-download"> 下载</i></a>
<?php if (isset($config['report'])) : ?>
<?php if (isset($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>
<?php endif; ?>
<?php if (is_who_login('admin')) : ?>
@ -161,9 +161,7 @@ if ($config['ad_top']) echo $config['ad_top_info'];
</div>
</div>
</div>
<? /** 底部广告 */ if ($config['ad_bot']) echo $config['ad_bot_info']; ?>
<!-- 随机图片 -->
<?php if ($config['info_rand_pic']) : ?>
<div class="col-md-12" style="padding-bottom: 10px;">
@ -171,7 +169,8 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<div class="cards cards-borderless">
<?php if (is_file(APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php')) :
include_once APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php';
for ($i = 0; $i <= 7; $i++) : $randName = array_rand($logs, 1) // echo $img_url . $logs[$randName]['path'];
for ($i = 0; $i <= 7; $i++) : $randName = array_rand($logs, 1)
/** echo $img_url . $logs[$randName]['path']; */
?>
<div class="col-md-4 col-sm-6 col-lg-3">
<a class="card" href="?img=<?php echo $logs[$randName]['path']; ?>" target="_blank">
@ -186,7 +185,6 @@ if ($config['ad_top']) echo $config['ad_top_info'];
</div>
</div>
<?php endif; ?>
<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>

View File

@ -11,8 +11,8 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<?php
if (!$config['showSwitch'] && !is_who_login('admin')) : ?>
<div class="alert alert-info">管理员关闭了预览哦~~</div>
<?php exit(require_once __DIR__ . '/footer.php');
else :
<?php exit(require_once __DIR__ . '/footer.php'); ?>
<?php else :
// $path = isset($_GET['date']) ? $_GET['date'] : date('Y/m/d/'); // 获取指定目录
/* 限制GET浏览日期 有助于防止爬虫*/
$listDate = $config['listDate']; // 配置限制日期
@ -67,7 +67,9 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<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="#" 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="/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>
<?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>
<?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>
<?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>
@ -187,7 +189,7 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<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/datetimepicker/datetimepicker.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/holder.min.js"></script>
<!-- <script type="application/javascript" src="< php static_cdn(); ?>/public/static/holder.min.js"></script> -->
<script>
// viewjs
new Viewer(document.getElementById('viewjs'), {

View File

@ -1,10 +1,11 @@
<?php
/**
* 2023-01-29
* 随机图片显示
*/
$img_array = glob('../public/images/*.{gif,jpg,png,jpeg,webp,bmp}', GLOB_BRACE);
if(count($img_array) == 0) die('没找到图片文件。请先上传一些图片到 '.dirname(__FILE__).'/images/ 文件夹');
if (count($img_array) == 0) die('没找到图片文件。请先上传一些图片到 ' . dirname(__FILE__) . '/images/ 文件夹');
header('Content-Type: image/png');
echo(file_get_contents($img_array[array_rand($img_array)]));
echo (file_get_contents($img_array[array_rand($img_array)]));

View File

@ -180,7 +180,7 @@ 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');

View File

@ -4,22 +4,22 @@ $config=Array
'title'=>'简单图床 - EasyImage',
'keywords'=>'简单图床,easyimage,easyimage2.0,无数据库图床,免费图床,PHP多图长传程序,自适应页面,一键复制链接,HTML5,markdown,bbscode',
'description'=>'简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序,最新html5自适应页面兼容手机电脑,上传后返回图片直链,markdown图片,论坛贴图bbscode链接,简单方便支持一键复制,支持多域名,api上传',
'tips'=>'<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-github"> 如果你喜欢这种图床风格就下载喔 (๑•̀ㅂ•́)و✧</i></a>
<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-heart"> 简单图床是一款开源图床, 支持多文件上传无数据库</i></a>
'tips'=>'<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-github"> 如果你喜欢这种图床风格就下载喔 (๑•̀ㅂ•́)و✧</i></a>
<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-heart"> 简单图床是一款开源图床, 支持多文件上传无数据库</i></a>
<a><li class="icon icon-bullhorn text-muted"> 单文件≤10M,单次上传≤30张</li></a>',
'notice_status'=>0,
'notice'=>'<p>简单图床是一款开源图床, 支持多文件上传无数据库;</p>
'notice'=>'<p>简单图床是一款开源图床, 支持多文件上传无数据库;</p>
<p>如果你喜欢这种图床风格就<a href="https://github.com/icret/EasyImages2.0" target="_black">下载</a> (๑•̀ㅂ•́)و✧</p>',
'set_notice'=>'<div class="alert alert-primary alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button>
<h5>目录保存以 /// 递进,非必要请勿修改! 否则会导致部分操作不可用;</h5>
<h5>本人仅为程序开源创作,如遇非法网站使用与本人无关,请勿用于商业用途;</h5>
<h5>作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中源作者信息。</h5>
<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://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://s2.loli.net/2023/01/20/laTuceHD3qjpd82.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;"><i class="icon icon-wechat"></i> 打赏作者</a>
<a href="https://s2.loli.net/2023/01/20/rREU1dJk9HMxDFA.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini hidden-xs inline-block" style="color:#1970fc;"><i class="icon icon-zhifubao"></i> 打赏作者</a>
'set_notice'=>'<div class="alert alert-primary alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button>
<h5>目录保存以 /// 递进,非必要请勿修改! 否则会导致部分操作不可用;</h5>
<h5>本人仅为程序开源创作,如遇非法网站使用与本人无关,请勿用于商业用途;</h5>
<h5>作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中源作者信息。</h5>
<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://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://s2.loli.net/2023/01/20/laTuceHD3qjpd82.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;"><i class="icon icon-wechat"></i> 打赏作者</a>
<a href="https://s2.loli.net/2023/01/20/rREU1dJk9HMxDFA.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini hidden-xs inline-block" style="color:#1970fc;"><i class="icon icon-zhifubao"></i> 打赏作者</a>
</div>',
'domain'=>'http://127.0.0.1',
'imgurl'=>'http://127.0.0.1',
@ -67,6 +67,7 @@ $config=Array
'moderatecontent_key'=>'',
'nsfwjs_url'=>'',
'showSwitch'=>1,
'history'=>1,
'showSort'=>1,
'listNumber'=>20,
'listDate'=>10,
@ -99,7 +100,7 @@ $config=Array
9=>'month'
),
'language'=>0,
'login_bg'=>'https://img.paulzzh.com/touhou/random',
'login_bg'=>'../application/bing.php',
'report'=>'',
'image_recycl'=>1,
'tinyfilemanager'=>1,
@ -111,18 +112,18 @@ $config=Array
'guest_path_status'=>0,
'token_path_status'=>0,
'admin_path'=>'u',
'update'=>'2023-01-30 06:40:54',
'footer'=>'<a href="https://github.com/icret/EasyImages2.0" target="_blank" rel="nofollow" data-toggle="tooltip" title="Since 2018 - Github">© Since 2018</a>
<a href="https://png.cm/" target="_blank" data-toggle="tooltip" title="EasyImage 简单图床">EasyImage</a>
<a href="/admin/terms.php" target="_blank" data-toggle="tooltip" title="使用协议">DMCA</a>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c790ac2bdc2f385757ecd0183206108d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
'update'=>'2023-01-30 23:08:30',
'footer'=>'<a href="https://github.com/icret/EasyImages2.0" target="_blank" rel="nofollow" data-toggle="tooltip" title="Since 2018 - Github">© Since 2018</a>
<a href="https://png.cm/" target="_blank" data-toggle="tooltip" title="EasyImage 简单图床">EasyImage</a>
<a href="/admin/terms.php" target="_blank" data-toggle="tooltip" title="使用协议">DMCA</a>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c790ac2bdc2f385757ecd0183206108d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>',
'ad_top'=>0,
'ad_top_info'=>' <!--广告 按照这个范例替换相应链接,如果想多几个广告,就多复制几个-->

View File

@ -150,8 +150,8 @@ mustLogin();
<?php echo imgRatio(); ?>,
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 += '<img src="' + obj.url + '" alt="' + 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);
}
}
});
</script>

View File

@ -191,7 +191,7 @@ function checkPASS($name)
</div>
<?php echo 'Copyright © 2018-' . date('Y'); ?>
<a href="https://png.cm/" target="_blank">EasyImage</a> By
<a href="https://blog.png.cm/902.html" target="_blank">Icret</a> Version:<a href="https://github.com/icret/EasyImages2.0" target="_blank"><?php echo get_current_verson(); ?></a>
<a href="https://blog.png.cm/902.html" target="_blank">Icret</a> Version:<a href="https://github.com/icret/EasyImages2.0" target="_blank"><?php echo get_current_version(); ?></a>
</footer>
</body>

View File

@ -181,7 +181,7 @@ if ($state !== 'checked') {
</div>
<?php echo 'Copyright © 2018-' . date('Y'); ?>
<a href="https://png.cm/" target="_blank">EasyImage</a> By
<a href="https://blog.png.cm/902.html" target="_blank">Icret</a> Version:<a href="https://github.com/icret/EasyImages2.0" target="_blank"><?php echo get_current_verson(); ?></a>
<a href="https://blog.png.cm/902.html" target="_blank">Icret</a> Version:<a href="https://github.com/icret/EasyImages2.0" target="_blank"><?php echo get_current_version(); ?></a>
</footer>
</body>

View File

@ -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';
}
});
/** javascript parseUrlurlurl
* 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);
});
});
}