feat(首次发布): 添加项目文件

This commit is contained in:
2020-09-16 12:24:54 +08:00
parent 09edb92e2a
commit fdbb417665
35 changed files with 2760 additions and 1 deletions

6
404.php Normal file
View File

@ -0,0 +1,6 @@
<?php
require "config.php";
xhtml_head("ERROR 404 !");
echo "<div class=\"error\">你的请求无法找到 - ERROR 404 !</div>";
xhtml_footer();
?>

View File

@ -1 +1 @@
# phpcp
# 爱特PHP全能文件专家(php control panel)

36
auto.php Normal file
View 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
View 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
View 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>&ensp;<a href=\"?pk=bz2&path=" . urlencode($path) . "\">Bzip2</a>压缩!";
}
xhtml_footer();
?>

35
chmod.php Normal file
View 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][√]&ensp;-&ensp;$tmp</div>\n";
} else {
echo "<div class=\"error\">[$i][×]&ensp;-&ensp;$tmp</div>\n";
}
$i++;
}
}
xhtml_footer();
?>

182
config.php Normal file
View 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和p7zipx64\x86\armhttp://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", "&#x7231;&#x7279;&#x6587;&#x4EF6;&#x4E13;&#x5BB6;");
//程序根目录
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="登&emsp;&emsp;录&emsp;&emsp;文&emsp;&emsp;管">
</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
View 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][√]&ensp;-&ensp;$tmp</div>\n";
} else {
echo "<div class=\"error\">[$i][×]&ensp;-&ensp;$tmp</div>\n";
}
$i++;
}
}
xhtml_footer();
?>

122
create.php Normal file
View 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 "数量-&gt;<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 "文件目录&ensp;$createpath&ensp;成功创建\n";
echo "</div>\n";
} else {
echo "<div class=\"error\">\n";
echo "文件目录&ensp;$createpath&ensp;无法创建\n";
echo "</div>\n";
}
} else {
if (mkdir($createpath, 0755)) {
echo "<div class=\"love\">\n";
echo "文件目录&ensp;$createpath&ensp;成功创建\n";
echo "</div>\n";
} else {
echo "<div class=\"error\">\n";
echo "文件目录&ensp;$createpath&ensp;无法创建\n";
echo "</div>\n";
}
}
} elseif ($createtype == "file") {
if (!strstr($createpath, "/") && !strstr($createpath, "\\")) {
if (file_exists($getcwd . "/" . $createpath)) {
echo "<div class=\"error\">\n";
echo "文件路径&ensp;$createpath&ensp;已经存在\n";
echo "</div>\n";
} else {
if (!($fp = fopen($getcwd . "/" . $createpath, "w"))) {
echo "<div class=\"error\">\n";
echo "空白文件&ensp;$createpath&ensp;无法创建\n";
echo "</div>\n";
} else {
fclose($fp);
echo "<div class=\"love\">\n";
echo "空白文件&ensp;$createpath&ensp;成功创建\n";
echo "</div>\n";
}
}
} else {
if (file_exists($createpath)) {
echo "<div class=\"error\">\n";
echo "文件路径&ensp;$createpath&ensp;已经存在\n";
echo "</div>\n";
} else {
if (!($fp = fopen($createpath, "w"))) {
echo "<div class=\"error\">\n";
echo "空白文件&ensp;$createpath&ensp;无法创建\n";
echo "</div>\n";
} else {
fclose($fp);
echo "<div class=\"love\">\n";
echo "空白文件&ensp;$createpath&ensp;成功创建\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=\"创建所有输入数据\" />(有效&ensp;数据)\n";
echo "</div>\n";
echo "</form>\n";
xhtml_footer();
?>

35
delete.php Normal file
View 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][√]&ensp;-&ensp;$tmp</div>\n";
} else {
echo "<div class=\"error\">[$i][×]&ensp;-&ensp;$tmp</div>\n";
}
$i++;
}
unset($_SESSION['flist']);
}
xhtml_footer();
?>

29
dget.php Normal file
View 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
View 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

File diff suppressed because one or more lines are too long

154
file.php Normal file
View 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\">文件的&ensp;MD5&ensp;散列值</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\">文件的&ensp;SHA1&ensp;散列值</a>(效验文件)\n";
}
echo "</div>\n";
}
xhtml_footer();
?>

93
flist.php Normal file
View 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 "添加-&gt;<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=\"添加所有输入路径\" />(有效&ensp;路径)\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]&ensp;-&ensp;{$_SESSION['flist'][$i]}\n";
echo "</div>\n";
}
echo "</form>\n";
}
xhtml_footer();
?>

145
index.php Normal file
View 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)) . "&ensp;&ensp;空闲空间:" . ___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("-&gt;<a href=\"%s\">%s</a>&ensp;", $diskurl, $disk);
}
echo "<br>\n";
}
echo "浏览路径:[<a href=\"?path=" . urlencode(___realpath($path . "/..")) . "$multiple\">UP</a>]&ensp;&ensp;" . ___shortpath(___realpath($path));
if ($multiple != null) echo "&ensp;&ensp;[<a href=\"./multiple.php?type={$_GET['multiple']}&gopath=" . urlencode($path) . "\">选定</a>|<a href=\"./index.php?path=" . urlencode($path) . "\">关闭</a>]";
echo "&ensp;&ensp;[<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 "[&ensp;Link&ensp;-&gt;&ensp;" . readlink($tmp) . "&ensp;]";
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链接指向&ensp;:&ensp;" . readlink($tmp) . "\n";
if ($finfo = $filesystem->getfinfo()) echo "\n<br />\n档案信息&ensp;:&ensp;$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
View 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
View 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";
}
} elseif ($pid == -1) {
if (___sendfile(trim($_GET['mail']), $_SESSION['flist'])) {
echo "系统已经发送邮件!\n";
} else {
echo "系统无法发送邮件\n";
}
} else {
if ($pid == 0) {
___sendfile(trim($_GET['mail']), $_SESSION['flist']);
exit;
}
echo "系统正在投递邮件!\n";
}
echo "</div>\n";
}
xhtml_footer();
?>

46
mbconv.php Normal file
View File

@ -0,0 +1,46 @@
<?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;
} 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\">\n";
if (!function_exists("mb_convert_encoding") || !function_exists("mb_list_encodings")) {
echo "核心函数库没有被支持!\n";
} elseif (!is_readable($path)) {
echo "无法读取输入文件内容!\n";
} elseif (!isset($_GET['ic']) || !isset($_GET['pc']) || !isset($_GET['save'])) {
echo "编码转换参数没有设置!\n";
} elseif (($ic = trim($_GET['ic'])) == "" || ($pc = trim($_GET['pc'])) == "" || ($save = trim($_GET['save'])) == "") {
echo "编码转换参数不能为空!\n";
} elseif ($ic == $pc) {
echo "输入输出编码不能一致!\n";
} elseif (!in_array($ic, mb_list_encodings()) || !in_array($pc, mb_list_encodings())) {
echo "选择的编码格式不支持!\n";
} else {
if (!strstr($save, "/") && !strstr($save, "\\")) $save = (dirname($path) . "/" . $save);
if ($save == $path) {
echo "新路径应不同于老路径!\n";
} elseif (!($data = file_get_contents($path))) {
echo "读取失败或者文件为空!\n";
} elseif (!file_put_contents($save, mb_convert_encoding($data, $pc, $ic))) {
echo "无权限写入或写入错误!\n";
file_exists($save) && unlink($save);
} elseif (filesize($save) < 1) {
unlink($save);
echo "无法成功进行编码转换!\n";
} else {
echo "编码已转换并写入文件!\n";
}
}
echo "</div>\n";
xhtml_footer();
}
?>

