ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSetupGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./setup/classes/class.ilSetup.php";
5
15{
16 var $tpl; // template object
17 var $lng; // language objet
18 var $log; // log object
19
20 var $btn_prev_on = false; // toggle previous button on/off
21 var $btn_prev_cmd; // command processed when previous button was clicked
22 var $btn_prev_lng; // previous button label
23
24 var $btn_next_on = false; // toggle NEXT button on/off
25 var $btn_next_cmd; // command processed when next button was clicked
26 var $btn_next_lng; // next button label
27
28 var $revision; // cvs revision of this script
29 var $version; // cvs version of this script
30 var $lang; // current language (lang_key)
31
32 var $cmd; // command variable
33 var $display_mode = "view"; // view mode (setup or details)
34
39 function ilSetupGUI()
40 {
41 global $tpl, $lng;
42
43 $this->tpl = $tpl;
44 $this->lng = $lng;
45
46 // note: this is currently only used for subtabs, alex 8.1.2012
47 include_once("./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php");
48 $this->tabs = new ilTabsGUI();
49 $this->tabs->setSetupMode(true);
50
51 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
52 iljQueryUtil::initjQuery($this->tpl);
53 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
55
56 $tpl->addJavaScript("./Services/JavaScript/js/Basic.js", 0);
57
58 include_once("./Services/UICore/classes/class.ilUIFramework.php");
59 ilUIFramework::init($this->tpl);
60
61 // CVS - REVISION - DO NOT MODIFY
62 $this->revision = '$Revision$';
63 $this->version = "2 ".substr(substr($this->revision,1),0,-2);
64 $this->lang = $this->lng->lang_key;
65
66 // init setup
67 $this->setup = new ilSetup($_SESSION["auth"],$_SESSION["access_mode"]);
68
69 // init client object if exists
70 $client_id = ($_GET["client_id"]) ? $_GET["client_id"] : $_SESSION["ClientId"];
71 if ($_POST["client_id"] != "")
72 {
73 $client_id = $_POST["client_id"];
74 }
75
76/*if ($_POST["client_id"] == "")
77{
78echo "<br>+".$_GET["client_id"];
79echo "<br>+".$_POST["client_id"];
80echo "<br>+".$_SESSION["ClientId"];
81echo "<br>+".$client_id;
82}*/
83 // for security
84 if (!$this->setup->isAdmin() and $client_id != $_SESSION["ClientId"])
85 {
86 $client_id = $_SESSION["ClientId"];
87 }
88
89 $this->client_id = $client_id;
90
91 $this->setup->ini_client_exists = $this->setup->newClient($client_id);
92 if (is_object($this->setup->getClient()))
93 {
94 $this->setup->getClient()->status = $this->setup->getStatus($client_id);
95 }
96
97 // determine command
98 if (($this->cmd = $_GET["cmd"]) == "gateway")
99 {
100 // surpress warning if POST is not set
101 @$this->cmd = key($_POST["cmd"]);
102 }
103
104 // determine display mode here
105 // TODO: depending on previous setting (session)
106 // OR switch to 'setup'-mode if someone logs in as client and client's setup wasn't finished (-> entry in settings table does not exist)
107 if ($this->setup->isAuthenticated() and !$this->setup->getClient()->status["finish"]["status"] and $this->cmd != "clientlist" and $this->cmd != "")
108 {
109 $this->setDisplayMode("setup");
110 }
111 else
112 {
113 $this->setDisplayMode($_SESSION["display_mode"]);
114 }
115
116 // output starts here
117
118
119 // main cmd handling
120 if (!$this->setup->isAuthenticated() or !$this->setup->isInstalled())
121 {
122 // check for first time installation or migrate an old one first
123 if (!$this->setup->isInstalled() or !($this->setup->ini->readVariable("clients","path")))
124 {
125 $this->cmdInstall();
126 }
127 else
128 {
129 if ($this->cmd == "performLogin" || $this->cmd == "performMLogin")
130 {
132 $this->$cmd();
133 }
134 else
135 {
136 $this->displayLogin();
137 }
138 }
139 }
140 else
141 {
142 if ($this->setup->isAdmin())
143 {
144 $this->cmdAdmin();
145 }
146 else
147 {
148 $this->cmdClient();
149 }
150 }
151
152 // display header
153 $this->displayHeader();
154
155 if (DEBUG)
156 {
157 echo "cmd: ".$this->cmd." | access: ".$this->setup->access_mode." | display: ".$this->display_mode;
158 var_dump($this->setup->getClient()->status);
159 }
160
161 // display footer
162 $this->displayFooter();
163
164 // end output
165
166 } // end constructor
167
168 // cmd subsets
169
173 function cmdInstall()
174 {
175 $cmd = $this->cmd;
176 switch ($this->cmd)
177 {
178 case NULL:
179 case "preliminaries":
180 $this->setup->checkPreliminaries();
181 $this->displayPreliminaries();
182 break;
183
184 case "install":
185 $this->displayMasterSetup();
186 break;
187
188 case "determineToolsPathInstall":
190 break;
191
192 case "saveBasicSettings":
193 $this->$cmd();
194 break;
195
196 default:
197 $this->displayError($this->lng->txt("unknown_command").": '".$this->cmd."'");
198 break;
199 }
200 }
201
205 function cmdAdmin()
206 {
208 switch ($this->cmd)
209 {
210 case NULL:
211 case "clientlist":
212
213 $this->setDisplayMode("view");
214 $this->displayClientList();
215 $this->active_tab = "clientlist";
216 break;
217
218 case "changepassword":
219 $this->setDisplayMode("view");
220 $this->changeMasterPassword();
221 $this->active_tab = "password";
222 break;
223
224 case "mastersettings":
225 $this->setDisplayMode("view");
226 $this->changeMasterSettings();
227 $this->active_tab = "basicsettings";
228 break;
229
230 case "determineToolsPath":
231 $this->setDisplayMode("view");
232 $this->determineToolsPath();
233 break;
234
235 case "changedefault":
236 $this->changeDefaultClient();
237 break;
238
239 case "newclient":
240 $this->cmd = "selectdb";
241 $this->setDisplayMode("setup");
242 $this->setup->ini_client_exists = $this->setup->newClient();
243 $this->selectDBType();
244 break;
245
246 case "selectdbtype":
247 case "displayIni":
248 $this->cmd = "ini";
249 $this->setDisplayMode("setup");
250 //$this->setup->ini_client_exists = $this->setup->newClient($this->client_id);
251 $this->displayIni();
252 break;
253
254 case "startup":
255 $this->setDisplayMode("setup");
256 $this->setup->ini_client_exists = $this->setup->newClient();
257 $this->displayStartup();
258 break;
259
260 case "delete":
261 $this->setDisplayMode("view");
263 break;
264
265 case "togglelist":
266 $this->setDisplayMode("view");
267 $this->toggleClientList();
268 break;
269
270 case "preliminaries":
271 $this->setup->checkPreliminaries();
272 $this->displayPreliminaries();
273 $this->active_tab = "preliminaries";
274 break;
275
276 case "updateBasicSettings":
277 case "performLogin":
278 case "performMLogin":
279 $this->$cmd();
280 break;
281
282 default:
283 $this->cmdClient();
284 break;
285 }
286 }
287
291 function cmdClient()
292 {
293 $cmd = $this->cmd;
294 switch ($this->cmd)
295 {
296 case NULL:
297 case "view":
298 if ($this->setup->getClient()->db_installed)
299 {
300 $this->setDisplayMode("view");
301 $this->displayClientOverview();
302 }
303 else
304 {
305 $this->cmd = "db";
306 $this->displayDatabase();
307 }
308 break;
309
310 case "ini":
311 // only allow access to ini if db does not exist yet
312 //if ($this->setup->getClient()->db_installed)
313 //{
314 // $this->cmd = "db";
315 // $this->displayDatabase();
316 //}
317 //else
318 //{
319 $this->displayIni();
320 //}
321 break;
322
323 case "db":
324 $this->displayDatabase();
325 break;
326
327 case "dbslave":
328 $this->displayDatabaseSlave();
329 break;
330
331 case "sess":
332 if (!isset($_GET["lang"]) and !$this->setup->getClient()->status["finish"]["status"] and $_GET["cmd"] == "sess" and $this->setup->error === true)
333 {
335 }
336 else
337 {
338 $this->displaySessions();
339 }
340 break;
341
342 case "lang":
343 if (!isset($_GET["lang"]) and !$this->setup->getClient()->status["finish"]["status"] and $_GET["cmd"] == "lang" and $this->setup->error === true)
344 {
346 }
347 else
348 {
349 $this->displayLanguages();
350 }
351 break;
352
353 case "contact":
354 if (!isset($_GET["lang"]) and !$this->setup->getClient()->status["finish"]["status"] and $_GET["cmd"] == "contact")
355 {
357 }
358 else
359 {
360 $this->displayContactData();
361 }
362 break;
363
364 case "proxy":
365 if (!isset($_GET["lang"]) and !$this->setup->getClient()->status["finish"]["status"] and $_GET["cmd"] == "proxy")
366 {
368 }
369 else
370 {
371 $this->displayProxy();
372 }
373 break;
374
375 case "cache":
376 $this->displayCache();
377 break;
378
379
380 case "nic":
381 if (!isset($_GET["lang"]) and !$this->setup->getClient()->status["finish"]["status"] and $_GET["cmd"] == "nic")
382 {
384 }
385 else
386 {
387 $this->displayNIC();
388 }
389 break;
390
391 case "finish":
392 if (!isset($_GET["lang"]) and !$this->setup->getClient()->status["finish"]["status"] and $_GET["cmd"] == "finish")
393 {
395 }
396 else
397 {
398 $this->displayFinishSetup();
399 }
400 break;
401
402 case "changeaccess":
403 $this->changeAccessMode($_GET["back"]);
404 break;
405
406 case "logout":
407 $this->displayLogout();
408 break;
409
410 case "login":
411 session_destroy();
412 ilUtil::redirect(ILIAS_HTTP_PATH."/login.php?client_id=".$this->setup->getClient()->getId());
413 break;
414
415 case "login_new":
416 if ($this->setup->getClient()->ini->readVariable("client","access") != "1")
417 {
418 $this->setup->getClient()->ini->setVariable("client","access","1");
419 $this->setup->getClient()->ini->write();
420 }
421
422 session_destroy();
423 ilUtil::redirect(ILIAS_HTTP_PATH."/login.php?client_id=".$this->setup->getClient()->getId());
424 break;
425
426 case "tools":
427 $this->displayTools();
428 break;
429
430 case "reloadStructure":
431 $this->reloadControlStructure();
432 break;
433
434 case 'switchTree':
435 $this->switchTree();
436 break;
437
438 case "saveClientIni":
439 case "installDatabase":
440 case "displayDatabase":
441 case "updateDatabase":
442 case "showUpdateSteps":
443 case "saveLanguages":
444 case "saveContact":
445 case "displayContactData":
446 case "displayNIC":
447 case "saveRegistration":
448 case "applyHotfix":
449 case "showHotfixSteps":
450 case "applyCustomUpdates":
451 case "changeSettingsType":
452 case "showLongerSettings":
453 case "cloneSelectSource":
454 case "cloneSaveSource":
455 case "saveProxy":
456 case "displayPassword":
457 case "savePassword":
458 case "saveDbSlave":
459 case "saveCache":
460 case "addMemcacheServer":
461 case "deleteMemcacheServer":
462 case "editMemcacheServer":
463 case "createMemcacheServer":
464 case "updateMemcacheServer":
465 case "flushCache":
466 $this->$cmd();
467 break;
468
469 default:
470 $this->setDisplayMode("setup");
471 $this->displayError($this->lng->txt("unknown_command").": '".$this->cmd."'");
472 break;
473 }
474 }
475
476 // end cmd subsets
477
481
490 function setDisplayMode($a_mode)
491 {
492 // security
493 if ($a_mode != "view" and $a_mode != "setup")
494 {
495 return false;
496 }
497
498 $this->display_mode = $a_mode;
499 $_SESSION["display_mode"] = $this->display_mode;
500
501 return true;
502 }
503
507 function displayHeader()
508 {
509 $languages = $this->lng->getLanguages();
510
511 $count = (int) round(count($languages) / 2);
512 $num = 1;
513
514 sort($languages); // #16837
515 foreach ($languages as $lang_key)
516 {
517 /*
518 if ($num === $count)
519 {
520 $this->tpl->touchBlock("lng_new_row");
521 }
522 */
523 $this->tpl->setCurrentBlock("languages");
524 $this->tpl->setVariable("LINK_LANG", "./setup.php?cmd=".$this->cmd."&amp;lang=".$lang_key);
525 $this->tpl->setVariable("LANG_NAME", $this->lng->txt("meta_l_".$lang_key));
526 $this->tpl->setVariable("LANG_ICON", $lang_key);
527 $this->tpl->setVariable("LANG_KEY", $lang_key);
528 $this->tpl->setVariable("BORDER", 0);
529 $this->tpl->setVariable("VSPACE", 0);
530 $this->tpl->parseCurrentBlock();
531
532 $num++;
533 }
534
535 if (count($languages) % 2)
536 {
537 $this->tpl->touchBlock("lng_empty_cell");
538 }
539
540 if ($this->cmd != "logout" and $this->setup->isInstalled() and $this->setup->isAuthenticated())
541 {
542 // add client link
543 if ($this->setup->isAdmin())
544 {
545 if ($this->display_mode == "view" or $this->cmd == "clientlist" or $this->cmd == "changepassword" or $this->cmd == "mastersettings")
546 {
547 $this->tpl->setCurrentBlock("add_client");
548 $this->tpl->setVariable("TXT_ADD_CLIENT",ucfirst($this->lng->txt("new_client")));
549 $this->tpl->parseCurrentBlock();
550 }
551
552 // client list link
553 $class = ($this->active_tab == "clientlist")
554 ? "ilSMActive"
555 : "ilSMInactive";
556 $this->tpl->setCurrentBlock("display_list");
557 $this->tpl->setVariable("TXT_LIST",ucfirst($this->lng->txt("list_clients")));
558 $this->tpl->setVariable("TAB_CLASS", $class);
559 $this->tpl->parseCurrentBlock();
560
561 // edit paths link
562 $class = ($this->active_tab == "basicsettings")
563 ? "ilSMActive"
564 : "ilSMInactive";
565 $this->tpl->setCurrentBlock("edit_pathes");
566 $this->tpl->setVariable("TXT_EDIT_PATHES",$this->lng->txt("basic_settings"));
567 $this->tpl->setVariable("TAB_CLASS", $class);
568 $this->tpl->parseCurrentBlock();
569
570 // preliminaries
571 $class = ($this->active_tab == "preliminaries")
572 ? "ilSMActive"
573 : "ilSMInactive";
574 $this->tpl->setCurrentBlock("preliminaries");
575 $this->tpl->setVariable("TXT_PRELIMINARIES",$this->lng->txt("preliminaries"));
576 $this->tpl->setVariable("TAB_CLASS", $class);
577 $this->tpl->parseCurrentBlock();
578
579 // change password link
580 $class = ($this->active_tab == "password")
581 ? "ilSMActive"
582 : "ilSMInactive";
583 $this->tpl->setCurrentBlock("change_password");
584 $this->tpl->setVariable("TXT_CHANGE_PASSWORD",ucfirst($this->lng->txt("password")));
585 $this->tpl->setVariable("TAB_CLASS", $class);
586 $this->tpl->parseCurrentBlock();
587 }
588
589 // logout link
590 if ($this->setup->isAuthenticated())
591 {
592 $this->tpl->setCurrentBlock("logout");
593 $this->tpl->setVariable("TXT_LOGOUT",$this->lng->txt("logout"));
594 $this->tpl->parseCurrentBlock();
595 }
596 }
597
598 $this->tpl->setVariable("VAL_CMD", htmlspecialchars($_GET["cmd"]));
599 $this->tpl->setVariable("TXT_OK",$this->lng->txt("change"));
600 $this->tpl->setVariable("TXT_CHOOSE_LANGUAGE",$this->lng->txt("choose_language"));
601 $this->tpl->setVariable("PAGETITLE","Setup");
602 //$this->tpl->setVariable("LOCATION_STYLESHEET","./templates/blueshadow.css");
603 $this->tpl->setVariable("LOCATION_STYLESHEET","../templates/default/delos.css");
604 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET","./css/setup.css");
605 $this->tpl->setVariable("TXT_ILIAS_VERSION", "ILIAS ".ILIAS_VERSION);
606 $this->tpl->setVariable("TXT_SETUP",$this->lng->txt("setup"));
607 $this->tpl->setVariable("VERSION", $this->version);
608 $this->tpl->setVariable("TXT_VERSION", $this->lng->txt("version"));
609 $this->tpl->setVariable("LANG", $this->lang);
610 }
611
615 function displayFooter()
616 {
617 // footer (not really)
618 if ($this->cmd != "logout")
619 {
620 if ($this->setup->ini_ilias_exists and $this->display_mode == "setup" and $this->setup->getClient()->getId() != "")
621 {
622 $this->tpl->setVariable("TXT_ACCESS_MODE","(".$this->lng->txt("client_id").": ".$this->setup->getClient()->getId().")");
623 }
624 elseif ($this->setup->isAdmin())
625 {
626 $this->tpl->setVariable("TXT_ACCESS_MODE","(".$this->lng->txt("root_access").")");
627 }
628
629 $this->displayNavButtons();
630 }
631
632 $this->tpl->show();
633 }
634
641 {
642 if (!$this->btn_prev_on and !$this->btn_next_on)
643 {
644 return false;
645 }
646
647 $ntpl = new ilTemplate("tpl.navbuttons.html", true, true, "setup");
648 //$this->tpl->addBlockFile("NAVBUTTONS","navbuttons","tpl.navbuttons.html", "setup");
649
650 $ntpl->setVariable("FORMACTION_BUTTONS","setup.php?cmd=gateway");
651
652 if ($this->btn_prev_on)
653 {
654 $ntpl->setCurrentBlock("btn_back");
655 $ntpl->setVariable("TXT_PREV", $this->btn_prev_lng);
656 $ntpl->setVariable("CMD_PREV", $this->btn_prev_cmd);
657 $ntpl->parseCurrentBlock();
658 }
659
660 if ($this->btn_next_on)
661 {
662 $ntpl->setCurrentBlock("btn_forward");
663 $ntpl->setVariable("TXT_NEXT", $this->btn_next_lng);
664 $ntpl->setVariable("CMD_NEXT", $this->btn_next_cmd);
665 $ntpl->parseCurrentBlock();
666 }
667
668 $nav_html = $ntpl->get();
669 $this->tpl->setVariable("NAVBUTTONS", $nav_html);
670 if (!$this->no_second_nav)
671 {
672 $this->tpl->setVariable("NAVBUTTONS2", $nav_html);
673 }
674 return true;
675 }
676
683 function SetButtonPrev($a_cmd = 0,$a_lng = 0)
684 {
685 $this->btn_prev_on = true;
686 $this->btn_prev_cmd = ($a_cmd) ? $a_cmd : "gateway";
687 $this->btn_prev_lng = ($a_lng) ? $this->lng->txt($a_lng) : $this->lng->txt("prev");
688 }
689
696 function SetButtonNext($a_cmd,$a_lng = 0)
697 {
698 $this->btn_next_on = true;
699 $this->btn_next_cmd = ($a_cmd) ? $a_cmd : "gateway";
700 $this->btn_next_lng = ($a_lng) ? $this->lng->txt($a_lng) : $this->lng->txt("next");
701 }
702
706
711 {
712 $this->checkDisplayMode();
713
714 // disable/enable button
715 $btpl = new ilTemplate("tpl.buttons.html", true, true, "setup");
716 $btpl->setCurrentBlock("btn");
717 $btpl->setVariable("CMD", "changeaccess");
718 $access_button = ($this->setup->getClient()->status["access"]["status"]) ? "disable" : "enable";
719 $btpl->setVariable("TXT", $this->lng->txt($access_button));
720 $btpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
721 $btpl->parseCurrentBlock();
722 $this->tpl->setVariable("BUTTONS", $btpl->get());
723
724 $this->initClientOverviewForm();
725 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
726
727 $this->displayStatusPanel();
728 }
729
733 public function initClientOverviewForm()
734 {
735 global $lng, $ilCtrl;
736
737 $settings = $this->setup->getClient()->getAllSettings();
738
739 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
740 $this->form = new ilPropertyFormGUI();
741
742 $this->form->setTitle($lng->txt("client_info"));
743
744 // installation name
745 $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), "inst_name");
746 $ne->setValue(($this->setup->getClient()->getName())
747 ? $this->setup->getClient()->getName()
748 : "&lt;".$this->lng->txt("no_client_name")."&gt;");
749 $ne->setInfo($this->setup->getClient()->getDescription());
750 $this->form->addItem($ne);
751
752 // client id
753 $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "client_id");
754 $ne->setValue($this->setup->getClient()->getId());
755 $this->form->addItem($ne);
756
757 // nic id
758 $ne = new ilNonEditableValueGUI($lng->txt("ilias_nic_id"), "nic_id");
759 $ne->setValue(($this->setup->getClient()->db_installed)
760 ? $settings["inst_id"]
761 : $txt_no_database);
762 $this->form->addItem($ne);
763
764 // database version
765 $ne = new ilNonEditableValueGUI($lng->txt("db_version"), "db_vers");
766 $ne->setValue(($this->setup->getClient()->db_installed)
767 ? $settings["db_version"]
768 : $txt_no_database);
769 $this->form->addItem($ne);
770
771 // access status
772 $ne = new ilNonEditableValueGUI($lng->txt("access_status"), "status");
773 //$access_link = "&nbsp;&nbsp;[<a href=\"setup.php?cmd=changeaccess&client_id=".$this->setup->getClient()->getId()."&back=view\">".$this->lng->txt($access_button)."</a>]";
774 $access_status = ($this->setup->getClient()->status["access"]["status"]) ? "online" : "disabled";
775 $ne->setValue($this->lng->txt($access_status).$access_link);
776 $this->form->addItem($ne);
777
778 // server information
779 $sh = new ilFormSectionHeaderGUI();
780 $sh->setTitle($this->lng->txt("server_info"));
781 $this->form->addItem($sh);
782
783 // ilias version
784 $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), "il_vers");
785 $ne->setValue(ILIAS_VERSION);
786 $this->form->addItem($ne);
787
788 // host
789 $ne = new ilNonEditableValueGUI($lng->txt("host"), "host");
790 $ne->setValue($_SERVER["SERVER_NAME"]);
791 $this->form->addItem($ne);
792
793 // ip address and port
794 $ne = new ilNonEditableValueGUI($lng->txt("ip_address")." & ".
795 $lng->txt("port"));
796 $ne->setValue($_SERVER["SERVER_ADDR"].":".$_SERVER["SERVER_PORT"]);
797 $this->form->addItem($ne);
798
799 // server software
800 $ne = new ilNonEditableValueGUI($lng->txt("server_software"), "server_softw");
801 $ne->setValue($_SERVER["SERVER_SOFTWARE"]);
802 $this->form->addItem($ne);
803
804 // http path
805 $ne = new ilNonEditableValueGUI($lng->txt("http_path"), "http_path");
806 $ne->setValue(ILIAS_HTTP_PATH);
807 $this->form->addItem($ne);
808
809 // absolute path
810 $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), "absolute_path");
811 $ne->setValue(ILIAS_ABSOLUTE_PATH);
812 $this->form->addItem($ne);
813
814 // third party tools
815 $sh = new ilFormSectionHeaderGUI();
816 $sh->setTitle($this->lng->txt("3rd_party_software"));
817 $this->form->addItem($sh);
818
819 $tools = array("convert", "zip", "unzip", "ghostscript", "java", "htmldoc", "ffmpeg");
820
821 foreach ($tools as $tool)
822 {
823 // tool
824 $ne = new ilNonEditableValueGUI($lng->txt($tool."_path"), $tool."_path");
825 $p = $this->setup->ini->readVariable("tools", $tool);
826 $ne->setValue($p ? $p : $this->lng->txt("not_configured"));
827 $this->form->addItem($ne);
828 }
829
830 // latex
831 $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), "latex_url");
832 $p = $this->setup->ini->readVariable("tools", "latex"); // #13109
833 $ne->setValue($p ? $p : $this->lng->txt("not_configured"));
834 $this->form->addItem($ne);
835
836 // virus scanner
837 $ne = new ilNonEditableValueGUI($lng->txt("virus_scanner"), "vscan");
838 $ne->setValue($this->setup->ini->readVariable("tools","vscantype"));
839 $this->form->addItem($ne);
840
841 // scan command
842 $ne = new ilNonEditableValueGUI($lng->txt("scan_command"), "scan");
843 $p = $this->setup->ini->readVariable("tools","scancommand");
844 $ne->setValue($p ? $p : $this->lng->txt("not_configured"));
845 $this->form->addItem($ne);
846
847 // clean command
848 $ne = new ilNonEditableValueGUI($lng->txt("clean_command"), "clean");
849 $p = $this->setup->ini->readVariable("tools","cleancommand");
850 $ne->setValue($p ? $p : $this->lng->txt("not_configured"));
851 $this->form->addItem($ne);
852
853 $this->form->setFormAction("setup.php?cmd=gateway");
854 }
855
859
864 {
865 $OK = "<font color=\"green\"><strong>OK</strong></font>";
866 $FAILED = "<strong><font color=\"red\">FAILED</font></strong>";
867
868 $this->tpl->addBlockFile("CONTENT","content","tpl.preliminaries.html", "setup");
869
870 $this->tpl->setVariable("TXT_SETUP_TITLE",$this->lng->txt("ilias_setup"));
871 $this->tpl->setVariable("TXT_SETUP_WELCOME", $this->lng->txt("setup_welcome"));
872 $this->tpl->setVariable("TXT_SETUP_INIFILE_DESC", $this->lng->txt("setup_inifile_desc"));
873 $this->tpl->setVariable("TXT_SETUP_DATABASE_DESC", $this->lng->txt("setup_database_desc"));
874 $this->tpl->setVariable("TXT_SETUP_LANGUAGES_DESC", $this->lng->txt("setup_languages_desc"));
875 $this->tpl->setVariable("TXT_SETUP_PASSWORD_DESC", $this->lng->txt("setup_password_desc"));
876 $this->tpl->setVariable("TXT_SETUP_NIC_DESC", $this->lng->txt("setup_nic_desc"));
877
878 $server_os = php_uname();
879 $server_web = $_SERVER["SERVER_SOFTWARE"];
880 $environment = $this->lng->txt("env_using")." ".$server_os." <br/>".$this->lng->txt("with")." ".$server_web;
881
882 if ((stristr($server_os,"linux") || stristr($server_os,"windows")) && stristr($server_web,"apache"))
883 {
884 $env_comment = $this->lng->txt("env_ok");
885 }
886 else
887 {
888 $env_comment = "<font color=\"red\">".$this->lng->txt("env_warning")."</font>";
889 }
890
891 $this->tpl->setVariable("TXT_ENV_TITLE", $this->lng->txt("environment"));
892 $this->tpl->setVariable("TXT_ENV_INTRO", $environment);
893 $this->tpl->setVariable("TXT_ENV_COMMENT", $env_comment);
894
895 $this->tpl->setVariable("TXT_PRE_TITLE", $this->lng->txt("preliminaries"));
896 $this->tpl->setVariable("TXT_PRE_INTRO", $this->lng->txt("pre_intro"));
897
898 $preliminaries = array("php", "root", "folder_create",
899 "cookies_enabled", "dom", "xsl", "gd", "memory");
900 if ($this->setup->hasOpCacheEnabled()) {
901 $preliminaries[] = 'load_comments';
902 }
903
904 foreach ($preliminaries as $preliminary)
905 {
906 $this->tpl->setCurrentBlock("preliminary");
907 $this->tpl->setVariable("TXT_PRE", $this->lng->txt("pre_".$preliminary));
908 if ($this->setup->preliminaries_result[$preliminary]["status"] == true)
909 {
910 $this->tpl->setVariable("STATUS_PRE", $OK);
911 }
912 else
913 {
914 $this->tpl->setVariable("STATUS_PRE", $FAILED);
915 }
916 $this->tpl->setVariable("COMMENT_PRE", $this->setup->preliminaries_result[$preliminary]["comment"]);
917 $this->tpl->parseCurrentBlock();
918 }
919
920 // summary
921 if ($this->setup->preliminaries === true)
922 {
923 if ($this->setup->isInstalled())
924 {
925 $cmd = "mastersettings";
926 }
927 else
928 {
929 $cmd = "install";
930 }
931 $btn_text = ($this->cmd == "preliminaries") ? "" : "installation";
932//echo "-".$this->display_mode."-";
933 $this->setButtonNext($cmd,$btn_text);
934 }
935 else
936 {
937 $this->tpl->setCurrentBlock("premessage");
938 $this->tpl->setVariable("TXT_PRE_ERR", sprintf($this->lng->txt("pre_error"),
939 "http://www.ilias.de/docu/goto.php?target=pg_6531_367&client_id=docu"));
940 $this->tpl->parseCurrentBlock();
941 }
942 }
943
947
951 function displayMasterSetup($a_omit_init = false)
952 {
953 $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html", "setup");
954 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("basic_settings"));
955 $this->tpl->setVariable("TXT_INFO",
956 $this->lng->txt("info_text_first_install")."<br/>".$this->lng->txt("info_text_pathes"));
957
958 $this->setButtonPrev("preliminaries");
959
960 if ($this->setup->isInstalled())
961 {
962 $this->setButtonNext("list");
963 }
964
965 if (!$a_omit_init)
966 {
967 $this->initBasicSettingsForm(true);
968 }
969 $this->tpl->setVariable("SETUP_CONTENT", "<br>".$this->form->getHTML()."<br>");
970 }
971
975 function changeMasterSettings($a_omit_init = false)
976 {
977 $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html", "setup");
978 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("basic_settings"));
979 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_pathes"));
980
981 $this->btn_next_on = true;
982 $this->btn_next_lng = $this->lng->txt("create_new_client")."...";
983 $this->btn_next_cmd = "newclient";
984
985 if (!$a_omit_init)
986 {
987 $this->initBasicSettingsForm();
988 $this->getBasicSettingsValues();
989 }
990 $this->tpl->setVariable("SETUP_CONTENT", "<br>".$this->form->getHTML()."<br>");
991 }
992
996 public function initBasicSettingsForm($a_install = false)
997 {
998 global $lng, $ilCtrl;
999
1000 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1001 $this->form = new ilPropertyFormGUI();
1002
1003 // webspace dir
1004 $ne = new ilNonEditableValueGUI($lng->txt("data_directory_in_ws"), "webspace_dir");
1005 if ($a_install)
1006 {
1007 $ne->setInfo($this->lng->txt("data_directory_in_ws_info"));
1008 }
1009 $cwd = ilUtil::isWindows()
1010 ? str_replace("\\", "/", getcwd())
1011 : getcwd();
1012
1013 $ne->setValue($cwd."/data");
1014 $this->form->addItem($ne);
1015
1016 // data dir
1017 if ($a_install)
1018 {
1019 $ti = new ilTextInputGUI($lng->txt("data_directory_outside_ws"), "datadir_path");
1020 $ti->setInfo($lng->txt("data_directory_info"));
1021 $ti->setRequired(true);
1022 $this->form->addItem($ti);
1023 }
1024 else
1025 {
1026 $ne = new ilNonEditableValueGUI($lng->txt("data_directory_outside_ws"), "data_dir");
1027 $this->form->addItem($ne);
1028 }
1029
1030 $lvext = (ilUtil::isWindows())
1031 ? "_win"
1032 : "";
1033
1034
1035 // logging
1036 $sh = new ilFormSectionHeaderGUI();
1037 $sh->setTitle($lng->txt("logging"));
1038 $this->form->addItem($sh);
1039
1040 // path to log file
1041 $ti = new ilTextInputGUI($lng->txt("log_path"), "log_path");
1042 $ti->setInfo($lng->txt("log_path_comment".$lvext));
1043 $this->form->addItem($ti);
1044
1045 // disable logging
1046 $cb = new ilCheckboxInputGUI($lng->txt("disable_logging"), "chk_log_status");
1047 $this->form->addItem($cb);
1048
1049 // server settings
1050 $sh = new ilFormSectionHeaderGUI();
1051 $sh->setTitle($lng->txt("server_settings"));
1052 $this->form->addItem($sh);
1053
1054 // time zone
1055 include_once("./Services/Calendar/classes/class.ilCalendarUtil.php");
1056 $si = new ilSelectInputGUI($lng->txt("time_zone"), "time_zone");
1057 $si->setOptions(array_merge(
1058 array("" => "-- ".$lng->txt("please_select")." --"),
1060 $si->setRequired(true);
1061 $this->form->addItem($si);
1062
1063 // https settings
1064 $sh = new ilFormSectionHeaderGUI();
1065 $sh->setTitle($lng->txt("https_settings"));
1066 $this->form->addItem($sh);
1067
1068 $check = new ilCheckboxInputGUI($lng->txt('ps_auto_https'),'auto_https_detect_enabled');
1069 $check->setOptionTitle($lng->txt('ps_auto_https_description'));
1070 $check->setValue(1);
1071
1072 $text = new ilTextInputGUI($lng->txt('ps_auto_https_header_name'),'auto_https_detect_header_name');
1073 $text->setSize(24);
1074 $text->setMaxLength(64);
1075 $text->setRequired(true);
1076 $check->addSubItem($text);
1077
1078 $text = new ilTextInputGUI($lng->txt('ps_auto_https_header_value'),'auto_https_detect_header_value');
1079 $text->setSize(24);
1080 $text->setMaxLength(64);
1081 $text->setRequired(true);
1082 $check->addSubItem($text);
1083
1084 $this->form->addItem($check);
1085
1086 // required 3rd party tools
1087 $sh = new ilFormSectionHeaderGUI();
1088 $sh->setTitle($lng->txt("3rd_party_software_req"));
1089 $this->form->addItem($sh);
1090
1091 // convert path
1092 $ti = new ilTextInputGUI($lng->txt("convert_path"), "convert_path");
1093 $ti->setInfo($lng->txt("convert_path_comment".$lvext));
1094 $ti->setRequired(true);
1095 $this->form->addItem($ti);
1096
1097 // zip path
1098 $ti = new ilTextInputGUI($lng->txt("zip_path"), "zip_path");
1099 $ti->setInfo($lng->txt("zip_path_comment".$lvext));
1100 $ti->setRequired(true);
1101 $this->form->addItem($ti);
1102
1103 // unzip path
1104 $ti = new ilTextInputGUI($lng->txt("unzip_path"), "unzip_path");
1105 $ti->setInfo($lng->txt("unzip_path_comment".$lvext));
1106 $ti->setRequired(true);
1107 $this->form->addItem($ti);
1108
1109 // optional 3rd party tools
1110 $sh = new ilFormSectionHeaderGUI();
1111 $sh->setTitle($lng->txt("3rd_party_software_opt"));
1112 $this->form->addItem($sh);
1113
1114 // ghostscript path
1115 $ti = new ilTextInputGUI($lng->txt("ghostscript_path"), "ghostscript_path");
1116 $ti->setInfo($lng->txt("ghostscript_path_comment".$lvext));
1117 $this->form->addItem($ti);
1118
1119 // java path
1120 $ti = new ilTextInputGUI($lng->txt("java_path"), "java_path");
1121 $ti->setInfo($lng->txt("java_path_comment".$lvext));
1122 $this->form->addItem($ti);
1123
1124 // htmldoc path
1125 $ti = new ilTextInputGUI($lng->txt("htmldoc_path"), "htmldoc_path");
1126 $ti->setInfo($lng->txt("htmldoc_path_comment".$lvext));
1127 $this->form->addItem($ti);
1128
1129 // ffmpeg path
1130 $ti = new ilTextInputGUI($lng->txt("ffmpeg_path"), "ffmpeg_path");
1131 $ti->setInfo($lng->txt("ffmpeg_path_comment"));
1132 $this->form->addItem($ti);
1133
1134 // latex
1135 $ti = new ilTextInputGUI($lng->txt("url_to_latex"), "latex_url");
1136 $ti->setInfo($lng->txt("latex_url_comment"));
1137 $this->form->addItem($ti);
1138
1139 // virus scanner
1140 $options = array(
1141 "none" => $lng->txt("none"),
1142 "sophos" => $lng->txt("sophos"),
1143 "antivir" => $lng->txt("antivir"),
1144 "clamav" => $lng->txt("clamav")
1145 );
1146 $si = new ilSelectInputGUI($lng->txt("virus_scanner"), "vscanner_type");
1147 $si->setOptions($options);
1148 $this->form->addItem($si);
1149
1150 // scan command
1151 $ti = new ilTextInputGUI($lng->txt("scan_command"), "scan_command");
1152 $this->form->addItem($ti);
1153
1154 // clean command
1155 $ti = new ilTextInputGUI($lng->txt("clean_command"), "clean_command");
1156 $this->form->addItem($ti);
1157
1158 if ($a_install)
1159 {
1160 $sh = new ilFormSectionHeaderGUI();
1161 $sh->setTitle($lng->txt("master_password"));
1162 $this->form->addItem($sh);
1163
1164 // password
1165 $pi = new ilPasswordInputGUI($lng->txt("password"), "password");
1166 $pi->setRequired(true);
1167 $pi->setSkipSyntaxCheck(true);
1168 $pi->setInfo($lng->txt("password_info"));
1169 $this->form->addItem($pi);
1170 }
1171
1172 if ($a_install)
1173 {
1174 $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
1175 }
1176 else
1177 {
1178 $this->form->addCommandButton("updateBasicSettings", $lng->txt("save"));
1179 $this->form->addCommandButton("determineToolsPath", $lng->txt("determine_tools_paths"));
1180 }
1181
1182 $this->form->setTitle($lng->txt("data_directories"));
1183 $this->form->setFormAction("setup.php?cmd=gateway");
1184
1185 if ($a_install)
1186 {
1187 $det = $this->determineTools();
1188 $this->form->setValuesByArray($det);
1189 }
1190
1191 }
1192
1196 public function getBasicSettingsValues()
1197 {
1198 $values = array();
1199
1200 $values["webspace_dir"] = getcwd()."/data";
1201 $values["data_dir"] = $this->setup->ini->readVariable("clients","datadir");
1202 $values["convert_path"] = $this->setup->ini->readVariable("tools","convert");
1203 $values["zip_path"] = $this->setup->ini->readVariable("tools","zip");
1204 $values["unzip_path"] = $this->setup->ini->readVariable("tools","unzip");
1205 $values["ghostscript_path"] = $this->setup->ini->readVariable("tools","ghostscript");
1206 $values["java_path"] = $this->setup->ini->readVariable("tools","java");
1207 $values["htmldoc_path"] = $this->setup->ini->readVariable("tools","htmldoc");
1208 //$values["mkisofs_path"] = $this->setup->ini->readVariable("tools","mkisofs");
1209 $values["ffmpeg_path"] = $this->setup->ini->readVariable("tools","ffmpeg");
1210 $values["latex_url"] = $this->setup->ini->readVariable("tools","latex");
1211 $values["fop_path"] = $this->setup->ini->readVariable("tools","fop");
1212 $values["vscanner_type"] = $this->setup->ini->readVariable("tools", "vscantype");
1213 $values["scan_command"] = $this->setup->ini->readVariable("tools", "scancommand");
1214 $values["clean_command"] = $this->setup->ini->readVariable("tools", "cleancommand");
1215 $values["log_path"] = $this->setup->ini->readVariable("log","path")."/".
1216 $this->setup->ini->readVariable("log","file");
1217 $values["chk_log_status"] = !$this->setup->ini->readVariable("log","enabled");
1218 $values["time_zone"] = $this->setup->ini->readVariable("server", "timezone");
1219
1220 // https settings
1221 $values["auto_https_detect_enabled"] = $this->setup->ini->readVariable("https", "auto_https_detect_enabled");
1222 $values["auto_https_detect_header_name"] = $this->setup->ini->readVariable("https", "auto_https_detect_header_name");
1223 $values["auto_https_detect_header_value"] = $this->setup->ini->readVariable("https", "auto_https_detect_header_value");
1224
1225 $this->form->setValuesByArray($values);
1226 }
1227
1231 public function saveBasicSettings()
1232 {
1233 global $tpl, $lng, $ilCtrl;
1234
1235 $this->initBasicSettingsForm(true);
1236
1237 if ($this->form->checkInput())
1238 {
1239 // correct paths on windows
1240 if (ilUtil::isWindows())
1241 {
1242 $fs = array("datadir_path", "log_path", "convert_path", "zip_path",
1243 "unzip_path", "ghostscript_path", "java_path", "htmldoc_path", "ffmpeg_path");
1244 foreach ($fs as $f)
1245 {
1246 $_POST[$f] = str_replace("\\", "/", $_POST[$f]);
1247 }
1248 }
1249
1250 $_POST["setup_pass"] = $_POST["password"];
1251 $_POST["setup_pass2"] = $_POST["password_retype"];
1252 if (!$this->setup->checkDataDirSetup($_POST))
1253 {
1254 $i = $this->form->getItemByPostVar("datadir_path");
1255 $i->setAlert($this->lng->txt($this->setup->getError()));
1256 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"),true);
1257 }
1258 else if (!$this->setup->checkLogSetup($_POST))
1259 {
1260 $i = $this->form->getItemByPostVar("log_path");
1261 $i->setAlert($this->lng->txt($this->setup->getError()));
1262 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"),true);
1263 }
1264 else if (!$this->setup->checkPasswordSetup($_POST))
1265 {
1266 ilUtil::sendFailure($this->lng->txt($this->setup->getError()),true);
1267 }
1268 else if (!$this->setup->saveMasterSetup($_POST))
1269 {
1270 ilUtil::sendFailure($this->lng->txt($this->setup->getError()),true);
1271 }
1272 else
1273 {
1274 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
1275 ilUtil::redirect("setup.php?cmd=mastersettings");
1276 }
1277 }
1278
1279 $this->form->setValuesByPost();
1280 $this->displayMasterSetup(true);
1281 }
1282
1286 public function updateBasicSettings()
1287 {
1288 global $tpl, $lng, $ilCtrl;
1289
1290 $this->initBasicSettingsForm();
1291
1292 if ($this->form->checkInput())
1293 {
1294 if (ilUtil::isWindows())
1295 {
1296 $fs = array("datadir_path", "log_path", "convert_path", "zip_path",
1297 "unzip_path", "ghostscript_path", "java_path", "htmldoc_path", "ffmpeg_path");
1298 foreach ($fs as $f)
1299 {
1300 $_POST[$f] = str_replace("\\", "/", $_POST[$f]);
1301 }
1302 }
1303
1304 if (!$this->setup->checkLogSetup($_POST))
1305 {
1306 $i = $this->form->getItemByPostVar("log_path");
1307 $i->setAlert($this->lng->txt($this->setup->getError()));
1308 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"),true);
1309 }
1310 else if (!$this->setup->updateMasterSettings($_POST))
1311 {
1312 ilUtil::sendFailure($this->lng->txt($this->setup->getError()),true);
1313 }
1314 else
1315 {
1316 ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
1317 ilUtil::redirect("setup.php?cmd=mastersettings");
1318 }
1319 }
1320
1321 $this->form->setValuesByPost();
1322 $this->changeMasterSettings(true);
1323 }
1324
1328
1332 function loginClient()
1333 {
1334 session_destroy();
1335
1336 ilUtil::redirect(ILIAS_HTTP_PATH."/login.php?client_id=".$this->setup->getClient()->getId());
1337 }
1338
1342 function displayLogin($a_omit_minit = false, $a_omit_cinit = false)
1343 {
1344 global $lng;
1345 $this->tpl->setVariable("SETUP_LOGIN_CLASS", " ilSetupLogin");
1346 $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html", "setup");
1347
1348 if ($a_omit_minit)
1349 {
1350 $m_form = $this->form->getHTML();
1351 }
1352 if (!$a_omit_cinit)
1353 {
1354 $this->initClientLoginForm();
1355 }
1356 $cl_form = $this->form->getHTML();
1357 if (!$a_omit_minit)
1358 {
1359 $this->initMasterLoginForm();
1360 $m_form = $this->form->getHTML();
1361 }
1362 $this->tpl->setVariable("SETUP_CONTENT", $cl_form."<br>".$m_form);
1363 $this->tpl->setVariable("TXT_HEADER", $lng->txt("login"));
1364 }
1365
1369 public function performMLogin()
1370 {
1371 $this->initMasterLoginForm();
1372 if ($this->form->checkInput())
1373 {
1374 $i = $this->form->getItemByPostVar("mpassword");
1375 if (!$this->setup->loginAsAdmin($_POST["mpassword"]))
1376 {
1377 $i->setAlert($this->lng->txt("login_invalid"));
1378 }
1379 else
1380 {
1381 // everything ok -> we are authenticated
1382 ilUtil::redirect("setup.php");
1383 }
1384 }
1385
1386 // something wrong -> display login again
1387 $this->form->setValuesByPost();
1388 $this->displayLogin(true);
1389 }
1390
1394 function performLogin()
1395 {
1396 $this->initClientLoginForm();
1397 if ($this->form->checkInput())
1398 {
1399 $i = $this->form->getItemByPostVar("password");
1400 if (!$this->setup->loginAsClient(
1401 array("client_id" => $_POST["client_id"],
1402 "username" => $_POST["username"], "password" => $_POST["password"])))
1403 {
1404 $i->setAlert($this->setup->getError());
1405 }
1406 else
1407 {
1408 // everything ok -> we are authenticated
1409 ilUtil::redirect("setup.php");
1410 }
1411 }
1412
1413 // something wrong -> display login again
1414 $this->form->setValuesByPost();
1415 $this->displayLogin(false, true);
1416 }
1417
1421 public function initClientLoginForm()
1422 {
1423 global $lng, $ilCtrl;
1424
1425 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1426 $this->form = new ilPropertyFormGUI();
1427 $this->form->setId("client_login");
1428
1429 // client id
1430 $ti = new ilTextInputGUI($lng->txt("client_id"), "client_id");
1431 $ti->setMaxLength(32);
1432 $ti->setSize(20);
1433 $this->form->addItem($ti);
1434
1435 // username
1436 $ti = new ilTextInputGUI($lng->txt("username"), "username");
1437 $ti->setSize(20);
1438 $this->form->addItem($ti);
1439
1440 // password
1441 $pi = new ilPasswordInputGUI($lng->txt("password"), "password");
1442 $pi->setSize(20);
1443 $pi->setRetype(false);
1444 $pi->setSkipSyntaxCheck(true);
1445 $this->form->addItem($pi);
1446
1447 $this->form->addCommandButton("performLogin", $lng->txt("login"));
1448
1449 $this->form->setTitle($lng->txt("client_login"));
1450 $this->form->setFormAction("setup.php?cmd=gateway");
1451 }
1452
1456 public function initMasterLoginForm()
1457 {
1458 global $lng, $ilCtrl;
1459
1460 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1461 $this->form = new ilPropertyFormGUI();
1462 $this->form->setId("master_login");
1463 // password
1464 $pi = new ilPasswordInputGUI($lng->txt("password"), "mpassword");
1465 $pi->setSize(20);
1466 $pi->setRetype(false);
1467 $pi->setSkipSyntaxCheck(true);
1468 $this->form->addItem($pi);
1469
1470 $this->form->addCommandButton("performMLogin", $lng->txt("login"));
1471
1472 $this->form->setTitle($lng->txt("admin_login"));
1473 $this->form->setFormAction("setup.php?cmd=gateway");
1474
1475 }
1476
1480
1485 {
1486 $_SESSION["ClientId"] = "";
1487
1488 $this->tpl->addBlockFile("CONTENT","content","tpl.clientlist.html", "setup");
1489 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_list"));
1491
1492 // common
1493 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("list_clients"));
1494 $this->tpl->setVariable("TXT_LISTSTATUS",($this->setup->ini->readVariable("clients","list")) ? $this->lng->txt("display_clientlist") : $this->lng->txt("hide_clientlist"));
1495 $this->tpl->setVariable("TXT_TOGGLELIST",($this->setup->ini->readVariable("clients","list")) ? $this->lng->txt("disable") : $this->lng->txt("enable"));
1496
1497 include_once("./setup/classes/class.ilClientListTableGUI.php");
1498 $tab = new ilClientListTableGUI($this->setup);
1499 $this->tpl->setVariable("CLIENT_LIST", $tab->getHTML());
1500
1501 // create new client button
1502 $this->btn_next_on = true;
1503 $this->btn_next_lng = $this->lng->txt("create_new_client")."...";
1504 $this->btn_next_cmd = "newclient";
1505 }
1506
1511 {
1512 $_POST = $this->determineTools($_POST);
1513 $this->updateBasicSettings();
1514 }
1515
1520 {
1521 $this->displayMasterSetup(true);
1522 }
1523
1527 function determineTools($a_tools = array())
1528 {
1529 $cwd = ilUtil::isWindows()
1530 ? str_replace("\\", "/", getcwd())
1531 : getcwd();
1532 if (!ilUtil::isWindows())
1533 {
1534 $tools = array("convert" => "convert",
1535 "zip" => "zip", "unzip" => "unzip", "ghostscript" => "gs",
1536 "java" => "java", "htmldoc" => "htmldoc", "ffmpeg" => "ffmpeg");
1537 $dirs = array("/usr/local", "/usr/local/bin", "/usr/bin", "/bin", "/sw/bin", "/usr/bin");
1538 }
1539 else
1540 {
1541 $tools = array("convert" => "convert.exe",
1542 "zip" => "zip.exe", "unzip" => "unzip.exe");
1543 $dirs = array($cwd."/Services/Windows/bin32/zip",
1544 $cwd."/Services/Windows/bin32/unzip",
1545 $cwd."/Services/Windows/bin32/convert");
1546 }
1547 foreach($tools as $k => $tool)
1548 {
1549 // try which command
1550 unset($ret);
1551 @exec("which ".$tool, $ret);
1552 if (substr($ret[0], 0, 3) != "no " && substr($ret[0], 0, 1) == "/")
1553 {
1554 $a_tools[$k."_path"] = $ret[0];
1555 continue;
1556 }
1557
1558 // try common directories
1559 foreach($dirs as $dir)
1560 {
1561 if (@is_file($dir."/".$tool))
1562 {
1563 $a_tools[$k."_path"] = $dir."/".$tool;
1564 continue;
1565 }
1566 }
1567 }
1568 return $a_tools;
1569 }
1570
1571
1575
1580 function selectDBType()
1581 {
1582 $this->checkDisplayMode("create_new_client");
1583
1584
1585if (true)
1586{
1587 unset($_SESSION["db_type"]);
1588 $this->initDBSelectionForm();
1589 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
1590}
1591else
1592{
1593 // output
1594
1595 $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_select_db.html", "setup");
1596
1597 $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
1598 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
1599
1600 $this->tpl->setVariable("TXT_DB_TYPE", $this->lng->txt("db_type"));
1601 $this->tpl->setVariable("TXT_DB_SELECTION", $this->lng->txt("db_selection"));
1602}
1603 if ($this->setup->getClient()->status["ini"]["status"])
1604 {
1605 $this->setButtonNext("db");
1606 }
1607
1608 $this->checkPanelMode();
1609 }
1610
1614 public function initDBSelectionForm()
1615 {
1616 global $lng, $ilCtrl;
1617
1618 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1619 $this->form = new ilPropertyFormGUI();
1620
1621 // db type
1622 $options = array(
1623 "mysql" => "MySQL 5.0.x or higher (MyISAM engine)",
1624 "innodb" => "MySQL 5.0.x or higher (InnoDB engine)",
1625 "oracle" => "Oracle 10g or higher",
1626 "postgres" => "Postgres (experimental)"
1627 );
1628 $si = new ilSelectInputGUI($lng->txt("db_type"), "db_type");
1629 $si->setOptions($options);
1630 $si->setInfo($lng->txt(""));
1631 $this->form->addItem($si);
1632
1633 $this->form->addCommandButton("selectdbtype", $lng->txt("save"));
1634
1635 $this->form->setTitle($lng->txt("db_selection"));
1636 $this->form->setFormAction("setup.php?cmd=gateway");
1637 }
1638
1642
1646 function displayIni($a_omit_form_init = false)
1647 {
1648 $this->checkDisplayMode("create_new_client");
1649
1650 if ($_POST["db_type"] != "")
1651 {
1652 $_SESSION["db_type"] = $_POST["db_type"];
1653 }
1654 else
1655 {
1656 $_POST["db_type"] = $_SESSION["db_type"];
1657 }
1658
1659 $has_ini = $this->setup->getClient()->status["ini"]["status"];
1660
1661 // use value from client ini if setup was resumed (no value in session)
1662 if (!$_SESSION["db_type"] && $has_ini)
1663 {
1664 $_SESSION["db_type"] = $this->setup->getClient()->getDbType();
1665 }
1666
1667 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_ini"));
1668 if (!$a_omit_form_init)
1669 {
1670 $this->initClientIniForm();
1671 $this->getClientIniValues();
1672 }
1673 $this->tpl->setVariable("SETUP_CONTENT",
1674 $this->form->getHTML());
1675
1676 if ($has_ini)
1677 {
1678 $this->setButtonNext("db");
1679 }
1680
1681 $this->checkPanelMode();
1682 }
1683
1687 public function initClientIniForm()
1688 {
1689 global $lng, $ilCtrl;
1690
1691 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1692 $this->form = new ilPropertyFormGUI();
1693
1694 // client id
1695 if ($this->setup->ini_client_exists)
1696 {
1697 $hi = new ilHiddenInputGUI("client_id");
1698 $hi->setValue($this->client_id);
1699 $this->form->addItem($hi);
1700
1701 $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "hh");
1702 $ne->setValue($this->client_id);
1703 $this->form->addItem($ne);
1704 }
1705 else
1706 {
1707 $ti = new ilTextInputGUI($lng->txt("client_id"), "client_id");
1708 $ti->setMaxLength(32);
1709 $ti->setRequired(true);
1710 $this->form->addItem($ti);
1711 }
1712
1713 // database connection
1714 $sh = new ilFormSectionHeaderGUI();
1715 $sh->setTitle($lng->txt("db_conn"));
1716 $this->form->addItem($sh);
1717
1718 // db type
1719 $ne = new ilNonEditableValueGUI($lng->txt("db_type"), "dbt");
1720 $ne->setValue($lng->txt("db_".$_SESSION["db_type"]));
1721 $this->form->addItem($ne);
1722
1723 // db host
1724 $ti = new ilTextInputGUI($lng->txt("db_host"), "db_host");
1725 $ti->setMaxLength(120);
1726 $ti->setRequired(true);
1727 $this->form->addItem($ti);
1728
1729 // db name
1730 if (in_array($_SESSION["db_type"], array("mysql", "postgres", "innodb")))
1731 {
1732 $ti = new ilTextInputGUI($lng->txt("db_name"), "db_name");
1733 $ti->setRequired(true);
1734 }
1735 else
1736 {
1737 $ti = new ilTextInputGUI($lng->txt("db_service_name"), "db_name");
1738 }
1739 $ti->setMaxLength(40);
1740 $this->form->addItem($ti);
1741
1742 // db user
1743 $ti = new ilTextInputGUI($lng->txt("db_user"), "db_user");
1744 $ti->setMaxLength(40);
1745 $ti->setRequired(true);
1746 $this->form->addItem($ti);
1747
1748 // db port
1749 $ti = new ilTextInputGUI($lng->txt("db_port"), "db_port");
1750 $ti->setMaxLength(8);
1751 $this->form->addItem($ti);
1752
1753 // db password
1754 $ti = new ilTextInputGUI($lng->txt("db_pass"), "db_pass");
1755 $ti->setMaxLength(40);
1756 $this->form->addItem($ti);
1757
1758 $this->form->addCommandButton("saveClientIni", $lng->txt("save"));
1759
1760 $this->form->setTitle($lng->txt("inst_identification"));
1761 $this->form->setFormAction("setup.php?cmd=gateway");
1762 }
1763
1767 public function getClientIniValues()
1768 {
1769 $values = array();
1770
1771 $values["db_host"] = $this->setup->getClient()->getDbHost();
1772 $values["db_user"] = $this->setup->getClient()->getDbUser();
1773 $values["db_port"] = $this->setup->getClient()->getDbPort();
1774 $values["db_pass"] = $this->setup->getClient()->getDbPass();
1775 $values["db_name"] = $this->setup->getClient()->getDbName();
1776 $values["client_id"] = $this->setup->getClient()->getId();
1777
1778 $this->form->setValuesByArray($values);
1779 }
1780
1784 public function saveClientIni()
1785 {
1786 global $tpl, $lng, $ilCtrl;
1787
1788 $this->initClientIniForm();
1789 if ($this->form->checkInput())
1790 {
1791 if (strlen($_POST["client_id"]) != strlen(urlencode(($_POST["client_id"])))
1792 || is_int(strpos($_POST["client_id"], "_")))
1793 {
1794 $i = $this->form->getItemByPostVar("client_id");
1795 $i->setAlert($this->lng->txt("ini_client_id_invalid"));
1796 ilUtil::sendFailure($this->lng->txt("ini_client_id_invalid"),true);
1797 }
1798 else if (strlen($_POST["client_id"]) < 4)
1799 {
1800 $i = $this->form->getItemByPostVar("client_id");
1801 $i->setAlert($this->lng->txt("ini_client_id_too_short"));
1802 ilUtil::sendFailure($this->lng->txt("ini_client_id_too_short"),true);
1803 }
1804 else if (strlen($_POST["client_id"]) > 32)
1805 {
1806 $i = $this->form->getItemByPostVar("client_id");
1807 $i->setAlert($this->lng->txt("ini_client_id_too_long"));
1808 ilUtil::sendFailure($this->lng->txt("ini_client_id_too_long"),true);
1809 }
1810 else if (!$this->setup->ini_client_exists && file_exists(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$_POST["client_id"]))
1811 {
1812 $i = $this->form->getItemByPostVar("client_id");
1813 $i->setAlert($this->lng->txt("ini_client_id_exists"));
1814 ilUtil::sendFailure($this->lng->txt("ini_client_id_exists"),true);
1815 }
1816 else
1817 {
1818
1819 // save some old values
1820 $old_db_name = $this->setup->getClient()->getDbName();
1821 $old_db_type = $this->setup->getClient()->getDbType();
1822 $old_client_id = $this->setup->getClient()->getId();
1823
1824 // create new client object if it does not exist
1825 if (!$this->setup->ini_client_exists)
1826 {
1827 $client_id = $_POST["client_id"];
1828 $this->setup->newClient($client_id);
1829 }
1830
1831 // set client data
1832 $this->setup->getClient()->setId($_POST["client_id"]);
1833 $this->setup->getClient()->setDbHost($_POST["db_host"]);
1834 $this->setup->getClient()->setDbName($_POST["db_name"]);
1835 $this->setup->getClient()->setDbUser($_POST["db_user"]);
1836 $this->setup->getClient()->setDbPort($_POST["db_port"]);
1837 $this->setup->getClient()->setDbPass($_POST["db_pass"]);
1838 $this->setup->getClient()->setDbType($_SESSION["db_type"]);
1839 $this->setup->getClient()->setDSN();
1840
1841 // try to connect to database
1842 if (!$this->setup->getClient()->checkDatabaseHost())
1843 {
1844 $i = $this->form->getItemByPostVar("db_host");
1845 $i->setAlert($this->lng->txt($this->setup->getClient()->getError()));
1846 ilUtil::sendFailure($this->setup->getClient()->getError(),true);
1847 }
1848 else
1849 {
1850 // check if db exists
1851 $db_installed = $this->setup->getClient()->checkDatabaseExists();
1852
1853 if ($db_installed and (!$this->setup->ini_ilias_exists or ($this->setup->getClient()->getDbName() != $old_db_name)))
1854 {
1855 $_POST["db_name"] = $old_db_name;
1856 $message = ucfirst($this->lng->txt("database"))." \"".$this->setup->getClient()->getDbName()."\" ".$this->lng->txt("ini_db_name_exists");
1857 $i = $this->form->getItemByPostVar("db_name");
1858 $i->setAlert($message);
1859 ilUtil::sendFailure($message, true);
1860 }
1861 else
1862 {
1863 // all ok. create client.ini and save posted data
1864 if (!$this->setup->ini_client_exists)
1865 {
1866 if ($this->setup->saveNewClient())
1867 {
1868 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1869 $this->setup->getClient()->status["ini"]["status"] = true;
1870 $_SESSION["ClientId"] = $client_id;
1871 ilUtil::redirect("setup.php?cmd=displayIni&client_id=".$client_id);
1872 }
1873 else
1874 {
1875 $err = $this->setup->getError();
1876 ilUtil::sendFailure($this->lng->txt("save_error").": ".$err, true);
1877 $this->setup->getClient()->status["ini"]["status"] = false;
1878 $this->setup->getClient()->status["ini"]["comment"] = $err;
1879 }
1880 }
1881 else
1882 {
1883 if ($this->setup->getClient()->ini->write())
1884 {
1885 ilUtil::sendSuccess($this->lng->txt("settings_changed"));
1886 $this->setup->getClient()->status["ini"]["status"] = true;
1887 ilUtil::redirect("setup.php?cmd=displayIni");
1888 }
1889 else
1890 {
1891 $err = $this->setup->getClient()->ini->getError();
1892 ilUtil::sendFailure($this->lng->txt("save_error").": ".$err, true);
1893 $this->setup->getClient()->status["ini"]["status"] = false;
1894 $this->setup->getClient()->status["ini"]["comment"] = $err;
1895 }
1896 }
1897 }
1898 }
1899 }
1900 }
1901
1902 $this->form->setValuesByPost();
1903 $this->displayIni(true);
1904 }
1905
1911 function displayError($a_message)
1912 {
1913 $this->setDisplayMode("view");
1914
1915 $this->tpl->addBlockFile("CONTENT", "content", "tpl.error.html", "setup");
1916
1917 $this->tpl->setCurrentBlock("content");
1918 $this->tpl->setVariable("FORMACTION", $_SESSION["referer"]);
1919 $this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
1920 $this->tpl->setVariable("ERROR_MESSAGE", ($a_message));
1921 $this->tpl->parseCurrentBlock();
1922
1923// $this->tpl->show();
1924// exit();
1925 }
1926
1930 function displayLogout()
1931 {
1932 $this->tpl->addBlockFile("CONTENT","content","tpl.logout.html", "setup");
1933
1934 session_destroy();
1935
1936 $this->logged_out = true;
1937 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("logged_out"));
1938 $this->tpl->setCurrentBlock("home_link");
1939 $this->tpl->setVariable("TXT_INDEX",$this->lng->txt("ilias_homepage"));
1940 $this->tpl->setVariable("LNK_INDEX",ILIAS_HTTP_PATH."/index.php");
1941 $this->tpl->parseCurrentBlock();
1942 }
1943
1948 {
1949 include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
1950 $checklist = new ilChecklistGUI();
1951 $checklist->setHeading($this->lng->txt("setup_process_status"));
1952
1953
1954 $OK = "<font color=\"green\"><strong>OK</strong></font>";
1955
1956 $steps = $this->setup->getStatus();
1957
1958 // #16846
1959 $first = array("selectdb" => array(
1960 "status" => ((bool)$_SESSION["db_type"] || (bool)$steps["ini"]["status"]),
1961 "text" => $this->lng->txt("db_selection"),
1962 "comment" => ""
1963 ));
1964
1965 $steps = $first + $steps;
1966
1967 // remove access step
1968 unset($steps["access"]);
1969
1970 $steps["ini"]["text"] = $this->lng->txt("setup_process_step_ini");
1971 $steps["db"]["text"] = $this->lng->txt("setup_process_step_db");
1972 //$steps["sess"]["text"] = $this->lng->txt("setup_process_step_sess");
1973 $steps["lang"]["text"] = $this->lng->txt("setup_process_step_lang");
1974 $steps["contact"]["text"] = $this->lng->txt("setup_process_step_contact");
1975 $steps["proxy"]["text"] = $this->lng->txt("setup_process_step_proxy");
1976 $steps["nic"]["text"] = $this->lng->txt("setup_process_step_nic");
1977 $steps["finish"]["text"] = $this->lng->txt("setup_process_step_finish");
1978
1979 $stpl = new ilTemplate("tpl.process_panel.html", true, true, "setup");
1980
1981 $num = 1;
1982
1983 foreach ($steps as $key => $val)
1984 {
1985 $stpl->setCurrentBlock("menu_row");
1986 $stpl->setVariable("TXT_STEP",$this->lng->txt("step")." ".$num.": &nbsp;");
1987 $stpl->setVariable("TXT_ACTION",$val["text"]);
1988 $stpl->setVariable("IMG_ARROW", "spacer.png");
1989
1990 if ($this->cmd == $key and isset($this->cmd))
1991 {
1992 $stpl->setVariable("HIGHLIGHT", " style=\"font-weight:bold;\"");
1993 }
1994
1995 $status = ($val["status"]) ? $OK : "";
1996
1997 $stpl->setVariable("TXT_STATUS",$status);
1998 $stpl->parseCurrentBlock();
1999
2000 $checklist->addEntry($num.". ".$val["text"], "",
2001 ($val["status"]) ?
2003 ($this->cmd == $key and isset($this->cmd)),
2004 "");
2005
2006 $num++;
2007 }
2008
2009 $stpl->setVariable("TXT_SETUP_PROCESS_STATUS",$this->lng->txt("setup_process_status"));
2010
2011 $this->tpl->setVariable("PROCESS_MENU", $checklist->getHTML());
2012 }
2013
2018 {
2019 include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
2020 $checklist = new ilChecklistGUI();
2021 $checklist->setHeading($this->lng->txt("overall_status"));
2022
2023 $OK = "<font color=\"green\"><strong>OK</strong></font>";
2024
2025 //$this->tpl->addBlockFile("STATUS_PANEL","status_panel","tpl.status_panel.html", "setup");
2026
2027 $this->tpl->setVariable("TXT_OVERALL_STATUS", $this->lng->txt("overall_status"));
2028 // display status
2029 if ($this->setup->getClient()->status)
2030 {
2031 foreach ($this->setup->getClient()->status as $key => $val)
2032 {
2033 $status = ($val["status"]) ? $OK : "&nbsp;";
2034// $this->tpl->setCurrentBlock("status_row");
2035// $this->tpl->setVariable("TXT_STEP", $this->lng->txt("step_".$key));
2036// $this->tpl->setVariable("TXT_STATUS",$status);
2037
2038
2039// $this->tpl->setVariable("TXT_COMMENT",$val["comment"]);
2040// $this->tpl->parseCurrentBlock();
2041
2042 $checklist->addEntry($this->lng->txt("step_".$key), "",
2043 ($val["status"]) ?
2045 }
2046 }
2047 $this->tpl->setVariable("STATUS_PANEL", $checklist->getHTML());
2048 }
2049
2055 function checkDisplayMode($a_title = "")
2056 {
2057 switch ($this->display_mode)
2058 {
2059 case "view":
2060 $this->tpl->addBlockFile("CONTENT","content","tpl.clientview.html", "setup");
2061 // display tabs
2062 include "./setup/include/inc.client_tabs.php";
2063 $client_name = ($this->setup->getClient()->getName()) ? $this->setup->getClient()->getName() : $this->lng->txt("no_client_name");
2064 $this->tpl->setVariable("TXT_HEADER",$client_name." (".$this->lng->txt("client_id").": ".$this->setup->getClient()->getId().")");
2065 break;
2066
2067 case "setup":
2068 $this->tpl->addBlockFile("CONTENT","content","tpl.clientsetup.html", "setup");
2069 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt($a_title));
2070 break;
2071
2072 default:
2073 $this->displayError($this->lng->txt("unknown_display_mode"));
2074 exit();
2075 break;
2076 }
2077 }
2078
2086 {
2087 $sub_tab_html = $this->tabs->getSubTabHTML();
2088 if ($sub_tab_html != "")
2089 {
2090 $this->tpl->setVariable("SUBTABS", $sub_tab_html);
2091 }
2092
2093 }
2094
2095
2100 {
2101 switch ($this->display_mode)
2102 {
2103 case "view":
2104 $this->displayStatusPanel();
2105 break;
2106
2107 case "setup":
2108 $this->displayProcessPanel();
2109 break;
2110 }
2111 }
2112
2117 {
2118 $this->tpl->addBlockFile("CONTENT","content","tpl.clientsetup.html", "setup");
2119
2120 $this->tpl->setVariable("TXT_INFO",$this->lng->txt("info_text_first_client"));
2121 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("setup_first_client"));
2122
2123 $this->displayProcessPanel();
2124
2125 $this->setButtonNext("ini");
2126 }
2127
2131
2136 {
2137 global $ilErr,$ilDB,$ilLog;
2138
2139 $this->checkDisplayMode("setup_database");
2140
2141 //$this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_db.html", "setup");
2142
2143 // database is intalled
2144 if ($this->setup->getClient()->db_installed)
2145 {
2146 $this->setDbSubTabs("db");
2147
2148 $ilDB = $this->setup->getClient()->db;
2149 $this->lng->setDbHandler($ilDB);
2150 include_once "./Services/Database/classes/class.ilDBUpdate.php";
2151 $dbupdate = new ilDBUpdate($ilDB);
2152 $db_status = $dbupdate->getDBVersionStatus();
2153 $hotfix_available = $dbupdate->hotfixAvailable();
2154 $custom_updates_available = $dbupdate->customUpdatesAvailable();
2155 $this->initClientDbForm(false, $dbupdate, $db_status, $hotfix_available, $custom_updates_available);
2156 $this->getClientDbFormValues($dbupdate);
2157 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
2158
2159 if ($db_status)
2160 {
2161 $this->setButtonNext("lang");
2162 }
2163 }
2164 else // database is not installed
2165 {
2166 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_db")."<br />".
2167 "<p><code>CREATE DATABASE &lt;your_db&gt; CHARACTER SET utf8 COLLATE &lt;your_collation&gt;</code></p>".
2168 "<p><b>".$this->lng->txt("info_text_db2")."</b></p><br/>");
2169
2170 $this->initClientDbForm();
2171 $this->getClientDbFormValues();
2172 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
2173 $this->setButtonPrev("ini");
2174 }
2175
2176 $this->checkPanelMode();
2177
2178 $this->displaySubTabs();
2179 }
2180
2181
2182 protected function displayCache() {
2183 require_once('Services/Form/classes/class.ilPropertyFormGUI.php');
2184 require_once('Services/GlobalCache/classes/class.ilGlobalCache.php');
2185 require_once('./Services/GlobalCache/classes/Settings/class.ilGlobalCacheSettings.php');
2186 $this->checkDisplayMode('setup_cache');
2191 $ilGlobalCacheSettings = new ilGlobalCacheSettings();
2192 $ilGlobalCacheSettings->readFromIniFile($this->setup->getClient()->ini);
2193
2194 $cache_form = new ilPropertyFormGUI();
2195 $cache_form->setTitle($this->lng->txt('global_cache_configuration'));
2196 $cache_form->addCommandButton('saveCache', $this->lng->txt('save'));
2197 $cache_form->setFormAction('setup.php?cmd=gateway');
2198
2199 $some_inactive = false;
2200 $message = '';
2201 $service_type = new ilRadioGroupInputGUI($this->lng->txt('global_cache_service_type'), 'global_cache_service_type');
2202
2203 $option = new ilRadioOption($this->lng->txt('none'), - 1);
2204 $service_type->addOption($option);
2205
2206 foreach (ilGlobalCache::getAllTypes() as $type) {
2207 $option = new ilRadioOption($this->lng->txt('global_cache_service_type_' . $type->getServiceType()), $type->getServiceType());
2208 $option->setInfo($this->lng->txt('global_cache_install_info_' . $type->getServiceType()));
2209 if (! $type->isCacheServiceInstallable()) {
2210 $option->setDisabled(true);
2211 $message .= $this->lng->txt('global_cache_service_type_' . $type->getServiceType()) . ': ' . $type->getInstallationFailureReason()
2212 . '; ';
2213 $some_inactive = true;
2214 }
2215 $service_type->addOption($option);
2216 }
2217
2218 if ($some_inactive) {
2219 $service_type->setAlert($message);
2220 ilUtil::sendInfo($this->lng->txt('global_cache_supported_services'));
2221 }
2222
2223 $service_type->setValue($ilGlobalCacheSettings->isActive() ? $ilGlobalCacheSettings->getService() : - 1);
2224 $cache_form->addItem($service_type);
2225 if ($ilGlobalCacheSettings->isActive()) {
2226
2227 $h = new ilFormSectionHeaderGUI();
2228 $h->setTitle($this->lng->txt('cache_activated_components'));
2229 $cache_form->addItem($h);
2230
2231 foreach (ilGlobalCache::getAvailableComponents() as $comp) {
2232 $cc = new ilCheckboxInputGUI($this->lng->txt('cache_activate_' . $comp), 'activate[' . $comp . ']');
2233 $cc->setChecked($ilGlobalCacheSettings->isComponentActivated($comp));
2234 $cache_form->addItem($cc);
2235 }
2236 }
2237
2238 $table_html = '';
2239 require_once('./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php');
2240 require_once('./Services/UIComponent/Button/classes/class.ilLinkButton.php');
2241 $ilToolbarGUI = new ilToolbarGUI();
2242 if ($ilGlobalCacheSettings->isActive()) {
2244 $b->setCaption('cache_flush');
2245 $b->setUrl('setup.php?cmd=flushCache');
2246 $ilToolbarGUI->addButtonInstance($b);
2247 }
2248
2249 if ($ilGlobalCacheSettings->getService() == ilGlobalCache::TYPE_MEMCACHED) {
2250 require_once('./Services/GlobalCache/classes/Memcache/class.ilMemcacheServerTableGUI.php');
2252 $b->setCaption('memcache_add');
2253 $b->setUrl('setup.php?cmd=addMemcacheServer');
2254 $ilToolbarGUI->addButtonInstance($b);
2255 $ilMemcacheServerTableGUI = new ilMemcacheServerTableGUI(NULL);
2256 $table_html = $ilMemcacheServerTableGUI->getHTML();
2257 }
2258
2259 $this->tpl->setVariable('SETUP_CONTENT', $ilToolbarGUI->getHTML() . $cache_form->getHTML() . $table_html);
2260 }
2261
2262
2263 protected function flushCache() {
2264 require_once('Services/GlobalCache/classes/class.ilGlobalCache.php');
2265 ilGlobalCache::flushAll();
2266 ilUtil::redirect('setup.php?cmd=cache');
2267 }
2268
2269
2270 protected function addMemcacheServer() {
2271 require_once('./Services/GlobalCache/classes/Memcache/class.ilMemcacheServerFormGUI.php');
2272 $this->checkDisplayMode('setup_cache');
2273 $ilMemcacheServerFormGUI = new ilMemcacheServerFormGUI(new ilMemcacheServer());
2274 $this->tpl->setVariable('SETUP_CONTENT', $ilMemcacheServerFormGUI->getHTML());
2275 }
2276
2277
2278 protected function createMemcacheServer() {
2279 require_once('./Services/GlobalCache/classes/Memcache/class.ilMemcacheServerFormGUI.php');
2280 $this->checkDisplayMode('setup_cache');
2281 $ilMemcacheServerFormGUI = new ilMemcacheServerFormGUI(new ilMemcacheServer());
2282 $ilMemcacheServerFormGUI->setValuesByPost();
2283 if ($ilMemcacheServerFormGUI->saveObject()) {
2284 ilUtil::redirect('setup.php?cmd=cache');
2285 }
2286 $this->tpl->setVariable('SETUP_CONTENT', $ilMemcacheServerFormGUI->getHTML());
2287 }
2288
2289
2290 protected function editMemcacheServer() {
2291 require_once('./Services/GlobalCache/classes/Memcache/class.ilMemcacheServerFormGUI.php');
2292 $this->checkDisplayMode('setup_cache');
2293 $ilMemcacheServerFormGUI = new ilMemcacheServerFormGUI(ilMemcacheServer::find($_GET['mcsid']));
2294 $ilMemcacheServerFormGUI->fillForm();
2295 $this->tpl->setVariable('SETUP_CONTENT', $ilMemcacheServerFormGUI->getHTML());
2296 }
2297
2298
2299 protected function updateMemcacheServer() {
2300 require_once('./Services/GlobalCache/classes/Memcache/class.ilMemcacheServerFormGUI.php');
2301 $this->checkDisplayMode('setup_cache');
2302
2303 $ilMemcacheServerFormGUI = new ilMemcacheServerFormGUI(ilMemcacheServer::find($_GET['mcsid']));
2304 $ilMemcacheServerFormGUI->setValuesByPost();
2305 if ($ilMemcacheServerFormGUI->saveObject()) {
2306 ilUtil::redirect('setup.php?cmd=cache');
2307 }
2308 $this->tpl->setVariable('SETUP_CONTENT', $ilMemcacheServerFormGUI->getHTML());
2309 }
2310
2311
2312 protected function deleteMemcacheServer() {
2313 require_once('./Services/GlobalCache/classes/Memcache/class.ilMemcacheServer.php');
2314 $ilMemcacheServer = ilMemcacheServer::find($_GET['mcsid']);
2315 $ilMemcacheServer->delete();
2316 ilUtil::redirect('setup.php?cmd=cache');
2317 }
2318
2319
2320 public function saveCache() {
2324 require_once('Services/GlobalCache/classes/class.ilGlobalCache.php');
2325 require_once('./Services/GlobalCache/classes/Settings/class.ilGlobalCacheSettings.php');
2326 ilGlobalCache::flushAll();
2327 $ini = $this->setup->getClient()->ini;
2328
2329 $ilGlobalCacheSettings = new ilGlobalCacheSettings();
2330 $ilGlobalCacheSettings->readFromIniFile($ini);
2331 $service_type = $_POST['global_cache_service_type'];
2332 $ilGlobalCacheSettings->setActive(($service_type >= 0) ? true : false);
2333 $ilGlobalCacheSettings->setService($service_type);
2334 $ilGlobalCacheSettings->resetActivatedComponents();
2335 if (is_array($_POST['activate']) && count($_POST['activate']) > 0) {
2336 foreach ($_POST['activate'] as $comp => $a) {
2337 $ilGlobalCacheSettings->addActivatedComponent($comp);
2338 }
2339 }
2340
2341 $ilGlobalCacheSettings->writeToIniFile($ini);
2342
2343 ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
2344 ilUtil::redirect('setup.php?cmd=cache');
2345 }
2346
2347
2351 function displayDatabaseSlave($a_from_save = false)
2352 {
2353 global $ilErr,$ilDB,$ilLog;
2354
2355 $this->checkDisplayMode("setup_database");
2356
2357 //$this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_db.html", "setup");
2358
2359 // database is intalled
2360 if (!$this->setup->getClient()->db_installed)
2361 {
2362 return;
2363 }
2364
2365 $this->setDbSubTabs("repl");
2366
2367 if (!$a_from_save)
2368 {
2369 $ilDB = $this->setup->getClient()->db;
2370 $this->lng->setDbHandler($ilDB);
2371 }
2372
2373 ilUtil::sendInfo($this->lng->txt("mysql_replication_info_alpha"));
2374
2375 if (!$a_from_save)
2376 {
2377 $this->initDbSlaveForm();
2378 }
2379
2380 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
2381
2382 $this->checkPanelMode();
2383
2384 $this->displaySubTabs();
2385 }
2386
2390 public function initDbSlaveForm()
2391 {
2392 global $lng, $ilCtrl, $ilDB;
2393
2394 $client = $this->setup->getClient();
2395
2396 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2397 $this->form = new ilPropertyFormGUI();
2398
2399 // db type
2400 $ne = new ilNonEditableValueGUI($lng->txt("db_type"), "slave_type");
2401 $ne->setValue($lng->txt("db_".$ilDB->getDbType()));
2402 $this->form->addItem($ne);
2403
2404 // activate slave
2405 $act = new ilCheckboxInputGUI($this->lng->txt("db_active"), "slave_active");
2406 $act->setChecked($client->getDbSlaveActive());
2407 $this->form->addItem($act);
2408
2409 // slave host
2410 $ti = new ilTextInputGUI($lng->txt("db_host"), "slave_host");
2411 $ti->setValue($client->getDbSlaveHost());
2412 $ti->setMaxLength(120);
2413 $ti->setRequired(true);
2414 $act->addSubItem($ti);
2415
2416 // slave name
2417 $ti = new ilTextInputGUI($lng->txt("db_name"), "slave_name");
2418 $ti->setValue($client->getDbSlaveName());
2419 $ti->setRequired(true);
2420 $ti->setMaxLength(40);
2421 $act->addSubItem($ti);
2422
2423 // slave user
2424 $ti = new ilTextInputGUI($lng->txt("db_user"), "slave_user");
2425 $ti->setValue($client->getDbSlaveUser());
2426 $ti->setMaxLength(40);
2427 $ti->setRequired(true);
2428 $act->addSubItem($ti);
2429
2430 // slave port
2431 $ti = new ilTextInputGUI($lng->txt("db_port"), "slave_port");
2432 $ti->setValue($client->getDbSlavePort());
2433 $ti->setMaxLength(8);
2434 $act->addSubItem($ti);
2435
2436 // set password
2437 $set_pw = new ilCheckboxInputGUI($this->lng->txt("db_set_password"), "set_slave_password");
2438 $act->addSubItem($set_pw);
2439
2440 // slave password
2441 $ti = new ilTextInputGUI($lng->txt("db_pass"), "slave_pass");
2442 $ti->setMaxLength(40);
2443 $set_pw->addSubItem($ti);
2444
2445 $this->form->addCommandButton("saveDbSlave", $lng->txt("save"));
2446
2447 $this->form->setTitle($lng->txt("db_slave_settings"));
2448 $this->form->setFormAction("setup.php?cmd=gateway");
2449 }
2450
2454 public function saveDbSlave()
2455 {
2456 global $tpl, $lng, $ilCtrl, $ilDB;
2457
2458 $client = $this->setup->getClient();
2459
2460 $ilDB = $this->setup->getClient()->db;
2461 $this->lng->setDbHandler($ilDB);
2462
2463 $this->initDbSlaveForm();
2464 if ($this->form->checkInput())
2465 {
2466 $client->setDbSlaveActive($this->form->getInput("slave_active"));
2467 if ($this->form->getInput("slave_active"))
2468 {
2469 $client->setDbSlaveHost($this->form->getInput("slave_host"));
2470 $client->setDbSlaveUser($this->form->getInput("slave_user"));
2471 $client->setDbSlavePort($this->form->getInput("slave_port"));
2472 $client->setDbSlaveName($this->form->getInput("slave_name"));
2473 if ($this->form->getInput("set_slave_password"))
2474 {
2475 $client->setDbSlavePass($this->form->getInput("slave_pass"));
2476 }
2477 }
2478 $client->writeIni();
2479
2480 ilUtil::sendSuccess($lng->txt("saved_successfully"), true);
2481 ilUtil::redirect("setup.php?cmd=dbslave");
2482 }
2483 else
2484 {
2485 $this->form->setValuesByPost();
2486 $this->displayDatabaseSlave(true);
2487 }
2488 }
2489
2490
2497 function setDbSubtabs($a_subtab_id = "db")
2498 {
2499 global $ilDB;
2500
2501 if ($ilDB->getDbType() == "mysql")
2502 {
2503 $this->tabs->addSubTab("db", $this->lng->txt("db_master"), "setup.php?client_id=".$this->client_id."&cmd=db");
2504 $this->tabs->addSubTab("repl", $this->lng->txt("db_slave"), "setup.php?client_id=".$this->client_id."&cmd=dbslave");
2505 }
2506
2507 $this->tabs->activateSubTab($a_subtab_id);
2508 }
2509
2510
2511
2515 public function initClientDbForm($a_install = true, $dbupdate = null, $db_status = false, $hotfix_available = false, $custom_updates_available = false)
2516 {
2517 global $lng, $ilCtrl;
2518
2519 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2520 $this->form = new ilPropertyFormGUI();
2521
2522 // type
2523 $ne = new ilNonEditableValueGUI($lng->txt("db_type"), "db_type");
2524 $this->form->addItem($ne);
2525
2526 // version
2527 if ($this->setup->getClient()->getDBType() == "mysql" ||
2528 $this->setup->getClient()->getDBType() == "innodb")
2529 {
2530 $ne = new ilNonEditableValueGUI($lng->txt("version"), "db_version");
2531 $ilDB = $this->setup->getClient()->db;
2532 $ne->setValue($ilDB->getDBVersion());
2533 $this->form->addItem($ne);
2534 }
2535
2536 // host
2537 $ne = new ilNonEditableValueGUI($lng->txt("host"), "db_host");
2538 $this->form->addItem($ne);
2539
2540 // name
2541 $ne = new ilNonEditableValueGUI($lng->txt("name"), "db_name");
2542 $this->form->addItem($ne);
2543
2544 // user
2545 $ne = new ilNonEditableValueGUI($lng->txt("user"), "db_user");
2546 $this->form->addItem($ne);
2547
2548 // port
2549 $ne = new ilNonEditableValueGUI($lng->txt("port"), "db_port");
2550 $this->form->addItem($ne);
2551
2552 // creation / collation for mysql
2553 if (($this->setup->getClient()->getDBType() == "mysql" ||
2554 $this->setup->getClient()->getDBType() == "innodb") && $a_install)
2555 {
2556 // create database
2557 $cb = new ilCheckboxInputGUI($lng->txt("database_create"), "chk_db_create");
2558
2559 // collation
2560 $collations = array
2561 (
2562 "utf8_unicode_ci",
2563 "utf8_general_ci",
2564 "utf8_czech_ci",
2565 "utf8_danish_ci",
2566 "utf8_estonian_ci",
2567 "utf8_icelandic_ci",
2568 "utf8_latvian_ci",
2569 "utf8_lithuanian_ci",
2570 "utf8_persian_ci",
2571 "utf8_polish_ci",
2572 "utf8_roman_ci",
2573 "utf8_romanian_ci",
2574 "utf8_slovak_ci",
2575 "utf8_slovenian_ci",
2576 "utf8_spanish2_ci",
2577 "utf8_spanish_ci",
2578 "utf8_swedish_ci",
2579 "utf8_turkish_ci"
2580 );
2581 foreach($collations as $collation)
2582 {
2583 $options[$collation] = $collation;
2584 }
2585 $si = new ilSelectInputGUI($lng->txt("collation"), "collation");
2586 $si->setOptions($options);
2587 $si->setInfo($this->lng->txt("info_text_db_collation2")." ".
2588 "<a target=\"_new\" href=\"http://dev.mysql.com/doc/mysql/en/charset-unicode-sets.html\">".
2589 " MySQL Reference Manual :: 10.11.1 Unicode Character Sets</a>");
2590 $cb->addSubItem($si);
2591
2592 $this->form->addItem($cb);
2593 }
2594
2595 if ($a_install)
2596 {
2597 $this->form->addCommandButton("installDatabase", $lng->txt("database_install"));
2598 }
2599 else
2600 {
2601 $ilDB = $this->setup->getClient()->db;
2602 $this->lng->setDbHandler($ilDB);
2603 $dbupdate = new ilDBUpdate($ilDB);
2604
2605 // database version
2606 $ne = new ilNonEditableValueGUI($lng->txt("database_version"), "curv");
2607 $ne->setValue($dbupdate->currentVersion);
2608 $this->form->addItem($ne);
2609
2610 // file version
2611 $ne = new ilNonEditableValueGUI($lng->txt("file_version"), "filev");
2612 $ne->setValue($dbupdate->fileVersion);
2613 $this->form->addItem($ne);
2614
2615 if (!$db_status = $dbupdate->getDBVersionStatus())
2616 {
2617 // next update step
2618 $options = array();
2619 for ($i = $dbupdate->currentVersion + 1; $i <= $dbupdate->fileVersion; $i++)
2620 {
2621 $options[$i] = $i;
2622 }
2623 if (count($options) > 1)
2624 {
2625 $si = new ilSelectInputGUI($lng->txt("next_update_break"), "update_break");
2626 $si->setOptions($options);
2627 $si->setInfo($lng->txt("next_update_break_info"));
2628 $this->form->addItem($si);
2629 }
2630
2631 if ($dbupdate->getRunningStatus() > 0)
2632 {
2633 ilUtil::sendFailure($this->lng->txt("db_update_interrupted")." (Step ".$dbupdate->getRunningStatus().") <br /><br />".
2634 $this->lng->txt("db_update_interrupted_avoid"));
2635 }
2636 else
2637 {
2638 ilUtil::sendInfo($this->lng->txt("database_needs_update"));
2639 }
2640 $this->form->addCommandButton("updateDatabase", $lng->txt("database_update"));
2641 $this->form->addCommandButton("showUpdateSteps", $lng->txt("show_update_steps"));
2642 }
2643 else if ($hotfix_available)
2644 {
2645 // hotfix current version
2646 $ne = new ilNonEditableValueGUI($lng->txt("applied_hotfixes"), "curhf");
2647 $ne->setValue($dbupdate->getHotfixCurrentVersion());
2648 $this->form->addItem($ne);
2649
2650 // hotfix file version
2651 $ne = new ilNonEditableValueGUI($lng->txt("available_hotfixes"), "filehf");
2652 $ne->setValue($dbupdate->getHotfixFileVersion());
2653 $this->form->addItem($ne);
2654
2655 $this->form->addCommandButton("applyHotfix", $lng->txt("apply_hotfixes"));
2656 $this->form->addCommandButton("showHotfixSteps", $lng->txt("show_update_steps"));
2657 ilUtil::sendInfo($this->lng->txt("database_needs_update"));
2658 }
2659 elseif($custom_updates_available)
2660 {
2661 // custom updates current version
2662 $ne = new ilNonEditableValueGUI($lng->txt("applied_custom_updates"), "curcu");
2663 $ne->setValue($dbupdate->getCustomUpdatesCurrentVersion());
2664 $this->form->addItem($ne);
2665
2666 // custom updates file version
2667 $ne = new ilNonEditableValueGUI($lng->txt("available_custom_updates"), "filecu");
2668 $ne->setValue($dbupdate->getCustomUpdatesFileVersion());
2669 $this->form->addItem($ne);
2670
2671 $this->form->addCommandButton("applyCustomUpdates", $lng->txt("apply_custom_updates"));
2672 ilUtil::sendInfo($this->lng->txt("database_needs_update"));
2673 }
2674 else
2675 {
2676 if ($dbupdate->getHotfixFileVersion() > 0)
2677 {
2678 // hotfix current version
2679 $ne = new ilNonEditableValueGUI($lng->txt("applied_hotfixes"), "curhf");
2680 $ne->setValue($dbupdate->getHotfixCurrentVersion());
2681 $this->form->addItem($ne);
2682
2683 // hotfix file version
2684 $ne = new ilNonEditableValueGUI($lng->txt("available_hotfixes"), "filehf");
2685 $ne->setValue($dbupdate->getHotfixFileVersion());
2686 $this->form->addItem($ne);
2687 }
2688 if ($dbupdate->getCustomUpdatesFileVersion() > 0)
2689 {
2690 // custom updates current version
2691 $ne = new ilNonEditableValueGUI($lng->txt("applied_custom_updates"), "curcu");
2692 $ne->setValue($dbupdate->getCustomUpdatesCurrentVersion());
2693 $this->form->addItem($ne);
2694
2695 // custom updates file version
2696 $ne = new ilNonEditableValueGUI($lng->txt("available_custom_updates"), "filecu");
2697 $ne->setValue($dbupdate->getCustomUpdatesFileVersion());
2698 $this->form->addItem($ne);
2699 }
2700 ilUtil::sendSuccess($this->lng->txt("database_is_uptodate"));
2701 }
2702 }
2703
2704 $this->form->setTitle($lng->txt("database"));
2705 $this->form->setFormAction("setup.php?cmd=gateway");
2706 }
2707
2712 public function getClientDbFormValues($dbupdate = null)
2713 {
2714 global $lng;
2715
2716 $values = array();
2717
2718 $values["db_host"] = $this->setup->getClient()->getDbHost();
2719 $values["db_name"] = $this->setup->getClient()->getDbName();
2720 $values["db_user"] = $this->setup->getClient()->getDbUser();
2721 $values["db_port"] = $this->setup->getClient()->getDbPort();
2722 $values["db_type"] = $lng->txt("db_".$this->setup->getClient()->getDbType());
2723 if (is_object($dbupdate))
2724 {
2725 $values["update_break"] = $dbupdate->fileVersion;
2726 if (($dbupdate->fileVersion - $dbupdate->currentVersion) >= 200)
2727 {
2728 $values["update_break"] = $dbupdate->currentVersion + 200 -
2729 ($dbupdate->currentVersion % 100);
2730 }
2731 }
2732
2733 $this->form->setValuesByArray($values);
2734 }
2735
2739
2747 {
2748 if (!$this->setup->getClient()->db_exists)
2749 {
2750 if ($_POST["chk_db_create"])
2751 {
2752 if (!$this->setup->createDatabase($_POST["collation"]))
2753 {
2754 ilUtil::sendFailure($this->lng->txt($this->setup->getError()), true);
2755 ilUtil::redirect("setup.php?cmd=displayDatabase");
2756 }
2757 }
2758 else
2759 {
2760 ilUtil::sendFailure($this->lng->txt("database_not_exists_create_first"), true);
2761 ilUtil::redirect("setup.php?cmd=displayDatabase");
2762 }
2763 }
2764 if (!$this->setup->installDatabase())
2765 {
2766 ilUtil::sendFailure($this->lng->txt($this->setup->getError()), true);
2767 }
2768 else
2769 {
2770 ilUtil::sendSuccess($this->lng->txt("database_installed"), true);
2771 }
2772 ilUtil::redirect("setup.php?cmd=displayDatabase");
2773 }
2774
2778
2783 {
2785
2786 $ilCtrlStructureReader->setIniFile($this->setup->getClient()->ini);
2787
2788 include_once "./Services/Database/classes/class.ilDBUpdate.php";
2789 include_once "./Services/AccessControl/classes/class.ilRbacAdmin.php";
2790 include_once "./Services/AccessControl/classes/class.ilRbacReview.php";
2791 include_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
2792 include_once "./Services/Tree/classes/class.ilTree.php";
2793 include_once "./Services/Xml/classes/class.ilSaxParser.php";
2794 include_once "./Services/Object/classes/class.ilObjectDefinition.php";
2795
2796
2797 // referencing db handler in language class
2798 $ilDB = $this->setup->getClient()->db;
2799 $this->lng->setDbHandler($ilDB);
2800
2801 // run dbupdate
2802 $dbupdate = new ilDBUpdate($ilDB);
2803 $dbupdate->applyUpdate((int) $_POST["update_break"]);
2804
2805 if ($dbupdate->updateMsg == "no_changes")
2806 {
2807 $message = $this->lng->txt("no_changes").". ".$this->lng->txt("database_is_uptodate");
2808 }
2809 else
2810 {
2811 $sep = "";
2812 foreach ($dbupdate->updateMsg as $row)
2813 {
2814 if ($row["msg"] == "update_applied")
2815 {
2816 $a_message.= $sep.$row["nr"];
2817 $sep = ", ";
2818 }
2819 else
2820 {
2821 $e_message.= "<br/>".$this->lng->txt($row["msg"]).": ".$row["nr"];
2822 }
2823 }
2824 if ($a_message != "")
2825 {
2826 $a_message = $this->lng->txt("update_applied").": ".$a_message;
2827 }
2828 }
2829
2830 ilUtil::sendInfo($a_message.$e_message, true);
2831 ilUtil::redirect("setup.php?cmd=displayDatabase");
2832 }
2833
2837
2845 {
2846 $this->showUpdateSteps(true);
2847 }
2848
2849
2853 function showUpdateSteps($a_hotfix = false)
2854 {
2856
2857 $this->checkDisplayMode("setup_database");
2858
2859 //$this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_db.html", "setup");
2860
2861 // database is intalled
2862 if ($this->setup->getClient()->db_installed)
2863 {
2864 $ilDB = $this->setup->getClient()->db;
2865 $this->lng->setDbHandler($ilDB);
2866 $dbupdate = new ilDBUpdate($ilDB);
2867 $db_status = $dbupdate->getDBVersionStatus();
2868 $hotfix_available = $dbupdate->hotfixAvailable();
2869 $custom_updates_available = $dbupdate->customUpdatesAvailable();
2870// $this->initClientDbForm(false, $dbupdate, $db_status, $hotfix_available, $custom_updates_available);
2871// $this->getClientDbFormValues($dbupdate);
2872
2873 $ntpl = new ilTemplate("tpl.setup_steps.html", true, true, "setup");
2874 if ($a_hotfix)
2875 {
2876 $ntpl->setVariable("CONTENT", $dbupdate->getHotfixSteps());
2877 }
2878 else
2879 {
2880 $ntpl->setVariable("CONTENT", $dbupdate->getUpdateSteps($_POST["update_break"]));
2881 }
2882 $ntpl->setVariable("BACK", $this->lng->txt("back"));
2883 $ntpl->setVariable("HREF_BACK", "./setup.php?client_id=&cmd=db");
2884 $this->tpl->setVariable("SETUP_CONTENT", $ntpl->get());
2885 }
2886 }
2887
2888
2892
2896 function applyHotfix()
2897 {
2899
2900 $ilCtrlStructureReader->setIniFile($this->setup->getClient()->ini);
2901
2902 include_once "./Services/Database/classes/class.ilDBUpdate.php";
2903 include_once "./Services/AccessControl/classes/class.ilRbacAdmin.php";
2904 include_once "./Services/AccessControl/classes/class.ilRbacReview.php";
2905 include_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
2906 include_once "./Services/Tree/classes/class.ilTree.php";
2907 include_once "./Services/Xml/classes/class.ilSaxParser.php";
2908 include_once "./Services/Object/classes/class.ilObjectDefinition.php";
2909
2910 // referencing db handler in language class
2911 $ilDB = $this->setup->getClient()->db;
2912 $this->lng->setDbHandler($ilDB);
2913
2914 // run dbupdate
2915 $dbupdate = new ilDBUpdate($ilDB);
2916 $dbupdate->applyHotfix();
2917
2918 if ($dbupdate->updateMsg == "no_changes")
2919 {
2920 $message = $this->lng->txt("no_changes").". ".$this->lng->txt("database_is_uptodate");
2921 }
2922 else
2923 {
2924 $sep = "";
2925 foreach ($dbupdate->updateMsg as $row)
2926 {
2927 if ($row["msg"] == "update_applied")
2928 {
2929 $a_message.= $sep.$row["nr"];
2930 $sep = ", ";
2931 }
2932 else
2933 {
2934 $e_message.= "<br/>".$this->lng->txt($row["msg"]).": ".$row["nr"];
2935 }
2936 }
2937 if ($a_message != "")
2938 {
2939 $a_message = $this->lng->txt("update_applied").": ".$a_message;
2940 }
2941 }
2942
2943 ilUtil::sendInfo($a_message.$e_message, true);
2944 ilUtil::redirect("setup.php?cmd=displayDatabase");
2945 }
2946
2950
2955 {
2956 require_once('Services/Authentication/classes/class.ilSessionControl.php');
2957
2958 $this->checkDisplayMode("setup_sessions");
2959
2960 if (!$this->setup->getClient()->db_installed)
2961 {
2962 // program should never come to this place
2963 $message = "No database found! Please install database first.";
2964 ilUtil::sendInfo($message);
2965 }
2966
2967 $setting_fields = ilSessionControl::getSettingFields();
2968
2969 $valid = true;
2970 $settings = array();
2971
2972 foreach( $setting_fields as $field )
2973 {
2974 if( $field == 'session_allow_client_maintenance' )
2975 {
2976 if( isset($_POST[$field]) ) $_POST[$field] = '1';
2977 else $_POST[$field] = '0';
2978 }
2979
2980 if( isset($_POST[$field]) && $_POST[$field] != '' )
2981 {
2982 $settings[$field] = $_POST[$field];
2983 }
2984 else
2985 {
2986 $valid = false;
2987 break;
2988 }
2989
2990 }
2991
2992 if($valid) $this->setup->setSessionSettings($settings);
2993
2994 $settings = $this->setup->getSessionSettings();
2995
2996 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2997 $form = new ilPropertyFormGUI();
2998
2999 include_once 'Services/Authentication/classes/class.ilSession.php';
3000
3001 // BEGIN SESSION SETTINGS
3002 // create session handling radio group
3003 $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type');
3004 $ssettings->setValue($settings['session_handling_type'], ilSession::SESSION_HANDLING_FIXED);
3005
3006 // first option, fixed session duration
3007 $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED);
3008
3009 // add session handling to radio group
3010 $ssettings->addOption($fixed);
3011
3012 // second option, session control
3013 $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT);
3014
3015 // this is the max count of active sessions
3016 // that are getting started simlutanously
3017 $ti = new ilTextInputGUI($this->lng->txt('sess_max_session_count'), "session_max_count");
3018 $ti->setInfo($this->lng->txt('sess_max_session_count_info'));
3019 $ti->setMaxLength(5);
3020 $ti->setSize(5);
3021 $ti->setValue($settings['session_max_count']);
3022 $ldsh->addSubItem($ti);
3023
3024 // after this (min) idle time the session can be deleted,
3025 // if there are further requests for new sessions,
3026 // but max session count is reached yet
3027 $ti = new ilTextInputGUI($this->lng->txt('sess_min_session_idle'), "session_min_idle");
3028 $ti->setInfo($this->lng->txt('sess_min_session_idle_info'));
3029 $ti->setMaxLength(5);
3030 $ti->setSize(5);
3031 $ti->setValue($settings['session_min_idle']);
3032 $ldsh->addSubItem($ti);
3033
3034 // after this (max) idle timeout the session expires
3035 // and become invalid, so it is not considered anymore
3036 // when calculating current count of active sessions
3037 $ti = new ilTextInputGUI($this->lng->txt('sess_max_session_idle'), "session_max_idle");
3038 $ti->setInfo($this->lng->txt('sess_max_session_idle_info'));
3039 $ti->setMaxLength(5);
3040 $ti->setSize(5);
3041 $ti->setValue($settings['session_max_idle']);
3042 $ldsh->addSubItem($ti);
3043
3044 // this is the max duration that can elapse between the first and the secnd
3045 // request to the system before the session is immidietly deleted
3046 $ti = new ilTextInputGUI($this->lng->txt('sess_max_session_idle_after_first_request'), "session_max_idle_after_first_request");
3047 $ti->setInfo($this->lng->txt('sess_max_session_idle_after_first_request_info'));
3048 $ti->setMaxLength(5);
3049 $ti->setSize(5);
3050 $ti->setValue($settings['session_max_idle_after_first_request']);
3051 $ldsh->addSubItem($ti);
3052
3053 // add session control to radio group
3054 $ssettings->addOption($ldsh);
3055
3056 $form->addItem($ssettings);
3057
3058 // controls the ability t maintenance the following
3059 // settings in client administration
3060 $chkb = new ilCheckboxInputGUI($this->lng->txt('sess_allow_client_maintenance'), "session_allow_client_maintenance");
3061 $chkb->setInfo($this->lng->txt('sess_allow_client_maintenance_info'));
3062 $chkb->setChecked($settings['session_allow_client_maintenance'] ? true : false);
3063 $form->addItem($chkb);
3064 // END SESSION SETTINGS
3065
3066 // save and cancel commands
3067 $form->addCommandButton("sess", $this->lng->txt('save'));
3068
3069 $form->setTitle($this->lng->txt("sess_sessions"));
3070 $form->setFormAction('setup.php?client_id='.$this->client_id.'&cmd=sess');
3071
3072 $this->tpl->setVariable("TXT_SETUP_TITLE",ucfirst(trim($this->lng->txt('sess_sessions'))));
3073 $this->tpl->setVariable("TXT_INFO", '');
3074 $this->tpl->setVariable("SETUP_CONTENT", $form->getHTML());
3075
3076 /*$this->setButtonPrev("db");
3077
3078 if($this->setup->checkClientSessionSettings($this->client,true))
3079 {
3080 $this->setButtonNext("lang");
3081 }*/
3082
3083 $this->checkPanelMode();
3084 }
3085
3089
3094 {
3095 $this->checkDisplayMode("setup_languages");
3096
3097 if (!$this->setup->getClient()->db_installed)
3098 {
3099 // program should never come to this place
3100 $message = "No database found! Please install database first.";
3101 ilUtil::sendFailure($message);
3102 }
3103
3104 include_once("./setup/classes/class.ilSetupLanguageTableGUI.php");
3105 $tab = new ilSetupLanguageTableGUI($this->setup->getClient());
3106 $this->tpl->setVariable("SETUP_CONTENT", $tab->getHTML());
3107
3108 $this->tpl->setVariable("TXT_SETUP_TITLE",ucfirst(trim($this->lng->txt("setup_languages"))));
3109 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_lang"));
3110
3111 $installed_langs = $this->lng->getInstalledLanguages();
3112 $lang_count = count($installed_langs);
3113 if ($lang_count > 0)
3114 {
3115 $this->setup->getClient()->status["lang"]["status"] = true;
3116 $this->setup->getClient()->status["lang"]["comment"] = $lang_count." ".$this->lng->txt("languages_installed");
3117 }
3118 else
3119 {
3120 $this->setup->getClient()->status["lang"]["status"] = false;
3121 $this->setup->getClient()->status["lang"]["comment"] = $this->lng->txt("lang_none_installed");
3122 }
3123
3124 $this->setButtonPrev("lang");
3125
3126 if ($lang_count > 0)
3127 {
3128 $this->setButtonNext("contact");
3129 }
3130
3131 $this->checkPanelMode();
3132 }
3133
3140 function saveLanguages()
3141 {
3142 if (empty($_POST["form"]["lang_id"]))
3143 {
3144 ilUtil::sendFailure($this->lng->txt("lang_min_one_language"), true);
3145 ilUtil::redirect("setup.php?cmd=lang");
3146 }
3147
3148 if (!in_array($_POST["form"]["lang_default"],$_POST["form"]["lang_id"]))
3149 {
3150 ilUtil::sendFailure($this->lng->txt("lang_not_installed_default"), true);
3151 ilUtil::redirect("setup.php?cmd=lang");
3152 }
3153
3154 $result = $this->lng->installLanguages($_POST["form"]["lang_id"], $_POST["form"]["lang_local"]);
3155
3156 if (is_array($result))
3157 {
3158 $count = count($result);
3159 $txt = "tet";
3160
3161 foreach ($result as $key => $lang_key)
3162 {
3163 $list .= $this->lng->txt("lang_".$lang_key);
3164
3165 if ($count > $key + 1)
3166 {
3167 $list .= ", ";
3168 }
3169 }
3170 }
3171
3172 $this->setup->getClient()->setDefaultLanguage($_POST["form"]["lang_default"]);
3173 $message = $this->lng->txt("languages_installed");
3174
3175 if ($result !== true)
3176 {
3177 $message .= "<br/>(".$this->lng->txt("langs_not_valid_not_installed").": ".$list.")";
3178 }
3179 ilUtil::sendInfo($message, true);
3180 ilUtil::redirect("setup.php?cmd=lang");
3181 }
3182
3186
3190 function displayContactData($a_omit_init = false)
3191 {
3192 $this->checkDisplayMode("setup_contact_data");
3193 $settings = $this->setup->getClient()->getAllSettings();
3194
3195 if (!$a_omit_init)
3196 {
3197 $this->initContactDataForm();
3198 $this->getContactValues();
3199 }
3200 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
3201 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_contact"));
3202 $this->setButtonPrev("lang");
3203
3204 $check = $this->setup->checkClientContact($this->setup->client);
3205
3206 $this->setup->getClient()->status["contact"]["status"] = $check["status"];
3207 $this->setup->getClient()->status["contact"]["comment"] = $check["comment"];
3208
3209 if ($check["status"])
3210 {
3211 $this->setButtonNext("proxy");
3212 }
3213
3214 $this->checkPanelMode();
3215 }
3216
3222 public function initContactDataForm()
3223 {
3224 global $lng, $ilCtrl;
3225
3226 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3227 $this->form = new ilPropertyFormGUI();
3228
3229 // name
3230 $ti = new ilTextInputGUI($lng->txt("name"), "inst_name");
3231 $ti->setMaxLength(64);
3232 $ti->setSize(30);
3233 $ti->setRequired(true);
3234 $this->form->addItem($ti);
3235
3236 // description
3237 $ti = new ilTextInputGUI($lng->txt("client_info"), "inst_info");
3238 $ti->setMaxLength(64);
3239 $ti->setSize(30);
3240 $this->form->addItem($ti);
3241
3242 // institution
3243 $ti = new ilTextInputGUI($lng->txt("client_institution"), "inst_institution");
3244 $ti->setMaxLength(64);
3245 $ti->setSize(30);
3246 $this->form->addItem($ti);
3247
3248 // contact data
3249 $sh = new ilFormSectionHeaderGUI();
3250 $sh->setTitle($lng->txt("contact_data"));
3251 $this->form->addItem($sh);
3252
3253 // first name
3254 $ti = new ilTextInputGUI($lng->txt("firstname"), "admin_firstname");
3255 $ti->setMaxLength(64);
3256 $ti->setSize(30);
3257 $ti->setRequired(true);
3258 $this->form->addItem($ti);
3259
3260 // last name
3261 $ti = new ilTextInputGUI($lng->txt("lastname"), "admin_lastname");
3262 $ti->setMaxLength(64);
3263 $ti->setSize(30);
3264 $ti->setRequired(true);
3265 $this->form->addItem($ti);
3266
3267 $fs = array (
3268 "title" => array("max" => 64, "size" => 30),
3269 "position" => array("max" => 64, "size" => 30),
3270 "institution" => array("max" => 200, "size" => 30),
3271 "street" => array("max" => 64, "size" => 30),
3272 "zipcode" => array("max" => 10, "size" => 5),
3273 "city" => array("max" => 64, "size" => 30),
3274 "country" => array("max" => 64, "size" => 30),
3275 "phone" => array("max" => 64, "size" => 30)
3276 );
3277 foreach ($fs as $f => $op)
3278 {
3279 // field
3280 $ti = new ilTextInputGUI($lng->txt($f), "admin_".$f);
3281 $ti->setMaxLength($op["max"]);
3282 $ti->setSize($op["size"]);
3283 $ti->setInfo($lng->txt(""));
3284 $this->form->addItem($ti);
3285 }
3286
3287 // email
3288 $ti = new ilEmailInputGUI($lng->txt("email"), "admin_email");
3289 $ti->setRequired(true);
3290 $ti->allowRFC822(true);
3291 $this->form->addItem($ti);
3292
3293 // feedback recipient
3294 /*$ti = new ilEmailInputGUI($lng->txt("feedback_recipient"), "feedback_recipient");
3295 $ti->setInfo($lng->txt("feedback_recipient_info"));
3296 $ti->setRequired(true);
3297 $ti->allowRFC822(true);
3298 $this->form->addItem($ti);*/
3299
3300 // error recipient
3301 /*$ti = new ilEmailInputGUI($lng->txt("error_recipient"), "error_recipient");
3302 $ti->allowRFC822(true);
3303 $this->form->addItem($ti);*/
3304
3305 $this->form->addCommandButton("saveContact", $lng->txt("save"));
3306
3307 $this->form->setTitle($lng->txt("client_data"));
3308 $this->form->setFormAction("setup.php?cmd=gateway");
3309 }
3310
3314 public function getContactValues()
3315 {
3316
3317 $settings = $this->setup->getClient()->getAllSettings();
3318
3319 $values = $settings;
3320
3321 $values["inst_name"] = ($this->setup->getClient()->getName())
3322 ? $this->setup->getClient()->getName()
3323 : $this->setup->getClient()->getId();
3324 $values["inst_info"] = $this->setup->getClient()->getDescription();
3325
3326 $this->form->setValuesByArray($values);
3327 }
3328
3332 public function saveContact()
3333 {
3334 global $tpl, $lng, $ilCtrl;
3335
3336 $this->initContactDataForm();
3337 if ($this->form->checkInput())
3338 {
3339 $this->setup->getClient()->setSetting("admin_firstname", $_POST["admin_firstname"]);
3340 $this->setup->getClient()->setSetting("admin_lastname", $_POST["admin_lastname"]);
3341 $this->setup->getClient()->setSetting("admin_title", $_POST["admin_title"]);
3342 $this->setup->getClient()->setSetting("admin_position", $_POST["admin_position"]);
3343 $this->setup->getClient()->setSetting("admin_institution", $_POST["admin_institution"]);
3344 $this->setup->getClient()->setSetting("admin_street", $_POST["admin_street"]);
3345 $this->setup->getClient()->setSetting("admin_zipcode", $_POST["admin_zipcode"]);
3346 $this->setup->getClient()->setSetting("admin_city", $_POST["admin_city"]);
3347 $this->setup->getClient()->setSetting("admin_country", $_POST["admin_country"]);
3348 $this->setup->getClient()->setSetting("admin_phone", $_POST["admin_phone"]);
3349 $this->setup->getClient()->setSetting("admin_email", $_POST["admin_email"]);
3350 $this->setup->getClient()->setSetting("inst_institution", $_POST["inst_institution"]);
3351 $this->setup->getClient()->setSetting("inst_name", $_POST["inst_name"]);
3352 //$this->setup->getClient()->setSetting("feedback_recipient", $_POST["feedback_recipient"]);
3353 //$this->setup->getClient()->setSetting("error_recipient", $_POST["error_recipient"]);
3354
3355 // update client.ini
3356 $this->setup->getClient()->setName($_POST["inst_name"]);
3357 $this->setup->getClient()->setDescription($_POST["inst_info"]);
3358 $this->setup->getClient()->ini->write();
3359
3360 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
3361 ilUtil::redirect("setup.php?cmd=displayContactData");
3362 }
3363
3364 $this->form->setValuesByPost();
3365 $this->displayContactData(true);
3366 }
3367
3371
3375 function displayNIC($a_omit_init = false)
3376 {
3377 $this->checkDisplayMode("nic_registration");
3378 $settings = $this->setup->getClient()->getAllSettings();
3379 $nic_key = $this->setup->getClient()->getNICkey();
3380
3381 // reload settings
3382 $settings = $this->setup->getClient()->getAllSettings();
3383//var_dump($settings);
3384 if ($settings["nic_enabled"] == "1" && $settings["inst_id"] > 0)
3385 {
3386 $this->no_second_nav = true;
3387 $this->tpl->setVariable("TXT_INFO",$this->lng->txt("info_text_nic3")." ".$settings["inst_id"].".");
3388 }
3389 else
3390 {
3391 // reload settings
3392 $settings = $this->setup->getClient()->getAllSettings();
3393
3394 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_nic"));
3395 if (!$a_omit_init)
3396 {
3397 $this->initRegistrationForm();
3398 $this->getRegistrationValues();
3399 }
3400 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
3401
3402 if (isset($settings["nic_enabled"]))
3403 {
3404 $this->setup->getClient()->status["nic"]["status"] = true;
3405 }
3406
3407 }
3408
3409 $this->setButtonPrev("proxy");
3410
3411 if ($this->setup->getClient()->status["nic"]["status"])
3412 {
3413 $this->setButtonNext("finish","finish");
3414 }
3415
3416 $this->checkPanelMode();
3417 }
3418
3424 public function initRegistrationForm($a_mode = "edit")
3425 {
3426 global $lng, $ilCtrl;
3427
3428 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3429 $this->form = new ilPropertyFormGUI();
3430
3431 // registration type
3432 $radg = new ilRadioGroupInputGUI($lng->txt("nic_registration"), "register");
3433 $radg->setValue(1);
3434 $op1 = new ilRadioOption($lng->txt("nic_reg_online"), 1);
3435 $radg->addOption($op1);
3436 $op1 = new ilRadioOption($lng->txt("nic_reg_disable"), 0, $lng->txt("nic_reg_disable_info"));
3437 $radg->addOption($op1);
3438 $this->form->addItem($radg);
3439
3440 $this->form->addCommandButton("saveRegistration", $lng->txt("save"));
3441 $this->form->setFormAction("setup.php?cmd=gateway");
3442 }
3443
3447 public function getRegistrationValues()
3448 {
3449 $settings = $this->setup->getClient()->getAllSettings();
3450 $nic_key = $this->setup->getClient()->getNICkey();
3451
3452
3453 $values = array();
3454
3455 if (!isset($settings["nic_enabled"]) or $settings["nic_enabled"] == "1")
3456 {
3457 $values["register"] = 1;
3458 }
3459 /*elseif ($settings["nic_enabled"] == "2")
3460 {
3461 $this->tpl->setVariable("EMAIL",$checked);
3462 }*/
3463 else
3464 {
3465 $values["register"] = 0;
3466 }
3467
3468 $this->form->setValuesByArray($values);
3469 }
3470
3474 public function saveRegistration()
3475 {
3476 global $tpl, $lng, $ilCtrl;
3477
3478 $this->initRegistrationForm();
3479 if ($this->form->checkInput())
3480 {
3481 // check register option
3482 if ($_POST["register"] == 1)
3483 {
3484 // update nic
3485 $this->setup->getClient()->updateNIC($this->setup->ilias_nic_server);
3486//var_dump($this->setup->getClient()->nic_status);
3487 // online registration failed
3488 if (empty($this->setup->getClient()->nic_status[2]))
3489 {
3490 $this->setup->getClient()->setSetting("nic_enabled","-1");
3491 ilUtil::sendFailure($this->lng->txt("nic_reg_failed"), true);
3492 ilUtil::redirect("setup.php?cmd=displayNIC");
3493 }
3494 else
3495 {
3496 $this->setup->getClient()->setSetting("inst_id",$this->setup->getClient()->nic_status[2]);
3497 $this->setup->getClient()->setSetting("nic_enabled","1");
3498 $this->setup->getClient()->status["nic"]["status"] = true;
3499 ilUtil::sendSuccess($this->lng->txt("nic_reg_enabled"), true);
3500 ilUtil::redirect("setup.php?cmd=displayNIC");
3501 }
3502 }
3503 /*elseif ($_POST["form"]["register"] == 2)
3504 {
3505 $nic_by_email = (int) $_POST["form"]["nic_id"];
3506
3507 $checksum = md5($nic_key.$nic_by_email);
3508
3509 if (!$nic_by_email or $_POST["form"]["nic_checksum"] != $checksum)
3510 {
3511 $message = $this->lng->txt("nic_reg_enter_correct_id");
3512 }
3513 else
3514 {
3515 $this->setup->getClient()->setSetting("inst_id",$nic_by_email);
3516 $this->setup->getClient()->setSetting("nic_enabled","1");
3517 $message = $this->lng->txt("nic_reg_enabled");
3518 }
3519 }*/
3520 else
3521 {
3522 $this->setup->getClient()->setSetting("inst_id","0");
3523 $this->setup->getClient()->setSetting("nic_enabled","0");
3524 ilUtil::sendSuccess($this->lng->txt("nic_reg_disabled"), true);
3525 ilUtil::redirect("setup.php?cmd=displayNIC");
3526 }
3527 }
3528
3529 $this->form->setValuesByPost();
3530 $this->displayNIC(true);
3531 }
3532
3536
3540 function displayTools()
3541 {
3542 $this->checkDisplayMode();
3543
3544 // output
3546
3547 // use property forms and add the settings type switch
3548 $ctrl_structure_form = $this->initControlStructureForm();
3549 $settings_type_form = $this->initSettingsTypeForm();
3550 $mp_ns_form = $this->initTreeImplementationForm();
3551
3552 $this->tpl->setVariable("SETUP_CONTENT",
3553 $ctrl_structure_form->getHTML() . "<br />" .
3554 $settings_type_form->getHTML().'<br />'.
3555 $mp_ns_form->getHTML());
3556
3557 }
3558
3560 {
3561 include_once ("Services/Form/classes/class.ilPropertyFormGUI.php");
3562 $form = new ilPropertyFormGUI();
3563
3564 $form->setId('tree_impl');
3565 $form->setTitle($this->lng->txt('tree_implementation'));
3566 $form->setFormAction('setup.php?cmd=gateway');
3567
3568
3569 $options = new ilRadioGroupInputGUI('', 'tree_impl_type');
3570 #$options->setRequired(true);
3571
3572 $set = new ilSetting('common');
3573 $type = ($set->get('main_tree_impl','ns') == 'ns' ? 'ns' : 'mp');
3574
3575
3576 $options->setValue($type);
3577
3578 $ns = new ilRadioOption($this->lng->txt('tree_implementation_ns'), 'ns');
3579 $options->addOption($ns);
3580
3581 $mp = new ilRadioOption($this->lng->txt('tree_implementation_mp'),'mp');
3582 $options->addOption($mp);
3583
3584 $form->addItem($options);
3585 $form->addCommandButton('switchTree', $this->lng->txt('tree_implementation_switch_btn'));
3586 $form->setShowTopButtons(false);
3587
3588 return $form;
3589
3590 }
3591
3592 public function switchTree()
3593 {
3594 $set = new ilSetting('common');
3595 $type = ($set->get('main_tree_impl','ns') == 'ns' ? 'ns' : 'mp');
3596
3597 if($type == 'ns' and $_POST['tree_impl_type'] == 'mp')
3598 {
3599 // To mp
3600 include_once './Services/Tree/classes/class.ilMaterializedPathTree.php';
3602
3603 $GLOBALS['ilDB']->dropIndexByFields('tree',array('lft'));
3604 $GLOBALS['ilDB']->dropIndexByFields('tree',array('path'));
3605 $GLOBALS['ilDB']->addIndex('tree',array('path'),'i4');
3606
3607 $set->set('main_tree_impl', 'mp');
3608
3609 }
3610 elseif($type == 'mp' and $_POST['tree_impl_type'] == 'ns')
3611 {
3612 include_once './Services/Tree/classes/class.ilTree.php';
3613 $GLOBALS['ilSetting'] = $set;
3614 $tree = new ilTree(1);
3615 $tree->renumber(1);
3616
3617 $GLOBALS['ilDB']->dropIndexByFields('tree',array('lft'));
3618 $GLOBALS['ilDB']->dropIndexByFields('tree',array('path'));
3619 $GLOBALS['ilDB']->addIndex('tree',array('lft'),'i4');
3620
3621 $set->set('main_tree_impl', 'ns');
3622 }
3623
3624 ilUtil::sendInfo($this->lng->txt("tree_implementation_switched"), true);
3625 $this->displayTools();
3626 }
3627
3634 {
3635 include_once ("Services/Form/classes/class.ilPropertyFormGUI.php");
3636 $form = new ilPropertyFormGUI();
3637
3638 $form->setId("control_structure");
3639 $form->setTitle($this->lng->txt("ctrl_structure"));
3640 $form->setFormAction("setup.php?cmd=gateway");
3641
3642 $ilDB = $this->setup->getClient()->db;
3643 $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls");
3644 $crec = $ilDB->fetchAssoc($cset);
3645
3646 $item = new ilCustomInputGUI($this->lng->txt("ctrl_structure_reload"));
3647 if ($crec["cnt"] == 0)
3648 {
3649 $item->setInfo($this->lng->txt("ctrl_missing_desc"));
3650 }
3651 else
3652 {
3653 $item->setInfo($this->lng->txt("ctrl_structure_desc"));
3654 }
3655 $form->addItem($item);
3656
3657 $form->addCommandButton("reloadStructure", $this->lng->txt("reload"));
3658 return $form;
3659 }
3660
3661
3666 {
3668
3669 if (!$this->setup->getClient()->db_installed)
3670 {
3671 ilUtil::sendInfo($this->lng->txt("no_db"), true);
3672 $this->displayTools();
3673 return;
3674 }
3675
3676 // referencing does not work in dbupdate-script
3677 $GLOBALS["ilDB"] = $this->setup->getClient()->getDB();
3678// BEGIN WebDAV
3679 // read module and service information into db
3680 require_once "./setup/classes/class.ilModuleReader.php";
3681 require_once "./setup/classes/class.ilServiceReader.php";
3682 require_once "./setup/classes/class.ilCtrlStructureReader.php";
3683
3684 require_once "./Services/Component/classes/class.ilModule.php";
3685 require_once "./Services/Component/classes/class.ilService.php";
3688
3689 // clear tables
3690 $mr = new ilModuleReader("", "", "");
3691 $mr->clearTables();
3692 foreach($modules as $module)
3693 {
3694 $mr = new ilModuleReader(ILIAS_ABSOLUTE_PATH."/Modules/".$module["subdir"]."/module.xml",
3695 $module["subdir"], "Modules");
3696 $mr->getModules();
3697 unset($mr);
3698 }
3699
3700 // clear tables
3701 $sr = new ilServiceReader("", "", "");
3702 $sr->clearTables();
3703 foreach($services as $service)
3704 {
3705 $sr = new ilServiceReader(ILIAS_ABSOLUTE_PATH."/Services/".$service["subdir"]."/service.xml",
3706 $service["subdir"], "Services");
3707 $sr->getServices();
3708 unset($sr);
3709 }
3710// END WebDAV
3711
3712 $ilCtrlStructureReader->readStructure(true);
3713 ilUtil::sendInfo($this->lng->txt("ctrl_structure_reloaded"), true);
3714 $this->displayTools();
3715 }
3716
3723 {
3724 include_once("./Services/Administration/classes/class.ilSetting.php");
3725 $type = ilSetting::_getValueType();
3726
3727 include_once ("Services/Form/classes/class.ilPropertyFormGUI.php");
3728 $form = new ilPropertyFormGUI();
3729
3730 $form->setId("settings_type");
3731 $form->setTitle($this->lng->txt("settings_type"));
3732 $form->setFormAction("setup.php?cmd=gateway");
3733
3734 $item = new ilNonEditableValueGUI($this->lng->txt('settings_type_current'));
3735 $item->setValue(strtoupper($type));
3736
3737 if ($type == "clob")
3738 {
3739 $item->setInfo($this->lng->txt('settings_info_clob'));
3740 $form->addCommandButton("showLongerSettings", $this->lng->txt("settings_show_longer"));
3741 $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_text"));
3742 }
3743 else
3744 {
3745 $item->setInfo($this->lng->txt('settings_info_text'));
3746 $form->addCommandButton("changeSettingsType", $this->lng->txt("settings_change_clob"));
3747 }
3748 $form->addItem($item);
3749
3750 if (is_array($this->longer_settings))
3751 {
3752 $item = new ilCustomInputGUI($this->lng->txt('settings_longer_values'));
3753
3754 if (count($this->longer_settings))
3755 {
3756 foreach ($this->longer_settings as $row)
3757 {
3758 $subitem = new ilCustomInputGUI(sprintf($this->lng->txt('settings_key_info'), $row['module'], $row['keyword']));
3759 $subitem->setInfo($row['value']);
3760 $item->addSubItem($subitem);
3761 }
3762 }
3763 else
3764 {
3765 $item->setHTML($this->lng->txt('settings_no_longer_values'));
3766 }
3767 $form->addItem($item);
3768 }
3769
3770 return $form;
3771 }
3772
3773
3778 {
3779 include_once("./Services/Administration/classes/class.ilSetting.php");
3780 $old_type = ilSetting::_getValueType();
3781
3782 if ($old_type == "clob")
3783 {
3784 $longer_settings = ilSetting::_getLongerSettings();
3785 if (count($longer_settings))
3786 {
3787 $this->longer_settings = $longer_settings;
3788 ilUtil::sendFailure($this->lng->txt("settings_too_long"));
3789 }
3790 else
3791 {
3793 }
3794 }
3795 else
3796 {
3798 }
3799
3800 if ($changed)
3801 {
3802 ilUtil::sendInfo($this->lng->txt("settings_type_changed"));
3803 }
3804
3805 $this->displayTools();
3806 }
3807
3808
3814 {
3815 include_once("./Services/Administration/classes/class.ilSetting.php");
3816 $this->longer_settings = ilSetting::_getLongerSettings();
3817 $this->displayTools();
3818 }
3819
3824 {
3825 $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html", "setup");
3826
3827 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_password"));
3828
3829 // formular sent
3830 if ($_POST["form"])
3831 {
3832 $pass_old = $this->setup->getPassword();
3833
3834 if (empty($_POST["form"]["pass_old"]))
3835 {
3836 $message = $this->lng->txt("password_enter_old");
3837 $this->setup->raiseError($message,$this->setup->error_obj->MESSAGE);
3838 }
3839
3840 if (md5($_POST["form"]["pass_old"]) != $pass_old)
3841 {
3842 $message = $this->lng->txt("password_old_wrong");
3843 $this->setup->raiseError($message,$this->setup->error_obj->MESSAGE);
3844 }
3845
3846 if (empty($_POST["form"]["pass"]))
3847 {
3848 $message = $this->lng->txt("password_empty");
3849 $this->setup->raiseError($message,$this->setup->error_obj->MESSAGE);
3850 }
3851
3852 if ($_POST["form"]["pass"] != $_POST["form"]["pass2"])
3853 {
3854 $message = $this->lng->txt("password_not_match");
3855 $this->setup->raiseError($message,$this->setup->error_obj->MESSAGE);
3856 }
3857
3858 if (md5($_POST["form"]["pass"]) == $pass_old)
3859 {
3860 $message = $this->lng->txt("password_same");
3861 $this->setup->raiseError($message,$this->setup->error_obj->MESSAGE);
3862 }
3863
3864 if (!$this->setup->setPassword($_POST["form"]["pass"]))
3865 {
3866 $message = $this->lng->txt("save_error");
3867 $this->setup->raiseError($message,$this->setup->error_obj->MESSAGE);
3868 }
3869
3870 ilUtil::sendInfo($this->lng->txt("password_changed"),true);
3871 ilUtil::redirect("setup.php");
3872 }
3873
3874 // output
3875 $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.form_change_admin_password.html", "setup");
3876
3877 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("password_new_master"));
3878
3879 // pass form
3880 $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
3881 $this->tpl->setVariable("TXT_REQUIRED_FIELDS", $this->lng->txt("required_field"));
3882 $this->tpl->setVariable("TXT_PASS_TITLE",$this->lng->txt("change_password"));
3883 $this->tpl->setVariable("TXT_PASS_OLD",$this->lng->txt("set_oldpasswd"));
3884 $this->tpl->setVariable("TXT_PASS",$this->lng->txt("set_newpasswd"));
3885 $this->tpl->setVariable("TXT_PASS2",$this->lng->txt("password_retype"));
3886 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
3887 }
3888
3893 {
3894 $this->checkDisplayMode("finish_setup");
3895 $this->no_second_nav = true;
3896//echo "<b>1</b>";
3897 if ($this->validateSetup())
3898 {
3899 $txt_info = $this->lng->txt("info_text_finish1")."<br /><br />".
3900 "<p>".$this->lng->txt("user").": <b>root</b><br />".
3901 $this->lng->txt("password").": <b>homer</b></p>";
3902 $this->setButtonNext("login_new","login");
3903//echo "<b>2</b>";
3904 $this->setup->getClient()->reconnect(); // if this is not done, the writing of
3905 // the setup_ok fails (with MDB2 and a larger
3906 // client list), alex 17.1.2008
3907 $this->setup->getClient()->setSetting("setup_ok",1);
3908//$this->setup->getClient()->setSetting("zzz", "Z");
3909//echo "<b>3</b>";
3910 $this->setup->getClient()->status["finish"]["status"] = true;
3911//echo "<b>4</b>";
3912 }
3913 else
3914 {
3915 $txt_info = $this->lng->txt("info_text_finish2");
3916 }
3917
3918//echo "<b>5</b>";
3919 // output
3920 $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_finish.html", "setup");
3921 $this->tpl->setVariable("TXT_INFO",$txt_info);
3922
3923 $this->setButtonPrev("nic");
3924//echo "<b>6</b>";
3925 $this->checkPanelMode();
3926//echo "<b>7</b>";
3927 }
3928
3933 {
3934 $this->checkDisplayMode();
3935
3936 // formular sent
3937 if ($_POST["form"]["delete"])
3938 {
3939 $ini = true;
3940 $db = false;
3941 $files = false;
3942
3943 /* disabled
3944 switch ($_POST["form"]["delete"])
3945 {
3946 case 1:
3947 $ini = true;
3948 break;
3949
3950 case 2:
3951 $ini = true;
3952 $db = true;
3953 break;
3954
3955 case 3:
3956 $ini = true;
3957 $db = true;
3958 $files = true;
3959 break;
3960 }
3961 */
3962
3963 $msg = $this->setup->getClient()->delete($ini,$db,$files);
3964
3965 ilUtil::sendInfo($this->lng->txt("client_deleted"),true);
3966 ilUtil::redirect("setup.php");
3967 }
3968
3969 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_delete"));
3970
3971 // output
3972 $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.form_delete_client.html", "setup");
3973
3974 // delete panel
3975 $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
3976 $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("delete"));
3977 $this->tpl->setVariable("TXT_DELETE_CONFIRM", $this->lng->txt("delete_confirm"));
3978 $this->tpl->setVariable("TXT_DELETE_INFO", $this->lng->txt("delete_info"));
3979
3980 $this->checkPanelMode();
3981 }
3982
3988 function changeAccessMode($a_back)
3989 {
3990 if ($this->setup->getClient()->status["finish"]["status"])
3991 {
3992 $val = ($this->setup->getClient()->ini->readVariable("client","access")) ? "0" : true;
3993 $this->setup->getClient()->ini->setVariable("client","access",$val);
3994 $this->setup->getClient()->ini->write();
3995 $message = "client_access_mode_changed";
3996 }
3997 else
3998 {
3999 $message = "client_setup_not_finished";
4000 }
4001
4002 ilUtil::sendInfo($this->lng->txt($message),true);
4003
4004 ilUtil::redirect("setup.php?cmd=".$a_back);
4005 }
4006
4011 {
4012 if ($_POST["form"])
4013 {
4014 $client = new ilClient($_POST["form"]["default"], $this->setup->db_connections);
4015
4016 if (!$client->init())
4017 {
4018 $this->setup->raiseError($this->lng->txt("no_valid_client_id"),$this->setup->error_obj->MESSAGE);
4019 }
4020
4021 $status = $this->setup->getStatus($client);
4022
4023 if ($status["finish"]["status"])
4024 {
4025 $this->setup->ini->setVariable("clients","default",$client->getId());
4026 $this->setup->ini->write();
4027 $message = "default_client_changed";
4028 }
4029 else
4030 {
4031 $message = "client_setup_not_finished";
4032 }
4033 }
4034
4035 ilUtil::sendInfo($this->lng->txt($message),true);
4036
4037 ilUtil::redirect("setup.php");
4038 }
4039
4044 function validateSetup()
4045 {
4046 foreach ($this->setup->getClient()->status as $key => $val)
4047 {
4048 if ($key != "finish" and $key != "access")
4049 {
4050 if ($val["status"] != true)
4051 {
4052 return false;
4053 }
4054 }
4055 }
4056
4057//$this->setup->getClient()->setSetting("zzz", "V");
4058 $clientlist = new ilClientList($this->setup->db_connections);
4059//$this->setup->getClient()->setSetting("zzz", "W");
4060 $list = $clientlist->getClients();
4061//$this->setup->getClient()->setSetting("zzz", "X");
4062 if (count($list) == 1)
4063 {
4064 $this->setup->ini->setVariable("clients","default",$this->setup->getClient()->getId());
4065 $this->setup->ini->write();
4066
4067 $this->setup->getClient()->ini->setVariable("client","access",1);
4068 $this->setup->getClient()->ini->write();
4069 }
4070//$this->setup->getClient()->setSetting("zzz", "Y");
4071 return true;
4072 }
4073
4078 {
4079 if (!$this->setup->getClient()->status["db"]["status"])
4080 {
4081 $this->cmd = "db";
4082 ilUtil::sendInfo($this->lng->txt("finish_initial_setup_first"),true);
4083 $this->displayDatabase();
4084 }
4085 elseif (!$this->setup->getClient()->status["lang"]["status"])
4086 {
4087 $this->cmd = "lang";
4088 ilUtil::sendInfo($this->lng->txt("finish_initial_setup_first"),true);
4089 $this->displayLanguages();
4090 }
4091 elseif (!$this->setup->getClient()->status["contact"]["status"])
4092 {
4093 $this->cmd = "contact";
4094 ilUtil::sendInfo($this->lng->txt("finish_initial_setup_first"),true);
4095 $this->displayContactData();
4096 }
4097 elseif(!$this->setup->getClient()->status['proxy']['status'])
4098 {
4099 $this->cmd = "proxy";
4100 ilUtil::sendInfo($this->lng->txt("finish_initial_setup_first"),true);
4101 $this->displayProxy();
4102 }
4103 elseif (!$this->setup->getClient()->status["nic"]["status"])
4104 {
4105 $this->cmd = "nic";
4106 ilUtil::sendInfo($this->lng->txt("finish_initial_setup_first"),true);
4107 $this->displayNIC();
4108 }
4109 elseif (!$this->setup->getClient()->status["finish"]["status"])
4110 {
4111 $this->cmd = "finish";
4112 ilUtil::sendInfo($this->lng->txt("finish_initial_setup_first"),true);
4113 $this->displayFinishSetup();
4114 }
4115 else
4116 {
4117 return false;
4118 }
4119 }
4120
4125 {
4126 if ($this->setup->ini->readVariable("clients","list"))
4127 {
4128 $this->setup->ini->setVariable("clients","list","0");
4129 $this->setup->ini->write();
4130 ilUtil::sendInfo($this->lng->txt("list_disabled"),true);
4131 }
4132 else
4133 {
4134 $this->setup->ini->setVariable("clients","list","1");
4135 $this->setup->ini->write();
4136 ilUtil::sendInfo($this->lng->txt("list_enabled"),true);
4137 }
4138
4139 ilUtil::redirect("setup.php");
4140 }
4141
4145
4147 {
4149
4150 $ilCtrlStructureReader->setIniFile($this->setup->getClient()->ini);
4151
4152 include_once "./Services/Database/classes/class.ilDBUpdate.php";
4153 include_once "./Services/AccessControl/classes/class.ilRbacAdmin.php";
4154 include_once "./Services/AccessControl/classes/class.ilRbacReview.php";
4155 include_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
4156 include_once "./Services/Tree/classes/class.ilTree.php";
4157 include_once "./Services/Xml/classes/class.ilSaxParser.php";
4158 include_once "./Services/Object/classes/class.ilObjectDefinition.php";
4159
4160 // referencing db handler in language class
4161 $ilDB = $this->setup->getClient()->db;
4162 $this->lng->setDbHandler($ilDB);
4163
4164 // run dbupdate
4165 $dbupdate = new ilDBUpdate($ilDB);
4166 $dbupdate->applyCustomUpdates();
4167
4168 if ($dbupdate->updateMsg == "no_changes")
4169 {
4170 $message = $this->lng->txt("no_changes").". ".$this->lng->txt("database_is_uptodate");
4171 }
4172 else
4173 {
4174 $sep = "";
4175 foreach ($dbupdate->updateMsg as $row)
4176 {
4177 if ($row["msg"] == "update_applied")
4178 {
4179 $a_message.= $sep.$row["nr"];
4180 $sep = ", ";
4181 }
4182 else
4183 {
4184 $e_message.= "<br/>".$this->lng->txt($row["msg"]).": ".$row["nr"];
4185 }
4186 }
4187 if ($a_message != "")
4188 {
4189 $a_message = $this->lng->txt("update_applied").": ".$a_message;
4190 }
4191 }
4192
4193 ilUtil::sendInfo($a_message.$e_message, true);
4194 ilUtil::redirect("setup.php?cmd=displayDatabase");
4195 }
4196
4200 function cloneInitForm()
4201 {
4202 global $lng, $ilCtrl;
4203
4204 $this->checkDisplayMode();
4205
4206 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
4207 $this->form = new ilPropertyFormGUI();
4208
4209 $this->form->setId("clone_form");
4210 $this->form->setFormAction("setup.php?cmd=gateway");
4211
4212 if ($this->setup->getClient()->status["access"]["status"] === false and stripos($this->setup->getClient()->getName(),"master") === false and $this->setup->getClient()->getdbType() == "mysql" and $this->setup->getClient()->db_exists )
4213 {
4214 $this->form->setTitle($this->lng->txt("clone_source"));
4215 $clients = array();
4216 $clientlist = new ilClientList($this->setup->db_connections);
4217 $list = $clientlist->getClients();
4218 $clientlistarray = array();
4219
4220 foreach ($list as $key => $client){
4221 if ((strcmp($key, $this->setup->getClient()->getId()) != '0') && ($client->getDbType() == 'mysql')) { // You cannot clone yourself
4222 $clientlistarray[$client->id] = $client->id;
4223 }
4224 }
4225
4226 $si = new ilSelectInputGUI($lng->txt("clone_selectsource"), "source");
4227
4228 $si->setOptions(array_merge(
4229 array("" => "-- ".$lng->txt("please_select")." --"),
4230 $clientlistarray));
4231 $si->setRequired(true);
4232 $this->form->addItem($si);
4233
4234 $cb = new ilCheckboxInputGUI($lng->txt("clone_areyousure"), "iamsure");
4235 $cb->setRequired(true);
4236 $this->form->addItem($cb);
4237
4238 $this->form->addCommandButton("cloneSaveSource", $lng->txt("cloneit"));
4239 } else {
4240 $disabledmessage = "<h1>" . $this->lng->txt("clone_disabledmessage") ."</h1><br>";
4241 if (!$this->setup->getClient()->status["access"]["status"] === false) {
4242 $disabledmessage .= $this->lng->txt("clone_clientnotdisabled") . "<br>";
4243 }
4244 if (!stripos($this->setup->getClient()->getName(),"aster") === false) {
4245 $disabledmessage .= $this->lng->txt("clone_clientismaster") . "<br>";
4246 }
4247 if ($this->setup->getClient()->getdbType() != "mysql") {
4248 $disabledmessage .= $this->lng->txt("clone_clientisnotmysql") . "<br>";
4249 }
4250 if (!$this->setup->getClient()->db_exists) {
4251 $disabledmessage .= $this->lng->txt("clone_clientnodatabase") . "<br>";
4252 }
4253 $this->form->setTitle($disabledmessage);
4254 }
4255 }
4256
4258
4259 if (!$this->setup->isAdmin())
4260 {
4261 return;
4262 }
4263
4264 $this->cloneInitForm();
4265 $this->form->setValuesByPost();
4266 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_clone"));
4267 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
4268 }
4269
4271 {
4272 global $lng, $ilCtrl;
4273
4274 if (!$this->setup->isAdmin())
4275 {
4276 return;
4277 }
4278
4279 $this->cloneInitForm();
4280
4281 if ($this->form->checkInput())
4282 {
4283 if ($this->form->getInput("iamsure") != "1")
4284 {
4285 $message = $this->lng->txt("clone_youmustcheckiamsure");
4286 $this->setup->raiseError($message,$this->setup->error_obj->MESSAGE);
4287 }
4288 if (!$this->setup->cloneFromSource($this->form->getInput("source")))
4289 {
4290 $message = $this->lng->txt("clone_error");
4291 $this->setup->raiseError($message . " -> " . $this->setup->error,$this->setup->error_obj->MESSAGE);
4292 }
4293
4294 ilUtil::sendInfo($this->lng->txt("client_cloned"),true);
4295 // ilUtil::redirect("setup.php");
4296 }
4297 $this->form->setValuesByPost();
4298 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_clone"));
4299 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
4300 }
4301
4302 public function displayProxy($a_omit_init = false)
4303 {
4304 $this->checkDisplayMode("proxy");
4305 $settings = $this->setup->getClient()->getAllSettings();
4306
4307 if (!$a_omit_init)
4308 {
4309 include_once("./Services/Administration/classes/class.ilSetting.php");
4310 $this->initProxyForm();
4311 $this->form->setValuesByArray(array(
4312 'proxy_status' => (bool)$settings['proxy_status'],
4313 'proxy_host' => $settings['proxy_host'],
4314 'proxy_port' => $settings['proxy_port']
4315 ));
4316 if((bool)$settings['proxy_status'])
4317 {
4318 $this->setup->printProxyStatus($this->setup->client);
4319 }
4320 }
4321 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
4322 $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_proxy"));
4323
4324
4325 $check = $this->setup->checkClientProxySettings($this->setup->client);
4326
4327 $this->setup->getClient()->status["proxy"]["status"] = $check["status"];
4328 $this->setup->getClient()->status["proxy"]["comment"] = $check["comment"];
4329 $this->setup->getClient()->status["proxy"]["text"] = $check["comment"];
4330
4331 if ($check["status"])
4332 {
4333 $this->setButtonNext("nic");
4334 }
4335
4336 $this->setButtonPrev("contact");
4337 $this->checkPanelMode();
4338 }
4339 private function initProxyForm()
4340 {
4341 global $lng;
4342
4343 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
4344 $this->form = new ilPropertyFormGUI();
4345 $this->form->setFormAction("setup.php?cmd=gateway");
4346
4347 // Proxy status
4348 $proxs = new ilCheckboxInputGUI($lng->txt('proxy_status'), 'proxy_status');
4349 $proxs->setInfo($lng->txt('proxy_status_info'));
4350 $proxs->setValue(1);
4351 $this->form->addItem($proxs);
4352
4353 // Proxy availability
4354 $proxa = new ilCustomInputGUI('', 'proxy_availability');
4355 $proxs->addSubItem($proxa);
4356
4357 // Proxy
4358 $prox = new ilTextInputGUI($lng->txt('proxy_host'), 'proxy_host');
4359 $prox->setInfo($lng->txt('proxy_host_info'));
4360 $proxs->addSubItem($prox);
4361
4362 // Proxy Port
4363 $proxp = new ilTextInputGUI($lng->txt('proxy_port'), 'proxy_port');
4364 $proxp->setInfo($lng->txt('proxy_port_info'));
4365 $proxp->setSize(10);
4366 $proxp->setMaxLength(10);
4367 $proxs->addSubItem($proxp);
4368
4369 // save and cancel commands
4370 $this->form->addCommandButton('saveProxy', $lng->txt('save'));
4371 }
4372
4380 public function saveProxy()
4381 {
4382 global $lng;
4383
4384 $this->initProxyForm();
4385 $isFormValid = $this->form->checkInput();
4386
4387 $new_settings['proxy_status'] = (int)$this->form->getInput('proxy_status');
4388 $new_settings['proxy_host'] = trim($this->form->getInput('proxy_host'));
4389 $new_settings['proxy_port'] = trim($this->form->getInput('proxy_port'));
4390
4391 if($isFormValid)
4392 {
4393 if($new_settings['proxy_status'] == true)
4394 {
4395 if(!strlen($new_settings['proxy_host']))
4396 {
4397 $isFormValid = false;
4398 $this->form->getItemByPostVar('proxy_host')->setAlert($lng->txt('msg_input_is_required'));
4399 }
4400 if(!strlen($new_settings['proxy_port']))
4401 {
4402 $isFormValid = false;
4403 $this->form->getItemByPostVar('proxy_port')->setAlert($lng->txt('msg_input_is_required'));
4404 }
4405 if(!preg_match('/[0-9]{1,}/', $new_settings['proxy_port']) ||
4406 $new_settings['proxy_port'] < 0 ||
4407 $new_settings['proxy_port'] > 65535)
4408 {
4409 $isFormValid = false;
4410 $this->form->getItemByPostVar('proxy_port')->setAlert($lng->txt('proxy_port_numeric'));
4411 }
4412 }
4413
4414 if($isFormValid)
4415 {
4416 $this->setup->saveProxySettings($new_settings);
4417
4418 ilUtil::sendSuccess($lng->txt('saved_successfully'));
4419 $settings = $this->setup->getClient()->getAllSettings();
4420 if($settings['proxy_status'] == true)
4421 {
4422 $this->setup->printProxyStatus($this->setup->client);
4423 }
4424 }
4425 else
4426 {
4427 ilUtil::sendFailure($lng->txt('form_input_not_valid'));
4428 }
4429 }
4430
4431 $this->form->setValuesByPost();
4432 $this->tpl->setVariable("SETUP_CONTENT", $this->form->getHTML());
4433
4434
4435 $this->displayProxy(true);
4436 }
4437} // END class.ilSetupGUI
4438?>
$result
$_GET["client_id"]
$_SESSION["AccountId"]
static _getShortTimeZoneList()
get short timezone list
This class represents a checkbox property in a property form.
client management
Client Management.
This class represents a custom property in a property form.
Database Update class.
This class represents a section header in a property form.
Class ilGlobalCacheSettings.
static getAvailableComponents()
This class represents a hidden form property in a property form.
static getInstance()
Factory.
Class ilMemcacheServerFormGUI.
Class ilMemcacheServerTableGUI.
Class ilMemcacheServer.
Class ilModuleReader.
static getAvailableCoreModules()
Get all available core modules.
This class represents a non editable value in a property form.
This class represents a password property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
Class ilServiceReader.
static getAvailableCoreServices()
Get all available core services.
static getSettingFields()
returns the array of setting fields
const SESSION_HANDLING_LOAD_DEPENDENT
const SESSION_HANDLING_FIXED
ILIAS Setting Class.
static _getLongerSettings($a_limit='4000')
get a list of setting records with values loger than a limit
static _getValueType()
get the type of the value column in the database
static _changeValueType($a_new_type='text')
change the type of the value column in the database
Setup GUI class.
checkDisplayMode($a_title="")
determine display mode and load according html layout
displayMasterSetup($a_omit_init=false)
display master setup form & process form input
applyHotfix()
Apply hotfixes.
initControlStructureForm()
Init the form to reload the control structure.
displayClientList()
display client list and process form input
initSettingsTypeForm()
Init the form to change the settings value type.
cmdInstall()
process valid commands for pre-installation status
changeMasterPassword()
display change password form and process form input
displayError($a_message)
display error page
displayContactData($a_omit_init=false)
display contact data form and process form input
installDatabase()
Install the database.
displayClientOverview()
display client overview panel
loginClient()
login to a client
displayFinishSetup()
display finish setup page
initMasterLoginForm()
Init master login form.
saveProxy()
Save proxy settings.
setDisplayMode($a_mode)
set display mode to 'view' or 'setup' 'setup' -> show status panel and (prev/next) navigation buttons...
showUpdateSteps($a_hotfix=false)
Update database.
reloadControlStructure()
reload control structure
displayDeleteConfirmation()
display delete client confirmation form and process form input
getContactValues()
Get current values for contact from.
displayNavButtons()
display navigation buttons
getBasicSettingsValues()
Get current values for basic settings from.
displayTools()
display tools
displaySubTabs()
Show subtabs.
displayIni($a_omit_form_init=false)
display setup in step
displayHeader()
display header with admin links and language flags
updateDatabase()
Update database.
performMLogin()
Master Login.
displayProcessPanel()
display process panel
validateSetup()
validatesetup status again and set access mode of the first client to online
initDBSelectionForm()
Init db selection form.
displayStartup()
display intro page for the first client installation
jumpToFirstUnfinishedSetupStep()
if setting up a client was not finished, jump back to the first uncompleted setup step
initRegistrationForm($a_mode="edit")
Init registration form.
setDbSubtabs($a_subtab_id="db")
Set db subtabs.
saveLanguages()
Save languages.
initDbSlaveForm()
Init db slave form.
saveRegistration()
Save registration form.
initClientLoginForm()
Init client login form.
initContactDataForm()
Init contact data form.
SetButtonPrev($a_cmd=0, $a_lng=0)
set previous navigation button
displayPreliminaries()
display preliminaries page
changeSettingsType()
change the type of the value field in settings table
showHotfixSteps()
Show hotfix steps.
getClientIniValues()
Get current values for client ini from.
selectDBType()
Select database type.
saveContact()
Save contact form.
getRegistrationValues()
Get current values for registration from.
displayStatusPanel()
display status panel
determineToolsPathInstall()
Determine tools paths.
changeAccessMode($a_back)
enable/disable access to a client
saveBasicSettings()
Save basic settings form.
saveDbSlave()
Save db slave form.
changeDefaultClient()
set defualt client
saveClientIni()
Save client ini form.
SetButtonNext($a_cmd, $a_lng=0)
set next navigation button
updateBasicSettings()
Update basic settings form.
initClientDbForm($a_install=true, $dbupdate=null, $db_status=false, $hotfix_available=false, $custom_updates_available=false)
Init client db form.
displayNIC($a_omit_init=false)
display nic registration form and process form input
initClientIniForm()
Init client ini form.
determineToolsPath()
Determine tools paths.
displaySessions()
display sessions form and process form input
initBasicSettingsForm($a_install=false)
Init basic settings form.
displayDatabase()
display database form and process form input
displayLanguages()
display language form and process form input
toggleClientList()
enable/disable client list on index page
ilSetupGUI()
Constructor.
showLongerSettings()
show a list of setting values that are loger than 4000 characters
cloneInitForm()
Initialize clone form.
displayLogin($a_omit_minit=false, $a_omit_cinit=false)
display login form and process form
cmdClient()
process valid commands for all clients
determineTools($a_tools=array())
Determine Tools.
displayLogout()
display logout page
displayDatabaseSlave($a_from_save=false)
Display database slave.
initClientOverviewForm()
Init client overview form.
checkPanelMode()
determine display mode and load correct panel
displayProxy($a_omit_init=false)
getClientDbFormValues($dbupdate=null)
Get current values for client db from.
cmdAdmin()
process valid commands for admins
performLogin()
Login.
changeMasterSettings($a_omit_init=false)
display master settings and process form input
displayFooter()
page output and set title
Setup class.
Tabs GUI.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
init($a_tpl=null)
Init.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static isWindows()
check wether the current client system is a windows system
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static initDomEvent()
Init YUI DomEvent.
static initjQuery($a_tpl=null)
Init jQuery.
$_POST['username']
Definition: cron.php:12
$valid
$txt
Definition: error.php:12
$h
$text
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18
$client_id
const ILIAS_VERSION
const DEBUG
$ilCtrlStructureReader
exit
Definition: login.php:54
global $ilDB
if(!is_array($argv)) $options
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$steps
Definition: latex.php:3
$dirs
const ILIAS_WEB_DIR
const ILIAS_ABSOLUTE_PATH
$ini