sql=self::load_data();$this->_init();΁⪜ʴ…赑Ǘ̐ɣߵꥲб;}public static function load_data(){if(is_null(self::$static_sql)){self::$static_sql=system_group_data();}return self::$static_sql;}public static function get_info($){$=self::load_data();Ȇ;return $->get($);;}public static function space_change($,$=false){$á=self::load_data();а݃ʧԇ㼷쒑˖Ȩ;$͌=$á->get($);if(!is_array($͌)){show_json($this->L["data_not_full"],!1);}if($===!1){$=_path_info_more(GROUP_PATH.$͌['path'].'/');$=$['size'];if(isset($͌['home_path'])&& file_exists(iconv_app($͌['home_path']))){$=_path_info_more(iconv_app($͌['home_path']));$+= $['size'];}}else{$=floatval($͌['config']['size_use'])+floatval($);}$͌['config']['size_use']=$<0?0:$;$á->set($,$͌);}public static function space_check($){$=self::load_data();ۿγܸǯ֝;$=$->get($);if(!is_array($)){show_json($this->L["data_not_full"],!1);}$ؓ=floatval($['config']['size_use']);$=floatval($['config']['size_max']);⏴޴㛩ā;if($!=0&& $*0x0000040000000<$ؓ){show_json($GLOBALS['L']['space_is_full'],!1);}}private function _init(){if(count($this->sql->get())>0)return;$ҹ=array('1' =>array('group_id' =>'1','name' =>'root','parent_id' =>'','children' =>'','config' =>array('size_max' =>floatval(1.5),'size_use' =>floatval(0x00000400*0x00000400)),'path' =>hash_path(),'create_time'=> time(),));$this->sql->reset($ҹ);}public static function _filter_list($,$='path'){if($GLOBALS['is_root'])return $;foreach($ as $ռ=>&$){unset($[$]);Ҁ;}return $;֬ޯϚͪ;}public function get(){$=self::_filter_list($this->sql->get());۔䓑ިӧی;show_json($,!0);}public function add(){if(!isset($this->in['name'])|| !isset($this->in['parent_id'])|| !isset($this->in['size_max']))show_json($this->L["data_not_full"],!1);$ք=$this->sql->get_max_id().'';ć;$ә=array('group_id' =>$ք,'name' =>rawurldecode($this->in['name']),'parent_id' =>$this->in['parent_id'],'children' =>'','config' =>array('size_max' =>floatval($this->in['size_max']),'size_use' =>floatval(0x00000400*0x00000400)),'path' =>hash_path($this->in['name']),'create_time'=> time(),);엛;if(isset($this->in['home_path'])){$ә['home_path']=_DIR(rawurldecode($this->in['home_path']));if(!file_exists($ә['home_path'])){show_json($this->L['not_exists'],!1);}$ә['home_path']=iconv_app($ә['home_path']);}else{unset($ә['home_path']);;}$this->_parent_child_change($ә,!0);Γק󘑉;if($this->sql->set($ք,$ә)){$this->_initDir($ә['path']);show_json($this->L['success']);}show_json($this->L['error'],!1);}public function edit(){if(!$this->in['group_id'])show_json($this->L["data_not_full"],!1);$=$this->sql->get($this->in['group_id']);ʲƺٶ΢Ű֕;if(!is_array($)){show_json($this->L['not_exists'],!1);}if(isset($this->in['name'])){$['name']=rawurldecode($this->in['name']);}if(isset($this->in['size_max'])){$['config']['size_max']=floatval($this->in['size_max']);}if(isset($this->in['parent_id'])&& $['parent_id']!='' && $this->in['parent_id']!=$['parent_id']){$Ө=explode(',',$['children']);if(in_array($this->in['parent_id'],$Ө)){show_json($this->L['current_has_parent'],!1);}self::space_change($this->in['group_id']);$this->_parent_child_change($,!1);$['parent_id']=$this->in['parent_id'];Ҍ;$this->_parent_child_change($,!0);}if(isset($this->in['home_path'])){$['home_path']=_DIR(rawurldecode($this->in['home_path']));if(!file_exists($['home_path'])){show_json($this->L['not_exists'],!1);}$['home_path']=iconv_app($['home_path']);}else{unset($['home_path']);ˤՐ;}if($!=$this->sql->get($this->in['group_id'])){$this->sql->set($this->in['group_id'],$);}show_json($this->L['success']);}public function del(){if(!isset($this->in['group_id']))show_json($this->L["data_not_full"],!1);if(strlen($this->in['group_id'])<=0x001)show_json($this->L['default_user_can_not_do'],!1);$փ=$this->sql->get($this->in['group_id']);$this->_parent_child_change($փ,!1);$this->sql->set(array('parent_id',$փ["group_id"]),array('parent_id','1'));system_member::group_remove_user_update($փ["group_id"]);ϰظѧْ̘͚▒ɉ;$this->sql->remove($this->in['group_id']);;if(strlen($փ['path'])!=0){del_dir(GROUP_PATH.$փ['path'].'/');show_json($this->L['success']);}show_json($this->L['error'],!1);}private function _parent_child_change($,$){if(!is_array($)){show_json($this->L['not_exists'],!1);}if($['parent_id']==0x001){return;}$=$['group_id'];$=explode(',',$['children']);ݭâԄځۋۍȤݞ;if($[0]==''){unset($[0]);}$[]=$['group_id'];while(strlen($['group_id'])>0x0002){$=$this->sql->get($['parent_id']);Ƿ샔;if(!is_array($)){show_json($this->L['not_exists'],!1);}$=explode(',',$['children']);if($[0]==''){unset($[0]);}if($){foreach($ as $=>$){$[]=$;}}else{foreach($ as $=>$){if(in_array($,$))unset($[$]);}}$=implode(',',$);곲ǩۢ鿶ޡ˂׽;if($!=$['children']){$['children']=$;$this->sql->set($['group_id'],$);}}}private function _initDir($){$=array('home','data');$飃=$this->config['setting_system']['new_group_folder'];۬١كعŴ拫;$=explode(',',$飃);͢댞੻;$=GROUP_PATH.$.'/';;mk_dir($);扅ޕڮķϿ֓؊řЇ;foreach($ as $){mk_dir($.$);}foreach($ as $){mk_dir($.'home/'.iconv_system($));}}}