* * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ /* $Id$ */ $phpgw_info["flags"] = array("disable_template_class" => True, "login" => True, "currentapp" => "login", "noheader" => True); include("./header.inc.php"); $deny_login = False; /* if ($code != 10 && $phpgw_info["server"]["usecookies"] == False) { Setcookie("sessionid"); Setcookie("kp3"); Setcookie("domain"); } */ /* This is not working yet because I need to figure out a way to clear the $cd =1 if(isset($PHP_AUTH_USER) && $cd == "1") { Header("HTTP/1.0 401 Unauthorized"); Header("WWW-Authenticate: Basic realm=\"phpGroupWare\""); echo "You have to re-authentificate yourself \n"; exit; } */ $phpgw_info["server"]["template_dir"] = $phpgw_info["server"]["server_root"]."/phpgwapi/templates/default"; $tmpl = new Template($phpgw_info["server"]["template_dir"]); if (! $deny_login && ! $phpgw_info["server"]["show_domain_selectbox"]) { $tmpl->set_file(array("login_form" => "login.tpl")); } else if ($phpgw_info["server"]["show_domain_selectbox"]) { $tmpl->set_file(array("login_form" => "login_selectdomain.tpl")); } else { $tmpl->set_file(array("login_form" => "login_denylogin.tpl")); } // When I am updating my server, I don't want people logging in a messing // things up. function deny_login() { global $tmpl; $tmpl->parse("loginout", "login_form"); $tmpl->p("loginout"); exit; } function show_cookie() { global $phpgw_info, $code, $last_loginid, $login; /* This needs to be this way, because if someone doesnt want to use cookies, we shouldnt sneak one in */ if ($code != 5 && (isset($phpgw_info["server"]["usecookies"]) && $phpgw_info["server"]["usecookies"])){ return $last_loginid; } } function check_logoutcode($code) { global $phpgw_info; switch($code){ case "1": return "You have been successfully logged out"; break; case "2": return "Sorry, your login has expired"; break; case "5": return "" . "Bad login or password" . ""; break; case "10": Setcookie("sessionid"); Setcookie("kp3"); Setcookie("domain"); return "" . "Your session could not be verified." . ""; break; default: return " "; } } /* Program starts here */ if ($deny_login) { deny_login(); } if (isset($PHP_AUTH_USER)) { $submit = True; $login = $PHP_AUTH_USER; $passwd = $PHP_AUTH_PW; } if (isset($submit) && $submit) { if (getenv(REQUEST_METHOD) != "POST" && !isset($PHP_AUTH_USER)) { $phpgw->redirect($phpgw->link("","code=5")); } $sessionid = $phpgw->session->create($login,$passwd); if (!isset($sessionid) || !$sessionid) { $phpgw->redirect($phpgw_info["server"]["webserver_url"]."/login.php?cd=5"); } else { $phpgw->redirect($phpgw->link($phpgw_info["server"]["webserver_url"] . "/index.php", "cd=yes")); } } else { // !!! DONT CHANGE THESE LINES !!! // If there is something wrong with this code TELL ME! // Commenting out the code will not fix it. (jengo) if (isset($last_loginid)) { //echo "check point 1 - $last_loginid
\n"; $prefs = CreateObject("phpgwapi.preferences", $last_loginid); //echo "check point 2
\n"; $phpgw_info["user"]["preferences"] = $prefs->read_repository(); //echo "check point 3
\n"; #print "LANG:".$phpgw_info["user"]["preferences"]["common"]["lang"]."
"; $phpgw->translation->add_app("login"); $phpgw->translation->add_app("loginscreen"); if (lang("loginscreen_message") != "loginscreen_message*") { $tmpl->set_var("lang_message",stripslashes(lang("loginscreen_message"))); } } else { // If the lastloginid cookies isn't set, we will default to english. // Change this if you need. $phpgw_info["user"]["preferences"]["common"]["lang"] = "en"; $phpgw->translation->add_app("login"); $phpgw->translation->add_app("loginscreen"); if (lang("loginscreen_message") != "loginscreen_message*") { $tmpl->set_var("lang_message",stripslashes(lang("loginscreen_message"))); } } } if(!isset($cd) || !$cd) $cd=""; if ($phpgw_info["server"]["show_domain_selectbox"]) { reset($phpgw_domain); unset($domain_select); // For security ... just in case while ($domain = each($phpgw_domain)) { $domain_select .= '