mirror of
https://github.com/icret/EasyImages2.0.git
synced 2025-01-08 11:58:03 +08:00
file manage change
This commit is contained in:
parent
0a2e2d63b4
commit
700e001de1
@ -923,7 +923,7 @@ auto_delete(); //定时删除
|
||||
</div>
|
||||
<form class="form-inline" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
|
||||
<input class="form-control" type="hidden" name="delDir" value="/suspic/" readonly="">
|
||||
<a class="btn btn-mini btn-primary" href="../i/manag.php?path=suspic" target="_blank">管理可疑</a>
|
||||
<a class="btn btn-mini btn-primary" href="filer.php?path=<?php echo $config['path']; ?>suspic" target="_blank">管理可疑</a>
|
||||
<button class="btn btn-mini btn-danger"><?php echo $cache_num; ?>张 | 删除全部</button>
|
||||
</form>
|
||||
</div>
|
||||
@ -1271,7 +1271,7 @@ auto_delete(); //定时删除
|
||||
</div>
|
||||
<form class="form-inline" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
|
||||
<input class="form-control" type="hidden" name="delDir" value="/recycle/" readonly="">
|
||||
<a class="btn btn-mini btn-primary" href="../i/manag.php?path=recycle" target="_blank">管理回收</a>
|
||||
<a class="btn btn-mini btn-primary" href="filer.php?path=<?php echo $config['path']; ?>recycle" target="_blank">管理回收</a>
|
||||
<button class="btn btn-mini btn-danger"><?php echo $cache_num; ?>张 | 删除全部</button>
|
||||
</form>
|
||||
</div>
|
||||
@ -1383,7 +1383,7 @@ auto_delete(); //定时删除
|
||||
<div class="tab-pane fade" id="Content14">
|
||||
<h5 class="header-dividing">文件管理 <small>由作者定制,非必要请勿替换</small></h5>
|
||||
<a class="btn btn-mini btn-primary" href="/admin/manager.php?p=<?php echo date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用Tinyfilemanager管理文件"><i class="icon icon-folder-open"> 文件管理</i></a>
|
||||
<a class="btn btn-mini btn-primary" href="/i/manag.php?path=<?php echo date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用web-indexr管理文件"><i class="icon icon-folder-close"> 文件管理</i></a>
|
||||
<a class="btn btn-mini btn-primary" href="filer.php?path=<?php echo $config['path'] . date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用web-indexr管理文件"><i class="icon icon-folder-close"> 文件管理</i></a>
|
||||
<h5 class="header-dividing">删除文件 <small>* 删除后不可恢复</small></h5>
|
||||
<form class="form-inline" method="get" action="../app/del.php" id="form" name="delForm" target="_blank" style="margin-bottom: 5px;">
|
||||
<p id="delimgurl"></p>
|
||||
|
@ -4,36 +4,44 @@
|
||||
* Powered by https://github.com/rehiy/web-indexr
|
||||
*/
|
||||
|
||||
session_start();
|
||||
|
||||
/**开始 - 自定义修改 */
|
||||
require_once __DIR__ . '/../app/function.php';
|
||||
require_once APP_ROOT . '/config/config.php';
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
|
||||
// 开启tinyfilemanager文件管理
|
||||
if (!$config['file_manage']) {
|
||||
require_once APP_ROOT . '/app/header.php';
|
||||
echo '<h4 class="alert alert-danger">文件管理已关闭~~</h4>';
|
||||
header("refresh:3;url=" . $config['domain'] . '?manag-closed');
|
||||
require_once APP_ROOT . '/app/footer.php';
|
||||
exit;
|
||||
exit(require_once APP_ROOT . '/app/footer.php');
|
||||
}
|
||||
/**结束 - 自定义修改 */
|
||||
|
||||
// 根路径
|
||||
RexHelper::$root = APP_ROOT . $config['path'];
|
||||
// 目录绝对路径,结尾不加 `/`
|
||||
// RexHelper::$root = $_SERVER['DOCUMENT_ROOT'];
|
||||
RexHelper::$root = $_SERVER['DOCUMENT_ROOT'];
|
||||
|
||||
// 用户列表
|
||||
RexHelper::$users = array(
|
||||
$config['user'] => array('password' => $config['password']),
|
||||
|
||||
// 系统用户列表,密码类型 MD5
|
||||
RexHelper::$users[$config['user']] = array(
|
||||
'password' => $config['password']
|
||||
);
|
||||
|
||||
/**结束 - 自定义修改 */
|
||||
// 可编辑文件后缀,开头不加 `.`
|
||||
// RexHelper::$text_suff[] = "jsx";
|
||||
// RexHelper::$text_suff[] = "php5";
|
||||
|
||||
// 文件排除规则,仅正则表达式
|
||||
RexHelper::$ignore_list = array(
|
||||
'/^\.git|.php|.htaccess|robots.txt|favicon.ico|README.md/', '/^admin|api|app|config|docs|install|public/'
|
||||
);
|
||||
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="zh-Hans-CN">
|
||||
|
||||
<head>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="renderer" content="webkit" />
|
||||
@ -158,7 +166,7 @@ class RExplorer
|
||||
static function view_login($path)
|
||||
{
|
||||
echo '
|
||||
<div class="login">
|
||||
<div class="login"">
|
||||
<form class="form-horizontal" method="post" action="?action=login">
|
||||
<h5 class="card-title text-center mb-5">文件管理 <small>v' . RexHelper::$version . '</small></h5>
|
||||
<div class="form-group">
|
||||
@ -168,7 +176,7 @@ class RExplorer
|
||||
<div class="form-group">
|
||||
<label for="exampleInputInviteCode3">密码</label>
|
||||
<input type="password" class="form-control" name="password" id="exampleInputInviteCode3" placeholder="登录密码">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">登录</button>
|
||||
</form>
|
||||
</div>';
|
||||
@ -210,12 +218,15 @@ class RExplorer
|
||||
foreach ($fslist as $item) {
|
||||
$suffix = $item->isDir() ? '/' : '';
|
||||
$srpath = RexHelper::path_ator($item->getRealPath());
|
||||
if (RexHelper::is_ignore($item->getFileName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
if (RexHelper::file_catetory($srpath) == 'image') {
|
||||
echo '
|
||||
<td>
|
||||
<img data-toggle="lightbox" src="/../app/thumb.php?img=', $srpath, '" data-image="' . $srpath . '" data-caption="查看原图" class="img-thumbnail" alt="查看原图" width="80">
|
||||
<img data-toggle="lightbox" src="../app/thumb.php?img=', $srpath, '" data-image="' . $srpath . '" data-caption="查看原图" class="img-thumbnail" alt="查看原图" width="80">
|
||||
</td>';
|
||||
} else {
|
||||
echo '
|
||||
@ -234,7 +245,6 @@ class RExplorer
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
@ -328,10 +338,12 @@ class RExplorer
|
||||
return;
|
||||
case 'image':
|
||||
echo '
|
||||
<img data-toggle="lightbox" src="/../app/thumb.php?img=', $path, '" data-image="' . $path . '" data-caption="小图看大图" class="img-thumbnail" alt="" width="200">
|
||||
<div class="card view-image">
|
||||
<img src="', $path, '" class="card-img-top">
|
||||
<div class="card-body">
|
||||
<a href="', $path, '" target="_blank">查看原图</a>
|
||||
<a href="', $path, '" class="card-link">查看原图</a>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
return;
|
||||
default:
|
||||
@ -447,7 +459,7 @@ class RExplorer
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">压缩文件名</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="filename" value="/EasyImage2.0.zip">
|
||||
<input type="text" class="form-control" name="filename" value="/test.zip">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
@ -488,7 +500,7 @@ class RExplorer
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">压缩包路径</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="filename" value="/EasyImage2.0.zip">
|
||||
<input type="text" class="form-control" name="filename" value="/test.zip">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
@ -892,14 +904,24 @@ class RexHelper
|
||||
{
|
||||
static $root = __DIR__;
|
||||
|
||||
static $version = '1.3';
|
||||
static $version = '1.4';
|
||||
|
||||
static $ssid = 'rexplorer_sid';
|
||||
|
||||
static $users = array(
|
||||
'admin' => array('password' => 'e6e061838856bf47e1de730719fb2609'),
|
||||
static $users = array();
|
||||
|
||||
static $text_suff = array(
|
||||
'sql', 'tpl', 'php', 'htm', 'html', 'ts', 'js', 'css',
|
||||
'bat', 'sh', 'md', 'log', 'txt', 'json', 'env', 'ini',
|
||||
);
|
||||
|
||||
static $img_suff = array(
|
||||
'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico', 'jfif',
|
||||
'tif', 'tga', 'svg'
|
||||
);
|
||||
|
||||
static $ignore_list = array();
|
||||
|
||||
/**
|
||||
* 优化容量显示
|
||||
* @param string $path 路径
|
||||
@ -947,19 +969,33 @@ class RexHelper
|
||||
static function file_catetory($path)
|
||||
{
|
||||
if ($ext = pathinfo($path, PATHINFO_EXTENSION)) {
|
||||
$text_types = array(
|
||||
'sql', 'tpl', 'php', 'htm', 'html', 'js', 'css',
|
||||
'sh', 'md', 'log', 'txt', 'json', 'env', 'ini',
|
||||
);
|
||||
if (in_array($ext, $text_types)) {
|
||||
if (in_array($ext, self::$text_suff)) {
|
||||
return 'text';
|
||||
}
|
||||
}
|
||||
if (@getimagesize($path)) {
|
||||
return 'image';
|
||||
|
||||
if (in_array($ext, self::$img_suff)) {
|
||||
return 'image';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否需要排除
|
||||
* @param string $name 文件名称
|
||||
* @return string
|
||||
*/
|
||||
static function is_ignore($name)
|
||||
{
|
||||
if (!empty(self::$ignore_list)) {
|
||||
foreach (self::$ignore_list as $expr) {
|
||||
if (preg_match($expr, $name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
@ -28,7 +28,7 @@ if (empty($_FILES['file'])) {
|
||||
}
|
||||
|
||||
// sign
|
||||
if (empty($_REQUEST['sign']) || $_REQUEST['sign'] !== date('YmdH')) {
|
||||
if (empty($_POST['sign']) || $_POST['sign'] !== date('YmdH')) {
|
||||
exit(json_encode(array(
|
||||
"result" => "failed",
|
||||
"code" => 403,
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user