corrected problems with multi-domain support, and prepared for the new release

This commit is contained in:
seek3r 2000-11-22 08:34:19 +00:00
parent 7617c124f8
commit 74d17782e7
9 changed files with 132 additions and 107 deletions

View File

@ -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

View File

@ -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 '<title>phpGroupWare setup ' . $title . '</title><BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" '
. 'marginright="0" marginbottom="0"><table border="0" width="100%"><tr>'
@ -30,9 +31,8 @@
echo "</td></tr></table>";
}
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 "<p><body bgcolor='#ffffff'>\n";
@ -59,48 +59,56 @@
echo "</body></html>\n";
}
if (!isset($phpgw_domain)) {
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);
$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 "<br><b>You will need to upgrade your header.inc.php before you can continue with this setup</b>";
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();
?>

View File

@ -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 "<p>When you are done installing and upgrading applications, you should ";
echo "continue to the <a href='config.php'>Configuration Page</a>";
echo "<br>or skip to <a href='lang.php'>Configure multi-language support</a>.\n";
echo "<br><br>or for a drastic measure, you can delete all your tables and data and recreate the new empty tables.\n";
echo " <form method=\"POST\" action=\"$PHP_SELF\">\n";
echo " <input type=\"submit\" name=\"action\" value=\"Delete my old tables\">\n";
echo " </form>\n";
?>
</body>
</html>

View File

@ -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 "<html><head><title>phpGroupWare Setup</title></head>\n";
echo "<body bgcolor='#ffffff'>\n";
@ -136,7 +122,4 @@
<?php
echo '<center><input type="submit" name="submit" value="Install"></center>';
}
}

View File

@ -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");

View File

@ -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 " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from 0.9.3 to $currentver is completed.</td>\n";
echo " </tr>\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 " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from 0.9.4 to $currentver is completed.</td>\n";
echo " </tr>\n";
}
}
v0_9_1to0_9_2();
v0_9_2to0_9_3();
v0_9_3to0_9_4();
// v0_9_4to0_9_5();
?>

View File

@ -260,7 +260,7 @@
)";
$db->query($sql);
$currentver = "0.9.3";
$currentver = "0.9.4";
update_version_table();
?>

View File

@ -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 " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from 0.9.3 to $currentver is completed.</td>\n";
echo " </tr>\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 " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from 0.9.4 to $currentver is completed.</td>\n";
echo " </tr>\n";
}
}
v0_9_1to0_9_2();
v0_9_2to0_9_3();
v0_9_3to0_9_4();
// v0_9_4to0_9_5();
?>

View File

@ -11,5 +11,5 @@
/* $Id$ */
$phpgw_info["server"]["version"] = "0.9.4pre5";
$phpgw_info["server"]["version"] = "0.9.4";
?>