當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Controller_Request_Abstract::getControllerName方法代碼示例

本文整理匯總了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');
     }
 }
開發者ID:KasaiDot,項目名稱:FansubCMS,代碼行數:27,代碼來源:Acl.php

示例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');
     }
 }
開發者ID:romulotorres,項目名稱:ZendBase,代碼行數:7,代碼來源:Auth.php

示例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.');
     }
 }
開發者ID:psoas,項目名稱:ch3-dev-preview,代碼行數:26,代碼來源:CheckAuth.php

示例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');
             }
         }
     }
 }
開發者ID:stevenli,項目名稱:360ic.net.cn,代碼行數:32,代碼來源:AuthPlugin.php

示例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;
 }
開發者ID:sgdoc,項目名稱:sgdoce-codigo,代碼行數:32,代碼來源:Security.php

示例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');
         }
     }
 }
開發者ID:sura2k,項目名稱:sentrifugo,代碼行數:34,代碼來源:AccessControl.php

示例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);
 }
開發者ID:erickosma,項目名稱:e-ong,代碼行數:35,代碼來源:Auth.php

示例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('/');
         }
     }
 }
開發者ID:razorcell,項目名稱:GBADMIN,代碼行數:25,代碼來源:AccessCheck.php

示例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);
 }
開發者ID:mayconheerdt,項目名稱:zfSkeleton,代碼行數:27,代碼來源:Auth.php

示例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);
 }
開發者ID:josmel,項目名稱:voy,代碼行數:8,代碼來源:Acl.php

示例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;
     }
 }
開發者ID:dafik,項目名稱:dfi,代碼行數:9,代碼來源:Acl.php

示例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');
         }
     }
 }
開發者ID:kyroskoh,項目名稱:apigrove,代碼行數:13,代碼來源:ACLPlugin.php

示例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));
     }
 }
開發者ID:fredcido,項目名稱:cenbrap,代碼行數:15,代碼來源:Layout.php

示例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");
     }
 }
開發者ID:sp1ke77,項目名稱:MLM-1,代碼行數:11,代碼來源:Privileges.php

示例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());
     }
 }
開發者ID:CHH,項目名稱:Spark-Web-Framework,代碼行數:12,代碼來源:StandardResolver.php


注:本文中的Zend_Controller_Request_Abstract::getControllerName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。