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


PHP URI::string方法代码示例

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


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

示例1: check

 /**
  * When visiting any page on the site, check if the user is already logged in,
  * or they are visiting a page that is allowed when logged out. Otherwise,
  * redirect to the login page. If visiting the login page, check the browser
  * supports cookies.
  */
 public function check()
 {
     $uri = new URI();
     // Skip check when accessing the data services, as it is redundant but would slow the services down.
     // Also no need to login when running the scheduled tasks.
     if ($uri->segment(1) == 'services' || $uri->segment(1) == 'scheduled_tasks') {
         return;
     }
     // check for setup request
     //
     if ($uri->segment(1) == 'setup_check') {
         // get kohana paths
         //
         $ipaths = Kohana::include_paths();
         // check if indicia_setup module folder exists
         //
         clearstatcache();
         foreach ($ipaths as $path) {
             if (preg_match("/indicia_setup/", $path) && file_exists($path)) {
                 return;
             }
         }
     }
     // Always logged in
     $auth = new Auth();
     if (!$auth->logged_in() and !$auth->auto_login() and $uri->segment(1) != 'login' and $uri->segment(1) != 'logout' and $uri->segment(1) != 'new_password' and $uri->segment(1) != 'forgotten_password') {
         $_SESSION['requested_page'] = $uri->string();
         url::redirect('login');
     } else {
         if ($auth->logged_in() and is_null($_SESSION['auth_user']->password) and $uri->segment(1) != 'new_password' and $uri->segment(1) != 'logout' and $uri->segment(1) != 'setup_check') {
             $_SESSION['requested_page'] = $uri->string();
             url::redirect('new_password');
         }
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:41,代码来源:login.php

示例2: login

 /**
  * Show invite only page if enabled
  */
 public function login()
 {
     $uri = new URI();
     // Redirect to invite page if not logged or signing in
     if (!in_array($uri->string(), array('invite', 'sign/in')) && strpos($uri->string(), 'sign/up') !== 0 && !Visitor::instance()->logged_in()) {
         // Stop execution if ajax, ie. expired session and trying to do ajax call
         if (request::is_ajax()) {
             exit;
         }
         url::redirect('invite');
     }
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:15,代码来源:invite_hook.php


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