26 require_once(
"../class/config.php");
29 "mode" => array (
"request",
"integer" ,0),
30 "sd" => array (
"request",
"integer" ,0),
31 "usr" => array (
"request",
"integer" ,0),
32 "order" => array (
"request",
"integer" ,0),
36 if (!$admin->enabled) {
37 $msg->raise(
"ERROR",
"admin", _(
"This page is restricted to authorized staff"));
38 echo
$msg->msg_html_all();
42 include_once (
"head.php");
45 <h3><?php
__(
"Quotas status"); ?></h3>
49 echo
$msg->msg_html_all();
52 <?php
__(
"This page shows the space and service count of your AlternC server and each AlternC accounts.");
53 echo
"<br /><br />"; printf(_(
"If you want to manage them, go to").
" <a href=\"adm_list.php\">"._(
"Administration -> Manage the Alternc accounts").
"</a>"); ?>
56 <?php printf(_(
"Sizes are shown as %s"),(
$mode==0 ||
$mode==4)?_(
"MB."):_(
"% of the total.")); ?>
59 <?php
__(
"Server-side view:"); ?> <span
class=
"ina <?php if ($mode==4) { echo 'ina-active'; } ?>"><a href=
"quotas_users.php?mode=4"><?php
__(
"Global"); ?></a></span><br /><br />
60 <?php
__(
"Detailed view:"); ?>
61 <span
class=
"ina <?php if ($mode==0) { echo 'ina-active'; } ?>"><a href=
"quotas_users.php?mode=0&sd=<?php echo $sd; ?>&usr=<?php echo $usr; ?>"><?php
__(
"In MB"); ?></a></span>
62 <span
class=
"ina <?php if ($mode==1) { echo 'ina-active'; } ?>"><a href=
"quotas_users.php?mode=1&sd=<?php echo $sd; ?>&usr=<?php echo $usr; ?>"><?php
__(
"Percentage"); ?></a></span>
63 <span
class=
"ina <?php if ($mode==2) { echo 'ina-active'; } ?>"><a href=
"quotas_users.php?mode=2&sd=<?php echo $sd; ?>&usr=<?php echo $usr; ?>"><?php
__(
"Graphical"); ?></a></span>
64 <?php
if (
$mode != 4) { ?>
65 <?php
if ($usr==0) {
if ($sd==0) { ?>
66 <span
class=
"ina"><a href=
"quotas_users.php?mode=<?php echo $mode; ?>&sd=1&usr=<?php echo $usr; ?>"><?php
__(
"Show the domain names"); ?></a></span>
68 <span
class=
"ina"><a href=
"quotas_users.php?mode=<?php echo $mode; ?>&sd=0&usr=<?php echo $usr; ?>"><?php
__(
"Hide the domain names"); ?></a></span>
71 <span
class=
"ina"><a href=
"quotas_users.php?mode=<?php echo $mode; ?>&sd=<?php echo $sd; ?>"><?php
__(
"All accounts"); ?></a></span>
76 <?php
if (
$mode == 4) {
82 $membres_list = $admin->get_list(0,
$cuid);
83 foreach ($membres_list as $n) {
84 $domList =
$dom->enum_domains($n[
"uid"]);
85 $mList[$n[
"uid"]] = array (
86 "login" => $n[
"login"],
87 "domaines" => $domList,
92 $dc = 0; $mc = 0; $mlc = 0; $dbc = 0;
94 foreach ($mList as $mUID => $mData)
96 $tmpweb = $quota->get_size_web_sum_user($mUID);
99 if (!empty($mData[
"domaines"]))
101 foreach ($mData[
"domaines"] as $domaine)
105 $tmpmail = $quota->get_size_mail_sum_domain($domaine);
107 $mc = $quota->get_size_mail_count_domain($domaine);
109 $tmplist = $quota->get_size_mailman_sum_domain($domaine);
114 $mlc = $quota->get_size_mailman_count_user($mUID);
115 $tmpdb = $quota->get_size_db_sum_user($mData[
"login"]);
117 $dbc = $quota->get_size_db_count_user($mData[
"login"]);
121 $totaltotal=$quota->get_size_unit($tmptotal);
125 $tmptotalweb = $quota->get_size_web_sum_all();
126 $totalweb=$quota->get_size_unit($tmptotalweb * 1024);
128 $tmptotalmail = $quota->get_size_mail_sum_all();
129 $totalmail=$quota->get_size_unit($tmptotalmail);
131 $tmptotallist = $quota->get_size_mailman_sum_all();
132 $totallist=$quota->get_size_unit($tmptotallist * 1024);
134 $tmptotaldb = $quota->get_size_db_sum_all();
135 $totaldb=$quota->get_size_unit($tmptotaldb);
137 $tmptotaltotal=($tmptotalweb*1024)+($tmptotallist*1024)+$tmptotalmail+$tmptotaldb;
138 $totaltotal=$quota->get_size_unit($tmptotaltotal);
140 $dc =
$dom->count_domains_all();
141 $mc = $quota->get_size_mail_count_all();
142 $mlc = $quota->get_size_mailman_count_all();
143 $dbc = $quota->get_size_db_count_all();
149 <table
class=
"tedit" width=
"100%">
151 <tr><th> </th><th><?php
__(
"Count"); ?></th><th><?php
__(
"Space"); ?></th></tr>
155 <th><?php
__(
"Domains"); ?></th>
156 <td><?php echo $dc; ?></td>
160 <th><?php
__(
"Email addresses"); ?></th>
161 <td><?php echo $mc; ?></td>
166 <th><?php
__(
"Mailman lists"); ?></th>
167 <td><?php echo $mlc; ?></td>
172 <th><?php
__(
"MySQL Databases"); ?></th>
173 <td><?php echo $dbc; ?></td>
174 <td><?php echo sprintf(
"%.1f",
$totaldb[
'size']).
" ".
$totaldb[
'unit']; ?></td>
177 <th colspan=
"2"><?php
__(
"Total"); ?></th>
178 <td><?php echo sprintf(
"%.1f", $totaltotal[
'size']).
" ".$totaltotal[
'unit']; ?></td>
184 <?php }
elseif ($usr==0) {
187 function sortlink($txt,$asc,$desc) {
188 global $order,
$mode,$sd,$usr;
189 if ($order==$asc) $neworder=$desc;
else $neworder=$asc;
191 if ($order==$asc) echo
" class=\"headerSortUp\"";
192 if ($order==$desc) echo
" class=\"headerSortDown\"";
194 echo
"<a href=\"quotas_users.php?order=".$neworder.
"&mode=".
$mode.
"&sd=".$sd.
"&usr=".$usr.
"\">";
204 <table
class=
"tedit" width=
"100%">
206 <tr><th rowspan=
"2"><?php sortlink(_(
"Account"),0,1); ?></th><th colspan=
"3"><?php
__(
"Count"); ?></th><th colspan=
"5"><?php
__(
"Space"); ?></th></tr>
208 <?php sortlink(_(
"Dom"),2,3); ?>
209 <?php sortlink(_(
"Mails"),4,5); ?>
210 <?php sortlink(_(
"Lists"),6,7); ?>
211 <?php sortlink(_(
"Web"),8,9); ?>
212 <?php sortlink(_(
"Mails"),10,11); ?>
213 <?php sortlink(_(
"Lists"),12,13); ?>
214 <?php sortlink(_(
"DB"),14,15); ?>
215 <?php sortlink(_(
"Total"),16,17); ?>
221 $afields=array(
"login",
"domaincount",
"mailcount",
"mailmancount",
"websize",
"mailsize",
"mailmansize",
"dbsize",
"totalsize");
226 $membres_list = $admin->get_list(0,
$cuid);
227 foreach ($membres_list as $minfo) {
228 $domList =
$dom->enum_domains($minfo[
'uid']);
229 $mList[$muid] = array (
230 "login" => $minfo[
'login'],
231 "domaines" => $domList,
236 $dc = 0; $mc = 0; $mlc = 0; $dbc = 0;
238 foreach ($mList as $mUID => $mData)
240 $tmpweb = $quota->get_size_web_sum_user($mUID);
243 if (!empty($mData[
"domaines"]))
245 foreach ($mData[
"domaines"] as $domaine)
249 $tmpmail = $quota->get_size_mail_sum_domain($domaine);
251 $mc = $quota->get_size_mail_count_domain($domaine);
253 $tmplist = $quota->get_size_mailman_sum_domain($domaine);
258 $mlc = $quota->get_size_mailman_count_user($mUID);
259 $tmpdb = $quota->get_size_db_sum_user($mData[
"login"]);
261 $dbc = $quota->get_size_db_count_user($mData[
"login"]);
267 $totalweb = $quota->get_size_web_sum_all();
269 $totallist = $quota->get_size_mailman_sum_all();
270 $totaldb = $quota->get_size_db_sum_all();
274 if ($totaltotal==0) $totaltotal=1;
277 $membres_list = $admin->get_list(0,
$cuid);
279 $membres_list = $admin->get_list(1);
287 foreach ($membres_list as
$c) {
292 $domaines_list =
$dom->enum_domains(
$c[
"uid"]);
296 $one[
"domains"]=array();
297 foreach ($domaines_list as
$d) {
299 $one[
"domains"][]=
$d;
300 $mstmp = $quota->get_size_mail_sum_domain(
$d);
302 $mlstmp = $quota->get_size_mailman_sum_domain(
$d);
305 $one[
"mailsize"]=$ms;
306 $one[
"mailmansize"]=$mls;
309 $maildomains_list = $mail->enum_domains(
$c[
"uid"]);
311 foreach ($maildomains_list as $md) {
312 $mc += $md[
'nb_mail'];
315 $one[
"mailcount"]=$mc;
316 $one[
"domaincount"]=$dc;
319 if (isset($mailman)) {
320 $mlc = $mailman->count_ml_user(
$c[
"uid"]);
321 $one[
"mailmancount"]=$mlc;
325 $ws = $quota->get_size_web_sum_user(
$c[
"uid"]);
330 $ds = $quota->get_size_db_sum_user(
$c[
"login"]);
333 $ts=$ds/1024+$ws+$ms/1024+$mls;
334 $one[
"totalsize"]=$ts;
339 $asc=(($order%2)==0);
340 $fie=$afields[intval($order/2)];
341 function mysort($a,$b) {
344 if ($a[$fie]<$b[$fie])
return -1;
345 if ($a[$fie]>$b[$fie])
return 1;
348 if ($a[$fie]<$b[$fie])
return 1;
349 if ($a[$fie]>$b[$fie])
return -1;
354 usort($all,
"mysort");
359 foreach ($all as
$c) {
364 echo
"<b><a href=\"quotas_users.php?mode=".$mode.
"&sd=".$sd.
"&usr=".
$c[
"uid"].
"\">".
$c[
"login"].
"</a></b><br />\n";
365 $domaines_list =
$dom->enum_domains(
$c[
"uid"]);
369 foreach (
$c[
"domains"] as
$d) {
370 if ($sd) echo
" - {$d}<br />\n";
374 $mls=
$c[
"mailmansize"];
376 $mailsize=$quota->get_size_unit($ms);
377 $mailmansize=$quota->get_size_unit($mls * 1024);
381 $webspace=$quota->get_size_unit($ws * 1024);
387 $dc=
$c[
"domaincount"];
389 $mlc=
$c[
"mailmancount"];
391 echo
"</td><td>$dc</td><td>$mc</td><td>$mlc</td><td";
392 if (
$mode!=2) echo
" style=\"text-align: right\"";
396 echo sprintf(
"%.1f", $webspace[
'size']).
" ".$webspace[
'unit'];
398 echo sprintf(
"%.1f",$pc).
" %";
400 $quota->quota_displaybar($pc);
403 if (
$mode!=2) echo
" style=\"text-align: right\"";
414 echo sprintf(
"%.1f", $mailsize[
'size']).
" ".$mailsize[
'unit'];
416 echo sprintf(
"%.1f",$pc).
" %";
418 $quota->quota_displaybar($pc);
422 if (
$mode!=2) echo
" style=\"text-align: right\"";
432 echo sprintf(
"%.1f", $mailmansize[
'size']).
" ".$mailmansize[
'unit'];
434 echo sprintf(
"%.1f",$pc).
" %";
436 $quota->quota_displaybar($pc);
440 if (
$mode!=2) echo
" style=\"text-align: right\"";
445 $dbsize=$quota->get_size_unit($ds);
453 echo sprintf(
"%.1f", $dbsize[
'size']).
" ".$dbsize[
'unit'];
455 echo sprintf(
"%.1f",$pc).
" %";
457 $quota->quota_displaybar($pc);
461 if (
$mode!=2) echo
" style=\"text-align: right\"";
470 echo sprintf(
"%.1f",(100*$ts/$totaltotal)).
" %";
473 $pc=intval(100*$ts/$totaltotal);
477 $quota->quota_displaybar($pc);
499 $c = $admin->get($usr);
500 $mcreator = $admin->get_creator(
$c[
'uid']);
501 if ($mcreator[
'uid'] ==
$cuid) {
505 $c = $admin->get($usr);
512 define(
"QUOTASONE",
"1");
513 require_once(
"quotas_oneuser.php");
518 <?php include_once(
"foot.php"); ?>
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
if(empty($site_name)) elseif($piwik->site_add( $site_name, $site_urls))
foreach($db_sizes as $d) if(count($db_sizes) > 0 && $mode==0) $totallist
foreach($domaines_user as $domaine) $totaldb
$fields
Display the quotas of one or some users.