修复粘贴上传

pull/18/head 2.4.3
icret 2021-11-17 22:01:01 +08:00
parent 586bd059ed
commit f1d7fcb7d4
14 changed files with 279 additions and 3844 deletions

View File

@ -68,6 +68,7 @@ RewriteRule config/(.*).(php)$ [F]
* 2021-11-17 v2.4.3
- 增加登录验证码
- 修复粘贴上传不显示删除连接
* 2021-11-14 v2.4.2
- 增加上传日志

View File

@ -108,9 +108,9 @@ if (is_array($char_data)) {
<canvas id="myChart" width="1080" height="200"></canvas>
</div>
</div>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/chart/zui.chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.4.0/public/static/zui/lib/chart/zui.chart.min.js"></script>
<!--[if lt IE 9]>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/chart/excanvas.js"></script>
<script src="https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.4.0/public/static/zui/lib/chart/excanvas.js"></script>
<![endif]-->
<script>
// 文件统计-柱状图

View File

@ -21,9 +21,7 @@ require_once APP_ROOT . '/application/total_files.php';
<link href="<?php static_cdn(); ?>/public/static/nprogress.min.css?v0.2.0" rel="stylesheet">
<script src="<?php static_cdn(); ?>/public/static/zui/lib/jquery/jquery-3.4.1.min.js?v3.4.1"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/js/zui.min.js?v1.9.2"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/uploader/zui.uploader.min.js?v1.9.2"></script>
<script src="<?php static_cdn(); ?>/public/static/qrcode.min.js?v2.0"></script>
<script src="<?php static_cdn(); ?>/public/static/hm.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js?vv1.5.5"></script>
<script src="<?php static_cdn(); ?>/public/static/nprogress.min.js"></script>
<style>

View File

@ -53,9 +53,9 @@ function real_ip()
/**
* 写日志
* 日志格式:图片名称->上传时间(北京时间->IP地址->浏览器信息->文件相对路径->cache文件相对路径
* 日志格式:图片名称->上传时间(Asia/Shanghai->IP地址->浏览器信息->文件相对路径->图片的MD5
*/
function write_log($file, $cacheFile = null)
function write_log($file, $imgMD5)
{
$name = trim(basename($file), " \t\n\r\0\x0B"); // 图片名称
$log = array($name => array(
@ -63,7 +63,7 @@ function write_log($file, $cacheFile = null)
'ip' => real_ip(), // 上传ip
'user_agent' => $_SERVER['HTTP_USER_AGENT'], //浏览器信息
'path' => $file, // 文件相对路径
'cache' => $cacheFile, // 文件缓存相对位置
'md5' => $imgMD5, // 文件缓存相对位置
));
$logFileName = APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php';
@ -74,8 +74,8 @@ function write_log($file, $cacheFile = null)
}
// 写入禁止浏览器直接访问
if (!is_file($logFileName)){
$php_code = '<?php exit;?>';
if (filesize($logFileName)==0){
$php_code = '<?php /** {图片名称{date:上传日期(Asia/Shanghai),ip:上传者IP,user_agent:上传者浏览器信息,path:图片相对路径,md5:图片的MD5}} */ exit;?>';
file_put_contents($logFileName, $php_code);
}

View File

@ -1,52 +1,52 @@
<?php
$config=Array
(
'title'=>'简单图床 - EasyImage',
'keywords'=>'简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制',
'description'=>'简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序最新html5自适应页面兼容手机电脑上传后返回图片直链markdown图片论坛贴图bbscode链接简单方便支持一键复制支持多域名api上传。',
'tips'=>'本站仅做演示用,不定时清理图片单文件≤5M每次上传≤30张',
'domain'=>'http://localhost',
'imgurl'=>'http://localhost',
'password'=>'admin@123',
'mustLogin'=>0,
'apiStatus'=>0,
'path'=>'/i/',
'imgName'=>'default',
'maxSize'=>5242880,
'maxUploadFiles'=>30,
'watermark'=>0,
'waterText'=>'简单图床 - img.545141.com',
'waterPosition'=>0,
'textColor'=>'255,0,0,1',
'textSize'=>16,
'textFont'=>'/public/static/hkxzy.ttf',
'waterImg'=>'/public/images/watermark.png',
'extensions'=>'bmp,jpg,png,tif,gif,pcx,tga,svg,webp,jpeg,tga,svg,ico',
'compress'=>0,
'imgConvert'=>'',
'maxWidth'=>10240,
'maxHeight'=>10240,
'minWidth'=>5,
'minHeight'=>5,
'imgRatio'=>0,
'image_x'=>1000,
'image_y'=>800,
'static_cdn'=>0,
'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0',
'ad_top'=>0,
$config=Array
(
'title'=>'简单图床 - EasyImage',
'keywords'=>'简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制',
'description'=>'简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序最新html5自适应页面兼容手机电脑上传后返回图片直链markdown图片论坛贴图bbscode链接简单方便支持一键复制支持多域名api上传。',
'tips'=>'本站仅做演示用,不定时清理图片单文件≤5M每次上传≤30张',
'domain'=>'http://localhost',
'imgurl'=>'http://localhost',
'password'=>'admin@123',
'mustLogin'=>0,
'apiStatus'=>0,
'path'=>'/i/',
'imgName'=>'default',
'maxSize'=>5242880,
'maxUploadFiles'=>30,
'watermark'=>0,
'waterText'=>'简单图床 - img.545141.com',
'waterPosition'=>0,
'textColor'=>'255,0,0,1',
'textSize'=>16,
'textFont'=>'/public/static/hkxzy.ttf',
'waterImg'=>'/public/images/watermark.png',
'extensions'=>'bmp,jpg,png,tif,gif,pcx,tga,svg,webp,jpeg,tga,svg,ico',
'compress'=>0,
'imgConvert'=>'',
'maxWidth'=>10240,
'maxHeight'=>10240,
'minWidth'=>5,
'minHeight'=>5,
'imgRatio'=>0,
'image_x'=>1000,
'image_y'=>800,
'static_cdn'=>0,
'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0',
'ad_top'=>0,
'ad_top_info'=>' <div id="ad" class="col-md-12" align="center" style="padding:5px;">
<!--广告 按照这个范例替换相应链接,如果想多几个广告,就多复制几个-->
<a href="https://app.cloudcone.com/?ref=3521" target="_blank"><img src="/public/images/ad.jpg" /></a>
</div>
',
'ad_bot'=>0,
',
'ad_bot'=>0,
'ad_bot_info'=>' <div id="ad" class="col-md-12" align="center" style="padding:5px;">
<!--广告 按照这个范例替换相应链接,如果想多几个广告,就多复制几个-->
<a href="https://app.cloudcone.com/?ref=3521" target="_blank"><img src="/public/images/ad.jpg" /></a>
</div>
',
'showSwitch'=>1,
'listNumber'=>20,
',
'showSwitch'=>1,
'listNumber'=>20,
'customize'=>' <!-- 统计代码-->
<script>
var _hmt = _hmt || [];
@ -70,16 +70,16 @@ $config=Array
<i class="icon icon-qq">加入QQ群</i>
</a>
<a target="_blank" href="/master.zip"><i class="icon icon-download-alt">下载源码</i></a>
--> ',
'checkEnv'=>1,
'checkImg'=>0,
'checkImg_value'=>50,
'upload_logs'=>1,
'cache_freq'=>2,
'version'=>'2.4.3',
'form'=>'',
'TinyImag_key'=>'',
'moderatecontent_key'=>'',
--> ',
'checkEnv'=>1,
'checkImg'=>0,
'checkImg_value'=>50,
'upload_logs'=>1,
'cache_freq'=>2,
'version'=>'2.4.3',
'form'=>'',
'TinyImag_key'=>'',
'moderatecontent_key'=>'',
'footer'=>'<a href="/admin/terms.php" target="_blank">请勿上传违反中国政策的图片</a>
<i class="icon icon-smile"></i> <br/>
@ -88,5 +88,5 @@ Copyright © 2018-2021
<a href="https://www.545141.com/902.html" target="_blank"> Icret</a> Version:
<a href="https://github.com/icret/EasyImages2.0" target="_blank"> 2.4.0</a>
<a href="/admin/terms.php" target="_blank"> DMCA</a>
'
'
);

View File

@ -117,15 +117,14 @@ if ($handle->uploaded) {
flush();
}
}
unset($handle);
// 上传日志控制
if ($config['upload_logs'] == true) {
require_once APP_ROOT . '/application/logs-write.php';
@write_log($imageUrl);
@write_log(config_path() . $handle->file_dst_name,md5_file(APP_ROOT.config_path() . $handle->file_dst_name));
}
unset($handle);
// 图片违规检查
if ($config['checkImg']) {
require_once APP_ROOT . '/config/api_key.php';

View File

@ -77,8 +77,9 @@ mustLogin();
</div>
</div>
</table>
<script src="<?php static_cdn();?>/public/static/paste.js"></script>
<script src="<?php static_cdn();?>/public/static/copy_btn.js"></script>
<script src="<?php static_cdn();?>/public/static/EasyImage.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/uploader/zui.uploader.min.js?v1.9.2"></script>
<script>
$('#upShowID').uploader({
// 自动上传

212
public/static/EasyImage.js Executable file
View File

@ -0,0 +1,212 @@
/**
* 来自于copy_btn.js paste.js合并
* 简单图床-复制
*/
var copyBtn = document.getElementsByClassName('copyBtn1')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("links");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn2')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("bbscode");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn3')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("markdown");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn4')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("html");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn5')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("del");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
// btn状态
$('#btnLinks').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btnBbscode').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btnMarkDown').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btnHtml').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btndel').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
/****************************************************************
* 复制截图 简单图床修改版
*/
(function () {
document.addEventListener('paste', function (e) {
var items = ((e.clipboardData || window.clipboardData).items) || [];
var file = null;
if (items && items.length) {
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
file = items[i].getAsFile();
break;
}
}
}
if (!file) {
alert('粘贴内容非图片!');
return;
}
var formData = new FormData();
formData.append('file', file);
var xhr = new XMLHttpRequest();
xhr.onload = function () {
try {
var result = JSON.parse(this.responseText);
if (result.result === 'success') {
var links = document.getElementById("links");
links.innerHTML += result.url + "\n";
var bbscode = document.getElementById("bbscode");
bbscode.innerHTML += "[img]" + result.url + "[/img]\n";
var markdown = document.getElementById("markdown");
markdown.innerHTML += "![](" + result.url + ")\n";
var html = document.getElementById("html");
html.innerHTML += "&lt;img src=\"" + result.url + "\" /&#62;\n";
var del = document.getElementById("del");
del.innerHTML += result.del + "\n";
} else {
alert('上传失败1');
}
} catch (e) {
alert('上传失败2');
}
};
xhr.onerror = function () {
alert('上传失败3');
};
xhr.open('POST', './file.php', true);
xhr.send(formData);
});
})();
/****************************************************************
* 百度统计
*/
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?5320b69f4f1caa9328dfada73c8e6a75";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();

