diff --git a/admin/accounts.php b/admin/accounts.php index 457526a87a..6072899ee1 100755 --- a/admin/accounts.php +++ b/admin/accounts.php @@ -46,11 +46,22 @@ $account_info = account_read($method,$start,$sort,$order); while (list($null,$account) = each($account_info)) { +// while (list($key) = each($account_info[0])) { +// for ($i=0; $i0: " . $account_info[1][$key]; +// echo "
1: " . $a[2]; +// echo "
2: " . $b[1]; + + $lastname = $account["account_lastname"]; + $firstname = $account["account_firstname"]; + $account_id = $account["account_id"]; + $loginid = $account["account_lid"]; + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $t->set_var("tr_color",$tr_color); - $lastname = $account["account_lastname"]; - $firstname = $account["account_firstname"]; +// $lastname = $account["account_lastname"]; +// $firstname = $account["account_firstname"]; if (! $lastname) $lastname = ' '; if (! $firstname) $firstname = ' '; @@ -58,17 +69,17 @@ $t->set_var("row_firstname",$firstname); $t->set_var("row_lastname",$lastname); $t->set_var("row_edit",' ' . lang("Edit") . ' '); + . $account_id) . '"> ' . lang("Edit") . ' '); if ($phpgw_info["user"]["userid"] != $account["account_lid"]) { $t->set_var("row_delete",' '.lang("Delete").' '); + . $account_id) . '"> '.lang("Delete").' '); } else { $t->set_var("row_delete"," "); } $t->set_var("row_view",' ' . lang("View") . ' '); + . $account_id) . '"> ' . lang("View") . ' '); if ($total == 1) { $t->set_var("output",""); diff --git a/admin/editaccount.php b/admin/editaccount.php index a6ed23c11f..d1cbb01840 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -24,16 +24,6 @@ Header("Location: " . $phpgw->link("accounts.php")); } - // This function is gonna go soon. (jengo) - function change_owner($app,$table,$field,$new,$old) - { - global $phpgw, $phpgw_info; - - if ($phpgw_info["apps"][$app]["enabled"] || ! $app) { - $phpgw->db->query("update $table set $field='$new' where $field='$old'"); - } - } - if ($submit) { if ($old_loginid != $n_loginid) { if (account_exsists($n_loginid)) { @@ -64,64 +54,8 @@ "groups" => $phpgw->accounts->groups_array_to_string($n_groups))); } - -// $phpgw->db->query("select account_lid from accounts where account_id=$account_id"); -// $phpgw->db->next_record(); -// $lid = $phpgw->db->f("account_lid"); - - -/* if (! $error) { - $phpgw->db->lock(array('accounts','preferences','sessions')); - if ($n_passwd) { - $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 session_pwd='" . addslashes($n_passwd) - . "' where session_lid='$lid'"); - } - while ($permission = each($new_permissions)) { - if ($phpgw_info["apps"][$permission[0]]["enabled"]) { - $phpgw->accounts->add_app($permission[0]); - } - } - - if (! $n_account_status) { - $n_account_status = "L"; - } - $cd = 27; - - // If they changed there loginid, we need to change the owner in ALL - // tables to reflect on the new one - if ($lid != $n_loginid) { - change_owner("","preferences","preference_owner",$n_loginid,$lid); - change_owner("addressbook","addressbook","ab_owner",$n_loginid,$lid); - change_owner("todo","todo","todo_owner",$n_loginid,$lid); - change_owner("","accounts","account_lid",$n_loginid,$lid); - change_owner("","sessions","session_lid",$n_loginid,$lid); - change_owner("calendar","webcal_entry","cal_create_by",$n_loginid,$lid); - change_owner("calendar","webcal_entry_user","cal_login",$n_loginid,$lid); - - if ($lid <> $n_loginid) { - $sep = $phpgw->common->filesystem_separator(); - - $basedir = $phpgw_info["server"]["files_dir"] . $sep . "users" . $sep; - - if (! @rename($basedir . $lid, $basedir . $n_loginid)) { - $cd = 35; - } - } - } - - $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->groups_array_to_string($n_groups) - . "' where account_lid='$n_loginid'"); - - $phpgw->db->unlock(); - Header("Location: " . $phpgw->link("accounts.php", "cd=$cd")); - exit; - } // if ! $error */ + Header("Location: " . $phpgw->link("accounts.php", "cd=$cd")); + exit; } // if $submit $phpgw->common->phpgw_header(); diff --git a/admin/inc/accounts_ldap.inc.php b/admin/inc/accounts_ldap.inc.php index 9900e3db06..b665c4ed7a 100644 --- a/admin/inc/accounts_ldap.inc.php +++ b/admin/inc/accounts_ldap.inc.php @@ -41,7 +41,14 @@ $sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("uid")); $info = ldap_get_entries($ldap, $sr); - return count($info); + $total = 0; + for ($i=0;$idb->next_record(); ldap_delete($ldap,"uid=" . $phpgw->db->f("account_lid") . ", ". $phpgw_info["server"]["ldap_context"]); + $phpgw->db->query("delete from accounts where account_id='$account_id'"); } function account_exsists($loginid) { + global $phpgw_info, $ldap; + $filter = "(|(uid=$loginid))"; + + $sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("uid")); + $total = ldap_get_entries($ldap, $sr); + + // Odd, but it works + if (count($total) == 2) { + return True; + } else { + return False; + } } function account_close() diff --git a/admin/inc/accounts_sql.inc.php b/admin/inc/accounts_sql.inc.php index 1a9846d772..bd7c824b83 100755 --- a/admin/inc/accounts_sql.inc.php +++ b/admin/inc/accounts_sql.inc.php @@ -140,9 +140,9 @@ } while ($permission = each($account_info["permissions"])) { - if ($phpgw_info["apps"][$permission[0]]["enabled"]) { - $phpgw->accounts->add_app($permission[0]); - } + if ($phpgw_info["apps"][$permission[0]]["enabled"]) { + $phpgw->accounts->add_app($permission[0]); + } } if (! $account_info["account_status"]) { @@ -150,27 +150,13 @@ } $cd = 27; - // If they changed there loginid, we need to change the owner in ALL - // tables to reflect on the new one - if ($lid != $account_info["loginid"]) { -/* - change_owner("","preferences","preference_owner",$account_info["loginid"],$lid); - change_owner("addressbook","addressbook","ab_owner",$account_info["loginid"],$lid); - change_owner("todo","todo","todo_owner",$account_info["loginid"],$lid); -// change_owner("","accounts","account_lid",$account_info["loginid"],$lid); - change_owner("","sessions","session_lid",$account_info["loginid"],$lid); - change_owner("calendar","webcal_entry","cal_create_by",$account_info["loginid"],$lid); - change_owner("calendar","webcal_entry_user","cal_login",$account_info["loginid"],$lid); -*/ - - if ($lid != $n_loginid) { - $sep = $phpgw->common->filesystem_separator(); + if ($account_info["c_loginid"] != $account_info["loginid"]) { + $sep = $phpgw->common->filesystem_separator(); - $basedir = $phpgw_info["server"]["files_dir"] . $sep . "users" . $sep; + $basedir = $phpgw_info["server"]["files_dir"] . $sep . "users" . $sep; - if (! @rename($basedir . $lid, $basedir . $account_info["loginid"])) { - $cd = 35; - } + if (! @rename($basedir . $lid, $basedir . $account_info["loginid"])) { + $cd = 35; } }