summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-05-30 09:52:51 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-05-30 09:52:51 +0000
commit37248fa7b984f33291fa9715f301787b17c28ee7 (patch)
treea5ee801c754c75201ce591b5efc6c3f348965ca5 /frontends/php
parent9245d334df5ddcce1806d870b21585e6e5b45472 (diff)
downloadzabbix-37248fa7b984f33291fa9715f301787b17c28ee7.tar.gz
zabbix-37248fa7b984f33291fa9715f301787b17c28ee7.tar.xz
zabbix-37248fa7b984f33291fa9715f301787b17c28ee7.zip
- merged rev. 4205:4207 from branches/1.4.1 (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@4208 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/chart.php2
-rw-r--r--frontends/php/chart2.php2
-rw-r--r--frontends/php/chart3.php2
-rw-r--r--frontends/php/charts.php6
-rw-r--r--frontends/php/history.php6
-rw-r--r--frontends/php/httpdetails.php2
-rw-r--r--frontends/php/include/defines.inc.php4
-rw-r--r--frontends/php/include/graphs.inc.php12
-rw-r--r--frontends/php/screens.php9
9 files changed, 28 insertions, 17 deletions
diff --git a/frontends/php/chart.php b/frontends/php/chart.php
index 1c230996..502c6c8e 100644
--- a/frontends/php/chart.php
+++ b/frontends/php/chart.php
@@ -33,7 +33,7 @@ include_once "include/page_header.php";
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
"itemid"=> array(T_ZBX_INT, O_MAND,P_SYS, DB_ID, null),
- "period"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(3600,365*24*3600), null),
+ "period"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(ZBX_MIN_PERIOD,ZBX_MAX_PERIOD), null),
"from"=> array(T_ZBX_INT, O_OPT, null, '{}>=0', null),
"width"=> array(T_ZBX_INT, O_OPT, null, '{}>0', null),
"height"=> array(T_ZBX_INT, O_OPT, null, '{}>0', null),
diff --git a/frontends/php/chart2.php b/frontends/php/chart2.php
index 15c6a9c9..a0dcbe60 100644
--- a/frontends/php/chart2.php
+++ b/frontends/php/chart2.php
@@ -34,7 +34,7 @@ include_once "include/page_header.php";
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
"graphid"=> array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null),
- "period"=> array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(3600,12*31*24*3600), null),
+ "period"=> array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD,ZBX_MAX_PERIOD), null),
"from"=> array(T_ZBX_INT, O_OPT, P_NZERO, null, null),
"stime"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null),
"border"=> array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null),
diff --git a/frontends/php/chart3.php b/frontends/php/chart3.php
index b5637aca..c9360b66 100644
--- a/frontends/php/chart3.php
+++ b/frontends/php/chart3.php
@@ -33,7 +33,7 @@ include_once "include/page_header.php";
<?php
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
- "period"=> array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(3600,12*31*24*3600), null),
+ "period"=> array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD,ZBX_MAX_PERIOD), null),
"from"=> array(T_ZBX_INT, O_OPT, P_NZERO, null, null),
"stime"=> array(T_ZBX_INT, O_OPT, P_NZERO, null, null),
"border"=> array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null),
diff --git a/frontends/php/charts.php b/frontends/php/charts.php
index 33725b73..d879e534 100644
--- a/frontends/php/charts.php
+++ b/frontends/php/charts.php
@@ -51,7 +51,7 @@ include_once "include/page_header.php";
"left"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
"right"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
"from"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
- "period"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
+ "period"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(ZBX_MIN_PERIOD,ZBX_MAX_PERIOD),NULL),
"stime"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL,NULL),
"action"=> array(T_ZBX_STR, O_OPT, P_SYS, IN("'go'"),NULL),
"reset"=> array(T_ZBX_STR, O_OPT, P_SYS, IN("'reset'"),NULL),
@@ -70,7 +70,7 @@ include_once "include/page_header.php";
$_REQUEST["keep"] = get_request("keep", 1); // possible excessed REQUEST variable !!!
- $_REQUEST["period"] = get_request("period",get_profile("web.graph[".$_REQUEST["graphid"]."].period", 3600));
+ $_REQUEST["period"] = get_request("period",get_profile("web.graph[".$_REQUEST["graphid"]."].period", ZBX_PERIOD_DEFAULT));
$effectiveperiod = navigation_bar_calc();
validate_group_with_host(PERM_READ_ONLY,array("allow_all_hosts","monitored_hosts","with_items", "always_select_first_host"));
@@ -85,7 +85,7 @@ include_once "include/page_header.php";
}
?>
<?php
- if($_REQUEST["graphid"] > 0 && $_REQUEST["period"] >= 3600)
+ if($_REQUEST["graphid"] > 0 && $_REQUEST["period"] >= ZBX_MIN_PERIOD)
{
update_profile("web.graph[".$_REQUEST["graphid"]."].period",$_REQUEST["period"]);
}
diff --git a/frontends/php/history.php b/frontends/php/history.php
index c2a0052f..0f655963 100644
--- a/frontends/php/history.php
+++ b/frontends/php/history.php
@@ -44,7 +44,7 @@ include_once "include/page_header.php";
"itemid"=> array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null),
"from"=> array(T_ZBX_INT, O_OPT, null, '{}>=0', null),
- "period"=> array(T_ZBX_INT, O_OPT, null, '{}>=3600', null),
+ "period"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(ZBX_MIN_PERIOD,ZBX_MAX_PERIOD), null),
"dec"=> array(T_ZBX_INT, O_OPT, null, null, null),
"inc"=> array(T_ZBX_INT, O_OPT, null, null, null),
"left"=> array(T_ZBX_INT, O_OPT, null, null, null),
@@ -129,8 +129,8 @@ include_once "include/page_header.php";
if($_REQUEST["action"]=="showgraph")
{
- $_REQUEST["period"] = get_request("period",get_profile("web.item[".$_REQUEST["itemid"]."].graph.period", 3600));
- if($_REQUEST["period"] >= 3600)
+ $_REQUEST["period"] = get_request("period",get_profile("web.item[".$_REQUEST["itemid"]."].graph.period", ZBX_PERIOD_DEFAULT));
+ if($_REQUEST["period"] >= ZBX_MIN_PERIOD)
{
update_profile("web.item[".$_REQUEST["itemid"]."].graph.period",$_REQUEST["period"]);
}
diff --git a/frontends/php/httpdetails.php b/frontends/php/httpdetails.php
index e5280203..354844da 100644
--- a/frontends/php/httpdetails.php
+++ b/frontends/php/httpdetails.php
@@ -36,7 +36,7 @@ include_once "include/page_header.php";
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
"from"=> array(T_ZBX_INT, O_OPT, null, '{}>=0', null),
- "period"=> array(T_ZBX_INT, O_OPT, null, '{}>=3600', null),
+ "period"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(ZBX_MIN_PERIOD,ZBX_MAX_PERIOD), null),
"dec"=> array(T_ZBX_INT, O_OPT, null, null, null),
"inc"=> array(T_ZBX_INT, O_OPT, null, null, null),
"left"=> array(T_ZBX_INT, O_OPT, null, null, null),
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 295fb00d..b4be08f6 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -390,6 +390,10 @@
define('ZBX_SIMPLE_EXPRESSION_FUNCTION_ID', 3);
define('ZBX_SIMPLE_EXPRESSION_PARAMETER_ID', 4);
+ define('ZBX_MIN_PERIOD', 3600);
+ define('ZBX_MAX_PERIOD', 12*31*24*3600);
+ define('ZBX_PERIOD_DEFAULT', ZBX_MIN_PERIOD);
+
global $_GET, $_POST, $_COOKIE, $_REQUEST;
/* Support for PHP5. PHP5 does not have $HTTP_..._VARS */
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php
index 1ab73968..d9d986ec 100644
--- a/frontends/php/include/graphs.inc.php
+++ b/frontends/php/include/graphs.inc.php
@@ -564,7 +564,7 @@
function navigation_bar_calc()
{
// $workingperiod = 3600;
- if(!isset($_REQUEST["period"])) $_REQUEST["period"]=3600;
+ if(!isset($_REQUEST["period"])) $_REQUEST["period"]=ZBX_PERIOD_DEFAULT;
if(!isset($_REQUEST["from"])) $_REQUEST["from"]=0;
if(!isset($_REQUEST["stime"])) $_REQUEST["stime"]=null;
@@ -581,12 +581,12 @@
unset($_REQUEST["left"]);
unset($_REQUEST["right"]);
- if($_REQUEST["from"] <= 0) $_REQUEST["from"] = 0;
- if($_REQUEST["period"] <= 3600) $_REQUEST["period"] = 3600;
+ if($_REQUEST["from"] <= 0) $_REQUEST["from"] = 0;
+ if($_REQUEST["period"] <= ZBX_MIN_PERIOD) $_REQUEST["period"] = ZBX_MIN_PERIOD;
if(isset($_REQUEST["reset"]))
{
- $_REQUEST["period"] = 3600;
+ $_REQUEST["period"] = ZBX_PERIOD_DEFAULT;
$_REQUEST["from"] = 0;
// $workingperiod = 3600;
}
@@ -608,10 +608,10 @@
$form->AddItem(S_PERIOD.SPACE);
- $period = get_request('period', 3600);
+ $period = get_request('period',ZBX_PERIOD_DEFAULT);
if(in_array($period,array(3600,2*3600,4*3600,8*3600,12*3600,24*3600,7*24*3600,31*24*3600,365*24*3600)))
- $custom_per = 3*3600;
+ $custom_per = ZBX_MIN_PERIOD;
else
$custom_per = $period;
diff --git a/frontends/php/screens.php b/frontends/php/screens.php
index f52e43b0..0b4b7b0c 100644
--- a/frontends/php/screens.php
+++ b/frontends/php/screens.php
@@ -55,7 +55,7 @@ include_once "include/page_header.php";
"from"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
"left"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
"right"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
- "period"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
+ "period"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(ZBX_MIN_PERIOD,ZBX_MAX_PERIOD),NULL),
"stime"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL,NULL),
"action"=> array(T_ZBX_STR, O_OPT, P_SYS, IN("'go'"),NULL),
"reset"=> array(T_ZBX_STR, O_OPT, P_SYS, IN("'reset'"),NULL),
@@ -68,6 +68,7 @@ include_once "include/page_header.php";
if( 2 != $_REQUEST["fullscreen"] )
update_profile('web.screens.config', $_REQUEST['config']);
+
?>
<?php
@@ -76,6 +77,12 @@ include_once "include/page_header.php";
if( 2 != $_REQUEST["fullscreen"] )
update_profile("web.screens.elementid",$_REQUEST["elementid"]);
+
+ $_REQUEST["period"] = get_request('period',get_profile('web.screens'.$_REQUEST['elementid'].'.period', ZBX_PERIOD_DEFAULT));
+ if($_REQUEST["period"] >= ZBX_MIN_PERIOD)
+ {
+ update_profile('web.screens'.$_REQUEST['elementid'].'.period',$_REQUEST['period']);
+ }
?>
<?php