ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilFileSystemGUI Class Reference

File System Explorer GUI class. More...

+ 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"
 
const CMD_UNZIP_FILE = "unzipFile"
 

Protected Member Functions

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

Protected Attributes

LegacyArchives $unzip
 
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
 
WrapperFactory $wrapper
 
ILIAS Refinery Factory $refinery
 

Private Member Functions

 extCommand (int $a_nr)
 
 sanitizeCurrentDirectory ()
 

Private Attributes

Factory $ui_factory
 
Renderer $ui_renderer
 

Detailed Description

File System Explorer GUI class.

Deprecated:
Will be removed in ILIAS 10. Use ILIAS ResourceStorageService as replacement.

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

75  {
76  global $DIC;
77 
78  $this->ctrl = $DIC->ctrl();
79  $this->lng = $DIC->language();
80  $this->tpl = $DIC->ui()->mainTemplate();
81  $this->wrapper = $DIC->http()->wrapper();
82  $this->refinery = $DIC->refinery();
83  $this->main_absolute_dir = realpath($main_absolute_directory);
84  $this->ui_factory = $DIC->ui()->factory();
85  $this->ui_renderer = $DIC->ui()->renderer();
86  $this->unzip = $DIC->legacyArchives();
87 
88  $this->defineCommands();
89 
90  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
91  $this->lng->loadLanguageModule("content");
92  $this->setAllowDirectories(true);
93  $this->setAllowDirectoryCreation(true);
94  $this->setAllowFileCreation(true);
95  }
setAllowDirectoryCreation(bool $a_val)
global $DIC
Definition: shib_login.php:22
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 262 of file class.ilFileSystemGUI.php.

262  : void
263  {
264  $this->label_enable = $a_act;
265  $this->label_header = $a_label_header;
266  }

◆ addCommand()

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

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

242  : void {
243  $i = count($this->commands);
244 
245  $this->commands[$i]["object"] = $a_obj;
246  $this->commands[$i]["method"] = $a_func;
247  $this->commands[$i]["name"] = $a_name;
248  $this->commands[$i]["single"] = $a_single;
249  $this->commands[$i]["allow_dir"] = $a_allow_dir;
250  }

◆ cancelRename()

ilFileSystemGUI::cancelRename ( )

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

References ILIAS\Repository\ctrl().

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

◆ clearCommands()

ilFileSystemGUI::clearCommands ( )

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

252  : void
253  {
254  $this->commands = [];
255  }

◆ confirmDeleteFile()

ilFileSystemGUI::confirmDeleteFile ( array  $a_files)

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

References $DIC, ILIAS\UICore\GlobalTemplate\setContent(), and ilLanguage\txt().

763  : void
764  {
765  global $DIC;
766  $ilCtrl = $DIC['ilCtrl'];
767  $tpl = $DIC['tpl'];
768  $lng = $DIC['lng'];
769 
770  $cgui = new ilConfirmationGUI();
771  $cgui->setFormAction($ilCtrl->getFormAction($this));
772  $cgui->setHeaderText($lng->txt("info_delete_sure"));
773  $cgui->setCancel($lng->txt("cancel"), "listFiles");
774  $cgui->setConfirm($lng->txt("delete"), "deleteFile");
775 
776  foreach ($a_files as $i) {
777  $cgui->addItem("file[]", $i, $i);
778  }
779 
780  $tpl->setContent($cgui->getHTML());
781  }
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
setContent(string $a_html)
Sets content for standard template.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ createDirectory()

ilFileSystemGUI::createDirectory ( )

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

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

