diff options
author | Friendika <info@friendika.com> | 2011-06-19 21:08:51 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-06-19 21:08:51 -0700 |
commit | f3292e68a25c03cbd92952f5670f355b8784c877 (patch) | |
tree | 1184c776561042295ea3f711e9af6926b406cbd5 /include | |
parent | b56e00c7c5ed1ee7043852b4ce025a3d02f139e8 (diff) | |
download | volse-hubzilla-f3292e68a25c03cbd92952f5670f355b8784c877.tar.gz volse-hubzilla-f3292e68a25c03cbd92952f5670f355b8784c877.tar.bz2 volse-hubzilla-f3292e68a25c03cbd92952f5670f355b8784c877.zip |
user and status outputs reversed for api post
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/include/api.php b/include/api.php index d1f0f9330..fbcfffef8 100644 --- a/include/api.php +++ b/include/api.php @@ -341,10 +341,62 @@ item_post($a); // this should output the last post (the one we just posted). - return api_users_show($a,$type); + return api_status_show($a,$type); } api_register_func('api/statuses/update','api_statuses_update', true); + + function api_status_show(&$a, $type){ + $user_info = api_get_user($a); + // get last public wall message + $lastwall = q("SELECT `item`.*, `i`.`contact-id` as `reply_uid`, `i`.`nick` as `reply_author` + FROM `item`, `contact`, + (SELECT `item`.`id`, `item`.`contact-id`, `contact`.`nick` FROM `item`,`contact` WHERE `contact`.`id`=`item`.`contact-id`) as `i` + WHERE `item`.`contact-id` = %d + AND `i`.`id` = `item`.`parent` + AND `contact`.`id`=`item`.`contact-id` AND `contact`.`self`=1 + AND `type`!='activity' + AND `item`.`allow_cid`='' AND `item`.`allow_gid`='' AND `item`.`deny_cid`='' AND `item`.`deny_gid`='' + ORDER BY `created` DESC + LIMIT 1", + intval($user_info['id']) + ); + + if (count($lastwall)>0){ + $lastwall = $lastwall[0]; + + $in_reply_to_status_id = ''; + $in_reply_to_user_id = ''; + $in_reply_to_screen_name = ''; + if ($lastwall['parent']!=$lastwall['id']) { + $in_reply_to_status_id=$lastwall['parent']; + $in_reply_to_user_id = $lastwall['reply_uid']; + $in_reply_to_screen_name = $lastwall['reply_author']; + } + $status_info = array( + 'created_at' => api_date($lastwall['created']), + 'id' => $lastwall['contact-id'], + 'text' => strip_tags(bbcode($lastwall['body'])), + 'source' => 'web', + 'truncated' => false, + 'in_reply_to_status_id' => $in_reply_to_status_id, + 'in_reply_to_user_id' => $in_reply_to_user_id, + 'favorited' => false, + 'in_reply_to_screen_name' => $in_reply_to_screen_name, + 'geo' => '', + 'coordinates' => $lastwall['coord'], + 'place' => $lastwall['location'], + 'contributors' => '' + ); + $status_info['user'] = $user_info; + } + return api_apply_template("status", $type, array('$status' => $status_info)); + + } + + + + /** * Returns extended information of a given user, specified by ID or screen name as per the required id parameter. |