Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php class explorer extends Controller{public $path;public $user;public function __constr..
Decoded Output download
<?php class explorer extends Controller{public $path;public $user;public function __construct(){parent::__construct();$this->tpl=TEMPLATE.'explorer/';;$this->user=$_SESSION['kod_user'];;if(isset($this->in['path'])){$this->path=_DIR($this->in['path']);$this->check_system_path();}}public function index(){$='';if(isset($this->in['path'])&& $this->in['path']!=''){$=_DIR_CLEAR($_GET['path']);$=rtrim($,'/').'/';}$this->assign('dir',$);if($this->config['forceWap']){$this->display('index_wap.php');}else{$this->display('index.php');}}private function check_system_path(){if(!in_array(ACT,array('mkfile','mkdir','search','pathCuteDrag','pathCopyDrag','pathPast','fileDownload'))){return;}if(in_array($GLOBALS['path_type'],array(KOD_USER_SHARE,KOD_USER_FAV,KOD_GROUP_ROOT_ALL,KOD_GROUP_ROOT_SELF))){show_json($this->L['error'],!1);}}public function pathInfo(){$=json_decode($this->in['list'],!0);;if(!$){show_json($this->L['error'],!1);}foreach($ as &$){$['path']=_DIR($['path']);}$=path_info_muti($,$this->L['time_type_info']);if(!$){show_json($this->L['not_exists'],!1);}if(count($)==0x001&& $[0]['type']!='folder'){if($GLOBALS['is_root']|| $GLOBALS['auth']['explorer:fileDownload']==0x001){$['download_path']=_make_file_proxy($[0]['path']);}$=$[0]['path'];$['file_md5']=@md5_file($);;$=get_path_ext($);;if(in_array($,array('jpg','gif','png','jpeg','bmp'))){load_class('imageThumb');$=imageThumb::imageSize($);if($){$['image_size']=$;}}}$['path']=_DIR_OUT($['path']);;show_json($);}public function pathChmod(){$=json_decode($this->in['list'],!0);if(!$){show_json($this->L['error'],!1);}$=octdec('0'.$this->in['mod']);$=0;;$=0;foreach($ as $){$=_DIR($['path']);if(chmod_path($,$)){$++;}else{$++;}}$=$==0?!0:!1;;$=$.' success,'.$.' error';;if(count($)==0x001&& $==0){$=$this->L['success'];}show_json($,$);}public function mkfile(){$=BASIC_PATH.'static/others/newfile-tpl/';;space_size_use_check();$=rtrim($this->path,'/');;$=get_filename_auto($,'','folder_rename');;if(@touch($)){chmod_path($,0777);if(isset($this->in['content'])){file_put_contents($,$this->in['content']);}else{$=get_path_ext($);$=$.'newfile.'.$;if(file_exists($)){$=file_get_contents($);file_put_contents($,$);}}space_size_use_change($);show_json($this->L['create_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['create_error'],!1);}}public function mkdir(){space_size_use_check();$=rtrim($this->path,'/');;$=get_filename_auto($,'','folder_rename');if(@mkdir($,0777)){chmod_path($,0777);show_json($this->L['create_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['create_error'],!1);}}public function pathRname(){$=_DIR($this->in['rname_to']);;if(file_exist_case($)){show_json($this->L['name_isexists'],!1);}if(@rename($this->path,$)){show_json($this->L['rname_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['no_permission_write_all'],!1);}}public function search(){if(!isset($this->in['search']))show_json($this->L['please_inpute_search_words'],!1);$=intval($this->in['is_content']);$=intval($this->in['is_case']);;$=trim($this->in['ext']);if($GLOBALS['path_type']==KOD_USER_SHARE&& strstr($this->path,KOD_USER_SHARE)){show_json($this->L['path_cannot_search'],!1);}$=path_search($this->path,iconv_system(rawurldecode($this->in['search'])),$,$,$);show_json(_DIR_OUT($));;}public function pathList(){$=$this->in['path'];if($=="")$='/';$=$this->path($this->path);;if($this->path== MYHOME|| $this->path==HOME){$this->_self_root_load($['folderlist']);}if($['info']['path_type']==KOD_GROUP_PATH&& !strstr(trim(_DIR_CLEAR($this->in['path']),'/'),'/')){$this->_self_group_load($['folderlist']);}$['user_space']=$this->user['config'];show_json($);;}public function treeList(){$=$this->in['app'];;if(isset($this->in['type'])&& $this->in['type']=='init'){$this->_tree_init($);}switch(trim(rawurldecode($this->in['path']))){case KOD_USER_FAV:show_json($this->_tree_fav(),!0);break;case KOD_GROUP_ROOT_SELF:show_json($this->_group_self(),!0);break;case KOD_GROUP_ROOT_ALL:show_json($this->_group_tree('1'),!0);break;default:break;}if((isset($this->in['tree_icon'])&& $this->in['tree_icon']!='groupPublic')&& !strstr(trim(rawurldecode($this->in['path']),'/'),'/')&&($GLOBALS['path_type']==KOD_GROUP_PATH|| $GLOBALS['path_type']==KOD_GROUP_SHARE)){$=$this->_group_tree($GLOBALS['path_id']);show_json($,!0);return;}$=_DIR($this->in['path']);if(!is_readable($))show_json($this->L['no_permission_read'],!1);$=($=='editor'?!0:!1);;$=$this->path($,$,!0);function sort_by_key($,$){if($['name']==$['name'])return 0;return($['name']>$['name'])?0x001:-0x001;}usort($['folderlist'],"sort_by_key");;usort($['filelist'],"sort_by_key");;if($==MYHOME|| $==HOME){}if($=='editor'){$=array_merge($['folderlist'],$['filelist']);show_json($,!0);}else{show_json($['folderlist'],!0);}}private function _self_group_load(&$){foreach($ as $=>$){if($['name']=='share'){$[$]=array('name' =>$this->L['group_share'],'menuType' =>"menufolder folderBox",'ext' =>"folder_share",'isParent' =>!0,'is_readable' =>!0,'is_writeable' =>!0,'path' =>KOD_GROUP_PATH.':'.$GLOBALS['path_id'].'/share/','type' =>'folder','open' =>!1,'isParent' =>!1);break;}}$=array_values($);;}private function _self_root_load(&$){foreach($ as $=>$){if($['name']=='share'){$[$]=array('name' =>$this->L['my_share'],'menuType' =>"menuTreeUser",'ext' =>"folder_share",'isParent' =>!0,'is_readable' =>!0,'is_writeable' =>!0,'path' =>KOD_USER_SHARE.':'.$this->user["user_id"].'/','type' =>'folder','open' =>!1,'isParent' =>!1);break;}}$=array_values($);;if($this->config['user']['recycle_open']=="1"){}}private function _tree_fav(){$=($this->in['app']=='editor'?!0:!1);$=new fileCache(USER.'data/fav.php');$=$->get();$=array();;$GLOBALS['path_from_auth_check']=!0;;foreach($ as $=>$){$=path_haschildren(_DIR($['path']),$);if(!isset($['type'])){$['type']='folder';}if(in_array($['type'],array('group'))){$=!0;}$=array('name' =>$['name'],'ext' =>$['ext'],'menuType' =>"menuTreeFav",'path' =>$['path'],'type' =>$['type'],'open' =>!1,'isParent' =>$);if(isset($['type'])&& $['type']!='folder'){$['ext']=$['type'];}$[]=$;}$GLOBALS['path_from_auth_check']=!1;return $;}private function _tree_init($){if($=='editor' && isset($this->in['project'])){$=$this->path(_DIR($this->in['project']),!0,!0);$=array_merge($['folderlist'],$['filelist']);$=array(array('name'=> get_path_this($this->in['project']),'children' =>$,'menuType' =>"menuTreeRoot",'ext' =>"folder",'path' =>$this->in['project'],'type' =>'folder','open' =>!0,'isParent' =>count($)>0?!0:!1));show_json($);return;}$=($=='editor'?!0:!1);$=$this->_tree_fav($);$=KOD_GROUP_PATH.':1/';;if(system_member::user_auth_group(0x001)==!1){$=KOD_GROUP_SHARE.':1/';}$=$this->path(_DIR($),$,!0);$=$this->path(_DIR(MYHOME),$,!0);;if($){$=array_merge($['folderlist'],$['filelist']);$=array_merge($['folderlist'],$['filelist']);}else{$=$['folderlist'];$=$['folderlist'];}$=count($)>0?!0:!1;$=count($)>0?!0:!1;$=array('webroot'=>array(),'fav'=>array('name' =>$this->L['fav'],'ext' =>"treeFav",'menuType' =>"menuTreeFavRoot",'children' =>$,'path' =>KOD_USER_FAV,'type' =>'folder','open' =>!0,'isParent' =>count($)>0?!0:!1),'my_home'=>array('name' =>$this->L['root_path'],'menuType' =>"menuTreeRoot",'ext' =>"treeSelf",'children' =>$,'path' =>MYHOME,'type' =>'folder','open' =>!0,'isParent' =>$),'public'=>array('name' =>$this->L['public_path'],'menuType' =>"menuTreeGroupRoot",'ext' =>"groupPublic",'children' =>$,'path' =>$,'type' =>'folder','open' =>!0,'isParent' =>$),'my_group'=>array('name' =>$this->L['my_kod_group'],'menuType' =>"menuTreeGroupRoot",'ext' =>"groupSelfRoot",'children' =>$this->_group_self(),'path' =>KOD_GROUP_ROOT_SELF,'type' =>'folder','open' =>!0,'isParent' =>!0),'group'=>array('name' =>$this->L['kod_group'],'menuType' =>"menuTreeGroupRoot",'ext' =>"groupRoot",'children' =>$this->_group_tree('1'),'path' =>KOD_GROUP_ROOT_ALL,'type' =>'folder','open' =>!0,'isParent' =>!0),);;if($=='editor'){unset($['my_group']);unset($['group']);unset($['public']);if($GLOBALS['is_root']==0x001){$=$this->path(_DIR(WEB_ROOT),$,!0);$=array_merge($['folderlist'],$['filelist']);$['webroot']=array('name' =>"webroot",'menuType' =>"menuTreeRoot",'ext' =>"folder",'children' =>$,'path' =>WEB_ROOT,'type' =>'folder','open' =>!0,'isParent' =>!0);}}else{unset($['webroot']);;}$=array();;foreach($ as $=>$){if(count($['children'])<0x001&& in_array($,array('my_group','group'))){continue;}$[]=$;}show_json($);}private function _group_tree($){$=system_group::load_data();$=$->get(array('parent_id',$));$=$this->_make_node_list($);;$=array();if($!='1'){$=system_member::get_user_at_group($);foreach($ as $=>$){$='user';if($['user_id']==$this->user['user_id']){$='userSelf';}$[]=array('name' =>$['name'],'menuType' =>"menuTreeUser",'ext' =>$,'path' =>KOD_USER_SHARE.':'.$['user_id'].'/','type' =>'folder','open' =>!1,'isParent' =>!1);}}$=array_merge($,$);return $;;}private function _group_self(){$=array();foreach($this->user['group_info'] as $=>$){if($=='1')continue;$=system_group::get_info($);;if($){$[]=$;}}return $this->_make_node_list($);;}private function _make_node_list($){$=array();if(!is_array($)){return $;}foreach($ as $=>$){$=KOD_GROUP_PATH;$=system_member::user_auth_group($['group_id']);if($==!1){$=KOD_GROUP_SHARE;$='groupGuest';}else if($=='read'){$='groupSelf';}else{$='groupSelfOwner';}$=!0;$=system_member::get_user_at_group($['group_id']);if(count($)==0&& $['children']==''){$=!1;}$[]=array('name' =>$['name'],'type' =>'folder','path' =>$.':'.$['group_id'].'/','ext' =>$,'tree_icon' =>$,'menuType' =>"menuTreeGroup",'isParent' =>$);}return $;;}public function pathDelete(){$=json_decode($this->in['list'],!0);;if(!is_dir(USER_RECYCLE)){mk_dir(USER_RECYCLE);}$=$this->config['user']['recycle_open'];if(!path_writeable(USER_RECYCLE)){$='0';}$=0;$=0;foreach($ as $){$=_DIR($['path']);if($!="1" || $GLOBALS['path_type']==KOD_GROUP_SHARE|| $GLOBALS['path_type']==KOD_GROUP_PATH|| $GLOBALS['path_type']==KOD_USER_RECYCLE){if($['type']=='folder'){if(del_dir($))$++;else $++;;}else{if(del_file($))$++;else $++;;}space_size_use_reset();}else{$=USER_RECYCLE.get_path_this($);$=get_filename_auto($,date('-h:i:s'),'folder_rename');;if(@rename($,$)){$++;}else{$++;}}}$=$==0?!0:!1;$=$.' success,'.$.' error';if($==0){$=$this->L['remove_success'];}show_json($,$);}private function clearTemp(){$=USER_TEMP;;$=@filemtime($);if(time()-$>0x0258){del_dir($);mk_dir($);}}public function pathDeleteRecycle(){if(!isset($this->in['list'])){if(!del_dir(USER_RECYCLE)){show_json($this->L['remove_fali'],!1);}else{mkdir(USER_RECYCLE);$this->clearTemp();space_size_use_reset();show_json($this->L['recycle_clear_success'],!0);}}$=json_decode($this->in['list'],!0);$=0;$=0;foreach($ as $){$=_DIR($['path']);;if($['type']=='folder'){if(del_dir($))$++;else $++;;}else{if(del_file($))$++;else $++;;}}space_size_use_reset();if(count($)==0x001){if($)show_json($this->L['remove_success']);else show_json($this->L['remove_fali'],!1);;}else{$=$==0?!0:!1;;show_json($this->L['remove_success'].$.'success,'.$.'error',$);}}public function pathCopy(){session_start();;$=json_decode($this->in['list'],!0);;$_SESSION['path_copy']=json_encode($);;$_SESSION['path_copy_type']='copy';;show_json($this->L['copy_success'],ture,$_SESSION);;}public function pathCute(){session_start();$=json_decode($this->in['list'],!0);;foreach($ as $=>&$){$['path']=rawurldecode($['path']);_DIR($['path']);}$_SESSION['path_copy']=json_encode($);;$_SESSION['path_copy_type']='cute';show_json($this->L['cute_success']);;}public function pathCuteDrag(){$=json_decode($this->in['list'],!0);;$=$this->path;;$=$GLOBALS['path_type'];;$=$GLOBALS['path_id'];;if(!path_writeable($this->path))show_json($this->L['no_permission_write'],!1);$=0;;$=0;$=array();;foreach($ as $){$=_DIR($['path']);;$=get_path_this($);;$=get_filename_auto($.$,'',$this->config['user']['file_repeat']);if($!=$GLOBALS['path_id']){space_size_use_check();}if(move_path($,$,'',$this->config['user']['file_repeat'])){$++;if($!=$GLOBALS['path_id']){space_size_use_change($);space_size_use_change($,!1,$,$);}$[]=_DIR_OUT(iconv_app($));}else{$++;;}}$=$==0?!0:!1;$=$.' success,'.$.' error';;if($==0){$=$this->L['success'];}show_json($,$,$);}public function pathCopyDrag(){$=json_decode($this->in['list'],!0);;$=$this->path;$=$GLOBALS['path_type'];$=$GLOBALS['path_id'];;space_size_use_check();;if(!path_writeable($this->path))show_json($this->L['no_permission_write'],!1);$=0;$=0;;$=array();foreach($ as $){$=_DIR($['path']);$=get_path_this($);;$=get_filename_auto($.$,'',$this->config['user']['file_repeat']);;if($this->in['filename_auto']==0x001&& trim($,'/')==trim($,'/')){$=get_filename_auto($.$,'','folder_rename');}if(copy_dir($,$)){$++;space_size_use_change($);$[]=_DIR_OUT(iconv_app($));}else{$++;}}$=$==0?!0:!1;;$=$.' success,'.$.' error';;if($==0){$=$this->L['success'];}show_json($,$,$);}public function clipboard(){$=json_decode($_SESSION['path_copy'],!0);if(!$){$=array();}show_json($,!0,$_SESSION['path_copy_type']);}public function pathPast(){if(!isset($_SESSION['path_copy'])){show_json($this->L['clipboard_null'],!1,array());}$=$this->path;session_start();;$='';$=array();$=json_decode($_SESSION['path_copy'],!0);$=$_SESSION['path_copy_type'];$=$GLOBALS['path_type'];;$=$GLOBALS['path_id'];if(!path_writeable($))show_json($this->L['no_permission_write'],!1,$);$GLOBALS['path_from_auth_check']=!0;;$=count($);if($==0){show_json($this->L['clipboard_null'],!1,$);}for($=0;$<$;$++){$=_DIR($[$]['path']);_DIR($this->in['path']);;$=get_path_this($);$=iconv_app($);if(!file_exists($)){$.= "<li>{$}".$this->L['copy_not_exists']."</li>";continue;}if($[$]['type']=='folder'){if($==substr($,0,strlen($))){$.="<em style='color:#fff;'>{$}".$this->L['current_has_parent']."</em>";continue;;}}$=get_filename_auto($.$,'',$this->config['user']['file_repeat']);$=get_path_this($);if($=='copy'){space_size_use_check();copy_dir($,$);space_size_use_change($);}else{if($!=$GLOBALS['path_id']){space_size_use_check();}move_path($,$,'',$this->config['user']['file_repeat']);if($!=$GLOBALS['path_id']){space_size_use_change($);space_size_use_change($,!1,$,$);}}$[]=_DIR_OUT(iconv_app($));;}if($=='copy'){$=$this->L['past_success'].$;}else{$_SESSION['path_copy']=json_encode(array());$_SESSION['path_copy_type']='';$=$this->L['cute_past_success'].$;}$=($==''?!0:!1);show_json($,$,$);}public function fileDownload(){file_put_out($this->path,!0);;}public function fileDownloadRemove(){$=rawurldecode(_DIR_CLEAR($this->in['path']));;$=USER_TEMP.iconv_system($);;space_size_use_change($,!1);;file_put_out($,!0);;del_file($);;}public function zipDownload(){if(!file_exists(USER_TEMP)){mkdir(USER_TEMP);}else{$=path_list(USER_TEMP,!0,!1);$=0x0e10*0x0000018;if($['filelist']>=0x001){for($=0;$<count($['filelist']);$++){$=$['filelist'][$]['mtime'];if(time()-$>$){del_file($['filelist'][$]['path'].$['filelist'][$]['name']);}}}}$=$this->zip(USER_TEMP);show_json($this->L['zip_success'],!0,get_path_this($));}public function zip($=''){load_class('pclzip');;ini_set('memory_limit','2028M');;$=json_decode($this->in['list'],!0);$=count($);for($=0;$<$;$++){$[$]['path']=rtrim(_DIR($[$]['path']),'/');}$=$;if($==''){$=get_path_father($[0]['path']);}if(!is_writeable($)){show_json($this->L['no_permission_write'],!1);}if($==0x001){$=get_path_this($[0]['path']);}else{$=get_path_this(get_path_father($[0]['path']));}$=$.$.'.zip';$=get_filename_auto($,'',$this->config['user']['file_repeat']);;space_size_use_check();;$=array();for($=0;$<$;$++){if(file_exists($[$]['path'])){$[]=$[$]['path'];}}if(count($)==0){show_json($this->L['not_exists'],!1);}$=new PclZip($);foreach($ as $=>$){$=_DIR_CLEAR(get_path_father($));if($==0){$=$->create($,PCLZIP_OPT_REMOVE_PATH,$,PCLZIP_CB_PRE_FILE_NAME,'zip_pre_name');continue;}$=$->add($,PCLZIP_OPT_REMOVE_PATH,$,PCLZIP_CB_PRE_FILE_NAME,'zip_pre_name');}space_size_use_change($);if($==0){show_json("Create error!",!1);}$=$this->L['zip_success'].$this->L['size'].":".size_format(filesize($));if($==''){show_json($,!0,_DIR_OUT(iconv_app($)));}else{return iconv_app($);}}public function unzip(){ini_set('memory_limit','2028M');;$=$this->path;;$=get_path_this($);;$=substr($,0,strrpos($,'.'));$=get_path_ext($);$=get_path_father($).$;;if(isset($this->in['to_this'])){$=get_path_father($);}if(isset($this->in['path_to'])){$=_DIR($this->in['path_to']);}if(!is_writeable(get_path_father($))){show_json($this->L['no_permission_write'],!1);}space_size_use_check();load_class('pclzip');$=new PclZip($);$=$->extract(PCLZIP_OPT_PATH,$,PCLZIP_OPT_SET_CHMOD,0777,PCLZIP_CB_PRE_FILE_NAME,'unzip_pre_name',PCLZIP_CB_PRE_EXTRACT,"check_ext_unzip",PCLZIP_OPT_REPLACE_NEWER);if($==0){show_json("Error : ".$->errorInfo(!0),fasle);}else{space_size_use_change($);show_json($this->L['unzip_success']);}}public function imageRotate(){load_class('imageThumb');;$=new imageThumb($this->path,'file');$=$->imgRotate($this->path,intval($this->in['rotate']));;if($){show_json($this->L['success']);}else{show_json($this->L['error'],!1);}}public function image(){if(filesize($this->path)<=0x00000400*0x014|| !function_exists('imagecolorallocate')){file_put_out($this->path);return;}if(!is_dir(DATA_THUMB)){mk_dir(DATA_THUMB);}load_class('imageThumb');$=$this->path;$=@md5_file($);if(strlen($)<0x05){$=md5($);}$=DATA_THUMB.$.'.png';if(!file_exists($)){if(get_path_father($)==DATA_THUMB){$=$this->path;}else{$=new imageThumb($,'file');$->prorate($,0x0fa,0x0fa);}}if(!file_exists($)|| filesize($)<0x064){$=$this->path;}file_put_out($);}public function serverDownload(){set_time_limit(0);;$='download_'.$this->in['uuid'];;if($this->in['type']=='percent'){if(isset($_SESSION[$])){$=$_SESSION[$];$=array('uuid' =>$this->in['uuid'],'length' =>(int)$['length'],'name' =>$['name'],'size' =>(int)@filesize(iconv_system($['path'])),'time' =>mtime());show_json($);}else{show_json('',!1);}}else if($this->in['type']=='remove'){del_file($_SESSION[$]['path']);unset($_SESSION[$]);show_json('',!1);}$=_DIR($this->in['save_path']);if(!is_writeable($)){show_json($this->L['no_permission_write'],!1);}$=rawurldecode($this->in['url']);$=url_header($);if(!$){show_json($this->L['download_error_exists'],!1);}$=$.$['name'];if(!checkExt($)){$=_DIR($this->in['save_path']).date('-h:i:s').'.txt';}space_size_use_check();$=get_filename_auto(iconv_system($),'',$this->config['user']['file_repeat']);;$=$.'.downloading';session_start();;$_SESSION[$]=array('length'=> $['length'],'path' =>$,'name' =>get_path_this($));;session_write_close();;if(file_download_this($,$,$['length'])){session_start();unset($_SESSION[$]);session_write_close();if(@rename($,$)){$=get_path_this(iconv_app($));space_size_use_change($);show_json($this->L['download_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['download_error_create'],!1);}}else{session_start();;unset($_SESSION[$]);;session_write_close();show_json($this->L['download_error_create'],!1);}}public function officeView(){if(!file_exists($this->path)){show_tips($this->L['not_exists']);}$=get_path_ext($this->path);$=_make_file_proxy($this->path);;if(defined("OFFICE_KOD_SERVER")){$=APPHOST.'index.php?explorer/fileProxy&path='.$this->in['path'];$=$_SESSION['kod_user'];$=rand_string(0x0a);$=OFFICE_KOD_SERVER.rawurlencode($).'&lang=cn&appType=desktp&appMode=edit' .'&file_time='.@filemtime($this->path).'&user_id='.$['user_id'].'&user_name='.$['name'].'&app_id='.OFFICE_KOD_APP_ID.'&app_s='.$.'&app_v='.md5($.OFFICE_KOD_APP_KEY).'&access_token='.session_id();header("location:".$);exit;}if(file_exists(PLUGIN_DIR.'officeView')){if(isset($_GET['is_edit'])|| !isset($this->config['settings']['office_server_doc2pdf'])){include(PLUGIN_DIR.'officeView/index.php');}else{include(PLUGIN_DIR.'officeView/flexpapper.php');}exit;}$=$_SERVER['HTTP_HOST'];;if(strpos(OFFICE_SERVER,'view.officeapps.live.com')===-0x001|| strstr($,'10.10.')|| strstr($,'192.168.')|| strstr($,'127.0.')|| !strstr($,'.')){$=$this->L['unknow_file_office'];show_tips($);}else{$=OFFICE_SERVER.rawurlencode($);header("location:".$);}}public function officeSave(){$=_DIR($this->in['path']);;if(isset($this->in['from_activex'])){if($_FILES["file"]["error"]>0){echo "Return Code: ".$_FILES["file"]["error"];}else{move_uploaded_file($_FILES["file"]["tmp_name"],$this->path);echo 'succeed';}exit;}if(!is_writeable($)){$this->json_putout(array('error'=>'no_permission_write'));}if(($=file_get_contents('php://input'))===!1){$this->json_putout(array('error'=>'Bad Request'));}$=json_decode($,!0);if($===NULL){$this->json_putout(array('error'=>'Bad Response'));}$=array(0=>'NotFound',0x001=>'Editing',0x0002=>'MustSave',0x00003=>'Corrupted',0x000004=>'Closed');$=array('error'=>0,'action'=>$[$["status"]]);;switch($[$["status"]]){case "MustSave":case "Corrupted":$["c"]="saved";;$['status']='0';;if(file_download_this($["url"],$)){$['status']='success';}break;default:break;;}$this->json_putout($);;}private function json_putout($){@header('Content-Type: application/json; charset==utf-8');@header('X-Robots-Tag: noindex');@header('X-Content-Type-Options: nosniff');;echo json_encode($);exit;;}public function fileProxy(){file_put_out($this->path);}public function fileUpload(){$=_DIR($this->in['upload_to']);if(!is_writeable($))show_json($this->in['upload_to'],!1);if($=='')show_json($this->L['upload_error_big'],!1);if(strlen($this->in['fullPath'])>0x001){$=_DIR_CLEAR(rawurldecode($this->in['fullPath']));$=get_path_father($);$=iconv_system($);if(mk_dir($.$)){$=$.$;}}$=$this->config['user']['file_repeat'];$=USER_TEMP;;mk_dir($);;if(!is_writeable($))show_json($this->L['no_permission_write'],!1);upload_chunk('file',$,$,$);;}private function path_share(&$){$=explode(',',$GLOBALS['path_id']);$=system_member::user_share_list($[0]);$=$GLOBALS['path_id_user_share'];foreach($ as $=>$){$=_DIR(KOD_USER_SHARE.':'.$[0].'/'.$['name']);;$['path']=get_path_this($);$['atime']='';;$['ctime']='';$['mode']='';;$['is_readable']=0x001;;$['is_writable']=0x001;;$['exists']=intval(file_exists($));$['meta_info']='path_self_share';$['menuType']="menuSharePath";if(get_path_ext($['name'])=='oexe'){$=json_decode(@file_get_contents($),!0);if(is_array($))$=array_merge($,$);}if($['type']=='folder'){$['ext']='folder';$['folderlist'][]=$;}else{$['filelist'][]=$;}}$['path_read_write']='readable';;$GLOBALS['path_id_user_share']=$;;if($[0]==$this->user['user_id']){$['share_list']=$;}return $;}private function path_fav(&$){$=new fileCache(USER.'data/fav.php');$=$->get();$GLOBALS['path_from_auth_check']=!0;;foreach($ as $=>$){$=_DIR($['path']);$=path_haschildren($,$);if(!isset($['type'])){$['type']='folder';}if($['type']=='folder' && $['ext']!='treeFav'){$=!0;}$=array('name' =>$['name'],'ext' =>$['ext'],'menuType' =>"menuFavPath",'atime' =>'','ctime' =>'','mode' =>'','is_readable' =>0x001,'is_writeable' =>0x001,'exists' =>intval(file_exists($)),'meta_info' =>'treeFav','path' =>$['path'],'type' =>$['type'],'open' =>!1,'isParent' =>!1);if(strstr($['path'],KOD_USER_SHARE)|| strstr($['path'],KOD_USER_FAV)|| strstr($['path'],KOD_GROUP_ROOT_SELF)|| strstr($['path'],KOD_GROUP_ROOT_ALL)){$['exists']=0x001;}if(get_path_ext($['name'])=='oexe'){$=json_decode(@file_get_contents($),!0);if(is_array($))$=array_merge($,$);}if($['type']=='folder'){$['folderlist'][]=$;}else{$['filelist'][]=$;}}$GLOBALS['path_from_auth_check']=!1;$GLOBALS['path_type']=KOD_USER_FAV;$['path_read_write']='writeable';;return $;}private function path_group(&$,$){if($==KOD_GROUP_ROOT_SELF){$=$this->_group_self();}else{$=$this->_group_tree('1');}$GLOBALS['path_from_auth_check']=!0;foreach($ as $=>$){$=array('name' =>$['name'],'menuType' =>"menuGroupRoot",'atime' =>'','ctime' =>'','mode' =>'','is_readable' =>0x001,'is_writeable' =>0x001,'exists' =>0x001,'path' =>$['path'],'ext' =>$['ext'],'type' =>'folder','open' =>!1,'isParent' =>!1);;if($['type']=='folder'){$['folderlist'][]=$;}else{$['filelist'][]=$;}}$GLOBALS['path_from_auth_check']=!1;;$GLOBALS['path_type']=$;$['path_read_write']='writeable';return $;;}private function path($,$=true,$=false){$=explode(',',$this->config['setting_system']['path_hidden']);$=_DIR_OUT(iconv_app($));;if($GLOBALS['path_type']==KOD_USER_SHARE&& strpos(trim($,'/'),'/')===!1){$=$;}$=array('folderlist' =>array(),'filelist' =>array(),'info' =>array(),'path_read_write' =>'not_exists','this_path' =>$);if(!file_exists($)){$['path_read_write']="not_exists";}else if(path_writeable($)){$['path_read_write']='writeable';}else if(path_writeable($)){$['path_read_write']='readable';}else{$['path_read_write']='not_readable';}if($===!1){return $;}else if($GLOBALS['path_type']==KOD_USER_SHARE&& !strstr(trim($this->in['path'],'/'),'/')){$=$this->path_share($);}else if($GLOBALS['path_type']==KOD_USER_FAV){$=$this->path_fav($);}else if($GLOBALS['path_type']==KOD_GROUP_ROOT_SELF){$=$this->path_group($,$GLOBALS['path_type']);}else if($GLOBALS['path_type']==KOD_GROUP_ROOT_ALL){$=$this->path_group($,$GLOBALS['path_type']);}else{$=path_list($,$,!0);$['folderlist']=$['folderlist'];$['filelist']=$['filelist'];}$=array();$=array();foreach($['filelist'] as $=>$){if(in_array($['name'],$))continue;$['ext']=get_path_ext($['name']);if($['ext']=='oexe' && !isset($['content'])){$=iconv_system($['path']);$=json_decode(@file_get_contents($),!0);if(is_array($))$=array_merge($,$);}$[]=$;;}foreach($['folderlist'] as $=>$){if(in_array($['name'],$))continue;$[]=$;;}$['filelist']=$;$['folderlist']=$;;$=_DIR_OUT($);$this->_role_check_info($);return $;}private function _role_check_info(&$){if(!$GLOBALS['path_type']){$['info']=array("path_type"=>'',"role"=>'',"id"=>'','name'=>'');return;}$['info']=array("path_type" =>$GLOBALS['path_type'],"role" =>$GLOBALS['is_root']?'owner':'guest',"id" =>$GLOBALS['path_id'],'name' =>'',);if($GLOBALS['path_type']==KOD_USER_SHARE){$GLOBALS['path_id']=explode(':',$GLOBALS['path_id']);$GLOBALS['path_id']=$GLOBALS['path_id'][0];$['info']['id']=$GLOBALS['path_id'];$=system_member::get_info($GLOBALS['path_id']);$['info']['name']=$['name'];if($GLOBALS['is_root']){$['info']['admin_real_path']=USER_PATH.$['path'].'/home/';}}if($GLOBALS['path_type']==KOD_GROUP_PATH|| $GLOBALS['path_type']==KOD_GROUP_SHARE){$=system_group::get_info($GLOBALS['path_id']);$['info']['name']=$['name'];$=system_member::user_auth_group($GLOBALS['path_id']);if($=='write' || $GLOBALS['is_root']){$['info']['role']='owner';$['group_space_use']=$['config'];}if($GLOBALS['is_root']){$['info']['admin_real_path']=GROUP_PATH.$['path'].'/home/';}}}} ?>
Did this file decode correctly?
Original Code
<?php class explorer extends Controller{public $path;public $user;public function __construct(){parent::__construct();$this->tpl=TEMPLATE.'explorer/';;$this->user=$_SESSION['kod_user'];;if(isset($this->in['path'])){$this->path=_DIR($this->in['path']);$this->check_system_path();}}public function index(){$='';if(isset($this->in['path'])&& $this->in['path']!=''){$=_DIR_CLEAR($_GET['path']);$=rtrim($,'/').'/';}$this->assign('dir',$);if($this->config['forceWap']){$this->display('index_wap.php');}else{$this->display('index.php');}}private function check_system_path(){if(!in_array(ACT,array('mkfile','mkdir','search','pathCuteDrag','pathCopyDrag','pathPast','fileDownload'))){return;}if(in_array($GLOBALS['path_type'],array(KOD_USER_SHARE,KOD_USER_FAV,KOD_GROUP_ROOT_ALL,KOD_GROUP_ROOT_SELF))){show_json($this->L['error'],!1);}}public function pathInfo(){$=json_decode($this->in['list'],!0);;if(!$){show_json($this->L['error'],!1);}foreach($ as &$){$['path']=_DIR($['path']);}$=path_info_muti($,$this->L['time_type_info']);if(!$){show_json($this->L['not_exists'],!1);}if(count($)==0x001&& $[0]['type']!='folder'){if($GLOBALS['is_root']|| $GLOBALS['auth']['explorer:fileDownload']==0x001){$['download_path']=_make_file_proxy($[0]['path']);}$=$[0]['path'];$['file_md5']=@md5_file($);;$=get_path_ext($);;if(in_array($,array('jpg','gif','png','jpeg','bmp'))){load_class('imageThumb');$=imageThumb::imageSize($);if($){$['image_size']=$;}}}$['path']=_DIR_OUT($['path']);;show_json($);}public function pathChmod(){$=json_decode($this->in['list'],!0);if(!$){show_json($this->L['error'],!1);}$=octdec('0'.$this->in['mod']);$=0;;$=0;foreach($ as $){$=_DIR($['path']);if(chmod_path($,$)){$++;}else{$++;}}$=$==0?!0:!1;;$=$.' success,'.$.' error';;if(count($)==0x001&& $==0){$=$this->L['success'];}show_json($,$);}public function mkfile(){$=BASIC_PATH.'static/others/newfile-tpl/';;space_size_use_check();$=rtrim($this->path,'/');;$=get_filename_auto($,'','folder_rename');;if(@touch($)){chmod_path($,0777);if(isset($this->in['content'])){file_put_contents($,$this->in['content']);}else{$=get_path_ext($);$=$.'newfile.'.$;if(file_exists($)){$=file_get_contents($);file_put_contents($,$);}}space_size_use_change($);show_json($this->L['create_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['create_error'],!1);}}public function mkdir(){space_size_use_check();$=rtrim($this->path,'/');;$=get_filename_auto($,'','folder_rename');if(@mkdir($,0777)){chmod_path($,0777);show_json($this->L['create_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['create_error'],!1);}}public function pathRname(){$=_DIR($this->in['rname_to']);;if(file_exist_case($)){show_json($this->L['name_isexists'],!1);}if(@rename($this->path,$)){show_json($this->L['rname_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['no_permission_write_all'],!1);}}public function search(){if(!isset($this->in['search']))show_json($this->L['please_inpute_search_words'],!1);$=intval($this->in['is_content']);$=intval($this->in['is_case']);;$=trim($this->in['ext']);if($GLOBALS['path_type']==KOD_USER_SHARE&& strstr($this->path,KOD_USER_SHARE)){show_json($this->L['path_cannot_search'],!1);}$=path_search($this->path,iconv_system(rawurldecode($this->in['search'])),$,$,$);show_json(_DIR_OUT($));;}public function pathList(){$=$this->in['path'];if($=="")$='/';$=$this->path($this->path);;if($this->path== MYHOME|| $this->path==HOME){$this->_self_root_load($['folderlist']);}if($['info']['path_type']==KOD_GROUP_PATH&& !strstr(trim(_DIR_CLEAR($this->in['path']),'/'),'/')){$this->_self_group_load($['folderlist']);}$['user_space']=$this->user['config'];show_json($);;}public function treeList(){$=$this->in['app'];;if(isset($this->in['type'])&& $this->in['type']=='init'){$this->_tree_init($);}switch(trim(rawurldecode($this->in['path']))){case KOD_USER_FAV:show_json($this->_tree_fav(),!0);break;case KOD_GROUP_ROOT_SELF:show_json($this->_group_self(),!0);break;case KOD_GROUP_ROOT_ALL:show_json($this->_group_tree('1'),!0);break;default:break;}if((isset($this->in['tree_icon'])&& $this->in['tree_icon']!='groupPublic')&& !strstr(trim(rawurldecode($this->in['path']),'/'),'/')&&($GLOBALS['path_type']==KOD_GROUP_PATH|| $GLOBALS['path_type']==KOD_GROUP_SHARE)){$=$this->_group_tree($GLOBALS['path_id']);show_json($,!0);return;}$=_DIR($this->in['path']);if(!is_readable($))show_json($this->L['no_permission_read'],!1);$=($=='editor'?!0:!1);;$=$this->path($,$,!0);function sort_by_key($,$){if($['name']==$['name'])return 0;return($['name']>$['name'])?0x001:-0x001;}usort($['folderlist'],"sort_by_key");;usort($['filelist'],"sort_by_key");;if($==MYHOME|| $==HOME){}if($=='editor'){$=array_merge($['folderlist'],$['filelist']);show_json($,!0);}else{show_json($['folderlist'],!0);}}private function _self_group_load(&$){foreach($ as $=>$){if($['name']=='share'){$[$]=array('name' =>$this->L['group_share'],'menuType' =>"menufolder folderBox",'ext' =>"folder_share",'isParent' =>!0,'is_readable' =>!0,'is_writeable' =>!0,'path' =>KOD_GROUP_PATH.':'.$GLOBALS['path_id'].'/share/','type' =>'folder','open' =>!1,'isParent' =>!1);break;}}$=array_values($);;}private function _self_root_load(&$){foreach($ as $=>$){if($['name']=='share'){$[$]=array('name' =>$this->L['my_share'],'menuType' =>"menuTreeUser",'ext' =>"folder_share",'isParent' =>!0,'is_readable' =>!0,'is_writeable' =>!0,'path' =>KOD_USER_SHARE.':'.$this->user["user_id"].'/','type' =>'folder','open' =>!1,'isParent' =>!1);break;}}$=array_values($);;if($this->config['user']['recycle_open']=="1"){}}private function _tree_fav(){$=($this->in['app']=='editor'?!0:!1);$=new fileCache(USER.'data/fav.php');$=$->get();$=array();;$GLOBALS['path_from_auth_check']=!0;;foreach($ as $=>$){$=path_haschildren(_DIR($['path']),$);if(!isset($['type'])){$['type']='folder';}if(in_array($['type'],array('group'))){$=!0;}$=array('name' =>$['name'],'ext' =>$['ext'],'menuType' =>"menuTreeFav",'path' =>$['path'],'type' =>$['type'],'open' =>!1,'isParent' =>$);if(isset($['type'])&& $['type']!='folder'){$['ext']=$['type'];}$[]=$;}$GLOBALS['path_from_auth_check']=!1;return $;}private function _tree_init($){if($=='editor' && isset($this->in['project'])){$=$this->path(_DIR($this->in['project']),!0,!0);$=array_merge($['folderlist'],$['filelist']);$=array(array('name'=> get_path_this($this->in['project']),'children' =>$,'menuType' =>"menuTreeRoot",'ext' =>"folder",'path' =>$this->in['project'],'type' =>'folder','open' =>!0,'isParent' =>count($)>0?!0:!1));show_json($);return;}$=($=='editor'?!0:!1);$=$this->_tree_fav($);$=KOD_GROUP_PATH.':1/';;if(system_member::user_auth_group(0x001)==!1){$=KOD_GROUP_SHARE.':1/';}$=$this->path(_DIR($),$,!0);$=$this->path(_DIR(MYHOME),$,!0);;if($){$=array_merge($['folderlist'],$['filelist']);$=array_merge($['folderlist'],$['filelist']);}else{$=$['folderlist'];$=$['folderlist'];}$=count($)>0?!0:!1;$=count($)>0?!0:!1;$=array('webroot'=>array(),'fav'=>array('name' =>$this->L['fav'],'ext' =>"treeFav",'menuType' =>"menuTreeFavRoot",'children' =>$,'path' =>KOD_USER_FAV,'type' =>'folder','open' =>!0,'isParent' =>count($)>0?!0:!1),'my_home'=>array('name' =>$this->L['root_path'],'menuType' =>"menuTreeRoot",'ext' =>"treeSelf",'children' =>$,'path' =>MYHOME,'type' =>'folder','open' =>!0,'isParent' =>$),'public'=>array('name' =>$this->L['public_path'],'menuType' =>"menuTreeGroupRoot",'ext' =>"groupPublic",'children' =>$,'path' =>$,'type' =>'folder','open' =>!0,'isParent' =>$),'my_group'=>array('name' =>$this->L['my_kod_group'],'menuType' =>"menuTreeGroupRoot",'ext' =>"groupSelfRoot",'children' =>$this->_group_self(),'path' =>KOD_GROUP_ROOT_SELF,'type' =>'folder','open' =>!0,'isParent' =>!0),'group'=>array('name' =>$this->L['kod_group'],'menuType' =>"menuTreeGroupRoot",'ext' =>"groupRoot",'children' =>$this->_group_tree('1'),'path' =>KOD_GROUP_ROOT_ALL,'type' =>'folder','open' =>!0,'isParent' =>!0),);;if($=='editor'){unset($['my_group']);unset($['group']);unset($['public']);if($GLOBALS['is_root']==0x001){$=$this->path(_DIR(WEB_ROOT),$,!0);$=array_merge($['folderlist'],$['filelist']);$['webroot']=array('name' =>"webroot",'menuType' =>"menuTreeRoot",'ext' =>"folder",'children' =>$,'path' =>WEB_ROOT,'type' =>'folder','open' =>!0,'isParent' =>!0);}}else{unset($['webroot']);;}$=array();;foreach($ as $=>$){if(count($['children'])<0x001&& in_array($,array('my_group','group'))){continue;}$[]=$;}show_json($);}private function _group_tree($){$=system_group::load_data();$=$->get(array('parent_id',$));$=$this->_make_node_list($);;$=array();if($!='1'){$=system_member::get_user_at_group($);foreach($ as $=>$){$='user';if($['user_id']==$this->user['user_id']){$='userSelf';}$[]=array('name' =>$['name'],'menuType' =>"menuTreeUser",'ext' =>$,'path' =>KOD_USER_SHARE.':'.$['user_id'].'/','type' =>'folder','open' =>!1,'isParent' =>!1);}}$=array_merge($,$);return $;;}private function _group_self(){$=array();foreach($this->user['group_info'] as $=>$){if($=='1')continue;$=system_group::get_info($);;if($){$[]=$;}}return $this->_make_node_list($);;}private function _make_node_list($){$=array();if(!is_array($)){return $;}foreach($ as $=>$){$=KOD_GROUP_PATH;$=system_member::user_auth_group($['group_id']);if($==!1){$=KOD_GROUP_SHARE;$='groupGuest';}else if($=='read'){$='groupSelf';}else{$='groupSelfOwner';}$=!0;$=system_member::get_user_at_group($['group_id']);if(count($)==0&& $['children']==''){$=!1;}$[]=array('name' =>$['name'],'type' =>'folder','path' =>$.':'.$['group_id'].'/','ext' =>$,'tree_icon' =>$,'menuType' =>"menuTreeGroup",'isParent' =>$);}return $;;}public function pathDelete(){$=json_decode($this->in['list'],!0);;if(!is_dir(USER_RECYCLE)){mk_dir(USER_RECYCLE);}$=$this->config['user']['recycle_open'];if(!path_writeable(USER_RECYCLE)){$='0';}$=0;$=0;foreach($ as $){$=_DIR($['path']);if($!="1" || $GLOBALS['path_type']==KOD_GROUP_SHARE|| $GLOBALS['path_type']==KOD_GROUP_PATH|| $GLOBALS['path_type']==KOD_USER_RECYCLE){if($['type']=='folder'){if(del_dir($))$++;else $++;;}else{if(del_file($))$++;else $++;;}space_size_use_reset();}else{$=USER_RECYCLE.get_path_this($);$=get_filename_auto($,date('-h:i:s'),'folder_rename');;if(@rename($,$)){$++;}else{$++;}}}$=$==0?!0:!1;$=$.' success,'.$.' error';if($==0){$=$this->L['remove_success'];}show_json($,$);}private function clearTemp(){$=USER_TEMP;;$=@filemtime($);if(time()-$>0x0258){del_dir($);mk_dir($);}}public function pathDeleteRecycle(){if(!isset($this->in['list'])){if(!del_dir(USER_RECYCLE)){show_json($this->L['remove_fali'],!1);}else{mkdir(USER_RECYCLE);$this->clearTemp();space_size_use_reset();show_json($this->L['recycle_clear_success'],!0);}}$=json_decode($this->in['list'],!0);$=0;$=0;foreach($ as $){$=_DIR($['path']);;if($['type']=='folder'){if(del_dir($))$++;else $++;;}else{if(del_file($))$++;else $++;;}}space_size_use_reset();if(count($)==0x001){if($)show_json($this->L['remove_success']);else show_json($this->L['remove_fali'],!1);;}else{$=$==0?!0:!1;;show_json($this->L['remove_success'].$.'success,'.$.'error',$);}}public function pathCopy(){session_start();;$=json_decode($this->in['list'],!0);;$_SESSION['path_copy']=json_encode($);;$_SESSION['path_copy_type']='copy';;show_json($this->L['copy_success'],ture,$_SESSION);;}public function pathCute(){session_start();$=json_decode($this->in['list'],!0);;foreach($ as $=>&$){$['path']=rawurldecode($['path']);_DIR($['path']);}$_SESSION['path_copy']=json_encode($);;$_SESSION['path_copy_type']='cute';show_json($this->L['cute_success']);;}public function pathCuteDrag(){$=json_decode($this->in['list'],!0);;$=$this->path;;$=$GLOBALS['path_type'];;$=$GLOBALS['path_id'];;if(!path_writeable($this->path))show_json($this->L['no_permission_write'],!1);$=0;;$=0;$=array();;foreach($ as $){$=_DIR($['path']);;$=get_path_this($);;$=get_filename_auto($.$,'',$this->config['user']['file_repeat']);if($!=$GLOBALS['path_id']){space_size_use_check();}if(move_path($,$,'',$this->config['user']['file_repeat'])){$++;if($!=$GLOBALS['path_id']){space_size_use_change($);space_size_use_change($,!1,$,$);}$[]=_DIR_OUT(iconv_app($));}else{$++;;}}$=$==0?!0:!1;$=$.' success,'.$.' error';;if($==0){$=$this->L['success'];}show_json($,$,$);}public function pathCopyDrag(){$=json_decode($this->in['list'],!0);;$=$this->path;$=$GLOBALS['path_type'];$=$GLOBALS['path_id'];;space_size_use_check();;if(!path_writeable($this->path))show_json($this->L['no_permission_write'],!1);$=0;$=0;;$=array();foreach($ as $){$=_DIR($['path']);$=get_path_this($);;$=get_filename_auto($.$,'',$this->config['user']['file_repeat']);;if($this->in['filename_auto']==0x001&& trim($,'/')==trim($,'/')){$=get_filename_auto($.$,'','folder_rename');}if(copy_dir($,$)){$++;space_size_use_change($);$[]=_DIR_OUT(iconv_app($));}else{$++;}}$=$==0?!0:!1;;$=$.' success,'.$.' error';;if($==0){$=$this->L['success'];}show_json($,$,$);}public function clipboard(){$=json_decode($_SESSION['path_copy'],!0);if(!$){$=array();}show_json($,!0,$_SESSION['path_copy_type']);}public function pathPast(){if(!isset($_SESSION['path_copy'])){show_json($this->L['clipboard_null'],!1,array());}$=$this->path;session_start();;$='';$=array();$=json_decode($_SESSION['path_copy'],!0);$=$_SESSION['path_copy_type'];$=$GLOBALS['path_type'];;$=$GLOBALS['path_id'];if(!path_writeable($))show_json($this->L['no_permission_write'],!1,$);$GLOBALS['path_from_auth_check']=!0;;$=count($);if($==0){show_json($this->L['clipboard_null'],!1,$);}for($=0;$<$;$++){$=_DIR($[$]['path']);_DIR($this->in['path']);;$=get_path_this($);$=iconv_app($);if(!file_exists($)){$.= "<li>{$}".$this->L['copy_not_exists']."</li>";continue;}if($[$]['type']=='folder'){if($==substr($,0,strlen($))){$.="<em style='color:#fff;'>{$}".$this->L['current_has_parent']."</em>";continue;;}}$=get_filename_auto($.$,'',$this->config['user']['file_repeat']);$=get_path_this($);if($=='copy'){space_size_use_check();copy_dir($,$);space_size_use_change($);}else{if($!=$GLOBALS['path_id']){space_size_use_check();}move_path($,$,'',$this->config['user']['file_repeat']);if($!=$GLOBALS['path_id']){space_size_use_change($);space_size_use_change($,!1,$,$);}}$[]=_DIR_OUT(iconv_app($));;}if($=='copy'){$=$this->L['past_success'].$;}else{$_SESSION['path_copy']=json_encode(array());$_SESSION['path_copy_type']='';$=$this->L['cute_past_success'].$;}$=($==''?!0:!1);show_json($,$,$);}public function fileDownload(){file_put_out($this->path,!0);;}public function fileDownloadRemove(){$=rawurldecode(_DIR_CLEAR($this->in['path']));;$=USER_TEMP.iconv_system($);;space_size_use_change($,!1);;file_put_out($,!0);;del_file($);;}public function zipDownload(){if(!file_exists(USER_TEMP)){mkdir(USER_TEMP);}else{$=path_list(USER_TEMP,!0,!1);$=0x0e10*0x0000018;if($['filelist']>=0x001){for($=0;$<count($['filelist']);$++){$=$['filelist'][$]['mtime'];if(time()-$>$){del_file($['filelist'][$]['path'].$['filelist'][$]['name']);}}}}$=$this->zip(USER_TEMP);show_json($this->L['zip_success'],!0,get_path_this($));}public function zip($=''){load_class('pclzip');;ini_set('memory_limit','2028M');;$=json_decode($this->in['list'],!0);$=count($);for($=0;$<$;$++){$[$]['path']=rtrim(_DIR($[$]['path']),'/');}$=$;if($==''){$=get_path_father($[0]['path']);}if(!is_writeable($)){show_json($this->L['no_permission_write'],!1);}if($==0x001){$=get_path_this($[0]['path']);}else{$=get_path_this(get_path_father($[0]['path']));}$=$.$.'.zip';$=get_filename_auto($,'',$this->config['user']['file_repeat']);;space_size_use_check();;$=array();for($=0;$<$;$++){if(file_exists($[$]['path'])){$[]=$[$]['path'];}}if(count($)==0){show_json($this->L['not_exists'],!1);}$=new PclZip($);foreach($ as $=>$){$=_DIR_CLEAR(get_path_father($));if($==0){$=$->create($,PCLZIP_OPT_REMOVE_PATH,$,PCLZIP_CB_PRE_FILE_NAME,'zip_pre_name');continue;}$=$->add($,PCLZIP_OPT_REMOVE_PATH,$,PCLZIP_CB_PRE_FILE_NAME,'zip_pre_name');}space_size_use_change($);if($==0){show_json("Create error!",!1);}$=$this->L['zip_success'].$this->L['size'].":".size_format(filesize($));if($==''){show_json($,!0,_DIR_OUT(iconv_app($)));}else{return iconv_app($);}}public function unzip(){ini_set('memory_limit','2028M');;$=$this->path;;$=get_path_this($);;$=substr($,0,strrpos($,'.'));$=get_path_ext($);$=get_path_father($).$;;if(isset($this->in['to_this'])){$=get_path_father($);}if(isset($this->in['path_to'])){$=_DIR($this->in['path_to']);}if(!is_writeable(get_path_father($))){show_json($this->L['no_permission_write'],!1);}space_size_use_check();load_class('pclzip');$=new PclZip($);$=$->extract(PCLZIP_OPT_PATH,$,PCLZIP_OPT_SET_CHMOD,0777,PCLZIP_CB_PRE_FILE_NAME,'unzip_pre_name',PCLZIP_CB_PRE_EXTRACT,"check_ext_unzip",PCLZIP_OPT_REPLACE_NEWER);if($==0){show_json("Error : ".$->errorInfo(!0),fasle);}else{space_size_use_change($);show_json($this->L['unzip_success']);}}public function imageRotate(){load_class('imageThumb');;$=new imageThumb($this->path,'file');$=$->imgRotate($this->path,intval($this->in['rotate']));;if($){show_json($this->L['success']);}else{show_json($this->L['error'],!1);}}public function image(){if(filesize($this->path)<=0x00000400*0x014|| !function_exists('imagecolorallocate')){file_put_out($this->path);return;}if(!is_dir(DATA_THUMB)){mk_dir(DATA_THUMB);}load_class('imageThumb');$=$this->path;$=@md5_file($);if(strlen($)<0x05){$=md5($);}$=DATA_THUMB.$.'.png';if(!file_exists($)){if(get_path_father($)==DATA_THUMB){$=$this->path;}else{$=new imageThumb($,'file');$->prorate($,0x0fa,0x0fa);}}if(!file_exists($)|| filesize($)<0x064){$=$this->path;}file_put_out($);}public function serverDownload(){set_time_limit(0);;$='download_'.$this->in['uuid'];;if($this->in['type']=='percent'){if(isset($_SESSION[$])){$=$_SESSION[$];$=array('uuid' =>$this->in['uuid'],'length' =>(int)$['length'],'name' =>$['name'],'size' =>(int)@filesize(iconv_system($['path'])),'time' =>mtime());show_json($);}else{show_json('',!1);}}else if($this->in['type']=='remove'){del_file($_SESSION[$]['path']);unset($_SESSION[$]);show_json('',!1);}$=_DIR($this->in['save_path']);if(!is_writeable($)){show_json($this->L['no_permission_write'],!1);}$=rawurldecode($this->in['url']);$=url_header($);if(!$){show_json($this->L['download_error_exists'],!1);}$=$.$['name'];if(!checkExt($)){$=_DIR($this->in['save_path']).date('-h:i:s').'.txt';}space_size_use_check();$=get_filename_auto(iconv_system($),'',$this->config['user']['file_repeat']);;$=$.'.downloading';session_start();;$_SESSION[$]=array('length'=> $['length'],'path' =>$,'name' =>get_path_this($));;session_write_close();;if(file_download_this($,$,$['length'])){session_start();unset($_SESSION[$]);session_write_close();if(@rename($,$)){$=get_path_this(iconv_app($));space_size_use_change($);show_json($this->L['download_success'],!0,_DIR_OUT(iconv_app($)));}else{show_json($this->L['download_error_create'],!1);}}else{session_start();;unset($_SESSION[$]);;session_write_close();show_json($this->L['download_error_create'],!1);}}public function officeView(){if(!file_exists($this->path)){show_tips($this->L['not_exists']);}$=get_path_ext($this->path);$=_make_file_proxy($this->path);;if(defined("OFFICE_KOD_SERVER")){$=APPHOST.'index.php?explorer/fileProxy&path='.$this->in['path'];$=$_SESSION['kod_user'];$=rand_string(0x0a);$=OFFICE_KOD_SERVER.rawurlencode($).'&lang=cn&appType=desktp&appMode=edit' .'&file_time='.@filemtime($this->path).'&user_id='.$['user_id'].'&user_name='.$['name'].'&app_id='.OFFICE_KOD_APP_ID.'&app_s='.$.'&app_v='.md5($.OFFICE_KOD_APP_KEY).'&access_token='.session_id();header("location:".$);exit;}if(file_exists(PLUGIN_DIR.'officeView')){if(isset($_GET['is_edit'])|| !isset($this->config['settings']['office_server_doc2pdf'])){include(PLUGIN_DIR.'officeView/index.php');}else{include(PLUGIN_DIR.'officeView/flexpapper.php');}exit;}$=$_SERVER['HTTP_HOST'];;if(strpos(OFFICE_SERVER,'view.officeapps.live.com')===-0x001|| strstr($,'10.10.')|| strstr($,'192.168.')|| strstr($,'127.0.')|| !strstr($,'.')){$=$this->L['unknow_file_office'];show_tips($);}else{$=OFFICE_SERVER.rawurlencode($);header("location:".$);}}public function officeSave(){$=_DIR($this->in['path']);;if(isset($this->in['from_activex'])){if($_FILES["file"]["error"]>0){echo "Return Code: ".$_FILES["file"]["error"];}else{move_uploaded_file($_FILES["file"]["tmp_name"],$this->path);echo 'succeed';}exit;}if(!is_writeable($)){$this->json_putout(array('error'=>'no_permission_write'));}if(($=file_get_contents('php://input'))===!1){$this->json_putout(array('error'=>'Bad Request'));}$=json_decode($,!0);if($===NULL){$this->json_putout(array('error'=>'Bad Response'));}$=array(0=>'NotFound',0x001=>'Editing',0x0002=>'MustSave',0x00003=>'Corrupted',0x000004=>'Closed');$=array('error'=>0,'action'=>$[$["status"]]);;switch($[$["status"]]){case "MustSave":case "Corrupted":$["c"]="saved";;$['status']='0';;if(file_download_this($["url"],$)){$['status']='success';}break;default:break;;}$this->json_putout($);;}private function json_putout($){@header('Content-Type: application/json; charset==utf-8');@header('X-Robots-Tag: noindex');@header('X-Content-Type-Options: nosniff');;echo json_encode($);exit;;}public function fileProxy(){file_put_out($this->path);}public function fileUpload(){$=_DIR($this->in['upload_to']);if(!is_writeable($))show_json($this->in['upload_to'],!1);if($=='')show_json($this->L['upload_error_big'],!1);if(strlen($this->in['fullPath'])>0x001){$=_DIR_CLEAR(rawurldecode($this->in['fullPath']));$=get_path_father($);$=iconv_system($);if(mk_dir($.$)){$=$.$;}}$=$this->config['user']['file_repeat'];$=USER_TEMP;;mk_dir($);;if(!is_writeable($))show_json($this->L['no_permission_write'],!1);upload_chunk('file',$,$,$);;}private function path_share(&$){$=explode(',',$GLOBALS['path_id']);$=system_member::user_share_list($[0]);$=$GLOBALS['path_id_user_share'];foreach($ as $=>$){$=_DIR(KOD_USER_SHARE.':'.$[0].'/'.$['name']);;$['path']=get_path_this($);$['atime']='';;$['ctime']='';$['mode']='';;$['is_readable']=0x001;;$['is_writable']=0x001;;$['exists']=intval(file_exists($));$['meta_info']='path_self_share';$['menuType']="menuSharePath";if(get_path_ext($['name'])=='oexe'){$=json_decode(@file_get_contents($),!0);if(is_array($))$=array_merge($,$);}if($['type']=='folder'){$['ext']='folder';$['folderlist'][]=$;}else{$['filelist'][]=$;}}$['path_read_write']='readable';;$GLOBALS['path_id_user_share']=$;;if($[0]==$this->user['user_id']){$['share_list']=$;}return $;}private function path_fav(&$){$=new fileCache(USER.'data/fav.php');$=$->get();$GLOBALS['path_from_auth_check']=!0;;foreach($ as $=>$){$=_DIR($['path']);$=path_haschildren($,$);if(!isset($['type'])){$['type']='folder';}if($['type']=='folder' && $['ext']!='treeFav'){$=!0;}$=array('name' =>$['name'],'ext' =>$['ext'],'menuType' =>"menuFavPath",'atime' =>'','ctime' =>'','mode' =>'','is_readable' =>0x001,'is_writeable' =>0x001,'exists' =>intval(file_exists($)),'meta_info' =>'treeFav','path' =>$['path'],'type' =>$['type'],'open' =>!1,'isParent' =>!1);if(strstr($['path'],KOD_USER_SHARE)|| strstr($['path'],KOD_USER_FAV)|| strstr($['path'],KOD_GROUP_ROOT_SELF)|| strstr($['path'],KOD_GROUP_ROOT_ALL)){$['exists']=0x001;}if(get_path_ext($['name'])=='oexe'){$=json_decode(@file_get_contents($),!0);if(is_array($))$=array_merge($,$);}if($['type']=='folder'){$['folderlist'][]=$;}else{$['filelist'][]=$;}}$GLOBALS['path_from_auth_check']=!1;$GLOBALS['path_type']=KOD_USER_FAV;$['path_read_write']='writeable';;return $;}private function path_group(&$,$){if($==KOD_GROUP_ROOT_SELF){$=$this->_group_self();}else{$=$this->_group_tree('1');}$GLOBALS['path_from_auth_check']=!0;foreach($ as $=>$){$=array('name' =>$['name'],'menuType' =>"menuGroupRoot",'atime' =>'','ctime' =>'','mode' =>'','is_readable' =>0x001,'is_writeable' =>0x001,'exists' =>0x001,'path' =>$['path'],'ext' =>$['ext'],'type' =>'folder','open' =>!1,'isParent' =>!1);;if($['type']=='folder'){$['folderlist'][]=$;}else{$['filelist'][]=$;}}$GLOBALS['path_from_auth_check']=!1;;$GLOBALS['path_type']=$;$['path_read_write']='writeable';return $;;}private function path($,$=true,$=false){$=explode(',',$this->config['setting_system']['path_hidden']);$=_DIR_OUT(iconv_app($));;if($GLOBALS['path_type']==KOD_USER_SHARE&& strpos(trim($,'/'),'/')===!1){$=$;}$=array('folderlist' =>array(),'filelist' =>array(),'info' =>array(),'path_read_write' =>'not_exists','this_path' =>$);if(!file_exists($)){$['path_read_write']="not_exists";}else if(path_writeable($)){$['path_read_write']='writeable';}else if(path_writeable($)){$['path_read_write']='readable';}else{$['path_read_write']='not_readable';}if($===!1){return $;}else if($GLOBALS['path_type']==KOD_USER_SHARE&& !strstr(trim($this->in['path'],'/'),'/')){$=$this->path_share($);}else if($GLOBALS['path_type']==KOD_USER_FAV){$=$this->path_fav($);}else if($GLOBALS['path_type']==KOD_GROUP_ROOT_SELF){$=$this->path_group($,$GLOBALS['path_type']);}else if($GLOBALS['path_type']==KOD_GROUP_ROOT_ALL){$=$this->path_group($,$GLOBALS['path_type']);}else{$=path_list($,$,!0);$['folderlist']=$['folderlist'];$['filelist']=$['filelist'];}$=array();$=array();foreach($['filelist'] as $=>$){if(in_array($['name'],$))continue;$['ext']=get_path_ext($['name']);if($['ext']=='oexe' && !isset($['content'])){$=iconv_system($['path']);$=json_decode(@file_get_contents($),!0);if(is_array($))$=array_merge($,$);}$[]=$;;}foreach($['folderlist'] as $=>$){if(in_array($['name'],$))continue;$[]=$;;}$['filelist']=$;$['folderlist']=$;;$=_DIR_OUT($);$this->_role_check_info($);return $;}private function _role_check_info(&$){if(!$GLOBALS['path_type']){$['info']=array("path_type"=>'',"role"=>'',"id"=>'','name'=>'');return;}$['info']=array("path_type" =>$GLOBALS['path_type'],"role" =>$GLOBALS['is_root']?'owner':'guest',"id" =>$GLOBALS['path_id'],'name' =>'',);if($GLOBALS['path_type']==KOD_USER_SHARE){$GLOBALS['path_id']=explode(':',$GLOBALS['path_id']);$GLOBALS['path_id']=$GLOBALS['path_id'][0];$['info']['id']=$GLOBALS['path_id'];$=system_member::get_info($GLOBALS['path_id']);$['info']['name']=$['name'];if($GLOBALS['is_root']){$['info']['admin_real_path']=USER_PATH.$['path'].'/home/';}}if($GLOBALS['path_type']==KOD_GROUP_PATH|| $GLOBALS['path_type']==KOD_GROUP_SHARE){$=system_group::get_info($GLOBALS['path_id']);$['info']['name']=$['name'];$=system_member::user_auth_group($GLOBALS['path_id']);if($=='write' || $GLOBALS['is_root']){$['info']['role']='owner';$['group_space_use']=$['config'];}if($GLOBALS['is_root']){$['info']['admin_real_path']=GROUP_PATH.$['path'].'/home/';}}}}
Function Calls
| None |
Stats
| MD5 | 298b8784902511785025422640846cfe |
| Eval Count | 0 |
| Decode Time | 107 ms |