Skip to content

Strip tags #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/dashboard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
if(isset($User->user->dash_layout_parsed[2])) {
$Trap->reset_print_limit ($User->user->dash_layout_parsed[2]['elements']);
$all_info_traps = $Trap->fetch_traps (array("notice", "informational", "debug"));
$all_info_traps = $Trap->fetch_traps (array("notice", "informational", "debug", "audit"));
}
if(isset($User->user->dash_layout_parsed[3])) {
$Trap->reset_print_limit ($User->user->dash_layout_parsed[3]['elements']);
Expand Down Expand Up @@ -103,4 +103,4 @@
print "</div>";
}

print "</div>";
print "</div>";
4 changes: 2 additions & 2 deletions app/json/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if($_GET['type']=="all") { $result = $Trap->fetch_traps ("all"); }
elseif($_GET['type']=="major") { $result = $Trap->fetch_traps (array("emergency", "alert", "critical")); }
elseif($_GET['type']=="minor") { $result = $Trap->fetch_traps (array("error", "warning")); }
elseif($_GET['type']=="informational") { $result = $Trap->fetch_traps (array("notice", "informational", "debug")); }
elseif($_GET['type']=="informational") { $result = $Trap->fetch_traps (array("notice", "informational", "debug", "audit")); }
elseif($_GET['type']=="unknown") { $result = $Trap->fetch_traps (array("unknown")); }
}
/**
Expand Down Expand Up @@ -83,4 +83,4 @@
}

# return result
print_r(json_encode($result_final));
print_r(json_encode($result_final));
4 changes: 2 additions & 2 deletions app/login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<title>Snmptraps</title>

<!-- icon -->
<link rel="icon" type="image/png" href="<?php print BASE; ?>css/favicon_big.png">
<link rel="icon" type="image/png" href="css/favicon_big.png">

<!-- css -->
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css">
Expand Down Expand Up @@ -94,4 +94,4 @@
<!-- end body -->
</body>
</html>
<?php ob_end_flush(); ?>
<?php ob_end_flush(); ?>
2 changes: 1 addition & 1 deletion db/SCHEMA.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DROP TABLE IF EXISTS `severity_definitions`;
CREATE TABLE `severity_definitions` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`oid` varchar(128) NOT NULL DEFAULT '',
`severity` set('emergency','alert','critical','error','warning','notice','informational','debug') NOT NULL DEFAULT '',
`severity` set('emergency','alert','critical','error','warning','notice','informational','debug','audit') NOT NULL DEFAULT '',
`content` varchar(128) DEFAULT '',
`comment` text,
PRIMARY KEY (`id`),
Expand Down
7 changes: 4 additions & 3 deletions functions/classes/class.Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ public function send ($message_details, $recipients) {
# save details
$this->message_details = (object) $message_details;
# set subject
$subject = "[".$message_details->hostname."] - ".$message_details->msg;
$subject = "[".$message_details->hostname."] - ".$message_details->severity;

# set mail body content
$body = array();
Expand All @@ -548,7 +548,7 @@ public function send ($message_details, $recipients) {

# get content
$mail_content_html = $this->generate_message (implode("\r\n", $body));
$mail_content_plain = $this->generate_message_plain (implode("\r\n", strip_tags(str_replace("<br>","\n",$body))));
$mail_content_plain = $this->generate_message_plain (strip_tags(implode("\r\n", str_replace("<br>","\n",$body))));

# try to send
try {
Expand Down Expand Up @@ -787,6 +787,7 @@ private function set_pushover_priority ($severity) {
elseif ($severity=="critical") { $this->p_priority = 1; }
elseif ($severity=="error") { $this->p_priority = 0; }
elseif ($severity=="warning") { $this->p_priority = 0; }
elseif ($severity=="audit") { $this->p_priority = -1; }
elseif ($severity=="notice") { $this->p_priority = -1; }
elseif ($severity=="informational") { $this->p_priority = -2; }
elseif ($severity=="debug") { $this->p_priority = -2; }
Expand Down Expand Up @@ -954,4 +955,4 @@ private function set_color ($s) {
}
}

?>
?>
6 changes: 3 additions & 3 deletions functions/classes/class.SNMP.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function process_oid ($oid) {
* @return void
*/
public function define_severities () {
return array('emergency','alert','critical','error','warning','notice','informational','debug');
return array('emergency','alert','critical','error','warning','notice','informational','debug', 'audit');
}

/**
Expand Down Expand Up @@ -536,7 +536,7 @@ public function set_permitted_hostnames ($hostnames = "all") {
* @return void
*/
public function define_severities () {
$this->severities = array('emergency','alert','critical','error','warning','notice','informational','debug');
$this->severities = array('emergency','alert','critical','error','warning','notice','informational','debug','audit');
}


Expand Down Expand Up @@ -1122,4 +1122,4 @@ private function update_trap_severity ($item = array()) {
}


}
}
4 changes: 2 additions & 2 deletions functions/classes/class.Table_print.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function set_severity_class ($s, $newClass) {
// red
if ($s=="emergency" || $s=="alert" || $s=="critical") { $c = "danger"; }
elseif ($s=="error" || $s=="warning") { $c = "warning"; }
elseif ($s=="notice"|| $s=="debug" || $s=="informational") { $c = "success"; }
elseif ($s=="notice"|| $s=="debug" || $s=="informational" || $s=="audit") { $c = "success"; }
else { $c = "info"; }
// newclass ?
return $newClass ? $c." new" : $c;
Expand Down Expand Up @@ -559,7 +559,7 @@ public function prepare_input_item ($field, $value = false, $additional_params =
private function prepare_multiple_checkboxes ($field, $value, $additional_params) {
// get all possible items
if ($field->Field=="notification_severities") {
$options = array('emergency','alert','critical','error','warning','notice','informational','debug', 'unknown');
$options = array('emergency','alert','critical','error','warning','notice','informational','debug', 'unknown','audit');
}
elseif ($field->Field=="notification_types") {
include(dirname(__FILE__)."/../../config.php");
Expand Down
5 changes: 3 additions & 2 deletions functions/classes/class.traphandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class Trap {
"warning" => "warning",
"notice" => "notice",
"informational" => "informational",
"debug" => "debug"
"debug" => "debug",
"audit" => "audit"
);

/**
Expand Down Expand Up @@ -774,4 +775,4 @@ public function close_file () {

}

?>
?>
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<title><?php print $title; ?></title>

<!-- icon -->
<link rel="icon" type="image/png" href="<?php print BASE; ?>css/favicon_big.png">
<link rel="icon" type="image/png" href="css/favicon_big.png">

<!-- css -->
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css?v=<?php print implode(".", $version); ?>">
Expand Down Expand Up @@ -136,4 +136,4 @@
</body>
</html>
<?php ob_end_flush(); ?>
<?php } ?>
<?php } ?>