X-Git-Url: https://git.toastfreeware.priv.at/toast/cookiecaptcha.git/blobdiff_plain/3f4919ad5822525e88136b46d7a3bfa02a90d497..def5670e9b43c6204d0fc36ea236f3b7910bd820:/ConfirmEdit.php diff --git a/ConfirmEdit.php b/ConfirmEdit.php index 55fa2fb..f6cab65 100644 --- a/ConfirmEdit.php +++ b/ConfirmEdit.php @@ -486,22 +486,16 @@ class SimpleCaptcha { */ function filterLink( $url ) { global $wgCaptchaWhitelist; - $whitelist = false; $source = wfMsgForContent( 'captcha-addurl-whitelist' ); - if( $source && $source != '<captcha-addurl-whitelist>' ) { - $whitelist = $this->buildRegexes( explode( "\n", $source ) ); - } + $whitelist = wfEmptyMsg( 'captcha-addurl-whitelist', $source ) + ? false + : $this->buildRegexes( explode( "\n", $source ) ); - if ( $whitelist === false && $wgCaptchaWhitelist === false ) { - // $whitelist is empty, $wgCaptchaWhitelist is default - return true; - } elseif ( $whitelist === false && $wgCaptchaWhitelist !== false ) { - // $whitelist is empty - return !( preg_match( $wgCaptchaWhitelist, $url ) ); - } else { - return !( preg_match( $wgCaptchaWhitelist, $url ) || preg_match( $whitelist, $url ) ); - } + $cwl = $wgCaptchaWhitelist !== false ? preg_match( $wgCaptchaWhitelist, $url ) : false; + $wl = $whitelist !== false ? preg_match( $whitelist, $url ) : false; + + return !( $cwl || $wl ); } /** @@ -781,4 +775,4 @@ class CaptchaCacheStore { } # End invocation guard -?> +