From d26840b61f5e7735ab7b0e1f9072f9d5c06e2513 Mon Sep 17 00:00:00 2001 From: jengo Date: Wed, 21 Feb 2001 03:03:16 +0000 Subject: [PATCH] Added a temp fix for edit and add accounts, I am now going to go through it and clean up the variable names to make them more standard and understandable --- admin/editaccount.php | 26 ++++++++++++-------------- admin/newaccount.php | 14 +++++++------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/admin/editaccount.php b/admin/editaccount.php index b026ad8959..f5bcfd6edf 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -25,8 +25,9 @@ { global $phpgw,$phpgw_info; - $t = new Template($phpgw->common->get_tpl_dir("admin")); - $t->set_file(array("form" => "account_form.tpl")); + $t = new Template($phpgw->common->get_tpl_dir("admin")); + $t->set_unknowns('remove'); + $t->set_file(array("form" => "account_form.tpl")); if ($_userData) { @@ -53,11 +54,11 @@ // groups list $groups_select = '"; $t->set_var("groups_select",$groups_select); @@ -103,12 +104,9 @@ if ($userData["status"]) { - $t->set_var('account_status','checked'); + $t->set_var('account_status',' checked'); } - else - { - $t->set_var('account_status',''); - } + $t->set_var("n_firstname_value",$userData["firstname"]); $t->set_var("n_lastname_value",$userData["lastname"]); @@ -199,7 +197,7 @@ $t->set_var("permissions_list",$appRightsOutput); - $t->pparse('out','form'); + echo $t->finish($t->parse('out','form')); } // stores the userdata @@ -327,9 +325,9 @@ if ($submit) { $userData = array( - 'account_lid' => $account_lid, 'firstname' => $n_firstname, - 'lastname' => $n_lastname, 'passwd' => $n_passwd, - 'status' => $n_account_status, 'old_loginid' => rawurldecode($old_loginid), + 'account_lid' => $account_lid, 'firstname' => $firstname, + 'lastname' => $lastname, 'passwd' => $n_passwd, + 'status' => $account_status, 'old_loginid' => rawurldecode($old_loginid), 'account_id' => $account_id, 'passwd_2' => $n_passwd_2, 'n_groups' => $n_groups, 'new_permissions' => $new_permissions ); diff --git a/admin/newaccount.php b/admin/newaccount.php index 8e6b7699a4..a81672b47b 100755 --- a/admin/newaccount.php +++ b/admin/newaccount.php @@ -36,13 +36,13 @@ } } - if (! $n_loginid) + if (! $account_lid) $error[$totalerrors++] = lang("You must enter a loginid"); if (! $n_passwd) $error[$totalerrors++] = lang("You must enter a password"); - if ($n_passwd == $n_loginid) + if ($n_passwd == $account_lid) $error[$totalerrors++] = lang("The login and password can not be the same"); if ($n_passwd != $n_passwd_2) @@ -52,7 +52,7 @@ $error[$totalerrors++] = "
" . lang("You must add at least 1 permission or group to this account"); } - if ($phpgw->accounts->exists($n_loginid)) { + if ($phpgw->accounts->exists($account_lid)) { $error[$totalerrors++] = lang("That loginid has already been taken"); } @@ -65,9 +65,9 @@ 'phpgw_acl', 'phpgw_applications' )); - $phpgw->accounts->create('u', $n_loginid, $n_passwd, $n_firstname, $n_lastname, $n_account_status); + $phpgw->accounts->create('u', $account_lid, $n_passwd, $n_firstname, $n_lastname, $n_account_status); - $account_id = $phpgw->accounts->name2id($n_loginid); + $account_id = $phpgw->accounts->name2id($account_lid); $apps = CreateObject('phpgwapi.applications',array($account_id,'u')); $apps->read_installed_apps(); @@ -112,7 +112,7 @@ // Assign user to groups for ($i=0;$iacl->add_repository('phpgw_group',$n_groups[$i],$account_id,'u',1); + $phpgw->acl->add_repository('phpgw_group',$n_groups[$i],$account_id,1); } $pref = CreateObject('phpgwapi.preferences',$account_id); @@ -172,7 +172,7 @@ $phpgw->template->set_var('account_status',' checked'); } - $phpgw->template->set_var("n_loginid_value",$n_loginid); + $phpgw->template->set_var("n_loginid_value",$account_lid); $phpgw->template->set_var("lang_account_active",lang("Account active"));