]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/OpenID/User_openid.php
Localisation updates from http://translatewiki.net.
[quix0rs-gnu-social.git] / plugins / OpenID / User_openid.php
1 <?php
2 /**
3  * Table Definition for user_openid
4  */
5
6 if (!defined('STATUSNET')) {
7     exit(1);
8 }
9
10 class User_openid extends Memcached_DataObject
11 {
12     ###START_AUTOCODE
13     /* the code below is auto generated do not remove the above tag */
14
15     public $__table = 'user_openid';                     // table name
16     public $canonical;                       // varchar(255)  primary_key not_null
17     public $display;                         // varchar(255)  unique_key not_null
18     public $user_id;                         // int(4)   not_null
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('User_openid',$k,$v); }
25
26     /* the code above is auto generated do not remove the tag below */
27     ###END_AUTOCODE
28
29     function table()
30     {
31         $db = $this->getDatabaseConnection();
32         $dbtype = $db->phptype; // Database type is stored here. Crazy but true.
33
34         return array('canonical' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
35                      'display'   => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
36                      'user_id'   => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
37                      'created'   => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
38                      'modified'  => ($dbtype == 'mysql' || $dbtype == 'mysqli') ?
39                      DB_DATAOBJECT_MYSQLTIMESTAMP + DB_DATAOBJECT_NOTNULL :
40                      DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME
41                      );
42     }
43
44     /**
45      * List primary and unique keys in this table.
46      * Unique keys used for lookup *MUST* be listed to ensure proper caching.
47      */
48     function keys()
49     {
50         return array_keys($this->keyTypes());
51     }
52
53     function keyTypes()
54     {
55         return array('canonical' => 'K', 'display' => 'U', 'user_id' => 'U');
56     }
57
58     /**
59      * No sequence keys in this table.
60      */
61     function sequenceKey()
62     {
63         return array(false, false, false);
64     }
65
66     static function hasOpenID($user_id)
67     {
68         $oid = new User_openid();
69
70         $oid->user_id = $user_id;
71
72         $cnt = $oid->find();
73
74         return ($cnt > 0);
75     }
76 }