diff --git a/bureau/admin/quotas_users.php b/bureau/admin/quotas_users.php index c915f105..b96980b0 100644 --- a/bureau/admin/quotas_users.php +++ b/bureau/admin/quotas_users.php @@ -6,6 +6,7 @@ $fields = array ( "mode" => array ("get", "integer" ,0), "sd" => array ("get", "integer" ,0), "usr" => array ("get", "integer" ,0), + "order" => array ("get", "integer" ,0), ); getFields($fields); @@ -160,27 +161,41 @@ echo "

"; printf(_("If you want to manage them, go to")."  "; + echo $txt; + echo ""; + echo "     "; + if ($order==$asc) echo "\"sorted"; + if ($order==$desc) echo "\"sorted"; + } + ?>
- + - - - - - - - - + + + + + + + + get_list(1); } + + +// ------------------------------------------------------------ +// LOOP ON EACH MEMBER +$all=array(); foreach ($membres_list as $c) { + + $one=$c; + + // On affiche le compte et ses domaines : + $domaines_list = $dom->enum_domains($c["uid"]); + $dc=0; // Domain Count + $ms=0; // Mail Space + $mls=0; + $one["domains"]=array(); + foreach ($domaines_list as $d) { + $dc++; + $one["domains"][]=$d; + $mstmp = $quota->get_size_mail_sum_domain($d); + $ms+=$mstmp; + $mlstmp = $quota->get_size_mailman_sum_domain($d); + $mls+=$mlstmp; + } + $one["mailsize"]=$ms; + $one["mailmainsize"]=$mls; + + // Mail Count + $maildomains_list = $mail->enum_domains($c["uid"]); + $mc = 0; + foreach ($maildomains_list as $md) { + $mc += $md['nb_mail']; + } + + $one["mailcount"]=$mc; + $one["domaincount"]=$dc; + + // Mailman List Count + if (isset($mailman)) { + $mlc = $mailman->count_ml_user($c["uid"]); + $one["mailmancount"]=$mlc; + } + + // Espace WEB + $ws = $quota->get_size_web_sum_user($c["uid"]); + $one["websize"]=$ws; + // Espace Mail : + + // Espace DB : +$ds = $quota->get_size_db_sum_user($c["login"]); +$one["dbsize"]=$ds; + +$ts=$ds/1024+$ws+$ms/1024+$mls; // In KB +$one["totalsize"]=$ts; +$all[]=$one; +} + +// SORT this $all array +$asc=(($order%2)==0); +$fie=$afields[intval($order/2)]; +function mysort($a,$b) { + global $fie,$asc; + if ($asc) { + if ($a[$fie]<$b[$fie]) return -1; + if ($a[$fie]>$b[$fie]) return 1; + return 0; + } else { + if ($a[$fie]<$b[$fie]) return 1; + if ($a[$fie]>$b[$fie]) return -1; + return 0; + } + +} +usort($all,"mysort"); + + +// ------------------------------------------------------------ +// LOOP ON EACH MEMBER +foreach ($all as $c) { echo ""; - } + $mailmansize=$quota->get_size_unit($mls); // Espace WEB - $ws = $quota->get_size_web_sum_user($c["uid"]); + $ws = $c["websize"]; $webspace=$quota->get_size_unit($ws * 1024); - if (isset($totalweb) && $totalweb){ - $pc=intval(100*$ws/$totalweb); - } - else{ - $pc=0; - } + if (isset($totalweb) && $totalweb){ + $pc=intval(100*$ws/$totalweb); + } else { + $pc=0; + } + $dc=$c["domaincount"]; + $mc=$c["mailcount"]; + $mlc=$c["mailmancount"]; + echo ""; + if ($mode==0) { echo sprintf("%.1f", $webspace['size'])." ".$webspace['unit']; } elseif ($mode==1) { @@ -343,7 +420,7 @@ if ($mode!=2) echo " style=\"text-align: right\""; echo ">"; // Espace DB : -$ds = $quota->get_size_db_sum_user($c["login"]); +$ds = $c["dbsize"]; $dbsize=$quota->get_size_unit($ds); if ($totaldb) @@ -364,7 +441,7 @@ echo ""; -$ts=$ds/1024+$ws+$ms/1024+$mls; // In KB +$ts=$c["totalsize"]; $totalsize=$quota->get_size_unit($ts * 1024); if ($mode==0) { echo sprintf("%.1f", $totalsize['size'])." ".$totalsize['unit']; diff --git a/debian/changelog b/debian/changelog index 0dd0b1e9..bf5abe9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ alternc (3.1.7) oldoldstable; urgency=low * fix permission in browser not working * fix FTP access security UX * enh add DMARC and SPF management for gesmx & gesdns domains through variables + * fix error message '1' for locked domains + * enh sort added to quotas_users -- Benjamin Sonntag Thu, 16 Jun 2015 16:10:12 +0200
"; @@ -250,47 +342,32 @@ foreach ($membres_list as $c) { $dc=0; // Domain Count $ms=0; // Mail Space $mls=0; - foreach ($domaines_list as $d) { + foreach ($c["domains"] as $d) { if ($sd) echo "   - {$d}
\n"; - $dc++; - $mstmp = $quota->get_size_mail_sum_domain($d); - $ms+=$mstmp; - $mlstmp = $quota->get_size_mailman_sum_domain($d); - $mls+=$mlstmp; } + + $ms=$c["mailsize"]; + $mls=$c["mailmansize"]; $mailsize=$quota->get_size_unit($ms); - - if($mls != 0) - $mailmansize=$quota->get_size_unit($mls); - else - $mailmansize=$quota->get_size_unit($quota->get_size_mailman_sum_user($c["uid"]) * 1024); - - // Mail Count - $maildomains_list = $mail->enum_domains($c["uid"]); - $mc = 0; - foreach ($maildomains_list as $md) { - $mc += $md['nb_mail']; - } - - // Mailman List Count - if (isset($mailman)) { - $mlc = $mailman->count_ml_user($c["uid"]); - echo "
$dc$mc$mlc$dc$mc$mlc