From: Rob Church Date: Tue, 2 May 2006 00:41:30 +0000 (+0000) Subject: (bug 5782) Allow entries in the bad image list to use canonical namespace names X-Git-Tag: 1.31.0-rc.0~57277 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=9401ed5bb2465805d3fef979bdd4f80c28daad00;p=lhc%2Fweb%2Fwiklou.git (bug 5782) Allow entries in the bad image list to use canonical namespace names --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b50ecfcade..5b777fff08 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -183,6 +183,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 4876) Add __NEWSECTIONLINK__ magic word to force the "new section" link/tab to show up on specific pages on demand * Bidi-aid on list pages +* (bug 5782) Allow entries in the bad image list to use canonical namespace names == Compatibility == diff --git a/includes/Image.php b/includes/Image.php index 88ffbeb23b..4547a8c480 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1873,18 +1873,19 @@ function wfGetSVGsize( $filename ) { function wfIsBadImage( $name ) { global $wgContLang; static $titleList = false; - if ( $titleList === false ) { + + if( !$titleList ) { + # Build the list now $titleList = array(); - - $lines = explode("\n", wfMsgForContent( 'bad_image_list' )); - foreach ( $lines as $line ) { - if ( preg_match( '/^\*\s*\[{2}:(' . $wgContLang->getNsText( NS_IMAGE ) . ':.*?)\]{2}/', $line, $m ) ) { - $t = Title::newFromText( $m[1] ); - $titleList[$t->getDBkey()] = 1; + $lines = explode( "\n", wfMsgForContent( 'bad_image_list' ) ); + foreach( $lines as $line ) { + if( preg_match( '/^\*\s*\[\[:?(.*?)\]\]/i', $line, $matches ) ) { + $title = Title::newFromText( $matches[1] ); + if( is_object( $title ) && $title->getNamespace() == NS_IMAGE ) + $titleList[ $title->getDBkey() ] = true; } } } - return array_key_exists( $name, $titleList ); }