From 2aea2d586cc080005509dfff99fbd808c4e71240 Mon Sep 17 00:00:00 2001 From: seek3r Date: Sat, 10 Feb 2001 04:50:21 +0000 Subject: [PATCH] fixed new install --- setup/lang.php | 4 +- setup/setup_demo.php | 125 +++++++++++++---------- setup/sql/common_default_records.inc.php | 49 +++++---- setup/sql/common_main.inc.php | 4 +- setup/sql/mysql_droptables.inc.php | 17 ++- setup/sql/mysql_newtables.inc.php | 10 +- setup/sql/pgsql_droptables.inc.php | 27 +++-- setup/sql/pgsql_newtables.inc.php | 23 ++--- 8 files changed, 150 insertions(+), 109 deletions(-) diff --git a/setup/lang.php b/setup/lang.php index e53c6c1303..e044b65507 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -24,7 +24,7 @@ } $phpgw_setup->loaddb(); - include($phpgw_info["server"]["api_inc"]."/class.common.inc.php"); + include(PHPGW_API_INC."/class.common.inc.php"); $common = new common; // this is not used //$sep = $common->filesystem_separator(); @@ -54,7 +54,7 @@ } if (($addlang && $upgrademethod == "addonlynew") || ($upgrademethod != "addonlynew")) { //echo '
Test: loop above file()'; - $raw_file = file($phpgw_info["server"]["server_root"] . "/setup/phpgw_" . strtolower($lang) . ".lang"); + $raw_file = file(PHPGW_SERVER_ROOT . "/setup/phpgw_" . strtolower($lang) . ".lang"); while (list($null,$line) = each($raw_file)) { $addit = False; list($message_id,$app_name,$phpgw_setup->db_lang,$content) = explode("\t",$line); diff --git a/setup/setup_demo.php b/setup/setup_demo.php index 6cba4913bb..5174ba9350 100644 --- a/setup/setup_demo.php +++ b/setup/setup_demo.php @@ -52,72 +52,89 @@ }else{ $phpgw_setup->loaddb(); /* First clear out exsisting tables */ - $defaultprefs = 'a:5:{s:6:"common";a:1:{s:0:"";s:2:"en";}s:11:"addressbook";a:1:{s:0:"";s:4:"True";}i:8;a:1:{s:0:"";s:13:"workdaystarts";}i:15;a:1:{s:0:"";s:11:"workdayends";}s:6:"Monday";a:1:{s:0:"";s:13:"weekdaystarts";}}'; $phpgw_setup->db->query("delete from phpgw_accounts"); $phpgw_setup->db->query("delete from preferences"); $phpgw_setup->db->query("delete from phpgw_acl"); - - /* Create records for demo accounts */ - $sql = "insert into phpgw_accounts"; - $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values (1, 'demo', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo', 'Account', ".time().", 'A')"; - $phpgw_setup->db->query($sql); - $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('1', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', 1, 'u', 0)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 1, 'u', 1)"); + $defaultprefs = 'a:5:{s:6:"common";a:10:{s:9:"maxmatchs";s:2:"15";s:12:"template_set";s:8:"verdilak";s:5:"theme";s:6:"purple";s:13:"navbar_format";s:5:"icons";s:9:"tz_offset";N;s:10:"dateformat";s:5:"m/d/Y";s:10:"timeformat";s:2:"12";s:4:"lang";s:2:"en";s:11:"default_app";N;s:8:"currency";s:1:"$";}s:11:"addressbook";a:1:{s:0:"";s:4:"True";}i:8;a:1:{s:0:"";s:13:"workdaystarts";}i:15;a:1:{s:0:"";s:11:"workdayends";}s:6:"Monday";a:1:{s:0:"";s:13:"weekdaystarts";}}'; +// $defaultprefs = 'a:5:{s:6:"common";a:1:{s:0:"";s:2:"en";}s:11:"addressbook";a:1:{s:0:"";s:4:"True";}i:8;a:1:{s:0:"";s:13:"workdaystarts";}i:15;a:1:{s:0:"";s:11:"workdayends";}s:6:"Monday";a:1:{s:0:"";s:13:"weekdaystarts";}}'; - + $defaultgroupid = mt_rand (100, 600000); + $sql = "insert into phpgw_accounts"; + $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; + $sql .= "values (".$defaultgroupid.", 'Default', 'g', '".md5($passwd)."', 'Default', 'Group', ".time().", 'A')"; + $phpgw_setup->db->query($sql); + + $admingroupid = mt_rand (100, 600000); + $sql = "insert into phpgw_accounts"; + $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; + $sql .= "values (".$admingroupid.", 'Admins', 'g', '".md5($passwd)."', 'Admin', 'Group', ".time().", 'A')"; + $phpgw_setup->db->query($sql); + + /* Create records for demo accounts */ + $accountid = mt_rand (100, 600000); $sql = "insert into phpgw_accounts"; $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values (2, 'demo2', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo2', 'Account', ".time().", 'A')"; - $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('2', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', 2, 'u', 0)") ; - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 2, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 2, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 2, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 2, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 2, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 2, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 2, 'u', 1)"); - - $sql = "insert into phpgw_accounts"; - $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values (3, 'demo3', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo3', 'Account', ".time().", 'A')"; + $sql .= "values (".$accountid.", 'demo', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo', 'Account', ".time().", 'A')"; $phpgw_setup->db->query($sql); - $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('3', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', 3, 'u', 0)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 3, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 3, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 3, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 3, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 3, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 3, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 3, 'u', 1)"); + $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 0)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', ".$accountid.", 'u', 1)"); + + $accountid = mt_rand (100, 600000); + $sql = "insert into phpgw_accounts"; + $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; + $sql .= "values (".$accountid.", 'demo2', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo2', 'Account', ".time().", 'A')"; + $phpgw_setup->db->query($sql); + $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 0)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', ".$accountid.", 'u', 1)"); + + $accountid = mt_rand (100, 600000); + $sql = "insert into phpgw_accounts"; + $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; + $sql .= "values (".$accountid.", 'demo3', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo3', 'Account', ".time().", 'A')"; + $phpgw_setup->db->query($sql); + $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 0)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', ".$accountid.", 'u', 1)"); /* Create records for administrator account */ + $accountid = mt_rand (100, 600000); $sql = "insert into phpgw_accounts"; $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values (4, '$username', 'u', '".md5($passwd)."', '$fname', '$lname', ".time().", 'A')"; + $sql .= "values (".$accountid.", '$username', 'u', '".md5($passwd)."', '$fname', '$lname', ".time().", 'A')"; $phpgw_setup->db->query($sql); - $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('4', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '2', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('admin', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('nntp', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('transy', 'run', 4, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('manual', 'run', 4, 'u', 1)"); + $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '".$admingroupid."', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('admin', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('nntp', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', ".$accountid.", 'u', 1)"); +// $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('transy', 'run', ".$accountid.", 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('manual', 'run', ".$accountid.", 'u', 1)"); Header("Location: index.php"); exit; diff --git a/setup/sql/common_default_records.inc.php b/setup/sql/common_default_records.inc.php index 1de333e5c2..3c6ecd567a 100644 --- a/setup/sql/common_default_records.inc.php +++ b/setup/sql/common_default_records.inc.php @@ -11,13 +11,6 @@ /* $Id$ */ - $d1 = strtolower(substr($phpgw_info["server"]["include_root"],0,3)); - $d2 = strtolower(substr($phpgw_info["server"]["server_root"],0,3)); - if($d1 == "htt" || $d1 == "ftp" || $d2 == "htt" || $d2 == "ftp") { - echo "Failed attempt to break in via an old Security Hole!
\n"; - exit; - } unset($d1);unset($d2); - function add_default_server_config(){ global $phpgw_info, $phpgw_setup; $phpgw_setup->db->query("insert into phpgw_config (config_name, config_value) values ('template_set', 'user_choice')"); @@ -60,7 +53,7 @@ if ($useglobalconfigsettings == "on"){ if (is_file($basedir)){ - include ($phpgw_info["server"]["include_root"]."/globalconfig.inc.php"); + include (PHPGW_INCLUDE_ROOT."/globalconfig.inc.php"); $phpgw_setup->db->query("insert into phpgw_config (config_name, config_value) values ('template_set', '".$phpgw_info["server"]["template_set"]."')"); $phpgw_setup->db->query("insert into phpgw_config (config_name, config_value) values ('temp_dir', '".$phpgw_info["server"]["temp_dir"]."')"); $phpgw_setup->db->query("insert into phpgw_config (config_name, config_value) values ('files_dir', '".$phpgw_info["server"]["files_dir"]."')"); @@ -107,20 +100,38 @@ add_default_server_config(); } - include($phpgw_info["server"]["server_root"] . "/setup/sql/default_applications.inc.php"); + include(PHPGW_SERVER_ROOT . "/setup/sql/default_applications.inc.php"); + $defaultgroupid = mt_rand (100, 600000); + $sql = "insert into phpgw_accounts"; + $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; + $sql .= "values (".$defaultgroupid.", 'Default', 'g', '".md5($passwd)."', 'Default', 'Group', ".time().", 'A')"; + $phpgw_setup->db->query($sql); - $phpgw_setup->db->query("insert into groups (group_name) values ('Default')"); - $phpgw_setup->db->query("insert into accounts (account_lid,account_pwd,account_firstname,account_lastname,account_status) values ('demo','81dc9bdb52d04dc20036dbd8313ed055','Demo','Account','A')"); - - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('admin', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 1, 'u', 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 1, 'u', 1)"); + $admingroupid = mt_rand (100, 600000); + $sql = "insert into phpgw_accounts"; + $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; + $sql .= "values (".$admingroupid.", 'Admins', 'g', '".md5($passwd)."', 'Admin', 'Group', ".time().", 'A')"; + $phpgw_setup->db->query($sql); $defaultprefs = 'a:5:{s:6:"common";a:1:{s:0:"";s:2:"en";}s:11:"addressbook";a:1:{s:0:"";s:4:"True";}i:8;a:1:{s:0:"";s:13:"workdaystarts";}i:15;a:1:{s:0:"";s:11:"workdayends";}s:6:"Monday";a:1:{s:0:"";s:13:"weekdaystarts";}}'; - $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('1', '$defaultprefs')"); + $accountid = mt_rand (100, 600000); + $sql = "insert into phpgw_accounts"; + $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; + $sql .= "values (".$accountid.", 'demo', 'u', '81dc9bdb52d04dc20036dbd8313ed055', 'Demo', 'Account', ".time().", 'A')"; + $phpgw_setup->db->query($sql); + $phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('4', '$defaultprefs')"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '".$admingroupid."', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('admin', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('nntp', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('transy', 'run', $accountid, 'u', 1)"); + $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('manual', 'run', $accountid, 'u', 1)"); @$phpgw_setup->db->query("INSERT INTO languages (lang_id, lang_name, available) values ('aa','Afar','No')"); @$phpgw_setup->db->query("INSERT INTO languages (lang_id, lang_name, available) values ('ab','Abkhazian','No')"); diff --git a/setup/sql/common_main.inc.php b/setup/sql/common_main.inc.php index f578e2e7a5..0ef1acba66 100644 --- a/setup/sql/common_main.inc.php +++ b/setup/sql/common_main.inc.php @@ -20,7 +20,7 @@ function update_version_table($tableschanged = True){ global $phpgw_info, $phpgw_setup; if ($tableschanged == True){$phpgw_info["setup"]["tableschanged"] = True;} - $phpgw_setup->db->query("update applications set app_version='".$phpgw_info["setup"]["currentver"]["phpgwapi"]."' where (app_name='admin' or app_name='filemanager' or app_name='addressbook' or app_name='todo' or app_name='calendar' or app_name='email' or app_name='nntp' or app_name='cron_apps' or app_name='notes')"); + $phpgw_setup->db->query("update phpgw_applications set app_version='".$phpgw_info["setup"]["currentver"]["phpgwapi"]."' where (app_name='admin' or app_name='filemanager' or app_name='addressbook' or app_name='todo' or app_name='calendar' or app_name='email' or app_name='nntp' or app_name='cron_apps' or app_name='notes')"); } if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == "drop"){ @@ -30,7 +30,7 @@ include("./sql/".$phpgw_domain[$ConfigDomain]["db_type"]."_newtables.inc.php"); include("./sql/common_default_records.inc.php"); $included = True; - include($phpgw_info["server"]["server_root"] . "/setup/lang.php"); + include(PHPGW_SERVER_ROOT . "/setup/lang.php"); $phpgw_info["setup"]["currentver"]["phpgwapi"] = "oldversion"; } diff --git a/setup/sql/mysql_droptables.inc.php b/setup/sql/mysql_droptables.inc.php index e0c410fba7..d44bb43256 100644 --- a/setup/sql/mysql_droptables.inc.php +++ b/setup/sql/mysql_droptables.inc.php @@ -11,16 +11,16 @@ /* $Id$ */ - $phpgw_setup->db->query("DROP TABLE config"); - $phpgw_setup->db->query("DROP TABLE applications"); + $phpgw_setup->db->query("DROP TABLE phpgw_config"); + $phpgw_setup->db->query("DROP TABLE phpgw_applications"); $phpgw_setup->db->query("DROP TABLE phpgw_accounts"); - $phpgw_setup->db->query("DROP TABLE groups"); - $phpgw_setup->db->query("DROP TABLE preferences"); + $phpgw_setup->db->query("DROP TABLE phpgw_preferences"); $phpgw_setup->db->query("DROP TABLE phpgw_sessions"); $phpgw_setup->db->query("DROP TABLE phpgw_app_sessions"); $phpgw_setup->db->query("DROP TABLE phpgw_acl"); $phpgw_setup->db->query("DROP TABLE phpgw_hooks"); $phpgw_setup->db->query("DROP TABLE phpgw_access_log"); + $phpgw_setup->db->query("DROP TABLE phpgw_categories"); $phpgw_setup->db->query("DROP TABLE profiles"); $phpgw_setup->db->query("DROP TABLE addressbook"); $phpgw_setup->db->query("DROP TABLE todo"); @@ -32,6 +32,13 @@ $phpgw_setup->db->query("DROP TABLE lang"); $phpgw_setup->db->query("DROP TABLE languages"); $phpgw_setup->db->query("DROP TABLE customers"); - $phpgw_setup->db->query("DROP TABLE phpgw_categories"); $phpgw_setup->db->query("DROP TABLE notes"); + + /* Legacy tables */ + + $phpgw_setup->db->query("DROP TABLE config"); + $phpgw_setup->db->query("DROP TABLE applications"); + $phpgw_setup->db->query("DROP TABLE groups"); + $phpgw_setup->db->query("DROP TABLE accounts"); + $phpgw_setup->db->query("DROP TABLE preferences"); ?> \ No newline at end of file diff --git a/setup/sql/mysql_newtables.inc.php b/setup/sql/mysql_newtables.inc.php index 302a696658..2c73cb3131 100644 --- a/setup/sql/mysql_newtables.inc.php +++ b/setup/sql/mysql_newtables.inc.php @@ -47,11 +47,9 @@ )"; $phpgw_setup->db->query($sql); - $sql = "create table groups ( - group_id int NOT NULL auto_increment, - group_name varchar(255), - group_apps varchar(255), - primary key(group_id) + $sql = "CREATE TABLE phpgw_preferences ( + preference_owner int, + preference_value text )"; $phpgw_setup->db->query($sql); @@ -300,7 +298,7 @@ );"; $phpgw_setup->db->query($sql); - $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.9"; + $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.10pre8"; $phpgw_info["setup"]["oldver"]["phpgwapi"] = $phpgw_info["setup"]["currentver"]["phpgwapi"]; update_version_table(); // $phpgw_setup->update_version_table(); diff --git a/setup/sql/pgsql_droptables.inc.php b/setup/sql/pgsql_droptables.inc.php index 331d0d3051..c87f9cf3a6 100644 --- a/setup/sql/pgsql_droptables.inc.php +++ b/setup/sql/pgsql_droptables.inc.php @@ -11,18 +11,20 @@ /* $Id$ */ - $phpgw_setup->db->query("DROP TABLE config"); - $phpgw_setup->db->query("DROP TABLE applications"); + $phpgw_setup->db->query("DROP TABLE phpgw_config"); + $phpgw_setup->db->query("DROP TABLE phpgw_applications"); $phpgw_setup->db->query("drop sequence phpgw_accounts_account_id_seq"); $phpgw_setup->db->query("DROP TABLE phpgw_accounts"); - $phpgw_setup->db->query("drop sequence groups_group_id_seq"); - $phpgw_setup->db->query("DROP TABLE groups"); - $phpgw_setup->db->query("DROP TABLE preferences"); + $phpgw_setup->db->query("DROP TABLE phpgw_preferences"); $phpgw_setup->db->query("DROP TABLE phpgw_sessions"); $phpgw_setup->db->query("DROP TABLE phpgw_app_sessions"); $phpgw_setup->db->query("DROP TABLE phpgw_acl"); $phpgw_setup->db->query("DROP TABLE phpgw_access_log"); + $phpgw_setup->db->query("drop sequence phpgw_categories_cat_id_seq"); + $phpgw_setup->db->query("DROP TABLE phpgw_categories"); $phpgw_setup->db->query("drop sequence profiles_con_seq"); + $phpgw_setup->db->query("drop sequence phpgw_hooks_hook_id_seq"); + $phpgw_setup->db->query("DROP TABLE phpgw_hooks"); $phpgw_setup->db->query("DROP TABLE profiles"); $phpgw_setup->db->query("drop sequence addressbook_ab_id_seq"); $phpgw_setup->db->query("DROP TABLE addressbook"); @@ -40,10 +42,17 @@ $phpgw_setup->db->query("DROP TABLE languages"); $phpgw_setup->db->query("drop sequence categories_cat_id_seq"); $phpgw_setup->db->query("DROP TABLE categories"); - $phpgw_setup->db->query("drop sequence phpgw_categories_cat_id_seq"); - $phpgw_setup->db->query("DROP TABLE phpgw_categories"); $phpgw_setup->db->query("DROP sequence notes_note_id_seq"); $phpgw_setup->db->query("DROP TABLE notes"); - $phpgw_setup->db->query("drop sequence phpgw_hooks_hook_id_seq"); - $phpgw_setup->db->query("DROP TABLE phpgw_hooks"); + + $phpgw_setup->db->query("DROP TABLE config"); + $phpgw_setup->db->query("DROP TABLE applications"); + $phpgw_setup->db->query("DROP TABLE config"); + $phpgw_setup->db->query("DROP TABLE applications"); + $phpgw_setup->db->query("drop sequence groups_group_id_seq"); + $phpgw_setup->db->query("DROP TABLE groups"); + $phpgw_setup->db->query("drop sequence accounts_account_id_seq"); + $phpgw_setup->db->query("DROP TABLE accounts"); + $phpgw_setup->db->query("DROP TABLE preferences"); + ?> \ No newline at end of file diff --git a/setup/sql/pgsql_newtables.inc.php b/setup/sql/pgsql_newtables.inc.php index 8731092313..6c81f1fe23 100644 --- a/setup/sql/pgsql_newtables.inc.php +++ b/setup/sql/pgsql_newtables.inc.php @@ -31,7 +31,7 @@ $phpgw_setup->db->query($sql); - $sql = "create table accounts ( + $sql = "create table phpgw_accounts ( account_id serial, account_lid varchar(25) NOT NULL, account_pwd char(32) NOT NULL, @@ -46,13 +46,18 @@ )"; $phpgw_setup->db->query($sql); - $sql = "create table groups ( - group_id serial, - group_name varchar(50), - group_apps varchar(255) + $sql = "create table preferences ( + preference_owner int, + preference_value text )"; $phpgw_setup->db->query($sql); - + + $sql = "create table phpgw_preferences ( + preference_owner int, + preference_value text + )"; + $phpgw_setup->db->query($sql); + $sql = "create table phpgw_sessions ( session_id varchar(255), session_lid varchar(255), @@ -91,12 +96,6 @@ )"; $phpgw_setup->db->query($sql); - $sql = "create table preferences ( - preference_owner int, - preference_value text - )"; - $phpgw_setup->db->query($sql); - $sql = "CREATE TABLE profiles ( con serial, owner varchar(20),