Index: trunk/phpwiki/fpw/wikiPage.php |
— | — | @@ -124,8 +124,9 @@ |
125 | 125 | } |
126 | 126 | |
127 | 127 | if ( strtolower ( substr ( $this->contents , 0 , 9 ) ) == "#redirect" and $doRedirect and $action != "edit" and !isset ($oldID) ) { # #REDIRECT |
128 | | - if ( preg_match ( '/^#redirect\s*\[\[\s*([^\]\n]+)\s*\]\]/i' , $this->contents , $regs ) ) { |
129 | | - $target = $regs[1] ; |
| 128 | + # Lenient syntax: two or one or no brackets around the target |
| 129 | + if ( preg_match ( '/^#redirect(\s*\[\[\s*([^\]\n]+)\s*\]\]|\s*\[\s*([^\]\n]+)\s*\]|\s+([^\ \n]*))/i' , $this->contents , $regs ) ) { |
| 130 | + $target = ($regs[2] ? $regs[2] : ($regs[3] ? $regs[3] : $regs[4])); |
130 | 131 | $link = wikiLink ( $this->getNiceTitle() ) ; |
131 | 132 | $link = "<a href=\"$link&action=view&redirect=no\">".$this->getNiceTitle()."</a>" ; |
132 | 133 | $link = str_replace ( "$1" , $link , $wikiRedirectFrom ) ; |