Subversion Repositories Applications.annuaire

Rev

Rev 42 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42 aurelien 1
<?php
2
 
3
/**
4
 * An SQLite store.
5
 *
6
 * @package OpenID
7
 */
8
 
9
/**
10
 * Require the base class file.
11
 */
12
require_once "Auth/OpenID/SQLStore.php";
13
 
14
/**
15
 * An SQL store that uses SQLite as its backend.
16
 *
17
 * @package OpenID
18
 */
19
class Auth_OpenID_SQLiteStore extends Auth_OpenID_SQLStore {
20
    function setSQL()
21
    {
22
        $this->sql['nonce_table'] =
23
            "CREATE TABLE %s (nonce CHAR(8) UNIQUE PRIMARY KEY, ".
24
            "expires INTEGER)";
25
 
26
        $this->sql['assoc_table'] =
27
            "CREATE TABLE %s (server_url VARCHAR(2047), handle VARCHAR(255), ".
28
            "secret BLOB(128), issued INTEGER, lifetime INTEGER, ".
29
            "assoc_type VARCHAR(64), PRIMARY KEY (server_url, handle))";
30
 
31
        $this->sql['settings_table'] =
32
            "CREATE TABLE %s (setting VARCHAR(128) UNIQUE PRIMARY KEY, ".
33
            "value BLOB(20))";
34
 
35
        $this->sql['create_auth'] =
36
            "INSERT INTO %s VALUES ('auth_key', ?)";
37
 
38
        $this->sql['get_auth'] =
39
            "SELECT value FROM %s WHERE setting = 'auth_key'";
40
 
41
        $this->sql['set_assoc'] =
42
            "INSERT OR REPLACE INTO %s VALUES (?, ?, ?, ?, ?, ?)";
43
 
44
        $this->sql['get_assocs'] =
45
            "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
46
            "WHERE server_url = ?";
47
 
48
        $this->sql['get_assoc'] =
49
            "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
50
            "WHERE server_url = ? AND handle = ?";
51
 
52
        $this->sql['remove_assoc'] =
53
            "DELETE FROM %s WHERE server_url = ? AND handle = ?";
54
 
55
        $this->sql['add_nonce'] =
56
            "INSERT OR REPLACE INTO %s (nonce, expires) VALUES (?, ?)";
57
 
58
        $this->sql['get_nonce'] =
59
            "SELECT * FROM %s WHERE nonce = ?";
60
 
61
        $this->sql['remove_nonce'] =
62
            "DELETE FROM %s WHERE nonce = ?";
63
    }
64
}
65
 
66
?>