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


PHP Auth_OpenID_urinorm函數代碼示例

本文整理匯總了PHP中Auth_OpenID_urinorm函數的典型用法代碼示例。如果您正苦於以下問題:PHP Auth_OpenID_urinorm函數的具體用法?PHP Auth_OpenID_urinorm怎麽用?PHP Auth_OpenID_urinorm使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: _parse

 /**
  * Parse a URL into its trust_root parts.
  *
  * @static
  *
  * @access private
  *
  * @param string $trust_root The url to parse
  *
  * @return mixed $parsed Either an associative array of trust root
  * parts or false if parsing failed.
  */
 function _parse($trust_root)
 {
     $trust_root = Auth_OpenID_urinorm($trust_root);
     if ($trust_root === null) {
         return false;
     }
     if (preg_match("/:\\/\\/[^:]+(:\\d+){2,}(\\/|\$)/", $trust_root)) {
         return false;
     }
     $parts = @parse_url($trust_root);
     if ($parts === false) {
         return false;
     }
     $required_parts = array('scheme', 'host');
     $forbidden_parts = array('user', 'pass', 'fragment');
     $keys = array_keys($parts);
     if (array_intersect($keys, $required_parts) != $required_parts) {
         return false;
     }
     if (array_intersect($keys, $forbidden_parts) != array()) {
         return false;
     }
     if (!preg_match(Auth_OpenID___HostSegmentRe, $parts['host'])) {
         return false;
     }
     $scheme = strtolower($parts['scheme']);
     $allowed_schemes = array('http', 'https');
     if (!in_array($scheme, $allowed_schemes)) {
         return false;
     }
     $parts['scheme'] = $scheme;
     $host = strtolower($parts['host']);
     $hostparts = explode('*', $host);
     switch (count($hostparts)) {
         case 1:
             $parts['wildcard'] = false;
             break;
         case 2:
             if ($hostparts[0] || $hostparts[1] && substr($hostparts[1], 0, 1) != '.') {
                 return false;
             }
             $host = $hostparts[1];
             $parts['wildcard'] = true;
             break;
         default:
             return false;
     }
     if (strpos($host, ':') !== false) {
         return false;
     }
     $parts['host'] = $host;
     if (isset($parts['path'])) {
         $path = strtolower($parts['path']);
         if (substr($path, 0, 1) != '/') {
             return false;
         }
     } else {
         $path = '/';
     }
     $parts['path'] = $path;
     if (!isset($parts['port'])) {
         $parts['port'] = false;
     }
     $parts['unparsed'] = $trust_root;
     return $parts;
 }
開發者ID:kaantunc,項目名稱:MYK-BOR,代碼行數:78,代碼來源:TrustRoot.php

示例2: _checkReturnTo

 /**
  * @access private
  */
 function _checkReturnTo($message, $return_to)
 {
     // Check an OpenID message and its openid.return_to value
     // against a return_to URL from an application.  Return True
     // on success, False on failure.
     // Check the openid.return_to args against args in the
     // original message.
     $result = Auth_OpenID_GenericConsumer::_verifyReturnToArgs($message->toPostArgs());
     if (Auth_OpenID::isFailure($result)) {
         return false;
     }
     // Check the return_to base URL against the one in the
     // message.
     $msg_return_to = $message->getArg(Auth_OpenID_OPENID_NS, 'return_to');
     if (Auth_OpenID::isFailure($return_to)) {
         // XXX log me
         return false;
     }
     $return_to_parts = parse_url(Auth_OpenID_urinorm($return_to));
     $msg_return_to_parts = parse_url(Auth_OpenID_urinorm($msg_return_to));
     // If port is absent from both, add it so it's equal in the
     // check below.
     if (!array_key_exists('port', $return_to_parts) && !array_key_exists('port', $msg_return_to_parts)) {
         $return_to_parts['port'] = null;
         $msg_return_to_parts['port'] = null;
     }
     // If path is absent from both, add it so it's equal in the
     // check below.
     if (!array_key_exists('path', $return_to_parts) && !array_key_exists('path', $msg_return_to_parts)) {
         $return_to_parts['path'] = null;
         $msg_return_to_parts['path'] = null;
     }
     // The URL scheme, authority, and path MUST be the same
     // between the two URLs.
     foreach (array('scheme', 'host', 'port', 'path') as $component) {
         // If the url component is absent in either URL, fail.
         // There should always be a scheme, host, port, and path.
         if (!array_key_exists($component, $return_to_parts)) {
             return false;
         }
         if (!array_key_exists($component, $msg_return_to_parts)) {
             return false;
         }
         if (Auth_OpenID::arrayGet($return_to_parts, $component) !== Auth_OpenID::arrayGet($msg_return_to_parts, $component)) {
             return false;
         }
     }
     return true;
 }
開發者ID:raphox,項目名稱:php-openid,代碼行數:52,代碼來源:Consumer.php

示例3: runTest

 function runTest()
 {
     $actual = Auth_OpenID_urinorm($this->uri);
     $this->assertEquals($this->expected, $actual);
 }
開發者ID:matheuscsc,項目名稱:finalproject,代碼行數:5,代碼來源:URINorm.php

示例4: normalizeUrl

 /**
  * Given a URL, this "normalizes" it by adding a trailing slash
  * and / or a leading http:// scheme where necessary.  Returns
  * null if the original URL is malformed and cannot be normalized.
  *
  * @access private
  * @param string $url The URL to be normalized.
  * @return mixed $new_url The URL after normalization, or null if
  * $url was malformed.
  */
 static function normalizeUrl($url)
 {
     @($parsed = parse_url($url));
     if (!$parsed) {
         return null;
     }
     if (isset($parsed['scheme']) && isset($parsed['host'])) {
         $scheme = strtolower($parsed['scheme']);
         if (!in_array($scheme, array('http', 'https'))) {
             return null;
         }
     } else {
         $url = 'http://' . $url;
     }
     $normalized = Auth_OpenID_urinorm($url);
     if ($normalized === null) {
         return null;
     }
     list($defragged, $frag) = Auth_OpenID::urldefrag($normalized);
     return $defragged;
 }
開發者ID:rb26,項目名稱:zenphoto,代碼行數:31,代碼來源:OpenID.php

示例5: doOpenIDValidate

 function doOpenIDValidate($openid)
 {
     // use the JanRain php-openid library
     require_once $this->module_path . 'php-openid-1.2.3/Auth/OpenID/URINorm.php';
     $oModuleModel =& getModel('module');
     $config = $oModuleModel->getModuleConfig('member');
     if ($config->enable_openid != 'Y') {
         $this->stop('msg_invalid_request');
     }
     ob_start();
     require $this->module_path . 'openid_lib/class.openid.php';
     require_once $this->module_path . 'openid_lib/libcurlemu.inc.php';
     $openid_ctx = new SimpleOpenID();
     $openid_ctx->SetIdentity(Auth_OpenID_urinorm($openid));
     $openid_ctx->validation_result = $openid_ctx->ValidateWithServer();
     ob_clean();
     return $openid_ctx;
 }
開發者ID:hottaro,項目名稱:xpressengine,代碼行數:18,代碼來源:member.controller.php

示例6: normalizeUrl

 function normalizeUrl($url)
 {
     return Auth_OpenID_urinorm($url);
 }
開發者ID:BGCX067,項目名稱:ezopenid-svn-to-git,代碼行數:4,代碼來源:ezopenid.php


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