[ PHPXref.com ] [ Generated: Thu Jul 24 15:16:34 2008 ] [ ILIAS 3.6.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> login.php (source)

   1  <?php
   2  /*
   3      +-----------------------------------------------------------------------------+
   4      | ILIAS open source                                                           |
   5      +-----------------------------------------------------------------------------+
   6      | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
   7      |                                                                             |
   8      | This program is free software; you can redistribute it and/or               |
   9      | modify it under the terms of the GNU General Public License                 |
  10      | as published by the Free Software Foundation; either version 2              |
  11      | of the License, or (at your option) any later version.                      |
  12      |                                                                             |
  13      | This program is distributed in the hope that it will be useful,             |
  14      | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
  15      | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
  16      | GNU General Public License for more details.                                |
  17      |                                                                             |
  18      | You should have received a copy of the GNU General Public License           |
  19      | along with this program; if not, write to the Free Software                 |
  20      | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
  21      +-----------------------------------------------------------------------------+
  22  */
  23  
  24  
  25  /**
  26  * login script for ilias
  27  *
  28  * @author Sascha Hofmann <saschahofmann@gmx.de>
  29  * @author Peter Gabriel <pgabriel@databay.de>
  30  * @version $Id: login.php,v 1.65.2.1 2006/04/18 14:14:39 shofmann Exp $
  31  *
  32  * @package ilias-layout
  33  */
  34  
  35  // get pear
  36  include ("include/inc.get_pear.php");
  37  
  38  
  39  // login language selection is post type
  40  if ($_POST["lang"] != "")
  41  {
  42      $_GET["lang"] = $_POST["lang"];
  43  }
  44  
  45  // check for session cookies enabled
  46  if (!isset($_COOKIE['iltest']))
  47  {
  48      if (empty($_GET['cookies']))
  49      {
  50          setcookie("iltest","cookie");
  51          header('Location: '.$_SERVER['PHP_SELF']."?cookies=nocookies&lang=".$_GET['lang']);
  52      }
  53      else
  54      {
  55          $_COOKIE['iltest'] = "";
  56      }
  57  }
  58  else
  59  {
  60      unset($_GET['cookies']);
  61  }
  62  
  63  // start correct client
  64  // if no client_id is given, default client is loaded (in class.ilias.php)
  65  if (isset($_GET["client_id"]))
  66  {    
  67      setcookie("ilClientId",$_GET["client_id"]);
  68      $_COOKIE["ilClientId"] = $_GET["client_id"];
  69  }
  70  
  71  require_once  "include/inc.check_pear.php";
  72  require_once  "include/inc.header.php";
  73  
  74  
  75  // check correct setup
  76  if (!$ilias->getSetting("setup_ok"))
  77  {
  78      echo "setup is not completed. Please run setup routine again. (login.php)";
  79      exit();
  80  }
  81  
  82  // check for auth
  83  if ($ilias->auth->getAuth())
  84  {
  85      if(!$ilias->account->checkTimeLimit())
  86      {
  87          $ilias->auth->logout();
  88          session_destroy();
  89          ilUtil::redirect('login.php?time_limit=true');
  90      }
  91  
  92      include_once  './Services/Tracking/classes/class.ilOnlineTracking.php';
  93  
  94      ilOnlineTracking::_addUser($ilUser->getId());
  95  
  96      if ($ilias->getSetting("chat_active"))
  97      {
  98          include_once  "./chat/classes/class.ilChatServerCommunicator.php";
  99          include_once  "./chat/classes/class.ilChatRoom.php";
 100  
 101          ilChatServerCommunicator::_login();
 102          ilChatRoom::_unkick($ilUser->getId());
 103      }
 104  
 105      // UPDATE LAST FORUM VISIT
 106      include_once  './classes/class.ilObjForum.php';
 107  
 108      ilObjForum::_updateOldAccess($ilUser->getId());
 109  
 110      $return_to = "start.php";
 111  
 112      if ($_GET["rep_ref_id"] != "")
 113      {
 114          $return_to.= "?script=".rawurlencode("repository.php?cmd=frameset&ref_id=".$_GET["rep_ref_id"]);
 115      }
 116  
 117      if (!empty($_GET["return_to"]))
 118      {
 119          $return_to = urldecode($_GET["return_to"]);
 120      }
 121  
 122      ilUtil::redirect($return_to);
 123  }
 124  
 125  // Instantiate login template
 126  // Use Shibboleth-only authentication if auth_mode is set to Shibboleth
 127  if ($ilias->getSetting("auth_mode") == AUTH_SHIBBOLETH)
 128  {
 129      $tpl->addBlockFile("CONTENT", "content", "tpl.login.shib_only.html");
 130  }
 131  // Use dual login template if Shibboleth is configured and enabled
 132  elseif ($ilias->getSetting("shib_active"))
 133  {
 134      $tpl->addBlockFile("CONTENT", "content", "tpl.login.dual.html");
 135  }
 136  else
 137  {
 138      $tpl->addBlockFile("CONTENT", "content", "tpl.login.html");
 139  }
 140  
 141  //language handling
 142  if ($_GET["lang"] == "")
 143  {
 144      $_GET["lang"] = $ilias->ini->readVariable("language","default");
 145  }
 146  
 147  
 148  //instantiate language
 149  $lng = new ilLanguage($_GET["lang"]);
 150  
 151  // catch reload
 152  if ($_GET["reload"])
 153  {
 154      if ($_GET["inactive"])
 155      {
 156          $tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./login.php?inactive=true\";\n</script>\n");
 157      }
 158      else
 159      {
 160          $tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./login.php?expired=true\";\n</script>\n");
 161      }
 162  }
 163  
 164  
 165  $tpl->setVariable("TXT_OK", $lng->txt("ok"));
 166  
 167  $languages = $lng->getInstalledLanguages();
 168  
 169  foreach ($languages as $lang_key)
 170  {
 171      $tpl->setCurrentBlock("languages");
 172      $tpl->setVariable("LANG_KEY", $lang_key);
 173      $tpl->setVariable("LANG_NAME",
 174          ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
 175      $tpl->setVariable("BORDER", 0);
 176      $tpl->setVariable("VSPACE", 0);
 177      $tpl->parseCurrentBlock();
 178  }
 179  
 180  // allow new registrations? 
 181  if ($ilias->getSetting("enable_registration"))
 182  {
 183      $tpl->setCurrentBlock("new_registration");
 184      $tpl->setVariable("REGISTER", $lng->txt("registration"));
 185      $tpl->setVariable("LANG_ID", $_GET["lang"]);
 186      $tpl->parseCurrentBlock();
 187  }
 188  // allow password assistance? Surpress option if Authmode is not local database
 189  if ($ilias->getSetting("password_assistance") and AUTH_DEFAULT == AUTH_LOCAL)
 190  {
 191      $tpl->setCurrentBlock("password_assistance");
 192      $tpl->setVariable("FORGOT_PASSWORD", $lng->txt("forgot_password"));
 193      $tpl->setVariable("FORGOT_USERNAME", $lng->txt("forgot_username"));
 194      $tpl->setVariable("LANG_ID", $_GET["lang"]);
 195      $tpl->parseCurrentBlock();
 196  }
 197  
 198  if ($ilias->getSetting("pub_section"))
 199  {
 200      $tpl->setCurrentBlock("homelink");
 201      $tpl->setVariable("CLIENT_ID","?client_id=".$_COOKIE["ilClientId"]."&lang=".$_GET["lang"]);
 202      $tpl->setVariable("TXT_HOME",$lng->txt("home"));
 203      $tpl->parseCurrentBlock();
 204  }
 205  
 206  if ($ilias->ini_ilias->readVariable("clients","list"))
 207  {
 208      $tpl->setCurrentBlock("client_list");
 209      $tpl->setVariable("TXT_CLIENT_LIST",$lng->txt("to_client_list"));
 210      $tpl->parseCurrentBlock();    
 211  }
 212  
 213  $tpl->setVariable("ILIAS_RELEASE", $ilias->getSetting("ilias_version"));
 214  $tpl->setVariable("TXT_SHIB_LOGIN", $lng->txt("login_to_ilias_via_shibboleth"));
 215  $tpl->setVariable("TXT_SHIB_LOGIN_BUTTON", $ilias->getSetting("shib_login_button"));
 216  $tpl->setVariable("TXT_SHIB_LOGIN_INSTRUCTIONS", $ilias->getSetting("shib_login_instructions"));
 217  $tpl->setVariable("TXT_ILIAS_LOGIN", $lng->txt("login_to_ilias"));
 218  $tpl->setVariable("FORMACTION", "login.php?rep_ref_id=".$_GET["rep_ref_id"]);
 219  $tpl->setVariable("TXT_USERNAME", $lng->txt("username"));
 220  $tpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
 221  $tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
 222  $tpl->setVariable("LANG_FORM_ACTION", "login.php?rep_ref_id=".$_GET["rep_ref_id"]);
 223  $tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
 224  $tpl->setVariable("LANG_ID", $_GET["lang"]);
 225  
 226  if ($_GET["inactive"])
 227  {
 228      $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_inactive"));
 229  }
 230  elseif ($_GET["expired"])
 231  {
 232      $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_session_expired"));
 233  }
 234  
 235  // TODO: Move this to header.inc since an expired session could not detected in login script 
 236  $status = $ilias->auth->getStatus();
 237  $auth_error = $ilias->getAuthError();
 238  
 239  if (!empty($status))
 240  {
 241      switch ($status)
 242      {
 243          case AUTH_EXPIRED:
 244              $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_session_expired"));
 245              break;
 246          case AUTH_IDLED:
 247              // lang variable err_idled not existing
 248              //$tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_idled"));
 249              break;
 250          case AUTH_WRONG_LOGIN:
 251          default:
 252              $add = "";
 253              if (is_object($auth_error))
 254              {
 255                  $add = "<br>".$auth_error->getMessage();
 256              }
 257              $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_wrong_login").$add);            
 258              break;
 259      }
 260  }
 261  
 262  
 263  if($_GET['time_limit'])
 264  {
 265      $tpl->setVariable("TXT_MSG_LOGIN_FAILED",$lng->txt('time_limit_reached'));
 266  }
 267  
 268  // output wrong IP message
 269  if($_GET['wrong_ip'])
 270  {
 271      $tpl->setVariable("TXT_MSG_LOGIN_FAILED", $lng->txt('wrong_ip_detected')." (".$_SERVER["REMOTE_ADDR"].")");
 272  }
 273  
 274  $tpl->setVariable("PHP_SELF", $_SERVER['PHP_SELF']);
 275  $tpl->setVariable("USERNAME", $_POST["username"]);
 276  $tpl->setVariable("USER_AGREEMENT", $lng->txt("usr_agreement"));
 277  
 278  // browser does not accept cookies
 279  if ($_GET['cookies'] == 'nocookies')
 280  {
 281      $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_no_cookies"));
 282      $tpl->setVariable("COOKIES_HOWTO", $lng->txt("cookies_howto"));
 283  }
 284  
 285  $tpl->show(false);
 286  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]