User Patch: If a callback is not given, then just provide the raw JSON.
Submitted by Ross Masters <ross@rossmasters.com>
This commit is contained in:
parent
1e76845e9c
commit
eba4b688c4
1 changed files with 6 additions and 2 deletions
|
@ -296,7 +296,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||||
|
|
||||||
header("Content-type: text/javascript");
|
header("Content-type: text/javascript");
|
||||||
echo $_GET['callback'].'('.json_encode($result).')';
|
|
||||||
|
// If a callback is not given, then just provide the raw JSON.
|
||||||
|
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
|
||||||
} else {
|
} else {
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
print 'You are not allowed to access this resource. ';
|
print 'You are not allowed to access this resource. ';
|
||||||
|
@ -329,7 +331,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||||
header("Content-type: text/javascript");
|
header("Content-type: text/javascript");
|
||||||
echo $_GET['callback'].'('.json_encode($result).')';
|
|
||||||
|
// If a callback is not given, then just provide the raw JSON.
|
||||||
|
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
|
||||||
} else {
|
} else {
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
print 'You are not allowed to access this resource. ';
|
print 'You are not allowed to access this resource. ';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue