From d96c9afac2063ed9df5132754a607cd640270433 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Mon, 12 Jan 2004 06:22:20 +0000 Subject: [PATCH] use a prefix for user accounts can be set in setup --- admin/inc/class.boaccounts.inc.php | 16 ++++++++++++++-- admin/inc/class.uiaccounts.inc.php | 11 ++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/admin/inc/class.boaccounts.inc.php b/admin/inc/class.boaccounts.inc.php index 3efc8040b6..c67ff6f6c4 100755 --- a/admin/inc/class.boaccounts.inc.php +++ b/admin/inc/class.boaccounts.inc.php @@ -304,12 +304,18 @@ ExecMethod('admin.uiaccounts.list_users'); return False; } + + $accountPrefix = ''; + if(isset($GLOBALS['phpgw_info']['server']['account_prefix'])) + { + $accountPrefix = $GLOBALS['phpgw_info']['server']['account_prefix']; + } if ($_POST['submit']) { $userData = array( 'account_type' => 'u', - 'account_lid' => $_POST['account_lid'], + 'account_lid' => $accountPrefix.$_POST['account_lid'], 'account_firstname' => $_POST['account_firstname'], 'account_lastname' => $_POST['account_lastname'], 'account_passwd' => $_POST['account_passwd'], @@ -568,11 +574,17 @@ ExecMethod('admin.uiaccounts.list_users'); return False; } + + $accountPrefix = ''; + if(isset($GLOBALS['phpgw_info']['server']['account_prefix'])) + { + $accountPrefix = $GLOBALS['phpgw_info']['server']['account_prefix']; + } if ($_POST['submit']) { $userData = array( - 'account_lid' => $_POST['account_lid'], + 'account_lid' => $accountPrefix.$_POST['account_lid'], 'firstname' => $_POST['account_firstname'], 'lastname' => $_POST['account_lastname'], 'account_passwd' => $_POST['account_passwd'], diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php index 1e9c243fb8..b0e455cc5f 100755 --- a/admin/inc/class.uiaccounts.inc.php +++ b/admin/inc/class.uiaccounts.inc.php @@ -1068,10 +1068,19 @@ ); $t->set_var($var); */ + $accountPrefix = ''; + if(isset($GLOBALS['phpgw_info']['server']['account_prefix'])) + { + $accountPrefix = $GLOBALS['phpgw_info']['server']['account_prefix']; + if (preg_match ("/^$accountPrefix(.*)/i", $userData['account_lid'], $matches)) + { + $userData['account_lid'] = $matches[1]; + } + } $var = Array( 'input_expires' => $jscal->input('expires',$userData['expires']<0?'':($userData['expires']?$userData['expires']:time()+(60*60*24*7))), 'lang_never' => lang('Never'), - 'account_lid' => '', + 'account_lid' => $accountPrefix.'', 'lang_homedir' => $lang_homedir, 'lang_shell' => $lang_shell, 'homedirectory' => $homedirectory,