change the way public feeds work just to fix statusnet's bug, because they won't

This commit is contained in:
Friendika 2011-08-24 05:58:31 -07:00
parent a775474dff
commit d6f9e0e2a4

View file

@ -12,6 +12,18 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
if(! strlen($owner_nick)) if(! strlen($owner_nick))
killme(); 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` = '' "; $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` $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']); $birthday = feed_birthday($owner_id,$owner['timezone']);
if(strlen($dfrn_id)) { if(! $public_feed) {
$sql_extra = ''; $sql_extra = '';
switch($direction) { 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'; $sort = 'DESC';
else else
$sort = 'ASC'; $sort = 'ASC';
@ -89,6 +101,11 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
if(! strlen($last_update)) if(! strlen($last_update))
$last_update = 'now -30 days'; $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'); $check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, $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 // public feeds get html, our own nodes use bbcode
if($dfrn_id === '') { if($public_feed) {
$type = 'html'; $type = 'html';
// catch any email that's in a public conversation and make sure it doesn't leak // catch any email that's in a public conversation and make sure it doesn't leak
if($item['private']) if($item['private'])