1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 01:10:51 +01:00

use template files instead of hardcoded HTML for generating psots

This commit is contained in:
Savetheinternet 2011-10-05 23:53:43 +11:00
parent 5582b5599e
commit 0629bf68f7
8 changed files with 312 additions and 289 deletions

View File

@ -467,7 +467,7 @@
// Array('c', 'd', 'e', 'f', 'g'), // Array('c', 'd', 'e', 'f', 'g'),
// Array('h', 'i', 'j'), // Array('h', 'i', 'j'),
// Array('k', Array('l', 'm')), // Array('k', Array('l', 'm')),
// 'status' => 'http://status.example.org/' // Array('status' => 'http://status.example.org/')
//); //);
// Categories // Categories

View File

@ -266,144 +266,9 @@
} }
public function build($index=false) { public function build($index=false) {
global $board, $config, $memcached, $debug; global $board, $config;
if(!$this->mod && $config['memcached']['enabled']) { return Element('post_reply.html', Array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index));
if($built = $memcached->get($this->memcached_key($index))) {
if($config['debug']) {
$debug['memcached'][] = $this->memcached_key($index);
}
return $built;
}
}
$built = '<div class="post reply" id="reply_' . $this->id . '">' .
'<p class="intro"' . (!$index?' id="' . $this->id . '"':'') . '>' .
// Delete
'<input type="checkbox" class="delete" name="delete_' . $this->id . '" id="delete_' . $this->id . '" /><label for="delete_' . $this->id . '">';
// Subject
if(!empty($this->subject))
$built .= '<span class="subject">' . $this->subject . '</span> ';
// Email
if(!empty($this->email))
$built .= '<a class="email" href="mailto:' . $this->email . '">';
// Name
$built .= '<span class="name"' .
(!empty($this->capcode) && isset($config['custom_capcode'][$this->capcode][1]) ?
' style="' . $config['custom_capcode'][$this->capcode][1] . '"'
: '')
. '>' . $this->name . '</span>'
// Trip
. (!empty($this->trip) ? ' <span class="trip"' .
(!empty($this->capcode) && isset($config['custom_capcode'][$this->capcode][2]) ?
' style="' . $config['custom_capcode'][$this->capcode][2] . '"'
: '')
. '>'.$this->trip.'</span>':'')
// End email
. (!empty($this->email)? '</a>' : '')
// Capcode
. (!empty($this->capcode) ? capcode($this->capcode) : '');
// IP Address
if($this->mod && hasPermission($config['mod']['show_ip'], $board['uri'], $this->mod)) {
$built .= ' [<a style="margin:0;" href="?/IP/' . $this->ip . '">' . $this->ip . '</a>]';
}
// Date/time
$built .= ' ' . date($config['post_date'], $this->time);
// End delete
$built .= '</label>'
// Poster ID
. ($config['poster_ids'] ?
' ID: ' . poster_id($this->ip, $this->thread)
: '')
. ' <a class="post_no"' .
// JavaScript highlight
($index?'':' onclick="highlightReply(' . $this->id . ');"') .
' href="' . $this->link() . '">No.</a>' .
// JavaScript cite
'<a class="post_no"' . ($index?'':' onclick="citeReply(' . $this->id . ');"') . ' href="' . ($index ? $this->link('q') : 'javascript:void(0);') . '">'.$this->id.'</a>' .
'</p>';
if($this->embed) {
// Embedded video (or something else; doesn't have to be a video really)
$built .=
// Actual embedding
$this->embed;
} elseif(!empty($this->file) && $this->file != 'deleted') {
// File info
$built .= '<p class="fileinfo">' .
'File: <a href="' . $config['uri_img'] . $this->file . '">' . $this->file . '</a> ' .
'<span class="unimportant">(' .
($this->thumb == 'spoiler' ?
'Spoiler Image, '
: '') .
// Filesize
format_bytes($this->filesize) .
// File dimensions
($this->filex && $this->filey ?
', ' . $this->filex . 'x' . $this->filey
: '' );
// Aspect Ratio
if($config['show_ratio'] && $this->filex && $this->filey) {
$fraction = fraction($this->filex, $this->filey, ':');
$built .= ', ' . $fraction;
}
if($config['show_filename']) {
// Filename
$built .= ', ' .
(strlen($this->filename) > $config['max_filename_display'] ?
'<span title="' . $this->filename . '">' .
substr($this->filename, 0, $config['max_filename_display']) . '&hellip;' .
'</span>'
:
$this->filename
);
}
$ext = explode('.', $this->file);
$ext = $ext[1];
$built .= ')</span></p>' .
// Thumbnail
'<a href="' .
$config['uri_img'] .$this->file .
'" target="_blank"' .
($this->thumb == 'file' ? ' class="file"' : '') .
'><img src="' .
($this->thumb == 'file' ?
$config['root'] . sprintf($config['file_thumb'], isset($config['file_icons'][$ext]) ? $config['file_icons'][$ext] : $config['file_icons']['default'])
:
($this->thumb == 'spoiler' ?
$config['root'] . $config['spoiler_image']
:
$config['uri_thumb'] . $this->thumb
)
) .
'" style="width:' . $this->thumbx . 'px;height:' . $this->thumby . 'px;" alt="" /></a>';
} elseif($this->file == 'deleted') {
$built .= '<img src="' . $config['image_deleted'] . '" alt="" />';
}
$built .= $this->postControls();
// Body
$built .= '<p class="body">' . ($index ? truncate($this->body, $this->link()) : $this->body) . '</p></div><br/>';
if(!$this->mod && $config['memcached']['enabled']) {
$memcached->set($this->memcached_key($index), $built, time() + $config['memcached']['timeout']);
}
return $built;
}
function memcached_key($index) {
global $board;
return 'post_' . md5($this->body) . '_' . ($this->file ? $this->file : '-') . '_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id;
} }
}; };
@ -502,147 +367,34 @@
return $built; return $built;
} }
public function ratio() {
return fraction($this->filex, $this->filey, ':');
}
public function build($index=false) { public function build($index=false) {
global $board, $config; global $board, $config, $memcached, $debug;
if($this->embed) { if(!$this->mod && $config['memcached']['enabled']) {
// Embedded video (or something else; doesn't have to be a video really) if($built = $memcached->get($this->memcached_key($index))) {
$built = if($config['debug']) {
// Actual embedding $debug['memcached'][] = $this->memcached_key($index);
$this->embed; }
} elseif(!empty($this->file) && $this->file != 'deleted') { return $built;
// File info
$built = '<p class="fileinfo">' .
'File: <a href="' . $config['uri_img'] . $this->file . '">' . $this->file . '</a> ' .
'<span class="unimportant">(' .
($this->thumb == 'spoiler' ?
'Spoiler Image, '
: '') .
// Filesize
format_bytes($this->filesize) .
// File dimensions
($this->filex && $this->filey ?
', ' . $this->filex . 'x' . $this->filey
: '' );
// Aspect Ratio
if($config['show_ratio'] && $this->filex && $this->filey) {
$fraction = fraction($this->filex, $this->filey, ':');
$built .= ', ' . $fraction;
} }
if($config['show_filename']) {
// Filename
$built .= ', ' .
(strlen($this->filename) > $config['max_filename_display'] ?
'<span title="' . $this->filename . '">' .
substr($this->filename, 0, $config['max_filename_display']) . '&hellip;' .
'</span>'
:
$this->filename
);
}
$ext = explode('.', $this->file);
$ext = $ext[1];
$built .= ')</span></p>' .
// Thumbnail
'<a href="' .
$config['uri_img'] .$this->file .
'" target="_blank"' .
($this->thumb == 'file' ? ' class="file"' : '') .
'><img src="' .
($this->thumb == 'file' ?
$config['root'] . sprintf($config['file_thumb'], isset($config['file_icons'][$ext]) ? $config['file_icons'][$ext] : $config['file_icons']['default'])
:
($this->thumb == 'spoiler' ?
$config['root'] . $config['spoiler_image']
:
$config['uri_thumb'] . $this->thumb
)
) .
'" style="width:' . $this->thumbx . 'px;height:' . $this->thumby . 'px;" alt="" /></a>';
} elseif($this->file == 'deleted') {
$built = '<img src="' . $config['image_deleted'] . '" alt="" />';
} }
$built .= '<div class="post op"><p class="intro"' . (!$index?' id="' . $this->id . '"':'') . '>'; $built = Element('post_thread.html', Array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index));
// Delete if(!$this->mod && $config['memcached']['enabled']) {
$built .= '<input type="checkbox" class="delete" name="delete_' . $this->id . '" id="delete_' . $this->id . '" /><label for="delete_' . $this->id . '">'; $memcached->set($this->memcached_key($index), $built, time() + $config['memcached']['timeout']);
// Subject
if(!empty($this->subject))
$built .= '<span class="subject">' . $this->subject . '</span> ';
// Email
if(!empty($this->email))
$built .= '<a class="email" href="mailto:' . $this->email . '">';
// Name
$built .= '<span class="name">' . $this->name . '</span>'
// Trip
. (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'')
// End email
. (!empty($this->email)? '</a>' : '')
// Capcode
. (!empty($this->capcode) ? capcode($this->capcode) : '');
// IP Address
if($this->mod && hasPermission($config['mod']['show_ip'], $board['uri'], $this->mod)) {
$built .= ' [<a style="margin:0;" href="?/IP/' . $this->ip . '">' . $this->ip . '</a>]';
} }
// Date/time
$built .= ' ' . date($config['post_date'], $this->time);
// End delete
$built .= '</label>'
// Poster ID
. ($config['poster_ids'] ?
' ID: ' . poster_id($this->ip, $this->id)
: '')
. ' <a class="post_no"' .
// JavaScript highlight
($index?'':' onclick="highlightReply(' . $this->id . ');"') .
' href="' . $this->link() . '">No.</a>' .
// JavaScript cite
'<a class="post_no"' . ($index?'':' onclick="citeReply(' . $this->id . ');"') . ' href="' . ($index ? $this->link('q') : 'javascript:void(0);') . '">'.$this->id.'</a>' .
// Sticky
($this->sticky ? '<img class="icon" title="Sticky" src="' . $config['image_sticky'] . '" alt="Sticky" />' : '') .
// Locked
($this->locked ? '<img class="icon" title="Locked" src="' . $config['image_locked'] . '" alt="Locked" />' : '') .
// [Reply]
($index ? '<a href="' . $this->root . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $this->id) . '">[Reply]</a>' : '') .
// Mod controls
$this->postControls() .
'</p>';
// Body
$built .= '<p class="body">' . ($index ? truncate($this->body, $this->link()) : $this->body) . '</p>' .
// Omitted posts
($this->omitted || $this->omitted_images? '<span class="omitted">' .
($this->omitted ?
$this->omitted . ' post' . ($this->omitted==1?'':'s') .
($this->omitted_images ? ' and ' : '')
:'') .
($this->omitted_images ?
$this->omitted_images . ' image repl' . ($this->omitted_images==1?'y':'ies')
:'') .
' omitted. Click reply to view.</span>':'') .
// End
'</div>';
// Replies
foreach($this->posts as &$post) {
$built .= $post->build($index);
}
$built .= '<br class="clear"/>' . ($this->hr ? '<hr/>' : '');
return $built; return $built;
} }
function memcached_key($index) {
global $board;
return 'thread_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id;
}
}; };
?> ?>

View File

@ -732,16 +732,6 @@
while($th = $query->fetch()) { while($th = $query->fetch()) {
$thread = new Thread($th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], $th['sticky'], $th['locked'], $th['embed'], $mod ? '?/' : $config['root'], $mod); $thread = new Thread($th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], $th['sticky'], $th['locked'], $th['embed'], $mod ? '?/' : $config['root'], $mod);
if($config['memcached']['enabled'] && !$mod) {
if($built = $memcached->get("threadindex_{$board['uri']}_{$th['id']}")) {
$body .= $built;
if($config['debug']) {
$debug['memcached'][] = "threadindex_{$board['uri']}_{$th['id']}";
}
continue;
}
}
$posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri'])); $posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri']));
$posts->bindValue(':id', $th['id']); $posts->bindValue(':id', $th['id']);
$posts->bindValue(':limit', ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT); $posts->bindValue(':limit', ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT);
@ -771,10 +761,6 @@
$built = '<div id="thread_' . $thread->id . '">' . $thread->build(true) . '</div>'; $built = '<div id="thread_' . $thread->id . '">' . $thread->build(true) . '</div>';
if($config['memcached']['enabled'] && !$mod) {
$memcached->set("threadindex_{$board['uri']}_{$th['id']}", $built, time() + $config['memcached']['timeout']);
}
$body .= $built; $body .= $built;
} }
@ -1371,8 +1357,9 @@
$id = round($id); $id = round($id);
if($config['memcached']['enabled'] && !$mod) { if($config['memcached']['enabled'] && !$mod) {
// Clear cache for index pages // Clear cache
$memcached->delete("threadindex_{$board['uri']}_{$id}"); $memcached->delete("thread_index_{$board['uri']}_{$id}");
$memcached->delete("thread_{$board['uri']}_{$id}");
} }
$query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri'])); $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri']));

