diff --git a/alerts.php b/alerts.php
old mode 100755
new mode 100644
diff --git a/html/ajax_rulesuggest.php b/html/ajax_rulesuggest.php
new file mode 100644
index 000000000..701ed4923
--- /dev/null
+++ b/html/ajax_rulesuggest.php
@@ -0,0 +1,116 @@
+
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see . */
+
+/**
+ * Rule Suggestion-AJAX
+ * @author Daniel Preussker
+ * @copyright 2014 f0o, LibreNMS
+ * @license GPL
+ * @package LibreNMS/Alerts
+ */
+
+session_start();
+if( !isset($_SESSION['authenticated']) ) {
+ die("Unauthorized.");
+}
+
+require_once("../includes/defaults.inc.php");
+require_once("../config.php");
+require_once("../includes/definitions.inc.php");
+require_once("../includes/functions.php");
+
+/**
+ * Levenshtein Sort
+ * @param string $base Comparisson basis
+ * @param array $obj Object to sort
+ * @return array
+ */
+function levsort($base, $obj) {
+ $ret = array();
+ foreach( $obj as $elem ) {
+ $lev = levenshtein($base, $elem, 1, 10, 10);
+ if( $lev == 0 ) {
+ return array(array('name'=>$elem));
+ } else {
+ while( isset($ret["$lev"]) ) {
+ $lev += 0.1;
+ }
+ $ret["$lev"] = array('name'=>$elem);
+ }
+ }
+ ksort($ret);
+ return $ret;
+}
+
+$obj = array(array('name'=>'Error: No suggestions found.'));
+if( isset($_GET['term'],$_GET['device_id']) ) {
+ $chk = array();
+ $_GET['term'] = mres($_GET['term']);
+ $_GET['device_id'] = mres($_GET['device_id']);
+ if( strstr($_GET['term'],".") ) {
+ $term = explode(".",$_GET['term']);
+ if( $config['memcached']['enable'] ) {
+ $chk = $memcache->get('rule-suggest_'.$term[0]);
+ }
+ if( !(sizeof($chk) > 0) || $chk === false ) {
+ $tmp = dbFetchRows('SHOW COLUMNS FROM '.$term[0]);
+ foreach( $tmp as $tst ) {
+ if( isset($tst['Field']) ) {
+ $chk[] = $term[0].'.'.$tst['Field'];
+ }
+ }
+ }
+ $current = true;
+ } else {
+ if( $config['memcached']['enable'] ) {
+ $chk = $memcache->get('rule-suggest-toplvl');
+ }
+ if( !(sizeof($chk) > 0) || $chk === false ) {
+ $tmp = dbFetchRows('SHOW TABLES');
+ foreach( $tmp as $tst ) {
+ $tbl = array_shift($tst);
+ $chhk = dbFetchRows('SELECT device_id FROM '.$tbl.' LIMIT 1');
+ if( isset($chhk[0]['device_id']) ) {
+ $chk[] = $tbl.'.';
+ }
+ }
+ }
+ }
+ if( sizeof($chk) > 0 ) {
+ if( $config['memcached']['enable'] ) {
+ $memcache->set('rule-suggest-'.$oterm,$chk,86400); //Cache for 24h
+ }
+ $obj = levsort($_GET['term'],$chk);
+ $obj = array_chunk($obj,20,true);
+ $obj = $obj[0];
+ if( $current == true ) {
+ foreach( $obj as $fld ) {
+ $flds[] = $fld['name'];
+ }
+ $qry = dbFetchRows("SELECT ".implode(", ",$flds)." FROM ".$term[0]." WHERE device_id = ?", array($_GET['device_id']));
+ foreach( $obj as $lev=>$fld ) {
+ list($tbl, $chk) = explode(".",$fld['name']);
+ $val = array();
+ foreach( $qry as $row ) {
+ $val[] = $row[$chk];
+ }
+ $ret[$lev] = array('name'=>$fld['name'],'current'=>$val);
+ }
+ $obj = $ret;
+ }
+ }
+}
+die(json_encode($obj));
+?>
diff --git a/html/api_v0.php b/html/api_v0.php
index 2e965a410..80530a6c0 100644
--- a/html/api_v0.php
+++ b/html/api_v0.php
@@ -35,8 +35,8 @@ $app->group('/api', function() use ($app) {
$app->get('/:hostname', 'authToken', 'get_device')->name('get_device');//api/v0/devices/$hostname
$app->get('/:hostname/vlans', 'authToken', 'get_vlans')->name('get_vlans');//api/v0/devices/$hostname/vlans
$app->get('/:hostname/graphs', 'authToken', 'get_graphs')->name('get_graphs');//api/v0/devices/$hostname/graphs
- $app->get('/:hostname/:type', 'authToken', 'get_graph_generic_by_hostname')->name('get_graph_generic_by_hostname');//api/v0/devices/$hostname/$type
$app->get('/:hostname/ports', 'authToken', 'get_port_graphs')->name('get_port_graphs');//api/v0/devices/$hostname/ports
+ $app->get('/:hostname/:type', 'authToken', 'get_graph_generic_by_hostname')->name('get_graph_generic_by_hostname');//api/v0/devices/$hostname/$type
$app->get('/:hostname/ports/:ifname', 'authToken', 'get_port_stats_by_port_hostname')->name('get_port_stats_by_port_hostname');//api/v0/devices/$hostname/ports/$ifName
$app->get('/:hostname/ports/:ifname/:type', 'authToken', 'get_graph_by_port_hostname')->name('get_graph_by_port_hostname');//api/v0/devices/$hostname/ports/$ifName/$type
});
@@ -45,6 +45,10 @@ $app->group('/api', function() use ($app) {
$app->group('/portgroups', function() use ($app) {
$app->get('/:group', 'authToken', 'get_graph_by_portgroup')->name('get_graph_by_portgroup');//api/v0/portgroups/$group
});
+ $app->group('/bills', function() use ($app) {
+ $app->get('/:bill_id', 'authToken', 'list_bills')->name('get_bill');//api/v0/bills/$bill_id
+ });
+ $app->get('/bills', 'authToken', 'list_bills')->name('list_bills');//api/v0/bills
});
$app->get('/v0', 'authToken', 'show_endpoints');//api/v0
});
diff --git a/html/css/jquery-ui.min.css b/html/css/jquery-ui.min.css
new file mode 100644
index 000000000..243792a75
--- /dev/null
+++ b/html/css/jquery-ui.min.css
@@ -0,0 +1,7 @@
+/*! jQuery UI - v1.11.2 - 2014-12-02
+* http://jqueryui.com
+* Includes: core.css, autocomplete.css, menu.css, theme.css
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Helvetica%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=2px&bgColorHeader=dddddd&bgTextureHeader=highlight_soft&bgImgOpacityHeader=50&borderColorHeader=dddddd&fcHeader=444444&iconColorHeader=0073ea&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=dddddd&fcContent=444444&iconColorContent=ff0084&bgColorDefault=f6f6f6&bgTextureDefault=highlight_soft&bgImgOpacityDefault=100&borderColorDefault=dddddd&fcDefault=0073ea&iconColorDefault=666666&bgColorHover=0073ea&bgTextureHover=highlight_soft&bgImgOpacityHover=25&borderColorHover=0073ea&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=dddddd&fcActive=ff0084&iconColorActive=454545&bgColorHighlight=ffffff&bgTextureHighlight=flat&bgImgOpacityHighlight=55&borderColorHighlight=cccccc&fcHighlight=444444&iconColorHighlight=0073ea&bgColorError=ffffff&bgTextureError=flat&bgImgOpacityError=55&borderColorError=ff0084&fcError=222222&iconColorError=ff0084&bgColorOverlay=eeeeee&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=80&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=60&thicknessShadow=4px&offsetTopShadow=-4px&offsetLeftShadow=-4px&cornerRadiusShadow=0px
+* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
+
+.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-widget{font-family:Helvetica,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Helvetica,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#fff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;color:#444}.ui-widget-content a{color:#444}.ui-widget-header{border:1px solid #ddd;background:#ddd url("images/ui-bg_highlight-soft_50_dddddd_1x100.png") 50% 50% repeat-x;color:#444;font-weight:bold}.ui-widget-header a{color:#444}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #ddd;background:#f6f6f6 url("images/ui-bg_highlight-soft_100_f6f6f6_1x100.png") 50% 50% repeat-x;font-weight:bold;color:#0073ea}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#0073ea;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #0073ea;background:#0073ea url("images/ui-bg_highlight-soft_25_0073ea_1x100.png") 50% 50% repeat-x;font-weight:bold;color:#fff}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#fff;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #ddd;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#ff0084}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#ff0084;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #ccc;background:#fff url("images/ui-bg_flat_55_ffffff_40x100.png") 50% 50% repeat-x;color:#444}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#444}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #ff0084;background:#fff url("images/ui-bg_flat_55_ffffff_40x100.png") 50% 50% repeat-x;color:#222}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#222}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#222}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_ff0084_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_0073ea_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_666666_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_0073ea_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ff0084_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:2px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:2px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:2px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:2px}.ui-widget-overlay{background:#eee url("images/ui-bg_flat_0_eeeeee_40x100.png") 50% 50% repeat-x;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:-4px 0 0 -4px;padding:4px;background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.6;filter:Alpha(Opacity=60);border-radius:0}
\ No newline at end of file
diff --git a/html/css/styles.css b/html/css/styles.css
index 9737051ed..da910be18 100644
--- a/html/css/styles.css
+++ b/html/css/styles.css
@@ -1612,3 +1612,20 @@ tr.search:nth-child(odd) {
width: 250px;
}
+.ui-autocomplete {
+ max-height: 100px;
+ overflow-y: auto;
+ overflow-x: hidden;
+}
+
+/* IE 6 doesn't support max-height
+* we use height instead, but this forces the menu to always be this tall
+*/
+* html .ui-autocomplete {
+ height: 100px;
+}
+
+.glyphicon-large {
+ font-size: 2.5em;
+}
+
diff --git a/html/css/tagmanager.css b/html/css/tagmanager.css
new file mode 100644
index 000000000..02e1de944
--- /dev/null
+++ b/html/css/tagmanager.css
@@ -0,0 +1,21 @@
+.tagmanagerTag {
+ background: none repeat scroll 0 0 #cde69c;
+ border: 1px solid #a5d24a;
+ border-radius: 3px;
+ color: #638421;
+ display: block;
+ float: left;
+ font-size: 13px;
+ margin-bottom: 5px;
+ margin-right: 5px;
+ padding: 6px 5px 5px 5px;
+ text-decoration: none;
+ vertical-align: middle;
+ line-height: 18px;
+ height: 30px;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
+}
+.tagmanagerRemoveTag {
+ color: #c0c0c0;
+ padding-left: 8px;
+}
diff --git a/html/forms/ack-alert.inc.php b/html/forms/ack-alert.inc.php
new file mode 100644
index 000000000..3f395c415
--- /dev/null
+++ b/html/forms/ack-alert.inc.php
@@ -0,0 +1,28 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+$alert_id = mres($_POST['alert_id']);
+if(!is_numeric($alert_id)) {
+ echo('ERROR: No alert selected');
+ exit;
+} else {
+ if(dbUpdate(array('state' => '2'), 'alerts', 'id=?',array($alert_id))) {
+ echo('Alert has been acknowledged.');
+ exit;
+ } else {
+ echo('ERROR: Alert has not been acknowledged.');
+ exit;
+ }
+}
+
diff --git a/html/forms/alert-templates.inc.php b/html/forms/alert-templates.inc.php
new file mode 100644
index 000000000..21afa02fd
--- /dev/null
+++ b/html/forms/alert-templates.inc.php
@@ -0,0 +1,78 @@
+
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see . */
+
+/**
+ * Alert Templates
+ * @author f0o
+ * @copyright 2014 f0o, LibreNMS
+ * @license GPL
+ * @package LibreNMS
+ * @subpackage Alerts
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+$ok = '';
+$error = '';
+$name = mres($_POST['name']);
+if(!empty($name)) {
+ if( is_numeric($_REQUEST['template_id']) && $_REQUEST['rule_id'] ) {
+ //Update the template/rule mapping
+
+ if( is_array($_REQUEST['rule_id']) ) {
+ $_REQUEST['rule_id'] = implode(",",$_REQUEST['rule_id']);
+ }
+ if( substr($_REQUEST['rule_id'], 0,1) != "," ){
+ $_REQUEST['rule_id'] = ",".$_REQUEST['rule_id'];
+ }
+ if( substr($_REQUEST['rule_id'],-1,1) != "," ){
+ $_REQUEST['rule_id'] .= ",";
+ }
+ if(dbUpdate(array('rule_id' => mres($_REQUEST['rule_id']), 'name' => $name), "alert_templates", "id = ?", array($_REQUEST['template_id']))) {
+ $ok = "Updated template and rule id mapping";
+ } else {
+ $error ="Failed to update the template and rule id mapping";
+ }
+ } elseif( $_REQUEST['template'] && is_numeric($_REQUEST['template_id']) ) {
+ //Update template-text
+
+ if($ret = dbUpdate(array('template' => $_REQUEST['template'], 'name' => $name), "alert_templates", "id = ?", array($_REQUEST['template_id']))) {
+ $ok = "Updated template";
+ } else {
+ $error = "Failed to update the template";
+ }
+ } elseif( $_REQUEST['template'] ) {
+ //Create new template
+
+ if(dbInsert(array('template' => $_REQUEST['template'], 'name' => $name), "alert_templates")) {
+ $ok = "Alert template has been created.";
+ } else {
+ $error = "Could not create aler template";
+ }
+ } else {
+ $error = "We could not work out what you wanted to do!";
+ }
+} else {
+ $error = "You haven't given your template a name, it feels sad :( - $name";
+}
+
+if(!empty( $ok )) {
+ die("$ok");
+} else {
+ die("ERROR: $error");
+}
+?>
diff --git a/html/forms/attach-alert-template.inc.php b/html/forms/attach-alert-template.inc.php
new file mode 100644
index 000000000..373cf8d84
--- /dev/null
+++ b/html/forms/attach-alert-template.inc.php
@@ -0,0 +1,31 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+if(!is_numeric($_POST['template_id'])) {
+ echo('ERROR: No template selected');
+ exit;
+} else {
+ if(dbUpdate(array('rule_id' => mres($_POST['rule_id'])), 'alert_templates', '`id`=?', array($_POST['template_id'])) >= 0) {
+ echo('Alert rules have been attached to this template.');
+ exit;
+ } else {
+ echo('ERROR: Alert rules have not been attached to this template.');
+ exit;
+ }
+}
+
diff --git a/html/forms/create-alert-item.inc.php b/html/forms/create-alert-item.inc.php
new file mode 100644
index 000000000..cc7cb2bb8
--- /dev/null
+++ b/html/forms/create-alert-item.inc.php
@@ -0,0 +1,58 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+$rule = implode(" ", $_POST['rules']);
+$rule = rtrim($rule,'&&');
+$rule = rtrim($rule,'||');
+$alert_id = $_POST['alert_id'];
+$count = mres($_POST['count']);
+$delay = mres($_POST['delay']);
+$mute = mres($_POST['mute']);
+
+if(empty($rule)) {
+ $update_message = "ERROR: No rule was generated";
+} elseif(validate_device_id($_POST['device_id']) || $_POST['device_id'] == '-1') {
+ $device_id = $_POST['device_id'];
+ if(!is_numeric($count)) {
+ $count='-1';
+ }
+ $delay_sec = convert_delay($delay);
+ if($mute == 'on') {
+ $mute = true;
+ } else {
+ $mute = false;
+ }
+ $extra = array('mute'=>$mute,'count'=>$count,'delay'=>$delay_sec);
+ $extra_json = json_encode($extra);
+ if(is_numeric($alert_id) && $alert_id > 0) {
+ if(dbUpdate(array('rule' => $rule,'severity'=>mres($_POST['severity']),'extra'=>$extra_json), 'alert_rules', 'id=?',array($alert_id)) >= 0) {
+ $update_message = "Edited Rule: ".$rule."";
+ } else {
+ $update_message = "ERROR: Failed to edit Rule: ".$rule."";
+ }
+ } else {
+ if( dbInsert(array('device_id'=>$device_id,'rule'=>$rule,'severity'=>mres($_POST['severity']),'extra'=>$extra_json),'alert_rules') ) {
+ $update_message = "Added Rule: ".$rule.$mute."";
+ } else {
+ $update_message = "ERROR: Failed to add Rule: ".$rule."";
+ }
+ }
+} else {
+ $update_message = "ERROR: invalid device ID or not a global alert";
+}
+echo $update_message;
diff --git a/html/forms/delete-alert-rule.inc.php b/html/forms/delete-alert-rule.inc.php
new file mode 100644
index 000000000..a15b1edbe
--- /dev/null
+++ b/html/forms/delete-alert-rule.inc.php
@@ -0,0 +1,31 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+if(!is_numeric($_POST['alert_id'])) {
+ echo('ERROR: No alert selected');
+ exit;
+} else {
+ if(dbDelete('alert_rules', "`id` = ?", array($_POST['alert_id']))) {
+ echo('Alert rule has been deleted.');
+ exit;
+ } else {
+ echo('ERROR: Alert rule has not been deleted.');
+ exit;
+ }
+}
+
diff --git a/html/forms/delete-alert-template.inc.php b/html/forms/delete-alert-template.inc.php
new file mode 100644
index 000000000..14ebd6c5b
--- /dev/null
+++ b/html/forms/delete-alert-template.inc.php
@@ -0,0 +1,31 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+if(!is_numeric($_POST['template_id'])) {
+ echo('ERROR: No template selected');
+ exit;
+} else {
+ if(dbDelete('alert_templates', "`id` = ?", array($_POST['template_id']))) {
+ echo('Alert template has been deleted.');
+ exit;
+ } else {
+ echo('ERROR: Alert template has not been deleted.');
+ exit;
+ }
+}
+
diff --git a/html/forms/parse-alert-rule.inc.php b/html/forms/parse-alert-rule.inc.php
new file mode 100644
index 000000000..9f33138f0
--- /dev/null
+++ b/html/forms/parse-alert-rule.inc.php
@@ -0,0 +1,28 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+$alert_id = $_POST['alert_id'];
+
+if(is_numeric($alert_id) && $alert_id > 0) {
+ $rule = dbFetchRow("SELECT * FROM `alert_rules` WHERE `id` = ? LIMIT 1",array($alert_id));
+ $rule_split = preg_split('/([a-zA-Z0-9_\-\.\=\%\ \"\'\!\~]+[&&||]+)/',$rule['rule'], -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
+ $count = count($rule_split) - 1;
+ $rule_split[$count] = $rule_split[$count].'&&';
+ $output = array('severity'=>$rule['severity'],'extra'=>$rule['extra'],'rules'=>$rule_split);
+ echo _json_encode($output);
+}
diff --git a/html/forms/parse-alert-template.inc.php b/html/forms/parse-alert-template.inc.php
new file mode 100644
index 000000000..a04104a8f
--- /dev/null
+++ b/html/forms/parse-alert-template.inc.php
@@ -0,0 +1,25 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+$template_id = ($_POST['template_id']);
+
+if(is_numeric($template_id) && $template_id > 0) {
+ $template = dbFetchRow("SELECT * FROM `alert_templates` WHERE `id` = ? LIMIT 1",array($template_id));
+ $output = array('template'=>$template['template'],'name'=>$template['name']);
+ echo _json_encode($output);
+}
diff --git a/html/forms/parse-template-rules.inc.php b/html/forms/parse-template-rules.inc.php
new file mode 100644
index 000000000..736698e02
--- /dev/null
+++ b/html/forms/parse-template-rules.inc.php
@@ -0,0 +1,26 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+$template_id = ($_POST['template_id']);
+
+if(is_numeric($template_id) && $template_id > 0) {
+ $template = dbFetchCell("SELECT `rule_id` FROM `alert_templates` WHERE `id` = ? LIMIT 1",array($template_id));
+ $rule_id = split(",", $template);
+ $output = array('rule_id'=>$rule_id);
+ echo _json_encode($output);
+}
diff --git a/html/forms/update-alert-rule.inc.php b/html/forms/update-alert-rule.inc.php
new file mode 100644
index 000000000..9c8de3cbc
--- /dev/null
+++ b/html/forms/update-alert-rule.inc.php
@@ -0,0 +1,50 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+if(!is_numeric($_POST['alert_id']))
+{
+ echo('ERROR: No alert selected');
+ exit;
+}
+else
+{
+ if($_POST['state'] == 'true')
+ {
+ $state = 0;
+ }
+ elseif($_POST['state'] == 'false')
+ {
+ $state = 1;
+ }
+ else
+ {
+ $state = 1;
+ }
+ $update = dbUpdate(array('disabled' => $state), 'alert_rules', '`id`=?', array($_POST['alert_id']));
+ if(!empty($update) || $update == '0')
+ {
+ echo('Alert rule has been updated.');
+ exit;
+ }
+ else
+ {
+ echo('ERROR: Alert rule has not been updated.');
+ exit;
+ }
+}
+
diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php
index c8b40bb2a..a02ef291b 100644
--- a/html/includes/api_functions.inc.php
+++ b/html/includes/api_functions.inc.php
@@ -465,3 +465,33 @@ function get_port_graphs() {
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}
+
+function list_bills() {
+ global $config;
+ $app = \Slim\Slim::getInstance();
+ $router = $app->router()->getCurrentRoute()->getParams();
+ $bill_id = $router['bill_id'];
+ if(isset($_GET['custid'])) {
+ $sql = "`bill_custid` = ?";
+ $param = array($_GET['custid']);
+ } elseif(isset($_GET['ref'])) {
+ $sql = "`bill_ref` = ?";
+ $param = array($_GET['ref']);
+ } elseif(is_numeric($bill_id)) {
+ $sql = "`bill_id` = ?";
+ $param = array($bill_id);
+ } else {
+ $sql = "";
+ $param = array();
+ }
+ if(count($param) >= 1) {
+ $sql = "WHERE $sql";
+ }
+ $bills = dbFetchRows("SELECT * FROM `bills` $sql",$param);
+ $total_bills = count($bills);
+ $output = array("status" => "ok", "err-msg" => '', "count" => $total_bills, "bills" => $bills);
+ $app->response->setStatus('200');
+ $app->response->headers->set('Content-Type', 'application/json');
+ echo _json_encode($output);
+}
+
diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php
index fc3b0542b..c1554f350 100644
--- a/html/includes/functions.inc.php
+++ b/html/includes/functions.inc.php
@@ -709,4 +709,12 @@ function generate_pagination($count,$limit,$page,$links = 2) {
return($return);
}
+function is_admin() {
+ if ($_SESSION['userlevel'] == '10') {
+ $allowed = true;
+ } else {
+ $allowed = false;
+ }
+}
+
?>
diff --git a/html/includes/modal/alert_template.inc.php b/html/includes/modal/alert_template.inc.php
new file mode 100644
index 000000000..5ecda629f
--- /dev/null
+++ b/html/includes/modal/alert_template.inc.php
@@ -0,0 +1,223 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+?>
+
+
+
+
+
+
+
Alert Rules
+
+
+
+
+
+
+
+
diff --git a/html/includes/modal/attach_alert_template.inc.php b/html/includes/modal/attach_alert_template.inc.php
new file mode 100644
index 000000000..5584e81e9
--- /dev/null
+++ b/html/includes/modal/attach_alert_template.inc.php
@@ -0,0 +1,102 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+?>
+
+
+
+
+
+
+
Attach template to rules...
+
+
+
Please select the rules that you would like to assign this template to.
+
+
+
+
+
+
+
+
+
diff --git a/html/includes/modal/delete_alert_rule.inc.php b/html/includes/modal/delete_alert_rule.inc.php
new file mode 100644
index 000000000..694bd01c4
--- /dev/null
+++ b/html/includes/modal/delete_alert_rule.inc.php
@@ -0,0 +1,70 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+?>
+
+
+
+
+
+
+
Confirm Delete
+
+
+
If you would like to remove the alert rule then please click Delete.
+
+
+
+
+
+
+
diff --git a/html/includes/modal/delete_alert_template.inc.php b/html/includes/modal/delete_alert_template.inc.php
new file mode 100644
index 000000000..bc758ec7d
--- /dev/null
+++ b/html/includes/modal/delete_alert_template.inc.php
@@ -0,0 +1,70 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+?>
+
+
+
+
+
+
+
Confirm Delete
+
+
+
If you would like to remove the alert template then please click Delete.
+
+
+
+
+
+
+
diff --git a/html/includes/modal/new_alert_rule.inc.php b/html/includes/modal/new_alert_rule.inc.php
new file mode 100644
index 000000000..6c6558100
--- /dev/null
+++ b/html/includes/modal/new_alert_rule.inc.php
@@ -0,0 +1,211 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+if(is_admin() === false) {
+ die('ERROR: You need to be admin');
+}
+
+?>
+
+
');
-
- // Get which entities match this checker
- $entities = get_entity_list($type, $subtype, $device['device_id'], $entry['entity']);
-
- if (!empty($entities))
- {
- echo('
');
+require_once('includes/print-alerts.php');
?>
diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php
index 9a4764258..8f95aa5a4 100644
--- a/html/pages/device/edit.inc.php
+++ b/html/pages/device/edit.inc.php
@@ -19,7 +19,8 @@ if ($_SESSION['userlevel'] < '7')
}
$panes['apps'] = 'Applications';
- $panes['alerts'] = 'Alerts';
+ $panes['alerts'] = 'Alert Settings';
+ $panes['alert-rules'] = 'Alert Rules';
$panes['modules'] = 'Modules';
if ($config['enable_services'])
diff --git a/html/pages/device/edit/alert-rules.inc.php b/html/pages/device/edit/alert-rules.inc.php
new file mode 100644
index 000000000..f85a64d4c
--- /dev/null
+++ b/html/pages/device/edit/alert-rules.inc.php
@@ -0,0 +1,17 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+require_once('includes/print-alert-rules.php');
+
+?>
diff --git a/html/pages/device/edit/alerts.inc.php b/html/pages/device/edit/alerts.inc.php
index be7bc7707..da3d2be99 100644
--- a/html/pages/device/edit/alerts.inc.php
+++ b/html/pages/device/edit/alerts.inc.php
@@ -1,5 +1,4 @@
"7")
@@ -33,6 +32,12 @@ $override_sysContact_string = get_dev_attrib($device,'override_sysContact_string
$disable_notify = get_dev_attrib($device,'disable_notify');
?>
+
+
+
+
diff --git a/html/pages/templates.inc.php b/html/pages/templates.inc.php
new file mode 100644
index 000000000..68cbb842f
--- /dev/null
+++ b/html/pages/templates.inc.php
@@ -0,0 +1,17 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+require_once('includes/print-alert-templates.php');
+
+?>
diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php
old mode 100755
new mode 100644
diff --git a/includes/functions.php b/includes/functions.php
index e3fc74346..8dba210de 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -1094,4 +1094,21 @@ function _json_format($json, $options = 448)
return $result;
}
+
+function convert_delay($delay) {
+ $delay = preg_replace('/\s/','',$delay);
+ if(strstr($delay, 'm',TRUE)) {
+ $delay_sec = $delay * 60;
+ } elseif(strstr($delay, 'h',TRUE)) {
+ $delay_sec = $delay * 3600;
+ } elseif(strstr($delay, 'd',TRUE)) {
+ $delay_sec = $delay * 86400;
+ } elseif(is_numeric($delay)) {
+ $delay_sec = $delay;
+ } else {
+ $delay_sec = 0;
+ }
+ return($delay_sec);
+}
+
?>
diff --git a/poller.php b/poller.php
old mode 100755
new mode 100644