]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User.php
Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / classes / User.php
index f381ec6070eeba6e1ea61d6bbb58e95a8126d859..92180a9fbc4d747b8809588cfdcd4040d4172d97 100644 (file)
@@ -84,7 +84,8 @@ class User extends Memcached_DataObject
 
     function isSubscribed($other)
     {
-        return Subscription::exists($this->getProfile(), $other);
+        $profile = $this->getProfile();
+        return $profile->isSubscribed($other);
     }
 
     // 'update' won't write key columns, so we have to do it ourselves.
@@ -115,6 +116,16 @@ class User extends Memcached_DataObject
         return $result;
     }
 
+    /**
+     * Check whether the given nickname is potentially usable, or if it's
+     * excluded by any blacklists on this system.
+     *
+     * WARNING: INPUT IS NOT VALIDATED OR NORMALIZED. NON-NORMALIZED INPUT
+     * OR INVALID INPUT MAY LEAD TO FALSE RESULTS.
+     *
+     * @param string $nickname
+     * @return boolean true if clear, false if blacklisted
+     */
     static function allowed_nickname($nickname)
     {
         // XXX: should already be validated for size, content, etc.
@@ -418,8 +429,8 @@ class User extends Memcached_DataObject
 
     function mutuallySubscribed($other)
     {
-        return $this->isSubscribed($other) &&
-          $other->isSubscribed($this);
+        $profile = $this->getProfile();
+        return $profile->mutuallySubscribed($other);
     }
 
     function mutuallySubscribedUsers()
@@ -889,13 +900,23 @@ class User extends Memcached_DataObject
     static function singleUser()
     {
         if (common_config('singleuser', 'enabled')) {
+
+            $user = null;
+
             $nickname = common_config('singleuser', 'nickname');
-            if ($nickname) {
+
+            if (!empty($nickname)) {
                 $user = User::staticGet('nickname', $nickname);
-            } else {
+            }
+
+            // if there was no nickname or no user by that nickname,
+            // try the site owner.
+
+            if (empty($user)) {
                 $user = User::siteOwner();
             }
-            if ($user) {
+
+            if (!empty($user)) {
                 return $user;
             } else {
                 // TRANS: Server exception.