Update alerts.php

Update to make canopsis transport works. Canopsis transport use AMQP PHP libraries which needs to be installed and included at the begining of the transport but PHP doesn't allow this include to occured in an anonyous function.
This commit is contained in:
gcoeugnet
2016-03-29 15:34:39 +02:00
parent 82b639e25d
commit 0e5f4f4861
+7 -2
View File
@@ -340,8 +340,13 @@ function ExtTransports($obj) {
$msg = FormatAlertTpl($obj);
$obj['msg'] = $msg;
echo $transport.' => ';
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };');
$tmp = $tmp($obj,$opts);
if ($transport == "canopsis") {
$tmp = eval ('global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false;');
}
else {
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };');
$tmp = $tmp($obj,$opts);
}
$prefix = array( 0=>"recovery", 1=>$obj['severity']." alert", 2=>"acknowledgment" );
$prefix[3] = &$prefix[0];
$prefix[4] = &$prefix[0];