37
move.php Normal file
View File

@ -0,0 +1,37 @@
<?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=move&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;
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">文件列表</a>(操作结果)\n";
echo "</div>";
while ($i < count($_SESSION['flist'])) {
if (rename($_SESSION['flist'][$i], $tmp = ($gopath . "/" . ___basename($_SESSION['flist'][$i])))) {
echo "<div class=\"love\">[$i][√]&ensp;-&ensp;$tmp</div>\n";
} else {
echo "<div class=\"error\">[$i][×]&ensp;-&ensp;$tmp</div>\n";
}
$i++;
}
unset($_SESSION['flist']);
}
xhtml_footer();
?>

215
multiple.php Normal file
View File

@ -0,0 +1,215 @@
<?php
require "config.php";
if (!isset($_REQUEST['type'])) {
header("Location: ./404.php");
exit;
} elseif (($type = trim($_REQUEST['type'])) == "") {
header("Location: ./404.php");
exit;
}
if (!isset($_GET['gopath'])) {
$gopath = OPEN;
} else {
$gopath = ___realpath(trim($_GET['gopath']));
}
if (!isset($_GET['getcwd'])) {
$getcwd = $gopath;
} else {
$getcwd = ___realpath(trim($_GET['getcwd']));
}
if ($type == "list") {
header("Location: ./flist.php?getcwd=" . urlencode($getcwd));
exit;
} elseif ($type == "create") {
header("Location: ./create.php?getcwd=" . urlencode($getcwd));
exit;
} elseif ($type == "upload") {
header("Location: ./upload.php?getcwd=" . urlencode($getcwd));
exit;
} elseif ($type == "addlist") {
if (isset($_POST['flist'])) if (count($_POST['flist']) > 0) {
if (!isset($_SESSION['flist'])) $_SESSION['flist'] = array();
$_SESSION['flist'] = array_filter(array_unique(array_merge($_SESSION['flist'], array_map('urldecode', $_POST['flist']))));
usort($_SESSION['flist'], "___sortcmp");
}
header("Location: ./flist.php?getcwd=" . urlencode($getcwd));
exit;
} elseif ($type == "unzipdir") {
if (isset($_SESSION['ffpath'])) if (!is_dir($_SESSION['ffpath'])) {
header("Location: ./unzip.php?path=" . urlencode($_SESSION['ffpath']) . "&unzipdir=" . urlencode($getcwd));
exit;
}
header("Location: ./404.php");
exit;
} elseif ($type == "unpackdir") {
if (isset($_SESSION['ffpath'])) if (!is_dir($_SESSION['ffpath'])) {
header("Location: ./file.php?path=" . urlencode($_SESSION['ffpath']) . "&unpackdir=" . urlencode($getcwd));
exit;
}
header("Location: ./404.php");
exit;
} elseif ($type == "shell_exec") {
header("Location: ./shell.php?getcwd=" . urlencode($getcwd));
exit;
}
if (isset($_POST['flist'])) {
if (!is_array($_POST['flist'])) {
$_SESSION['flist'] = array();
} else {
$_SESSION['flist'] = array_map('urldecode', $_POST['flist']);
}
} elseif (!isset($_SESSION['flist'])) {
$_SESSION['flist'] = array();
}
switch ($type) {
case "move" :
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 {
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "&multiple=$type\">选择路径</a>(目标目录)\n";
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"move.php\" method=\"GET\">\n";
echo "<input type=\"text\" name=\"gopath\" value=\"$getcwd\" />\n";
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
echo "<input type=\"submit\" value=\"GO\" />\n";
echo "</form>\n";
echo "</div>\n";
echo "<div class=\"like\">文件清单(选择列表)</div>\n";
for ($i = 0; $i < count($_SESSION['flist']); $i++) {
echo "<div class=\"love\">[$i]&ensp;-&ensp;{$_SESSION['flist'][$i]}</div>\n";
}
}
xhtml_footer();
break;
case "copy" :
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 {
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "&multiple=$type\">选择路径</a>(目标目录)\n";
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"copy.php\" method=\"GET\">\n";
echo "<input type=\"text\" name=\"gopath\" value=\"$getcwd\" />\n";
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
echo "<input type=\"submit\" value=\"GO\" />\n";
echo "</form>\n";
echo "</div>\n";
echo "<div class=\"like\">文件清单(选择列表)</div>\n";
for ($i = 0; $i < count($_SESSION['flist']); $i++) {
echo "<div class=\"love\">[$i]&ensp;-&ensp;{$_SESSION['flist'][$i]}</div>\n";
}
}
xhtml_footer();
break;
case "pkzip" :
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 {
if (($zpath = ___realpath($getcwd)) == "/") {
$zpath = $zpath .= "archive.zip";
} else {
$zpath = $zpath .= "/archive.zip";
}
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "&multiple=$type\">存放目录</a>(归档路径)\n";
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"pkzip.php\" method=\"GET\">\n";
echo "<input type=\"text\" name=\"gopath\" value=\"$zpath\" />\n";
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
echo "<input type=\"submit\" value=\"GO\" />\n";
echo "</form>\n";
echo "</div>\n";
echo "<div class=\"like\">文件清单(选择列表)</div>\n";
for ($i = 0; $i < count($_SESSION['flist']); $i++) {
echo "<div class=\"love\">[$i]&ensp;-&ensp;{$_SESSION['flist'][$i]}</div>\n";
}
}
xhtml_footer();
break;
case "chmod" :
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 {
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">文件列表</a>(返回浏览)\n";
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"chmod.php\" method=\"GET\">\n";
echo "递归权限:<input type=\"radio\" name=\"recursive\" value=\"on\" checked />开启\n";
echo "<input type=\"radio\" name=\"recursive\" value=\"off\" />关闭\n<br />\n";
echo "目录权限:<input type=\"text\" name=\"dirperms\" value=\"0755\" />\n";
echo "<br />\n文件权限:<input type=\"text\" name=\"fileperms\" value=\"0644\" />\n";
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
echo "<br />\n<input type=\"submit\" value=\"GO\" />\n";
echo "</form>\n";
echo "</div>\n";
echo "<div class=\"like\">文件清单(选择列表)</div>\n";
for ($i = 0; $i < count($_SESSION['flist']); $i++) {
echo "<div class=\"love\">[$i]&ensp;-&ensp;{$_SESSION['flist'][$i]}</div>\n";
}
}
xhtml_footer();
break;
case "delete";
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 {
echo "<div class=\"love\">\n";
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回</a>]\n";
echo "此操作不可逆,<a href=\"./delete.php?getcwd=" . urlencode($getcwd) . "\">确认删除</a>\n";
echo "</div>\n";
echo "<div class=\"like\">文件清单(选择列表)</div>\n";
for ($i = 0; $i < count($_SESSION['flist']); $i++) {
echo "<div class=\"love\">[$i]&ensp;-&ensp;{$_SESSION['flist'][$i]}</div>\n";
}
}
xhtml_footer();
break;
case "sendfile" :
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 {
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>(接收邮箱)\n";
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"mail.php\" method=\"GET\">\n";
echo "<input type=\"text\" name=\"mail\" />\n";
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
echo "<input type=\"submit\" value=\"GO\" />\n";
echo "</form>\n";
echo "</div>\n";
echo "<div class=\"like\">文件清单(选择列表)</div>\n";
for ($i = 0; $i < count($_SESSION['flist']); $i++) {
echo "<div class=\"love\">[$i]&ensp;-&ensp;{$_SESSION['flist'][$i]}</div>\n";
}
}
xhtml_footer();
break;
default :
header("Location: ./404.php");
exit;
}
?>

