redirect example

$this->aclResource = strtolower(str_replace('_', '', $this->request->getControllerName()));

        if ($this->aclResource === 'error' || $this->request->getModuleName() !== 'backend') {
            return;
        }

        if ($this->shouldAuth()) {
            if ($this->checkAuth() === null) {
                if ($this->request->isXmlHttpRequest()) {
                    throw new Enlight_Controller_Exception('Unauthorized', 401);
                }
                $this->action->redirect('backend/');
            }
        } else {
            $this->initLocale();
        }
    }

    /** * @throws Enlight_Controller_Exception * * @return Shopware_Components_Auth|null */
    
/** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    // Retrieve the accounts to be canceled from the temp store.     /** @var \Drupal\user\Entity\User[] $accounts */
    $accounts = $this->tempStoreFactory
      ->get('user_user_operations_cancel')
      ->get($this->currentUser()->id());
    if (!$accounts) {
      return $this->redirect('entity.user.collection');
    }

    $root = NULL;
    $names = [];
    $form['accounts'] = ['#tree' => TRUE];
    foreach ($accounts as $account) {
      $uid = $account->id();
      $names[$uid] = $account->label();
      // Prevent user 1 from being canceled.       if ($uid <= 1) {
        $root = intval($uid) === 1 ? $account : $root;
        
$app->view()->set('languages', $container->offsetGet('config')['languages']);

    $app->render('/language-selection.php');
})->via('GET', 'POST')->name('language-selection');

$app->map('/license', function D) use ($app$menuHelper$container) {
    $menuHelper->setCurrent('license');

    if ($app->request()->isPost()) {
        if ($app->request->post('tos')) {
            $app->redirect($menuHelper->getNextUrl());

            return;
        }

        $app->view()->set('error', true);
    }

    $tosUrls = $container->offsetGet('config')['tos.urls'];
    $tosUrl = $tosUrls['en'];

    if (\array_key_exists($container->offsetGet('install.language')$tosUrls)) {
        

        $_SESSION['DB_DONE'] = true;

        $cleanupList = $this->getCleanupList();

        if ($this->request->isPost()) {
            $this->cleanupMedia();
        }

        if (\count($cleanupList) == 0) {
            $_SESSION['CLEANUP_DONE'] = true;
            $this->response->redirect($this->app->urlFor('done'));
        }

        if ($this->request->isPost()) {
            $this->cleanupTemplateRelations();

            $result = [];
            foreach ($cleanupList as $path) {
                $result = array_merge($result, Utils::cleanPath($path));
            }

            if (\count($result) == 0) {
                
public function deleteShortcutLinkInline(ShortcutInterface $shortcut) {
    $label = $shortcut->label();

    try {
      $shortcut->delete();
      $this->messenger()->addStatus($this->t('The shortcut %title has been deleted.', ['%title' => $label]));
    }
    catch (\Exception $e) {
      $this->messenger()->addStatus($this->t('Unable to delete the shortcut for %title.', ['%title' => $label]), 'error');
    }

    return $this->redirect('<front>');
  }

}
if ($content_conflicts) {
        $form = $this->conflictsForm($form$content_conflicts);
      }
      if ($translated_content_conflicts) {
        $form = $this->i18nWarningForm($form$translated_content_conflicts);
      }
      return $form;
    }
    else {
      $this->store->set('step', 'review');
      return $this->redirect('migrate_drupal_ui.upgrade_review');
    }
  }

  /** * Build the markup for conflict warnings. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\migrate\Audit\AuditResult[] $conflicts * The failing audit results. * * @return array * The form structure. */
trigger_error('The path /admin/structure/block/block-content/types is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/structure/block-content. See https://www.drupal.org/node/3320855.', E_USER_DEPRECATED);
    $helper = new PathChangedHelper($route_match$request);
    $params = [
      '%old_path' => $helper->oldPath(),
      '%new_path' => $helper->newPath(),
      '%change_record' => 'https://www.drupal.org/node/3320855',
    ];
    $warning_message = $this->t('You have been redirected from %old_path. Update links, shortcuts, and bookmarks to use %new_path.', $params);
    $this->messenger()->addWarning($warning_message);
    $this->getLogger('block_content')->warning('A user was redirected from %old_path. This redirect will be removed in a future version of Drupal. Update links, shortcuts, and bookmarks to use %new_path. See %change_record for more information.', $params);

    return $helper->redirect();
  }

  /** * Provides a redirect to the content block library. * * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * A route match object, used for the route name and the parameters. * @param \Symfony\Component\HttpFoundation\Request $request * The current request object. * * @return \Symfony\Component\HttpFoundation\RedirectResponse * * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use * /admin/content/block directly instead of * /admin/structure/block/block-content. * * @see https://www.drupal.org/node/3320855 */
