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) if ($order)
$ordermethod = "order by $order $sort"; $ordermethod = "order by $order $sort";
else else
$ordermethod = "order by lastname,firstname,loginid asc"; $ordermethod = "order by account_lastname,account_firstname,account_lid asc";
if (! $sort) if (! $sort)
$sort = "desc"; $sort = "desc";
if ($query) { 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%' "; . "like '%$query%' ";
} }
@ -50,8 +50,8 @@
$t->set_var("lang_user_accounts",lang("user accounts")); $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("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_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,"firstname",$order,"accounts.php",lang("first 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_edit",lang("Edit"));
$t->set_var("lang_delete",lang("Delete")); $t->set_var("lang_delete",lang("Delete"));
@ -59,33 +59,33 @@
$t->parse("out","header"); $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"); . "$ordermethod limit $limit");
while ($phpgw->db->next_record()) { while ($phpgw->db->next_record()) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var("tr_color",$tr_color); $t->set_var("tr_color",$tr_color);
$lastname = $phpgw->db->f("lastname"); $lastname = $phpgw->db->f("account_lastname");
$firstname = $phpgw->db->f("firstname"); $firstname = $phpgw->db->f("account_firstname");
if (! $lastname) $lastname = ' '; if (! $lastname) $lastname = ' ';
if (! $firstname) $firstname = ' '; if (! $firstname) $firstname = ' ';
$t->set_var("row_firstname",$firstname); $t->set_var("row_firstname",$firstname);
$t->set_var("row_lastname",$lastname); $t->set_var("row_lastname",$lastname);
$t->set_var("row_edit",'<a href="'.$phpgw->link("editaccount.php","con=" $t->set_var("row_edit",'<a href="'.$phpgw->link("editaccount.php","account_id="
. $phpgw->db->f("con")) . '"> ' . lang("Edit") . ' </a>'); . $phpgw->db->f("account_id")) . '"> ' . lang("Edit") . ' </a>');
if ($phpgw_info["user"]["userid"] != $phpgw->db->f("loginid")) { if ($phpgw_info["user"]["userid"] != $phpgw->db->f("loginid")) {
$t->set_var("row_delete",'<a href="' . $phpgw->link("deleteaccount.php",'con=' $t->set_var("row_delete",'<a href="' . $phpgw->link("deleteaccount.php",'account_id='
. $phpgw->db->f("con")) . '"> '.lang("Delete").' </a>'); . $phpgw->db->f("account_id")) . '"> '.lang("Delete").' </a>');
} else { } else {
$t->set_var("row_delete","&nbsp;"); $t->set_var("row_delete","&nbsp;");
} }
$t->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "con=" $t->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "account_id="
. $phpgw->db->f("con")) . '"> ' . lang("View") . ' </a>'); . $phpgw->db->f("account_id")) . '"> ' . lang("View") . ' </a>');
if ($phpgw->db->num_rows() == 1) { if ($phpgw->db->num_rows() == 1) {
$t->set_var("output",""); $t->set_var("output","");

View File

@ -11,7 +11,7 @@
/* $Id$ */ /* $Id$ */
if ($confirm) { if ($confirm || ! $account_id) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
@ -21,12 +21,12 @@
include("../header.inc.php"); include("../header.inc.php");
// Make sure they are not attempting to delete there own account. // Make sure they are not attempting to delete there own account.
// If they are, they should not reach this point anyway. // 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")); Header("Location: " . $phpgw->link("accounts.php"));
exit; exit;
} }
if (($con) && (! $confirm)) { if (($account_id) && (! $confirm)) {
?> ?>
<center> <center>
<table border=0 with=65%> <table border=0 with=65%>
@ -45,7 +45,7 @@
<a href="<?php echo $phpgw->link("accounts.php") . "\">" . lang("No"); ?></a> <a href="<?php echo $phpgw->link("accounts.php") . "\">" . lang("No"); ?></a>
</td> </td>
<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> </td>
</tr> </tr>
</table> </table>
@ -55,7 +55,7 @@
} }
if ($confirm) { 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(); $phpgw->db->next_record();
$lid = $phpgw->db->f(0); $lid = $phpgw->db->f(0);
@ -82,7 +82,7 @@
$phpgw->db->query("delete from preferences where owner='$lid'"); $phpgw->db->query("delete from preferences where owner='$lid'");
$phpgw->db->query("delete from todo where todo_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 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 users_headlines where owner='$lid'");
//$phpgw->db->query("delete from profiles 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_message_class"] = True;
$phpgw_info["flags"]["disable_send_class"] = True; $phpgw_info["flags"]["disable_send_class"] = True;
include("../header.inc.php"); include("../header.inc.php");
if (! $con) if (! $account_id)
Header("Location: " . $phpgw->link("accounts.php")); Header("Location: " . $phpgw->link("accounts.php"));
function change_owner($app,$table,$field,$new,$old) function change_owner($app,$table,$field,$new,$old)
@ -30,9 +30,9 @@
} }
if ($submit) { 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(); $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) {
if ($n_passwd != $n_passwd_2){ if ($n_passwd != $n_passwd_2){
@ -44,7 +44,7 @@
} }
if ($lid != $n_loginid) { 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) { if ($phpgw->db->num_rows() != 0) {
$error .= "<br>" . lang("That loginid has already been taken"); $error .= "<br>" . lang("That loginid has already been taken");
} }
@ -56,10 +56,10 @@
if (! $error) { if (! $error) {
$phpgw->db->lock(array('accounts','preferences','sessions')); $phpgw->db->lock(array('accounts','preferences','sessions'));
if ($n_passwd) { if ($n_passwd) {
$phpgw->db->query("update accounts set passwd='" . md5($n_passwd) . "', " $phpgw->db->query("update accounts set account_pwd='" . md5($n_passwd) . "', "
. "lastpasswd_change='" . time() . "' where loginid='" . "$lid'"); . "account_lastpwd_change='" . time() . "' where account_lid='" . "$lid'");
$phpgw->db->query("update sessions set passwd='" . addslashes($n_passwd) $phpgw->db->query("update sessions set passwd='" . addslashes($n_passwd)
. "' where loginid='$lid'"); . "' where loginid='$lid'");
} }
while ($permission = each($new_permissions)) { while ($permission = each($new_permissions)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) { if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
@ -99,12 +99,12 @@
} }
} }
$phpgw->db->query("update accounts set firstname='" . addslashes($n_firstname) . "'," $phpgw->db->query("update accounts set account_firstname='" . addslashes($n_firstname) . "',"
. " lastname='" . addslashes($n_lastname) . "', permissions='" . " account_lastname='" . addslashes($n_lastname) . "', account_permissions='"
. $phpgw->accounts->add_app("",True) . "', status='" . $phpgw->accounts->add_app("",True) . "', account_status='"
. "$n_account_status', groups='" . "$n_account_status', account_groups='"
. $phpgw->accounts->array_to_string("none",$n_groups) . $phpgw->accounts->array_to_string("none",$n_groups)
. "' where loginid='$n_loginid'"); . "' where account_lid='$n_loginid'");
$phpgw->db->unlock(); $phpgw->db->unlock();
Header("Location: " . $phpgw->link("accounts.php", "cd=$cd")); Header("Location: " . $phpgw->link("accounts.php", "cd=$cd"));
@ -115,16 +115,16 @@
$phpgw->common->header(); $phpgw->common->header();
$phpgw->common->navbar(); $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(); $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(); $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"); ?>"> <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 <?php
if ($error) { if ($error) {
echo "<center>" . lang("Error") . ":$error</center>"; echo "<center>" . lang("Error") . ":$error</center>";
@ -134,21 +134,21 @@
<table border=0 width=65%> <table border=0 width=65%>
<tr> <tr>
<td><?php echo lang("LoginID"); ?></td> <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>
<tr> <tr>
<td><?php echo lang("First Name"); ?></td> <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>
<tr> <tr>
<td><?php echo lang("Last Name"); ?></td> <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>
<tr> <tr>
<td><?php echo lang("Groups"); ?></td> <td><?php echo lang("Groups"); ?></td>
<td><select name="n_groups[]" multiple size="5"> <td><select name="n_groups[]" multiple size="5">
<?php <?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"); $phpgw->db->query("select * from groups");
while ($phpgw->db->next_record()) { while ($phpgw->db->next_record()) {

View File

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