From 9b432090e9ad362c682ab055cc0bd469f7216360 Mon Sep 17 00:00:00 2001 From: Jon Langseth Date: Tue, 7 Feb 2012 11:24:26 +0100 Subject: [PATCH] Permitedcalls is now called permittedcalls in the DB. Fixed a failure-failure resulting in invalid JSON (double responses) --- api/lib/user_functions.php | 2 +- api/user.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/lib/user_functions.php b/api/lib/user_functions.php index 05ce335..a022433 100644 --- a/api/lib/user_functions.php +++ b/api/lib/user_functions.php @@ -307,7 +307,7 @@ function get_userdata( $username, $domain ) if ( $type == 'local' ) { // WARNING: Note the typo in the name of the 'permittedcalls' column! - $query_kamailio = sprintf ("SELECT id, username, domain, password, email_address, ha1, ha1b, rpid, permitedcalls FROM %s WHERE username = '%s' AND domain = '%s'", + $query_kamailio = sprintf ("SELECT id, username, domain, password, email_address, ha1, ha1b, rpid, permittedcalls FROM %s WHERE username = '%s' AND domain = '%s'", $config['kamailio_subscriber_table'], sql_clean($username), sql_clean($domain)); diff --git a/api/user.php b/api/user.php index 7d5494d..260ac35 100644 --- a/api/user.php +++ b/api/user.php @@ -235,9 +235,10 @@ token_auth(); delete_provision_user( $username, $domain ); // Give errormessage, and quit. print json_encode( array( 'response' => 'failed', 'cause' => 'dbfail', 'detail' => 'Failed to read recently added data. Operations rolled back' ) ); - + break; } print json_encode( array( 'response' => 'ok', 'user' => $userdata )); + break; } else print json_encode( array( 'response' => 'invalid', 'cause' => 'parameters' ) ); @@ -356,9 +357,10 @@ token_auth(); delete_provision_user( $username, $domain ); // Give errormessage, and quit. print json_encode( array( 'response' => 'failed', 'cause' => 'dbfail', 'detail' => 'Failed to read recently added data. Operations rolled back' ) ); - + break; } print json_encode( array( 'response' => 'ok', 'user' => $userdata )); + break; } else print json_encode( array( 'response' => 'invalid', 'cause' => 'parameters' ) ); -- 2.39.2