From b1c1a25c26ceac45793536c9a4fe903075cc3b63 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Mon, 29 Oct 2012 22:10:58 -0600 Subject: Add (`thread`, `id`) multi-column key to optimize rebuilding index pages. This SQL command can be used to add the key to existing board tables: create index `thread_id` on posts_%s (`thread`, `id`); --- templates/posts.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'templates') diff --git a/templates/posts.sql b/templates/posts.sql index d10749f8..ac383ab0 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -27,6 +27,7 @@ CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( `embed` text, UNIQUE KEY `id` (`id`), KEY `thread` (`thread`), + KEY `thread_id` (`thread`, `id`), KEY `time` (`time`), FULLTEXT KEY `body` (`body`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- cgit v1.3 From f2d3e45fd3b21758fd12c0c4a23ce272cca18026 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Fri, 13 Jul 2012 11:03:22 -0600 Subject: Handle posts without filenames. If a post doesn't have a filename (such as because of a post event changing it), then don't show an empty filename with the post. --- templates/post_reply.html | 2 +- templates/post_thread.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/post_reply.html b/templates/post_reply.html index f50e392e..ddd0afd4 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -63,7 +63,7 @@ , {{ post.ratio }} {% endif %} {% endif %} - {% if config.show_filename %} + {% if config.show_filename and post.filename %} , {% if post.filename|length > config.max_filename_display %} {{ post.filename|truncate(config.max_filename_display) }} diff --git a/templates/post_thread.html b/templates/post_thread.html index da93c5dd..cf93bed0 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -20,7 +20,7 @@ , {{ post.ratio }} {% endif %} {% endif %} - {% if config.show_filename %} + {% if config.show_filename and post.filename %} , {% if post.filename|length > config.max_filename_display %} {{ post.filename|truncate(config.max_filename_display) }} -- cgit v1.3 From f01813d95b2e39fc938262a3aca6986d97c7da6b Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Sat, 19 Jan 2013 01:20:55 -0600 Subject: Remove now redundant single-column `thread` key from posts_* tables. --- templates/posts.sql | 1 - 1 file changed, 1 deletion(-) (limited to 'templates') diff --git a/templates/posts.sql b/templates/posts.sql index ac383ab0..c766d38e 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -26,7 +26,6 @@ CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( `sage` int(1) NOT NULL, `embed` text, UNIQUE KEY `id` (`id`), - KEY `thread` (`thread`), KEY `thread_id` (`thread`, `id`), KEY `time` (`time`), FULLTEXT KEY `body` (`body`) -- cgit v1.3 From 0da1c18a7ff2328a3cdd422e3f67d4b4bf403fb5 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Thu, 30 Aug 2012 04:07:23 -0600 Subject: Add field_disable_subject and field_disable_reply_subject config options. --- inc/config.php | 4 ++++ post.php | 8 +++++++- templates/post_form.html | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/inc/config.php b/inc/config.php index e977f066..ea936032 100644 --- a/inc/config.php +++ b/inc/config.php @@ -348,6 +348,10 @@ $config['field_disable_name'] = false; // When true, no email will be able to be set. $config['field_disable_email'] = false; + // When true, no subject will be able to be set. + $config['field_disable_subject'] = false; + // When true, no subject will be able to be set in replies. + $config['field_disable_reply_subject'] = false; // When true, a blank password will be used for files (not usable for deletion). $config['field_disable_password'] = false; diff --git a/post.php b/post.php index 98da7486..54065832 100644 --- a/post.php +++ b/post.php @@ -139,7 +139,7 @@ if (isset($_POST['delete'])) { header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); } elseif (isset($_POST['post'])) { - if (!isset($_POST['subject'], $_POST['body'], $_POST['board'])) + if (!isset($_POST['body'], $_POST['board'])) error($config['error']['bot']); if (!isset($_POST['name'])) @@ -148,6 +148,9 @@ if (isset($_POST['delete'])) { if (!isset($_POST['email'])) $_POST['email'] = ''; + if (!isset($_POST['subject'])) + $_POST['subject'] = ''; + if (!isset($_POST['password'])) $_POST['password'] = ''; @@ -271,6 +274,9 @@ if (isset($_POST['delete'])) { if ($config['field_disable_password']) $_POST['password'] = ''; + + if ($config['field_disable_subject'] || (!$post['op'] && $config['field_disable_reply_subject'])) + $_POST['subject'] = ''; } // Check for a file diff --git a/templates/post_form.html b/templates/post_form.html index 8b7350c7..aa051f5f 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -27,12 +27,18 @@ {% endif %} - + {% if not (config.field_disable_subject or (id and config.field_disable_reply_subject)) or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %} {% trans %}Subject{% endtrans %} {{ antibot.html() }} + {% else %} + {% trans %}Submit{% endtrans %} + {{ antibot.html() }} + + + {% endif %} {% if config.spoiler_images %} {% endif %} -- cgit v1.3