diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
| commit | 28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch) | |
| tree | 8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/chart4.php | |
| parent | 495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff) | |
| download | zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.gz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.xz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.zip | |
- developed group permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/chart4.php')
| -rw-r--r-- | frontends/php/chart4.php | 124 |
1 files changed, 51 insertions, 73 deletions
diff --git a/frontends/php/chart4.php b/frontends/php/chart4.php index bd4529a0..05547607 100644 --- a/frontends/php/chart4.php +++ b/frontends/php/chart4.php @@ -19,99 +19,74 @@ **/ ?> <?php - include "include/config.inc.php"; + require_once "include/config.inc.php"; + require_once "include/triggers.inc.php"; -# PARAMETERS: - -# itemid -# type + $page["file"] = "chart4.php"; + $page["title"] = "S_CHART"; + $page["type"] = PAGE_TYPE_IMAGE; - $start_time=time(NULL); +include_once "include/page_header.php"; - if(!isset($_REQUEST["type"])) - { - $_REQUEST["type"]="week"; - } +?> +<?php +// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION + $fields=array( + "triggerid"=> array(T_ZBX_INT, O_MAND,P_SYS, DB_ID, NULL) + ); - if($_REQUEST["type"] == "month") - { - $period=30*24*3600; - } - else if($_REQUEST["type"] == "week") - { - $period=7*24*3600; - } - else if($_REQUEST["type"] == "year") - { - $period=365*24*3600; - } - else + check_fields($fields); +?> +<?php + $denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_MODE_LT); + + if(! ($db_data = DBfetch(DBselect('select distinct t.triggerid,t.description,h.host,h.hostid '. + ' from hosts h, items i, functions f, triggers t'. + ' where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and t.triggerid='.$_REQUEST["triggerid"]. + ' and i.hostid not in ('.$denyed_hosts.') ' + )))) { - $period=7*24*3600; - $type="week"; + access_deny(); } - $sizeX=900; - $sizeY=300; + $start_time = time(NULL); - $shiftX=12; - $shiftYup=17; - $shiftYdown=25+15*3; + $sizeX = 900; + $sizeY = 300; - - set_image_header(); - - check_authorisation(); + $shiftX = 12; + $shiftYup = 17; + $shiftYdown = 25+15*3; $im = imagecreate($sizeX+$shiftX+61,$sizeY+$shiftYup+$shiftYdown+10); - - $red=ImageColorAllocate($im,255,0,0); - $darkred=ImageColorAllocate($im,150,0,0); - $green=ImageColorAllocate($im,0,255,0); - $darkgreen=ImageColorAllocate($im,0,150,0); - $blue=ImageColorAllocate($im,0,0,255); - $darkblue=ImageColorAllocate($im,0,0,150); - $yellow=ImageColorAllocate($im,255,255,0); - $darkyellow=ImageColorAllocate($im,150,150,0); - $cyan=ImageColorAllocate($im,0,255,255); - $black=ImageColorAllocate($im,0,0,0); - $gray=ImageColorAllocate($im,150,150,150); - $white=ImageColorAllocate($im,255,255,255); - $bg=ImageColorAllocate($im,6+6*16,7+7*16,8+8*16); + + $red = ImageColorAllocate($im,255,0,0); + $darkred = ImageColorAllocate($im,150,0,0); + $green = ImageColorAllocate($im,0,255,0); + $darkgreen = ImageColorAllocate($im,0,150,0); + $bluei = ImageColorAllocate($im,0,0,255); + $darkblue = ImageColorAllocate($im,0,0,150); + $yellow = ImageColorAllocate($im,255,255,0); + $darkyellow = ImageColorAllocate($im,150,150,0); + $cyan = ImageColorAllocate($im,0,255,255); + $black = ImageColorAllocate($im,0,0,0); + $gray = ImageColorAllocate($im,150,150,150); + $white = ImageColorAllocate($im,255,255,255); + $bg = ImageColorAllocate($im,6+6*16,7+7*16,8+8*16); $x=imagesx($im); $y=imagesy($im); -// ImageFilledRectangle($im,0,0,$sizeX+$shiftX+61,$sizeY+$shiftYup+$shiftYdown+10,$white); ImageFilledRectangle($im,0,0,$x,$y,$white); ImageRectangle($im,0,0,$x-1,$y-1,$black); - if(!check_right_on_trigger("R",$_REQUEST["triggerid"])) - { -// show_table_header("<font color=\"AA0000\">No permissions !</font>"); -// show_page_footer(); - ImageOut($im); - ImageDestroy($im); - exit; - } - + $str = expand_trigger_description_by_data($db_data); -// $trigger=get_trigger_by_triggerid($_REQUEST["triggerid"]); -// $str=$trigger["description"]; - -// if( strstr($str,"%s")) -// { - $str=expand_trigger_description($_REQUEST["triggerid"]); -// } - - $str=$str." (year ".date("Y").")"; - $x=imagesx($im)/2-ImageFontWidth(4)*strlen($str)/2; + $str = $str." (year ".date("Y").")"; + $x = imagesx($im)/2-ImageFontWidth(4)*strlen($str)/2; ImageString($im, 4,$x,1, $str , $darkred); $now = time(NULL); - $to_time=$now; - $from_time=$to_time-$period; - $from_time_now=$to_time-24*3600; $count_now=array(); $true=array(); @@ -133,8 +108,6 @@ $false[$i]=$stat["false"]; $unknown[$i]=$stat["unknown"]; $count_now[$i]=1; - -// echo $true[$i]." ".$false[$i]."<br>"; } for($i=0;$i<=$sizeY;$i+=$sizeY/10) @@ -206,3 +179,8 @@ ImageOut($im); ImageDestroy($im); ?> +<?php + +include_once "include/page_footer.php"; + +?> |
