diff options
author | Sem <sembrestels@riseup.net> | 2013-11-09 16:27:03 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2013-11-09 16:27:03 +0100 |
commit | 911d0021c374602c31e5bfd71b1cd8074f2c2293 (patch) | |
tree | 7e1d529b705e24906d69b9056d7980f0ebabc772 /mod/openid_api/vendors/php-openid/Auth/OpenID/MySQLStore.php | |
parent | 5cc7f96262509b2a5d43fa6fbb6cd083064385be (diff) | |
parent | 33c206552a0cfd1166b2d5e4fcceb26f5ff1d224 (diff) | |
download | elgg-911d0021c374602c31e5bfd71b1cd8074f2c2293.tar.gz elgg-911d0021c374602c31e5bfd71b1cd8074f2c2293.tar.bz2 |
Add 'mod/openid_api/' from commit '33c206552a0cfd1166b2d5e4fcceb26f5ff1d224'
git-subtree-dir: mod/openid_api
git-subtree-mainline: 5cc7f96262509b2a5d43fa6fbb6cd083064385be
git-subtree-split: 33c206552a0cfd1166b2d5e4fcceb26f5ff1d224
Diffstat (limited to 'mod/openid_api/vendors/php-openid/Auth/OpenID/MySQLStore.php')
-rw-r--r-- | mod/openid_api/vendors/php-openid/Auth/OpenID/MySQLStore.php | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/mod/openid_api/vendors/php-openid/Auth/OpenID/MySQLStore.php b/mod/openid_api/vendors/php-openid/Auth/OpenID/MySQLStore.php new file mode 100644 index 000000000..810f059f1 --- /dev/null +++ b/mod/openid_api/vendors/php-openid/Auth/OpenID/MySQLStore.php @@ -0,0 +1,77 @@ +<?php + +/** + * A MySQL store. + * + * @package OpenID + */ + +/** + * Require the base class file. + */ +require_once "Auth/OpenID/SQLStore.php"; + +/** + * An SQL store that uses MySQL as its backend. + * + * @package OpenID + */ +class Auth_OpenID_MySQLStore extends Auth_OpenID_SQLStore { + /** + * @access private + */ + function setSQL() + { + $this->sql['nonce_table'] = + "CREATE TABLE %s (\n". + " server_url VARCHAR(2047) NOT NULL,\n". + " timestamp INTEGER NOT NULL,\n". + " salt CHAR(40) NOT NULL,\n". + " UNIQUE (server_url(255), timestamp, salt)\n". + ") ENGINE=InnoDB"; + + $this->sql['assoc_table'] = + "CREATE TABLE %s (\n". + " server_url BLOB NOT NULL,\n". + " handle VARCHAR(255) NOT NULL,\n". + " secret BLOB NOT NULL,\n". + " issued INTEGER NOT NULL,\n". + " lifetime INTEGER NOT NULL,\n". + " assoc_type VARCHAR(64) NOT NULL,\n". + " PRIMARY KEY (server_url(255), handle)\n". + ") ENGINE=InnoDB"; + + $this->sql['set_assoc'] = + "REPLACE INTO %s (server_url, handle, secret, issued,\n". + " lifetime, assoc_type) VALUES (?, ?, !, ?, ?, ?)"; + + $this->sql['get_assocs'] = + "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". + "WHERE server_url = ?"; + + $this->sql['get_assoc'] = + "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". + "WHERE server_url = ? AND handle = ?"; + + $this->sql['remove_assoc'] = + "DELETE FROM %s WHERE server_url = ? AND handle = ?"; + + $this->sql['add_nonce'] = + "INSERT INTO %s (server_url, timestamp, salt) VALUES (?, ?, ?)"; + + $this->sql['clean_nonce'] = + "DELETE FROM %s WHERE timestamp < ?"; + + $this->sql['clean_assoc'] = + "DELETE FROM %s WHERE issued + lifetime < ?"; + } + + /** + * @access private + */ + function blobEncode($blob) + { + return "0x" . bin2hex($blob); + } +} + |