From ba8803510914d24303da8776448eacbf23bb3076 Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 7 Oct 2014 17:35:50 -0700 Subject: [PATCH] Edited at feature...add `edited_at` DATETIME NULL to all tables to use it. --- inc/functions.php | 2 +- inc/mod/pages.php | 4 ++-- templates/post_reply.html | 1 + templates/post_thread.html | 1 + templates/posts.sql | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 44320494..4a4bf9d5 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -886,7 +886,7 @@ function insertFloodPost(array $post) { function post(array $post) { global $pdo, $board; - $query = prepare(sprintf("INSERT INTO ``posts_%s`` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :files, :num_files, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri'])); + $query = prepare(sprintf("INSERT INTO ``posts_%s`` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :files, :num_files, :filehash, :password, :ip, :sticky, :locked, 0, :embed, NULL)", $board['uri'])); // Basic stuff if (!empty($post['subject'])) { diff --git a/inc/mod/pages.php b/inc/mod/pages.php index cb04a6ca..60d448eb 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1485,9 +1485,9 @@ function mod_edit_post($board, $edit_raw_html, $postID) { if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) { 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)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup, `edited_at` = NOW() WHERE `id` = :id', $board)); else - $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body_nomarkup` = :body WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body_nomarkup` = :body, `edited_at` = NOW() WHERE `id` = :id', $board)); $query->bindValue(':id', $postID); $query->bindValue('name', $_POST['name']); $query->bindValue(':email', $_POST['email']); diff --git a/templates/post_reply.html b/templates/post_reply.html index e7343230..9a32f403 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -22,6 +22,7 @@ {% if post.modifiers['ban message'] %} {{ config.mod.ban_message|sprintf(post.modifiers['ban message']) }} {% endif %} + {% include 'post/edited_at.html' %}
diff --git a/templates/post_thread.html b/templates/post_thread.html index 08b4c4c1..51d1fb0c 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -55,6 +55,7 @@ {% if post.modifiers['ban message'] %} {{ config.mod.ban_message|sprintf(post.modifiers['ban message']) }} {% endif %} + {% include 'post/edited_at.html' %} {% if post.omitted or post.omitted_images %} diff --git a/templates/posts.sql b/templates/posts.sql index 9a47c6ad..01632033 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( `locked` int(1) NOT NULL, `sage` int(1) NOT NULL, `embed` text, + `edited_at` DATETIME NULL, UNIQUE KEY `id` (`id`), KEY `thread_id` (`thread`,`id`), KEY `filehash` (`filehash`(40)),