X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile.php;h=1076fb2cb3e09f8b95b1915b36f1b6bb5ffbcef6;hb=2eadeca74515802dccc63d7ec84af1bc7d1338d9;hp=03196447b891e31ef5b09e7af9d97b6942cf24dd;hpb=a5a89f50b8e3f9b99d8ea3a7eff378637b149c7f;p=quix0rs-gnu-social.git diff --git a/classes/Profile.php b/classes/Profile.php index 03196447b8..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();