當前位置: 首頁>>代碼示例>>PHP>>正文


PHP jUrl::getCurrentUrl方法代碼示例

本文整理匯總了PHP中jUrl::getCurrentUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP jUrl::getCurrentUrl方法的具體用法?PHP jUrl::getCurrentUrl怎麽用?PHP jUrl::getCurrentUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jUrl的用法示例。


在下文中一共展示了jUrl::getCurrentUrl方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: out

 /**
  *
  */
 function out()
 {
     $rep = $this->getResponse('redirectUrl');
     jAuth::logout();
     $conf = jApp::coord()->getPlugin('auth')->config;
     if ($conf['after_logout'] == '') {
         throw new jException('jauth~autherror.no.after_logout');
     }
     if (jApp::coord()->execOriginalAction()) {
         if ($conf['enable_after_logout_override']) {
             $url_return = $this->param('auth_url_return');
             if ($url_return) {
                 $rep->url = $url_return;
             } else {
                 $rep->url = jUrl::get($conf['after_logout']);
             }
         }
     } else {
         // we are here because of an internal redirection (authentication missing)
         // if we can indicate the url to go after the login, let's pass this url
         // to the next action (which is in most of case a login form)
         if ($conf['enable_after_login_override']) {
             $rep->url = jUrl::get($conf['after_logout'], array('auth_url_return' => jUrl::getCurrentUrl()));
         } else {
             $rep->url = jUrl::get($conf['after_logout']);
         }
     }
     return $rep;
 }
開發者ID:medali1990,項目名稱:medsite,代碼行數:32,代碼來源:login.classic.php

示例2: _prepareTpl

 protected function _prepareTpl()
 {
     $config = new \Jelix\JCommunity\Config();
     $this->_tpl->assign('canRegister', $config->isRegistrationEnabled());
     $this->_tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
     if (jAuth::isConnected()) {
         $this->_tpl->assign('login', jAuth::getUserSession()->login);
     } else {
         $conf = jAuth::loadConfig();
         $this->_tpl->assign('persistance_ok', jAuth::isPersistant());
         $form = jForms::get("jcommunity~login");
         if (!$form) {
             $form = jForms::create("jcommunity~login");
         }
         $this->_tpl->assign('form', $form);
         $this->_tpl->assign('url_return', '');
         if ($conf['enable_after_login_override']) {
             $req = jApp::coord()->request;
             if ($req->getParam('auth_url_return')) {
                 $this->_tpl->assign('url_return', $req->getParam('auth_url_return'));
             } else {
                 if ($this->param('as_main_content')) {
                     if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] && $_SERVER['HTTP_REFERER'] != jUrl::getCurrentUrl(false, true)) {
                         $this->_tpl->assign('url_return', $_SERVER['HTTP_REFERER']);
                     }
                 } else {
                     if ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') {
                         $this->_tpl->assign('url_return', jUrl::getCurrentUrl(false, true));
                     }
                 }
             }
         }
     }
 }
開發者ID:jelix,項目名稱:jcommunity-module,代碼行數:34,代碼來源:login.zone.php

示例3: out

 /**
  *
  */
 function out()
 {
     jAuth::logout();
     $conf = $GLOBALS['gJCoord']->getPlugin('auth')->config;
     if ($conf['after_logout'] == '') {
         throw new jException('jauth~autherror.no.after_logout');
     }
     $url_return = $this->param('auth_url_return');
     if (!$conf['enable_after_logout_override'] || $url_return == null || $url_return == jUrl::getCurrentUrl()) {
         // we don't want to return to the current page if authentification is missing for this page
         $url_return = jUrl::get($conf['after_logout'], array('auth_url_return' => $url_return));
     }
     $rep = $this->getResponse('redirectUrl');
     $rep->url = $url_return;
     return $rep;
 }
開發者ID:hadrienl,項目名稱:jelix,代碼行數:19,代碼來源:login.classic.php

