/** * Handles a request. The result output is returned by altering the given response. * * @param RequestInterface $request The request object * @param ResponseInterface $response The response, modified by this handler * @return void * @api */ public function processRequest(RequestInterface $request, ResponseInterface $response) { if ($request instanceof WidgetRequest) { $this->widgetConfiguration = $request->getWidgetContext()->getWidgetConfiguration(); } parent::processRequest($request, $response); }
/** * Finds and instanciates a controller that matches the current request. * If no controller can be found, an instance of NotFoundControllerInterface is returned. * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request to dispatch * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerException * @return \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface */ protected function resolveController(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request) { $controllerObjectName = $request->getControllerObjectName(); $controller = $this->objectManager->get($controllerObjectName); if (!$controller instanceof \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface) { throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerException('Invalid controller "' . $request->getControllerObjectName() . '". The controller must implement the TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerInterface.', 1202921619); } return $controller; }
/** * Performs a redirect if possible * * @param RequestInterface $request * @param array $settings * @return void */ public function processRedirect(RequestInterface $request, array $settings) { $formData = $request->getArgument('formData'); $redirectUrl = NULL; // May be set by anything if (!empty($formData['redirect_url'])) { $redirectUrl = $formData['redirect_url']; } // May be set via config.typolinkLinkAccessRestrictedPages_addParams if (!empty($formData['return_url'])) { $redirectUrl = $formData['return_url']; } if ($redirectUrl !== NULL) { HttpUtility::redirect($redirectUrl); } }
/** * Override the action name if found in the uc of the user * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { $vars = GeneralUtility::_GET('tx_indexedsearch_web_indexedsearchisearch'); $beUser = $this->getBackendUserAuthentication(); if (is_array($vars) && isset($vars['action']) && method_exists($this, $vars['action'] . 'Action')) { $action = $vars['action']; switch($action) { case 'saveStopwordsKeywords': $action = 'statisticDetails'; break; case 'deleteIndexedItem': $action = 'statistic'; break; } $beUser->uc['indexed_search']['action'] = $action; $beUser->uc['indexed_search']['arguments'] = $request->getArguments(); $beUser->writeUC(); } elseif (isset($beUser->uc['indexed_search']['action'])) { if ($request instanceof WebRequest) { $request->setControllerActionName($beUser->uc['indexed_search']['action']); } if (isset($beUser->uc['indexed_search']['arguments'])) { $request->setArguments($beUser->uc['indexed_search']['arguments']); } } parent::processRequest($request, $response); }
/** * Returns the locale object for frontend * * @param \Aimeos\MShop\Context\Item\Iface $context Context object * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface|null $request Request object * @return \Aimeos\MShop\Locale\Item\Iface Locale item object */ public static function get(\Aimeos\MShop\Context\Item\Iface $context, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null) { if (!isset(self::$locale)) { $config = $context->getConfig(); $sitecode = $config->get('mshop/locale/site', 'default'); $name = $config->get('typo3/param/name/site', 'loc_site'); if ($request !== null && $request->hasArgument($name) === true) { $sitecode = $request->getArgument($name); } elseif (($value = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('S')) !== null) { $sitecode = $value; } $langid = $config->get('mshop/locale/language', ''); $name = $config->get('typo3/param/name/language', 'loc_language'); if ($request !== null && $request->hasArgument($name) === true) { $langid = $request->getArgument($name); } elseif (isset($GLOBALS['TSFE']->config['config']['language'])) { $langid = $GLOBALS['TSFE']->config['config']['language']; } $currency = $config->get('mshop/locale/currency', ''); $name = $config->get('typo3/param/name/currency', 'loc_currency'); if ($request !== null && $request->hasArgument($name) === true) { $currency = $request->getArgument($name); } elseif (($value = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('C')) !== null) { $currency = $value; } $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); self::$locale = $localeManager->bootstrap($sitecode, $langid, $currency); } return self::$locale; }
/** * Maps arguments delivered by the request object to the local controller arguments. * * @throws Exception\RequiredArgumentMissingException * @return void */ protected function mapRequestArgumentsToControllerArguments() { /** @var \TYPO3\CMS\Extbase\Mvc\Controller\Argument $argument */ foreach ($this->arguments as $argument) { $argumentName = $argument->getName(); if ($this->request->hasArgument($argumentName)) { $argument->setValue($this->request->getArgument($argumentName)); } elseif ($argument->isRequired()) { throw new \TYPO3\CMS\Extbase\Mvc\Controller\Exception\RequiredArgumentMissingException('Required argument "' . $argumentName . '" is not set for ' . $this->request->getControllerObjectName() . '->' . $this->request->getControllerActionName() . '.', 1298012500); } } }
/** * Constructs a new \EssentialDots\ExtbaseHijax\Event\Listener. * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request * @param array $configuration Framework configuraiton * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj An array of parameters */ public function __construct(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, $configuration = null, $cObj = null) { $this->injectObjectManager(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')); $this->injectConfigurationManager($this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface')); $this->injectAutoIDService($this->objectManager->get('EssentialDots\\ExtbaseHijax\\Service\\AutoIDService')); $this->request = $request; if (method_exists($this->request, 'setMethod')) { $this->request->setMethod('GET'); } if ($configuration) { $this->configuration = $this->ksortRecursive($configuration); } else { $this->configuration = $this->ksortRecursive($this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK)); } if ($cObj) { $this->cObj = $cObj; } else { $this->cObj = $this->configurationManager->getContentObject(); } /* @var $listenerFactory \EssentialDots\ExtbaseHijax\Service\Serialization\ListenerFactory */ $listenerFactory = $this->objectManager->get('EssentialDots\\ExtbaseHijax\\Service\\Serialization\\ListenerFactory'); // old logic - using autoincrement //$this->id = $this->autoIDService->getAutoId(get_class($this)); // new logic - determine the id based on md5 hash $this->id = ''; // resetting the id so it doesn't affect the hash $serialized = $listenerFactory->serialize($this); list($table, $uid) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $this->cObj->currentRecord); if ($table == 'tt_content' && $uid) { $this->id = str_replace(':', '-', $this->cObj->currentRecord) . '-' . md5($serialized); } else { // test if this is ExtbaseHijax Pi1 if (method_exists($this->request, 'getControllerExtensionName') && method_exists($this->request, 'getPluginName') && $this->request->getControllerExtensionName() == 'ExtbaseHijax' && $this->request->getPluginName() == 'Pi1') { $encodedSettings = str_replace('.', '---', $this->configuration['settings']['loadContentFromTypoScript']); $settingsHash = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($encodedSettings); if ($this->configuration['switchableControllerActions']['ContentElement'][0] == 'user') { $this->id = 'h-' . $settingsHash . '-' . $encodedSettings; } else { $this->id = 'hInt-' . $settingsHash . '-' . $encodedSettings; } } elseif ($this->configuration['settings']['fallbackTypoScriptConfiguration']) { $encodedSettings = str_replace('.', '---', $this->configuration['settings']['fallbackTypoScriptConfiguration']); $settingsHash = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($encodedSettings); $this->id = 'f-' . $settingsHash . '-' . $encodedSettings; } else { $this->id = md5($serialized); } } }
/** * Returns the fixed parameters that should be included in every URL * * @param \MW_Config_Interface $config Config object * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request Request object * @return array Associative list of site, language and currency if available */ protected static function getFixedParams(\MW_Config_Interface $config, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request) { $fixed = array(); $name = $config->get('typo3/param/name/site', 'loc-site'); if ($request->hasArgument($name) === true) { $fixed[$name] = $request->getArgument($name); } $name = $config->get('typo3/param/name/language', 'loc-language'); if ($request->hasArgument($name) === true) { $fixed[$name] = $request->getArgument($name); } $name = $config->get('typo3/param/name/currency', 'loc-currency'); if ($request->hasArgument($name) === true) { $fixed[$name] = $request->getArgument($name); } return $fixed; }
/** * Returns the JSON encoded site item. * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request TYPO3 request object * @return string JSON encoded site item object * @throws Exception If no site item was found for the code */ protected function getSite(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request) { $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($this->getContext()); $manager = $localeManager->getSubManager('site'); $site = 'default'; if ($request->hasArgument('site')) { $site = $request->getArgument('site'); } $criteria = $manager->createSearch(); $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); $items = $manager->searchItems($criteria); if (($item = reset($items)) === false) { throw new Exception(sprintf('No site found for code "%1$s"', $site)); } return json_encode($item->toArray()); }
public function bindRequest(RequestInterface $request) { if ($request->hasArgument($this->getName())) { $this->setValue($request->getArgument($this->getName())); } }
/** * Handles a request. The result output is returned by altering the given response. * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request object * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response The response, modified by this handler * @return void * @api */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { $this->widgetConfiguration = $request->getWidgetContext()->getWidgetConfiguration(); parent::processRequest($request, $response); }
/** * Handles a request. The result output is returned by altering the given response. * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request object * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response The response, modified by this handler * @return void * @api */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { if ($request instanceof WidgetRequest) { $this->widgetConfiguration = $request->getWidgetContext()->getWidgetConfiguration(); } ActionController::processRequest($request, $response); }
/** * Reads the submitted values from the request and assigns them * to the appropriate fields. * * @param RequestInterface $request */ public function bindRequest(RequestInterface $request) { foreach ($this->controlFields as $key => $value) { $this->controlFields[$key] = $request->getArgument($key); } foreach ($this->getFields() as $field) { $field->bindRequest($request); } $this->isBound = TRUE; }
/** * Determines if request holds a bookmark to restore and in case there is forwards it to restoreBookmark * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request) { if ($request->hasArgument('action') && $request->hasArgument('controller')) { if ($request->getArgument('action') == 'restore' && $request->getArgument('controller') == 'Bookmark' && $this->bookmarkIsRestored === FALSE) { if ($request->hasArgument('bookmark')) { $this->restoreBookmarkByUid($request->getArgument('bookmark')); } } } }
/** * @param string $format * @return void */ public function setFormat($format) { $this->request->setFormat($format); }