本文整理汇总了PHP中Zend_Controller_Request_Abstract::getControllerName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getControllerName方法的具体用法?PHP Zend_Controller_Request_Abstract::getControllerName怎么用?PHP Zend_Controller_Request_Abstract::getControllerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getControllerName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$this->_initAcl();
if ($this->_auth->hasIdentity()) {
$ident = $this->_auth->getIdentity();
$date = new Zend_Date();
$ident->last_login = $date->get(DATABASE_DATE_FORMAT);
$ident->save();
}
if ($request->getControllerName() != 'admin' && $request->getModuleName() != 'admin') {
return;
}
// if this is not admin skip the rest
if (!$this->_auth->hasIdentity() && !($request->getControllerName() == 'auth' && $request->getActionName() == 'login' && $request->getModuleName() == 'admin')) {
$redirect = new Zend_Controller_Action_Helper_Redirector();
$redirect->gotoSimple('login', 'auth', 'admin');
}
if ($request->getModuleName() == 'user' && $request->getControllerName() == 'admin' && $request->getActionName() == 'profile') {
return;
}
// the profile is a free resource
$resource = $request->getModuleName() . '_' . $request->getControllerName();
$hasResource = $this->_acl->has($resource);
if ($hasResource && !$this->_acl->isAllowed('fansubcms_user_custom_role_logged_in_user', $resource, $request->getActionName())) {
throw new FansubCMS_Exception_Denied('The user is not allowd to do this');
}
}
示例2: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if (!Zend_Auth::getInstance()->hasIdentity() && ($request->getControllerName() != 'index' && $request->getControllerName() != 'error')) {
$request->setControllerName('index');
$request->setActionName('index');
}
}
示例3: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
$publicPages = array();
$publicPages['controllers'] = array('login');
$publicPages['actions'] = array();
$controllerName = $request->getControllerName();
if ($auth->hasIdentity() || in_array($controllerName, $publicPages['controllers'])) {
return true;
}
throw new WebVista_App_AuthException('You must be authenticated to access the system.');
$roleId = $auth->getIdentity()->roleId;
$acl = WebVista_Acl::getInstance();
if (!$acl->hasRole($roleId)) {
$error = "Sorry, the requested user role '" . $roleId . "' does not exist";
}
if (!$acl->has($request->getModuleName() . '_' . $request->getControllerName())) {
$error = "Sorry, the requested controller '" . $request->getControllerName() . "' does not exist as an ACL resource";
}
if (!$acl->isAllowed($roleId, $request->getModuleName() . '_' . $request->getControllerName(), $request->getActionName())) {
$error = "Sorry, the page you requested does not exist or you do not have access";
}
if (isset($error)) {
throw new WebVista_App_AuthException('You must be authenticated to access the system.');
}
}
示例4: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if ('company' == $request->getControllerName()) {
$tsn = $request->tsn ? $request->tsn : $_COOKIE['tsn'];
if ($tsn) {
$token = Token::create($tsn);
$token->update_sync_time();
} else {
$token = Token::create_abstract('123');
}
if ($token->is_logined() == true) {
if ($token->is_expire()) {
$token->destroy();
include_once LIB_PATH . '/view_helper/BuildUrl.php';
$url_builder = new Zend_View_Helper_BuildUrl();
$referer = SearchFilter::slashes($url_builder->buildUrl($request->getActionName(), $request->getControllerName(), $request->getModuleName()));
$login_url = $url_builder->buildUrl('login', 'auth', 'index', array('redirect' => $referer));
$redirector = new Zend_Controller_Action_Helper_Redirector();
$redirector->gotoUrl($login_url);
return;
}
$token->register();
} else {
if ('auth' != $request->getActionName()) {
$token->destroy();
$request->setModuleName('index');
$request->setControllerName('auth');
$request->setActionName('login');
}
}
}
}
示例5: _checkSkipAcl
protected function _checkSkipAcl(Zend_Controller_Request_Abstract $request, $type)
{
// verificação de requisicao - Caso ajax, verifica se a action é delete, senao, SKIP nele.
if ($request->isXmlHttpRequest() && !in_array($request->getActionName(), $this->_arrAjaxNotSkip)) {
return TRUE;
}
$configs = Zend_Registry::get('configs');
$skip = $configs['security']['skip'][$type];
$result = FALSE;
$result = in_array($request->getActionName(), $skip);
foreach ($skip as $routers) {
$route = explode('/', $routers);
switch (count($route)) {
case 1:
// action
$result = in_array($request->getActionName(), $skip);
break;
case 2:
// controller/action
$result = in_array($request->getControllerName() . '/' . $request->getActionName(), $skip);
break;
case 3:
// module/controller/action
$result = in_array($request->getModuleName() . '/' . $request->getControllerName() . '/' . $request->getActionName(), $skip);
break;
}
if ($result) {
return TRUE;
}
}
return $result;
}
示例6: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$storage = new Zend_Auth_Storage_Session();
$data = $storage->read();
$role = $data['emprole'];
if ($role == 1) {
$role = 'admin';
}
$request->getModuleName();
$request->getControllerName();
$request->getActionName();
$module = $request->getModuleName();
$resource = $request->getControllerName();
$privilege = $request->getActionName();
$this->id_param = $request->getParam('id');
$allowed = false;
$acl = $this->_getAcl();
$moduleResource = "{$module}:{$resource}";
if ($resource == 'profile') {
$role = 'viewer';
}
if ($resource == 'services') {
$role = 'services';
}
if ($role != '') {
if ($acl->has($moduleResource)) {
$allowed = $acl->isAllowed($role, $moduleResource, $privilege);
}
if (!$allowed) {
$request->setControllerName('error');
$request->setActionName('error');
}
}
}
示例7: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$controller = "";
$action = "";
$module = "";
/* if($request->getControllerName() == "index" ){
$controller = $request->getControllerName();
$action = $request->getActionName();
$module = $request->getModuleName();
}
else if ( !$this->_auth->hasIdentity() ) {
}*/
if (!$this->_isAuthorized($request->getControllerName(), $request->getActionName())) {
if (!$this->_auth->hasIdentity()) {
if (!in_array($request->getControllerName(), $this->_moRedirect) && !Application_Model_Redirect::hasRequestUri()) {
Application_Model_Redirect::saveRequestUri("/" . $request->getControllerName() . "/" . $request->getActionName());
}
$controller = $this->_notLoggedRoute['controller'];
$action = $this->_notLoggedRoute['action'];
$module = $this->_notLoggedRoute['module'];
} else {
$controller = $this->_forbiddenRoute['controller'];
$action = $this->_forbiddenRoute['action'];
$module = $this->_forbiddenRoute['module'];
}
} else {
$controller = $request->getControllerName();
$action = $request->getActionName();
$module = $request->getModuleName();
}
$request->setControllerName($controller);
$request->setActionName($action);
$request->setModuleName($module);
}
示例8: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$loginController = 'authentication';
$loginAction = 'login';
$auth = Zend_Auth::getInstance();
// If user is not logged in and is not requesting login page
// - redirect to login page.
if (!$auth->hasIdentity() && $request->getControllerName() != $loginController && $request->getActionName() != $loginAction) {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
$redirector->gotoSimpleAndExit($loginAction, $loginController);
}
// User is logged in or on login page.
if ($auth->hasIdentity()) {
// Is logged in
// Let's check the credential
$acl = new Tynex_Models_TynexAcl();
$identity = $auth->getIdentity();
// role is a column in the user table (database)
$isAllowed = $acl->isAllowed($identity->role, $request->getControllerName(), $request->getActionName());
if (!$isAllowed) {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
$redirector->gotoUrlAndExit('/');
}
}
}
示例9: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if (!in_array($request->getModuleName(), array('qg', 'painel'))) {
return;
}
$controller = "";
$action = "";
$module = "";
if (!$this->_auth->hasIdentity()) {
$controller = $this->_notLoggedRoute['controller'];
$action = $this->_notLoggedRoute['action'];
$module = $request->getModuleName();
} else {
if (!$this->_isAuthorized($request->getModuleName(), $request->getControllerName(), $request->getActionName())) {
$controller = $this->_forbiddenRoute['controller'];
$action = $this->_forbiddenRoute['action'];
$module = $request->getModuleName();
} else {
$controller = $request->getControllerName();
$action = $request->getActionName();
$module = $request->getModuleName();
}
}
$request->setControllerName($controller);
$request->setActionName($action);
$request->setModuleName($module);
}
示例10: hasAccessUrl
function hasAccessUrl(Zend_Controller_Request_Abstract $request)
{
$acl = $this->getAcl();
$url1 = $request->getModuleName() . '::*';
$url2 = $request->getModuleName() . '::' . $request->getControllerName() . '::*';
$url3 = $request->getModuleName() . '::' . $request->getControllerName() . '::' . $request->getActionName();
return $acl->has($url1) && $acl->isAllowed($this->getRole(), $url1) || $acl->has($url2) && $acl->isAllowed($this->getRole(), $url2) || $acl->has($url3) && $acl->isAllowed($this->getRole(), $url3);
}
示例11: getModulesIdsByRequest
public static function getModulesIdsByRequest(Zend_Controller_Request_Abstract $request)
{
$map = self::getMapModules();
if (isset($map[$request->getModuleName()][$request->getControllerName()][$request->getActionName()])) {
return $map[$request->getModuleName()][$request->getControllerName()][$request->getActionName()];
} else {
return false;
}
}
示例12: preDispatch
/**
* @param $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$id = Zend_Auth::getInstance()->getIdentity();
if (empty($id)) {
// If it is not the login action of the authentication controller then forward to the login form
if (!($request->getControllerName() === 'authentication' || $request->getControllerName() === 'favicon.ico' || $request->getControllerName() === 'error' || $request->getControllerName() === 'index')) {
$this->_response->setRedirect('/login');
}
}
}
示例13: _includeCssController
/**
*
* @access protected
* @return void
*/
protected function _includeCssController()
{
$ds = '/';
//DIRECTORY_SEPARATOR;
$file = 'public' . $ds . 'styles' . $ds . $this->_request->getModuleName() . $ds . $this->_request->getControllerName() . '.css';
if (file_exists(APPLICATION_PATH . $ds . '..' . $ds . $file)) {
$view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
$view->headLink()->appendStylesheet($view->baseUrl($file));
}
}
示例14: preDispatch
public function preDispatch(\Zend_Controller_Request_Abstract $request)
{
if ($request->getControllerName() == "login" || $request->getControllerName() == "privilegese" || $request->getControllerName() == "index" || $request->getControllerName() == "error" || $request->getControllerName() == "document") {
return;
}
$hasPrivilege = self::hasPrivilige($request);
if ($hasPrivilege == false) {
$request->setControllerName("privileges");
$request->setActionName("index");
}
}
示例15: getInstance
public function getInstance(Zend_Controller_Request_Abstract $request)
{
if (!is_null($request->getModuleName())) {
$controller = $this->_loadCommand($request->getControllerName(), $request->getModuleName());
return $controller;
} elseif (!is_null($request->getControllerName())) {
$controller = $this->_loadCommand($request->getControllerName());
return $controller;
} else {
return $this->_loadCommand($this->getDefaultControllerName());
}
}