Index: trunk/phase3/includes/Title.php |
— | — | @@ -2064,14 +2064,20 @@ |
2065 | 2065 | |
2066 | 2066 | # Namespace or interwiki prefix |
2067 | 2067 | $firstPass = true; |
| 2068 | + $prefixRegexp = "/^(.+?)_*:_*(.*)$/S"; |
2068 | 2069 | do { |
2069 | 2070 | $m = array(); |
2070 | | - if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $dbkey, $m ) ) { |
| 2071 | + if ( preg_match( $prefixRegexp, $dbkey, $m ) ) { |
2071 | 2072 | $p = $m[1]; |
2072 | | - if ( $ns = $wgContLang->getNsIndex( $p )) { |
| 2073 | + if ( $ns = $wgContLang->getNsIndex( $p ) ) { |
2073 | 2074 | # Ordinary namespace |
2074 | 2075 | $dbkey = $m[2]; |
2075 | 2076 | $this->mNamespace = $ns; |
| 2077 | + # For Talk:X pages, check if X has a "namespace" prefix |
| 2078 | + if( $ns == NS_TALK && preg_match( $prefixRegexp, $dbkey, $x ) ) { |
| 2079 | + if( $wgContLang->getNsIndex( $x[1] ) ) |
| 2080 | + return false; # Disallow Talk:File:x type titles... |
| 2081 | + } |
2076 | 2082 | } elseif( Interwiki::isValidInterwiki( $p ) ) { |
2077 | 2083 | if( !$firstPass ) { |
2078 | 2084 | # Can't make a local interwiki link to an interwiki link. |