Zend Framework Central Authentication
class FilterPlugin extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$params = $request->getParams();
$controller = $request->getControllerName();
$action = $request->getActionName();
$filter = $GLOBALS['filters'][$controller][$action];
$validator = $GLOBALS['validators'][$controller][$action];
$inputdata = new Zend_Filter_Input($filter, $validator, $params);
if (!$inputdata ->isValid()) {
$request->setModuleName('default')
->setControllerName('error')
->setActionName('illegalparam')
->setDispatched(false);
return;
}
}
- Zend Framework follow MVC Design with Dispatcher.
- Auth / ACL Implement
- Validate & Filter the URL with using dispatcher
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$params = $request->getParams();
$controller = $request->getControllerName();
$action = $request->getActionName();
$filter = $GLOBALS['filters'][$controller][$action];
$validator = $GLOBALS['validators'][$controller][$action];
$inputdata = new Zend_Filter_Input($filter, $validator, $params);
if (!$inputdata ->isValid()) {
$request->setModuleName('default')
->setControllerName('error')
->setActionName('illegalparam')
->setDispatched(false);
return;
}
}
No comments:
Post a Comment
Please add comments only related to zend framework certification.