42 $path = preg_replace(
"/[\/\\\]+$/",
"",
$path);
59 if ($mode ==
"filesystem")
61 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
65 if (defined(
"ILIAS_MODULE"))
67 return "../".ILIAS_WEB_DIR.
"/".$ilias->client_id;
71 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
83 return CLIENT_DATA_DIR;
105 $a_dir = trim($a_dir);
108 if (substr($a_dir,-1) ==
"/")
110 $a_dir = substr($a_dir,0,-1);
114 if (!(
$path = substr($a_dir,0, strrpos($a_dir,
"/") - strlen($a_dir))))
121 return @mkdir($a_dir,fileperms(
$path));
139 $dirs = array($a_dir);
140 $a_dir = dirname($a_dir);
142 while($last_dirname != $a_dir)
144 array_unshift(
$dirs, $a_dir);
145 $last_dirname = $a_dir;
146 $a_dir = dirname($a_dir);
150 $reverse_paths = array_reverse(
$dirs, TRUE);
152 foreach ($reverse_paths as $key => $value)
154 if ($found_index == -1)
164 foreach (
$dirs as $dirindex => $dir)
167 if ($dirindex >= $found_index)
169 if (! file_exists($dir))
171 if (strcmp(substr($dir,strlen($dir)-1,1),
"/") == 0)
175 $dir = substr($dir,0,strlen($dir)-1);
178 if (! mkdir($dir, $umask))
180 error_log(
"Can't make directory: $dir");
184 elseif (! is_dir($dir))
186 error_log(
"$dir is not a directory");
192 $umask = fileperms($dir);
208 if (!is_dir($a_dir) || is_int(strpos($a_dir,
"..")))
213 $current_dir = opendir($a_dir);
222 while($entryname = readdir($current_dir))
224 $files[] = $entryname;
227 foreach($files as
$file)
229 if(is_dir($a_dir.
"/".$file) and ($file !=
"." and $file!=
".."))
233 elseif ($file !=
"." and $file !=
"..")
235 unlink(${a_dir}.
"/".${file});
239 closedir($current_dir);
249 $current_dir = opendir($a_dir);
253 while($entry = readdir($current_dir))
255 if(is_dir($a_dir.
"/".$entry))
257 $dirs[$entry] = array(
"type" =>
"dir",
"entry" => $entry);
261 $size = filesize($a_dir.
"/".$entry);
262 $files[$entry] = array(
"type" =>
"file",
"entry" => $entry,
269 return array_merge(
$dirs, $files);