ILIAS  release_8 Revision v8.23
ilFileSystemGUI Class Reference

File System Explorer GUI class. More...

+ Inheritance diagram for ilFileSystemGUI:
+ Collaboration diagram for ilFileSystemGUI:

Public Member Functions

 __construct (string $main_absolute_directory)
 
 setAllowedSuffixes (array $a_suffixes)
 
 getAllowedSuffixes ()
 
 setForbiddenSuffixes (array $a_suffixes)
 
 getForbiddenSuffixes ()
 
 isValidSuffix (string $a_suffix)
 
 setAllowDirectories (bool $a_val)
 
 getAllowDirectories ()
 
 setPostDirPath (bool $a_val)
 
 getPostDirPath ()
 
 setTableId (string $a_val)
 
 getTableId ()
 
 setTitle (string $a_val)
 
 getTitle ()
 
 setUseUploadDirectory (bool $a_val)
 
 getUseUploadDirectory ()
 
 getLastPerformedCommand ()
 
 executeCommand ()
 
 addCommand (object $a_obj, string $a_func, string $a_name, bool $a_single=true, bool $a_allow_dir=false)
 
 clearCommands ()
 
 labelFile (string $a_file, string $a_label)
 
 activateLabels (bool $a_act, string $a_label_header)
 
 setAllowDirectoryCreation (bool $a_val)
 
 getAllowDirectoryCreation ()
 
 setAllowFileCreation (bool $a_val)
 Set allowed file creation. More...
 
 getAllowFileCreation ()
 
 listFiles (?ilTable2GUI $a_table_gui=null)
 
 getTable (string $a_dir, string $a_subdir)
 
 renameFileForm (string $a_file)
 
 renameFile ()
 
 cancelRename ()
 
 createDirectory ()
 
 uploadFile ()
 
 confirmDeleteFile (array $a_files)
 
 deleteFile ()
 
 unzipFile (?string $a_file=null)
 
 downloadFile (string $a_file)
 
 getActionCommands ()
 
 defineCommands ()
 

Data Fields

const PARAMETER_CDIR = "cdir"
 
const SESSION_LAST_COMMAND = "fsys_lastcomm"
 
const PARAMETER_NEWDIR = "newdir"
 
const PARAMETER_FHSH = "fhsh"
 
const POST_PARAM_FILE = "file"
 
const PARAM_RESETOFFSET = "resetoffset"
 
const PARAM_OLD_NAME = "old_name"
 
const PARAM_UPFILE = "upfile"
 
const POST_PARAM_NEW_NAME = "new_name"
 
const POST_PARAM_NEW_DIR = "new_dir"
 
const POST_PARAM_UPLOADED_FILE = "uploaded_file"
 

Protected Member Functions

 setPerformedCommand ($command, array $pars=[])
 
 parseCurrentDirectory ()
 
 getFileList (string $a_dir, ?string $a_subdir=null)
 
 getIncomingFiles ()
 

Protected Attributes

ilCtrlInterface $ctrl
 
bool $use_upload_directory = false
 
array $allowed_suffixes = []
 
array $forbidden_suffixes = []
 
ilLanguage $lng
 
string $main_absolute_dir
 
bool $post_dir_path = false
 
ilGlobalTemplateInterface $tpl
 
array $file_labels = []
 
bool $label_enable = false
 
bool $allow_directories = true
 
string $table_id = ''
 
string $title = ''
 
array $commands = []
 
string $label_header = ''
 
bool $directory_creation = false
 
bool $file_creation = false
 
ILIAS HTTP Wrapper WrapperFactory $wrapper
 
ILIAS Refinery Factory $refinery
 

Private Member Functions

 extCommand (int $a_nr)
 
 sanitizeCurrentDirectory ()
 

Detailed Description

File System Explorer GUI class.

Deprecated:

Definition at line 31 of file class.ilFileSystemGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilFileSystemGUI::__construct ( string  $main_absolute_directory)
Parameters
string$main_absolute_directory

Definition at line 68 of file class.ilFileSystemGUI.php.

References $DIC, ILIAS\Repository\ctrl(), defineCommands(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), setAllowDirectories(), setAllowDirectoryCreation(), and setAllowFileCreation().

69  {
70  global $DIC;
71 
72  $this->ctrl = $DIC->ctrl();
73  $this->lng = $DIC->language();
74  $this->tpl = $DIC->ui()->mainTemplate();
75  $this->wrapper = $DIC->http()->wrapper();
76  $this->refinery = $DIC->refinery();
77  $this->main_absolute_dir = realpath($main_absolute_directory);
78 
79  $this->defineCommands();
80 
81  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
82  $this->lng->loadLanguageModule("content");
83  $this->setAllowDirectories(true);
84  $this->setAllowDirectoryCreation(true);
85  $this->setAllowFileCreation(true);
86  }
setAllowDirectoryCreation(bool $a_val)
global $DIC
Definition: feed.php:28
setAllowDirectories(bool $a_val)
setAllowFileCreation(bool $a_val)
Set allowed file creation.
+ Here is the call graph for this function:

Member Function Documentation

◆ activateLabels()

ilFileSystemGUI::activateLabels ( bool  $a_act,
string  $a_label_header 
)

Definition at line 256 of file class.ilFileSystemGUI.php.

Referenced by ilObjFileBasedLMGUI\executeCommand().

256  : void
257  {
258  $this->label_enable = $a_act;
259  $this->label_header = $a_label_header;
260  }
+ Here is the caller graph for this function:

◆ addCommand()

ilFileSystemGUI::addCommand ( object  $a_obj,
string  $a_func,
string  $a_name,
bool  $a_single = true,
bool  $a_allow_dir = false 
)

Definition at line 230 of file class.ilFileSystemGUI.php.

References $i.

236  : void {
237  $i = count($this->commands);
238 
239  $this->commands[$i]["object"] = $a_obj;
240  $this->commands[$i]["method"] = $a_func;
241  $this->commands[$i]["name"] = $a_name;
242  $this->commands[$i]["single"] = $a_single;
243  $this->commands[$i]["allow_dir"] = $a_allow_dir;
244  }
$i
Definition: metadata.php:41

◆ cancelRename()

ilFileSystemGUI::cancelRename ( )

Definition at line 621 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\ctrl().

621  : void
622  {
623  $this->ctrl->redirect($this, "listFiles");
624  }
+ Here is the call graph for this function:

◆ clearCommands()

