a couple of api improvements
This commit is contained in:
parent
ac3075bef7
commit
395268da22
@ -112,8 +112,11 @@ require_once('include/api_auth.php');
|
|||||||
break;
|
break;
|
||||||
case "json":
|
case "json":
|
||||||
header ("Content-Type: application/json");
|
header ("Content-Type: application/json");
|
||||||
foreach($r as $rr)
|
foreach($r as $rr) {
|
||||||
|
if(! $rr)
|
||||||
|
$rr = array();
|
||||||
$json = json_encode($rr);
|
$json = json_encode($rr);
|
||||||
|
}
|
||||||
if ($_GET['callback'])
|
if ($_GET['callback'])
|
||||||
$json = $_GET['callback']."(".$json.")";
|
$json = $_GET['callback']."(".$json.")";
|
||||||
return $json;
|
return $json;
|
||||||
@ -1079,6 +1082,8 @@ require_once('include/api_auth.php');
|
|||||||
'contributors' => ''
|
'contributors' => ''
|
||||||
);
|
);
|
||||||
$status_info['user'] = $user_info;
|
$status_info['user'] = $user_info;
|
||||||
|
if(array_key_exists('status',$status_info['user']))
|
||||||
|
unset($status_info['user']['status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return api_apply_template("status", $type, array('$status' => $status_info));
|
return api_apply_template("status", $type, array('$status' => $status_info));
|
||||||
@ -1320,6 +1325,8 @@ require_once('include/api_auth.php');
|
|||||||
|
|
||||||
// params
|
// params
|
||||||
$id = intval(argv(3));
|
$id = intval(argv(3));
|
||||||
|
if(! $id)
|
||||||
|
$id = $_REQUEST['id'];
|
||||||
|
|
||||||
logger('API: api_statuses_show: '.$id);
|
logger('API: api_statuses_show: '.$id);
|
||||||
|
|
||||||
@ -1336,10 +1343,12 @@ require_once('include/api_auth.php');
|
|||||||
$r = q("select * from item where true $item_normal $sql_extra",
|
$r = q("select * from item where true $item_normal $sql_extra",
|
||||||
intval($id)
|
intval($id)
|
||||||
);
|
);
|
||||||
|
|
||||||
xchan_query($r,true);
|
xchan_query($r,true);
|
||||||
|
|
||||||
$ret = api_format_items($r,$user_info);
|
$ret = api_format_items($r,$user_info);
|
||||||
|
|
||||||
|
|
||||||
if ($conversation) {
|
if ($conversation) {
|
||||||
$data = array('$statuses' => $ret);
|
$data = array('$statuses' => $ret);
|
||||||
return api_apply_template("timeline", $type, $data);
|
return api_apply_template("timeline", $type, $data);
|
||||||
|
@ -28,7 +28,7 @@ function api_login(&$a){
|
|||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
logger(__file__.__line__.__function__."\n".$e);
|
logger($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// workarounds for HTTP-auth in CGI mode
|
// workarounds for HTTP-auth in CGI mode
|
||||||
|
Reference in New Issue
Block a user