3 require_once(
"../class/config.php");
6 "mode" => array (
"get",
"integer" ,0),
7 "sd" => array (
"get",
"integer" ,0),
8 "usr" => array (
"get",
"integer" ,0),
12 if (!$admin->enabled) {
13 __(
"This page is restricted to authorized staff");
17 include_once (
"head.php");
20 <h3><?php
__(
"Quotas status"); ?></h3>
25 echo
"<p class=\"alert alert-warning\">$error</p>";
29 <?php
__(
"This page shows the space and service count of your AlternC server and each AlternC accounts.");
30 echo
"<br /><br />"; printf(_(
"If you want to manage them, go to").
" <a href=\"adm_list.php\">"._(
"Administration -> Manage the Alternc accounts").
"</a>"); ?>
33 <?php printf(_(
"Sizes are shown as %s"),(
$mode==0 ||
$mode==4)?_(
"MB."):_(
"% of the total.")); ?>
36 <?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 />
37 <?php
__(
"Detailed view:"); ?>
38 <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>
39 <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>
40 <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>
41 <?php
if (
$mode != 4) { ?>
42 <?php
if ($usr==0) {
if ($sd==0) { ?>
43 <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>
45 <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>
48 <span
class=
"ina"><a href=
"quotas_users.php?mode=<?php echo $mode; ?>&sd=<?php echo $sd; ?>"><?php
__(
"All accounts"); ?></a></span>
53 <?php
if (
$mode == 4) {
59 $membres_list = $admin->get_list(0,
$cuid);
60 foreach ($membres_list as $n) {
61 $domList =
$dom->enum_domains($n[
"uid"]);
62 $mList[$n[
"uid"]] = array (
63 "login" => $n[
"login"],
64 "domaines" => $domList,
69 $dc = 0; $mc = 0; $mlc = 0; $dbc = 0;
71 foreach ($mList as $mUID => $mData)
73 $tmpweb = $quota->get_size_web_sum_user($mUID);
76 if (!empty($mData[
"domaines"]))
78 foreach ($mData[
"domaines"] as $domaine)
82 $tmpmail = $quota->get_size_mail_sum_domain($domaine);
84 $mc = $quota->get_size_mail_count_domain($domaine);
86 $tmplist = $quota->get_size_mailman_sum_domain($domaine);
91 $mlc = $quota->get_size_mailman_count_user($mUID);
92 $tmpdb = $quota->get_size_db_sum_user($mData[
"login"]);
94 $dbc = $quota->get_size_db_count_user($mData[
"login"]);
98 $totaltotal=$quota->get_size_unit($tmptotal);
102 $tmptotalweb = $quota->get_size_web_sum_all();
103 $totalweb=$quota->get_size_unit($tmptotalweb * 1024);
105 $tmptotalmail = $quota->get_size_mail_sum_all();
106 $totalmail=$quota->get_size_unit($tmptotalmail);
108 $tmptotallist = $quota->get_size_mailman_sum_all();
109 $totallist=$quota->get_size_unit($tmptotallist * 1024);
111 $tmptotaldb = $quota->get_size_db_sum_all();
112 $totaldb=$quota->get_size_unit($tmptotaldb);
114 $tmptotaltotal=($tmptotalweb*1024)+($tmptotallist*1024)+$tmptotalmail+($tmptotaldb/1024);
115 $totaltotal=$quota->get_size_unit($tmptotaltotal);
117 $dc =
$dom->count_domains_all();
118 $mc = $quota->get_size_mail_count_all();
119 $mlc = $quota->get_size_mailman_count_all();
120 $dbc = $quota->get_size_db_count_all();
126 <table
class=
"tedit" width=
"100%">
128 <tr><th> </th><th><?php
__(
"Count"); ?></th><th><?php
__(
"Space"); ?></th></tr>
132 <th><?php
__(
"Domains"); ?></th>
133 <td><?php echo $dc; ?></td>
137 <th><?php
__(
"Email addresses"); ?></th>
138 <td><?php echo $mc; ?></td>
143 <th><?php
__(
"Mailman lists"); ?></th>
144 <td><?php echo $mlc; ?></td>
149 <th><?php
__(
"MySQL Databases"); ?></th>
150 <td><?php echo $dbc; ?></td>
151 <td><?php echo sprintf(
"%.1f",
$totaldb[
'size']).
" ".
$totaldb[
'unit']; ?></td>
154 <th colspan=
"2"><?php
__(
"Total"); ?></th>
155 <td><?php echo sprintf(
"%.1f", $totaltotal[
'size']).
" ".$totaltotal[
'unit']; ?></td>
161 <?php } elseif ($usr==0) {
167 <table
class=
"tedit" width=
"100%">
169 <tr><th rowspan=
"2"><?php
__(
"Account"); ?></th><th colspan=
"3"><?php
__(
"Count"); ?></th><th colspan=
"5"><?php
__(
"Space"); ?></th></tr>
171 <th><?php
__(
"Dom"); ?></th>
172 <th><?php
__(
"Mails"); ?></th>
173 <th><?php
__(
"Lists"); ?></th>
174 <th><?php
__(
"Web"); ?></th>
175 <th><?php
__(
"Mails"); ?></th>
176 <th><?php
__(
"Lists"); ?></th>
177 <th><?php
__(
"DB"); ?></th>
178 <th><?php
__(
"Total"); ?></th>
187 $membres_list = $admin->get_list(0,
$cuid);
188 foreach ($membres_list as $minfo) {
189 $domList =
$dom->enum_domains($minfo[
'uid']);
190 $mList[$muid] = array (
191 "login" => $minfo[
'login'],
192 "domaines" => $domList,
197 $dc = 0; $mc = 0; $mlc = 0; $dbc = 0;
199 foreach ($mList as $mUID => $mData)
201 $tmpweb = $quota->get_size_web_sum_user($mUID);
204 if (!empty($mData[
"domaines"]))
206 foreach ($mData[
"domaines"] as $domaine)
210 $tmpmail = $quota->get_size_mail_sum_domain($domaine);
212 $mc = $quota->get_size_mail_count_domain($domaine);
214 $tmplist = $quota->get_size_mailman_sum_domain($domaine);
219 $mlc = $quota->get_size_mailman_count_user($mUID);
220 $tmpdb = $quota->get_size_db_sum_user($mData[
"login"]);
222 $dbc = $quota->get_size_db_count_user($mData[
"login"]);
228 $totalweb = $quota->get_size_web_sum_all();
230 $totallist = $quota->get_size_mailman_sum_all();
231 $totaldb = $quota->get_size_db_sum_all();
235 if ($totaltotal==0) $totaltotal=1;
238 $membres_list = $admin->get_list(0,
$cuid);
240 $membres_list = $admin->get_list(1);
243 foreach ($membres_list as
$c) {
248 echo
"<b><a href=\"quotas_users.php?mode=".$mode.
"&sd=".$sd.
"&usr=".$c[
"uid"].
"\">".$c[
"login"].
"</a></b><br />\n";
249 $domaines_list =
$dom->enum_domains($c[
"uid"]);
253 foreach ($domaines_list as
$d) {
254 if ($sd) echo
" - {$d}<br />\n";
256 $mstmp = $quota->get_size_mail_sum_domain($d);
258 $mlstmp = $quota->get_size_mailman_sum_domain($d);
262 $mailsize=$quota->get_size_unit($ms);
265 $mailmansize=$quota->get_size_unit($mls);
267 $mailmansize=$quota->get_size_unit($quota->get_size_mailman_sum_user($c[
"uid"]) * 1024);
270 $maildomains_list = $mail->enum_domains($c[
"uid"]);
272 foreach ($maildomains_list as $md) {
273 $mc += $md[
'nb_mail'];
277 if (
isset($mailman)) {
278 $mlc = $mailman->count_ml_user($c[
"uid"]);
279 echo
"</td><td>$dc</td><td>$mc</td><td>$mlc</td><td";
280 if (
$mode!=2) echo
" style=\"text-align: right\"";
285 $ws = $quota->get_size_web_sum_user($c[
"uid"]);
286 $webspace=$quota->get_size_unit($ws * 1024);
295 echo sprintf(
"%.1f", $webspace[
'size']).
" ".$webspace[
'unit'];
296 } elseif (
$mode==1) {
297 echo sprintf(
"%.1f",$pc).
" %";
299 #echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."\"/>";
300 $quota->quota_displaybar($pc);
303 if (
$mode!=2) echo
" style=\"text-align: right\"";
314 echo sprintf(
"%.1f", $mailsize[
'size']).
" ".$mailsize[
'unit'];
315 } elseif (
$mode==1) {
316 echo sprintf(
"%.1f",$pc).
" %";
318 #echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
319 $quota->quota_displaybar($pc);
323 if (
$mode!=2) echo
" style=\"text-align: right\"";
333 echo sprintf(
"%.1f", $mailmansize[
'size']).
" ".$mailmansize[
'unit'];
334 } elseif (
$mode==1) {
335 echo sprintf(
"%.1f",$pc).
" %";
337 #echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
338 $quota->quota_displaybar($pc);
342 if (
$mode!=2) echo
" style=\"text-align: right\"";
346 $ds = $quota->get_size_db_sum_user($c[
"login"]);
347 $dbsize=$quota->get_size_unit($ds);
355 echo sprintf(
"%.1f", $dbsize[
'size']).
" ".$dbsize[
'unit'];
356 } elseif (
$mode==1) {
357 echo sprintf(
"%.1f",$pc).
" %";
359 #echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
360 $quota->quota_displaybar($pc);
364 if (
$mode!=2) echo
" style=\"text-align: right\"";
367 $ts=$ds/1024+$ws+$ms/1024+$mls;
368 $totalsize=$quota->get_size_unit($ts * 1024);
370 echo sprintf(
"%.1f", $totalsize[
'size']).
" ".$totalsize[
'unit'];
371 } elseif (
$mode==1) {
372 echo sprintf(
"%.1f",(100*$ts/$totaltotal)).
" %";
375 $pc=intval(100*$ts/$totaltotal);
379 #echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
380 $quota->quota_displaybar($pc);
402 $c = $admin->get($usr);
403 $mcreator = $admin->get_creator($c[
'uid']);
404 if ($mcreator[
'uid'] ==
$cuid) {
408 $c = $admin->get($usr);
414 if ($oneuser_ok) { # quotas_oneuser.php will used prefilled $c
415 define(
"QUOTASONE",
"1");
416 require_once(
"quotas_oneuser.php");
421 <?php include_once(
"foot.php"); ?>