2009-09-08 05:29:38 +00:00
< ? php
require_once ( " ../class/config.php " );
2012-04-06 10:10:36 +00:00
$fields = array (
2016-05-23 13:03:13 +00:00
" mode " => array ( " request " , " integer " , 0 ),
" sd " => array ( " request " , " integer " , 0 ),
" usr " => array ( " request " , " integer " , 0 ),
" order " => array ( " request " , " integer " , 0 ),
2012-04-06 10:10:36 +00:00
);
getFields ( $fields );
2009-09-08 05:29:38 +00:00
if ( ! $admin -> enabled ) {
__ ( " This page is restricted to authorized staff " );
exit ();
}
include_once ( " head.php " );
?>
2012-08-24 12:43:05 +00:00
< h3 >< ? php __ ( " Quotas status " ); ?> </h3>
2010-06-02 22:20:39 +00:00
< hr id = " topbar " />
< br />
2009-09-08 05:29:38 +00:00
< ? php
2012-04-06 10:10:36 +00:00
if ( isset ( $error ) && $error ) {
2013-10-18 09:59:03 +00:00
echo " <p class= \" alert alert-warning \" > $error </p> " ;
2009-09-08 05:29:38 +00:00
}
?>
< p >
2013-01-21 15:56:04 +00:00
< ? php __ ( " This page shows the space and service count of your AlternC server and each AlternC accounts. " );
2013-01-21 16:15:20 +00:00
echo " <br /><br /> " ; printf ( _ ( " If you want to manage them, go to " ) . " <a href= \" adm_list.php \" > " . _ ( " Administration -> Manage the Alternc accounts " ) . " </a> " ); ?>
2012-08-24 10:19:55 +00:00
</ p >
< p >
2010-06-03 08:41:37 +00:00
< ? php printf ( _ ( " Sizes are shown as %s " ),( $mode == 0 || $mode == 4 ) ? _ ( " MB. " ) : _ ( " % of the total. " )); ?>
2009-09-08 05:29:38 +00:00
</ p >
< p >
2012-08-24 10:19:55 +00:00
< ? 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 />
2010-06-03 08:41:37 +00:00
< ? php __ ( " Detailed view: " ); ?>
2012-08-24 10:19:55 +00:00
< 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>
< 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>
< 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>
2009-09-08 05:29:38 +00:00
< ? php if ( $mode != 4 ) { ?>
< ? php if ( $usr == 0 ) { if ( $sd == 0 ) { ?>
2010-06-03 08:41:37 +00:00
< 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>
2009-09-08 05:29:38 +00:00
< ? php } else { ?>
2010-06-03 08:41:37 +00:00
< 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>
2009-09-08 05:29:38 +00:00
< ? php } } ?>
< ? php if ( $usr ) { ?>
2012-08-20 08:49:22 +00:00
< span class = " ina " >< a href = " quotas_users.php?mode=<?php echo $mode ; ?>&sd=<?php echo $sd ; ?> " >< ? php __ ( " All accounts " ); ?> </a></span>
2009-09-08 05:29:38 +00:00
< ? php } ?>
< ? php } ?>
</ p >
< ? php if ( $mode == 4 ) {
2013-10-18 09:59:03 +00:00
// Mode : affichage des donn<6E> es globales
2009-09-08 05:29:38 +00:00
if ( $cuid != 2000 )
{
$mList = array ();
2012-08-25 13:25:51 +00:00
$membres_list = $admin -> get_list ( 0 , $cuid );
foreach ( $membres_list as $n ) {
$domList = $dom -> enum_domains ( $n [ " uid " ]);
2009-09-08 05:29:38 +00:00
$mList [ $n [ " uid " ]] = array (
" login " => $n [ " login " ],
" domaines " => $domList ,
);
}
$totalweb = 0 ; $totalmail = 0 ; $totallist = 0 ; $totaldb = 0 ;
$dc = 0 ; $mc = 0 ; $mlc = 0 ; $dbc = 0 ;
foreach ( $mList as $mUID => $mData )
{
2012-08-24 16:14:15 +00:00
$tmpweb = $quota -> get_size_web_sum_user ( $mUID );
2009-09-08 05:29:38 +00:00
$totalweb += $tmpweb ;
if ( ! empty ( $mData [ " domaines " ]))
{
foreach ( $mData [ " domaines " ] as $domaine )
{
$dc ++ ;
2012-08-24 16:14:15 +00:00
$tmpmail = $quota -> get_size_mail_sum_domain ( $domaine );
2009-09-08 05:29:38 +00:00
$totalmail += $tmpmail ;
2012-08-24 16:14:15 +00:00
$mc = $quota -> get_size_mail_count_domain ( $domaine );
2009-09-08 05:29:38 +00:00
2012-08-24 16:14:15 +00:00
$tmplist = $quota -> get_size_mailman_sum_domain ( $domaine );
2009-09-08 05:29:38 +00:00
$totallist += $tmplist ;
}
}
2012-08-24 16:14:15 +00:00
$mlc = $quota -> get_size_mailman_count_user ( $mUID );
$tmpdb = $quota -> get_size_db_sum_user ( $mData [ " login " ]);
2012-12-26 10:21:14 +00:00
$totaldb += $tmpdb ;
2012-08-24 16:14:15 +00:00
$dbc = $quota -> get_size_db_count_user ( $mData [ " login " ]);
2009-09-08 05:29:38 +00:00
}
2012-12-26 10:21:14 +00:00
$tmptotal = $totalweb + $totallist + $totalmail + ( $totaldb / 1024 );
$totaltotal = $quota -> get_size_unit ( $tmptotal );
2009-09-08 05:29:38 +00:00
}
else
{
2012-12-26 10:21:14 +00:00
$tmptotalweb = $quota -> get_size_web_sum_all (); // In KB
$totalweb = $quota -> get_size_unit ( $tmptotalweb * 1024 );
2009-09-08 05:29:38 +00:00
2012-12-26 10:21:14 +00:00
$tmptotalmail = $quota -> get_size_mail_sum_all (); // In B
$totalmail = $quota -> get_size_unit ( $tmptotalmail );
$tmptotallist = $quota -> get_size_mailman_sum_all (); // IN KB
$totallist = $quota -> get_size_unit ( $tmptotallist * 1024 );
$tmptotaldb = $quota -> get_size_db_sum_all (); // IN B
$totaldb = $quota -> get_size_unit ( $tmptotaldb );
$tmptotaltotal = ( $tmptotalweb * 1024 ) + ( $tmptotallist * 1024 ) + $tmptotalmail + ( $tmptotaldb / 1024 ); // IN B
$totaltotal = $quota -> get_size_unit ( $tmptotaltotal );
2009-09-08 05:29:38 +00:00
2012-08-25 13:25:51 +00:00
$dc = $dom -> count_domains_all ();
2012-08-24 16:14:15 +00:00
$mc = $quota -> get_size_mail_count_all ();
$mlc = $quota -> get_size_mailman_count_all ();
$dbc = $quota -> get_size_db_count_all ();
2009-09-08 05:29:38 +00:00
}
?>
< center >
2013-04-29 15:58:09 +00:00
< div >
< table class = " tedit " width = " 100% " >
2009-09-08 05:29:38 +00:00
< thead >
2010-06-03 08:41:37 +00:00
< tr >< th >& nbsp ; </ th >< th >< ? php __ ( " Count " ); ?> </th><th><?php __("Space"); ?></th></tr>
2009-09-08 05:29:38 +00:00
</ thead >
< tbody >
< tr >
2010-06-03 08:41:37 +00:00
< th >< ? php __ ( " Domains " ); ?> </th>
< td >< ? php echo $dc ; ?> </td>
2012-12-26 10:21:14 +00:00
< td >< ? php echo sprintf ( " %.1f " , $totalweb [ 'size' ]) . " " . $totalweb [ 'unit' ]; ?> </td>
2009-09-08 05:29:38 +00:00
</ tr >
< tr >
2010-06-03 08:41:37 +00:00
< th >< ? php __ ( " Email addresses " ); ?> </th>
< td >< ? php echo $mc ; ?> </td>
2012-12-26 10:21:14 +00:00
< td >< ? php echo sprintf ( " %.1f " , $totalmail [ 'size' ]) . " " . $totalmail [ 'unit' ]; ?> </td>
2009-09-08 05:29:38 +00:00
</ tr >
2010-06-03 08:41:37 +00:00
< ? php if ( $mlc ) { ?>
2009-09-08 05:29:38 +00:00
< tr >
2010-06-03 08:41:37 +00:00
< th >< ? php __ ( " Mailman lists " ); ?> </th>
< td >< ? php echo $mlc ; ?> </td>
2012-12-26 10:21:14 +00:00
< td >< ? php echo sprintf ( " %.1f " , $totallist [ 'size' ]) . " " . $totallist [ 'unit' ]; ?> </td>
2009-09-08 05:29:38 +00:00
</ tr >
2010-06-03 08:41:37 +00:00
< ? php } ?>
2009-09-08 05:29:38 +00:00
< tr >
2010-06-03 08:41:37 +00:00
< th >< ? php __ ( " MySQL Databases " ); ?> </th>
< td >< ? php echo $dbc ; ?> </td>
2012-12-26 10:21:14 +00:00
< td >< ? php echo sprintf ( " %.1f " , $totaldb [ 'size' ]) . " " . $totaldb [ 'unit' ]; ?> </td>
2009-09-08 05:29:38 +00:00
</ tr >
< tr >
2010-06-03 08:41:37 +00:00
< th colspan = " 2 " >< ? php __ ( " Total " ); ?> </th>
2012-12-26 10:21:14 +00:00
< td >< ? php echo sprintf ( " %.1f " , $totaltotal [ 'size' ]) . " " . $totaltotal [ 'unit' ]; ?> </td>
2009-09-08 05:29:38 +00:00
</ tr >
</ tbody >
</ table >
</ div >
</ center >
< ? php } elseif ( $usr == 0 ) {
// Mode : affichage de tous les comptes
2015-07-31 13:47:51 +00:00
function sortlink ( $txt , $asc , $desc ) {
global $order , $mode , $sd , $usr ;
if ( $order == $asc ) $neworder = $desc ; else $neworder = $asc ;
echo " <a href= \" quotas_users.php?order= " . $neworder . " &mode= " . $mode . " &sd= " . $sd . " &usr= " . $usr . " \" > " ;
echo $txt ;
echo " </a> " ;
echo " " ;
if ( $order == $asc ) echo " <img src= \" icon/sort0.png \" alt= \" sorted up \" title= \" sorted up \" /> " ;
if ( $order == $desc ) echo " <img src= \" icon/sort1.png \" alt= \" sorted down \" title= \" sorted down \" /> " ;
}
2009-09-08 05:29:38 +00:00
?>
< center >
2013-04-29 15:58:09 +00:00
< div >
< table class = " tedit " width = " 100% " >
2009-09-08 05:29:38 +00:00
< thead >
2015-07-31 13:47:51 +00:00
< tr >< th rowspan = " 2 " >< ? php sortlink ( _ ( " Account " ), 0 , 1 ); ?> </th><th colspan="3"><?php __("Count"); ?></th><th colspan="5"><?php __("Space"); ?></th></tr>
2009-09-08 05:29:38 +00:00
< tr >
2015-07-31 13:47:51 +00:00
< th >< ? php sortlink ( _ ( " Dom " ), 2 , 3 ); ?> </th>
< th >< ? php sortlink ( _ ( " Mails " ), 4 , 5 ); ?> </th>
< th >< ? php sortlink ( _ ( " Lists " ), 6 , 7 ); ?> </th>
< th >< ? php sortlink ( _ ( " Web " ), 8 , 9 ); ?> </th>
< th >< ? php sortlink ( _ ( " Mails " ), 10 , 11 ); ?> </th>
< th >< ? php sortlink ( _ ( " Lists " ), 12 , 13 ); ?> </th>
< th >< ? php sortlink ( _ ( " DB " ), 14 , 15 ); ?> </th>
< th >< ? php sortlink ( _ ( " Total " ), 16 , 17 ); ?> </th>
2009-09-08 05:29:38 +00:00
</ tr >
</ thead >
< tbody >
< ? php
2015-07-31 13:47:51 +00:00
$afields = array ( " login " , " domaincount " , " mailcount " , " mailmancount " , " websize " , " mailsize " , " mailmansize " , " dbsize " , " totalsize " );
2009-09-08 05:29:38 +00:00
if ( $cuid != 2000 )
{
$mList = array ();
2012-08-25 13:25:51 +00:00
$membres_list = $admin -> get_list ( 0 , $cuid );
foreach ( $membres_list as $minfo ) {
$domList = $dom -> enum_domains ( $minfo [ 'uid' ]);
$mList [ $muid ] = array (
" login " => $minfo [ 'login' ],
2009-09-08 05:29:38 +00:00
" domaines " => $domList ,
);
}
$totalweb = 0 ; $totalmail = 0 ; $totallist = 0 ; $totaldb = 0 ;
$dc = 0 ; $mc = 0 ; $mlc = 0 ; $dbc = 0 ;
foreach ( $mList as $mUID => $mData )
{
2012-08-24 16:14:15 +00:00
$tmpweb = $quota -> get_size_web_sum_user ( $mUID );
2012-12-26 10:21:14 +00:00
$totalweb += $tmpweb ;
2009-09-08 05:29:38 +00:00
if ( ! empty ( $mData [ " domaines " ]))
{
foreach ( $mData [ " domaines " ] as $domaine )
{
$dc ++ ;
2012-12-26 10:21:14 +00:00
$tmpmail = $quota -> get_size_mail_sum_domain ( $domaine );
2009-09-08 05:29:38 +00:00
$totalmail += $tmpmail ;
2012-12-26 10:21:14 +00:00
$mc = $quota -> get_size_mail_count_domain ( $domaine );
2009-09-08 05:29:38 +00:00
2012-12-26 10:21:14 +00:00
$tmplist = $quota -> get_size_mailman_sum_domain ( $domaine );
2009-09-08 05:29:38 +00:00
$totallist += $tmplist ;
}
}
2012-08-25 13:25:51 +00:00
$mlc = $quota -> get_size_mailman_count_user ( $mUID );
2012-08-24 16:14:15 +00:00
$tmpdb = $quota -> get_size_db_sum_user ( $mData [ " login " ]);
2012-12-26 10:21:14 +00:00
$totaldb += $tmpdb ;
2012-08-24 16:14:15 +00:00
$dbc = $quota -> get_size_db_count_user ( $mData [ " login " ]);
2009-09-08 05:29:38 +00:00
}
}
else
{
2012-08-24 16:14:15 +00:00
$totalweb = $quota -> get_size_web_sum_all ();
$totalmail = $quota -> get_size_mail_sum_all ();
$totallist = $quota -> get_size_mailman_sum_all ();
$totaldb = $quota -> get_size_db_sum_all ();
2009-09-08 05:29:38 +00:00
}
2012-12-26 10:21:14 +00:00
$totaltotal = $totalweb + $totallist + ( $totalmail / 1024 ) + ( $totaldb / 1024 ); // In KB
2012-08-21 12:53:29 +00:00
if ( $totaltotal == 0 ) $totaltotal = 1 ;
2009-09-08 05:29:38 +00:00
2012-08-25 13:25:51 +00:00
if ( $cuid != 2000 ) {
$membres_list = $admin -> get_list ( 0 , $cuid );
} else {
$membres_list = $admin -> get_list ( 1 );
2009-09-08 05:29:38 +00:00
}
2015-07-31 13:47:51 +00:00
// ------------------------------------------------------------
// LOOP ON EACH MEMBER
$all = array ();
foreach ( $membres_list as $c ) {
$one = $c ;
2009-09-08 05:29:38 +00:00
// On affiche le compte et ses domaines :
2012-08-25 13:25:51 +00:00
$domaines_list = $dom -> enum_domains ( $c [ " uid " ]);
2009-09-08 05:29:38 +00:00
$dc = 0 ; // Domain Count
$ms = 0 ; // Mail Space
2012-08-25 13:25:51 +00:00
$mls = 0 ;
2015-07-31 13:47:51 +00:00
$one [ " domains " ] = array ();
2012-08-25 13:25:51 +00:00
foreach ( $domaines_list as $d ) {
2009-09-08 05:29:38 +00:00
$dc ++ ;
2015-07-31 13:47:51 +00:00
$one [ " domains " ][] = $d ;
2012-08-25 13:25:51 +00:00
$mstmp = $quota -> get_size_mail_sum_domain ( $d );
2009-09-08 05:29:38 +00:00
$ms += $mstmp ;
2012-08-25 13:25:51 +00:00
$mlstmp = $quota -> get_size_mailman_sum_domain ( $d );
2009-09-08 05:29:38 +00:00
$mls += $mlstmp ;
}
2015-07-31 13:47:51 +00:00
$one [ " mailsize " ] = $ms ;
$one [ " mailmainsize " ] = $mls ;
2012-12-26 10:21:14 +00:00
2009-09-08 05:29:38 +00:00
// Mail Count
2012-08-25 13:25:51 +00:00
$maildomains_list = $mail -> enum_domains ( $c [ " uid " ]);
$mc = 0 ;
foreach ( $maildomains_list as $md ) {
$mc += $md [ 'nb_mail' ];
}
2012-08-26 16:18:05 +00:00
2015-07-31 13:47:51 +00:00
$one [ " mailcount " ] = $mc ;
$one [ " domaincount " ] = $dc ;
2009-09-08 05:29:38 +00:00
// Mailman List Count
2013-01-31 08:36:12 +00:00
if ( isset ( $mailman )) {
$mlc = $mailman -> count_ml_user ( $c [ " uid " ]);
2015-07-31 13:47:51 +00:00
$one [ " mailmancount " ] = $mlc ;
2013-01-31 08:36:12 +00:00
}
2009-09-08 05:29:38 +00:00
// Espace WEB
2012-08-24 16:14:15 +00:00
$ws = $quota -> get_size_web_sum_user ( $c [ " uid " ]);
2015-07-31 13:47:51 +00:00
$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 " <tr><td> " ;
// On affiche le compte et ses domaines :
echo " <b><a href= \" quotas_users.php?mode= " . $mode . " &sd= " . $sd . " &usr= " . $c [ " uid " ] . " \" > " . $c [ " login " ] . " </a></b><br /> \n " ;
$domaines_list = $dom -> enum_domains ( $c [ " uid " ]);
$dc = 0 ; // Domain Count
$ms = 0 ; // Mail Space
$mls = 0 ;
foreach ( $c [ " domains " ] as $d ) {
if ( $sd ) echo " - { $d } <br /> \n " ;
}
$ms = $c [ " mailsize " ];
$mls = $c [ " mailmansize " ];
$mailsize = $quota -> get_size_unit ( $ms );
$mailmansize = $quota -> get_size_unit ( $mls );
// Espace WEB
$ws = $c [ " websize " ];
2012-12-26 10:21:14 +00:00
$webspace = $quota -> get_size_unit ( $ws * 1024 );
2015-07-31 13:47:51 +00:00
if ( isset ( $totalweb ) && $totalweb ){
$pc = intval ( 100 * $ws / $totalweb );
} else {
$pc = 0 ;
}
$dc = $c [ " domaincount " ];
$mc = $c [ " mailcount " ];
$mlc = $c [ " mailmancount " ];
2009-09-08 05:29:38 +00:00
2015-07-31 13:47:51 +00:00
echo " </td><td> $dc </td><td> $mc </td><td> $mlc </td><td " ;
if ( $mode != 2 ) echo " style= \" text-align: right \" " ;
echo " > " ;
2009-09-08 05:29:38 +00:00
if ( $mode == 0 ) {
2012-12-26 10:21:14 +00:00
echo sprintf ( " %.1f " , $webspace [ 'size' ]) . " " . $webspace [ 'unit' ];
2009-09-08 05:29:38 +00:00
} elseif ( $mode == 1 ) {
echo sprintf ( " %.1f " , $pc ) . " % " ;
} else {
2013-04-25 16:06:50 +00:00
#echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."\"/>";
$quota -> quota_displaybar ( $pc );
2009-09-08 05:29:38 +00:00
}
echo " </td><td " ;
if ( $mode != 2 ) echo " style= \" text-align: right \" " ;
echo " > " ;
// Espace Mail :
if ( $totalmail )
$pc = intval ( 100 * $ms / $totalmail );
else
$pc = 0 ;
if ( $mode == 0 ) {
2012-12-26 10:21:14 +00:00
echo sprintf ( " %.1f " , $mailsize [ 'size' ]) . " " . $mailsize [ 'unit' ];
2009-09-08 05:29:38 +00:00
} elseif ( $mode == 1 ) {
echo sprintf ( " %.1f " , $pc ) . " % " ;
} else {
2013-04-25 16:06:50 +00:00
#echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
$quota -> quota_displaybar ( $pc );
2009-09-08 05:29:38 +00:00
}
echo " </td><td " ;
if ( $mode != 2 ) echo " style= \" text-align: right \" " ;
echo " > " ;
// Espace Mailman :
if ( $totallist )
$pc = intval ( 100 * $mls / $totallist );
else
$pc = 0 ;
if ( $mode == 0 ) {
2012-12-26 10:21:14 +00:00
echo sprintf ( " %.1f " , $mailmansize [ 'size' ]) . " " . $mailmansize [ 'unit' ];
2009-09-08 05:29:38 +00:00
} elseif ( $mode == 1 ) {
echo sprintf ( " %.1f " , $pc ) . " % " ;
} else {
2013-04-25 16:06:50 +00:00
#echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
$quota -> quota_displaybar ( $pc );
2009-09-08 05:29:38 +00:00
}
echo " </td><td " ;
if ( $mode != 2 ) echo " style= \" text-align: right \" " ;
echo " > " ;
// Espace DB :
2015-07-31 13:47:51 +00:00
$ds = $c [ " dbsize " ];
2012-12-26 10:21:14 +00:00
$dbsize = $quota -> get_size_unit ( $ds );
2009-09-08 05:29:38 +00:00
if ( $totaldb )
$pc = intval ( 100 * $ds / $totaldb );
else
$pc = 0 ;
if ( $mode == 0 ) {
2012-12-26 10:21:14 +00:00
echo sprintf ( " %.1f " , $dbsize [ 'size' ]) . " " . $dbsize [ 'unit' ];
2009-09-08 05:29:38 +00:00
} elseif ( $mode == 1 ) {
echo sprintf ( " %.1f " , $pc ) . " % " ;
} else {
2013-04-25 16:06:50 +00:00
#echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
$quota -> quota_displaybar ( $pc );
2009-09-08 05:29:38 +00:00
}
echo " </td><td " ;
if ( $mode != 2 ) echo " style= \" text-align: right \" " ;
echo " > " ;
2015-07-31 13:47:51 +00:00
$ts = $c [ " totalsize " ];
2012-12-26 10:21:14 +00:00
$totalsize = $quota -> get_size_unit ( $ts * 1024 );
2009-09-08 05:29:38 +00:00
if ( $mode == 0 ) {
2012-12-26 10:21:14 +00:00
echo sprintf ( " %.1f " , $totalsize [ 'size' ]) . " " . $totalsize [ 'unit' ];
2009-09-08 05:29:38 +00:00
} elseif ( $mode == 1 ) {
echo sprintf ( " %.1f " ,( 100 * $ts / $totaltotal )) . " % " ;
} else {
2010-04-29 14:29:27 +00:00
if ( $totaltotal ) {
2009-09-08 05:29:38 +00:00
$pc = intval ( 100 * $ts / $totaltotal );
2010-04-29 14:29:27 +00:00
} else {
$pc = 0 ;
}
2013-04-25 16:06:50 +00:00
#echo "<img src=\"images/hippo_bleue.gif\" style=\"width: ".(1*$pc)."px; height: 16px\" alt=\"".$pc."%\" title=\"".$pc."%\"/>";
$quota -> quota_displaybar ( $pc );
2009-09-08 05:29:38 +00:00
}
echo " </td> " ;
echo " </tr> " ;
}
?>
</ tbody >
</ table >
</ div >
</ center >
< ? php
} else { // Mode affichage d'UN seul compte
2012-08-25 13:25:51 +00:00
$oneuser_ok = false ;
if ( $cuid != 2000 ) {
$c = $admin -> get ( $usr );
$mcreator = $admin -> get_creator ( $c [ 'uid' ]);
if ( $mcreator [ 'uid' ] == $cuid ) {
$oneuser_ok = true ;
}
} else {
$c = $admin -> get ( $usr );
if ( $c != false ) {
$oneuser_ok = true ;
}
2009-09-08 05:29:38 +00:00
}
2012-08-25 13:25:51 +00:00
if ( $oneuser_ok ) { # quotas_oneuser.php will used prefilled $c
2010-06-03 08:41:37 +00:00
define ( " QUOTASONE " , " 1 " );
require_once ( " quotas_oneuser.php " );
2009-09-08 05:29:38 +00:00
}
2012-08-25 13:25:51 +00:00
} // endif un seul compte
2009-09-08 05:29:38 +00:00
?>
< ? php include_once ( " foot.php " ); ?>