]> git.mxchange.org Git - friendica.git/commitdiff
Fix some notices/warnings again
authorMichael <heluecht@pirati.ca>
Thu, 21 Nov 2019 22:40:54 +0000 (22:40 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 21 Nov 2019 22:40:54 +0000 (22:40 +0000)
include/api.php
src/Protocol/Diaspora.php

index 8325e39b71442f6518054ac1293ea3657ae666ab..22fe64097bbafa8640f75df8f5c01d4661fc006e 100644 (file)
@@ -959,7 +959,7 @@ function api_account_verify_credentials($type)
        // - Adding last status
        if (!$skip_status) {
                $item = api_get_last_status($user_info['pid'], $user_info['uid']);
-               if ($item) {
+               if (!empty($item)) {
                        $user_info['status'] = api_format_item($item, $type);
                }
        }
@@ -1318,7 +1318,7 @@ function api_status_show($type, $item_id)
        $status_info = [];
 
        $item = api_get_item(['id' => $item_id]);
-       if ($item) {
+       if (!empty($item)) {
                $status_info = api_format_item($item, $type);
        }
 
@@ -1382,7 +1382,7 @@ function api_users_show($type)
        $user_info = api_get_user($a);
 
        $item = api_get_last_status($user_info['pid'], $user_info['uid']);
-       if ($item) {
+       if (!empty($item)) {
                $user_info['status'] = api_format_item($item, $type);
        }
 
index e137afe99e803133a58597a6a6c830a299bce6ba..7c583dc280947ad6cafa5ea8fa7b6e46f8e6f480 100644 (file)
@@ -3419,7 +3419,7 @@ class Diaspora
                        $condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
                        $item = Item::selectFirst(['contact-id'], $condition);
                        if (DBA::isResult($item)) {
-                               $ret= [];
+                               $ret = [];
                                $ret["root_handle"] = self::handleFromContact($item["contact-id"]);
                                $ret["root_guid"] = $guid;
                                return $ret;
@@ -3445,12 +3445,12 @@ class Diaspora
                        $profile = $matches[1];
                }
 
-               $ret= [];
+               $ret = [];
 
-               if ($profile != "") {
-                       if (Contact::getIdForURL($profile)) {
-                               $author = Contact::getDetailsByURL($profile);
-                               $ret["root_handle"] = $author['addr'];
+               if (!empty($profile) && ($cid = Contact::getIdForURL($profile))) {
+                       $contact = DBA::selectFirst('contact', ['addr'], ['id' => $cid]);
+                       if (!empty($contact['addr'])) {
+                               $ret['root_handle'] = $contact['addr'];
                        }
                }