Browse Source

优化

tags/6.2.7
叙述、别离 1 year ago
parent
commit
b4994afbec
25 changed files with 746 additions and 759 deletions
  1. +1
    -1
      src/admin/dialog/config.php
  2. +165
    -174
      src/admin/dialog/select_images.php
  3. +3
    -3
      src/admin/dialog/select_images_post.php
  4. +140
    -140
      src/admin/dialog/select_media.php
  5. +187
    -187
      src/admin/dialog/select_mimages.php
  6. +122
    -122
      src/admin/dialog/select_soft.php
  7. +5
    -5
      src/admin/dialog/select_soft_post.php
  8. +49
    -49
      src/admin/dialog/select_templets.php
  9. +3
    -3
      src/admin/dialog/select_templets_post.php
  10. +1
    -1
      src/admin/file_class.php
  11. +1
    -1
      src/admin/file_manage_control.php
  12. +1
    -1
      src/admin/friendlink_edit.php
  13. +2
    -2
      src/admin/inc/inc_archives_functions.php
  14. +1
    -1
      src/admin/inc/inc_menu_module.php
  15. +1
    -1
      src/admin/makehtml_homepage.php
  16. +1
    -1
      src/admin/media_add.php
  17. +1
    -1
      src/admin/sys_info_mark.php
  18. +8
    -8
      src/admin/templets/action_search.htm
  19. +1
    -1
      src/admin/templets/album_add.htm
  20. +1
    -1
      src/admin/templets/album_edit.htm
  21. +23
    -23
      src/admin/templets/freelist_main.htm
  22. +14
    -14
      src/admin/templets/search_keywords_main.htm
  23. +1
    -1
      src/admin/templets_one_add.php
  24. +1
    -1
      src/admin/templets_one_edit.php
  25. +13
    -17
      src/system/helpers/upload.helper.php

+ 1
- 1
src/admin/dialog/config.php View File

@@ -21,7 +21,7 @@ $s_scriptName = $dedeNowurls[0];
$cuserLogin = new userLogin();
if ($cuserLogin->getUserID() <= 0) {
if (empty($adminDirHand)) {
ShowMsg("提示:需要输入后台管理目录才能登录<br><form>请输入后台管理目录名:<input type='hidden' name='gotopage' value='".urlencode($dedeNowurl)."'><input type='text' name='adminDirHand' value='dede'><input type='submit' name='sbt' value='前往登录'></form>", "javascript:;");
ShowMsg("<p>提示:需要输入后台管理目录才能登录</p><form><span>请输入后台管理目录名:</span><input type='hidden' name='gotopage' value='".urlencode($dedeNowurl)."'><input type='text' name='adminDirHand' value='admin'><input type='submit' name='sbt' value='前往登录'></form>", "javascript:;");
exit();
}
$adminDirHand = HtmlReplace($adminDirHand, 1);


+ 165
- 174
src/admin/dialog/select_images.php View File

@@ -52,125 +52,60 @@ if (!empty($iseditor)) {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择图片</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}.napisdiv{left:10;top:10;width:150px;height:100px;position:absolute;z-index:3;display:none}</style>
<script>
function nullLink() {
return;
}
function ChangeImage(surl) {
document.getElementById('picview').src = surl;
}
</script>
<script src="../js/float.js"></script>
<script>
function nullLink() {
return;
}
function ChangeImage(surl) {
document.getElementById('floater').style.display = 'block';
document.getElementById('picview').src = surl;
}
function TNav() {
if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE';
else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF';
else return "OT";
}
//获取地址参数
function getUrlParam(paramName) {
var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
var match = window.location.search.match(reParam);
return (match && match.length > 1) ? match[1] : '';
}
function ReturnImg(reimg) {
var funcNum = getUrlParam('CKEditorFuncNum');
var iseditor = parseInt(getUrlParam('iseditor'));
if (funcNum > 1) {
var fileUrl = reimg;
window.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl);
}
if (iseditor==1) {
let addonHTML = `<img src='${reimg}'>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
} else {
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
if (window.opener.document.getElementById('div<?php echo $v ?>')) {
if (TNav() == 'IE') {
//window.opener.document.getElementById('div<?php echo $v ?>').filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = reimg;
window.opener.document.getElementById('div<?php echo $v ?>').src = reimg;
window.opener.document.getElementById('div<?php echo $v ?>').style.width = '150px';
window.opener.document.getElementById('div<?php echo $v ?>').style.height = '100px';
} else
window.opener.document.getElementById('div<?php echo $v ?>').style.backgroundImage = "url(" + reimg + ")";
} else if (window.opener.document.getElementById('<?php echo $v ?>')) {
window.opener.document.getElementById('<?php echo $v ?>').src = reimg;
}
//适配新的缩略图
if (window.opener.document.getElementById('litPic')) {
window.opener.document.getElementById('litPic').src = reimg;
}
if (document.all) window.opener = true;
} else if (typeof window.opener.CKEDITOR.instances["<?php echo $f ?>"] !== "undefined") {
let addonHTML = `<img src='${reimg}'>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
}
}
window.close();
}
</script>
</head>
<body>
<div class="upload-bg">
<div id="floater" class="napisdiv">
<a href="javascript:nullLink();" onClick="document.getElementById('floater').style.display='none';"><img src="../../static/web/img/icon_img.png" id="picview" title="关闭预览"></a>
</div>
<table cellpadding="0" cellspacing="1" align="center" class="table icon">
<tr>
<td colspan="4">
<form action="select_images_post.php" method="POST" enctype="multipart/form-data" name="myform">
<?php $noeditor = !empty($noeditor) ? "<input type='hidden' name='noeditor' value='yes'>" : ''; echo $noeditor;?>
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="v" value="<?php echo $v ?>">
<input type="hidden" name="iseditor" value="<?php echo $iseditor ?>">
<input type="hidden" name="imgstick" value="<?php echo $imgstick ?>">
<input type="hidden" name="CKEditorFuncNum" value="<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>">
<input type="hidden" name="job" value="upload">
<input type="file" name="imgfile" class="w-50">
<label><input type="checkbox" name="needwatermark" value="1" <?php if ($photo_markup == '1') echo "checked";?>> 水印</label>
<label><input type="checkbox" name="resize" value="1"> 缩小</label>
<label>宽:<input type="text" name="iwidth" value="<?php echo $cfg_ddimg_width ?>" class="admin-input-xs"></label>
<label>高:<input type="text" name="iheight" value="<?php echo $cfg_ddimg_height ?>" class="admin-input-xs"></label>
<button type="submit" name="sb1" class="btn btn-success btn-sm">上传</button>
</form>
</td>
</tr>
<tr>
<td colspan="4">点击图片预览,再点击图片关闭预览,点击文件名选择图片</td>
</tr>
<tr>
<td width="6%">预览</td>
<td width="40%">选择图片</td>
<td width="20%">文件大小</td>
<td>修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = "";
$ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择图片</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}.napisdiv{left:10;top:10;width:150px;height:100px;position:absolute;z-index:9998;display:none}</style>
<script src="../js/float.js"></script>
</head>
<body>
<div class="upload-bg">
<div id="floater" class="napisdiv">
<a href="javascript:nullLink();" onClick="document.getElementById('floater').style.display='none';"><img src="../../static/web/img/icon_img.png" id="picview" title="关闭预览"></a>
</div>
<table cellpadding="0" cellspacing="1" align="center" class="table icon">
<tr>
<td colspan="3">
<form action="select_images_post.php" method="POST" enctype="multipart/form-data" name="myform">
<?php $noeditor = !empty($noeditor) ? "<input type='hidden' name='noeditor' value='yes'>" : ''; echo $noeditor;?>
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="v" value="<?php echo $v ?>">
<input type="hidden" name="iseditor" value="<?php echo $iseditor ?>">
<input type="hidden" name="imgstick" value="<?php echo $imgstick ?>">
<input type="hidden" name="CKEditorFuncNum" value="<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>">
<input type="hidden" name="job" value="upload">
<input type="file" name="imgfile" class="w-50">
<label><input type="checkbox" name="needwatermark" value="1" <?php if ($photo_markup == '1') echo "checked";?>> 水印</label>
<label><input type="checkbox" name="resize" value="1"> 缩小</label>
<label>宽:<input type="text" name="iwidth" value="<?php echo $cfg_ddimg_width ?>" class="admin-input-xs"></label>
<label>高:<input type="text" name="iheight" value="<?php echo $cfg_ddimg_height ?>" class="admin-input-xs"></label>
<button type="submit" name="sb1" class="btn btn-success btn-sm">上传</button>
</form>
</td>
</tr>
<tr>
<td colspan="3">点击图片预览,再点击图片关闭预览,点击文件名选择图片</td>
</tr>
<tr>
<td width="50%">选择图片</td>
<td width="20%">文件大小</td>
<td>修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = "";
$ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = explode("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 2);
@@ -178,60 +113,116 @@ if (!empty($iseditor)) {
@list($ty1, $ty2) = explode("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr>
<td colspan='2'><a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/icon_dir2.png'>上级目录</a></td>
<td colspan='2'>当前目录:$activepath</td>
</tr>";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td colspan='4'><a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode("$activepath/$file").$addparm."'><img src='../../static/web/img/icon_dir.png'>$file</a></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(".$cfg_imgtype.")#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td colspan='2'>
<a href=\"javascript:;\" onClick=\"ChangeImage('$reurl');\"><img src='$reurl' title='$file'></a>
<a href=\"javascript:;\" onclick=\"ReturnImg('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td colspan='2'>
<a href=\"javascript:;\" onClick=\"ChangeImage('$reurl');\"><img src='$reurl' title='$file'></a>
<a href=\"javascript:;\" onclick=\"ReturnImg('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr>
<td colspan='2'><a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/icon_dir2.png'>上级目录</a></td>
<td>当前目录:$activepath</td>
</tr>";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td colspan='3'><a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode("$activepath/$file").$addparm."'><img src='../../static/web/img/icon_dir.png'>$file</a></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(".$cfg_imgtype.")#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<a href=\"javascript:;\" onClick=\"ChangeImage('$reurl');\"><img src='$reurl' title='$file'></a>
<a href=\"javascript:;\" onclick=\"ReturnImg('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<a href=\"javascript:;\" onClick=\"ChangeImage('$reurl');\"><img src='$reurl' title='$file'></a>
<a href=\"javascript:;\" onclick=\"ReturnImg('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
?>
</tr>
</table>
</div>
<script>
function nullLink() {
return;
}
function ChangeImage(surl) {
document.getElementById('floater').style.display = 'block';
document.getElementById('picview').src = surl;
}
function TNav() {
if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE';
else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF';
else return "OT";
}
//获取地址参数
function getUrlParam(paramName) {
var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
var match = window.location.search.match(reParam);
return (match && match.length > 1) ? match[1] : '';
}
function ReturnImg(reimg) {
var funcNum = getUrlParam('CKEditorFuncNum');
var iseditor = parseInt(getUrlParam('iseditor'));
if (funcNum > 1) {
var fileUrl = reimg;
window.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl);
}
if (iseditor==1) {
let addonHTML = `<img src='${reimg}'>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
} else {
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
if (window.opener.document.getElementById('div<?php echo $v ?>')) {
if (TNav() == 'IE') {
//window.opener.document.getElementById('div<?php echo $v ?>').filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = reimg;
window.opener.document.getElementById('div<?php echo $v ?>').src = reimg;
window.opener.document.getElementById('div<?php echo $v ?>').style.width = '150px';
window.opener.document.getElementById('div<?php echo $v ?>').style.height = '100px';
} else
window.opener.document.getElementById('div<?php echo $v ?>').style.backgroundImage = "url(" + reimg + ")";
} else if (window.opener.document.getElementById('<?php echo $v ?>')) {
window.opener.document.getElementById('<?php echo $v ?>').src = reimg;
}
//适配新的缩略图
if (window.opener.document.getElementById('litPic')) {
window.opener.document.getElementById('litPic').src = reimg;
}
if (document.all) window.opener = true;
} else if (typeof window.opener.CKEDITOR.instances["<?php echo $f ?>"] !== "undefined") {
let addonHTML = `<img src='${reimg}'>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
}
}//End Loop
?>
</tr>
</table>
</div>
</body>
}
window.close();
}
</script>
</body>
</html>

