|
From: Greg M. <bli...@us...> - 2008-07-11 17:32:59
|
Update of /cvsroot/phpwebsite-comm/modules/openid/class/Auth In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26802 Modified Files: OpenID.php Log Message: Upgrade to PHP OpenID 2.1.1 Index: OpenID.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/openid/class/Auth/OpenID.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OpenID.php 4 Feb 2008 04:54:31 -0000 1.1.1.1 --- OpenID.php 11 Jul 2008 17:32:36 -0000 1.2 *************** *** 14,20 **** * @package OpenID * @author JanRain, Inc. <op...@ja...> ! * @copyright 2005 Janrain, Inc. ! * @license http://www.gnu.org/copyleft/lesser.html LGPL */ /** --- 14,25 ---- * @package OpenID * @author JanRain, Inc. <op...@ja...> ! * @copyright 2005-2008 Janrain, Inc. ! * @license http://www.apache.org/licenses/LICENSE-2.0 Apache ! */ ! ! /** ! * The library version string */ + define('Auth_OpenID_VERSION', '2.1.1'); /** *************** *** 24,27 **** --- 29,33 ---- require_once "Auth/Yadis/ParanoidHTTPFetcher.php"; require_once "Auth/OpenID/BigMath.php"; + require_once "Auth/OpenID/URINorm.php"; /** *************** *** 203,211 **** return true; } else { ! if (Auth_OpenID::ensureDir(dirname($dir_name))) { ! return is_dir($dir_name) || @mkdir($dir_name); ! } else { ! return false; } } } --- 209,220 ---- return true; } else { ! $parent_dir = dirname($dir_name); ! ! // Terminal case; there is no parent directory to create. ! if ($parent_dir == $dir_name) { ! return true; } + + return (Auth_OpenID::ensureDir($parent_dir) && @mkdir($dir_name)); } } *************** *** 345,380 **** /** - * Turn a string into an ASCII string. - * - * Replace non-ascii characters with a %-encoded, UTF-8 - * encoding. This function will fail if the input is a string and - * there are non-7-bit-safe characters. It is assumed that the - * caller will have already translated the input into a Unicode - * character sequence, according to the encoding of the HTTP POST - * or GET. - * - * Do not escape anything that is already 7-bit safe, so we do the - * minimal transform on the identity URL - * - * @access private - */ - function quoteMinimal($s) - { - $res = array(); - for ($i = 0; $i < strlen($s); $i++) { - $c = $s[$i]; - if ($c >= "\x80") { - for ($j = 0; $j < count(utf8_encode($c)); $j++) { - array_push($res, sprintf("%02X", ord($c[$j]))); - } - } else { - array_push($res, $c); - } - } - - return implode('', $res); - } - - /** * Implements python's urlunparse, which is not available in PHP. * Given the specified components of a URL, this function rebuilds --- 354,357 ---- *************** *** 438,497 **** function normalizeUrl($url) { ! if ($url === null) { ! return null; ! } ! ! assert(is_string($url)); ! ! $old_url = $url; ! $url = trim($url); ! ! if (strpos($url, "://") === false) { ! $url = "http://" . $url; ! } ! ! $parsed = @parse_url($url); ! if ($parsed === false) { return null; } ! $defaults = array( ! 'scheme' => '', ! 'host' => '', ! 'path' => '', ! 'query' => '', ! 'fragment' => '', ! 'port' => '' ! ); ! ! $parsed = array_merge($defaults, $parsed); ! ! if (($parsed['scheme'] == '') || ! ($parsed['host'] == '')) { ! if ($parsed['path'] == '' && ! $parsed['query'] == '') { return null; } ! ! $url = 'http://' + $url; ! $parsed = parse_url($url); ! ! $parsed = array_merge($defaults, $parsed); } ! $tail = array_map(array('Auth_OpenID', 'quoteMinimal'), ! array($parsed['path'], ! $parsed['query'])); ! if ($tail[0] == '') { ! $tail[0] = '/'; } ! ! $url = Auth_OpenID::urlunparse($parsed['scheme'], $parsed['host'], ! $parsed['port'], $tail[0], $tail[1]); ! ! assert(is_string($url)); ! ! return $url; } --- 415,440 ---- 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; } *************** *** 574,577 **** --- 517,552 ---- } } + + /** + * Wrap PHP's standard error_log functionality. Use this to + * perform all logging. It will interpolate any additional + * arguments into the format string before logging. + * + * @param string $format_string The sprintf format for the message + */ + 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") + { + return("<html>". + "<head><title>". + $title . + "</title></head>". + "<body onload='document.forms[0].submit();'>". + $form . + "<script>". + "var elements = document.forms[0].elements;". + "for (var i = 0; i < elements.length; i++) {". + " elements[i].style.display = \"none\";". + "}". + "</script>". + "</body>". + "</html>"); + } } ?> |