ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFileSystemGUI Class Reference

File System Explorer GUI class. More...

+ Collaboration diagram for ilFileSystemGUI:

Public Member Functions

 ilFileSystemGUI ($a_main_directory)
 
 setAllowDirectories ($a_val)
 Set allow directories. More...
 
 getAllowDirectories ()
 Get allow directories. More...
 
 setPostDirPath ($a_val)
 Set post dir path. More...
 
 getPostDirPath ()
 Get post dir path. More...
 
 setTableId ($a_val)
 Set table id. More...
 
 getTableId ()
 Get table id. More...
 
 setTitle ($a_val)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 getLastPerformedCommand ()
 Get performed command. More...
 
executeCommand ()
 execute command More...
 
 addCommand (&$a_obj, $a_func, $a_name, $a_single=true, $a_allow_dir=false)
 Add command. More...
 
 clearCommands ()
 Clear commands. More...
 
 labelFile ($a_file, $a_label)
 label a file More...
 
 activateLabels ($a_act, $a_label_header)
 activate file labels More...
 
extCommand ($a_nr)
 call external command More...
 
 setAllowDirectoryCreation ($a_val)
 Set allowed directory creation. More...
 
 getAllowDirectoryCreation ()
 Get allowed directory creation. More...
 
 setAllowFileCreation ($a_val)
 Set allowed file creation. More...
 
 getAllowFileCreation ()
 Get allowed file creation. More...
 
 listFiles ()
 list files More...
 
 renameFileForm ()
 list files More...
 
 renameFile ()
 rename a file More...
 
 cancelRename ()
 cancel renaming a file More...
 
 createDirectory ()
 create directory More...
 
 uploadFile ()
 upload file More...
 
 confirmDeleteFile ()
 Confirm file deletion. More...
 
 deleteFile ()
 delete object file More...
 
 unzipFile ()
 delete object file More...
 
 downloadFile ()
 delete object file More...
 
 getTabs (&$tabs_gui)
 get tabs More...
 

Data Fields

 $ctrl
 

Protected Member Functions

 setPerformedCommand ($command, $pars="")
 Set performed command. More...
 

Detailed Description

File System Explorer GUI class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ activateLabels()

ilFileSystemGUI::activateLabels (   $a_act,
  $a_label_header 
)

activate file labels

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

Referenced by ilObjFileBasedLMGUI\executeCommand(), and ilObjMediaObjectGUI\executeCommand().

237  {
238  $this->label_enable = $a_act;
239  $this->label_header = $a_label_header;
240  }
+ Here is the caller graph for this function:

◆ addCommand()

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

Add command.

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

205  {
206  $i = count($this->commands);
207 
208  $this->commands[$i]["object"] =& $a_obj;
209  $this->commands[$i]["method"] = $a_func;
210  $this->commands[$i]["name"] = $a_name;
211  $this->commands[$i]["single"] = $a_single;
212  $this->commands[$i]["allow_dir"] = $a_allow_dir;
213 
214  //$this->commands[] = $arr;
215  }

◆ cancelRename()

ilFileSystemGUI::cancelRename ( )

cancel renaming a file

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

529  {
530  $this->ctrl->redirect($this, "listFiles");
531  }

◆ clearCommands()

ilFileSystemGUI::clearCommands ( )

Clear commands.

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

221  {
222  $this->commands = array();
223  }

◆ confirmDeleteFile()

ilFileSystemGUI::confirmDeleteFile ( )

Confirm file deletion.

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

References $_POST, $ilCtrl, $lng, $tpl, and ilUtil\sendFailure().

626  {
627  global $ilCtrl, $tpl, $lng;
628 
629  if (!is_array($_POST["file"]) || count($_POST["file"]) == 0)
630  {
631  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
632  $ilCtrl->redirect($this, "listFile");
633  }
634  else
635  {
636  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
637  $cgui = new ilConfirmationGUI();
638  $cgui->setFormAction($ilCtrl->getFormAction($this));
639  $cgui->setHeaderText($lng->txt("info_delete_sure"));
640  $cgui->setCancel($lng->txt("cancel"), "listFiles");
641  $cgui->setConfirm($lng->txt("delete"), "deleteFile");
642 
643  foreach ($_POST["file"] as $i)
644  {
645  $cgui->addItem("file[]", $i, $i);
646  }
647 
648  $tpl->setContent($cgui->getHTML());
649  }
650  }
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:40
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDirectory()

