Fix transport options when edited on Windows (#10001)

Windows puts line returns as \r\n, when parsing LibreNMS previously left the \r, which could cause issues
Centralize the code so we just have one place to fix.
Try to fix SMSEagle, it had the options wrong (copied from another transport)
This commit is contained in:
Tony Murray
2019-03-27 07:18:02 -05:00
committed by GitHub
parent 743b76ea9c
commit ac1cd1296b
9 changed files with 40 additions and 35 deletions

View File

@@ -32,13 +32,11 @@ class Hipchat extends Transport
if (empty($this->config)) {
return $this->deliverAlertOld($obj, $opts);
}
$hipchat_opts = $this->parseUserOptions($this->config['hipchat-options']);
$hipchat_opts['url'] = $this->config['hipchat-url'];
$hipchat_opts['room_id'] = $this->config['hipchat-room-id'];
$hipchat_opts['from'] = $this->config['hipchat-from-name'];
foreach (explode(PHP_EOL, $this->config['hipchat-options']) as $option) {
list($k,$v) = explode('=', $option);
$hipchat_opts[$k] = $v;
}
return $this->contactHipchat($obj, $hipchat_opts);
}