fckphp_config=$fckphp_config; $this->type=$type; $this->raw_cwd=$cwd; $this->actual_cwd=str_replace("//","/",($fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd)); $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd)); } function run() { header ("Content-Type: application/xml; charset=utf-8"); echo "\n"; ?> ] > real_cwd)) { while (($filename=readdir($dh))!==false) { if (($filename!=".")&&($filename!="..")) { if (is_dir($this->real_cwd."/$filename")) { //check if$fckphp_configured not to show this folder $hide=false; for($i=0;$ifckphp_config['ResourceAreas'][$this->type]['HideFolders']);$i++) $hide=(ereg($this->fckphp_config['ResourceAreas'][$this->type]['HideFolders'][$i],$filename)?true:$hide); if (!$hide) echo "\t\t\n"; } else { array_push($files,$filename); } } } closedir($dh); } echo "\t\n"; echo "\t\n"; for ($i=0;$ifckphp_config['ResourceAreas'][$this->type]['AllowedExtensions'])) { //check if$fckphp_configured not to show this file $editable=$hide=false; for($j=0;$jfckphp_config['ResourceAreas'][$this->type]['HideFiles']);$j++) $hide=(ereg($this->fckphp_config['ResourceAreas'][$this->type]['HideFiles'][$j],$files[$i])?true:$hide); if (!$hide) { if ($this->fckphp_config['ResourceAreas'][$this->type]['AllowImageEditing']) $editable=$this->isImageEditable($this->real_cwd."/".$files[$i]); echo "\t\treal_cwd."/".$files[$i])/1024)."\" editable=\"" . ( $editable?"1":"0" ) . "\" />\n"; } } } echo "\t\n"; echo "\n"; } function isImageEditable($file) { $fh=fopen($file,"r"); if ($fh) { $start4=fread($fh,4); fclose($fh); $start3=substr($start4,0,3); if ($start4=="\x89PNG") { //PNG return (function_exists("imagecreatefrompng") && function_exists("imagepng")); } elseif ($start3=="GIF") { //GIF return (function_exists("imagecreatefromgif") && function_exists("imagegif")); } elseif ($start3=="\xFF\xD8\xFF") { //JPEG return (function_exists("imagecreatefromjpeg")&& function_exists("imagejpeg")); } elseif ($start4=="hsi1") { //JPEG return (function_exists("imagecreatefromjpeg")&& function_exists("imagejpeg")); } else { return false; } } else { return false; } } } ?>