diff options
author | tailor <cygnus@cprogrammer.org> | 2007-11-26 19:56:28 +0000 |
---|---|---|
committer | tailor <cygnus@cprogrammer.org> | 2007-11-26 19:56:28 +0000 |
commit | 691ad461b09f249f2cbd4614c68576ebb303ea2f (patch) | |
tree | 994e94ca0199f583ee5c2a8168e53c8e8ab2276d | |
parent | 8d6f82a082e79462bfa1a4026479fbf38bcfc576 (diff) | |
download | php-openid-691ad461b09f249f2cbd4614c68576ebb303ea2f.zip php-openid-691ad461b09f249f2cbd4614c68576ebb303ea2f.tar.gz php-openid-691ad461b09f249f2cbd4614c68576ebb303ea2f.tar.bz2 |
[project @ [FIX #38] Replace direct usage of NO_MATH_SUPPORT with function calls]
-rw-r--r-- | Auth/OpenID.php | 4 | ||||
-rw-r--r-- | Auth/OpenID/Association.php | 2 | ||||
-rw-r--r-- | Auth/OpenID/BigMath.php | 16 | ||||
-rw-r--r-- | examples/detect.php | 5 |
4 files changed, 20 insertions, 7 deletions
diff --git a/Auth/OpenID.php b/Auth/OpenID.php index fd72db3..a1a0d43 100644 --- a/Auth/OpenID.php +++ b/Auth/OpenID.php @@ -97,7 +97,7 @@ define('Auth_OpenID_punct', "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"); if (Auth_OpenID_getMathLib() === null) { - define('Auth_OpenID_NO_MATH_SUPPORT', true); + Auth_OpenID_setNoMathSupport(); } /** @@ -574,4 +574,4 @@ class Auth_OpenID { } } } -?>
\ No newline at end of file +?> diff --git a/Auth/OpenID/Association.php b/Auth/OpenID/Association.php index 1bfe403..4d3ac33 100644 --- a/Auth/OpenID/Association.php +++ b/Auth/OpenID/Association.php @@ -423,7 +423,7 @@ function Auth_OpenID_getDefaultAssociationOrder() { $order = array(); - if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) { + if (!Auth_OpenID_noMathSupport()) { $order[] = array('HMAC-SHA1', 'DH-SHA1'); if (Auth_OpenID_HMACSHA256_SUPPORTED) { diff --git a/Auth/OpenID/BigMath.php b/Auth/OpenID/BigMath.php index 40de144..98815f5 100644 --- a/Auth/OpenID/BigMath.php +++ b/Auth/OpenID/BigMath.php @@ -427,7 +427,7 @@ function &Auth_OpenID_getMathLib() return $lib; } - if (defined('Auth_OpenID_NO_MATH_SUPPORT')) { + if (Auth_OpenID_noMathSupport()) { $null = null; return $null; } @@ -443,7 +443,7 @@ function &Auth_OpenID_getMathLib() } $triedstr = implode(", ", $tried); - define('Auth_OpenID_NO_MATH_SUPPORT', true); + Auth_OpenID_setNoMathSupport(); $result = null; return $result; @@ -456,4 +456,16 @@ function &Auth_OpenID_getMathLib() return $lib; } +function Auth_OpenID_setNoMathSupport() +{ + if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) { + define('Auth_OpenID_NO_MATH_SUPPORT', true); + } +} + +function Auth_OpenID_noMathSupport() +{ + return defined('Auth_OpenID_NO_MATH_SUPPORT'); +} + ?> diff --git a/examples/detect.php b/examples/detect.php index 07106e7..0d7fc77 100644 --- a/examples/detect.php +++ b/examples/detect.php @@ -194,8 +194,9 @@ function detect_math($r, &$out) $out .= $r->ol(array( 'Install the ' . $gmp_lnk . ' PHP extension', 'Install the ' . $bc_lnk . ' PHP extension', - 'If your site is low-security, define ' . - 'Auth_OpenID_NO_MATH_SUPPORT. The library will function, but ' . + 'If your site is low-security, call ' . + 'Auth_OpenID_setNoMathSupport(), defined in Auth/OpenID/BigMath.php. ', + 'The library will function, but ' . 'the security of your OpenID server will depend on the ' . 'security of the network links involved. If you are only ' . 'using consumer support, you should still be able to operate ' . |