]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/OpenID/User_openid_prefs.php
Merge branch '1.1.x'
[quix0rs-gnu-social.git] / plugins / OpenID / User_openid_prefs.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2012, StatusNet, Inc.
5  *
6  * User_openid_prefs.php
7  * 
8  * PHP version 5
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  * @category  OpenID
24  * @package   StatusNet
25  * @author    Evan Prodromou <evan@status.net>
26  * @copyright 2012 StatusNet, Inc.
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
28  * @link      http://status.net/
29  */
30
31 if (!defined('STATUSNET')) {
32     exit(1);
33 }
34
35 /**
36  * Store preferences for OpenID use in StatusNet
37  *
38  * @category OpenID
39  * @package  StatusNet
40  * @author   Evan Prodromou <evan@status.net>
41  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
42  * @link     http://status.net/
43  *
44  * @see      DB_DataObject
45  */
46
47 class User_openid_prefs extends Managed_DataObject
48 {
49     public $__table = 'user_openid_prefs'; // table name
50
51     public $user_id;            // The User with the prefs
52     public $hide_profile_link;  // Hide the link on the profile block?
53     public $created;            // datetime
54     public $modified;           // datetime
55
56     /**
57      * Get an instance by key
58      *
59      * This is a utility method to get a single instance with a given key value.
60      *
61      * @param string $k Key to use to lookup (usually 'user_id' for this class)
62      * @param mixed  $v Value to lookup
63      *
64      * @return TagSub object found, or null for no hits
65      *
66      */
67     function staticGet($k, $v=null)
68     {
69         return Managed_DataObject::staticGet('User_openid_prefs', $k, $v);
70     }
71
72     /**
73      * The One True Thingy that must be defined and declared.
74      */
75
76     public static function schemaDef()
77     {
78         return array(
79                      'description' => 'Per-user preferences for OpenID display',
80                      'fields' => array('user_id' => array('type' => 'integer',
81                                                           'not null' => true,
82                                                           'description' => 'User whose prefs we are saving'),
83                                        'hide_profile_link' => array('type' => 'int',
84                                                                     'not null' => true,
85                                                                     'default' => 0,
86                                                                     'description' => 'Whether to hide profile links from profile block'),
87                                        'created' => array('type' => 'datetime',
88                                                           'not null' => true,
89                                                           'description' => 'date this record was created'),
90                                        'modified' => array('type' => 'datetime',
91                                                            'not null' => true,
92                                                            'description' => 'date this record was modified'),
93                                        ),
94                      'primary key' => array('user_id'),
95                      'foreign keys' => array('user_openid_prefs_user_id_fkey' => array('user', array('user_id' => 'id')),
96                                              ),
97                      'indexes' => array(),
98                      );
99     }
100 }