4 require_once(
"./Services/FileSystem/classes/class.ilFileData.php");
40 define(
'FORUM_PATH',
'forum');
49 $this->obj_id = $a_obj_id;
50 $this->pos_id = $a_pos_id;
63 $this->pos_id = $a_id;
78 $dp = opendir($this->forum_path);
80 while(
$file = readdir($dp))
89 if(!is_dir($this->forum_path.
'/'.
$file))
92 'path' => $this->forum_path.
'/'.
$file,
93 'md5' => md5($this->obj_id.
'_'.$this->pos_id.
'_'.
$rest),
95 'size' => filesize($this->forum_path.
'/'.
$file),
106 $dp = opendir($this->forum_path);
108 while(
$file = readdir($dp))
120 if(!is_dir($this->forum_path.
'/'.
$file))
123 'path' => $this->forum_path.
'/'.
$file,
124 'md5' => md5($this->obj_id.
'_'.$this->pos_id.
'_'.
$rest),
126 'size' => filesize($this->forum_path.
'/'.
$file),
138 if((
int)$a_new_frm_id)
140 $dp = opendir($this->forum_path);
142 while(
$file = readdir($dp))
154 if(!is_dir($this->forum_path.
'/'.
$file))
156 @rename($this->forum_path.
'/'.
$file, $this->forum_path.
'/'.$a_new_frm_id.
'_'.$this->pos_id.
'_'.
$rest);
172 @copy($this->
getForumPath().
"/".$this->obj_id.
"_".$this->pos_id.
"_".$file[
"name"],
173 $this->getForumPath().
"/".$a_new_obj_id.
"_".$a_new_pos_id.
"_".$file[
"name"]);
200 if(isset($files[
'name']) && is_array($files[
'name']))
202 foreach($files[
'name'] as $index => $name)
205 while(substr($name, -1) ==
'/')
207 $name = substr($name, 0, -1);
210 $temp_name = $files[
'tmp_name'][$index];
211 $error = $files[
'error'][$index];
213 if(strlen(
$filename) && strlen($temp_name) && $error == 0)
224 else if(isset($files[
'name']) && is_string($files[
'name']))
227 while(substr($files[
'name'], -1) ==
'/')
229 $files[
'name'] = substr($files[
'name'], 0, -1);
232 $temp_name = $files[
'tmp_name'];
252 if(is_array($a_filenames))
254 foreach($a_filenames as
$file)
272 if(file_exists($this->forum_path.
'/'.$this->obj_id.
'_'.$this->pos_id.
'_'.$a_filename))
274 return unlink($this->forum_path.
'/'.$this->obj_id.
'_'.$this->pos_id.
"_".$a_filename);
285 return $this->forum_path.
'/'.$this->obj_id.
'_'.$this->pos_id.
"_".$a_path;
297 foreach((array)$files as
$file)
299 if($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename)
302 'path' => $this->forum_path.
'/'.$file[
'entry'],
303 'filename' => $file[
'entry'],
304 'clean_filename' => str_replace($this->obj_id.
'_'.$this->pos_id.
'_',
'', $file[
'entry'])
321 if(is_array($a_md5_filename))
323 foreach((array)$files as
$file)
325 if($file[
'type'] ==
'file' && in_array(md5($file[
'entry']), $a_md5_filename))
327 unlink( $this->forum_path.
'/'.$file[
'entry'] );
335 foreach((array)$files as
$file)
337 if($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename)
339 return unlink( $this->forum_path.
'/'.$file[
'entry'] );
357 foreach($a_files as
$file)
359 if(!file_exists($this->forum_path.
'/'.$this->obj_id.
'_'.$this->pos_id.
'_'.$file))
388 if(is_writable($this->forum_path) && is_readable($this->forum_path))
394 $this->ilias->raiseError(
"Forum directory is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
405 if(is_writable($this->
getPath()))
407 if(mkdir($this->
getPath().
'/'.FORUM_PATH))
409 if(chmod($this->
getPath().
'/'.FORUM_PATH,0755))
411 $this->forum_path = $this->
getPath().
'/'.FORUM_PATH;
427 if(file_exists($a_path))
430 return rename($a_path,$a_path.
'.old');