diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index ffa3fa34..9de2fdfd 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -1615,10 +1615,17 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
$_POST['body'] .= "$value";
}
+ // Handle embed edits...
+ foreach ($config['embedding'] as &$embed) {
+ if (preg_match($embed[0], $_POST['embed'])) {
+ $embed_link = $_POST['embed'];
+ }
+ }
+
if ($edit_raw_html)
- $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name,'. $trip .' `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup, `edited_at` = UNIX_TIMESTAMP(NOW()) WHERE `id` = :id', $board));
+ $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name,'. $trip .' `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup, `embed` = :embed `edited_at` = UNIX_TIMESTAMP(NOW()) WHERE `id` = :id', $board));
else
- $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name,'. $trip .' `email` = :email, `subject` = :subject, `body_nomarkup` = :body, `edited_at` = UNIX_TIMESTAMP(NOW()) WHERE `id` = :id', $board));
+ $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name,'. $trip .' `email` = :email, `subject` = :subject, `body_nomarkup` = :body, `embed` = :embed, `edited_at` = UNIX_TIMESTAMP(NOW()) WHERE `id` = :id', $board));
$query->bindValue(':id', $postID);
$query->bindValue(':name', $_POST['name'] ? $_POST['name'] : $config['anonymous']);
$query->bindValue(':email', $_POST['email']);
@@ -1628,6 +1635,11 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
$body_nomarkup = $_POST['body'] . "\n1";
$query->bindValue(':body_nomarkup', $body_nomarkup);
}
+ if (isset($embed_link)) {
+ $query->bindValue(':embed', $embed_link);
+ } else {
+ $query->bindValue(':embed', NULL, PDO::PARAM_NULL);
+ }
$query->execute() or error(db_error($query));
if( $config['clean']['edits_remove_local'] || $config['clean']['edits_remove_global'] ) {
@@ -1686,7 +1698,10 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
$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));
+ $preview = new Post($post);
+ $html = $preview->build(true);
+
+ mod_page(_('Edit post'), 'mod/edit_post_form.html', array('token' => $security_token, 'board' => $board, 'raw' => $edit_raw_html, 'post' => $post, 'preview' => $html));
}
}
diff --git a/templates/mod/edit_post_form.html b/templates/mod/edit_post_form.html
index d40d9b05..b36044f8 100644
--- a/templates/mod/edit_post_form.html
+++ b/templates/mod/edit_post_form.html
@@ -1,3 +1,5 @@
+