]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/activityimporter.php
??? Not callable?
[quix0rs-gnu-social.git] / lib / activityimporter.php
index 27f89225c2ba93ac49d30f1bace8d6ad61572a5c..2cf950183005a3477352488f68e965cb94200626 100644 (file)
@@ -115,10 +115,11 @@ class ActivityImporter extends QueueHandler
 
             $other = $activity->objects[0];
 
-            $otherProfile = Profile::fromUri($other->id);
-
-            if (empty($otherProfile)) {
+            try {
+                $otherProfile = Profile::fromUri($other->id);
                 // TRANS: Client exception thrown when trying to subscribe to an unknown profile.
+            } catch (UnknownUriException $e) {
+                // Let's convert it to a client exception instead of server.
                 throw new ClientException(_('Unknown profile.'));
             }
 
@@ -213,7 +214,7 @@ class ActivityImporter extends QueueHandler
         // Get (safe!) HTML and text versions of the content
 
         $rendered = $this->purify($sourceContent);
-        $content = html_entity_decode(strip_tags($rendered), ENT_QUOTES, 'UTF-8');
+        $content = common_strip_html($rendered);
 
         $shortened = $user->shortenLinks($content);
 
@@ -305,7 +306,7 @@ class ActivityImporter extends QueueHandler
             // Is the recipient a remote group?
             $oprofile = Ostatus_profile::ensureProfileURI($recipient);
 
-            if ($oprofile) {
+            if ($oprofile instanceof Ostatus_profile) {
                 if (!$oprofile->isGroup()) {
                     // may be canonicalized or something
                     $replies[] = $oprofile->uri;
@@ -320,10 +321,11 @@ class ActivityImporter extends QueueHandler
 
             if ($id) {
                 $group = User_group::getKV('id', $id);
-                if ($group) {
+                if ($group instanceof User_group) {
                     // Deliver to all members of this local group if allowed.
-                    $profile = $sender->localProfile();
-                    if ($profile->isMember($group)) {
+                    $profile = Profile::getKV('id', $recipient);
+
+                    if (($profile instanceof Profile) && ($profile->isMember($group))) {
                         $groups[] = $group->id;
                     } else {
                         common_log(LOG_INFO, "Skipping reply to local group {$group->nickname} as sender {$profile->id} is not a member");