[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/openid/Auth/OpenID/ -> MySQLStore.php (source)

   1  <?php
   2  
   3  /**
   4   * A MySQL store.
   5   *
   6   * @package OpenID
   7   */
   8  
   9  // Do not allow direct access
  10  defined( '_JEXEC' ) or die( 'Restricted access' );
  11  
  12  /**
  13   * Require the base class file.
  14   */
  15  require_once "Auth/OpenID/SQLStore.php";
  16  
  17  /**
  18   * An SQL store that uses MySQL as its backend.
  19   *
  20   * @package OpenID
  21   */
  22  class Auth_OpenID_MySQLStore extends Auth_OpenID_SQLStore {
  23      /**
  24       * @access private
  25       */
  26      function setSQL()
  27      {
  28          $this->sql['nonce_table'] =
  29              "CREATE TABLE %s (\n".
  30              "  server_url VARCHAR(2047) NOT NULL,\n".
  31              "  timestamp INTEGER NOT NULL,\n".
  32              "  salt CHAR(40) NOT NULL,\n".
  33              "  UNIQUE (server_url(255), timestamp, salt)\n".
  34              ") ENGINE=InnoDB";
  35  
  36          $this->sql['assoc_table'] =
  37              "CREATE TABLE %s (\n".
  38              "  server_url BLOB NOT NULL,\n".
  39              "  handle VARCHAR(255) NOT NULL,\n".
  40              "  secret BLOB NOT NULL,\n".
  41              "  issued INTEGER NOT NULL,\n".
  42              "  lifetime INTEGER NOT NULL,\n".
  43              "  assoc_type VARCHAR(64) NOT NULL,\n".
  44              "  PRIMARY KEY (server_url(255), handle)\n".
  45              ") ENGINE=InnoDB";
  46  
  47          $this->sql['set_assoc'] =
  48              "REPLACE INTO %s (server_url, handle, secret, issued,\n".
  49              "  lifetime, assoc_type) VALUES (?, ?, !, ?, ?, ?)";
  50  
  51          $this->sql['get_assocs'] =
  52              "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
  53              "WHERE server_url = ?";
  54  
  55          $this->sql['get_assoc'] =
  56              "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
  57              "WHERE server_url = ? AND handle = ?";
  58  
  59          $this->sql['remove_assoc'] =
  60              "DELETE FROM %s WHERE server_url = ? AND handle = ?";
  61  
  62          $this->sql['add_nonce'] =
  63              "INSERT INTO %s (server_url, timestamp, salt) VALUES (?, ?, ?)";
  64  
  65          $this->sql['clean_nonce'] =
  66              "DELETE FROM %s WHERE timestamp < ?";
  67  
  68          $this->sql['clean_assoc'] =
  69              "DELETE FROM %s WHERE issued + lifetime < ?";
  70      }
  71  
  72      /**
  73       * @access private
  74       */
  75      function blobEncode($blob)
  76      {
  77          return "0x" . bin2hex($blob);
  78      }
  79  }
  80  
  81  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1