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

Generated on Fri Dec 13 2013 10:18:32 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1