42 $path = preg_replace(
"/[\/\\\]+$/",
"",
$path);
59 if ($mode ==
"filesystem")
61 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
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))
184 elseif (! is_dir($dir))
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))
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);
util class various functions, usage as namespace
makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
getDir($a_dir)
get directory
delDir($a_dir)
removes a dir and all its content (subdirs and files) recursively
getWebspaceDir($mode="filesystem")
get webspace directory
makeDirParents($a_dir)
Create a new directory and all parent directories.
removeTrailingPathSeparators($path)
Reload workbook from saved file
Create styles array
The data for the language used.
getDataDir()
get data directory (outside webspace)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively