4 require_once(
"./Services/FileSystem/classes/class.ilFileData.php");
5 require_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
25 $this->lng = $DIC->language();
26 $this->error = $DIC[
'ilErr'];
31 define(
'FORUM_DRAFTS_PATH',
'forum/drafts');
32 parent::__construct();
33 $this->drafts_path = parent::getPath() .
"/" . FORUM_DRAFTS_PATH;
85 public function getFiles()
99 'path' => $file->getPathname(),
100 'md5' => md5($file->getFilename()),
101 'name' => $file->getFilename(),
102 'size' => $file->getSize(),
103 'ctime' =>
date(
'Y-m-d H:i:s', $file->getCTime())
113 public function getFilesOfPost()
122 if ($file->isDir()) {
127 'path' => $file->getPathname(),
128 'md5' => md5($file->getFilename()),
129 'name' => $file->getFilename(),
130 'size' => $file->getSize(),
131 'ctime' =>
date(
'Y-m-d H:i:s', $file->getCTime())
140 foreach ($this->getFilesOfPost() as
$file) {
143 $forum_path .
'/' . $this->obj_id .
'_' . $new_post_id .
'_' . $file[
'name']
152 public function delete()
169 if (isset(
$files[
'name']) && is_array(
$files[
'name'])) {
172 while (substr(
$name, -1) ==
'/') {
188 } elseif (isset(
$files[
'name']) && is_string(
$files[
'name'])) {
190 while (substr(
$files[
'name'], -1) ==
'/') {
194 $temp_name =
$files[
'tmp_name'];
214 if (is_array($a_filenames)) {
215 foreach ($a_filenames as
$file) {
256 if ($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename) {
259 'filename' => $file[
'entry'],
260 'clean_filename' => $file[
'entry']
277 if (is_array($a_md5_filename)) {
279 if ($file[
'type'] ==
'file' && in_array(md5($file[
'entry']), $a_md5_filename)) {
287 if ($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename) {
305 foreach ($a_files as
$file) {
336 $this->error->raiseError(
"Forum directory is not readable/writable by webserver", $this->error->FATAL);
347 if (is_writable($this->
getPath())) {
365 if (file_exists($a_path)) {
367 return \ilFileUtils::rename($a_path, $a_path .
'.old');
404 $filesOfDraft = $this->getFilesOfPost();
405 if (count($filesOfDraft)) {
406 ksort($filesOfDraft);
410 foreach ($filesOfDraft as
$file) {
411 @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/.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
unlinkFile($a_filename)
unlink one uploaded file expects a filename e.g 'foo'
static newInstanceByDraftId($draft_id)
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
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.