diff --git a/inc/functions.php b/inc/functions.php
index c46807bb..85b61b2e 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1849,7 +1849,11 @@ function extract_modifiers($body) {
return $modifiers;
}
-function markup(&$body, $track_cites = false) {
+function remove_modifiers($body) {
+ return preg_replace('@(.+?)@usm', '', $body);
+}
+
+function markup(&$body, $track_cites = false, $op = false) {
global $board, $config, $markup_urls;
$modifiers = extract_modifiers($body);
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 8380cfd3..a90fbbd6 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -1473,6 +1473,15 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
error($config['error']['404']);
if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) {
+ // Remove any modifiers they may have put in
+ $_POST['body'] = remove_modifiers($_POST['body']);
+
+ // Add back modifiers in the original post
+ $modifiers = extract_modifiers($post['body_nomarkup']);
+ foreach ($modifiers as $key => $value) {
+ $_POST['body'] .= "$value";
+ }
+
if ($edit_raw_html)
$query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup WHERE `id` = :id', $board));
else
@@ -1501,15 +1510,20 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . link_for($post) . '#' . $postID, true, $config['redirect_http']);
} else {
+ // Remove modifiers
+ $post['body_nomarkup'] = remove_modifiers($post['body_nomarkup']);
+
+ $post['body_nomarkup'] = utf8tohtml($post['body_nomarkup']);
+ $post['body'] = utf8tohtml($post['body']);
if ($config['minify_html']) {
- $post['body_nomarkup'] = str_replace("\n", '
', utf8tohtml($post['body_nomarkup']));
- $post['body'] = str_replace("\n", '
', utf8tohtml($post['body']));
+ $post['body_nomarkup'] = str_replace("\n", '
', $post['body_nomarkup']);
+ $post['body'] = str_replace("\n", '
', $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));
}
}