gui enhancements

This commit is contained in:
SJ
2013-08-22 11:24:54 +02:00
parent a9050a9f44
commit 760a76121a
23 changed files with 67 additions and 15 deletions

View File

@ -141,15 +141,34 @@ class ModelGroupGroup extends Model {
public function get_emails_by_string($s = '', $page = 0, $page_len = PAGE_LEN) {
$emails = array();
$from = (int)$page * (int)$page_len;
if(strlen($s) < 1) { return array(); }
$query = $this->db->query("SELECT email FROM `" . TABLE_EMAIL . "` WHERE email LIKE ? ORDER BY email ASC LIMIT " . (int)$from . ", " . (int)$page_len, array($s . "%") );
if(ENABLE_LDAP_AUTH == 1) {
$ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
if($ldap->is_bind_ok()) {
if(isset($query->rows)) { return $query->rows; }
$query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=" . LDAP_ACCOUNT_OBJECTCLASS . ")(" . LDAP_MAIL_ATTR . "=" . $s . "*))", array());
return array();
if(isset($query->rows)) {
$emails = $this->model_user_auth->get_email_array_from_ldap_attr($query->rows);
}
}
}
$query = $this->db->query("SELECT email FROM `" . TABLE_EMAIL . "` WHERE email LIKE ? ORDER BY email ASC LIMIT " . (int)$from . ", " . (int)$page_len, array($s . "%") );
if(isset($query->rows)) {
foreach($query->rows as $q) {
array_push($emails, $q['email']);
}
}
return $emails;
}

View File

@ -38,6 +38,10 @@ class ModelHealthHealth extends Model {
$today = $last_7_days = $last_30_days = 0;
$now = time();
$ts = $now - 3600;
$query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) { $last_60_mins = $query->row['count']; }
$ts = $now - 86400;
$query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) { $today = $query->row['count']; }
@ -50,7 +54,7 @@ class ModelHealthHealth extends Model {
$query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) { $last_30_days = $query->row['count']; }
return array($today, $last_7_days, $last_30_days);
return array($last_60_mins, $today, $last_7_days, $last_30_days);
}

View File

@ -157,7 +157,7 @@ class ModelUserAuth extends Model {
}
private function get_email_array_from_ldap_attr($e = array()) {
public function get_email_array_from_ldap_attr($e = array()) {
$data = array();
foreach($e as $a) {