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

Generated on Fri Dec 13 2013 08:00:18 for ILIAS Release_3_3_x_branch .rev 46803 by  doxygen 1.7.1