ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjSystemFolderGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObjectGUI.php";
5 require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
6 
19 {
23  protected $tabs;
24 
28  protected $rbacsystem;
29 
33  protected $obj_definition;
34 
38  protected $error;
39 
43  protected $db;
44 
48  protected $style_definition;
49 
53  protected $help;
54 
58  protected $client_ini;
59 
63  protected $bench;
64 
70  public $type;
71 
76  public function __construct($a_data, $a_id, $a_call_by_reference)
77  {
78  global $DIC;
79 
80  $this->tabs = $DIC->tabs();
81  $this->access = $DIC->access();
82  $this->ctrl = $DIC->ctrl();
83  $this->rbacsystem = $DIC->rbac()->system();
84  $this->user = $DIC->user();
85  $this->obj_definition = $DIC["objDefinition"];
86  $this->settings = $DIC->settings();
87  $this->error = $DIC["ilErr"];
88  $this->db = $DIC->database();
89  $this->style_definition = $DIC["styleDefinition"];
90  $this->lng = $DIC->language();
91  $this->tpl = $DIC["tpl"];
92  $this->help = $DIC["ilHelp"];
93  $this->toolbar = $DIC->toolbar();
94  $this->client_ini = $DIC["ilClientIniFile"];
95  $this->type = "adm";
96  $this->bench = $DIC["ilBench"];
97  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
98 
99  $this->lng->loadLanguageModule("administration");
100  $this->lng->loadLanguageModule("adm");
101  }
102 
103  public function executeCommand()
104  {
105  $ilTabs = $this->tabs;
106 
107  $next_class = $this->ctrl->getNextClass($this);
108  $this->prepareOutput();
109 
110  switch ($next_class) {
111  case 'ilpermissiongui':
112  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
113  $perm_gui = new ilPermissionGUI($this);
114  $ret =&$this->ctrl->forwardCommand($perm_gui);
115  break;
116 
117  case 'ilimprintgui':
118  // page editor will set its own tabs
119  $ilTabs->clearTargets();
120  $ilTabs->setBackTarget(
121  $this->lng->txt("back"),
122  $this->ctrl->getLinkTarget($this, "")
123  );
124 
125  include_once("./Services/Imprint/classes/class.ilImprintGUI.php");
126  $igui = new ilImprintGUI();
127 
128  // needed for editor
129  $igui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "impr"));
130 
131  if (!$this->checkPermissionBool("write")) {
132  $igui->setEnableEditing(false);
133  }
134 
135  $ret = $this->ctrl->forwardCommand($igui);
136  if ($ret != "") {
137  $this->tpl->setContent($ret);
138  }
139  break;
140 
141  case "ilobjectownershipmanagementgui":
142  $this->setSystemCheckSubTabs("no_owner");
143  include_once("Services/Object/classes/class.ilObjectOwnershipManagementGUI.php");
144  $gui = new ilObjectOwnershipManagementGUI(0);
145  $this->ctrl->forwardCommand($gui);
146  break;
147 
148  case "ilcronmanagergui":
149  $ilTabs->activateTab("cron_jobs");
150  include_once("Services/Cron/classes/class.ilCronManagerGUI.php");
151  $gui = new ilCronManagerGUI();
152  $this->ctrl->forwardCommand($gui);
153  break;
154 
155  default:
156 //var_dump($_POST);
157  $cmd = $this->ctrl->getCmd("view");
158 
159  $cmd .= "Object";
160  $this->$cmd();
161 
162  break;
163  }
164 
165  return true;
166  }
167 
173  public function viewObject()
174  {
175  $ilAccess = $this->access;
176 
177  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
178  return $this->showBasicSettingsObject();
179  }
180  return $this->showServerInfoObject();
181  }
182 
183  public function viewScanLogObject()
184  {
185  return $this->viewScanLog();
186  }
187 
191  public function setSystemCheckSubTabs($a_activate)
192  {
193  $ilTabs = $this->tabs;
195 
196  $ilTabs->addSubTab(
197  "system_check_sub",
198  $this->lng->txt("system_check"),
199  $ilCtrl->getLinkTarget($this, "check")
200  );
201  $ilTabs->addSubTab(
202  "no_owner",
203  $this->lng->txt("system_check_no_owner"),
204  $ilCtrl->getLinkTargetByClass("ilObjectOwnershipManagementGUI")
205  );
206 
207  $ilTabs->setSubTabActive($a_activate);
208  $ilTabs->setTabActive("system_check");
209  }
210 
216  public function checkObject()
217  {
223 
224  $this->setSystemCheckSubTabs("system_check_sub");
225 
226  if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
227  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
228  }
229  //echo "1";
230 
231  if ($_POST['count_limit'] !== null || $_POST['age_limit'] !== null || $_POST['type_limit'] !== null) {
232  $ilUser->writePref(
233  'systemcheck_count_limit',
234  (is_numeric($_POST['count_limit']) && $_POST['count_limit'] > 0) ? $_POST['count_limit'] : ''
235  );
236  $ilUser->writePref(
237  'systemcheck_age_limit',
238  (is_numeric($_POST['age_limit']) && $_POST['age_limit'] > 0) ? $_POST['age_limit'] : ''
239  );
240  $ilUser->writePref('systemcheck_type_limit', trim($_POST['type_limit']));
241  }
242 
243  if ($_POST["mode"]) {
244  //echo "3";
245  $this->writeCheckParams();
246  $this->startValidator($_POST["mode"], $_POST["log_scan"]);
247  } else {
248  //echo "4";
249  include_once "./Services/Repository/classes/class.ilValidator.php";
250  $validator = new ilValidator();
251  $hasScanLog = $validator->hasScanLog();
252 
253  $this->tpl->addBlockFile(
254  "ADM_CONTENT",
255  "adm_content",
256  "tpl.adm_check.html",
257  "Modules/SystemFolder"
258  );
259 
260  if ($hasScanLog) {
261  $this->tpl->setVariable("TXT_VIEW_LOG", $this->lng->txt("view_last_log"));
262  }
263 
264  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
265  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("systemcheck"));
266  $this->tpl->setVariable("COLSPAN", 3);
267  $this->tpl->setVariable("TXT_ANALYZE_TITLE", $this->lng->txt("analyze_data"));
268  $this->tpl->setVariable("TXT_ANALYSIS_OPTIONS", $this->lng->txt("analysis_options"));
269  $this->tpl->setVariable("TXT_REPAIR_OPTIONS", $this->lng->txt("repair_options"));
270  $this->tpl->setVariable("TXT_OUTPUT_OPTIONS", $this->lng->txt("output_options"));
271  $this->tpl->setVariable("TXT_SCAN", $this->lng->txt("scan"));
272  $this->tpl->setVariable("TXT_SCAN_DESC", $this->lng->txt("scan_desc"));
273  $this->tpl->setVariable("TXT_DUMP_TREE", $this->lng->txt("dump_tree"));
274  $this->tpl->setVariable("TXT_DUMP_TREE_DESC", $this->lng->txt("dump_tree_desc"));
275  $this->tpl->setVariable("TXT_CLEAN", $this->lng->txt("clean"));
276  $this->tpl->setVariable("TXT_CLEAN_DESC", $this->lng->txt("clean_desc"));
277  $this->tpl->setVariable("TXT_RESTORE", $this->lng->txt("restore_missing"));
278  $this->tpl->setVariable("TXT_RESTORE_DESC", $this->lng->txt("restore_missing_desc"));
279  $this->tpl->setVariable("TXT_PURGE", $this->lng->txt("purge_missing"));
280  $this->tpl->setVariable("TXT_PURGE_DESC", $this->lng->txt("purge_missing_desc"));
281  $this->tpl->setVariable("TXT_RESTORE_TRASH", $this->lng->txt("restore_trash"));
282  $this->tpl->setVariable("TXT_RESTORE_TRASH_DESC", $this->lng->txt("restore_trash_desc"));
283  $this->tpl->setVariable("TXT_PURGE_TRASH", $this->lng->txt("purge_trash"));
284  $this->tpl->setVariable("TXT_PURGE_TRASH_DESC", $this->lng->txt("purge_trash_desc"));
285  $this->tpl->setVariable("TXT_COUNT_LIMIT", $this->lng->txt("purge_count_limit"));
286  $this->tpl->setVariable("TXT_COUNT_LIMIT_DESC", $this->lng->txt("purge_count_limit_desc"));
287  $this->tpl->setVariable("COUNT_LIMIT_VALUE", $ilUser->getPref("systemcheck_count_limit"));
288  $this->tpl->setVariable("TXT_AGE_LIMIT", $this->lng->txt("purge_age_limit"));
289  $this->tpl->setVariable("TXT_AGE_LIMIT_DESC", $this->lng->txt("purge_age_limit_desc"));
290  $this->tpl->setVariable("AGE_LIMIT_VALUE", $ilUser->getPref("systemcheck_age_limit"));
291  $this->tpl->setVariable("TXT_TYPE_LIMIT", $this->lng->txt("purge_type_limit"));
292  $this->tpl->setVariable("TXT_TYPE_LIMIT_DESC", $this->lng->txt("purge_type_limit_desc"));
293 
294  if ($ilUser->getPref('systemcheck_mode_scan')) {
295  $this->tpl->touchBlock('mode_scan_checked');
296  }
297  if ($ilUser->getPref('systemcheck_mode_dump_tree')) {
298  $this->tpl->touchBlock('mode_dump_tree_checked');
299  }
300  if ($ilUser->getPref('systemcheck_mode_clean')) {
301  $this->tpl->touchBlock('mode_clean_checked');
302  }
303  if ($ilUser->getPref('systemcheck_mode_restore')) {
304  $this->tpl->touchBlock('mode_restore_checked');
305  $this->tpl->touchBlock('mode_purge_disabled');
306  } elseif ($ilUser->getPref('systemcheck_mode_purge')) {
307  $this->tpl->touchBlock('mode_purge_checked');
308  $this->tpl->touchBlock('mode_restore_disabled');
309  }
310  if ($ilUser->getPref('systemcheck_mode_restore_trash')) {
311  $this->tpl->touchBlock('mode_restore_trash_checked');
312  $this->tpl->touchBlock('mode_purge_trash_disabled');
313  } elseif ($ilUser->getPref('systemcheck_mode_purge_trash')) {
314  $this->tpl->touchBlock('mode_purge_trash_checked');
315  $this->tpl->touchBlock('mode_restore_trash_disabled');
316  }
317  if ($ilUser->getPref('systemcheck_log_scan')) {
318  $this->tpl->touchBlock('log_scan_checked');
319  }
320 
321 
322  // #9520 - restrict to types which can be found in tree
323 
324  $obj_types_in_tree = array();
325 
326  $ilDB = $this->db;
327  $set = $ilDB->query('SELECT type FROM object_data od' .
328  ' JOIN object_reference ref ON (od.obj_id = ref.obj_id)' .
329  ' JOIN tree ON (tree.child = ref.ref_id)' .
330  ' WHERE tree.tree < 1' .
331  ' GROUP BY type');
332  while ($row = $ilDB->fetchAssoc($set)) {
333  $obj_types_in_tree[] = $row['type'];
334  }
335 
336  $types = $objDefinition->getAllObjects();
337  $ts = array("" => "");
338  foreach ($types as $t) {
339  if ($t != "" && !$objDefinition->isSystemObject($t) && $t != "root" &&
340  in_array($t, $obj_types_in_tree)) {
341  if ($objDefinition->isPlugin($t)) {
343  $ts[$t] = $pl->txt("obj_" . $t);
344  } else {
345  $ts[$t] = $this->lng->txt("obj_" . $t);
346  }
347  }
348  }
349  asort($ts);
350  $this->tpl->setVariable(
351  "TYPE_LIMIT_CHOICE",
353  $ilUser->getPref("systemcheck_type_limit"),
354  'type_limit',
355  $ts,
356  false,
357  true
358  )
359  );
360  $this->tpl->setVariable("TXT_LOG_SCAN", $this->lng->txt("log_scan"));
361  $this->tpl->setVariable("TXT_LOG_SCAN_DESC", $this->lng->txt("log_scan_desc"));
362  $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("start_scan"));
363 
364  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save_params_for_cron"));
365 
366  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
367 
368  $cron_form = new ilPropertyFormGUI();
369  $cron_form->setFormAction($this->ctrl->getFormAction($this));
370  $cron_form->setTitle($this->lng->txt('systemcheck_cronform'));
371 
372  $radio_group = new ilRadioGroupInputGUI($this->lng->txt('systemcheck_cron'), 'cronjob');
373  $radio_group->setValue($ilSetting->get('systemcheck_cron'));
374 
375  $radio_opt = new ilRadioOption($this->lng->txt('disabled'), 0);
376  $radio_group->addOption($radio_opt);
377 
378  $radio_opt = new ilRadioOption($this->lng->txt('enabled'), 1);
379  $radio_group->addOption($radio_opt);
380 
381  $cron_form->addItem($radio_group);
382 
383  $cron_form->addCommandButton('saveCheckCron', $this->lng->txt('save'));
384 
385  $this->tpl->setVariable('CRON_FORM', $cron_form->getHTML());
386  }
387  }
388 
389  private function saveCheckParamsObject()
390  {
391  $this->writeCheckParams();
392  unset($_POST['mode']);
393  return $this->checkObject();
394  }
395 
396  private function writeCheckParams()
397  {
398  include_once "./Services/Repository/classes/class.ilValidator.php";
399  $validator = new ilValidator();
400  $modes = $validator->getPossibleModes();
401 
402  $prefs = array();
403  foreach ($modes as $mode) {
404  if (isset($_POST['mode'][$mode])) {
405  $value = (int) $_POST['mode'][$mode];
406  } else {
407  $value = 0;
408  }
409  $prefs[ 'systemcheck_mode_' . $mode ] = $value;
410  }
411 
412  if (isset($_POST['log_scan'])) {
413  $value = (int) $_POST['log_scan'];
414  } else {
415  $value = 0;
416  }
417  $prefs['systemcheck_log_scan'] = $value;
418 
420  foreach ($prefs as $key => $val) {
421  $ilUser->writePref($key, $val);
422  }
423  }
424 
425  private function saveCheckCronObject()
426  {
428 
429  $systemcheck_cron = ($_POST['cronjob'] ? 1 : 0);
430  $ilSetting->set('systemcheck_cron', $systemcheck_cron);
431 
432  unset($_POST['mode']);
433  return $this->checkObject();
434  }
435 
441  public function changeHeaderTitleObject()
442  {
444  $styleDefinition = $this->style_definition;
445 
446  $this->tpl->addBlockFile(
447  "ADM_CONTENT",
448  "adm_content",
449  "tpl.header_title_edit.html",
450  "Modules/SystemFolder"
451  );
452 
453  $array_push = true;
454 
455  if ($_SESSION["error_post_vars"]) {
456  $_SESSION["translation_post"] = $_SESSION["error_post_vars"];
457  $_GET["mode"] = "session";
458  $array_push = false;
459  }
460 
461  // load from db if edit category is called the first time
462  if (($_GET["mode"] != "session")) {
463  $data = $this->object->getHeaderTitleTranslations();
464  $_SESSION["translation_post"] = $data;
465  $array_push = false;
466  } // remove a translation from session
467  elseif ($_GET["entry"] != 0) {
468  array_splice($_SESSION["translation_post"]["Fobject"], $_GET["entry"], 1, array());
469 
470  if ($_GET["entry"] == $_SESSION["translation_post"]["default_language"]) {
471  $_SESSION["translation_post"]["default_language"] = "";
472  }
473  }
474 
475  $data = $_SESSION["translation_post"];
476 
477  // add additional translation form
478  if (!$_GET["entry"] and $array_push) {
479  $count = array_push($data["Fobject"], array("title" => "","desc" => ""));
480  } else {
481  $count = count($data["Fobject"]);
482  }
483 
484  // stripslashes in form?
485  $strip = isset($_SESSION["translation_post"]) ? true : false;
486 
487  foreach ($data["Fobject"] as $key => $val) {
488  // add translation button
489  if ($key == $count -1) {
490  $this->tpl->setCurrentBlock("addTranslation");
491  $this->tpl->setVariable("TXT_ADD_TRANSLATION", $this->lng->txt("add_translation") . " >>");
492  $this->tpl->parseCurrentBlock();
493  }
494 
495  // remove translation button
496  if ($key != 0) {
497  $this->tpl->setCurrentBlock("removeTranslation");
498  $this->tpl->setVariable("TXT_REMOVE_TRANSLATION", $this->lng->txt("remove_translation"));
499  $this->ctrl->setParameter($this, "entry", $key);
500  $this->ctrl->setParameter($this, "mode", "edit");
501  $this->tpl->setVariable(
502  "LINK_REMOVE_TRANSLATION",
503  $this->ctrl->getLinkTarget($this, "removeTranslation")
504  );
505  $this->tpl->parseCurrentBlock();
506  }
507 
508  // lang selection
509  $this->tpl->addBlockFile(
510  "SEL_LANGUAGE",
511  "sel_language",
512  "tpl.lang_selection.html",
513  "Services/MetaData"
514  );
515  $this->tpl->setVariable("SEL_NAME", "Fobject[" . $key . "][lang]");
516 
517  include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
518 
519  $languages = ilMDLanguageItem::_getLanguages();
520 
521  foreach ($languages as $code => $language) {
522  $this->tpl->setCurrentBlock("lg_option");
523  $this->tpl->setVariable("VAL_LG", $code);
524  $this->tpl->setVariable("TXT_LG", $language);
525 
526  if ($code == $val["lang"]) {
527  $this->tpl->setVariable("SELECTED", "selected=\"selected\"");
528  }
529 
530  $this->tpl->parseCurrentBlock();
531  }
532 
533  // object data
534  $this->tpl->setCurrentBlock("obj_form");
535 
536  if ($key == 0) {
537  $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("change_header_title"));
538  } else {
539  $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("translation") . " " . $key);
540  }
541 
542  if ($key == $data["default_language"]) {
543  $this->tpl->setVariable("CHECKED", "checked=\"checked\"");
544  }
545 
546  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
547  $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
548  $this->tpl->setVariable("TXT_DEFAULT", $this->lng->txt("default"));
549  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
550  $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($val["title"], $strip));
551  $this->tpl->setVariable("DESC", ilUtil::stripSlashes($val["desc"]));
552  $this->tpl->setVariable("NUM", $key);
553  $this->tpl->parseCurrentBlock();
554  }
555 
556  // global
557  $this->tpl->setCurrentBlock("adm_content");
558 
559  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
560  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
561  $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
562  $this->tpl->setVariable("CMD_SUBMIT", "saveHeaderTitle");
563  $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
564  }
565 
569  public function saveHeaderTitleObject()
570  {
572 
573  $data = $_POST;
574 
575  // default language set?
576  if (!isset($data["default_language"])) {
577  $ilErr->raiseError($this->lng->txt("msg_no_default_language"), $ilErr->MESSAGE);
578  }
579 
580  // prepare array fro further checks
581  foreach ($data["Fobject"] as $key => $val) {
582  $langs[$key] = $val["lang"];
583  }
584 
585  $langs = array_count_values($langs);
586 
587  // all languages set?
588  if (array_key_exists("", $langs)) {
589  $ilErr->raiseError($this->lng->txt("msg_no_language_selected"), $ilErr->MESSAGE);
590  }
591 
592  // no single language is selected more than once?
593  if (array_sum($langs) > count($langs)) {
594  $ilErr->raiseError($this->lng->txt("msg_multi_language_selected"), $ilErr->MESSAGE);
595  }
596 
597  // copy default translation to variable for object data entry
598  $_POST["Fobject"]["title"] = $_POST["Fobject"][$_POST["default_language"]]["title"];
599  $_POST["Fobject"]["desc"] = $_POST["Fobject"][$_POST["default_language"]]["desc"];
600 
601  // first delete all translation entries...
602  $this->object->removeHeaderTitleTranslations();
603 
604  // ...and write new translations to object_translation
605  foreach ($data["Fobject"] as $key => $val) {
606  if ($key == $data["default_language"]) {
607  $default = 1;
608  } else {
609  $default = 0;
610  }
611 
612  $this->object->addHeaderTitleTranslation(ilUtil::stripSlashes($val["title"]), ilUtil::stripSlashes($val["desc"]), $val["lang"], $default);
613  }
614 
615  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
616 
617  $this->ctrl->redirect($this);
618  }
619 
620  public function cancelObject()
621  {
622  $this->ctrl->redirect($this, "view");
623  }
624 
631  {
632  $_SESSION["translation_post"] = $_POST;
633 
634  $this->ctrl->setParameter($this, "mode", "session");
635  $this->ctrl->setParameter($this, "entry", "0");
636  $this->ctrl->redirect($this, "changeHeaderTitle");
637  }
638 
644  public function removeTranslationObject()
645  {
646  $this->ctrl->setParameter($this, "entry", $_GET["entry"]);
647  $this->ctrl->setParameter($this, "mode", "session");
648  $this->ctrl->redirect($this, "changeHeaderTitle");
649  }
650 
651 
652  public function startValidator($a_mode, $a_log)
653  {
656 
657  if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
658  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
659  }
660 
661  $logging = ($a_log) ? true : false;
662  include_once "./Services/Repository/classes/class.ilValidator.php";
663  $validator = new ilValidator($logging);
664  $validator->setMode("all", false);
665 
666  $modes = array();
667  foreach ($a_mode as $mode => $value) {
668  $validator->setMode($mode, (bool) $value);
669  $modes[] = $mode . '=' . $value;
670  }
671 
672  $scan_log = $validator->validate();
673 
674  $mode = $this->lng->txt("scan_modes") . ": " . implode(', ', $modes);
675 
676  // output
677  $this->tpl->addBlockFile(
678  "ADM_CONTENT",
679  "adm_content",
680  "tpl.adm_scan.html",
681  "Modules/SystemFolder"
682  );
683 
684  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
685  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("scanning_system"));
686  $this->tpl->setVariable("COLSPAN", 3);
687  $this->tpl->setVariable("TXT_SCAN_LOG", $scan_log);
688  $this->tpl->setVariable("TXT_MODE", $mode);
689 
690  if ($logging === true) {
691  $this->tpl->setVariable("TXT_VIEW_LOG", $this->lng->txt("view_log"));
692  }
693 
694  $this->tpl->setVariable("TXT_DONE", $this->lng->txt("done"));
695 
696  $validator->writeScanLogLine($mode);
697  }
698 
699  public function viewScanLog()
700  {
701  include_once "./Services/Repository/classes/class.ilValidator.php";
702  $validator = new IlValidator();
703  $scan_log =&$validator->readScanLog();
704 
705  if (is_array($scan_log)) {
706  $scan_log = '<pre>' . implode("", $scan_log) . '</pre>';
707  $this->tpl->setVariable("ADM_CONTENT", $scan_log);
708  } else {
709  $scan_log = "no scanlog found.";
710  }
711 
712  // output
713  $this->tpl->addBlockFile(
714  "ADM_CONTENT",
715  "adm_content",
716  "tpl.adm_scan.html",
717  "Modules/SystemFolder"
718  );
719  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("scan_details"));
720  $this->tpl->setVariable("COLSPAN", 3);
721  $this->tpl->setVariable("TXT_SCAN_LOG", $scan_log);
722  $this->tpl->setVariable("TXT_DONE", $this->lng->txt("done"));
723  }
724 
725 
729  public function benchmarkObject()
730  {
732  $lng = $this->lng;
735  $tpl = $this->tpl;
737 
738  if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
739  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
740  }
741 
742  $this->benchmarkSubTabs("settings");
743 
744  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
745  $this->form = new ilPropertyFormGUI();
746 
747  // Activate DB Benchmark
748  $cb = new ilCheckboxInputGUI($lng->txt("adm_activate_db_benchmark"), "enable_db_bench");
749  $cb->setChecked($ilSetting->get("enable_db_bench"));
750  $cb->setInfo($lng->txt("adm_activate_db_benchmark_desc"));
751  $this->form->addItem($cb);
752 
753  // DB Benchmark User
754  $ti = new ilTextInputGUI($lng->txt("adm_db_benchmark_user"), "db_bench_user");
755  $ti->setValue($ilSetting->get("db_bench_user"));
756  $ti->setInfo($lng->txt("adm_db_benchmark_user_desc"));
757  $this->form->addItem($ti);
758 
759  $this->form->addCommandButton("saveBenchSettings", $lng->txt("save"));
760 
761  $this->form->setTitle($lng->txt("adm_db_benchmark"));
762  $this->form->setFormAction($ilCtrl->getFormAction($this));
763 
764  $tpl->setContent($this->form->getHTML());
765  }
766 
771  {
772  $this->benchmarkSubTabs("chronological");
773  $this->showDbBenchResults("chronological");
774  }
775 
780  {
781  $this->benchmarkSubTabs("slowest_first");
782  $this->showDbBenchResults("slowest_first");
783  }
784 
789  {
790  $this->benchmarkSubTabs("sorted_by_sql");
791  $this->showDbBenchResults("sorted_by_sql");
792  }
793 
798  {
799  $this->benchmarkSubTabs("by_first_table");
800  $this->showDbBenchResults("by_first_table");
801  }
802 
808  public function showDbBenchResults($a_mode)
809  {
810  $tpl = $this->tpl;
811 
813  $rec = $ilBench->getDbBenchRecords();
814 
815  include_once("./Modules/SystemFolder/classes/class.ilBenchmarkTableGUI.php");
816  $table = new ilBenchmarkTableGUI($this, "benchmark", $rec, $a_mode);
817  $tpl->setContent($table->getHTML());
818  }
819 
826  public function benchmarkSubTabs($a_current)
827  {
828  $ilTabs = $this->tabs;
829  $lng = $this->lng;
831 
833  $ilTabs->activateTab("benchmarks"); // #18083
834 
835  $ilTabs->addSubtab(
836  "settings",
837  $lng->txt("settings"),
838  $ilCtrl->getLinkTarget($this, "benchmark")
839  );
840 
841  $rec = $ilBench->getDbBenchRecords();
842  if (count($rec) > 0) {
843  $ilTabs->addSubtab(
844  "chronological",
845  $lng->txt("adm_db_bench_chronological"),
846  $ilCtrl->getLinkTarget($this, "showDbBenchChronological")
847  );
848  $ilTabs->addSubtab(
849  "slowest_first",
850  $lng->txt("adm_db_bench_slowest_first"),
851  $ilCtrl->getLinkTarget($this, "showDbBenchSlowestFirst")
852  );
853  $ilTabs->addSubtab(
854  "sorted_by_sql",
855  $lng->txt("adm_db_bench_sorted_by_sql"),
856  $ilCtrl->getLinkTarget($this, "showDbBenchSortedBySql")
857  );
858  $ilTabs->addSubtab(
859  "by_first_table",
860  $lng->txt("adm_db_bench_by_first_table"),
861  $ilCtrl->getLinkTarget($this, "showDbBenchByFirstTable")
862  );
863  }
864 
865  $ilTabs->activateSubTab($a_current);
866  }
867 
868 
872  public function saveBenchSettingsObject()
873  {
875  if ($_POST["enable_db_bench"]) {
876  $ilBench->enableDbBench(true, ilUtil::stripSlashes($_POST["db_bench_user"]));
877  } else {
878  $ilBench->enableDbBench(false);
879  }
880 
881  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
882 
883  $this->ctrl->redirect($this, "benchmark");
884  }
885 
886 
890  public function switchBenchModuleObject()
891  {
892  $this->ctrl->setParameter($this, 'cur_mod', $_POST['module']);
893  $this->ctrl->redirect($this, "benchmark");
894  }
895 
896 
900  public function clearBenchObject()
901  {
903  $ilBench->clearData();
904  $this->saveBenchSettingsObject();
905  }
906 
907  // get tabs
908  public function getAdminTabs()
909  {
911  $ilHelp = $this->help;
912 
913  // $ilHelp->setScreenIdComponent($this->object->getType());
914 
915  $this->ctrl->setParameter($this, "ref_id", $this->object->getRefId());
916 
917  // general settings
918  if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
919  $this->tabs_gui->addTarget(
920  "general_settings",
921  $this->ctrl->getLinkTarget($this, "showBasicSettings"),
922  array("showBasicSettings", "saveBasicSettings"),
923  get_class($this)
924  );
925  }
926 
927  // server info
928  if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
929  $this->tabs_gui->addTarget(
930  "server",
931  $this->ctrl->getLinkTarget($this, "showServerInfo"),
932  array("showServerInfo", "view"),
933  get_class($this)
934  );
935  }
936 
937  if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
938  $this->tabs_gui->addTarget(
939  "cron_jobs",
940  $this->ctrl->getLinkTargetByClass("ilCronManagerGUI", ""),
941  "",
942  get_class($this)
943  );
944 
945  // $tabs_gui->addTarget("system_check",
946  // $this->ctrl->getLinkTarget($this, "check"), array("check","viewScanLog","saveCheckParams","saveCheckCron"), get_class($this));
947 
948  $this->tabs_gui->addTarget(
949  "benchmarks",
950  $this->ctrl->getLinkTarget($this, "benchmark"),
951  "benchmark",
952  get_class($this)
953  );
954  }
955 
956  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
957  $this->tabs_gui->addTarget(
958  "perm_settings",
959  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
960  array("perm","info","owner"),
961  'ilpermissiongui'
962  );
963  }
964  }
965 
969  public function showPHPInfoObject()
970  {
971  phpinfo();
972  exit;
973  }
974 
975  //
976  //
977  // Server Info
978  //
979  //
980 
984  public function setServerInfoSubTabs($a_activate)
985  {
986  $ilTabs = $this->tabs;
989 
990  $ilTabs->addSubTabTarget("server_data", $ilCtrl->getLinkTarget($this, "showServerInfo"));
991 
992  if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
993  $ilTabs->addSubTabTarget("adm_https", $ilCtrl->getLinkTarget($this, "showHTTPS"));
994  $ilTabs->addSubTabTarget("proxy", $ilCtrl->getLinkTarget($this, "showProxy"));
995  $ilTabs->addSubTabTarget("java_server", $ilCtrl->getLinkTarget($this, "showJavaServer"));
996  $ilTabs->addSubTabTarget("webservices", $ilCtrl->getLinkTarget($this, "showWebServices"));
997  }
998 
999  $ilTabs->setSubTabActive($a_activate);
1000  $ilTabs->setTabActive("server");
1001  }
1002 
1006  public function showServerInfoObject()
1007  {
1014  $tpl = $this->tpl;
1015  $ilCtrl = $this->ctrl;
1016  $ilToolbar = $this->toolbar;
1017  $lng = $this->lng;
1018 
1019  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
1020  $button = ilLinkButton::getInstance();
1021  $button->setCaption('vc_information');
1022  $button->setUrl($this->ctrl->getLinkTarget($this, 'showVcsInformation'));
1023  $ilToolbar->addButtonInstance($button);
1024 
1025  $this->initServerInfoForm();
1026  $this->setServerInfoSubTabs("server_data");
1027 
1028  $btpl = new ilTemplate("tpl.server_data.html", true, true, "Modules/SystemFolder");
1029  $btpl->setVariable("FORM", $this->form->getHTML());
1030  $btpl->setVariable("PHP_INFO_TARGET", $ilCtrl->getLinkTarget($this, "showPHPInfo"));
1031  $tpl->setContent($btpl->get());
1032  }
1033 
1039  public function initServerInfoForm()
1040  {
1041  $lng = $this->lng;
1042  $ilClientIniFile = $this->client_ini;
1044 
1045  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1046  $this->form = new ilPropertyFormGUI();
1047 
1048  // installation name
1049  $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), "");
1050  $ne->setValue($ilClientIniFile->readVariable("client", "name"));
1051  $ne->setInfo($ilClientIniFile->readVariable("client", "description"));
1052  $this->form->addItem($ne);
1053 
1054  // client id
1055  $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "");
1056  $ne->setValue(CLIENT_ID);
1057  $this->form->addItem($ne);
1058 
1059  // installation id
1060  $ne = new ilNonEditableValueGUI($lng->txt("inst_id"), "");
1061  $ne->setValue($ilSetting->get("inst_id"));
1062  $this->form->addItem($ne);
1063 
1064  // database version
1065  $ne = new ilNonEditableValueGUI($lng->txt("db_version"), "");
1066  $ne->setValue($ilSetting->get("db_version"));
1067 
1068  include_once("./Services/Database/classes/class.ilDBUpdate.php");
1069  $this->form->addItem($ne);
1070 
1071  // ilias version
1072  $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), "");
1073  $ne->setValue($ilSetting->get("ilias_version"));
1074  $this->form->addItem($ne);
1075 
1076  // host
1077  $ne = new ilNonEditableValueGUI($lng->txt("host"), "");
1078  $ne->setValue($_SERVER["SERVER_NAME"]);
1079  $this->form->addItem($ne);
1080 
1081  // ip & port
1082  $ne = new ilNonEditableValueGUI($lng->txt("ip_address") . " & " . $this->lng->txt("port"), "");
1083  $ne->setValue($_SERVER["SERVER_ADDR"] . ":" . $_SERVER["SERVER_PORT"]);
1084  $this->form->addItem($ne);
1085 
1086  // server
1087  $ne = new ilNonEditableValueGUI($lng->txt("server_software"), "");
1088  $ne->setValue($_SERVER["SERVER_SOFTWARE"]);
1089  $this->form->addItem($ne);
1090 
1091  // http path
1092  $ne = new ilNonEditableValueGUI($lng->txt("http_path"), "");
1093  $ne->setValue(ILIAS_HTTP_PATH);
1094  $this->form->addItem($ne);
1095 
1096  // absolute path
1097  $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), "");
1098  $ne->setValue(ILIAS_ABSOLUTE_PATH);
1099  $this->form->addItem($ne);
1100 
1101  $not_set = $lng->txt("path_not_set");
1102 
1103  // convert
1104  $ne = new ilNonEditableValueGUI($lng->txt("path_to_convert"), "");
1105  $ne->setValue((PATH_TO_CONVERT) ? PATH_TO_CONVERT : $not_set);
1106  $this->form->addItem($ne);
1107 
1108  // zip
1109  $ne = new ilNonEditableValueGUI($lng->txt("path_to_zip"), "");
1110  $ne->setValue((PATH_TO_ZIP) ? PATH_TO_ZIP : $not_set);
1111  $this->form->addItem($ne);
1112 
1113  // unzip
1114  $ne = new ilNonEditableValueGUI($lng->txt("path_to_unzip"), "");
1115  $ne->setValue((PATH_TO_UNZIP) ? PATH_TO_UNZIP : $not_set);
1116  $this->form->addItem($ne);
1117 
1118  // java
1119  $ne = new ilNonEditableValueGUI($lng->txt("path_to_java"), "");
1120  $ne->setValue((PATH_TO_JAVA) ? PATH_TO_JAVA : $not_set);
1121  $this->form->addItem($ne);
1122 
1123  // mkisofs
1124  $ne = new ilNonEditableValueGUI($lng->txt("path_to_mkisofs"), "");
1125  $ne->setValue((PATH_TO_MKISOFS) ? PATH_TO_MKISOFS : $not_set);
1126  $this->form->addItem($ne);
1127 
1128  // latex
1129  $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), "");
1130  $ne->setValue((URL_TO_LATEX) ? URL_TO_LATEX : $not_set);
1131  $this->form->addItem($ne);
1132 
1133 
1134  $this->form->setTitle($lng->txt("server_data"));
1135  $this->form->setFormAction($this->ctrl->getFormAction($this));
1136  }
1137 
1138  //
1139  //
1140  // General Settings
1141  //
1142  //
1143 
1147  public function setGeneralSettingsSubTabs($a_activate)
1148  {
1149  $ilTabs = $this->tabs;
1150  $ilCtrl = $this->ctrl;
1151 
1152  $ilTabs->addSubTabTarget("basic_settings", $ilCtrl->getLinkTarget($this, "showBasicSettings"));
1153  $ilTabs->addSubTabTarget("header_title", $ilCtrl->getLinkTarget($this, "showHeaderTitle"));
1154  $ilTabs->addSubTabTarget("contact_data", $ilCtrl->getLinkTarget($this, "showContactInformation"));
1155  $ilTabs->addSubTabTarget("adm_imprint", $ilCtrl->getLinkTargetByClass("ilimprintgui", "preview"));
1156 
1157  $ilTabs->setSubTabActive($a_activate);
1158  $ilTabs->setTabActive("general_settings");
1159  }
1160 
1161  //
1162  //
1163  // Basic Settings
1164  //
1165  //
1166 
1170  public function showBasicSettingsObject()
1171  {
1172  $tpl = $this->tpl;
1173 
1174  $this->initBasicSettingsForm();
1175  $this->setGeneralSettingsSubTabs("basic_settings");
1176 
1177  $tpl->setContent($this->form->getHTML());
1178  }
1179 
1180 
1184  public function initBasicSettingsForm()
1185  {
1190  $lng = $this->lng;
1192 
1193  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1194  $this->form = new ilPropertyFormGUI();
1195  $lng->loadLanguageModule("pd");
1196 
1197  // installation short title
1198  $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
1199  $ti->setMaxLength(200);
1200  $ti->setSize(40);
1201  $ti->setValue($ilSetting->get("short_inst_name"));
1202  $ti->setInfo($this->lng->txt("short_inst_name_info"));
1203  $this->form->addItem($ti);
1204 
1205 
1206  $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
1207  $cb->setInfo($lng->txt("pub_section_info"));
1208  if (ilPublicSectionSettings::getInstance()->isEnabled()) {
1209  $cb->setChecked(true);
1210  }
1211  $this->form->addItem($cb);
1212 
1213  $this->lng->loadLanguageModule('administration');
1214  $domains = new ilTextInputGUI($this->lng->txt('adm_pub_section_domain_filter'), 'public_section_domains');
1215  $domains->setInfo($this->lng->txt('adm_pub_section_domain_filter_info'));
1216  $domains->setMulti(true);
1217  $domains->setValue(current(ilPublicSectionSettings::getInstance()->getDomains()));
1218  $domains->setMultiValues(ilPublicSectionSettings::getInstance()->getDomains());
1219 
1220  $cb->addSubItem($domains);
1221 
1222 
1223  // Enable Global Profiles
1224  $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
1225  $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
1226  $cb_prop->setChecked($ilSetting->get('enable_global_profiles'));
1227  $cb->addSubItem($cb_prop);
1228 
1229  // search engine
1230  include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
1231  $robot_settings = ilRobotSettings::_getInstance();
1232  $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
1233  $cb2->setInfo($this->lng->txt("enable_search_engine"));
1234  $this->form->addItem($cb2);
1235 
1236  if (!$robot_settings->checkRewrite()) {
1237  $cb2->setAlert($lng->txt("allow_override_alert"));
1238  $cb2->setChecked(false);
1239  $cb2->setDisabled(true);
1240  } else {
1241  if ($ilSetting->get("open_google")) {
1242  $cb2->setChecked(true);
1243  }
1244  }
1245 
1246  // locale
1247  $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
1248  $ti->setMaxLength(80);
1249  $ti->setSize(40);
1250  $ti->setInfo($this->lng->txt("adm_locale_info"));
1251  $ti->setValue($ilSetting->get("locale"));
1252  $this->form->addItem($ti);
1253 
1254  // save and cancel commands
1255  $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
1256 
1257  $this->form->setTitle($lng->txt("basic_settings"));
1258  $this->form->setFormAction($this->ctrl->getFormAction($this));
1259  }
1260 
1265  public function saveBasicSettingsObject()
1266  {
1267  $tpl = $this->tpl;
1268  $lng = $this->lng;
1269  $ilCtrl = $this->ctrl;
1272  $ilErr = $this->error;
1273 
1274  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1275  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1276  }
1277 
1278  $this->initBasicSettingsForm();
1279  if ($this->form->checkInput()) {
1280  $ilSetting->set("short_inst_name", $_POST["short_inst_name"]);
1281 
1282  $public_section = ilPublicSectionSettings::getInstance();
1283  $public_section->setEnabled($this->form->getInput('pub_section'));
1284 
1285  $domains = array();
1286  foreach ((array) $this->form->getInput('public_section_domains') as $domain) {
1287  if (strlen(trim($domain))) {
1288  $domains[] = $domain;
1289  }
1290  }
1291  $public_section->setDomains($domains);
1292  $public_section->save();
1293 
1294  $global_profiles = ($_POST["pub_section"])
1295  ? (int) $_POST['enable_global_profiles']
1296  : 0;
1297  $ilSetting->set('enable_global_profiles', $global_profiles);
1298 
1299  $ilSetting->set("open_google", $_POST["open_google"]);
1300  $ilSetting->set("locale", $_POST["locale"]);
1301 
1302  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1303  $ilCtrl->redirect($this, "showBasicSettings");
1304  }
1305  $this->setGeneralSettingsSubTabs("basic_settings");
1306  $this->form->setValuesByPost();
1307  $tpl->setContent($this->form->getHtml());
1308  }
1309 
1310  //
1311  //
1312  // Header title
1313  //
1314  //
1315 
1319  public function showHeaderTitleObject($a_get_post_values = false)
1320  {
1321  $tpl = $this->tpl;
1322 
1323  $this->setGeneralSettingsSubTabs("header_title");
1324  include_once("./Services/Object/classes/class.ilObjectTranslationTableGUI.php");
1325  $table = new ilObjectTranslationTableGUI($this, "showHeaderTitle", false);
1326  if ($a_get_post_values) {
1327  $vals = array();
1328  foreach ($_POST["title"] as $k => $v) {
1329  $vals[] = array("title" => $v,
1330  "desc" => $_POST["desc"][$k],
1331  "lang" => $_POST["lang"][$k],
1332  "default" => ($_POST["default"] == $k));
1333  }
1334  $table->setData($vals);
1335  } else {
1336  $data = $this->object->getHeaderTitleTranslations();
1337  if (is_array($data["Fobject"])) {
1338  foreach ($data["Fobject"] as $k => $v) {
1339  if ($k == $data["default_language"]) {
1340  $data["Fobject"][$k]["default"] = true;
1341  } else {
1342  $data["Fobject"][$k]["default"] = false;
1343  }
1344  }
1345  } else {
1346  $data["Fobject"] = array();
1347  }
1348  $table->setData($data["Fobject"]);
1349  }
1350  $tpl->setContent($table->getHTML());
1351  }
1352 
1356  public function saveHeaderTitlesObject()
1357  {
1358  $ilCtrl = $this->ctrl;
1359  $lng = $this->lng;
1361  $ilErr = $this->error;
1362 
1363  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1364  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1365  }
1366 
1367  // var_dump($_POST);
1368 
1369  // default language set?
1370  if (!isset($_POST["default"]) && count($_POST["lang"]) > 0) {
1371  ilUtil::sendFailure($lng->txt("msg_no_default_language"));
1372  return $this->showHeaderTitleObject(true);
1373  }
1374 
1375  // all languages set?
1376  if (array_key_exists("", $_POST["lang"])) {
1377  ilUtil::sendFailure($lng->txt("msg_no_language_selected"));
1378  return $this->showHeaderTitleObject(true);
1379  }
1380 
1381  // no single language is selected more than once?
1382  if (count(array_unique($_POST["lang"])) < count($_POST["lang"])) {
1383  ilUtil::sendFailure($lng->txt("msg_multi_language_selected"));
1384  return $this->showHeaderTitleObject(true);
1385  }
1386 
1387  // save the stuff
1388  $this->object->removeHeaderTitleTranslations();
1389  foreach ($_POST["title"] as $k => $v) {
1390  $this->object->addHeaderTitleTranslation(
1392  ilUtil::stripSlashes($_POST["desc"][$k]),
1393  ilUtil::stripSlashes($_POST["lang"][$k]),
1394  ($_POST["default"] == $k)
1395  );
1396  }
1397 
1398  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1399  $ilCtrl->redirect($this, "showHeaderTitle");
1400  }
1401 
1405  public function addHeaderTitleObject()
1406  {
1407  $ilCtrl = $this->ctrl;
1408  $lng = $this->lng;
1409 
1410  if (is_array($_POST["title"])) {
1411  foreach ($_POST["title"] as $k => $v) {
1412  }
1413  }
1414  $k++;
1415  $_POST["title"][$k] = "";
1416  $this->showHeaderTitleObject(true);
1417  }
1418 
1422  public function deleteHeaderTitlesObject()
1423  {
1424  $ilCtrl = $this->ctrl;
1425  $lng = $this->lng;
1426  //var_dump($_POST);
1427  foreach ($_POST["title"] as $k => $v) {
1428  if ($_POST["check"][$k]) {
1429  unset($_POST["title"][$k]);
1430  unset($_POST["desc"][$k]);
1431  unset($_POST["lang"][$k]);
1432  if ($k == $_POST["default"]) {
1433  unset($_POST["default"]);
1434  }
1435  }
1436  }
1437  $this->saveHeaderTitlesObject();
1438  }
1439 
1440 
1441  //
1442  //
1443  // Cron Jobs
1444  //
1445  //
1446 
1447  /*
1448  * OLD GLOBAL CRON JOB SWITCHES (ilSetting)
1449  *
1450  * cron_user_check => obsolete
1451  * cron_inactive_user_delete => obsolete
1452  * cron_inactivated_user_delete => obsolete
1453  * cron_link_check => obsolete
1454  * cron_web_resource_check => migrated
1455  * cron_lucene_index => obsolete
1456  * forum_notification => migrated
1457  * mail_notification => migrated
1458  * disk_quota/enabled => migrated
1459  * crsgrp_ntf => migrated
1460  * cron_upd_adrbook => migrated
1461  */
1462 
1463  public function jumpToCronJobsObject()
1464  {
1465  // #13010 - this is used for external settings
1466  $this->ctrl->redirectByClass("ilCronManagerGUI", "render");
1467  }
1468 
1469 
1470  //
1471  //
1472  // Contact Information
1473  //
1474  //
1475 
1480  {
1481  $tpl = $this->tpl;
1482 
1483  $this->initContactInformationForm();
1484  $this->setGeneralSettingsSubTabs("contact_data");
1485  $tpl->setContent($this->form->getHTML());
1486  }
1487 
1491  public function initContactInformationForm()
1492  {
1493  $lng = $this->lng;
1495 
1496  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1497  $this->form = new ilPropertyFormGUI();
1498 
1499  // first name
1500  $ti = new ilTextInputGUI($this->lng->txt("firstname"), "admin_firstname");
1501  $ti->setMaxLength(64);
1502  $ti->setSize(40);
1503  $ti->setRequired(true);
1504  $ti->setValue($ilSetting->get("admin_firstname"));
1505  $this->form->addItem($ti);
1506 
1507  // last name
1508  $ti = new ilTextInputGUI($this->lng->txt("lastname"), "admin_lastname");
1509  $ti->setMaxLength(64);
1510  $ti->setSize(40);
1511  $ti->setRequired(true);
1512  $ti->setValue($ilSetting->get("admin_lastname"));
1513  $this->form->addItem($ti);
1514 
1515  // title
1516  $ti = new ilTextInputGUI($this->lng->txt("title"), "admin_title");
1517  $ti->setMaxLength(64);
1518  $ti->setSize(40);
1519  $ti->setValue($ilSetting->get("admin_title"));
1520  $this->form->addItem($ti);
1521 
1522  // position
1523  $ti = new ilTextInputGUI($this->lng->txt("position"), "admin_position");
1524  $ti->setMaxLength(64);
1525  $ti->setSize(40);
1526  $ti->setValue($ilSetting->get("admin_position"));
1527  $this->form->addItem($ti);
1528 
1529  // institution
1530  $ti = new ilTextInputGUI($this->lng->txt("institution"), "admin_institution");
1531  $ti->setMaxLength(200);
1532  $ti->setSize(40);
1533  $ti->setValue($ilSetting->get("admin_institution"));
1534  $this->form->addItem($ti);
1535 
1536  // street
1537  $ti = new ilTextInputGUI($this->lng->txt("street"), "admin_street");
1538  $ti->setMaxLength(64);
1539  $ti->setSize(40);
1540  //$ti->setRequired(true);
1541  $ti->setValue($ilSetting->get("admin_street"));
1542  $this->form->addItem($ti);
1543 
1544  // zip code
1545  $ti = new ilTextInputGUI($this->lng->txt("zipcode"), "admin_zipcode");
1546  $ti->setMaxLength(10);
1547  $ti->setSize(5);
1548  //$ti->setRequired(true);
1549  $ti->setValue($ilSetting->get("admin_zipcode"));
1550  $this->form->addItem($ti);
1551 
1552  // city
1553  $ti = new ilTextInputGUI($this->lng->txt("city"), "admin_city");
1554  $ti->setMaxLength(64);
1555  $ti->setSize(40);
1556  //$ti->setRequired(true);
1557  $ti->setValue($ilSetting->get("admin_city"));
1558  $this->form->addItem($ti);
1559 
1560  // country
1561  $ti = new ilTextInputGUI($this->lng->txt("country"), "admin_country");
1562  $ti->setMaxLength(64);
1563  $ti->setSize(40);
1564  //$ti->setRequired(true);
1565  $ti->setValue($ilSetting->get("admin_country"));
1566  $this->form->addItem($ti);
1567 
1568  // phone
1569  $ti = new ilTextInputGUI($this->lng->txt("phone"), "admin_phone");
1570  $ti->setMaxLength(64);
1571  $ti->setSize(40);
1572  //$ti->setRequired(true);
1573  $ti->setValue($ilSetting->get("admin_phone"));
1574  $this->form->addItem($ti);
1575 
1576  // email
1577  $ti = new ilEmailInputGUI($this->lng->txt("email"), "admin_email");
1578  $ti->setMaxLength(64);
1579  $ti->setSize(40);
1580  $ti->setRequired(true);
1581  $ti->allowRFC822(true);
1582  $ti->setValue($ilSetting->get("admin_email"));
1583  $this->form->addItem($ti);
1584 
1585  // feedback recipient
1586  /* currently used in:
1587  - footer
1588  - terms of service: no document found message
1589  */
1590  /*$ti = new ilEmailInputGUI($this->lng->txt("feedback_recipient"), "feedback_recipient");
1591  $ti->setInfo(sprintf($this->lng->txt("feedback_recipient_info"), $this->lng->txt("contact_sysadmin")));
1592  $ti->setMaxLength(64);
1593  $ti->setSize(40);
1594  $ti->setRequired(true);
1595  $ti->allowRFC822(true);
1596  $ti->setValue($ilSetting->get("feedback_recipient"));
1597  $this->form->addItem($ti);*/
1598 
1599  // System support contacts
1600  include_once("./Modules/SystemFolder/classes/class.ilSystemSupportContacts.php");
1601  $ti = new ilTextInputGUI($this->lng->txt("adm_support_contacts"), "adm_support_contacts");
1602  $ti->setMaxLength(500);
1603  $ti->setValue(ilSystemSupportContacts::getList());
1604  //$ti->setSize();
1605  $ti->setInfo($this->lng->txt("adm_support_contacts_info"));
1606  $this->form->addItem($ti);
1607 
1608 
1609  // error recipient
1610  /*$ti = new ilEmailInputGUI($this->lng->txt("error_recipient"), "error_recipient");
1611  $ti->setMaxLength(64);
1612  $ti->setSize(40);
1613  $ti->allowRFC822(true);
1614  $ti->setValue($ilSetting->get("error_recipient"));
1615  $this->form->addItem($ti);*/
1616 
1617  $this->form->addCommandButton("saveContactInformation", $lng->txt("save"));
1618 
1619  $this->form->setTitle($lng->txt("contact_data"));
1620  $this->form->setFormAction($this->ctrl->getFormAction($this));
1621  }
1622 
1628  {
1629  $tpl = $this->tpl;
1630  $lng = $this->lng;
1631  $ilCtrl = $this->ctrl;
1634  $ilErr = $this->error;
1635 
1636  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1637  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1638  }
1639 
1640  $this->initContactInformationForm();
1641  if ($this->form->checkInput()) {
1642  $fs = array("admin_firstname", "admin_lastname", "admin_title", "admin_position",
1643  "admin_institution", "admin_street", "admin_zipcode", "admin_city",
1644  "admin_country", "admin_phone", "admin_email");
1645  foreach ($fs as $f) {
1646  $ilSetting->set($f, $_POST[$f]);
1647  }
1648 
1649  include_once("./Modules/SystemFolder/classes/class.ilSystemSupportContacts.php");
1650  ilSystemSupportContacts::setList($_POST["adm_support_contacts"]);
1651 
1652  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1653  $ilCtrl->redirect($this, "showContactInformation");
1654  } else {
1655  $this->setGeneralSettingsSubTabs("contact_data");
1656  $this->form->setValuesByPost();
1657  $tpl->setContent($this->form->getHtml());
1658  }
1659  }
1660 
1661  //
1662  //
1663  // Web Services
1664  //
1665  //
1666 
1670  public function showWebServicesObject()
1671  {
1672  $tpl = $this->tpl;
1673 
1674  $this->initWebServicesForm();
1675  $this->setServerInfoSubTabs("webservices");
1676  $tpl->setContent($this->form->getHTML());
1677  }
1678 
1682  public function initWebServicesForm()
1683  {
1684  $lng = $this->lng;
1686 
1687  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1688  $this->form = new ilPropertyFormGUI();
1689 
1690  // soap administration
1691  $cb = new ilCheckboxInputGUI($this->lng->txt("soap_user_administration"), "soap_user_administration");
1692  $cb->setInfo($this->lng->txt("soap_user_administration_desc"));
1693  if ($ilSetting->get("soap_user_administration")) {
1694  $cb->setChecked(true);
1695  }
1696  $this->form->addItem($cb);
1697 
1698  // wsdl path
1699  $wsdl = new ilTextInputGUI($this->lng->txt('soap_wsdl_path'), 'soap_wsdl_path');
1700  $wsdl->setInfo(sprintf($this->lng->txt('soap_wsdl_path_info'), "<br />'" . ILIAS_HTTP_PATH . "/webservice/soap/server.php?wsdl'"));
1701  $wsdl->setValue((string) $ilSetting->get('soap_wsdl_path'));
1702  $wsdl->setSize(60);
1703  $wsdl->setMaxLength(255);
1704  $this->form->addItem($wsdl);
1705 
1706  // response timeout
1707  $ctime = new ilNumberInputGUI($this->lng->txt('soap_connect_timeout'), 'ctimeout');
1708  $ctime->setMinValue(1);
1709  $ctime->setSize(2);
1710  $ctime->setMaxLength(3);
1711  include_once './Services/WebServices/SOAP/classes/class.ilSoapClient.php';
1712  $ctime->setValue((int) $ilSetting->get('soap_connect_timeout', ilSoapClient::DEFAULT_CONNECT_TIMEOUT));
1713  $ctime->setInfo($this->lng->txt('soap_connect_timeout_info'));
1714  $this->form->addItem($ctime);
1715 
1716  $this->form->addCommandButton("saveWebServices", $lng->txt("save"));
1717 
1718  $this->form->setTitle($lng->txt("webservices"));
1719  $this->form->setFormAction($this->ctrl->getFormAction($this));
1720  }
1721 
1726  public function saveWebServicesObject()
1727  {
1728  $tpl = $this->tpl;
1729  $lng = $this->lng;
1730  $ilCtrl = $this->ctrl;
1733  $ilErr = $this->error;
1734 
1735  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1736  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1737  }
1738 
1739  $this->initWebServicesForm();
1740  if ($this->form->checkInput()) {
1741  $ilSetting->set('soap_user_administration', $this->form->getInput('soap_user_administration'));
1742  $ilSetting->set('soap_wsdl_path', trim($this->form->getInput('soap_wsdl_path')));
1743  $ilSetting->set('soap_connect_timeout', $this->form->getInput('ctimeout'));
1744 
1745  ilUtil::sendSuccess($lng->txt('msg_obj_modified'), true);
1746  $ilCtrl->redirect($this, 'showWebServices');
1747  } else {
1748  $this->setGeneralSettingsSubTabs("webservices");
1749  $this->form->setValuesByPost();
1750  $tpl->setContent($this->form->getHtml());
1751  }
1752  }
1753 
1754  //
1755  //
1756  // Java Server
1757  //
1758  //
1759 
1763  public function showJavaServerObject()
1764  {
1765  $tpl = $this->tpl;
1766 
1767  $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.java_settings.html', 'Modules/SystemFolder');
1768 
1769  $GLOBALS['lng']->loadLanguageModule('search');
1770 
1771  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1772  $toolbar = new ilToolbarGUI();
1773  $toolbar->addButton(
1774  $this->lng->txt('lucene_create_ini'),
1775  $this->ctrl->getLinkTarget($this, 'createJavaServerIni')
1776  );
1777  $tpl->setVariable('ACTION_BUTTONS', $toolbar->getHTML());
1778 
1779  $this->initJavaServerForm();
1780  $this->setServerInfoSubTabs("java_server");
1781  $tpl->setVariable('SETTINGS_TABLE', $this->form->getHTML());
1782  }
1783 
1788  public function createJavaServerIniObject()
1789  {
1790  $this->setGeneralSettingsSubTabs('java_server');
1791  $this->initJavaServerIniForm();
1792  $this->tpl->setContent($this->form->getHTML());
1793  }
1794 
1795  protected function initJavaServerIniForm()
1796  {
1797  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1798 
1799  $this->form = new ilPropertyFormGUI();
1800 
1801  $GLOBALS['lng']->loadLanguageModule('search');
1802 
1803  $this->form->setTitle($this->lng->txt('lucene_tbl_create_ini'));
1804  $this->form->setFormAction($this->ctrl->getFormAction($this, 'createJavaServerIni'));
1805  $this->form->addCommandButton('downloadJavaServerIni', $this->lng->txt('lucene_download_ini'));
1806  $this->form->addCommandButton('showJavaServer', $this->lng->txt('cancel'));
1807 
1808  // Host
1809  $ip = new ilTextInputGUI($this->lng->txt('lucene_host'), 'ho');
1810  $ip->setInfo($this->lng->txt('lucene_host_info'));
1811  $ip->setMaxLength(128);
1812  $ip->setSize(32);
1813  $ip->setRequired(true);
1814  $this->form->addItem($ip);
1815 
1816  // Port
1817  $port = new ilNumberInputGUI($this->lng->txt('lucene_port'), 'po');
1818  $port->setSize(5);
1819  $port->setMinValue(1);
1820  $port->setMaxValue(65535);
1821  $port->setRequired(true);
1822  $this->form->addItem($port);
1823 
1824  // Index Path
1825  $path = new ilTextInputGUI($this->lng->txt('lucene_index_path'), 'in');
1826  $path->setSize(80);
1827  $path->setMaxLength(1024);
1828  $path->setInfo($this->lng->txt('lucene_index_path_info'));
1829  $path->setRequired(true);
1830  $this->form->addItem($path);
1831 
1832  // Logging
1833  $log = new ilTextInputGUI($this->lng->txt('lucene_log'), 'lo');
1834  $log->setSize(80);
1835  $log->setMaxLength(1024);
1836  $log->setInfo($this->lng->txt('lucene_log_info'));
1837  $log->setRequired(true);
1838  $this->form->addItem($log);
1839 
1840  // Level
1841  $lev = new ilSelectInputGUI($this->lng->txt('lucene_level'), 'le');
1842  $lev->setOptions(array(
1843  'DEBUG' => 'DEBUG',
1844  'INFO' => 'INFO',
1845  'WARN' => 'WARN',
1846  'ERROR' => 'ERROR',
1847  'FATAL' => 'FATAL'));
1848  $lev->setValue('INFO');
1849  $lev->setRequired(true);
1850  $this->form->addItem($lev);
1851 
1852  // CPU
1853  $cpu = new ilNumberInputGUI($this->lng->txt('lucene_cpu'), 'cp');
1854  $cpu->setValue(1);
1855  $cpu->setSize(1);
1856  $cpu->setMaxLength(2);
1857  $cpu->setMinValue(1);
1858  $cpu->setRequired(true);
1859  $this->form->addItem($cpu);
1860 
1861  // Max file size
1862  $fs = new ilNumberInputGUI($this->lng->txt('lucene_max_fs'), 'fs');
1863  $fs->setInfo($this->lng->txt('lucene_max_fs_info'));
1864  $fs->setValue(500);
1865  $fs->setSize(4);
1866  $fs->setMaxLength(4);
1867  $fs->setMinValue(1);
1868  $fs->setRequired(true);
1869  $this->form->addItem($fs);
1870 
1871  return true;
1872  }
1873 
1878  protected function downloadJavaServerIniObject()
1879  {
1880  $this->initJavaServerIniForm();
1881  if ($this->form->checkInput()) {
1882  include_once './Services/WebServices/RPC/classes/class.ilRpcIniFileWriter.php';
1883  $ini = new ilRpcIniFileWriter();
1884  $ini->setHost($this->form->getInput('ho'));
1885  $ini->setPort($this->form->getInput('po'));
1886  $ini->setIndexPath($this->form->getInput('in'));
1887  $ini->setLogPath($this->form->getInput('lo'));
1888  $ini->setLogLevel($this->form->getInput('le'));
1889  $ini->setNumThreads($this->form->getInput('cp'));
1890  $ini->setMaxFileSize($this->form->getInput('fs'));
1891 
1892  $ini->write();
1893  ilUtil::deliverData($ini->getIniString(), 'ilServer.ini', 'text/plain', 'utf-8');
1894  return true;
1895  }
1896 
1897  $this->form->setValuesByPost();
1898  ilUtil::sendFailure($this->lng->txt('err_check_input'));
1899  $this->setGeneralSettingsSubTabs('java_server');
1900  $this->tpl->setContent($this->form->getHTML());
1901  return true;
1902  }
1903 
1907  public function initJavaServerForm()
1908  {
1909  $lng = $this->lng;
1911 
1912  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1913  $this->form = new ilPropertyFormGUI();
1914 
1915  // host
1916  $ti = new ilTextInputGUI($this->lng->txt("java_server_host"), "rpc_server_host");
1917  $ti->setMaxLength(64);
1918  $ti->setSize(32);
1919  $ti->setValue($ilSetting->get("rpc_server_host"));
1920  $this->form->addItem($ti);
1921 
1922  // port
1923  $ti = new ilNumberInputGUI($this->lng->txt("java_server_port"), "rpc_server_port");
1924  $ti->setMaxLength(5);
1925  $ti->setSize(5);
1926  $ti->setValue($ilSetting->get("rpc_server_port"));
1927  $this->form->addItem($ti);
1928 
1929  // pdf fonts
1930  $pdf = new ilFormSectionHeaderGUI();
1931  $pdf->setTitle($this->lng->txt('rpc_pdf_generation'));
1932  $this->form->addItem($pdf);
1933 
1934  $pdf_font = new ilTextInputGUI($this->lng->txt('rpc_pdf_font'), 'rpc_pdf_font');
1935  $pdf_font->setInfo($this->lng->txt('rpc_pdf_font_info'));
1936  $pdf_font->setSize(64);
1937  $pdf_font->setMaxLength(1024);
1938  $pdf_font->setRequired(true);
1939  $pdf_font->setValue(
1940  $ilSetting->get('rpc_pdf_font', 'Helvetica, unifont')
1941  );
1942  $this->form->addItem($pdf_font);
1943 
1944 
1945  // save and cancel commands
1946  $this->form->addCommandButton("saveJavaServer", $lng->txt("save"));
1947 
1948  $this->form->setTitle($lng->txt("java_server"));
1949  $this->form->setDescription($lng->txt("java_server_info") .
1950  '<br /><a href="Services/WebServices/RPC/lib/README.md" target="_blank">' .
1951  $lng->txt("java_server_readme") . '</a>');
1952  $this->form->setFormAction($this->ctrl->getFormAction($this));
1953  }
1954 
1959  public function saveJavaServerObject()
1960  {
1961  $tpl = $this->tpl;
1962  $lng = $this->lng;
1963  $ilCtrl = $this->ctrl;
1966  $ilErr = $this->error;
1967 
1968  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1969  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1970  }
1971 
1972  $this->initJavaServerForm();
1973  if ($this->form->checkInput()) {
1974  $ilSetting->set("rpc_server_host", trim($_POST["rpc_server_host"]));
1975  $ilSetting->set("rpc_server_port", trim($_POST["rpc_server_port"]));
1976  $ilSetting->set('rpc_pdf_font', ilUtil::stripSlashes($_POST['rpc_pdf_font']));
1977  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1978  $ilCtrl->redirect($this, "showJavaServer");
1979 
1980  // TODO check settings, ping server
1981  } else {
1982  $this->setGeneralSettingsSubTabs("java_server");
1983  $this->form->setValuesByPost();
1984  $tpl->setContent($this->form->getHtml());
1985  }
1986  }
1987 
1995  public function showProxyObject()
1996  {
1997  $tpl = $this->tpl;
1998  $ilAccess = $this->access;
1999  $ilErr = $this->error;
2000 
2001  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2002  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
2003  }
2004 
2005  require_once './Services/Http/classes/class.ilProxySettings.php';
2006 
2007  $this->initProxyForm();
2008  $this->form->setValuesByArray(array(
2009  'proxy_status' => ilProxySettings::_getInstance()->isActive(),
2010  'proxy_host' => ilProxySettings::_getInstance()->getHost(),
2011  'proxy_port' => ilProxySettings::_getInstance()->getPort()
2012  ));
2013  if (ilProxySettings::_getInstance()->isActive()) {
2014  $this->printProxyStatus();
2015  }
2016 
2017  $tpl->setContent($this->form->getHTML());
2018  }
2019 
2027  private function printProxyStatus()
2028  {
2029  try {
2030  ilProxySettings::_getInstance()->checkConnection();
2031  $this->form->getItemByPostVar('proxy_availability')->setHTML(
2032  '<img src="' . ilUtil::getImagePath('icon_ok.svg') . '" /> ' .
2033  $this->lng->txt('proxy_connectable')
2034  );
2035  } catch (ilProxyException $e) {
2036  $this->form->getItemByPostVar('proxy_availability')->setHTML(
2037  '<img src="' . ilUtil::getImagePath('icon_not_ok.svg') . '" /> ' .
2038  $this->lng->txt('proxy_not_connectable')
2039  );
2040  ilUtil::sendFailure(sprintf($this->lng->txt('proxy_socket_error'), $e->getMessage()));
2041  }
2042  }
2043 
2051  public function saveProxyObject()
2052  {
2053  $tpl = $this->tpl;
2054  $ilAccess = $this->access;
2055  $ilErr = $this->error;
2056  $lng = $this->lng;
2057 
2058  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2059  $ilErr->raiseError($lng->txt('permission_denied'), $ilErr->MESSAGE);
2060  }
2061 
2062  require_once './Services/Http/classes/class.ilProxySettings.php';
2063 
2064  $this->initProxyForm();
2065  $isFormValid = $this->form->checkInput();
2066  ilProxySettings::_getInstance()->isActive((int) $this->form->getInput('proxy_status'))
2067  ->setHost(trim($this->form->getInput('proxy_host')))
2068  ->setPort(trim($this->form->getInput('proxy_port')));
2069  if ($isFormValid) {
2070  if (ilProxySettings::_getInstance()->isActive()) {
2071  if (!strlen(ilProxySettings::_getInstance()->getHost())) {
2072  $isFormValid = false;
2073  $this->form->getItemByPostVar('proxy_host')->setAlert($lng->txt('msg_input_is_required'));
2074  }
2075  if (!strlen(ilProxySettings::_getInstance()->getPort())) {
2076  $isFormValid = false;
2077  $this->form->getItemByPostVar('proxy_port')->setAlert($lng->txt('msg_input_is_required'));
2078  }
2079  if (!preg_match('/[0-9]{1,}/', ilProxySettings::_getInstance()->getPort()) ||
2080  ilProxySettings::_getInstance()->getPort() < 0 ||
2081  ilProxySettings::_getInstance()->getPort() > 65535) {
2082  $isFormValid = false;
2083  $this->form->getItemByPostVar('proxy_port')->setAlert($lng->txt('proxy_port_numeric'));
2084  }
2085  }
2086 
2087  if ($isFormValid) {
2089  ilUtil::sendSuccess($lng->txt('saved_successfully'));
2090  if (ilProxySettings::_getInstance()->isActive()) {
2091  $this->printProxyStatus();
2092  }
2093  } else {
2094  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
2095  }
2096  }
2097 
2098  $this->form->setValuesByPost();
2099  $tpl->setContent($this->form->getHTML());
2100  }
2101 
2109  private function initProxyForm()
2110  {
2111  $lng = $this->lng;
2112  $ilCtrl = $this->ctrl;
2113 
2114  $this->setServerInfoSubTabs('proxy');
2115 
2116  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
2117  $this->form = new ilPropertyFormGUI();
2118  $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveProxy'));
2119 
2120  // Proxy status
2121  $proxs = new ilCheckboxInputGUI($lng->txt('proxy_status'), 'proxy_status');
2122  $proxs->setInfo($lng->txt('proxy_status_info'));
2123  $proxs->setValue(1);
2124  $this->form->addItem($proxs);
2125 
2126  // Proxy availability
2127  $proxa = new ilCustomInputGUI('', 'proxy_availability');
2128  $proxs->addSubItem($proxa);
2129 
2130  // Proxy
2131  $prox = new ilTextInputGUI($lng->txt('proxy_host'), 'proxy_host');
2132  $prox->setInfo($lng->txt('proxy_host_info'));
2133  $proxs->addSubItem($prox);
2134 
2135  // Proxy Port
2136  $proxp = new ilTextInputGUI($lng->txt('proxy_port'), 'proxy_port');
2137  $proxp->setInfo($lng->txt('proxy_port_info'));
2138  $proxp->setSize(10);
2139  $proxp->setMaxLength(10);
2140  $proxs->addSubItem($proxp);
2141 
2142  // save and cancel commands
2143  $this->form->addCommandButton('saveProxy', $lng->txt('save'));
2144  }
2145 
2146  public function showHTTPSObject()
2147  {
2148  $tpl = $this->tpl;
2149  $ilAccess = $this->access;
2150  $ilErr = $this->error;
2151 
2152  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2153  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
2154  }
2155 
2156  $form = $this->initHTTPSForm();
2157  $tpl->setContent($form->getHTML());
2158  }
2159 
2160  public function saveHTTPSObject()
2161  {
2162  $tpl = $this->tpl;
2163  $lng = $this->lng;
2164  $ilCtrl = $this->ctrl;
2165 
2166  $form = $this->initHTTPSForm();
2167  if ($form->checkInput()) {
2168  $security = ilSecuritySettings::_getInstance();
2169 
2170  // ilias https handling settings
2171  $security->setHTTPSEnabled($_POST["https_enabled"]);
2172 
2173  if ($security->validate($form)) {
2174  $security->save();
2175 
2176  ilUtil::sendSuccess($lng->txt('saved_successfully'), true);
2177  $ilCtrl->redirect($this, "showHTTPS");
2178  }
2179  }
2180 
2181  $form->setValuesByPost();
2182  $tpl->setContent($form->getHTML());
2183  }
2184 
2185  private function initHTTPSForm()
2186  {
2187  $ilCtrl = $this->ctrl;
2188  $lng = $this->lng;
2189 
2190  $this->setServerInfoSubTabs('adm_https');
2191 
2192  $lng->loadLanguageModule('ps');
2193 
2194  include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2195  $security = ilSecuritySettings::_getInstance();
2196 
2197  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
2198  $form = new ilPropertyFormGUI();
2199  $form->setTitle($lng->txt("adm_https"));
2200  $form->setFormAction($ilCtrl->getFormAction($this, 'saveHTTPS'));
2201 
2202  $check2 = new ilCheckboxInputGUI($lng->txt('activate_https'), 'https_enabled');
2203  $check2->setChecked($security->isHTTPSEnabled() ? 1 : 0);
2204  $check2->setValue(1);
2205  $form->addItem($check2);
2206 
2207  // save and cancel commands
2208  $form->addCommandButton('saveHTTPS', $lng->txt('save'));
2209 
2210  return $form;
2211  }
2212 
2213  public function addToExternalSettingsForm($a_form_id)
2214  {
2215  switch ($a_form_id) {
2217 
2218  include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2219  $security = ilSecuritySettings::_getInstance();
2220 
2221  $subitems = null;
2222 
2223  $fields['activate_https'] =
2224  array($security->isHTTPSEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL);
2225 
2226  return array("general_settings" => array("showHTTPS", $fields));
2227  }
2228  }
2229 
2233  public static function _goto()
2234  {
2235  global $DIC;
2236 
2237  $ilAccess = $DIC->access();
2238  $ilErr = $DIC["ilErr"];
2239  $lng = $DIC->language();
2240 
2241  $a_target = SYSTEM_FOLDER_ID;
2242 
2243  if ($ilAccess->checkAccess("read", "", $a_target)) {
2244  ilUtil::redirect("ilias.php?baseClass=ilAdministrationGUI");
2245  exit;
2246  } else {
2247  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2248  ilUtil::sendFailure(sprintf(
2249  $lng->txt("msg_no_perm_read_item"),
2251  ), true);
2253  }
2254  }
2255  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2256  }
2257 
2261  protected function showVcsInformationObject()
2262  {
2263  $vc_info = array();
2264 
2265  require_once 'Services/Administration/classes/class.ilSubversionInformation.php';
2266  require_once 'Services/Administration/classes/class.ilGitInformation.php';
2267 
2268  foreach (array(new ilSubversionInformation(), new ilGitInformation()) as $vc) {
2269  $html = $vc->getInformationAsHtml();
2270  if ($html) {
2271  $vc_info[] = $html;
2272  }
2273  }
2274 
2275  if ($vc_info) {
2276  ilUtil::sendInfo(implode("<br />", $vc_info));
2277  } else {
2278  ilUtil::sendInfo($this->lng->txt('vc_information_not_determined'));
2279  }
2280 
2281  $this->showServerInfoObject();
2282  }
2283 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
saveJavaServerObject()
Save java server form.
initWebServicesForm()
Init web services form.
addHeaderTitleTranslationObject()
adds a translation form & save post vars to session
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
showWebServicesObject()
Show Web Services.
switchBenchModuleObject()
save benchmark settings
showPHPInfoObject()
Show PHP Information.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
benchmarkSubTabs($a_current)
Benchmark sub tabs.
setValue($a_value)
Set Value.
showContactInformationObject()
Show contact information.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
initJavaServerForm()
Init java server form.
This class represents a property form user interface.
Class ilGitInformation.
showProxyObject()
Show proxy settings.
global $DIC
Definition: saml.php:7
saveBasicSettingsObject()
Save basic settings form.
$_GET["client_id"]
$pdf
Definition: example_001.php:31
This class represents a section header in a property form.
static setList($a_list)
Set list.
$code
Definition: example_050.php:99
saveProxyObject()
Save proxy settings.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
showHeaderTitleObject($a_get_post_values=false)
Show header title.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
benchmarkObject()
Benchmark settings.
changeHeaderTitleObject()
edit header title form
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
const DEFAULT_CONNECT_TIMEOUT
deleteHeaderTitlesObject()
Remove header titles.
clearBenchObject()
delete all benchmark records
removeTranslationObject()
removes a translation form & save post vars to session
Class for proxy related exception handling in ILIAS.
Class ilObjectOwnershipManagementGUI.
saveContactInformationObject()
Save contact information form.
user()
Definition: user.php:4
Class ilObjSystemFolderGUI.
Creates a java server ini file for the current client
global $ilCtrl
Definition: ilias.php:18
showDbBenchResults($a_mode)
Show Db Benchmark Results.
setInfo($a_info)
Set Information Text.
static _getInstance()
Get instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setChecked($a_checked)
Set Checked.
showDbBenchByFirstTableObject()
Show db benchmark results.
prepareOutput($a_show_subobjects=true)
prepare output
checkObject()
displays system check menu
showDbBenchSortedBySqlObject()
Show db benchmark results.
This class represents a property in a property form.
printProxyStatus()
Print proxy settings.
saveHeaderTitlesObject()
Save header titles.
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
showDbBenchChronologicalObject()
Show db benchmark results.
if(isset($_POST['submit'])) $form
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
downloadJavaServerIniObject()
Create and offer server ini file for download.
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setOptions($a_options)
Set Options.
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
addHeaderTitleObject()
Add a header title.
Class ilSubversionInformation.
Create styles array
The data for the language used.
setSystemCheckSubTabs($a_activate)
Set sub tabs for general settings.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showDbBenchSlowestFirstObject()
Show db benchmark results.
setSize($a_size)
Set Size.
static _goto()
goto target group
setServerInfoSubTabs($a_activate)
Set sub tabs for server info.
Class ilImprintGUI.
This class represents a custom property in a property form.
saveHeaderTitleObject()
save header title
TableGUI class for title/description translations.
settings()
Definition: settings.php:2
setMaxLength($a_maxlength)
Set Max Length.
saveWebServicesObject()
Save web services form.
initContactInformationForm()
Init contact information form.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
This class represents a non editable value in a property form.
Create new PHPExcel object
obj_idprivate
global $ilSetting
Definition: privfeed.php:17
initProxyForm()
Initialize proxy settings form.
initServerInfoForm()
Init server info form.
global $ilBench
Definition: ilias.php:18
global $ilDB
$ret
Definition: parser.php:6
Class ilCronManagerGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
showJavaServerObject()
Show Java Server Settings.
setGeneralSettingsSubTabs($a_activate)
Set sub tabs for general settings.
if(empty($password)) $table
Definition: pwgen.php:24
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
__construct($a_data, $a_id, $a_call_by_reference)
Constructor public.
createJavaServerIniObject()
Create a server ini file.
ILIAS Data Validator & Recovery Tool.
viewObject()
show admin subpanels and basic settings form
setValue($a_value)
Set Value.
static redirect($a_script)
static _getInstance()
Getter for unique instance.
static _getInstance()
Get instance of ilSecuritySettings.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
$key
Definition: croninfo.php:18
$_POST["username"]
$html
Definition: example_001.php:87
saveBenchSettingsObject()
Save benchmark settings.
showBasicSettingsObject()
Show basic settings.
$ini
Definition: raiseError.php:4