示例4: beforeAction

 /**
  * @param    array  $params   plugin parameters for the current action
  * @return null or jSelectorAct  if action should change
  */
 public function beforeAction($params)
 {
     $notLogged = false;
     $badip = false;
     $selector = null;
     // Check if auth cookie exist and user isn't logged on
     if (isset($this->config['persistant_enable']) && $this->config['persistant_enable'] && !jAuth::isConnected()) {
         if (isset($this->config['persistant_cookie_name']) && isset($this->config['persistant_crypt_key'])) {
             $cookieName = $this->config['persistant_cookie_name'];
             if (isset($_COOKIE[$cookieName]['auth']) && strlen($_COOKIE[$cookieName]['auth']) > 0) {
                 $decrypted = jCrypt::decrypt($_COOKIE[$cookieName]['auth'], $this->config['persistant_crypt_key']);
                 $decrypted = @unserialize($decrypted);
                 if ($decrypted && is_array($decrypted)) {
                     list($login, $password) = $decrypted;
                     jAuth::login($login, $password);
                 }
             }
             if (isset($_COOKIE[$cookieName]['login'])) {
                 // destroy deprecated cookies
                 setcookie($cookieName . '[login]', '', time() - 3600, $this->config['persistant_cookie_path']);
                 setcookie($cookieName . '[passwd]', '', time() - 3600, $this->config['persistant_cookie_path']);
             }
         } else {
             throw new jException('jelix~auth.error.persistant.incorrectconfig', 'persistant_cookie_name, persistant_crypt_key');
         }
     }
     //Do we check the ip ?
     if ($this->config['secure_with_ip']) {
         if (!isset($_SESSION['JELIX_AUTH_SECURE_WITH_IP'])) {
             $_SESSION['JELIX_AUTH_SECURE_WITH_IP'] = $this->_getIpForSecure();
         } else {
             if ($_SESSION['JELIX_AUTH_SECURE_WITH_IP'] != $this->_getIpForSecure()) {
                 session_destroy();
                 $selector = new jSelectorAct($this->config['bad_ip_action']);
                 $notLogged = true;
                 $badip = true;
             }
         }
     }
     //Creating the user's object if needed
     if (!isset($_SESSION[$this->config['session_name']])) {
         $notLogged = true;
         $_SESSION[$this->config['session_name']] = new jAuthDummyUser();
     } else {
         $notLogged = !jAuth::isConnected();
     }
     if (!$notLogged && $this->config['timeout']) {
         if (isset($_SESSION['JELIX_AUTH_LASTTIME'])) {
             if (time() - $_SESSION['JELIX_AUTH_LASTTIME'] > $this->config['timeout'] * 60) {
                 $notLogged = true;
                 jAuth::logout();
                 unset($_SESSION['JELIX_AUTH_LASTTIME']);
             } else {
                 $_SESSION['JELIX_AUTH_LASTTIME'] = time();
             }
         } else {
             $_SESSION['JELIX_AUTH_LASTTIME'] = time();
         }
     }
     $needAuth = isset($params['auth.required']) ? $params['auth.required'] == true : $this->config['auth_required'];
     $authok = false;
     if ($needAuth) {
         if ($notLogged) {
             if ($this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
                 throw new jException($this->config['error_message']);
             } else {
                 if (!$badip) {
                     $auth_url_return = jApp::coord()->request->getParam('auth_url_return');
                     if ($auth_url_return === null) {
                         jApp::coord()->request->params['auth_url_return'] = jUrl::getCurrentUrl();
                     }
                     $selector = new jSelectorAct($this->config['on_error_action']);
                 }
             }
         } else {
             $authok = true;
         }
     } else {
         $authok = true;
     }
     return $selector;
 }
開發者ID:havefnubb,項目名稱:havefnubb,代碼行數:86,代碼來源:auth.coord.php

示例5: beforeAction

 /**
  * @param    array  $params   plugin parameters for the current action
  * @return null or jSelectorAct  if action should change
  */
 public function beforeAction($params)
 {
     $notLogged = false;
     $badip = false;
     $selector = null;
     // Check if auth cookie exist and user isn't logged on
     jAuth::checkCookieToken();
     //Do we check the ip ?
     if ($this->config['secure_with_ip']) {
         if (!isset($_SESSION['JELIX_AUTH_SECURE_WITH_IP'])) {
             $_SESSION['JELIX_AUTH_SECURE_WITH_IP'] = $this->_getIpForSecure();
         } else {
             if ($_SESSION['JELIX_AUTH_SECURE_WITH_IP'] != $this->_getIpForSecure()) {
                 session_destroy();
                 $selector = new jSelectorAct($this->config['bad_ip_action']);
                 $notLogged = true;
                 $badip = true;
             }
         }
     }
     //Creating the user's object if needed
     if (!isset($_SESSION[$this->config['session_name']])) {
         $notLogged = true;
         $_SESSION[$this->config['session_name']] = new jAuthDummyUser();
     } else {
         $notLogged = !jAuth::isConnected();
     }
     if (!$notLogged && $this->config['timeout']) {
         if (isset($_SESSION['JELIX_AUTH_LASTTIME'])) {
             if (time() - $_SESSION['JELIX_AUTH_LASTTIME'] > $this->config['timeout'] * 60) {
                 $notLogged = true;
                 jAuth::logout();
                 unset($_SESSION['JELIX_AUTH_LASTTIME']);
             } else {
                 $_SESSION['JELIX_AUTH_LASTTIME'] = time();
             }
         } else {
             $_SESSION['JELIX_AUTH_LASTTIME'] = time();
         }
     }
     $needAuth = isset($params['auth.required']) ? $params['auth.required'] == true : $this->config['auth_required'];
     if ($needAuth && $notLogged) {
         if ($this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
             throw new jException($this->config['error_message']);
         } elseif (jApp::coord()->request->isAjax() && !$badip) {
             if (isset($this->config['on_ajax_error_action']) && $this->config['on_ajax_error_action']) {
                 $auth_url_return = jApp::coord()->request->getParam('auth_url_return');
                 if ($auth_url_return === null) {
                     jApp::coord()->request->params['auth_url_return'] = jUrl::getCurrentUrl();
                 }
                 $selector = new jSelectorAct($this->config['on_ajax_error_action']);
             } else {
                 throw new jException($this->config['error_message']);
             }
         } elseif (!$badip) {
             $auth_url_return = jApp::coord()->request->getParam('auth_url_return');
             if ($auth_url_return === null) {
                 jApp::coord()->request->params['auth_url_return'] = jUrl::getCurrentUrl();
             }
             $selector = new jSelectorAct($this->config['on_error_action']);
         }
     }
     return $selector;
 }
開發者ID:jelix,項目名稱:jelix,代碼行數:68,代碼來源:auth.coord.php


注:本文中的jUrl::getCurrentUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。