if (!\in_array($this->context->getMethod()['HEAD', 'GET'], true)) {
                throw $e;
            }

            if ($this->allowSchemes) {
                redirect_scheme:
                $scheme = $this->context->getScheme();
                $this->context->setScheme(current($this->allowSchemes));
                try {
                    $ret = parent::match($pathinfo);

                    return $this->redirect($pathinfo$ret['_route'] ?? null, $this->context->getScheme()) + $ret;
                } catch (ExceptionInterface) {
                    throw $e;
                } finally {
                    $this->context->setScheme($scheme);
                }
            } elseif ('/' === $trimmedPathinfo = rtrim($pathinfo, '/') ?: '/') {
                throw $e;
            } else {
                try {
                    $pathinfo = $trimmedPathinfo === $pathinfo ? $pathinfo.'/' : $trimmedPathinfo;
                    $ret = parent::match($pathinfo);

                    
/** @var Slim $app */
$app = $container->get('app');

$app->hook('slim.before.dispatch', function D) use ($app$container) {
    $baseUrl = CommonUtils::getBaseUrl($app);

    $lang = null;
    if (!UPDATE_IS_MANUAL) {
        if (!is_file(UPDATE_META_FILE)) {
            $shopPath = str_replace('/recovery/update', '/', $app->request()->getRootUri());
            $app->response()->redirect($shopPath);
            $app->response()->status(302);
            $app->stop();
        }

        $file = file_get_contents(UPDATE_META_FILE);
        $updateConfig = json_decode($file, true);
        $container->setParameter('update.config', $updateConfig);
        $lang = substr($updateConfig['locale'], 0, 2);
    }

    session_set_cookie_params(7200, $baseUrl);

    

  public function resetPass(Request $request$uid$timestamp$hash) {
    $account = $this->currentUser();
    // When processing the one-time login link, we have to make sure that a user     // isn't already logged in.     if ($account->isAuthenticated()) {
      // The current user is already logged in.       if ($account->id() == $uid) {
        user_logout();
        // We need to begin the redirect process again because logging out will         // destroy the session.         return $this->redirect(
          'user.reset',
          [
            'uid' => $uid,
            'timestamp' => $timestamp,
            'hash' => $hash,
          ]
        );
      }
      // A different user is already logged in on the computer.       else {
        /** @var \Drupal\user\UserInterface $reset_link_user */
        
$uri = URI::createURIString(
            'https',
            $authority,
            $request->getUri()->getPath(), // Absolute URIs should use a "/" for an empty path             $request->getUri()->getQuery(),
            $request->getUri()->getFragment()
        );

        // Set an HSTS header         $response->setHeader('Strict-Transport-Security', 'max-age=' . $duration)
            ->redirect($uri)
            ->setStatusCode(307)
            ->setBody('')
            ->getCookieStore()
            ->clear();

        throw new RedirectException($response);
    }
}

if (function_exists('function_usable')) {
    /** * Function usable * * Executes a function_exists() check, and if the Suhosin PHP * extension is loaded - checks whether the function that is * checked might be disabled in there as well. * * This is useful as function_exists() will return FALSE for * functions disabled via the *disable_functions* php.ini * setting, but not for *suhosin.executor.func.blacklist* and * *suhosin.executor.disable_eval*. These settings will just * terminate script execution if a disabled function is executed. * * The above described behavior turned out to be a bug in Suhosin, * but even though a fix was committed for 0.9.34 on 2012-02-12, * that version is yet to be released. This function will therefore * be just temporary, but would probably be kept for a few years. * * @see http://www.hardened-php.net/suhosin/ * * @param string $functionName Function to check for * * @return bool TRUE if the function exists and is safe to call, * FALSE otherwise. * * @codeCoverageIgnore This is too exotic */
$this->View()->loadTemplate('frontend/blog/' . $type . '.tpl');
        }

        $categoryContent = $this->get('modules')->Categories()->sGetCategoryContent($categoryId);

        // Make sure the category exists and is a blog category         if (empty($categoryContent) || !$categoryContent['blog']) {
            throw new Enlight_Controller_Exception(sprintf('Blog category by id "%d" is invalid', $categoryId), 404);
        }

        if (!empty($categoryContent['external'])) {
            $this->redirect($categoryContent['external']['code' => 301]);

            return;
        }

        $assigningData = [
            'sBanner' => $this->get('modules')->Marketing()->sBanner($categoryId),
            'sBreadcrumb' => $this->getCategoryBreadcrumb($categoryId),
            'sCategoryContent' => $categoryContent,
            'sNumberArticles' => $totalResult,
            'sPage' => $page,
            'sPerPage' => $perPage,
            

        return new RedirectResponse($url$status);
    }

    /** * Returns a RedirectResponse to the given route with the given parameters. * * @param int $status The HTTP status code (302 "Found" by default) */
    protected function redirectToRoute(string $route, array $parameters = [], int $status = 302): RedirectResponse
    {
        return $this->redirect($this->generateUrl($route$parameters)$status);
    }

    /** * Returns a JsonResponse that uses the serializer component if enabled, or json_encode. * * @param int $status The HTTP status code (200 "OK" by default) */
    protected function json(mixed $data, int $status = 200, array $headers = [], array $context = []): JsonResponse
    {
        if ($this->container->has('serializer')) {
            $json = $this->container->get('serializer')->serialize($data, 'json', array_merge([
                
if (!\in_array($this->context->getMethod()['HEAD', 'GET'], true)) {
                throw $e;
            }

            if ($this->allowSchemes) {
                redirect_scheme:
                $scheme = $this->context->getScheme();
                $this->context->setScheme(current($this->allowSchemes));
                try {
                    $ret = parent::match($pathinfo);

                    return $this->redirect($pathinfo$ret['_route'] ?? null, $this->context->getScheme()) + $ret;
                } catch (ExceptionInterface) {
                    throw $e;
                } finally {
                    $this->context->setScheme($scheme);
                }
            } elseif ('/' === $trimmedPathinfo = rtrim($pathinfo, '/') ?: '/') {
                throw $e;
            } else {
                try {
                    $pathinfo = $trimmedPathinfo === $pathinfo ? $pathinfo.'/' : $trimmedPathinfo;
                    $ret = parent::match($pathinfo);

                    
$url = $this->Front()->ensureRouter()->assemble([
            'action' => 'performOrderRedirect',
            'hash' => $hash,
            'fullPath' => true,
        ]);

        if ($shop->getHost()) {
            // change the url to the subshop url             $url = str_replace('://' . $this->Request()->getHttpHost(), '://' . $shop->getHost()$url);
        }

        $this->redirect($url);
    }

    /** * This Action can be called with a different domain. * So domain depending cookies can be changed. * This is needed when the users want's to perform an order on a different domain. * For example in a different Subshop */
    public function performOrderRedirectAction()
    {
        $hash = $this->Request()->getQuery('hash');

        
Home | Imprint | This part of the site doesn't use cookies.