Auth/OpenID/URINorm.php-Dateireferenz

gehe zum Quellcode dieser Datei

Namensbereiche

namespace  OpenID

Funktionen

 Auth_OpenID_getURIPattern ()
 Auth_OpenID_getAuthorityPattern ()
 Auth_OpenID_getEncodedPattern ()
 Auth_OpenID_getURLIllegalCharRE ()
 Auth_OpenID_getUnreserved ()
 Auth_OpenID_getEscapeRE ()
 Auth_OpenID_pct_encoded_replace_unreserved ($mo)
 Auth_OpenID_pct_encoded_replace ($mo)
 Auth_OpenID_remove_dot_segments ($path)
 Auth_OpenID_urinorm ($uri)


Dokumentation der Funktionen

Auth_OpenID_getAuthorityPattern (  ) 

Definiert in Zeile 20 der Datei URINorm.php.

00021 {
00022     return '/^([^@]*@)?([^:]*)(:.*)?/';
00023 }

Auth_OpenID_getEncodedPattern (  ) 

Definiert in Zeile 25 der Datei URINorm.php.

00026 {
00027     return '/%([0-9A-Fa-f]{2})/';
00028 }

Auth_OpenID_getEscapeRE (  ) 

Definiert in Zeile 68 der Datei URINorm.php.

00069 {
00070     $parts = array();
00071     foreach (array_merge(Auth_Yadis_getUCSChars(),
00072                          Auth_Yadis_getIPrivateChars()) as $pair) {
00073         list($m, $n) = $pair;
00074         $parts[] = sprintf("%s-%s", chr($m), chr($n));
00075     }
00076 
00077     return sprintf('[%s]', implode('', $parts));
00078 }

Auth_OpenID_getUnreserved (  ) 

Definiert in Zeile 41 der Datei URINorm.php.

00042 {
00043     $_unreserved = array();
00044     for ($i = 0; $i < 256; $i++) {
00045         $_unreserved[$i] = false;
00046     }
00047 
00048     for ($i = ord('A'); $i <= ord('Z'); $i++) {
00049         $_unreserved[$i] = true;
00050     }
00051 
00052     for ($i = ord('0'); $i <= ord('9'); $i++) {
00053         $_unreserved[$i] = true;
00054     }
00055 
00056     for ($i = ord('a'); $i <= ord('z'); $i++) {
00057         $_unreserved[$i] = true;
00058     }
00059 
00060     $_unreserved[ord('-')] = true;
00061     $_unreserved[ord('.')] = true;
00062     $_unreserved[ord('_')] = true;
00063     $_unreserved[ord('~')] = true;
00064 
00065     return $_unreserved;
00066 }

Auth_OpenID_getURIPattern (  ) 

Definiert in Zeile 15 der Datei URINorm.php.

00016 {
00017     return '&^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?&';
00018 }

Auth_OpenID_getURLIllegalCharRE (  ) 

Definiert in Zeile 36 der Datei URINorm.php.

00037 {
00038     return "/([^-A-Za-z0-9:\/\?#\[\]@\!\$&'\(\)\*\+,;=\._~\%])/";
00039 }

Auth_OpenID_pct_encoded_replace ( mo  ) 

Definiert in Zeile 94 der Datei URINorm.php.

00095 {
00096     return chr(intval($mo[1], 16));
00097 }

Auth_OpenID_pct_encoded_replace_unreserved ( mo  ) 

Definiert in Zeile 80 der Datei URINorm.php.

00081 {
00082     $_unreserved = Auth_OpenID_getUnreserved();
00083 
00084     $i = intval($mo[1], 16);
00085     if ($_unreserved[$i]) {
00086         return chr($i);
00087     } else {
00088         return strtoupper($mo[0]);
00089     }
00090 
00091     return $mo[0];
00092 }

Auth_OpenID_remove_dot_segments ( path  ) 

Definiert in Zeile 99 der Datei URINorm.php.

