From 88dff2a683ea580930b95ffa33cccdf648d89cab Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 20:16:09 +1000
Subject: [PATCH 01/13] Set $config['try_smarter'] to true. If you notice any
problems, please report them to us.
---
inc/config.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inc/config.php b/inc/config.php
index 4858274d..2634f719 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -935,7 +935,7 @@
// $config['url_favicon'] = '/favicon.gif';
// EXPERIMENTAL: Try not to build pages when we shouldn't have to.
- $config['try_smarter'] = false;
+ $config['try_smarter'] = true;
/*
* ====================
From b666886416f793074669a7e2bc1d7cc3c2b4746a Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 21:08:01 +1000
Subject: [PATCH 02/13] A few modifications:
1. Finally, clean up some of the crappy code in inc/display.php; no more extreme clutter. new Thread() and new Post() take an array as the first parameter now.
2. Poster country flags. Currently requires the "geoip" extension.
3. Give post images a classname. This was also long-overdue.
---
inc/config.php | 16 +++++++++++
inc/display.php | 72 ++++++++++++++++------------------------------
inc/functions.php | 38 ++++++++++++------------
inc/mod/pages.php | 28 +++---------------
post.php | 9 ++++++
stylesheets/style.css | 4 +--
templates/post_reply.html | 7 +++--
templates/post_thread.html | 4 +--
8 files changed, 80 insertions(+), 98 deletions(-)
diff --git a/inc/config.php b/inc/config.php
index 2634f719..5e215fca 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -386,6 +386,11 @@
// When true, a blank password will be used for files (not usable for deletion).
$config['field_disable_password'] = false;
+ // Attach country flags to posts. Requires the PHP "geoip" extension to be installed:
+ // http://www.php.net/manual/en/intro.geoip.php. In the future, maybe I will find and include a proper
+ // pure-PHP geolocation library.
+ $config['country_flags'] = false;
+
// Require users to see the ban page at least once for a ban even if it has since expired.
$config['require_ban_view'] = true;
@@ -726,6 +731,17 @@
// Optional HTML to append to "You are banned" pages. For example, you could include instructions and/or
// a link to an email address or IRC chat room to appeal the ban.
$config['ban_page_extra'] = '';
+
+ // Display flags (when available). This config option has no effect unless poster flags are enabled (see
+ // $config['country_flags']). Disable this if you want all previously-assigned flags to be hidden.
+ $config['display_flags'] = true;
+
+ // Location of post flags/icons (where "%s" is the flag name). Defaults to static/flags/%s.png.
+ // $config['uri_flags'] = 'http://static.example.org/flags/%s.png';
+
+ // Width and height of post flags:
+ $config['flag_width'] = 16;
+ $config['flag_height'] = 11;
/*
* ====================
diff --git a/inc/display.php b/inc/display.php
index af0ee89f..ee600ed3 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -270,36 +270,25 @@ function embed_html($link) {
}
class Post {
- public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $embed, $root=null, $mod=false) {
+ public function __construct($post, $root=null, $mod=false) {
global $config;
if (!isset($root))
$root = &$config['root'];
- $this->id = $id;
- $this->thread = $thread;
- $this->subject = utf8tohtml($subject);
- $this->email = $email;
- $this->name = utf8tohtml($name);
- $this->trip = $trip;
- $this->capcode = $capcode;
- $this->body = $body;
- $this->time = $time;
- $this->thumb = $thumb;
- $this->thumbx = $thumbx;
- $this->thumby = $thumby;
- $this->file = $file;
- $this->filex = $filex;
- $this->filey = $filey;
- $this->filesize = $filesize;
- $this->filename = $filename;
- $this->ip = $ip;
- $this->embed = $embed;
- $this->root = $root;
+ foreach ($post as $key => $value) {
+ $this->{$key} = $value;
+ }
+
+ $this->subject = utf8tohtml($this->subject);
+ $this->name = utf8tohtml($this->name);
$this->mod = $mod;
+ $this->root = $root;
if ($this->embed)
$this->embed = embed_html($this->embed);
+ $this->modifiers = extract_modifiers($this->body_nomarkup);
+
if ($this->mod)
// Fix internal links
// Very complicated regex
@@ -367,42 +356,29 @@ class Post {
};
class Thread {
- public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $bumplocked, $embed, $root=null, $mod=false, $hr=true) {
+ public function __construct($post, $root = null, $mod = false, $hr = true) {
global $config;
if (!isset($root))
$root = &$config['root'];
- $this->id = $id;
- $this->subject = utf8tohtml($subject);
- $this->email = $email;
- $this->name = utf8tohtml($name);
- $this->trip = $trip;
- $this->capcode = $capcode;
- $this->body = $body;
- $this->time = $time;
- $this->thumb = $thumb;
- $this->thumbx = $thumbx;
- $this->thumby = $thumby;
- $this->file = $file;
- $this->filex = $filex;
- $this->filey = $filey;
- $this->filesize = $filesize;
- $this->filename = $filename;
+ foreach ($post as $key => $value) {
+ $this->{$key} = $value;
+ }
+
+ $this->subject = utf8tohtml($this->subject);
+ $this->name = utf8tohtml($this->name);
+ $this->mod = $mod;
+ $this->root = $root;
+
+ $this->posts = array();
$this->omitted = 0;
$this->omitted_images = 0;
- $this->posts = array();
- $this->ip = $ip;
- $this->sticky = $sticky;
- $this->locked = $locked;
- $this->bumplocked = $bumplocked;
- $this->embed = $embed;
- $this->root = $root;
- $this->mod = $mod;
- $this->hr = $hr;
if ($this->embed)
$this->embed = embed_html($this->embed);
+ $this->modifiers = extract_modifiers($this->body_nomarkup);
+
if ($this->mod)
// Fix internal links
// Very complicated regex
@@ -462,7 +438,7 @@ class Thread {
$built .= ' ' . $config['mod']['link_sticky'] . '';
if (hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod))
- if ($this->bumplocked)
+ if ($this->sage)
$built .= ' ' . $config['mod']['link_bumpunlock'] . '';
else
$built .= ' ' . $config['mod']['link_bumplock'] . '';
diff --git a/inc/functions.php b/inc/functions.php
index 085d911f..c6751a91 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -149,6 +149,8 @@ function loadConfig() {
$config['url_javascript'] = $config['root'] . $config['file_script'];
if (!isset($config['additional_javascript_url']))
$config['additional_javascript_url'] = $config['root'];
+ if (!isset($config['uri_flags']))
+ $config['uri_flags'] = $config['root'] . 'static/flags/%s.png';
if ($config['root_file']) {
chdir($config['root_file']);
@@ -1044,11 +1046,7 @@ function index($page, $mod=false) {
if ($query->rowCount() < 1 && $page > 1)
return false;
while ($th = $query->fetch(PDO::FETCH_ASSOC)) {
- $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['sage'], $th['embed'], $mod ? '?/' : $config['root'], $mod
- );
+ $thread = new Thread($th, $mod ? '?/' : $config['root'], $mod);
if ($config['cache']['enabled'] && $cached = cache::get("thread_index_{$board['uri']}_{$th['id']}")) {
$replies = $cached['replies'];
@@ -1080,11 +1078,7 @@ function index($page, $mod=false) {
if ($po['file'])
$num_images++;
- $thread->add(new Post(
- $po['id'], $th['id'], $po['subject'], $po['email'], $po['name'], $po['trip'], $po['capcode'], $po['body'], $po['time'],
- $po['thumb'], $po['thumbwidth'], $po['thumbheight'], $po['file'], $po['filewidth'], $po['fileheight'], $po['filesize'],
- $po['filename'], $po['ip'], $po['embed'], $mod ? '?/' : $config['root'], $mod)
- );
+ $thread->add(new Post($po, $mod ? '?/' : $config['root'], $mod));
}
if ($omitted) {
@@ -1467,6 +1461,18 @@ function unicodify($body) {
return $body;
}
+function extract_modifiers($body) {
+ $modifiers = array();
+
+ if (preg_match_all('@(.+?)@um', $body, $matches, PREG_SET_ORDER)) {
+ foreach ($matches as $match) {
+ $modifiers[$match[1]] = $match[2];
+ }
+ }
+
+ return $modifiers;
+}
+
function markup(&$body, $track_cites = false) {
global $board, $config, $markup_urls;
@@ -1730,17 +1736,9 @@ function buildThread($id, $return = false, $mod = false) {
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
if (!isset($thread)) {
- $thread = new Thread(
- $post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'],
- $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'],
- $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], $mod ? '?/' : $config['root'], $mod
- );
+ $thread = new Thread($post, $mod ? '?/' : $config['root'], $mod);
} else {
- $thread->add(new Post(
- $post['id'], $thread->id, $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'],
- $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'],
- $post['filesize'], $post['filename'], $post['ip'], $post['embed'], $mod ? '?/' : $config['root'], $mod)
- );
+ $thread->add(new Post($post, $mod ? '?/' : $config['root'], $mod));
}
}
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 932b2ed6..9f8fcc5c 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -780,19 +780,9 @@ function mod_page_ip($ip) {
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
if (!$post['thread']) {
- // TODO: There is no reason why this should be such a fucking mess.
- $po = new Thread(
- $post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'],
- $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'],
- $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'],
- $post['sage'], $post['embed'], '?/', $mod, false
- );
+ $po = new Thread($post, '?/', $mod, false);
} else {
- $po = new Post(
- $post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'],
- $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'],
- $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod
- );
+ $po = new Post($post, '?/', $mod);
}
if (!isset($args['posts'][$board['uri']]))
@@ -1907,19 +1897,9 @@ function mod_reports() {
if (!$post['thread']) {
// Still need to fix this:
- $po = new Thread(
- $post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'],
- $post['capcode'], $post['body'], $post['time'], $post['thumb'],
- $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'],
- $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'],
- $post['locked'], $post['sage'], $post['embed'], '?/', $mod, false
- );
+ $po = new Thread($post, '?/', $mod, false);
} else {
- $po = new Post(
- $post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'],
- $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'],
- $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod
- );
+ $po = new Post($post, '?/', $mod);
}
// a little messy and inefficient
diff --git a/post.php b/post.php
index 8a8487e8..11792379 100644
--- a/post.php
+++ b/post.php
@@ -421,6 +421,15 @@ if (isset($_POST['delete'])) {
wordfilters($post['body']);
$post['body'] = escape_markup_modifiers($post['body']);
+ if ($config['country_flags']) {
+ if (!geoip_db_avail(GEOIP_COUNTRY_EDITION)) {
+ error('GeoIP not available: ' . geoip_db_filename(GEOIP_COUNTRY_EDITION));
+ }
+ if ($country_code = @geoip_country_code_by_name('8.8.8.8')) {
+ $post['body'] .= '' . strtolower($country_code) . '';
+ }
+ }
+
if ($mod && isset($post['raw']) && $post['raw']) {
$post['body'] = '' . $post['body'] . '';
}
diff --git a/stylesheets/style.css b/stylesheets/style.css
index c0430b7c..16f99e9a 100644
--- a/stylesheets/style.css
+++ b/stylesheets/style.css
@@ -129,13 +129,13 @@ img.banner {
border: 1px solid #a9a9a9;
margin: 12px auto 0 auto;
}
-img {
+img.post-image {
display: block;
float: left;
margin: 10px 20px;
border: none;
}
-div.post img {
+div.post img.post-image {
padding: 5px;
margin: 5px 20px 0 0;
}
diff --git a/templates/post_reply.html b/templates/post_reply.html
index b0391f19..56832710 100644
--- a/templates/post_reply.html
+++ b/templates/post_reply.html
@@ -28,6 +28,9 @@
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[{{ post.ip }}]
{% endif %}
+ {% if config.display_flags and post.modifiers.flag_country %}
+
+ {% endif %}
{% if config.poster_ids %}
@@ -49,7 +52,7 @@
{% if post.embed %}
{{ post.embed }}
{% elseif post.file == 'deleted' %}
-
+
{% elseif post.file and post.file %}
File: {{ post.file }}
(
@@ -87,7 +90,7 @@
-
+
{% elseif post.file and post.file %}
{% trans %}File:{% endtrans %} {{ post.file }}
(
@@ -42,7 +42,7 @@
)
-';
}
}
- if ($mod && isset($post['raw']) && $post['raw']) {
- $post['body'] = '' . $post['body'] . '';
- }
-
if (mysql_version() >= 50503) {
$post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset
} else {
diff --git a/templates/post_reply.html b/templates/post_reply.html
index 56832710..1cce0e27 100644
--- a/templates/post_reply.html
+++ b/templates/post_reply.html
@@ -108,6 +108,9 @@
{{ post.postControls }}
{% 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']) }}
+ {% endif %}
diff --git a/templates/post_thread.html b/templates/post_thread.html
index 5caca9a4..6824ce9d 100644
--- a/templates/post_thread.html
+++ b/templates/post_thread.html
@@ -82,6 +82,9 @@
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[{{ post.ip }}]
{% endif %}
+ {% if config.display_flags and post.modifiers.flag_country %}
+
+ {% endif %}
{% if config.poster_ids %}
@@ -127,6 +130,9 @@
{% 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']) }}
+ {% endif %}
{% if post.omitted or post.omitted_images %}
From 0f2497a5f6abe5ac9c5ab5e50e2bedfe5456b180 Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 21:34:28 +1000
Subject: [PATCH 05/13] Fix some styling for non-post img's
---
stylesheets/style.css | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/stylesheets/style.css b/stylesheets/style.css
index 16f99e9a..e62891e2 100644
--- a/stylesheets/style.css
+++ b/stylesheets/style.css
@@ -125,7 +125,7 @@ div.banner a:hover {
text-decoration: none;
}
img.banner {
- float: none;
+ display: block;
border: 1px solid #a9a9a9;
margin: 12px auto 0 auto;
}
@@ -141,7 +141,6 @@ div.post img.post-image {
}
div.post img.icon {
display: inline;
- float: none;
margin: 0 5px;
padding: 0;
}
From 57e69268ef3ae4756e09778e5e599adddb51756d Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 21:46:51 +1000
Subject: [PATCH 06/13] This wasn't usd anywhere.
---
inc/display.php | 4 ----
1 file changed, 4 deletions(-)
diff --git a/inc/display.php b/inc/display.php
index ee600ed3..c4e09eab 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -463,10 +463,6 @@ class Thread {
return $built;
}
- public function ratio() {
- return fraction($this->filex, $this->filey, ':');
- }
-
public function build($index=false) {
global $board, $config, $debug;
From eb8de3f99282d0d209256d069cc0fc2dd605bffd Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 21:48:05 +1000
Subject: [PATCH 07/13] remove some autism from readme
---
README.md | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 7bd6f461..967b1c88 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,8 @@ Tinyboard - A lightweight PHP imageboard.
About
------------
-Tinyboard is a light-weight, fast, highly configurable and user-friendly
-imageboard software package released under a non-restrictive open-source
-license. It is written in PHP and has few dependencies.
+Tinyboard is a free light-weight, fast, highly configurable and user-friendly
+imageboard software package. It is written in PHP and has few dependencies.
Requirements
------------
From aaeac9de3cd2e0909c6672f4d4dc1fd6d60a80e2 Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 21:51:10 +1000
Subject: [PATCH 08/13] forgot this here
---
inc/display.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/inc/display.php b/inc/display.php
index c4e09eab..c573db44 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -369,6 +369,7 @@ class Thread {
$this->name = utf8tohtml($this->name);
$this->mod = $mod;
$this->root = $root;
+ $this->hr = $hr;
$this->posts = array();
$this->omitted = 0;
From 23f23b830160eaf07d3d0488fd2c6343f33d5448 Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 22:02:57 +1000
Subject: [PATCH 09/13] Make js/inline-expanding.js better, now that post
images are marked with .post-image
---
js/inline-expanding.js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/js/inline-expanding.js b/js/inline-expanding.js
index 61085b0d..ac477409 100644
--- a/js/inline-expanding.js
+++ b/js/inline-expanding.js
@@ -16,10 +16,7 @@ onready(function(){
var link = this.getElementsByTagName('a');
for (var i = 0; i < link.length; i++) {
- if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' && link[i].childNodes[0].src && link[i].className != 'file') {
- if (window.jQuery && !$(link).prev().hasClass('fileinfo')) {
- continue;
- }
+ if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' && link[i].childNodes[0].src && link[i].childNodes[0].className.match(/post-image/)) {
link[i].childNodes[0].style.maxWidth = '95%';
link[i].onclick = function(e) {
if (this.childNodes[0].className == 'hidden')
From a9fe4ea2db12e8d16212ad9565d3b0a1dfdfd54d Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 22:12:25 +1000
Subject: [PATCH 10/13] Change flag_country to just flag
---
post.php | 2 +-
templates/post_reply.html | 4 ++--
templates/post_thread.html | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/post.php b/post.php
index d160c7e3..92035f77 100644
--- a/post.php
+++ b/post.php
@@ -430,7 +430,7 @@ if (isset($_POST['delete'])) {
error('GeoIP not available: ' . geoip_db_filename(GEOIP_COUNTRY_EDITION));
}
if ($country_code = @geoip_country_code_by_name($_SERVER['REMOTE_ADDR'])) {
- $post['body'] .= '' . strtolower($country_code) . '';
+ $post['body'] .= '' . strtolower($country_code) . '';
}
}
diff --git a/templates/post_reply.html b/templates/post_reply.html
index 1cce0e27..3ae60b0d 100644
--- a/templates/post_reply.html
+++ b/templates/post_reply.html
@@ -28,8 +28,8 @@
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[{{ post.ip }}]
{% endif %}
- {% if config.display_flags and post.modifiers.flag_country %}
-
+ {% if config.display_flags and post.modifiers.flag %}
+
{% endif %}
diff --git a/templates/post_thread.html b/templates/post_thread.html
index 6824ce9d..f4ca7e72 100644
--- a/templates/post_thread.html
+++ b/templates/post_thread.html
@@ -82,8 +82,8 @@
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[{{ post.ip }}]
{% endif %}
- {% if config.display_flags and post.modifiers.flag_country %}
-
+ {% if config.display_flags and post.modifiers.flag %}
+
{% endif %}
From 47ddd2f8b24b115a26403d7d7a1d8bdcb0da6c5d Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 22:18:57 +1000
Subject: [PATCH 11/13] Fix editing raw HTML posts
---
inc/mod/pages.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 9f8fcc5c..457f905b 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -1283,7 +1283,7 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
$query->bindValue(':subject', $_POST['subject']);
$query->bindValue(':body', $_POST['body']);
if ($edit_raw_html) {
- $body_nomarkup = '' . $_POST['body'] . '';
+ $body_nomarkup = $_POST['body'] . '1';
$query->bindValue(':body_nomarkup', $body_nomarkup);
}
$query->execute() or error(db_error($query));
From 0ad1c03997d43e2473039c3991e74bdd0ad9b5c1 Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 23:12:40 +1000
Subject: [PATCH 12/13] Optional "flag style" and "flag alt" modifiers
---
inc/config.php | 6 +++---
templates/post_reply.html | 4 +++-
templates/post_thread.html | 4 +++-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/inc/config.php b/inc/config.php
index 5e215fca..f0e3ea9f 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -739,9 +739,9 @@
// Location of post flags/icons (where "%s" is the flag name). Defaults to static/flags/%s.png.
// $config['uri_flags'] = 'http://static.example.org/flags/%s.png';
- // Width and height of post flags:
- $config['flag_width'] = 16;
- $config['flag_height'] = 11;
+ // Width and height (and more?) of post flags. Can be overridden with the Tinyboard post modifier:
+ // .
+ $config['flag_style'] = 'width:16px;height:11px;';
/*
* ====================
diff --git a/templates/post_reply.html b/templates/post_reply.html
index 3ae60b0d..635709bc 100644
--- a/templates/post_reply.html
+++ b/templates/post_reply.html
@@ -29,7 +29,9 @@
[{{ post.ip }}]
{% endif %}
{% if config.display_flags and post.modifiers.flag %}
-
+
{% endif %}
diff --git a/templates/post_thread.html b/templates/post_thread.html
index f4ca7e72..4630eb40 100644
--- a/templates/post_thread.html
+++ b/templates/post_thread.html
@@ -83,7 +83,9 @@
[{{ post.ip }}]
{% endif %}
{% if config.display_flags and post.modifiers.flag %}
-
+
{% endif %}
From 0565e2119d54cb4be8c6931ee42acfb586188893 Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Fri, 16 Aug 2013 23:25:32 +1000
Subject: [PATCH 13/13] Bugfix: Thumbnail sizes (thumbx => thumbwidth, etc.)
---
templates/post_reply.html | 2 +-
templates/post_thread.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/post_reply.html b/templates/post_reply.html
index 635709bc..518a8edf 100644
--- a/templates/post_reply.html
+++ b/templates/post_reply.html
@@ -104,7 +104,7 @@
{{ config.root }}{{ config.spoiler_image }}
{% else %}
{{ config.uri_thumb }}{{ post.thumb }}
- {% endif %}" style="width:{{ post.thumbx }}px;height:{{ post.thumby }}px" alt="" />
+ {% endif %}" style="width:{{ post.thumbwidth }}px;height:{{ post.thumbheight }}px" alt="" />
{% endif %}
{{ post.postControls }}
diff --git a/templates/post_thread.html b/templates/post_thread.html
index 4630eb40..fa8495d5 100644
--- a/templates/post_thread.html
+++ b/templates/post_thread.html
@@ -54,7 +54,7 @@
{{ config.root }}{{ config.spoiler_image }}
{% else %}
{{ config.uri_thumb }}{{ post.thumb }}
- {% endif %}" style="width:{{ post.thumbx }}px;height:{{ post.thumby }}px" alt="" />
+ {% endif %}" style="width:{{ post.thumbwidth }}px;height:{{ post.thumbheight }}px" alt="" />
{% endif %}