From: Jon Langseth Date: Tue, 7 Feb 2012 10:24:26 +0000 (+0100) Subject: Permitedcalls is now called permittedcalls in the DB. Fixed a failure-failure resulti... X-Git-Url: https://git.defcon.no/?a=commitdiff_plain;h=9b432090e9ad362c682ab055cc0bd469f7216360;p=hermes Permitedcalls is now called permittedcalls in the DB. Fixed a failure-failure resulting in invalid JSON (double responses) --- 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' ) );