diff options
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/actions.inc.php | 30 | ||||
| -rw-r--r-- | frontends/php/include/db.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 25 | ||||
| -rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 3 |
4 files changed, 27 insertions, 33 deletions
diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index 31e73ffd..afa34a76 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -34,15 +34,15 @@ return $result; } - # Update Action + # Add Action - function update_action( $actionid, $filter_triggerid, $userid, $good, $delay, $subject, $message, $severity, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) + function add_action( $userid, $delay, $subject, $message, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) { - if(!check_right_on_trigger("A",$triggerid)) - { - error("Insufficient permissions"); - return 0; - } +// if(!check_right_on_trigger("A",$triggerid)) +// { +// error("Insufficient permissions"); +// return 0; +// } if($recipient == RECIPIENT_TYPE_USER) { @@ -52,19 +52,17 @@ { $id = $usrgrpid; } - $subject=addslashes($subject); - $message=addslashes($message); - $sql="update actions set filter_triggerid=$filter_triggerid,userid=$id,good=$good,delay=$delay,nextcheck=0,subject='$subject',message='$message',severity=$severity,recipient=$recipient,maxrepeats=$maxrepeats,repeatdelay=$repeatdelay where actionid=$actionid"; + $sql="insert into actions (userid,delay,nextcheck,subject,message,recipient,maxrepeats,repeatdelay) values ($id,$delay,0,'$subject','$message',$recipient,$maxrepeats,$repeatdelay)"; $result=DBexecute($sql); - return $result; + return DBinsert_id($result,"actions","actionid"); } - # Add Action + # Update Action - function add_action( $userid, $delay, $subject, $message, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) + function update_action($actionid, $userid, $delay, $subject, $message, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) { -// if(!check_right_on_trigger("A",$triggerid)) +// if(!check_right_on_trigger("U",$triggerid)) // { // error("Insufficient permissions"); // return 0; @@ -79,9 +77,9 @@ $id = $usrgrpid; } - $sql="insert into actions (userid,delay,nextcheck,subject,message,recipient,maxrepeats,repeatdelay) values ($id,$delay,0,'$subject','$message',$recipient,$maxrepeats,$repeatdelay)"; + $sql="update actions set userid=$id,delay=$delay,nextcheck=0,subject='$subject',message='$message',recipient=$recipient,maxrepeats=$maxrepeats, repeatdelay=$repeatdelay where actionid=$actionid"; $result=DBexecute($sql); - return DBinsert_id($result,"actions","actionid"); + return $result; } # Delete Action by userid diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index 26716087..395a454f 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -79,7 +79,7 @@ { global $DB,$DB_TYPE; -// echo $query."<br>"; + echo $query."<br>"; if($DB_TYPE == "MYSQL") { diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index cf5455df..6b3e2492 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -986,7 +986,7 @@ } show_form_begin("triggers.trigger"); - echo "Trigger configuration"; + echo S_TRIGGER; show_table2_v_delimiter($col++); if(isset($hostid)) @@ -1503,7 +1503,6 @@ $actionid=$action["actionid"]; $actiontype=$action["actiontype"]; $source=$action["source"]; - $good=$action["good"]; $delay=$action["delay"]; // Otherwise symbols like ",' will not be shown $subject=htmlspecialchars($action["subject"]); @@ -1548,27 +1547,22 @@ // $delay=30; $delay=@iif(isset($_REQUEST["delay"]),$_REQUEST["delay"],30); // $subject=$description; - $subject=@iif(isset($_REQUEST["subject"]),$_REQUEST["subject"],$description); + $subject=@iif(isset($_REQUEST["subject"]),$_REQUEST["subject"],"{TRIGGER.NAME}: {STATUS}"); + $message=@iif(isset($_REQUEST["message"]),$_REQUEST["message"],"{TRIGGER.NAME}: {STATUS}"); $scope=@iif(isset($_REQUEST["scope"]),$_REQUEST["scope"],0); - $good=@iif(isset($_REQUEST["good"]),$_REQUEST["good"],1); $recipient=@iif(isset($_REQUEST["recipient"]),$_REQUEST["recipient"],RECIPIENT_TYPE_GROUP); // $severity=0; $severity=@iif(isset($_REQUEST["severity"]),$_REQUEST["severity"],0); $maxrepeats=@iif(isset($_REQUEST["maxrepeats"]),$_REQUEST["maxrepeats"],0); $repeatdelay=@iif(isset($_REQUEST["repeatdelay"]),$_REQUEST["repeatdelay"],600); $repeat=@iif(isset($_REQUEST["repeat"]),$_REQUEST["repeat"],0); - - if(isset($_REQUEST["message"])) - { - $message=$_REQUEST["message"]; - } } $conditiontype=@iif(isset($_REQUEST["conditiontype"]),$_REQUEST["conditiontype"],0); show_form_begin("actions.action"); - echo nbsp(S_NEW_ACTION); + echo nbsp(S_ACTION); $col=0; show_table2_v_delimiter($col++); @@ -1579,19 +1573,21 @@ } echo nbsp(S_SOURCE); show_table2_h_delimiter(); - echo "<select class=\"biginput\" name=\"good\" size=1>"; + echo "<select class=\"biginput\" name=\"source\" size=1>"; echo "<OPTION VALUE=\"0\""; if($source==0) echo "SELECTED"; echo ">".S_TRIGGER; echo "</SELECT>"; show_table2_v_delimiter($col); - echo nbsp("Conditions"); + echo nbsp(S_CONDITIONS); show_table2_h_delimiter(); + $found=0; for($i=1;$i<=1000;$i++) { if(isset($_REQUEST["conditiontype$i"])) { echo "<input type=checkbox name=\"conditionchecked$i\">".get_condition_desc($_REQUEST["conditiontype$i"],$_REQUEST["conditionop$i"],$_REQUEST["conditionvalue$i"]); echo "<br>"; + $found=1; } } @@ -1604,6 +1600,7 @@ echo "<input name=\"conditionvalue$i\" type=\"hidden\" value=\"".$_REQUEST["conditionvalue$i"]."\">"; } } + if($found==0) echo S_NO_CONDITIONS_DEFINED; show_table2_v_delimiter($col++); echo nbsp(" "); @@ -1638,11 +1635,9 @@ if(in_array($conditiontype,array(CONDITION_TYPE_TRIGGER_SEVERITY))) $h2=$h2.form_select("operator",CONDITION_OPERATOR_MORE_EQUAL,">="); $h2=$h2."</SELECT>"; -// echo $h2; - show_table2_v_delimiter($col); - echo nbsp(" Condition"); + echo nbsp(S_CONDITION); show_table2_h_delimiter(); if($conditiontype == CONDITION_TYPE_GROUP) diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index 19078856..7d6d90a8 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -63,6 +63,8 @@ "S_TIME_PERIOD"=> "Time period", "S_TRIGGER_DESCRIPTION"=> "Trigger description", "S_CONDITIONS"=> "Conditions", + "S_CONDITION"=> "Condition", + "S_NO_CONDITIONS_DEFINED"=> "No conditions defined", // actions.php "S_ACTIONS"=> "Actions", @@ -80,7 +82,6 @@ "S_ON"=> "ON", "S_OFF"=> "OFF", "S_NO_ACTIONS_DEFINED"=> "No actions defined", - "S_NEW_ACTION"=> "New action", "S_SINGLE_USER"=> "Single user", "S_USER_GROUP"=> "User group", "S_GROUP"=> "Group", |
