📄 task.php
字号:
case "scissor"://创建剪切任务
if(checkcore($path)){
$title = $T_lang['title'][7];
$content = $T_lang['scissor'][0].$T_lang['confirm'][0];
}else{
if(isset($_SESSION['readystick'])){
unset($_SESSION['readystick']);
}
$_SESSION['readystick'][0] = $_POST['path'];
$_SESSION['readystick'][1] = "scissor";
$window = false;
$method = NULL;
}
break;
case "copy"://创建拷贝任务
if(isset($_SESSION['readystick'])){
unset($_SESSION['readystick']);
}
$_SESSION['readystick'][0] = $_POST['path'];
$_SESSION['readystick'][1] = "copy";
$window = false;
$method = NULL;
break;
case "stepstick"://粘贴前的检查
$break = true;
$title = $T_lang['title'][8];
if(isset($_SESSION['readystick'])){
$source = truepath(urldecode($_SESSION['readystick'][0]));
if(is_dir($realpath."/".basename($source))&&is_dir($source)&&
(strtolower(dirname($source))!=strtolower($realpath)))
{
$content = str_replace("--target--",$path."/".basename($source),
$T_lang['stick'][0]).$T_lang['submit'][4].$T_lang['cancel'][0];
}elseif(file_exists($realpath."/".basename($source))&&is_file($source)&&
(strtolower(dirname($source))!=strtolower($realpath)))
{
$content = str_replace("--target--",$path."/".basename($source),
$T_lang['stick'][1]).$T_lang['submit'][4].$T_lang['cancel'][0];
}else{
$break = false;
}
}else{
$content = $T_lang['stick'][3].$T_lang['confirm'][0];
}
if($break){
break;
}
case "stick"://开始粘贴
$title = $T_lang['title'][8];
if(isset($_SESSION['readystick'])){
$source = truepath(urldecode($_SESSION['readystick'][0]));
if($_SESSION['readystick'][1] == "copy"){//粘贴拷贝任务
if(strtolower(dirname($source)) == strtolower($realpath)){
$target = $path."/".$T_lang['stick'][4].basename($source);
}else{
$target = $path."/".basename($source);
}
if(checkcore($target)){
$errors = $T_lang['stick'][5];
}else{
$target = truepath($target);
if(is_dir($source)){
if($_POST['type']=="cover"){
$errors = copypath($source,$target,false);
}else{
$errors = copypath($source,$target);
}
if($errors==""){
$errors = $T_lang['stick'][6];
}else{
$errors = str_replace("--alert--",$errors,
$T_lang['font'][0]);
}
}else{
if(@copy($source,$target)){
$errors = $T_lang['stick'][7];
}else{
$errors = str_replace("--source--",$source,
$T_lang['stick'][8]);
}
}
}
}elseif($_SESSION['readystick'][1] == "scissor"){//粘贴剪切任务
if(strtolower(dirname($source)) == strtolower($realpath)){
$errors = $T_lang['stick'][9];
}else{
$target = $path."/".basename($source);
if(checkcore($target)){
$errors = $T_lang['stick'][10];
}else{
$target = truepath($target);
if(is_dir($source)){
if($_POST['type']=="cover"){
$errors = movepath($source,$target,false);
}else{
$errors = movepath($source,$target);
}
if($errors==""){
$errors = $T_lang['stick'][11];
}else{
$errors = str_replace("--alert--",$errors,
$T_lang['font'][0]);
}
}else{
if(@copy($source,$target)){
if(@unlink($source)){
$errors = $T_lang['stick'][12];
}else{
$errors = str_replace("--source--",$source,
$T_lang['stick'][13]);
}
}else{
$errors = str_replace("--source--",$source,
$T_lang['stick'][14]);
}
}
}
}
}
unset($_SESSION['readystick']);
}else{
$errors = $T_lang['stick'][15];
}
$content = $errors.$T_lang['confirm'][2];
break;
case "recycled"://清空回收站任务
$title = $T_lang['title'][9];
$errors=delpath($T_Recycled);
if($errors==""){
$errors = $T_lang['recycled'][0];
}else{
$errors = str_replace("--alert--",$errors,$T_lang['font'][0]);
}
$content = $errors.$T_lang['confirm'][1];
echo "<script>parent.parent.left.webFXTreeHandler.selected.reload();</script>";
break;
case "attribute"://获得文件或文件夹的信息
$title = $T_lang['title'][10];
$basename = basename($path);
$position = $path;
if(is_dir($realpath)){
$attribute = new StatFolder($realpath);
$size = $attribute->GetTotalSize();
$num = $attribute->GetFileNum();
$typenum = $attribute->GetTypeNum();
$foldernum = $attribute->GetFolderNum();
$content = str_replace("--basename--",$basename,$T_lang['attribute'][0]);
$content = str_replace("--position--",$position,$content);
$content = str_replace("--size--",$size,$content);
$content = str_replace("--num--",$num,$content);
$content = str_replace("--typenum--",$typenum,$content);
$content = str_replace("--foldernum--",$foldernum,$content);
}else{
$size = filesize($realpath);//大小
$atime = date("Y-m-d H:i:s", fileatime($realpath));//修改时间
$mtime = date("Y-m-d H:i:s", filemtime($realpath));//访问时间
clearstatcache();
$content = str_replace("--basename--",$basename,$T_lang['attribute'][1]);
$content = str_replace("--position--",$position,$content);
$content = str_replace("--size--",$size,$content);
$content = str_replace("--atime--",$atime,$content);
$content = str_replace("--mtime--",$mtime,$content);
}
break;
case "upload"://上传文件
$title = $T_lang['title'][11];
$content = "";
foreach($_FILES["file"]["error"] as $key => $value){
if($_FILES["file"]["name"][$key]!=""){
if($value==UPLOAD_ERR_OK){
$filename = $_FILES["file"]["name"][$key];
if(move_uploaded_file($_FILES["file"]["tmp_name"][$key],
$T_tempdir."/".$filename))
{
if(file_exists($realpath."/".$filename)){
$content.= str_replace("--filename--",$filename,
$T_lang['upload'][0]);
}else{
if(copy($T_tempdir."/".$filename,$realpath."/".$filename)){
@unlink($T_tempdir."/".$filename);
$content .= str_replace("--filename--",$filename,
$T_lang['upload'][1]);
}else{
$content .= str_replace("--filename--",$filename,
$T_lang['upload'][2]);
}
}
}else{
$content .= str_replace("--filename--",$filename,
$T_lang['upload'][2]);
}
}else{
$content .= str_replace("--filename--",$filename,
$T_lang['upload'][2]);
}
}
}
$content.= $T_lang['confirm'][2];
break;
case "rewrite"://编辑文件准备
$title = $T_lang['title'][13]."[".$path."]";
if(checkcore($path)){
$content = $T_lang['rewrite'][0].$T_lang['confirm'][0];
}else{
if(in_array(fileext($path),$T_editext)){
$txtfile = $T_task."?action=edit&path=".$_POST['path'];
$editfile = str_replace("--txtfile--",$txtfile,$T_lang['rewrite'][1]);
}else{
$content = $T_lang['rewrite'][2].$T_lang['confirm'][0];
}
}
break;
case "savefile"://保存文件
$txtdata = trim($_POST['txtdata']);
if($txtdata!==""){
if($T_Magic) $txtdata = stripslashes($txtdata);
$txtdata = preg_replace("/[\s]textarea/i","textarea",$txtdata);
$txtdata = preg_replace("/[\s]xml/i","xml",$txtdata);
$fp = fopen($realpath, 'w');
flock($fp,LOCK_EX);
fwrite($fp,$txtdata);
flock($fp,LOCK_UN);
fclose($fp);
}
header("Location:{$T_task}?action=edit&path=".$_POST['path']);
exit;
break;
default://未定义页面
$title = $T_lang['title'][15];
$content = $T_lang['undefined'][0].$T_lang['confirm'][0];
break;
}
}elseif($_GET['action']=="edit"&&$_GET['path']){//编辑文件
$path = urldecode($_GET['path']);
$realpath = truepath($path);
$datafile = "";
if(is_file($realpath)&&!checkcore($path)){
if(filesize($realpath)==0){
$datafile = $T_lang['rewrite'][4];
}else{
$fp = fopen($realpath, 'r');
flock($fp,LOCK_SH);
$datafile = fread($fp,filesize($realpath));
flock($fp,LOCK_UN);
fclose($fp);
$datafile = preg_replace("/textarea/i"," textarea",$datafile);
$datafile = preg_replace("/<\?xml/i","<? xml",$datafile);
}
}else{
$datafile = str_replace("--filename--",$path,$T_lang['rewrite'][3]);
}
}
if($window){
if($content!=""){
echo "<script type=\"text/javascript\">parent.newwindow('".$title.
"','".$content."');</script>";
exit;
}elseif($datafile!=""){
require_once($T_edit);
exit;
}elseif($editfile!=""){
echo "<script type=\"text/javascript\">parent.editwindow('".$title.
"','".$editfile."');</script>";
exit;
}
}else{
if($method){
echo "<script type=\"text/javascript\">".$method."</script>";
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -