Merged in admin section changes

This commit is contained in:
jengo 2000-09-25 22:27:40 +00:00
parent 4008ac3e04
commit 066b5ff4fe
4 changed files with 47 additions and 47 deletions

View File

@ -27,13 +27,13 @@
if ($order)
$ordermethod = "order by $order $sort";
else
$ordermethod = "order by lastname,firstname,loginid asc";
$ordermethod = "order by account_lastname,account_firstname,account_lid asc";
if (! $sort)
$sort = "desc";
if ($query) {
$querymethod = " where firstname like '%$query%' OR lastname like '%$query%' OR loginid "
$querymethod = " where account_firstname like '%$query%' OR account_lastname like '%$query%' OR account_lid "
. "like '%$query%' ";
}
@ -50,8 +50,8 @@
$t->set_var("lang_user_accounts",lang("user accounts"));
$t->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$total));
$t->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"lastname",$order,"accounts.php",lang("last name")));
$t->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"firstname",$order,"accounts.php",lang("first name")));
$t->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"account_lastname",$order,"accounts.php",lang("last name")));
$t->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"account_firstname",$order,"accounts.php",lang("first name")));
$t->set_var("lang_edit",lang("Edit"));
$t->set_var("lang_delete",lang("Delete"));
@ -59,33 +59,33 @@
$t->parse("out","header");
$phpgw->db->query("select con,firstname,lastname,loginid from accounts $querymethod "
$phpgw->db->query("select account_id,account_firstname,account_lastname,account_lid from accounts $querymethod "
. "$ordermethod limit $limit");
while ($phpgw->db->next_record()) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var("tr_color",$tr_color);
$lastname = $phpgw->db->f("lastname");
$firstname = $phpgw->db->f("firstname");
$lastname = $phpgw->db->f("account_lastname");
$firstname = $phpgw->db->f("account_firstname");
if (! $lastname) $lastname = ' ';
if (! $firstname) $firstname = ' ';
$t->set_var("row_firstname",$firstname);
$t->set_var("row_lastname",$lastname);
$t->set_var("row_edit",'<a href="'.$phpgw->link("editaccount.php","con="
. $phpgw->db->f("con")) . '"> ' . lang("Edit") . ' </a>');
$t->set_var("row_edit",'<a href="'.$phpgw->link("editaccount.php","account_id="
. $phpgw->db->f("account_id")) . '"> ' . lang("Edit") . ' </a>');
if ($phpgw_info["user"]["userid"] != $phpgw->db->f("loginid")) {
$t->set_var("row_delete",'<a href="' . $phpgw->link("deleteaccount.php",'con='
. $phpgw->db->f("con")) . '"> '.lang("Delete").' </a>');
$t->set_var("row_delete",'<a href="' . $phpgw->link("deleteaccount.php",'account_id='
. $phpgw->db->f("account_id")) . '"> '.lang("Delete").' </a>');
} else {
$t->set_var("row_delete","&nbsp;");
}
$t->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "con="
. $phpgw->db->f("con")) . '"> ' . lang("View") . ' </a>');
$t->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "account_id="
. $phpgw->db->f("account_id")) . '"> ' . lang("View") . ' </a>');
if ($phpgw->db->num_rows() == 1) {
$t->set_var("output","");

View File

@ -11,7 +11,7 @@
/* $Id$ */
if ($confirm) {
if ($confirm || ! $account_id) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
}
@ -21,12 +21,12 @@
include("../header.inc.php");
// Make sure they are not attempting to delete there own account.
// If they are, they should not reach this point anyway.
if ($phpgw_info["user"]["con"] == $con) {
if ($phpgw_info["user"]["account_id"] == $account_id) {
Header("Location: " . $phpgw->link("accounts.php"));
exit;
}
if (($con) && (! $confirm)) {
if (($account_id) && (! $confirm)) {
?>
<center>
<table border=0 with=65%>
@ -45,7 +45,7 @@
<a href="<?php echo $phpgw->link("accounts.php") . "\">" . lang("No"); ?></a>
</td>
<td>
<a href="<?php echo $phpgw->link("deleteaccount.php","con=$con&confirm=true") . "\">" . lang("Yes"); ?></a>
<a href="<?php echo $phpgw->link("deleteaccount.php","account_id=$account_id&confirm=true") . "\">" . lang("Yes"); ?></a>
</td>
</tr>
</table>
@ -55,7 +55,7 @@
}
if ($confirm) {
$phpgw->db->query("select loginid from accounts where con=$con");
$phpgw->db->query("select account_lid from accounts where account_id=$account_id");
$phpgw->db->next_record();
$lid = $phpgw->db->f(0);
@ -82,7 +82,7 @@
$phpgw->db->query("delete from preferences where owner='$lid'");
$phpgw->db->query("delete from todo where todo_owner='$lid'");
$phpgw->db->query("delete from addressbook where ab_owner='$lid'");
$phpgw->db->query("delete from accounts where loginid='$lid'");
$phpgw->db->query("delete from accounts where account_lid='$lid'");
//$phpgw->db->query("delete from users_headlines where owner='$lid'");
//$phpgw->db->query("delete from profiles where owner='$lid'");

View File

@ -17,7 +17,7 @@
$phpgw_info["flags"]["disable_message_class"] = True;
$phpgw_info["flags"]["disable_send_class"] = True;
include("../header.inc.php");
if (! $con)
if (! $account_id)
Header("Location: " . $phpgw->link("accounts.php"));
function change_owner($app,$table,$field,$new,$old)
@ -30,9 +30,9 @@
}
if ($submit) {
$phpgw->db->query("select loginid from accounts where con=$con");
$phpgw->db->query("select account_lid from accounts where account_id=$account_id");
$phpgw->db->next_record();
$lid = $phpgw->db->f("loginid");
$lid = $phpgw->db->f("account_lid");
if ($n_passwd || $n_passwd_2) {
if ($n_passwd != $n_passwd_2){
@ -44,7 +44,7 @@
}
if ($lid != $n_loginid) {
$phpgw->db->query("select loginid from accounts where loginid='$n_loginid'");
$phpgw->db->query("select account_lid from accounts where account_lid='$n_loginid'");
if ($phpgw->db->num_rows() != 0) {
$error .= "<br>" . lang("That loginid has already been taken");
}
@ -56,10 +56,10 @@
if (! $error) {
$phpgw->db->lock(array('accounts','preferences','sessions'));
if ($n_passwd) {
$phpgw->db->query("update accounts set passwd='" . md5($n_passwd) . "', "
. "lastpasswd_change='" . time() . "' where loginid='" . "$lid'");
$phpgw->db->query("update accounts set account_pwd='" . md5($n_passwd) . "', "
. "account_lastpwd_change='" . time() . "' where account_lid='" . "$lid'");
$phpgw->db->query("update sessions set passwd='" . addslashes($n_passwd)
. "' where loginid='$lid'");
. "' where loginid='$lid'");
}
while ($permission = each($new_permissions)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
@ -99,12 +99,12 @@
}
}
$phpgw->db->query("update accounts set firstname='" . addslashes($n_firstname) . "',"
. " lastname='" . addslashes($n_lastname) . "', permissions='"
. $phpgw->accounts->add_app("",True) . "', status='"
. "$n_account_status', groups='"
. $phpgw->accounts->array_to_string("none",$n_groups)
. "' where loginid='$n_loginid'");
$phpgw->db->query("update accounts set account_firstname='" . addslashes($n_firstname) . "',"
. " account_lastname='" . addslashes($n_lastname) . "', account_permissions='"
. $phpgw->accounts->add_app("",True) . "', account_status='"
. "$n_account_status', account_groups='"
. $phpgw->accounts->array_to_string("none",$n_groups)
. "' where account_lid='$n_loginid'");
$phpgw->db->unlock();
Header("Location: " . $phpgw->link("accounts.php", "cd=$cd"));
@ -115,16 +115,16 @@
$phpgw->common->header();
$phpgw->common->navbar();
$phpgw->db->query("select loginid from accounts where con=$con");
$phpgw->db->query("select account_lid from accounts where account_id=$account_id");
$phpgw->db->next_record();
$db_perms = $phpgw->accounts->read_apps($phpgw->db->f("loginid"));
$db_perms = $phpgw->accounts->read_apps($phpgw->db->f("account_lid"));
$phpgw->db->query("select * from accounts where con=$con");
$phpgw->db->query("select * from accounts where account_id=$account_id");
$phpgw->db->next_record();
$account_status = $phpgw->db->f("status");
$account_status = $phpgw->db->f("account_status");
?>
<form method="POST" action="<?php echo $phpgw->link("editaccount.php"); ?>">
<input type="hidden" name="con" value="<? echo $con; ?>">
<input type="hidden" name="account_id" value="<? echo $account_id; ?>">
<?php
if ($error) {
echo "<center>" . lang("Error") . ":$error</center>";
@ -134,21 +134,21 @@
<table border=0 width=65%>
<tr>
<td><?php echo lang("LoginID"); ?></td>
<td><input name="n_loginid" value="<? echo $phpgw->db->f("loginid"); ?>"></td>
<td><input name="n_loginid" value="<? echo $phpgw->db->f("account_lid"); ?>"></td>
</tr>
<tr>
<td><?php echo lang("First Name"); ?></td>
<td><input name="n_firstname" value="<?echo $phpgw->db->f("firstname"); ?>"></td>
<td><input name="n_firstname" value="<?echo $phpgw->db->f("account_firstname"); ?>"></td>
</tr>
<tr>
<td><?php echo lang("Last Name"); ?></td>
<td><input name="n_lastname" value="<? echo $phpgw->db->f("lastname"); ?>"></td>
<td><input name="n_lastname" value="<? echo $phpgw->db->f("account_lastname"); ?>"></td>
</tr>
<tr>
<td><?php echo lang("Groups"); ?></td>
<td><select name="n_groups[]" multiple size="5">
<?php
$user_groups = $phpgw->accounts->read_group_names($phpgw->db->f("loginid"));
$user_groups = $phpgw->accounts->read_group_names($phpgw->db->f("account_lid"));
$phpgw->db->query("select * from groups");
while ($phpgw->db->next_record()) {

View File

@ -33,7 +33,7 @@
if (count($new_permissions) == 0)
$error .= "<br>" . lang("You must add at least 1 permission to this account");
$phpgw->db->query("select loginid from accounts where loginid='$n_loginid'");
$phpgw->db->query("select account_lid from accounts where account_lid='$n_loginid'");
$phpgw->db->next_record();
if ($phpgw->db->f("loginid"))
$error .= "<br>" . lang("That loginid has already been taken");
@ -68,11 +68,11 @@
if ($n_anonymous && ! $n_admin)
$phpgwpermissions->add("anonymous");
$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->accounts->add_app("",True)
. "','" . $phpgw->accounts->array_to_string("none",$n_groups) . "','A',0)";
$sql = "insert into accounts (account_lid,account_pwd,account_firstname,account_lastname,"
. "account_permissions,account_groups,account_status,account_lastpwd_change) values ('$n_loginid'"
. ",'" . md5($n_passwd) . "','" . addslashes($n_firstname) . "','"
. 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();