summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-18 17:08:19 -0700
committerBrion Vibber <brion@pobox.com>2010-03-18 17:08:19 -0700
commit1301877dfe89c57c182246c0d7ba0ff6335fd17b (patch)
treef2945952dbecefae0dc486a25f2529f589cf38df /classes
parent26ba430ae8163089c4a1d0aee5d5f21bb0dbf96f (diff)
OStatus discover fixes:
* Subscription::start was sometimes passing users instead of profiles to hooks, which broke OStatus subscription notifications; now normalizing to profiles for processing. * H-card parsing would trigger a lot of PHP warnings and notices in hKit. Now suppressing warnings and notices for the duration of the call to keep them out of output when display_errors is on. * H-card parsing would trigger a PHP fatal error if the source page was not well-formed XML and Tidy was not present on the system. Switched normalization to use the PHP DOM module which is always present, as we have no need for Tidy's extra features here. * Trying to fetch avatars from Google profiles failed and triggered a PHP warning due to the relative URL not being resolved during h-card parsing. Now passing profile page URL into hKit by sneaking a <base> tag in while we normalize the HTML source. * Profile pages without a "Link" header could trigger PHP notices due to a bad NULL -> array(NULL) conversion in LinkHeader::getLink(). Now checking that there was a return value before converting single return value into array.
Diffstat (limited to 'classes')
-rw-r--r--classes/Subscription.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/classes/Subscription.php b/classes/Subscription.php
index 97c44a2e4..60c12cccc 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -62,6 +62,14 @@ class Subscription extends Memcached_DataObject
static function start($subscriber, $other)
{
+ // @fixme should we enforce this as profiles in callers instead?
+ if ($subscriber instanceof User) {
+ $subscriber = $subscriber->getProfile();
+ }
+ if ($other instanceof User) {
+ $other = $other->getProfile();
+ }
+
if (!$subscriber->hasRight(Right::SUBSCRIBE)) {
throw new Exception(_('You have been banned from subscribing.'));
}