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