2006-04-26 12:28:53 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
$Id: menu_quota.php,v 1.2 2003/06/10 06:42:25 root Exp $
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
AlternC - Web Hosting System
|
|
|
|
Copyright (C) 2002 by the AlternC Development Team.
|
|
|
|
http://alternc.org/
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Based on:
|
|
|
|
Valentin Lacambre's web hosting softwares: http://altern.org/
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License (GPL)
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Original Author of file:
|
|
|
|
Purpose of file:
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
2009-03-27 03:30:23 +00:00
|
|
|
|
|
|
|
$q=$quota->getquota();
|
|
|
|
|
|
|
|
$qlist=$quota->qlist();
|
|
|
|
reset($qlist);
|
2009-03-27 06:34:27 +00:00
|
|
|
$col=1;
|
2009-03-27 03:30:23 +00:00
|
|
|
|
|
|
|
echo '<dt id="#quotas">' . _("Quotas") . '</dt>';
|
|
|
|
echo '<dd><a href="quota_show.php">' . _("Show my quotas") . '</a></dd>';
|
|
|
|
|
|
|
|
if (!is_array($q)) {
|
|
|
|
// "No quotas for this account, or quotas currently unavailable
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (list($key,$val)=each($qlist)) {
|
|
|
|
$col=3-$col;
|
|
|
|
|
|
|
|
if (($key == 'bw_web' || $key == 'web') && ($q[$key]["t"] > 0)) {
|
|
|
|
if ($key == 'web') {
|
|
|
|
$q[$key]["u"] = $q[$key]["u"] * 1024;
|
2009-08-04 18:23:46 +00:00
|
|
|
$q[$key]["t"] = $q[$key]["t"] * 1024;
|
2009-03-27 03:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$usage_percent = (int) ($q[$key]["u"] / $q[$key]["t"] * 100);
|
|
|
|
$usage_color = ($q[$key]["u"] > $q[$key]["t"] ? '#f00' : '#0f0');
|
2009-03-27 06:34:27 +00:00
|
|
|
$usage_color = ((85 < $usage_percent && $usage_percent < 100) ? '#ff0' : $usage_color); // yellow
|
|
|
|
|
|
|
|
$url = ($key == 'bw_web' ? 'stats_show_per_month.php' : 'quota_show.php');
|
2009-03-27 03:30:23 +00:00
|
|
|
|
|
|
|
echo "<dd>";
|
2009-03-27 06:34:27 +00:00
|
|
|
echo '<div><a href="' . $url . '">' . /* _($val) */ $key . ' ' . $usage_percent . '%' . ' (' . format_size($q[$key]["u"]) . ' / ' . format_size($q[$key]["t"]) . ')</a></div>';
|
2009-03-27 03:30:23 +00:00
|
|
|
echo "</dd>";
|
|
|
|
echo "<dd>";
|
|
|
|
echo '<div style="width: 100%; background: #fff;">';
|
|
|
|
echo '<div style="width: ' . ($usage_percent > 100 ? 100 : $usage_percent) . '%; background: ' . $usage_color . ';"> </div>';
|
|
|
|
echo '</div>';
|
|
|
|
echo "</dd>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-27 06:34:27 +00:00
|
|
|
|