627  : void
628  {
629  global $DIC;
630  $lng = $DIC['lng'];
631 
632  // determine directory
633  $cur_subdir = $this->sanitizeCurrentDirectory();
634  $cur_dir = (empty($cur_subdir))
635  ? $this->main_absolute_dir
636  : $this->main_absolute_dir . "/" . $cur_subdir;
637 
638  $new_dir = $this->wrapper->post()->has(self::POST_PARAM_NEW_DIR)
639  ? $this->wrapper->post()->retrieve(self::POST_PARAM_NEW_DIR, $this->refinery->to()->string())
640  : '';
641 
642  $new_dir = str_replace(".", "", ilUtil::stripSlashes($new_dir));
643  $new_dir = str_replace("/", "", $new_dir);
644 
645  if (!empty($new_dir)) {
646  ilFileUtils::makeDir($cur_dir . "/" . $new_dir);
647  if (is_dir($cur_dir . "/" . $new_dir)) {
648  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_dir_created"), true);
649  $this->setPerformedCommand("create_dir", ["name" => $new_dir]);
650  }
651  } else {
652  $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_enter_a_dir_name"), true);
653  }
654  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
655  $this->ctrl->redirect($this, 'listFiles');
656  }
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: shib_login.php:22
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 933 of file class.ilFileSystemGUI.php.

References ILIAS\Repository\lng().

Referenced by __construct().

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

◆ deleteFile()

ilFileSystemGUI::deleteFile ( )

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

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

783  : void
784  {
785  if (!$this->wrapper->post()->has(self::POST_PARAM_FILE)) {
786  throw new LogicException($this->lng->txt("no_checkbox"));
787  }
788  $is_dir = false;
789  $post_file = null;
790 
791  $postfiles = $this->wrapper->post()->retrieve(
792  self::POST_PARAM_FILE,
793  $this->refinery->to()->listOf(
794  $this->refinery->to()->string()
795  )
796  );
797  foreach ($postfiles as $post_file) {
798  if (ilUtil::stripSlashes($post_file) === "..") {
799  throw new LogicException($this->lng->txt("no_checkbox"));
800  break;
801  }
802 
803  $cur_subdir = $this->sanitizeCurrentDirectory();
804  $cur_dir = (empty($cur_subdir))
805  ? $this->main_absolute_dir
806  : $this->main_absolute_dir . "/" . $cur_subdir;
807  $pi = pathinfo((string) $post_file);
808  $file = $cur_dir . "/" . ilUtil::stripSlashes($pi["basename"]);
809 
810  if (is_file($file)) {
811  unlink($file);
812  }
813 
814  if (is_dir($file)) {
815  $is_dir = true;
816  ilFileUtils::delDir($file);
817  }
818  }
819 
820  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
821  if ($is_dir) {
822  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_dir_deleted"), true);
823  $this->setPerformedCommand(
824  "delete_dir",
825  ["name" => ilUtil::stripSlashes($post_file)]
826  );
827  } else {
828  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_file_deleted"), true);
829  $this->setPerformedCommand(
830  "delete_file",
831  ["name" => ilUtil::stripSlashes($post_file)]
832  );
833  }
834  $this->ctrl->redirect($this, 'listFiles');
835  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 913 of file class.ilFileSystemGUI.php.

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

913  : void
914  {
915  $file = $this->main_absolute_dir . "/" . $a_file;
916 
917  if (is_file($file) && !(is_dir($file))) {
918  ilFileDelivery::deliverFileLegacy($file, basename($a_file));
919  exit;
920  }
921  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
922  $this->ctrl->redirect($this, "listFiles");
923  }
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
exit
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:

◆ executeCommand()

ilFileSystemGUI::executeCommand ( )

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

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

223  : string
224  {
225  $next_class = $this->ctrl->getNextClass($this);
226  $cmd = $this->ctrl->getCmd("listFiles");
227  if (str_starts_with((string) $cmd, "extCommand_")) {
228  $ret = $this->extCommand(substr((string) $cmd, 11, strlen((string) $cmd) - 11));
229  } else {
230  $ret = $this->$cmd();
231  }
232 
233  return $ret ?? '';
234  }
+ Here is the call graph for this function:

◆ extCommand()

ilFileSystemGUI::extCommand ( int  $a_nr)
private

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

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

Referenced by executeCommand().

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

References $commands.

928  : array
929  {
930  return $this->commands;
931  }

◆ getAllowDirectories()

ilFileSystemGUI::getAllowDirectories ( )

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

References $allow_directories.

Referenced by listFiles(), and unzipFile().

149  : bool
150  {
152  }
+ Here is the caller graph for this function:

◆ getAllowDirectoryCreation()

ilFileSystemGUI::getAllowDirectoryCreation ( )

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

References $directory_creation.

Referenced by listFiles().

430  : bool
431  {
433  }
+ Here is the caller graph for this function:

◆ getAllowedSuffixes()

ilFileSystemGUI::getAllowedSuffixes ( )
Returns
string[]

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

References $allowed_suffixes.

Referenced by isValidSuffix().

108  : array
109  {
111  }
+ Here is the caller graph for this function:

◆ getAllowFileCreation()

ilFileSystemGUI::getAllowFileCreation ( )

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

References $file_creation.

Referenced by listFiles().

443  : bool
444  {
445  return $this->file_creation;
446  }
+ 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  : [["type" => "dir", "entry" => ".."]];
316 
317  $items = [];
318  foreach ($entries as $e) {
319  if ($e["entry"] == ".") {
320  continue;
321  }
322  if ($e["entry"] == ".." && empty($a_subdir)) {
323  continue;
324  }
325  $cfile = (empty($a_subdir))
326  ? $e["entry"]
327  : $a_subdir . "/" . $e["entry"];
328 
329  $items[] = [
330  self::POST_PARAM_FILE => $cfile,
331  "entry" => $e["entry"],
332  "type" => $e["type"],
333  "size" => $e["size"] ?? 0,
334  "hash" => md5((string) $e["entry"])
335  ];
336  }
337 
338  return $items;
339  }
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 124 of file class.ilFileSystemGUI.php.

References $forbidden_suffixes.

Referenced by isValidSuffix().

124  : array
125  {
127  }
+ Here is the caller graph for this function:

◆ getIncomingFiles()

ilFileSystemGUI::getIncomingFiles ( )
protected
Returns
string[]

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

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

Referenced by extCommand().

344  : array
345  {
346  $sel_files = $hashes = [];
347  if ($this->wrapper->post()->has(self::POST_PARAM_FILE)) {
348  $hashes = $this->wrapper->post()->retrieve(
349  self::POST_PARAM_FILE,
350  $this->refinery->to()->listOf(
351  $this->refinery->to()->string()
352  )
353  );
354  } elseif ($this->wrapper->query()->has(self::PARAMETER_FHSH)) {
355  $hashes = [$this->wrapper->query()->retrieve(
356  self::PARAMETER_FHSH,
357  $this->refinery->to()->string()
358  )
359  ];
360  }
361 
362  if (count($hashes) > 0) {
363  $dir = $this->parseCurrentDirectory();
364  $all_files = $this->getFileList($dir["dir"], $dir["subdir"]);
365  foreach ($hashes as $hash) {
366  foreach ($all_files as $file) {
367  if ($file["hash"] == $hash) {
368  $sel_files[] = $this->getPostDirPath()
369  ? $file[self::POST_PARAM_FILE]
370  : $file["entry"];
371  break;
372  }
373  }
374  }
375  }
376 
377  return $sel_files;
378  }
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 213 of file class.ilFileSystemGUI.php.

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

