From 6b1fde7e9a450ae8e4835f7e8c2ba1f398e78c1f Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 21 May 2015 04:14:10 -0400
Subject: [PATCH] Merge remote-tracking branch 'ispc/master'
---
interface/web/dashboard/dashlets/limits.php | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php
index 87898eb..2455da8 100644
--- a/interface/web/dashboard/dashlets/limits.php
+++ b/interface/web/dashboard/dashlets/limits.php
@@ -130,7 +130,7 @@
if($user_is_admin == false) {
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
- $client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
}
$rows = array();
@@ -143,10 +143,15 @@
}
if($value != 0 || $value == $wb['unlimited_txt']) {
$value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value;
+ $usage = $this->_get_limit_usage($limit);
+ $percentage = ($value == '-1' || $value == 0 ? 0 : round(100 * $usage / $value));
$rows[] = array('field' => $field,
'field_txt' => $wb[$field.'_txt'],
'value' => $value_formatted,
- 'usage' => $this->_get_limit_usage($limit));
+ 'value_raw' => $value,
+ 'usage' => $usage,
+ 'usage_raw' => $usage,
+ 'percentage' => $percentage);
}
}
$tpl->setLoop('rows', $rows);
@@ -159,10 +164,10 @@
function _get_limit_usage($limit) {
global $app;
- $sql = "SELECT count(sys_userid) as number FROM ".$app->db->quote($limit['db_table'])." WHERE ";
+ $sql = "SELECT count(sys_userid) as number FROM ?? WHERE ";
if($limit['db_where'] != '') $sql .= $limit['db_where']." AND ";
$sql .= $app->tform->getAuthSQL('r');
- $rec = $app->db->queryOneRecord($sql);
+ $rec = $app->db->queryOneRecord($sql, $limit['db_table']);
return $rec['number'];
}
--
Gitblit v1.9.1