forked from extern/egroupware
This is the completed (I think) code to support multi-domains
This commit is contained in:
parent
97310142a1
commit
78d039621e
@ -22,12 +22,17 @@
|
|||||||
echo '<title>phpGroupWare setup ' . $title . '</title><BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" '
|
echo '<title>phpGroupWare setup ' . $title . '</title><BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" '
|
||||||
. 'marginright="0" marginbottom="0"><table border="0" width="100%"><tr>'
|
. 'marginright="0" marginbottom="0"><table border="0" width="100%"><tr>'
|
||||||
. '<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version '
|
. '<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version '
|
||||||
. $phpgw_info["server"]["version"] . ' setup</font></td></tr></table>';
|
. $phpgw_info["server"]["version"] . ' setup</font></td><td align="right" bgcolor="486591">';
|
||||||
|
echo "<form action='".$PHP_SELF."' method='POST'>\n";
|
||||||
|
echo " <input type='hidden' name='FormLogout' value='True'>\n";
|
||||||
|
echo " <input type='submit' name='Logout' value='Logout'>\n";
|
||||||
|
echo " </form>\n";
|
||||||
|
echo "</td></tr></table>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function loginForm($err="")
|
function loginForm($err="")
|
||||||
{
|
{
|
||||||
global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPasswd, $PHP_SELF;
|
global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPW, $PHP_SELF;
|
||||||
|
|
||||||
setup_header("Please login");
|
setup_header("Please login");
|
||||||
echo "<p><body bgcolor='#ffffff'>\n";
|
echo "<p><body bgcolor='#ffffff'>\n";
|
||||||
@ -54,49 +59,48 @@
|
|||||||
echo "</body></html>\n";
|
echo "</body></html>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (count($phpgw_domain) > 1){
|
if (!isset($phpgw_domain)) {
|
||||||
// echo "count: ".count($phpgw_domain)."<br>\n";;
|
setup_header("Upgrade your header.inc.php");
|
||||||
//}
|
echo "<br><b>You will need to upgrade your header.inc.php before you can continue with this setup</b>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
reset($phpgw_domain);
|
reset($phpgw_domain);
|
||||||
$default_domain = each($phpgw_domain);
|
$default_domain = each($phpgw_domain);
|
||||||
$phpgw_info["server"]["default_domain"] = $default_domain[0];
|
$phpgw_info["server"]["default_domain"] = $default_domain[0];
|
||||||
unset ($default_domain); // we kill this for security reasons
|
unset ($default_domain); // we kill this for security reasons
|
||||||
|
|
||||||
if (isset($FormPW)) {
|
if (isset($FormLogout)) {
|
||||||
if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"]) {
|
setcookie("SetupPW"); // scrub the old one
|
||||||
setcookie("SetupPasswd","$FormPW");
|
setcookie("SetupDomain"); // scrub the old one
|
||||||
setcookie("SetupDomain","$FormDomain");
|
loginForm("You have sucessfully logged out");
|
||||||
}else{
|
exit;
|
||||||
loginForm("Invalid password.");
|
} elseif (isset($SetupPW)) {
|
||||||
|
if ($SetupPW != $phpgw_domain[$SetupDomain]["config_passwd"]) {
|
||||||
|
setcookie("SetupPW"); // scrub the old one
|
||||||
|
setcookie("SetupDomain"); // scrub the old one
|
||||||
|
loginForm("Invalid session cookie (cookies must be enabled)");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} elseif (isset($SetupPasswd)) {
|
} elseif (isset($FormPW)) {
|
||||||
if ($SetupPasswd != $phpgw_domain[$SetupDomain]["config_passwd"]) {
|
if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"]) {
|
||||||
setcookie("SetupPasswd",""); // scrub the old one
|
setcookie("SetupPW",$FormPW);
|
||||||
setcookie("SetupDomain",""); // scrub the old one
|
setcookie("SetupDomain",$FormDomain);
|
||||||
loginForm("Invalid session cookie (cookies must be enabled)");
|
$SetupDomain = $FormDomain;
|
||||||
|
}else{
|
||||||
|
loginForm("Invalid password.");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loginForm();
|
loginForm();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Database setup */
|
/* Database setup */
|
||||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_info["server"]["db_type"].".inc.php");
|
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_domain[$SetupDomain]["db_type"].".inc.php");
|
||||||
$db = new db;
|
$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->Host = $phpgw_domain[$SetupDomain]["db_host"];
|
||||||
$db->Type = $phpgw_domain[$SetupDomain]["db_type"];
|
$db->Type = $phpgw_domain[$SetupDomain]["db_type"];
|
||||||
$db->Database = $phpgw_domain[$SetupDomain]["db_name"];
|
$db->Database = $phpgw_domain[$SetupDomain]["db_name"];
|
||||||
$db->User = $phpgw_domain[$SetupDomain]["db_user"];
|
$db->User = $phpgw_domain[$SetupDomain]["db_user"];
|
||||||
$db->Password = $phpgw_domain[$SetupDomain]["db_pass"];
|
$db->Password = $phpgw_domain[$SetupDomain]["db_pass"];
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -49,6 +49,15 @@
|
|||||||
if (!$ok) {
|
if (!$ok) {
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
|
echo ' <table border="0" width="100%"><tr>'
|
||||||
|
. '<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version '
|
||||||
|
. $phpgw_info["server"]["version"] . ' setup</font></td><td align="right" bgcolor="486591">';
|
||||||
|
echo "<form action='".$PHP_SELF."' method='POST'>\n";
|
||||||
|
echo " <input type='hidden' name='FormLogout' value='True'>\n";
|
||||||
|
echo " <input type='submit' name='Logout' value='Logout'>\n";
|
||||||
|
echo " </form>\n";
|
||||||
|
echo "</td></tr></table>";
|
||||||
|
|
||||||
echo "<table width=\"70%\" border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='0'>\n";
|
echo "<table width=\"70%\" border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='0'>\n";
|
||||||
echo "<tr bgcolor='#486591'>";
|
echo "<tr bgcolor='#486591'>";
|
||||||
echo "<th align=\"center\"><font color='#fefefe'>phpGroupWare Core Staus</font></th>";
|
echo "<th align=\"center\"><font color='#fefefe'>phpGroupWare Core Staus</font></th>";
|
||||||
|
Loading…
Reference in New Issue
Block a user