Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: OpenID

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /openid/Auth/OpenID/MySQLStore.php

Documentation is available at MySQLStore.php

  1. <?php
  2.  
  3. /**
  4.  * A MySQL 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 MySQL as its backend.
  16.  *
  17.  * @package OpenID
  18.  */
  19.     /**
  20.      * @access private
  21.      */
  22.     function setSQL()
  23.     {
  24.         $this->sql['nonce_table'=
  25.             "CREATE TABLE %s (nonce CHAR(8) UNIQUE PRIMARY KEY, ".
  26.             "expires INTEGER) TYPE=InnoDB";
  27.  
  28.         $this->sql['assoc_table'=
  29.             "CREATE TABLE %s (server_url BLOB, handle VARCHAR(255), ".
  30.             "secret BLOB, issued INTEGER, lifetime INTEGER, ".
  31.             "assoc_type VARCHAR(64), PRIMARY KEY (server_url(255), handle)) ".
  32.             "TYPE=InnoDB";
  33.  
  34.         $this->sql['settings_table'=
  35.             "CREATE TABLE %s (setting VARCHAR(128) UNIQUE PRIMARY KEY, ".
  36.             "value BLOB) TYPE=InnoDB";
  37.  
  38.         $this->sql['create_auth'=
  39.             "INSERT INTO %s VALUES ('auth_key', !)";
  40.  
  41.         $this->sql['get_auth'=
  42.             "SELECT value FROM %s WHERE setting = 'auth_key'";
  43.  
  44.         $this->sql['set_assoc'=
  45.             "REPLACE INTO %s VALUES (?, ?, !, ?, ?, ?)";
  46.  
  47.         $this->sql['get_assocs'=
  48.             "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
  49.             "WHERE server_url = ?";
  50.  
  51.         $this->sql['get_assoc'=
  52.             "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
  53.             "WHERE server_url = ? AND handle = ?";
  54.  
  55.         $this->sql['remove_assoc'=
  56.             "DELETE FROM %s WHERE server_url = ? AND handle = ?";
  57.  
  58.         $this->sql['add_nonce'=
  59.             "REPLACE INTO %s (nonce, expires) VALUES (?, ?)";
  60.  
  61.         $this->sql['get_nonce'=
  62.             "SELECT * FROM %s WHERE nonce = ?";
  63.  
  64.         $this->sql['remove_nonce'=
  65.             "DELETE FROM %s WHERE nonce = ?";
  66.     }
  67.  
  68.     /**
  69.      * @access private
  70.      */
  71.     function blobEncode($blob)
  72.     {
  73.         return "0x" bin2hex($blob);
  74.     }
  75. }
  76.  
  77. ?>

Documentation generated on Mon, 05 Mar 2007 21:12:05 +0000 by phpDocumentor 1.3.1