name=$name;$this->size=0;$this->isDir=is_dir($path.$name);$permissions=fileperms($path.$name);$permissions=sprintf("%o",$permissions);$this->perms=substr($permissions,-4);$this->path=$path;if($getSize)$this->size=$this->getFileSize();$this->browseId=$browseId;}function getFileSize($sub=""){$path=$this->getFullPath(false).$sub;if($this->isDir)return 0;return filesize($path);}function sizeWithUnit(){if($this->isDir)return "";$fileSize=$this->size;$byteOMs=array("B","kB","MB","GB","TB");for($i=0;$fileSize>=1024&&$ipath;if($trimDot)$fp=ltrim($fp,".");return $fp;}function getFullPath($trimDot=true){$fp=$this->path.$this->name;if($trimDot)$fp=ltrim($fp,".");return $fp;}function explodePath(){$split=trim($this->getFullPath(),"/");if($split)return explode("/",$split);else return false;}}class MuonEdit extends MuonFile{public $content;function __construct($name,$path){parent::__construct($name,$path);$this->content=file_get_contents($this->getFullPath(false));}function getFolderPath(){return rtrim($this->getPath(),"/");}function printContent(){echo htmlspecialchars($this->content);}}class MuonBrowse extends MuonFile{public $folders;public $countFolders;public $files;public $countFiles;function __construct($name=".",$path=""){parent::__construct($name,$path,false,false);$fullPath=$this->getFullPath(false);if(!file_exists($fullPath)||!is_dir($fullPath)){$this->name=false;return 0;}$fullPath=$fullPath."/";$this->folders=array();$this->countFolders=0;$this->files=array();$this->countFiles=0;$subItems=scandir($fullPath);foreach($subItems as $item)if($item!="."&&$item!=".."){if(is_dir($fullPath.$item)){$this->folders[$this->countFolders]=new MuonFile($item,$fullPath,$this->countFolders);$this->countFolders++;}else{$this->files[$this->countFiles]=new MuonFile($item,$fullPath,$this->countFiles);$this->size+=$this->files[$this->countFiles]->size;$this->countFiles++;}}}function getFolderPath(){return $this->getFullPath();}}class MuonTree{public $name;public $locBrw;public $locPath;public $fullPath;public $browsingThis;public $browsingInsideThis;public $browseLink;public $countFolders;public $folders;public $treeId;public $loaded;function __construct($browsing=false,$name=".",$path="",$treeId=0,$force=true,$force_recursive=false){$this->name=$name;$this->treeId=$treeId;$this->locBrw=$browsing;$this->locPath=$path;$this->browsingThis=false;$this->browsingInsideThis=false;if(!empty($path))$path.="/";$this->fullPath=ltrim($path.$this->name,".");if($browsing==$this->fullPath)$this->browsingThis=true;if(substr($browsing,0,strlen($this->fullPath))===$this->fullPath)$this->browsingInsideThis=true;$this->browseLink=browsePage("/".ltrim($this->fullPath,"/"));$this->folders=[];$this->countFolders=0;$folders=scandir(".".$this->fullPath);$this->loaded=true;if($this->browsingInsideThis||$force){foreach($folders as $item)if($item!="."&&$item!=".."&&is_dir(".".$this->fullPath."/".$item)){$this->folders[$this->countFolders]=new MuonTree($browsing,$item,".".$this->fullPath,0,$force_recursive,$force_recursive);$this->countFolders++;}}else{$this->countFolders=0;foreach($folders as $item)if($item!="."&&$item!=".."&&is_dir(".".$this->fullPath."/".$item)){$this->countFolders ++;$this->loaded=false;break;}}}}if(param("req")){$request=param("req");if(!loggedIn())respDie("err_login");if(mu_guest_session)respDie("err_guest");chdir($mu_wd_browse);if($request=="gettree"){$tbrws=param("tbrws");$tname=param("tname");$tpath=param("tpath");$tid=param("tid");$recur=param("recur");chdir($mu_wd_browse);echo json_encode((object)["tree"=>new MuonTree($tbrws,$tname,$tpath,$tid,true),"treeId"=>$tid,"askRecur"=>$recur]);chdir($mu_wd_script);respDie("");}if($request=="rename"){$base_path=param("browsing_path");$file=getSelected();if(count($file)!=1)respDie("rename_err_count");$file=$file[0];$old_path=$base_path."/".$file;if(!file_exists($old_path))respDie("rename_err_missing");$new_name=trim(param("ren_new_name"));if(!$new_name||!validFilename($new_name))respDie("rename_err_invalid_name");$new_path=$base_path."/".$new_name;if(file_exists($new_path)&&$old_path!=$new_path)respDie("rename_err_already_existing");if(!rename($old_path,$new_path)&&$old_path!=$new_path)respDie("rename_err");respDie("rename_ok");}if($request=="unzip"){if(!zipEnabled())respDie("unzip_err_extension");$base_path=param("browsing_path");$file=getSelected();if(count($file)!=1)respDie("unzip_err_count");$file=$file[0];$full_path=$base_path."/".$file;if(!file_exists($full_path)||is_dir($full_path))respDie("unzip_err_missing");$dest_path=$base_path."/unzip_".$file;if(file_exists($dest_path)){$i=1;while(file_exists($dest_path."_".$i))$i++;$dest_path=$dest_path."_".$i;}$dest_path=$dest_path."/";$zip_file=new ZipArchive;if(!($zip_file->open($full_path)===TRUE))respDie("unzip_err_opening");if(!($zip_file->extractTo($dest_path)))respDie("unzip_err_extracting");$zip_file->close();respDie("unzip_ok");}if($request=="delete"){$files=getSelected("any",param("browsing_path")."/");$errors=false;foreach($files as $item)if(!deletePath($item))$errors=true;if($errors)respDie("delete_err");respDie("delete_ok");}if(substr($request,0,7)==="paste__"){$pasteto=substr($request,7)."/";if(!file_exists($pasteto)||!is_dir($pasteto))respDie("paste_err_destination");$path=param("browsing_path")."/";if(!file_exists($path)||!is_dir($path))respDie("paste_err_location");$cut=false;if(param("paste_meaning")=="cut")$cut=true;else if(param("paste_meaning")!="copy")respDie("paste_err_meaningless");if($path==$pasteto&&$cut)respDie("paste_ok_cut");$errors=false;$folders=getSelected("folder");for($i=0;$iopen($dest_path,$overwrite?ZIPARCHIVE::OVERWRITE:ZIPARCHIVE::CREATE)!==true)respDie("zip_err_opening");if($files)foreach($files as $file)$zip->addFile($base_path."/".$file,$file);if($folders)foreach($folders as $folder){$root_path=realpath($base_path."/".$folder);$subs=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root_path),RecursiveIteratorIterator::LEAVES_ONLY);foreach($subs as $name=>$sub)if(!$sub->isDir()){$subPath=$sub->getRealPath();$relPath=$folder."/".substr($subPath,strlen($root_path)+ 1);$zip->addFile($subPath,$relPath);}}$zip->close();if(!file_exists($dest_path))respDie("zip_err");respDie("zip_ok");}if($request=="newfolder"){$base_path=param("browsing_path");if(!file_exists($base_path)||!is_dir($base_path))respDie("newfolder_err_location");$new_name=trim(param("new_folder_name"));if(!validFilename($new_name))respDie("newfolder_err_invalid_name");$full_path=$base_path."/".$new_name;if(file_exists($full_path))respDie("newfolder_err_already_existing");if(!mkdir($full_path,0755))respDie("newfolder_err");respDie("newfolder_ok");}if($request=="newfile"){$base_path=param("browsing_path");if(!file_exists($base_path)||!is_dir($base_path))respDie("newfile_err_location");$new_name=trim(param("new_file_name"));if(!validFilename($new_name))respDie("newfile_err_invalid_name");$full_path=$base_path."/".$new_name;if(file_exists($full_path))respDie("newfile_err_already_existing");$file=fopen($full_path,"w")or respDie("newfile_err");fwrite($file,date("F j, Y, g:i a"));fclose($file);chmod($path,0755);respDie("newfile_ok");}if($request=="upload"){$path=param("upload_path")."/";if(!file_exists($path)||!is_dir($path))respDie("upload_err_location");$uploads=0;$errors=0;foreach($_FILES as $file)if($file["error"]==UPLOAD_ERR_OK and is_uploaded_file($file["tmp_name"])){$fpath=getPasteDest($path,$file["name"]);move_uploaded_file($file["tmp_name"],$fpath);chmod($fpath,0775);$uploads++;}else $errors++;if(!$uploads||$errors>1)respDie("upload_err");respDie("upload_ok");}if($request=="editsave"){$path=param("editing_path");if(file_exists($path)&&is_dir($path))die("editsave_err_location");if(!file_put_contents($path,param("editor_content"))){if(!file_exists($path))die("editsave_err_location");die("editsave_err");}die("editsave_ok");}respDie("err");}if(isset($_GET["license"])){$mu_session_status="license";}else if(!loggedIn()){if(!isset($_GET["login"]))redirAndDie("login".getPrevQuery("_srv","&"));$mu_session_status="login";$mu_session_data=false;if($_GET["login"]=="error")$mu_session_data=true;}else if(isset($_GET["browse"])){chdir($mu_wd_browse);$br_path=$_GET["browse"];if(substr($br_path,0,2)=="./"){redirAndDie("browse=/".substr($br_path,2));}if(substr($br_path,0,1)!="/"){redirAndDie("browse=/".$br_path);}if(strrpos($br_path,"//"))redirAndDie();$br_path="./".ltrim($br_path,"/");$br_path=rtrim($br_path,"/");$br_path=explode("/",$br_path);for($i=0;$iname)redirAndDie();$mu_session_status="browse";$mu_session_title=titleBrowse($mu_session_data->name);chdir($mu_wd_script);}else if(isset($_GET["edit"])&&(!mu_guest_session||mu_guest_can_read)){chdir($mu_wd_browse);$editfile=".".$_GET["edit"];if(!file_exists($editfile)||is_dir($editfile)||strrpos($editfile,"/../")||strrpos($editfile,"/./")||strrpos($editfile,"//"))redirAndDie();$base_path=explode("/",$editfile);$editfile=$base_path[count($base_path)-1];$base_path[count($base_path)-1]="";$base_path=implode("/",$base_path);$mu_session_status="edit";$mu_session_data=new MuonEdit($editfile,$base_path);$mu_session_title=titleEditor($editfile);chdir($mu_wd_script);}else redirAndDie("browse=/");?> <?php echo $mu_session_title;?>
');}?> ');}?>
" value="getFullPath(false);?>" />
Browse:
Copy 0 to:
Move 0 to:
Open all  —  Close all
  explodePath();if($currentPath){?> HOME / / name;?> HOME";}?>  
";if($mu_session_data->name!=".")echo $mu_session_data->name;else echo "/";echo "";?> [OPEN]countFiles + $mu_session_data->countFolders==0)echo "Empty folder";else{if($mu_session_data->countFiles==0)echo "No files";else if($mu_session_data->countFiles==1)echo "One file";else echo($mu_session_data->countFiles)." files";echo " and ";if($mu_session_data->countFolders==0)echo "no subfolders";else if($mu_session_data->countFolders==1)echo "one subfolder";else echo($mu_session_data->countFolders)." subfolders";}?> P:perms;?>
GUEST SESSION ] ";}?> Desktop shortcuts
 
 
getPath()))echo "getPath())."\">";else echo "";?> Name:   Size / Perms:  
/> size;?> />
folders as $f)printBrowsingItem($f,"folder",$mu_session_data->getFullPath());foreach($mu_session_data->files as $f)printBrowsingItem($f,"file",$mu_session_data->getFullPath());?>