forked from leftypol/leftypol
multiimage posting
This commit is contained in:
parent
7a04150b04
commit
c483e1258c
18 changed files with 366 additions and 273 deletions
|
@ -291,6 +291,7 @@ function ready() {
|
|||
{% endraw %}
|
||||
|
||||
var post_date = "{{ config.post_date }}";
|
||||
var max_images = {{ config.max_images }};
|
||||
|
||||
onready(init);
|
||||
|
||||
|
|
38
templates/post/fileinfo.html
Normal file
38
templates/post/fileinfo.html
Normal file
|
@ -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 %}
|
|
@ -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']) }}
|
||||
|
|
|
@ -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' %}
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue