Example #1
0
function finalize_timespan(&$timespan)
{
    if (!isset($timespan["current_value_date1"])) {
        /* Default end date is now default time span */
        $timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
    }
    if (!isset($timespan["current_value_date2"])) {
        /* Default end date is now */
        $timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
    }
    /* correct bad dates on calendar */
    if ($timespan["end_now"] < $timespan["begin_now"]) {
        set_preset_timespan($timespan);
        $_SESSION["sess_current_timespan"] = read_graph_config_option("default_timespan");
        $timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
        $timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
    }
    /* if moved to future although not allow by settings, stop at current time */
    if ($timespan["end_now"] > time() && read_graph_config_option("allow_graph_dates_in_future") == "") {
        $timespan["end_now"] = time();
        # convert end time to human readable format
        $timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
    }
    $_SESSION["sess_current_timespan_end_now"] = $timespan["end_now"];
    $_SESSION["sess_current_timespan_begin_now"] = $timespan["begin_now"];
    $_SESSION["sess_current_date1"] = $timespan["current_value_date1"];
    $_SESSION["sess_current_date2"] = $timespan["current_value_date2"];
    $timespan_sel_pos = strpos(get_browser_query_string(), "&predefined_timespan");
    if ($timespan_sel_pos) {
        $_SESSION["urlval"] = substr(get_browser_query_string(), 0, $timespan_sel_pos);
    } else {
        $_SESSION["urlval"] = get_browser_query_string();
    }
}
Example #2
0
function finalize_timespan(&$timespan)
{
    require_once CACTI_BASE_PATH . "/lib/sys/http.php";
    if (!isset($timespan["current_value_date1"])) {
        /* Default end date is now default time span */
        $timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
    }
    if (!isset($timespan["current_value_date2"])) {
        /* Default end date is now */
        $timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
    }
    /* correct bad dates on calendar */
    if ($timespan["end_now"] < $timespan["begin_now"]) {
        set_preset_timespan($timespan);
        $_SESSION["sess_current_timespan"] = read_graph_config_option("default_timespan");
        $timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
        $timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
    }
    /* if moved to future although not allow by settings, stop at current time */
    if ($timespan["end_now"] > time() && read_graph_config_option("allow_graph_dates_in_future") == "") {
        $timespan["end_now"] = time();
        # convert end time to human readable format
        $timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
    }
    $_SESSION["sess_current_timespan_end_now"] = $timespan["end_now"];
    $_SESSION["sess_current_timespan_begin_now"] = $timespan["begin_now"];
    $_SESSION["sess_current_date1"] = $timespan["current_value_date1"];
    $_SESSION["sess_current_date2"] = $timespan["current_value_date2"];
    # sanitize query_string for timespan and timeshift
    $browser_query_string = get_browser_query_string();
    $browser_query_string = preg_replace('/&predefined_timespan=\\d+/', '', $browser_query_string);
    $browser_query_string = preg_replace('/&predefined_timeshift=\\d+/', '', $browser_query_string);
    $_SESSION["urlval"] = $browser_query_string;
}
Example #3
0
function finalize_timespan(&$timespan) {
	if (!isset($timespan["current_value_date1"])) {
		/* Default end date is now default time span */
		$timespan["current_value_date1"] = date("Y", $timespan["begin_now"]) . "-" . date("m", $timespan["begin_now"]) . "-" . date("d", $timespan["begin_now"]) . " " . date("H", $timespan["begin_now"]) . ":".date("i", $timespan["begin_now"]);
	}

	if (!isset($timespan["current_value_date2"])) {
		/* Default end date is now */
		$timespan["current_value_date2"] = date("Y", $timespan["end_now"]) . "-" . date("m", $timespan["end_now"]) . "-" . date("d", $timespan["end_now"]) . " " . date("H", $timespan["end_now"]) . ":" . date("i", $timespan["end_now"]);
	}

	/* correct bad dates on calendar */
	if ($timespan["end_now"] < $timespan["begin_now"]) {
		set_preset_timespan($timespan);
		$_SESSION["sess_current_timespan"] = read_graph_config_option("default_timespan");

		$timespan["current_value_date1"] = date("Y", $timespan["begin_now"]) . "-" . date("m", $timespan["begin_now"]) . "-" . date("d", $timespan["begin_now"]) . " " . date("H", $timespan["begin_now"]) . ":".date("i", $timespan["begin_now"]);
		$timespan["current_value_date2"] = date("Y", $timespan["end_now"]) . "-" . date("m", $timespan["end_now"]) . "-" . date("d", $timespan["end_now"]) . " " . date("H", $timespan["end_now"]) . ":" . date("i", $timespan["end_now"]);
	}

	$_SESSION["sess_current_timespan_end_now"] = $timespan["end_now"];
	$_SESSION["sess_current_timespan_begin_now"] = $timespan["begin_now"];
	$_SESSION["sess_current_date1"] = $timespan["current_value_date1"];
	$_SESSION["sess_current_date2"] = $timespan["current_value_date2"];

	$timespan_sel_pos = strpos(get_browser_query_string(),"&predefined_timespan");
	if ($timespan_sel_pos) {
		$_SESSION["urlval"] = substr(get_browser_query_string(),0,$timespan_sel_pos);
	}else {
		$_SESSION["urlval"] = get_browser_query_string();
	}
}
Example #4
0
function finalize_timespan(&$timespan)
{
    if (!isset($timespan['current_value_date1'])) {
        /* Default end date is now default time span */
        $timespan['current_value_date1'] = date('Y-m-d H:i', $timespan['begin_now']);
    }
    if (!isset($timespan['current_value_date2'])) {
        /* Default end date is now */
        $timespan['current_value_date2'] = date('Y-m-d H:i', $timespan['end_now']);
    }
    /* correct bad dates on calendar */
    if ($timespan['end_now'] < $timespan['begin_now']) {
        set_preset_timespan($timespan);
        $_SESSION['sess_current_timespan'] = read_graph_config_option('default_timespan');
        $timespan['current_value_date1'] = date('Y-m-d H:i', $timespan['begin_now']);
        $timespan['current_value_date2'] = date('Y-m-d H:i', $timespan['end_now']);
    }
    /* if moved to future although not allow by settings, stop at current time */
    if ($timespan['end_now'] > time() && read_graph_config_option('allow_graph_dates_in_future') == '') {
        $timespan['end_now'] = time();
        # convert end time to human readable format
        $timespan['current_value_date2'] = date('Y-m-d H:i', $timespan['end_now']);
    }
    $_SESSION['sess_current_timespan_end_now'] = $timespan['end_now'];
    $_SESSION['sess_current_timespan_begin_now'] = $timespan['begin_now'];
    $_SESSION['sess_current_date1'] = $timespan['current_value_date1'];
    $_SESSION['sess_current_date2'] = $timespan['current_value_date2'];
    $timespan_sel_pos = strpos(get_browser_query_string(), '&predefined_timespan');
    if ($timespan_sel_pos) {
        $_SESSION['urlval'] = substr(get_browser_query_string(), 0, $timespan_sel_pos);
    } else {
        $_SESSION['urlval'] = get_browser_query_string();
    }
}