params[$parameter]; } function getNbDocs(){ return sizeof($this->listeDocs); } function getCurrentDoc(){ return $this->currentDoc; } //renvoi un document précis sinon renvoi faux function getDoc($numDoc){ if($numDoc >= 0 && $numDoc <= $this->getNbDocs()-1){ $this->current = $numDoc; return $this->getCurrentDoc(); }else return false; } function isInCache($id){ global $visionneuse_path; return file_exists($visionneuse_path."/temp/".$this->driver_name."_".$id); } function setInCache($id,$data){ global $visionneuse_path; $fdest = fopen($visionneuse_path."/temp/".$this->driver_name."_".$id,"w+"); fwrite($fdest,$data); fclose($fdest); } function readInCache($id){ global $visionneuse_path; $data = ""; $data = file_get_contents($visionneuse_path."/temp/".$this->driver_name."_".$id); return $data; } function get_cached_filename($id){ global $visionneuse_path; return $visionneuse_path."/temp/".$this->driver_name."_".$id; } function cleanCache(){ global $visionneuse_path; $dh = opendir($visionneuse_path."/temp/"); if (!$dh) return; $files = array(); $totalSize = 0; while (($file = readdir($dh)) !== false){ if ($file != "." && $file != "..") { $stat = stat($visionneuse_path."/temp/".$file); $files[$file] = array("mtime"=>$stat['mtime']); $totalSize += $stat['size']; } } closedir($dh); $deleteList = array(); foreach ($files as $file => $stat) { //si le dernier accès au fichier est de plus de 3h, on vide... if( ($file != "CVS") && (time() - $stat["mtime"] > (3600*3))){ if(is_dir($visionneuse_path."/temp/".$file)){ $this->rrmdir($visionneuse_path."/temp/".$file); }else{ unlink($visionneuse_path."/temp/".$file); } } } } function rrmdir($dir){ if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dir."/".$object) == "dir"){ $this->rrmdir($dir."/".$object); }else{ unlink($dir."/".$object); } } } reset($objects); rmdir($dir); } } function is_allowed($doc_id){ $docnum_visible = true; return $docnum_visible; } } ?>