Beispiel #1
0
 /**
  * Checks if given action exists and is accessible
  *
  * @param string $fullAction
  *
  * @return boolean
  */
 public function checkAction($fullAction)
 {
     $config = Config::getInstance();
     $fileName = '';
     list($module, $action) = explode('/', trim($fullAction), 2);
     $this->moduleName = $module;
     $this->actionName = $action;
     $this->isSharedModule = false;
     if ($module != '' && $action != '') {
         $appFolder = $config->getFolderPath('app');
         $sharedFolder = $config->getFolderPath('shared');
         $fileName = Locator::getAppModuleFilePath($module, "actions/{$action}.php");
         if (!file_exists($fileName)) {
             // module is not defined for the application => search shared space
             $fileName = Locator::getSharedModuleFilePath($module, "actions/{$action}.php");
             if (file_exists($fileName)) {
                 $this->isSharedModule = true;
             } else {
                 $fileName = '';
             }
             $this->addWarning("Did not find the file for action {$fullAction}");
         }
         // Check unauthorized requests
         if (!$this->checkAuthorization($module, $action)) {
             $this->addWarning("Authorization check failed for action {$fullAction}");
             $fileName = '';
         }
     } else {
         $this->addWarning("Malformed action {$fullAction}");
     }
     return $fileName == '' ? false : $fileName;
 }