diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-03-02 13:19:46 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-03-02 13:19:46 +1100 |
| commit | ee43a11130035379ac341cd64c944795420b3fa5 (patch) | |
| tree | 807c21f36ade67ff328fbbfae92d2c2da459c092 | |
| parent | 0d2e3c71e4005b8404a753d6de206a0961d2d5f0 (diff) | |
Change markup formatting order to fix dangerous HTML-breaking bug
| -rw-r--r-- | inc/functions.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/inc/functions.php b/inc/functions.php index 96f11f2a..3840e03b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -864,6 +864,13 @@ $body = utf8tohtml($body, true); + if($config['wiki_markup']) { + $body = preg_replace("/(^|\n)==(.+?)==\n?/m", "<h2>$2</h2>", $body); + $body = preg_replace("/'''(.+?)'''/m", "<strong>$1</strong>", $body); + $body = preg_replace("/''(.+?)''/m", "<em>$1</em>", $body); + $body = preg_replace("/\*\*(.+?)\*\*/m", "<span class=\"spoiler\">$1</span>", $body); + } + if($config['markup_urls']) { $body = preg_replace($config['url_regex'], "<a href=\"$0\">$0</a>", $body, -1, $num_links); if($num_links > $config['max_links']) @@ -925,12 +932,6 @@ $body = preg_replace("/(^|\n)([\s]+)?(>)([^\n]+)?($|\n)/m", '$1$2<span class="quote">$3$4</span>$5', $body); - if($config['wiki_markup']) { - $body = preg_replace("/(^|\n)==(.+?)==\n?/m", "<h2>$2</h2>", $body); - $body = preg_replace("/'''(.+?)'''/m", "<strong>$1</strong>", $body); - $body = preg_replace("/''(.+?)''/m", "<em>$1</em>", $body); - $body = preg_replace("/\*\*(.+?)\*\*/m", "<span class=\"spoiler\">$1</span>", $body); - } if($config['strip_superfluous_returns']) $body = preg_replace('/\s+$/', '', $body); |
