X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fapi.php;h=42868aa9eb81566c5f2587dafcdca9f3b2db4158;hb=3e797547a37f8c8f22e88965b4a4d278bcc192e0;hp=af6f54fe607568e20ad0ddd6971516e03b97bdbf;hpb=e44111e935b6356dc6f8928d713173ff96bf7c61;p=friendica.git diff --git a/include/api.php b/include/api.php index af6f54fe60..42868aa9eb 100644 --- a/include/api.php +++ b/include/api.php @@ -579,7 +579,9 @@ function api_get_user(App $a, $contact_id = null) // $called_api is the API path exploded on / and is expected to have at least 2 elements if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (count($called_api) > 0)) { $argid = count($called_api); - list($user, $null) = explode(".", $a->argv[$argid]); + if (!empty($a->argv[$argid])) { + list($user, $null) = explode(".", $a->argv[$argid]); + } if (is_numeric($user)) { $user = dbesc(api_unique_id_to_nurl(intval($user))); @@ -1278,7 +1280,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 +1365,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 +1825,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 +1905,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."); }