mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
@@ -37,7 +37,7 @@ $config_token = mres($_POST['config_token']);
|
||||
$status = 'error';
|
||||
$message = 'Error with config';
|
||||
|
||||
if ($action == 'remove' || $action == 'remove-slack' || $action == 'remove-rocket' || $action == 'remove-hipchat' || $action == 'remove-pushover' || $action == 'remove-boxcar' || $action == 'remove-clickatell' || $action == 'remove-playsms' || $action == 'remove-smseagle') {
|
||||
if ($action == 'remove' || preg_match('/^remove-.*$/', $action)) {
|
||||
$config_id = mres($_POST['config_id']);
|
||||
if (empty($config_id)) {
|
||||
$message = 'No config id passed';
|
||||
@@ -53,6 +53,8 @@ if ($action == 'remove' || $action == 'remove-slack' || $action == 'remove-rocke
|
||||
dbDelete('config', "`config_name` LIKE 'alert.transports.pushover.$config_id.%'");
|
||||
} elseif ($action == 'remove-boxcar') {
|
||||
dbDelete('config', "`config_name` LIKE 'alert.transports.boxcar.$config_id.%'");
|
||||
} elseif ($action == 'remove-telegram') {
|
||||
dbDelete('config', "`config_name` LIKE 'alert.transports.telegram.$config_id.%'");
|
||||
} elseif ($action == 'remove-clickatell') {
|
||||
dbDelete('config', "`config_name` LIKE 'alert.transports.clickatell.$config_id.%'");
|
||||
} elseif ($action == 'remove-playsms') {
|
||||
@@ -169,6 +171,20 @@ if ($action == 'remove' || $action == 'remove-slack' || $action == 'remove-rocke
|
||||
$message = 'Could not create config item';
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add-telegram') {
|
||||
if (empty($config_value)) {
|
||||
$message = 'No Telegram chat id provided';
|
||||
} else {
|
||||
$config_id = dbInsert(array('config_name' => 'alert.transports.telegram.', 'config_value' => $config_value, 'config_group' => $config_group, 'config_sub_group' => $config_sub_group, 'config_default' => $config_value, 'config_descr' => 'Telegram Transport'), 'config');
|
||||
if ($config_id > 0) {
|
||||
dbUpdate(array('config_name' => 'alert.transports.telegram.'.$config_id.'.chat_id'), 'config', 'config_id=?', array($config_id));
|
||||
dbInsert(array('config_name' => 'alert.transports.telegram.'.$config_id.'.token', 'config_value' => $config_extra, 'config_group' => $config_group, 'config_sub_group' => $config_sub_group, 'config_default' => $config_extra, 'config_descr' => 'Telegram token'), 'config');
|
||||
$status = 'ok';
|
||||
$message = 'Config item created';
|
||||
} else {
|
||||
$message = 'Could not create config item';
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add-clickatell') {
|
||||
if (empty($config_value)) {
|
||||
$message = 'No Clickatell token provided';
|
||||
|
Reference in New Issue
Block a user