4 require_once(
"./Services/FileSystem/classes/class.ilFileData.php");
5 require_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
25 define(
'FORUM_DRAFTS_PATH',
'forum/drafts');
26 parent::__construct();
27 $this->drafts_path = parent::getPath().
"/".FORUM_DRAFTS_PATH;
80 public function getFiles()
96 'path' => $file->getPathname(),
97 'md5' => md5($file->getFilename()),
98 'name' => $file->getFilename(),
99 'size' => $file->getSize(),
100 'ctime' =>
date(
'Y-m-d H:i:s', $file->getCTime())
110 public function getFilesOfPost()
126 'path' => $file->getPathname(),
127 'md5' => md5($file->getFilename()),
128 'name' => $file->getFilename(),
129 'size' => $file->getSize(),
130 'ctime' =>
date(
'Y-m-d H:i:s', $file->getCTime())
139 foreach($this->getFilesOfPost() as
$file)
142 $forum_path.
'/'.$this->obj_id.
'_'.$new_post_id.
'_'.$file[
'name']);
150 public function delete()
169 foreach(
$files[
'name'] as $index => $name)
172 while(substr($name, -1) ==
'/')
174 $name = substr($name, 0, -1);
177 $temp_name =
$files[
'tmp_name'][$index];
191 else if(isset(
$files[
'name']) && is_string(
$files[
'name']))
194 while(substr(
$files[
'name'], -1) ==
'/')
199 $temp_name =
$files[
'tmp_name'];
219 if(is_array($a_filenames))
221 foreach($a_filenames as
$file)
266 if($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename)
270 'filename' => $file[
'entry'],
271 'clean_filename' => $file[
'entry']
288 if(is_array($a_md5_filename))
292 if($file[
'type'] ==
'file' && in_array(md5($file[
'entry']), $a_md5_filename))
304 if($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename)
324 foreach($a_files as
$file)
361 $this->
ilias->raiseError(
"Forum directory is not readable/writable by webserver",$this->
ilias->error_obj->FATAL);
372 if(is_writable($this->
getPath()))
393 if(file_exists($a_path))
396 return \ilFileUtils::rename($a_path, $a_path .
'.old');
418 public function deliverZipFile()
433 $post = ilForumPostDraft::newInstanceByDraftId($this->
getDraftId());
445 $filesOfDraft = $this->getFilesOfPost();
446 if(count($filesOfDraft))
448 ksort($filesOfDraft);
452 foreach($filesOfDraft as
$file)
454 @copy($file[
'path'], $tmp_dir .
'/' . $file[
'name']);
static makeDirParents($a_dir)
Create a new directory and all parent directories.
__checkReadWrite()
check if directory is writable overwritten method from base class private
__construct($obj_id=0, $draft_id)
storeUploadedFile($files)
Store uploaded files in filesystem.
moveFilesOfDraft($forum_path, $new_post_id)
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
checkFilesExist($a_files)
check if files exist
This class handles all operations on files for the drafts of a forum object.
unlinkFiles($a_filenames)
unlink files: expects an array of filenames e.g.
unlinkFilesByMD5Filenames($a_md5_filename)
get file data of a specific attachment
static _sanitizeFilemame($a_filename)
getAbsolutePath($a_path)
get absolute path of filename
This class handles all operations on files in directory /ilias_data/.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
unlinkFile($a_filename)
unlink one uploaded file expects a filename e.g 'foo'
redirection script todo: (a better solution should control the processing via a xml file) ...
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
getFileDataByMD5Filename($a_md5_filename)
get file data of a specific attachment
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__initDirectory()
init directory overwritten method public
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
__rotateFiles($a_path)
rotate files with same name recursive method