diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-07-29 17:21:02 +0200 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-07-29 17:21:02 +0200 |
commit | b1e766dadb1d4a9e727b2d1d5f32442392ac6bd3 (patch) | |
tree | 0839cbb08006eddbd5957e2a3895c3f50d63352d | |
parent | 0111a1231cfa90a2aee5b18fc4b8c3dde9f48b81 (diff) | |
download | volse-hubzilla-b1e766dadb1d4a9e727b2d1d5f32442392ac6bd3.tar.gz volse-hubzilla-b1e766dadb1d4a9e727b2d1d5f32442392ac6bd3.tar.bz2 volse-hubzilla-b1e766dadb1d4a9e727b2d1d5f32442392ac6bd3.zip |
allow GET or POST data in statuses/update
-rw-r--r-- | include/api.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/include/api.php b/include/api.php index 4e5ea43bd..5ebf04bb9 100644 --- a/include/api.php +++ b/include/api.php @@ -323,20 +323,31 @@ 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 - function api_statuses_update(&$a, $type) { if (local_user()===false) return false; $user_info = api_get_user($a); // convert $_POST array items to the form we use for web posts. - $_POST['body'] = urldecode($_POST['status']); - $_POST['parent'] = $_POST['in_reply_to_status_id']; - if($_POST['lat'] && $_POST['long']) - $_POST['coord'] = sprintf("%s %s",$_POST['lat'],$_POST['long']); + $_POST['body'] = urldecode(requestdata('status')); + $_POST['parent'] = requestdata('in_reply_to_status_id'); + if(requestdata('lat') && requestdata('long')) + $_POST['coord'] = sprintf("%s %s",requestdata('lat'),requestdata('long')); $_POST['profile_uid'] = local_user(); - if($_POST['parent']) + if(requestdata('parent')) $_POST['type'] = 'net-comment'; else $_POST['type'] = 'wall'; |