]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Merge branch 'friendika-master'
[friendica.git] / include / items.php
index 45d8b62c0ba267544671edd7ca616d0af97ed7af..15fd262f4c0d35958f545f476d28c5698c893844 100644 (file)
@@ -144,7 +144,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
                `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, 
                `contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`
                FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
-               WHERE `item`.`uid` = %d AND `item`.`visible` = 1 
+               WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`parent` != 0 
                AND `item`.`wall` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
                AND ( `item`.`edited` > '%s' OR `item`.`changed` > '%s' )
                $sql_extra
@@ -688,11 +688,12 @@ function item_store($arr,$force_parent = false) {
                                $arr['parent-uri'] = $r[0]['parent-uri'];
                        }
 
-                       $parent_id = $r[0]['id'];
-                       $allow_cid = $r[0]['allow_cid'];
-                       $allow_gid = $r[0]['allow_gid'];
-                       $deny_cid  = $r[0]['deny_cid'];
-                       $deny_gid  = $r[0]['deny_gid'];
+                       $parent_id      = $r[0]['id'];
+                       $parent_deleted = $r[0]['deleted'];
+                       $allow_cid      = $r[0]['allow_cid'];
+                       $allow_gid      = $r[0]['allow_gid'];
+                       $deny_cid       = $r[0]['deny_cid'];
+                       $deny_gid       = $r[0]['deny_gid'];
                }
                else {
 
@@ -739,10 +740,10 @@ function item_store($arr,$force_parent = false) {
                return 0;
        }
 
-       if($arr['parent-uri'] === $arr['uri'])
+       if((! $parent_id) || ($arr['parent-uri'] === $arr['uri']))      
                $parent_id = $current_post;
-       if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid))
+
+       if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid))
                $private = 1;
        else
                $private = $arr['private']; 
@@ -750,13 +751,14 @@ function item_store($arr,$force_parent = false) {
        // Set parent id - and also make sure to inherit the parent's ACL's.
 
        $r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s',
-               `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d WHERE `id` = %d LIMIT 1",
+               `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d, `deleted` = %d WHERE `id` = %d LIMIT 1",
                intval($parent_id),
                dbesc($allow_cid),
                dbesc($allow_gid),
                dbesc($deny_cid),
                dbesc($deny_gid),
                intval($private),
+               intval($parent_deleted),
                intval($current_post)
        );