clean_tmp(true); return parent::save_form(); } protected function get_store_hash(){ return "cmsrest_".SESSid."_".md5(serialize($this->parameters)); } protected function get_jsonstore_url(){ return "./cms_rest.php/".$this->get_store_hash(); } protected function save_store(){ $selector = $this->get_selected_selector(); file_put_contents("./temp/".$this->get_store_hash(), serialize(array( 'id' => $this->id, 'classname' => get_class($this), 'selector_value' => $selector->get_value(), 'datas' => $this->datas ))); } public function get_datas(){ $this->clean_tmp(); if(file_exists('./temp/'.$this->get_store_hash())){ $content = unserialize(file_get_contents("./temp/".$this->get_store_hash())); $this->datas = $content['datas']; } $this->save_store(); return array( 'jsonstore'=> $this->get_jsonstore_url() ); } public function set_datas($datas){ $this->datas = $datas; } public function store_proceed($content){ //Must be rewrite } private function clean_tmp($force = false){ $dh = opendir('./opac_css/temp'); while($file = readdir($dh)){ if($file != 'CVS' && substr($file,0,8) === "cmsrest_"){ if($force){ unlink('./opac_css/temp/'.$file); } $this->check_file($file); } } } private function check_file($filename){ $infos = explode("_",$filename); $query = 'SELECT SESSID SESSNAME FROM sessions WHERE SESSID = "'.$infos[1].'"'; $result = pmb_mysql_query($query); if(!pmb_mysql_num_rows($result)){ unlink('./opac_css/temp/'.$filename); } } }