Skip to content

Commit 691ad46

Browse files
author
tailor
committed
[project @ [FIX #38] Replace direct usage of NO_MATH_SUPPORT with function calls]
1 parent 8d6f82a commit 691ad46

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

Auth/OpenID.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
9898

9999
if (Auth_OpenID_getMathLib() === null) {
100-
define('Auth_OpenID_NO_MATH_SUPPORT', true);
100+
Auth_OpenID_setNoMathSupport();
101101
}
102102

103103
/**
@@ -574,4 +574,4 @@ function update(&$dest, &$src)
574574
}
575575
}
576576
}
577-
?>
577+
?>

Auth/OpenID/Association.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ function Auth_OpenID_getDefaultAssociationOrder()
423423
{
424424
$order = array();
425425

426-
if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
426+
if (!Auth_OpenID_noMathSupport()) {
427427
$order[] = array('HMAC-SHA1', 'DH-SHA1');
428428

429429
if (Auth_OpenID_HMACSHA256_SUPPORTED) {

Auth/OpenID/BigMath.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ function &Auth_OpenID_getMathLib()
427427
return $lib;
428428
}
429429

430-
if (defined('Auth_OpenID_NO_MATH_SUPPORT')) {
430+
if (Auth_OpenID_noMathSupport()) {
431431
$null = null;
432432
return $null;
433433
}
@@ -443,7 +443,7 @@ function &Auth_OpenID_getMathLib()
443443
}
444444
$triedstr = implode(", ", $tried);
445445

446-
define('Auth_OpenID_NO_MATH_SUPPORT', true);
446+
Auth_OpenID_setNoMathSupport();
447447

448448
$result = null;
449449
return $result;
@@ -456,4 +456,16 @@ function &Auth_OpenID_getMathLib()
456456
return $lib;
457457
}
458458

459+
function Auth_OpenID_setNoMathSupport()
460+
{
461+
if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
462+
define('Auth_OpenID_NO_MATH_SUPPORT', true);
463+
}
464+
}
465+
466+
function Auth_OpenID_noMathSupport()
467+
{
468+
return defined('Auth_OpenID_NO_MATH_SUPPORT');
469+
}
470+
459471
?>

examples/detect.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ function detect_math($r, &$out)
194194
$out .= $r->ol(array(
195195
'Install the ' . $gmp_lnk . ' PHP extension',
196196
'Install the ' . $bc_lnk . ' PHP extension',
197-
'If your site is low-security, define ' .
198-
'Auth_OpenID_NO_MATH_SUPPORT. The library will function, but ' .
197+
'If your site is low-security, call ' .
198+
'Auth_OpenID_setNoMathSupport(), defined in Auth/OpenID/BigMath.php. ',
199+
'The library will function, but ' .
199200
'the security of your OpenID server will depend on the ' .
200201
'security of the network links involved. If you are only ' .
201202
'using consumer support, you should still be able to operate ' .

0 commit comments

Comments
 (0)