4require_once(
"./Services/FileSystem/classes/class.ilFileData.php");
5require_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']);
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
This class handles all operations on files for the drafts of a forum object.
checkFilesExist($a_files)
check if files exist
__checkReadWrite()
check if directory is writable overwritten method from base class @access private
unlinkFile($a_filename)
unlink one uploaded file expects a filename e.g 'foo'
getAbsolutePath($a_path)
get absolute path of filename
storeUploadedFile($files)
Store uploaded files in filesystem.
unlinkFilesByMD5Filenames($a_md5_filename)
get file data of a specific attachment
getFileDataByMD5Filename($a_md5_filename)
get file data of a specific attachment
__rotateFiles($a_path)
rotate files with same name recursive method
unlinkFiles($a_filenames)
unlink files: expects an array of filenames e.g.
__initDirectory()
init directory overwritten method @access public
moveFilesOfDraft($forum_path, $new_post_id)
__construct($obj_id=0, $draft_id)
This class handles all operations on files in directory /ilias_data/.
getPath()
get Path @access public
static newInstanceByDraftId($draft_id)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static _sanitizeFilemame($a_filename)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file