".S_NO_PERMISSIONS."");
show_footer();
exit;
}
?>
$expression");
?>
";
$result2=DBselect($sql);
$found=0;
while($row2=DBfetch($result2))
{
// $sql="select * from actions a,triggers t,hosts h,functions f,items i where a.triggerid=t.triggerid and f.triggerid=t.triggerid and h.hostid=a.triggerid and i.hostid=h.hostid and a.actionid=".$row["actionid"]." and a.scope=1 and h.hostid=".$row2["hostid"];
$sql="select * from actions a where a.actionid=".$row["actionid"]." and a.scope=1 and a.triggerid=".$row2["hostid"];
// echo "$sql
";
$result3=DBselect($sql);
if(DBnum_rows($result3)>0) $found=1;
}
if($found==0) continue;
}
if($row["recipient"] == RECIPIENT_TYPE_USER)
{
$user=get_user_by_userid($row["userid"]);
$recipient=$user["alias"];
}
else
{
$groupd=get_usergroup_by_usrgrpid($row["userid"]);
$recipient=$groupd["name"];
}
if($row["good"] == 1)
{
# echo "
".S_ON." | ";
$good=array("value"=>S_ON,"class"=>"on");
}
else if($row["good"] == 0)
{
# echo "".S_OFF." | ";
$good=array("value"=>S_OFF,"class"=>"off");
}
else if($row["good"] == 2)
{
# echo "".S_ON."/OFF | ";
$good=array("value"=>S_ON."/".S_OFF,"class"=>"on");
}
$actions="Change";
table_row(array(
get_scope_description($row["scope"]),
$recipient,
$good,
htmlspecialchars($row["delay"]),
htmlspecialchars($row["subject"]),
$actions
),$col++);
}
if(DBnum_rows($result)==0)
{
echo "";
echo "".S_NO_ACTIONS_DEFINED." | ";
echo "
";
}
table_end();
?>
";
if(isset($_GET["actionid"]))
{
$sql="select a.actionid,a.triggerid,a.good,a.delay,a.subject,a.message,a.userid,a.scope,a.severity,a.recipient from actions a where a.actionid=".$_GET["actionid"];
$result=DBselect($sql);
$actionid=DBget_field($result,0,0);
$triggerid=DBget_field($result,0,1);
$good=DBget_field($result,0,2);
$delay=DBget_field($result,0,3);
// Otherwise symbols like ",' will not be shown
$subject=htmlspecialchars(DBget_field($result,0,4));
$message=DBget_field($result,0,5);
$uid=DBget_field($result,0,6);
$scope=@iif(isset($_GET["scope"]),$_GET["scope"],DBget_field($result,0,7));
$severity=DBget_field($result,0,8);
$recipient=@iif(isset($_GET["recipient"]),$_GET["recipient"],DBget_field($result,0,9));
}
else
{
$trigger=get_trigger_by_triggerid($_GET["triggerid"]);
$description=htmlspecialchars(stripslashes($trigger["description"]));
// $delay=30;
$delay=@iif(isset($_GET["delay"]),$_GET["delay"],30);
// $subject=$description;
$subject=@iif(isset($_GET["subject"]),$_GET["subject"],$description);
$scope=@iif(isset($_GET["scope"]),$_GET["scope"],0);
$good=@iif(isset($_GET["good"]),$_GET["good"],1);
$recipient=@iif(isset($_GET["recipient"]),$_GET["recipient"],RECIPIENT_TYPE_GROUP);
// $severity=0;
$severity=@iif(isset($_GET["severity"]),$_GET["severity"],0);
$sql="select i.description, h.host, i.key_ from hosts h, items i,functions f where f.triggerid=".$_GET["triggerid"]." and h.hostid=i.hostid and f.itemid=i.itemid order by i.description";
$result=DBselect($sql);
if(isset($_GET["message"]))
{
$message=$_GET["message"];
}
else
{
$message="INSERT YOUR MESSAGE HERE\n\n------Latest data------\n\n";
while($row=DBfetch($result))
{
$message=$message.$row["description"].": {".$row["host"].":".$row["key_"].".last(0)} (latest value)\n";
$message=$message.$row["description"].": {".$row["host"].":".$row["key_"].".max(300)} (maximum value for last 5 min)\n";
$message=$message.$row["description"].": {".$row["host"].":".$row["key_"].".min(300)} (minimum value for last 5 min)\n\n";
}
$message=$message."---------End--------\n";
}
}
show_form_begin("actions.action");
echo nbsp(S_NEW_ACTION);
$col=0;
show_table2_v_delimiter($col++);
echo "