+ 3
- 3
src/admin/dialog/select_images_post.php View File

@@ -22,20 +22,20 @@ if (empty($imgfile)) {
$imgfile = '';
}
if (!is_uploaded_file($imgfile)) {
ShowMsg("您没有选择上传文件".$imgfile, "-1");
ShowMsg("您没有选择上传文件".$imgfile, "-1");
exit();
}
$CKEditorFuncNum = (isset($CKEditorFuncNum)) ? $CKEditorFuncNum : 1;
$imgfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $imgfile_name));
if (!preg_match("#\.(".$cfg_imgtype.")#i", $imgfile_name)) {
ShowMsg("您所上传的图片类型不在许可列表,请修改系统对扩展名限定的配置", "-1");
ShowMsg("您上传的图片类型错误,请修改系统对扩展名配置", "-1");
exit();
}
$nowtme = time();
$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp", "image/webp");
$imgfile_type = strtolower(trim($imgfile_type));
if (!in_array($imgfile_type, $sparr)) {
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种", "-1");
ShowMsg("您上传的图片格式错误,请使用jpg、png、gif、wbmp格式其中一种", "-1");
exit();
}
$mdir = MyDate($cfg_addon_savetype, $nowtme);


+ 140
- 140
src/admin/dialog/select_media.php View File

