• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

setup/classes/class.ilSetupGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003     +-----------------------------------------------------------------------------+
00004     | ILIAS open source                                                           |
00005     +-----------------------------------------------------------------------------+
00006     | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007     |                                                                             |
00008     | This program is free software; you can redistribute it and/or               |
00009     | modify it under the terms of the GNU General Public License                 |
00010     | as published by the Free Software Foundation; either version 2              |
00011     | of the License, or (at your option) any later version.                      |
00012     |                                                                             |
00013     | This program is distributed in the hope that it will be useful,             |
00014     | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015     | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016     | GNU General Public License for more details.                                |
00017     |                                                                             |
00018     | You should have received a copy of the GNU General Public License           |
00019     | along with this program; if not, write to the Free Software                 |
00020     | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021     +-----------------------------------------------------------------------------+
00022 */
00023 
00034 require_once "class.ilSetup.php";
00035 
00036 class ilSetupGUI extends ilSetup
00037 {
00038     var $tpl;       // template object
00039     var $lng;       // language objet
00040     var $log;       // log object
00041     
00042     var $btn_prev_on = false;   // toggle previous button on/off
00043     var $btn_prev_cmd;          // command processed when previous button was clicked
00044     var $btn_prev_lng;          // previous button label
00045 
00046     var $btn_next_on = false;   // toggle NEXT button on/off
00047     var $btn_next_cmd;          // command processed when next button was clicked
00048     var $btn_next_lng;          // next button label
00049 
00050     var $revision;              // cvs revision of this script
00051     var $version;               // cvs version of this script
00052     var $lang;                  // current language (lang_key)
00053 
00054     var $cmd;                       // command variable
00055     var $display_mode = "view";     // view mode (setup or details)
00056 
00061     function ilSetupGUI()
00062     {
00063         global $tpl, $lng;
00064 
00065         $this->tpl =& $tpl;
00066         $this->lng =& $lng;
00067 
00068         //CVS - REVISION - DO NOT MODIFY
00069         $this->revision = "$Revision: 8012 $";
00070         $this->version = "2.".substr(substr($this->revision,2),0,-2);
00071         $this->lang = $this->lng->lang_key;
00072 
00073                                 // init setup
00074                                 $this->ilSetup($_SESSION["auth"],$_SESSION["access_mode"]);
00075                 
00076                                 // init client object if exists
00077                                 $client_id = ($_GET["client_id"]) ? $_GET["client_id"] : $_SESSION["ClientId"];
00078         // for security
00079         if (!$this->isAdmin() and $client_id != $_SESSION["ClientId"])
00080         {
00081             $client_id = $_SESSION["ClientId"];
00082         }
00083 
00084         $this->ini_client_exists = $this->newClient($client_id);
00085         $this->client->status = $this->getStatus();
00086 
00087         // determine command
00088         if (($this->cmd = $_GET["cmd"]) == "gateway")
00089         {
00090             // surpress warning if POST is not set
00091             @$this->cmd = key($_POST["cmd"]);
00092         }
00093 
00094         // determine display mode here
00095         // TODO: depending on previous setting (session)
00096         // 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)
00097         if ($this->isAuthenticated() and !$this->client->status["finish"]["status"] and $this->cmd != "clientlist" and $this->cmd != "")
00098         {
00099             $this->setDisplayMode("setup");
00100         }
00101         else
00102         {
00103             $this->setDisplayMode($_SESSION["display_mode"]);
00104         }
00106 // output starts here
00107 
00108         // display header
00109         $this->displayHeader();
00110 
00111         // main cmd handling
00112         if (!$this->isAuthenticated() or !$this->isInstalled())
00113         {
00114             // check for first time installation or migrate an old one first
00115             if (!$this->isInstalled() or !($this->ini->readVariable("clients","path")))
00116             {
00117                 $this->cmdInstall();
00118             }
00119             else
00120             {
00121                 $this->displayLogin();
00122             }
00123         }
00124         else
00125         {
00126             if ($this->isAdmin())
00127             {
00128                 $this->cmdAdmin();
00129             }
00130             else
00131             {
00132                 $this->cmdClient();
00133             }
00134         }
00135 
00136         if (DEBUG)
00137         {
00138             echo "cmd: ".$this->cmd." | access: ".$this->access_mode." | display: ".$this->display_mode;
00139             var_dump($this->client->status);
00140         }
00141 
00142         // display footer
00143         $this->displayFooter();
00144 
00145 // end output
00147 
00148     }  // end constructor
00149 
00151 // cmd subsets
00152 
00156     function cmdInstall()
00157     {
00158         switch ($this->cmd)
00159         {
00160             case NULL:
00161             case "preliminaries":
00162                 $this->checkPreliminaries();
00163                 $this->displayPreliminaries();
00164                 break;
00165 
00166             case "install":
00167                 $this->displayMasterSetup();
00168                 break;
00169 
00170             default:
00171                 $this->displayError($this->lng->txt("unknown_command"));
00172                 break;
00173         }
00174     }
00175     
00179     function cmdAdmin()
00180     {
00181         switch ($this->cmd)
00182         {
00183             case NULL:
00184             case "clientlist":
00185                 $this->setDisplayMode("view");
00186                 $this->displayClientList();
00187                 break;
00188             
00189             case "changepassword":
00190                 $this->setDisplayMode("view");
00191                 $this->changeMasterPassword();
00192                 break;
00193 
00194             case "mastersettings":
00195                 $this->setDisplayMode("view");
00196                 $this->changeMasterSettings();
00197                 break;
00198 
00199             case "changedefault":
00200                 $this->changeDefaultClient();
00201                 break;  
00202 
00203             case "newclient":
00204                 $this->cmd = "ini";
00205                 $this->setDisplayMode("setup");
00206                 $this->ini_client_exists = $this->newClient();
00207                 $this->displayIni();
00208                 break;  
00209 
00210             case "startup":
00211                 $this->setDisplayMode("setup");
00212                 $this->ini_client_exists = $this->newClient();
00213                 $this->displayStartup();
00214                 break;
00215 
00216             case "delete":
00217                 $this->setDisplayMode("view");
00218                 $this->displayDeleteConfirmation();
00219                 break;
00220 
00221             case "togglelist":
00222                 $this->setDisplayMode("view");
00223                 $this->toggleClientList();
00224                 break;
00225 
00226             default:
00227                 $this->cmdClient();
00228                 break;
00229         }
00230     }
00231     
00235     function cmdClient()
00236     {
00237         switch ($this->cmd)
00238         {
00239             case NULL:
00240             case "view":
00241                 if ($this->client->db_installed)
00242                 {
00243                     $this->setDisplayMode("view"); 
00244                     $this->displayClientOverview();
00245                 }
00246                 else
00247                 {
00248                     $this->cmd = "db";
00249                     $this->displayDatabase();
00250                 }
00251                 break;
00252                 
00253             case "ini":
00254                 // only allow access to ini if db does not exist yet
00255                 if ($this->client->db_installed)
00256                 {
00257                     $this->cmd = "db";
00258                     $this->displayDatabase();
00259                 }
00260                 else
00261                 {
00262                     $this->displayIni();
00263                 }
00264                 break;
00265 
00266             case "db":
00267                 $this->displayDatabase();
00268                 break;
00269     
00270             case "lang":
00271                 if (!isset($_GET["lang"]) and !$this->client->status["finish"]["status"] and $_GET["cmd"] == "lang" and $this->error === true)
00272                 {
00273                     $this->jumpToFirstUnfinishedSetupStep();
00274                 }
00275                 else
00276                 {
00277                     $this->displayLanguages();
00278                 }
00279                 break;
00280 
00281             case "contact":
00282                 if (!isset($_GET["lang"]) and !$this->client->status["finish"]["status"] and $_GET["cmd"] == "contact")
00283                 {
00284                     $this->jumpToFirstUnfinishedSetupStep();
00285                 }
00286                 else
00287                 {
00288                     $this->displayContactData();
00289                 }
00290                 break;
00291     
00292             case "nic":
00293                 if (!isset($_GET["lang"]) and !$this->client->status["finish"]["status"] and $_GET["cmd"] == "nic")
00294                 {
00295                     $this->jumpToFirstUnfinishedSetupStep();
00296                 }
00297                 else
00298                 {
00299                     $this->displayNIC();
00300                 }
00301                 break;
00302     
00303             case "finish":
00304                 if (!isset($_GET["lang"]) and !$this->client->status["finish"]["status"] and $_GET["cmd"] == "finish")
00305                 {
00306                     $this->jumpToFirstUnfinishedSetupStep();
00307                 }
00308                 else
00309                 {
00310                     $this->displayFinishSetup();
00311                 }
00312                 break;
00313 
00314             case "changeaccess":
00315                 $this->changeAccessMode($_GET["back"]);
00316                 break;
00317 
00318             case "logout":
00319                 $this->displayLogout();
00320                 break;
00321 
00322             case "login":
00323                 session_destroy();
00324                 ilUtil::redirect(ILIAS_HTTP_PATH."/login.php?client_id=".$this->client->getId());
00325                 break;
00326 
00327             case "login_new":
00328                 if ($this->client->ini->readVariable("client","access") != "1")
00329                 {
00330                     $this->client->ini->setVariable("client","access","1");
00331                     $this->client->ini->write();
00332                 }
00333 
00334                 session_destroy();
00335                 ilUtil::redirect(ILIAS_HTTP_PATH."/login.php?client_id=".$this->client->getId());
00336                 break;
00337 
00338             default:
00339                 $this->displayError($this->lng->txt("unknown_command"));
00340                 break;
00341         }
00342     }
00343 
00344 // end cmd subsets 
00346 
00350     function displayClientOverview()
00351     {       
00352         $this->checkDisplayMode();
00353     
00354         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.client_overview.html");
00355 
00356         if ($this->client->db_installed)
00357         {
00358             $settings = $this->client->getAllSettings();
00359         }
00360         
00361         $txt_no_database = $this->lng->txt("no_database");
00362 
00363         $access_status = ($this->client->status["access"]["status"]) ? "online" : "disabled";
00364         $access_button = ($this->client->status["access"]["status"]) ? "disable" : "enable";
00365         $access_link = "&nbsp;&nbsp;[<a href=\"setup.php?cmd=changeaccess&client_id=".$this->client->getId()."&back=view\">".$this->lng->txt($access_button)."</a>]";
00366         
00367         // basic data
00368         $this->tpl->setVariable("TXT_BASIC_DATA", $this->lng->txt("client_info"));
00369         $this->tpl->setVariable("TXT_INST_NAME", $this->lng->txt("inst_name"));
00370         $this->tpl->setVariable("TXT_INST_ID", $this->lng->txt("ilias_nic_id"));
00371         $this->tpl->setVariable("TXT_CLIENT_ID2", $this->lng->txt("client_id"));
00372         $this->tpl->setVariable("TXT_DB_VERSION", $this->lng->txt("db_version"));
00373         $this->tpl->setVariable("TXT_ACCESS_STATUS", $this->lng->txt("access_status"));
00374         
00375         $this->tpl->setVariable("TXT_SERVER_DATA", $this->lng->txt("server_info"));
00376         $this->tpl->setVariable("TXT_ILIAS_VERSION", $this->lng->txt("ilias_version"));
00377         $this->tpl->setVariable("TXT_HOSTNAME", $this->lng->txt("host"));
00378         $this->tpl->setVariable("TXT_IP_ADDRESS", $this->lng->txt("ip_address"));
00379         $this->tpl->setVariable("TXT_SERVER_PORT", $this->lng->txt("port"));
00380         $this->tpl->setVariable("TXT_SERVER_SOFTWARE", $this->lng->txt("server_software"));
00381         $this->tpl->setVariable("TXT_HTTP_PATH", $this->lng->txt("http_path"));
00382         $this->tpl->setVariable("TXT_ABSOLUTE_PATH", $this->lng->txt("absolute_path"));
00383         $this->tpl->setVariable("TXT_DEFAULT_LANGUAGE", $this->lng->txt("default_language"));
00384         $this->tpl->setVariable("TXT_FEEDBACK_RECIPIENT", $this->lng->txt("feedback_recipient"));
00385         $this->tpl->setVariable("TXT_ERROR_RECIPIENT", $this->lng->txt("error_recipient"));
00386 
00387         // pathes
00388         $this->tpl->setVariable("TXT_SOFTWARE", $this->lng->txt("3rd_party_software"));
00389         $this->tpl->setVariable("TXT_CONVERT_PATH", $this->lng->txt("path_to_convert"));
00390         $this->tpl->setVariable("TXT_ZIP_PATH", $this->lng->txt("path_to_zip"));
00391         $this->tpl->setVariable("TXT_UNZIP_PATH", $this->lng->txt("path_to_unzip"));
00392         $this->tpl->setVariable("TXT_JAVA_PATH", $this->lng->txt("path_to_java"));
00393         $this->tpl->setVariable("TXT_HTMLDOC_PATH", $this->lng->txt("path_to_htmldoc"));
00394         $this->tpl->setVariable("TXT_VIRUS_SCANNER", $this->lng->txt("virus_scanner"));
00395         $this->tpl->setVariable("TXT_SCAN_COMMAND", $this->lng->txt("scan_command"));
00396         $this->tpl->setVariable("TXT_CLEAN_COMMAND", $this->lng->txt("clean_command"));
00397 
00399         // display formula data
00400 
00401         // client data
00402         $this->tpl->setVariable("INST_ID",($this->client->db_installed) ? $settings["inst_id"] : $txt_no_database);
00403         $this->tpl->setVariable("CLIENT_ID2",$this->client->getId());
00404         $this->tpl->setVariable("INST_NAME",($this->client->getName()) ? $this->client->getName() : "&lt;".$this->lng->txt("no_client_name")."&gt;");
00405         $this->tpl->setVariable("INST_INFO",$this->client->getDescription());
00406         $this->tpl->setVariable("DB_VERSION",($this->client->db_installed) ? $settings["db_version"] : $txt_no_database);
00407         $this->tpl->setVariable("ACCESS_STATUS",$this->lng->txt($access_status).$access_link);
00408 
00409         // server data
00410         $this->tpl->setVariable("HTTP_PATH",ILIAS_HTTP_PATH);
00411         $this->tpl->setVariable("ABSOLUTE_PATH",ILIAS_ABSOLUTE_PATH);
00412         $this->tpl->setVariable("HOSTNAME", $_SERVER["SERVER_NAME"]);
00413         $this->tpl->setVariable("SERVER_PORT", $_SERVER["SERVER_PORT"]);
00414         $this->tpl->setVariable("SERVER_ADMIN", $_SERVER["SERVER_ADMIN"]);  // not used
00415         $this->tpl->setVariable("SERVER_SOFTWARE", $_SERVER["SERVER_SOFTWARE"]);
00416         $this->tpl->setVariable("IP_ADDRESS", $_SERVER["SERVER_ADDR"]);
00417         $this->tpl->setVariable("ILIAS_VERSION", ILIAS_VERSION);
00418 
00419         $this->tpl->setVariable("FEEDBACK_RECIPIENT",($this->client->db_installed) ? $settings["feedback_recipient"] : $txt_no_database);
00420         $this->tpl->setVariable("ERROR_RECIPIENT",($this->client->db_installed) ? $settings["error_recipient"] : $txt_no_database);
00421 
00422         // pathes to tools
00423         $not_set = $this->lng->txt("path_not_set");
00424                 
00425         $convert = $this->ini->readVariable("tools","convert");
00426         $zip = $this->ini->readVariable("tools","zip");
00427         $unzip = $this->ini->readVariable("tools","unzip");
00428         $java = $this->ini->readVariable("tools","java");
00429         $htmldoc = $this->ini->readVariable("tools","htmldoc");
00430         $vscan = $this->ini->readVariable("tools","vscantype");
00431         $scancomm = $this->ini->readVariable("tools","scancommand");
00432         $cleancomm = $this->ini->readVariable("tools","cleancommand");
00433         
00434         $this->tpl->setVariable("CONVERT_PATH",($convert) ? $convert : $not_set);
00435         $this->tpl->setVariable("ZIP_PATH",($zip) ? $zip : $not_set);
00436         $this->tpl->setVariable("UNZIP_PATH",($unzip) ? $unzip : $not_set);
00437         $this->tpl->setVariable("JAVA_PATH",($java) ? $java : $not_set);
00438         $this->tpl->setVariable("HTMLDOC_PATH",($htmldoc) ? $htmldoc : $not_set);
00439         $this->tpl->setVariable("VAL_SCAN_COMMAND",($scancomm) ? $scancomm : $not_set);
00440         $this->tpl->setVariable("VAL_CLEAN_COMMAND",($cleancomm) ? $cleancomm : $not_set);
00441         $this->tpl->setVariable("VAL_VIRUS_SCANNER",($vscan) ? $vscan : $not_set);
00442 
00443         $this->tpl->parseCurrentBlock();
00444 
00445         $this->displayStatusPanel();
00446     }
00447 
00455     function setDisplayMode($a_mode)
00456     {
00457         // security
00458         if ($a_mode != "view" and $a_mode != "setup")
00459         {
00460             return false;
00461         }
00462 
00463         $this->display_mode = $a_mode;
00464         $_SESSION["display_mode"] = $this->display_mode;
00465         
00466         return true;
00467     }
00468     
00472     function displayHeader()
00473     {
00474         $languages = $this->lng->getLanguages();
00475         
00476         $count = (int) round(count($languages) / 2);
00477         $num = 1;
00478         
00479         foreach ($languages as $lang_key)
00480         {
00481             if ($num === $count)
00482             {
00483                 $this->tpl->touchBlock("lng_new_row");
00484             }
00485 
00486             $this->tpl->setCurrentBlock("languages");
00487             $this->tpl->setVariable("LINK_LANG", "./setup.php?cmd=".$this->cmd."&amp;lang=".$lang_key);
00488             $this->tpl->setVariable("LANG_NAME", $this->lng->txt("lang_".$lang_key));
00489             $this->tpl->setVariable("LANG_ICON", $lang_key);
00490             $this->tpl->setVariable("BORDER", 0);
00491             $this->tpl->setVariable("VSPACE", 0);
00492             $this->tpl->parseCurrentBlock();
00493 
00494             $num++;
00495         }
00496         
00497         if (count($languages) % 2)
00498         {
00499             $this->tpl->touchBlock("lng_empty_cell");
00500         }
00501         
00502         if ($this->cmd != "logout" and $this->isInstalled())
00503         {
00504             // add client link
00505             if ($this->isAdmin())
00506             {
00507                 if ($this->display_mode == "view" or $this->cmd == "clientlist" or $this->cmd == "changepassword" or $this->cmd == "mastersettings")
00508                 {
00509                     $this->tpl->setCurrentBlock("add_client");
00510                     $this->tpl->setVariable("TXT_ADD_CLIENT",ucfirst($this->lng->txt("new")));
00511                     $this->tpl->parseCurrentBlock();
00512                 }
00513     
00514                 // client list link
00515                 $this->tpl->setCurrentBlock("display_list");
00516                 $this->tpl->setVariable("TXT_LIST",ucfirst($this->lng->txt("list")));
00517                 $this->tpl->parseCurrentBlock();
00518             
00519                 // edit pathes link
00520                 $this->tpl->setCurrentBlock("edit_pathes");
00521                 $this->tpl->setVariable("TXT_EDIT_PATHES",$this->lng->txt("pathes"));
00522                 $this->tpl->parseCurrentBlock();
00523 
00524                 // change password link
00525                 $this->tpl->setCurrentBlock("change_password");
00526                 $this->tpl->setVariable("TXT_CHANGE_PASSWORD",ucfirst($this->lng->txt("password")));
00527                 $this->tpl->parseCurrentBlock();
00528             }
00529 
00530             // logout link
00531             if ($this->isAuthenticated())
00532             {
00533                 $this->tpl->setCurrentBlock("logout");
00534                 $this->tpl->setVariable("TXT_LOGOUT",$this->lng->txt("logout"));
00535                 $this->tpl->parseCurrentBlock();
00536             }
00537         }
00538 
00539         $this->tpl->setVariable("PAGETITLE","Setup");
00540         $this->tpl->setVariable("LOCATION_STYLESHEET","./templates/blueshadow.css");
00541         $this->tpl->setVariable("LOCATION_JAVASCRIPT","../templates/default");
00542         $this->tpl->setVariable("TXT_SETUP", "ILIAS3 - ".$this->lng->txt("setup"));
00543         $this->tpl->setVariable("VERSION", $this->version);
00544         $this->tpl->setVariable("TXT_VERSION", $this->lng->txt("version"));
00545         $this->tpl->setVariable("LANG", $this->lang);
00546     }
00547 
00551     function displayFooter()
00552     {
00553         // footer (not really)
00554         if ($this->cmd != "logout")
00555         {
00556             if ($this->ini_ilias_exists and $this->display_mode == "setup" and $this->client->getId() != "")
00557             {
00558                 $this->tpl->setVariable("TXT_ACCESS_MODE","(".$this->lng->txt("client_id").": ".$this->client->getId().")");
00559             }
00560             elseif ($this->isAdmin())
00561             {
00562                 $this->tpl->setVariable("TXT_ACCESS_MODE","(".$this->lng->txt("root_access").")");
00563             }
00564         
00565             $this->displayNavButtons();
00566         }
00567         
00568         $this->tpl->show();
00569     }
00570 
00575     function displayNavButtons()
00576     {
00577         if (!$this->btn_prev_on and !$this->btn_next_on)
00578         {
00579             return false;
00580         }
00581         
00582         $this->tpl->addBlockFile("NAVBUTTONS","navbuttons","tpl.navbuttons.html");
00583 
00584         $this->tpl->setVariable("FORMACTION_BUTTONS","setup.php?cmd=gateway");
00585 
00586         if ($this->btn_prev_on)
00587         {
00588             $this->tpl->setCurrentBlock("btn_back");
00589             $this->tpl->setVariable("TXT_PREV", $this->btn_prev_lng);   
00590             $this->tpl->setVariable("CMD_PREV", $this->btn_prev_cmd);   
00591             $this->tpl->parseCurrentBlock();
00592         }
00593         
00594         if ($this->btn_next_on)
00595         {
00596             $this->tpl->setCurrentBlock("btn_forward");
00597             $this->tpl->setVariable("TXT_NEXT", $this->btn_next_lng);
00598             $this->tpl->setVariable("CMD_NEXT", $this->btn_next_cmd);   
00599             $this->tpl->parseCurrentBlock();
00600         }
00601         
00602         return true;
00603     }
00604 
00610     function SetButtonPrev($a_cmd = 0,$a_lng = 0)
00611     {
00612         $this->btn_prev_on = true;
00613         $this->btn_prev_cmd = ($a_cmd) ? $a_cmd : "gateway";
00614         $this->btn_prev_lng = ($a_lng) ? $this->lng->txt($a_lng) : "<<&nbsp;&nbsp;&nbsp;".$this->lng->txt("prev");
00615     }
00616 
00622     function SetButtonNext($a_cmd,$a_lng = 0)
00623     {
00624         $this->btn_next_on = true;
00625         $this->btn_next_cmd = ($a_cmd) ? $a_cmd : "gateway";
00626         $this->btn_next_lng = ($a_lng) ? $this->lng->txt($a_lng) : $this->lng->txt("next")."&nbsp;&nbsp;&nbsp;>>";
00627     }
00628 
00632     function displayPreliminaries()
00633     {
00634         $OK = "<font color=\"green\"><strong>OK</strong></font>";
00635         $FAILED = "<strong><font color=\"red\">FAILED</font></strong>";
00636         
00637         $this->tpl->addBlockFile("CONTENT","content","tpl.preliminaries.html");
00638         
00639         $this->tpl->setVariable("TXT_SETUP_TITLE",$this->lng->txt("ilias_setup"));
00640         $this->tpl->setVariable("TXT_SETUP_WELCOME", $this->lng->txt("setup_welcome"));
00641         $this->tpl->setVariable("TXT_SETUP_INIFILE_DESC", $this->lng->txt("setup_inifile_desc"));
00642         $this->tpl->setVariable("TXT_SETUP_DATABASE_DESC", $this->lng->txt("setup_database_desc"));
00643         $this->tpl->setVariable("TXT_SETUP_LANGUAGES_DESC", $this->lng->txt("setup_languages_desc"));
00644         $this->tpl->setVariable("TXT_SETUP_PASSWORD_DESC", $this->lng->txt("setup_password_desc"));     
00645         $this->tpl->setVariable("TXT_SETUP_NIC_DESC", $this->lng->txt("setup_nic_desc"));   
00646     
00647         $server_os = php_uname();
00648         $server_web = $_SERVER["SERVER_SOFTWARE"];
00649         $environment = $this->lng->txt("env_using")." ".$server_os." <br/>".$this->lng->txt("with")." ".$server_web;
00650         
00651         if ((stristr($server_os,"linux") || stristr($server_os,"windows")) && stristr($server_web,"apache"))
00652         {
00653             $env_comment = $this->lng->txt("env_ok");       
00654         }
00655         else
00656         {
00657             $env_comment = "<font color=\"red\">".$this->lng->txt("env_warning")."</font>";
00658         }
00659             
00660         $this->tpl->setVariable("TXT_ENV_TITLE", $this->lng->txt("environment"));
00661         $this->tpl->setVariable("TXT_ENV_INTRO", $environment);
00662         $this->tpl->setVariable("TXT_ENV_COMMENT", $env_comment);   
00663         
00664         $this->tpl->setVariable("TXT_PRE_TITLE", $this->lng->txt("preliminaries"));
00665         $this->tpl->setVariable("TXT_PRE_INTRO", $this->lng->txt("pre_intro"));
00666 
00667         // display phpversion
00668         $this->tpl->setCurrentBlock("preliminary");
00669         $this->tpl->setVariable("TXT_PRE", $this->lng->txt("pre_php_version").": ".$arCheck["php"]["version"]);
00670 
00671         if ($this->preliminaries_result["php"]["status"] == true)
00672         {
00673             $this->tpl->setVariable("STATUS_PRE", $OK);
00674         }
00675         else
00676         {
00677             $this->tpl->setVariable("STATUS_PRE", $FAILED);
00678             $this->tpl->setVariable("COMMENT_PRE", $this->preliminaries_result["php"]["comment"]);
00679         }
00680 
00681         $this->tpl->parseCurrentBlock();
00682     
00683         // check if ilias3 folder is writable
00684         $this->tpl->setCurrentBlock("preliminary");
00685         $this->tpl->setVariable("TXT_PRE", $this->lng->txt("pre_folder_write"));
00686 
00687         if ($this->preliminaries_result["root"]["status"] == true)
00688         {
00689             $this->tpl->setVariable("STATUS_PRE", $OK);
00690         }
00691         else
00692         {
00693             $this->tpl->setVariable("STATUS_PRE", $FAILED);
00694             $this->tpl->setVariable("COMMENT_PRE", $this->preliminaries_result["root"]["comment"]);
00695         }
00696         $this->tpl->parseCurrentBlock();
00697         
00698         // check if ilias3 can create new folders
00699         $this->tpl->setCurrentBlock("preliminary");
00700         $this->tpl->setVariable("TXT_PRE", $this->lng->txt("pre_folder_create"));
00701 
00702         if ($this->preliminaries_result["create"]["status"] == true)
00703         {
00704             $this->tpl->setVariable("STATUS_PRE", $OK);
00705         }
00706         else
00707         {
00708             $this->tpl->setVariable("STATUS_PRE", $FAILED);
00709             $this->tpl->setVariable("COMMENT_PRE", $this->preliminaries_result["create"]["comment"]);
00710         }
00711 
00712         $this->tpl->parseCurrentBlock();
00713 
00714         // check cookies
00715         $this->tpl->setCurrentBlock("preliminary");
00716         $this->tpl->setVariable("TXT_PRE", $this->lng->txt("pre_cookies_enabled"));
00717 
00718         if ($this->preliminaries_result["cookies"]["status"] == true)
00719         {
00720             $this->tpl->setVariable("STATUS_PRE", $OK);
00721         }
00722         else
00723         {
00724             $this->tpl->setVariable("STATUS_PRE", $FAILED);
00725             $this->tpl->setVariable("COMMENT_PRE", $this->preliminaries_result["cookies"]["comment"]);
00726         }
00727 
00728         $this->tpl->parseCurrentBlock();
00729 
00730         // check javascript
00731         $this->tpl->setCurrentBlock("preliminary_js");
00732         $this->tpl->setVariable("TXT_PRE", $this->lng->txt("pre_javascript_enabled"));
00733         $this->tpl->setVariable("STATUS_PRE", $FAILED);
00734         $this->tpl->setVariable("COMMENT_PRE", $this->lng->txt("pre_javascript_comment"));
00735         $this->tpl->parseCurrentBlock();
00736 
00737         // summary
00738         if ($this->preliminaries === true)
00739         {
00740             $cmd = "install";
00741 
00742             $btn_text = ($this->cmd == "preliminaries") ? "" : "installation";
00743             $this->setButtonNext($cmd,$btn_text);
00744         }
00745         else
00746         {
00747             $this->tpl->setCurrentBlock("premessage");
00748             $this->tpl->setVariable("TXT_PRE_ERR", $this->lng->txt("pre_error"));
00749             $this->tpl->parseCurrentBlock();
00750         }
00751     }
00752     
00756     function displayMasterSetup()
00757     {
00758         if ($_POST["form"])
00759         {
00760             if (!$this->checkDataDirSetup($_POST["form"]))
00761             {
00762                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
00763             }
00764     
00765             if (!$this->checkLogSetup($_POST["form"]))
00766             {
00767                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
00768             }
00769 
00770             if (!$this->checkToolsSetup($_POST["form"]))
00771             {
00772                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
00773             }
00774             
00775             if (!$this->checkPasswordSetup($_POST["form"]))
00776             {
00777                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
00778             }
00779 
00780             if (!$this->saveMasterSetup($_POST["form"]))
00781             {
00782                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
00783             }           
00784             
00785             sendInfo($this->lng->txt("settings_saved"),true);
00786             
00787             ilUtil::redirect("setup.php?cmd=startup");
00788         }
00789 
00790         $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html");
00791 
00792         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.form_mastersetup.html");
00793 
00794         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
00795         
00796         // for checkboxes & radio buttons
00797         $checked = "checked=\"checked\"";
00798 
00799         // general
00800         $this->tpl->setVariable("TXT_ENTER_DIR_AND_FILENAME", $this->lng->txt("dsfsdave"));
00801         $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("setup_basic_settings"));
00802         $this->tpl->setVariable("SUBMIT_CMD", "install");
00803         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00804         $this->tpl->setVariable("TXT_ENTER_DIR_AND_FILENAME", $this->lng->txt("enter_dir_and_filename"));
00805         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_first_install")."<br/>".$this->lng->txt("info_text_pathes"));
00806         
00807         if ($this->safe_mode)
00808         {
00809             $this->tpl->setVariable("SAFE_MODE_STYLE", " class=\"message\" ");
00810             $this->tpl->setVariable("TXT_SAFE_MODE_INFO", $this->lng->txt("safe_mode_enabled"));
00811         }
00812         else
00813         {
00814             $this->tpl->setVariable("TXT_SAFE_MODE_INFO", "");
00815         }
00816 
00817         // datadir
00818         $this->tpl->setCurrentBlock("setup_datadir");
00819         $this->tpl->setVariable("TXT_DATADIR_TITLE", $this->lng->txt("main_datadir_outside_webspace"));
00820         $this->tpl->setVariable("TXT_DATADIR_PATH", $this->lng->txt("datadir_path"));
00821         $this->tpl->setVariable("TXT_DATADIR_COMMENT1", $this->lng->txt("datadir_path_comment1"));
00822         $this->tpl->setVariable("TXT_CREATE", $this->lng->txt("create"));
00823         // values
00824         //echo $this->ini->readVariable($this->ini->readVariable("server","presetting"),"data_dir");
00825         if ($_SESSION["error_post_vars"]["form"])
00826         {
00827             $this->tpl->setVariable("DATADIR_PATH", $_SESSION["error_post_vars"]["form"]["datadir_path"]);
00828         }
00829         elseif ($this->ini->readVariable("server","presetting") != "")
00830         {
00831             $this->tpl->setVariable("DATADIR_PATH", $this->ini->readVariable($this->ini->readVariable("server","presetting"),"data_dir"));
00832         }
00833 
00834 
00835             
00836         //$chk_datadir_path = ($_SESSION["error_post_vars"]["form"]["chk_datadir_path"]) ? "CHK_DATADIR_PATH_TARGET" : "CHK_DATADIR_PATH_CREATE";
00837         $chk_datadir_path = ($_SESSION["error_post_vars"]["form"]["chk_datadir_path"]) ? $checked : "";
00838         $this->tpl->setVariable("CHK_DATADIR_PATH",$chk_datadir_path);
00839         $this->tpl->parseCurrentBlock();
00840         
00841         // logging
00842         $this->tpl->setCurrentBlock("setup_log");
00843         $this->tpl->setVariable("TXT_LOG_TITLE", $this->lng->txt("logging"));
00844         $this->tpl->setVariable("TXT_LOG_PATH", $this->lng->txt("log_path"));
00845         $this->tpl->setVariable("TXT_LOG_COMMENT", $this->lng->txt("log_path_comment"));
00846         $this->tpl->setVariable("TXT_DISABLE_LOGGING", $this->lng->txt("disable_logging"));
00847 
00848         // values
00849         if ($_SESSION["error_post_vars"]["form"])
00850         {
00851             $this->tpl->setVariable("LOG_PATH", $_SESSION["error_post_vars"]["form"]["log_path"]);
00852         }
00853         elseif ($this->ini->readVariable("server","presetting") != "")
00854         {
00855             $this->tpl->setVariable("LOG_PATH", $this->ini->readVariable($this->ini->readVariable("server","presetting"),"log"));
00856         }
00857 
00858         $chk_log_path = ($_SESSION["error_post_vars"]["form"]["chk_log_status"]) ? $checked : "";
00859         $this->tpl->setVariable("CHK_LOG_STATUS",$chk_log_path);
00860         $this->tpl->parseCurrentBlock();
00861 
00862         // tools
00863         $this->tpl->setCurrentBlock("setup_tools");
00864         $this->tpl->setVariable("TXT_DISABLE_CHECK", $this->lng->txt("disable_check"));
00865         $this->tpl->setVariable("TXT_TOOLS_TITLE", $this->lng->txt("3rd_party_software"));
00866         $this->tpl->setVariable("TXT_CONVERT_PATH", $this->lng->txt("convert_path"));
00867         $this->tpl->setVariable("TXT_ZIP_PATH", $this->lng->txt("zip_path"));
00868         $this->tpl->setVariable("TXT_UNZIP_PATH", $this->lng->txt("unzip_path"));
00869         $this->tpl->setVariable("TXT_JAVA_PATH", $this->lng->txt("java_path"));
00870         $this->tpl->setVariable("TXT_HTMLDOC_PATH", $this->lng->txt("htmldoc_path"));
00871 
00872         $this->tpl->setVariable("TXT_CONVERT_COMMENT", $this->lng->txt("convert_path_comment"));
00873         $this->tpl->setVariable("TXT_ZIP_COMMENT", $this->lng->txt("zip_path_comment"));
00874         $this->tpl->setVariable("TXT_UNZIP_COMMENT", $this->lng->txt("unzip_path_comment"));
00875         $this->tpl->setVariable("TXT_JAVA_COMMENT", $this->lng->txt("java_path_comment"));
00876         $this->tpl->setVariable("TXT_HTMLDOC_COMMENT", $this->lng->txt("htmldoc_path_comment"));
00877 
00878         // values
00879         if ($_SESSION["error_post_vars"]["form"])
00880         {
00881             $this->tpl->setVariable("CONVERT_PATH", $_SESSION["error_post_vars"]["form"]["convert_path"]);
00882             $this->tpl->setVariable("ZIP_PATH", $_SESSION["error_post_vars"]["form"]["zip_path"]);
00883             $this->tpl->setVariable("UNZIP_PATH", $_SESSION["error_post_vars"]["form"]["unzip_path"]);
00884             $this->tpl->setVariable("JAVA_PATH", $_SESSION["error_post_vars"]["form"]["java_path"]);
00885             $this->tpl->setVariable("HTMLDOC_PATH", $_SESSION["error_post_vars"]["form"]["htmldoc_path"]);
00886         }
00887         elseif ($this->ini->readVariable("server","presetting") != "")
00888         {
00889             $this->tpl->setVariable("CONVERT_PATH", $this->ini->readVariable($this->ini->readVariable("server","presetting"),"convert"));
00890             $this->tpl->setVariable("ZIP_PATH", $this->ini->readVariable($this->ini->readVariable("server","presetting"),"zip"));
00891             $this->tpl->setVariable("UNZIP_PATH", $this->ini->readVariable($this->ini->readVariable("server","presetting"),"unzip"));
00892             $this->tpl->setVariable("JAVA_PATH", $this->ini->readVariable($this->ini->readVariable("server","presetting"),"java"));
00893             $this->tpl->setVariable("HTMLDOC_PATH", $this->ini->readVariable($this->ini->readVariable("server","presetting"),"htmldoc"));
00894         }
00895                                 
00896         $this->tpl->setVariable("TXT_VIRUS_SCANNER", $this->lng->txt("virus_scanner"));
00897         $this->tpl->setVariable("TXT_NONE", $this->lng->txt("none"));
00898         $this->tpl->setVariable("TXT_SOPHOS", $this->lng->txt("sophos"));
00899         $this->tpl->setVariable("TXT_ANTIVIR", $this->lng->txt("antivir"));
00900         $this->tpl->setVariable("TXT_SCAN_COMMAND", $this->lng->txt("scan_command"));
00901         $this->tpl->setVariable("TXT_CLEAN_COMMAND", $this->lng->txt("clean_command"));
00902 
00903 
00904         $chk_convert_path = ($_SESSION["error_post_vars"]["form"]["chk_convert_path"]) ? $checked : "";
00905         $chk_zip_path = ($_SESSION["error_post_vars"]["form"]["chk_zip_path"]) ? $checked : "";
00906         $chk_unzip_path = ($_SESSION["error_post_vars"]["form"]["chk_unzip_path"]) ? $checked : "";
00907         $chk_java_path = ($_SESSION["error_post_vars"]["form"]["chk_java_path"]) ? $checked : "";
00908         $chk_htmldoc_path = ($_SESSION["error_post_vars"]["form"]["chk_htmldoc_path"]) ? $checked : "";
00909 
00910         $this->tpl->setVariable("CHK_CONVERT_PATH", $chk_convert_path);
00911         $this->tpl->setVariable("CHK_ZIP_PATH", $chk_zip_path);
00912         $this->tpl->setVariable("CHK_UNZIP_PATH", $chk_unzip_path);
00913         $this->tpl->setVariable("CHK_JAVA_PATH", $chk_java_path);
00914         $this->tpl->setVariable("CHK_HTMLDOC_PATH", $chk_htmldoc_path);
00915         $this->tpl->parseCurrentBlock();
00916         
00917         // setup password
00918         $this->tpl->setCurrentBlock("setup_pass");
00919         $this->tpl->setVariable("TXT_SETUP_PASS_TITLE", $this->lng->txt("setup_pass_title"));
00920         $this->tpl->setVariable("TXT_SETUP_PASS_COMMENT", $this->lng->txt("password_info"));
00921         $this->tpl->setVariable("TXT_SETUP_PASS", $this->lng->txt("setup_pass"));
00922         $this->tpl->setVariable("TXT_SETUP_PASS2", $this->lng->txt("setup_pass2"));
00923         // values
00924         $this->tpl->setVariable("SETUP_PASS", $_SESSION["error_post_vars"]["form"]["setup_pass"]);
00925         $this->tpl->setVariable("SETUP_PASS2", $_SESSION["error_post_vars"]["form"]["setup_pass2"]);
00926         $this->tpl->parseCurrentBlock();
00927         
00928         $this->setButtonPrev("preliminaries");
00929 
00930         if ($this->isInstalled())
00931         {
00932             $this->setButtonNext("list");
00933         }
00934     }
00935     
00939     function loginClient()
00940     {
00941         session_destroy();
00942         
00943         ilUtil::redirect(ILIAS_HTTP_PATH."/login.php?client_id=".$this->client->getId());
00944     }
00945     
00949     function displayLogin()
00950     {
00951         $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html");
00952 
00953         if ($_POST["form"])
00954         {
00955             // first check client login
00956             if (empty($_POST["form"]["admin_password"]))
00957             {
00958                 if (!$this->loginAsClient($_POST["form"]))
00959                 {
00960                     if ($error_msg = $this->getError())
00961                     {
00962                         $this->raiseError($this->lng->txt($error_msg),$this->error_obj->MESSAGE);
00963                     }
00964                 }
00965             }
00966             else
00967             {
00968                 if (!$this->loginAsAdmin($_POST["form"]["admin_password"]))
00969                 {
00970                     $this->raiseError($this->lng->txt("login_invalid"),$this->error_obj->MESSAGE);
00971                 }
00972             }
00973 
00974             ilUtil::redirect("setup.php");
00975         }
00976 
00977         // output
00978         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.form_login.html");
00979         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
00980         $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("setup_login"));
00981 
00982         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_login"));
00983 
00984         $this->tpl->setVariable("TXT_REQUIRED_FIELDS", $this->lng->txt("required_field"));
00985         $this->tpl->setVariable("TXT_CLIENT_LOGIN",$this->lng->txt("client_login"));
00986         $this->tpl->setVariable("TXT_CLIENT_ID",$this->lng->txt("client_id"));
00987         $this->tpl->setVariable("TXT_USERNAME",ucfirst($this->lng->txt("username")));
00988         $this->tpl->setVariable("TXT_PASSWORD",ucfirst($this->lng->txt("password")));
00989         $this->tpl->setVariable("TXT_OR",strtoupper($this->lng->txt("or")));
00990         $this->tpl->setVariable("TXT_ADMIN_LOGIN",$this->lng->txt("admin_login"));
00991         $this->tpl->setVariable("TXT_ADMIN_PASSWORD",ucfirst($this->lng->txt("password")));
00992         $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("submit"));
00993     }
00994 
00998     function displayClientList()
00999     {
01000         $_SESSION["ClientId"] = "";
01001         
01002         $_GET["sort_by"] = ($_GET["sort_by"]) ? $_GET["sort_by"] : "name";
01003 
01004         $clientlist = new ilClientList();
01005         $list = $clientlist->getClients();
01006 
01007         if (count($list) == 0)
01008         {
01009             sendInfo($this->lng->txt("no_clients_available"),true);
01010         }
01011         
01012         //prepare clientlist
01013         $data = array();
01014         $data["data"] = array();
01015         $data["ctrl"] = array();
01016         $data["cols"] = array("","name","id","login","details","status","access");
01017 
01018         foreach ($list as $key => $client)
01019         {
01020             // check status
01021             // TODO: aufr�umen!!! 
01022             $status_arr = $this->getStatus($client);
01023 
01024             if (!$status_arr["db"]["status"])
01025             {
01026                 $status = $status_arr["db"]["comment"];
01027             }
01028             elseif (!$status_arr["finish"]["status"])
01029             {
01030                 $status = $this->lng->txt("setup_not_finished");
01031             }
01032             else
01033             {
01034                 $status = "<font color=\"green\"><strong>OK</strong></font>";
01035             }
01036             
01037             if ($status_arr["access"]["status"])
01038             {
01039                 $access = "online";
01040             }
01041             else
01042             {
01043                 $access = "disabled";
01044             }
01045             
01046             if ($key == $this->default_client)
01047             {
01048                 $default = " checked=\"checked\"";
01049             }
01050             else
01051             {
01052                 $default = "";
01053             }
01054             
01055             if ($status_arr["finish"]["status"] and $status_arr["access"]["status"])
01056             {
01057                 $login = "<a href=\"../login.php?client_id=".$key."\">Login</a>";
01058             }
01059             else
01060             {
01061                 $login = "&nbsp;";
01062             }
01063 
01064             $access_html = "<a href=\"setup.php?cmd=changeaccess&client_id=".$key."&back=clientlist\">".$this->lng->txt($access)."</a>";
01065             
01066             $client_name = ($client->getName()) ? $client->getName() : "&lt;".$this->lng->txt("no_client_name")."&gt;";
01067             
01068             //visible data part
01069             $data["data"][] = array(
01070                             "default"       => "<input type=\"radio\" name=\"form[default]\" value=\"".$key."\"".$default."/>",
01071                             "name"          => $client_name."#separator#".$client->getDescription(),
01072                             "id"            => $key,
01073                             "login"         => $login,
01074                             "details"       => "<a href=\"setup.php?cmd=view&client_id=".$key."\">Details</a>",
01075                             "status"        => $status,
01076                             "access_html"   => $access_html
01077                             );
01078 
01079         }
01080 
01081         $this->maxcount = count($data["data"]);
01082 
01083         // sorting array
01084         $data["data"] = ilUtil::sortArray($data["data"],$_GET["sort_by"],$_GET["sort_order"]);
01085 
01086         $this->tpl->addBlockFile("CONTENT","content","tpl.clientlist.html");
01087         
01088         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_list"));
01089         
01090         sendInfo();
01091 
01092         // load template for table
01093         $this->tpl->addBlockfile("CLIENT_LIST", "client_list", "tpl.table.html");
01094         // load template for table content data
01095         $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
01096 
01097         // common
01098         $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("available_clients"));
01099         $this->tpl->setVariable("TXT_LISTSTATUS",($this->ini->readVariable("clients","list")) ? $this->lng->txt("display_clientlist") : $this->lng->txt("hide_clientlist"));
01100         $this->tpl->setVariable("TXT_TOGGLELIST",($this->ini->readVariable("clients","list")) ? $this->lng->txt("disable") : $this->lng->txt("enable"));
01101 
01102         $this->tpl->setVariable("FORMACTION","setup.php?cmd=gateway");
01103 
01104         // build table
01105         include_once "../classes/class.ilTableGUI.php";
01106         $tbl = new ilTableGUI();
01107 
01108         $num = 0;
01109 
01110         // title & header columns
01111         $tbl->setTitle(ucfirst($this->lng->txt("select_client")));
01112 
01113         foreach ($data["cols"] as $val)
01114         {
01115             $header_names[] = ucfirst($this->lng->txt($val));
01116         }
01117         $tbl->setHeaderNames($header_names);
01118         $tbl->setHeaderVars($data["cols"],$header_params);
01119         $tbl->setColumnWidth(array("5%","30%","10%","10%","10%","20%","15%"));
01120         
01121         // control
01122         $tbl->setOrderColumn($_GET["sort_by"],"name");
01123         $tbl->setOrderDirection($_GET["sort_order"],"asc");
01124         $tbl->setLimit(0);
01125         $tbl->setOffset(0);
01126         $tbl->setMaxCount($maxcount);
01127         
01128         // SHOW VALID ACTIONS
01129         $this->tpl->setVariable("COLUMN_COUNTS",count($data["cols"]));
01130         
01131         // footer
01132         //$tbl->setFooter("tbl_footer");
01133         
01134         $tbl->disable("footer");
01135         $tbl->disable("icon");
01136         $tbl->disable("numinfo");
01137         
01138         // render table
01139         $tbl->render();
01140 
01141         if (is_array($data["data"][0]))
01142         {
01143             //table cell
01144             for ($i=0; $i < count($data["data"]); $i++)
01145             {
01146                 $data2 = $data["data"][$i];
01147                 $ctrl = $data["ctrl"][$i];
01148 
01149                 // color changing
01150                 $css_row = ilUtil::switchColor($i+1,"tblrow1","tblrow2");
01151 
01152                 $this->tpl->setCurrentBlock("table_cell");
01153                 $this->tpl->setVariable("CELLSTYLE", "tblrow1");
01154                 $this->tpl->parseCurrentBlock();
01155 
01156                 foreach ($data2 as $key => $val)
01157                 {
01158                     $this->tpl->setCurrentBlock("text");
01159                     
01160                     if ($key == "name")
01161                     {
01162                         $name_field = explode("#separator#",$val);
01163                         $val = $name_field[0]."<br/><span class=\"subtitle\">".$name_field[1]."</span>";
01164                     }
01165 
01166                     $this->tpl->setVariable("TEXT_CONTENT", $val);                  
01167                     $this->tpl->parseCurrentBlock();
01168 
01169                     $this->tpl->setCurrentBlock("table_cell");
01170                     $this->tpl->parseCurrentBlock();
01171 
01172                 } //foreach
01173 
01174                 $this->tpl->setCurrentBlock("tbl_content");
01175                 $this->tpl->setVariable("CSS_ROW", $css_row);
01176                 $this->tpl->parseCurrentBlock();
01177             }
01178 
01179             $this->tpl->setCurrentBlock("tbl_action_btn");
01180             $this->tpl->setVariable("TPLPATH",TPLPATH);         
01181             $this->tpl->setVariable("BTN_NAME","changedefault");
01182             $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("set_default_client"));
01183             $this->tpl->parseCurrentBlock();
01184 
01185             $this->tpl->setCurrentBlock("tbl_action_row");
01186             $this->tpl->setVariable("TPLPATH",TPLPATH);         
01187             $this->tpl->setVariable("COLUMN_COUNTS","7");
01188             $this->tpl->parseCurrentBlock();
01189 
01190         }
01191     }
01192 
01196     function changeMasterSettings()
01197     {
01198         if ($_POST["form"])
01199         {
01200             if (!$this->checkLogSetup($_POST["form"]))
01201             {
01202                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
01203             }
01204 
01205             if (!$this->checkToolsSetup($_POST["form"]))
01206             {
01207                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
01208             }
01209 
01210             if (!$this->updateMasterSettings($_POST["form"]))
01211             {
01212                 $this->raiseError($this->lng->txt($this->getError()),$this->error_obj->MESSAGE);
01213             }
01214 
01215             sendInfo($this->lng->txt("settings_saved"),true);
01216             ilUtil::redirect("setup.php");
01217         }
01218 
01219         $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html");
01220 
01221         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.form_mastersetup.html");
01222 
01223         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
01224 
01225         // for checkboxes & radio buttons
01226         $checked = "checked=\"checked\"";
01227 
01228         // general
01229         $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("change_basic_settings"));
01230         $this->tpl->setVariable("SUBMIT_CMD", "mastersettings");
01231         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
01232         $this->tpl->setVariable("TXT_ENTER_DIR_AND_FILENAME", $this->lng->txt("enter_dir_and_filename"));
01233         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_pathes"));
01234         
01235         if ($this->safe_mode)
01236         {
01237             $this->tpl->setVariable("SAFE_MODE_STYLE", " class=\"message\" ");
01238             $this->tpl->setVariable("TXT_SAFE_MODE_INFO", $this->lng->txt("safe_mode_enabled"));
01239         }
01240         else
01241         {
01242             $this->tpl->setVariable("TXT_SAFE_MODE_INFO", "");
01243         }
01244         // datadir
01245         $this->tpl->setCurrentBlock("display_datadir");
01246         $this->tpl->setVariable("TXT_DATADIR_TITLE", $this->lng->txt("main_datadir_outside_webspace"));
01247         $this->tpl->setVariable("TXT_DATADIR_PATH", $this->lng->txt("datadir_path"));
01248         $this->tpl->setVariable("DATADIR_PATH", $this->ini->readVariable("clients","datadir"));
01249         $this->tpl->setVariable("TXT_DATADIR_COMMENT2", $this->lng->txt("datadir_path_comment2"));
01250         $this->tpl->parseCurrentBlock();
01251 
01252         // logging
01253         $this->tpl->setCurrentBlock("setup_log");
01254         $this->tpl->setVariable("TXT_LOG_TITLE", $this->lng->txt("logging"));
01255         $this->tpl->setVariable("TXT_LOG_PATH", $this->lng->txt("log_path"));
01256         $this->tpl->setVariable("TXT_LOG_COMMENT", $this->lng->txt("log_path_comment"));
01257         $this->tpl->setVariable("TXT_DISABLE_LOGGING", $this->lng->txt("disable_logging"));
01258         // values
01259         if ($_SESSION["error_post_vars"])
01260         {
01261             $this->tpl->setVariable("LOG_PATH", $_SESSION["error_post_vars"]["form"]["log_path"]);
01262             $chk_log_status = ($_SESSION["error_post_vars"]["form"]["chk_log_status"]) ? $checked : "";
01263         }
01264         else
01265         {
01266             $this->tpl->setVariable("LOG_PATH",$this->ini->readVariable("log","path")."/".$this->ini->readVariable("log","file"));
01267             $chk_log_status = ($this->ini->readVariable("log","enabled")) ? "" : $checked;
01268 
01269         }
01270 
01271         $this->tpl->setVariable("CHK_LOG_STATUS",$chk_log_status);
01272         $this->tpl->parseCurrentBlock();
01273 
01274         // tools
01275         $this->tpl->setCurrentBlock("setup_tools");
01276         $this->tpl->setVariable("TXT_DISABLE_CHECK", $this->lng->txt("disable_check"));
01277         $this->tpl->setVariable("TXT_TOOLS_TITLE", $this->lng->txt("3rd_party_software"));
01278         $this->tpl->setVariable("TXT_CONVERT_PATH", $this->lng->txt("convert_path"));
01279         $this->tpl->setVariable("TXT_ZIP_PATH", $this->lng->txt("zip_path"));
01280         $this->tpl->setVariable("TXT_UNZIP_PATH", $this->lng->txt("unzip_path"));
01281         $this->tpl->setVariable("TXT_JAVA_PATH", $this->lng->txt("java_path"));
01282         $this->tpl->setVariable("TXT_HTMLDOC_PATH", $this->lng->txt("htmldoc_path"));
01283         $this->tpl->setVariable("TXT_FOP_PATH", $this->lng->txt("fop_path"));
01284         
01285         $this->tpl->setVariable("TXT_VIRUS_SCANNER", $this->lng->txt("virus_scanner"));
01286         $this->tpl->setVariable("TXT_NONE", $this->lng->txt("none"));
01287         $this->tpl->setVariable("TXT_SOPHOS", $this->lng->txt("sophos"));
01288         $this->tpl->setVariable("TXT_ANTIVIR", $this->lng->txt("antivir"));
01289         $this->tpl->setVariable("TXT_SCAN_COMMAND", $this->lng->txt("scan_command"));
01290         $this->tpl->setVariable("TXT_CLEAN_COMMAND", $this->lng->txt("clean_command"));
01291 
01292         $this->tpl->setVariable("TXT_CONVERT_COMMENT", $this->lng->txt("convert_path_comment"));
01293         $this->tpl->setVariable("TXT_ZIP_COMMENT", $this->lng->txt("zip_path_comment"));
01294         $this->tpl->setVariable("TXT_UNZIP_COMMENT", $this->lng->txt("unzip_path_comment"));
01295         $this->tpl->setVariable("TXT_JAVA_COMMENT", $this->lng->txt("java_path_comment"));
01296         $this->tpl->setVariable("TXT_HTMLDOC_COMMENT", $this->lng->txt("htmldoc_path_comment"));
01297         $this->tpl->setVariable("TXT_FOP_COMMENT", $this->lng->txt("fop_path_comment"));
01298         // values
01299         if ($_SESSION["error_post_vars"])
01300         {
01301             $this->tpl->setVariable("CONVERT_PATH", $_SESSION["error_post_vars"]["form"]["convert_path"]);
01302             $this->tpl->setVariable("ZIP_PATH", $_SESSION["error_post_vars"]["form"]["zip_path"]);
01303             $this->tpl->setVariable("UNZIP_PATH", $_SESSION["error_post_vars"]["form"]["unzip_path"]);
01304             $this->tpl->setVariable("JAVA_PATH", $_SESSION["error_post_vars"]["form"]["java_path"]);
01305             $this->tpl->setVariable("HTMLDOC_PATH", $_SESSION["error_post_vars"]["form"]["htmldoc_path"]);
01306             $this->tpl->setVariable("FOP_PATH", $_SESSION["error_post_vars"]["form"]["fop_path"]);
01307             $this->tpl->setVariable("STYPE_".
01308                 strtoupper($_SESSION["error_post_vars"]["form"]["vscanner_type"]), " selected=\"1\" ");
01309             $this->tpl->setVariable("SCAN_COMMAND", $_SESSION["error_post_vars"]["form"]["scan_command"]);
01310             $this->tpl->setVariable("CLEAN_COMMAND", $_SESSION["error_post_vars"]["form"]["clean_command"]);
01311         }
01312         else
01313         {
01314             $this->tpl->setVariable("CONVERT_PATH", $this->ini->readVariable("tools","convert"));
01315             $this->tpl->setVariable("ZIP_PATH", $this->ini->readVariable("tools","zip"));
01316             $this->tpl->setVariable("UNZIP_PATH",$this->ini->readVariable("tools","unzip"));
01317             $this->tpl->setVariable("JAVA_PATH",$this->ini->readVariable("tools","java"));
01318             $this->tpl->setVariable("HTMLDOC_PATH",$this->ini->readVariable("tools","htmldoc"));
01319             $this->tpl->setVariable("FOP_PATH",$this->ini->readVariable("tools","fop"));
01320             $this->tpl->setVariable("STYPE_".
01321                 strtoupper($this->ini->readVariable("tools", "vscantype")), " selected=\"1\" ");
01322             $this->tpl->setVariable("SCAN_COMMAND", $this->ini->readVariable("tools", "scancommand"));
01323             $this->tpl->setVariable("CLEAN_COMMAND", $this->ini->readVariable("tools", "cleancommand"));
01324         }
01325 
01326         $chk_convert_path = ($_SESSION["error_post_vars"]["form"]["chk_convert_path"]) ? $checked : "";
01327         $chk_zip_path = ($_SESSION["error_post_vars"]["form"]["chk_zip_path"]) ? $checked : "";
01328         $chk_unzip_path = ($_SESSION["error_post_vars"]["form"]["chk_unzip_path"]) ? $checked : "";
01329         $chk_java_path = ($_SESSION["error_post_vars"]["form"]["chk_java_path"]) ? $checked : "";
01330         $chk_htmldoc_path = ($_SESSION["error_post_vars"]["form"]["chk_htmldoc_path"]) ? $checked : "";
01331         $chk_fop_path = ($_SESSION["error_post_vars"]["form"]["chk_fop_path"]) ? $checked : "";
01332 
01333         $this->tpl->setVariable("CHK_LOG_STATUS", $chk_log_stauts);
01334         $this->tpl->setVariable("CHK_CONVERT_PATH", $chk_convert_path);
01335         $this->tpl->setVariable("CHK_ZIP_PATH", $chk_zip_path);
01336         $this->tpl->setVariable("CHK_UNZIP_PATH", $chk_unzip_path);
01337         $this->tpl->setVariable("CHK_JAVA_PATH", $chk_java_path);
01338         $this->tpl->setVariable("CHK_HTMLDOC_PATH", $chk_htmldoc_path);
01339         $this->tpl->setVariable("CHK_FOP_PATH", $chk_fop_path);
01340         $this->tpl->parseCurrentBlock();
01341     }
01342 
01346     function displayIni()
01347     {
01348         $this->checkDisplayMode("create_new_client");
01349         
01350         // checkings
01351         if ($_POST["form"])
01352         {
01353             // check client name
01354             if (!$_POST["form"]["client_id"])
01355             {
01356                 $this->raiseError($this->lng->txt("ini_no_client_id"),$this->error_obj->MESSAGE);
01357             }
01358 
01359             if (strlen($_POST["form"]["client_id"]) != strlen(urlencode(($_POST["form"]["client_id"]))))
01360             {
01361                 $this->raiseError($this->lng->txt("ini_client_id_invalid"),$this->error_obj->MESSAGE);
01362             }           
01363 
01364             if (strlen($_POST["form"]["client_id"]) < 4)
01365             {
01366                 $this->raiseError($this->lng->txt("ini_client_id_too_short"),$this->error_obj->MESSAGE);
01367             }
01368 
01369             if (strlen($_POST["form"]["client_id"]) > 32)
01370             {
01371                 $this->raiseError($this->lng->txt("ini_client_id_too_long"),$this->error_obj->MESSAGE);
01372             }
01373 
01374             // check database
01375             if (!$_POST["form"]["db_host"])
01376             {
01377                 $this->raiseError($this->lng->txt("ini_no_db_host"),$this->error_obj->MESSAGE);
01378             }
01379 
01380             if (!$_POST["form"]["db_name"])
01381             {
01382                 $this->raiseError($this->lng->txt("ini_no_db_name"),$this->error_obj->MESSAGE);
01383             }
01384             
01385             if (!$_POST["form"]["db_user"])
01386             {
01387                 $this->raiseError($this->lng->txt("ini_no_db_user"),$this->error_obj->MESSAGE);
01388             }
01389 
01390             // create new client object if it does not exist
01391             if (!$this->ini_client_exists)
01392             {
01393                 $client_id = $_POST["form"]["client_id"];
01394                 
01395                 // check for existing client dir (only for newly created clients not renaming)
01396                 if (!$this->ini_client_exists and file_exists(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$client_id))
01397                 {
01398                     $this->raiseError($this->lng->txt("ini_client_id_exists"),$this->error_obj->MESSAGE);
01399                 }
01400 
01401                 $this->newClient($client_id);
01402             }
01403 
01404             // save some old values
01405             $old_db_name = $this->client->getDbName();
01406             $old_client_id = $this->client->getId();            
01407             // set client data 
01408             $this->client->setId($_POST["form"]["client_id"]);
01409             $this->client->setDbHost($_POST["form"]["db_host"]);
01410             $this->client->setDbName($_POST["form"]["db_name"]);
01411             $this->client->setDbUser($_POST["form"]["db_user"]);
01412             $this->client->setDbPass($_POST["form"]["db_pass"]);
01413             $this->client->setDSN();
01414             
01415             // try to connect to database
01416             if (!$this->client->checkDatabaseHost())
01417             {
01418                 $this->raiseError($this->lng->txt($this->client->getError()),$this->error_obj->MESSAGE);
01419             }
01420             
01421             // check if db exists
01422             $db_installed = $this->client->checkDatabaseExists();
01423 
01424             if ($db_installed and (!$this->ini_ilias_exists or ($this->client->getDbName() != $old_db_name)))
01425             {
01426                 $_POST["form"]["db_name"] = $old_db_name;
01427                 $message = ucfirst($this->lng->txt("database"))." \"".$this->client->getDbName()."\" ".$this->lng->txt("ini_db_name_exists");
01428                 $this->raiseError($message,$this->error_obj->MESSAGE);
01429             }
01430             
01431             if ($this->ini_client_exists and $old_client_id != $this->client->getId())
01432             {
01433                 $message = $this->lng->txt("ini_client_id_no_change");
01434                 $this->raiseError($message,$this->error_obj->MESSAGE);
01435             }
01436 
01437             // all ok. create client.ini and save posted data
01438             if (!$this->ini_client_exists)
01439             {
01440                 if ($this->saveNewClient())
01441                 {
01442                     sendInfo($this->lng->txt("settings_saved"));
01443                     $this->client->status["ini"]["status"] = true;
01444                 }
01445                 else
01446                 {
01447                     $err = $this->getError();
01448                     sendInfo($this->lng->txt("save_error").": ".$err);
01449                     $this->client->status["ini"]["status"] = false;
01450                     $this->client->status["ini"]["comment"] = $err;
01451                 }
01452             }
01453             else
01454             {
01455                 if ($this->client->ini->write())
01456                 {
01457                     sendInfo($this->lng->txt("settings_changed"));
01458                     $this->client->status["ini"]["status"] = true;
01459                 }
01460                 else
01461                 {
01462                     $err = $this->client->ini->getError();
01463                     sendInfo($this->lng->txt("save_error").": ".$err);
01464                     $this->client->status["ini"]["status"] = false;
01465                     $this->client->status["ini"]["comment"] = $err;
01466                 }
01467             }
01468         }
01469 
01470         // output
01471         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_ini.html");
01472         
01473         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
01474         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
01475         
01476         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_ini"));
01477         
01478         // display default values, loaded valus or saved error values
01479         if ($_SESSION["error_post_vars"]["form"])
01480         {
01481             $this->tpl->setVariable("CLIENT_ID", $_SESSION["error_post_vars"]["form"]["client_id"]);
01482             $this->tpl->setVariable("DB_HOST", $_SESSION["error_post_vars"]["form"]["db_host"]);    
01483             $this->tpl->setVariable("DB_NAME", $_SESSION["error_post_vars"]["form"]["db_name"]);        
01484             $this->tpl->setVariable("DB_USER", $_SESSION["error_post_vars"]["form"]["db_user"]);        
01485             $this->tpl->setVariable("DB_PASS", $_SESSION["error_post_vars"]["form"]["db_pass"]);
01486         }
01487         else
01488         {
01489             $this->tpl->setVariable("CLIENT_ID", $this->client->getId());
01490             $this->tpl->setVariable("DB_HOST", $this->client->getDbHost()); 
01491             $this->tpl->setVariable("DB_NAME", $this->client->getDbName());     
01492             $this->tpl->setVariable("DB_USER", $this->client->getDbUser());     
01493             $this->tpl->setVariable("DB_PASS", $this->client->getDbPass());     
01494         }
01495 
01496         $this->tpl->setVariable("TXT_CLIENT_HEADER", $this->lng->txt("inst_identification"));
01497         $this->tpl->setVariable("TXT_CLIENT_ID", $this->lng->txt("client_id"));
01498         $this->tpl->setVariable("TXT_DB_HEADER", $this->lng->txt("db_conn"));
01499         $this->tpl->setVariable("TXT_DB_TYPE", $this->lng->txt("db_type"));
01500         $this->tpl->setVariable("TXT_DB_HOST", $this->lng->txt("db_host"));
01501         $this->tpl->setVariable("TXT_DB_NAME", $this->lng->txt("db_name")); 
01502         $this->tpl->setVariable("TXT_DB_USER", $this->lng->txt("db_user"));
01503         $this->tpl->setVariable("TXT_DB_PASS", $this->lng->txt("db_pass"));
01504 
01505         if ($this->client->status["ini"]["status"])
01506         {
01507             $this->setButtonNext("db");
01508         }
01509         
01510         $this->checkPanelMode();
01511     }
01512     
01518     function displayError($a_message)
01519     {
01520         $this->tpl->addBlockFile("CONTENT", "content", "tpl.error.html");
01521         
01522         $this->tpl->setCurrentBlock("content");
01523         $this->tpl->setVariable("FORMACTION", $_SESSION["referer"]);
01524         $this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
01525         $this->tpl->setVariable("ERROR_MESSAGE",($a_message));
01526         $this->tpl->parseCurrentBlock();
01527         
01528         $this->tpl->show();
01529         exit();
01530     }
01531 
01535     function displayLogout()
01536     {
01537         $this->tpl->addBlockFile("CONTENT","content","tpl.logout.html");
01538 
01539         session_destroy();
01540 
01541         $this->logged_out = true;
01542         $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("logged_out"));        
01543         $this->tpl->setCurrentBlock("home_link");
01544         $this->tpl->setVariable("TXT_INDEX",$this->lng->txt("ilias_homepage"));
01545         $this->tpl->setVariable("LNK_INDEX",ILIAS_HTTP_PATH."/index.php");
01546         $this->tpl->parseCurrentBlock();
01547     }
01548 
01552     function displayProcessPanel()
01553     {
01554         $OK = "<font color=\"green\"><strong>OK</strong></font>";
01555         
01556         $steps = array();
01557         $steps = $this->getStatus();
01558         
01559         // remove access step
01560         unset($steps["access"]);
01561         
01562         $steps["ini"]["text"]       = $this->lng->txt("setup_process_step_ini");
01563         $steps["db"]["text"]        = $this->lng->txt("setup_process_step_db");
01564         $steps["lang"]["text"]      = $this->lng->txt("setup_process_step_lang");
01565         $steps["contact"]["text"]   = $this->lng->txt("setup_process_step_contact");
01566         $steps["nic"]["text"]       = $this->lng->txt("setup_process_step_nic");
01567         $steps["finish"]["text"]    = $this->lng->txt("setup_process_step_finish");
01568         
01569         $this->tpl->addBlockFile("PROCESS_MENU","process_menu","tpl.process_panel.html");
01570 
01571         $this->tpl->setVariable("TXT_SETUP_PROCESS_STATUS",$this->lng->txt("setup_process_status"));
01572 
01573         $num = 1;
01574 
01575         foreach ($steps as $key => $val)
01576         {
01577             $this->tpl->setCurrentBlock("menu_row");
01578             $this->tpl->setVariable("TXT_STEP",$this->lng->txt("step")." ".$num.": &nbsp;");
01579             $this->tpl->setVariable("TXT_ACTION",$val["text"]);
01580             $this->tpl->setVariable("IMG_ARROW", "spacer.gif");
01581             
01582             $num++;
01583 
01584             if ($this->cmd == $key and isset($this->cmd))
01585             {
01586                 $this->tpl->setVariable("HIGHLIGHT", " style=\"font-weight:bold;\"");
01587                 $this->tpl->setVariable("IMG_ARROW", "arrow_right.png");
01588             }
01589             
01590             $status = ($val["status"]) ? $OK : "";          
01591             
01592             $this->tpl->setVariable("TXT_STATUS",$status);
01593             $this->tpl->parseCurrentBlock();
01594         }
01595     }
01596 
01600     function displayStatusPanel()
01601     {
01602         $OK = "<font color=\"green\"><strong>OK</strong></font>";
01603 
01604         $this->tpl->addBlockFile("STATUS_PANEL","status_panel","tpl.status_panel.html");
01605 
01606         $this->tpl->setVariable("TXT_OVERALL_STATUS",$this->lng->txt("overall_status"));
01607         // display status
01608         if ($this->client->status)
01609         {
01610             foreach ($this->client->status as $key => $val)
01611             {
01612                 $status = ($val["status"]) ? $OK : "&nbsp;";
01613                 $this->tpl->setCurrentBlock("status_row");
01614                 $this->tpl->setVariable("TXT_STEP",$key.":&nbsp;");
01615                 $this->tpl->setVariable("TXT_STATUS",$status);
01616                 $this->tpl->setVariable("TXT_COMMENT",$val["comment"]);
01617                 $this->tpl->parseCurrentBlock();
01618             }
01619         }
01620     }
01621     
01626     function checkDisplayMode($a_title = "")
01627     {
01628         switch ($this->display_mode)
01629         {
01630             case "view":
01631                 $this->tpl->addBlockFile("CONTENT","content","tpl.clientview.html");
01632                 // display tabs
01633                 include "./include/inc.client_tabs.php";
01634                 $client_name = ($this->client->getName()) ? $this->client->getName() : $this->lng->txt("no_client_name");
01635                 $this->tpl->setVariable("TXT_HEADER",$client_name." (".$this->lng->txt("client_id").": ".$this->client->getId().")");       
01636                 break;
01637             
01638             case "setup":
01639                 $this->tpl->addBlockFile("CONTENT","content","tpl.clientsetup.html");
01640                 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt($a_title));        
01641                 break;
01642 
01643             default:
01644                 $this->displayError($this->lng->txt("unknown_display_mode"));
01645                 exit();
01646                 break;
01647         }
01648     }
01649 
01653     function checkPanelMode()
01654     {
01655         switch ($this->display_mode)
01656         {
01657             case "view":
01658                 $this->displayStatusPanel();                
01659                 break;
01660             
01661             case "setup":
01662                 $this->displayProcessPanel();
01663                 break;
01664         }
01665     }
01666 
01670     function displayStartup()
01671     {
01672         $this->tpl->addBlockFile("CONTENT","content","tpl.clientsetup.html");
01673         
01674         $this->tpl->setVariable("TXT_INFO",$this->lng->txt("info_text_first_client"));
01675         $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("setup_first_client"));
01676         
01677         $this->displayProcessPanel();
01678         
01679         $this->setButtonNext("ini");
01680     }
01681 
01685     function displayDatabase()
01686     {
01687         global $ilErr,$ilDB;
01688 
01689         $this->checkDisplayMode("setup_database");
01690 
01691         // checkings
01692         if ($_POST["form"]["db_flag"] == 1)
01693         {
01694             $message = "";
01695             
01696             if (!$this->client->db_installed)
01697             {
01698                 if (!$this->client->db_exists)
01699                 {
01700                     if ($_POST["form"]["chk_db_create"])
01701                     {
01702                         if (!$this->createDatabase($_POST["collation"]))
01703                         {
01704                             $message = $this->lng->txt($this->getError());
01705                             $this->raiseError($message,$this->error_obj->MESSAGE);
01706                         }
01707                     }
01708                     else
01709                     {
01710                         $message = $this->lng->txt("database_not_exists_create_first");
01711                         $this->raiseError($message,$this->error_obj->MESSAGE);                  
01712                     }
01713                 }
01714                 
01715                 if (!$this->installDatabase())
01716                 {
01717                     $message = $this->lng->txt($this->getError());
01718                     $this->client->status["db"]["status"] = false;
01719                     $this->client->status["db"]["comment"] = "install_error";
01720                 }
01721                 else
01722                 {
01723                     $message = $this->lng->txt("database_installed");
01724                 }
01725             }
01726             else
01727             {
01728                 include_once "../classes/class.ilDBUpdate.php";
01729                 include_once "../classes/class.ilRbacAdmin.php";
01730                 include_once "../classes/class.ilRbacReview.php";
01731                 include_once "../classes/class.ilRbacSystem.php";
01732                 include_once "../classes/class.ilTree.php";
01733                 include_once "../classes/class.ilSaxParser.php";
01734                 include_once "../classes/class.ilObjectDefinition.php";
01735 
01736                 // referencing db handler in language class
01737                 $this->lng->setDbHandler($this->client->db);
01738 
01739                 // referencing does not work in dbupdate-script
01740                 $ilDB = new ilDbx($this->client->dsn);
01741 
01742                 // run dbupdate
01743                 $dbupdate = new ilDBUpdate($ilDB);
01744                 $dbupdate->applyUpdate();
01745             
01746                 if ($dbupdate->updateMsg == "no_changes")
01747                 {
01748                     $message = $this->lng->txt("no_changes").". ".$this->lng->txt("database_is_uptodate");
01749                 }
01750                 else
01751                 {
01752                     foreach ($dbupdate->updateMsg as $row)
01753                     {
01754                         $message .= $this->lng->txt($row["msg"]).": ".$row["nr"]."<br/>";
01755                     }
01756                 }
01757             }
01758         }
01759 
01760         sendInfo($message);
01761 
01762         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_db.html");
01763         
01764         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
01765         $this->tpl->setVariable("DB_HOST", $this->client->getDbHost());
01766         $this->tpl->setVariable("DB_NAME", $this->client->getDbName());     
01767         $this->tpl->setVariable("DB_USER", $this->client->getDbUser());     
01768         $this->tpl->setVariable("DB_PASS", $this->client->getDbPass());
01769 
01770         if ($this->client->db_installed)
01771         {
01772             // referencing db handler in language class
01773             $this->lng->setDbHandler($this->client->db);
01774 
01775             include_once "../classes/class.ilDBUpdate.php";
01776             $ilDB = new ilDbx($this->client->dsn);
01777             $dbupdate = new ilDBUpdate($ilDB);
01778 
01779             if (!$db_status = $dbupdate->getDBVersionStatus())
01780             {
01781                 $remark = "<font color=\"red\">".$this->lng->txt("database_needs_update").
01782                                   " (".$this->lng->txt("database_version").": ".$dbupdate->currentVersion.
01783                                   " ; ".$this->lng->txt("file_version").": ".$dbupdate->fileVersion.")</font>";
01784                 $this->tpl->setVariable("TXT_INFO", $remark);
01785                 
01786                 $this->tpl->setCurrentBlock("btn_submit");
01787                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("database_update"));
01788                 $this->tpl->parseCurrentBlock();
01789             }
01790             else
01791             {
01792                 $this->tpl->setVariable("TXT_INFO",$this->lng->txt("database_is_uptodate"));
01793                 $this->client->status["db"]["status"] = true;
01794                 $this->client->status["db"]["comment"] = "version ".$dbupdate->getCurrentVersion();
01795             }
01796             
01797             $this->tpl->setVariable("TXT_DB_VERSION", $this->lng->txt("version"));
01798             $this->tpl->setVariable("VAL_DB_VERSION", $ilDB->getMySQLVersion());
01799                         $this->tpl->setVariable("TXT_DB_MODE", $this->lng->txt("ilias_db_mode"));
01800                         
01801                         if ($ilDB->isMySQL4_1OrHigher())
01802                         {
01803                                 $this->tpl->setVariable("VAL_DB_MODE", $this->lng->txt("mysql_4_1_x_or_higher_mode"));
01804                         }
01805                         else
01806                         {
01807                                 $this->tpl->setVariable("VAL_DB_MODE", $this->lng->txt("mysql_4_0_x_or_lower_mode"));
01808                         }
01809                         $this->tpl->setVariable("TXT_CHECK_VERSIONS", $this->lng->txt("check_db_versions"));
01810         }
01811         else
01812         {
01813             $checked = "";
01814 
01815             if ($_SESSION["error_post_vars"]["form"]["chk_db_create"])
01816             {
01817                 $checked = "checked=\"checked\"";
01818             }
01819 
01820             $this->tpl->setCurrentBlock("option_db_create");
01821             $this->tpl->setVariable("TXT_DB_CREATE", $this->lng->txt("database_create"));
01822             $this->tpl->setVariable("DB_CREATE_CHECK",$checked);
01823             $this->tpl->parseCurrentBlock();
01824 
01825             $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("database_install"));
01826             $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_db"));
01827             
01828             // output version
01829             $ilDB = new ilDbx($this->client->dsn_host);
01830             $this->tpl->setVariable("TXT_DB_VERSION", $this->lng->txt("version"));
01831             $this->tpl->setVariable("VAL_DB_VERSION", $ilDB->getMySQLVersion());
01832                         $this->tpl->setVariable("TXT_DB_MODE", $this->lng->txt("ilias_db_mode"));
01833                         
01834                         if ($ilDB->isMySQL4_1OrHigher())
01835                         {
01836                                 $this->tpl->setVariable("VAL_DB_MODE", $this->lng->txt("mysql_4_1_x_or_higher_mode"));
01837                         }
01838                         else
01839                         {
01840                                 $this->tpl->setVariable("VAL_DB_MODE", $this->lng->txt("mysql_4_0_x_or_lower_mode"));
01841                         }
01842                         $this->tpl->setVariable("TXT_CHECK_VERSIONS", $this->lng->txt("check_db_versions"));
01843             
01844             // collation selection ( see utf8 collations at
01845             // http://dev.mysql.com/doc/mysql/en/charset-unicode-sets.html )
01846             if ($ilDB->isMySQL4_1OrHigher())
01847             {
01848                 $collations = array
01849                 (
01850                     "utf8_unicode_ci",
01851                     "utf8_general_ci",
01852                     "utf8_czech_ci",
01853                     "utf8_danish_ci",
01854                     "utf8_estonian_ci",
01855                     "utf8_icelandic_ci",
01856                     "utf8_latvian_ci",
01857                     "utf8_lithuanian_ci",
01858                     "utf8_persian_ci",
01859                     "utf8_polish_ci",
01860                     "utf8_roman_ci",
01861                     "utf8_romanian_ci",
01862                     "utf8_slovak_ci",
01863                     "utf8_slovenian_ci",
01864                     "utf8_spanish2_ci",
01865                     "utf8_spanish_ci",
01866                     "utf8_swedish_ci",
01867                     "utf8_turkish_ci"
01868                 );
01869                 foreach($collations as $collation)
01870                 {
01871                     $this->tpl->setCurrentBlock("collation_item");
01872                     $this->tpl->setVariable("VAL_COLLATION_ITEM", $collation);
01873                     $this->tpl->setVariable("TXT_COLLATION_ITEM", $collation);
01874                     $this->tpl->parseCurrentBlock();
01875                 }
01876                 $this->tpl->setCurrentBlock("collation_selection");
01877                 $this->tpl->setVariable("TXT_COLLATION", $this->lng->txt("collation"));
01878                 $this->tpl->parseCurrentBlock();
01879                 //$this->tpl->setCurrentBlock("setup_content");
01880                 $this->tpl->setVariable("COLLATION_INFO1", $this->lng->txt("info_text_db_collation1"));
01881                 $this->tpl->setVariable("COLLATION_EXAMPLE",
01882                     "<br /><br />".$this->lng->txt("example").": CREATE DATABASE ilias3 CHARACTER SET utf8 COLLATE utf8_unicode_ci");
01883                 $this->tpl->setVariable("COLLATION_INFO2", "<br /><br />".$this->lng->txt("info_text_db_collation2")." ".
01884                     "<a target=\"_new\" href=\"http://dev.mysql.com/doc/mysql/en/charset-unicode-sets.html\">".
01885                     " MySQL Reference Manual :: 10.11.1 Unicode Character Sets</a>");
01886             }
01887         }
01888         
01889         $this->tpl->parseCurrentBlock();
01890         
01891         $this->tpl->setVariable("TXT_SETUP_TITLE", $this->lng->txt("setup_database"));
01892         $this->tpl->setVariable("TXT_DB_HEADER", $this->lng->txt("db_conn"));
01893         $this->tpl->setVariable("TXT_DB_TYPE", $this->lng->txt("db_type"));
01894         $this->tpl->setVariable("TXT_DB_HOST", $this->lng->txt("db_host"));
01895         $this->tpl->setVariable("TXT_DB_NAME", $this->lng->txt("db_name")); 
01896         $this->tpl->setVariable("TXT_DB_USER", $this->lng->txt("db_user"));
01897         $this->tpl->setVariable("TXT_DB_PASS", $this->lng->txt("db_pass"));
01898         
01899         // only allow to return to ini if db does not exist yet
01900         if (!$this->client->db_installed)
01901         {
01902             $this->setButtonPrev("ini");
01903         }
01904         
01905         if ($this->client->db_installed and $db_status)
01906         {
01907             $this->setButtonNext("lang");
01908         }
01909         
01910         $this->checkPanelMode();
01911     }
01912     
01916     function displayLanguages()
01917     {
01918         $this->checkDisplayMode("setup_languages");
01919 
01920         if (!$this->client->db_installed)
01921         {
01922             // program should never come to this place
01923             $message = "No database found! Please install database first.";
01924             sendInfo($message);
01925         }
01926     
01927         // checkings
01928         if ($_POST["form"])
01929         {
01930             if (empty($_POST["form"]["lang_id"]))
01931             {
01932                 $message = $this->lng->txt("lang_min_one_language");
01933                 $this->raiseError($message,$this->error_obj->MESSAGE);
01934             }
01935             
01936             if (!in_array($_POST["form"]["lang_default"],$_POST["form"]["lang_id"]))
01937             {
01938                 $message = $this->lng->txt("lang_not_installed_default");
01939                 $this->error = true;
01940                 $this->raiseError($message,$this->error_obj->MESSAGE);
01941 
01942             }
01943             
01944             $result = $this->lng->installLanguages($_POST["form"]["lang_id"]);
01945             
01946             if (is_array($result))
01947             {
01948                 $count = count($result);
01949                 $txt = "tet";
01950                 
01951                 foreach ($result as $key => $lang_key)
01952                 {
01953                     $list .= $this->lng->txt("lang_".$lang_key);
01954                     
01955                     if ($count > $key + 1)
01956                     {
01957                         $list .= ", ";
01958                     }
01959                 }
01960             }
01961 
01962             $this->client->setDefaultLanguage($_POST["form"]["lang_default"]);
01963             $message = $this->lng->txt("languages_installed");
01964             
01965             if ($result !== true)
01966             {
01967                 $message .= "<br/>(".$this->lng->txt("langs_not_valid_not_installed").": ".$list.")";
01968             }
01969             sendInfo($message);
01970         }
01971 
01972         // output
01973         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_lang.html");
01974 
01975         $languages = $this->lng->getInstallableLanguages();
01976         $installed_langs = $this->lng->getInstalledLanguages();
01977         $default_lang = $this->client->getDefaultLanguage();
01978         
01979         $lang_count = count($installed_langs);
01980         
01981         $this->tpl->setVariable("TXT_LANG_HEADER", ucfirst($this->lng->txt("available_languages")));
01982         $this->tpl->setVariable("TXT_LANGUAGE", ucfirst($this->lng->txt("language")));
01983         $this->tpl->setVariable("TXT_INSTALLED", ucfirst($this->lng->txt("installed")));
01984         $this->tpl->setVariable("TXT_DEFAULT", ucfirst($this->lng->txt("default")));
01985 
01986         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
01987         
01988         $this->tpl->setVariable("TXT_SETUP_TITLE",ucfirst(trim($this->lng->txt("setup_languages"))));
01989         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_lang"));
01990         
01991         if ($lang_count > 0)
01992         {
01993             $this->client->status["lang"]["status"] = true;
01994             $this->client->status["lang"]["comment"] = $lang_count." ".$this->lng->txt("languages_installed");
01995         }
01996         else
01997         {
01998             $this->client->status["lang"]["status"] = false;
01999             $this->client->status["lang"]["comment"] = $this->lng->txt("lang_none_installed");
02000         }
02001 
02002         foreach ($languages as $lang_key)
02003         {
02004             $this->tpl->setCurrentBlock("language_row");
02005             $this->tpl->setVariable("LANG_KEY", $lang_key);
02006             $this->tpl->setVariable("TXT_LANG", $this->lng->txt("lang_".$lang_key));
02007             $this->tpl->setVariable("BORDER", 0);
02008             $this->tpl->setVariable("VSPACE", 0);
02009 
02010             if (in_array($lang_key,$installed_langs))
02011             {
02012                 $this->tpl->setVariable("CHECKED", ("checked=\"checked\""));        
02013             }
02014 
02015             if ($lang_key == $default_lang)
02016             {
02017                 $this->tpl->setVariable("DEFAULT", ("checked=\"checked\""));        
02018             }
02019 
02020             $this->tpl->parseCurrentBlock();
02021         }
02022         
02023         $this->setButtonPrev("db");
02024         
02025         if ($lang_count > 0)
02026         {
02027             $this->setButtonNext("contact");
02028         }
02029         
02030         $this->checkPanelMode();
02031     }
02032     
02036     function displayContactData()
02037     {
02038         $this->checkDisplayMode("setup_contact_data");
02039     
02040         $settings = $this->client->getAllSettings();
02041 
02042         // formular sent
02043         if ($_POST["form"])
02044         {
02045             //init checking var
02046             $form_valid = true;
02047 
02048             // check required fields
02049             if (empty($_POST["form"]["admin_firstname"]) or empty($_POST["form"]["admin_lastname"])
02050                 or empty($_POST["form"]["admin_street"]) or empty($_POST["form"]["admin_zipcode"])
02051                 or empty($_POST["form"]["admin_country"]) or empty($_POST["form"]["admin_city"])
02052                 or empty($_POST["form"]["admin_phone"]) or empty($_POST["form"]["admin_email"])
02053                 or empty($_POST["form"]["inst_name"]) or empty($_POST["form"]["inst_info"]))
02054             {
02055                 $form_valid = false;
02056                 $message = $this->lng->txt("fill_out_required_fields");
02057                 //$this->raiseError($message,$this->error_obj->MESSAGE);
02058                 sendInfo($message);
02059             }
02060             
02061             // admin email
02062             if (!ilUtil::is_email($_POST["form"]["admin_email"]) and $form_valid)
02063             {
02064                 $form_valid = false;
02065                 $message = $this->lng->txt("input_error").": '".$this->lng->txt("email")."'<br/>".$this->lng->txt("email_not_valid");
02066                 sendInfo($message);
02067                 //$this->raiseError($message,$this->error_obj->MESSAGE);
02068             }
02069 
02070             if (!$form_valid)   //required fields not satisfied. Set formular to already fill in values
02071             {
02073         // load user modified settings again
02074                 // contact
02075                 $settings["admin_firstname"] = ilUtil::prepareFormOutput($_POST["form"]["admin_firstname"],true);
02076                 $settings["admin_lastname"] = ilUtil::prepareFormOutput($_POST["form"]["admin_lastname"],true);
02077                 $settings["admin_title"] = ilUtil::prepareFormOutput($_POST["form"]["admin_title"],true);
02078                 $settings["admin_position"] = ilUtil::prepareFormOutput($_POST["form"]["admin_position"],true);
02079                 $settings["admin_institution"] = ilUtil::prepareFormOutput($_POST["form"]["admin_institution"],true);
02080                 $settings["admin_street"] = ilUtil::prepareFormOutput($_POST["form"]["admin_street"],true);
02081                 $settings["admin_zipcode"] = ilUtil::prepareFormOutput($_POST["form"]["admin_zipcode"],true);
02082                 $settings["admin_city"] = ilUtil::prepareFormOutput($_POST["form"]["admin_city"],true);
02083                 $settings["admin_country"] = ilUtil::prepareFormOutput($_POST["form"]["admin_country"],true);
02084                 $settings["admin_phone"] = ilUtil::prepareFormOutput($_POST["form"]["admin_phone"],true);
02085                 $settings["admin_email"] = ilUtil::prepareFormOutput($_POST["form"]["admin_email"],true);
02086 
02087                 // client
02088                 $settings["inst_name"] = ilUtil::prepareFormOutput($_POST["form"]["inst_name"],true);
02089                 $settings["inst_info"] = ilUtil::prepareFormOutput($_POST["form"]["inst_info"],true);
02090                 $settings["inst_institution"] = ilUtil::prepareFormOutput($_POST["form"]["inst_institution"],true);
02091             }
02092             else // all required fields ok
02093             {
02094 
02096         // write new settings
02097 
02098                 // contact
02099                 $this->client->setSetting("admin_firstname",ilUtil::stripSlashes($_POST["form"]["admin_firstname"]));
02100                 $this->client->setSetting("admin_lastname",ilUtil::stripSlashes($_POST["form"]["admin_lastname"]));
02101                 $this->client->setSetting("admin_title",ilUtil::stripSlashes($_POST["form"]["admin_title"]));
02102                 $this->client->setSetting("admin_position",ilUtil::stripSlashes($_POST["form"]["admin_position"]));
02103                 $this->client->setSetting("admin_institution",ilUtil::stripSlashes($_POST["form"]["admin_institution"]));
02104                 $this->client->setSetting("admin_street",ilUtil::stripSlashes($_POST["form"]["admin_street"]));
02105                 $this->client->setSetting("admin_zipcode",ilUtil::stripSlashes($_POST["form"]["admin_zipcode"]));
02106                 $this->client->setSetting("admin_city",ilUtil::stripSlashes($_POST["form"]["admin_city"]));
02107                 $this->client->setSetting("admin_country",ilUtil::stripSlashes($_POST["form"]["admin_country"]));
02108                 $this->client->setSetting("admin_phone",ilUtil::stripSlashes($_POST["form"]["admin_phone"]));
02109                 $this->client->setSetting("admin_email",ilUtil::stripSlashes($_POST["form"]["admin_email"]));
02110                 $this->client->setSetting("inst_institution",ilUtil::stripSlashes($_POST["form"]["inst_institution"]));
02111 
02112                 // update client.ini
02113                 $this->client->setName(ilUtil::stripSlashes($_POST["form"]["inst_name"]));
02114                 $this->client->setDescription(ilUtil::stripSlashes($_POST["form"]["inst_info"]));
02115                 $this->client->ini->write();
02116 
02117                 // reload settings
02118                 $settings = $this->client->getAllSettings();
02119                 // feedback
02120                 sendInfo($this->lng->txt("saved_successfully"));
02121             }
02122         }
02123 
02124         // output
02125         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_contact.html");
02126 
02127         // client values
02128         $this->tpl->setVariable("INST_NAME",ilUtil::prepareFormOutput(($this->client->getName()) ? $this->client->getName() : $this->client->getId()));
02129         $this->tpl->setVariable("INST_INFO",ilUtil::prepareFormOutput($this->client->getDescription()));
02130         $this->tpl->setVariable("INST_INSTITUTION",ilUtil::prepareFormOutput($settings["inst_institution"]));
02131 
02132         // contact values
02133         $this->tpl->setVariable("ADMIN_FIRSTNAME",ilUtil::prepareFormOutput($settings["admin_firstname"]));
02134         $this->tpl->setVariable("ADMIN_LASTNAME",ilUtil::prepareFormOutput($settings["admin_lastname"]));
02135         $this->tpl->setVariable("ADMIN_TITLE",ilUtil::prepareFormOutput($settings["admin_title"]));
02136         $this->tpl->setVariable("ADMIN_POSITION",ilUtil::prepareFormOutput($settings["admin_position"]));
02137         $this->tpl->setVariable("ADMIN_INSTITUTION",ilUtil::prepareFormOutput($settings["admin_institution"]));
02138         $this->tpl->setVariable("ADMIN_STREET",ilUtil::prepareFormOutput($settings["admin_street"]));
02139         $this->tpl->setVariable("ADMIN_ZIPCODE",ilUtil::prepareFormOutput($settings["admin_zipcode"]));
02140         $this->tpl->setVariable("ADMIN_CITY",ilUtil::prepareFormOutput($settings["admin_city"]));
02141         $this->tpl->setVariable("ADMIN_COUNTRY",ilUtil::prepareFormOutput($settings["admin_country"]));
02142         $this->tpl->setVariable("ADMIN_PHONE",ilUtil::prepareFormOutput($settings["admin_phone"]));
02143         $this->tpl->setVariable("ADMIN_EMAIL",ilUtil::prepareFormOutput($settings["admin_email"]));
02144         
02145         // client text
02146         $this->tpl->setVariable("TXT_INST_DATA", $this->lng->txt("client_data"));
02147         $this->tpl->setVariable("TXT_INST_NAME", $this->lng->txt("client_name"));
02148         $this->tpl->setVariable("TXT_INST_INFO", $this->lng->txt("client_info"));
02149         $this->tpl->setVariable("TXT_INST_INSTITUTION", $this->lng->txt("client_institution"));
02150 
02151         // contact text
02152         $this->tpl->setVariable("TXT_CONTACT_DATA", $this->lng->txt("contact_data"));
02153         $this->tpl->setVariable("TXT_REQUIRED_FIELDS", $this->lng->txt("required_field"));
02154         $this->tpl->setVariable("TXT_FIRSTNAME", $this->lng->txt("firstname"));
02155         $this->tpl->setVariable("TXT_LASTNAME", $this->lng->txt("lastname"));
02156         $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
02157         $this->tpl->setVariable("TXT_POSITION", $this->lng->txt("position"));
02158         $this->tpl->setVariable("TXT_INSTITUTION", $this->lng->txt("institution"));
02159         $this->tpl->setVariable("TXT_STREET", $this->lng->txt("street"));
02160         $this->tpl->setVariable("TXT_ZIPCODE", $this->lng->txt("zipcode"));
02161         $this->tpl->setVariable("TXT_CITY", $this->lng->txt("city"));
02162         $this->tpl->setVariable("TXT_COUNTRY", $this->lng->txt("country"));
02163         $this->tpl->setVariable("TXT_PHONE", $this->lng->txt("phone"));
02164         $this->tpl->setVariable("TXT_EMAIL", $this->lng->txt("email"));
02165         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
02166         
02167         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
02168         $this->tpl->setVariable("TXT_SETUP_TITLE","contact information & client data");
02169         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_contact"));
02170         
02171         $this->setButtonPrev("lang");
02172         
02173         $check = $this->checkClientContact($this->client);
02174 
02175         $this->client->status["contact"]["status"] = $check["status"];
02176         $this->client->status["contact"]["comment"] = $check["comment"];
02177 
02178         if ($check["status"])
02179         {
02180             $this->setButtonNext("nic");
02181         }
02182         
02183         $this->checkPanelMode();
02184     }
02185 
02189     function displayNIC()
02190     {
02191         $this->checkDisplayMode("nic_registration");
02192         $settings = $this->client->getAllSettings();
02193         $nic_key = $this->client->getNICkey();
02194         
02195         // formular sent
02196         if ($_POST["form"])
02197         {
02198             // check register option
02199             if ($_POST["form"]["register"] == 1)
02200             {
02201                 // update nic
02202                 $this->client->updateNIC($this->ilias_nic_server);
02203                 
02204                 // online registration failed
02205                 if (empty($this->client->nic_status[2]))
02206                 {
02207                     $this->client->setSetting("nic_enabled","-1");
02208                     $message = $this->lng->txt("nic_reg_failed");               
02209                 }
02210                 else
02211                 {
02212                     $this->client->setSetting("inst_id",$this->client->nic_status[2]);
02213                     $this->client->setSetting("nic_enabled","1");
02214                     $this->client->status["nic"]["status"] = true;
02215                     $message = $this->lng->txt("nic_reg_enabled");      
02216                 }
02217             }
02218             elseif ($_POST["form"]["register"] == 2)
02219             {
02220                 $nic_by_email = (int) $_POST["form"]["nic_id"];
02221                 
02222                 $checksum = md5($nic_key.$nic_by_email);
02223                 
02224                 if (!$nic_by_email or $_POST["form"]["nic_checksum"] != $checksum)
02225                 {
02226                     $message = $this->lng->txt("nic_reg_enter_correct_id");     
02227                 }
02228                 else
02229                 {
02230                     $this->client->setSetting("inst_id",$nic_by_email);
02231                     $this->client->setSetting("nic_enabled","1");
02232                     $message = $this->lng->txt("nic_reg_enabled");      
02233                 }
02234             }
02235             else
02236             {
02237                 $this->client->setSetting("inst_id","0");
02238                 $this->client->setSetting("nic_enabled","0");
02239                 $message = $this->lng->txt("nic_reg_disabled");
02240             }
02241 
02242             sendInfo($message);
02243         }
02244         
02245         // reload settings
02246         $settings = $this->client->getAllSettings();
02247         
02248         if ($settings["nic_enabled"] == "1")
02249         {
02250             $this->tpl->setVariable("TXT_INFO",$this->lng->txt("info_text_nic3")." ".$settings["inst_id"].".");
02251         }
02252         else
02253         {
02254             // reload settings
02255             $settings = $this->client->getAllSettings();
02256             
02257             $email_subject = rawurlencode("NIC registration request");
02258             $email_body = base64_encode($this->client->getURLStringForNIC($this->ilias_nic_server));
02259             $email_link = "<a href=\"mailto:ilias-nic@uni-koeln.de?subject=".$email_subject."&body=".$email_body."\">".$this->lng->txt("email")."</a>";
02260 
02261             $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_nic1")." ".$email_link." ".$this->lng->txt("info_text_nic2"));
02262 
02263             // output
02264             $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_nic.html");
02265     
02266             $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
02267     
02268             // register form
02269             $this->tpl->setVariable("TXT_NIC_ENTER_ID",$this->lng->txt("nic_reg_enter_id"));
02270             $this->tpl->setVariable("TXT_NIC_ENTER_CHECKSUM",$this->lng->txt("nic_reg_enter_checksum"));
02271             $this->tpl->setVariable("TXT_NIC_REGISTER",$this->lng->txt("nic_registration"));
02272             $this->tpl->setVariable("TXT_NIC_ENABLE",$this->lng->txt("nic_reg_online"));
02273             $this->tpl->setVariable("TXT_NIC_EMAIL",$this->lng->txt("nic_reg_email"));
02274             $this->tpl->setVariable("TXT_NIC_DISABLE",$this->lng->txt("nic_reg_disable")." <span class=\"subtitle\">".$this->lng->txt("nic_reg_disable_comment")."</span>");
02275     
02276             $checked = "checked=\"checked\"";
02277             
02278             if (!isset($settings["nic_enabled"]) or $settings["nic_enabled"] == "1")
02279             {
02280                 $this->tpl->setVariable("ENABLED",$checked);
02281             }
02282             elseif ($settings["nic_enabled"] == "2")
02283             {
02284                 $this->tpl->setVariable("EMAIL",$checked);
02285             }
02286             else
02287             {
02288                 $this->tpl->setVariable("DISABLED",$checked);
02289             }
02290     
02291             if (isset($settings["nic_enabled"]))
02292             {
02293                 $this->client->status["nic"]["status"] = true;
02294             }
02295         }
02296 
02297         $this->setButtonPrev("contact");
02298         
02299         if ($this->client->status["nic"]["status"])
02300         {
02301             $this->setButtonNext("finish","finish");
02302         }
02303         
02304         $this->checkPanelMode();
02305     }
02306     
02310     function changeMasterPassword()
02311     {
02312         $this->tpl->addBlockFile("CONTENT","content","tpl.std_layout.html");
02313         
02314         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_password"));
02315 
02316         // formular sent
02317         if ($_POST["form"])
02318         {
02319             $pass_old = $this->getPassword();
02320 
02321             if (empty($_POST["form"]["pass_old"]))
02322             {
02323                 $message = $this->lng->txt("password_enter_old");
02324                 $this->raiseError($message,$this->error_obj->MESSAGE);
02325             }
02326                 
02327             if (md5($_POST["form"]["pass_old"]) != $pass_old)
02328             {
02329                 $message = $this->lng->txt("password_old_wrong");
02330                 $this->raiseError($message,$this->error_obj->MESSAGE);
02331             }
02332             
02333             if (empty($_POST["form"]["pass"]))
02334             {
02335                 $message = $this->lng->txt("password_empty");
02336                 $this->raiseError($message,$this->error_obj->MESSAGE);
02337             }
02338             
02339             if ($_POST["form"]["pass"] != $_POST["form"]["pass2"])
02340             {
02341                 $message = $this->lng->txt("password_not_match");
02342                 $this->raiseError($message,$this->error_obj->MESSAGE);
02343             }
02344             
02345             if (md5($_POST["form"]["pass"]) == $pass_old)
02346             {
02347                 $message = $this->lng->txt("password_same");
02348                 $this->raiseError($message,$this->error_obj->MESSAGE);
02349             }
02350             
02351             if (!$this->setPassword($_POST["form"]["pass"]))
02352             {
02353                 $message = $this->lng->txt("save_error");
02354                 $this->raiseError($message,$this->error_obj->MESSAGE);
02355             }
02356 
02357             sendInfo($this->lng->txt("password_changed"),true);
02358             ilUtil::redirect("setup.php");
02359         }
02360         
02361         // output
02362         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.form_change_admin_password.html");
02363 
02364         $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("password_new_master"));
02365 
02366         // pass form
02367         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
02368         $this->tpl->setVariable("TXT_REQUIRED_FIELDS", $this->lng->txt("required_field"));
02369         $this->tpl->setVariable("TXT_PASS_TITLE",$this->lng->txt("change_password"));
02370         $this->tpl->setVariable("TXT_PASS_OLD",$this->lng->txt("set_oldpasswd"));
02371         $this->tpl->setVariable("TXT_PASS",$this->lng->txt("set_newpasswd"));
02372         $this->tpl->setVariable("TXT_PASS2",$this->lng->txt("password_retype"));
02373         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
02374     }
02375 
02379     function displayFinishSetup()
02380     {
02381         $this->checkDisplayMode("finish_setup");
02382 
02383         if ($this->validateSetup())
02384         {
02385             $txt_info = $this->lng->txt("info_text_finish1");
02386             $this->setButtonNext("login_new","login");
02387             $this->client->setSetting("setup_ok",1);
02388             $this->client->status["finish"]["status"] = true;
02389         }
02390         else
02391         {
02392             $txt_info = $this->lng->txt("info_text_finish2");
02393         }
02394         
02395         // output
02396         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_finish.html");
02397         $this->tpl->setVariable("TXT_INFO",$txt_info);
02398         
02399         $this->setButtonPrev("nic");
02400         
02401         $this->checkPanelMode();
02402     }
02403     
02407     function displayDeleteConfirmation()
02408     {
02409         $this->checkDisplayMode();
02410 
02411         // formular sent
02412         if ($_POST["form"]["delete"])
02413         {
02414             $ini = true;
02415             $db = false;
02416             $files = false;
02417         
02418             /* disabled
02419             switch ($_POST["form"]["delete"])
02420             {
02421                 case 1:
02422                     $ini = true;
02423                     break;
02424             
02425                 case 2:
02426                     $ini = true;
02427                     $db = true;
02428                     break;
02429 
02430                 case 3:
02431                     $ini = true;
02432                     $db = true;
02433                     $files = true;
02434                     break;      
02435             }
02436             */
02437             
02438             $msg = $this->client->delete($ini,$db,$files);
02439 
02440             sendInfo($this->lng->txt("client_deleted"),true);
02441             ilUtil::redirect("setup.php");
02442         }
02443 
02444         $this->tpl->setVariable("TXT_INFO", $this->lng->txt("info_text_delete"));
02445         
02446         // output
02447         $this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.form_delete_client.html");
02448 
02449         // delete panel
02450         $this->tpl->setVariable("FORMACTION", "setup.php?cmd=gateway");
02451         $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("delete"));
02452         $this->tpl->setVariable("TXT_DELETE_CONFIRM", $this->lng->txt("delete_confirm"));
02453         $this->tpl->setVariable("TXT_DELETE_INFO", $this->lng->txt("delete_info"));
02454 
02455         $this->checkPanelMode();
02456     }
02457     
02462     function changeAccessMode($a_back)
02463     {
02464         if ($this->client->status["finish"]["status"])
02465         {
02466             $val = ($this->client->ini->readVariable("client","access")) ? "0" : true;
02467             $this->client->ini->setVariable("client","access",$val);
02468             $this->client->ini->write();
02469             $message = "client_access_mode_changed";
02470         }
02471         else
02472         {
02473             $message = "client_setup_not_finished";
02474         }
02475         
02476         sendInfo($this->lng->txt($message),true);
02477         
02478         ilUtil::redirect("setup.php?cmd=".$a_back);
02479     }
02480     
02484     function changeDefaultClient()
02485     {
02486         if ($_POST["form"])
02487         {
02488             $client = new ilClient($_POST["form"]["default"]);
02489 
02490             if (!$client->init())
02491             {
02492                 $this->raiseError($this->lng->txt("no_valid_client_id"),$this->error_obj->MESSAGE);
02493             }
02494             
02495             $status = $this->getStatus($client);
02496         
02497             if ($status["finish"]["status"])
02498             {
02499                 $this->ini->setVariable("clients","default",$client->getId());
02500                 $this->ini->write();
02501                 $message = "default_client_changed";
02502             }
02503             else
02504             {
02505                 $message = "client_setup_not_finished";
02506             }
02507         }
02508         
02509         sendInfo($this->lng->txt($message),true);
02510         
02511         ilUtil::redirect("setup.php");
02512     }
02513 
02518     function validateSetup()
02519     {
02520         foreach ($this->client->status as $key => $val)
02521         {
02522             if ($key != "finish" and $key != "access")
02523             {
02524                 if ($val["status"] != true)
02525                 {
02526                     return false;
02527                 }
02528             }
02529         }
02530         
02531         $clientlist = new ilClientList();
02532         $list = $clientlist->getClients();
02533         
02534         if (count($list) == 1)
02535         {
02536             $this->ini->setVariable("clients","default",$this->client->getId());
02537             $this->ini->write();
02538 
02539             $this->client->ini->setVariable("client","access",1);
02540             $this->client->ini->write();
02541         }
02542 
02543         return true;
02544     }
02545     
02549     function jumpToFirstUnfinishedSetupStep()
02550     {
02551         if (!$this->client->status["db"]["status"])
02552         {
02553             $this->cmd = "db";
02554             sendInfo($this->lng->txt("finish_initial_setup_first"),true);
02555             $this->displayDatabase();
02556         }
02557         elseif (!$this->client->status["lang"]["status"])
02558         {
02559             $this->cmd = "lang";
02560             sendInfo($this->lng->txt("finish_initial_setup_first"),true);
02561             $this->displayLanguages();      
02562         }
02563         elseif (!$this->client->status["contact"]["status"])
02564         {
02565             $this->cmd = "contact";
02566             sendInfo($this->lng->txt("finish_initial_setup_first"),true);
02567             $this->displayContactData();        
02568         }
02569         elseif (!$this->client->status["nic"]["status"])
02570         {
02571             $this->cmd = "nic";
02572             sendInfo($this->lng->txt("finish_initial_setup_first"),true);
02573             $this->displayNIC();        
02574         }
02575         elseif (!$this->client->status["finish"]["status"])
02576         {
02577             $this->cmd = "finish";
02578             sendInfo($this->lng->txt("finish_initial_setup_first"),true);
02579             $this->displayFinishSetup();        
02580         }
02581         else
02582         {
02583             return false;
02584         }
02585     }
02586 
02590     function toggleClientList()
02591     {
02592         if ($this->ini->readVariable("clients","list"))
02593         {
02594             $this->ini->setVariable("clients","list","0");
02595             $this->ini->write();
02596             sendInfo($this->lng->txt("list_disabled"),true);
02597         }
02598         else
02599         {
02600             $this->ini->setVariable("clients","list","1");
02601             $this->ini->write();
02602             sendInfo($this->lng->txt("list_enabled"),true);             
02603         }
02604         
02605         ilUtil::redirect("setup.php");
02606     }
02607 } // END class.ilSetupGUI
02608 ?>

Generated on Fri Dec 13 2013 09:06:37 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1