diff options
-rwxr-xr-x | usr/local/www/status_rrd_graph.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index 28e6220..14dc30d 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -227,11 +227,13 @@ function get_dates($curperiod, $graph) { break; } $start = mktime((8 + $houroffset), 0, 0, $curmonth, $curday, $curyear); - $end = mktime((8 + $houroffset) + 12, 0, 0, $curmonth, $curday, $curyear); + if($offset == 0) + $end = mktime((8 + $houroffset) + 12, 0, 0, $curmonth, $curday, $curyear); break; case "day": $start = mktime(0, 0, 0, $curmonth, ($curday + $offset), $curyear); - $end = mktime(0, 0, 0, $curmonth, (($curday + $offset) + 1), $curyear); + if($offset == 0) + $end = mktime(0, 0, 0, $curmonth, (($curday + $offset) + 1), $curyear); break; case "week": switch($offset) { @@ -243,23 +245,28 @@ function get_dates($curperiod, $graph) { break; } $start = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset), $curyear); - $end = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset + 7), $curyear); + if($offset == 0) + $end = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset + 7), $curyear); break; case "month": $start = mktime(0, 0, 0, ($curmonth + $offset), 0, $curyear); - $end = mktime(0, 0, 0, (($curmonth + $offset) + 1), 0, $curyear); + if($offset == 0) + $end = mktime(0, 0, 0, (($curmonth + $offset) + 1), 0, $curyear); break; case "quarter": $start = mktime(0, 0, 0, (($curmonth - 2) + $offset), 0, $curyear); - $end = mktime(0, 0, 0, (($curmonth + $offset) + 1), 0, $curyear); + if($offset == 0) + $end = mktime(0, 0, 0, (($curmonth + $offset) + 1), 0, $curyear); break; case "year": $start = mktime(0, 0, 0, 1, 0, ($curyear + $offset)); - $end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1)); + if($offset == 0) + $end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1)); break; case "4year": $start = mktime(0, 0, 0, 1, 0, (($curyear - 3) + $offset)); - $end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1)); + if($offset == 0) + $end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1)); break; } // echo "start $start ". date('l jS \of F Y h:i:s A', $start) .", end $end ". date('l jS \of F Y h:i:s A', $end) ."<br>"; |