From 15fcaf6bbbed741b9992d11ebd69532e46ebf444 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Sun, 18 Mar 2001 03:34:56 +0000 Subject: [PATCH] Enhance exists() to not error due to empty $account_id --- phpgwapi/inc/class.accounts_ldap.inc.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index ba7ad335e1..587cb2234e 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -231,14 +231,15 @@ if (gettype($account_id) == "string") { $account_id = $this->name2id($account_id); } - $sql = "SELECT account_id FROM phpgw_accounts WHERE account_id=".$account_id; - $this->db->query($sql,__LINE__,__FILE__); - if ($this->db->num_rows() == 1) { - $insql = True; - } else { - $insql = False; + if ($account_id) { + $sql = "SELECT account_id FROM phpgw_accounts WHERE account_id=".$account_id; + $this->db->query($sql,__LINE__,__FILE__); + if ($this->db->num_rows() == 1) { + $insql = True; + } else { + $insql = False; + } } - $ds = $phpgw->common->ldapConnect(); $sri = ldap_search($ds, $phpgw_info["server"]["ldap_context"], "uid=".$account_lid); $allValues = ldap_get_entries($ds, $sri);