2
pclzip.php Normal file

File diff suppressed because one or more lines are too long

198
perms.php Normal file
View File

@ -0,0 +1,198 @@
<?php
$perms = array(
"0000" => 0000, "0100" => 0100, "0010" => 0010,
"0001" => 0001, "0200" => 0200, "0020" => 0020,
"0002" => 0002, "0300" => 0300, "0030" => 0030,
"0003" => 0003, "0400" => 0400, "0040" => 0040,
"0004" => 0004, "0500" => 0500, "0050" => 0050,
"0005" => 0005, "0600" => 0600, "0060" => 0060,
"0006" => 0006, "0700" => 0700, "0070" => 0070,
"0007" => 0007, "0100" => 0100, "0010" => 0010,
"0110" => 0110, "0011" => 0011, "0120" => 0120,
"0012" => 0012, "0130" => 0130, "0013" => 0013,
"0140" => 0140, "0014" => 0014, "0150" => 0150,
"0015" => 0015, "0160" => 0160, "0016" => 0016,
"0170" => 0170, "0017" => 0017, "0200" => 0200,
"0020" => 0020, "0210" => 0210, "0021" => 0021,
"0220" => 0220, "0022" => 0022, "0230" => 0230,
"0023" => 0023, "0240" => 0240, "0024" => 0024,
"0250" => 0250, "0025" => 0025, "0260" => 0260,
"0026" => 0026, "0270" => 0270, "0027" => 0027,
"0300" => 0300, "0030" => 0030, "0310" => 0310,
"0031" => 0031, "0320" => 0320, "0032" => 0032,
"0330" => 0330, "0033" => 0033, "0340" => 0340,
"0034" => 0034, "0350" => 0350, "0035" => 0035,
"0360" => 0360, "0036" => 0036, "0370" => 0370,
"0037" => 0037, "0400" => 0400, "0040" => 0040,
"0410" => 0410, "0041" => 0041, "0420" => 0420,
"0042" => 0042, "0430" => 0430, "0043" => 0043,
"0440" => 0440, "0044" => 0044, "0450" => 0450,
"0045" => 0045, "0460" => 0460, "0046" => 0046,
"0470" => 0470, "0047" => 0047, "0500" => 0500,
"0050" => 0050, "0510" => 0510, "0051" => 0051,
"0520" => 0520, "0052" => 0052, "0530" => 0530,
"0053" => 0053, "0540" => 0540, "0054" => 0054,
"0550" => 0550, "0055" => 0055, "0560" => 0560,
"0056" => 0056, "0570" => 0570, "0057" => 0057,
"0600" => 0600, "0060" => 0060, "0610" => 0610,
"0061" => 0061, "0620" => 0620, "0062" => 0062,
"0630" => 0630, "0063" => 0063, "0640" => 0640,
"0064" => 0064, "0650" => 0650, "0065" => 0065,
"0660" => 0660, "0066" => 0066, "0670" => 0670,
"0067" => 0067, "0700" => 0700, "0070" => 0070,
"0710" => 0710, "0071" => 0071, "0720" => 0720,
"0072" => 0072, "0730" => 0730, "0073" => 0073,
"0740" => 0740, "0074" => 0074, "0750" => 0750,
"0075" => 0075, "0760" => 0760, "0076" => 0076,
"0770" => 0770, "0077" => 0077, "0100" => 0100,
"0101" => 0101, "0102" => 0102, "0103" => 0103,
"0104" => 0104, "0105" => 0105, "0106" => 0106,
"0107" => 0107, "0110" => 0110, "0111" => 0111,
"0112" => 0112, "0113" => 0113, "0114" => 0114,
"0115" => 0115, "0116" => 0116, "0117" => 0117,
"0120" => 0120, "0121" => 0121, "0122" => 0122,
"0123" => 0123, "0124" => 0124, "0125" => 0125,
"0126" => 0126, "0127" => 0127, "0130" => 0130,
"0131" => 0131, "0132" => 0132, "0133" => 0133,
"0134" => 0134, "0135" => 0135, "0136" => 0136,
"0137" => 0137, "0140" => 0140, "0141" => 0141,
"0142" => 0142, "0143" => 0143, "0144" => 0144,
"0145" => 0145, "0146" => 0146, "0147" => 0147,
"0150" => 0150, "0151" => 0151, "0152" => 0152,
"0153" => 0153, "0154" => 0154, "0155" => 0155,
"0156" => 0156, "0157" => 0157, "0160" => 0160,
"0161" => 0161, "0162" => 0162, "0163" => 0163,
"0164" => 0164, "0165" => 0165, "0166" => 0166,
"0167" => 0167, "0170" => 0170, "0171" => 0171,
"0172" => 0172, "0173" => 0173, "0174" => 0174,
"0175" => 0175, "0176" => 0176, "0177" => 0177,
"0200" => 0200, "0201" => 0201, "0202" => 0202,
"0203" => 0203, "0204" => 0204, "0205" => 0205,
"0206" => 0206, "0207" => 0207, "0210" => 0210,
"0211" => 0211, "0212" => 0212, "0213" => 0213,
"0214" => 0214, "0215" => 0215, "0216" => 0216,
"0217" => 0217, "0220" => 0220, "0221" => 0221,
"0222" => 0222, "0223" => 0223, "0224" => 0224,
"0225" => 0225, "0226" => 0226, "0227" => 0227,
"0230" => 0230, "0231" => 0231, "0232" => 0232,
"0233" => 0233, "0234" => 0234, "0235" => 0235,
"0236" => 0236, "0237" => 0237, "0240" => 0240,
"0241" => 0241, "0242" => 0242, "0243" => 0243,
"0244" => 0244, "0245" => 0245, "0246" => 0246,
"0247" => 0247, "0250" => 0250, "0251" => 0251,
"0252" => 0252, "0253" => 0253, "0254" => 0254,
"0255" => 0255, "0256" => 0256, "0257" => 0257,
"0260" => 0260, "0261" => 0261, "0262" => 0262,
"0263" => 0263, "0264" => 0264, "0265" => 0265,
"0266" => 0266, "0267" => 0267, "0270" => 0270,
"0271" => 0271, "0272" => 0272, "0273" => 0273,
"0274" => 0274, "0275" => 0275, "0276" => 0276,
"0277" => 0277, "0300" => 0300, "0301" => 0301,
"0302" => 0302, "0303" => 0303, "0304" => 0304,
"0305" => 0305, "0306" => 0306, "0307" => 0307,
"0310" => 0310, "0311" => 0311, "0312" => 0312,
"0313" => 0313, "0314" => 0314, "0315" => 0315,
"0316" => 0316, "0317" => 0317, "0320" => 0320,
"0321" => 0321, "0322" => 0322, "0323" => 0323,
"0324" => 0324, "0325" => 0325, "0326" => 0326,
"0327" => 0327, "0330" => 0330, "0331" => 0331,
"0332" => 0332, "0333" => 0333, "0334" => 0334,
"0335" => 0335, "0336" => 0336, "0337" => 0337,
"0340" => 0340, "0341" => 0341, "0342" => 0342,
"0343" => 0343, "0344" => 0344, "0345" => 0345,
"0346" => 0346, "0347" => 0347, "0350" => 0350,
"0351" => 0351, "0352" => 0352, "0353" => 0353,
"0354" => 0354, "0355" => 0355, "0356" => 0356,
"0357" => 0357, "0360" => 0360, "0361" => 0361,
"0362" => 0362, "0363" => 0363, "0364" => 0364,
"0365" => 0365, "0366" => 0366, "0367" => 0367,
"0370" => 0370, "0371" => 0371, "0372" => 0372,
"0373" => 0373, "0374" => 0374, "0375" => 0375,
"0376" => 0376, "0377" => 0377, "0400" => 0400,
"0401" => 0401, "0402" => 0402, "0403" => 0403,
"0404" => 0404, "0405" => 0405, "0406" => 0406,
"0407" => 0407, "0410" => 0410, "0411" => 0411,
"0412" => 0412, "0413" => 0413, "0414" => 0414,
"0415" => 0415, "0416" => 0416, "0417" => 0417,
"0420" => 0420, "0421" => 0421, "0422" => 0422,
"0423" => 0423, "0424" => 0424, "0425" => 0425,
"0426" => 0426, "0427" => 0427, "0430" => 0430,
"0431" => 0431, "0432" => 0432, "0433" => 0433,
"0434" => 0434, "0435" => 0435, "0436" => 0436,
"0437" => 0437, "0440" => 0440, "0441" => 0441,
"0442" => 0442, "0443" => 0443, "0444" => 0444,
"0445" => 0445, "0446" => 0446, "0447" => 0447,
"0450" => 0450, "0451" => 0451, "0452" => 0452,
"0453" => 0453, "0454" => 0454, "0455" => 0455,
"0456" => 0456, "0457" => 0457, "0460" => 0460,
"0461" => 0461, "0462" => 0462, "0463" => 0463,
"0464" => 0464, "0465" => 0465, "0466" => 0466,
"0467" => 0467, "0470" => 0470, "0471" => 0471,
"0472" => 0472, "0473" => 0473, "0474" => 0474,
"0475" => 0475, "0476" => 0476, "0477" => 0477,
"0500" => 0500, "0501" => 0501, "0502" => 0502,
"0503" => 0503, "0504" => 0504, "0505" => 0505,
"0506" => 0506, "0507" => 0507, "0510" => 0510,
"0511" => 0511, "0512" => 0512, "0513" => 0513,
"0514" => 0514, "0515" => 0515, "0516" => 0516,
"0517" => 0517, "0520" => 0520, "0521" => 0521,
"0522" => 0522, "0523" => 0523, "0524" => 0524,
"0525" => 0525, "0526" => 0526, "0527" => 0527,
"0530" => 0530, "0531" => 0531, "0532" => 0532,
"0533" => 0533, "0534" => 0534, "0535" => 0535,
"0536" => 0536, "0537" => 0537, "0540" => 0540,
"0541" => 0541, "0542" => 0542, "0543" => 0543,
"0544" => 0544, "0545" => 0545, "0546" => 0546,
"0547" => 0547, "0550" => 0550, "0551" => 0551,
"0552" => 0552, "0553" => 0553, "0554" => 0554,
"0555" => 0555, "0556" => 0556, "0557" => 0557,
"0560" => 0560, "0561" => 0561, "0562" => 0562,
"0563" => 0563, "0564" => 0564, "0565" => 0565,
"0566" => 0566, "0567" => 0567, "0570" => 0570,
"0571" => 0571, "0572" => 0572, "0573" => 0573,
"0574" => 0574, "0575" => 0575, "0576" => 0576,
"0577" => 0577, "0600" => 0600, "0601" => 0601,
"0602" => 0602, "0603" => 0603, "0604" => 0604,
"0605" => 0605, "0606" => 0606, "0607" => 0607,
"0610" => 0610, "0611" => 0611, "0612" => 0612,
"0613" => 0613, "0614" => 0614, "0615" => 0615,
"0616" => 0616, "0617" => 0617, "0620" => 0620,
"0621" => 0621, "0622" => 0622, "0623" => 0623,
"0624" => 0624, "0625" => 0625, "0626" => 0626,
"0627" => 0627, "0630" => 0630, "0631" => 0631,
"0632" => 0632, "0633" => 0633, "0634" => 0634,
"0635" => 0635, "0636" => 0636, "0637" => 0637,
"0640" => 0640, "0641" => 0641, "0642" => 0642,
"0643" => 0643, "0644" => 0644, "0645" => 0645,
"0646" => 0646, "0647" => 0647, "0650" => 0650,
"0651" => 0651, "0652" => 0652, "0653" => 0653,
"0654" => 0654, "0655" => 0655, "0656" => 0656,
"0657" => 0657, "0660" => 0660, "0661" => 0661,
"0662" => 0662, "0663" => 0663, "0664" => 0664,
"0665" => 0665, "0666" => 0666, "0667" => 0667,
"0670" => 0670, "0671" => 0671, "0672" => 0672,
"0673" => 0673, "0674" => 0674, "0675" => 0675,
"0676" => 0676, "0677" => 0677, "0700" => 0700,
"0701" => 0701, "0702" => 0702, "0703" => 0703,
"0704" => 0704, "0705" => 0705, "0706" => 0706,
"0707" => 0707, "0710" => 0710, "0711" => 0711,
"0712" => 0712, "0713" => 0713, "0714" => 0714,
"0715" => 0715, "0716" => 0716, "0717" => 0717,
"0720" => 0720, "0721" => 0721, "0722" => 0722,
"0723" => 0723, "0724" => 0724, "0725" => 0725,
"0726" => 0726, "0727" => 0727, "0730" => 0730,
"0731" => 0731, "0732" => 0732, "0733" => 0733,
"0734" => 0734, "0735" => 0735, "0736" => 0736,
"0737" => 0737, "0740" => 0740, "0741" => 0741,
"0742" => 0742, "0743" => 0743, "0744" => 0744,
"0745" => 0745, "0746" => 0746, "0747" => 0747,
"0750" => 0750, "0751" => 0751, "0752" => 0752,
"0753" => 0753, "0754" => 0754, "0755" => 0755,
"0756" => 0756, "0757" => 0757, "0760" => 0760,
"0761" => 0761, "0762" => 0762, "0763" => 0763,
"0764" => 0764, "0765" => 0765, "0766" => 0766,
"0767" => 0767, "0770" => 0770, "0771" => 0771,
"0772" => 0772, "0773" => 0773, "0774" => 0774,
"0775" => 0775, "0776" => 0776, "0777" => 0777
);
?>