@@ -42,60 +42,45 @@ if (!empty($noeditor)) {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择多媒体</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}</style>
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
}
var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
if (window.opener.CKEDITOR != null && funcNum != 1) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
window.close();
}
</script>
</head>
<body>
<div class="upload-bg">
<table align="center" cellspacing="0" cellpadding="2" class="table icon">
<tr>
<td colspan="3">
<form action="select_media_post.php" method="POST" enctype="multipart/form-data" name="myform">
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="job" value="upload">
<input type="hidden" name="CKEditorFuncNum" value="<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>">
<input type="file" name="uploadfile" class="w-75">
<button type="submit" name="sb1" class="btn btn-success btn-sm">上传</button>
</form>
</td>
</tr>
<tr>
<td width="50%">点击名称选择文件</td>
<td width="20%">文件大小</td>
<td>最后修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = "";
$ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择多媒体</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}</style>
</head>
<body>
<div class="upload-bg">
<table align="center" cellspacing="0" cellpadding="2" class="table icon">
<tr>
<td colspan="3">
<form action="select_media_post.php" method="POST" enctype="multipart/form-data" name="myform">
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="job" value="upload">
<input type="hidden" name="CKEditorFuncNum" value="<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>">
<input type="file" name="uploadfile" class="w-75">
<button type="submit" name="sb1" class="btn btn-success btn-sm">上传</button>
</form>
</td>
</tr>
<tr>
<td width="50%">点击名称选择文件</td>
<td width="20%">文件大小</td>
<td>最后修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = "";
$ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 2);
@@ -103,90 +88,105 @@ if (!empty($noeditor)) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr>
<td><a href='select_media.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/icon_dir2.png'>上级目录</a></td>
<td colspan='2'>当前目录:$activepath</td>
</tr>";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td colspan='3'><a href=select_media.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='../../static/web/img/icon_dir.png'>$file</a></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(swf|fly|fla|flv)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_flash.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(wmv|avi)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_video.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(rm|rmvb|mp3|mp4)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_rm.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(mp3|wma)#", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_music.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
?>
</table>
</div>
</body>
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr>
<td><a href='select_media.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/icon_dir2.png'>上级目录</a></td>
<td colspan='2'>当前目录:$activepath</td>
</tr>";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td colspan='3'><a href=select_media.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='../../static/web/img/icon_dir.png'>$file</a></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(swf|fly|fla|flv)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_flash.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(wmv|avi)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_video.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(rm|rmvb|mp3|mp4)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_rm.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(mp3|wma)#", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$line = "<tr>
<td>
<img src='../../static/web/img/icon_music.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td align='center'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
?>
</table>
</div>
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
}
var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
if (window.opener.CKEDITOR != null && funcNum != 1) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
window.close();
}
</script>
</body>
</html>

+ 187
- 187
src/admin/dialog/select_mimages.php View File

