allow GET or POST data in statuses/update
This commit is contained in:
parent
0111a1231c
commit
b1e766dadb
|
@ -323,20 +323,31 @@
|
||||||
api_register_func('api/account/verify_credentials','api_account_verify_credentials', true);
|
api_register_func('api/account/verify_credentials','api_account_verify_credentials', true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get data from $_POST or $_GET
|
||||||
|
*/
|
||||||
|
function requestdata($k){
|
||||||
|
if (isset($_POST[$k])){
|
||||||
|
return $_POST[$k];
|
||||||
|
}
|
||||||
|
if (isset($_GET[$k])){
|
||||||
|
return $_GET[$k];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// TODO - media uploads
|
// TODO - media uploads
|
||||||
|
|
||||||
function api_statuses_update(&$a, $type) {
|
function api_statuses_update(&$a, $type) {
|
||||||
if (local_user()===false) return false;
|
if (local_user()===false) return false;
|
||||||
$user_info = api_get_user($a);
|
$user_info = api_get_user($a);
|
||||||
|
|
||||||
// convert $_POST array items to the form we use for web posts.
|
// convert $_POST array items to the form we use for web posts.
|
||||||
|
|
||||||
$_POST['body'] = urldecode($_POST['status']);
|
$_POST['body'] = urldecode(requestdata('status'));
|
||||||
$_POST['parent'] = $_POST['in_reply_to_status_id'];
|
$_POST['parent'] = requestdata('in_reply_to_status_id');
|
||||||
if($_POST['lat'] && $_POST['long'])
|
if(requestdata('lat') && requestdata('long'))
|
||||||
$_POST['coord'] = sprintf("%s %s",$_POST['lat'],$_POST['long']);
|
$_POST['coord'] = sprintf("%s %s",requestdata('lat'),requestdata('long'));
|
||||||
$_POST['profile_uid'] = local_user();
|
$_POST['profile_uid'] = local_user();
|
||||||
if($_POST['parent'])
|
if(requestdata('parent'))
|
||||||
$_POST['type'] = 'net-comment';
|
$_POST['type'] = 'net-comment';
|
||||||
else
|
else
|
||||||
$_POST['type'] = 'wall';
|
$_POST['type'] = 'wall';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user