]> git.mxchange.org Git - friendica.git/commitdiff
Some fixes for the fetching of postings by using /p/
authorMichael Vogel <icarus@dabo.de>
Wed, 9 Mar 2016 18:30:04 +0000 (19:30 +0100)
committerMichael Vogel <icarus@dabo.de>
Wed, 9 Mar 2016 18:30:04 +0000 (19:30 +0100)
include/diaspora2.php

index 4c9d79912e341a125821b6f401173b0cfc9ab500..7aa0fc6989abb0b1008b61dae054c9c3f6ec53e4 100644 (file)
@@ -550,12 +550,15 @@ class diaspora {
                        return self::fetch_message($source_xml->root_guid, $server, ++$level);
                }
 
                        return self::fetch_message($source_xml->root_guid, $server, ++$level);
                }
 
+               $author = "";
+
                // Fetch the author - for the old and the new Diaspora version
                if ($source_xml->post->status_message->diaspora_handle)
                        $author = (string)$source_xml->post->status_message->diaspora_handle;
                // Fetch the author - for the old and the new Diaspora version
                if ($source_xml->post->status_message->diaspora_handle)
                        $author = (string)$source_xml->post->status_message->diaspora_handle;
-               elseif ($source_xml->author)
+               elseif ($source_xml->author AND ($source_xml->getName() == "status_message"))
                        $author = (string)$source_xml->author;
 
                        $author = (string)$source_xml->author;
 
+               // If this isn't a "status_message" then quit
                if (!$author)
                        return false;
 
                if (!$author)
                        return false;
 
@@ -1391,22 +1394,24 @@ EOT;
                        logger("1st try: reshared message ".$guid." will be fetched from original server: ".$server);
                        $item_id = self::store_by_guid($guid, $server);
 
                        logger("1st try: reshared message ".$guid." will be fetched from original server: ".$server);
                        $item_id = self::store_by_guid($guid, $server);
 
-                       if (!$item_id) {
-                               $server = "https://".substr($author, strpos($author, "@") + 1);
-                               logger("2nd try: reshared message ".$guid." will be fetched from sharer's server: ".$server);
-                               $item = self::store_by_guid($guid, $server);
-                       }
                        if (!$item_id) {
                                $server = "http://".substr($orig_author, strpos($orig_author, "@") + 1);
                        if (!$item_id) {
                                $server = "http://".substr($orig_author, strpos($orig_author, "@") + 1);
-                               logger("3rd try: reshared message ".$guid." will be fetched from original server: ".$server);
-                               $item = self::store_by_guid($guid, $server);
+                               logger("2nd try: reshared message ".$guid." will be fetched from original server: ".$server);
+                               $item_id = self::store_by_guid($guid, $server);
+                       }
+
+                       // Deactivated by now since there is a risk that someone could manipulate postings through this method
+/*                     if (!$item_id) {
+                               $server = "https://".substr($author, strpos($author, "@") + 1);
+                               logger("3rd try: reshared message ".$guid." will be fetched from sharer's server: ".$server);
+                               $item_id = self::store_by_guid($guid, $server);
                        }
                        if (!$item_id) {
                                $server = "http://".substr($author, strpos($author, "@") + 1);
                                logger("4th try: reshared message ".$guid." will be fetched from sharer's server: ".$server);
                        }
                        if (!$item_id) {
                                $server = "http://".substr($author, strpos($author, "@") + 1);
                                logger("4th try: reshared message ".$guid." will be fetched from sharer's server: ".$server);
-                               $item = self::store_by_guid($guid, $server);
+                               $item_id = self::store_by_guid($guid, $server);
                        }
                        }
-
+*/
                        if ($item_id) {
                                $r = q("SELECT `body`, `tag`, `app`, `created`, `object-type`, `uri`, `guid`,
                                                `author-name`, `author-link`, `author-avatar`
                        if ($item_id) {
                                $r = q("SELECT `body`, `tag`, `app`, `created`, `object-type`, `uri`, `guid`,
                                                `author-name`, `author-link`, `author-avatar`