From 7061acf508017f251b9f78cc3276301738fdfec6 Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Wed, 16 Nov 2016 04:06:46 +0000 Subject: [PATCH] fix: dbUpdate calls now check if it is 0 or above (#4996) --- html/includes/forms/alert-templates.inc.php | 4 ++-- html/includes/forms/edit-dashboard.inc.php | 2 +- html/includes/forms/poller-groups.inc.php | 2 +- html/includes/forms/storage-update.inc.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/html/includes/forms/alert-templates.inc.php b/html/includes/forms/alert-templates.inc.php index 88a8119cba..8dc20e86a0 100644 --- a/html/includes/forms/alert-templates.inc.php +++ b/html/includes/forms/alert-templates.inc.php @@ -43,7 +43,7 @@ if (!empty($name)) { 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']))) { + if (dbUpdate(array('rule_id' => mres($_REQUEST['rule_id']), 'name' => $name), "alert_templates", "id = ?", array($_REQUEST['template_id'])) >= 0) { $ok = "Updated template and rule id mapping"; } else { $error ="Failed to update the template and rule id mapping"; @@ -51,7 +51,7 @@ if (!empty($name)) { } elseif ($_REQUEST['template'] && is_numeric($_REQUEST['template_id'])) { //Update template-text - if ($ret = dbUpdate(array('template' => $_REQUEST['template'], 'name' => $name, 'title' => $_REQUEST['title'], 'title_rec' => $_REQUEST['title_rec']), "alert_templates", "id = ?", array($_REQUEST['template_id']))) { + if (dbUpdate(array('template' => $_REQUEST['template'], 'name' => $name, 'title' => $_REQUEST['title'], 'title_rec' => $_REQUEST['title_rec']), "alert_templates", "id = ?", array($_REQUEST['template_id'])) >= 0) { $ok = "Updated template"; } else { $error = "Failed to update the template"; diff --git a/html/includes/forms/edit-dashboard.inc.php b/html/includes/forms/edit-dashboard.inc.php index 99e41744c5..6e277eae75 100644 --- a/html/includes/forms/edit-dashboard.inc.php +++ b/html/includes/forms/edit-dashboard.inc.php @@ -26,7 +26,7 @@ header('Content-type: application/json'); $status = 'error'; $message = 'unknown error'; if (isset($_REQUEST['dashboard_id']) && isset($_REQUEST['dashboard_name']) && isset($_REQUEST['access'])) { - if (dbUpdate(array('dashboard_name'=>$_REQUEST['dashboard_name'],'access'=>$_REQUEST['access']), 'dashboards', '(user_id = ? || access = 2) && dashboard_id = ?', array($_SESSION['user_id'],$_REQUEST['dashboard_id']))) { + if (dbUpdate(array('dashboard_name'=>$_REQUEST['dashboard_name'],'access'=>$_REQUEST['access']), 'dashboards', '(user_id = ? || access = 2) && dashboard_id = ?', array($_SESSION['user_id'],$_REQUEST['dashboard_id'])) >= 0) { $status = 'ok'; $message = 'Updated dashboard'; } else { diff --git a/html/includes/forms/poller-groups.inc.php b/html/includes/forms/poller-groups.inc.php index 8369af66a1..e9869146b1 100644 --- a/html/includes/forms/poller-groups.inc.php +++ b/html/includes/forms/poller-groups.inc.php @@ -24,7 +24,7 @@ $group_name = mres($_POST['group_name']); $descr = mres($_POST['descr']); if (!empty($group_name)) { if (is_numeric($group_id)) { - if (dbUpdate(array('group_name' => $group_name, 'descr' => $descr), 'poller_groups', 'id = ?', array($group_id))) { + if (dbUpdate(array('group_name' => $group_name, 'descr' => $descr), 'poller_groups', 'id = ?', array($group_id)) >= 0) { $ok = 'Updated poller group'; } else { $error = 'Failed to update the poller group'; diff --git a/html/includes/forms/storage-update.inc.php b/html/includes/forms/storage-update.inc.php index b26dc9f68a..d87231fd5b 100644 --- a/html/includes/forms/storage-update.inc.php +++ b/html/includes/forms/storage-update.inc.php @@ -36,7 +36,7 @@ if (!is_numeric($device_id)) { } elseif (!is_numeric($data)) { $message = 'Missing value'; } else { - if (dbUpdate(array('storage_perc_warn'=>$data), 'storage', '`storage_id`=? AND `device_id`=?', array($storage_id,$device_id))) { + if (dbUpdate(array('storage_perc_warn'=>$data), 'storage', '`storage_id`=? AND `device_id`=?', array($storage_id,$device_id)) >= 0) { $message = 'Storage information updated'; $status = 'ok'; } else {