We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Confirm_address.php 1.86 KB
Newer Older
Evan Prodromou's avatar
Evan Prodromou committed
1 2
<?php
/**
3
 * Table Definition for confirm_address
Evan Prodromou's avatar
Evan Prodromou committed
4
 */
5
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
Evan Prodromou's avatar
Evan Prodromou committed
6

7
class Confirm_address extends Memcached_DataObject 
Evan Prodromou's avatar
Evan Prodromou committed
8 9 10 11
{
    ###START_AUTOCODE
    /* the code below is auto generated do not remove the above tag */

12
    public $__table = 'confirm_address';                 // table name
Evan Prodromou's avatar
Evan Prodromou committed
13 14
    public $code;                            // varchar(32)  primary_key not_null
    public $user_id;                         // int(4)   not_null
15
    public $address;                         // varchar(255)   not_null
Evan Prodromou's avatar
Evan Prodromou committed
16 17
    public $address_extra;                   // varchar(255)   not_null
    public $address_type;                    // varchar(8)   not_null
18 19
    public $claimed;                         // datetime()  
    public $sent;                            // datetime()  
Evan Prodromou's avatar
Evan Prodromou committed
20 21 22
    public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP

    /* Static get */
23 24
    function staticGet($k,$v=null)
    { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
Evan Prodromou's avatar
Evan Prodromou committed
25 26 27

    /* the code above is auto generated do not remove the tag below */
    ###END_AUTOCODE
28

29 30
    function sequenceKey()
    { return array(false, false); }
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

    static function getAddress($address, $addressType)
    {
        $ca = new Confirm_address();

        $ca->address      = $address;
        $ca->address_type = $addressType;

        if ($ca->find(true)) {
            return $ca;
        }

        return null;
    }

    static function saveNew($user, $address, $addressType, $extra=null)
    {
        $ca = new Confirm_address();

        if (!empty($user)) {
            $ca->user_id = $user->id;
        }

        $ca->address       = $address;
        $ca->address_type  = $addressType;
        $ca->address_extra = $extra;
        $ca->code          = common_confirmation_code(64);

        $ca->insert();

        return $ca;
    }
Evan Prodromou's avatar
Evan Prodromou committed
63
}