22 $this->lng = $DIC->language();
23 $this->error = $DIC[
'ilErr'];
28 define(
'FORUM_DRAFTS_PATH',
'forum/drafts');
29 parent::__construct();
30 $this->drafts_path = parent::getPath() .
"/" . FORUM_DRAFTS_PATH;
82 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()
119 if ($file->isDir()) {
123 $files[$file->getFilename()] = array(
124 'path' => $file->getPathname(),
125 'md5' => md5($file->getFilename()),
126 'name' => $file->getFilename(),
127 'size' => $file->getSize(),
128 'ctime' => date(
'Y-m-d H:i:s', $file->getCTime())
137 foreach ($this->getFilesOfPost() as $file) {
140 $forum_path .
'/' . $this->obj_id .
'_' . $new_post_id .
'_' . $file[
'name']
149 public function delete()
166 if (isset(
$files[
'name']) && is_array(
$files[
'name'])) {
169 while (substr(
$name, -1) ==
'/') {
185 } elseif (isset(
$files[
'name']) && is_string(
$files[
'name'])) {
187 while (substr(
$files[
'name'], -1) ==
'/') {
191 $temp_name =
$files[
'tmp_name'];
211 if (is_array($a_filenames)) {
212 foreach ($a_filenames as $file) {
252 foreach ((array)
$files as $file) {
253 if ($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename) {
256 'filename' => $file[
'entry'],
257 'clean_filename' => $file[
'entry']
274 if (is_array($a_md5_filename)) {
275 foreach ((array)
$files as $file) {
276 if ($file[
'type'] ==
'file' && in_array(md5($file[
'entry']), $a_md5_filename)) {
283 foreach ((array)
$files as $file) {
284 if ($file[
'type'] ==
'file' && md5($file[
'entry']) == $a_md5_filename) {
302 foreach ($a_files as $file) {
333 $this->error->raiseError(
"Forum directory is not readable/writable by webserver", $this->error->FATAL);
344 if (is_writable($this->
getPath())) {
362 if (file_exists($a_path)) {
364 return \ilFileUtils::rename($a_path, $a_path .
'.old');
401 $filesOfDraft = $this->getFilesOfPost();
402 if (count($filesOfDraft)) {
403 ksort($filesOfDraft);
407 foreach ($filesOfDraft as $file) {
408 @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/.
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
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__initDirectory()
init directory overwritten method public
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.