ilFileSystemGUI::createDirectory ( )

create directory

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

References $_GET, $_POST, $lng, ilUtil\makeDir(), ilUtil\sendFailure(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

537  {
538  global $lng;
539 
540  // determine directory
541  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
542  $cur_dir = (!empty($cur_subdir))
543  ? $this->main_dir."/".$cur_subdir
544  : $this->main_dir;
545 
546  $new_dir = str_replace(".", "", ilUtil::stripSlashes($_POST["new_dir"]));
547  $new_dir = str_replace("/", "", $new_dir);
548 
549  if (!empty($new_dir))
550  {
551  ilUtil::makeDir($cur_dir."/".$new_dir);
552  if (is_dir($cur_dir."/".$new_dir))
553  {
554  ilUtil::sendSuccess($lng->txt("cont_dir_created"), true);
555  $this->setPerformedCommand("create_dir", array("name" => $new_dir));
556  }
557  }
558  else
559  {
560  ilUtil::sendFailure($lng->txt("cont_enter_a_dir_name"), true);
561  }
562  $this->ctrl->saveParameter($this, "cdir");
563  $this->ctrl->redirect($this, "listFiles");
564  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
global $lng
Definition: privfeed.php:40
setPerformedCommand($command, $pars="")
Set performed command.
+ Here is the call graph for this function:

◆ deleteFile()

ilFileSystemGUI::deleteFile ( )

delete object file

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

References $_GET, $_POST, $file, $lng, ilUtil\delDir(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

656  {
657  global $lng;
658 
659  if (!isset($_POST["file"]))
660  {
661  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
662  }
663 
664  foreach ($_POST["file"] as $post_file)
665  {
666  if (ilUtil::stripSlashes($post_file) == "..")
667  {
668  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
669  break;
670  }
671 
672  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
673  $cur_dir = (!empty($cur_subdir))
674  ? $this->main_dir."/".$cur_subdir
675  : $this->main_dir;
676  $file = $cur_dir."/".ilUtil::stripSlashes($post_file);
677 
678  if (@is_file($file))
679  {
680  unlink($file);
681  }
682 
683  if (@is_dir($file))
684  {
685  $is_dir = true;
687  }
688  }
689 
690  $this->ctrl->saveParameter($this, "cdir");
691  if ($is_dir)
692  {
693  ilUtil::sendSuccess($lng->txt("cont_dir_deleted"), true);
694  $this->setPerformedCommand("delete_dir",
695  array("name" => ilUtil::stripSlashes($post_file)));
696  }
697  else
698  {
699  ilUtil::sendSuccess($lng->txt("cont_file_deleted"), true);
700  $this->setPerformedCommand("delete_file",
701  array("name" => ilUtil::stripSlashes($post_file)));
702  }
703  $this->ctrl->redirect($this, "listFiles");
704  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:40
setPerformedCommand($command, $pars="")
Set performed command.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ downloadFile()

ilFileSystemGUI::downloadFile ( )

delete object file

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

References $_GET, $_POST, $file, $valid, ilUtil\deliverFile(), exit, ilUtil\getDir(), and ilUtil\stripSlashes().

752  {
753  if (!isset($_POST["file"]))
754  {
755  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
756  }
757 
758  if (count($_POST["file"]) > 1)
759  {
760  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
761  }
762 
763  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
764  $cur_dir = (!empty($cur_subdir))
765  ? $this->main_dir."/".$cur_subdir
766  : $this->main_dir;
767  $file = $cur_dir."/".$_POST["file"][0];
768 
769  // validate against files of current directory
770  $valid = false;
771  foreach(ilUtil::getDir($cur_dir) as $entry)
772  {
773  if($entry["type"] == "file" &&
774  $cur_dir."/".$entry["entry"] == $file)
775  {
776  $valid = true;
777  break;
778  }
779  }
780 
781  if (@is_file($file) && !(@is_dir($file)) && $valid)
782  {
783  ilUtil::deliverFile($file, $_POST["file"][0]);
784  exit;
785  }
786  else
787  {
788  $this->ctrl->saveParameter($this, "cdir");
789  $this->ctrl->redirect($this, "listFiles");
790  }
791  }
print $file
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
$valid
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
redirection script todo: (a better solution should control the processing via a xml file) ...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ executeCommand()

& ilFileSystemGUI::executeCommand ( )

execute command

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

References $cmd, $ret, and extCommand().

177  {
178  $next_class = $this->ctrl->getNextClass($this);
179  $cmd = $this->ctrl->getCmd();
180 
181  switch($next_class)
182  {
183 
184  default:
185  if (substr($cmd, 0, 11) == "extCommand_")
186  {
187  $ret =& $this->extCommand(substr($cmd, 11, strlen($cmd) - 11));
188  }
189  else
190  {
191  $ret =& $this->$cmd();
192  }
193  break;
194  }
195 
196  return $ret;
197  }
$cmd
Definition: sahs_server.php:35
& extCommand($a_nr)
call external command
+ Here is the call graph for this function:

◆ extCommand()

& ilFileSystemGUI::extCommand (   $a_nr)

call external command

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

References $_GET, $_POST, $file, and ilUtil\stripSlashes().

Referenced by executeCommand().

246  {
247  // remove ".." items
248  foreach ($_POST["file"] as $k => $v)
249  {
250  if ($_POST["file"][$k] == "..")
251  {
252  unset($_POST["file"][$k]);
253  }
254  }
255 
256  // check if at least one item is select
257  if (!isset($_POST["file"]))
258  {
259  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
260  }
261 
262  // check if only one item is select, if command does not allow multiple selection
263  if (count($_POST["file"]) > 1 && $this->commands[$a_nr]["single"])
264  {
265  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
266  }
267 
268  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
269 
270  // collect files and
271  $files = array();
272  foreach ($_POST["file"] as $k => $v)
273  {
274  $file = (!empty($cur_subdir))
275  ? $this->main_dir."/".$cur_subdir."/".ilUtil::stripSlashes($_POST["file"][$k])
276  : $this->main_dir."/".ilUtil::stripSlashes($_POST["file"][$k]);
277 
278  // check wether selected item is a directory
279  if (@is_dir($file) && !$this->commands[$a_nr]["allow_dir"])
280  {
281  $this->ilias->raiseError($this->lng->txt("select_a_file"),$this->ilias->error_obj->MESSAGE);
282  }
283  $file = (!empty($cur_subdir))
284  ? $cur_subdir."/".ilUtil::stripSlashes($_POST["file"][$k])
285  : ilUtil::stripSlashes($_POST["file"][$k]);
286  $files[] = $file;
287  }
288 
289  if ($this->commands[$a_nr]["single"])
290  {
291  $files = $files[0];
292  }
293 
294  $obj =& $this->commands[$a_nr]["object"];
295  $method = $this->commands[$a_nr]["method"];
296 
297  return $obj->$method($files);
298  }
print $file
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllowDirectories()

ilFileSystemGUI::getAllowDirectories ( )

Get allow directories.

Returns
boolean allow directories

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

Referenced by listFiles(), and unzipFile().

81  {
82  return $this->allow_directories;
83  }
+ Here is the caller graph for this function:

◆ getAllowDirectoryCreation()

ilFileSystemGUI::getAllowDirectoryCreation ( )

Get allowed directory creation.

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

Referenced by listFiles().

312  {
313  return $this->directory_creation;
314  }
+ Here is the caller graph for this function:

◆ getAllowFileCreation()

ilFileSystemGUI::getAllowFileCreation ( )

Get allowed file creation.

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

Referenced by listFiles().

328  {
329  return $this->file_creation;
330  }
+ Here is the caller graph for this function:

◆ getLastPerformedCommand()

ilFileSystemGUI::getLastPerformedCommand ( )

Get performed command.

Returns
array command array

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

References $_SESSION, and $ret.

167  {
168  $ret = $_SESSION["fsys"]["lastcomm"];
169  $_SESSION["fsys"]["lastcomm"] = "none";
170  return $ret;
171  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ getPostDirPath()

ilFileSystemGUI::getPostDirPath ( )

Get post dir path.

Returns
boolean post dir path

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

Referenced by listFiles().

101  {
102  return $this->post_dir_path;
103  }
+ Here is the caller graph for this function:

◆ getTableId()

ilFileSystemGUI::getTableId ( )

Get table id.

Returns
string table id

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

Referenced by listFiles().

121  {
122  return $this->table_id;
123  }
+ Here is the caller graph for this function:

◆ getTabs()

ilFileSystemGUI::getTabs ( $tabs_gui)

get tabs

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

References $ilCtrl.

797  {
798  global $ilCtrl;
799 
800  $ilCtrl->setParameter($this, "resetoffset", 1);
801  $tabs_gui->addTarget("cont_list_files",
802  $this->ctrl->getLinkTarget($this, "listFiles"), "listFiles",
803  get_class($this));
804  $ilCtrl->setParameter($this, "resetoffset", "");
805  }
global $ilCtrl
Definition: ilias.php:18

◆ getTitle()

ilFileSystemGUI::getTitle ( )

Get title.

Returns
string title

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

Referenced by listFiles().

141  {
142  return $this->title;
143  }
+ Here is the caller graph for this function:

◆ ilFileSystemGUI()

ilFileSystemGUI::ilFileSystemGUI (   $a_main_directory)

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

References $ilCtrl, $lng, $tpl, setAllowDirectories(), setAllowDirectoryCreation(), and setAllowFileCreation().

17  {
18  global $lng, $ilCtrl, $tpl, $ilias;
19 
20  $this->ctrl =& $ilCtrl;
21  $this->lng =& $lng;
22  $this->ilias =& $ilias;
23  $this->tpl =& $tpl;
24  $this->main_dir = $a_main_directory;
25  $this->post_dir_path = false;
26  $this->commands = array(
27  0 => array(
28  "object" => $this,
29  "method" => "downloadFile",
30  "name" => $lng->txt("download"),
31  "int" => true
32  ),
33  1 => array(
34  "object" => $this,
35  "method" => "confirmDeleteFile",
36  "name" => $lng->txt("delete"),
37  "allow_dir" => true,
38  "int" => true
39  ),
40  2 => array(
41  "object" => $this,
42  "method" => "unzipFile",
43  "name" => $lng->txt("unzip"),
44  "int" => true
45  ),
46  3 => array(
47  "object" => $this,
48  "method" => "renameFileForm",
49  "name" => $lng->txt("rename"),
50  "allow_dir" => true,
51  "int" => true
52  ),
53  );
54 
55  $this->file_labels = array();
56  $this->label_enable = false;
57  $this->ctrl->saveParameter($this, "cdir");
58  $lng->loadLanguageModule("content");
59  $this->setAllowDirectories(true);
60  $this->setAllowDirectoryCreation(true);
61  $this->setAllowFileCreation(true);
62 //echo "<br>main_dir:".$this->main_dir.":";
63  }
setAllowDirectories($a_val)
Set allow directories.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
setAllowDirectoryCreation($a_val)
Set allowed directory creation.
setAllowFileCreation($a_val)
Set allowed file creation.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ labelFile()

ilFileSystemGUI::labelFile (   $a_file,
  $a_label 
)

label a file

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

229  {
230  $this->file_labels[$a_file][] = $a_label;
231  }

◆ listFiles()

ilFileSystemGUI::listFiles ( )

list files

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

References $_GET, $file, $ilCtrl, $lng, $options, $si, ilUploadFiles\_getUploadDirectory(), ilUploadFiles\_getUploadFiles(), getAllowDirectories(), getAllowDirectoryCreation(), getAllowFileCreation(), getPostDirPath(), getTableId(), getTitle(), ilTextInputGUI\setMaxLength(), ilFileInputGUI\setSize(), and ilUtil\stripSlashes().

336  {
337  global $ilToolbar, $lng, $ilCtrl;
338 
339 
340  // determine directory
341  // FIXME: I have to call stripSlashes here twice, because I could not
342  // determine where the second layer of slashes is added to the
343  // URL Parameter
344  $cur_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["cdir"]));
345  $new_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["newdir"]));
346 
347  if($new_subdir == "..")
348  {
349  $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
350  }
351  else
352  {
353  if (!empty($new_subdir))
354  {
355  if (!empty($cur_subdir))
356  {
357  $cur_subdir = $cur_subdir."/".$new_subdir;
358  }
359  else
360  {
361  $cur_subdir = $new_subdir;
362  }
363  }
364  }
365 
366  $cur_subdir = str_replace("..", "", $cur_subdir);
367  $cur_dir = (!empty($cur_subdir))
368  ? $this->main_dir."/".$cur_subdir
369  : $this->main_dir;
370 
371  $this->ctrl->setParameter($this, "cdir", $cur_subdir);
372 
373  // toolbar for adding files/directories
374  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
375  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
376 
377  if ($this->getAllowDirectories() && $this->getAllowDirectoryCreation())
378  {
379  $ti = new ilTextInputGUI($this->lng->txt("cont_new_dir"), "new_dir");
380  $ti->setMaxLength(80);
381  $ti->setSize(10);
382  $ilToolbar->addInputItem($ti, true);
383  $ilToolbar->addFormButton($lng->txt("create"), "createDirectory");
384 
385  $ilToolbar->addSeparator();
386  }
387 
388  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
389  if ($this->getAllowFileCreation())
390  {
391  $fi = new ilFileInputGUI($this->lng->txt("cont_new_file"), "new_file");
392  $fi->setSize(10);
393  $ilToolbar->addInputItem($fi, true);
394  $ilToolbar->addFormButton($lng->txt("upload"), "uploadFile");
395  }
396 
397  include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
399  {
400  $ilToolbar->addSeparator();
402  $options[""] = $lng->txt("cont_select_from_upload_dir");
403  foreach($files as $file)
404  {
405  $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
406  $options[$file] = $file;
407  }
408  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
409  $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
410  $si->setOptions($options);
411  $ilToolbar->addInputItem($si, true);
412  $ilToolbar->addFormButton($lng->txt("copy"), "uploadFile");
413  }
414 
415  // load files templates
416  include_once("./Services/FileSystem/classes/class.ilFileSystemTableGUI.php");
417  $fs_table = new ilFileSystemTableGUI($this, "listFiles", $cur_dir, $cur_subdir,
418  $this->label_enable, $this->file_labels, $this->label_header, $this->commands,
419  $this->getPostDirPath());
420  $fs_table->setId($this->getTableId());
421  if ($this->getTitle() != "")
422  {
423  $fs_table->setTitle($this->getTitle());
424  }
425  if ($_GET["resetoffset"] == 1)
426  {
427  $fs_table->resetOffset();
428  }
429  $this->tpl->setContent($fs_table->getHTML());
430  }
print $file
This class represents a selection list property in a property form.
getTableId()
Get table id.
$_GET["client_id"]
This class represents a file property in a property form.
getAllowDirectoryCreation()
Get allowed directory creation.
static _getUploadDirectory()
Get the directory with uploaded files.
static _getUploadFiles()
Get a list of readable files in the upload directory.
setSize($a_size)
Set Size.
global $ilCtrl
Definition: ilias.php:18
if(!is_array($argv)) $options
This class represents a text property in a property form.
getAllowDirectories()
Get allow directories.
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getPostDirPath()
Get post dir path.
global $lng
Definition: privfeed.php:40
getAllowFileCreation()
Get allowed file creation.
TableGUI class for file system.
+ Here is the call graph for this function:

◆ renameFile()

ilFileSystemGUI::renameFile ( )

rename a file

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

References $_GET, $_POST, $lng, ilUtil\renameExecutables(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

492  {
493  global $lng;
494 
495  $new_name = str_replace("..", "", ilUtil::stripSlashes($_POST["new_name"]));
496  $new_name = str_replace("/", "", $new_name);
497  if ($new_name == "")
498  {
499  $this->ilias->raiseError($this->lng->txt("enter_new_name"),$this->ilias->error_obj->MESSAGE);
500  }
501 
502  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
503  $dir = (!empty($cur_subdir))
504  ? $this->main_dir."/".$cur_subdir."/"
505  : $this->main_dir."/";
506 
507  rename($dir.ilUtil::stripSlashes($_GET["old_name"]), $dir.$new_name);
508 
509  ilUtil::renameExecutables($this->main_dir);
510  if (@is_dir($dir.$new_name))
511  {
512  ilUtil::sendSuccess($lng->txt("cont_dir_renamed"), true);
513  $this->setPerformedCommand("rename_dir", array("old_name" => $_GET["old_name"],
514  "new_name" => $new_name));
515  }
516  else
517  {
518  ilUtil::sendSuccess($lng->txt("cont_file_renamed"), true);
519  $this->setPerformedCommand("rename_file", array("old_name" => $_GET["old_name"],
520  "new_name" => $new_name));
521  }
522  $this->ctrl->redirect($this, "listFiles");
523  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
global $lng
Definition: privfeed.php:40
setPerformedCommand($command, $pars="")
Set performed command.
+ Here is the call graph for this function:

◆ renameFileForm()

ilFileSystemGUI::renameFileForm ( )

list files

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

References $_GET, $_POST, $file, $ilCtrl, $lng, ilTextInputGUI\setMaxLength(), and ilUtil\stripSlashes().

436  {
437  global $lng, $ilCtrl;
438 
439  if (!isset($_POST["file"]))
440  {
441  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
442  }
443 
444  if (count($_POST["file"]) > 1)
445  {
446  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
447  }
448 
449  if (ilUtil::stripSlashes($_POST["file"][0]) == ".." )
450  {
451  $this->ilias->raiseError($this->lng->txt("select_a_file"),$this->ilias->error_obj->MESSAGE);
452  }
453 
454  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
455  $file = (!empty($cur_subdir))
456  ? $this->main_dir."/".$cur_subdir."/".ilUtil::stripSlashes($_POST["file"][0])
457  : $this->main_dir."/".ilUtil::stripSlashes($_POST["file"][0]);
458 
459  $this->ctrl->setParameter($this, "old_name", ilUtil::stripSlashes($_POST["file"][0]));
460 
461  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
462  $form = new ilPropertyFormGUI();
463 
464  // file/dir name
465  $ti = new ilTextInputGUI($this->lng->txt("name"), "new_name");
466  $ti->setMaxLength(200);
467  $ti->setSize(40);
468  $ti->setValue(ilUtil::stripSlashes($_POST["file"][0]));
469  $form->addItem($ti);
470 
471  // save and cancel commands
472  $form->addCommandButton("renameFile", $lng->txt("rename"));
473  $form->addCommandButton("cancelRename", $lng->txt("cancel"));
474  $form->setFormAction($ilCtrl->getFormAction($this, "renameFile"));
475 
476  if (@is_dir($file))
477  {
478  $form->setTitle($this->lng->txt("cont_rename_dir"));
479  }
480  else
481  {
482  $form->setTitle($this->lng->txt("rename_file"));
483  }
484 
485  $this->tpl->setContent($form->getHTML());
486  }
print $file
$_POST['username']
Definition: cron.php:12
This class represents a property form user interface.
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
This class represents a text property in a property form.
redirection script todo: (a better solution should control the processing via a xml file) ...
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ setAllowDirectories()

ilFileSystemGUI::setAllowDirectories (   $a_val)

Set allow directories.

Parameters
booleanallow directories

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

Referenced by ilFileSystemGUI().

71  {
72  $this->allow_directories = $a_val;
73  }
+ Here is the caller graph for this function:

◆ setAllowDirectoryCreation()

ilFileSystemGUI::setAllowDirectoryCreation (   $a_val)

Set allowed directory creation.

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

Referenced by ilFileSystemGUI().

304  {
305  $this->directory_creation = $a_val;
306  }
+ Here is the caller graph for this function:

◆ setAllowFileCreation()

ilFileSystemGUI::setAllowFileCreation (   $a_val)

Set allowed file creation.

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

Referenced by ilFileSystemGUI().

320  {
321  $this->file_creation = $a_val;
322  }
+ Here is the caller graph for this function:

◆ setPerformedCommand()

ilFileSystemGUI::setPerformedCommand (   $command,
  $pars = "" 
)
protected

Set performed command.

Parameters
stringcommand
arrayparameter array

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

References $_SESSION.

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

152  {
153  if (!is_array($pars))
154  {
155  $pars = array();
156  }
157  $_SESSION["fsys"]["lastcomm"] = array_merge(
158  array("cmd" => $command), $pars);
159  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ setPostDirPath()

ilFileSystemGUI::setPostDirPath (   $a_val)

Set post dir path.

Parameters
booleanpost dir path

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

Referenced by ilObjMediaPoolGUI\executeCommand().

91  {
92  $this->post_dir_path = $a_val;
93  }
+ Here is the caller graph for this function:

◆ setTableId()

ilFileSystemGUI::setTableId (   $a_val)

Set table id.

Parameters
stringtable id

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

Referenced by ilObjSAHSLearningModuleGUI\executeCommand(), and ilObjExerciseGUI\executeCommand().

111  {
112  $this->table_id = $a_val;
113  }
+ Here is the caller graph for this function:

◆ setTitle()

ilFileSystemGUI::setTitle (   $a_val)

Set title.

Parameters
stringtitle

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

Referenced by ilObjExerciseGUI\executeCommand().

131  {
132  $this->title = $a_val;
133  }
+ Here is the caller graph for this function:

◆ unzipFile()

ilFileSystemGUI::unzipFile ( )

delete object file

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

References $_GET, $_POST, $file, $lng, getAllowDirectories(), ilUtil\renameExecutables(), ilUtil\sendSuccess(), ilUtil\stripSlashes(), and ilUtil\unzip().

710  {
711  global $lng;
712 
713  if (!isset($_POST["file"]))
714  {
715  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
716  }
717 
718  if (count($_POST["file"]) > 1)
719  {
720  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
721  }
722 
723  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
724  $cur_dir = (!empty($cur_subdir))
725  ? $this->main_dir."/".$cur_subdir
726  : $this->main_dir;
727  $file = $cur_dir."/".ilUtil::stripSlashes($_POST["file"][0]);
728 
729  if (@is_file($file))
730  {
731  if ($this->getAllowDirectories())
732  {
733  ilUtil::unzip($file, true);
734  }
735  else
736  {
737  ilUtil::unzip($file, true, true);
738  }
739  }
740 
741  ilUtil::renameExecutables($this->main_dir);
742 
743  $this->ctrl->saveParameter($this, "cdir");
744  ilUtil::sendSuccess($lng->txt("cont_file_unzipped"), true);
745  $this->ctrl->redirect($this, "listFiles");
746  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
redirection script todo: (a better solution should control the processing via a xml file) ...
getAllowDirectories()
Get allow directories.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ uploadFile()

ilFileSystemGUI::uploadFile ( )

upload file

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

References $_GET, $_POST, $lng, ilUploadFiles\_checkUploadFile(), ilUploadFiles\_copyUploadFile(), if, ilUtil\renameExecutables(), ilUtil\sendFailure(), ilUtil\sendSuccess(), setPerformedCommand(), and ilUtil\stripSlashes().

570  {
571  global $lng;
572 
573  // determine directory
574  $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
575  $cur_dir = (!empty($cur_subdir))
576  ? $this->main_dir."/".$cur_subdir
577  : $this->main_dir;
578 
579 
580  include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
581 
582  if (is_file($_FILES["new_file"]["tmp_name"]))
583  {
584  move_uploaded_file($_FILES["new_file"]["tmp_name"],
585  $cur_dir."/".ilUtil::stripSlashes($_FILES["new_file"]["name"]));
586  if (is_file($cur_dir."/".ilUtil::stripSlashes($_FILES["new_file"]["name"])))
587  {
588  ilUtil::sendSuccess($lng->txt("cont_file_created"), true);
589  $this->setPerformedCommand("create_file",
590  array("name" => ilUtil::stripSlashes($_FILES["new_file"]["name"])));
591 
592  }
593  }
594  elseif ($_POST["uploaded_file"])
595  {
596  // check if the file is in the ftp directory and readable
597  if (ilUploadFiles::_checkUploadFile($_POST["uploaded_file"]))
598  {
599  // copy uploaded file to data directory
600  ilUploadFiles::_copyUploadFile($_POST["uploaded_file"],
601  $cur_dir."/".ilUtil::stripSlashes($_POST["uploaded_file"]));
602  }
603  if (is_file($cur_dir."/".ilUtil::stripSlashes($_POST["uploaded_file"])))
604  {
605  ilUtil::sendSuccess($lng->txt("cont_file_created"), true);
606  $this->setPerformedCommand("create_file",
607  array("name" => ilUtil::stripSlashes($_POST["uploaded_file"])));
608  }
609  }
610  else if (trim($_FILES["new_file"]["name"]) == "")
611  {
612  ilUtil::sendFailure($lng->txt("cont_enter_a_file"), true);
613  }
614 
615  $this->ctrl->saveParameter($this, "cdir");
616 
617  ilUtil::renameExecutables($this->main_dir);
618 
619  $this->ctrl->redirect($this, "listFiles");
620  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(!file_exists(getcwd().'/ilias.ini.php')) if(isset( $_GET["client_id"]))
registration confirmation script for ilias
Definition: confirmReg.php:20
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
global $lng
Definition: privfeed.php:40
setPerformedCommand($command, $pars="")
Set performed command.
static _checkUploadFile($a_file)
Check if a file exists in the upload directory and is readable.
static _copyUploadFile($a_file, $a_target, $a_raise_errors=true)
copy an uploaded file to the target directory (including virus check)
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilFileSystemGUI::$ctrl

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


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