From 6a619d1f8cd9b3c43aef8f5e2dfe91fd9f62c246 Mon Sep 17 00:00:00 2001 From: Robert Anderson <randerson@lbsd.net> Date: Thu, 7 May 2009 18:25:20 +0000 Subject: [PATCH] * Added passthrough errors to db.php & ajax.php * Fixed AdminGroups.php --- webgui/ajax.php | 4 ++++ webgui/include/ajax/functions/AdminGroups.php | 11 ++++------- webgui/include/db.php | 3 +++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/webgui/ajax.php b/webgui/ajax.php index d7b85ea9..08f484e9 100644 --- a/webgui/ajax.php +++ b/webgui/ajax.php @@ -150,6 +150,10 @@ print_r($soapParams); $res = removeAdminGroup($soapParams); + if (isset($res)) { + ajaxException($res); + } + break; case "getWiSPResellers": diff --git a/webgui/include/ajax/functions/AdminGroups.php b/webgui/include/ajax/functions/AdminGroups.php index 2b95bf14..995551fe 100644 --- a/webgui/include/ajax/functions/AdminGroups.php +++ b/webgui/include/ajax/functions/AdminGroups.php @@ -46,15 +46,12 @@ function getAdminGroups($params) { function removeAdminGroup($params) { global $db; - $db->errorInfo(); - $res = DBDo("DELETE FROM groups WHERE ID = ".$params[0]['id']); - print_r($params); - # If STH is blank, return the error back to whoever requested the data - if (!isset($res)) { - print_r($res->errorInfo()); + $res = DBDo("DELETE FROM groups WHERE ID = ".$params[0][0]); + if (!is_numeric($res)) { + return $res; } - return $res; + return NULL; } ?> diff --git a/webgui/include/db.php b/webgui/include/db.php index 49c3c99d..91ee9b88 100644 --- a/webgui/include/db.php +++ b/webgui/include/db.php @@ -88,6 +88,9 @@ function DBDo($command) # Perform query $sth = $db->exec($command); + if ($sth === FALSE) { + return $db->errorInfo(); + } return $sth; } -- GitLab