增加了在preDispatch Hook中增加了flash session bug的处理

This commit is contained in:
Li Jianxuan 2011-11-04 07:30:44 +00:00
parent 6a8d4b34b4
commit 9d86bfc6f2
1 changed files with 103 additions and 96 deletions

View File

@ -20,6 +20,7 @@
$this->acl->add(new Zend_Acl_Resource('data')); $this->acl->add(new Zend_Acl_Resource('data'));
$this->acl->add(new Zend_Acl_Resource('water')); $this->acl->add(new Zend_Acl_Resource('water'));
$this->acl->add(new Zend_Acl_Resource('admin')); $this->acl->add(new Zend_Acl_Resource('admin'));
$this->acl->add(new Zend_Acl_Resource('upload'));
// allow access to everything for all users by default // allow access to everything for all users by default
// except for the account management and administration areas // except for the account management and administration areas
$this->acl->allow(); $this->acl->allow();
@ -37,7 +38,6 @@
$this->acl->allow('member', 'account'); $this->acl->allow('member', 'account');
// allows administrators access to the admin area // allows administrators access to the admin area
$this->acl->allow('administrator', 'admin'); $this->acl->allow('administrator', 'admin');
} }
/** /**
* preDispatch * preDispatch
@ -50,6 +50,13 @@
*/ */
public function preDispatch(Zend_Controller_Request_Abstract $request) public function preDispatch(Zend_Controller_Request_Abstract $request)
{ {
$phpSessId = $request->getParam('PHPSESSID');
if (!empty($phpSessId) && session_id() != $phpSessId) {
session_destroy();
session_id($phpSessId);
session_start();
}
// check if a user is logged in and has a valid role, // check if a user is logged in and has a valid role,
// otherwise, assign them the default role (guest) // otherwise, assign them the default role (guest)
$mb = new member(); $mb = new member();