bug fix: quota summary was inserted directly on main page without calling the appropriate hook.

This commit is contained in:
Remi 2016-02-24 14:49:33 +01:00
parent 79097f48da
commit 1c049f6bc6
3 changed files with 24 additions and 7 deletions

View File

@ -106,12 +106,17 @@ if($admin->enabled) {
echo "</p>";
} // if $admin->enabled
$c = $admin->get($cuid);
define("QUOTASONE","1");
echo "<hr/>";
require_once("quotas_oneuser.php");
$blocks=$hooks->invoke("hook_homepageblock");
uasort($blocks, function($a, $b) {return $a->order<$b->order ? -1 : 1;});
foreach ($blocks as $v) {
if (property_exists($v, "call")) {
$func=$v->call;
$func();
}
if (property_exists($v, "include")) {
include $v->include;
}
}
?>
<?php include_once("foot.php"); ?>

View File

@ -151,7 +151,7 @@ if (!isset($mode)) { # when included from adm_login, mode is not set
<!-- Mailing lists -->
<?php
$totallist = $quota->get_size_mailman_sum_user($c["uid"]);
$totallist = $quota->get_size_mailman_sum_user($mem->user["uid"]);
if ($totallist) {
// $totalweb is in KB, so we call get_size_unit() with it in Bytes
$t=$quota->get_size_unit($totallist * 1024);

View File

@ -80,9 +80,21 @@ class m_quota {
$obj['links'][] = array('txt' => 'progressbar', 'total' => $q[$key]["t"], 'used' => $q[$key]["u"]);
}
// do not return menu item if there is no quota
if (!count($obj['links'])) return false;
return $obj;
}
function hook_homepageblock() {
return (object)Array(
'pos' => 20,
'call'=> function() {
define("QUOTASONE","1");
},
'include' => "quotas_oneuser.php"
);
}
/* ----------------------------------------------------------------- */
/** Check if a user can use a ressource.