From c92d4c5e11ef3d52b5588c71e2433b32ecbe2d17 Mon Sep 17 00:00:00 2001 From: jengo Date: Tue, 12 Dec 2000 22:39:50 +0000 Subject: [PATCH] Added in the new serialized config table --- setup/config.php | 23 +++++++++---- setup/sql/common_default_records.inc.php | 41 ++++++++++++++++++++++-- setup/sql/mysql_newtables.inc.php | 4 +-- setup/sql/mysql_upgrade_beta.inc.php | 5 ++- setup/sql/pgsql_newtables.inc.php | 5 ++- setup/sql/pgsql_upgrade_beta.inc.php | 6 ++-- version.inc.php | 2 +- 7 files changed, 68 insertions(+), 18 deletions(-) diff --git a/setup/config.php b/setup/config.php index fb0ec3d8ba..fa5e53a7f1 100644 --- a/setup/config.php +++ b/setup/config.php @@ -11,9 +11,12 @@ /* $Id$ */ - $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", "noapi" => True); + $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", + "noapi" => True); include("./inc/functions.inc.php"); include("../header.inc.php"); + include($phpgw_info["server"]["include_root"] . "/phpgwapi/phpgw_common.inc.php"); + $common = new common; // Authorize the user to use setup app and load the database // Does not return unless user is authorized @@ -33,7 +36,12 @@ if ($submit) { @$db->query("delete from config"); - while ($newsetting = each($newsettings)) { + $phpgw_info["server"] = $newsettings; + //$config_string = addslashes(serialize($t_array)); + + $db->query("insert into config values ('" . addslashes(serialize($newsettings)) . "')",__LINE__,__FILE__); + +/* while ($newsetting = each($newsettings)) { if ($newsetting[0] == "nntp_server") { $db->query("select config_value FROM config WHERE config_name='nntp_server'"); if ($db->num_rows()) { @@ -46,7 +54,7 @@ } $db->query("insert into config (config_name, config_value) values ('" . addslashes($newsetting[0]) . "','" . addslashes($newsetting[1]) . "')"); - } + } */ if ($newsettings["auth_type"] == "ldap") { Header("Location: ldap.php"); exit; @@ -62,9 +70,12 @@ } @$db->query("select * from config"); - while (@$db->next_record()) { - $current_config[$db->f("config_name")] = $db->f("config_value"); - } + @$db->next_record(); + $current_config = unserialize($db->f(0)); + // $current_config = $phpgw_info["server"]; + +// $current_config[$db->f("config_name")] = $db->f("config_value"); +// } if ($current_config["files_dir"] == "/path/to/dir/phpgroupware/files") { $current_config["files_dir"] = $phpgw_info["server"]["server_root"] . "/files"; diff --git a/setup/sql/common_default_records.inc.php b/setup/sql/common_default_records.inc.php index 295f141808..431874f804 100644 --- a/setup/sql/common_default_records.inc.php +++ b/setup/sql/common_default_records.inc.php @@ -13,7 +13,44 @@ function add_default_server_config(){ global $db, $phpgw_info, $currentver; - $db->query("insert into config (config_name, config_value) values ('default_tplset', 'default')"); + + $phpgw_info["server"]["default_tplset"] = "default"; + $phpgw_info["server"]["temp_dir"]="/path/to/tmp"; + $phpgw_info["server"]["files_dir"]="/path/to/phpgroupware/files"; + $phpgw_info["server"]["webserver_url"]="/phpgroupware"; + $phpgw_info["server"]["mail_server"]="localhost"; + $phpgw_info["server"]["mail_server_type"]="imap"; + $phpgw_info["server"]["imap_server_type"]="UWash"; + $phpgw_info["server"]["mail_suffix"]="yourdomain.com"; + $phpgw_info["server"]["mail_login_type"]="standard"; + $phpgw_info["server"]["smtp_server"]="localhost"; + $phpgw_info["server"]["smtp_port"]="25"; + $phpgw_info["server"]["auth_type"]="sql"; + $phpgw_info["server"]["account_repository"]="sql"; + $phpgw_info["server"]["ldap_host"]="localhost"; + $phpgw_info["server"]["ldap_context"]="ou=People,dc=my-domain,dc=com"; + $phpgw_info["server"]["ldap_root_dn"]="cn=Manager,dc=my-domain,dc=com"; + $phpgw_info["server"]["ldap_root_pw"]="secret"; + $phpgw_info["server"]["ldap_encryption_type"]="DES"; + $phpgw_info["server"]["usecookies"]="True"; + $phpgw_info["server"]["encryptkey"]="change this phrase 2 something else"; + $phpgw_info["server"]["default_ftp_server"]="localhost"; + $phpgw_info["server"]["httpproxy_server"]=""; + $phpgw_info["server"]["httpproxy_port"]=""; + $phpgw_info["server"]["showpoweredbyon"]="top"; + $phpgw_info["server"]["site_title"]="phpGroupWare"; + $phpgw_info["server"]["hostname"]="localhost"; + $phpgw_info["server"]["nntp_server"]="yournewsserver.com"; + $phpgw_info["server"]["nntp_port"]="119"; + $phpgw_info["server"]["nntp_sender"]="complaints@yourserver.com"; + $phpgw_info["server"]["nntp_organization"]="phpGroupWare"; + $phpgw_info["server"]["nntp_admin"]="admin@yourserver.com"; + $phpgw_info["server"]["nntp_login_username"]=""; + $phpgw_info["server"]["nntp_login_password"]=""; + + $db->query("insert into config values("' . serialize($s) . '")"); + +/* $db->query("insert into config (config_name, config_value) values ('default_tplset', 'default')"); $db->query("insert into config (config_name, config_value) values ('temp_dir', '/path/to/tmp')"); $db->query("insert into config (config_name, config_value) values ('files_dir', '/path/to/dir/phpgroupware/files')"); $db->query("insert into config (config_name, config_value) values ('encryptkey', 'change this phrase 2 something else')"); @@ -48,7 +85,7 @@ $db->query("insert into config (config_name, config_value) values ('showpoweredbyon', 'bottom')"); $db->query("insert into config (config_name, config_value) values ('htmlcompliant', 'False')"); $db->query("insert into config (config_name, config_value) values ('checkfornewversion', 'False')"); - $db->query("insert into config (config_name, config_value) values ('freshinstall', 'True')"); + $db->query("insert into config (config_name, config_value) values ('freshinstall', 'True')"); */ } if ($useglobalconfigsettings == "on"){ diff --git a/setup/sql/mysql_newtables.inc.php b/setup/sql/mysql_newtables.inc.php index 8f4d6107cc..9bc1dbb033 100644 --- a/setup/sql/mysql_newtables.inc.php +++ b/setup/sql/mysql_newtables.inc.php @@ -14,9 +14,7 @@ // NOTE: Please use spaces to seperate the field names. It makes copy and pasting easier. $sql = "CREATE TABLE config ( - config_name varchar(255) NOT NULL, - config_value varchar(100), - UNIQUE config_name (config_name) + config_string blob )"; $db->query($sql); diff --git a/setup/sql/mysql_upgrade_beta.inc.php b/setup/sql/mysql_upgrade_beta.inc.php index 534d27e662..3b12790869 100644 --- a/setup/sql/mysql_upgrade_beta.inc.php +++ b/setup/sql/mysql_upgrade_beta.inc.php @@ -732,8 +732,11 @@ if ($currentver == "0.9.7") { // upgrade code starts here + $db->query("drop table config"); + $db->query("CREATE TABLE config ( config_string blob )"); + echo "Note: You will need to re-submit your config data."; // upgrade code ends here - $currentver = "0.9.8pre1"; + $currentver = "0.9.8pre2"; update_version_table(); } /* diff --git a/setup/sql/pgsql_newtables.inc.php b/setup/sql/pgsql_newtables.inc.php index 9829ec1d22..32a05b6f94 100644 --- a/setup/sql/pgsql_newtables.inc.php +++ b/setup/sql/pgsql_newtables.inc.php @@ -14,10 +14,9 @@ // NOTE: Please use spaces to seperate the field names. It makes copy and pasting easier. $sql = "CREATE TABLE config ( - config_name varchar(255) NOT NULL UNIQUE, - config_value varchar(100) NOT NULL + config_string text )"; - $db->query($sql); + $db->query($sql); $sql = "create table applications ( app_name varchar(25) NOT NULL, diff --git a/setup/sql/pgsql_upgrade_beta.inc.php b/setup/sql/pgsql_upgrade_beta.inc.php index 8f1affb27e..aed025695c 100644 --- a/setup/sql/pgsql_upgrade_beta.inc.php +++ b/setup/sql/pgsql_upgrade_beta.inc.php @@ -745,9 +745,11 @@ if ($currentver == "0.9.7" || ereg ("^0\.9\.8pre", $currentver)){ if ($currentver == "0.9.7") { // upgrade code starts here - + $db->query("drop table config"); + $db->query("CREATE TABLE config ( config_string text )"); + echo "Note: You will need to re-submit your config data."; // upgrade code ends here - $currentver = "0.9.8pre1"; + $currentver = "0.9.8pre2"; update_version_table(); } /* diff --git a/version.inc.php b/version.inc.php index 2db84b1881..ebc3b31dc5 100644 --- a/version.inc.php +++ b/version.inc.php @@ -11,5 +11,5 @@ /* $Id$ */ - $phpgw_info["server"]["version"] = "0.9.8pre1"; + $phpgw_info["server"]["version"] = "0.9.8pre2"; $phpgw_info["server"]["current_header_version"] = "1.5";