]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
Merge branch 'develop' of https://github.com/friendica/friendica into redis_serialize
[friendica.git] / include / api.php
index af6f54fe607568e20ad0ddd6971516e03b97bdbf..ad991485a4da241e0c536d0746f2e85f98c8fd0c 100644 (file)
@@ -1278,7 +1278,7 @@ function api_status_show($type)
        // get last public wall message
        $condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
                'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
-       $lastwall = dba::selectFirst('item', [], $condition, ['order' => ['id' => true]]);
+       $lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
 
        if (DBM::is_result($lastwall)) {
                $in_reply_to = api_in_reply_to($lastwall);
@@ -1363,7 +1363,7 @@ function api_users_show($type)
 
        $condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
                'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'private' => false];
-       $lastwall = dba::selectFirst('item', [], $condition, ['order' => ['id' => true]]);
+       $lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
 
        if (DBM::is_result($lastwall)) {
                $in_reply_to = api_in_reply_to($lastwall);
@@ -1823,12 +1823,12 @@ function api_statuses_show($type)
        $conversation = !empty($_REQUEST['conversation']);
 
        // try to fetch the item for the local user - or the public item, if there is no local one
-       $uri_item = dba::selectFirst('item', ['uri'], ['id' => $id]);
+       $uri_item = Item::selectFirst(['uri'], ['id' => $id]);
        if (!DBM::is_result($uri_item)) {
                throw new BadRequestException("There is no status with this id.");
        }
 
-       $item = dba::selectFirst('item', ['id'], ['uri' => $uri_item['uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
+       $item = Item::selectFirst(['id'], ['uri' => $uri_item['uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
        if (!DBM::is_result($item)) {
                throw new BadRequestException("There is no status with this id.");
        }
@@ -1903,12 +1903,12 @@ function api_conversation_show($type)
        logger('API: api_conversation_show: '.$id);
 
        // try to fetch the item for the local user - or the public item, if there is no local one
-       $item = dba::selectFirst('item', ['parent-uri'], ['id' => $id]);
+       $item = Item::selectFirst(['parent-uri'], ['id' => $id]);
        if (!DBM::is_result($item)) {
                throw new BadRequestException("There is no status with this id.");
        }
 
-       $parent = dba::selectFirst('item', ['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
+       $parent = Item::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
        if (!DBM::is_result($parent)) {
                throw new BadRequestException("There is no status with this id.");
        }