r87 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86‎ | r87 | r88 >
Date:02:03, 8 February 2002
Author:vibber
Status:old
Tags:
Comment:
Fix for bad characters in page names
Modified paths:
  • /trunk/phpwiki/fpw/wikiTitle.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/wikiTitle.php
@@ -68,13 +68,20 @@
6969 if ( $s != "" ) $s .= ":" ;
7070 $s .= ucfirst ( trim ( $this->mainTitle ) ) ;
7171 if ( trim ( $this->subpageTitle ) != "" ) $s .= "/".trim($this->subpageTitle) ;
72 - $s = str_replace ( "\\\"" , "" , $s ) ;
73 - $s = str_replace ( "\"" , "" , $s ) ;
 72+
 73+ # Unescape apostrophes (does this always work?)
7474 $s = str_replace ( "\\'" , "'" , $s ) ;
7575
 76+ # Strip forbidden characters
 77+ $s = str_replace ( "\\\"" , "" , $s ) ;
 78+ #$s = str_replace ( "\"" , "" , $s ) ;
 79+ # All non-alpha ASCII chars: !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\127
 80+ # FIXME: Decide exactly which ones to forbid.
 81+ $s = preg_replace ( "/[\"\#\$\%\&\\<>\[\]\{\|\}\127]/", "", $s);
 82+
7683 # Make it compatible with old wiki
7784 $s = str_replace ( " " , "_" , $s ) ;
78 -
 85+
7986 # If you use $this->secureTitle in a URL, Satan will eat your soul with a blunt spoon.
8087 # I'm not kidding. Use $this->url instead or nurlencode() it if you're writing out a URL!
8188 # secureTitle ONLY belongs in SQL queries and comparisons therewith.

Status & tagging log