00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00035
00036 include("include/inc.get_pear.php");
00037
00038
00039
00040 if ($_POST["lang"] != "")
00041 {
00042 $_GET["lang"] = $_POST["lang"];
00043 }
00044
00045
00046 if (!isset($_COOKIE['iltest']))
00047 {
00048 if (empty($_GET['cookies']))
00049 {
00050 setcookie("iltest","cookie");
00051 header('Location: '.$_SERVER['PHP_SELF']."?cookies=nocookies&lang=".$_GET['lang']);
00052 }
00053 else
00054 {
00055 $_COOKIE['iltest'] = "";
00056 }
00057 }
00058 else
00059 {
00060 unset($_GET['cookies']);
00061 }
00062
00063
00064
00065 if (isset($_GET["client_id"]))
00066 {
00067 setcookie("ilClientId",$_GET["client_id"]);
00068 $_COOKIE["ilClientId"] = $_GET["client_id"];
00069 }
00070
00071 require_once "include/inc.check_pear.php";
00072 require_once "include/inc.header.php";
00073
00074
00075
00076 if (!$ilias->getSetting("setup_ok"))
00077 {
00078 echo "setup is not completed. Please run setup routine again. (login.php)";
00079 exit();
00080 }
00081
00082
00083 if ($ilias->auth->getAuth())
00084 {
00085 if(!$ilias->account->checkTimeLimit())
00086 {
00087 $ilias->auth->logout();
00088 session_destroy();
00089 ilUtil::redirect('login.php?time_limit=true');
00090 }
00091
00092 include_once './Services/Tracking/classes/class.ilOnlineTracking.php';
00093
00094 ilOnlineTracking::_addUser($ilUser->getId());
00095
00096 if ($ilias->getSetting("chat_active"))
00097 {
00098 include_once "./chat/classes/class.ilChatServerCommunicator.php";
00099 include_once "./chat/classes/class.ilChatRoom.php";
00100
00101 ilChatServerCommunicator::_login();
00102 ilChatRoom::_unkick($ilUser->getId());
00103 }
00104
00105
00106 include_once './classes/class.ilObjForum.php';
00107
00108 ilObjForum::_updateOldAccess($ilUser->getId());
00109
00110 $return_to = "start.php";
00111
00112 if ($_GET["rep_ref_id"] != "")
00113 {
00114 $return_to.= "?script=".rawurlencode("repository.php?cmd=frameset&ref_id=".$_GET["rep_ref_id"]);
00115 }
00116
00117 if (!empty($_GET["return_to"]))
00118 {
00119 $return_to = urldecode($_GET["return_to"]);
00120 }
00121
00122 ilUtil::redirect($return_to);
00123 }
00124
00125
00126
00127 if ($ilias->getSetting("auth_mode") == AUTH_SHIBBOLETH)
00128 {
00129 $tpl->addBlockFile("CONTENT", "content", "tpl.login.shib_only.html");
00130 }
00131
00132 elseif ($ilias->getSetting("shib_active"))
00133 {
00134 $tpl->addBlockFile("CONTENT", "content", "tpl.login.dual.html");
00135 }
00136 else
00137 {
00138 $tpl->addBlockFile("CONTENT", "content", "tpl.login.html");
00139 }
00140
00141
00142 if ($_GET["lang"] == "")
00143 {
00144 $_GET["lang"] = $ilias->ini->readVariable("language","default");
00145 }
00146
00147
00148
00149 $lng = new ilLanguage($_GET["lang"]);
00150
00151
00152 if ($_GET["reload"])
00153 {
00154 if ($_GET["inactive"])
00155 {
00156 $tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./login.php?inactive=true\";\n</script>\n");
00157 }
00158 else
00159 {
00160 $tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./login.php?expired=true\";\n</script>\n");
00161 }
00162 }
00163
00164
00165 $tpl->setVariable("TXT_OK", $lng->txt("ok"));
00166
00167 $languages = $lng->getInstalledLanguages();
00168
00169 foreach ($languages as $lang_key)
00170 {
00171 $tpl->setCurrentBlock("languages");
00172 $tpl->setVariable("LANG_KEY", $lang_key);
00173 $tpl->setVariable("LANG_NAME",
00174 ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
00175 $tpl->setVariable("BORDER", 0);
00176 $tpl->setVariable("VSPACE", 0);
00177 $tpl->parseCurrentBlock();
00178 }
00179
00180
00181 if ($ilias->getSetting("enable_registration"))
00182 {
00183 $tpl->setCurrentBlock("new_registration");
00184 $tpl->setVariable("REGISTER", $lng->txt("registration"));
00185 $tpl->setVariable("LANG_ID", $_GET["lang"]);
00186 $tpl->parseCurrentBlock();
00187 }
00188
00189 if ($ilias->getSetting("password_assistance") and AUTH_DEFAULT == AUTH_LOCAL)
00190 {
00191 $tpl->setCurrentBlock("password_assistance");
00192 $tpl->setVariable("FORGOT_PASSWORD", $lng->txt("forgot_password"));
00193 $tpl->setVariable("FORGOT_USERNAME", $lng->txt("forgot_username"));
00194 $tpl->setVariable("LANG_ID", $_GET["lang"]);
00195 $tpl->parseCurrentBlock();
00196 }
00197
00198 if ($ilias->getSetting("pub_section"))
00199 {
00200 $tpl->setCurrentBlock("homelink");
00201 $tpl->setVariable("CLIENT_ID","?client_id=".$_COOKIE["ilClientId"]."&lang=".$_GET["lang"]);
00202 $tpl->setVariable("TXT_HOME",$lng->txt("home"));
00203 $tpl->parseCurrentBlock();
00204 }
00205
00206 if ($ilias->ini_ilias->readVariable("clients","list"))
00207 {
00208 $tpl->setCurrentBlock("client_list");
00209 $tpl->setVariable("TXT_CLIENT_LIST",$lng->txt("to_client_list"));
00210 $tpl->parseCurrentBlock();
00211 }
00212
00213 $tpl->setVariable("ILIAS_RELEASE", $ilias->getSetting("ilias_version"));
00214 $tpl->setVariable("TXT_SHIB_LOGIN", $lng->txt("login_to_ilias_via_shibboleth"));
00215 $tpl->setVariable("TXT_SHIB_LOGIN_BUTTON", $ilias->getSetting("shib_login_button"));
00216 $tpl->setVariable("TXT_SHIB_LOGIN_INSTRUCTIONS", $ilias->getSetting("shib_login_instructions"));
00217 $tpl->setVariable("TXT_ILIAS_LOGIN", $lng->txt("login_to_ilias"));
00218 $tpl->setVariable("FORMACTION", "login.php?rep_ref_id=".$_GET["rep_ref_id"]);
00219 $tpl->setVariable("TXT_USERNAME", $lng->txt("username"));
00220 $tpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
00221 $tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
00222 $tpl->setVariable("LANG_FORM_ACTION", "login.php?rep_ref_id=".$_GET["rep_ref_id"]);
00223 $tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
00224 $tpl->setVariable("LANG_ID", $_GET["lang"]);
00225
00226 if ($_GET["inactive"])
00227 {
00228 $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_inactive"));
00229 }
00230 elseif ($_GET["expired"])
00231 {
00232 $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_session_expired"));
00233 }
00234
00235
00236 $status = $ilias->auth->getStatus();
00237 $auth_error = $ilias->getAuthError();
00238
00239 if (!empty($status))
00240 {
00241 switch ($status)
00242 {
00243 case AUTH_EXPIRED:
00244 $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_session_expired"));
00245 break;
00246 case AUTH_IDLED:
00247
00248
00249 break;
00250 case AUTH_WRONG_LOGIN:
00251 default:
00252 $add = "";
00253 if (is_object($auth_error))
00254 {
00255 $add = "<br>".$auth_error->getMessage();
00256 }
00257 $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_wrong_login").$add);
00258 break;
00259 }
00260 }
00261
00262
00263 if($_GET['time_limit'])
00264 {
00265 $tpl->setVariable("TXT_MSG_LOGIN_FAILED",$lng->txt('time_limit_reached'));
00266 }
00267
00268
00269 if($_GET['wrong_ip'])
00270 {
00271 $tpl->setVariable("TXT_MSG_LOGIN_FAILED", $lng->txt('wrong_ip_detected')." (".$_SERVER["REMOTE_ADDR"].")");
00272 }
00273
00274 $tpl->setVariable("PHP_SELF", $_SERVER['PHP_SELF']);
00275 $tpl->setVariable("USERNAME", $_POST["username"]);
00276 $tpl->setVariable("USER_AGREEMENT", $lng->txt("usr_agreement"));
00277
00278
00279 if ($_GET['cookies'] == 'nocookies')
00280 {
00281 $tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_no_cookies"));
00282 $tpl->setVariable("COOKIES_HOWTO", $lng->txt("cookies_howto"));
00283 }
00284
00285 $tpl->show(false);
00286 ?>