]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
Merge pull request #108 from fabrixxm/widget
[friendica.git] / mod / network.php
index f40d34353204f717c420a52b7b3c5b91a4e10807..16739b434579753b947929a8fe0af41bf0766280 100644 (file)
@@ -100,14 +100,16 @@ function network_content(&$a, $update = 0) {
 
        }
 
-       // We aren't going to try and figure out at the item, group, and page level 
-       // which items you've seen and which you haven't. You're looking at some
-       // subset of items, so just mark everything seen. 
+       // We aren't going to try and figure out at the item, group, and page
+       // level which items you've seen and which you haven't. If you're looking
+       // at the top level network page just mark everything seen. 
        
-       $r = q("UPDATE `item` SET `unseen` = 0 
-               WHERE `unseen` = 1 AND `uid` = %d",
-               intval($_SESSION['uid'])
-       );
+       if((! $group) && (! $cid)) {
+               $r = q("UPDATE `item` SET `unseen` = 0 
+                       WHERE `unseen` = 1 AND `uid` = %d",
+                       intval($_SESSION['uid'])
+               );
+       }
 
        // We don't have to deal with ACL's on this page. You're looking at everything
        // that belongs to you, hence you can see all of it. We will filter by group if
@@ -137,7 +139,7 @@ function network_content(&$a, $update = 0) {
                                notice( t('Group is empty'));
                }
 
-               $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( $contact_str )) ";
+               $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` REGEXP '<" . intval($group) . ">' )) ";
                $o = '<h2>' . t('Group: ') . $r[0]['name'] . '</h2>' . $o;
        }
        elseif($cid) {
@@ -149,7 +151,7 @@ function network_content(&$a, $update = 0) {
                if(count($r)) {
                        $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( " . intval($cid) . " )) ";
                        $o = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o;
-                       if($r[0]['network'] !== NETWORK_MAIL && $r[0]['network'] !== NETWORK_DFRN && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
+                       if($r[0]['network'] !== NETWORK_MAIL && $r[0]['network'] !== NETWORK_DFRN && $r[0]['network'] !== NETWORK_FACEBOOK && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
                                notice( t('Private messages to this person are at risk of public disclosure.') . EOL);
                        }
 
@@ -164,11 +166,13 @@ function network_content(&$a, $update = 0) {
        if((! $group) && (! $cid) && (! $update))
                $o .= get_birthdays();
 
+       $sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` ");
 
        $r = q("SELECT COUNT(*) AS `total`
                FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
                AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+               $sql_extra2
                $sql_extra ",
                intval($_SESSION['uid'])
        );