28
pkzip.php Normal file
View File

@ -0,0 +1,28 @@
<?php
require "config.php";
if (!isset($_GET['gopath']) || !isset($_SESSION['flist']) || !file_exists("pclzip.php")) {
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 {
require "pclzip.php";
$pkzip = new pclzip($gopath = trim($_GET['gopath']));
echo "[<a href=\"./index.php?path=" . urlencode($getcwd) . "\">目录</a>]\n";
if ($pkzip->create($_SESSION['flist'], PCLZIP_OPT_REMOVE_PATH, dirname($gopath))) {
echo "文件&ensp;" . ___basename($gopath) . "&ensp;创建成功!";
} else {
echo "文件&ensp;" . ___basename($gopath) . "&ensp;无法建立!";
}
}
xhtml_footer();
?>

73
readme.txt Normal file
View File

@ -0,0 +1,73 @@
----------------
爱特网站文件专家
----------------
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和p7zipx64\x86\armhttp://aite.me/7zrar.zip
借助这二个强大的组件你可以用爱特文件管理器解压任意格式压缩包
可以用文件管理器的远程下载直接导入unrar和p7zip组件包,然后在线解压
解压后有x64\x86\arm三个目录,一般空间用x86,一般安卓手机环境用arm组件
进入对应的组件目录,将p7zip.bin和unrar.bin文件移动到文件管理器目录即可
然后文件管理器的rar和7za解压选项就可以用了,当然也可以解压带密码压缩包

31
rename.php Normal file
View File

@ -0,0 +1,31 @@
<?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;
}
if (isset($_GET['name'])) if (($name = trim($_GET['name'])) != "") {
if (strpos($name, "/") === false || strpos($name, "\\")) {
$to = dirname($path) . "/$name";
} else {
$to = $name;
}
if (rename($path, $to)) {
header("Location: ?path=" . urlencode($to));
exit;
}
}
xhtml_head("重新命名");
echo "<div class=\"like\">\n<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\"]>返回目录</a>\n新的命名</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"\" method=\"GET\">\n";
echo "<input type=\"hidden\" name=\"path\" value=\"$path\" />\n";
echo "<input type=\"text\" name=\"name\" value=\"" . ___basename($path) . "\" />\n";
echo "<input type=\"submit\" value=\"命名\" />\n";
echo "</form>\n";
echo "</div>\n";
xhtml_footer();
?>

