mirror of
https://github.com/xiaoqidun/phpcp.git
synced 2024-09-12 18:59:04 +08:00
feat(首次发布): 添加项目文件
This commit is contained in:
parent
09edb92e2a
commit
fdbb417665
6
404.php
Normal file
6
404.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
xhtml_head("ERROR 404 !");
|
||||
echo "<div class=\"error\">你的请求无法找到 - ERROR 404 !</div>";
|
||||
xhtml_footer();
|
||||
?>
|
@ -1 +1 @@
|
||||
# phpcp
|
||||
# 爱特PHP全能文件专家(php control panel)
|
||||
|
36
auto.php
Normal file
36
auto.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if (basename($_SERVER['SCRIPT_NAME']) != "auto.php") {
|
||||
if (!file_exists("admin.php")) {
|
||||
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['password2'])) {
|
||||
if (strlen($u = trim($_POST['username'])) >= 5 && strlen($p = trim($_POST['password'])) >= 5 && $p === trim($_POST['password2'])) {
|
||||
$data = "<?php\ndefine(\"U\",\"$u\");\ndefine(\"P\",\"$p\");\n?>";
|
||||
if (file_put_contents("admin.php", $data)) {
|
||||
header("Location: {$_SERVER['SCRIPT_NAME']}?{$_SERVER['QUERY_STRING']}");
|
||||
exit;
|
||||
} else {
|
||||
$info = "没有权限写入配置文件!";
|
||||
}
|
||||
} else {
|
||||
$info = "没有正确输入配置信息!";
|
||||
}
|
||||
}
|
||||
require "xhtml.php";
|
||||
header("Content-Type:text/html;charset=UTF-8");
|
||||
xhtml_head("配置系统");
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"{$_SERVER['SCRIPT_NAME']}?{$_SERVER['QUERY_STRING']}\" method=\"POST\">\n";
|
||||
echo "用户昵称:<br />\n<input type=\"text\" name=\"username\" /><br />\n";
|
||||
echo "用户密码:<br />\n<input type=\"text\" name=\"password\" /><br />\n";
|
||||
echo "重复密码:<br />\n<input type=\"password\" name=\"password2\" /><br />\n";
|
||||
echo "<input type=\"submit\" value=\"配置超级帐号\" />\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
if (isset($info)) {
|
||||
echo "<div class=\"like\">\n配置系统错误信息\n</div>\n";
|
||||
echo "<div class=\"love\">\n$info\n</div>\n";
|
||||
}
|
||||
xhtml_footer();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
28
autocp.php
Normal file
28
autocp.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['path'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (!file_exists($path = trim($_GET['path']))) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
}
|
||||
xhtml_head("创建复件");
|
||||
echo "[<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\">返回目录</a>]\n";
|
||||
if (isset($_GET['yes'])) {
|
||||
$to = dirname($path) . "/" . ___basename($path) . "-copy";
|
||||
if (file_exists($to)) {
|
||||
echo "目标复件已经存在!";
|
||||
} else {
|
||||
$fs = new filesystem($path);
|
||||
if ($fs->cppath($to)) {
|
||||
echo "成功为您创建复件!";
|
||||
} else {
|
||||
echo "无法为您创建复件!";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "需要复件,<a href=\"?yes&path=" . urlencode($path) . "\">确认创建</a>?";
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
65
autopk.php
Normal file
65
autopk.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['path'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (!is_file($path = trim($_GET['path']))) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (!is_readable($path)) {
|
||||
xhtml_head("压缩文件");
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\"]>返回目录</a>错误提示\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "此文件您没有读取权限!";
|
||||
echo "</div>\n";
|
||||
xhtml_footer();
|
||||
exit;
|
||||
}
|
||||
xhtml_head("压缩文件");
|
||||
echo "[<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\">返回目录</a>]\n";
|
||||
if (isset($_GET['pk'])) {
|
||||
$pk = trim($_GET['pk']);
|
||||
if ($pk != "gz" && $pk != "bz2") {
|
||||
echo "无法支持你的压缩!";
|
||||
} elseif (file_exists("$path.$pk")) {
|
||||
echo "目标压缩已经存在!";
|
||||
} elseif (!($fp = fopen($path, "rb"))) {
|
||||
echo "无法打开您的文件!";
|
||||
} else {
|
||||
switch ($pk) {
|
||||
case "gz" :
|
||||
if (!function_exists("gzopen")) {
|
||||
echo "没有核心函数支持!";
|
||||
} elseif (!($gz = gzopen("$path.$pk", "w"))) {
|
||||
echo "无法打开目标文件!";
|
||||
} else {
|
||||
while (!feof($fp)) {
|
||||
gzwrite($gz, fread($fp, 4096));
|
||||
}
|
||||
gzclose($gz);
|
||||
echo "压缩文件已经创建!";
|
||||
}
|
||||
break;
|
||||
case "bz2" :
|
||||
if (!function_exists("bzopen")) {
|
||||
echo "没有核心函数支持!";
|
||||
} elseif (!($bz2 = bzopen("$path.$pk", "w"))) {
|
||||
echo "无法打开目标文件!";
|
||||
} else {
|
||||
while (!feof($fp)) {
|
||||
bzwrite($bz2, fread($fp, 4096));
|
||||
}
|
||||
bzclose($bz2);
|
||||
echo "压缩文件已经创建!";
|
||||
}
|
||||
break;
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
} else {
|
||||
echo "创建<a href=\"?pk=gz&path=" . urlencode($path) . "\">Gzip</a> <a href=\"?pk=bz2&path=" . urlencode($path) . "\">Bzip2</a>压缩!";
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
35
chmod.php
Normal file
35
chmod.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['recursive']) || !isset($_GET['dirperms']) || !isset($_GET['fileperms']) || !isset($_SESSION['flist'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
}
|
||||
if (!isset($_GET['getcwd'])) {
|
||||
$getcwd = OPEN;
|
||||
} else {
|
||||
$getcwd = ___realpath(trim($_GET['getcwd']));
|
||||
}
|
||||
xhtml_head("批量改权");
|
||||
if (count($_SESSION['flist']) < 1) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回</a>]抱歉,文件清单为空!\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
$i = 0;
|
||||
$fs = new filesystem();
|
||||
$recursive = trim($_GET['recursive']) == "on" ? true : false;
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
|
||||
echo "</div>";
|
||||
while ($i < count($_SESSION['flist'])) {
|
||||
$fs->chpath($tmp = $_SESSION['flist'][$i]);
|
||||
if ($fs->chmod(trim($_GET['dirperms']), trim($_GET['fileperms']), $recursive)) {
|
||||
echo "<div class=\"love\">[$i][√] - $tmp</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"error\">[$i][×] - $tmp</div>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
182
config.php
Normal file
182
config.php
Normal file
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
/**************
|
||||
* 爱特网站文件专家
|
||||
* ----------------
|
||||
* 01.文件批量压缩功能
|
||||
* 02.批量网址获取文件
|
||||
* 03.文件批量上传功能
|
||||
* 04.强大权限设置支持
|
||||
* 05.批量文件删除功能
|
||||
* 06.批量文件复制支持
|
||||
* 07.批量文件移动支持
|
||||
* 08.批量建立目录文件
|
||||
* 09.高级终端命令执行
|
||||
* 10.批量文件传至邮箱
|
||||
* 11.实用文件清单支持
|
||||
* 12.自定编码查看文件
|
||||
* 13.自定编码编辑文件
|
||||
* 14.目录与文件的命名
|
||||
* 15.创建文件复件支持
|
||||
* 16.目录位置允许跳转
|
||||
* 17.文件效验Md5,Sha1
|
||||
* 18.硬盘使用情况查看
|
||||
* 19.任意文件下载支持
|
||||
* 20.牛逼强大解压支持
|
||||
* 21.文件编码转换工具
|
||||
* 22.下载文件断点续传
|
||||
* ----------------
|
||||
* ->>目前支持压缩类型
|
||||
* Gz,Bz2,Zip
|
||||
* ->>目前支持解压类型
|
||||
* Gz,Bz2,Tar,Tgz,Tbz,Zip
|
||||
* ----------------
|
||||
* ->>爱特文件专家安装
|
||||
* 环境:PHP5+ SESSION
|
||||
* 首次使用提示创建帐号密码
|
||||
* 修改密码直接编辑admin.php
|
||||
* 在Linux操作系统中将更好用
|
||||
* 不选择任何文件则使用清单文件
|
||||
* 选择文件并操作会清空文件清单
|
||||
* 编辑文件如不选择编码将用UTF-8
|
||||
* ->>爱特文件专家技巧
|
||||
* 文件列表添加Ftp://可以操作Ftp文件
|
||||
* 使用远程上传输入Url地址即可导入文件
|
||||
* 用清单功能批量操作不同目录文件,如压缩
|
||||
* 命名功能如果输入绝对路径还可以当移动使
|
||||
* 有时操作重要文件怕出错,文件复件让你安心
|
||||
* 谦容各种浏览器,甚至Elinks也能完美的使用
|
||||
* 更多技巧等你使用,欢迎Bug的反馈与交流讨论
|
||||
* ----------------
|
||||
* -->爱特文件专家作者
|
||||
* 官方网站:aite.me
|
||||
* 官方网站:aite.xyz
|
||||
* 腾讯扣群:38181604
|
||||
* 腾讯扣扣:88966001
|
||||
* 腾讯扣扣:759234755
|
||||
* 电子邮箱:admin@aite.xyz
|
||||
* 电子邮箱:xiaoqidun@gmail.com
|
||||
* 组件下载:http://aite.me/7zrar.zip
|
||||
* 官方更新:http://aite.me/fileadmin.zip
|
||||
* ----------------
|
||||
* -->爱特文件专家版权
|
||||
* 爱特文件专家使用了Pclzip和Archive_Tar
|
||||
* http://www.phpconcept.net/pclzip
|
||||
* http://pear.php.net/package/Archive_Tar
|
||||
* 爱特文件专家除此库之外均为原创编码
|
||||
* ----------------
|
||||
* 如果解压选项中出现了rar和7za二个选项且是linux系统
|
||||
* 你可能需要安装爱特文件专家的unrar和p7zip组件才能用
|
||||
* unrar和p7zip(x64\x86\arm)http://aite.me/7zrar.zip
|
||||
* 借助这二个强大的组件你可以用爱特文件管理器解压任意格式压缩包
|
||||
* 可以用文件管理器的远程下载直接导入unrar和p7zip组件包,然后在线解压
|
||||
* 解压后有x64\x86\arm三个目录,一般空间用x86,一般安卓手机环境用arm组件
|
||||
* 进入对应的组件目录,将p7zip.bin和unrar.bin文件移动到文件管理器目录即可
|
||||
* 然后文件管理器的rar和7za解压选项就可以用了,当然也可以解压带密码压缩包
|
||||
**************/
|
||||
//服务器会话
|
||||
session_start();
|
||||
//错误的屏蔽
|
||||
error_reporting(0);
|
||||
//时间戳修正
|
||||
define("TIME", 8 * 3600);
|
||||
//程序的名称
|
||||
define("NAME", "爱特文件专家");
|
||||
//程序根目录
|
||||
define("ROOT", dirname(__FILE__));
|
||||
//初始化目录
|
||||
define("OPEN", ROOT . "/..");
|
||||
//安装系统吧
|
||||
require ROOT . "/auto.php";
|
||||
//用户认证吧
|
||||
require ROOT . "/admin.php";
|
||||
//载入对象库
|
||||
require ROOT . "/kernel.php";
|
||||
//载入函数库
|
||||
require ROOT . "/xhtml.php";
|
||||
require ROOT . "/system.php";
|
||||
//强制的编码
|
||||
header("Content-Type:text/html;charset=UTF-8");
|
||||
//密匙的安全
|
||||
if (function_exists("chmod")) chmod("admin.php", 0600);
|
||||
//最大化运行
|
||||
if (function_exists("set_time_limit")) set_time_limit(0);
|
||||
if (function_exists("ignore_user_abort")) ignore_user_abort(true);
|
||||
if (function_exists("ini_set")) ini_set("max_execution_time", "0");
|
||||
//用户的登录
|
||||
if (!isset($_SESSION['adminstatus'])) {
|
||||
if (isset($_POST['username']) && isset($_POST['password'])) {
|
||||
if (U === $_POST['username'] && P === $_POST['password']) {
|
||||
$_SESSION['adminstatus'] = true;
|
||||
header("Location: {$_SERVER['SCRIPT_NAME']}?" . str_ireplace("&logout", "", $_SERVER['QUERY_STRING']));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
xhtml_head("安全登录");
|
||||
echo <<<"LOGIN"
|
||||
|
||||
<style type="text/css">
|
||||
input {
|
||||
height: 20px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#dialog_box {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
color: #33384c;
|
||||
padding: 20px;
|
||||
position: fixed;
|
||||
transform: translate(-50%, -50%);
|
||||
box-shadow: 4px 4px 2px rgba(45, 182, 249, 0.91);
|
||||
background-color: #0d84d5;
|
||||
}
|
||||
|
||||
#dialog_screen {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 9;
|
||||
position: fixed;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#dialog_submit {
|
||||
color: #1f2a4c;
|
||||
width: 96%;
|
||||
height: 25px;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
display: block;
|
||||
background: #18dff9;
|
||||
box-shadow: 2px 2px 1px rgba(124, 189, 249, 0.91);
|
||||
margin-top: 20px;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
<div id="dialog_screen">
|
||||
<div id="dialog_box">
|
||||
<form action="{$_SERVER['SCRIPT_NAME']}?{$_SERVER['QUERY_STRING']}" method="POST">
|
||||
管理账号:<input type="text" name="username">
|
||||
<br>
|
||||
<br>
|
||||
管理密码:<input type="password" name="password">
|
||||
<br>
|
||||
<input type="submit" id="dialog_submit" value="登  录  文  管">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
LOGIN;
|
||||
xhtml_footer();
|
||||
exit;
|
||||
} else {
|
||||
if ($_SESSION['adminstatus'] !== true || isset($_GET['logout'])) {
|
||||
unset($_SESSION['adminstatus']);
|
||||
header("Location: {$_SERVER['SCRIPT_NAME']}?" . str_ireplace("&logout", "", $_SERVER['QUERY_STRING']));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
38
copy.php
Normal file
38
copy.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['gopath']) || !isset($_SESSION['flist'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
}
|
||||
if (!isset($_GET['getcwd'])) {
|
||||
$getcwd = OPEN;
|
||||
} else {
|
||||
$getcwd = ___realpath(trim($_GET['getcwd']));
|
||||
}
|
||||
xhtml_head("批量复制");
|
||||
if (!is_dir($gopath = trim($_GET['gopath']))) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./multiple.php?type=copy&getcwd=" . urlencode($getcwd) . "\">返回</a>]抱歉,目标目录非法!\n";
|
||||
echo "</div>\n";
|
||||
} elseif (count($_SESSION['flist']) < 1) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回</a>]抱歉,文件清单为空!\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
$i = 0;
|
||||
$fs = new filesystem();
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
|
||||
echo "</div>";
|
||||
while ($i < count($_SESSION['flist'])) {
|
||||
$fs->chpath($_SESSION['flist'][$i]);
|
||||
if ($fs->cppath($tmp = ($gopath . "/" . ___basename($_SESSION['flist'][$i])))) {
|
||||
echo "<div class=\"love\">[$i][√] - $tmp</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"error\">[$i][×] - $tmp</div>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
122
create.php
Normal file
122
create.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['getcwd'])) {
|
||||
$getcwd = OPEN;
|
||||
} else {
|
||||
$getcwd = ___realpath(trim($_GET['getcwd']));
|
||||
}
|
||||
xhtml_head("建立数据");
|
||||
echo "<div class=\"like\">\n<a href=\"./index.php?path=" . urlencode($getcwd) . "\"]>返回目录</a>\n数据数量</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"\" method=\"GET\">\n";
|
||||
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
|
||||
echo "数量-><input type=\"text\" name=\"createnum\" />\n";
|
||||
echo "<input type=\"submit\" value=\"GO\" />\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
if (isset($_POST['createtype']) && isset($_POST['createpath'])) if (is_array($_POST['createtype']) && is_array($_POST['createpath'])) if (count($_POST['createtype']) == count($_POST['createpath']) && count($_POST['createtype']) > 0) {
|
||||
$o = 0;
|
||||
$i = 0;
|
||||
echo "<div class=\"like\">批量创建数据报告</div>\n";
|
||||
while ($i < count($_POST['createtype'])) {
|
||||
$createtype = trim($_POST['createtype'][$i]);
|
||||
$createpath = trim($_POST['createpath'][$i]);
|
||||
if ($getcwd == $createpath || $createpath == "") {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if ($createtype == "dir") {
|
||||
if (!strstr($createpath, "/") && !strstr($createpath, "\\")) {
|
||||
if (mkdir($getcwd . "/" . $createpath, 0755)) {
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "文件目录 $createpath 成功创建\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "文件目录 $createpath 无法创建\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
} else {
|
||||
if (mkdir($createpath, 0755)) {
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "文件目录 $createpath 成功创建\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "文件目录 $createpath 无法创建\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
} elseif ($createtype == "file") {
|
||||
if (!strstr($createpath, "/") && !strstr($createpath, "\\")) {
|
||||
if (file_exists($getcwd . "/" . $createpath)) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "文件路径 $createpath 已经存在\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
if (!($fp = fopen($getcwd . "/" . $createpath, "w"))) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "空白文件 $createpath 无法创建\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
fclose($fp);
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "空白文件 $createpath 成功创建\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (file_exists($createpath)) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "文件路径 $createpath 已经存在\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
if (!($fp = fopen($createpath, "w"))) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "空白文件 $createpath 无法创建\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
fclose($fp);
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "空白文件 $createpath 成功创建\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$o++;
|
||||
$i++;
|
||||
}
|
||||
if ($o < 1) echo "郁闷,没有任何文件被操作!\n";
|
||||
}
|
||||
echo "<div class=\"like\">定义创建数据路径</div>\n";
|
||||
echo "<form action=\"?getcwd=" . urlencode($getcwd) . "\" method=\"POST\">\n";
|
||||
if (!isset($_GET['createnum'])) {
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<select name=\"createtype[]\">\n";
|
||||
echo "<option value=\"dir\">文件目录</option>\n";
|
||||
echo "<option value=\"file\">空白文件</option>\n";
|
||||
echo "</select>\n";
|
||||
echo "路径[+]<input type=\"text\" name=\"createpath[]\" />\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
$i = 0;
|
||||
$createnum = (int)trim($_GET['createnum']);
|
||||
if ($createnum < 1) $createnum = 1;
|
||||
while ($i < $createnum) {
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<select name=\"createtype[]\">\n";
|
||||
echo "<option value=\"dir\">文件目录</option>\n";
|
||||
echo "<option value=\"file\">空白文件</option>\n";
|
||||
echo "</select>\n";
|
||||
echo "路径[" . ($i + 1) . "]<input type=\"text\" name=\"createpath[]\" />\n";
|
||||
echo "</div>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<input type=\"submit\" value=\"创建所有输入数据\" />(有效 数据)\n";
|
||||
echo "</div>\n";
|
||||
echo "</form>\n";
|
||||
xhtml_footer();
|
||||
?>
|
35
delete.php
Normal file
35
delete.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_SESSION['flist'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
}
|
||||
if (!isset($_GET['getcwd'])) {
|
||||
$getcwd = OPEN;
|
||||
} else {
|
||||
$getcwd = ___realpath(trim($_GET['getcwd']));
|
||||
}
|
||||
xhtml_head("批量删除");
|
||||
if (count($_SESSION['flist']) < 1) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回</a>]抱歉,文件清单为空!\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
$i = 0;
|
||||
$fs = new filesystem();
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
|
||||
echo "</div>";
|
||||
while ($i < count($_SESSION['flist'])) {
|
||||
$fs->chpath($tmp = $_SESSION['flist'][$i]);
|
||||
if ($fs->rmpath()) {
|
||||
echo "<div class=\"love\">[$i][√] - $tmp</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"error\">[$i][×] - $tmp</div>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
unset($_SESSION['flist']);
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
29
dget.php
Normal file
29
dget.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['path'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (($path = trim($_GET['path'])) == "") {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (!is_file($path) || !is_readable($path)) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} else {
|
||||
$myfs = new filesystem($path);
|
||||
$info = $myfs->getpath();
|
||||
if (isset($_GET['mime']) && strlen($mime = trim($_GET['mime'])) >= 3) {
|
||||
header("Content-Type: $mime");
|
||||
} else {
|
||||
___download($path);
|
||||
exit;
|
||||
}
|
||||
header("Accept-Ranges: bytes");
|
||||
header("Content-Length: " . $info['size']);
|
||||
$fp = fopen($path, "rb");
|
||||
while (!feof($fp)) {
|
||||
echo fread($fp, 4096);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
?>
|
102
editor.php
Normal file
102
editor.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['path'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (($path = trim($_GET['path'])) == "") {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (!is_file($path)) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (!is_writable($path)) {
|
||||
xhtml_head("编辑文件");
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\"]>返回目录</a>错误提示\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "此文件您没有写入权限!";
|
||||
echo "</div>\n";
|
||||
xhtml_footer();
|
||||
} else {
|
||||
xhtml_head("编辑文件");
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\"]>返回目录</a>选择编码\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">";
|
||||
echo "<form action=\"\" method=\"GET\">\n";
|
||||
echo "<select name=\"charset\">\n";
|
||||
if (!function_exists("mb_convert_encoding")) {
|
||||
echo "<option>缺少模块</option>\n";
|
||||
} else {
|
||||
$sencode = mb_list_encodings();
|
||||
usort($sencode, "___sortcmp");
|
||||
foreach ($sencode as $encode) {
|
||||
if ($encode == "pass") {
|
||||
continue;
|
||||
}
|
||||
if (function_exists("mb_encoding_aliases")) {
|
||||
$alias = mb_encoding_aliases($encode);
|
||||
echo "\n<optgroup label=\"$encode\">\n";
|
||||
echo "<option value=\"$encode\">$encode</option>\n";
|
||||
if (is_array($alias)) if (count($alias) >= 1) {
|
||||
usort($alias, "___sortcmp");
|
||||
foreach ($alias as $encodealias) {
|
||||
if ($encodealias == $encode) {
|
||||
continue;
|
||||
}
|
||||
echo "<option value=\"$encode\">$encodealias</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
} else {
|
||||
echo "<option value=\"$encode\">$encode</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<input type=\"hidden\" name=\"path\" value=\"$path\" />";
|
||||
echo "<input type=\"submit\" value=\"设置编码\" />\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
if (isset($_POST['content'])) if (trim($_POST['content']) != "") {
|
||||
echo "<div class=\"like\">文件保存情况报告</div>\n";
|
||||
if (!get_magic_quotes_gpc()) {
|
||||
$fcontent = $_POST['content'];
|
||||
} else {
|
||||
$fcontent = stripslashes($_POST['content']);
|
||||
}
|
||||
if (isset($_POST['charset'])) if (trim($_POST['charset']) != "") {
|
||||
$fcontent = ___convert($fcontent, trim($_POST['charset']), "UTF-8");
|
||||
}
|
||||
echo "<div class=\"love\">\n";
|
||||
if (file_put_contents($path, $fcontent)) {
|
||||
echo "文件数据已经成功存储!\n";
|
||||
} else {
|
||||
echo "文件数据无法存入文件!\n";
|
||||
}
|
||||
echo "</div>\n";
|
||||
}
|
||||
$data = file_get_contents($path);
|
||||
if (!isset($_GET['charset'])) {
|
||||
$charset = null;
|
||||
$content = ___codepre($data, null);
|
||||
} elseif (($charset = trim($_GET['charset'])) == "") {
|
||||
$content = ___codepre($data, null);
|
||||
} else {
|
||||
$content = ___codepre(___convert($data, "UTF-8", $charset), null);
|
||||
}
|
||||
echo "<div class=\"like\">爱特文本编辑工具</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"?path=" . urlencode($path) . "&charset={$charset}\" method=\"POST\">\n";
|
||||
echo "<input type=\"submit\" value=\"保存文件\" />\n";
|
||||
echo "<input type=\"reset\" value=\"重置文件\" />\n<br />\n";
|
||||
if (isset($_GET['charset'])) if ($charset != "") {
|
||||
echo "<input type=\"hidden\" name=\"charset\" value=\"$charset\" />\n";
|
||||
}
|
||||
echo "<textarea name=\"content\" style=\"width:99%;height:400px;\">$content</textarea>\n<br/>\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
xhtml_footer();
|
||||
}
|
||||
?>
|
2
email.php
Normal file
2
email.php
Normal file
File diff suppressed because one or more lines are too long
154
file.php
Normal file
154
file.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['path'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
} elseif (is_dir($path = ___realpath(trim($_GET['path'])))) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
}
|
||||
$fs = new filesystem($path);
|
||||
xhtml_head(___shortpath($path));
|
||||
if (!($data = $fs->getpath($path))) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>]\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\">返回目录</a>文件详情\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "文件名称:" . ___basename($path) . "<br />\n";
|
||||
if ($perms = $fs->getperms()) echo "文件权限:$perms<br />\n";
|
||||
echo "文件大小:" . ___filesize($data['size']) . "<br />\n";
|
||||
echo "所有者ID:{$data['uid']}<br />\n";
|
||||
echo "所有组ID:{$data['gid']}<br />\n";
|
||||
if (function_exists("mime_content_type")) echo "文件类型:" . mime_content_type($path) . "<br />\n";
|
||||
echo "上次访问:" . gmdate("Y-m-d H:i:s", ($data['atime']) + TIME) . "<br />\n";
|
||||
echo "上次修改:" . gmdate("Y-m-d H:i:s", ($data['mtime']) + TIME) . "<br />\n";
|
||||
echo "上次改变:" . gmdate("Y-m-d H:i:s", ($data['ctime']) + TIME) . "<br />\n";
|
||||
if (is_link($path)) echo "链接指向:" . readlink($path) . "<br />\n";
|
||||
if ($finfo = $fs->getfinfo()) echo "档案信息:$finfo\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "爱特解压<a href=\"./index.php?new&path=" . urlencode(dirname($path)) . "&multiple=unpackdir&getcwd=" . urlencode($path) . "\">目标目录</a>\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"unpack.php\" method=\"GET\">\n";
|
||||
echo "<input type=\"hidden\" name=\"path\" value=\"$path\" />";
|
||||
if (!isset($_GET['unpackdir'])) {
|
||||
echo "目标:<input type=\"text\" name=\"unpackdir\" value=\"" . dirname($path) . "\" /><br />\n";
|
||||
} else {
|
||||
echo "目标:<input type=\"text\" name=\"unpackdir\" value=\"" . trim($_GET['unpackdir']) . "\" /><br />\n";
|
||||
}
|
||||
echo "类型:<input type=\"radio\" name=\"type\" value=\"gz\" />GZ<input type=\"radio\" name=\"type\" value=\"bz2\" />BZ2<input type=\"radio\" name=\"type\" value=\"zip\" checked />ZIP<input type=\"radio\" name=\"type\" value=\"tar\" />TAR<br />\n";
|
||||
if (___superexec('pwd') != "") {
|
||||
echo "[+]高级:<input type=\"radio\" name=\"type\" value=\"7za\" />7ZA(众多格式支持)<br />\n";
|
||||
echo "[+]特殊:<input type=\"radio\" name=\"type\" value=\"rar\" />RAR(调用软件解压)<br />\n";
|
||||
echo "[+]密码:<input type=\"text\" name=\"password\" /><br />\n";
|
||||
}
|
||||
echo "<input type=\"submit\" value=\"释放资源到指定的目录\" />(目录需存在)\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
if (function_exists("mb_convert_encoding") && function_exists("mb_list_encodings")) {
|
||||
$sencode = mb_list_encodings();
|
||||
usort($sencode, "___sortcmp");
|
||||
echo "<div class=\"like\">\n爱特编码转换工具\n</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"mbconv.php\" method=\"GET\">\n";
|
||||
echo "<input type=\"hidden\" name=\"path\" value=\"$path\" />\n";
|
||||
echo "输入编码:<select name=\"ic\">\n";
|
||||
foreach ($sencode as $encode) {
|
||||
if ($encode == "pass") {
|
||||
continue;
|
||||
} else {
|
||||
if (function_exists("mb_encoding_aliases")) {
|
||||
$alias = mb_encoding_aliases($encode);
|
||||
echo "\n<optgroup label=\"$encode\">\n";
|
||||
if ($encode == "auto") {
|
||||
echo "<option value=\"$encode\" selected>$encode</option>\n";
|
||||
} else {
|
||||
echo "<option value=\"$encode\">$encode</option>\n";
|
||||
}
|
||||
if (is_array($alias)) if (count($alias) >= 1) {
|
||||
usort($alias, "___sortcmp");
|
||||
foreach ($alias as $encodealias) {
|
||||
if ($encodealias == $encode) {
|
||||
continue;
|
||||
}
|
||||
echo "<option value=\"$encode\">$encodealias</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
} else {
|
||||
if ($encode == "auto") {
|
||||
echo "<option value=\"$encode\" selected>$encode</option>\n";
|
||||
} else {
|
||||
echo "<option value=\"$encode\">$encode</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<br />\n";
|
||||
echo "输出编码:<select name=\"pc\">\n";
|
||||
foreach ($sencode as $encode) {
|
||||
if ($encode == "auto" || $encode == "pass") {
|
||||
continue;
|
||||
} else {
|
||||
if (function_exists("mb_encoding_aliases")) {
|
||||
$alias = mb_encoding_aliases($encode);
|
||||
echo "\n<optgroup label=\"$encode\">\n";
|
||||
if ($encode == "UTF-8") {
|
||||
echo "<option value=\"$encode\" selected>$encode</option>\n";
|
||||
} else {
|
||||
echo "<option value=\"$encode\">$encode</option>\n";
|
||||
}
|
||||
if (is_array($alias)) if (count($alias) >= 1) {
|
||||
usort($alias, "___sortcmp");
|
||||
foreach ($alias as $encodealias) {
|
||||
if ($encodealias == $encode) {
|
||||
continue;
|
||||
}
|
||||
echo "<option value=\"$encode\">$encodealias</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
} else {
|
||||
if ($encode == "UTF-8") {
|
||||
echo "<option value=\"$encode\" selected>$encode</option>\n";
|
||||
} else {
|
||||
echo "<option value=\"$encode\">$encode</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<br />\n";
|
||||
echo "存档路径:<input type=\"text\" name=\"save\" value=\"" . ___basename($path) . ".out\" />(RW)\n";
|
||||
echo "<br />\n";
|
||||
echo "<input type=\"submit\" value=\"转换编码并存档到指定文件路径\" />(覆盖式写入)\n";
|
||||
echo "<br />\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
echo "<div class=\"like\">\n爱特文件效验工具\n</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "md5:";
|
||||
if (isset($_GET['md5'])) {
|
||||
echo "<br />" . md5_file($path);
|
||||
} else {
|
||||
echo "<a href=\"./file.php?{$_SERVER['QUERY_STRING']}&md5\">文件的 MD5 散列值</a>(效验文件)\n";
|
||||
}
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "sha1:";
|
||||
if (isset($_GET['sha1'])) {
|
||||
echo "<br />" . sha1_file($path);
|
||||
} else {
|
||||
echo "<a href=\"./file.php?{$_SERVER['QUERY_STRING']}&sha1\">文件的 SHA1 散列值</a>(效验文件)\n";
|
||||
}
|
||||
echo "</div>\n";
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
93
flist.php
Normal file
93
flist.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_GET['getcwd'])) {
|
||||
$getcwd = OPEN;
|
||||
} else {
|
||||
$getcwd = ___realpath(trim($_GET['getcwd']));
|
||||
}
|
||||
if (!isset($_SESSION['flist'])) $_SESSION['flist'] = array();
|
||||
if (isset($_POST['addpath'])) if (is_array($_POST['addpath'])) {
|
||||
if (count($_POST['addpath']) > 0) {
|
||||
$_SESSION['flist'] = array_filter(array_unique(array_merge($_SESSION['flist'], $_POST['addpath'])));
|
||||
usort($_SESSION['flist'], "___sortcmp");
|
||||
}
|
||||
}
|
||||
if (isset($_GET['clean'])) if (($clean = trim($_GET['clean'])) != "") {
|
||||
switch ($clean) {
|
||||
case "all" :
|
||||
$_SESSION['flist'] = array();
|
||||
header("Location: flist.php?getcwd=" . urlencode($getcwd));
|
||||
break;
|
||||
case "array" :
|
||||
if (isset($_POST['fclean'])) if (is_array($_POST['fclean'])) if (count($_POST['fclean']) > 0) {
|
||||
foreach ($_POST['fclean'] as $tmp) {
|
||||
unset($_SESSION['flist'][(int)trim($tmp)]);
|
||||
}
|
||||
usort($_SESSION['flist'], "___sortcmp");
|
||||
}
|
||||
header("Location: flist.php?getcwd=" . urlencode($getcwd));
|
||||
break;
|
||||
default :
|
||||
if (isset($_SESSION['flist'][(int)$clean])) {
|
||||
unset($_SESSION['flist'][(int)$clean]);
|
||||
usort($_SESSION['flist'], "___sortcmp");
|
||||
}
|
||||
header("Location: flist.php?getcwd=" . urlencode($getcwd));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
xhtml_head("文件清单");
|
||||
echo "<div class=\"like\">添加自定义的路径(/file||url://)</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"\" method=\"GET\">\n";
|
||||
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
|
||||
echo "添加-><input type=\"text\" name=\"addnum\" />\n";
|
||||
echo "<input type=\"submit\" value=\"GO\" />\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
echo "<form action=\"?getcwd=" . urlencode($getcwd) . "\" method=\"POST\">\n";
|
||||
if (!isset($_GET['addnum'])) {
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "路径[+]<input type=\"text\" name=\"addpath[]\" />\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
$i = 0;
|
||||
$addnum = (int)trim($_GET['addnum']);
|
||||
if ($addnum < 1) $addnum = 1;
|
||||
while ($i < $addnum) {
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "路径[" . ($i + 1) . "]<input type=\"text\" name=\"addpath[]\" /><br />\n";
|
||||
echo "</div>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<input type=\"submit\" value=\"添加所有输入路径\" />(有效 路径)\n";
|
||||
echo "</div>\n";
|
||||
echo "</form>\n";
|
||||
if (count($_SESSION['flist']) < 1) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>]抱歉,没有文件列表查看!\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>]\n";
|
||||
echo "文件清单(<a href=\"./flist.php?getcwd=" . urlencode($getcwd) . "&clean=all\">清空列表</a>)\n";
|
||||
echo "</div>\n";
|
||||
echo "<form action=\"./flist.php?clean=array&getcwd=" . urlencode($getcwd) . "\" method=\"POST\">\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<input type=\"submit\" value=\"从清单中清除所选\" />\n";
|
||||
echo "(<a href=\"?cs&getcwd=" . urlencode($getcwd) . "\">全选</a>|<a href=\"?getcwd=" . urlencode($getcwd) . "\">消选</a>)\n";
|
||||
echo "</div>\n";
|
||||
$select = isset($_GET['cs']) ? "checked " : null;
|
||||
for ($i = 0; $i < count($_SESSION['flist']); $i++) {
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<input type=\"checkbox\" name=\"fclean[]\" value=\"$i\" $select/>\n";
|
||||
echo "[<a href=\"./flist.php?getcwd=" . urlencode($getcwd) . "&clean=$i\">清除</a>]\n";
|
||||
echo "[$i] - {$_SESSION['flist'][$i]}\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
echo "</form>\n";
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
145
index.php
Normal file
145
index.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
$path = isset($_GET['path']) ? trim($_GET['path']) : OPEN;
|
||||
if ($path == "" || !is_dir($path)) $path = OPEN;
|
||||
$filesystem = new filesystem($path);
|
||||
if (!isset($_GET['multiple'])) {
|
||||
$multiple = null;
|
||||
} else {
|
||||
if (($multiple = trim($_GET['multiple'])) == "") {
|
||||
$multiple = null;
|
||||
} else {
|
||||
if (($multiple == "unzipdir" || $multiple == "unpackdir") && isset($_GET['getcwd'])) if (file_exists($getcwd = trim($_GET['getcwd']))) {
|
||||
if (isset($_GET['new'])) $_SESSION['ffpath'] = $getcwd;
|
||||
}
|
||||
$multiple = "&multiple=$multiple";
|
||||
}
|
||||
}
|
||||
xhtml_head("爱特文件管理器");
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"\" method=\"GET\">\n";
|
||||
echo "路径跳转:<input type=\"text\" name=\"path\" />\n";
|
||||
if ($multiple != null) echo "<input type=\"hidden\" name=\"multiple\" value=\"{$_GET['multiple']}\" />\n";
|
||||
echo "<input type=\"submit\" value=\"GO\" />\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
if (function_exists("disk_total_space") && function_exists("disk_free_space")) {
|
||||
echo "分区大小:" . ___filesize(disk_total_space($path)) . "  空闲空间:" . ___filesize(disk_free_space($path)) . "<br />";
|
||||
}
|
||||
if ($disks = ___windowsdisk()) {
|
||||
echo "盘符切换:";
|
||||
foreach ($disks as $disk) {
|
||||
$diskurl = "?path=" . urlencode($disk);
|
||||
if ($multiple != null) {
|
||||
$diskurl .= $multiple;
|
||||
}
|
||||
echo sprintf("-><a href=\"%s\">%s</a> ", $diskurl, $disk);
|
||||
}
|
||||
echo "<br>\n";
|
||||
}
|
||||
echo "浏览路径:[<a href=\"?path=" . urlencode(___realpath($path . "/..")) . "$multiple\">UP</a>]  " . ___shortpath(___realpath($path));
|
||||
if ($multiple != null) echo "  [<a href=\"./multiple.php?type={$_GET['multiple']}&gopath=" . urlencode($path) . "\">选定</a>|<a href=\"./index.php?path=" . urlencode($path) . "\">关闭</a>]";
|
||||
echo "  [<a href=\"{$_SERVER['SCRIPT_NAME']}?{$_SERVER['QUERY_STRING']}&logout\">Logout</a>]\n";
|
||||
echo "\n</div>\n";
|
||||
if (($data = $filesystem->getpath()) === false) {
|
||||
echo "<div class=\"error\">抱歉,系统无法获取对应目录内容!</div>\n";
|
||||
} elseif ($data === null) {
|
||||
echo "<div class=\"error\">抱歉,这是一个无内容的空目录哦!</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<form action=\"multiple.php?getcwd=" . urlencode($path) . "\" method=\"POST\">";
|
||||
echo "<select name=\"type\">\n";
|
||||
echo "<option value=\"list\">文件清单(管理)</option>\n";
|
||||
echo "<option value=\"move\">移动文件(多选)</option>\n";
|
||||
echo "<option value=\"copy\">复制文件(多选)</option>\n";
|
||||
echo "<option value=\"pkzip\">压缩文件(多选)</option>\n";
|
||||
echo "<option value=\"chmod\">权限修改(多选)</option>\n";
|
||||
echo "<option value=\"delete\">删除文件(多选)</option>\n";
|
||||
echo "<option value=\"create\">建立数据(目录)</option>\n";
|
||||
echo "<option value=\"upload\">本地远程(上传)</option>\n";
|
||||
echo "<option value=\"addlist\">文件清单(加入)</option>\n";
|
||||
echo "<option value=\"sendfile\">发送文件(邮箱)</option>\n";
|
||||
if (function_exists("shell_exec") || (function_exists("proc_open") && function_exists("stream_get_contents") && php_uname("s") == "Linux")) {
|
||||
echo "<option value=\"shell_exec\">终端命令(高级)</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<input type=\"submit\" value=\"执行操作\" />\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
$select = isset($_GET['select']) ? "checked " : null;
|
||||
echo "<form action=\"multiple.php?getcwd=" . urlencode($path) . "\" method=\"POST\">";
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<select name=\"type\">\n";
|
||||
echo "<option value=\"list\">文件清单(管理)</option>\n";
|
||||
echo "<option value=\"move\">移动文件(多选)</option>\n";
|
||||
echo "<option value=\"copy\">复制文件(多选)</option>\n";
|
||||
echo "<option value=\"pkzip\">压缩文件(多选)</option>\n";
|
||||
echo "<option value=\"chmod\">权限修改(多选)</option>\n";
|
||||
echo "<option value=\"delete\">删除文件(多选)</option>\n";
|
||||
echo "<option value=\"create\">建立数据(目录)</option>\n";
|
||||
echo "<option value=\"upload\">本地远程(上传)</option>\n";
|
||||
echo "<option value=\"addlist\">文件清单(加入)</option>\n";
|
||||
echo "<option value=\"sendfile\">发送文件(邮箱)</option>\n";
|
||||
if (function_exists("proc_open") || function_exists("shell_exec")) {
|
||||
echo "<option value=\"shell_exec\">终端命令(高级)</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "<input type=\"submit\" value=\"执行\" />\n";
|
||||
echo "(<a href=\"?path=" . urlencode($path) . "&select$multiple\">全选</a>|<a href=\"?path=" . urlencode($path) . "$multiple\">消选</a>)\n";
|
||||
echo "</div>\n";
|
||||
if (count($data[0]) != 0) {
|
||||
echo "\n<div class=\"like\">目录列表</div>\n";
|
||||
foreach ($data[0] as $tmp) {
|
||||
$filesystem->chpath($tmp);
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<input type=\"checkbox\" name=\"flist[]\" value=\"" . urlencode($tmp) . "\" $select/>\n";
|
||||
echo ($perms = $filesystem->getperms()) == false ? "[????]" : "[$perms]";
|
||||
echo "<a href=\"?path=" . urlencode($tmp) . "$multiple\">" . ___basename($tmp) . "</a>\n";
|
||||
if (is_link($tmp)) echo "[ Link -> " . readlink($tmp) . " ]";
|
||||
echo "(<a href=\"./rename.php?path=" . urlencode($tmp) . "\">命名</a>|<a href=\"./autocp.php?path=" . urlencode($tmp) . "\">复件</a>)\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
if (count($data[1]) != 0) {
|
||||
echo "\n<div class=\"like\">文件列表</div>\n";
|
||||
foreach ($data[1] as $tmp) {
|
||||
$filesystem->chpath($tmp);
|
||||
$iget = $filesystem->getpath();
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<input type=\"checkbox\" name=\"flist[]\" value=\"" . urlencode($tmp) . "\" $select/>\n";
|
||||
echo ($perms = $filesystem->getperms()) == false ? "[????]" : "[$perms]";
|
||||
echo "<a href=\"./file.php?path=" . urlencode($tmp) . "\">" . ___basename($tmp) . "</a>(" . ___filesize($iget['size']) . ")\n";
|
||||
echo "<br />\n";
|
||||
echo "<a href=\"./dget.php?path=" . urlencode($tmp) . "\">下载</a>|";
|
||||
if ($mime = ___getmime($tmp, 'png:jpg:gif:bmp:zip')) {
|
||||
if ($mime == 'application/zip') {
|
||||
echo "<a href=\"./unzip.php?path=" . urlencode($tmp) . "\">解压</a>";
|
||||
} else {
|
||||
echo "<a href=\"./dget.php?mime=" . urlencode($mime) . "&path=" . urlencode($tmp) . "\">打开</a>";
|
||||
}
|
||||
} else {
|
||||
echo "<a href=\"./view.php?path=" . urlencode($tmp) . "\">查看</a>";
|
||||
}
|
||||
echo "|<a href=\"./editor.php?path=" . urlencode($tmp) . "\">编辑</a>|<a href=\"./rename.php?path=" . urlencode($tmp) . "\">命名</a>|<a href=\"./autocp.php?path=" . urlencode($tmp) . "\">复件</a>|<a href=\"./autopk.php?path=" . urlencode($tmp) . "\">压缩</a>\n";
|
||||
if (is_link($tmp)) echo "<br />\n链接指向 : " . readlink($tmp) . "\n";
|
||||
if ($finfo = $filesystem->getfinfo()) echo "\n<br />\n档案信息 : $finfo\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
if (count($data[2]) != 0) {
|
||||
echo "\n<div class=\"like\">未知列表</div>\n";
|
||||
foreach ($data[2] as $tmp) {
|
||||
$filesystem->chpath($tmp);
|
||||
echo "<div class=\"love\">\n";
|
||||
echo "<input type=\"checkbox\" name=\"flist[]\" value=\"" . urlencode($tmp) . "\" $select/>\n";
|
||||
if (is_link($tmp)) echo "[Link]";
|
||||
echo ($perms = $filesystem->getperms()) == false ? "[????]" : "[$perms]";
|
||||
echo "$tmp\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
echo "</form>\n";
|
||||
}
|
||||
xhtml_footer();
|
||||
?>
|
172
kernel.php
Normal file
172
kernel.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
class filesystem
|
||||
{
|
||||
private $path = null;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
if (func_num_args() > 0) $this->path = func_get_arg(0);
|
||||
}
|
||||
|
||||
function chmod()
|
||||
{
|
||||
if (!function_exists("chmod") || !file_exists("perms.php")) return false;
|
||||
if (func_num_args() == 3) {
|
||||
$path = $this->path;
|
||||
$dirperms = func_get_arg(0);
|
||||
$fileperms = func_get_arg(1);
|
||||
$recursive = func_get_arg(2);
|
||||
} elseif (func_num_args() == 4) {
|
||||
$path = func_get_arg(0);
|
||||
$dirperms = func_get_arg(1);
|
||||
$fileperms = func_get_arg(2);
|
||||
$recursive = func_get_arg(3);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($path)) return false;
|
||||
require "perms.php";
|
||||
if (!isset($perms["$dirperms"]) || !isset($perms["$fileperms"])) return false;
|
||||
if (!is_dir($path)) return chmod($path, $perms["$fileperms"]);
|
||||
if (!$recursive || !($dh = opendir($path))) return chmod($path, $perms["$dirperms"]);
|
||||
while (($entry = readdir($dh)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
$this->chmod($path . "/" . $entry, $dirperms, $fileperms, $recursive);
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
return chmod($path, $perms["$dirperms"]);
|
||||
|
||||
}
|
||||
|
||||
function chpath()
|
||||
{
|
||||
if (func_num_args() < 1) {
|
||||
return false;
|
||||
} else {
|
||||
$this->path = func_get_arg(0);
|
||||
}
|
||||
}
|
||||
|
||||
function cppath()
|
||||
{
|
||||
if (func_num_args() == 1) {
|
||||
$path = $this->path;
|
||||
$topath = func_get_arg(0);
|
||||
} elseif (func_num_args() == 2) {
|
||||
$path = func_get_arg(1);
|
||||
$topath = func_get_arg(0);;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($path)) {
|
||||
return false;
|
||||
} elseif (!is_dir($path)) {
|
||||
return copy($path, $topath);
|
||||
} elseif (!mkdir($topath, 0755, true)) {
|
||||
return false;
|
||||
}
|
||||
if (!($dh = opendir($path))) return false;
|
||||
while (($entry = readdir($dh)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
$this->cppath($topath . "/" . $entry, $path . "/" . $entry);
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
return true;
|
||||
}
|
||||
|
||||
function rmpath()
|
||||
{
|
||||
if (func_num_args() > 0) {
|
||||
$path = func_get_arg(0);
|
||||
} else {
|
||||
$path = $this->path;
|
||||
}
|
||||
if (!file_exists($path) && !is_link($path)) {
|
||||
return true;
|
||||
} elseif (is_link($path)) {
|
||||
return unlink($path);
|
||||
} elseif (!is_dir($path)) {
|
||||
return unlink($path);
|
||||
}
|
||||
if (!($dh = opendir($path))) return false;
|
||||
while (($entry = readdir($dh)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
$this->rmpath($path . "/" . $entry);
|
||||
}
|
||||
}
|
||||
return rmdir($path);
|
||||
}
|
||||
|
||||
function getpath()
|
||||
{
|
||||
if (func_num_args() > 0) {
|
||||
$path = func_get_arg(0);
|
||||
} else {
|
||||
$path = $this->path;
|
||||
}
|
||||
if (is_dir($path)) {
|
||||
$fs = array(array(), array(), array());
|
||||
if (!($dh = opendir($path))) return false;
|
||||
while (($entry = readdir($dh)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if (is_dir($entry = ___realpath($path . "/" . $entry))) {
|
||||
$fs[0][] = $entry;
|
||||
} elseif (is_file($entry)) {
|
||||
$fs[1][] = $entry;
|
||||
} else {
|
||||
if ($entry != "") {
|
||||
$fs[2][] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
if ((count($fs, 1) - 3) < 1) return null;
|
||||
if (count($fs[0]) > 0) usort($fs[0], "___sortcmp");
|
||||
if (count($fs[1]) > 0) usort($fs[1], "___sortcmp");
|
||||
if (count($fs[2]) > 0) usort($fs[2], "___sortcmp");
|
||||
return $fs;
|
||||
} elseif (file_exists($path)) {
|
||||
if (!($fs = stat($path))) {
|
||||
return false;
|
||||
} else {
|
||||
return $fs;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getfinfo()
|
||||
{
|
||||
if (!function_exists("finfo_open")) return false;
|
||||
$finfo = finfo_open();
|
||||
if (func_num_args() > 0) {
|
||||
return finfo_file($finfo, func_get_arg(0));
|
||||
}
|
||||
return finfo_file($finfo, $this->path);
|
||||
}
|
||||
|
||||
function getperms()
|
||||
{
|
||||
if (!function_exists("fileperms")) return false;
|
||||
if (func_num_args() > 0) {
|
||||
$path = func_get_arg(0);
|
||||
if (($perms = fileperms($path)) === false) {
|
||||
return false;
|
||||
} else {
|
||||
return substr(sprintf("%o", $perms), -4);
|
||||
}
|
||||
}
|
||||
if (($perms = fileperms($this->path)) === false) {
|
||||
return false;
|
||||
} else {
|
||||
return substr(sprintf("%o", $perms), -4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
51
mail.php
Normal file
51
mail.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
require "config.php";
|
||||
if (!isset($_SESSION['flist']) || !isset($_GET['mail'])) {
|
||||
header("Location: ./404.php");
|
||||
exit;
|
||||
}
|
||||
if (!isset($_GET['getcwd'])) {
|
||||
$getcwd = OPEN;
|
||||
} else {
|
||||
$getcwd = ___realpath(trim($_GET['getcwd']));
|
||||
}
|
||||
xhtml_head("文件发送");
|
||||
if (count($_SESSION['flist']) < 1) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回</a>]抱歉,文件清单为空!\n";
|
||||
echo "</div>\n";
|
||||
} elseif (!stripos($_GET['mail'], "@")) {
|
||||
echo "<div class=\"error\">\n";
|
||||
echo "[<a href=\"./multiple.php?type=sendfile&getcwd=" . urlencode($getcwd) . "\">返回</a>]抱歉,明显不是邮箱!\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
echo "<div class=\"like\">\n";
|
||||
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class=\"love\">\n";
|
||||
if (function_exists("pcntl_fork")) {
|
||||
$pid = pcntl_fork();
|
||||
}
|
||||
if (!isset($pid)) {
|
||||
if (___sendfile(trim($_GET['mail']), $_SESSION['flist'])) {
|
||||
echo "系统已经发送邮件!\n";
|
||||
} else {
|
||||
echo "系统无法发送邮件!\n |