Skip to content

Commit

Permalink
Remove old size unit selector code.
Browse files Browse the repository at this point in the history
  • Loading branch information
cafuego committed Sep 14, 2010
1 parent 32ac716 commit 17c0f2f
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions internode.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,35 +524,13 @@ function display_history() {
$string = sprintf("Daily Transfer: %s Total Transfer: %s", format_size($total / count($this->history)), format_size($total));
imagestring($im, 2, IMAGE_BORDER_LEFT+IMAGE_BORDER+imagefontwidth(2), (imagefontheight(2) * 3), $string, $darkgreen);

if($this->remaining > 0) {
if($this->remaining > 0) {
$string = sprintf("Daily Remaining: %s Total Remaining: %s", format_size($this->remaining / $this->days_remaining), format_size($this->remaining) );
imagestring($im, 2, IMAGE_BORDER_LEFT+IMAGE_BORDER+imagefontwidth(2), (imagefontheight(2) * 4), $string, $orange);
} else {
$over = abs($this->remaining);
if($over > (1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000)) {
$over /= (1000 * 1000 * 1000 * 1000 * 1000 * 1000);
$unit = "Yottabytes";
} else if($over > (1000 * 1000 * 1000 * 1000 * 1000 * 1000)) {
$over /= (1000 * 1000 * 1000 * 1000 * 1000);
$unit = "Zettabytes";
} else if($over > (1000 * 1000 * 1000 * 1000 * 1000)) {
$over /= (1000 * 1000 * 1000 * 1000);
$unit = "Exabytes";
} else if($over > (1000 * 1000 * 1000 * 1000)) {
$over /= (1000 * 1000 * 1000);
$unit = "Petabytes";
} else if($over > (1000 * 1000 * 1000)) {
$over /= (1000 * 1000);
$unit = "Tb";
} else if($over > (1000 * 1000)) {
$over /= 1000;
$unit = "Gb";
} else {
$unit = "Mb";
}
} else {
$string = sprintf("WARNING: You are %s over quota!", $this->format_size($over) );
imagestring($im, 2, IMAGE_BORDER_LEFT+IMAGE_BORDER+imagefontwidth(2), (imagefontheight(2) * 4), $string, $red);
}
}
} else {
$string = $string = sprintf("Graph Interval: %d days", count($this->history));
imagestring($im, 2, IMAGE_BORDER_LEFT+IMAGE_BORDER+imagefontwidth(2), (imagefontheight(2) * 2), $string, $blue);
Expand Down

0 comments on commit 17c0f2f

Please sign in to comment.