r23136 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23135‎ | r23136 | r23137 >
Date:20:54, 20 June 2007
Author:raymond
Status:old
Tags:
Comment:
Some tweaks per hint of Brion on wikitech-l
Modified paths:
  • /trunk/extensions/ConfirmEdit/ConfirmEdit.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmEdit/ConfirmEdit.php
@@ -486,22 +486,16 @@
487487 */
488488 function filterLink( $url ) {
489489 global $wgCaptchaWhitelist;
490 - $whitelist = false;
491490 $source = wfMsgForContent( 'captcha-addurl-whitelist' );
492491
493 - if( $source && $source != '<captcha-addurl-whitelist>' ) {
494 - $whitelist = $this->buildRegexes( explode( "\n", $source ) );
495 - }
 492+ $whitelist = wfEmptyMsg( 'captcha-addurl-whitelist', $source )
 493+ ? false
 494+ : $this->buildRegexes( explode( "\n", $source ) );
496495
497 - if ( $whitelist === false && $wgCaptchaWhitelist === false ) {
498 - // $whitelist is empty, $wgCaptchaWhitelist is default
499 - return true;
500 - } elseif ( $whitelist === false && $wgCaptchaWhitelist !== false ) {
501 - // $whitelist is empty
502 - return !( preg_match( $wgCaptchaWhitelist, $url ) );
503 - } else {
504 - return !( preg_match( $wgCaptchaWhitelist, $url ) || preg_match( $whitelist, $url ) );
505 - }
 496+ $cwl = $wgCaptchaWhitelist !== false ? preg_match( $wgCaptchaWhitelist, $url ) : false;
 497+ $wl = $whitelist !== false ? preg_match( $whitelist, $url ) : false;
 498+
 499+ return !( $cwl || $wl );
506500 }
507501
508502 /**

Status & tagging log