213  : array
214  {
215  if (!ilSession::has(self::SESSION_LAST_COMMAND)) {
216  return [];
217  }
218  $ret = ilSession::get(self::SESSION_LAST_COMMAND);
219  ilSession::set(self::SESSION_LAST_COMMAND, null);
220  return (array) $ret;
221  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 159 of file class.ilFileSystemGUI.php.

References $post_dir_path.

Referenced by getIncomingFiles(), and getTable().

159  : bool
160  {
161  return $this->post_dir_path;
162  }
+ Here is the caller graph for this function:

◆ getTable()

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

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

References getPostDirPath(), and getTableId().

Referenced by listFiles().

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

◆ getTableId()

ilFileSystemGUI::getTableId ( )

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

References $table_id.

Referenced by getTable().

169  : string
170  {
171  return $this->table_id;
172  }
+ Here is the caller graph for this function:

◆ getTitle()

ilFileSystemGUI::getTitle ( )

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

References $title.

Referenced by listFiles().

179  : string
180  {
181  return $this->title;
182  }
+ Here is the caller graph for this function:

◆ getUseUploadDirectory()

ilFileSystemGUI::getUseUploadDirectory ( )

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

References $use_upload_directory.

Referenced by listFiles().

189  : bool
190  {
192  }
+ Here is the caller graph for this function:

◆ isValidSuffix()

ilFileSystemGUI::isValidSuffix ( string  $a_suffix)

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

References getAllowedSuffixes(), and getForbiddenSuffixes().

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

129  : bool
130  {
131  if (empty($a_suffix)) {
132  return true;
133  }
134 
135  if (is_array($this->getForbiddenSuffixes()) && in_array($a_suffix, $this->getForbiddenSuffixes())) {
136  return false;
137  }
138  if (is_array($this->getAllowedSuffixes()) && in_array($a_suffix, $this->getAllowedSuffixes())) {
139  return true;
140  }
141  return !is_array($this->getAllowedSuffixes()) || count($this->getAllowedSuffixes()) == 0;
142  }
+ 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 257 of file class.ilFileSystemGUI.php.

257  : void
258  {
259  $this->file_labels[$a_file][] = $a_label;
260  }

◆ listFiles()

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

Definition at line 448 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(), ilSelectInputGUI\setOptions(), ilFileInputGUI\setSize(), and ilLanguage\txt().

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

◆ parseCurrentDirectory()

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

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

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

Referenced by getIncomingFiles(), and listFiles().

271  : array
272  {
273  // determine directory
274  // FIXME: I have to call stripSlashes here twice, because I could not
275  // determine where the second layer of slashes is added to the
276  // URL Parameter
277 
278  $cur_subdir = $this->wrapper->query()->has(self::PARAMETER_CDIR)
279  ? $this->wrapper->query()->retrieve(self::PARAMETER_CDIR, $this->refinery->to()->string())
280  : '';
281 
282  $new_subdir = $this->wrapper->query()->has(self::PARAMETER_NEWDIR)
283  ? $this->wrapper->query()->retrieve(self::PARAMETER_NEWDIR, $this->refinery->to()->string())
284  : '';
285 
286  $cur_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($cur_subdir));
287  $new_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($new_subdir));
288 
289  if ($new_subdir === "..") {
290  $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
291  } elseif (!empty($new_subdir)) {
292  $cur_subdir = empty($cur_subdir) ? $new_subdir : $cur_subdir . "/" . $new_subdir;
293  }
294 
295  $cur_subdir = str_replace("..", "", $cur_subdir);
296  $cur_dir = (empty($cur_subdir))
297  ? $this->main_absolute_dir
298  : $this->main_absolute_dir . "/" . $cur_subdir;
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 553 of file class.ilFileSystemGUI.php.

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

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

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

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

◆ sanitizeCurrentDirectory()

ilFileSystemGUI::sanitizeCurrentDirectory ( )
private

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

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

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

969  : string
970  {
971  $cur_subdir = $this->wrapper->query()->has(self::PARAMETER_CDIR)
972  ? $this->wrapper->query()->retrieve(self::PARAMETER_CDIR, $this->refinery->to()->string())
973  : '';
974 
975  return str_replace(
976  "..",
977  "",
978  ilUtil::stripSlashes($cur_subdir)
979  );
980  }
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 144 of file class.ilFileSystemGUI.php.

Referenced by __construct().

144  : void
145  {
146  $this->allow_directories = $a_val;
147  }
+ Here is the caller graph for this function:

◆ setAllowDirectoryCreation()

ilFileSystemGUI::setAllowDirectoryCreation ( bool  $a_val)

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

Referenced by __construct().

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

◆ setAllowedSuffixes()

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

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

100  : void
101  {
102  $this->allowed_suffixes = $a_suffixes;
103  }

◆ setAllowFileCreation()

ilFileSystemGUI::setAllowFileCreation ( bool  $a_val)

Set allowed file creation.

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

Referenced by __construct().

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

◆ setForbiddenSuffixes()

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

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

116  : void
117  {
118  $this->forbidden_suffixes = $a_suffixes;
119  }

◆ setPerformedCommand()

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

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

