]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - classes/Confirm_address.php
Merge branch 'master' into 1.0.x
[quix0rs-gnu-social.git] / classes / Confirm_address.php
1 <?php
2 /**
3  * Table Definition for confirm_address
4  */
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
6
7 class Confirm_address extends Memcached_DataObject 
8 {
9     ###START_AUTOCODE
10     /* the code below is auto generated do not remove the above tag */
11
12     public $__table = 'confirm_address';                 // table name
13     public $code;                            // varchar(32)  primary_key not_null
14     public $user_id;                         // int(4)   not_null
15     public $address;                         // varchar(255)   not_null
16     public $address_extra;                   // varchar(255)   not_null
17     public $address_type;                    // varchar(8)   not_null
18     public $claimed;                         // datetime()  
19     public $sent;                            // datetime()  
20     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
21
22     /* Static get */
23     function staticGet($k,$v=null)
24     { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
25
26     /* the code above is auto generated do not remove the tag below */
27     ###END_AUTOCODE
28
29     function sequenceKey()
30     { return array(false, false); }
31
32     static function getAddress($address, $addressType)
33     {
34         $ca = new Confirm_address();
35
36         $ca->address      = $address;
37         $ca->address_type = $addressType;
38
39         if ($ca->find(true)) {
40             return $ca;
41         }
42
43         return null;
44     }
45
46     static function saveNew($user, $address, $addressType, $extra=null)
47     {
48         $ca = new Confirm_address();
49
50         if (!empty($user)) {
51             $ca->user_id = $user->id;
52         }
53
54         $ca->address       = $address;
55         $ca->address_type  = $addressType;
56         $ca->address_extra = $extra;
57         $ca->code          = common_confirmation_code(64);
58
59         $ca->insert();
60
61         return $ca;
62     }
63 }