X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile.php;h=1076fb2cb3e09f8b95b1915b36f1b6bb5ffbcef6;hb=2eadeca74515802dccc63d7ec84af1bc7d1338d9;hp=4c14f62a06c71611a2b49b879f17ced46b317b52;hpb=c49ece9fb40c68e6d6a47343208dc3da5726cf44;p=quix0rs-gnu-social.git diff --git a/classes/Profile.php b/classes/Profile.php index 4c14f62a06..1076fb2cb3 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -352,6 +352,31 @@ class Profile extends Memcached_DataObject return $profile; } + function getApplications($offset = 0, $limit = null) + { + $qry = + 'SELECT a.* ' . + 'FROM oauth_application_user u, oauth_application a ' . + 'WHERE u.profile_id = %d ' . + 'AND a.id = u.application_id ' . + 'AND u.access_type > 0 ' . + 'ORDER BY u.created DESC '; + + if ($offset > 0) { + if (common_config('db','type') == 'pgsql') { + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; + } else { + $qry .= ' LIMIT ' . $offset . ', ' . $limit; + } + } + + $application = new Oauth_application(); + + $cnt = $application->query(sprintf($qry, $this->id)); + + return $application; + } + function subscriptionCount() { $c = common_memcache(); @@ -504,6 +529,7 @@ class Profile extends Memcached_DataObject 'Reply', 'Group_member', ); + Event::handle('ProfileDeleteRelated', array($this, &$related)); foreach ($related as $cls) { $inst = new $cls(); @@ -717,11 +743,14 @@ class Profile extends Memcached_DataObject return $result; } - function hasForwarded($notice_id) + function hasRepeated($notice_id) { - $forward = Forward::pkeyGet(array('profile_id' => $this->id, - 'notice_id' => $notice_id)); + // XXX: not really a pkey, but should work + + $notice = Memcached_DataObject::pkeyGet('Notice', + array('profile_id' => $this->id, + 'repeat_of' => $notice_id)); - return (!empty($forward)); + return !empty($notice); } }