diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-10-05 23:53:43 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-10-05 23:53:43 +1100 |
| commit | 0629bf68f7eee1fd88d9227124b93a984c1868b9 (patch) | |
| tree | c00a77d2bd4f9fb8b8efb3e42271d517b33579cd | |
| parent | 5582b5599ef0aefc7114da7890795baf8e6b683f (diff) | |
use template files instead of hardcoded HTML for generating psots
| -rw-r--r-- | inc/config.php | 2 | ||||
| -rw-r--r-- | inc/display.php | 290 | ||||
| -rw-r--r-- | inc/functions.php | 19 | ||||
| -rw-r--r-- | inc/template.php | 60 | ||||
| -rw-r--r-- | templates/index.html | 2 | ||||
| -rw-r--r-- | templates/post_reply.html | 98 | ||||
| -rw-r--r-- | templates/post_thread.html | 128 | ||||
| -rw-r--r-- | templates/thread.html | 2 |
8 files changed, 312 insertions, 289 deletions
diff --git a/inc/config.php b/inc/config.php index ba435609..4a99011f 100644 --- a/inc/config.php +++ b/inc/config.php @@ -467,7 +467,7 @@ // Array('c', 'd', 'e', 'f', 'g'), // Array('h', 'i', 'j'), // Array('k', Array('l', 'm')), - // 'status' => 'http://status.example.org/' + // Array('status' => 'http://status.example.org/') //); // Categories diff --git a/inc/display.php b/inc/display.php index fc15c152..f544b88c 100644 --- a/inc/display.php +++ b/inc/display.php @@ -266,144 +266,9 @@ } public function build($index=false) { - global $board, $config, $memcached, $debug; - - if(!$this->mod && $config['memcached']['enabled']) { - 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']) . '…' . - '</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']); - } + global $board, $config; - return $built; - } - - function memcached_key($index) { - global $board; - return 'post_' . md5($this->body) . '_' . ($this->file ? $this->file : '-') . '_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id; + return Element('post_reply.html', Array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); } }; @@ -502,147 +367,34 @@ return $built; } + public function ratio() { + return fraction($this->filex, $this->filey, ':'); + } + public function build($index=false) { - global $board, $config; + global $board, $config, $memcached, $debug; - 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']) . '…' . - '</span>' - : - $this->filename - ); + if(!$this->mod && $config['memcached']['enabled']) { + if($built = $memcached->get($this->memcached_key($index))) { + if($config['debug']) { + $debug['memcached'][] = $this->memcached_key($index); + } + return $built; } - - $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 . '"':'') . '>'; - - // Delete - $built .= '<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">' . $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>' . + $built = Element('post_thread.html', Array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); - // 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); + if(!$this->mod && $config['memcached']['enabled']) { + $memcached->set($this->memcached_key($index), $built, time() + $config['memcached']['timeout']); } - $built .= '<br class="clear"/>' . ($this->hr ? '<hr/>' : ''); return $built; } + function memcached_key($index) { + global $board; + + return 'thread_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id; + } }; ?> diff --git a/inc/functions.php b/inc/functions.php index 647aee1a..6046b681 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -732,16 +732,6 @@ 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); - 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->bindValue(':id', $th['id']); $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>'; - if($config['memcached']['enabled'] && !$mod) { - $memcached->set("threadindex_{$board['uri']}_{$th['id']}", $built, time() + $config['memcached']['timeout']); - } - $body .= $built; } @@ -1371,8 +1357,9 @@ $id = round($id); if($config['memcached']['enabled'] && !$mod) { - // Clear cache for index pages - $memcached->delete("threadindex_{$board['uri']}_{$id}"); + // Clear cache + $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'])); diff --git a/inc/template.php b/inc/template.php index ed9e01f7..00cdbd36 100644 --- a/inc/template.php +++ b/inc/template.php @@ -6,8 +6,65 @@ }
require 'contrib/Twig/Autoloader.php';
+
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 = '…') {
+ 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']);
function Element($templateFile, array $options) {
@@ -28,9 +85,10 @@ $twig = new Twig_Environment($loader, Array(
'autoescape' => false,
- //'cache' => 'cache',
+ 'cache' => 'templates/cache',
'debug' => ($config['debug'] ? true : false),
));
+ $twig->addExtension(new Tinyboard_Twig_Extension());
// Read the template file
if(@file_get_contents("{$config['dir']['template']}/${templateFile}")) {
diff --git a/templates/index.html b/templates/index.html index 6e978f2d..8cd21eb0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -137,7 +137,7 @@ {% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %}
<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 }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
{{ body }}
diff --git a/templates/post_reply.html b/templates/post_reply.html new file mode 100644 index 00000000..a8ed151a --- /dev/null +++ b/templates/post_reply.html @@ -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 %}
diff --git a/templates/post_thread.html b/templates/post_thread.html new file mode 100644 index 00000000..6caff826 --- /dev/null +++ b/templates/post_thread.html @@ -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 %}
+
diff --git a/templates/thread.html b/templates/thread.html index 047cd201..6884d817 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -130,7 +130,7 @@ {% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %}
<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 }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
{{ body }}
|
