mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
fixed backward compatibility with old header.inc.php
This commit is contained in:
parent
d4b6f8f149
commit
97310142a1
@ -21,24 +21,6 @@
|
||||
include("./inc/setup_auth.inc.php");
|
||||
// Does not return unless user is authorized
|
||||
|
||||
/* Database setup */
|
||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_info["server"]["db_type"].".inc.php");
|
||||
|
||||
$db = new db;
|
||||
if ($phpgw_info["multiable_domains"] != True){
|
||||
$db->Host = $phpgw_info["server"]["db_host"];
|
||||
$db->Type = $phpgw_info["server"]["db_type"];
|
||||
$db->Database = $phpgw_info["server"]["db_name"];
|
||||
$db->User = $phpgw_info["server"]["db_user"];
|
||||
$db->Password = $phpgw_info["server"]["db_pass"];
|
||||
}else{
|
||||
$db->Host = $phpgw_domain[$SetupDomain]["db_host"];
|
||||
$db->Type = $phpgw_domain[$SetupDomain]["db_type"];
|
||||
$db->Database = $phpgw_domain[$SetupDomain]["db_name"];
|
||||
$db->User = $phpgw_domain[$SetupDomain]["db_user"];
|
||||
$db->Password = $phpgw_domain[$SetupDomain]["db_pass"];
|
||||
}
|
||||
|
||||
if ($newsettings["auth_type"] != "ldap") {
|
||||
setup_header();
|
||||
}
|
||||
|
@ -27,10 +27,9 @@
|
||||
|
||||
function loginForm($err="")
|
||||
{
|
||||
global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupCookie, $FormDomain, $PHP_SELF;
|
||||
global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPasswd, $PHP_SELF;
|
||||
|
||||
setup_header("Please login");
|
||||
|
||||
echo "<p><body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
@ -41,11 +40,12 @@
|
||||
}
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td><form action='".$PHP_SELF."' method='POST'>\n";
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
if (count($phpgw_domain) > 1){
|
||||
echo " <table><tr><td>Domain: </td><td><input type='text' name='FormDomain' value=''></td></tr>\n";
|
||||
echo " <tr><td>Password: </td><td><input type='password' name='FormPW' value=''></td></tr></table>\n";
|
||||
}else{
|
||||
echo " <input type='password' name='FormPW' value=''>\n";
|
||||
echo " <input type='hidden' name='FormDomain' value='".$phpgw_info["server"]["default_domain"]."'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='Login' value='Login'>\n";
|
||||
echo " </form></td>\n";
|
||||
@ -54,43 +54,49 @@
|
||||
echo "</body></html>\n";
|
||||
}
|
||||
|
||||
//if (count($phpgw_domain) > 1){
|
||||
// echo "count: ".count($phpgw_domain)."<br>\n";;
|
||||
//}
|
||||
|
||||
reset($phpgw_domain);
|
||||
$default_domain = each($phpgw_domain);
|
||||
$phpgw_info["server"]["default_domain"] = $default_domain[0];
|
||||
unset ($default_domain); // we kill this for security reasons
|
||||
|
||||
if (isset($FormPW)) {
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
if ($FormPW != $phpgw_domain[$FormDomain]["config_passwd"]) {
|
||||
loginForm("Invalid password.");
|
||||
exit;
|
||||
}
|
||||
if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"]) {
|
||||
setcookie("SetupPasswd","$FormPW");
|
||||
setcookie("SetupDomain","$FormDomain");
|
||||
}else{
|
||||
if ($FormPW != $phpgw_domain["default"]["config_passwd"]) {
|
||||
loginForm("Invalid password.");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// Valid login, fall through and set the cookie
|
||||
$SetupCookie = $FormPW;
|
||||
} else if (isset($SetupCookie)) {
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
if ($SetupCookie != $phpgw_domain[$SetupDomain]["config_passwd"]) {
|
||||
setcookie("SetupCookie",""); // scrub the old one
|
||||
} elseif (isset($SetupPasswd)) {
|
||||
if ($SetupPasswd != $phpgw_domain[$SetupDomain]["config_passwd"]) {
|
||||
setcookie("SetupPasswd",""); // scrub the old one
|
||||
setcookie("SetupDomain",""); // scrub the old one
|
||||
loginForm("Invalid session cookie (cookies must be enabled)");
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
if ($SetupCookie != $phpgw_domain["default"]["config_passwd"]) {
|
||||
setcookie("SetupCookie",""); // scrub the old one
|
||||
loginForm("Invalid session cookie (cookies must be enabled)");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
loginForm();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Auth ok.
|
||||
setcookie("SetupCookie","$SetupCookie");
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
setcookie("SetupDomain","$FormDomain");
|
||||
/* Database setup */
|
||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_info["server"]["db_type"].".inc.php");
|
||||
$db = new db;
|
||||
if ($phpgw_info["multiable_domains"] != True){
|
||||
$db->Host = $phpgw_info["server"]["db_host"];
|
||||
$db->Type = $phpgw_info["server"]["db_type"];
|
||||
$db->Database = $phpgw_info["server"]["db_name"];
|
||||
$db->User = $phpgw_info["server"]["db_user"];
|
||||
$db->Password = $phpgw_info["server"]["db_pass"];
|
||||
}else{
|
||||
$db->Host = $phpgw_domain[$SetupDomain]["db_host"];
|
||||
$db->Type = $phpgw_domain[$SetupDomain]["db_type"];
|
||||
$db->Database = $phpgw_domain[$SetupDomain]["db_name"];
|
||||
$db->User = $phpgw_domain[$SetupDomain]["db_user"];
|
||||
$db->Password = $phpgw_domain[$SetupDomain]["db_pass"];
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -25,36 +25,6 @@
|
||||
include("./inc/setup_auth.inc.php");
|
||||
// Does not return unless user is authorized
|
||||
|
||||
/* Database setup */
|
||||
switch($phpgw_info["server"]["db_type"]){
|
||||
case "pgsql":
|
||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_pgsql.inc.php");
|
||||
break;
|
||||
case "oracle":
|
||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_oracle.inc.php");
|
||||
break;
|
||||
case "mysql":
|
||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_mysql.inc.php");
|
||||
break;
|
||||
default:
|
||||
echo("<h1>Please set db_type in your header.inc.php correctly</h1>\n");
|
||||
exit;
|
||||
}
|
||||
|
||||
$db = new db;
|
||||
if ($phpgw_info["multiable_domains"] != True){
|
||||
$db->Host = $phpgw_info["server"]["db_host"];
|
||||
$db->Type = $phpgw_info["server"]["db_type"];
|
||||
$db->Database = $phpgw_info["server"]["db_name"];
|
||||
$db->User = $phpgw_info["server"]["db_user"];
|
||||
$db->Password = $phpgw_info["server"]["db_pass"];
|
||||
}else{
|
||||
$db->Host = $phpgw_domain[$SetupDomain]["db_host"];
|
||||
$db->Type = $phpgw_domain[$SetupDomain]["db_type"];
|
||||
$db->Database = $phpgw_domain[$SetupDomain]["db_name"];
|
||||
$db->User = $phpgw_domain[$SetupDomain]["db_user"];
|
||||
$db->Password = $phpgw_domain[$SetupDomain]["db_pass"];
|
||||
}
|
||||
// $db->Halt_On_Error = "report";
|
||||
$db->Halt_On_Error = "no";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user