diff options
author | Evan Prodromou <evan@status.net> | 2010-01-24 22:42:29 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-01-24 22:42:29 -0500 |
commit | 536170d7884a58d279a01e5ed5fbc267840a17ba (patch) | |
tree | 4a978b909939ba238af500d982f48735d0953943 /classes/Profile.php | |
parent | e6cf293db8c465b21899fd328152a991501a5038 (diff) | |
parent | 4daf76212a6802863d20c6af7597eddded227ae8 (diff) |
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'classes/Profile.php')
-rw-r--r-- | classes/Profile.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php index 25d908dbf..1076fb2cb 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(); |