=$old[0]))
{
// DISASTER
if(($new[0]-$old[0])/pow(10,5)>=1)
{
$audio="disaster_on.wav";
}
else
{
$audio="warning_on.wav";
}
}
// echo "$tr_hash
$triggers_hash
".$old[1]."
".$new[1];
?>
".S_NO_PERMISSIONS."");
show_footer();
exit;
}
if(isset($_GET["hostid"])&&!check_right("Host","R",$_GET["hostid"]))
{
show_table_header("".S_NO_PERMISSIONS."");
show_footer();
exit;
}
?>
";
}
?>
";
$h2=$h2."";
$h2=$h2.S_GROUP." ";
$h2=$h2."";
$h2=$h2." ".S_HOST." ";
$h2=$h2."";
$h2=$h2.nbsp(" ");
if(isset($_GET["select"])&&($_GET["select"]==""))
{
unset($_GET["select"]);
}
if(isset($_GET["select"]))
{
$h2=$h2."";
}
else
{
$h2=$h2."";
}
$h2=$h2.nbsp(" ");
$h2=$h2."";
// show_table_header_end();
show_header2($h1, $h2, "
");
?>
".S_ALL_SMALL." ";
}
else
{
echo "[".S_ALL_SMALL."] ";
}
while($row=DBfetch($result))
{
if(!check_right("Host","R",$row["hostid"]))
{
continue;
}
if(isset($_GET["hostid"]) && ($row["hostid"] == $_GET["hostid"]))
{
echo "[".$row["host"]."] ";
}
else
{
echo "".$row["host"]." ";
}
}*/
// show_table_v_delimiter(2);
// show_table_header_begin();
?>
".S_SHOW_ONLY_TRUE."] ";
}
else
{
$h1=$h1."[".S_SHOW_ALL_TRIGGERS."] ";
}
if($noactions!='true')
{
$h1=$h1."[".S_HIDE_ACTIONS."] ";
}
else
{
$h1=$h1."[".S_SHOW_ACTIONS."] ";
}
if($compact!='true')
{
$h1=$h1."[".S_HIDE_DETAILS."] ";
}
else
{
$h1=$h1."[".S_SHOW_DETAILS."] ";
}
if($select!='true')
{
$h1=$h1."[".S_SELECT."] ";
}
else
{
$h1=$h1."[".S_HIDE_SELECT."] ";
$h1=$h1."";
}
show_table_header($h1);
// echo "
";
}
$time=date("[H:i:s]",time());
if(isset($_GET["fullscreen"]))
{
show_table_header("".S_TRIGGERS_BIG." $time");
$cond="";
if(isset($_GET["hostid"]))
{
$cond=" and h.hostid=".$_GET["hostid"]." ";
}
if($onlytrue=='true')
{
$sql="select t.priority,count(*) from triggers t,hosts h,items i,functions f where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and t.triggerid=f.triggerid and t.description $select_cond and i.status=0 $cond group by 1";
}
else
{
$sql="select t.priority,count(*) from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and h.status=".HOST_STATUS_MONITORED." and t.description $select_cond and i.status=0 $cond group by 1";
}
$result=DBselect($sql);
$p0=$p1=$p2=$p3=$p4=$p5=0;
for($i=0;$i";
echo "";
table_td("".S_NOT_CLASSIFIED.": $p0","");
table_td("".S_INFORMATION.": $p1","");
table_td("".S_WARNING.": $p2","");
table_td("".S_AVERAGE.": $p3","BGCOLOR=#DDAAAA");
table_td("".S_HIGH.": $p4","BGCOLOR=#FF8888");
table_td("".S_DISASTER.": $p5","BGCOLOR=RED");
echo "
";
echo "";
}
else
{
// show_table_header("".S_TRIGGERS_BIG." $time");
}
table_begin();
$header=array();
echo "";
if(isset($_GET["fullscreen"]))
{
$fullscreen="&fullscreen=1";
}
else
{
$fullscreen="";
}
if(isset($sort) && $sort=="description")
{
$description=S_DESCRIPTION_BIG;
}
else
{
if($select=="TRUE")
$description="".S_DESCRIPTION;
else
$description="".S_DESCRIPTION."";
}
if($compact!='true') {$description=$description."
".S_EXPRESSION."";}
$header=array_merge($header,array($description));
$header=array_merge($header,array(S_STATUS));
if(!isset($sort)||(isset($sort) && $sort=="priority"))
{
$header=array_merge($header,array(S_SEVERITY_BIG));
}
else
{
if($select=="TRUE")
$header=array_merge($header,array("".S_SEVERITY.""));
else
$header=array_merge($header,array("".S_SEVERITY.""));
}
if(isset($sort) && $sort=="lastchange")
{
$header=array_merge($header,array(nbsp(S_LAST_CHANGE_BIG)));
}
else
{
if($select=="TRUE")
{
$header=array_merge($header,array("".nbsp(S_LAST_CHANGE).""));
}
else
{
$header=array_merge($header,array("".nbsp(S_LAST_CHANGE).""));
}
}
echo "";
if($noactions!='true')
{
$header=array_merge($header,array(S_ACTIONS));
}
$header=array_merge($header,array(S_COMMENTS));
table_header($header);
unset($header);
if(isset($_GET["hostid"]))
{
$cond=" and h.hostid=".$_GET["hostid"]." ";
}
else
{
$cond="";
}
if(!isset($sort))
{
$sort="priority";
}
switch ($sort)
{
case "description":
$sort="order by t.description";
break;
case "priority":
$sort="order by t.priority desc, t.description";
break;
case "lastchange":
$sort="order by t.lastchange desc, t.priority";
break;
default:
$sort="order by t.priority desc, t.description";
}
if($onlytrue=='true')
{
$result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and t.description $select_cond and t.triggerid=f.triggerid and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $sort");
}
else
{
$result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and t.description $select_cond and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $sort");
}
$col=0;
while($row=DBfetch($result))
{
if(!check_right_on_trigger("R",$row["triggerid"]))
{
continue;
}
// Check for dependencies
$sql="select count(*) from trigger_depends d, triggers t where d.triggerid_down=".$row["triggerid"]." and d.triggerid_up=t.triggerid and t.value=1";
$result2=DBselect($sql);
if(DBget_field($result2,0,0)>0)
{
continue;
}
$elements=array();
$description=expand_trigger_description($row["triggerid"]);
if($row["url"] != "")
{
$description="$description";
}
if($compact!='true')
{
$description=$description."
".explode_exp($row["expression"],1)."";
}
if( (time(NULL)-$row["lastchange"])<300)
{
$blink1="";
}
else
{
$blink1="";
$blink2="";
}
if($row["value"]==0)
$value=array("value"=>"$blink1".S_FALSE_BIG."$blink2","class"=>"off");
else if($row["value"]==2)
$value=array("value"=>"$blink1".S_UNKNOWN_BIG."$blink2","class"=>"unknown");
else
$value=array("value"=>S_TRUE_BIG,"class"=>"on");
if($row["priority"]==0) $priority=S_NOT_CLASSIFIED;
elseif($row["priority"]==1) $priority=S_INFORMATION;
elseif($row["priority"]==2) $priority=S_WARNING;
elseif($row["priority"]==3) $priority=array("value"=>S_AVERAGE,"class"=>"average");
elseif($row["priority"]==4) $priority=array("value"=>S_HIGH,"class"=>"high");
elseif($row["priority"]==5) $priority=array("value"=>S_DISASTER,"class"=>"disaster");
else $priority=$row["priority"];
$lastchange="".date(S_DATE_FORMAT_YMDHMS,$row["lastchange"])."";
$actions=array("hide"=>1);
if($noactions!='true')
{
$actions="".S_SHOW_ACTIONS." - ";
$actions=$actions."".S_HISTORY." - ";
if(isset($_GET["hostid"]))
{
$actions=$actions."".S_CHANGE."";
}
else
{
$actions=$actions."".S_CHANGE."";
}
}
$comments=array("hide"=>1);;
if($row["comments"] != "")
{
$comments="".S_SHOW."";
}
else
{
$comments="".S_ADD."";
}
table_row(array(
$description,
$value,
$priority,
$lastchange,
$actions,
$comments
),$col++);
}
table_end();
show_table_header(S_TOTAL.":$col");
?>