billing rewrite (disabling svn after)

git-svn-id: http://www.observium.org/svn/observer/trunk@2758 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-12-06 22:17:37 +00:00
parent b4855bcce8
commit a1e96f708f
212 changed files with 76139 additions and 260 deletions
+10 -2
View File
@@ -460,14 +460,12 @@ function format_si($rate, $round = 2)
if ($rate >= "0.1")
{
$sizes = Array('', 'k', 'M', 'G', 'T', 'P', 'E');
# $round = Array('2','2','2','2','2','2','2','2','2');
$ext = $sizes[0];
for ($i = 1; (($i < count($sizes)) && ($rate >= 1000)); $i++) { $rate = $rate / 1000; $ext = $sizes[$i]; }
}
else
{
$sizes = Array('', 'm', 'u', 'n');
# $round = Array('2','2','2','2');
$ext = $sizes[0];
for ($i = 1; (($i < count($sizes)) && ($rate != 0) && ($rate <= 0.1)); $i++) { $rate = $rate * 1000; $ext = $sizes[$i]; }
}
@@ -485,6 +483,16 @@ function format_bi($size, $round = '2')
return round($size, $round).$ext;
}
function format_number($value, $base = '1000', $round=2)
{
if($base == '1000')
{
return format_si($value, $round);
} else {
return format_bi($value, $round);
}
}
function is_valid_hostname($hostname)
{
// The Internet standards (Request for Comments) for protocols mandate that