X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=extlib%2FAuth%2FOpenID.php;h=c9d9779624dd13096f4ccc2dfc13c7aae623383b;hb=0503bcb0e2dd75de10a74ee5fc12d1523a44b028;hp=db6164256f801412c6b2c23faebcec9673d39cef;hpb=86560eeb3db60f39b0e1f3ef011819e5f3172101;p=quix0rs-gnu-social.git diff --git a/extlib/Auth/OpenID.php b/extlib/Auth/OpenID.php index db6164256f..c9d9779624 100644 --- a/extlib/Auth/OpenID.php +++ b/extlib/Auth/OpenID.php @@ -20,7 +20,7 @@ /** * The library version string */ -define('Auth_OpenID_VERSION', '2.1.3'); +define('Auth_OpenID_VERSION', '2.2.2'); /** * Require the fetcher code. @@ -102,9 +102,7 @@ define('Auth_OpenID_digits', define('Auth_OpenID_punct', "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"); -if (Auth_OpenID_getMathLib() === null) { - Auth_OpenID_setNoMathSupport(); -} +Auth_OpenID_include_init(); /** * The OpenID utility function class. @@ -120,7 +118,7 @@ class Auth_OpenID { * * @access private */ - function isFailure($thing) + static function isFailure($thing) { return is_a($thing, 'Auth_OpenID_FailureResponse'); } @@ -139,9 +137,12 @@ class Auth_OpenID { * Returns an empty array if neither GET nor POST was used, or if * POST was used but php://input cannot be opened. * + * See background: + * http://lists.openidenabled.com/pipermail/dev/2007-March/000395.html + * * @access private */ - function getQuery($query_str=null) + static function getQuery($query_str=null) { $data = array(); @@ -177,7 +178,7 @@ class Auth_OpenID { return $data; } - function params_from_string($str) + static function params_from_string($str) { $chunks = explode("&", $str); @@ -190,7 +191,7 @@ class Auth_OpenID { } list($k, $v) = $parts; - $data[$k] = urldecode($v); + $data[urldecode($k)] = urldecode($v); } return $data; @@ -203,7 +204,7 @@ class Auth_OpenID { * * @access private */ - function ensureDir($dir_name) + static function ensureDir($dir_name) { if (is_dir($dir_name) || @mkdir($dir_name)) { return true; @@ -225,7 +226,7 @@ class Auth_OpenID { * * @access private */ - function addPrefix($values, $prefix) + static function addPrefix($values, $prefix) { $new_values = array(); foreach ($values as $s) { @@ -241,7 +242,7 @@ class Auth_OpenID { * * @access private */ - function arrayGet($arr, $key, $fallback = null) + static function arrayGet($arr, $key, $fallback = null) { if (is_array($arr)) { if (array_key_exists($key, $arr)) { @@ -261,7 +262,7 @@ class Auth_OpenID { /** * Replacement for PHP's broken parse_str. */ - function parse_str($query) + static function parse_str($query) { if ($query === null) { return null; @@ -278,7 +279,7 @@ class Auth_OpenID { } list($key, $value) = $pair; - $new_parts[$key] = urldecode($value); + $new_parts[urldecode($key)] = urldecode($value); } return $new_parts; @@ -295,7 +296,7 @@ class Auth_OpenID { * pairs from $data into a URL query string * (e.g. "username=bob&id=56"). */ - function httpBuildQuery($data) + static function httpBuildQuery($data) { $pairs = array(); foreach ($data as $key => $value) { @@ -323,7 +324,7 @@ class Auth_OpenID { * @return string $url The original URL with the new parameters added. * */ - function appendArgs($url, $args) + static function appendArgs($url, $args) { if (count($args) == 0) { return $url; @@ -367,7 +368,7 @@ class Auth_OpenID { * @return string $url The URL resulting from assembling the * specified components. */ - function urlunparse($scheme, $host, $port = null, $path = '/', + static function urlunparse($scheme, $host, $port = null, $path = '/', $query = '', $fragment = '') { @@ -412,7 +413,7 @@ class Auth_OpenID { * @return mixed $new_url The URL after normalization, or null if * $url was malformed. */ - function normalizeUrl($url) + static function normalizeUrl($url) { @$parsed = parse_url($url); @@ -443,7 +444,7 @@ class Auth_OpenID { * * @access private */ - function intval($value) + static function intval($value) { $re = "/^\\d+$/"; @@ -461,7 +462,7 @@ class Auth_OpenID { * @param string $str The string of bytes to count. * @return int The number of bytes in $str. */ - function bytes($str) + static function bytes($str) { return strlen(bin2hex($str)) / 2; } @@ -470,7 +471,7 @@ class Auth_OpenID { * Get the bytes in a string independently of multibyte support * conditions. */ - function toBytes($str) + static function toBytes($str) { $hex = bin2hex($str); @@ -486,7 +487,7 @@ class Auth_OpenID { return $b; } - function urldefrag($url) + static function urldefrag($url) { $parts = explode("#", $url, 2); @@ -497,7 +498,7 @@ class Auth_OpenID { } } - function filter($callback, &$sequence) + static function filter($callback, &$sequence) { $result = array(); @@ -510,7 +511,7 @@ class Auth_OpenID { return $result; } - function update(&$dest, &$src) + static function update(&$dest, &$src) { foreach ($src as $k => $v) { $dest[$k] = $v; @@ -524,14 +525,14 @@ class Auth_OpenID { * * @param string $format_string The sprintf format for the message */ - function log($format_string) + static function log($format_string) { $args = func_get_args(); $message = call_user_func_array('sprintf', $args); error_log($message); } - function autoSubmitHTML($form, $title="OpenId transaction in progress") + static function autoSubmitHTML($form, $title="OpenId transaction in progress") { return("". "". @@ -549,4 +550,14 @@ class Auth_OpenID { "</html>"); } } -?> + +/* + * Function to run when this file is included. + * Abstracted to a function to make life easier + * for some PHP optimizers. + */ +function Auth_OpenID_include_init() { + if (Auth_OpenID_getMathLib() === null) { + Auth_OpenID_setNoMathSupport(); + } +}