diff --git a/webui/model/group/group.php b/webui/model/group/group.php index 47e1bfad..94df45b8 100644 --- a/webui/model/group/group.php +++ b/webui/model/group/group.php @@ -168,16 +168,38 @@ class ModelGroupGroup extends Model { } } + sort($emails); + + if(strlen($s) == 1 && ENABLE_LDAP_AUTH == 1) { + $emails = array_slice($emails, $page * $page_len, $page_len); + } + return $emails; } public function count_emails($s = '') { - if(strlen($s) < 1) { return 0; } + $count = 0; + + if(strlen($s) < 1) { return $count; } + + if(ENABLE_LDAP_AUTH == 1) { + $ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD); + if($ldap->is_bind_ok()) { + + $query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=" . LDAP_ACCOUNT_OBJECTCLASS . ")(" . LDAP_MAIL_ATTR . "=" . $s . "*))", array()); + + if(isset($query->rows)) { + $count = $query->num_rows; + } + } + } $query = $this->db->query("SELECT COUNT(*) AS num FROM `" . TABLE_EMAIL . "` WHERE email LIKE ?", array($s . "%") ); - return $query->row['num']; + $count += $query->row['num']; + + return $count; } diff --git a/webui/view/theme/default/templates/group/add.tpl b/webui/view/theme/default/templates/group/add.tpl index 28e67932..b19df9d4 100644 --- a/webui/view/theme/default/templates/group/add.tpl +++ b/webui/view/theme/default/templates/group/add.tpl @@ -30,7 +30,7 @@
diff --git a/webui/view/theme/default/templates/group/edit.tpl b/webui/view/theme/default/templates/group/edit.tpl index ab31757e..254ef556 100644 --- a/webui/view/theme/default/templates/group/edit.tpl +++ b/webui/view/theme/default/templates/group/edit.tpl @@ -44,7 +44,7 @@ diff --git a/webui/view/theme/mobile/templates/group/add.tpl b/webui/view/theme/mobile/templates/group/add.tpl index b17c3036..0c1389b2 100644 --- a/webui/view/theme/mobile/templates/group/add.tpl +++ b/webui/view/theme/mobile/templates/group/add.tpl @@ -21,7 +21,7 @@ diff --git a/webui/view/theme/mobile/templates/group/edit.tpl b/webui/view/theme/mobile/templates/group/edit.tpl index d08cd8a4..c7bd19dd 100644 --- a/webui/view/theme/mobile/templates/group/edit.tpl +++ b/webui/view/theme/mobile/templates/group/edit.tpl @@ -23,7 +23,7 @@