Fix bugzilla bug #100. Redirects can be done to category either by:
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 21 Aug 2004 22:39:56 +0000 (22:39 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 21 Aug 2004 22:39:56 +0000 (22:39 +0000)
#REDIRECT [[Category:Music]]  (article will be in the category)
or
#REDIRECT [[:Category:Music]] (article left out of category)

includes/Title.php

index 198d5f9..010494b 100644 (file)
@@ -159,6 +159,13 @@ class Title {
                $rt = NULL;
                if ( $wgMwRedir->matchStart( $text ) ) {
                        if ( preg_match( '/\\[\\[([^\\]\\|]+)[\\]\\|]/', $text, $m ) ) {
+                               # categories are escaped using : for example one can enter:
+                               # #REDIRECT [[:Category:Music]]. Need to remove it.
+                               if ( substr($m[1],0,1) == ':') {
+                                       # We don't want to keep the ':'
+                                       $m[1] = substr( $m[1], 1 );
+                               }
+                               
                                $rt = Title::newFromText( $m[1] );
                        }
                }