Converted the admin section to the new accounts class

This commit is contained in:
jengo 2000-08-26 19:20:27 +00:00
parent e542033680
commit 78880c948d
5 changed files with 30 additions and 33 deletions

View File

@ -47,9 +47,9 @@
$phpgw->common->navbar();
echo '<p><center>';
echo lang_admin("Sorry, the follow users are still a member of the group x",$group_name)
. '<br>' . lang_admin("They must be removed before you can continue")
. '</td></tr>';
echo lang_admin("Sorry, the follow users are still a member of the group x",$group_name)
. '<br>' . lang_admin("They must be removed before you can continue")
. '</td></tr>';
echo '<table border="0"><tr><td>';

View File

@ -63,13 +63,13 @@
while ($permission = each($new_permissions)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
$phpgw->permissions->add($permission[0]);
$phpgw->accounts->add_app($permission[0]);
}
}
//$phpgw->permissions->add("hr");
if ($new_permissions["anonymous"] && ! $new_permissions["admin"])
$phpgw->permissions->add("anonymous");
$phpgw->accounts->add_app("anonymous");
if (! $n_account_status)
$n_account_status = "L";
@ -99,7 +99,7 @@
$phpgw->db->query("update accounts set firstname='" . addslashes($n_firstname) . "',"
. " lastname='" . addslashes($n_lastname) . "', permissions='"
. $phpgw->permissions->add_rebuild() . "', status='"
. $phpgw->accounts->add_app("",True) . "', status='"
. "$n_account_status', groups='"
. $phpgw->groups->array_to_string("none",$n_groups)
. "' where loginid='$n_loginid'");
@ -113,11 +113,11 @@
$phpgw->common->header();
$phpgw->common->navbar();
$account_status = $phpgw->db->f("status");
$db_perms = $phpgw->accounts->read_apps($phpgw->db->f("loginid"));
$phpgw->db->query("select * from accounts where con='$con'");
$phpgw->db->next_record();
$account_status = $phpgw->db->f("status");
$db_perms = $phpgw->permissions->read_other($phpgw->db->f("loginid"));
?>
<form method="POST" action="editaccount.php">
@ -146,7 +146,7 @@
<td><?php echo lang_common("Groups"); ?></td>
<td><select name="n_groups[]" multiple size="5">
<?php
$user_groups = $phpgw->groups->read_names($phpgw->db->f("loginid"));
$user_groups = $phpgw->accounts->read_group_names($phpgw->db->f("loginid"));
$phpgw->db->query("select * from groups");
while ($phpgw->db->next_record()) {

View File

@ -41,26 +41,24 @@
$phpgw->db->lock(array("accounts","groups"));
$phpgw->db->query("update groups set group_name='$n_group', group_apps='"
. $phpgw->groups->array_to_string("none",$n_group_permissions)
. "' where group_id='$group_id'");
. $phpgw->accounts->array_to_string("none",$n_group_permissions)
. "' where group_id='$group_id'");
$phpgw->db->query("SELECT group_id FROM groups WHERE group_name='$n_group'");
$phpgw->db->next_record();
$phpgw->db->next_record();
$group_con = $phpgw->db->f("group_id");
for ($i=0; $i<count($n_users);$i++) {
$phpgw->db->query("SELECT groups FROM accounts WHERE con=".$n_users[$i]);
$phpgw->db->next_record();
$phpgw->db->next_record();
$user_groups = $phpgw->db->f("groups") . ",$group_con,";
$user_groups = ereg_replace(",,",",",$user_groups);
$phpgw->db->query("UPDATE accounts SET groups='$user_groups' WHERE con="
. $n_users[$i]);
$phpgw->db->query("UPDATE accounts SET groups='$user_groups' WHERE con='" . $n_users[$i] ."'");
}
$sep = $phpgw->common->filesystem_sepeartor();
$basedir = $phpgw_info["server"]["server_root"] . $sep . "filemanager" . $sep
. "groups" . $sep;
$basedir = $phpgw_info["server"]["server_root"] . $sep . "filemanager" . $sep . "groups" . $sep;
if (! @rename($basedir . $old_group_name, $basedir . $n_group)) {
$cd = 39;
@ -105,7 +103,7 @@
$selected_users[$phpgw->db->f("con")] = " selected";
}
$gp = $phpgw->groups->read_apps($group_id);
$gp = $phpgw->accounts->read_group_apps($group_id);
for ($i=0; $i<count($gp); $i++) {
$selected_permissions[$gp[$i]] = " selected";
@ -136,10 +134,10 @@
. "status != 'L' ORDER BY lastname,firstname,loginid asc");
while ($phpgw->db->next_record()) {
$user_list .= "<option value=\"" . $phpgw->db->f("con") . "\""
. $selected_users[$phpgw->db->f("con")] . ">"
. $phpgw->common->display_fullname($phpgw->db->f("loginid"),
$phpgw->db->f("firstname"),
$phpgw->db->f("lastname")) . "</option>";
. $selected_users[$phpgw->db->f("con")] . ">"
. $phpgw->common->display_fullname($phpgw->db->f("loginid"),
$phpgw->db->f("firstname"),
$phpgw->db->f("lastname")) . "</option>";
}
$t->set_var("user_list",$user_list);

View File

@ -55,7 +55,7 @@
while ($permission = each($new_permissions)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
$phpgw->permissions->add($permission[0]);
$phpgw->accounts->add_app($permission[0]);
}
}
//$phpgw->permissions->add("hr");
@ -66,8 +66,8 @@
$sql = "insert into accounts (loginid,passwd,firstname,lastname,"
. "permissions,groups,status,lastpasswd_change) values ('$n_loginid'"
. ",'" . md5($n_passwd) . "','" . addslashes($n_firstname) . "','"
. addslashes($n_lastname) . "','" . $phpgw->permissions->add_rebuild()
. "','" . $phpgw->groups->array_to_string("none",$n_groups) . "','A',0)";
. addslashes($n_lastname) . "','" . $phpgw->accounts->add_app("",True)
. "','" . $phpgw->accounts->array_to_string("none",$n_groups) . "','A',0)";
$phpgw->db->query($sql);
$phpgw->db->unlock();

View File

@ -34,19 +34,18 @@
$phpgw->db->query("INSERT INTO groups (group_name,group_apps) VALUES "
. "('$n_group','"
. $phpgw->groups->array_to_string("none",$n_group_permissions) . "') ");
. $phpgw->accounts->array_to_string("none",$n_group_permissions) . "') ");
$phpgw->db->query("SELECT group_id FROM groups WHERE group_name='$n_group'");
$phpgw->db->next_record();
$phpgw->db->next_record();
$group_con = $phpgw->db->f("group_id");
for ($i=0; $i<count($n_users);$i++) {
$phpgw->db->query("SELECT groups FROM accounts WHERE con=".$n_users[$i]);
$phpgw->db->next_record();
$phpgw->db->next_record();
$user_groups = $phpgw->db->f("groups") . ",$group_con,";
$user_groups = ereg_replace(",,",",",$user_groups);
$phpgw->db->query("UPDATE accounts SET groups='$user_groups' WHERE con="
. $n_users[$i]);
$phpgw->db->query("UPDATE accounts SET groups='$user_groups' WHERE con='" . $n_users[$i] . "'");
}
$sep = $phpgw->common->filesystem_sepeartor();
@ -97,8 +96,8 @@
$user_list .= "<option value=\"" . $phpgw->db->f("con") . "\""
. $selected_users[$phpgw->db->f("con")] . ">"
. $phpgw->common->display_fullname($phpgw->db->f("loginid"),
$phpgw->db->f("firstname"),
$phpgw->db->f("lastname")) . "</option>";
$phpgw->db->f("firstname"),
$phpgw->db->f("lastname")) . "</option>";
}
$t->set_var("user_list",$user_list);