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

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