From: Antoine Musso Date: Mon, 5 Sep 2005 20:03:19 +0000 (+0000) Subject: revert previous stuff. break things :) X-Git-Tag: 1.6.0~1714 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=73fd6b306736e8da05b80fb7d997b47b17453439;p=lhc%2Fweb%2Fwiklou.git revert previous stuff. break things :) --- diff --git a/includes/Article.php b/includes/Article.php index d8be97a6d7..b8e38e1dd7 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1227,7 +1227,17 @@ class Article { } $isminor = ( $minor && $wgUser->isLoggedIn() ); - $redir = $this->isRedirect( $text ) ? 1 : 0; + 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; } $text = $this->preSaveTransform( $text ); $dbw =& wfGetDB( DB_MASTER ); diff --git a/includes/Title.php b/includes/Title.php index 3da010dd0c..0721c1cab7 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -267,7 +267,7 @@ class Title { function newFromRedirect( $text ) { global $wgMwRedir; $rt = NULL; - if ( $wgMwRedir->match( $text ) ) { + if ( $wgMwRedir->matchStart( $text ) ) { if ( preg_match( '/\[{2}(.*?)(?:\||\]{2})/', $text, $m ) ) { # categories are escaped using : for example one can enter: # #REDIRECT [[:Category:Music]]. Need to remove it.