Example #1
0
 /**
  * @see \Ableron\Core\Controller\AbstractController::run()
  */
 protected function run()
 {
     // check for valid CSRF token before executing action
     if ($this->checkCsrfToken()) {
         try {
             $this->readParameters();
             $this->readData();
             $this->execute();
             $this->onExecuteSuccessful();
         } catch (ExecutionFailedException $e) {
             $this->onExecuteFailed();
         }
     } else {
         $this->setFlashMessage(Application::getI18nHandler()->getTranslator()->translate('core.security.csrf.actionNotExecuted'), null, ControllerInterface::MESSAGE_TYPE_ERROR);
     }
     // if we are here, no redirect has been sent during execution; so redirect to action source URL
     if (($encodedActionSourceUrl = $this->getQueryParameter(ABLERON_PARAM_ACTION_SOURCE_URL, false)) !== false && ($actionSourceUrl = StringUtil::base64UrlDecode($encodedActionSourceUrl)) !== false) {
         $this->redirectTo(new Uri($actionSourceUrl));
     } else {
         $this->redirectTo(EnvironmentUtil::getInternalUrl('/'));
     }
 }