@@ -4,201 +4,201 @@ include(DEDEDATA.'/mark/inc_photowatermark_config.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1.0,maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>插入多图</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<style>body{margin:0;line-height:1.6;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;color:#545b62;background:#fff}ul{margin:0;padding:0;list-style:none}input[type=radio],input[type=checkbox]{margin:0;height:auto;outline:none;box-shadow:none;vertical-align:text-top}button+button{margin-left:10px}#wrap{padding:10px}#topbar{padding:10px 0;border-bottom:1px solid #ccc;text-align:right}#topbar button{display:inline-block;padding:.25rem .65rem;line-height:1.6;font-size:12px;color:#fff;background:#1eb867;border-color:#1eb867;border-radius:.5rem;border:0;transition:all .5s;text-align:center}.topbar button+.topbar button{margin-left:10px}#topbar button:focus{background:#006829;border-color:#005b24;box-shadow:0 .125rem .25rem rgba(0,0,0,.075);outline:none}#file_list{display:grid;grid-gap:10px;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));padding-top:10px}#file_list:empty:after{content:'拖拽图片到此处上传'}#file_list li{display:block;position:relative;padding:10px;vertical-align:top;border-radius:.5rem}#file_list li.up-now:after{content:'';display:block;position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(255,255,255,0.8) url(../../static/web/img/loadinglit.gif)center center no-repeat;border-radius:.5rem;z-index:999}#file_list li:hover{background:#f5f5f5}#file_list li .picbox{display:flex;flex:0 0 auto;position:relative;padding-top:90%;width:100%;align-items:center;justify-content:center;overflow:hidden}#file_list li .picbox img{display:block;max-width:100%;max-height:100%;position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%);border-radius:.5rem}#file_list li .namebox{display:flex;padding:10px;justify-content:center;align-items:flex-start}#file_list li.up-over .picbox:after{position:absolute;bottom:10px;right:0;font-family:'FontAwesome';font-size:18px;color:#1eb867;content:'\f058';z-index:9}#file_list li .tools{display:none;position:absolute;bottom:12px;right:10px;z-index:99}#file_list li:hover .tools{display:block}#file_list li .tools .remove{cursor:pointer}#file_list li .tools .remove:after{font-family:'FontAwesome';font-size:18px;color:#dc3545;content:'\f1f8'}</style>
</head>
<body>
<div id="wrap">
<div id="topbar">
<label><input type="checkbox" name="isWater" id="isWater" <?php if ($photo_markup == '1') echo "checked";?>> 是否水印</label>
<button class="addfile">添加图片</button>
<button class="removeall">清空图片</button>
<button class="upall">全部上传</button>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1.0,maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>插入多图</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<style>body{margin:0;line-height:1.6;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;color:#545b62;background:#fff}ul{margin:0;padding:0;list-style:none}input[type=radio],input[type=checkbox]{margin:0;height:auto;outline:none;box-shadow:none;vertical-align:text-top}button+button{margin-left:10px}#wrap{padding:10px}#topbar{padding:10px 0;border-bottom:1px solid #ccc;text-align:right}#topbar button{display:inline-block;padding:.25rem .65rem;line-height:1.6;font-size:12px;color:#fff;background:#1eb867;border-color:#1eb867;border-radius:.5rem;border:0;transition:all .5s;text-align:center}.topbar button+.topbar button{margin-left:10px}#topbar button:focus{background:#006829;border-color:#005b24;box-shadow:0 .125rem .25rem rgba(0,0,0,.075);outline:none}#file_list{display:grid;grid-gap:10px;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));padding-top:10px}#file_list:empty:after{content:'拖拽图片到此处上传'}#file_list li{display:block;position:relative;padding:10px;vertical-align:top;border-radius:.5rem}#file_list li.up-now:after{content:'';display:block;position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(255,255,255,0.8) url(../../static/web/img/loadinglit.gif)center center no-repeat;border-radius:.5rem;z-index:999}#file_list li:hover{background:#f5f5f5}#file_list li .picbox{display:flex;flex:0 0 auto;position:relative;padding-top:90%;width:100%;align-items:center;justify-content:center;overflow:hidden}#file_list li .picbox img{display:block;max-width:100%;max-height:100%;position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%);border-radius:.5rem}#file_list li .namebox{display:flex;padding:10px;justify-content:center;align-items:flex-start}#file_list li.up-over .picbox:after{position:absolute;bottom:10px;right:0;font-family:'FontAwesome';font-size:18px;color:#1eb867;content:'\f058';z-index:9}#file_list li .tools{display:none;position:absolute;bottom:12px;right:10px;z-index:99}#file_list li:hover .tools{display:block}#file_list li .tools .remove{cursor:pointer}#file_list li .tools .remove:after{font-family:'FontAwesome';font-size:18px;color:#dc3545;content:'\f1f8'}</style>
</head>
<body>
<div id="wrap">
<div id="topbar">
<label><input type="checkbox" name="isWater" id="isWater" <?php if ($photo_markup == '1') echo "checked";?>> 是否水印</label>
<button class="addfile">添加图片</button>
<button class="removeall">清空图片</button>
<button class="upall">全部上传</button>
</div>
<ul id="file_list"></ul>
</div>
<ul id="file_list"></ul>
</div>
<script>
var axupimgs={};
axupimgs.res = [];//存放本地文件的数组
var blobInfo = {file:null}
blobInfo.blob = function(){return this.file;}
var upload_handler = async(blobInfo, succFun, failFun)=>{
var file = blobInfo.blob();
formData = new FormData();
formData.append('upload', file, file.name);
formData.append('format', "json");
if (document.querySelector('#isWater').checked) {
formData.append('needwatermark', 1);
} else {
//formData.append('needwatermark', 0);
}
let res = await fetch('select_images_post.php', {
method: 'POST',
body: formData
});
let data = await res.json();
if (typeof data.msg !== 'undefined' && data.msg !== '') {
alert(data.msg)
return;
}
succFun(data.url);
};
var upload_base_path = axupimgs.images_upload_base_path;
//为列表添加排序
function reSort(){
document.querySelectorAll('#file_list li').forEach((el,i)=>{
el.setAttribute('data-num',i);
});
}
function isFileImage(file) {
return file && file['type'].split('/')[0] === 'image';
}
function addList(files) {
var files_sum = files.length;
var vDom = document.createDocumentFragment();
for (let i=0;i<files_sum;i++) {
let file = files[i];
if (!isFileImage(file)) {
alert("选择非图片文件无法上传")
<script>
var axupimgs={};
axupimgs.res = [];//存放本地文件的数组
var blobInfo = {file:null}
blobInfo.blob = function(){return this.file;}
var upload_handler = async(blobInfo, succFun, failFun)=>{
var file = blobInfo.blob();
formData = new FormData();
formData.append('upload', file, file.name);
formData.append('format', "json");
if (document.querySelector('#isWater').checked) {
formData.append('needwatermark', 1);
} else {
//formData.append('needwatermark', 0);
}
let res = await fetch('select_images_post.php', {
method: 'POST',
body: formData
});
let data = await res.json();
if (typeof data.msg !== 'undefined' && data.msg !== '') {
alert(data.msg)
return;
}
let blobUrl = window.URL.createObjectURL(file)
axupimgs.res.push({file:file,blobUrl:blobUrl,url:''});
let li = document.createElement('li');
li.setAttribute('class','up-no');
li.setAttribute('data-time',file.lastModified);
li.innerHTML='<div class="picbox"><img src="'+blobUrl+'"></div><div class="namebox"><span>'+file.name+'</span></div><div class="tools"><a class="remove"></a></div>';
vDom.appendChild(li);
succFun(data.url);
};
var upload_base_path = axupimgs.images_upload_base_path;
//为列表添加排序
function reSort(){
document.querySelectorAll('#file_list li').forEach((el,i)=>{
el.setAttribute('data-num',i);
});
}
function isFileImage(file) {
return file && file['type'].split('/')[0] === 'image';
}
function addList(files) {
var files_sum = files.length;
var vDom = document.createDocumentFragment();
for (let i=0;i<files_sum;i++) {
let file = files[i];
if (!isFileImage(file)) {
alert("选择非图片文件无法上传")
return;
}
let blobUrl = window.URL.createObjectURL(file)
axupimgs.res.push({file:file,blobUrl:blobUrl,url:''});
let li = document.createElement('li');
li.setAttribute('class','up-no');
li.setAttribute('data-time',file.lastModified);
li.innerHTML='<div class="picbox"><img src="'+blobUrl+'"></div><div class="namebox"><span>'+file.name+'</span></div><div class="tools"><a class="remove"></a></div>';
vDom.appendChild(li);
}
document.querySelector('#file_list').appendChild(vDom);
//reSort();
}
document.querySelector('#file_list').appendChild(vDom);
//reSort();
}
//清空列表
document.querySelector('#topbar .removeall').addEventListener('click',()=>{
axupimgs.res=[]
document.querySelectorAll('#file_list li').forEach((el,i)=>{
el.parentNode.removeChild(el)
//清空列表
document.querySelector('#topbar .removeall').addEventListener('click',()=>{
axupimgs.res=[]
document.querySelectorAll('#file_list li').forEach((el,i)=>{
el.parentNode.removeChild(el)
});
});
});
//拖拽添加
document.addEventListener('dragover', (e)=>{
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
});
document.addEventListener('drop', (e)=>{
e.stopPropagation();
e.preventDefault();
if (!e.dataTransfer.files){return false;}
var dropfiles = e.dataTransfer.files;
if (!(dropfiles.length>0)){return false;}
var exts='.png,.gif,.jpg,.jpeg'.replace(/(\s)+/g,'').toLowerCase().split(',');
var files=[];
for ( let file of dropfiles ) {
ext = file.name.split('.');
ext = '.'+ext[ext.length-1];
for (let s of exts) {
if (s==ext){
files.push(file);
break;
//拖拽添加
document.addEventListener('dragover', (e)=>{
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
});
document.addEventListener('drop', (e)=>{
e.stopPropagation();
e.preventDefault();
if (!e.dataTransfer.files){return false;}
var dropfiles = e.dataTransfer.files;
if (!(dropfiles.length>0)){return false;}
var exts='.png,.gif,.jpg,.jpeg'.replace(/(\s)+/g,'').toLowerCase().split(',');
var files=[];
for ( let file of dropfiles ) {
ext = file.name.split('.');
ext = '.'+ext[ext.length-1];
for (let s of exts) {
if (s==ext){
files.push(file);
break;
}
}
}
}
if (files.length>0){ addList(files) }
});
//添加文件
document.querySelector('#topbar .addfile').addEventListener('click',()=>{
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('multiple', 'multiple');
input.setAttribute('accept', axupimgs.axupimgs_filetype);
input.click();
input.onchange = function() {
var files = this.files;
addList(files);
}
});
var file_i = 0;
function upAllFiles(n){
var len = axupimgs.res.length;
file_i = n;
if (len == n){
file_i=0;
document.querySelector('#topbar .upall').innerText='全部上传';
//返回
console.log(axupimgs.res);
axupimgs.res.forEach((v,k)=>{
let addonHTML = `<img src='${v.url}'/>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
})
window.close();
return true;
}
if ( axupimgs.res[n].url!='' ){
n++;
upAllFiles(n)
} else {
blobInfo.file=axupimgs.res[n].file;
blobInfo.isWater = document.querySelector('#isWater').checked;
upload_handler(blobInfo,function(url){
if (upload_base_path){
if (upload_base_path.slice(-1)=='/' && url.substr(0,1)=='/' ){
url = upload_base_path + url.slice(1);
}else if (upload_base_path.slice(-1)!='/' && url.substr(0,1)!='/' ){
url = upload_base_path + '/' + url;
} else {
url = upload_base_path + url;
}
}
axupimgs.res[file_i].url = url;
filename = url.split('/').pop();
var li = document.querySelectorAll('#file_list li')[file_i];
li.setAttribute('class','up-over');
li.querySelector('.namebox span').innerText = filename;
n++
upAllFiles(n);
},function(err){
if (files.length>0){ addList(files) }
});
//添加文件
document.querySelector('#topbar .addfile').addEventListener('click',()=>{
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('multiple', 'multiple');
input.setAttribute('accept', axupimgs.axupimgs_filetype);
input.click();
input.onchange = function() {
var files = this.files;
addList(files);
}
});
var file_i = 0;
function upAllFiles(n){
var len = axupimgs.res.length;
file_i = n;
if (len == n){
file_i=0;
document.querySelector('#topbar .upall').innerText='全部上传';
document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
el.setAttribute('class','up-no');
//返回
console.log(axupimgs.res);
axupimgs.res.forEach((v,k)=>{
let addonHTML = `<img src='${v.url}'/>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
})
window.close();
return true;
}
if ( axupimgs.res[n].url!='' ){
n++;
upAllFiles(n)
} else {
blobInfo.file=axupimgs.res[n].file;
blobInfo.isWater = document.querySelector('#isWater').checked;
upload_handler(blobInfo,function(url){
if (upload_base_path){
if (upload_base_path.slice(-1)=='/' && url.substr(0,1)=='/' ){
url = upload_base_path + url.slice(1);
}else if (upload_base_path.slice(-1)!='/' && url.substr(0,1)!='/' ){
url = upload_base_path + '/' + url;
} else {
url = upload_base_path + url;
}
}
axupimgs.res[file_i].url = url;
filename = url.split('/').pop();
var li = document.querySelectorAll('#file_list li')[file_i];
li.setAttribute('class','up-over');
li.querySelector('.namebox span').innerText = filename;
n++
upAllFiles(n);
},function(err){
document.querySelector('#topbar .upall').innerText='全部上传';
document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{
el.setAttribute('class','up-no');
});
alert(err);
});
alert(err);
});
}
}
document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
if (e.target.innerText!='全部上传'){return false;}
if (axupimgs.res.length>0){
document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
el.classList ? el.classList.add('up-now') : el.className+=' up-now';
});
e.target.innerText='上传中';
upAllFiles(0);
}
});
var observ_flist = new MutationObserver( (muList,observe)=>{
if (muList[0].addedNodes.length>0){
muList[0].addedNodes.forEach((el)=>{
el.querySelector('.remove').addEventListener('click',(e)=>{
var li = e.target.parentNode.parentNode;
var n = li.getAttribute('data-num');
var el = document.querySelectorAll('#file_list li')[n];
el.parentNode.removeChild(el);
axupimgs.res.splice(n,1);
}
}
document.querySelector('#topbar .upall').addEventListener('click',(e)=>{
if (e.target.innerText!='全部上传'){return false;}
if (axupimgs.res.length>0){
document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{
el.classList ? el.classList.add('up-now') : el.className+=' up-now';
});
});
}
reSort();
});
observ_flist.observe(document.querySelector('#file_list'),{childList:true});
</script>
</body>
e.target.innerText='上传中';
upAllFiles(0);
}
});
var observ_flist = new MutationObserver( (muList,observe)=>{
if (muList[0].addedNodes.length>0){
muList[0].addedNodes.forEach((el)=>{
el.querySelector('.remove').addEventListener('click',(e)=>{
var li = e.target.parentNode.parentNode;
var n = li.getAttribute('data-num');
var el = document.querySelectorAll('#file_list li')[n];
el.parentNode.removeChild(el);
axupimgs.res.splice(n,1);
});
});
}
reSort();
});
observ_flist.observe(document.querySelector('#file_list'),{childList:true});
</script>
</body>
</html>

+ 122
- 122
src/admin/dialog/select_soft.php View File

@@ -41,129 +41,129 @@ if (!empty($noeditor)) {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择软件</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}</style>
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
if (window.opener.CKEDITOR != null && funcNum != 1) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
if (typeof window.opener.CKEDITOR.instances["<?php echo $f ?>"] !== "undefined") {
let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/web/img/icon_addon.png'>附件:${reimg}</a>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择软件</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}</style>
</head>
<body>
<div class="upload-bg">
<table cellpadding="0" cellspacing="1" align="center" class="table icon">
<tr>
<td colspan="3">
<form action="select_soft_post.php" method="POST" enctype="multipart/form-data" name="myform">
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="job" value="upload">
<input type="file" name="uploadfile" class="w-50">
<label>改名:<input type="text" name="newname" class="admin-input-sm"></label>
<button type="submit" name="sb1" class="btn btn-success btn-sm">保存</button>
</form>
</td>
</tr>
<tr>
<td colspan="3">点击选择文件,红色字样的为刚上传的文件</td>
</tr>
<tr>
<td width="50%">选择文件</td>
<td width="20%">文件大小</td>
<td>修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = $ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 2);
} else {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr>
<td><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/icon_dir2.png'>上级目录</a></td>
<td colspan='2'>当前目录:$activepath</td>
</tr>\r\n";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td colspan='3'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='../../static/web/img/icon_dir.png'>$file</a></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "<tr>
<td>
<img src='../../static/web/img/icon_zip.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
} else {
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = '';
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "<tr>
<td>
<img src='../../static/web/img/icon_exe.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
?>
</table>
</div>
<script>
function nullLink() {
return;
}
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
function ReturnValue(reimg) {
var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1;?>;
if (window.opener.CKEDITOR != null && funcNum != 1) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
if (typeof window.opener.CKEDITOR.instances["<?php echo $f ?>"] !== "undefined") {
let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/web/img/icon_addon.png'>附件:${reimg}</a>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
}
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
window.close();
return
}
window.close();
return
}
window.close();
}
</script>
</head>
<body>
<div class="upload-bg">
<table cellpadding="0" cellspacing="1" align="center" class="table icon">
<tr>
<td colspan="3">
<form action="select_soft_post.php" method="POST" enctype="multipart/form-data" name="myform">
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="job" value="upload">
<input type="file" name="uploadfile" class="w-50">
<label>改名:<input type="text" name="newname" class="admin-input-sm"></label>
<button type="submit" name="sb1" class="btn btn-success btn-sm">保存</button>
</form>
</td>
</tr>
<tr>
<td colspan="3">点击选择文件,红色字样的为刚上传的文件</td>
</tr>
<tr>
<td width="50%">选择文件</td>
<td width="20%">文件大小</td>
<td>修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = $ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 2);
} else {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr>
<td><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='../../static/web/img/icon_dir2.png'>上级目录</a></td>
<td colspan='2'>当前目录:$activepath</td>
</tr>\r\n";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td colspan='3'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='../../static/web/img/icon_dir.png'>$file</a></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "<tr>
<td>
<img src='../../static/web/img/icon_zip.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
} else {
if ($file == $comeback) $lstyle = "class='text-danger'";
else $lstyle = '';
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "<tr>
<td>
<img src='../../static/web/img/icon_exe.png'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle>$file</a>
</td>
<td>$filesize KB</td>
<td>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
?>
</table>
</div>
</body>
</script>
</body>
</html>

+ 5
- 5
src/admin/dialog/select_soft_post.php View File

@@ -19,7 +19,7 @@ $newname = (empty($newname) ? '' : preg_replace("#[\\ \"\*\?\t\r\n<>':\/|]#", ""
$uploadfile = isset($imgfile) && empty($uploadfile) ? $imgfile : $uploadfile;
$uploadfile_name = isset($imgfile_name) && empty($uploadfile_name) ? $imgfile_name : $uploadfile_name;
if (!is_uploaded_file($uploadfile)) {
ShowMsg("您没有选择上传文件或上传的文件大小被限制", "-1");
ShowMsg("您没有选择上传文件或上传的文件大小被限制", "-1");
exit();
}
//软件类型所有支持的附件
@@ -27,7 +27,7 @@ $cfg_softtype = $cfg_softtype;
$cfg_softtype = str_replace('||', '|', $cfg_softtype);
$uploadfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $uploadfile_name));
if (!preg_match("#\.(".$cfg_softtype.")#i", $uploadfile_name)) {
ShowMsg("您上传的<span class='text-primary'>{$uploadmbtype}</span>不在许可列表", "-1");
ShowMsg("您上传的<span class='text-primary'>{$uploadmbtype}</span>扩展名已被系统禁止", "-1");
exit();
}
$nowtme = time();
@@ -45,7 +45,7 @@ if (!empty($newname)) {
if (!preg_match("#\.#", $filename)) $fs = explode('.', $uploadfile_name);
else $fs = explode('.', $filename);
if (preg_match("#".$cfg_not_allowall."#", $fs[count($fs) - 1])) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
if (!preg_match("#\.#", $filename)) $filename = $filename.'.'.$fs[count($fs) - 1];
@@ -53,13 +53,13 @@ if (!empty($newname)) {
$filename = $cuserLogin->getUserID().'-'.dd2char(MyDate('ymdHis', $nowtme));
$fs = explode('.', $uploadfile_name);
if (preg_match("#".$cfg_not_allowall."#", $fs[count($fs) - 1])) {
ShowMsg("您上传的文件可能存在不安全因素,系统拒绝操作", "-1");
ShowMsg("您上传的文件失败,请重新上传", "-1");
exit();
}
$filename = $filename.'.'.$fs[count($fs) - 1];
}
if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)$#i', trim($filename))) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
$fullfilename = $cfg_basedir.$activepath.'/'.$filename;


+ 49
- 49
src/admin/dialog/select_templets.php View File

@@ -33,55 +33,45 @@ if (empty($comeback)) {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择模板</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}</style>
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
window.opener.document.<?php echo $f ?>.value = reimg;
if (document.all) window.opener = true;
window.close();
}
</script>
</head>
<body>
<div class="upload-bg">
<table cellpadding="0" cellspacing="1" align="center" class="table icon">
<tr>
<td colspan="3">
<form action="select_templets_post.php" method="POST" enctype="multipart/form-data" name="myform">
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="job" value="upload">
<input type="file" name="uploadfile" class="w-50">
<label>改名:<input type="text" name="filename" class="admin-input-sm"></label>
<button type="submit" name="sb1" class="btn btn-success btn-sm">保存</button>
</form>
</td>
</tr>
<tr>
<td width="50%">选择文件</td>
<td width="20%">文件大小</td>
<td>修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = "";
$ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>选择模板</title>
<link rel="stylesheet" href="../../static/web/font/css/font-awesome.min.css">
<link rel="stylesheet" href="../../static/web/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/web/css/admin.css">
<style>body{background:#f5f5f5}.upload-bg{margin:10px;background:#fff;border-radius:.5rem;box-shadow:0 .125rem .25rem rgba(0,0,0,.075)}</style>
</head>
<body>
<div class="upload-bg">
<table cellpadding="0" cellspacing="1" align="center" class="table icon">
<tr>
<td colspan="3">
<form action="select_templets_post.php" method="POST" enctype="multipart/form-data" name="myform">
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="job" value="upload">
<input type="file" name="uploadfile" class="w-50">
<label>改名:<input type="text" name="filename" class="admin-input-sm"></label>
<button type="submit" name="sb1" class="btn btn-success btn-sm">保存</button>
</form>
</td>
</tr>
<tr>
<td width="50%">选择文件</td>
<td width="20%">文件大小</td>
<td>修改时间</td>
</tr>
<?php
$dh = scandir($inpath);
$ty1 = "";
$ty2 = "";
foreach ($dh as $file) {
//计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1.".".substr($ty2, 0, 2);
@@ -203,5 +193,15 @@ if (empty($comeback)) {
?>
</table>
</div>
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
window.opener.document.<?php echo $f ?>.value = reimg;
if (document.all) window.opener = true;
window.close();
}
</script>
</body>
</html>

+ 3
- 3
src/admin/dialog/select_templets_post.php View File

@@ -14,7 +14,7 @@ if (empty($uploadfile)) {
$uploadfile = "";
}
if (!is_uploaded_file($uploadfile)) {
ShowMsg("您没有选择上传文件", "-1");
ShowMsg("您没有选择上传文件", "-1");
exit();
}
if (!preg_match("#^text#", $uploadfile_type)) {
@@ -22,7 +22,7 @@ if (!preg_match("#^text#", $uploadfile_type)) {
exit();
}
if (!preg_match("#\.(".$cfg_txttype.")#i", $uploadfile_name)) {
ShowMsg("您所上传的模板文件类型不能被识别,只允许htm、html、tpl、txt扩展名", "-1");
ShowMsg("您上传的模板文件类型存在问题,请使用htm、html、tpl、txt扩展名", "-1");
exit();
}
if ($filename =='') {
@@ -30,7 +30,7 @@ if ($filename =='') {
}
$filename = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $filename));
if ($filename == '' || !preg_match("#\.(".$cfg_txttype.")#i", $filename)) {
ShowMsg("您上传的文件存在问题,请检查文件类型是否适合", "-1");
ShowMsg("您上传的文件存在问题,请检查文件类型", "-1");
exit();
}
$fullfilename = $cfg_basedir.$activepath."/".$filename;


+ 1
- 1
src/admin/file_class.php View File

@@ -32,7 +32,7 @@ class FileManagement
$newext = pathinfo($newname)['extension'];
if ($oldext != $newext) {
if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)$#i', trim($newname))) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
}


+ 1
- 1
src/admin/file_manage_control.php View File

@@ -41,7 +41,7 @@ else if ($fmdo == "edit") {
CheckCSRF();
$filename = str_replace("..", "", $filename);
if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)$#i', trim($filename))) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
$file = "$cfg_basedir$activepath/$filename";


+ 1
- 1
src/admin/friendlink_edit.php View File

@@ -44,7 +44,7 @@ if ($dopost == "delete") {
}
if (!empty($logoimg)) {
if (!is_uploaded_file($logoimg)) {
ShowMsg("您没有选择上传文件".$logoimg, "-1");
ShowMsg("您没有选择上传文件".$logoimg, "-1");
exit();
}
$mime = get_mime_type($logoimg);


+ 2
- 2
src/admin/inc/inc_archives_functions.php View File

@@ -354,7 +354,7 @@ function GetDDImage($litpic, $picname, $isremote)
$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png");
$_FILES[$litpic]['type'] = strtolower(trim($_FILES[$litpic]['type']));
if (!in_array($_FILES[$litpic]['type'], $sparr)) {
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG格式的其中一种", "-1");
ShowMsg("您上传的图片格式错误,请使用jpg、png、gif、wbmp格式其中一种", "-1");
exit();
}
$savepath = $cfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
@@ -669,7 +669,7 @@ function UploadOneImage($upname, $handurl = '', $isremote = 1, $ntitle = '')
$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png");
$_FILES[$upname]['type'] = strtolower(trim($_FILES[$upname]['type']));
if (!in_array($_FILES[$upname]['type'], $sparr)) {
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG格式的其中一种", "-1");
ShowMsg("您上传的图片格式错误,请使用jpg、png、gif、wbmp格式其中一种", "-1");
exit();
}
if (!empty($handurl) && !preg_match("#^http:\/\/#i", $handurl) && file_exists($cfg_basedir.$handurl)) {


+ 1
- 1
src/admin/inc/inc_menu_module.php View File

@@ -26,7 +26,7 @@ while ($row = $dsql->GetObject()) {
}
$adminMenu = '';
if ($cuserLogin->getUserType() >= 10) {
$adminMenu = DEDEBIZ_SAFE_MODE? "" : "<m:top item='6_' name='模块管理' c='6,' icon='fa-database'>
$adminMenu = DEDEBIZ_SAFE_MODE? "" : "<m:top item='6_' name='模块管理' icon='fa-database'>
<m:item name='模块管理' link='module_main.php' rank='sys_module' target='main' />
<m:item name='模块打包' link='module_make.php' rank='sys_module' target='main' />
</m:top>";


+ 1
- 1
src/admin/makehtml_homepage.php View File

@@ -61,7 +61,7 @@ if ($dopost == "view") {
$remotepos = empty($remotepos) ? '/index.html' : $remotepos;
$serviterm = empty($serviterm) ? "" : $serviterm;
if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)$#i', trim($position))) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
$homeFile = DEDEADMIN."/".$position;


+ 1
- 1
src/admin/media_add.php View File

@@ -53,7 +53,7 @@ if ($dopost == "upload") {
CloseFtp();
}
if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)$#i', trim($newname))) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
$fullfilename = $cfg_basedir.$filename;


+ 1
- 1
src/admin/sys_info_mark.php View File

@@ -33,7 +33,7 @@ if ($action == "save") {
if (is_uploaded_file($newimg)) {
$imgfile_type = strtolower(trim($newimg_type));
if (!in_array($imgfile_type, $allow_mark_types)) {
ShowMsg("上传的图片格式错误,请使用 gif、png格式的其中一种", "-1");
ShowMsg("上传的图片格式错误,请使用gif、png格式的其中一种", "-1");
exit();
}
if ($imgfile_type == 'image/xpng' || $imgfile_type == 'image/png') {


+ 8
- 8
src/admin/templets/action_search.htm View File

@@ -14,14 +14,14 @@
<td bgcolor="#f5f5f5">当前位置 &gt; <?php echo $keyword;?>搜索结果</td>
</tr>
<?php foreach ($asresult as $row) {?>
<tr>
<td bgcolor="#e9ecef"><?php echo $row['toptitle'] ?> => <?php echo $row['title'] ?></td>
</tr>
<?php foreach ($row['soniterm'] as $rows) {?>
<tr>
<td><a href="<?php echo $rows['linkurl'] ?>" target="main"><?php echo $rows['title'] ?></a><?php echo $rows['description'] ?></td>
</tr>
<?php }?>
<tr>
<td bgcolor="#e9ecef"><?php echo $row['toptitle'] ?> => <?php echo $row['title'] ?></td>
</tr>
<?php foreach ($row['soniterm'] as $rows) {?>
<tr>
<td><a href="<?php echo $rows['linkurl'] ?>" target="main"><?php echo $rows['title'] ?></a><?php echo $rows['description'] ?></td>
</tr>
<?php }?>
<?php }?>
</table>
</body>

+ 1
- 1
src/admin/templets/album_add.htm View File

@@ -390,7 +390,6 @@
}
}
</script>
<script>InitPage();</script>
<script>
$("#iptAlbumImages").change(function(val){
for (let i = 0; i < val.target.files.length; i++) {
@@ -418,5 +417,6 @@
}
})
</script>
<script>InitPage();</script>
</body>
</html>

+ 1
- 1
src/admin/templets/album_edit.htm View File

@@ -440,7 +440,6 @@
}
}
</script>
<script>InitPage();</script>
<script>
$(".btnEdit").change(function(val){
var formData = new FormData();
@@ -491,5 +490,6 @@
}
})
</script>
<script>InitPage();</script>
</body>
</html>

+ 23
- 23
src/admin/templets/freelist_main.htm View File

@@ -10,33 +10,11 @@
<script src="../static/web/js/jquery.min.js"></script>
<script src="../static/web/js/webajax.js"></script>
<script src="js/main.js"></script>
</head>
<body>
<table cellpadding="5" cellspacing="1" align="center" class="table maintable my-3">
<tr bgcolor="#f5f5f5">
<td>
<input type="text" name="keyword" id="keyword" value="<?php echo $keyword?>" class="admin-input-lg mr-3">
<button type="submit" name="Submit2" class="btn btn-success btn-sm">搜索</button>
<button type="button" name="bt1" onclick="location='freelist_add.php';" class="btn btn-success btn-sm">添加列表</button>
<button type="button" name="bt2" onclick="location='makehtml_freelist.php';" class="btn btn-success btn-sm">更新所有列表</button>
</td>
</tr>
</table>
<div id="rslist"><?php GetTagList($dsql,$pageno,$pagesize,$orderby);?></div>
<table cellpadding="1" cellspacing="1" align="center" class="table maintable mb-3">
<tr>
<td bgcolor="#f5f5f5">
<div id="pagelist">
<script>ReloadPageNum(1);</script>
</div>
</td>
</tr>
</table>
<script>
var pageno = 1;
var totalrow = parseInt('<?php echo $totalRow;?>');
var pagesize = parseInt('<?php echo $pagesize;?>');
var orderby = '<?php echo $orderby?>';
var orderby = "<?php echo $orderby?>";
var addget = "<?php echo $addget?>";
//加载列表
function ReloadPage(ordertype) {
@@ -126,5 +104,27 @@
ListArea.innerHTML = ahtml+"</ul>";
}
</script>
</head>
<body>
<table cellpadding="5" cellspacing="1" align="center" class="table maintable my-3">
<tr bgcolor="#f5f5f5">
<td>
<input type="text" name="keyword" id="keyword" value="<?php echo $keyword?>" class="admin-input-lg mr-3">
<button type="submit" name="Submit2" class="btn btn-success btn-sm">搜索</button>
<button type="button" name="bt1" onclick="location='freelist_add.php';" class="btn btn-success btn-sm">添加列表</button>
<button type="button" name="bt2" onclick="location='makehtml_freelist.php';" class="btn btn-success btn-sm">更新所有列表</button>
</td>
</tr>
</table>
<div id="rslist"><?php GetTagList($dsql,$pageno,$pagesize,$orderby);?></div>
<table cellpadding="1" cellspacing="1" align="center" class="table maintable mb-3">
<tr>
<td bgcolor="#f5f5f5">
<div id="pagelist">
<script>ReloadPageNum(1);</script>
</div>
</td>
</tr>
</table>
</body>
</html>

+ 14
- 14
src/admin/templets/search_keywords_main.htm View File

@@ -12,22 +12,11 @@
<script src="js/key.js"></script>
<script src="../static/web/js/webajax.js"></script>
<script src="js/main.js"></script>
</head>
<body>
<div id="rslist"><?php GetKeywordList($dsql,$pageno,$pagesize,$orderby);?></div>
<table cellpadding="1" cellspacing="1" align="center" class="table maintable mb-3">
<tr>
<td bgcolor="#f5f5f5" align="center">
<span id="pagelist"></span>
<script>ReloadPageNum(1);</script>
</td>
</tr>
</table>
<script>
var pageno = 1;
var totalrow = <?php echo $totalRow?>;
var pagesize = <?php echo $pagesize?>;
var orderby = '<?php echo $orderby?>';
var totalrow = "<?php echo $totalRow?>";
var pagesize = "<?php echo $pagesize?>";
var orderby = "<?php echo $orderby?>";
//加载列表
function ReloadPage(ordertype) {
orderby = ordertype;
@@ -144,5 +133,16 @@
ListArea.innerHTML = ahtml+"</ul>";
}
</script>
</head>
<body>
<div id="rslist"><?php GetKeywordList($dsql,$pageno,$pagesize,$orderby);?></div>
<table cellpadding="1" cellspacing="1" align="center" class="table maintable mb-3">
<tr>
<td bgcolor="#f5f5f5" align="center">
<span id="pagelist"></span>
<script>ReloadPageNum(1);</script>
</td>
</tr>
</table>
</body>
</html>

+ 1
- 1
src/admin/templets_one_add.php View File

@@ -18,7 +18,7 @@ if ($dopost == "save") {
$filename = preg_replace("#^\/#", "", $nfilename);
if (DEDEBIZ_SAFE_MODE) $ismake = 0; //安全模式不允许编译
if (!preg_match('#\.htm$#i', trim($template))) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
if ($likeid == '') {


+ 1
- 1
src/admin/templets_one_edit.php View File

@@ -19,7 +19,7 @@ if ($dopost == "saveedit") {
$filename = preg_replace("#^\/#", "", $nfilename);
if (DEDEBIZ_SAFE_MODE) $ismake = 0; //安全模式不允许编译
if (!preg_match('#\.htm$#i', trim($template))) {
ShowMsg("指定的文件名已被系统禁止", "javascript:;");
ShowMsg("文件扩展名已被系统禁止", "javascript:;");
exit();
}
//如果修改了文件名,删除旧文件


+ 13
- 17
src/system/helpers/upload.helper.php View File

@@ -17,8 +17,8 @@ if (!defined('DEDEINC')) exit('dedebiz');
* @param string $ftype 文件类型
* @param string $rnddd 后缀数字
* @param bool $watermark 是否水印
* @param string $filetype image、media、addon $file_type='' 对于swfupload上传的文件,因为没有filetype,所以需指定,并且有些特殊之处不同
* @return int -1没选定上传文件,0文件类型不允许, -2保存失败
* @param string $filetype image、media、addon $file_type='' 对于swfupload上传的文件,因为没有filetype,所以需指定,并且有些特殊之处不同
* @return int -1没选定上传文件,0文件类型不允许-2保存失败
*/
if (!function_exists('AdminUpload')) {
function AdminUpload($uploadname, $ftype = 'image', $rnddd = 0, $watermark = TRUE, $filetype = '')
@@ -90,14 +90,12 @@ if (!function_exists('AdminUpload')) {
return $fileurl;
}
}
//前台会员通用上传函数
//$upname 是文件上传框的表单名,而不是表单的变量
//$handname 允许会员手工指定网址情况下的网址
//前台会员通用上传函数:$upname是文件上传框的表单名,而不是表单的变量;$handname允许会员手工指定网址情况下的网址
if (!function_exists('MemberUploads')) {
function MemberUploads($upname, $handname, $userid = 0, $utype = 'image', $exname = '', $maxwidth = 0, $maxheight = 0, $water = false, $isadmin = false)
{
global $cfg_imgtype, $cfg_mb_addontype, $cfg_mediatype, $cfg_user_dir, $cfg_basedir, $cfg_dir_purview;
//当为游客投稿的情况下,这个 id 0
//当为游客投稿的情况下,这个id为0
if (empty($userid)) $userid = 0;
if (!is_dir($cfg_basedir.$cfg_user_dir."/$userid")) {
MkdirAll($cfg_basedir.$cfg_user_dir."/$userid", $cfg_dir_purview);
@@ -112,23 +110,23 @@ if (!function_exists('MemberUploads')) {
//源文件类型检查
if ($utype == 'image') {
if (!preg_match("/\.(".$cfg_imgtype.")$/", $GLOBALS[$upname.'_name'])) {
ShowMsg("您所上传的图片类型不在许可列表,请上传{$cfg_imgtype}类型", '-1');
ShowMsg("您上传的图片类型错误,请上传{$cfg_imgtype}类型", "-1");
exit();
}
$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp");
$imgfile_type = strtolower(trim($GLOBALS[$upname.'_type']));
if (!in_array($imgfile_type, $sparr)) {
ShowMsg('上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种', '-1');
ShowMsg("您上传的图片格式错误,请使用jpg、png、gif、wbmp格式其中一种", "-1");
exit();
}
} else if ($utype == 'flash' && !preg_match("/\.swf$/", $GLOBALS[$upname.'_name'])) {
ShowMsg('上传的文件必须为flash文件', '-1');
ShowMsg("上传的文件必须为flash文件", "-1");
exit();
} else if ($utype == 'media' && !preg_match("/\.(".$cfg_mediatype.")$/", $GLOBALS[$upname.'_name'])) {
ShowMsg('您所上传的文件类型必须为:'.$cfg_mediatype, '-1');
ShowMsg("您上传的文件类型必须为:$cfg_mediatype", "-1");
exit();
} else if (!preg_match("/\.(".$allAllowType.")$/", $GLOBALS[$upname.'_name'])) {
ShowMsg("您上传的文件类型不被允许", '-1');
ShowMsg("您上传的文件类型不被允许", '-1');
exit();
}
//再次严格检测文件扩展名是否符合系统定义的类型
@@ -136,12 +134,12 @@ if (!function_exists('MemberUploads')) {
$sname = $fs[count($fs) - 1];
$alltypes = explode('|', $allAllowType);
if (!in_array(strtolower($sname), $alltypes)) {
ShowMsg('您上传的文件类型不被允许', '-1');
ShowMsg('您上传的文件类型不被允许', '-1');
exit();
}
//强制禁止的文件类型
if (preg_match("/(asp|php|pl|cgi|shtm|js)$/", $sname)) {
ShowMsg('您上传的文件为系统禁止的类型', '-1');
ShowMsg("您上传的文件已被系统禁止", '-1');
exit();
}
if ($exname == '') {
@@ -162,7 +160,7 @@ if (!function_exists('MemberUploads')) {
@unlink($GLOBALS[$upname]);
if (@filesize($cfg_basedir.$filename) > $GLOBALS['cfg_mb_upload_size'] * 1024) {
@unlink($cfg_basedir.$filename);
ShowMsg('您上传的文件超出系统大小限制', '-1');
ShowMsg("您上传的文件超出系统大小限制", "-1");
exit();
}
//加水印或缩小图片
@@ -185,9 +183,7 @@ if (!function_exists('MemberUploads')) {
exit('Not allow filename for not safe!');
} else if (!preg_match("/\.(".$allAllowType.")$/", $handname)) {
exit('Not allow filename for filetype!');
}
//2011-4-10 修复会员中心修改相册时候错误(by:jason123j)
else if (!preg_match('#^http:#', $handname) && !preg_match('#^'.$cfg_user_dir.'/'.$userid."#", $handname) && !$isadmin) {
} else if (!preg_match('#^http:#', $handname) && !preg_match('#^'.$cfg_user_dir.'/'.$userid."#", $handname) && !$isadmin) {
exit('Not allow filename for not userdir!');
}
return $handname;


Loading…
Cancel
Save