function process_user_input(&$timespan, $timeshift) { if (isset($_POST["date1"])) { /* the dates have changed, therefore, I am now custom */ if ($_SESSION["sess_current_date1"] != $_POST["date1"] || $_SESSION["sess_current_date2"] != $_POST["date2"]) { $timespan["current_value_date1"] = sanitize_search_string($_POST["date1"]); $timespan["begin_now"] = strtotime($timespan["current_value_date1"]); $timespan["current_value_date2"] = sanitize_search_string($_POST["date2"]); $timespan["end_now"] = strtotime($timespan["current_value_date2"]); $_SESSION["sess_current_timespan"] = GT_CUSTOM; $_SESSION["custom"] = 1; $_POST["predefined_timespan"] = GT_CUSTOM; } else { /* the default button wasn't pushed */ if (!isset($_POST["button_clear_x"])) { $timespan["current_value_date1"] = sanitize_search_string($_POST["date1"]); $timespan["current_value_date2"] = sanitize_search_string($_POST["date2"]); $timespan["begin_now"] = $_SESSION["sess_current_timespan_begin_now"]; $timespan["end_now"] = $_SESSION["sess_current_timespan_end_now"]; /* time shifter: shift left */ if (isset($_POST["move_left_x"])) { shift_time($timespan, "-", $timeshift); } /* time shifter: shift right */ if (isset($_POST["move_right_x"])) { shift_time($timespan, "+", $timeshift); } /* custom display refresh */ if ($_SESSION["custom"]) { $_SESSION["sess_current_timespan"] = GT_CUSTOM; /* refresh the display */ } else { $_SESSION["custom"] = 0; } } else { /* first time in */ set_preset_timespan($timespan); } } } else { if (isset($_GET["predefined_timespan"]) && $_GET["predefined_timespan"] != GT_CUSTOM || !isset($_SESSION["custom"]) || !isset($_GET["predefined_timespan"]) && $_SESSION["custom"] == 0 || !isset($_SESSION["sess_current_date1"])) { set_preset_timespan($timespan); } else { $timespan["current_value_date1"] = $_SESSION["sess_current_date1"]; $timespan["current_value_date2"] = $_SESSION["sess_current_date2"]; $timespan["begin_now"] = $_SESSION["sess_current_timespan_begin_now"]; $timespan["end_now"] = $_SESSION["sess_current_timespan_end_now"]; /* custom display refresh */ if ($_SESSION["custom"]) { $_SESSION["sess_current_timespan"] = GT_CUSTOM; } } } }
function process_user_input(&$timespan, $timeshift) { if (isset($_POST['date1'])) { /* the dates have changed, therefore, I am now custom */ if ($_SESSION['sess_current_date1'] != $_POST['date1'] || $_SESSION['sess_current_date2'] != $_POST['date2'] || isset($_REQUEST['custom'])) { $timespan['current_value_date1'] = sanitize_search_string($_POST['date1']); $timespan['begin_now'] = strtotime($timespan['current_value_date1']); $timespan['current_value_date2'] = sanitize_search_string($_POST['date2']); $timespan['end_now'] = strtotime($timespan['current_value_date2']); $_SESSION['sess_current_timespan'] = GT_CUSTOM; $_SESSION['custom'] = 1; $_POST['predefined_timespan'] = GT_CUSTOM; } else { /* the default button wasn't pushed */ if (!isset($_POST['button_clear_x'])) { $timespan['current_value_date1'] = sanitize_search_string($_POST['date1']); $timespan['current_value_date2'] = sanitize_search_string($_POST['date2']); $timespan['begin_now'] = $_SESSION['sess_current_timespan_begin_now']; $timespan['end_now'] = $_SESSION['sess_current_timespan_end_now']; /* time shifter: shift left */ if (isset($_POST['move_left_x'])) { shift_time($timespan, '-', $timeshift); } /* time shifter: shift right */ if (isset($_POST['move_right_x'])) { shift_time($timespan, '+', $timeshift); } /* custom display refresh */ if (isset($_SESSION['custom'])) { $_SESSION['sess_current_timespan'] = GT_CUSTOM; /* refresh the display */ } else { $_SESSION['custom'] = 0; } } else { /* first time in */ set_preset_timespan($timespan); } } } else { if (isset($_GET['predefined_timespan']) && $_GET['predefined_timespan'] != GT_CUSTOM || !isset($_SESSION['custom']) || !isset($_GET['predefined_timespan']) && $_SESSION['custom'] == 0 || !isset($_SESSION['sess_current_date1'])) { set_preset_timespan($timespan); } else { $timespan['current_value_date1'] = $_SESSION['sess_current_date1']; $timespan['current_value_date2'] = $_SESSION['sess_current_date2']; $timespan['begin_now'] = $_SESSION['sess_current_timespan_begin_now']; $timespan['end_now'] = $_SESSION['sess_current_timespan_end_now']; /* custom display refresh */ if ($_SESSION['custom']) { $_SESSION['sess_current_timespan'] = GT_CUSTOM; } } } }