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"; + echo " \n"; + echo "
\n"; + ?> diff --git a/setup/lang.php b/setup/lang.php index 0dcca5d47a..86bffc96e7 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -16,23 +16,9 @@ $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "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 - 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; - $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"]; - //$db->Halt_On_Error = "report"; - //$db->Halt_On_Error = "no"; + // Authorize the user to use setup app and load the database + include("./inc/setup_auth.inc.php"); + //Does not return unless user is authorized echo "phpGroupWare Setup\n"; echo "\n"; @@ -136,7 +122,4 @@ '; } - } - - diff --git a/setup/ldap.php b/setup/ldap.php index c47ee025e1..3ddb6461e7 100644 --- a/setup/ldap.php +++ b/setup/ldap.php @@ -15,25 +15,13 @@ "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 and load the database + include("./inc/setup_auth.inc.php"); + // Does not return unless user is authorized include($phpgw_info["server"]["api_dir"] . "/phpgw_common.inc.php"); $common = new common; - // Authorize the user to use setup app - 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; - $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"]; - $db->query("select config_name,config_value from config where config_name like 'ldap%'",__LINE__,__FILE__); while ($db->next_record()) { $config[$db->f("config_name")] = $db->f("config_value"); diff --git a/setup/sql/mysql_upgrade_beta.inc.php b/setup/sql/mysql_upgrade_beta.inc.php index f9dd3f412f..3699044864 100644 --- a/setup/sql/mysql_upgrade_beta.inc.php +++ b/setup/sql/mysql_upgrade_beta.inc.php @@ -307,11 +307,7 @@ // The 0.9.3pre1 is only temp until release if ($currentver == "0.9.3" || ereg ("^0\.9\.4pre", $currentver)){ - if ($currentver == "0.9.3") { - $currentver = "0.9.4pre1"; - update_version_table(); - } - if ($currentver == "0.9.4pre1") { + if ($currentver == "0.9.4pre1" || $currentver == "0.9.3") { $sql = "CREATE TABLE notes ( note_id int(20) NOT NULL auto_increment, note_owner int(11), @@ -325,7 +321,7 @@ update_version_table(); } if ($currentver == "0.9.4pre2") { - $db->query("alter table webcal_entry change cal_create_by cal_owner int(11) NOT NULL"); + $db->query("alter table webcal_entry change cal_create_by cal_owner int(11) NOT NULL"); $currentver = "0.9.4pre3"; update_version_table(); } @@ -343,22 +339,39 @@ if ($currentver == "0.9.4pre4") { $sql = "ALTER TABLE todo ADD todo_startdate int(11) not null"; $db->query($sql); - $sql = "alter table sessions change session_lid session_lid varchar(255)"; $db->query($sql); - $currentver = "0.9.4pre5"; update_version_table(); } - + if ($currentver == "0.9.4pre5") { + $currentver = "0.9.4"; + update_version_table(); + } echo " \n"; echo " Upgrade from 0.9.3 to $currentver is completed.\n"; echo " \n"; } } + function v0_9_4to0_9_5(){ + global $currentver, $phpgw_info, $db; + + // The 0.9.4pre1 is only temp until release + if ($currentver == "0.9.4" || ereg ("^0\.9\.5pre", $currentver)){ + if ($currentver == "0.9.4") { + $currentver = "0.9.4pre1"; + update_version_table(); + } + echo " \n"; + echo " Upgrade from 0.9.4 to $currentver is completed.\n"; + echo " \n"; + } + } + v0_9_1to0_9_2(); v0_9_2to0_9_3(); v0_9_3to0_9_4(); +// v0_9_4to0_9_5(); ?> diff --git a/setup/sql/pgsql_newtables.inc.php b/setup/sql/pgsql_newtables.inc.php index cb624f4b39..8f9b235de4 100644 --- a/setup/sql/pgsql_newtables.inc.php +++ b/setup/sql/pgsql_newtables.inc.php @@ -260,7 +260,7 @@ )"; $db->query($sql); - $currentver = "0.9.3"; + $currentver = "0.9.4"; update_version_table(); ?> diff --git a/setup/sql/pgsql_upgrade_beta.inc.php b/setup/sql/pgsql_upgrade_beta.inc.php index 62e68f1033..9ae1b6b2b1 100644 --- a/setup/sql/pgsql_upgrade_beta.inc.php +++ b/setup/sql/pgsql_upgrade_beta.inc.php @@ -326,29 +326,61 @@ update_version_table(); } if ($currentver == "0.9.4pre2") { - $db->query("alter table webcal_entry change cal_create_by cal_owner int NOT NULL"); + $db->query("alter table webcal_entry change cal_create_by cal_owner int NOT NULL"); $currentver = "0.9.4pre3"; update_version_table(); } - if ($currentver == "0.9.4pre3") { - $sql = "ALTER TABLE todo ADD todo_startdate int not null"; - $db->query($sql); - - $sql = "ALTER TABLE todo CHANGE todo_datedue todo_enddate int not null"; - $db->query($sql); - - $currentver = "0.9.4pre4"; - update_version_table(); + $sql = "ALTER TABLE todo ADD todo_startdate int not null"; + $db->query($sql); + $sql = "ALTER TABLE todo CHANGE todo_datedue todo_enddate int not null"; + $db->query($sql); + $currentver = "0.9.4pre4"; + update_version_table(); + } + if ($currentver == "0.9.4pre4") { + $sql = "DROP TABLE sessions"; + $db->query($sql); + $sql = "create table sessions ( + session_id varchar(255), + session_lid varchar(255), + session_pwd varchar(255), + session_ip varchar(255), + session_logintime int, + session_dla int, + unique(session_id) + )"; + $db->query($sql); + $currentver = "0.9.4pre5"; + update_version_table(); + } + if ($currentver == "0.9.4pre5") { + $currentver = "0.9.4"; + update_version_table(); } echo " \n"; echo " Upgrade from 0.9.3 to $currentver is completed.\n"; echo " \n"; } } + function v0_9_4to0_9_5(){ + global $currentver, $phpgw_info, $db; + + // The 0.9.4pre1 is only temp until release + if ($currentver == "0.9.4" || ereg ("^0\.9\.5pre", $currentver)){ + if ($currentver == "0.9.4") { + $currentver = "0.9.4pre1"; + update_version_table(); + } + echo " \n"; + echo " Upgrade from 0.9.4 to $currentver is completed.\n"; + echo " \n"; + } + } v0_9_1to0_9_2(); v0_9_2to0_9_3(); v0_9_3to0_9_4(); +// v0_9_4to0_9_5(); ?> diff --git a/version.inc.php b/version.inc.php index da152ed648..568a8063c1 100644 --- a/version.inc.php +++ b/version.inc.php @@ -11,5 +11,5 @@ /* $Id$ */ - $phpgw_info["server"]["version"] = "0.9.4pre5"; + $phpgw_info["server"]["version"] = "0.9.4"; ?>