]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - classes/Oauth_application_user.php
Associate request tokens with OAuth apps and app users
[quix0rs-gnu-social.git] / classes / Oauth_application_user.php
1 <?php
2 /**
3  * Table Definition for oauth_application_user
4  */
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
6
7 class Oauth_application_user extends Memcached_DataObject
8 {
9     ###START_AUTOCODE
10     /* the code below is auto generated do not remove the above tag */
11
12     public $__table = 'oauth_application_user';          // table name
13     public $profile_id;                      // int(4)  primary_key not_null
14     public $application_id;                  // int(4)  primary_key not_null
15     public $access_type;                     // tinyint(1)
16     public $token;                           // varchar(255)
17     public $secret;                          // varchar(255)
18     public $verifier;                        // varchar(255)
19     public $created;                         // datetime   not_null
20     public $modified;                        // timestamp   not_null default_CURRENT_TIMESTAMP
21
22     /* Static get */
23     function staticGet($k,$v=NULL) {
24         return Memcached_DataObject::staticGet('Oauth_application_user',$k,$v);
25     }
26     /* the code above is auto generated do not remove the tag below */
27     ###END_AUTOCODE
28
29     static function getByKeys($user, $app)
30     {
31         if (empty($user) || empty($app)) {
32             return null;
33         }
34
35         $oau = new Oauth_application_user();
36
37         $oau->profile_id     = $user->id;
38         $oau->application_id = $app->id;
39         $oau->limit(1);
40
41         $result = $oau->find(true);
42
43         return empty($result) ? null : $oau;
44     }
45
46 }