public function postAction(Request $request)
 {
     $form = new ConfigurationForm($request);
     try {
         $configForm = $this->validateForm($form);
         $data = $configForm->getData();
         $paylineConfig = new PaylineConfig();
         $paylineConfig->merge($data);
         // Redirect to the success URL,
         if ($this->getRequest()->get('save_mode') == 'stay') {
             // If we have to stay on the same page, redisplay the configuration page/
             $route = '/admin/module/Payline';
         } else {
             // If we have to close the page, go back to the module back-office page.
             $route = '/admin/modules';
         }
         return RedirectResponse::create(URL::getInstance()->absoluteUrl($route));
     } catch (FormValidationException $e) {
         $error = $this->createStandardFormValidationErrorMessage($e);
     } catch (\Exception $e) {
         $error = $e->getMessage();
     }
     $this->setupFormErrorContext('Payline Configuration', $error, $form, $e);
     return $this->render('module-configure', ['module_code' => 'Payline']);
 }
    /**
     * Automatically perform any required redirect
     *
     * This method is meant to be a helper for simple scenarios. If you want to customize the
     * redirection page, just call the getRedirectUrl() and getRedirectData() methods directly.
     */
    public function redirect()
    {
        if (!$this instanceof RedirectResponseInterface || !$this->isRedirect()) {
            throw new RuntimeException('This response does not support redirection.');
        }
        if ('GET' === $this->getRedirectMethod()) {
            HttpRedirectResponse::create($this->getRedirectUrl())->send();
            exit;
        } elseif ('POST' === $this->getRedirectMethod()) {
            $hiddenFields = '';
            foreach ($this->getRedirectData() as $key => $value) {
                $hiddenFields .= sprintf('<input type="hidden" name="%1$s" value="%2$s" />', htmlspecialchars($key, ENT_QUOTES, 'UTF-8'), htmlspecialchars($value, ENT_QUOTES, 'UTF-8')) . "\n";
            }
            $output = '<!DOCTYPE html>
<html>
    <head>
        <title>Redirecting...</title>
    </head>
    <body onload="document.forms[0].submit();">
        <form action="%1$s" method="post">
            <p>Redirecting to payment page...</p>
            <p>
                %2$s
                <input type="submit" value="Continue" />
            </p>
        </form>
    </body>
</html>';
            $output = sprintf($output, htmlspecialchars($this->redirectUrl, ENT_QUOTES, 'UTF-8'), $hiddenFields);
            HttpResponse::create($output)->send();
            exit;
        }
        throw new RuntimeException('Invalid redirect method "' . $this->getRedirectMethod() . '".');
    }
 /**
  *
  * Launch the parser defined on the constructor and get the result.
  *
  * The result is transform id needed into a Response object
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event
  */
 public function onKernelView(GetResponseForControllerResultEvent $event)
 {
     $parser = $this->container->get('thelia.parser');
     $templateHelper = $this->container->get('thelia.template_helper');
     $parser->setTemplateDefinition($templateHelper->getActiveFrontTemplate(), true);
     $request = $this->container->get('request_stack')->getCurrentRequest();
     $response = null;
     try {
         $content = $parser->render($request->attributes->get('_view') . ".html");
         if ($content instanceof Response) {
             $response = $content;
         } else {
             $response = new Response($content, $parser->getStatus() ?: 200);
         }
     } catch (ResourceNotFoundException $e) {
         throw new NotFoundHttpException();
     } catch (OrderException $e) {
         switch ($e->getCode()) {
             case OrderException::CART_EMPTY:
                 // Redirect to the cart template
                 $response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
                 break;
             case OrderException::UNDEFINED_DELIVERY:
                 // Redirect to the delivery choice template
                 $response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
                 break;
         }
         if (null === $response) {
             throw $e;
         }
     }
     $event->setResponse($response);
 }
