0) { if (substr($p, -1) == DIRECTORY_SEPARATOR) { $p = substr($p, 0, -1); } if (substr($p, 0, 1) == DIRECTORY_SEPARATOR) { if (preg_match_all('`(.*'.DIRECTORY_SEPARATOR.')([a-zA-Z0-9_]+)$`U', $p, $m)) { $this->Path = $m[1][0]; $this->Name = $m[2][0]; } } } } function SetPath($v) { $this->Path = $v; } function GetPath() { return $this->Path; } function SetName($v) { $this->Name = $v; } function GetName() { return $this->Name; } function GetFullPath() { return $this->GetPath().$this->GetName().DIRECTORY_SEPARATOR; } function Exists() { return is_dir($this->GetFullPath()); } function GetFiles() { $Files = array(); if (is_readable($this->GetFullPath()) && $h = opendir($this->GetFullPath())) { while ($f = readdir($h)) { if ($f != '.' && $f != '..' && !is_dir($this->GetFullPath().$f)) { array_push($Files, $f); } } return (sizeof($Files) > 0)?$Files:false;; } return false; } function Create() { if (!is_dir($this->GetFullPath())) { return mkdir($this->GetFullPath()); } return true; } function CopyFile($o, $d = '') { if (is_array($o) && sizeof($o) > 0) { if (sizeof($o) > 1) { foreach ($o as $k => $v) { if (!(is_string($k))) { $this->CopyFile($v); } else { $this->CopyFile($k, $v); } } } } else if (file_exists($o)) { if (strlen(trim($d)) == 0) $d = basename($o); if (is_uploaded_file($o)) { return move_uploaded_file($o, $this->GetFullPath().$d); } else { return copy($f, $this->GetFullPath().$d); } } else return false; } function Remove($minPath,$fullPath) { $FinalPath = str_replace($minPath,'',$fullPath); if(trim($minPath)!="" && trim($minPath)!="/" && ereg($minPath,$fullPath) && $FinalPath!='' && $fullPath!=""){ exec('rm -R '.$fullPath); } } } ?>