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