diff --git a/setup/config.php b/setup/config.php
index 911b01b64f..e8eea14b3c 100644
--- a/setup/config.php
+++ b/setup/config.php
@@ -15,9 +15,7 @@
"currentapp" => "home", "noapi" => True);
include("../header.inc.php");
- $phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi";
-
- // Authorize the user to use setup app
+ // Authorize the user to use setup app and load the database
include("./inc/setup_auth.inc.php");
// Does not return unless user is authorized
diff --git a/setup/inc/setup_auth.inc.php b/setup/inc/setup_auth.inc.php
index d6831af7c0..1986ba32fd 100644
--- a/setup/inc/setup_auth.inc.php
+++ b/setup/inc/setup_auth.inc.php
@@ -15,9 +15,10 @@
// password in ../header.inc.php to protect all of the setup
// pages from unauthorized use.
- function setup_header($title = "")
- {
- global $phpgw_info;
+ $phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi";
+
+ function setup_header($title = ""){
+ global $phpgw_info, $PHP_SELF;
echo '
phpGroupWare setup ' . $title . ''
@@ -30,9 +31,8 @@
echo "
";
}
- function loginForm($err="")
- {
- global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPW, $PHP_SELF;
+ function loginForm($err=""){
+ global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPW, $PHP_SELF;
setup_header("Please login");
echo "\n";
@@ -59,48 +59,56 @@
echo "\n";
}
- if (!isset($phpgw_domain)) {
- setup_header("Upgrade your header.inc.php");
- echo "
You will need to upgrade your header.inc.php before you can continue with this setup";
- exit;
- }
- 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
+// function loaddb(){
+// global $phpgw_domain, $FormLogout, $FormDomain, $SetupPW, $SetupDomain, $db, $PHP_SELF;
- if (isset($FormLogout)) {
- setcookie("SetupPW"); // scrub the old one
- setcookie("SetupDomain"); // scrub the old one
- loginForm("You have sucessfully logged out");
- exit;
- } elseif (isset($SetupPW)) {
- if ($SetupPW != $phpgw_domain[$SetupDomain]["config_passwd"]) {
+ /* This code makes sure the newer multi-domain supporting header.inc.php is being used */
+ if (!isset($phpgw_domain)) {
+ setup_header("Upgrade your header.inc.php");
+ echo "
You will need to upgrade your header.inc.php before you can continue with this setup";
+ exit;
+ }
+
+ /* Based on authentication, the database will be loaded */
+ 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($FormLogout)) {
setcookie("SetupPW"); // scrub the old one
setcookie("SetupDomain"); // scrub the old one
- loginForm("Invalid session cookie (cookies must be enabled)");
+ loginForm("You have sucessfully logged out");
+ exit;
+ } 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;
+ }
+ } elseif (isset($FormPW)) {
+ if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"]) {
+ setcookie("SetupPW",$FormPW);
+ setcookie("SetupDomain",$FormDomain);
+ $SetupDomain = $FormDomain;
+ }else{
+ loginForm("Invalid password.");
+ exit;
+ }
+ } else {
+ loginForm();
exit;
}
- } elseif (isset($FormPW)) {
- if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"]) {
- setcookie("SetupPW",$FormPW);
- setcookie("SetupDomain",$FormDomain);
- $SetupDomain = $FormDomain;
- }else{
- loginForm("Invalid password.");
- exit;
- }
- } else {
- loginForm();
- exit;
- }
-
- /* Database setup */
- include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_domain[$SetupDomain]["db_type"].".inc.php");
- $db = new db;
- $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"];
+
+ /* Database setup */
+ include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_domain[$SetupDomain]["db_type"].".inc.php");
+ $db = new db;
+ $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"];
+// }
+// loaddb();
?>
diff --git a/setup/index.php b/setup/index.php
index 08a6730f92..3f5409df66 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -19,9 +19,7 @@
include("../header.inc.php");
include("../version.inc.php"); // To set the current core version
- $phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi";
-
- // Authorize the user to use setup app
+ // Authorize the user to use setup app and load the database
include("./inc/setup_auth.inc.php");
// Does not return unless user is authorized
@@ -344,6 +342,11 @@
echo "When you are done installing and upgrading applications, you should ";
echo "continue to the Configuration Page";
echo "
or skip to Configure multi-language support.\n";
+ echo "
or for a drastic measure, you can delete all your tables and data and recreate the new empty tables.\n";
+ echo "
\n";
+
?>