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

login.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 
00024 
00035 // get pear
00036 include("include/inc.get_pear.php");
00037 
00038 // start correct client
00039 // if no client_id is given, default client is loaded (in class.ilias.php)
00040 if (isset($_GET["client_id"]))
00041 {       
00042         setcookie("ilClientId",$_GET["client_id"]);
00043         $_COOKIE["ilClientId"] = $_GET["client_id"];
00044 }
00045 
00046 require_once "include/inc.check_pear.php";
00047 require_once "include/inc.header.php";
00048 
00049 // check correct setup
00050 if (!$ilias->getSetting("setup_ok"))
00051 {
00052         echo "setup is not completed. Please run setup routine again. (login.php)";
00053         exit();
00054 }
00055 
00056 // check for auth
00057 if ($ilias->auth->getAuth())
00058 {
00059 
00060         
00061         if(!$ilias->account->checkTimeLimit())
00062         {
00063                 $ilias->auth->logout();
00064                 session_destroy();
00065                 ilUtil::redirect('login.php?time_limit=true');
00066         }
00067 
00068         if ($ilias->getSetting("chat_active"))
00069         {
00070                 include_once "./chat/classes/class.ilChatServerCommunicator.php";
00071                 ilChatServerCommunicator::_login();
00072         }
00073         
00074         // UPDATE LAST FORUM VISIT
00075         include_once './classes/class.ilObjForum.php';
00076 
00077         ilObjForum::_updateOldAccess($ilUser->getId());
00078         
00079         $return_to = "start.php";
00080         
00081         if (!empty($_GET["return_to"]))
00082         {
00083                 $return_to = urldecode($_GET["return_to"]);
00084         }
00085 
00086         ilUtil::redirect($return_to);
00087 }
00088 
00089 //instantiate login template
00090 $tpl->addBlockFile("CONTENT", "content", "tpl.login.html");
00091 
00092 //language handling
00093 if ($_GET["lang"] == "")
00094 {
00095         $_GET["lang"] = $ilias->ini->readVariable("language","default");
00096 }
00097 
00098 //instantiate language
00099 $lng = new ilLanguage($_GET["lang"]);
00100 
00101 // catch reload
00102 if ($_GET["reload"])
00103 {
00104     if ($_GET["inactive"])
00105     {
00106         $tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./login.php?inactive=true\";\n</script>\n");
00107     }
00108     else
00109     {
00110         $tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./login.php?expired=true\";\n</script>\n");
00111     }
00112 }
00113 
00114 $languages = $lng->getInstalledLanguages();
00115 
00116 foreach ($languages as $lang_key)
00117 {
00118         $tpl->setCurrentBlock("languages");
00119         $tpl->setVariable("LANG_KEY", $lang_key);
00120         $tpl->setVariable("LANG_NAME", $lng->txt("lang_".$lang_key));
00121         $tpl->setVariable("BORDER", 0);
00122         $tpl->setVariable("VSPACE", 0);
00123         $tpl->parseCurrentBlock();
00124 }
00125 
00126 // allow new registrations? Surpress option if Authmode is not local database
00127 if ($ilias->getSetting("enable_registration") and AUTH_CURRENT == AUTH_LOCAL)
00128 {
00129         $tpl->setCurrentBlock("new_registration");
00130         $tpl->setVariable("REGISTER", $lng->txt("registration"));
00131         $tpl->setVariable("LANG_ID", $_GET["lang"]);
00132         $tpl->parseCurrentBlock();
00133 }
00134 // allow password assistance? Surpress option if Authmode is not local database
00135 if ($ilias->getSetting("password_assistance") and AUTH_CURRENT == AUTH_LOCAL)
00136 {
00137         $tpl->setCurrentBlock("password_assistance");
00138         $tpl->setVariable("FORGOT_PASSWORD", $lng->txt("forgot_password"));
00139         $tpl->setVariable("LANG_ID", $_GET["lang"]);
00140         $tpl->parseCurrentBlock();
00141 }
00142 
00143 $tpl->setVariable("ILIAS_RELEASE", $ilias->getSetting("ilias_version"));
00144 $tpl->setVariable("TXT_ILIAS_LOGIN", $lng->txt("login_to_ilias"));
00145 $tpl->setVariable("FORMACTION", "login.php");
00146 $tpl->setVariable("TXT_USERNAME", $lng->txt("username"));
00147 $tpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
00148 $tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
00149 $tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
00150 $tpl->setVariable("LANG_ID", $_GET["lang"]);
00151 
00152 if ($_GET["inactive"])
00153 {
00154     $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_inactive"));
00155 }
00156 elseif ($_GET["expired"])
00157 {
00158     $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_session_expired"));
00159 }
00160 
00161 // TODO: Move this to header.inc since an expired session could not detected in login script 
00162 $status = $ilias->auth->getStatus();
00163 
00164 if (!empty($status))
00165 {
00166         switch ($status)
00167         {
00168                 case AUTH_EXPIRED:
00169                         $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_session_expired"));
00170                         break;
00171                 case AUTH_IDLED:
00172                         // lang variable err_idled not existing
00173                         //$tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_idled"));
00174                         break;
00175                 case AUTH_WRONG_LOGIN:
00176                 default:
00177                         $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_wrong_login"));
00178                         break;
00179         }
00180 }
00181 if($_GET['time_limit'])
00182 {
00183         $tpl->setVariable("TXT_MSG_LOGIN_FAILED",$lng->txt('time_limit_reached'));
00184 }
00185 
00186 $tpl->setVariable("PHP_SELF", $_SERVER['PHP_SELF']);
00187 $tpl->setVariable("USERNAME", $_POST["username"]);
00188 $tpl->setVariable("USER_AGREEMENT", $lng->txt("usr_agreement"));
00189 
00190 $tpl->show(false);
00191 ?>

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