summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorcopypaste <admin@8chan.co>2014-04-27 15:48:47 +0200
committerczaks <marcin@6irc.net>2014-04-27 15:48:47 +0200
commitc483e1258cb5d168812a6e509e982a172f6c36c6 (patch)
treebe6324a26d75b43b2f4e1f017661b50b89aa8d2b /templates
parent7a04150b04d953f457c3fddf4bc198597f7e6470 (diff)
multiimage posting
Diffstat (limited to 'templates')
-rw-r--r--templates/main.js1
-rw-r--r--templates/post/fileinfo.html38
-rw-r--r--templates/post_reply.html34
-rw-r--r--templates/post_thread.html34
-rw-r--r--templates/posts.sql12
-rw-r--r--templates/themes/catalog/theme.php5
-rw-r--r--templates/themes/recent/theme.php12
-rw-r--r--templates/themes/ukko/theme.php4
8 files changed, 60 insertions, 80 deletions
diff --git a/templates/main.js b/templates/main.js
index 7796565c..953d8849 100644
--- a/templates/main.js
+++ b/templates/main.js
@@ -291,6 +291,7 @@ function ready() {
{% endraw %}
var post_date = "{{ config.post_date }}";
+var max_images = {{ config.max_images }};
onready(init);
diff --git a/templates/post/fileinfo.html b/templates/post/fileinfo.html
new file mode 100644
index 00000000..2136169b
--- /dev/null
+++ b/templates/post/fileinfo.html
@@ -0,0 +1,38 @@
+ {% if post.embed %}
+ {{ post.embed }}
+ {% else %}
+ <div class="files">
+ {% for file in post.files %}
+ <div class="file">
+ {% if file.file == 'deleted' %}
+ <img class="post-image deleted" src="{{ config.image_deleted }}" alt="" />
+ {% else %}
+ <p class="fileinfo">File: <a href="{{ config.uri_img }}{{ file.file }}">{{ file.file }}</a> <span class="unimportant">
+ (
+ {% if file.thumb == 'spoiler' %}
+ {% trans %}Spoiler Image{% endtrans %},
+ {% endif %}
+ {{ file.size|filesize }}
+ {% if file.width and file.height %}
+ , {{ file.width}}x{{ file.height }}
+ {% if config.show_ratio %}
+ , {{ ratio(file.width, file.height) }}
+ {% endif %}
+ {% endif %}
+ {% if config.show_filename and file.filename %}
+ ,
+ {% if file.filename|length > config.max_filename_display %}
+ <span class="postfilename" title="{{ file.filename|e }}">{{ file.filename|truncate(config.max_filename_display)|bidi_cleanup }}</span>
+ {% else %}
+ <span class="postfilename">{{ file.filename|e|bidi_cleanup }}</span>
+ {% endif %}
+ {% endif %}
+ {% include "post/image_identification.html" %}
+ )
+ </span></p>
+ {% include "post/image.html" with {'post':file} %}
+ {% endif %}
+</div>
+ {% endfor %}
+</div>
+ {% endif %}
diff --git a/templates/post_reply.html b/templates/post_reply.html
index 90ac5065..3d860872 100644
--- a/templates/post_reply.html
+++ b/templates/post_reply.html
@@ -1,7 +1,6 @@
{% filter remove_whitespace %}
{# tabs and new lines will be ignored #}
<div class="post reply" id="reply_{{ post.id }}">
-
<p class="intro"{% if not index %} id="{{ post.id }}"{% endif %}>
<input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" />
<label for="delete_{{ post.id }}">
@@ -18,38 +17,9 @@
{{ post.id }}
</a>
</p>
- {% if post.embed %}
- {{ post.embed }}
- {% elseif post.file == 'deleted' %}
- <img class="post-image deleted" src="{{ config.image_deleted }}" alt="" />
- {% elseif post.file and post.file %}
- <p class="fileinfo">File: <a href="{{ config.uri_img }}{{ post.file }}">{{ post.file }}</a> <span class="unimportant">
- (
- {% if post.thumb == 'spoiler' %}
- {% trans %}Spoiler Image{% endtrans %},
- {% endif %}
- {{ post.filesize|filesize }}
- {% if post.filewidth and post.fileheight %}
- , {{ post.filewidth}}x{{ post.fileheight }}
- {% if config.show_ratio %}
- , {{ post.ratio }}
- {% endif %}
- {% endif %}
- {% if config.show_filename and post.filename %}
- ,
- {% if post.filename|length > config.max_filename_display %}
- <span class="postfilename" title="{{ post.filename|e }}">{{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }}</span>
- {% else %}
- <span class="postfilename">{{ post.filename|e|bidi_cleanup }}</span>
- {% endif %}
- {% endif %}
- {% include "post/image_identification.html" %}
- )
- </span></p>
- {% include "post/image.html" %}
- {% endif %}
+ {% include 'post/fileinfo.html' %}
{{ post.postControls }}
- <div class="body">
+ <div class="body" {% if post.files|length > 1 %}style="clear:both"{% endif %}>
{% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %}
{% if post.modifiers['ban message'] %}
{{ config.mod.ban_message|sprintf(post.modifiers['ban message']) }}
diff --git a/templates/post_thread.html b/templates/post_thread.html
index f74427e4..a5bf8e08 100644
--- a/templates/post_thread.html
+++ b/templates/post_thread.html
@@ -2,38 +2,8 @@
{# tabs and new lines will be ignored #}
<div id="thread_{{ post.id }}" data-board="{{ board.uri }}">
-
-{% if post.embed %}
- {{ post.embed }}
-{% elseif post.file == 'deleted' %}
- <img class="post-image deleted" src="{{ config.image_deleted }}" alt="" />
-{% elseif post.file and post.file %}
- <p class="fileinfo">{% trans %}File:{% endtrans %} <a href="{{ config.uri_img }}{{ post.file }}">{{ post.file }}</a> <span class="unimportant">
- (
- {% if post.thumb == 'spoiler' %}
- {% trans %}Spoiler Image{% endtrans %},
- {% endif %}
- {{ post.filesize|filesize }}
- {% if post.filewidth and post.fileheight %}
- , {{ post.filewidth}}x{{ post.fileheight }}
- {% if config.show_ratio %}
- , {{ post.ratio }}
- {% endif %}
- {% endif %}
- {% if config.show_filename and post.filename %}
- ,
- {% if post.filename|length > config.max_filename_display %}
- <span class="postfilename" title="{{ post.filename|e }}">{{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }}</span>
- {% else %}
- <span class="postfilename">{{ post.filename|e|bidi_cleanup }}</span>
- {% endif %}
- {% endif %}
- {% include "post/image_identification.html" %}
- )
- </span></p>
- {% include "post/image.html" %}
-{% endif %}
-<div class="post op"><p class="intro"{% if not index %} id="{{ post.id }}"{% endif %}>
+{% include 'post/fileinfo.html' %}
+<div class="post op" {%if post.num_files > 1%}style='clear:both'{%endif%}><p class="intro"{% if not index %} id="{{ post.id }}"{% endif %}>
<input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" />
<label for="delete_{{ post.id }}">
{% include 'post/subject.html' %}
diff --git a/templates/posts.sql b/templates/posts.sql
index c1f491f2..9a47c6ad 100644
--- a/templates/posts.sql
+++ b/templates/posts.sql
@@ -10,14 +10,8 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` (
`body_nomarkup` text,
`time` int(11) NOT NULL,
`bump` int(11) DEFAULT NULL,
- `thumb` varchar(255) DEFAULT NULL,
- `thumbwidth` int(11) DEFAULT NULL,
- `thumbheight` int(11) DEFAULT NULL,
- `file` varchar(255) DEFAULT NULL,
- `filewidth` int(11) DEFAULT NULL,
- `fileheight` int(11) DEFAULT NULL,
- `filesize` int(11) DEFAULT NULL,
- `filename` text,
+ `files` text DEFAULT NULL,
+ `num_files` int(11) DEFAULT 0,
`filehash` text CHARACTER SET ascii,
`password` varchar(20) DEFAULT NULL,
`ip` varchar(39) CHARACTER SET ascii NOT NULL,
@@ -32,4 +26,4 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` (
KEY `ip` (`ip`),
KEY `list_threads` (`thread`, `sticky`, `bump`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
- \ No newline at end of file
+
diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php
index d3a837ca..1f42b8d1 100644
--- a/templates/themes/catalog/theme.php
+++ b/templates/themes/catalog/theme.php
@@ -40,7 +40,10 @@
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
$post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id']));
$post['board_name'] = $board['name'];
- $post['file'] = $config['uri_thumb'] . $post['thumb'];
+ if (isset($post['files']))
+ $files = json_decode($post['files']);
+ if ($files[0]->file == 'deleted') continue;
+ $post['file'] = $config['uri_thumb'] . $files[0]->thumb;
$recent_posts[] = $post;
}
diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php
index 26a9a69b..842ab9ac 100644
--- a/templates/themes/recent/theme.php
+++ b/templates/themes/recent/theme.php
@@ -42,7 +42,7 @@
foreach ($boards as &$_board) {
if (in_array($_board['uri'], $this->excluded))
continue;
- $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `file` IS NOT NULL AND `file` != 'deleted' AND `thumb` != 'spoiler' UNION ALL ", $_board['uri'], $_board['uri']);
+ $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `files` IS NOT NULL UNION ALL ", $_board['uri'], $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_images'], $query);
@@ -54,10 +54,14 @@
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
openBoard($post['board']);
+ if (isset($post['files']))
+ $files = json_decode($post['files']);
+
+ if ($files[0]->file == 'deleted') continue;
// board settings won't be available in the template file, so generate links now
$post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id'];
- $post['src'] = $config['uri_thumb'] . $post['thumb'];
+ if ($files) $post['src'] = $config['uri_thumb'] . $files[0]->thumb;
$recent_images[] = $post;
}
@@ -105,7 +109,7 @@
$stats['unique_posters'] = number_format($query->fetchColumn());
// Active content
- $query = 'SELECT SUM(`filesize`) FROM (';
+ /*$query = 'SELECT SUM(`filesize`) FROM (';
foreach ($boards as &$_board) {
if (in_array($_board['uri'], $this->excluded))
continue;
@@ -113,7 +117,7 @@
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
$query = query($query) or error(db_error());
- $stats['active_content'] = $query->fetchColumn();
+ $stats['active_content'] = $query->fetchColumn();*/
return Element('themes/recent/recent.html', Array(
'settings' => $settings,
diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php
index 1ca00014..88b0c4a4 100644
--- a/templates/themes/ukko/theme.php
+++ b/templates/themes/ukko/theme.php
@@ -51,14 +51,14 @@
$num_images = 0;
while ($po = $posts->fetch()) {
- if ($po['file'])
+ if ($po['files'])
$num_images++;
$thread->add(new Post($po, $mod ? '?/' : $config['root'], $mod));
}
if ($posts->rowCount() == ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
- $ct = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `file` IS NOT NULL AND `thread` = :thread", $post['board'], $post['board']));
+ $ct = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `files` IS NOT NULL AND `thread` = :thread", $post['board'], $post['board']));
$ct->bindValue(':thread', $post['id'], PDO::PARAM_INT);
$ct->execute() or error(db_error($count));