summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaf <admin@cable6.net>2014-04-19 12:56:59 +0000
committerczaks <marcin@6irc.net>2014-04-19 18:48:17 +0200
commitf83c87b623e71e1b88b1095ab4c4a0fd8fcf0d3a (patch)
tree9ebe50073ff177dee162f2969b799add7bc34b18
parent17967436e38bcc52d20326754146eccfd49897f5 (diff)
Added: /pol/-like flags based on https://github.com/dubcheck/Tinyboard/commit/a953229de7a370fe036d9458d024e20ea6e8de80
Conflicts: inc/config.php templates/post_form.html
-rw-r--r--inc/config.php15
-rw-r--r--inc/functions.php4
-rw-r--r--post.php14
-rw-r--r--templates/post_form.html13
4 files changed, 46 insertions, 0 deletions
diff --git a/inc/config.php b/inc/config.php
index fbf7d71b..922594e4 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -531,6 +531,21 @@
$config['country_flags_condensed'] = true;
$config['country_flags_condensed_css'] = 'static/flags/flags.css';
+ // Let the user choose a /pol/-like user_flag that will be shown in the post. For the user flags, please be aware
+ // that you will have to disable BOTH country_flags and contry_flags_condensed optimization (at least on a board
+ // where they are enabled).
+ $config['user_flag'] = false;
+
+ // List of user_flag the user can choose. Flag must be placed in the directory set by $config['uri_flags']
+ $config['user_flags'] = [];
+ /* example: 
+ $config['user_flags'] = array (
+ 'nz' => 'Nazi',
+ 'cm' => 'Communist',
+ 'eu' => 'Europe'
+ );
+ */
+
/*
* ====================
* Ban settings
diff --git a/inc/functions.php b/inc/functions.php
index b6927b4a..1393f580 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -201,6 +201,10 @@ function loadConfig() {
$config['additional_javascript_url'] = $config['root'];
if (!isset($config['uri_flags']))
$config['uri_flags'] = $config['root'] . 'static/flags/%s.png';
+ if (!isset($config['user_flag']))
+ $config['user_flag'] = false;
+ if (!isset($config['user_flags']))
+ $config['user_flags'] = [];
if ($config['root_file']) {
chdir($config['root_file']);
diff --git a/post.php b/post.php
index b18fc138..91abe7e6 100644
--- a/post.php
+++ b/post.php
@@ -469,6 +469,20 @@ if (isset($_POST['delete'])) {
}
}
+ if ($config['user_flag'] && isset($_POST['user_flag']))
+ if (!empty($_POST['user_flag']) ){
+
+ $user_flag = $_POST['user_flag'];
+
+ if (!isset($config['user_flags'][$user_flag]))
+ error('Invalid flag selection!');
+
+ $flag_alt = isset($user_flag_alt) ? $user_flag_alt : $config['user_flags'][$user_flag];
+
+ $post['body'] .= "\n<tinyboard flag>" . strtolower($user_flag) . "</tinyboard>" .
+ "\n<tinyboard flag alt>" . $flag_alt . "</tinyboard>";
+ }
+
if (mysql_version() >= 50503) {
$post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset
} else {
diff --git a/templates/post_form.html b/templates/post_form.html
index 09c2d48f..b06324cf 100644
--- a/templates/post_form.html
+++ b/templates/post_form.html
@@ -79,6 +79,19 @@
</td>
</tr>
{% endif %}
+ {% if config.user_flag %}
+ <tr>
+ <th>{% trans %}Flag{% endtrans %}</th>
+ <td>
+ <select name="user_flag" id="user_flag">
+ <option value="">{% trans %}None{% endtrans %}</option>
+ {% for flag, text in config.user_flags %}
+ <option value="{{ flag }}">{{ text }}</option>
+ {% endfor %}
+ </select>
+ </td>
+ </tr>
+ {% endif %}
<tr id="upload">
<th>
{% trans %}File{% endtrans %}