00100 {
00101     $result_segments = array();
00102 
00103     while ($path) {
00104         if (Auth_Yadis_startswith($path, '../')) {
00105             $path = substr($path, 3);
00106         } else if (Auth_Yadis_startswith($path, './')) {
00107             $path = substr($path, 2);
00108         } else if (Auth_Yadis_startswith($path, '/./')) {
00109             $path = substr($path, 2);
00110         } else if ($path == '/.') {
00111             $path = '/';
00112         } else if (Auth_Yadis_startswith($path, '/../')) {
00113             $path = substr($path, 3);
00114             if ($result_segments) {
00115                 array_pop($result_segments);
00116             }
00117         } else if ($path == '/..') {
00118             $path = '/';
00119             if ($result_segments) {
00120                 array_pop($result_segments);
00121             }
00122         } else if (($path == '..') ||
00123                    ($path == '.')) {
00124             $path = '';
00125         } else {
00126             $i = 0;
00127             if ($path[0] == '/') {
00128                 $i = 1;
00129             }
00130             $i = strpos($path, '/', $i);
00131             if ($i === false) {
00132                 $i = strlen($path);
00133             }
00134             $result_segments[] = substr($path, 0, $i);
00135             $path = substr($path, $i);
00136         }
00137     }
00138 
00139     return implode('', $result_segments);
00140 }

Auth_OpenID_urinorm ( uri  ) 

Definiert in Zeile 142 der Datei URINorm.php.

00143 {
00144     $uri_matches = array();
00145     preg_match(Auth_OpenID_getURIPattern(), $uri, $uri_matches);
00146 
00147     if (count($uri_matches) < 9) {
00148         for ($i = count($uri_matches); $i <= 9; $i++) {
00149             $uri_matches[] = '';
00150         }
00151     }
00152 
00153     $illegal_matches = array();
00154     preg_match(Auth_OpenID_getURLIllegalCharRE(),
00155                $uri, $illegal_matches);
00156     if ($illegal_matches) {
00157         return null;
00158     }
00159 
00160     $scheme = $uri_matches[2];
00161     if ($scheme) {
00162         $scheme = strtolower($scheme);
00163     }
00164 
00165     $scheme = $uri_matches[2];
00166     if ($scheme === '') {
00167         // No scheme specified
00168         return null;
00169     }
00170 
00171     $scheme = strtolower($scheme);
00172     if (!in_array($scheme, array('http', 'https'))) {
00173         // Not an absolute HTTP or HTTPS URI
00174         return null;
00175     }
00176 
00177     $authority = $uri_matches[4];
00178     if ($authority === '') {
00179         // Not an absolute URI
00180         return null;
00181     }
00182 
00183     $authority_matches = array();
00184     preg_match(Auth_OpenID_getAuthorityPattern(),
00185                $authority, $authority_matches);
00186     if (count($authority_matches) === 0) {
00187         // URI does not have a valid authority
00188         return null;
00189     }
00190 
00191     if (count($authority_matches) < 4) {
00192         for ($i = count($authority_matches); $i <= 4; $i++) {
00193             $authority_matches[] = '';
00194         }
00195     }
00196 
00197     list($_whole, $userinfo, $host, $port) = $authority_matches;
00198 
00199     if ($userinfo === null) {
00200         $userinfo = '';
00201     }
00202 
00203     if (strpos($host, '%') !== -1) {
00204         $host = strtolower($host);
00205         $host = preg_replace_callback(
00206                   Auth_OpenID_getEncodedPattern(),
00207                   'Auth_OpenID_pct_encoded_replace', $host);
00208         // NO IDNA.
00209         // $host = unicode($host, 'utf-8').encode('idna');
00210     } else {
00211         $host = strtolower($host);
00212     }
00213 
00214     if ($port) {
00215         if (($port == ':') ||
00216             ($scheme == 'http' && $port == ':80') ||
00217             ($scheme == 'https' && $port == ':443')) {
00218             $port = '';
00219         }
00220     } else {
00221         $port = '';
00222     }
00223 
00224     $authority = $userinfo . $host . $port;
00225 
00226     $path = $uri_matches[5];
00227     $path = preg_replace_callback(
00228                Auth_OpenID_getEncodedPattern(),
00229                'Auth_OpenID_pct_encoded_replace_unreserved', $path);
00230 
00231     $path = Auth_OpenID_remove_dot_segments($path);
00232     if (!$path) {
00233         $path = '/';
00234     }
00235 
00236     $query = $uri_matches[6];
00237     if ($query === null) {
00238         $query = '';
00239     }
00240 
00241     $fragment = $uri_matches[8];
00242     if ($fragment === null) {
00243         $fragment = '';
00244     }
00245 
00246     return $scheme . '://' . $authority . $path . $query . $fragment;
00247 }

Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen