X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fapi.php;h=d66446cb6896f346e9d0bf701ec264371379c98a;hb=af39296f0640bc40e58f51ec47c4e5aa53a24316;hp=00c2173c38b1b8f4c4297047928e1b8396447f42;hpb=d71281e45b6398119ecb09d47dd8947c9e41d15b;p=friendica.git diff --git a/include/api.php b/include/api.php index 00c2173c38..d66446cb68 100644 --- a/include/api.php +++ b/include/api.php @@ -1626,7 +1626,7 @@ function api_search($type) } $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); $data['status'] = api_format_items(dba::inArray($statuses), $user_info); @@ -1693,7 +1693,7 @@ function api_statuses_home_timeline($type) } $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); $items = dba::inArray($statuses); @@ -1770,7 +1770,7 @@ function api_statuses_public_timeline($type) } $params = ['order' => ['iid' => true], 'limit' => [$start, $count]]; - $statuses = Item::selectThread(api_user(), [], $condition, $params); + $statuses = Item::selectThreadForUser(api_user(), Item::DISPLAY_FIELDLIST, $condition, $params); $r = dba::inArray($statuses); } else { @@ -1787,7 +1787,7 @@ function api_statuses_public_timeline($type) } $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); $r = dba::inArray($statuses); } @@ -1846,7 +1846,7 @@ function api_statuses_networkpublic_timeline($type) } $params = ['order' => ['iid' => true], 'limit' => [$start, $count]]; - $statuses = Item::selectThread(api_user(), [], $condition, $params); + $statuses = Item::selectThreadForUser(api_user(), Item::DISPLAY_FIELDLIST, $condition, $params); $ret = api_format_items(dba::inArray($statuses), $user_info, false, $type); @@ -1917,7 +1917,7 @@ function api_statuses_show($type) $params = []; } - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); /// @TODO How about copying this to above methods which don't check $r ? if (!DBM::is_result($statuses)) { @@ -1998,7 +1998,7 @@ function api_conversation_show($type) } $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); if (!DBM::is_result($statuses)) { throw new BadRequestException("There is no status with id $id."); @@ -2048,7 +2048,7 @@ function api_statuses_repeat($type) logger('API: api_statuses_repeat: '.$id); $fields = ['body', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink']; - $item = Item::selectFirst(api_user(), $fields, ['id' => $id, 'private' => false]); + $item = Item::selectFirst($fields, ['id' => $id, 'private' => false]); if (DBM::is_result($item) && $item['body'] != "") { if (strpos($item['body'], "[/share]") !== false) { @@ -2168,7 +2168,7 @@ function api_statuses_mentions($type) } $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); $ret = api_format_items(dba::inArray($statuses), $user_info, false, $type); @@ -2248,7 +2248,7 @@ function api_statuses_user_timeline($type) } $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); $ret = api_format_items(dba::inArray($statuses), $user_info, true, $type); @@ -2300,7 +2300,7 @@ function api_favorites_create_destroy($type) $itemid = intval($_REQUEST['id']); } - $item = Item::selectFirst(api_user(), [], ['id' => $itemid, 'uid' => api_user()]); + $item = Item::selectFirstForUser(api_user(), [], ['id' => $itemid, 'uid' => api_user()]); if (!DBM::is_result($item)) { throw new BadRequestException("Invalid item."); @@ -2390,7 +2390,7 @@ function api_favorites($type) $condition[] = $max_id; } - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); $ret = api_format_items(dba::inArray($statuses), $user_info, false, $type); } @@ -3198,7 +3198,7 @@ function api_lists_statuses($type) } $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; - $statuses = Item::select(api_user(), [], $condition, $params); + $statuses = Item::selectForUser(api_user(), [], $condition, $params); $items = api_format_items(dba::inArray($statuses), $user_info, false, $type); @@ -4599,7 +4599,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $filetype, $visibility = false) { // get data about the api authenticated user - $uri = item_new_uri(get_app()->get_hostname(), intval(api_user())); + $uri = Item::newURI(intval(api_user())); $owner_record = q("SELECT * FROM `contact` WHERE `uid`= %d AND `self` LIMIT 1", intval(api_user())); $arr = []; @@ -4723,7 +4723,7 @@ function prepare_photo_data($type, $scale, $photo_id) $condition = ["`parent` = ? AND `uid` = ? AND (`verb` = ? OR `type`='photo')", $item[0]['parent'], api_user(), ACTIVITY_POST]; - $statuses = Item::select(api_user(), [], $condition); + $statuses = Item::selectForUser(api_user(), [], $condition); // prepare output of comments $commentData = api_format_items(dba::inArray($statuses), $user_info, false, $type); @@ -5716,7 +5716,7 @@ function api_friendica_notification_seen($type) $nm->setSeen($note); if ($note['otype']=='item') { // would be really better with an ItemsManager and $im->getByID() :-P - $item = Item::selectFirst(api_user(), [], ['id' => $note['iid'], 'uid' => api_user()]); + $item = Item::selectFirstForUser(api_user(), [], ['id' => $note['iid'], 'uid' => api_user()]); if (DBM::is_result($$item)) { // we found the item, return it to the user $ret = api_format_items([$item], $user_info, false, $type);