]> git.mxchange.org Git - friendica.git/blobdiff - mod/subthread.php
Merge pull request #5753 from MrPetovan/bug/5752-fix-warning-count
[friendica.git] / mod / subthread.php
index c5d8ee688fc0ac7d9466803e1a20779e56c721de..1153f2147d7c5efcb11f2f71b141fda086640253 100644 (file)
@@ -25,7 +25,7 @@ function subthread_content(App $a) {
        $condition = ["`parent` = ? OR `parent-uri` = ? AND `parent` = `id`", $item_id, $item_id];
        $item = Item::selectFirst([], $condition);
 
-       if (empty($item_id) || !DBA::is_result($item)) {
+       if (empty($item_id) || !DBA::isResult($item)) {
                logger('subthread: no item ' . $item_id);
                return;
        }
@@ -40,15 +40,12 @@ function subthread_content(App $a) {
 
        if (!$item['wall']) {
                // The top level post may have been written by somebody on another system
-               $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
-                       intval($item['contact-id']),
-                       intval($item['uid'])
-               );
-               if (!DBA::is_result($r)) {
+               $contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'uid' => $item['uid']]);
+               if (!DBA::isResult($contact)) {
                        return;
                }
-               if (!$r[0]['self']) {
-                       $remote_owner = $r[0];
+               if (!$contact['self']) {
+                       $remote_owner = $contact;
                }
        }
 
@@ -60,7 +57,7 @@ function subthread_content(App $a) {
                intval($owner_uid)
        );
 
-       if (DBA::is_result($r)) {
+       if (DBA::isResult($r)) {
                $owner = $r[0];
        }
 
@@ -79,18 +76,11 @@ function subthread_content(App $a) {
        if (local_user() && (local_user() == $owner_uid)) {
                $contact = $owner;
        } else {
-               $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
-                       intval($_SESSION['visitor_id']),
-                       intval($owner_uid)
-               );
-
-               if (DBA::is_result($r)) {
-                       $contact = $r[0];
+               $contact = DBA::selectFirst('contact', [], ['id' => $_SESSION['visitor_id'], 'uid' => $owner_uid]);
+               if (!DBA::isResult($contact)) {
+                       return;
                }
        }
-       if (!$contact) {
-               return;
-       }
 
        $uri = Item::newURI($owner_uid);