X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Factivityimporter.php;h=51ea8ddf6bdca3d3871e03f103ca81a0f9a04cd3;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=8846831b9062205532a0cdd65a7a1ae00ff1d73a;hpb=49fa34e23413f2901674ac0f2dc65b4bc8db6ddd;p=quix0rs-gnu-social.git diff --git a/lib/activityimporter.php b/lib/activityimporter.php index 8846831b90..51ea8ddf6b 100644 --- a/lib/activityimporter.php +++ b/lib/activityimporter.php @@ -109,7 +109,7 @@ class ActivityImporter extends QueueHandler // XXX: don't do this for untrusted input! - Subscription::start($otherProfile, $profile); + Subscription::ensureStart($otherProfile, $profile); } else if (empty($activity->actor) || $activity->actor->id == $author->id) { @@ -123,7 +123,7 @@ class ActivityImporter extends QueueHandler throw new ClientException(_('Unknown profile.')); } - Subscription::start($profile, $otherProfile); + Subscription::ensureStart($profile, $otherProfile); } else { // TRANS: Client exception thrown when trying to import an event not related to the importing user. throw new Exception(_('This activity seems unrelated to our user.')); @@ -213,8 +213,8 @@ 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'); + $rendered = common_purify($sourceContent); + $content = common_strip_html($rendered); $shortened = $user->shortenLinks($content); @@ -306,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; @@ -321,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"); @@ -338,15 +339,4 @@ class ActivityImporter extends QueueHandler return array($groups, $replies); } - - - function purify($content) - { - require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php'; - - $config = array('safe' => 1, - 'deny_attribute' => 'id,style,on*'); - - return htmLawed($content, $config); - } }