API: add GET /api/z/1.0/abconfig

This commit is contained in:
zotlabs 2016-11-14 20:30:28 -08:00
parent 537510f081
commit b9728a96ce

View File

@ -34,6 +34,7 @@
api_register_func('api/z/1.0/item/full','red_item', true); api_register_func('api/z/1.0/item/full','red_item', true);
api_register_func('api/z/1.0/abook','api_zot_abook_xchan',true); api_register_func('api/z/1.0/abook','api_zot_abook_xchan',true);
api_register_func('api/z/1.0/abconfig','api_zot_abconfig',true);
return; return;
} }
@ -287,6 +288,22 @@
json_return_and_die($r); json_return_and_die($r);
}; };
function api_zot_abconfig($type) {
if(api_user() === false)
return false;
$sql_extra = ((array_key_exists('abook_id',$_REQUEST) && intval($_REQUEST['abook_id'])) ? ' and abook_id = ' . intval($_REQUEST['abook_id']) . ' ' : '');
if($_SERVER['REQUEST_METHOD'] === 'POST') {
// update
}
$r = q("select abconfig.* from abconfig left join abook on abook_xchan = abconfig.xchan and abook_channel = abconfig.chan where abconfig.chan = %d $sql_extra ",
intval(api_user())
);
json_return_and_die($r);
}
function red_item_new($type) { function red_item_new($type) {