diff --git a/admin/accounts.php b/admin/accounts.php index 1b6a029527..82d96071ce 100755 --- a/admin/accounts.php +++ b/admin/accounts.php @@ -86,4 +86,6 @@ $t->pparse("out","footer"); $phpgw->common->phpgw_footer(); + + account_close(); ?> diff --git a/admin/deleteaccount.php b/admin/deleteaccount.php index aab2b6397a..f108ffdd5f 100755 --- a/admin/deleteaccount.php +++ b/admin/deleteaccount.php @@ -62,4 +62,5 @@ Header("Location: " . $phpgw->link("accounts.php","cd=$cd")); } + account_close(); ?> diff --git a/admin/editaccount.php b/admin/editaccount.php index c15cddc184..a6ed23c11f 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -226,6 +226,7 @@ -common->phpgw_footer(); +common->phpgw_footer(); ?> diff --git a/admin/inc/accounts_ldap.inc.php b/admin/inc/accounts_ldap.inc.php index 49802f6129..bd3127b4ab 100644 --- a/admin/inc/accounts_ldap.inc.php +++ b/admin/inc/accounts_ldap.inc.php @@ -14,6 +14,15 @@ // Sections of code where taking from slapda http://www.jeremias.net/projects/sldapa by // Jason Jeremias + + $ldap = ldap_connect($phpgw_info["server"]["ldap_host"]); + + if (! ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) { + echo "

Error binding to LDAP server. Check your config"; + exit; + } + + function account_read($method,$start,$sort,$order) { @@ -21,7 +30,7 @@ function account_add($account_info) { - global $phpgw_info; + global $phpgw_info, $ldap; if ($phpgw_info["server"]["ldap_encryption_type"] == "DES") { $salt = randomstring(2); @@ -33,13 +42,6 @@ $userpassword = md5cryptpass($account_info["passwd"], $salt); } - $ldap = ldap_connect($phpgw_info["server"]["ldap_host"]); - - if (! ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) { - echo "

Error binding to LDAP server. Check your config"; - exit; - } - // Create our entry $entry["uid"] = $uid; $entry["uidNumber"] = $uidnumber; @@ -92,10 +94,22 @@ function account_delete($account_id) { + global $ldap; + $searchline = getSearchLine($searchstring); + $result = ldap_search($ldap, $BASEDN, $searchline); + $entry = ldap_get_entries($ldap, $result); + $numentries = $entry["count"]; + + @ldap_delete($ldap, $button); } function account_exsists($loginid) { } + + function account_close() + { + @ldap_close($ldap); + } diff --git a/admin/inc/accounts_sql.inc.php b/admin/inc/accounts_sql.inc.php index abf467cf9d..2d0e97b769 100755 --- a/admin/inc/accounts_sql.inc.php +++ b/admin/inc/accounts_sql.inc.php @@ -243,3 +243,9 @@ return $phpgw->db->f(0); } + + // This is need for LDAP, so this is a dummy function. + function account_close() + { + return True; + } diff --git a/admin/newaccount.php b/admin/newaccount.php index 0cb2a3f845..145d8cd487 100755 --- a/admin/newaccount.php +++ b/admin/newaccount.php @@ -138,5 +138,7 @@ $t->set_var("lang_button",Lang("Add")); $t->pparse("out","form"); + + account_close(); $phpgw->common->phpgw_footer(); ?>