summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-04-28 13:08:39 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-04-28 13:08:39 +0000
commit29da2c144f6f4f47675853484f89d507cf59eff9 (patch)
treea564e74e7871d7e5025aa45903ad5dfc01839893 /frontends/php/include
parente9a087354f00e6fe0c1af6c2e762390a2bd60d42 (diff)
- fixed 00:00-23:59 problem (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2789 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/classes/graph.inc.php17
-rw-r--r--frontends/php/include/config.inc.php19
2 files changed, 18 insertions, 18 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php
index da894065..743d6212 100644
--- a/frontends/php/include/classes/graph.inc.php
+++ b/frontends/php/include/classes/graph.inc.php
@@ -99,6 +99,7 @@
$this->colors["White"]= ImageColorAllocate($this->im,255,255,255);
$this->colors["Dark Red No Alpha"]= ImageColorAllocate($this->im,150,0,0);
$this->colors["Black No Alpha"]= ImageColorAllocate($this->im,0,0,0);
+ $this->colors["Not Work Period"]= ImageColorAllocate($this->im,230,230,230);
}
else
{
@@ -117,6 +118,8 @@
$this->colors["Dark Red No Alpha"]= ImageColorAllocate($this->im,150,0,0);
$this->colors["Black No Alpha"]= ImageColorAllocate($this->im,0,0,0);
+ $this->colors["Not Work Period"]= ImageColorAllocate($this->im,230,230,230);
+
}
}
@@ -262,7 +265,7 @@
function drawRectangle()
{
- ImageFilledRectangle($this->im,0,0,$this->sizeX+$this->shiftXleft+$this->shiftXright+1,$this->sizeY+$this->shiftY+62+12*$this->num+8,$this->colors["White"]);
+ ImageFilledRectangle($this->im,0,0,$this->sizeX+$this->shiftXleft+$this->shiftXright+1,$this->sizeY+$this->shiftY+62+12*$this->num+8,$this->colors[($this->m_showWorkPeriod != 1) ? "White" : "Not Work Period"]);
if($this->border==1)
{
ImageRectangle($this->im,0,0,imagesx($this->im)-1,imagesy($this->im)-1,$this->colors["Black No Alpha"]);
@@ -355,8 +358,6 @@
if($this->m_showWorkPeriod != 1) return;
if($this->period > 2678400) return; // > 31*24*3600 (month)
- $workPeriodColor = ImageColorAllocate($this->im,230,230,230);
-
$db_work_period = DBselect("select work_period from config");
$work_period = DBfetch($db_work_period);
if(!$work_period)
@@ -369,8 +370,6 @@
$now = time();
if(isset($this->stime))
{
-# $this->to_time=$this->stime+24*3600;
-# $this->from_time=$this->stime;
$this->from_time=$this->stime;
$this->to_time=$this->stime+$this->period;
}
@@ -384,11 +383,9 @@
$start = find_period_start($periods,$from);
$end = -1;
-
while($start < $max_time && $start > 0)
{
- $end = find_period_end($periods,$start);
- if($end >= ($max_time) || $end < 0) $end = $max_time;
+ $end = find_period_end($periods,$start,$max_time);
$x1 = round((($start-$from)*$this->sizeX)/$this->period) + $this->shiftXleft;
$x2 = round((($end-$from)*$this->sizeX)/$this->period) + $this->shiftXleft;
@@ -400,9 +397,9 @@
$this->shiftY,
$x2,
$this->sizeY+$this->shiftY,
- $workPeriodColor);
+ $this->colors["White"]);
- $start = find_period_start($periods,$end+60);
+ $start = find_period_start($periods,$end);
}
}
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 5cbc23ac..f350dc4c 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -708,7 +708,6 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
));
}
}
-//print_r($out);
return $out;
}
@@ -717,7 +716,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
$date = getdate($time);
$wday = $date['wday'] == 0 ? 7 : $date['wday'];
$curr = $date['hours']*100+$date['minutes'];
-//$debug = 1;
+
if(isset($periods[$wday]))
{
$next_h = -1;
@@ -735,7 +734,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
continue;
}
$per_end = $period['end_h']*100+$period['end_m'];
- if($per_end < $curr) continue;
+ if($per_end <= $curr) continue;
return $time;
}
if($next_h >= 0 && $next_m >= 0)
@@ -768,7 +767,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
return -1;
}
- function find_period_end($periods,$time)
+ function find_period_end($periods,$time,$max_time)
{
$date = getdate($time);
$wday = $date['wday'] == 0 ? 7 : $date['wday'];
@@ -797,15 +796,17 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
if($new_time == $time)
return $time;
+ if($new_time > $max_time)
+ return $max_time;
- $next_time = find_period_end($periods,$new_time);
+ $next_time = find_period_end($periods,$new_time,$max_time);
if($next_time < 0)
return $new_time;
else
return $next_time;
}
}
- return -1;
+ return $max_time;
}
function validate_period(&$str)
@@ -829,9 +830,11 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
if($arr[1] > $arr[2]) // check week day
return -1;
- if($arr[3] > 23 || $arr[5] > 23) // check hour
+ if($arr[3] > 23 || $arr[3] < 0 || $arr[5] > 24 || $arr[5] < 0) // check hour
+ return -1;
+ if($arr[4] > 59 || $arr[4] < 0 || $arr[6] > 59 || $arr[6] < 0) // check min
return -1;
- if($arr[4] > 59 || $arr[6] > 59) // check min
+ if(($arr[5]*100 + $arr[6]) > 2400) // check max time 24:00
return -1;
if(($arr[3] * 100 + $arr[4]) >= ($arr[5] * 100 + $arr[6])) // check time period
return -1;