Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

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 /joomla/environment/sessionstorage/database.php

Documentation is available at database.php

  1. <?php
  2. /**
  3. @version        $Id: session.php 6157 2007-01-03 00:22:09Z Jinx $
  4. @package        Joomla.Framework
  5. @subpackage    Environment
  6. @copyright    Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
  7. @license        GNU/GPL, see LICENSE.php
  8. *  Joomla! is free software. This version may have been modified pursuant
  9. *  to the GNU General Public License, and as distributed it includes or
  10. *  is derivative of works licensed under the GNU General Public License or
  11. *  other free or open source software licenses.
  12. *  See COPYRIGHT.php for copyright notices and details.
  13. */
  14.  
  15. // Check to ensure this file is within the rest of the framework
  16. defined('JPATH_BASE'or die();
  17.  
  18. /**
  19. * Database session storage handler for PHP
  20. *
  21. @author        Johan Janssens <[email protected]>
  22. @package        Joomla.Framework
  23. @subpackage    Environment
  24. @since        1.5
  25. @see http://www.php.net/manual/en/function.session-set-save-handler.php
  26. */
  27. {
  28.     /**      
  29.      * Open the SessionHandler backend.
  30.      *      
  31.      * @access public
  32.      * @param string $save_path     The path to the session object.
  33.      * @param string $session_name  The name of the session.
  34.      * @return boolean  True on success, false otherwise.
  35.      */
  36.     function open($save_path$session_name)
  37.     {
  38.         return true;
  39.     }
  40.  
  41.     /**      
  42.      * Close the SessionHandler backend.
  43.      *      
  44.      * @access public
  45.      * @return boolean  True on success, false otherwise.
  46.      */
  47.     function close()
  48.     {
  49.         return true;
  50.     }
  51.     
  52.      /**      
  53.       * Read the data for a particular session identifier from the
  54.       * SessionHandler backend.
  55.       *      
  56.       * @access public
  57.       * @param string $id  The session identifier.
  58.       * @return string  The session data.
  59.       */
  60.     function read($id)
  61.     {
  62.         $session JTable::getInstance('session');
  63.         $session->load($id);
  64.         return (string)$session->data;
  65.     }
  66.     
  67.     /**      
  68.      * Write session data to the SessionHandler backend.
  69.      *      
  70.      * @access public
  71.      * @param string $id            The session identifier.
  72.      * @param string $session_data  The session data.
  73.      * @return boolean  True on success, false otherwise.
  74.      */
  75.     function write($id$session_data)
  76.     {
  77.         $session JTable::getInstance('session');
  78.         $session->load($id);
  79.         $session->data $session_data;
  80.         $session->store();
  81.         
  82.         return true;
  83.     }
  84.     
  85.     /**      
  86.       * Destroy the data for a particular session identifier in the
  87.       * SessionHandler backend.
  88.       *  
  89.       * @access public
  90.       * @param string $id  The session identifier.
  91.       * @return boolean  True on success, false otherwise.
  92.       */
  93.     function destroy($id)     
  94.     {         
  95.         $session JTable::getInstance('session');
  96.         $session->destroy($id);
  97.         return true;
  98.     }
  99.     
  100.     /**      
  101.      * Garbage collect stale sessions from the SessionHandler backend.
  102.      *      
  103.      * @access public
  104.      * @param integer $maxlifetime  The maximum age of a session.
  105.      * @return boolean  True on success, false otherwise.
  106.      */
  107.     function gc($maxlifetime)
  108.     {
  109.         $session JTable::getInstance('session');
  110.         $session->purge($maxlifetime);
  111.         return true;
  112.     }
  113. }
  114. ?>

Documentation generated on Mon, 05 Mar 2007 20:56:10 +0000 by phpDocumentor 1.3.1