X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile.php;h=49addfe47fe887d72d84f73c57fde62c25ed1098;hb=5c768d7ef71ce08e505056c6f3fbdd092cd3649d;hp=f628965a7482a1be41b054e76fdf3def1e16651a;hpb=6c4985476e9c29fa7965befd488ead37112e27d7;p=quix0rs-gnu-social.git diff --git a/classes/Profile.php b/classes/Profile.php index f628965a74..49addfe47f 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -138,6 +138,18 @@ class Profile extends Managed_DataObject return true; } + // Returns false if the user has no password (which will always + // be the case for remote users). This can be the case for OpenID + // logins or other mechanisms which don't store a password hash. + public function hasPassword() + { + try { + return $this->getUser()->hasPassword(); + } catch (NoSuchUserException $e) { + return false; + } + } + public function getObjectType() { // FIXME: More types... like peopletags and whatever @@ -865,6 +877,11 @@ class Profile extends Managed_DataObject function delete($useWhere=false) { + // just in case it hadn't been done before... (usually set before adding deluser to queue handling!) + if (!$this->hasRole(Profile_role::DELETED)) { + $this->grantRole(Profile_role::DELETED); + } + $this->_deleteNotices(); $this->_deleteSubscriptions(); $this->_deleteTags(); @@ -1395,6 +1412,11 @@ class Profile extends Managed_DataObject return $this->fullname; } + public function getHomepage() + { + return $this->homepage; + } + public function getDescription() { return $this->bio; @@ -1571,8 +1593,20 @@ class Profile extends Managed_DataObject return $this; } - public function sameAs(Profile $other) + /** + * Test whether the given profile is the same as the current class, + * for testing identities. + * + * @param Profile $other The other profile, usually from Action's $this->scoped + * + * @return boolean + */ + public function sameAs(Profile $other=null) { + if (is_null($other)) { + // In case $this->scoped is null or something, i.e. not a current/legitimate profile. + return false; + } return $this->getID() === $other->getID(); } @@ -1623,4 +1657,9 @@ class Profile extends Managed_DataObject public function setPref($namespace, $topic, $data) { return Profile_prefs::setData($this, $namespace, $topic, $data); } + + public function getConnectedApps($offset=0, $limit=null) + { + return $this->getUser()->getConnectedApps($offset, $limit); + } }