]> git.mxchange.org Git - friendica.git/commitdiff
change the way public feeds work just to fix statusnet's bug, because they won't
authorFriendika <info@friendika.com>
Wed, 24 Aug 2011 12:58:31 +0000 (05:58 -0700)
committerFriendika <info@friendika.com>
Wed, 24 Aug 2011 12:58:31 +0000 (05:58 -0700)
include/items.php

index 19e56c0b60329567c66b6fbffc1dbb9813f06e70..150be27070dd8d5f8118d5147917afdccda1a6f6 100644 (file)
@@ -12,6 +12,18 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
        if(! strlen($owner_nick))
                killme();
 
+       $public_feed = (($dfrn_id) ? false : true);
+       $starred = false;
+       $converse = false;
+
+       if($public_feed && $a->argc > 2) {
+               for($x = 2; $x < $a->argc; $x++) {
+                       if($a->argv[$x] == 'converse')
+                               $converse = true;
+               }
+       }
+
+
        $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid`  = '' AND `deny_gid`  = '' ";
 
        $r = q("SELECT `contact`.*, `user`.`uid` AS `user_uid`, `user`.`nickname`, `user`.`timezone`
@@ -29,7 +41,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
 
        $birthday = feed_birthday($owner_id,$owner['timezone']);
 
-       if(strlen($dfrn_id)) {
+       if(! $public_feed) {
 
                $sql_extra = '';
                switch($direction) {
@@ -81,7 +93,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
                );
        }
 
-       if($dfrn_id === '' || $dfrn_id === '*')
+       if($public_feed)
                $sort = 'DESC';
        else
                $sort = 'ASC';
@@ -89,6 +101,11 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
        if(! strlen($last_update))
                $last_update = 'now -30 days';
 
+       if($public_feed) {
+               if(! $converse)
+                       $sql_extra .= " AND `contact`.`self` = 1 ";
+       }
+
        $check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
 
        $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, 
@@ -152,7 +169,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
 
                // public feeds get html, our own nodes use bbcode
 
-               if($dfrn_id === '') {
+               if($public_feed) {
                        $type = 'html';
                        // catch any email that's in a public conversation and make sure it doesn't leak
                        if($item['private'])