| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/filter_chain/src/lmbInterceptingFilter.interface.php'); 10 lmb_require('limb/session/src/lmbSession.class.php'); 11 12 13 /** 14 * Tells lmbSessionStartupFilter filter to use either native (file based) session storage driver (default) or database session storage driver 15 * @see lmbSessionStartupFilter 16 */ 17 @define('LIMB_SESSION_USE_DB_DRIVER', false); 18 19 /** 20 * lmbSessionStartupFilter installs session storage driver and starts session. 21 * 22 * What session storage driver will be used is depend on {@link LIMB_USE_DB_DRIVER} constant value. 23 * If LIMB_USE_DB_DRIVER has FALSE value or not defined - native file based session storage will be used. 24 * Otherwise database storage driver will be installed. 25 * @see lmbSessionNativeStorage 26 * @see lmbSessionDbStorage 27 * 28 * @version $Id: lmbSessionStartupFilter.class.php 5945 2007-06-06 08:31:43Z pachanga $ 29 * @package web_app 30 */ 31 class lmbSessionStartupFilter implements lmbInterceptingFilter 32 { 33 /** 34 * @see lmbInterceptingFilter :: run() 35 * @uses LIMB_SESSION_USE_DB_DRIVER 36 */ 37 function run($filter_chain) 38 { 39 if(constant('LIMB_SESSION_USE_DB_DRIVER')) 40 $storage = $this->_createDBSessionStorage(); 41 else 42 $storage = $this->_createNativeSessionStorage(); 43 44 $session = lmbToolkit :: instance()->getSession(); 45 $session->start($storage); 46 47 $filter_chain->next(); 48 } 49 50 protected function _createNativeSessionStorage() 51 { 52 lmb_require('limb/session/src/lmbSessionNativeStorage.class.php'); 53 return new lmbSessionNativeStorage(); 54 } 55 56 /** 57 * Creates object of {@link lmbSessionDbStorage} class. 58 * If constant LIMB_SESSION_DB_MAX_LIFE_TIME is defined passed it's value as session max life time 59 * @see lmbInterceptingFilter :: run() 60 * @uses LIMB_SESSION_DB_MAX_LIFE_TIME 61 */ 62 protected function _createDBSessionStorage() 63 { 64 if(defined('LIMB_SESSION_DB_MAX_LIFE_TIME') && constant('LIMB_SESSION_DB_MAX_LIFE_TIME')) 65 $max_life_time = constant('LIMB_SESSION_DB_MAX_LIFE_TIME'); 66 else 67 $max_life_time = null; 68 69 lmb_require('limb/session/src/lmbSessionDbStorage.class.php'); 70 $db_connection = lmbToolkit :: instance()->getDefaultDbConnection(); 71 return new lmbSessionDbStorage($db_connection, $max_life_time); 72 } 73 } 74 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Dec 1 03:56:46 2008 | Cross-referenced by PHPXref 0.7 |