From bdcba87db66aefe7ee7d1da3e29f5f984727d297 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 5 Sep 2005 19:43:01 +0000 Subject: [PATCH] #3344: Redirected terms cannot be included in categories No more strip the whole text when magicword #REDIRECT is found in a text. Let you categorize redirects but might let some vandals use #REDIRECT in the middle of a text. --- includes/Article.php | 12 +----------- includes/Title.php | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index b8e38e1dd7..d8be97a6d7 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1227,17 +1227,7 @@ class Article { } $isminor = ( $minor && $wgUser->isLoggedIn() ); - if ( $this->isRedirect( $text ) ) { - # Remove all content but redirect - # This could be done by reconstructing the redirect from a title given by - # Title::newFromRedirect(), but then we wouldn't know which synonym the user - # wants to see - if ( preg_match( "/^((" . $wgMwRedir->getBaseRegex() . ')[^\\n]+)/i', $text, $m ) ) { - $redir = 1; - $text = $m[1] . "\n"; - } - } - else { $redir = 0; } + $redir = $this->isRedirect( $text ) ? 1 : 0; $text = $this->preSaveTransform( $text ); $dbw =& wfGetDB( DB_MASTER ); diff --git a/includes/Title.php b/includes/Title.php index 0721c1cab7..3da010dd0c 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -267,7 +267,7 @@ class Title { function newFromRedirect( $text ) { global $wgMwRedir; $rt = NULL; - if ( $wgMwRedir->matchStart( $text ) ) { + if ( $wgMwRedir->match( $text ) ) { if ( preg_match( '/\[{2}(.*?)(?:\||\]{2})/', $text, $m ) ) { # categories are escaped using : for example one can enter: # #REDIRECT [[:Category:Music]]. Need to remove it. -- 2.20.1