Exemple #4
0
 public function authenticationException(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     if ($exception instanceof AuthenticationException) {
         $event->setResponse(RedirectResponse::create($exception->getLoginTemplate()));
     }
 }
 public function handle(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     $currentRoute = $request->attributes->get('_route');
     if (!$this->session->has('LDAP_LOGIN_CALLBACK')) {
         if (in_array($currentRoute, $this->allowedRoutes)) {
             $this->session->set('LDAP_LOGIN_CALLBACK', $this->kernel->getParameter('rheck_ldap_firewall.default_url'));
         } else {
             $this->session->set('LDAP_LOGIN_CALLBACK', $currentRoute);
         }
     }
     if (in_array($currentRoute, $this->allowedRoutes)) {
         return;
     }
     if (!$this->session->has('LDAP_LOGIN')) {
         $loginUrl = $this->router->generate($this->kernel->getParameter('rheck_ldap_firewall.login_url'));
         $event->setResponse(RedirectResponse::create($loginUrl));
         return;
     }
     $ldapUserCredentials = $this->session->get('LDAP_LOGIN');
     $token = new LDAPToken();
     $token->setUser('ldap_proxy_user');
     $token->setLDAPUserCredentials($ldapUserCredentials);
     try {
         $authToken = $this->authenticationManager->authenticate($token);
         $this->securityContext->setToken($authToken);
     } catch (AuthenticationException $failed) {
         $this->session->set('LDAP_LOGIN_ERROR', 'Some error was occurred! Can\'t connect to LDAP.');
         $event->setResponse(RedirectResponse::create($this->router->generate('_rheck_ldap_login')));
     } catch (\Exception $e) {
         $this->session->set('LDAP_LOGIN_ERROR', 'Invalid credentials.');
         $event->setResponse(RedirectResponse::create($this->router->generate('_rheck_ldap_login')));
     }
 }
 public function loginAction()
 {
     $customerController = new BaseCustomerController();
     $customerController->setContainer($this->container);
     $response = $customerController->loginAction();
     if (!$this->getSecurityContext()->hasCustomerUser()) {
         $request = $this->getRequest();
         $customerLoginForm = new CustomerLogin($request);
         try {
             $form = $this->validateForm($customerLoginForm, "post");
             $request = CustomerTempQuery::create();
             $customerTemp = $request->where('`customer_temp`.email = ?', $form->get('email')->getData(), \PDO::PARAM_STR)->where('`customer_temp`.password = PASSWORD(?)', $form->get('password')->getData(), \PDO::PARAM_STR)->where('`customer_temp`.processed = 0')->findOne();
             if (null !== $customerTemp) {
                 $customer = CustomerQuery::create()->findOneByEmail($form->get('email')->getData());
                 $customer->setPassword($form->get('password')->getData())->save();
                 $customerTemp->setProcessed(true)->save();
                 $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer));
                 $successUrl = $customerLoginForm->getSuccessUrl();
                 $response = RedirectResponse::create($successUrl);
             }
         } catch (\Exception $e) {
         }
     }
     return $response;
 }
Exemple #7
0
 /** {@inheritdoc} */
 public function showFront(Template $template = null)
 {
     if (is_array($this->languages) && count($this->languages)) {
         // allowed languages
         $allowedLanguages = array();
         foreach ($this->languages as $lang) {
             $allowedLanguages[$lang['code']] = $lang;
         }
         // find preferred language
         reset($this->languages);
         $language = current($this->languages);
         foreach ($this->getLanguage() as $lang => $quality) {
             if (array_key_exists($lang, $allowedLanguages)) {
                 $language = $allowedLanguages[$lang];
                 break;
             }
         }
         $page = \PageQuery::create()->findPk($language['page_id']);
         if ($page) {
             return RedirectResponse::create(url($page->getUrl(), $_GET));
         } else {
             $this->app->logger->notice('Redirect page not found');
         }
     } else {
         $this->app->logger->notice('No languages found');
     }
     return '';
 }
 public function checkRedirectException(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     if ($exception instanceof \Thelia\Core\HttpKernel\Exception\RedirectException) {
         $response = RedirectResponse::create($exception->getUrl(), $exception->getStatusCode());
         $event->setResponse($response);
     }
 }
 /**
  * When a simple web user click a referral link, this code is executed.
  *
  * A hash is defined in the route ( at least should be defined ), so we
  * can retrieve referral line given this hash.
  *
  * If hash exists, current hash is saved in the cookie, so if user
  * registers or makes a purchase, this value will be used for
  * referral program engine.
  *
  * If cookie is already set, hash value is overwritten.
  *
  * @return Response Response object
  */
 public function trackAction()
 {
     $hash = $this->requestStack->getCurrentRequest()->query->get('hash');
     $cookie = new Cookie(ElcodiReferralProgramCookie::REFERRAL_PROGRAM_COOKIE_NAME, $hash);
     $responseUrl = $this->urlGenerator->generate($this->controllerRedirect);
     $response = RedirectResponse::create($responseUrl);
     $response->headers->setCookie($cookie);
     return $response;
 }
