32 $path = preg_replace(
"/[\/\\\]+$/",
"",
$path);
40 if ($mode ==
"filesystem")
42 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
46 if (defined(
"ILIAS_MODULE"))
48 return "../".ILIAS_WEB_DIR.
"/".$ilias->client_id;
52 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
61 return CLIENT_DATA_DIR;
66 $a_dir = trim($a_dir);
69 if (substr($a_dir,-1) ==
"/")
71 $a_dir = substr($a_dir,0,-1);
75 if (!(
$path = substr($a_dir,0, strrpos($a_dir,
"/") - strlen($a_dir))))
82 return @mkdir($a_dir,fileperms(
$path));
87 $dirs = array($a_dir);
88 $a_dir = dirname($a_dir);
90 while($last_dirname != $a_dir)
92 array_unshift(
$dirs, $a_dir);
93 $last_dirname = $a_dir;
94 $a_dir = dirname($a_dir);
98 $reverse_paths = array_reverse(
$dirs, TRUE);
100 foreach ($reverse_paths as $key => $value)
102 if ($found_index == -1)
115 if ($dirindex >= $found_index)
117 if (! file_exists(
$dir))
119 if (strcmp(substr(
$dir,strlen(
$dir)-1,1),
"/") == 0)
125 if (! mkdir(
$dir, $umask))
127 error_log(
"Can't make directory: $dir");
131 elseif (! is_dir(
$dir))
133 error_log(
"$dir is not a directory");
139 $umask = fileperms(
$dir);
148 if (!is_dir($a_dir) || is_int(strpos($a_dir,
"..")))
153 $current_dir = opendir($a_dir);
162 while($entryname = readdir($current_dir))
169 if(is_dir($a_dir.
"/".$file) and ($file !=
"." and $file!=
".."))
173 elseif ($file !=
"." and $file !=
"..")
175 unlink(${a_dir}.
"/".${file});
179 closedir($current_dir);
185 $current_dir = opendir($a_dir);
189 while($entry = readdir($current_dir))
191 if(is_dir($a_dir.
"/".$entry))
193 $dirs[$entry] = array(
"type" =>
"dir",
"entry" => $entry);
197 if ($entry !=
"." && $entry !=
"..")
199 $size = filesize($a_dir.
"/".$entry);
200 $files[$entry] = array(
"type" =>
"file",
"entry" => $entry,
214 if (!is_dir($temp_path))
218 $temp_name = tempnam($temp_path,
"tmp");
224 $temp_name = str_replace(
"\\",
"/", $temp_name);
230 public static function rename($source, $target)
232 return @
rename($source, $target);