mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-23 23:20:57 +01:00
Revert "Rework the GeoIP code, add country-based poster names"
This reverts commit db3c7f4ee9
.
This commit is contained in:
parent
a9b035d822
commit
9b943da60a
@ -773,14 +773,9 @@
|
||||
// $config['board_path'] if you wish to change the URL.
|
||||
$config['board_abbreviation'] = '/%s/';
|
||||
|
||||
// The default name (e.g. Anonymous). Can be an array - in that case it's picked randomly from the array.
|
||||
// The default name (ie. Anonymous). Can be an array - in that case it's picked randomly from the array.
|
||||
// Example: $config['anonymous'] = array('Bernd', 'Senpai', 'Jonne', 'ChanPro');
|
||||
$config['anonymous'] = 'Anonymous';
|
||||
// Pick the default name based on the poster's country. Can contain subarrays and is picked randomly from the them.
|
||||
// If the user posts from a country you have not set a name for, his name is going to be whatever you set in $config['anonymous'].
|
||||
// Example 1: $config['country_anonymous'] = array('cz' => 'Pepik', 'pl' => 'Karol Wojtyla', 'de' => 'Bernd', 'fi' => 'Jonne');
|
||||
// Example 2: $config['country_anonymous'] = array('cz' => array('Pepik', 'Bohus', 'Lada'), 'pl' => array('Karol Wojtyla', 'Demon Pedofyl');
|
||||
$config['country_anonymous'] = false;
|
||||
|
||||
// Number of reports you can create at once.
|
||||
$config['report_limit'] = 3;
|
||||
|
@ -21,8 +21,6 @@ require_once 'inc/api.php';
|
||||
require_once 'inc/bans.php';
|
||||
require_once 'inc/lib/gettext/gettext.inc';
|
||||
|
||||
use Lifo\IP\IP;
|
||||
|
||||
// the user is not currently logged in as a moderator
|
||||
$mod = false;
|
||||
|
||||
@ -244,23 +242,6 @@ function loadConfig() {
|
||||
|
||||
if (is_array($config['anonymous']))
|
||||
$config['anonymous'] = $config['anonymous'][array_rand($config['anonymous'])];
|
||||
|
||||
if ($config['country_flags'] || $config['country_anonymous']) {
|
||||
require_once 'inc/lib/geoip/geoip.inc';
|
||||
$gi=geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
|
||||
$ipaddy = $_SERVER['REMOTE_ADDR'];
|
||||
if (IP::isIPv4($ipaddy))
|
||||
$ipaddy = IP::to_ipv6($ipaddy, true);
|
||||
global $country_code, $country_name;
|
||||
$country_code = strtolower(geoip_country_code_by_addr_v6($gi, $ipaddy));
|
||||
$country_name = geoip_country_name_by_addr_v6($gi, $ipaddy);
|
||||
if (isset($config['country_anonymous'][$country_code])) {
|
||||
if (is_array($config['country_anonymous'][$country_code]))
|
||||
$config['anonymous'] = $config['country_anonymous'][$country_code][array_rand($config['country_anonymous'][$country_code])];
|
||||
else
|
||||
$config['anonymous'] = $config['country_anonymous'][$country_code];
|
||||
}
|
||||
}
|
||||
|
||||
event('load-config');
|
||||
|
||||
|
22
post.php
22
post.php
@ -488,8 +488,26 @@ if (isset($_POST['delete'])) {
|
||||
}
|
||||
|
||||
if ($config['country_flags']) {
|
||||
if (!in_array($country_code, array('eu', 'ap', 'o1', 'a1', 'a2')))
|
||||
$post['body'] .= "\n<tinyboard flag>".$country_code."</tinyboard>\n<tinyboard flag alt>".$country_name."</tinyboard>";
|
||||
require 'inc/lib/geoip/geoip.inc';
|
||||
$gi=geoip\geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
|
||||
|
||||
function ipv4to6($ip) {
|
||||
if (strpos($ip, ':') !== false) {
|
||||
if (strpos($ip, '.') > 0)
|
||||
$ip = substr($ip, strrpos($ip, ':')+1);
|
||||
else return $ip; //native ipv6
|
||||
}
|
||||
$iparr = array_pad(explode('.', $ip), 4, 0);
|
||||
$part7 = base_convert(($iparr[0] * 256) + $iparr[1], 10, 16);
|
||||
$part8 = base_convert(($iparr[2] * 256) + $iparr[3], 10, 16);
|
||||
return '::ffff:'.$part7.':'.$part8;
|
||||
}
|
||||
|
||||
if ($country_code = geoip\geoip_country_code_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']))) {
|
||||
if (!in_array(strtolower($country_code), array('eu', 'ap', 'o1', 'a1', 'a2')))
|
||||
$post['body'] .= "\n<tinyboard flag>".strtolower($country_code)."</tinyboard>".
|
||||
"\n<tinyboard flag alt>".geoip\geoip_country_name_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']))."</tinyboard>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['user_flag'] && isset($_POST['user_flag']))
|
||||
|
Loading…
Reference in New Issue
Block a user