From: Michael Date: Sun, 20 Nov 2016 09:24:56 +0000 (+0000) Subject: Bugfix: Filtering by group has always to be done with the contact id in the thread... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=68a31e084a1ce23676f8933f9f34e580ce31c051;p=friendica.git Bugfix: Filtering by group has always to be done with the contact id in the thread table --- diff --git a/mod/network.php b/mod/network.php index 559bad0a3e..ec44b8e5a6 100644 --- a/mod/network.php +++ b/mod/network.php @@ -453,6 +453,7 @@ function network_content(&$a, $update = 0) { if ($nouveau OR strlen($file) OR $update) { $sql_table = "`item`"; $sql_parent = "`parent`"; + $sql_post_table = " INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`"; } $sql_nets = (($nets) ? sprintf(" and $sql_table.`network` = '%s' ", dbesc($nets)) : ''); @@ -487,9 +488,9 @@ function network_content(&$a, $update = 0) { $gcontact_str_self = $self[0]["gid"]; } - $sql_post_table = " INNER JOIN `item` AS `temp1` ON `temp1`.`id` = ".$sql_table.".".$sql_parent; - $sql_extra3 .= " AND ($sql_table.`contact-id` IN ($contact_str) "; - $sql_extra3 .= " OR ($sql_table.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '".protect_sprintf('%<'.intval($group).'>%')."' AND `temp1`.`private`))"; + $sql_post_table .= " INNER JOIN `item` AS `temp1` ON `temp1`.`id` = ".$sql_table.".".$sql_parent; + $sql_extra3 .= " AND (`thread`.`contact-id` IN ($contact_str) "; + $sql_extra3 .= " OR (`thread`.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '".protect_sprintf('%<'.intval($group).'>%')."' AND `temp1`.`private`))"; } else { $sql_extra3 .= " AND false "; info( t('Group is empty')); @@ -569,7 +570,7 @@ function network_content(&$a, $update = 0) { if($tag) { $sql_extra = ""; - $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", + $sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(local_user())); $sql_order = "`item`.`id`"; $order_mode = "id"; @@ -583,7 +584,7 @@ function network_content(&$a, $update = 0) { } } if(strlen($file)) { - $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", + $sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", dbesc(protect_sprintf($file)), intval(TERM_OBJ_POST), intval(TERM_FILE), intval(local_user())); $sql_order = "`item`.`id`"; $order_mode = "id";