View File

@ -6,8 +6,65 @@
} }
require 'contrib/Twig/Autoloader.php'; require 'contrib/Twig/Autoloader.php';
Twig_Autoloader::register(); Twig_Autoloader::register();
class Tinyboard_Twig_Extension extends Twig_Extension {
public function getFilters() {
return Array(
'filesize' => new Twig_Filter_Function('format_bytes', Array('needs_environment' => false)),
'truncate' => new Twig_Filter_Function('twig_truncate_filter', array('needs_environment' => false)),
'truncate_body' => new Twig_Filter_Function('truncate', array('needs_environment' => false)),
'extension' => new Twig_Filter_Function('twig_extension_filter', array('needs_environment' => false)),
'sprintf' => new Twig_Filter_Function('sprintf', array('needs_environment' => false)),
'capcode' => new Twig_Filter_Function('capcode', array('needs_environment' => false)),
'hasPermission' => new Twig_Filter_Function('twig_hasPermission_filter', array('needs_environment' => false)),
'date' => new Twig_Filter_Function('twig_date_filter', array('needs_environment' => false)),
'poster_id' => new Twig_Filter_Function('poster_id', array('needs_environment' => false)),
'remove_whitespace' => new Twig_Filter_Function('twig_remove_whitespace_filter', array('needs_environment' => false))
);
}
public function getName() {
return 'tinyboard';
}
}
function twig_remove_whitespace_filter($data) {
return preg_replace('/[\t\r\n]/', '', $data);
}
function twig_date_filter($date, $format) {
return date($format, $date);
}
function twig_hasPermission_filter($mod, $permission, $board) {
return hasPermission($permission, $board, $mod);
}
function twig_extension_filter($value, $case_insensitive = true) {
return 'test';
$ext = substr($value, strrpos($value, '.') + 1);
if($case_insensitive)
$ext = strtolower($ext);
return $ext;
}
function twig_sprintf_filter( $value, $var) {
return sprintf($value, $var);
}
function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '&hellip;') {
if (strlen($value) > $length) {
if ($preserve) {
if (false !== ($breakpoint = strpos($value, ' ', $length))) {
$length = $breakpoint;
}
}
return substr($value, 0, $length) . $separator;
}
return $value;
}
$loader = new Twig_Loader_Filesystem($config['dir']['template']); $loader = new Twig_Loader_Filesystem($config['dir']['template']);
function Element($templateFile, array $options) { function Element($templateFile, array $options) {
@ -28,9 +85,10 @@
$twig = new Twig_Environment($loader, Array( $twig = new Twig_Environment($loader, Array(
'autoescape' => false, 'autoescape' => false,
//'cache' => 'cache', 'cache' => 'templates/cache',
'debug' => ($config['debug'] ? true : false), 'debug' => ($config['debug'] ? true : false),
)); ));
$twig->addExtension(new Tinyboard_Twig_Extension());
// Read the template file // Read the template file
if(@file_get_contents("{$config['dir']['template']}/${templateFile}")) { if(@file_get_contents("{$config['dir']['template']}/${templateFile}")) {

View File

@ -137,7 +137,7 @@
{% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %} {% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %}
<hr /> <hr />
<form name="postcontrols" action="{{ post_url }}" method="post"> <form name="postcontrols" action="{{ config.post_url }}" method="post">
<input type="hidden" name="board" value="{{ board.uri }}" /> <input type="hidden" name="board" value="{{ board.uri }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %} {% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
{{ body }} {{ body }}

98
templates/post_reply.html Normal file
View File

@ -0,0 +1,98 @@
{% 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 }}">
{% if post.subject|length > 0 %}
{# show subject #}
<span class="subject">{{ post.subject }}</span>
{% endif %}
{% if post.email|length > 0 %}
{# start email #}
<a class="email" href="mailto:{{ post.email }}">
{% endif %}
<span class="name">{{ post.name }}</span>
{% if post.trip|length > 0 %}
<span class="trip">{{ post.trip }}</span>
{% endif %}
{% if post.email|length > 0 %}
{# end email #}
</a>
{% endif %}
{% if post.capcode|length > 0 %}
{# show capcode #}
{{ post.capcode|capcode }}
{% endif %}
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %}
{{ post.time|date(config.post_date) }}
</label>
{% if config.poster_ids %}
ID: {{ post.ip|poster_id(post.id) }}
{% endif %}
<a class="post_no" href="{{ post.link }}">No.</a>
<a class="post_no"
{% if not index %}
onclick="citeReply({{ post.id }});"
{% endif %}
href="{% if index %}
{{ post.link('q') }}
{% else %}
javascript:void(0);
{% endif %}">
{{ post.id }}
</a>
{% if post.embed %}
{{ post.embed }}
{% elseif post.file == 'deleted' %}
<img 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' %}
Spoiler Image,
{% endif %}
{{ post.filesize|filesize }}
{% if post.filex and post.filey %}
, {{ post.filex}}x{{ post.filey }}
{% if config.show_ratio %}
, {{ post.ratio }}
{% endif %}
{% endif %}
{% if config.show_filename %}
,
{% if post.filename|length > config.max_filename_display %}
<span title="{{ post.filename }}">{{ post.filename|truncate(config.max_filename_display) }}</span>
{% else %}
{{ post.filename }}
{% endif %}
{% endif %}
)
</span></p>
<a href="{{ config.uri_img }}{{ post.file }}" target="_blank"{% if this.thumb == 'file' %} class="file"{% endif %}>
<img src="
{% if post.thumb == 'file' %}
{{ config.root }}
{% if config.file_icons[post.filename|extension] %}
{{ config.file_thumb|sprintf(config.file_icons[post.filename|extension]) }}
{% else %}
{{ config.file_thumb|sprintf(config.file_icons.default) }}
{% endif %}
{% elseif post.thumb == 'spoiler' %}
{{ config.root }}{{ config.spoiler_image }}
{% else %}
{{ config.uri_thumb }}{{ post.thumb }}
{% endif %}" style="width:{{ post.thumbx }}px;height:{{ post.thumby }}px" alt="" /></a>
{% endif %}
{{ post.postControls }}
<p class="body">
{% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %}
</p>
</div>
<br/>
{% endfilter %}

128
templates/post_thread.html Normal file
View File

@ -0,0 +1,128 @@
{% filter remove_whitespace %}
{# tabs and new lines will be ignored #}
{% if post.embed %}
{{ post.embed }}
{% elseif post.file == 'deleted' %}
<img 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' %}
Spoiler Image,
{% endif %}
{{ post.filesize|filesize }}
{% if post.filex and post.filey %}
, {{ post.filex}}x{{ post.filey }}
{% if config.show_ratio %}
, {{ post.ratio }}
{% endif %}
{% endif %}
{% if config.show_filename %}
,
{% if post.filename|length > config.max_filename_display %}
<span title="{{ post.filename }}">{{ post.filename|truncate(config.max_filename_display) }}</span>
{% else %}
{{ post.filename }}
{% endif %}
{% endif %}
)
</span></p>
<a href="{{ config.uri_img }}{{ post.file }}" target="_blank"{% if this.thumb == 'file' %} class="file"{% endif %}>
<img src="
{% if post.thumb == 'file' %}
{{ config.root }}
{% if config.file_icons[post.filename|extension] %}
{{ config.file_thumb|sprintf(config.file_icons[post.filename|extension]) }}
{% else %}
{{ config.file_thumb|sprintf(config.file_icons.default) }}
{% endif %}
{% elseif post.thumb == 'spoiler' %}
{{ config.root }}{{ config.spoiler_image }}
{% else %}
{{ config.uri_thumb }}{{ post.thumb }}
{% endif %}" style="width:{{ post.thumbx }}px;height:{{ post.thumby }}px" alt="" /></a>
{% endif %}
<div class="post op"><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 }}">
{% if post.subject|length > 0 %}
{# show subject #}
<span class="subject">{{ post.subject }}</span>
{% endif %}
{% if post.email|length > 0 %}
{# start email #}
<a class="email" href="mailto:{{ post.email }}">
{% endif %}
<span class="name">{{ post.name }}</span>
{% if post.trip|length > 0 %}
<span class="trip">{{ post.trip }}</span>
{% endif %}
{% if post.email|length > 0 %}
{# end email #}
</a>
{% endif %}
{% if post.capcode|length > 0 %}
{# show capcode #}
{{ post.capcode|capcode }}
{% endif %}
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %}
{{ post.time|date(config.post_date) }}
</label>
{% if config.poster_ids %}
ID: {{ post.ip|poster_id(post.id) }}
{% endif %}
<a class="post_no" href="{{ post.link }}">No.</a>
<a class="post_no"
{% if not index %}
onclick="citeReply({{ post.id }});"
{% endif %}
href="{% if index %}
{{ post.link('q') }}
{% else %}
javascript:void(0);
{% endif %}">
{{ post.id }}
</a>
{% if post.sticky %}
<img class="icon" title="Sticky" src="{{ config.image_sticky }}" alt="Sticky" />
{% endif %}
{% if post.locked %}
<img class="icon" title="Locked" src="{{ config.image_locked }}" alt="Locked" />
{% endif %}
{% if index %}
<a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ config.file_page|sprintf(post.id) }}">[Reply]</a>
{% endif %}
{{ post.postControls }}
<p class="body">
{% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %}
</p>
{% if post.omitted or post.omitted_images %}
<span class="omitted">
{% if post.omitted %}
{{ post.omitted }} post
{% if post.omitted != 1 %}
s
{% endif %}
{% if post.omitted_images %}
and
{% endif %}
{% endif %}
{% if post.omitted_images %}
{{ post.omitted_images }} image repl
{% if post.omitted_images == 1 %}
y
{% else %}
ies
{% endif %}
{% endif %} omitted. Click reply to view.
</span>
{% endif %}
</div>{% endfilter %}
{% for post in post.posts %}
{% include 'post_reply.html' %}
{% endfor %}
<br class="clear"/>{% if post.hr %}<hr/>{% endif %}

View File

@ -130,7 +130,7 @@
{% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %} {% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %}
<hr /> <hr />
<form name="postcontrols" action="{{ post_url }}" method="post"> <form name="postcontrols" action="{{ config.post_url }}" method="post">
<input type="hidden" name="board" value="{{ board.uri }}" /> <input type="hidden" name="board" value="{{ board.uri }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %} {% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
{{ body }} {{ body }}