From 6ec12c66c394b48fa0a319ec3ca938eaa2cf4f43 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 11 Sep 2014 21:41:45 -0700 Subject: red group/collection query calls for api --- include/api.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include') diff --git a/include/api.php b/include/api.php index c0f54af19..47de945db 100644 --- a/include/api.php +++ b/include/api.php @@ -582,10 +582,43 @@ require_once('include/items.php'); api_register_func('api/red/photos','api_photos', true); + function api_group_members(&$a,$type) { + if(api_user() === false) + return false; + + if($_REQUEST['group_id']) { + $r = q("select * from groups where uid = %d and id = %d limit 1", + intval(api_user()), + intval($_REQUEST['group_id']) + ); + if($r) { + $x = q("select * from group_member left join xchan on group_member.xchan = xchan.xchan_hash + left join abook on abook_xchan = xchan_hash where gid = %d", + intval($_REQUEST['group_id']) + ); + json_return_and_die($x); + } + } + } + + api_register_func('api/red/group_members','api_group_members', true); + function api_group(&$a,$type) { + if(api_user() === false) + return false; + + $r = q("select * from groups where uid = %d", + intval(api_user()) + ); + json_return_and_die($r); + } + api_register_func('api/red/group','api_group', true); + + + function api_statuses_mediap(&$a, $type) { if (api_user() === false) { -- cgit v1.2.3