mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-13 17:38:19 +01:00
added mutli-domain support. Still have a bug when going to the config page. It will not work for one of my test domains, and Im not sure why
This commit is contained in:
parent
561deb921c
commit
36f7b3e13b
@ -25,11 +25,19 @@
|
||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_info["server"]["db_type"].".inc.php");
|
||||
|
||||
$db = new db;
|
||||
$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"];
|
||||
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 = $domains[$SetupDomain]["db_host"];
|
||||
$db->Type = $domains[$SetupDomain]["db_type"];
|
||||
$db->Database = $domains[$SetupDomain]["db_name"];
|
||||
$db->User = $domains[$SetupDomain]["db_user"];
|
||||
$db->Password = $domains[$SetupDomain]["db_pass"];
|
||||
}
|
||||
|
||||
if ($newsettings["auth_type"] != "ldap") {
|
||||
setup_header();
|
||||
|
@ -17,61 +17,80 @@
|
||||
|
||||
function setup_header($title = "")
|
||||
{
|
||||
global $phpgw_info;
|
||||
global $phpgw_info;
|
||||
|
||||
echo '<title>phpGroupWare setup ' . $title . '</title><BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" '
|
||||
. 'marginright="0" marginbottom="0"><table border="0" width="100%"><tr>'
|
||||
. '<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version '
|
||||
. $phpgw_info["server"]["version"] . ' setup</font></td></tr></table>';
|
||||
echo '<title>phpGroupWare setup ' . $title . '</title><BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" '
|
||||
. 'marginright="0" marginbottom="0"><table border="0" width="100%"><tr>'
|
||||
. '<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version '
|
||||
. $phpgw_info["server"]["version"] . ' setup</font></td></tr></table>';
|
||||
}
|
||||
|
||||
function loginForm($err="")
|
||||
{
|
||||
global $PHP_SELF;
|
||||
global $phpgw_info, $domain, $PHP_SELF;
|
||||
|
||||
setup_header("Please login");
|
||||
|
||||
echo "<p><body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Setup Login</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
if ($err != "") {
|
||||
echo " <tr bgcolor='#e6e6e6'><td colspan='2'><font color='#ff0000'>".$err."</font></td></tr>\n";
|
||||
}
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td><form action='".$PHP_SELF."' method='POST'>\n";
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
echo " <input type='text' name='domain' value=''><br>\n";
|
||||
echo " <input type='password' name='FormPW' value=''><br>\n";
|
||||
}else{
|
||||
echo "<p><body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Setup Login</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
if ($err != "") {
|
||||
echo " <tr bgcolor='#e6e6e6'><td colspan='2'><font color='#ff0000'>".$err."</font></td></tr>\n";
|
||||
}
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td><form action='".$PHP_SELF."' method='POST'>\n";
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
echo " <table><tr><td>Domain: </td><td><input type='text' name='domain' 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='submit' name='Login' value='Login'>\n";
|
||||
echo " </form></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</body></html>\n";
|
||||
}
|
||||
echo " <input type='submit' name='Login' value='Login'>\n";
|
||||
echo " </form></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</body></html>\n";
|
||||
}
|
||||
|
||||
if (isset($FormPW)) {
|
||||
if ($FormPW != $phpgw_info["server"]["config_passwd"]) {
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
if ($FormPW != $domains[$domain]["config_passwd"]) {
|
||||
loginForm("Invalid password.");
|
||||
exit;
|
||||
}
|
||||
// Valid login, fall through and set the cookie
|
||||
$SetupCookie = $FormPW;
|
||||
}
|
||||
}else{
|
||||
if ($FormPW != $phpgw_info["server"]["config_passwd"]) {
|
||||
loginForm("Invalid password.");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// Valid login, fall through and set the cookie
|
||||
$SetupCookie = $FormPW;
|
||||
} else if (isset($SetupCookie)) {
|
||||
if ($SetupCookie != $phpgw_info["server"]["config_passwd"]) {
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
if ($SetupCookie != $domains[$SetupDomain]["config_passwd"]) {
|
||||
setcookie("SetupCookie",""); // scrub the old one
|
||||
setcookie("SetupDomain",""); // scrub the old one
|
||||
loginForm("Invalid session cookie (cookies must be enabled)");
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
if ($SetupCookie != $phpgw_info["server"]["config_passwd"]) {
|
||||
setcookie("SetupCookie",""); // scrub the old one
|
||||
loginForm("Invalid session cookie (cookies must be enabled)");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
loginForm();
|
||||
exit;
|
||||
loginForm();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Auth ok.
|
||||
setcookie("SetupCookie","$SetupCookie");
|
||||
if ($phpgw_info["multiable_domains"] == True){
|
||||
setcookie("SetupDomain","$domain");
|
||||
}
|
||||
?>
|
@ -42,11 +42,19 @@
|
||||
}
|
||||
|
||||
$db = new db;
|
||||
$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"];
|
||||
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 = $domains[$SetupDomain]["db_host"];
|
||||
$db->Type = $domains[$SetupDomain]["db_type"];
|
||||
$db->Database = $domains[$SetupDomain]["db_name"];
|
||||
$db->User = $domains[$SetupDomain]["db_user"];
|
||||
$db->Password = $domains[$SetupDomain]["db_pass"];
|
||||
}
|
||||
// $db->Halt_On_Error = "report";
|
||||
$db->Halt_On_Error = "no";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user