From d166fc70bd6378c3f72b7f40e71a79fcb63bc1f2 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 31 Aug 2013 13:23:29 +1000 Subject: [PATCH] Fix \t in posts (editing posts, and HTML Tidy) --- inc/functions.php | 8 ++++---- inc/mod/pages.php | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index ccf21c9e..b9d135cf 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1580,9 +1580,6 @@ function markup(&$body, $track_cites = false) { } } - // replace tabs with 8 spaces - $body = str_replace("\t", ' ', $body); - $tracked_cites = array(); // Cites @@ -1748,6 +1745,7 @@ function markup(&$body, $track_cites = false) { if ($config['markup_repair_tidy']) { $tidy = new tidy(); + $body = str_replace("\t", ' ', $body); $body = $tidy->repairString($body, array( 'doctype' => 'omit', 'bare' => true, @@ -1759,10 +1757,12 @@ function markup(&$body, $track_cites = false) { 'output-html' => true, 'newline' => 'LF', 'quiet' => true, - ), 'utf8'); $body = str_replace("\n", '', $body); } + + // replace tabs with 8 spaces + $body = str_replace("\t", ' ', $body); return $tracked_cites; } diff --git a/inc/mod/pages.php b/inc/mod/pages.php index afd8daf3..202ea182 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1317,6 +1317,8 @@ function mod_edit_post($board, $edit_raw_html, $postID) { $post['body'] = str_replace("\n", ' ', utf8tohtml($post['body'])); $post['body_nomarkup'] = str_replace("\r", '', $post['body_nomarkup']); $post['body'] = str_replace("\r", '', $post['body']); + $post['body_nomarkup'] = str_replace("\t", ' ', $post['body_nomarkup']); + $post['body'] = str_replace("\t", ' ', $post['body']); } mod_page(_('Edit post'), 'mod/edit_post_form.html', array('token' => $security_token, 'board' => $board, 'raw' => $edit_raw_html, 'post' => $post));