]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
[friendica.git] / include / items.php
index 129499967abf0047e9967126f6b90a38e04142f4..e5b640fd2327c29b9b87c5f1c563b734dfc42408 100644 (file)
@@ -959,6 +959,8 @@ function tag_deliver($uid,$item_id) {
                return;
 
        $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
+       $prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
+
 
        $i = q("select * from item where id = %d and uid = %d limit 1",
                intval($item_id),
@@ -1008,9 +1010,10 @@ function tag_deliver($uid,$item_id) {
                'otype'        => 'item'
        ));
 
-       if(! $community_page)
+       if((! $community_page) && (! $prvgroup))
                return;
 
+
        // tgroup delivery - setup a second delivery chain
        // prevent delivery looping - only proceed
        // if the message originated elsewhere and is a top-level post
@@ -1031,8 +1034,11 @@ function tag_deliver($uid,$item_id) {
 
        $private = ($u[0]['allow_cid'] || $u[0]['allow_gid'] || $u[0]['deny_cid'] || $u[0]['deny_gid']) ? 1 : 0;
 
-       q("update item set wall = 1, origin = 1, forum_mode = 1, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s', 
+       $forum_mode = (($prvgroup) ? 2 : 1);
+
+       q("update item set wall = 1, origin = 1, forum_mode = %d, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s', 
                `private` = %d, `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'  where id = %d limit 1",
+               intval($forum_mode),
                dbesc($c[0]['name']),
                dbesc($c[0]['url']),
                dbesc($c[0]['thumb']),
@@ -2194,7 +2200,7 @@ function local_delivery($importer,$data) {
                if($is_reply) {
                        $community = false;
 
-                       if($importer['page-flags'] == PAGE_COMMUNITY) {
+                       if($importer['page-flags'] == PAGE_COMMUNITY || $importer['page-flags'] == PAGE_PRVGROUP ) {
                                $sql_extra = '';
                                $community = true;
                                logger('local_delivery: possible community reply');
@@ -2221,8 +2227,8 @@ function local_delivery($importer,$data) {
                        if($r && count($r))
                                $is_a_remote_comment = true;                    
 
-                       // Does this have the characteristics of a community comment?
-                       // If it's a reply to a wall post on a community page it's a 
+                       // Does this have the characteristics of a community or private group comment?
+                       // If it's a reply to a wall post on a community/prvgroup page it's a 
                        // valid community comment. Also forum_mode makes it valid for sure. 
                        // If neither, it's not.
 
@@ -2711,6 +2717,12 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
                );
                $a = get_app();
                if(count($r)) {
+
+                       if(intval($r[0]['def_gid'])) {
+                               require_once('include/group.php');
+                               group_add_member($r[0]['uid'],'',$contact_record['id'],$r[0]['def_gid']);
+                       }
+
                        if(($r[0]['notify-flags'] & NOTIFY_INTRO) && ($r[0]['page-flags'] == PAGE_NORMAL)) {
                                $email_tpl = get_intltext_template('follow_notify_eml.tpl');
                                $email = replace_macros($email_tpl, array(