]> git.mxchange.org Git - friendica.git/commitdiff
Checks done on topmost parent in local_delivery, closes #10
authorDomovoy <domovoy@errlock.org>
Sat, 18 Aug 2012 15:17:33 +0000 (17:17 +0200)
committerDomovoy <domovoy@errlock.org>
Sat, 18 Aug 2012 15:17:33 +0000 (17:17 +0200)
include/items.php
object/Item.php

index 8de6f7cc8eb2b4faa465e3a0715512f9aaee2f11..a2b0fe053c4c1e015edb9df936c93701bd1f589c 100755 (executable)
@@ -2617,22 +2617,32 @@ function local_delivery($importer,$data) {
                        // Specifically, the recipient? 
 
                        $is_a_remote_comment = false;
-
-                       // POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used?
-                       $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`, 
-                               `contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item` 
-                               LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` 
-                               WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
-                               AND `item`.`uid` = %d 
-                               $sql_extra
+                       $top_uri = $parent_uri;
+                       
+                       $r = q("select `item`.`parent-uri` from `item`
+                               WHERE `item`.`uri` = '%s'
                                LIMIT 1",
-                               dbesc($parent_uri),
-                               dbesc($parent_uri),
-                               dbesc($parent_uri),
-                               intval($importer['importer_uid'])
+                               dbesc($parent_uri)
                        );
-                       if($r && count($r))
-                               $is_a_remote_comment = true;                    
+                       if($r && count($r)) {
+                               $top_uri = $r[0]['parent-uri'];
+
+                               // POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used?
+                               $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`, 
+                                       `contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item` 
+                                       LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` 
+                                       WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
+                                       AND `item`.`uid` = %d 
+                                       $sql_extra
+                                       LIMIT 1",
+                                       dbesc($top_uri),
+                                       dbesc($top_uri),
+                                       dbesc($top_uri),
+                                       intval($importer['importer_uid'])
+                               );
+                               if($r && count($r))
+                                       $is_a_remote_comment = true;
+                       }
 
                        // 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 
@@ -2936,7 +2946,7 @@ function local_delivery($importer,$data) {
                                if(!x($datarray['type']) || $datarray['type'] != 'activity') {
 
                                        $myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 AND `deleted` = 0",
-                                               dbesc($parent_uri),
+                                               dbesc($top_uri),
                                                intval($importer['importer_uid'])
                                        );
 
index 01e117ff78d0e765aa100c4ae60cc7d7aa37fa42..bfd2db711abcb02249fb62cfbf7a9f46492597d2 100644 (file)
@@ -396,7 +396,7 @@ class Item extends BaseObject {
         *              _ false on failure
         */
        public function get_data_value($name) {
-               if(!x($this->data, $name)) {
+               if(!isset($this->data[$name])) {
                        logger('[ERROR] Item::get_data_value : Item has no value name "'. $name .'".', LOGGER_DEBUG);
                        return false;
                }
@@ -477,8 +477,6 @@ class Item extends BaseObject {
                        $ww = 'ww';
 
                if($conv->is_writable() && $this->is_writable()) {
-                       logger('[DEBUG] Item::get_comment_box : Comment box is visible.', LOGGER_DEBUG);
-                       
                        $a = $this->get_app();
                        $qc = $qcomment =  null;
 
@@ -516,9 +514,6 @@ class Item extends BaseObject {
                                '$ww' => (($conv->get_mode() === 'network') ? $ww : '')
                        ));
                }
-               else {
-                       logger('[DEBUG] Item::get_comment_box : Comment box is NOT visible. Conv: '. ($conv->is_writable() ? 'yes' : 'no') .' Item: '. ($this->is_writable() ? 'yes' : 'no'), LOGGER_DEBUG);
-               }
 
                return $comment_box;
        }