References ilSession\set().

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

199  : void
200  {
201  if (!is_array($pars)) {
202  $pars = [];
203  }
204  ilSession::set(self::SESSION_LAST_COMMAND, array_merge(
205  ["cmd" => $command],
206  $pars
207  ));
208  }
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 154 of file class.ilFileSystemGUI.php.

154  : void
155  {
156  $this->post_dir_path = $a_val;
157  }

◆ setTableId()

ilFileSystemGUI::setTableId ( string  $a_val)

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

164  : void
165  {
166  $this->table_id = $a_val;
167  }

◆ setTitle()

ilFileSystemGUI::setTitle ( string  $a_val)

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

174  : void
175  {
176  $this->title = $a_val;
177  }

◆ setUseUploadDirectory()

ilFileSystemGUI::setUseUploadDirectory ( bool  $a_val)

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

Referenced by ilObjSAHSLearningModuleGUI\executeCommand().

184  : void
185  {
186  $this->use_upload_directory = $a_val;
187  }
+ Here is the caller graph for this function:

◆ unzipFile()

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

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

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

837  : void
838  {
839  // #17470 - direct unzip call (after upload)
840  $upname = $this->wrapper->query()->has(self::PARAM_UPFILE)
841  ? $this->wrapper->query()->retrieve(self::PARAM_UPFILE, $this->refinery->to()->string())
842  : null;
843  if (is_null($a_file) && $upname !== null) {
844  $a_file = basename((string) $upname);
845  }
846 
847  $cur_subdir = $this->sanitizeCurrentDirectory();
848  $cur_dir = (empty($cur_subdir))
849  ? $this->main_absolute_dir
850  : $this->main_absolute_dir . "/" . $cur_subdir;
851  $a_file = $this->main_absolute_dir . "/" . $a_file;
852 
853  if (is_file($a_file)) {
854  $cur_files = array_keys(ilFileUtils::getDir($cur_dir));
855  $cur_files_r = iterator_to_array(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cur_dir)));
856 
857  $this->unzip->unzip(
858  $a_file,
859  null,
860  true,
861  !$this->getAllowDirectories(),
862  false
863  );
864 
865  $new_files = array_keys(ilFileUtils::getDir($cur_dir));
866  $new_files_r = iterator_to_array(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cur_dir)));
867 
868  $diff = array_diff($new_files, $cur_files);
869  $diff_r = array_diff($new_files_r, $cur_files_r);
870 
871  // unlink forbidden file types
872  foreach (array_keys($diff_r) as $f) {
873  $pi = pathinfo($f);
874  if (!is_dir($f) && !$this->isValidSuffix(strtolower($pi["extension"] ?? ''))) {
875  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("file_some_invalid_file_types_removed") . " (" . $pi["extension"] . ")", true);
876  unlink($f);
877  }
878  }
879 
880  if ($diff !== []) {
881  if ($this->getAllowDirectories()) {
882  $new_files = [];
883 
884  foreach ($diff as $new_item) {
885  if (is_dir($cur_dir . "/" . $new_item)) {
886  ilFileUtils::recursive_dirscan($cur_dir . "/" . $new_item, $new_files);
887  }
888  }
889 
890  if (isset($new_files["path"])) {
891  foreach ($new_files["path"] as $idx => $path) {
892  $path = substr((string) $path, strlen($this->main_absolute_dir) + 1);
893  $diff[] = $path . $new_files[self::POST_PARAM_FILE][$idx];
894  }
895  }
896  }
897 
898  $this->setPerformedCommand(
899  "unzip_file",
900  ["added" => $diff
901  ]
902  );
903  }
904  }
905 
906  ilFileUtils::renameExecutables($this->main_absolute_dir);
907 
908  $this->ctrl->saveParameter($this, self::PARAMETER_CDIR);
909  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_file_unzipped"), true);
910  $this->ctrl->redirect($this, "listFiles");
911  }
$path
Definition: ltiservices.php:29
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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=[])
+ Here is the call graph for this function:

◆ uploadFile()

ilFileSystemGUI::uploadFile ( )

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

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

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

Field Documentation

