X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2FUser.php;h=92180a9fbc4d747b8809588cfdcd4040d4172d97;hb=749367e12f9742d7fd5ee028230fefa627599125;hp=f381ec6070eeba6e1ea61d6bbb58e95a8126d859;hpb=60b66bdd6e3bbc083aec6126b8583714dc24b94d;p=quix0rs-gnu-social.git diff --git a/classes/User.php b/classes/User.php index f381ec6070..92180a9fbc 100644 --- a/classes/User.php +++ b/classes/User.php @@ -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.