diff --git a/setup/index.php b/setup/index.php index 03d577d2b4..a88641f8e3 100644 --- a/setup/index.php +++ b/setup/index.php @@ -307,19 +307,29 @@ lang('LDAP account import/export'), 'POST','ldap.php', 'submit',lang('Configure Now'), - ''); - $link_make_accts = ' '; + '' + ); } else { $btn_config_ldap = ''; + } + $phpgw_setup->db->query("select config_value FROM phpgw_config WHERE config_name='webserver_url'"); + $phpgw_setup->db->next_record(); + if ($phpgw_setup->db->f(0)) + { $link_make_accts = $phpgw_setup->make_href_link_simple( '
', 'setup_demo.php', lang('Click Here'), lang('to setup 1 admin account and 3 demo accounts.
This will delete all existing accounts') + . ' ' . lang('(account deletion in SQL Only)') ); } + else + { + $link_make_accts = ' '; + } } else { diff --git a/setup/lang/phpgw_en.lang b/setup/lang/phpgw_en.lang index 42e9d1c856..3b3ffd2e42 100644 --- a/setup/lang/phpgw_en.lang +++ b/setup/lang/phpgw_en.lang @@ -1,3 +1,4 @@ +(account deletion in SQL Only) setup en (account deletion in SQL Only)
Import has been completed! Click here to return to setup
setup en
Import has been completed! Click here to return to setup
Add auto-created users to this group ('Default' will be attempted if this is empty.) setup en Add auto-created users to this group ('Default' will be attempted if this is empty.) Admins setup en Admins diff --git a/setup/setup_demo.php b/setup/setup_demo.php index b10c7b7881..737c5d6b9d 100644 --- a/setup/setup_demo.php +++ b/setup/setup_demo.php @@ -13,162 +13,198 @@ // Little file to setup a demo install -$phpgw_info['flags'] = array( + $GLOBALS['phpgw_info']['flags'] = array( 'noheader' => True, 'nonavbar' => True, 'currentapp' => "home", 'noapi' => True ); -include('./inc/functions.inc.php'); -include('../header.inc.php'); + include('./inc/functions.inc.php'); + include('../header.inc.php'); // Authorize the user to use setup app and load the database // Does not return unless user is authorized -if (!$phpgw_setup->auth('Config')) -{ - Header('Location: index.php'); - exit; -} + if (!$phpgw_setup->auth('Config')) + { + Header('Location: index.php'); + exit; + } -if (!$submit) -{ - $tpl_root = $phpgw_setup->setup_tpl_dir('setup'); - $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); - $setup_tpl->set_file(array( - 'T_head' => 'head.tpl', - 'T_footer' => 'footer.tpl', - 'T_alert_msg' => 'msg_alert_msg.tpl', + function add_account($username,$first,$last,$passwd,$type='u') + { + $account_info = array( + 'account_type' => $type, + 'account_lid' => $username, + 'account_passwd' => $passwd, + 'account_firstname' => $first, + 'account_lastname' => $last, + 'account_status' => 'A', + 'account_expires' => -1 + ); + $GLOBALS['phpgw']->accounts->create($account_info); + + return $GLOBALS['phpgw']->accounts->name2id($username); + } + + if (!$HTTP_POST_VARS['submit']) + { + $tpl_root = $phpgw_setup->setup_tpl_dir('setup'); + $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); + $setup_tpl->set_file(array( + 'T_head' => 'head.tpl', + 'T_footer' => 'footer.tpl', + 'T_alert_msg' => 'msg_alert_msg.tpl', 'T_login_main' => 'login_main.tpl', 'T_login_stage_header' => 'login_stage_header.tpl', 'T_setup_demo' => 'setup_demo.tpl' )); - $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); - $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); + $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); + $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); - $phpgw_setup->show_header(lang('Demo Server Setup')); + $phpgw_setup->show_header(lang('Demo Server Setup')); - $setup_tpl->set_var('action_url','setup_demo.php'); - $setup_tpl->set_var('description',lang('This will create 1 admin account and 3 demo accounts
The username/passwords are: demo/guest, demo2/guest and demo3/guest.
!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!
')); - $setup_tpl->set_var('detailadmin',lang('Details for Admin account')); - $setup_tpl->set_var('adminusername',lang('Admin username')); - $setup_tpl->set_var('adminfirstname',lang('Admin first name')); - $setup_tpl->set_var('adminlastname',lang('Admin last name')); - $setup_tpl->set_var('adminpassword',lang('Admin password')); - $setup_tpl->set_var('adminpassword2',lang('Re-enter password')); - $setup_tpl->set_var('create_demo_accounts',lang('Create demo accounts')); + $setup_tpl->set_var('action_url','setup_demo.php'); + $setup_tpl->set_var('description',lang('This will create 1 admin account and 3 demo accounts
The username/passwords are: demo/guest, demo2/guest and demo3/guest.
!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!
') + . ' '. lang('(account deletion in SQL only)' + )); + $setup_tpl->set_var('detailadmin',lang('Details for Admin account')); + $setup_tpl->set_var('adminusername',lang('Admin username')); + $setup_tpl->set_var('adminfirstname',lang('Admin first name')); + $setup_tpl->set_var('adminlastname',lang('Admin last name')); + $setup_tpl->set_var('adminpassword',lang('Admin password')); + $setup_tpl->set_var('adminpassword2',lang('Re-enter password')); + $setup_tpl->set_var('create_demo_accounts',lang('Create demo accounts')); - $setup_tpl->set_var('lang_submit',lang('submit')); - $setup_tpl->pparse('out','T_setup_demo'); - $phpgw_setup->show_footer(); -} -else -{ - if ($passwd != $passwd2) - { - echo lang('Passwords did not match, please re-enter') . '.'; - exit; + $setup_tpl->set_var('lang_submit',lang('submit')); + $setup_tpl->pparse('out','T_setup_demo'); + $phpgw_setup->show_footer(); } - if (!$username) + else { - echo lang('You must enter a username for the admin') . '.'; - exit; - } + /* Posted admin data */ + $passwd = $HTTP_POST_VARS['passwd']; + $passwd2 = $HTTP_POST_VARS['passwd2']; + $username = $HTTP_POST_VARS['username']; + $fname = $HTTP_POST_VARS['fname']; + $lname = $HTTP_POST_VARS['lname']; - $phpgw_setup->loaddb(); - $phpgw_setup->db->transaction_begin(); + if ($passwd != $passwd2) + { + echo lang('Passwords did not match, please re-enter') . '.'; + exit; + } + if (!$username) + { + echo lang('You must enter a username for the admin') . '.'; + exit; + } - /* First clear out existing tables */ - $phpgw_setup->db->query("delete from phpgw_accounts"); - $phpgw_setup->db->query("delete from phpgw_preferences"); - $phpgw_setup->db->query("delete from phpgw_acl"); - $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";}:s:8:"calendar";a:4:{s:13:"workdaystarts";s:1:"7";s:11:"workdayends";s:2:"15";s:13:"weekdaystarts";s:6:"Monday";s:15:"defaultcalendar";s:9:"month.php";}}'; + $phpgw_setup->loaddb(); + /* Load up some configured values */ + $phpgw_setup->db->query("SELECT config_name,config_value FROM phpgw_config WHERE config_name LIKE 'ldap%' OR config_name='account_repository'",__LINE__,__FILE__); + while ($phpgw_setup->db->next_record()) + { + $config[$phpgw_setup->db->f('config_name')] = $phpgw_setup->db->f('config_value'); + } + $GLOBALS['phpgw_info']['server']['ldap_host'] = $config['ldap_host']; + $GLOBALS['phpgw_info']['server']['ldap_context'] = $config['ldap_context']; + $GLOBALS['phpgw_info']['server']['ldap_group_context'] = $config['ldap_group_context']; + $GLOBALS['phpgw_info']['server']['ldap_root_dn'] = $config['ldap_root_dn']; + $GLOBALS['phpgw_info']['server']['ldap_root_pw'] = $config['ldap_root_pw']; + $GLOBALS['phpgw_info']['server']['ldap_extra_attributes'] = $config['ldap_extra_attributes']; + $GLOBALS['phpgw_info']['server']['ldap_account_home'] = $config['ldap_account_home']; + $GLOBALS['phpgw_info']['server']['ldap_account_shell'] = $config['ldap_account_shell']; + $GLOBALS['phpgw_info']['server']['ldap_encryption_type'] = $config['ldap_encryption_type']; + $GLOBALS['phpgw_info']['server']['account_repository'] = $config['account_repository']; + unset($config); - $sql = "insert into phpgw_accounts"; - $sql .= "(account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values ('Default', 'g', '".md5($passwd)."', 'Default', 'Group', ".time().", 'A')"; - $phpgw_setup->db->query($sql); - $defaultgroupid = $phpgw_setup->db->get_last_insert_id('phpgw_accounts', 'account_id'); + /* Create dummy class, then accounts object */ + class phpgw + { + var $db; + var $common; + var $accounts; + } + $GLOBALS['phpgw'] = new phpgw; + $GLOBALS['phpgw']->db = $phpgw_setup->db; + $GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); + $GLOBALS['phpgw']->accounts = CreateObject('phpgwapi.accounts'); - $sql = "insert into phpgw_accounts"; - $sql .= "(account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values ('Admins', 'g', '".md5($passwd)."', 'Admin', 'Group', ".time().", 'A')"; - $phpgw_setup->db->query($sql); - $admingroupid = $phpgw_setup->db->get_last_insert_id('phpgw_accounts', 'account_id'); + /* Begin transaction for acl, etc */ + $phpgw_setup->db->transaction_begin(); + + /* Now, clear out existing tables */ + $phpgw_setup->db->query('DELETE FROM phpgw_accounts'); + $phpgw_setup->db->query('DELETE FROM phpgw_preferences'); + $phpgw_setup->db->query('DELETE FROM phpgw_acl'); + + $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";}:s:8:"calendar";a:4:{s:13:"workdaystarts";s:1:"7";s:11:"workdayends";s:2:"15";s:13:"weekdaystarts";s:6:"Monday";s:15:"defaultcalendar";s:9:"month.php";}}'; + + /* Create the demo groups */ + $defaultgroupid = add_account('Default','Default','Group',$passwd,'g'); + $admingroupid = add_account('Admins','Admin', 'Group',$passwd,'g'); /* Creation of the demo accounts is now optional - the checkbox is on by default. */ - if ($create_demo) - { + if ($HTTP_POST_VARS['create_demo']) + { /* Create records for demo accounts */ - $sql = "insert into phpgw_accounts"; - $sql .= "(account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values ('demo', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo', 'Account', ".time().", 'A')"; - $phpgw_setup->db->query($sql); - $accountid = $phpgw_setup->db->get_last_insert_id('phpgw_accounts', 'account_id'); - $phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 0)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)"); + $accountid = add_account('demo','Demo','Account','guest'); - $sql = "insert into phpgw_accounts"; - $sql .= "(account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values ('demo2', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo2', 'Account', ".time().", 'A')"; - $phpgw_setup->db->query($sql); - $accountid = $phpgw_setup->db->get_last_insert_id('phpgw_accounts', 'account_id'); - $phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 0)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_account, acl_location, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_preferences (preference_owner, preference_value) VALUES ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('preferences', 'changepassword', ".$accountid.", 0)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('addressbook', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('filemanager', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('calendar', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('email', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('notes', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('todo', 'run', ".$accountid.", 1)"); - $sql = "insert into phpgw_accounts"; - $sql .= "(account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values ('demo3', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo3', 'Account', ".time().", 'A')"; - $phpgw_setup->db->query($sql); - $accountid = $phpgw_setup->db->get_last_insert_id('phpgw_accounts', 'account_id'); - $phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 0)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)"); - } + $accountid = add_account('demo2','Demo2','Account','guest'); + + $phpgw_setup->db->query("INSERT INTO phpgw_preferences (preference_owner, preference_value) VALUES ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('preferences', 'changepassword', ".$accountid.", 0)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_account, acl_location, acl_rights) VALUES ('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('addressbook', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('filemanager', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('calendar', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('email', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('notes', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('todo', 'run', ".$accountid.", 1)"); + + $accountid = add_account('demo3','Demo3','Account','guest'); + + $phpgw_setup->db->query("INSERT INTO phpgw_preferences (preference_owner, preference_value) VALUES ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('preferences', 'changepassword', ".$accountid.", 0)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('addressbook', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('filemanager', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('calendar', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('email', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('notes', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('todo', 'run', ".$accountid.", 1)"); + } /* Create records for administrator account */ - $sql = "insert into phpgw_accounts"; - $sql .= "(account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; - $sql .= "values ('$username', 'u', '".md5($passwd)."', '$fname', '$lname', ".time().", 'A')"; - $phpgw_setup->db->query($sql); - $accountid = $phpgw_setup->db->get_last_insert_id('phpgw_accounts', 'account_id'); - $phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$admingroupid."', $accountid, 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('admin', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('nntp', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)"); - $phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('manual', 'run', ".$accountid.", 1)"); + $accountid = add_account($username,$fname,$lname,$passwd); - $phpgw_setup->db->query("update phpgw_accounts set account_expires='-1'",__LINE__,__FILE__); - $phpgw_setup->db->transaction_commit(); + $phpgw_setup->db->query("INSERT INTO phpgw_preferences (preference_owner, preference_value) VALUES ('$accountid', '$defaultprefs')"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('phpgw_group', '".$defaultgroupid."', $accountid, 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('phpgw_group', '".$admingroupid."', $accountid, 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('preferences', 'changepassword', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('admin', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('addressbook', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('filemanager', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('calendar', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('email', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('notes', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('nntp', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('todo', 'run', ".$accountid.", 1)"); + $phpgw_setup->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('manual', 'run', ".$accountid.", 1)"); - Header("Location: index.php"); - exit; -} + $phpgw_setup->db->transaction_commit(); + + Header('Location: index.php'); + exit; + } ?>