示例#1
0
function delete_alarm($conn, $data)
{
    $id = $data['id'];
    //Validating ID before closing the alarm
    ossim_valid($id, OSS_HEX, 'illegal:' . _("Backlog ID"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = TRUE;
        $return['msg'] = $info_error;
        return $return;
    }
    //Opening the alarm
    Alarm::delete_backlog($conn, $id);
    $return['error'] = FALSE;
    $return['msg'] = _('Alarm deleted successfully');
    return $return;
}
/* connect to db */
$db = new ossim_db();
$conn = $db->connect();
foreach ($_POST as $key => $value) {
    if (preg_match("/check_([0-9a-fA-F]+)_([0-9a-fA-F]+)/", $key, $found)) {
        if ($only_close) {
            Alarm::close($conn, $found[1]);
        } elseif ($move_tag != "") {
            if ($move_tag > 0) {
                Tags::set_alarm_tag($conn, $found[1], $move_tag);
            } else {
                Tags::del_alarm_tag($conn, $found[1], $move_tag);
                # $move_tag=0 delete all, $move_tag<0 delete only a tag
            }
        } else {
            $result = Alarm::delete_backlog($conn, $found[1]);
            if (!$result) {
                $_SESSION["_delete_msg"] = _("You do not have enough permissions to delete this alarm as it contains events that you are not allowed to see.");
            }
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title><?php 
echo _("Alarm Operations");
?>
</title>
	</head>