ILIAS  release_4-4 Revision
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->addSubtab("settings",
759  $lng->txt("settings"),
760  $ilCtrl->getLinkTarget($this, "benchmark"));
761 
762  $rec = $ilBench->getDbBenchRecords();
763  if (count($rec) > 0)
764  {
765  $ilTabs->addSubtab("chronological",
766  $lng->txt("adm_db_bench_chronological"),
767  $ilCtrl->getLinkTarget($this, "showDbBenchChronological"));
768  $ilTabs->addSubtab("slowest_first",
769  $lng->txt("adm_db_bench_slowest_first"),
770  $ilCtrl->getLinkTarget($this, "showDbBenchSlowestFirst"));
771  $ilTabs->addSubtab("sorted_by_sql",
772  $lng->txt("adm_db_bench_sorted_by_sql"),
773  $ilCtrl->getLinkTarget($this, "showDbBenchSortedBySql"));
774  $ilTabs->addSubtab("by_first_table",
775  $lng->txt("adm_db_bench_by_first_table"),
776  $ilCtrl->getLinkTarget($this, "showDbBenchByFirstTable"));
777  }
778 
779  $ilTabs->activateSubTab($a_current);
780  }
781 
782 
787  {
788  global $ilBench;
789 
790  if ($_POST["enable_db_bench"])
791  {
792  $ilBench->enableDbBench(true, ilUtil::stripSlashes($_POST["db_bench_user"]));
793  }
794  else
795  {
796  $ilBench->enableDbBench(false);
797  }
798 
799  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
800 
801  $this->ctrl->redirect($this, "benchmark");
802  }
803 
804 
809  {
810  global $ilBench;
811 
812  $this->ctrl->setParameter($this,'cur_mod',$_POST['module']);
813  $this->ctrl->redirect($this, "benchmark");
814  }
815 
816 
820  function clearBenchObject()
821  {
822  global $ilBench;
823 
824  $ilBench->clearData();
825  $this->saveBenchSettingsObject();
826 
827  }
828 
829  // get tabs
830  function getAdminTabs(&$tabs_gui)
831  {
832  global $rbacsystem, $ilHelp;
833 
834 // $ilHelp->setScreenIdComponent($this->object->getType());
835 
836  $this->ctrl->setParameter($this,"ref_id",$this->object->getRefId());
837 
838  // general settings
839  if ($rbacsystem->checkAccess("write",$this->object->getRefId()))
840  {
841  $tabs_gui->addTarget("general_settings",
842  $this->ctrl->getLinkTarget($this, "showBasicSettings"),
843  array("showBasicSettings", "saveBasicSettings"), get_class($this));
844  }
845 
846  // server info
847  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
848  {
849  $tabs_gui->addTarget("server",
850  $this->ctrl->getLinkTarget($this, "showServerInfo"),
851  array("showServerInfo", "view"), get_class($this));
852  }
853 
854  if ($rbacsystem->checkAccess("write",$this->object->getRefId()))
855  {
856  $tabs_gui->addTarget("cron_jobs",
857  $this->ctrl->getLinkTargetByClass("ilCronManagerGUI", ""), "", get_class($this));
858 
859  $tabs_gui->addTarget("system_check",
860  $this->ctrl->getLinkTarget($this, "check"), array("check","viewScanLog","saveCheckParams","saveCheckCron"), get_class($this));
861 
862  $tabs_gui->addTarget("benchmarks",
863  $this->ctrl->getLinkTarget($this, "benchmark"), "benchmark", get_class($this));
864  }
865 
866  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
867  {
868  $tabs_gui->addTarget("perm_settings",
869  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
870  }
871  }
872 
876  function showPHPInfoObject()
877  {
878  phpinfo();
879  exit;
880  }
881 
882  //
883  //
884  // Server Info
885  //
886  //
887 
891  function setServerInfoSubTabs($a_activate)
892  {
893  global $ilTabs, $ilCtrl, $rbacsystem;
894 
895  $ilTabs->addSubTabTarget("server_data", $ilCtrl->getLinkTarget($this, "showServerInfo"));
896 
897  if ($rbacsystem->checkAccess("write",$this->object->getRefId()))
898  {
899  $ilTabs->addSubTabTarget("adm_https", $ilCtrl->getLinkTarget($this, "showHTTPS"));
900  $ilTabs->addSubTabTarget("proxy", $ilCtrl->getLinkTarget($this, "showProxy"));
901  $ilTabs->addSubTabTarget("java_server", $ilCtrl->getLinkTarget($this, "showJavaServer"));
902  $ilTabs->addSubTabTarget("webservices", $ilCtrl->getLinkTarget($this, "showWebServices"));
903  }
904 
905  $ilTabs->setSubTabActive($a_activate);
906  $ilTabs->setTabActive("server");
907  }
908 
912  function showServerInfoObject()
913  {
920  global $tpl, $ilCtrl, $ilToolbar, $lng;
921 
922  $ilToolbar->addButton($lng->txt('vc_information'), $this->ctrl->getLinkTarget($this, 'showVcsInformation'));
923 
924  $this->initServerInfoForm();
925  $this->setServerInfoSubTabs("server_data");
926 
927  $btpl = new ilTemplate("tpl.server_data.html", true, true, "Modules/SystemFolder");
928  $btpl->setVariable("FORM", $this->form->getHTML());
929  $btpl->setVariable("PHP_INFO_TARGET", $ilCtrl->getLinkTarget($this, "showPHPInfo"));
930  $tpl->setContent($btpl->get());
931  }
932 
938  public function initServerInfoForm()
939  {
940  global $lng, $ilClientIniFile, $ilSetting;
941 
942  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
943  $this->form = new ilPropertyFormGUI();
944 
945  // installation name
946  $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), "");
947  $ne->setValue($ilClientIniFile->readVariable("client","name"));
948  $ne->setInfo($ilClientIniFile->readVariable("client","description"));
949  $this->form->addItem($ne);
950 
951  // client id
952  $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "");
953  $ne->setValue(CLIENT_ID);
954  $this->form->addItem($ne);
955 
956  // installation id
957  $ne = new ilNonEditableValueGUI($lng->txt("inst_id"), "");
958  $ne->setValue($ilSetting->get("inst_id"));
959  $this->form->addItem($ne);
960 
961  // database version
962  $ne = new ilNonEditableValueGUI($lng->txt("db_version"), "");
963  $ne->setValue($ilSetting->get("db_version"));
964 
965  include_once ("./Services/Database/classes/class.ilDBUpdate.php");
966  $this->form->addItem($ne);
967 
968  // ilias version
969  $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), "");
970  $ne->setValue($ilSetting->get("ilias_version"));
971  $this->form->addItem($ne);
972 
973  // host
974  $ne = new ilNonEditableValueGUI($lng->txt("host"), "");
975  $ne->setValue($_SERVER["SERVER_NAME"]);
976  $this->form->addItem($ne);
977 
978  // ip & port
979  $ne = new ilNonEditableValueGUI($lng->txt("ip_address")." & ".$this->lng->txt("port"), "");
980  $ne->setValue($_SERVER["SERVER_ADDR"].":".$_SERVER["SERVER_PORT"]);
981  $this->form->addItem($ne);
982 
983  // server
984  $ne = new ilNonEditableValueGUI($lng->txt("server_software"), "");
985  $ne->setValue($_SERVER["SERVER_SOFTWARE"]);
986  $this->form->addItem($ne);
987 
988  // http path
989  $ne = new ilNonEditableValueGUI($lng->txt("http_path"), "");
990  $ne->setValue(ILIAS_HTTP_PATH);
991  $this->form->addItem($ne);
992 
993  // absolute path
994  $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), "");
996  $this->form->addItem($ne);
997 
998  $not_set = $lng->txt("path_not_set");
999 
1000  // convert
1001  $ne = new ilNonEditableValueGUI($lng->txt("path_to_convert"), "");
1002  $ne->setValue((PATH_TO_CONVERT) ? PATH_TO_CONVERT : $not_set);
1003  $this->form->addItem($ne);
1004 
1005  // zip
1006  $ne = new ilNonEditableValueGUI($lng->txt("path_to_zip"), "");
1007  $ne->setValue((PATH_TO_ZIP) ? PATH_TO_ZIP : $not_set);
1008  $this->form->addItem($ne);
1009 
1010  // unzip
1011  $ne = new ilNonEditableValueGUI($lng->txt("path_to_unzip"), "");
1012  $ne->setValue((PATH_TO_UNZIP) ? PATH_TO_UNZIP : $not_set);
1013  $this->form->addItem($ne);
1014 
1015  // java
1016  $ne = new ilNonEditableValueGUI($lng->txt("path_to_java"), "");
1017  $ne->setValue((PATH_TO_JAVA) ? PATH_TO_JAVA : $not_set);
1018  $this->form->addItem($ne);
1019 
1020  // htmldoc
1021  $ne = new ilNonEditableValueGUI($lng->txt("path_to_htmldoc"), "");
1022  $ne->setValue((PATH_TO_HTMLDOC) ? PATH_TO_HTMLDOC : $not_set);
1023  $this->form->addItem($ne);
1024 
1025  // mkisofs
1026  $ne = new ilNonEditableValueGUI($lng->txt("path_to_mkisofs"), "");
1027  $ne->setValue((PATH_TO_MKISOFS) ? PATH_TO_MKISOFS : $not_set);
1028  $this->form->addItem($ne);
1029 
1030  // latex
1031  $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), "");
1032  $ne->setValue((URL_TO_LATEX) ? URL_TO_LATEX : $not_set);
1033  $this->form->addItem($ne);
1034 
1035 
1036  $this->form->setTitle($lng->txt("server_data"));
1037  $this->form->setFormAction($this->ctrl->getFormAction($this));
1038 
1039  }
1040 
1041  //
1042  //
1043  // General Settings
1044  //
1045  //
1046 
1050  function setGeneralSettingsSubTabs($a_activate)
1051  {
1052  global $ilTabs, $ilCtrl;
1053 
1054  $ilTabs->addSubTabTarget("basic_settings", $ilCtrl->getLinkTarget($this, "showBasicSettings"));
1055  $ilTabs->addSubTabTarget("header_title", $ilCtrl->getLinkTarget($this, "showHeaderTitle"));
1056  $ilTabs->addSubTabTarget("contact_data", $ilCtrl->getLinkTarget($this, "showContactInformation"));
1057  $ilTabs->addSubTabTarget("adm_imprint", $ilCtrl->getLinkTargetByClass("ilimprintgui", "preview"));
1058 
1059  $ilTabs->setSubTabActive($a_activate);
1060  $ilTabs->setTabActive("general_settings");
1061  }
1062 
1063  //
1064  //
1065  // Basic Settings
1066  //
1067  //
1068 
1073  {
1074  global $tpl;
1075 
1076  $this->initBasicSettingsForm();
1077  $this->setGeneralSettingsSubTabs("basic_settings");
1078 
1079  $tpl->setContent($this->form->getHTML());
1080  }
1081 
1082 
1086  public function initBasicSettingsForm()
1087  {
1092  global $lng, $ilSetting;
1093 
1094  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1095  $this->form = new ilPropertyFormGUI();
1096  $lng->loadLanguageModule("pd");
1097 
1098  // installation short title
1099  $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
1100  $ti->setMaxLength(200);
1101  $ti->setSize(40);
1102  $ti->setValue($ilSetting->get("short_inst_name"));
1103  $ti->setInfo($this->lng->txt("short_inst_name_info"));
1104  $this->form->addItem($ti);
1105 
1106  // public section
1107  $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
1108  $cb->setInfo($lng->txt("pub_section_info"));
1109  if ($ilSetting->get("pub_section"))
1110  {
1111  $cb->setChecked(true);
1112  }
1113  $this->form->addItem($cb);
1114 
1115  // Enable Global Profiles
1116  $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
1117  $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
1118  $cb_prop->setChecked($ilSetting->get('enable_global_profiles'));
1119  $cb->addSubItem($cb_prop);
1120 
1121  // search engine
1122  include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
1123  $robot_settings = ilRobotSettings::_getInstance();
1124  $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
1125  $cb2->setInfo($this->lng->txt("enable_search_engine"));
1126  $this->form->addItem($cb2);
1127 
1128  if(!$robot_settings->checkRewrite())
1129  {
1130  $cb2->setAlert($lng->txt("allow_override_alert"));
1131  $cb2->setChecked(false);
1132  $cb2->setDisabled(true);
1133  }
1134  else
1135  {
1136  if ($ilSetting->get("open_google"))
1137  {
1138  $cb2->setChecked(true);
1139  }
1140  }
1141 
1142  // locale
1143  $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
1144  $ti->setMaxLength(80);
1145  $ti->setSize(40);
1146  $ti->setInfo($this->lng->txt("adm_locale_info"));
1147  $ti->setValue($ilSetting->get("locale"));
1148  $this->form->addItem($ti);
1149 
1150  // starting point
1151  include_once "Services/User/classes/class.ilUserUtil.php";
1152  $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start");
1153  $si->setRequired(true);
1154  $si->setInfo($this->lng->txt("adm_user_starting_point_info"));
1156  foreach(ilUserUtil::getPossibleStartingPoints(true) as $value => $caption)
1157  {
1158  $opt = new ilRadioOption($caption, $value);
1159  $si->addOption($opt);
1160 
1161  if(!in_array($value, $valid))
1162  {
1163  $opt->setInfo($this->lng->txt("adm_user_starting_point_invalid_info"));
1164  }
1165  }
1166  $si->setValue(ilUserUtil::getStartingPoint());
1167  $this->form->addItem($si);
1168 
1169  // starting point: repository object
1170  $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
1171  $repobj_id = new ilTextInputGUI($lng->txt("adm_user_starting_point_ref_id"), "usr_start_ref_id");
1172  $repobj_id->setRequired(true);
1173  $repobj_id->setSize(5);
1174  if($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ)
1175  {
1176  $start_ref_id = ilUserUtil::getStartingObject();
1177  $repobj_id->setValue($start_ref_id);
1178  if($start_ref_id)
1179  {
1180  $start_obj_id = ilObject::_lookupObjId($start_ref_id);
1181  if($start_obj_id)
1182  {
1183  $repobj_id->setInfo($lng->txt("obj_".ilObject::_lookupType($start_obj_id)).
1184  ": ".ilObject::_lookupTitle($start_obj_id));
1185  }
1186  }
1187  }
1188  $repobj->addSubItem($repobj_id);
1189  $si->addOption($repobj);
1190 
1191  // starting point: personal
1192  $startp = new ilCheckboxInputGUI($lng->txt("adm_user_starting_point_personal"), "usr_start_pers");
1193  $startp->setInfo($lng->txt("adm_user_starting_point_personal_info"));
1194  $startp->setChecked(ilUserUtil::hasPersonalStartingPoint());
1195  $si->addSubItem($startp);
1196 
1197 
1198  // save and cancel commands
1199  $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
1200 
1201  $this->form->setTitle($lng->txt("basic_settings"));
1202  $this->form->setFormAction($this->ctrl->getFormAction($this));
1203 
1204  }
1205 
1210  public function saveBasicSettingsObject()
1211  {
1212  global $tpl, $lng, $ilCtrl, $ilSetting, $rbacsystem;
1213 
1214  if (!$rbacsystem->checkAccess("write",$this->object->getRefId()))
1215  {
1216  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
1217  }
1218 
1219  $this->initBasicSettingsForm();
1220  if ($this->form->checkInput())
1221  {
1222  $ilSetting->set("short_inst_name", $_POST["short_inst_name"]);
1223  $ilSetting->set("pub_section", $_POST["pub_section"]);
1224 
1225  $global_profiles = ($_POST["pub_section"])
1226  ? (int)$_POST['enable_global_profiles']
1227  : 0;
1228  $ilSetting->set('enable_global_profiles', $global_profiles);
1229 
1230  $ilSetting->set("open_google", $_POST["open_google"]);
1231  $ilSetting->set("locale", $_POST["locale"]);
1232 
1233  include_once "Services/User/classes/class.ilUserUtil.php";
1234  ilUserUtil::setStartingPoint($this->form->getInput('usr_start'), $this->form->getInput('usr_start_ref_id'));
1235  ilUserUtil::togglePersonalStartingPoint($this->form->getInput('usr_start_pers'));
1236 
1237  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1238  $ilCtrl->redirect($this, "showBasicSettings");
1239  }
1240  $this->setGeneralSettingsSubTabs("basic_settings");
1241  $this->form->setValuesByPost();
1242  $tpl->setContent($this->form->getHtml());
1243  }
1244 
1245  //
1246  //
1247  // Header title
1248  //
1249  //
1250 
1254  function showHeaderTitleObject($a_get_post_values = false)
1255  {
1256  global $tpl;
1257 
1258  $this->setGeneralSettingsSubTabs("header_title");
1259  include_once("./Services/Object/classes/class.ilObjectTranslationTableGUI.php");
1260  $table = new ilObjectTranslationTableGUI($this, "showHeaderTitle", false);
1261  if ($a_get_post_values)
1262  {
1263  $vals = array();
1264  foreach($_POST["title"] as $k => $v)
1265  {
1266  $vals[] = array("title" => $v,
1267  "desc" => $_POST["desc"][$k],
1268  "lang" => $_POST["lang"][$k],
1269  "default" => ($_POST["default"] == $k));
1270  }
1271  $table->setData($vals);
1272  }
1273  else
1274  {
1275  $data = $this->object->getHeaderTitleTranslations();
1276  if (is_array($data["Fobject"]))
1277  {
1278  foreach($data["Fobject"] as $k => $v)
1279  {
1280  if ($k == $data["default_language"])
1281  {
1282  $data["Fobject"][$k]["default"] = true;
1283  }
1284  else
1285  {
1286  $data["Fobject"][$k]["default"] = false;
1287  }
1288  }
1289  }
1290  else
1291  {
1292  $data["Fobject"] = array();
1293  }
1294  $table->setData($data["Fobject"]);
1295  }
1296  $tpl->setContent($table->getHTML());
1297  }
1298 
1303  {
1304  global $ilCtrl, $lng, $rbacsystem;
1305 
1306  if (!$rbacsystem->checkAccess("write",$this->object->getRefId()))
1307  {
1308  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
1309  }
1310 
1311 // var_dump($_POST);
1312 
1313  // default language set?
1314  if (!isset($_POST["default"]) && count($_POST["lang"]) > 0)
1315  {
1316  ilUtil::sendFailure($lng->txt("msg_no_default_language"));
1317  return $this->showHeaderTitleObject(true);
1318  }
1319 
1320  // all languages set?
1321  if (array_key_exists("",$_POST["lang"]))
1322  {
1323  ilUtil::sendFailure($lng->txt("msg_no_language_selected"));
1324  return $this->showHeaderTitleObject(true);
1325  }
1326 
1327  // no single language is selected more than once?
1328  if (count(array_unique($_POST["lang"])) < count($_POST["lang"]))
1329  {
1330  ilUtil::sendFailure($lng->txt("msg_multi_language_selected"));
1331  return $this->showHeaderTitleObject(true);
1332  }
1333 
1334  // save the stuff
1335  $this->object->removeHeaderTitleTranslations();
1336  foreach($_POST["title"] as $k => $v)
1337  {
1338  $this->object->addHeaderTitleTranslation(
1340  ilUtil::stripSlashes($_POST["desc"][$k]),
1341  ilUtil::stripSlashes($_POST["lang"][$k]),
1342  ($_POST["default"] == $k));
1343  }
1344 
1345  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1346  $ilCtrl->redirect($this, "showHeaderTitle");
1347  }
1348 
1353  {
1354  global $ilCtrl, $lng;
1355 
1356  if (is_array($_POST["title"]))
1357  {
1358  foreach($_POST["title"] as $k => $v) {}
1359  }
1360  $k++;
1361  $_POST["title"][$k] = "";
1362  $this->showHeaderTitleObject(true);
1363  }
1364 
1369  {
1370  global $ilCtrl, $lng;
1371 //var_dump($_POST);
1372  foreach($_POST["title"] as $k => $v)
1373  {
1374  if ($_POST["check"][$k])
1375  {
1376  unset($_POST["title"][$k]);
1377  unset($_POST["desc"][$k]);
1378  unset($_POST["lang"][$k]);
1379  if ($k == $_POST["default"])
1380  {
1381  unset($_POST["default"]);
1382  }
1383  }
1384  }
1385  $this->saveHeaderTitlesObject();
1386  }
1387 
1388 
1389  //
1390  //
1391  // Cron Jobs
1392  //
1393  //
1394 
1395  /*
1396  * OLD GLOBAL CRON JOB SWITCHES (ilSetting)
1397  *
1398  * cron_user_check => obsolete
1399  * cron_inactive_user_delete => obsolete
1400  * cron_inactivated_user_delete => obsolete
1401  * cron_link_check => obsolete
1402  * cron_web_resource_check => migrated
1403  * cron_lucene_index => obsolete
1404  * forum_notification => migrated
1405  * mail_notification => migrated
1406  * disk_quota/enabled => migrated
1407  * payment_notification => migrated
1408  * crsgrp_ntf => migrated
1409  * cron_upd_adrbook => migrated
1410  */
1411 
1413  {
1414  // #13010 - this is used for external settings
1415  $this->ctrl->redirectByClass("ilCronManagerGUI", "render");
1416  }
1417 
1418 
1419  //
1420  //
1421  // Contact Information
1422  //
1423  //
1424 
1429  {
1430  global $tpl;
1431 
1432  $this->initContactInformationForm();
1433  $this->setGeneralSettingsSubTabs("contact_data");
1434  $tpl->setContent($this->form->getHTML());
1435  }
1436 
1440  public function initContactInformationForm()
1441  {
1442  global $lng, $ilSetting;
1443 
1444  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1445  $this->form = new ilPropertyFormGUI();
1446 
1447  // first name
1448  $ti = new ilTextInputGUI($this->lng->txt("firstname"), "admin_firstname");
1449  $ti->setMaxLength(64);
1450  $ti->setSize(40);
1451  $ti->setRequired(true);
1452  $ti->setValue($ilSetting->get("admin_firstname"));
1453  $this->form->addItem($ti);
1454 
1455  // last name
1456  $ti = new ilTextInputGUI($this->lng->txt("lastname"), "admin_lastname");
1457  $ti->setMaxLength(64);
1458  $ti->setSize(40);
1459  $ti->setRequired(true);
1460  $ti->setValue($ilSetting->get("admin_lastname"));
1461  $this->form->addItem($ti);
1462 
1463  // title
1464  $ti = new ilTextInputGUI($this->lng->txt("title"), "admin_title");
1465  $ti->setMaxLength(64);
1466  $ti->setSize(40);
1467  $ti->setValue($ilSetting->get("admin_title"));
1468  $this->form->addItem($ti);
1469 
1470  // position
1471  $ti = new ilTextInputGUI($this->lng->txt("position"), "admin_position");
1472  $ti->setMaxLength(64);
1473  $ti->setSize(40);
1474  $ti->setValue($ilSetting->get("admin_position"));
1475  $this->form->addItem($ti);
1476 
1477  // institution
1478  $ti = new ilTextInputGUI($this->lng->txt("institution"), "admin_institution");
1479  $ti->setMaxLength(200);
1480  $ti->setSize(40);
1481  $ti->setValue($ilSetting->get("admin_institution"));
1482  $this->form->addItem($ti);
1483 
1484  // street
1485  $ti = new ilTextInputGUI($this->lng->txt("street"), "admin_street");
1486  $ti->setMaxLength(64);
1487  $ti->setSize(40);
1488  //$ti->setRequired(true);
1489  $ti->setValue($ilSetting->get("admin_street"));
1490  $this->form->addItem($ti);
1491 
1492  // zip code
1493  $ti = new ilTextInputGUI($this->lng->txt("zipcode"), "admin_zipcode");
1494  $ti->setMaxLength(10);
1495  $ti->setSize(5);
1496  //$ti->setRequired(true);
1497  $ti->setValue($ilSetting->get("admin_zipcode"));
1498  $this->form->addItem($ti);
1499 
1500  // city
1501  $ti = new ilTextInputGUI($this->lng->txt("city"), "admin_city");
1502  $ti->setMaxLength(64);
1503  $ti->setSize(40);
1504  //$ti->setRequired(true);
1505  $ti->setValue($ilSetting->get("admin_city"));
1506  $this->form->addItem($ti);
1507 
1508  // country
1509  $ti = new ilTextInputGUI($this->lng->txt("country"), "admin_country");
1510  $ti->setMaxLength(64);
1511  $ti->setSize(40);
1512  //$ti->setRequired(true);
1513  $ti->setValue($ilSetting->get("admin_country"));
1514  $this->form->addItem($ti);
1515 
1516  // phone
1517  $ti = new ilTextInputGUI($this->lng->txt("phone"), "admin_phone");
1518  $ti->setMaxLength(64);
1519  $ti->setSize(40);
1520  //$ti->setRequired(true);
1521  $ti->setValue($ilSetting->get("admin_phone"));
1522  $this->form->addItem($ti);
1523 
1524  // email
1525  $ti = new ilTextInputGUI($this->lng->txt("email"), "admin_email");
1526  $ti->setMaxLength(64);
1527  $ti->setSize(40);
1528  $ti->setRequired(true);
1529  $ti->setValue($ilSetting->get("admin_email"));
1530  $this->form->addItem($ti);
1531 
1532  // feedback recipient
1533  $ti = new ilEmailInputGUI($this->lng->txt("feedback_recipient"), "feedback_recipient");
1534  $ti->setInfo(sprintf($this->lng->txt("feedback_recipient_info"), $this->lng->txt("contact_sysadmin")));
1535  $ti->setRequired(true);
1536  $ti->setValue($ilSetting->get("feedback_recipient"));
1537  $this->form->addItem($ti);
1538 
1539  // error recipient
1540  $ti = new ilEmailInputGUI($this->lng->txt("error_recipient"), "error_recipient");
1541  $ti->setValue($ilSetting->get("error_recipient"));
1542  $this->form->addItem($ti);
1543 
1544  $this->form->addCommandButton("saveContactInformation", $lng->txt("save"));
1545 
1546  $this->form->setTitle($lng->txt("contact_data"));
1547  $this->form->setFormAction($this->ctrl->getFormAction($this));
1548 
1549  }
1550 
1556  {
1557  global $tpl, $lng, $ilCtrl, $ilSetting, $rbacsystem;
1558 
1559  if (!$rbacsystem->checkAccess("write",$this->object->getRefId()))
1560  {
1561  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
1562  }
1563 
1564  $this->initContactInformationForm();
1565  if ($this->form->checkInput())
1566  {
1567  $fs = array("admin_firstname", "admin_lastname", "admin_title", "admin_position",
1568  "admin_institution", "admin_street", "admin_zipcode", "admin_city",
1569  "admin_country", "admin_phone", "admin_email",
1570  "feedback_recipient", "error_recipient");
1571  foreach ($fs as $f)
1572  {
1573  $ilSetting->set($f, $_POST[$f]);
1574  }
1575  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1576  $ilCtrl->redirect($this, "showContactInformation");
1577  }
1578  else
1579  {
1580  $this->setGeneralSettingsSubTabs("contact_data");
1581  $this->form->setValuesByPost();
1582  $tpl->setContent($this->form->getHtml());
1583  }
1584  }
1585 
1586  //
1587  //
1588  // Web Services
1589  //
1590  //
1591 
1596  {
1597  global $tpl;
1598 
1599  $this->initWebServicesForm();
1600  $this->setServerInfoSubTabs("webservices");
1601  $tpl->setContent($this->form->getHTML());
1602  }
1603 
1607  public function initWebServicesForm()
1608  {
1609  global $lng, $ilSetting;
1610 
1611  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1612  $this->form = new ilPropertyFormGUI();
1613 
1614  // soap administration
1615  $cb = new ilCheckboxInputGUI($this->lng->txt("soap_user_administration"), "soap_user_administration");
1616  $cb->setInfo($this->lng->txt("soap_user_administration_desc"));
1617  if ($ilSetting->get("soap_user_administration"))
1618  {
1619  $cb->setChecked(true);
1620  }
1621  $this->form->addItem($cb);
1622 
1623  // wsdl path
1624  $wsdl = new ilTextInputGUI($this->lng->txt('soap_wsdl_path'), 'soap_wsdl_path');
1625  $wsdl->setInfo(sprintf($this->lng->txt('soap_wsdl_path_info'), "<br />'".ILIAS_HTTP_PATH."/webservice/soap/server.php?wsdl'"));
1626  $wsdl->setValue((string)$ilSetting->get('soap_wsdl_path'));
1627  $wsdl->setSize(60);
1628  $wsdl->setMaxLength(255);
1629  $this->form->addItem($wsdl);
1630 
1631  // response timeout
1632  $ctime = new ilNumberInputGUI($this->lng->txt('soap_connect_timeout'), 'ctimeout');
1633  $ctime->setMinValue(1);
1634  $ctime->setSize(2);
1635  $ctime->setMaxLength(3);
1636  include_once './Services/WebServices/SOAP/classes/class.ilSoapClient.php';
1637  $ctime->setValue((int) $ilSetting->get('soap_connect_timeout', ilSoapClient::DEFAULT_CONNECT_TIMEOUT));
1638  $ctime->setInfo($this->lng->txt('soap_connect_timeout_info'));
1639  $this->form->addItem($ctime);
1640 
1641  $this->form->addCommandButton("saveWebServices", $lng->txt("save"));
1642 
1643  $this->form->setTitle($lng->txt("webservices"));
1644  $this->form->setFormAction($this->ctrl->getFormAction($this));
1645 
1646  }
1647 
1652  public function saveWebServicesObject()
1653  {
1654  global $tpl, $lng, $ilCtrl, $ilSetting, $rbacsystem;
1655 
1656  if (!$rbacsystem->checkAccess("write",$this->object->getRefId()))
1657  {
1658  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
1659  }
1660 
1661  $this->initWebServicesForm();
1662  if ($this->form->checkInput())
1663  {
1664  $ilSetting->set('soap_user_administration', $this->form->getInput('soap_user_administration'));
1665  $ilSetting->set('soap_wsdl_path', trim($this->form->getInput('soap_wsdl_path')));
1666  $ilSetting->set('soap_connect_timeout',$this->form->getInput('ctimeout'));
1667 
1668  ilUtil::sendSuccess($lng->txt('msg_obj_modified'), true);
1669  $ilCtrl->redirect($this, 'showWebServices');
1670  }
1671  else
1672  {
1673  $this->setGeneralSettingsSubTabs("webservices");
1674  $this->form->setValuesByPost();
1675  $tpl->setContent($this->form->getHtml());
1676  }
1677  }
1678 
1679  //
1680  //
1681  // Java Server
1682  //
1683  //
1684 
1689  {
1690  global $tpl;
1691 
1692  $tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.java_settings.html','Modules/SystemFolder');
1693 
1694  $GLOBALS['lng']->loadLanguageModule('search');
1695 
1696  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1697  $toolbar = new ilToolbarGUI();
1698  $toolbar->addButton($this->lng->txt('lucene_create_ini'),
1699  $this->ctrl->getLinkTarget($this,'createJavaServerIni'));
1700  $tpl->setVariable('ACTION_BUTTONS',$toolbar->getHTML());
1701 
1702  $this->initJavaServerForm();
1703  $this->setServerInfoSubTabs("java_server");
1704  $tpl->setVariable('SETTINGS_TABLE',$this->form->getHTML());
1705  }
1706 
1711  public function createJavaServerIniObject()
1712  {
1713  $this->setGeneralSettingsSubTabs('java_server');
1714  $this->initJavaServerIniForm();
1715  $this->tpl->setContent($this->form->getHTML());
1716  }
1717 
1718  protected function initJavaServerIniForm()
1719  {
1720  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1721 
1722  $this->form = new ilPropertyFormGUI();
1723 
1724  $GLOBALS['lng']->loadLanguageModule('search');
1725 
1726  $this->form->setTitle($this->lng->txt('lucene_tbl_create_ini'));
1727  $this->form->setFormAction($this->ctrl->getFormAction($this,'createJavaServerIni'));
1728  $this->form->addCommandButton('downloadJavaServerIni',$this->lng->txt('lucene_download_ini'));
1729  $this->form->addCommandButton('showJavaServer', $this->lng->txt('cancel'));
1730 
1731  // Host
1732  $ip = new ilTextInputGUI($this->lng->txt('lucene_host'),'ho');
1733  $ip->setInfo($this->lng->txt('lucene_host_info'));
1734  $ip->setMaxLength(128);
1735  $ip->setSize(32);
1736  $ip->setRequired(true);
1737  $this->form->addItem($ip);
1738 
1739  // Port
1740  $port = new ilNumberInputGUI($this->lng->txt('lucene_port'),'po');
1741  $port->setSize(5);
1742  $port->setMinValue(1);
1743  $port->setMaxValue(65535);
1744  $port->setRequired(true);
1745  $this->form->addItem($port);
1746 
1747  // Index Path
1748  $path = new ilTextInputGUI($this->lng->txt('lucene_index_path'),'in');
1749  $path->setSize(80);
1750  $path->setMaxLength(1024);
1751  $path->setInfo($this->lng->txt('lucene_index_path_info'));
1752  $path->setRequired(true);
1753  $this->form->addItem($path);
1754 
1755  // Logging
1756  $log = new ilTextInputGUI($this->lng->txt('lucene_log'),'lo');
1757  $log->setSize(80);
1758  $log->setMaxLength(1024);
1759  $log->setInfo($this->lng->txt('lucene_log_info'));
1760  $log->setRequired(true);
1761  $this->form->addItem($log);
1762 
1763  // Level
1764  $lev = new ilSelectInputGUI($this->lng->txt('lucene_level'),'le');
1765  $lev->setOptions(array(
1766  'DEBUG' => 'DEBUG',
1767  'INFO' => 'INFO',
1768  'WARN' => 'WARN',
1769  'ERROR' => 'ERROR',
1770  'FATAL' => 'FATAL'));
1771  $lev->setValue('INFO');
1772  $lev->setRequired(true);
1773  $this->form->addItem($lev);
1774 
1775  // CPU
1776  $cpu = new ilNumberInputGUI($this->lng->txt('lucene_cpu'),'cp');
1777  $cpu->setValue(1);
1778  $cpu->setSize(1);
1779  $cpu->setMaxLength(2);
1780  $cpu->setMinValue(1);
1781  $cpu->setRequired(true);
1782  $this->form->addItem($cpu);
1783 
1784  // Max file size
1785  $fs = new ilNumberInputGUI($this->lng->txt('lucene_max_fs'), 'fs');
1786  $fs->setInfo($this->lng->txt('lucene_max_fs_info'));
1787  $fs->setValue(500);
1788  $fs->setSize(4);
1789  $fs->setMaxLength(4);
1790  $fs->setMinValue(1);
1791  $fs->setRequired(true);
1792  $this->form->addItem($fs);
1793 
1794  return true;
1795  }
1796 
1801  protected function downloadJavaServerIniObject()
1802  {
1803  $this->initJavaServerIniForm();
1804  if($this->form->checkInput())
1805  {
1806  include_once './Services/WebServices/RPC/classes/class.ilRpcIniFileWriter.php';
1807  $ini = new ilRpcIniFileWriter();
1808  $ini->setHost($this->form->getInput('ho'));
1809  $ini->setPort($this->form->getInput('po'));
1810  $ini->setIndexPath($this->form->getInput('in'));
1811  $ini->setLogPath($this->form->getInput('lo'));
1812  $ini->setLogLevel($this->form->getInput('le'));
1813  $ini->setNumThreads($this->form->getInput('cp'));
1814  $ini->setMaxFileSize($this->form->getInput('fs'));
1815 
1816  $ini->write();
1817  ilUtil::deliverData($ini->getIniString(),'ilServer.ini','text/plain','utf-8');
1818  return true;
1819  }
1820 
1821  $this->form->setValuesByPost();
1822  ilUtil::sendFailure($this->lng->txt('err_check_input'));
1823  $this->setGeneralSettingsSubTabs('java_server');
1824  $this->tpl->setContent($this->form->getHTML());
1825  return true;
1826  }
1827 
1831  public function initJavaServerForm()
1832  {
1833  global $lng, $ilSetting;
1834 
1835  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1836  $this->form = new ilPropertyFormGUI();
1837 
1838  // host
1839  $ti = new ilTextInputGUI($this->lng->txt("java_server_host"), "rpc_server_host");
1840  $ti->setMaxLength(64);
1841  $ti->setSize(32);
1842  $ti->setValue($ilSetting->get("rpc_server_host"));
1843  $this->form->addItem($ti);
1844 
1845  // port
1846  $ti = new ilNumberInputGUI($this->lng->txt("java_server_port"), "rpc_server_port");
1847  $ti->setMaxLength(5);
1848  $ti->setSize(5);
1849  $ti->setValue($ilSetting->get("rpc_server_port"));
1850  $this->form->addItem($ti);
1851 
1852  // pdf fonts
1853  $pdf = new ilFormSectionHeaderGUI();
1854  $pdf->setTitle($this->lng->txt('rpc_pdf_generation'));
1855  $this->form->addItem($pdf);
1856 
1857  $pdf_font = new ilTextInputGUI($this->lng->txt('rpc_pdf_font'), 'rpc_pdf_font');
1858  $pdf_font->setInfo($this->lng->txt('rpc_pdf_font_info'));
1859  $pdf_font->setSize(64);
1860  $pdf_font->setMaxLength(1024);
1861  $pdf_font->setRequired(true);
1862  $pdf_font->setValue(
1863  $ilSetting->get('rpc_pdf_font','Helvetica, unifont'));
1864  $this->form->addItem($pdf_font);
1865 
1866 
1867  // save and cancel commands
1868  $this->form->addCommandButton("saveJavaServer", $lng->txt("save"));
1869 
1870  $this->form->setTitle($lng->txt("java_server"));
1871  $this->form->setDescription($lng->txt("java_server_info").
1872  '<br /><a href="Services/WebServices/RPC/lib/README.txt" target="_blank">'.
1873  $lng->txt("java_server_readme").'</a>');
1874  $this->form->setFormAction($this->ctrl->getFormAction($this));
1875 
1876  }
1877 
1882  public function saveJavaServerObject()
1883  {
1884  global $tpl, $lng, $ilCtrl, $ilSetting, $rbacsystem;
1885 
1886  if (!$rbacsystem->checkAccess("write",$this->object->getRefId()))
1887  {
1888  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
1889  }
1890 
1891  $this->initJavaServerForm();
1892  if ($this->form->checkInput())
1893  {
1894  $ilSetting->set("rpc_server_host", trim($_POST["rpc_server_host"]));
1895  $ilSetting->set("rpc_server_port", trim($_POST["rpc_server_port"]));
1896  $ilSetting->set('rpc_pdf_font',ilUtil::stripSlashes($_POST['rpc_pdf_font']));
1897  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1898  $ilCtrl->redirect($this, "showJavaServer");
1899 
1900  // TODO check settings, ping server
1901  }
1902  else
1903  {
1904  $this->setGeneralSettingsSubTabs("java_server");
1905  $this->form->setValuesByPost();
1906  $tpl->setContent($this->form->getHtml());
1907  }
1908  }
1909 
1917  public function showProxyObject()
1918  {
1919  global $tpl, $ilAccess, $ilSetting;
1920 
1921  if(!$ilAccess->checkAccess('write', '', $this->object->getRefId()))
1922  {
1923  $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
1924  }
1925 
1926  require_once './Services/Http/classes/class.ilProxySettings.php';
1927 
1928  $this->initProxyForm();
1929  $this->form->setValuesByArray(array(
1930  'proxy_status' => ilProxySettings::_getInstance()->isActive(),
1931  'proxy_host' => ilProxySettings::_getInstance()->getHost(),
1932  'proxy_port' => ilProxySettings::_getInstance()->getPort()
1933  ));
1934  if(ilProxySettings::_getInstance()->isActive())
1935  {
1936  $this->printProxyStatus();
1937  }
1938 
1939  $tpl->setContent($this->form->getHTML());
1940  }
1941 
1949  private function printProxyStatus()
1950  {
1951  try
1952  {
1953  ilProxySettings::_getInstance()->checkConnection();
1954  $this->form->getItemByPostVar('proxy_availability')->setHTML(
1955  '<img src="'.ilUtil::getImagePath('icon_ok.png').'" /> '.
1956  $this->lng->txt('proxy_connectable')
1957  );
1958  }
1959  catch(ilProxyException $e)
1960  {
1961  $this->form->getItemByPostVar('proxy_availability')->setHTML(
1962  '<img src="'.ilUtil::getImagePath('icon_not_ok.png').'" /> '.
1963  $this->lng->txt('proxy_not_connectable')
1964  );
1965  ilUtil::sendFailure($this->lng->txt('proxy_pear_net_socket_error').': '.$e->getMessage());
1966  }
1967  }
1968 
1976  public function saveProxyObject()
1977  {
1978  global $tpl, $ilAccess, $ilSetting, $lng;
1979 
1980  if(!$ilAccess->checkAccess('write', '', $this->object->getRefId()))
1981  {
1982  $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
1983  }
1984 
1985  require_once './Services/Http/classes/class.ilProxySettings.php';
1986 
1987  $this->initProxyForm();
1988  $isFormValid = $this->form->checkInput();
1989  ilProxySettings::_getInstance()->isActive((int)$this->form->getInput('proxy_status'))
1990  ->setHost(trim($this->form->getInput('proxy_host')))
1991  ->setPort(trim($this->form->getInput('proxy_port')));
1992  if($isFormValid)
1993  {
1994  if(ilProxySettings::_getInstance()->isActive())
1995  {
1996  if(!strlen(ilProxySettings::_getInstance()->getHost()))
1997  {
1998  $isFormValid = false;
1999  $this->form->getItemByPostVar('proxy_host')->setAlert($lng->txt('msg_input_is_required'));
2000  }
2001  if(!strlen(ilProxySettings::_getInstance()->getPort()))
2002  {
2003  $isFormValid = false;
2004  $this->form->getItemByPostVar('proxy_port')->setAlert($lng->txt('msg_input_is_required'));
2005  }
2006  if(!preg_match('/[0-9]{1,}/', ilProxySettings::_getInstance()->getPort()) ||
2007  ilProxySettings::_getInstance()->getPort() < 0 ||
2008  ilProxySettings::_getInstance()->getPort() > 65535)
2009  {
2010  $isFormValid = false;
2011  $this->form->getItemByPostVar('proxy_port')->setAlert($lng->txt('proxy_port_numeric'));
2012  }
2013  }
2014 
2015  if($isFormValid)
2016  {
2018  ilUtil::sendSuccess($lng->txt('saved_successfully'));
2019  if(ilProxySettings::_getInstance()->isActive())
2020  {
2021  $this->printProxyStatus();
2022  }
2023  }
2024  else
2025  {
2026  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
2027  }
2028  }
2029 
2030  $this->form->setValuesByPost();
2031  $tpl->setContent($this->form->getHTML());
2032  }
2033 
2041  private function initProxyForm()
2042  {
2043  global $lng, $ilCtrl;
2044 
2045  $this->setServerInfoSubTabs('proxy');
2046 
2047  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
2048  $this->form = new ilPropertyFormGUI();
2049  $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveProxy'));
2050 
2051  // Proxy status
2052  $proxs = new ilCheckboxInputGUI($lng->txt('proxy_status'), 'proxy_status');
2053  $proxs->setInfo($lng->txt('proxy_status_info'));
2054  $proxs->setValue(1);
2055  $this->form->addItem($proxs);
2056 
2057  // Proxy availability
2058  $proxa = new ilCustomInputGUI('', 'proxy_availability');
2059  $proxs->addSubItem($proxa);
2060 
2061  // Proxy
2062  $prox = new ilTextInputGUI($lng->txt('proxy_host'), 'proxy_host');
2063  $prox->setInfo($lng->txt('proxy_host_info'));
2064  $proxs->addSubItem($prox);
2065 
2066  // Proxy Port
2067  $proxp = new ilTextInputGUI($lng->txt('proxy_port'), 'proxy_port');
2068  $proxp->setInfo($lng->txt('proxy_port_info'));
2069  $proxp->setSize(10);
2070  $proxp->setMaxLength(10);
2071  $proxs->addSubItem($proxp);
2072 
2073  // save and cancel commands
2074  $this->form->addCommandButton('saveProxy', $lng->txt('save'));
2075  }
2076 
2077  public function showHTTPSObject()
2078  {
2079  global $tpl, $ilAccess;
2080 
2081  if(!$ilAccess->checkAccess('write', '', $this->object->getRefId()))
2082  {
2083  $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
2084  }
2085 
2086  $form = $this->initHTTPSForm();
2087  $tpl->setContent($form->getHTML());
2088  }
2089 
2090  public function saveHTTPSObject()
2091  {
2092  global $tpl, $lng, $ilCtrl;
2093 
2094  $form = $this->initHTTPSForm();
2095  if($form->checkInput())
2096  {
2097  $security = ilSecuritySettings::_getInstance();
2098 
2099  // auto https detection settings
2100  $security->setAutomaticHTTPSEnabled((int) $_POST["auto_https_detect_enabled"]);
2101  $security->setAutomaticHTTPSHeaderName(ilUtil::stripSlashes($_POST["auto_https_detect_header_name"]));
2102  $security->setAutomaticHTTPSHeaderValue(ilUtil::stripSlashes($_POST["auto_https_detect_header_value"]));
2103 
2104  // ilias https handling settings
2105  $security->setHTTPSEnabled($_POST["https_enabled"]);
2106 
2107  if($security->validate($form))
2108  {
2109  $security->save();
2110 
2111  ilUtil::sendSuccess($lng->txt('saved_successfully'), true);
2112  $ilCtrl->redirect($this, "showHTTPS");
2113  }
2114  }
2115 
2116  $form->setValuesByPost();
2117  $tpl->setContent($form->getHTML());
2118  }
2119 
2120  private function initHTTPSForm()
2121  {
2122  global $ilCtrl, $lng;
2123 
2124  $this->setServerInfoSubTabs('adm_https');
2125 
2126  $lng->loadLanguageModule('ps');
2127 
2128  include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2129  $security = ilSecuritySettings::_getInstance();
2130 
2131  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
2132  $form = new ilPropertyFormGUI();
2133  $form->setTitle($lng->txt("adm_https"));
2134  $form->setFormAction($ilCtrl->getFormAction($this, 'saveHTTPS'));
2135 
2136  $check = new ilCheckboxInputGUI($lng->txt('ps_auto_https'),'auto_https_detect_enabled');
2137  $check->setOptionTitle($lng->txt('ps_auto_https_description'));
2138  $check->setChecked($security->isAutomaticHTTPSEnabled() ? 1 : 0);
2139  $check->setValue(1);
2140 
2141  $text = new ilTextInputGUI($lng->txt('ps_auto_https_header_name'),'auto_https_detect_header_name');
2142  $text->setValue($security->getAutomaticHTTPSHeaderName());
2143  $text->setSize(24);
2144  $text->setMaxLength(64);
2145  $text->setRequired(true);
2146  $check->addSubItem($text);
2147 
2148  $text = new ilTextInputGUI($lng->txt('ps_auto_https_header_value'),'auto_https_detect_header_value');
2149  $text->setValue($security->getAutomaticHTTPSHeaderValue());
2150  $text->setSize(24);
2151  $text->setMaxLength(64);
2152  $text->setRequired(true);
2153  $check->addSubItem($text);
2154 
2155  $form->addItem($check);
2156 
2157  $check2 = new ilCheckboxInputGUI($lng->txt('activate_https'),'https_enabled');
2158  $check2->setChecked($security->isHTTPSEnabled() ? 1 : 0);
2159  $check2->setValue(1);
2160  $form->addItem($check2);
2161 
2162  // save and cancel commands
2163  $form->addCommandButton('saveHTTPS', $lng->txt('save'));
2164 
2165  return $form;
2166  }
2167 
2168  public function addToExternalSettingsForm($a_form_id)
2169  {
2170  switch($a_form_id)
2171  {
2173 
2174  include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2175  $security = ilSecuritySettings::_getInstance();
2176 
2177  $subitems = null;
2178  if($security->isAutomaticHTTPSEnabled())
2179  {
2180  $subitems = array(
2181  'ps_auto_https_header_name' => $security->getAutomaticHTTPSHeaderName(),
2182  'ps_auto_https_header_value' => $security->getAutomaticHTTPSHeaderValue()
2183  );
2184  }
2185  $fields = array('ps_auto_https' =>
2186  array($security->isAutomaticHTTPSEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL, $subitems)
2187  );
2188 
2189  $fields['activate_https'] =
2190  array($security->isHTTPSEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL);
2191 
2192  return array("general_settings" => array("showHTTPS", $fields));
2193  }
2194  }
2195 
2199  function _goto()
2200  {
2201  global $ilAccess, $ilErr, $lng;
2202 
2203  $a_target = SYSTEM_FOLDER_ID;
2204 
2205  if ($ilAccess->checkAccess("read", "", $a_target))
2206  {
2207  ilUtil::redirect("ilias.php?baseClass=ilAdministrationGUI");
2208  exit;
2209  }
2210  else
2211  {
2212  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
2213  {
2214  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
2215  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
2217  }
2218  }
2219  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2220  }
2221 
2225  protected function showVcsInformationObject()
2226  {
2227  $vc_info = array();
2228 
2229  require_once 'Services/Administration/classes/class.ilSubversionInformation.php';
2230  require_once 'Services/Administration/classes/class.ilGitInformation.php';
2231 
2232  foreach(array(new ilSubversionInformation(), new ilGitInformation()) as $vc)
2233  {
2234  $html = $vc->getInformationAsHtml();
2235  if($html)
2236  {
2237  $vc_info[] = $html;
2238  }
2239  }
2240 
2241  if($vc_info)
2242  {
2243  ilUtil::sendInfo(implode("<br />", $vc_info));
2244  }
2245  else
2246  {
2247  ilUtil::sendInfo($this->lng->txt('vc_information_not_determined'));
2248  }
2249 
2250  $this->showServerInfoObject();
2251  }
2252 }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
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
benchmarkSubTabs($a_current)
Benchmark sub tabs.
$_POST['username']
Definition: cron.php:12
setValue($a_value)
Set Value.
showContactInformationObject()
Show contact information.
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"]
This class represents a section header in a property form.
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.
showDbBenchChronologicalObject()
Show db benchmark results.
$GLOBALS['ct_recipient']
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.
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.
global $ilUser
Definition: imgupload.php:15
initContactInformationForm()
Init contact information form.
This class represents a non editable value in a property form.
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
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.
setOptionTitle($a_optiontitle)
Set Option Title (optional).
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.
saveBenchSettingsObject()
Save benchmark settings.
showBasicSettingsObject()
Show basic settings.
setMinValue($a_minvalue)
Set Minimum Value.