/** * Register when a link was clicked and redirect to link's URL. * For this method we don't use extbase parameters system to have an URL as short as possible */ public function clickedAction() { $this->linkRepository->registerClick(@$_REQUEST['n'], @$_REQUEST['l'], @$_REQUEST['p']); // Finally redirect to the destination URL $url = @$_REQUEST['url']; header("Location: {$url}"); die; }
/** * Register when a link was clicked and redirect to link's URL. * For this method we don't use extbase parameters system to have an URL as short as possible */ public function clickedAction() { $url = $this->linkRepository->registerClick(@$_REQUEST['n'], @$_REQUEST['l'], @$_REQUEST['p']); // Finally redirect to the destination URL if ($url) { header("Location: {$url}"); die; } else { throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException('The requested link was not found', 1440490767); } }
/** * Register when a link was clicked and redirect to link's URL. * For this method we don't use extbase parameters system to have an URL as short as possible */ public function clickedAction() { $args = $this->request->getArguments(); // For compatibility with old links $oldArgs = array('n', 'l', 'p'); foreach ($oldArgs as $arg) { if (!isset($args[$arg])) { if (isset($_REQUEST[$arg])) { $args[$arg] = $_REQUEST[$arg]; } } } $url = $this->linkRepository->registerClick(@$args['n'], @$args['l'], @$args['p']); // Finally redirect to the destination URL if ($url) { // This gives a proper 303 redirect. $this->redirectToUri($url); die; } else { throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException('The requested link was not found', 1440490767); } }