◆ $allow_directories

bool ilFileSystemGUI::$allow_directories = true
protected

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

Referenced by getAllowDirectories().

◆ $allowed_suffixes

array ilFileSystemGUI::$allowed_suffixes = []
protected

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

Referenced by getAllowedSuffixes().

◆ $commands

array ilFileSystemGUI::$commands = []
protected

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

Referenced by getActionCommands().

◆ $ctrl

ilCtrlInterface ilFileSystemGUI::$ctrl
protected

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

◆ $directory_creation

bool ilFileSystemGUI::$directory_creation = false
protected

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

Referenced by getAllowDirectoryCreation().

◆ $file_creation

bool ilFileSystemGUI::$file_creation = false
protected

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

Referenced by getAllowFileCreation().

◆ $file_labels

array ilFileSystemGUI::$file_labels = []
protected

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

◆ $forbidden_suffixes

array ilFileSystemGUI::$forbidden_suffixes = []
protected

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

Referenced by getForbiddenSuffixes().

◆ $label_enable

bool ilFileSystemGUI::$label_enable = false
protected

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

◆ $label_header

string ilFileSystemGUI::$label_header = ''
protected

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

◆ $lng

ilLanguage ilFileSystemGUI::$lng
protected

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

◆ $main_absolute_dir

string ilFileSystemGUI::$main_absolute_dir
protected

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

◆ $post_dir_path

bool ilFileSystemGUI::$post_dir_path = false
protected

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

Referenced by getPostDirPath().

◆ $refinery

ILIAS Refinery Factory ilFileSystemGUI::$refinery
protected

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

◆ $table_id

string ilFileSystemGUI::$table_id = ''
protected

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

Referenced by getTableId().

◆ $title

string ilFileSystemGUI::$title = ''
protected

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

Referenced by getTitle().

◆ $tpl

ilGlobalTemplateInterface ilFileSystemGUI::$tpl
protected

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

◆ $ui_factory

Factory ilFileSystemGUI::$ui_factory
private

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

◆ $ui_renderer

Renderer ilFileSystemGUI::$ui_renderer
private

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

◆ $unzip

LegacyArchives ilFileSystemGUI::$unzip
protected

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

Referenced by uploadFile().

◆ $use_upload_directory

bool ilFileSystemGUI::$use_upload_directory = false
protected

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

Referenced by getUseUploadDirectory().

◆ $wrapper

WrapperFactory ilFileSystemGUI::$wrapper
protected

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

◆ CMD_UNZIP_FILE

const ilFileSystemGUI::CMD_UNZIP_FILE = "unzipFile"

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

Referenced by ilFileSystemTableGUI\fillRow().

◆ PARAM_OLD_NAME

const ilFileSystemGUI::PARAM_OLD_NAME = "old_name"

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

◆ PARAM_RESETOFFSET

const ilFileSystemGUI::PARAM_RESETOFFSET = "resetoffset"

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

◆ PARAM_UPFILE

const ilFileSystemGUI::PARAM_UPFILE = "upfile"

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

◆ PARAMETER_CDIR

const ilFileSystemGUI::PARAMETER_CDIR = "cdir"

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

◆ PARAMETER_FHSH

const ilFileSystemGUI::PARAMETER_FHSH = "fhsh"

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

◆ PARAMETER_NEWDIR

const ilFileSystemGUI::PARAMETER_NEWDIR = "newdir"

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

◆ POST_PARAM_FILE

const ilFileSystemGUI::POST_PARAM_FILE = "file"

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

◆ POST_PARAM_NEW_DIR

const ilFileSystemGUI::POST_PARAM_NEW_DIR = "new_dir"

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

◆ POST_PARAM_NEW_NAME

const ilFileSystemGUI::POST_PARAM_NEW_NAME = "new_name"

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

◆ POST_PARAM_UPLOADED_FILE

const ilFileSystemGUI::POST_PARAM_UPLOADED_FILE = "uploaded_file"

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

◆ SESSION_LAST_COMMAND

const ilFileSystemGUI::SESSION_LAST_COMMAND = "fsys_lastcomm"

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


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