diff options
author | Darren Embry <dse@webonastick.com> | 2012-03-22 12:17:20 -0400 |
---|---|---|
committer | Darren Embry <dse@webonastick.com> | 2012-03-22 12:17:45 -0400 |
commit | 59418ceef6ffa89a9da38f4d4a1251dc73d5c05f (patch) | |
tree | 4f67bb89767222d4887256513cf9c810667bbbee | |
parent | 103a9d37f8577b1d7a58d6273457e5d4bf22223b (diff) | |
download | pfsense-59418ceef6ffa89a9da38f4d4a1251dc73d5c05f.zip pfsense-59418ceef6ffa89a9da38f4d4a1251dc73d5c05f.tar.gz |
Add date picker to the Custom RRD graph page to translate to unix time.
implements #1997.
http://redmine.pfsense.org/issues/1997
-rwxr-xr-x | usr/local/www/status_rrd_graph.php | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index 78acd9c..60d1cac 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -43,6 +43,8 @@ require_once("filter.inc"); require("shaper.inc"); require_once("rrd.inc"); +unset($input_errors); + /* if the rrd graphs are not enabled redirect to settings page */ if(! isset($config['rrd']['enable'])) { header("Location: status_rrd_graph_settings.php"); @@ -134,17 +136,29 @@ if ($_GET['option']) { $now = time(); if($curcat == "custom") { if (is_numeric($_GET['start'])) { - if($start < ($now - (3600 * 24 * 365 * 5))) { - $start = $now - (8 * 3600); - } - $start = $_GET['start']; - } else { + if($start < ($now - (3600 * 24 * 365 * 5))) { + $start = $now - (8 * 3600); + } + $start = $_GET['start']; + } else if ($_GET['start']) { + $start = strtotime($_GET['start']); + if ($start === FALSE || $start === -1) { + $input_errors[] = gettext("Invalid start date/time:") . " '{$_GET['start']}'"; $start = $now - (8 * 3600); + } + } else { + $start = $now - (8 * 3600); } } if (is_numeric($_GET['end'])) { $end = $_GET['end']; +} else if ($_GET['end']) { + $end = strtotime($_GET['end']); + if ($end === FALSE || $end === -1) { + $input_errors[] = gettext("Invalid end date/time:") . " '{$_GET['end']}'"; + $end = $now; + } } else { $end = $now; } @@ -324,6 +338,7 @@ function get_dates($curperiod, $graph) { ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> +<?php if ($input_errors && count($input_errors)) { print_input_errors($input_errors); } ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> @@ -463,11 +478,15 @@ function get_dates($curperiod, $graph) { <?php if($curcat == "custom") { + $tz = date_default_timezone_get(); + $tz_msg = gettext("Enter date and/or time. Current timezone:") . " $tz"; + $start_fmt = strftime("%m/%d/%Y %H:%M:%S %Z", $start); + $end_fmt = strftime("%m/%d/%Y %H:%M:%S %Z", $end); ?> <?=gettext("Start:");?> - <input type="text" name="start" class="formfldunknown" length="32" value="<?php echo $start;?>"> + <input title="<?= htmlentities($tz_msg); ?>." type="text" name="start" class="formfldunknown" size="32" length="32" value="<?= htmlentities($start_fmt); ?>"> <?=gettext("End:");?> - <input type="text" name="end" class="formfldunknown" length="32" value="<?php echo $end;?>"> + <input title="<?= htmlentities($tz_msg); ?>." type="text" name="end" class="formfldunknown" size="32" length="32" value="<?= htmlentities($end_fmt); ?>"> <input type="submit" name="Submit" value="<?=gettext("Go"); ?>"> <?php $curdatabase = $curoption; |