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