]> git.mxchange.org Git - friendica.git/blobdiff - mod/subthread.php
Merge remote-tracking branch 'upstream/develop' into develop
[friendica.git] / mod / subthread.php
index 33cf7489c167764b716f3cee77ca7dae78011667..958f4ba03b65bd831689d9cb4e1fba9bfd7c76b9 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function subthread_content(&$a) {
+function subthread_content(App &$a) {
 
        if(! local_user() && ! remote_user()) {
                return;
@@ -20,7 +20,7 @@ function subthread_content(&$a) {
                dbesc($item_id)
        );
 
-       if(! $item_id || (! count($r))) {
+       if(! $item_id || (! dbm::is_result($r))) {
                logger('subthread: no item ' . $item_id);
                return;
        }
@@ -41,8 +41,9 @@ function subthread_content(&$a) {
                        intval($item['contact-id']),
                        intval($item['uid'])
                );
-               if(! count($r))
+               if (! dbm::is_result($r)) {
                        return;
+               }
                if(! $r[0]['self'])
                        $remote_owner = $r[0];
        }
@@ -53,7 +54,7 @@ function subthread_content(&$a) {
                WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
                intval($owner_uid)
        );
-       if(count($r))
+       if (dbm::is_result($r))
                $owner = $r[0];
 
        if(! $owner) {
@@ -75,7 +76,7 @@ function subthread_content(&$a) {
                        intval($_SESSION['visitor_id']),
                        intval($owner_uid)
                );
-               if(count($r))
+               if (dbm::is_result($r))
                        $contact = $r[0];
        }
        if(! $contact) {
@@ -85,8 +86,8 @@ function subthread_content(&$a) {
        $uri = item_new_uri($a->get_hostname(),$owner_uid);
 
        $post_type = (($item['resource-id']) ? t('photo') : t('status'));
-       $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
-       $link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
+       $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE );
+       $link = xmlify('<link rel="alternate" type="text/html" href="' . App::get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
        $body = $item['body'];
 
        $obj = <<< EOT
@@ -127,7 +128,7 @@ EOT;
 
        $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
        $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
-       $plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
+       $plink = '[url=' . App::get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
        $arr['body'] =  sprintf( $bodyverb, $ulink, $alink, $plink );
 
        $arr['verb'] = $activity;