ilFileSystemGUI::clearCommands ( )

Definition at line 246 of file class.ilFileSystemGUI.php.

246  : void
247  {
248  $this->commands = [];
249  }

◆ confirmDeleteFile()

ilFileSystemGUI::confirmDeleteFile ( array  $a_files)

Definition at line 759 of file class.ilFileSystemGUI.php.

References $DIC, $i, ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

759  : void
760  {
761  global $DIC;
762  $ilCtrl = $DIC['ilCtrl'];
763  $tpl = $DIC['tpl'];
764  $lng = $DIC['lng'];
765 
766  $cgui = new ilConfirmationGUI();
767  $cgui->setFormAction($ilCtrl->getFormAction($this));
768  $cgui->setHeaderText($lng->txt("info_delete_sure"));
769  $cgui->setCancel($lng->txt("cancel"), "listFiles");
770  $cgui->setConfirm($lng->txt("delete"), "deleteFile");
771 
772  foreach ($a_files as $i) {
773  $cgui->addItem("file[]", $i, $i);
774  }
775 
776  $tpl->setContent($cgui->getHTML());
777  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilGlobalTemplateInterface $tpl
global $DIC
Definition: feed.php:28
setContent(string $a_html)
Sets content for standard template.
$i
Definition: metadata.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ createDirectory()

ilFileSystemGUI::createDirectory ( )

Definition at line 626 of file class.ilFileSystemGUI.php.

References $DIC, ILIAS\Repository\ctrl(), ilFileUtils\makeDir(), ILIAS\Repository\refinery(), sanitizeCurrentDirectory(), setPerformedCommand(), ilUtil\stripSlashes(), and ilLanguage\txt().

626  : void
627  {
628  global $DIC;
629  $lng = $DIC['lng'];
630 
631  // determine directory
632  $cur_subdir = $this->sanitizeCurrentDirectory();
633  $cur_dir = (!empty($cur_subdir))
634  ? $this->main_absolute_dir . "/" . $cur_subdir
635  : $this->main_absolute_dir;
636 
637  $new_dir = $this->wrapper->post()->has(self::POST_PARAM_NEW_DIR)
638  ? $this->wrapper->post()->retrieve(self::POST_PARAM_NEW_DIR, $this->refinery->to()->string())
639  : '';
640 
641  $new_dir = str_replace(".", "", ilUtil::stripSlashes($new_dir));
642  $new_dir = str_replace("/", "", $new_dir);
643 
644  if (!empty($new_dir)) {
645  ilFileUtils::makeDir($cur_dir . "/" . $new_dir);
646  if (is_dir($cur_dir . "/" . $new_dir)) {
647  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_dir_created"), true);
648  $this->setPerformedCommand("create_dir", array("name" => $new_dir));
649  }
650  } else {
651  $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_enter_a_dir_name"), true);
652  }
653  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
654  $this->ctrl->redirect($this, 'listFiles');
655  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
global $DIC
Definition: feed.php:28
setPerformedCommand($command, array $pars=[])
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ defineCommands()

ilFileSystemGUI::defineCommands ( )

Definition at line 928 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\lng().

Referenced by __construct().

928  : void
929  {
930  $this->commands = array(
931  0 => array(
932  "object" => $this,
933  "method" => "downloadFile",
934  "name" => $this->lng->txt("download"),
935  "int" => true,
936  "single" => true
937  ),
938  1 => array(
939  "object" => $this,
940  "method" => "confirmDeleteFile",
941  "name" => $this->lng->txt("delete"),
942  "allow_dir" => true,
943  "int" => true
944  ),
945  2 => array(
946  "object" => $this,
947  "method" => "unzipFile",
948  "name" => $this->lng->txt("unzip"),
949  "int" => true,
950  "single" => true,
951  "id" => "unzip_file"
952  ),
953  3 => array(
954  "object" => $this,
955  "method" => "renameFileForm",
956  "name" => $this->lng->txt("rename"),
957  "allow_dir" => true,
958  "int" => true,
959  "single" => true
960  ),
961  );
962  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFile()

ilFileSystemGUI::deleteFile ( )

Definition at line 779 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\ctrl(), ilFileUtils\delDir(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), sanitizeCurrentDirectory(), setPerformedCommand(), and ilUtil\stripSlashes().

779  : void
780  {
781  if (!$this->wrapper->post()->has(self::POST_PARAM_FILE)) {
782  throw new LogicException($this->lng->txt("no_checkbox"));
783  }
784  $is_dir = false;
785  $post_file = null;
786 
787  $postfiles = $this->wrapper->post()->retrieve(
788  self::POST_PARAM_FILE,
789  $this->refinery->to()->listOf(
790  $this->refinery->to()->string()
791  )
792  );
793  foreach ($postfiles as $post_file) {
794  if (ilUtil::stripSlashes($post_file) == "..") {
795  throw new LogicException($this->lng->txt("no_checkbox"));
796  break;
797  }
798 
799  $cur_subdir = $this->sanitizeCurrentDirectory();
800  $cur_dir = (!empty($cur_subdir))
801  ? $this->main_absolute_dir . "/" . $cur_subdir
802  : $this->main_absolute_dir;
803  $pi = pathinfo($post_file);
804  $file = $cur_dir . "/" . ilUtil::stripSlashes($pi["basename"]);
805 
806  if (is_file($file)) {
807  unlink($file);
808  }
809 
810  if (is_dir($file)) {
811  $is_dir = true;
812  ilFileUtils::delDir($file);
813  }
814  }
815 
816  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
817  if ($is_dir) {
818  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_dir_deleted"), true);
819  $this->setPerformedCommand(
820  "delete_dir",
821  array("name" => ilUtil::stripSlashes($post_file))
822  );
823  } else {
824  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_file_deleted"), true);
825  $this->setPerformedCommand(
826  "delete_file",
827  array("name" => ilUtil::stripSlashes($post_file))
828  );
829  }
830  $this->ctrl->redirect($this, 'listFiles');
831  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
setPerformedCommand($command, array $pars=[])
+ Here is the call graph for this function:

◆ downloadFile()

ilFileSystemGUI::downloadFile ( string  $a_file)

Definition at line 907 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\ctrl(), ilFileDelivery\deliverFileLegacy(), and exit.

907  : void
908  {
909  $file = $this->main_absolute_dir . "/" . $a_file;
910 
911  if (is_file($file) && !(is_dir($file))) {
912  ilFileDelivery::deliverFileLegacy($file, basename($a_file));
913  exit;
914  } else {
915  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
916  $this->ctrl->redirect($this, "listFiles");
917  }
918  }
exit
Definition: login.php:28
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
+ Here is the call graph for this function:

◆ executeCommand()

ilFileSystemGUI::executeCommand ( )

Definition at line 217 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\ctrl(), and extCommand().

217  : string
218  {
219  $next_class = $this->ctrl->getNextClass($this);
220  $cmd = $this->ctrl->getCmd("listFiles");
221  if (substr($cmd, 0, 11) == "extCommand_") {
222  $ret = $this->extCommand(substr($cmd, 11, strlen($cmd) - 11));
223  } else {
224  $ret = $this->$cmd();
225  }
226 
227  return $ret ?? '';
228  }
+ Here is the call graph for this function:

◆ extCommand()

ilFileSystemGUI::extCommand ( int  $a_nr)
private

Definition at line 379 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\ctrl(), getIncomingFiles(), ILIAS\Repository\lng(), sanitizeCurrentDirectory(), and ilUtil\stripSlashes().

Referenced by executeCommand().

379  : string
380  {
381  $selected = $this->getIncomingFiles();
382 
383  if (!count($selected)) {
384  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
385  $this->ctrl->redirect($this, "listFiles");
386  }
387 
388  // check if only one item is select, if command does not allow multiple selection
389  if (count($selected) > 1 && ($this->commands[$a_nr]["single"] ?? false)) {
390  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
391  $this->ctrl->redirect($this, "listFiles");
392  }
393 
394  $cur_subdir = $this->sanitizeCurrentDirectory();
395 
396  // collect files and
397  $files = array();
398  foreach ($selected as $file) {
399  $file = ilUtil::stripSlashes($file);
400  $file = (!empty($cur_subdir))
401  ? $cur_subdir . "/" . $file
402  : $file;
403 
404  // check wether selected item is a directory
405  if (is_dir($this->main_absolute_dir . "/" . $file) &&
406  !$this->commands[$a_nr]["allow_dir"]) {
407  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("select_a_file"), true);
408  $this->ctrl->redirect($this, "listFiles");
409  }
410 
411  $files[] = $file;
412  }
413 
414  if ($this->commands[$a_nr]["single"] ?? false) {
415  $files = array_shift($files);
416  }
417 
418  $obj = $this->commands[$a_nr]["object"];
419  $method = $this->commands[$a_nr]["method"];
420 
421  return (string) $obj->$method($files);
422  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActionCommands()

ilFileSystemGUI::getActionCommands ( )
Returns
string[]

Definition at line 923 of file class.ilFileSystemGUI.php.

References $commands.

Referenced by ilExAssignmentFileSystemGUI\getTable().

923  : array
924  {
925  return $this->commands;
926  }
+ Here is the caller graph for this function:

◆ getAllowDirectories()

ilFileSystemGUI::getAllowDirectories ( )

Definition at line 143 of file class.ilFileSystemGUI.php.

References $allow_directories.

Referenced by listFiles(), and unzipFile().

143  : bool
144  {
146  }
+ Here is the caller graph for this function:

◆ getAllowDirectoryCreation()

ilFileSystemGUI::getAllowDirectoryCreation ( )

Definition at line 429 of file class.ilFileSystemGUI.php.

References $directory_creation.

Referenced by listFiles().

429  : bool
430  {
432  }
+ Here is the caller graph for this function:

◆ getAllowedSuffixes()

ilFileSystemGUI::getAllowedSuffixes ( )
Returns
string[]

Definition at line 99 of file class.ilFileSystemGUI.php.

References $allowed_suffixes.

Referenced by isValidSuffix().

99  : array
100  {
102  }
+ Here is the caller graph for this function:

◆ getAllowFileCreation()

ilFileSystemGUI::getAllowFileCreation ( )

Definition at line 442 of file class.ilFileSystemGUI.php.

References $file_creation.

Referenced by listFiles().

442  : bool
443  {
444  return $this->file_creation;
445  }
+ Here is the caller graph for this function:

◆ getFileList()

ilFileSystemGUI::getFileList ( string  $a_dir,
?string  $a_subdir = null 
)
protected
Returns
array<int, array<string, mixed>>

Definition at line 309 of file class.ilFileSystemGUI.php.

References Vendor\Package\$e, and ilFileUtils\getDir().

Referenced by getIncomingFiles().

309  : array
310  {
311  $items = [];
312 
313  $entries = (is_dir($a_dir))
314  ? ilFileUtils::getDir($a_dir)
315  : array(array("type" => "dir", "entry" => ".."));
316 
317  $items = array();
318  foreach ($entries as $e) {
319  if (($e["entry"] == ".") ||
320  ($e["entry"] == ".." && empty($a_subdir))) {
321  continue;
322  }
323 
324  $cfile = (!empty($a_subdir))
325  ? $a_subdir . "/" . $e["entry"]
326  : $e["entry"];
327 
328  $items[] = array(
329  self::POST_PARAM_FILE => $cfile,
330  "entry" => $e["entry"],
331  "type" => $e["type"],
332  "size" => $e["size"] ?? 0,
333  "hash" => md5($e["entry"])
334  );
335  }
336 
337  return $items;
338  }
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getForbiddenSuffixes()

ilFileSystemGUI::getForbiddenSuffixes ( )
Returns
string[]

Definition at line 115 of file class.ilFileSystemGUI.php.

References $forbidden_suffixes.

Referenced by isValidSuffix().

115  : array
116  {
118  }
+ Here is the caller graph for this function:

◆ getIncomingFiles()

ilFileSystemGUI::getIncomingFiles ( )
protected
Returns
string[]

Definition at line 343 of file class.ilFileSystemGUI.php.

References getFileList(), getPostDirPath(), parseCurrentDirectory(), and ILIAS\Repository\refinery().

Referenced by extCommand().

343  : array
344  {
345  $sel_files = $hashes = [];
346  if ($this->wrapper->post()->has(self::POST_PARAM_FILE)) {
347  $hashes = $this->wrapper->post()->retrieve(
348  self::POST_PARAM_FILE,
349  $this->refinery->to()->listOf(
350  $this->refinery->to()->string()
351  )
352  );
353  } elseif ($this->wrapper->query()->has(self::PARAMETER_FHSH)) {
354  $hashes = [$this->wrapper->query()->retrieve(
355  self::PARAMETER_FHSH,
356  $this->refinery->to()->string()
357  )
358  ];
359  }
360 
361  if (count($hashes) > 0) {
362  $dir = $this->parseCurrentDirectory();
363  $all_files = $this->getFileList($dir["dir"], $dir["subdir"]);
364  foreach ($hashes as $hash) {
365  foreach ($all_files as $file) {
366  if ($file["hash"] == $hash) {
367  $sel_files[] = $this->getPostDirPath()
368  ? $file[self::POST_PARAM_FILE]
369  : $file["entry"];
370  break;
371  }
372  }
373  }
374  }
375 
376  return $sel_files;
377  }
getFileList(string $a_dir, ?string $a_subdir=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastPerformedCommand()

ilFileSystemGUI::getLastPerformedCommand ( )
Returns
string[]

Definition at line 207 of file class.ilFileSystemGUI.php.

References ilSession\get(), ilSession\has(), and ilSession\set().

207  : array
208  {
209  if (!ilSession::has(self::SESSION_LAST_COMMAND)) {
210  return [];
211  }
212  $ret = ilSession::get(self::SESSION_LAST_COMMAND);
213  ilSession::set(self::SESSION_LAST_COMMAND, null);
214  return (array) $ret;
215  }
static get(string $a_var)
static has($a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ getPostDirPath()

ilFileSystemGUI::getPostDirPath ( )

Definition at line 153 of file class.ilFileSystemGUI.php.

References $post_dir_path.

Referenced by getIncomingFiles(), ilExAssignmentFileSystemGUI\getTable(), and getTable().

153  : bool
154  {
155  return $this->post_dir_path;
156  }
+ Here is the caller graph for this function:

◆ getTable()

ilFileSystemGUI::getTable ( string  $a_dir,
string  $a_subdir 
)

Definition at line 506 of file class.ilFileSystemGUI.php.

References getPostDirPath(), and getTableId().

Referenced by listFiles().

507  {
508  return new ilFileSystemTableGUI(
509  $this,
510  "listFiles",
511  $a_dir,
512  $a_subdir,
513  $this->label_enable,
514  $this->file_labels,
515  $this->label_header,
516  $this->commands,
517  $this->getPostDirPath(),
518  $this->getTableId()
519  );
520  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableId()

ilFileSystemGUI::getTableId ( )

Definition at line 163 of file class.ilFileSystemGUI.php.

References $table_id.

Referenced by getTable().

163  : string
164  {
165  return $this->table_id;
166  }
+ Here is the caller graph for this function:

◆ getTitle()

ilFileSystemGUI::getTitle ( )

Definition at line 173 of file class.ilFileSystemGUI.php.

References $title.

Referenced by listFiles().

173  : string
174  {
175  return $this->title;
176  }
+ Here is the caller graph for this function:

◆ getUseUploadDirectory()

ilFileSystemGUI::getUseUploadDirectory ( )

Definition at line 183 of file class.ilFileSystemGUI.php.

References $use_upload_directory.

Referenced by listFiles().

183  : bool
184  {
186  }
+ Here is the caller graph for this function:

◆ isValidSuffix()

ilFileSystemGUI::isValidSuffix ( string  $a_suffix)

Definition at line 120 of file class.ilFileSystemGUI.php.

References getAllowedSuffixes(), and getForbiddenSuffixes().

Referenced by renameFile(), unzipFile(), and uploadFile().

120  : bool
121  {
122  if (empty($a_suffix)) {
123  return true;
124  }
125 
126  if (is_array($this->getForbiddenSuffixes()) && in_array($a_suffix, $this->getForbiddenSuffixes())) {
127  return false;
128  }
129  if (is_array($this->getAllowedSuffixes()) && in_array($a_suffix, $this->getAllowedSuffixes())) {
130  return true;
131  }
132  if (!is_array($this->getAllowedSuffixes()) || count($this->getAllowedSuffixes()) == 0) {
133  return true;
134  }
135  return false;
136  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ labelFile()

ilFileSystemGUI::labelFile ( string  $a_file,
string  $a_label 
)

Definition at line 251 of file class.ilFileSystemGUI.php.

251  : void
252  {
253  $this->file_labels[$a_file][] = $a_label;
254  }

◆ listFiles()

ilFileSystemGUI::listFiles ( ?ilTable2GUI  $a_table_gui = null)

Definition at line 447 of file class.ilFileSystemGUI.php.

References $DIC, ilUploadFiles\_getUploadDirectory(), ilUploadFiles\_getUploadFiles(), ILIAS\Repository\ctrl(), getAllowDirectories(), getAllowDirectoryCreation(), getAllowFileCreation(), getTable(), getTitle(), getUseUploadDirectory(), ILIAS\Repository\lng(), parseCurrentDirectory(), ILIAS\Repository\refinery(), ilFileInputGUI\setSize(), and ilLanguage\txt().

447  : void
448  {
449  global $DIC;
450  $ilToolbar = $DIC['ilToolbar'];
451  $lng = $DIC['lng'];
452  $ilCtrl = $DIC['ilCtrl'];
453 
454  $dir = $this->parseCurrentDirectory();
455 
456  $this->ctrl->setParameter($this, self::PARAMETER_CDIR, $dir["subdir"]);
457 
458  // toolbar for adding files/directories
459  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
460 
461  if ($this->getAllowDirectories() && $this->getAllowDirectoryCreation()) {
462  $ti = new ilTextInputGUI($this->lng->txt("cont_new_dir"), self::POST_PARAM_NEW_DIR);
463  $ti->setMaxLength(80);
464  $ti->setSize(10);
465  $ilToolbar->addInputItem($ti, true);
466  $ilToolbar->addFormButton($lng->txt("create"), "createDirectory");
467 
468  $ilToolbar->addSeparator();
469  }
470  if ($this->getAllowFileCreation()) {
471  $fi = new ilFileInputGUI($this->lng->txt("cont_new_file"), "new_file");
472  $fi->setSize(10);
473  $ilToolbar->addInputItem($fi, true);
474  $ilToolbar->addFormButton($lng->txt("upload"), "uploadFile");
475  }
477  $ilToolbar->addSeparator();
479  $options[""] = $lng->txt("cont_select_from_upload_dir");
480  foreach ($files as $file) {
481  $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
482  $options[$file] = $file;
483  }
484  $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), self::POST_PARAM_UPLOADED_FILE);
485  $si->setOptions($options);
486  $ilToolbar->addInputItem($si, true);
487  $ilToolbar->addFormButton($lng->txt("copy"), "uploadFile");
488  }
489 
490  $fs_table = $this->getTable($dir["dir"], $dir["subdir"]);
491 
492  if ($this->getTitle() != "") {
493  $fs_table->setTitle($this->getTitle());
494  }
495  if (
496  $this->wrapper->query()->has(self::PARAM_RESETOFFSET)
497  && $this->wrapper->query()->retrieve(
498  self::PARAM_RESETOFFSET,
499  $this->refinery->kindlyTo()->int()
500  ) == 1) {
501  $fs_table->resetOffset();
502  }
503  $this->tpl->setContent($fs_table->getHTML());
504  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a file property in a property form.
static _getUploadDirectory()
getTable(string $a_dir, string $a_subdir)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ parseCurrentDirectory()

ilFileSystemGUI::parseCurrentDirectory ( )
protected
Returns
array<string, mixed>

Definition at line 265 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\refinery(), and ilUtil\stripSlashes().

Referenced by getIncomingFiles(), and listFiles().

265  : array
266  {
267  // determine directory
268  // FIXME: I have to call stripSlashes here twice, because I could not
269  // determine where the second layer of slashes is added to the
270  // URL Parameter
271 
272  $cur_subdir = $this->wrapper->query()->has(self::PARAMETER_CDIR)
273  ? $this->wrapper->query()->retrieve(self::PARAMETER_CDIR, $this->refinery->to()->string())
274  : '';
275 
276  $new_subdir = $this->wrapper->query()->has(self::PARAMETER_NEWDIR)
277  ? $this->wrapper->query()->retrieve(self::PARAMETER_NEWDIR, $this->refinery->to()->string())
278  : '';
279 
280  $cur_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($cur_subdir));
281  $new_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($new_subdir));
282 
283  if ($new_subdir === "..") {
284  $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
285  } else {
286  if (!empty($new_subdir)) {
287  if (!empty($cur_subdir)) {
288  $cur_subdir = $cur_subdir . "/" . $new_subdir;
289  } else {
290  $cur_subdir = $new_subdir;
291  }
292  }
293  }
294 
295  $cur_subdir = str_replace("..", "", $cur_subdir);
296  $cur_dir = (!empty($cur_subdir))
297  ? $this->main_absolute_dir . "/" . $cur_subdir
298  : $this->main_absolute_dir;
299 
300  return [
301  "dir" => realpath($cur_dir),
302  "subdir" => $cur_subdir
303  ];
304  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renameFile()

ilFileSystemGUI::renameFile ( )

Definition at line 552 of file class.ilFileSystemGUI.php.

References Vendor\Package\$e, ILIAS\Repository\ctrl(), isValidSuffix(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilFileUtils\rename(), ilFileUtils\renameExecutables(), sanitizeCurrentDirectory(), setPerformedCommand(), and ilUtil\stripSlashes().

552  : void
553  {
554  $new_name = $this->wrapper->post()->has(self::POST_PARAM_NEW_NAME)
555  ? $this->wrapper->post()->retrieve(self::POST_PARAM_NEW_NAME, $this->refinery->to()->string())
556  : '';
557 
558  $new_name = str_replace("..", "", ilUtil::stripSlashes($new_name));
559  $new_name = str_replace("/", "", $new_name);
560  if ($new_name === "") {
561  throw new LogicException($this->lng->txt("enter_new_name"));
562  }
563 
564  $pi = pathinfo($new_name);
565  $suffix = $pi["extension"] ?? "";
566  if ($suffix != "" && !$this->isValidSuffix($suffix)) {
567  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("file_no_valid_file_type") . " ($suffix)", true);
568  $this->ctrl->redirect($this, "listFiles");
569  }
570 
571  $cur_subdir = $this->sanitizeCurrentDirectory();
572  $dir = (!empty($cur_subdir))
573  ? $this->main_absolute_dir . "/" . $cur_subdir . "/"
574  : $this->main_absolute_dir . "/";
575 
576  $old_name = $this->wrapper->query()->has(self::PARAM_OLD_NAME)
577  ? $this->wrapper->query()->retrieve(self::PARAM_OLD_NAME, $this->refinery->to()->string())
578  : null;
579 
580  // check if this path is inside $dir
581  $old_name = ilUtil::stripSlashes($old_name);
582  $realpath = realpath($dir . $old_name);
583  if (strpos($realpath, realpath($dir)) !== 0) {
584  throw new ilException($this->lng->txt("no_permission"));
585  }
586 
587  if (is_dir($dir . $old_name)) {
588  rename($dir . $old_name, $dir . $new_name);
589  } else {
590  try {
591  ilFileUtils::rename($dir . $old_name, $dir . $new_name);
592  } catch (ilException $e) {
593  $this->tpl->setOnScreenMessage('failure', $e->getMessage(), true);
594  $this->ctrl->redirect($this, "listFiles");
595  }
596  }
597 
598  ilFileUtils::renameExecutables($this->main_absolute_dir);
599  if (is_dir($dir . $new_name)) {
600  $this->tpl->setOnScreenMessage(
601  'success',
602  $this->lng->txt("cont_dir_renamed"),
603  true
604  );
605  $this->setPerformedCommand("rename_dir", [self::PARAM_OLD_NAME => $old_name,
606  self::POST_PARAM_NEW_NAME => $new_name
607  ]);
608  } else {
609  $this->tpl->setOnScreenMessage(
610  'success',
611  $this->lng->txt("cont_file_renamed"),
612  true
613  );
614  $this->setPerformedCommand("rename_file", array(self::PARAM_OLD_NAME => $old_name,
615  self::POST_PARAM_NEW_NAME => $new_name
616  ));
617  }
618  $this->ctrl->redirect($this, "listFiles");
619  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static renameExecutables(string $a_dir)
isValidSuffix(string $a_suffix)
setPerformedCommand($command, array $pars=[])
static rename(string $a_source, string $a_target)
+ Here is the call graph for this function:

◆ renameFileForm()

ilFileSystemGUI::renameFileForm ( string  $a_file)

Definition at line 522 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and sanitizeCurrentDirectory().

522  : void
523  {
524  $cur_subdir = $this->sanitizeCurrentDirectory();
525  $file = $this->main_absolute_dir . "/" . $a_file;
526 
527  $this->ctrl->setParameter($this, self::PARAM_OLD_NAME, basename($a_file));
528  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
529  $form = new ilPropertyFormGUI();
530 
531  // file/dir name
532  $ti = new ilTextInputGUI($this->lng->txt("name"), self::POST_PARAM_NEW_NAME);
533  $ti->setMaxLength(200);
534  $ti->setSize(40);
535  $ti->setValue(basename($a_file));
536  $form->addItem($ti);
537 
538  // save and cancel commands
539  $form->addCommandButton("renameFile", $this->lng->txt("rename"));
540  $form->addCommandButton("cancelRename", $this->lng->txt("cancel"));
541  $form->setFormAction($this->ctrl->getFormAction($this, "renameFile"));
542 
543  if (is_dir($file)) {
544  $form->setTitle($this->lng->txt("cont_rename_dir"));
545  } else {
546  $form->setTitle($this->lng->txt("rename_file"));
547  }
548 
549  $this->tpl->setContent($form->getHTML());
550  }
+ Here is the call graph for this function:

◆ sanitizeCurrentDirectory()

ilFileSystemGUI::sanitizeCurrentDirectory ( )
private

Definition at line 964 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\refinery(), and ilUtil\stripSlashes().

Referenced by createDirectory(), deleteFile(), extCommand(), renameFile(), renameFileForm(), unzipFile(), and uploadFile().

964  : string
965  {
966  $cur_subdir = $this->wrapper->query()->has(self::PARAMETER_CDIR)
967  ? $this->wrapper->query()->retrieve(self::PARAMETER_CDIR, $this->refinery->to()->string())
968  : '';
969 
970  return str_replace(
971  "..",
972  "",
973  ilUtil::stripSlashes($cur_subdir)
974  );
975  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAllowDirectories()

ilFileSystemGUI::setAllowDirectories ( bool  $a_val)

Definition at line 138 of file class.ilFileSystemGUI.php.

Referenced by __construct().

138  : void
139  {
140  $this->allow_directories = $a_val;
141  }
+ Here is the caller graph for this function:

◆ setAllowDirectoryCreation()

ilFileSystemGUI::setAllowDirectoryCreation ( bool  $a_val)

Definition at line 424 of file class.ilFileSystemGUI.php.

Referenced by __construct().

424  : void
425  {
426  $this->directory_creation = $a_val;
427  }
+ Here is the caller graph for this function:

◆ setAllowedSuffixes()

ilFileSystemGUI::setAllowedSuffixes ( array  $a_suffixes)
Parameters
string[]$a_suffixes

Definition at line 91 of file class.ilFileSystemGUI.php.

Referenced by ilObjMediaObjectGUI\returnToContextObject().

91  : void
92  {
93  $this->allowed_suffixes = $a_suffixes;
94  }
+ Here is the caller graph for this function:

◆ setAllowFileCreation()

ilFileSystemGUI::setAllowFileCreation ( bool  $a_val)

Set allowed file creation.

Definition at line 437 of file class.ilFileSystemGUI.php.

Referenced by __construct().

437  : void
438  {
439  $this->file_creation = $a_val;
440  }
+ Here is the caller graph for this function:

◆ setForbiddenSuffixes()

ilFileSystemGUI::setForbiddenSuffixes ( array  $a_suffixes)
Parameters
string[]$a_suffixes

Definition at line 107 of file class.ilFileSystemGUI.php.

107  : void
108  {
109  $this->forbidden_suffixes = $a_suffixes;
110  }

◆ setPerformedCommand()

ilFileSystemGUI::setPerformedCommand (   $command,
array  $pars = [] 
)
protected
Parameters
array | string$command
array$pars
Returns
void

Definition at line 193 of file class.ilFileSystemGUI.php.

References ilSession\set().

Referenced by createDirectory(), deleteFile(), renameFile(), unzipFile(), and uploadFile().

193  : void
194  {
195  if (!is_array($pars)) {
196  $pars = [];
197  }
198  ilSession::set(self::SESSION_LAST_COMMAND, array_merge(
199  ["cmd" => $command],
200  $pars
201  ));
202  }
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPostDirPath()

ilFileSystemGUI::setPostDirPath ( bool  $a_val)

Definition at line 148 of file class.ilFileSystemGUI.php.

Referenced by ilObjMediaPoolGUI\executeCommand().

148  : void
149  {
150  $this->post_dir_path = $a_val;
151  }
+ Here is the caller graph for this function:

◆ setTableId()

ilFileSystemGUI::setTableId ( string  $a_val)

Definition at line 158 of file class.ilFileSystemGUI.php.

Referenced by ilExPeerReviewGUI\executeCommand(), and ilExerciseManagementGUI\executeCommand().

158  : void
159  {
160  $this->table_id = $a_val;
161  }
+ Here is the caller graph for this function:

◆ setTitle()

ilFileSystemGUI::setTitle ( string  $a_val)

Definition at line 168 of file class.ilFileSystemGUI.php.

Referenced by ilExAssignmentEditorGUI\executeCommand().

168  : void
169  {
170  $this->title = $a_val;
171  }
+ Here is the caller graph for this function:

◆ setUseUploadDirectory()

ilFileSystemGUI::setUseUploadDirectory ( bool  $a_val)

Definition at line 178 of file class.ilFileSystemGUI.php.

Referenced by ilObjSAHSLearningModuleGUI\executeCommand().

178  : void
179  {
180  $this->use_upload_directory = $a_val;
181  }
+ Here is the caller graph for this function:

◆ unzipFile()

ilFileSystemGUI::unzipFile ( ?string  $a_file = null)

Definition at line 833 of file class.ilFileSystemGUI.php.

References $d, Vendor\Package\$f, $path, ILIAS\Repository\ctrl(), getAllowDirectories(), ilFileUtils\getDir(), isValidSuffix(), ILIAS\Repository\lng(), ilFileUtils\recursive_dirscan(), ILIAS\Repository\refinery(), ilFileUtils\renameExecutables(), sanitizeCurrentDirectory(), setPerformedCommand(), and ilFileUtils\unzip().

833  : void
834  {
835  // #17470 - direct unzip call (after upload)
836  $upname = $this->wrapper->query()->has(self::PARAM_UPFILE)
837  ? $this->wrapper->query()->retrieve(self::PARAM_UPFILE, $this->refinery->to()->string())
838  : null;
839  if (is_null($a_file) && $upname !== null) {
840  $a_file = basename($upname);
841  }
842 
843  $cur_subdir = $this->sanitizeCurrentDirectory();
844  $cur_dir = (!empty($cur_subdir))
845  ? $this->main_absolute_dir . "/" . $cur_subdir
846  : $this->main_absolute_dir;
847  $a_file = $this->main_absolute_dir . "/" . $a_file;
848 
849  if (is_file($a_file)) {
850  $cur_files = array_keys(ilFileUtils::getDir($cur_dir));
851  $cur_files_r = iterator_to_array(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cur_dir)));
852 
853  if ($this->getAllowDirectories()) {
854  ilFileUtils::unzip($a_file, true);
855  } else {
856  ilFileUtils::unzip($a_file, true, true);
857  }
858 
859  $new_files = array_keys(ilFileUtils::getDir($cur_dir));
860  $new_files_r = iterator_to_array(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cur_dir)));
861 
862  $diff = array_diff($new_files, $cur_files);
863  $diff_r = array_diff($new_files_r, $cur_files_r);
864 
865  // unlink forbidden file types
866  foreach ($diff_r as $f => $d) {
867  $pi = pathinfo($f);
868  if (!is_dir($f) && !$this->isValidSuffix(strtolower($pi["extension"] ?? ''))) {
869  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("file_some_invalid_file_types_removed") . " (" . $pi["extension"] . ")", true);
870  unlink($f);
871  }
872  }
873 
874  if (sizeof($diff)) {
875  if ($this->getAllowDirectories()) {
876  $new_files = array();
877 
878  foreach ($diff as $new_item) {
879  if (is_dir($cur_dir . "/" . $new_item)) {
880  ilFileUtils::recursive_dirscan($cur_dir . "/" . $new_item, $new_files);
881  }
882  }
883 
884  if (isset($new_files["path"])) {
885  foreach ($new_files["path"] as $idx => $path) {
886  $path = substr($path, strlen($this->main_absolute_dir) + 1);
887  $diff[] = $path . $new_files[self::POST_PARAM_FILE][$idx];
888  }
889  }
890  }
891 
892  $this->setPerformedCommand(
893  "unzip_file",
894  array("added" => $diff
895  )
896  );
897  }
898  }
899 
900  ilFileUtils::renameExecutables($this->main_absolute_dir);
901 
902  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
903  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_file_unzipped"), true);
904  $this->ctrl->redirect($this, "listFiles");
905  }
$path
Definition: ltiservices.php:32
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static renameExecutables(string $a_dir)
isValidSuffix(string $a_suffix)
static recursive_dirscan(string $dir, array &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
setPerformedCommand($command, array $pars=[])
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:

◆ uploadFile()

ilFileSystemGUI::uploadFile ( )

Definition at line 657 of file class.ilFileSystemGUI.php.

References $DIC, $name, $url, ilUploadFiles\_checkUploadFile(), ilUploadFiles\_copyUploadFile(), ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), isValidSuffix(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilFileUtils\renameExecutables(), sanitizeCurrentDirectory(), setPerformedCommand(), ilUtil\stripSlashes(), and ilLanguage\txt().

657  : void
658  {
659  global $DIC;
660  $lng = $DIC['lng'];
661 
662  // determine directory
663  $cur_subdir = $this->sanitizeCurrentDirectory();
664  $cur_dir = (!empty($cur_subdir))
665  ? $this->main_absolute_dir . "/" . $cur_subdir
666  : $this->main_absolute_dir;
667 
668  $tgt_file = null;
669 
670  $pi = pathinfo($_FILES["new_file"]["name"]);
671  $suffix = $pi["extension"] ?? "";
672  if (!$this->isValidSuffix($suffix)) {
673  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("file_no_valid_file_type") . " ($suffix)", true);
674  $this->ctrl->redirect($this, "listFiles");
675  }
676 
677  $uploaded_file = $this->wrapper->post()->has(self::POST_PARAM_UPLOADED_FILE)
678  ? $this->wrapper->post()->retrieve(self::POST_PARAM_UPLOADED_FILE, $this->refinery->to()->string())
679  : '';
680  if (is_file($_FILES["new_file"]["tmp_name"])) {
681  $name = $this->secure(ilUtil::stripSlashes($_FILES["new_file"]["name"]));
682  $tgt_file = $cur_dir . "/" . $name;
683 
684  // use filesystem directly
685  //ilFileUtils::moveUploadedFile(, $name, $tgt_file);
686  $upload = $DIC->upload();
687 
688  // If the upload has not yet been processed make sure he gets processed now.
689  if (!$upload->hasBeenProcessed()) {
690  $upload->process();
691  }
692 
693 
694  if (!$upload->hasUploads()) {
695  throw new ilException(
696  $DIC->language()->txt("upload_error_file_not_found")
697  );
698  }
699  $upload_result = $upload->getResults()[$_FILES["new_file"]["tmp_name"]];
700  if ($upload_result instanceof UploadResult) {
701  $processing_status = $upload_result->getStatus();
702  if ($processing_status->getCode() === ProcessingStatus::REJECTED) {
703  $this->tpl->setOnScreenMessage(
704  'failure',
705  $processing_status->getMessage(),
706  true
707  );
708  $this->ctrl->redirect($this, "listFiles");
709  }
710  }
711 
712  $upload->moveOneFileTo(
713  $upload_result,
714  LegacyPathHelper::createRelativePath($cur_dir . "/"),
715  LegacyPathHelper::deriveLocationFrom($cur_dir),
716  $name,
717  true
718  );
719  // end upload
720  } elseif ($uploaded_file) {
721  // check if the file is in the ftp directory and readable
722  if (ilUploadFiles::_checkUploadFile($uploaded_file)) {
723  $tgt_file = $cur_dir . "/" . ilUtil::stripSlashes($uploaded_file);
724 
725  // copy uploaded file to data directory
726  ilUploadFiles::_copyUploadFile($uploaded_file, $tgt_file);
727  }
728  } elseif (trim($_FILES["new_file"]["name"]) == "") {
729  $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_enter_a_file"), true);
730  }
731 
732  if ($tgt_file && is_file($tgt_file)) {
733  $unzip = null;
734  if (MimeType::getMimeType($tgt_file) == "application/zip") {
735  $this->ctrl->setParameter($this, self::PARAM_UPFILE, basename($tgt_file));
736  $url = $this->ctrl->getLinkTarget($this, "unzipFile");
737  $this->ctrl->setParameter($this, self::PARAM_UPFILE, "");
738  $unzip = ilLinkButton::getInstance();
739  $unzip->setCaption("unzip");
740  $unzip->setUrl($url);
741  $unzip = " " . $unzip->render();
742  }
743 
744  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_file_created") . $unzip, true);
745 
746  $this->setPerformedCommand(
747  "create_file",
748  array("name" => substr($tgt_file, strlen($this->main_absolute_dir) + 1))
749  );
750  }
751 
752  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
753 
754  ilFileUtils::renameExecutables($this->main_absolute_dir);
755 
756  $this->ctrl->redirect($this, 'listFiles');
757  }
static _copyUploadFile(string $a_file, string $a_target, bool $a_raise_errors=true)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
global $DIC
Definition: feed.php:28
static renameExecutables(string $a_dir)
isValidSuffix(string $a_suffix)
if($format !==null) $name
Definition: metadata.php:247
static _checkUploadFile(string $a_file)
setPerformedCommand($command, array $pars=[])
$url
+ Here is the call graph for this function:

Field Documentation

◆ $allow_directories

bool ilFileSystemGUI::$allow_directories = true
protected

Definition at line 55 of file class.ilFileSystemGUI.php.

Referenced by getAllowDirectories().

◆ $allowed_suffixes

array ilFileSystemGUI::$allowed_suffixes = []
protected

Definition at line 47 of file class.ilFileSystemGUI.php.

Referenced by getAllowedSuffixes().

◆ $commands

array ilFileSystemGUI::$commands = []
protected

Definition at line 58 of file class.ilFileSystemGUI.php.

Referenced by getActionCommands().

◆ $ctrl

ilCtrlInterface ilFileSystemGUI::$ctrl
protected

◆ $directory_creation

bool ilFileSystemGUI::$directory_creation = false
protected

Definition at line 60 of file class.ilFileSystemGUI.php.

Referenced by getAllowDirectoryCreation().

◆ $file_creation

bool ilFileSystemGUI::$file_creation = false
protected

Definition at line 61 of file class.ilFileSystemGUI.php.

Referenced by getAllowFileCreation().

◆ $file_labels

array ilFileSystemGUI::$file_labels = []
protected

Definition at line 53 of file class.ilFileSystemGUI.php.

◆ $forbidden_suffixes

array ilFileSystemGUI::$forbidden_suffixes = []
protected

Definition at line 48 of file class.ilFileSystemGUI.php.

Referenced by getForbiddenSuffixes().

◆ $label_enable

bool ilFileSystemGUI::$label_enable = false
protected

Definition at line 54 of file class.ilFileSystemGUI.php.

◆ $label_header

string ilFileSystemGUI::$label_header = ''
protected

Definition at line 59 of file class.ilFileSystemGUI.php.

◆ $lng

ilLanguage ilFileSystemGUI::$lng
protected

Definition at line 49 of file class.ilFileSystemGUI.php.

◆ $main_absolute_dir

string ilFileSystemGUI::$main_absolute_dir
protected

Definition at line 50 of file class.ilFileSystemGUI.php.

◆ $post_dir_path

bool ilFileSystemGUI::$post_dir_path = false
protected

Definition at line 51 of file class.ilFileSystemGUI.php.

Referenced by getPostDirPath().

◆ $refinery

ILIAS Refinery Factory ilFileSystemGUI::$refinery
protected

Definition at line 63 of file class.ilFileSystemGUI.php.

◆ $table_id

string ilFileSystemGUI::$table_id = ''
protected

Definition at line 56 of file class.ilFileSystemGUI.php.

Referenced by getTableId().

◆ $title

string ilFileSystemGUI::$title = ''
protected

Definition at line 57 of file class.ilFileSystemGUI.php.

Referenced by getTitle().

◆ $tpl

ilGlobalTemplateInterface ilFileSystemGUI::$tpl
protected

Definition at line 52 of file class.ilFileSystemGUI.php.

◆ $use_upload_directory

bool ilFileSystemGUI::$use_upload_directory = false
protected

Definition at line 46 of file class.ilFileSystemGUI.php.

Referenced by getUseUploadDirectory().

◆ $wrapper

ILIAS HTTP Wrapper WrapperFactory ilFileSystemGUI::$wrapper
protected

Definition at line 62 of file class.ilFileSystemGUI.php.

◆ PARAM_OLD_NAME

const ilFileSystemGUI::PARAM_OLD_NAME = "old_name"

Definition at line 40 of file class.ilFileSystemGUI.php.

◆ PARAM_RESETOFFSET

const ilFileSystemGUI::PARAM_RESETOFFSET = "resetoffset"

Definition at line 39 of file class.ilFileSystemGUI.php.

◆ PARAM_UPFILE

const ilFileSystemGUI::PARAM_UPFILE = "upfile"

Definition at line 41 of file class.ilFileSystemGUI.php.

◆ PARAMETER_CDIR

const ilFileSystemGUI::PARAMETER_CDIR = "cdir"

Definition at line 34 of file class.ilFileSystemGUI.php.

◆ PARAMETER_FHSH

const ilFileSystemGUI::PARAMETER_FHSH = "fhsh"

Definition at line 37 of file class.ilFileSystemGUI.php.

◆ PARAMETER_NEWDIR

const ilFileSystemGUI::PARAMETER_NEWDIR = "newdir"

Definition at line 36 of file class.ilFileSystemGUI.php.

◆ POST_PARAM_FILE

const ilFileSystemGUI::POST_PARAM_FILE = "file"

Definition at line 38 of file class.ilFileSystemGUI.php.

◆ POST_PARAM_NEW_DIR

const ilFileSystemGUI::POST_PARAM_NEW_DIR = "new_dir"

Definition at line 43 of file class.ilFileSystemGUI.php.

◆ POST_PARAM_NEW_NAME

const ilFileSystemGUI::POST_PARAM_NEW_NAME = "new_name"

Definition at line 42 of file class.ilFileSystemGUI.php.

◆ POST_PARAM_UPLOADED_FILE

const ilFileSystemGUI::POST_PARAM_UPLOADED_FILE = "uploaded_file"

Definition at line 44 of file class.ilFileSystemGUI.php.

◆ SESSION_LAST_COMMAND

const ilFileSystemGUI::SESSION_LAST_COMMAND = "fsys_lastcomm"

Definition at line 35 of file class.ilFileSystemGUI.php.


The documentation for this class was generated from the following file: