当前位置: 首页>>代码示例>>PHP>>正文


PHP Helpers::redirect方法代码示例

本文整理汇总了PHP中Helpers::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::redirect方法的具体用法?PHP Helpers::redirect怎么用?PHP Helpers::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helpers的用法示例。


在下文中一共展示了Helpers::redirect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: userIsAuthorized

 public function userIsAuthorized($action)
 {
     // Dafür sorgen, dass eine Anfrage ggf. auf das Login weitergeleitet wird,
     // wenn die Session abgelaufen ist und nach erfolgtem Login nahtlos auf
     // die angeforderte Seite weitergeleitet wird
     if ($this->module_name != 'login' && !Auth::isLoggedIn()) {
         $_SESSION['pixelmanager_temp_login_redirect']['uri'] = $_SERVER['REQUEST_URI'];
         $_SESSION['pixelmanager_temp_login_redirect']['get'] = $_GET;
         $_SESSION['pixelmanager_temp_login_redirect']['post'] = $_POST;
         $_SESSION['pixelmanager_temp_login_redirect']['request'] = $_REQUEST;
         Helpers::redirect(Config::get()->baseUrl . 'admin/html-output/login');
     } else {
         if ($this->module_name != 'login') {
             if (isset($_SESSION['pixelmanager_temp_login_redirect'])) {
                 $_GET = $_SESSION['pixelmanager_temp_login_redirect']['get'];
                 $_POST = $_SESSION['pixelmanager_temp_login_redirect']['post'];
                 $_REQUEST = $_SESSION['pixelmanager_temp_login_redirect']['request'];
                 unset($_SESSION['pixelmanager_temp_login_redirect']);
             }
         }
     }
     // Wenn es sich um ein Zusatzmodul handelt, ggf. auf Zugangsberechtigung prüfen
     if ($this->isCustomBackendModule()) {
         $can_user_access = $this->canUserAccessCustomBackendModule();
         if ($can_user_access === false) {
             $this->accessDenied();
         }
         return $can_user_access;
     }
     // Anfrage wurde bis jetzt nicht abgefangen, also erstmal annehmen, dass der Zugriff erlaubt ist
     return true;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:32,代码来源:HtmlOutputController.php

示例2: beforeActionExecute

 private function beforeActionExecute()
 {
     $userId = (string) HttpContext::getInstance()->getSession()->userId;
     if ($userId !== "") {
         Helpers::redirect('');
     }
 }
开发者ID:k0ksi,项目名称:Web-Development-Basics-Project,代码行数:7,代码来源:AnonymousAnnotation.php

示例3: delete

 public static function delete($params)
 {
     Session::verifyCsrfToken(Helpers::select("token", $_GET));
     $post = DB::get("select id from posts p where p.id = :id", array("id" => $params["id"]));
     if (!$post) {
         Helpers::notFound();
     }
     DB::query("delete from posts where id = :id", array("id" => $params["id"]));
     $back_page = Helpers::select("page", $_GET, 1);
     Helpers::redirect("/posts/" . $back_page);
 }
开发者ID:solymosi,项目名称:bexio-exercise,代码行数:11,代码来源:postController.class.php

示例4: __construct

 public function __construct($super)
 {
     parent::__construct($super);
     $this->controller = $super->core->getConfig()['site_config']['homecontroller'];
     $this->method = $super->core->getConfig()['site_config']['homemethod'];
     $url = $this->parseUrl();
     if (file_exists('app/controllers/' . $url[0] . '.php')) {
         $this->controller = $url[0];
         unset($url[0]);
     }
     require_once '/app/controllers/' . $this->controller . '.php';
     $this->controller = new $this->controller($this->super);
     if ($this->controller->hasRestriction()) {
         $rows = $this->super->getAcl()->hasRoleArr($this->controller->restrictionRole);
         if (count($rows) == 0 || !$this->super->getAcl()->isLoggedin()) {
             // Geen toegang.
             Helpers::redirect('/harmstercms/');
         }
     }
     // try and set the layout
     if (isset($this->controller->layout)) {
         $this->layout = $this->controller->layout;
     }
     if (isset($url[1])) {
         if (method_exists($this->controller, $url[1])) {
             $this->method = $url[1];
             unset($url[1]);
         }
     }
     if (isset($this->controller->restrictMethods) && is_array($this->controller->restrictMethods)) {
         if (array_key_exists($this->method, $this->controller->restrictMethods)) {
             $restriction = $this->controller->restrictMethods[$this->method];
             if (!$this->super->getAcl()->hasRole($restriction)) {
                 var_dump($this->super->getAcl()->hasRole($restriction));
                 echo 'Hij komt hier';
                 //Helpers::redirect('/harmstercms/');
             }
         }
     }
     $this->params = $url ? array_values($url) : [];
     $result = call_user_func_array([$this->controller, $this->method], $this->params);
     $this->result = $result;
 }
开发者ID:Hawiak,项目名称:harmstercms,代码行数:43,代码来源:App.php

示例5: authenticateAction

 public function authenticateAction()
 {
     if (isset($_POST['login']) && isset($_POST['password'])) {
         if (Auth::login($_POST['login'], $_POST['password'])) {
             if (isset($_POST['language'])) {
                 if ($_POST['language'] != '') {
                     $_SESSION['pixelmanager']['backendLanguage'] = $_POST['language'];
                 } else {
                     $_SESSION['pixelmanager']['backendLanguage'] = Auth::getUserPreferredLanguage();
                 }
             }
             if (isset($_SESSION['pixelmanager_temp_login_redirect']['uri'])) {
                 Helpers::redirect($_SESSION['pixelmanager_temp_login_redirect']['uri']);
             } else {
                 Helpers::redirect(Config::get()->baseUrl . 'admin/html-output/main');
             }
         } else {
             $this->view->assign('error', true);
         }
     } else {
         $this->view->assign('error', true);
     }
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:23,代码来源:Login.php

示例6: defaultAction

 public function defaultAction()
 {
     Auth::logout();
     Helpers::redirect(Config::get()->baseUrl . 'admin/html-output/login');
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:5,代码来源:Logout.php

示例7: redirectWithMessage

 static function redirectWithMessage($link, $message)
 {
     Session::setMessage($message);
     Helpers::redirect($link);
 }
开发者ID:Hawiak,项目名称:harmstercms,代码行数:5,代码来源:Helpers.php

示例8: run

 public function run()
 {
     // Startup-Ereignis
     Plugins::call(Plugins::STARTUP, null);
     // Router laden
     $router_file_name = Config::get()->frontendRouter->classFile;
     if (!file_exists($router_file_name)) {
         Helpers::fatalError('Frontend router class file not found (' . $router_file_name . ' doesn\'t exist)!', true);
     }
     require_once $router_file_name;
     $router_class_name = Config::get()->frontendRouter->className;
     if (!class_exists($router_class_name)) {
         Helpers::fatalError('Frontend router class not found (class "' . $router_class_name . '" doesn\'t exist in ' . $router_file_name . ')!', true);
     }
     $router = new $router_class_name();
     Registry::set('frontendRouter', $router);
     // PageBuilder laden
     $page_builder_file_name = Config::get()->pageBuilder->classFile;
     if (!file_exists($page_builder_file_name)) {
         Helpers::fatalError('PageBuilder class file not found (' . $page_builder_file_name . ' doesn\'t exist)!', true);
     }
     require_once $page_builder_file_name;
     $page_builder_class_name = Config::get()->pageBuilder->className;
     if (!class_exists($page_builder_class_name)) {
         Helpers::fatalError('PageBuilder class not found (class "' . $page_builder_class_name . '" doesn\'t exist in ' . $page_builder_file_name . ')!', true);
     }
     $page_builder = new $page_builder_class_name();
     Registry::set('pageBuilder', $page_builder);
     // routing
     $router->route();
     $languageId = $router->getLanguageId();
     if ($router->pageFound()) {
         $pageId = $router->getPageId();
         $error_404 = false;
     } else {
         $pageId = $router->getErrorPageId();
         $error_404 = true;
     }
     if ($pageId !== false) {
         // Ist die Seite ein Link? Dann einfach auf die angegebene URL weiterleiten...
         if ($router->isPageLink()) {
             Helpers::redirect($router->getPageLinkUrl(), Config::get()->pageLinkRedirectionResponseCode);
             exit;
         }
         // �bersetzungen laden
         $config = Config::getArray();
         $languages = $config['languages']['list'];
         setlocale(LC_ALL, $languages[$languageId]['locale']);
         if (is_array($languages[$languageId]['translation'])) {
             if (count($languages[$languageId]['translation']) > 0) {
                 foreach ($languages[$languageId]['translation'] as $translation_file) {
                     Translate::loadStrings($translation_file, $languageId);
                 }
             }
         } else {
             if ($languages[$languageId]['translation'] != '') {
                 Translate::loadStrings($languages[$languageId]['translation'], $languageId);
             }
         }
         // Before-Display-Ereignis
         Plugins::call(Plugins::BEFORE_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
         if (!$router->isPreview()) {
             // Versuchen, die Seite aus dem Cache zu holen
             $output = PageCache::getPage($pageId, $languageId);
             $output_cached = false;
             // Keine Version im Cache verf�gbar, Seite neu erzeugen
             if ($output === false) {
                 $output = $page_builder->getPage($pageId, $languageId);
             } else {
                 $output_cached = true;
             }
             // Wenn noch nicht im Cache, erzeugte Ausgabe im Cache ablegen
             if (!$output_cached) {
                 PageCache::cachePage($pageId, $languageId, $output);
             }
         } else {
             // Im Vorschau-Modus den Cache nicht verwenden
             // Und dem PageBuilder sagen, dass er die Vorschau-Version erstellen soll
             $output = $page_builder->getPage($pageId, $languageId, true);
             $output_cached = false;
         }
         // HTTP-Header senden
         if ($error_404) {
             if (!headers_sent()) {
                 header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
             }
         }
         $page_builder->outputHeader($pageId, $languageId);
         // Header-Senden-Ereignis
         Plugins::call(Plugins::SEND_HEADER, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
         // Modify-Output-Before-Display-Ereignis, bietet die M�glichkeit,
         // dass ein Plugin die Ausgabe vor der Ausgabe nochmal ver�ndert,
         // unabh�ngig davon, ob die Seite aus dem Cache geladen wurde oder nicht
         Plugins::call(Plugins::MODIFY_OUTPUT_BEFORE_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId, 'isCached' => $output_cached), $output);
         // Seite ausgeben
         print $output;
         // After-Display-Ereignis
         Plugins::call(Plugins::AFTER_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
     } else {
         Helpers::fatalError('Error 404: page not found ', true);
//.........这里部分代码省略.........
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:101,代码来源:StandardFrontendController.php


注:本文中的Helpers::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。