summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrick Brennan <admin@8chan.co>2014-09-20 15:21:50 +0000
committerFredrick Brennan <admin@8chan.co>2014-09-20 16:35:28 +0000
commit23c73ca83943fb720addebe461286bc4ff3679b9 (patch)
treeca31cfde85612e649a6bfb219caebe470860b1dc
parent1ce9fb8174cd7f5fb39f87b83095caf6a47258f1 (diff)
Allow the user to decide whether or not he wants to display his country
-rw-r--r--inc/config.php4
-rw-r--r--js/quick-reply.js2
-rw-r--r--post.php2
-rw-r--r--templates/post_form.html2
4 files changed, 8 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php
index 3dd8eb6c..e2cc2ebd 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -274,6 +274,7 @@
'file_url',
'json_response',
'user_flag',
+ 'no_country'
);
// Enable reCaptcha to make spam even harder. Rarely necessary.
@@ -531,6 +532,9 @@
// Attach country flags to posts.
$config['country_flags'] = false;
+ // Allow the user to decide whether or not he wants to display his country
+ $config['allow_no_country'] = false;
+
// Load all country flags from one file
$config['country_flags_condensed'] = true;
$config['country_flags_condensed_css'] = 'static/flags/flags.css';
diff --git a/js/quick-reply.js b/js/quick-reply.js
index 93cab334..07fe4aef 100644
--- a/js/quick-reply.js
+++ b/js/quick-reply.js
@@ -266,6 +266,8 @@
$postForm.find('input[type="file"]').parent()
.removeAttr('colspan')
.after($('<td class="spoiler"></td>').append(this, ' ', $('<label for="q-spoiler-image">').text(_('Spoiler Image'))));
+ } else if ($(this).attr('name') == 'no_country') {
+ $td.find('label,input[type="checkbox"]').remove();
} else {
$(tr).remove();
}
diff --git a/post.php b/post.php
index 033e5ab5..2763d4d3 100644
--- a/post.php
+++ b/post.php
@@ -487,7 +487,7 @@ if (isset($_POST['delete'])) {
$post['body'] .= "\n<tinyboard raw html>1</tinyboard>";
}
- if ($config['country_flags']) {
+ if (($config['country_flags'] && !$config['allow_no_country']) || ($config['country_flags'] && $config['allow_no_country'] && !isset($_POST['no_country']))) {
require 'inc/lib/geoip/geoip.inc';
$gi=geoip\geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
diff --git a/templates/post_form.html b/templates/post_form.html
index 3e425245..1846adb5 100644
--- a/templates/post_form.html
+++ b/templates/post_form.html
@@ -15,7 +15,7 @@
{{ antibot.html() }}
</th>
<td>
- <input type="text" name="name" size="25" maxlength="35" autocomplete="off">
+ <input type="text" name="name" size="25" maxlength="35" autocomplete="off"> {% if config.allow_no_country and config.country_flags %}<input id="no_country" name="no_country" type="checkbox"> <label for="no_country">{% trans %}Don't show my flag{% endtrans %}</label>{% endif %}
{{ antibot.html() }}
</td>
</tr>{% endif %}