public function pathInfo() { $path = $this->path; $type = $this->in['type']; if ($type == "folder") { $data = path_info($path, $this->L['time_type_info']); } else { $data = file_info($path, $this->L['time_type_info']); } show_json($data); }
function path_search($path, $search, $is_content = false, $file_ext = '', $is_case = false) { $ext_arr = explode("|", $file_ext); recursion_dir($path, $dirs, $files, -1, 0); $strpos = 'stripos'; //是否区分大小写 if ($is_case) { $strpos = 'strpos'; } $filelist = array(); $folderlist = array(); foreach ($files as $f) { $ext = get_path_ext($f); $path_this = get_path_this($f); if ($file_ext != '' && !in_array($ext, $ext_arr)) { continue; } //文件类型不在用户限定内 if ($strpos($path_this, $search) !== false) { //搜索文件名;搜到就返回;搜不到继续 $filelist[] = file_info($f); continue; } if ($is_content && is_file($f)) { $fp = fopen($f, "r"); $content = @fread($fp, get_filesize($f)); fclose($fp); if ($strpos($content, iconv_app($search)) !== false) { $filelist[] = file_info($f); } } } if ($file_ext == '') { //没限定扩展名则才搜索文件夹 foreach ($dirs as $f) { $path_this = get_path_this($f); if ($strpos($path_this, $search) !== false) { $folderlist[] = array('name' => iconv_app(get_path_this($f)), 'path' => iconv_app(get_path_father($f))); } } } return array('folderlist' => $folderlist, 'filelist' => $filelist); }
exit; } if (isset($_GET["browse-folder"])) { browse_folder(); exit; } if (isset($_GET["folder-infos"])) { folder_infos(); exit; } if (isset($_GET["top-bar"])) { top_bar(); exit; } if (isset($_GET["file-info"])) { file_info(); exit; } if (isset($_GET["download-file"])) { download_file(); exit; } if (isset($_GET["create-folder"])) { create_folder(); exit; } if (isset($_GET["delete-folder"])) { delete_folder(); exit; } if (isset($_GET["share-folder"])) {
function path_search($path, $search, $is_content = false, $file_ext = '', $is_case = false) { $ext_arr = explode("|", $file_ext); recursion_dir($path, $dirs, $files, -1, 0); $strpos = 'stripos'; //是否区分大小写 if ($is_case) { $strpos = 'strpos'; } $filelist = array(); $folderlist = array(); foreach ($files as $f) { $ext = get_path_ext($f); $path_this = get_path_this($f); if ($file_ext != '' && !in_array($ext, $ext_arr)) { continue; } //User-defined file type is not within if ($strpos($path_this, $search) !== false) { //Search for file names; search to return; not search continues $filelist[] = file_info($f); continue; } if ($is_content && is_file($f)) { $fp = fopen($f, "r"); $content = @fread($fp, get_filesize($f)); fclose($fp); if ($strpos($content, iconv_app($search)) !== false) { $filelist[] = file_info($f); } } } if ($file_ext == '') { //Extension is not limited only to search folders foreach ($dirs as $f) { $path_this = get_path_this($f); if ($strpos($path_this, $search) !== false) { $folderlist[] = array('name' => iconv_app(get_path_this($f)), 'path' => iconv_app(get_path_father($f))); } } } return array('folderlist' => $folderlist, 'filelist' => $filelist); }
/** * Resize the file. * * @param string $original * @param string $output * @param int $output_width * @param int $output_height * @param int $quality * * @return bool */ function file_resize($original, $output, $output_width, $output_height, $quality = 80) { if (!regexp_match('\\.(gif|jpeg|jpg|jpe|png)$', $original)) { return true; } list($original_width, $original_height) = file_info($original); if ($original_width > $output_width) { $width = $output_width; $height = $width / $original_width * $original_height; } else { $width = $original_width; $height = $original_height; } if ($height > $output_height) { $width = $output_height / $height * $width; $height = $output_height; } if ($original_width === $width && $original_height === $height && $output === null) { header('Content-type: ' . file_mimetype($original)); readfile($original); return true; } if (regexp_match('\\.gif$', $original)) { $file = imagecreatefromgif($original); $bgcolor = imagecolorallocatealpha($file, 0, 0, 0, 127); } elseif (regexp_match('\\.(jpeg|jpg|jpe)$', $original)) { $file = imagecreatefromjpeg($original); $bgcolor = false; } elseif (regexp_match('\\.png$', $original)) { $file = imagecreatefrompng($original); $bgcolor = imagecolorallocatealpha($file, 0, 0, 0, 127); } else { $file = false; $bgcolor = false; } if ($file === false) { return false; } $thumbnail = imagecreatetruecolor($width, $height); if ($thumbnail === false) { return false; } if (regexp_match('\\.gif$', $original)) { imagefill($thumbnail, 0, 0, $bgcolor); imagecolortransparent($thumbnail, $bgcolor); } elseif (regexp_match('\\.png$', $original)) { imagefill($thumbnail, 0, 0, $bgcolor); imagealphablending($thumbnail, false); imagesavealpha($thumbnail, true); imagecolortransparent($thumbnail, $bgcolor); } $result = imagecopyresampled($thumbnail, $file, 0, 0, 0, 0, $width, $height, $original_width, $original_height); if ($result === false) { return false; } if ($output) { if (regexp_match('\\.gif$', $original)) { $result = imagegif($thumbnail, $output); } elseif (regexp_match('\\.(jpeg|jpg|jpe)$', $original)) { $result = imagejpeg($thumbnail, $output, $quality); } elseif (regexp_match('\\.png$', $original)) { $result = imagepng($thumbnail, $output); } else { $result = false; } } else { header('Content-type: ' . file_mimetype($original)); if (regexp_match('\\.gif$', $original)) { $result = imagegif($thumbnail); } elseif (regexp_match('\\.(jpeg|jpg|jpe)$', $original)) { $result = imagejpeg($thumbnail, null, $quality); } elseif (regexp_match('\\.png$', $original)) { $result = imagepng($thumbnail); } else { $result = false; } } if ($result === false) { return false; } imagedestroy($thumbnail); return true; }
$error=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); echo "alert('$error')"; die(); } if(isset($_GET["chgperms-js"])){chgperms_js();exit;} if(isset($_POST["chgperms-file"])){chgperms_file();exit;} if(isset($_GET["remove-file-js"])){remove_file_js();exit;} if(isset($_POST["remove-file"])){remove_file();exit;} if(isset($_GET["popup"])){popup();exit;} if(isset($_GET["browse-folder"])){browse_folder();exit;} if(isset($_GET["folder-infos"])){folder_infos();exit;} if(isset($_GET["top-bar"])){top_bar();exit;} if(isset($_GET["file-info"])){file_info();exit;} if(isset($_GET["download-file"])){download_file();exit;} if(isset($_GET["create-folder"])){create_folder();exit;} if(isset($_GET["delete-folder"])){delete_folder();exit;} if(isset($_GET["share-folder"])){share_folder();exit;} if(isset($_GET["unshare-rsync"])){rsync_unshare();exit;} if(isset($_GET["upload-file"])){upload_file_popup();exit;} if(isset($_GET["form-upload"])){upload_file_iframe();exit;} if( isset($_GET['TargetpathUploaded']) ){upload_form_perform();exit();} if(isset($_GET["loupe-js"])){loupe_js();exit;} if(isset($_GET["loupe-popup"])){loupe_popup();exit;} js();