69
shell.php Normal file
View File

@ -0,0 +1,69 @@
<?php
require "config.php";
if (!isset($_GET['getcwd'])) {
header("Location: ./404.php");
exit;
} elseif (!is_dir($getcwd = trim($_GET['getcwd']))) {
header("Location: ./404.php");
exit;
} elseif (!function_exists("shell_exec") && (!function_exists("proc_open") || !function_exists("stream_get_contents") || php_uname("s") != "Linux")) {
xhtml_head("SHELL");
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\"]>返回目录</a>错误提示\n";
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "您没有打开SHELL权限";
echo "</div>\n";
xhtml_footer();
exit;
}
chdir($getcwd);
xhtml_head("SHELL");
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>SHELL\n";
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"?getcwd=" . urlencode($getcwd) . "\" method=\"POST\">\n";
echo "<input type=\"submit\" value=\"执行命令\" />\n";
echo "<input type=\"reset\" value=\"重置终端\" />\n<br />\n";
echo "<textarea name=\"shell\" style=\"width:99%;height:100px;\"></textarea>\n<br/>\n";
echo "</form>\n";
echo "</div>\n";
if (isset($_POST['shell'])) if (($s = trim($_POST['shell'])) != "") {
echo "<div class=\"like\">\n结果返回SHELL\n</div>\n";
echo "<div class=\"love\">\n";
if (function_exists("proc_open") && function_exists("stream_get_contents") && php_uname("s") == "Linux") {
if (!($sh = proc_open("sh", array(0 => array("pipe", "r"), 1 => array("pipe", "w")), $pipes))) {
echo "Open Shell Error !";
} else {
$i = 0;
$shell = explode("\n", $s);
while ($i < count($shell)) {
$x = trim($shell[$i]);
fwrite($pipes[0], "$x\n");
$i++;
}
fclose($pipes[0]);
$stream = stream_get_contents($pipes[1]);
if ($stream != "") {
echo "<pre>" . nl2br(___codepre(trim($stream))) . "</pre>";
} else {
echo "NULL";
}
fclose($pipes[1]);
proc_close($sh);
}
} else {
$i = 0;
$shell = explode("\n", $s);
while ($i < count($shell)) {
$sh = trim($shell[$i]);
echo "shell#&ensp;$sh<br />\n";
echo nl2br(___codepre(shell_exec($sh))) . "\n";
$i++;
}
}
echo "</div>\n";
}
xhtml_footer();
?>

53
style.css Normal file
View File

@ -0,0 +1,53 @@
.like {
padding: 3px;
color: #000000;
font-size: 18px;
background-color: #00BFFF;
border-bottom: 3px solid #1E90FF;
}
.love {
padding: 2px;
color: #000000;
word-wrap: break-word;
border-left: 1px solid #B0E0B6;
border-right: 1px solid #B0E0B6;
border-bottom: 1px dotted #6495ED;
}
.error {
color: red;
padding: 2px;
word-wrap: break-word;
border: 1px solid red;
}
#header {
padding: 4px;
color: #000000;
font-size: 18px;
background-color: #3CB369;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom: 3px solid #008080;
}
#footer {
padding: 4px;
color: #000000;
font-size: 18px;
background-color: #3CB369;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
border-bottom: 3px solid #008080;
}
#footer a:link {
color: #000000;
text-decoration: none;
}
#footer a:visited {
color: #000000;
text-decoration: none;
}

218
system.php Normal file
View File

@ -0,0 +1,218 @@
<?php
function ___sortcmp()
{
$a = func_get_arg(0);
$b = func_get_arg(1);
return strcasecmp($a, $b);
}
function ___codepre()
{
$str = func_get_arg(0);
if (func_num_args() > 1) {
$arr1 = array("&", "\"", "'", "<", ">", '"');
$arr2 = array("&amp;", "&quot;", "&apos;", "&lt;", "&gt;", "&#039;");
} else {
$arr1 = array("&", "\"", "'", "<", ">", " ", '"');
$arr2 = array("&amp;", "&quot;", "&apos;", "&lt;", "&gt;", "&nbsp;", "&#039;");
}
return str_replace($arr1, $arr2, $str);
}
function ___ziplist()
{
$zip = trim(func_get_arg(0));
if (!is_readable('pclzip.php') || !___getmime($zip, 'zip')) return false;
require 'pclzip.php';
$pclzip = new pclzip($zip);
if (!($getlist = $pclzip->listContent())) return false;
if (!is_array($getlist) || count($getlist) < 1) return false;
return $getlist;
}
function ___convert()
{
$str = func_get_arg(0);
if (!function_exists("mb_convert_encoding")) return $str;
$encode = func_num_args() < 2 ? "UTF-8" : func_get_arg(1);
$enlist = func_num_args() > 2 ? func_get_arg(2) : "auto,CP936";
return mb_convert_encoding($str, $encode, $enlist);
}
function ___getmime()
{
$path = trim(func_get_arg(0));
if (func_num_args() >= 2) {
$type = trim(func_get_arg(1));
$type = explode(':', $type);
}
if (!is_file($path)) return false;
if (!($fp = fopen($path, "rb"))) return false;
$bsupport = array(
array('jpg', 'ffd8ff', 'image/jpeg'),
array('png', '89504e47', 'image/png'),
array('gif', '47494638', 'image/gif'),
array('bmp', '424d', 'image/x-ms-bmp'),
array('zip', '504b0304', 'application/zip'));
$headstr = bin2hex(fread($fp, 4));
fclose($fp);
foreach ($bsupport as $temp) {
if (preg_match("/^$temp[1]/i", $headstr)) {
if (!isset($type)) {
return $temp[2];
} elseif (in_array($temp[0], $type)) {
return $temp[2];
}
}
}
return false;
}
function ___sendfile()
{
$i = 0;
$to = func_get_arg(0);
$fs = func_get_arg(1);
if (!is_file("email.php")) {
return false;
} else {
require "email.php";
}
if ($to == "" || !is_array($fs)) {
return false;
} elseif (count($fs) < 1) {
return false;
}
$systags = uniqid("");
$subject = "your files";
$headers = "Content-Type: multipart/mixed; boundary=\"$systags\"\r\n";
$emailbody = "--$systags\r\n";
$emailbody .= "Content-type: text/plain; charset=utf-8\r\n";
$emailbody .= "Content-transfer-encoding: 8bit\r\n\r\n";
while ($i < count($fs)) {
if (!is_file($fs[$i]) || !is_readable($fs[$i])) continue;
$attachment = chunk_split(base64_encode(file_get_contents($fs[$i])));
$emailbody .= "--$systags\r\n";
$emailbody .= "Content-type: application/octet-stream; name=" . ___basename($fs[$i]) . "\r\n";
$emailbody .= "Content-transfer-encoding: base64\r\n\r\n";
$emailbody .= "$attachment\r\n\r\n";
$i++;
}
$emailbody .= "--$systags--";
return email($to, "from aite.xyz file manager", $emailbody, $headers);
}
function ___download()
{
$path = trim(func_get_arg(0));
$size = filesize($path);
(isset($_SERVER['HTTP_RANGE']) && !empty($_SERVER['HTTP_RANGE']) && $range = substr($_SERVER['HTTP_RANGE'], 6)) || $range = '0-' . ($size - 1);
if (substr($range, -1) == '-') {
$init = substr($range, 0, -1);
$stop = $size - 1;
} elseif (substr($range, 0, 1) == '-') {
$init = $size - substr($range, 1) - 1;
$stop = $size - 1;
} else {
$init_stop = explode('-', $range);
$init = $init_stop[0];
$stop = $init_stop[1];
}
if (isset($_SERVER['HTTP_RANGE'])) {
header('HTTP/1.1 206 Partial Content');
}
header('Accept-Ranges: bytes');
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename=' . ___basename($path));
header("Content-Range: bytes $init-$stop/$size");
header('Content-Length: ' . ($stop - $init + 1));
$fp = fopen($path, "rb");
fseek($fp, $init);
while (!feof($fp)) {
echo fread($fp, 4096);
if (ftell($fp) > $stop) {
break;
}
}
fclose($fp);
}
function ___basename()
{
$path = trim(func_get_arg(0));
$path = str_replace("\\", "/", $path);
$path = explode("/", $path);
return ___convert($path[count($path) - 1]);
}
function ___realpath()
{
$path = func_get_arg(0);
$path = str_replace('\\', '/', $path);
if (!is_link($path)) return realpath($path);
return preg_replace('/[^:]?\/{2,}/si', '/', $path);
}
function ___filesize()
{
$size = trim(func_get_arg(0));
if ($size < 1024) {
return $size . " B";
} elseif ($size < 1024 * 1024) {
return number_format($size / 1024, 3) . " KB";
} elseif ($size < 1024 * 1024 * 1024) {
return number_format($size / 1024 / 1024, 3) . " MB";
} elseif ($size < 1024 * 1024 * 1024 * 1024) {
return number_format($size / 1024 / 1024 / 1024, 3) . " GB";
} else {
return number_format($size / 1024 / 1024 / 1024 / 1024, 3) . " TB";
}
}
function ___superexec()
{
$cmd = trim(func_get_arg(0));
if (php_uname("s") != "Linux") return false;
if ($cmd == "" || !function_exists("proc_open") || !function_exists("stream_get_contents")) {
return false;
}
if (!is_resource($sh = proc_open("exec sh", array(0 => array("pipe", "r"), 1 => array("pipe", "w")), $pipes))) {
return false;
}
fwrite($pipes[0], "export LANG=\"zh_CN.utf8\"\n");
fwrite($pipes[0], $cmd);
fclose($pipes[0]);
$result = stream_get_contents($pipes[1]);
fclose($pipes[1]);
proc_close($sh);
return trim($result);
}
function ___shortpath()
{
$path = trim(func_get_arg(0));
$path = ___convert($path, "UTF-8");
if (function_exists('mb_strlen')) {
if (mb_strlen($path, "UTF-8") <= 18) return $path;
} else {
if (strlen($path) <= 18) return $path;
}
$path1 = function_exists('mb_substr') ? mb_substr($path, -9, 9, "UTF-8") : substr($path, -9);
$path2 = function_exists('mb_substr') ? mb_substr($path, 0, 9, "UTF-8") : substr($path, 0, 9);
return $path2 . "&ensp;....&ensp;" . $path1;
}
function ___windowsdisk()
{
$disks = array();
foreach (range('A', 'Z') as $item) {
$item = sprintf("%s:\\", $item);
if (is_dir($item)) {
$disks[] = $item;
}
}
if (empty($disks)) return false;
return $disks;
}
?>

2
tarcls.php Normal file

File diff suppressed because one or more lines are too long

161
unpack.php Normal file
View File

@ -0,0 +1,161 @@
<?php
require "config.php";
if (!isset($_GET['path']) || !isset($_GET['type']) || !isset($_GET['unpackdir'])) {
header("Location: ./404.php");
exit;
} elseif (($type = trim($_GET['type'])) == "" || !is_file(($path = trim($_GET['path']))) || !is_dir(($unpackdir = trim($_GET['unpackdir'])))) {
header("Location: ./404.php");
exit;
}
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";
switch ($type) {
case "gz" :
if (!function_exists("gzopen")) {
echo "系统没有支持核心函数!";
} else {
$fp = preg_replace("/(.*?)\.gz$/si", "\\1", $unpackdir . "/" . basename($path));
if (file_exists($fp)) {
echo "目标文件已经存在了哦!";
} elseif (!($gz = gzopen($path, "r"))) {
echo "系统无法打开压缩文件!";
} else {
if (!($fp = fopen($fp, "wb"))) {
echo "系统无法保存解压文件!";
} else {
while (!feof($gz)) {
fwrite($fp, gzread($gz, 4096));
}
gzclose($gz);
fclose($fp);
echo "压缩文件已经解压完成!";
}
}
}
break;
case "bz2" :
if (!function_exists("bzopen")) {
echo "系统没有支持核心函数!";
} else {
$fp = preg_replace("/(.*?)\.bz2$/si", "\\1", $unpackdir . "/" . basename($path));
if (file_exists($fp)) {
echo "目标文件已经存在了哦!";
} elseif (!($bz2 = bzopen($path, "r"))) {
echo "系统无法打开压缩文件!";
} else {
if (!($fp = fopen($fp, "wb"))) {
echo "系统无法保存解压文件!";
} else {
while (!feof($bz2)) {
fwrite($fp, bzread($bz2, 4096));
}
bzclose($bz2);
fclose($fp);
echo "压缩文件已经解压完成!";
}
}
}
break;
case "zip" :
if (!file_exists("pclzip.php")) {
echo "暂时无法进行解压操作!";
} else {
require "pclzip.php";
$pk = new pclzip($path);
if (($zip = $pk->extract(PCLZIP_OPT_PATH, $unpackdir)) == false) {
echo "无法成功解压您的文件!";
} else {
echo "成功解压出&ensp;" . count($zip) . "&ensp;个档案!";
}
}
break;
case "tar" :
if (!file_exists("tarcls.php")) {
echo "暂时无法进行解压操作!";
} else {
require "tarcls.php";
$pk = new Archive_Tar($path);
if ($pk->extract($unpackdir) == false) {
echo "无法成功解压您的文件!";
} else {
echo "成功的对文件进行解压!";
}
}
break;
case "7za" :
$bin = "./p7zip.bin";
if (is_file($bin)) {
if (function_exists("chmod")) {
chmod($bin, 0700);
if (!is_executable($bin)) {
$tmp = sys_get_temp_dir() . '/p7zip.bin';
if (copy($bin, $tmp)) {
chmod($tmp, 0700);
!is_executable($tmp) ? $bin = false : $bin = $tmp;
} else {
$bin = false;
}
}
}
}
if (___superexec($bin) == "") {
if (___superexec('7z') != "") {
$bin = "7z";
} elseif (___superexec('7za') != "") {
$bin = "7za";
}
}
if (___superexec($bin) == "") {
echo "程序无法正常完成工作!";
} else {
$a = addslashes($path);
$b = addslashes($unpackdir);
$c = isset($_GET['password']) ? addslashes(trim($_GET['password'])) : null;
echo nl2br(___codepre(___convert(___superexec("$bin x '$a' '-o$b' '-p$c' -y 2>&1"), "UTF-8")));
}
break;
case "rar" :
$bin = "./unrar.bin";
if (is_file($bin)) {
if (function_exists("chmod")) {
chmod($bin, 0700);
if (!is_executable($bin)) {
$tmp = sys_get_temp_dir() . '/unrar.bin';
if (copy($bin, $tmp)) {
chmod($tmp, 0700);
!is_executable($tmp) ? $bin = false : $bin = $tmp;
} else {
$bin = false;
}
}
}
}
if (___superexec($bin) == "") {
if (___superexec('rar') != "") {
$bin = "rar";
} elseif (___superexec('unrar') != "") {
$bin = "unrar";
}
}
if (___superexec($bin) == "") {
echo "程序无法正常完成工作!";
} else {
$a = addslashes($path);
$b = addslashes($unpackdir);
$c = isset($_GET['password']) ? addslashes(trim($_GET['password'])) : null;
if ($c == null) {
echo nl2br(___codepre(___convert(___superexec("$bin x -y '$a' '$b' 2>&1"), "UTF-8")));
} else {
echo nl2br(___codepre(___convert(___superexec("$bin x -y '-p$c' '$a' '$b' 2>&1"), "UTF-8")));
}
}
break;
default :
echo "暂时不支持的压缩类型!";
}
echo "</div>\n";
xhtml_footer();
?>

75
unzip.php Normal file
View File

