Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #problem: plugin is not loading.
- ## snippets of my bootstrap: [php]
- class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
- {
- protected function _initAutoload()
- {
- $moduleLoader = new Zend_Application_Module_Autoloader(array(
- 'namespace' => '',
- 'basePath' => APPLICATION_PATH));
- return $moduleLoader;
- }
- function _initPlugins()
- {
- $front = Zend_Controller_Front::getInstance();
- $front->registerPlugin(new AccessControlPlugin());
- }
- // ...
- }
- ## my plugin (located in APPLICATION_PATH/library/Jobs): [php]
- class AccessControlPlugin extends Zend_Controller_Plugin_Abstract
- {
- public function preDispatch(Zend_Controller_Request_Abstract $request)
- {
- $req = $this->getRequest();
- $resp = $this->getResponse();
- //ignore the login pages.
- if (strtolower($req->getControllerName()) == "login") {
- return true;
- }
- // if we were ignoring the current request, the above code should have exited the function.
- // So, make sure the user is logged in. If not, redirect to the login page.
- $session = Zend_Registry::get("session");
- if (empty($session->userid))
- //user is not logged in, redirect to the login page.
- $resp->setRedirect('/login');
- }
- }
- }
Add Comment
Please, Sign In to add comment