bug fix: remove old references to unknown 'bw_web' quota values linking to not existing stats_show_per_month.php page and menu gadget

(anyone aiming to display custom menu gadget or size based quota could return in_menu=1 and type=size array values in hook_quota_get() function)
This commit is contained in:
Remi 2016-07-15 18:40:29 +02:00
parent e32e8837c0
commit 0c840f9f2e
2 changed files with 11 additions and 11 deletions

View File

@ -54,9 +54,7 @@ reset($qlist);
echo _($val);
if ($q[$key]["u"] >= $q[$key]["t"]) echo "</font>";
if ($key == 'bw_web') {
echo "&nbsp;</td><td>". format_size($q[$key]["u"]) ."&nbsp;</td><td>". format_size($q[$key]["t"]) ."&nbsp;</td>";
} elseif ($key == 'web') {
if (($key == 'web')||(isset($q[$key]['type'])&&($q[$key]['type']=='size'))) {
echo "&nbsp;</td><td>". format_size($q[$key]["u"] * 1024) . "&nbsp;</td><td>". format_size($q[$key]["t"] * 1024) ."&nbsp;</td>";
} else {
echo "&nbsp;</td><td>".$q[$key]["u"]."&nbsp;</td><td>".$q[$key]["t"]."&nbsp;</td>";

View File

@ -71,12 +71,14 @@ class m_quota {
$q = $this->getquota();
foreach (array('web', 'bw_web') as $key) {
foreach ($q as $key=>$value)
if (($key=="web")||(isset($value['in_menu'])&&$value['in_menu'])) {
if (!isset($q[$key]["u"]) || empty($q[$key]["t"])) {
continue;
}
$usage_percent = (int) ($q[$key]["u"] / $q[$key]["t"] * 100);
$obj['links'][] = array('txt' => _("quota_" . $key) . " " . sprintf(_("%s%% of %s"), $usage_percent, format_size($q[$key]["t"] * 1024)), 'url' => ($key == 'bw_web' ? 'stats_show_per_month.php' : 'quota_show.php'));
$obj['links'][] = array('txt' => _("quota_" . $key) . " " . sprintf(_("%s%% of %s"), $usage_percent, format_size($q[$key]["t"] * 1024)), 'url' => 'quota_show.php');
$obj['links'][] = array('txt' => 'progressbar', 'total' => $q[$key]["t"], 'used' => $q[$key]["u"]);
}