View File

@ -1,141 +0,0 @@
var copyBtn = document.getElementsByClassName('copyBtn1')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("links");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn2')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("bbscode");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn3')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("markdown");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn4')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("html");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn5')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("del");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
//success info
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
} catch (err) {
//fail info
alert(err);
}
}
// btn状态
$('#btnLinks').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btnBbscode').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btnMarkDown').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btnHtml').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});
$('#btndel').on('click', function () {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function () {
$btn.button('reset');
}, 2000);
});

View File

@ -1,7 +0,0 @@
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?5320b69f4f1caa9328dfada73c8e6a75";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();

File diff suppressed because one or more lines are too long

View File

@ -1,54 +0,0 @@
/**
* 复制截图 简单图床修改版
*/
(function () {
document.addEventListener('paste', function (e) {
var items = ((e.clipboardData || window.clipboardData).items) || [];
var file = null;
if (items && items.length) {
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
file = items[i].getAsFile();
break;
}
}
}
if (!file) {
alert('粘贴内容非图片!');
return;
}
var formData = new FormData();
formData.append('file', file);
var xhr = new XMLHttpRequest();
xhr.onload = function () {
try {
var result = JSON.parse(this.responseText);
if (result.result === 'success') {
var links = document.getElementById("links");
links.innerHTML += result.url + "\n";
var bbscode = document.getElementById("bbscode");
bbscode.innerHTML += "[img]" + result.url + "[/img]\n";
var markdown = document.getElementById("markdown");
markdown.innerHTML += "![](" + result.url + ")\n";
var html = document.getElementById("html");
html.innerHTML += "&lt;img src=\"" + result.url + "\" /&#62;\n";
} else {
alert('上传失败1');
}
} catch (e) {
alert('上传失败2');
}
};
xhr.onerror = function () {
alert('上传失败3');
};
xhr.open('POST', './file.php', true);
xhr.send(formData);
});
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long