From 1c974f646f8628595c85f1074438f38f4aa4fd97 Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Tue, 1 Jun 2004 19:51:22 +0000 Subject: [PATCH] enable redirects for urlencoded anchor names --- includes/EditPage.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index a082c6592d..68e1b9dff2 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -204,11 +204,12 @@ class EditPage { $hasmatch = preg_match( "/^ *([=]{1,6})(.*?)(\\1) *\\n/i", $this->textbox1, $matches ); # we can't deal with anchors, includes, html etc in the header for now, # headline would need to be parsed to improve this - if($hasmatch and strlen($matches[2]) > 0 and !preg_match( "/[\\['{<>]/", $matches[2])) { + #if($hasmatch and strlen($matches[2]) > 0 and !preg_match( "/[\\['{<>]/", $matches[2])) { + if($hasmatch and strlen($matches[2]) > 0) { global $wgInputEncoding; $headline = do_html_entity_decode( $matches[2], ENT_COMPAT, $wgInputEncoding ); - # strip out HTML, will be useful when - # $headline = preg_replace( "/<.*?" . ">/","",$headline ); + # strip out HTML + $headline = preg_replace( "/<.*?" . ">/","",$headline ); $headline = trim( $headline ); $sectionanchor = '#'.preg_replace("/[ \\?&\\/<>\\(\\)\\[\\]=,+']+/", '_', urlencode( $headline ) ); } -- 2.20.1