aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2015-09-11 06:42:11 +0200
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2015-09-11 06:42:11 +0200
commitedb1473f13a87ccfdfe2555ac9ab798fbc073805 (patch)
tree18a15afbca3cdbbf262e0737d01e23e7b4905cf1 /include/api.php
parent2f73d24ab134391c3b3a69d5cbfede42e028b5ed (diff)
parentf2171173fe2c9a0596672da293eb756a514ff789 (diff)
downloadvolse-hubzilla-edb1473f13a87ccfdfe2555ac9ab798fbc073805.tar.gz
volse-hubzilla-edb1473f13a87ccfdfe2555ac9ab798fbc073805.tar.bz2
volse-hubzilla-edb1473f13a87ccfdfe2555ac9ab798fbc073805.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/api.php b/include/api.php
index 6d71cfc33..a77bf15f7 100644
--- a/include/api.php
+++ b/include/api.php
@@ -896,6 +896,55 @@ require_once('include/items.php');
api_register_func('api/red/item/new','red_item_new', true);
+ function red_item(&$a, $type) {
+
+ if (api_user() === false) {
+ logger('api_red_item_new: no user');
+ return false;
+ }
+
+ if($_REQUEST['mid']) {
+ $arr = array('mid' => $_REQUEST['mid']);
+ }
+ elseif($_REQUEST['item_id']) {
+ $arr = array('item_id' => $_REQUEST['item_id']);
+ }
+ else
+ json_return_and_die(array());
+
+ $arr['start'] = 0;
+ $arr['records'] = 999999;
+ $arr['item_type'] = '*';
+
+ $i = items_fetch($arr,$a->get_channel(),get_observer_hash());
+
+ if(! $i)
+ json_return_and_die(array());
+
+ $ret = array();
+ $tmp = array();
+ $str = '';
+ foreach($i as $ii) {
+ $tmp[] = encode_item($ii,true);
+ if($str)
+ $str .= ',';
+ $str .= $ii['id'];
+ }
+ $ret['item'] = $tmp;
+ if($str) {
+ $r = q("select item_id.*, item.mid from item_id left join item on item_id.iid = item.id where item.id in ( $str ) ");
+
+ if($r)
+ $ret['item_id'] = $r;
+ }
+
+ json_return_and_die($ret);
+ }
+
+ api_register_func('api/red/item/full','red_item', true);
+
+
+
function api_get_status($xchan_hash) {
require_once('include/security.php');