⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 task.php

📁 BBWPS 宾馆管理系统 php+mysql
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
/*
    [BBWPS!] (C)2006-2010 小蜜蜂版权所有.
	This is NOT a freeware, use is subject to license terms
*/
define('IN_SELF', 'task');
require_once ("./global.php");
session_start();
	require_once ($T_function);
	$path       = urldecode($_POST['path']);
	$parentpath = urlencode(direction($path));
	$realpath   = truepath($path);
	if($_GET['type']==folder){
		$realpath = truepath($path,2);
	}
	$zippath    = $T_zipdir.'/'.str_replace('/','_',$path);
	$reload     = "window.location=(\'".$T_main."?path=".$parentpath."\')";
	$sreload    = "window.location=(\'".$T_main."?path=".$_POST['path']."\')";
	$preload    = "parent.location=('".$T_main."?path=".$parentpath."')";
	$rreload    = "parent.location=('".$T_main."?path=".$_POST['path']."')";
	$window     = true;
	require_once ($T_language);
	if($_POST['action']){
		switch($_POST['action']){
			case "shortcut":
				include_once("shortcut.list");
				if(in_array($_POST['path'],(array)$shortcuts)){
					echo "<script>alert('快捷方式已存在');</script>";
					exit();
				}
				$i=0;
				$shortcuts[]=$_POST['path'];
				$handle=fopen("shortcut.list","w");
				$str="<?php
";
				foreach($shortcuts as $value){
					$str.="\$shortcuts[".($i++)."]=\"".$value."\";
";
				}
				$str.="?>";
				fwrite($handle,$str);
				fclose($handle);
				echo "<script>alert('创建成功');</script>";
				break;
			case "replace"://字符串替换
				include_once("manager/include/replace.php");
				$arrConfig['isReg']         = $_POST['isReg']?1:0;
				$arrConfig['sub']           = $_POST['sub']?1:0;
				$arrConfig['replacePath'] 	= $realpath."/";
				$arrConfig['fileType']		  = explode(",",$_POST['filetype']);
				$arrConfig['search'][0]  	= $_POST['key'];
				$arrConfig['replace'][0]	= $_POST['keynew'];
				$str = new ReplaceFile($arrConfig);
				$content="<div  style=\"width:100%;height:200;overflow-x:hidden;overflow-y:scroll;\"><table><tr><td>&nbsp;&nbsp;&nbsp;</td><td align=\"left\">$str->msg</td></tr></table></div>";
				$title="字符串替换";
				break;
				
			case "rename"://重命名文件夹或文件之前的检查
				$title   = $T_lang['title'][0];
				$name = basename($path);
				if(checkcore($path)){
					$content = $T_lang['rename'][0].$T_lang['confirm'][0];
				}else{
					$content = $T_lang['rename'][1].$T_lang['form'][0].$T_lang['path'][0].
						$T_lang['action'][0].str_replace("--name--",$name,$T_lang['rename'][2]).
						$T_lang['submit'][0].$T_lang['cancel'][0].$T_lang['form']['end'];
				}
				break;
			case "truerename"://重命名文件夹或文件
				$title   = $T_lang['title'][0];
				if($_POST['newname']===""){//判断文件夹或文件名有没有给
					$content = $T_lang['newfolder'][0].$T_lang['confirm'][0];
				}else{
					$newname = $_POST['newname'];
					if(file_exists(dirname($realpath)."/".$newname)){
						$content = $T_lang['rename'][3].$T_lang['confirm'][0];
					}else{
						if(rename($realpath,dirname($realpath)."/".$newname)){
							$window = false;
							$method = $preload;
						}else{
							$content = $T_lang['rename'][4].$T_lang['confirm'][0];
						}
					}
				}
				break;
			case "newfolder"://新文件夹
				$title   = $T_lang['title'][1];
				if($_POST['foldername']===""){//判断文件夹名有没有给
					$content = $T_lang['newfolder'][0].$T_lang['confirm'][0];
				}else{
					$name = $_POST['foldername'];
					if(is_dir($realpath."/".$name)){
						$content = $T_lang['newfolder'][1].$T_lang['confirm'][0];
					}else{
						if(@mkdir($realpath."/".$name,0777)){
							$window = false;
							$method = $rreload;
						}else{
							$content = $T_lang['newfolder'][2].$T_lang['confirm'][0];
						}
					}	
				}
				break;
			case "newfile"://新文件
				$title = $T_lang['title'][2];
				$name  = $_POST['filename'].".".$_POST['exttype'];
				if($_POST['filename']===""){//判断文件名有没有给
					$content = $T_lang['newfile'][0].$T_lang['confirm'][0];
				}elseif(file_exists($realpath."/".$name)){
					$content = $T_lang['newfile'][1].$T_lang['confirm'][0];
				}else{
					if(file_exists($T_newfile)){
						if(copy($T_newfile,$realpath."/".$name)){
							$window = false;
							$method = $rreload;
						}elseif($fp = fopen($realpath."/".$name,"w")){
							flock($fp,LOCK_EX);
							fwrite($fp,"newfile",1024);
							flock($fp,LOCK_UN);
							fclose($fp);
							$window = false;
							$method = $rreload;	
						}else{
							$content = $T_lang['newfile'][2].$T_lang['confirm'][0];
						}
					}elseif($fp = fopen($realpath."/".$name,"w")){
						flock($fp,LOCK_EX);
						fwrite($fp,"newfile",1024);
						flock($fp,LOCK_UN);
						fclose($fp);
						$window = false;
						$method = $rreload;	
					}else{
						$content = $T_lang['newfile'][3].$T_lang['confirm'][0];
					}
				}
				break;
			case "download"://下载文件或文件夹前的准备			
			  $title   = $T_lang['title'][3];
				if(is_dir($realpath)){//压缩要下载的文件夹
					$zip = new ZipAllFloder();
					$zip->ZipFolder($realpath,$zippath.".zip");
					$content = $T_lang['download'][0].$T_lang['form'][2].$T_lang['action'][1].
						$T_lang['path'][1].$T_lang['submit'][1].$T_lang['cancel'][1].
						$T_lang['form']['end'];
				}else{//检查是否存在文件
					if(file_exists($realpath)){
						$content = $T_lang['download'][1].$T_lang['form'][1].
							$T_lang['action'][1].$T_lang['path'][0].$T_lang['submit'][1].
							$T_lang['cancel'][1].$T_lang['form']['end'];
					}else{
						$content = $T_lang['download'][2].$T_lang['confirm'][0];
					}
				}
				break;
			case "truedownload"://直接下载文件
				$filename = basename($path);
				$str='Content-Disposition: attachment; filename="'.$filename.'"';
				header("Content-type: application/force-download");
				header($str);
				readfile($realpath);
				exit;
				break;
			case "crush"://回收文件或文件夹前的检查
				$title   = $T_lang['title'][4];
				if(checkcore($path)){//检查核心文件是否是该$path的一个节点
					$content = $T_lang['crush'][0].$T_lang['confirm'][0];
				}else{
					$content = $T_lang['crush'][1].$T_lang['form'][0].$T_lang['path'][0].
						$T_lang['action'][2].$T_lang['submit'][2].$T_lang['cancel'][0].
						$T_lang['form']['end'];
				}
				break;
			case "back"://删除文件或文件夹
				$title   = $T_lang['title'][4];
				$from    = $T_fprefix.base64_encode(direction($path)).$T_fsuffix;
				if(is_dir($realpath)){
					$target = $T_Recycled."/".basename($path).$T_tprefix.date('Y-m-d H-i-s').
						$T_tsuffix.$from;
					$return = movepath($realpath,$target);
					if($return){
						$content = str_replace("--alert--",$return,$T_lang['font'][0]).
							$T_lang['confirm'][1];
					}else{
						$content = $T_lang['back'][0].$T_lang['confirm'][1];
					}
				}else{
					if($suffix=fileext(basename($realpath))){
						$suffix = ".".$suffix;
						$target = $T_Recycled."/".basename($path,$suffix).$T_tprefix.
							date('Y-m-d H-i-s').$T_tsuffix.$from.$suffix;
					}else{
						$target = $T_Recycled."/".basename($path).$T_tprefix.
							date('Y-m-d H-i-s').$T_tsuffix.$from;	
					}
					if(@copy($realpath,$target)){
						@unlink($realpath);
						$content = $T_lang['back'][1].$T_lang['confirm'][1];
					}else{
						$content = $T_lang['back'][2].$T_lang['confirm'][0];
					}
				}
				break;
			case "return"://还原回收站内的文件或文件夹
				$title   = $T_lang['title'][5];
				if(ereg(".*".$T_fprefix_."(.*)".$T_fsuffix_.".*",$path)){
					$return = ereg_replace(".*".$T_fprefix_."(.*)".$T_fsuffix_.".*",
											"\\1",$path);
					$return = truepath(base64_decode($return));
					if(is_dir($realpath)){
						$target = $return."/".ereg_replace("(.*)".$T_tprefix_.".*","\\1",
															basename($path));
						if($errors = movepath($realpath,$target)){
							$content = str_replace("--alert--",$errors,$T_lang['font'][0]).
								$T_lang['confirm'][0];
						}else{
							$window = false;
							$method = $preload;
						}
					}else{
						$target = $return."/".
							ereg_replace("(.*)".$T_tprefix_.".*".$T_tsuffix_."(\..*)?","\\1\\2",
							basename($path));
						if(file_exists($target)){
							$content = $T_lang['return'][0].$T_lang['confirm'][0];
						}else{
							if(@copy($realpath,$target)){
								if(@unlink($realpath)){
									$window = false;
									$method = $preload;
								}else{
									$content = $T_lang['return'][1].$T_lang['confirm'][0];
								}
							}
						}
					}
				}else{
					$content = $T_lang['return'][2].$T_lang['confirm'][0];
				}
				break;
			case "delete"://删除文件夹或文件前的confirm
				$title   = $T_lang['title'][6];
				if(checkcore($path)){
					$content = $T_lang['delete'][0].$T_lang['confirm'][0];
				}else{
					$content = $T_lang['delete'][1].$T_lang['form'][0].$T_lang['action'][3].
						$T_lang['path'][0].$T_lang['submit'][3].$T_lang['cancel'][0].
						$T_lang['form']['end'];		
				}
				break;
			case "truedelete"://删除文件夹或文件
				$title   = $T_lang['title'][6];
				if(file_exists($realpath)){
					if(is_dir($realpath)){//删除整个文件夹
						$return = delpath($realpath);
						if($return){
							$content = str_replace("--alert--",$return,$T_lang['font'][0]).
								$T_lang['confirm'][1];
						}else{
							$content = $T_lang['delete'][2].$T_lang['confirm'][1];
						}
					}else{//删除单个文件
						if(@unlink($realpath)){
							$content = $T_lang['delete'][3].$T_lang['confirm'][1];
						}else{
							$content = $T_lang['delete'][4].$T_lang['confirm'][1];
						}
					}
				}else{
					$content = $T_lang['delete'][5].$T_lang['confirm'][1];
				}
				break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -