]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Revoke access token UI
[quix0rs-gnu-social.git] / classes / Profile.php
index 4b2e0900647b29a20204ed63345a6665e2df69c5..1076fb2cb3e09f8b95b1915b36f1b6bb5ffbcef6 100644 (file)
@@ -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();
@@ -716,4 +742,15 @@ class Profile extends Memcached_DataObject
         }
         return $result;
     }
+
+    function hasRepeated($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($notice);
+    }
 }