Some tweaks per hint of Brion on wikitech-l
authorRaimond Spekking <raymond@users.mediawiki.org>
Wed, 20 Jun 2007 20:54:03 +0000 (20:54 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Wed, 20 Jun 2007 20:54:03 +0000 (20:54 +0000)
ConfirmEdit.php

index 55fa2fb5a3412909a289dc904ef2606305091f93..bb6f49cac78adda70e90d9b725f86f574d4d5a4e 100644 (file)
@@ -486,22 +486,16 @@ class SimpleCaptcha {
         */
        function filterLink( $url ) {
                global $wgCaptchaWhitelist;
-               $whitelist = false;
                $source = wfMsgForContent( 'captcha-addurl-whitelist' );
 
-               if( $source && $source != '&lt;captcha-addurl-whitelist&gt;' ) {
-                       $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 );
        }
 
        /**