]> git.mxchange.org Git - friendica.git/blobdiff - include/diaspora.php
events: use best_link_url() and zrl() for the author_link (author link as magic-link)
[friendica.git] / include / diaspora.php
index af014c47fe1cd71a0d083892974200faf9c33210..60c7909184360baa6ca007061372d7a98726cb3f 100644 (file)
@@ -1134,7 +1134,8 @@ class Diaspora {
                        return false;
 
                // This will work for new Diaspora servers and Friendica servers from 3.5
-               $source_url = $server."/fetch/post/".$guid;
+               $source_url = $server."/fetch/post/".urlencode($guid);
+
                logger("Fetch post from ".$source_url, LOGGER_DEBUG);
 
                $envelope = fetch_url($source_url);
@@ -1150,7 +1151,7 @@ class Diaspora {
 
                // This will work for older Diaspora and Friendica servers
                if (!$x) {
-                       $source_url = $server."/p/".$guid.".xml";
+                       $source_url = $server."/p/".urlencode($guid).".xml";
                        logger("Fetch post from ".$source_url, LOGGER_DEBUG);
 
                        $x = fetch_url($source_url);
@@ -3568,11 +3569,11 @@ class Diaspora {
                // Split the signed text
                $signed_parts = explode(";", $signature['signed_text']);
 
-               if ($item["deleted"])
+               if ($item["deleted"]) {
                        $message = array("author" => $signature['signer'],
                                        "target_guid" => $signed_parts[0],
                                        "target_type" => $signed_parts[1]);
-               elseif ($item['verb'] === ACTIVITY_LIKE)
+               } elseif (in_array($item["verb"], array(ACTIVITY_LIKE, ACTIVITY_DISLIKE))) {
                        $message = array("author" => $signed_parts[4],
                                        "guid" => $signed_parts[1],
                                        "parent_guid" => $signed_parts[3],
@@ -3580,7 +3581,7 @@ class Diaspora {
                                        "positive" => $signed_parts[0],
                                        "author_signature" => $signature['signature'],
                                        "parent_author_signature" => "");
-               else {
+               else {
                        // Remove the comment guid
                        $guid = array_shift($signed_parts);
 
@@ -3615,12 +3616,13 @@ class Diaspora {
         */
        public static function send_relay($item, $owner, $contact, $public_batch = false) {
 
-               if ($item["deleted"])
+               if ($item["deleted"]) {
                        return self::send_retraction($item, $owner, $contact, $public_batch, true);
-               elseif ($item['verb'] === ACTIVITY_LIKE)
+               } elseif (in_array($item["verb"], array(ACTIVITY_LIKE, ACTIVITY_DISLIKE))) {
                        $type = "like";
-               else
+               } else {
                        $type = "comment";
+               }
 
                logger("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
 
@@ -3687,7 +3689,7 @@ class Diaspora {
 
                if ($item['id'] == $item['parent']) {
                        $target_type = "Post";
-               } elseif ($item["verb"] == ACTIVITY_LIKE) {
+               } elseif (in_array($item["verb"], array(ACTIVITY_LIKE, ACTIVITY_DISLIKE))) {
                        $target_type = "Like";
                } else {
                        $target_type = "Comment";