@ -0,0 +1,75 @@
<?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 (!($ziplist = ___ziplist($path))) {
xhtml_head("爱特ZIP工具");
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("爱特ZIP工具");
if (isset($_POST['z']) && is_array($_POST['z']) && isset($_POST['undir']) && is_dir(trim($_POST['undir']))) {
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode(dirname($path)) . "\"]>返回目录</a>解压结果\n";
echo "</div>\n";
$pk = new pclzip($path);
$dir = trim($_POST['undir']);
$arr = array_map('urldecode', $_POST['z']);
if (($zip = $pk->extract(PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_BY_NAME, $arr)) == false) {
echo "<div class=\"love\">\n";
echo "无法成功解压您的文件!";
echo "\n</div>\n";
} else {
echo "<div class=\"love\">\n";
echo "本次共操作&ensp;" . count($zip) . "&ensp;个档案!";
echo "\n</div>\n";
foreach ($zip as $zf) {
echo "<div class=\"love\">\n";
if ($zf['folder']) {
echo "[目录]";
} else {
echo "[文件]";
}
echo ___convert($zf['filename'], "UTF-8") . "" . $zf['status'] . "\n<br />\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 "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n";
echo "<div class=\"love\">\n";
$unzipdir = dirname($path);
isset($_GET['unzipdir']) && is_dir($_GET['unzipdir']) && $unzipdir = trim($_GET['unzipdir']);
echo "解压<a href=\"./index.php?new&path=" . urlencode(dirname($path)) . "&multiple=unzipdir&getcwd=" . urlencode($path) . "\">到此</a>路径:\n";
echo "<input type=\"text\" name=\"undir\" value=\"$unzipdir\" />\n";
echo "<input type=\"submit\" value=\"UNZIP\" />\n";
echo "<a href=\"{$_SERVER['REQUEST_URI']}&select\">全选</a>|<a href=\"./unzip.php?path=" . urlencode($path) . "&unzipdir=" . urlencode($unzipdir) . "\">消选</a>\n";
echo "</div>\n";
$select = isset($_GET['select']) ? "checked " : null;
foreach ($ziplist as $zfile) {
echo "<div class=\"love\">\n";
echo "<input type=\"checkbox\" name=\"z[]\" value=\"" . urlencode($zfile['stored_filename']) . "\" $select/>\n";
if ($zfile['folder']) {
echo "[目录]" . ___codepre(___convert($zfile['stored_filename'], "UTF-8"));
} else {
echo "[文件]" . ___codepre(___convert($zfile['stored_filename'], "UTF-8"));
echo "" . ___filesize($zfile['size']) . "-&gt;" . ___filesize($zfile['compressed_size']) . "";
}
echo "\n</div>\n";
}
echo "</form>\n";
}
xhtml_footer();
?>

139
upload.php Normal file
View File

@ -0,0 +1,139 @@
<?php
require "config.php";
if (!isset($_GET['getcwd'])) {
$getcwd = OPEN;
} else {
$getcwd = ___realpath(trim($_GET['getcwd']));
}
if (!is_dir($getcwd)) {
header("Location: ./404.php");
exit;
}
xhtml_head("批量上传");
echo "<div class=\"like\">\n";
echo "<a href=\"./index.php?path=" . urlencode($getcwd) . "\">返回目录</a>\n";
if (isset($_GET['url'])) {
echo "<a href=\"?getcwd=" . urlencode($getcwd) . "\">本地上传</a>\n";
} else {
echo "<a href=\"?url&getcwd=" . urlencode($getcwd) . "\">远程上传</a>\n";
}
echo "</div>\n";
echo "<div class=\"love\">\n";
echo "<form action=\"\" method=\"GET\">\n";
echo "<input type=\"hidden\" name=\"getcwd\" value=\"$getcwd\" />\n";
if (isset($_GET['url'])) echo "<input type=\"hidden\" name=\"url\" />\n";
echo "数量-&gt;<input type=\"text\" name=\"uploadnum\" />\n";
echo "<input type=\"submit\" value=\"GO\" />\n";
echo "</form>\n";
echo "</div>\n";
if (isset($_GET['url'])) {
if (isset($_POST['fupload'])) if (is_array($_POST['fupload'])) if (count($_POST['fupload']) > 0) {
$o = 0;
$i = 0;
echo "<div class=\"like\">上传文件信息报告</div>\n";
while ($i < count($_POST['fupload'])) {
if (!preg_match("/^[a-z0-9]+\:\/\/.+/si", $_POST['fupload'][$i])) {
$i++;
continue;
}
preg_match("/[^\/\?&\s\:\\\]+$/i", $_POST['fupload'][$i], $fname);
$fname = $fname[0] != "" ? $fname[0] : time() . ".file";
if (!($fp = fopen(trim($_POST['fupload'][$i]), "rb"))) {
echo "<div class=\"error\">\n";
echo "{$fname}Error&ensp;!\n";
echo "</div>\n";
} elseif (!($fp2 = fopen($fpath = "$getcwd/$fname", "wb"))) {
echo "<div class=\"error\">\n";
echo "{$fname}Error&ensp;!\n";
echo "</div>\n";
} else {
while (!feof($fp)) {
fwrite($fp2, fread($fp, 4096));
}
fclose($fp);
fclose($fp2);
if (filesize($fpath) > 0) {
echo "<div class=\"love\">\n";
echo "{$fname}Yes&ensp;!\n";
echo "</div>\n";
} else {
unlink($fpath);
echo "<div class=\"error\">\n";
echo "{$fname}Error&ensp;!\n";
echo "</div>\n";
}
}
$o++;
$i++;
}
if ($o < 1) echo "郁闷,没有任何文件被上传!\n";
}
echo "<div class=\"like\">输入您的上传地址</div>\n";
echo "<form action=\"?url&getcwd=" . urlencode($getcwd) . "\" method=\"POST\">\n";
if (!isset($_GET['uploadnum'])) {
echo "<div class=\"love\">\n";
echo "地址[+]<input type=\"text\" name=\"fupload[]\" />\n";
echo "</div>\n";
} else {
$i = 0;
$uploadnum = (int)trim($_GET['uploadnum']);
if ($uploadnum < 1) $uploadnum = 1;
while ($i < $uploadnum) {
echo "<div class=\"love\">\n";
echo "地址[" . ($i + 1) . "]<input type=\"text\" name=\"fupload[]\" />\n";
echo "</div>\n";
$i++;
}
}
echo "<div class=\"love\">\n";
echo "<input type=\"submit\" value=\"远程上传所有文件\" />(有效&ensp;地址)\n";
echo "</div>\n";
echo "</form>\n";
} else {
if (isset($_FILES['fupload'])) if (count($_FILES['fupload']) > 0) {
$o = 0;
$i = 0;
echo "<div class=\"like\">上传文件信息报告</div>\n";
while ($i < count($_FILES['fupload']['size'])) {
if ($_FILES['fupload']['size'][$i] < 1) {
$i++;
continue;
}
if (!move_uploaded_file($_FILES['fupload']['tmp_name'][$i], $getcwd . "/" . $_FILES['fupload']['name'][$i])) {
echo "<div class=\"error\">\n";
echo "{$_FILES['fupload']['name'][$i]}Error&ensp;!\n";
echo "</div>\n";
} else {
echo "<div class=\"love\">\n";
echo "{$_FILES['fupload']['name'][$i]}" . ___filesize($_FILES['fupload']['size'][$i]) . "\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\" enctype=\"multipart/form-data\">\n";
if (!isset($_GET['uploadnum'])) {
echo "<div class=\"love\">\n";
echo "文件[+]<input type=\"file\" name=\"fupload[]\" />\n";
echo "</div>\n";
} else {
$i = 0;
$uploadnum = (int)trim($_GET['uploadnum']);
if ($uploadnum < 1) $uploadnum = 1;
while ($i < $uploadnum) {
echo "<div class=\"love\">\n";
echo "文件[" . ($i + 1) . "]<input type=\"file\" name=\"fupload[]\" />\n";
echo "</div>\n";
$i++;
}
}
echo "<div class=\"love\">\n";
echo "<input type=\"submit\" value=\"上传所有选择文件\" />(有效&ensp;文件)\n";
echo "</div>\n";
echo "</form>\n";
}
xhtml_footer();
?>

86
view.php Normal file
View File

@ -0,0 +1,86 @@
<?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_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();
} 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";
echo "<div class=\"like\">爱特文件内容浏览</div>\n";
if (filesize($path) > (2 * 1024 * 1024)) {
echo "<div class=\"love\">\n";
echo "文件过大,请下载后查看!\n";
echo "</div>\n";
} else {
echo "<div class=\"love\">\n";
if (!($data = file_get_contents($path))) {
echo "读取文件时发生了错误!\n";
} else {
echo "<pre>";
if (!isset($_GET['charset'])) {
echo nl2br(___codepre(___convert($data, "UTF-8")));
} elseif (($charset = trim($_GET['charset'])) == "") {
echo nl2br(___codepre(___convert($data, "UTF-8")));
} else {
echo nl2br(___codepre(___convert($data, "UTF-8", $charset)));
}
echo "<pre>\n";
}
echo "</div>";
}
xhtml_footer();
}
?>

31
xhtml.php Normal file
View File

@ -0,0 +1,31 @@
<?php
function xhtml_head()
{
$name = NAME;
$title = func_get_arg(0);
echo <<<XHTML
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$title} - {$name}</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div id="header">
我一直在开辟属于我的天空
</div>
XHTML;
}
function xhtml_footer()
{
echo <<<XHTML
<div id="footer">
By<a href="mailto:xiaoqidun@gmail.com">Xiaoqidun@Gmail.Com</a>
</div>
</body>
</html>
XHTML;
}
?>