Exemple #10
0
 public function redirect($url, $way = 'html', $status = '301', $header = array())
 {
     $redirectResponse = RedirectResponse::create($url, $status, $header);
     if ('html' === $way) {
         $content = $redirectResponse->getContent();
         $this->renderTrait('redirect.tpl', ['content' => $content]);
     } else {
         return $redirectResponse;
     }
 }
 /**
  * Redirect to URL or close dialog.
  *
  * @param string $url
  * @param bool $dialogRedirect If true, this will redirect dialogs as well, otherwise just close the dialog.
  */
 public static function redirect($url, $dialogRedirect = true)
 {
     $url = (string) $url;
     $redirectJs = '<script type="text/javascript">window.location.href = ' . json_encode($url) . ';</script>';
     if (isAjax()) {
         // we're in a dialog, use javascript to redirect
         self::returnPartial($dialogRedirect ? $redirectJs : '');
     } else {
         throw new ResponseException(RedirectResponse::create($url));
     }
 }
 public function checkRedirectException(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     if ($exception instanceof ExceptionRedirectException) {
         $response = RedirectResponse::create($exception->getUrl(), $exception->getStatusCode());
         $event->setResponse($response);
     } elseif ($exception instanceof AuthenticationException) {
         // Redirect to the login template
         $response = RedirectResponse::create($this->urlManager->viewUrl($exception->getLoginTemplate()));
         $event->setResponse($response);
     }
 }
 public function saveAction()
 {
     if (null !== ($response = $this->checkAuth(AdminResources::MODULE, ['Twitter'], AccessManager::UPDATE))) {
         return $response;
     }
     $form = new ConfigurationForm($this->getRequest());
     $configurationForm = $this->validateForm($form);
     $consumer_key = $configurationForm->get('consumer_key')->getData();
     $consumer_secret = $configurationForm->get('consumer_secret')->getData();
     $screen_name = $configurationForm->get('screen_name')->getData();
     $count = $configurationForm->get('count')->getData();
     $cache_lifetime = $configurationForm->get('cache_lifetime')->getData();
     // $debug_mode     = $configurationForm->get('debug_mode')->getData();
     $errorMessage = null;
     $response = null;
     // Save config values
     ConfigQuery::write('twitter_consumer_key', $consumer_key, 1, 1);
     ConfigQuery::write('twitter_consumer_secret', $consumer_secret, 1, 1);
     ConfigQuery::write('twitter_screen_name', $screen_name, 1, 1);
     ConfigQuery::write('twitter_count', $count, 1, 1);
     ConfigQuery::write('twitter_cache_lifetime', $cache_lifetime * 60, 1, 1);
     // Minutes
     ConfigQuery::write('twitter_last_updated', 0, 1, 1);
     if ($screen_name && $consumer_key && $consumer_secret) {
         if (!extension_loaded('openssl')) {
             $sslError = $this->getTranslator()->trans("This module requires the PHP extension open_ssl to work.", [], Twitter::DOMAIN_NAME);
         } else {
             $config = array('consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret, 'output_format' => 'array');
             try {
                 $connection = new TwitterOAuth($config);
                 $bearer_token = $connection->getBearerToken();
             } catch (\Exception $e) {
                 $errorMessage = $e->getMessage();
             }
             try {
                 $params = array('screen_name' => $screen_name, 'count' => 1, 'exclude_replies' => true);
                 $response = $connection->get('statuses/user_timeline', $params);
                 if ($response['error']) {
                     throw new TwitterException($response['error']);
                 }
             } catch (\Exception $e) {
                 $erroMessage = $this->getTranslator()->trans("Unrecognized screen name", [], Twitter::DOMAIN_NAME);
             }
         }
     }
     $response = RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/Twitter'));
     if (null !== $errorMessage) {
         $this->setupFormErrorContext($this->getTranslator()->trans("Twitter configuration failed.", [], Twitter::DOMAIN_NAME), $errorMessage, $form);
         $response = $this->render("module-configure", ['module_code' => 'Twitter']);
     }
     return $response;
 }
 public function getRedirectResponse()
 {
     if (!$this instanceof RedirectResponseInterface || !$this->isRedirect()) {
         throw new RuntimeException('This response does not support redirection.');
     }
     if ('GET' === $this->getRedirectMethod()) {
         return HttpRedirectResponse::create($this->getRedirectUrl());
     } elseif ('POST' === $this->getRedirectMethod()) {
         $xml = $this->toXml($this->getRedirectData());
         return HttpResponse::create(parent::postXmlCurl($xml, $this->getRedirectUrl(), false));
     }
     throw new RuntimeException('Invalid redirect method "' . $this->getRedirectMethod() . '".');
 }
 public function update($author, $name)
 {
     $package = Package::where('author', '=', $author)->where('name', '=', $name)->get()->first();
     $minRefresh = Carbon::now()->subMinutes(30)->timestamp;
     if (is_null($package)) {
         return RedirectResponse::create('/?no_such_package');
     } elseif (strtotime($package->updated_at) > $minRefresh) {
         return RedirectResponse::create('/package/' . $author . '/' . $name . '?too_quick');
     } else {
         $this->_refreshPackage($package);
         return RedirectResponse::create('/package/' . $author . '/' . $name);
     }
 }
 public function login()
 {
     $openId = new \LightOpenID($this->_getRequest()->getUri());
     if (!$openId->mode) {
         $openId->identity = 'https://steamcommunity.com/openid';
         return RedirectResponse::create($openId->authUrl());
     } else {
         if ($openId->validate()) {
             $id = basename($openId->identity);
             Session::set(Session::USER_ID, $id);
             return RedirectResponse::create('/users/' . $id);
         }
         return 'error';
     }
 }
 public function create($request, $response)
 {
     $formFactory = Forms::createFormFactory();
     /* @var $form \Symfony\Component\Form\Form */
     $form = $formFactory->create(new BookType());
     $form->handleRequest();
     if ($form->isValid()) {
         $this->em->persist($form->getData());
         $this->em->flush();
         $this->session->getFlashBag()->add('notice', 'Book inserted');
         $response = new RedirectResponse('/book');
         return $response;
     }
     return $response->create($this->template->render('book/create.html.twig', ['title' => 'New Book', 'form' => $form->createView()]));
 }
 /**
  * Send request to endpoints & receive data
  *
  * @param object $obj
  * @param array $data
  * 
  * @return object Redirect
  */
 public function initialize($obj, $data)
 {
     $param = ["Method" => 'SetExpressCheckout', "version" => parent::API_VERSION, "apiusername" => $obj->getApiUsername(), "apipassword" => $obj->getApiPassword(), "apisignature" => $obj->getApiSignature(), "paymentaction" => 'Sale', "returnUrl" => $obj->getReturnUrl(), "cancelUrl" => $obj->getCancelUrl(), "noShipping" => $obj->getNoShipping(), "PaymentRequest_ItemTotalAmt" => $data['amount'], "paymentRequest_Amt" => $data['amount'], "paymentaction" => 'Sale'];
     $param = array_merge($param, $obj->setItems($data['items']));
     $result = $this->sendRequest($this->getEndpoint($obj->getDev()), $param);
     if (empty($result)) {
         throw new EmptyResponseException('No Response returned');
     }
     if ($result['Ack'] == 'fail') {
         throw new AckFailException($result['LONGMESSAGE0']);
     }
     $this->session->set('token', $result['Token']);
     $this->session->set('paymentAmmount', $param['paymentRequest_Amt']);
     return Redirect::create($this->getLoginEndpoint($obj->getDev()) . urldecode($result['Token']));
 }
Exemple #19
0
 public function getRedirectResponse()
 {
     if (!$this instanceof RedirectResponseInterface || !$this->isRedirect()) {
         throw new RuntimeException('This response does not support redirection.');
     }
     if ('GET' === $this->getRedirectMethod()) {
         return HttpRedirectResponse::create($this->getRedirectUrl());
     } elseif ('POST' === $this->getRedirectMethod()) {
         $hiddenFields = '';
         $merchant_data = '';
         $working_key = $this->data['working_key'];
         //Shared by CCAVENUES
         $access_code = $this->data['access_key'];
         //Shared by CCAVENUES
         foreach ($this->getRedirectData() as $key => $value) {
             // echo $key."= ".$value.'<br/>';
             $merchant_data .= $key . '=' . urlencode($value) . '&';
         }
         $encrypted_data = encrypt($merchant_data, $working_key);
         // Method for encrypting the data.
         // foreach ($this->getRedirectData() as $key => $value) {
         //     $hiddenFields .= sprintf(
         //         '<input type="hidden" name="%1$s" value="%2$s" />',
         //         htmlentities($key, ENT_QUOTES, 'UTF-8', false),
         //         htmlentities($value, ENT_QUOTES, 'UTF-8', false)
         //     )."\n";
         // }
         $output = '<!DOCTYPE html>
                 <html>
                     <head>
                         <title>Redirecting...</title>
                     </head>
                     <body onload="document.forms[0].submit();">
                         <form action="%1$s" method="post" style="display:none;">
                             <p>Redirecting to payment page...</p>
                             <input type=text name=encRequest value="%2$s"/>
                             <input type=text name=access_code value="%3$s"/>
                             <p>
                                 <input type="submit" value="Continue" />
                             </p>
                         </form>
                     </body>
                 </html>';
         $output = sprintf($output, htmlentities($this->redirectUrl, ENT_QUOTES, 'UTF-8', false), $encrypted_data, $access_code);
         return HttpResponse::create($output);
     }
     throw new RuntimeException('Invalid redirect method "' . $this->getRedirectMethod() . '".');
 }
 public function handle(Request $request)
 {
     // Fetch username from authenticated token.
     $username = $this->checkUsername();
     // Fetch and check client_id.
     $clientId = $this->checkClientId($request);
     // Fetch and check redirect_uri.
     $redirectUri = $this->checkRedirectUri($request, $clientId);
     // Fetch and check state.
     $state = $this->checkState($request, $redirectUri);
     // Fetch and check scope.
     $scope = $this->checkScope($request, $clientId, $username, $redirectUri, $state);
     // Generate parameters, store to backend and set response.
     $parameters = $this->tokenTypeHandlerFactory->getTokenTypeHandler()->createAccessToken($clientId, $username, $scope, $state, $withRefreshToken = false);
     $redirectUri = Request::create($redirectUri, 'GET', $parameters)->getUri();
     return RedirectResponse::create($redirectUri);
 }
 public function handle(Request $request)
 {
     // Fetch username from authenticated token.
     $username = $this->checkUsername();
     // Fetch and check client_id.
     $clientId = $this->checkClientId($request);
     // Fetch and check redirect_uri.
     $redirectUri = $this->checkRedirectUri($request, $clientId);
     // Fetch and check state.
     $state = $this->checkState($request, $redirectUri);
     // Fetch and check scope.
     $scope = $this->checkScope($request, $clientId, $username, $redirectUri, $state);
     // Generate parameters, store to backend and set response.
     $codeManager = $this->modelManagerFactory->getModelManager('code');
     $class = $codeManager->getClassName();
     $code = new $class();
     $code->setCode(md5(uniqid(null, true)))->setClientId($clientId)->setUsername($username)->setRedirectUri($redirectUri)->setExpires(new \DateTime('+10 minutes'))->setScope((array) $scope);
     $code = $codeManager->createModel($code);
     $parameters = ['code' => $code->getCode(), 'state' => $state];
     $redirectUri = Request::create($redirectUri, 'GET', $parameters)->getUri();
     return RedirectResponse::create($redirectUri);
 }
 private function handleException(GetResponseForExceptionEvent $event, ExceptionInterface $exception)
 {
     if (null !== $this->logger) {
         $message = sprintf('%s: %s (code %s) at %s line %s', get_class($exception), $exception->getMessage(), $exception->getCode(), $exception->getFile(), $exception->getLine());
         if ($exception->getCode() < 500) {
             $this->logger->error($message, ['exception' => $exception]);
         } else {
             $this->logger->critical($message, ['exception' => $exception]);
         }
     }
     $message = unserialize($exception->getMessage());
     if (isset($message['redirect_uri'])) {
         $redirectUri = $message['redirect_uri'];
         unset($message['redirect_uri']);
         $redirectUri = Request::create($redirectUri, 'GET', $message)->getUri();
         $response = RedirectResponse::create($redirectUri);
     } else {
         $code = $exception->getCode();
         $response = JsonResponse::create($message, $code, ['Cache-Control' => 'no-store', 'Pragma' => 'no-cache']);
     }
     $event->setResponse($response);
 }
 public function saveAction()
 {
     $response = $this->checkAuth([AdminResources::MODULE], ['backofficepath'], AccessManager::UPDATE);
     if ($response !== null) {
         return $response;
     }
     $form = new \BackOfficePath\Form\Configuration($this->getRequest());
     $message = '';
     try {
         $vform = $this->validateForm($form);
         $data = $vform->getData();
         ConfigQuery::write('back_office_path', $data['back_office_path'], false, true);
         ConfigQuery::write('back_office_path_default_enabled', $data['back_office_path_default_enabled'] ? '1' : '0', false, true);
     } catch (\Exception $e) {
         $message = $e->getMessage();
     }
     if ($message) {
         $form->setErrorMessage($message);
         $this->getParserContext()->addForm($form);
         $this->getParserContext()->setGeneralError($message);
         return $this->render('module-configure', array('module_code' => BackOfficePath::getModuleCode()));
     }
     return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/' . BackOfficePath::getModuleCode()));
 }
    /**
     * @return HttpRedirectResponse
     */
    public function getRedirectResponse()
    {
        if (!$this->isRedirect()) {
            throw new RuntimeException('This response does not support redirection.');
        }
        if ('GET' === $this->getRedirectMethod()) {
            $url = $this->getRedirectUrl();
            return HttpRedirectResponse::create($url);
        } elseif ('POST' === $this->getRedirectMethod()) {
            $hiddenFields = '';
            foreach ($this->getRedirectData() as $key => $value) {
                $hiddenFields .= sprintf('<input type="hidden" name="%1$s" value="%2$s" />', htmlentities($key, ENT_QUOTES, 'UTF-8', false), htmlentities($value, ENT_QUOTES, 'UTF-8', false)) . "\n";
            }
            $output = <<<'TAG'
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Redirecting...</title>
    </head>
    <body onload="document.forms[0].submit();">
        <form action="%1$s" method="post">
            <p>Redirecting to payment page...</p>
            <p>
                %2$s
                <input type="submit" value="Continue" />
            </p>
        </form>
    </body>
</html>
TAG;
            $output = sprintf($output, htmlentities($this->getRedirectUrl(), ENT_QUOTES, 'UTF-8', false), $hiddenFields);
            return HttpResponse::create($output);
        }
        throw new RuntimeException('Invalid redirect method "' . $this->getRedirectMethod() . '".');
    }
Exemple #25
0
 /**
  *
  * create an instance of RedirectResponse
  *
  * @param $url
  * @param  int                                        $status
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function generateRedirect($url, $status = 302)
 {
     return RedirectResponse::create($url, $status);
 }
Exemple #26
0
 /**
  * redirect(string $location[, int $status = 302, array $headers = array()])
  *
  * Sends a redirect to the client, defaults with a 302 HTTP status code (can
  * be changed with the $status parameter, use 301 for permanent redirects).
  */
 protected function redirect($location, $status = 302, $headers = array())
 {
     // Check if a output action has be already performed
     $this->_checkIfPerformed();
     // Create a redirect
     $redirectResponse = \Symfony\Component\HttpFoundation\RedirectResponse::create($location, $status, $headers);
     // Add request informationen
     $redirectResponse->prepare($this->application->requestStack->getCurrentRequest());
     // Replace response object
     $this->application->response = $redirectResponse;
     // Don't use a template
     $this->useTemplate(false, $status);
 }
 protected function redirectToConfigurationPage()
 {
     return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/Carousel'));
 }
 /**
  * redirect to OpenSearchServer admin home
  *
  * @return \Symfony\Component\HttpFoundation\Response|static
  */
 protected function redirectToHome()
 {
     return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/OpenSearchServerSearch'));
 }
 /**
  * Creates a redirect response from the given request.
  *
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response|static
  */
 private function createRedirectResponse(Request $request)
 {
     $url = $this->loginUrl . '?' . http_build_query(['redirect_to' => $request->getUri(), 'reauth' => 0]);
     return RedirectResponse::create($url, 302);
 }
 /**
  * Redirect to the configuration page
  */
 protected function redirectToVariableConfigurationPage()
 {
     return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/configuration/variables'));
 }