Switched to lighter geoip package.

This commit is contained in:
Daniel Saunders 2020-01-22 21:44:18 -05:00
parent 0884eb3089
commit 191578f47f
3 changed files with 65 additions and 1590 deletions

View File

@ -11,7 +11,7 @@
"gettext/gettext": "^4.4",
"twig/twig": "^2.4",
"twig/extensions": "^1.5",
"maxmind/geoip": "^1.1",
"geoip/geoip": "^1.16",
"mrclay/minify": "^3.0",
"awsumchan/ip": "^1.1",
"erusev/parsedown": "^1.7"

1647
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -525,7 +525,7 @@ if (isset($_POST['delete'])) {
$post['body'] .= "\n<tinyboard raw html>1</tinyboard>";
if (($config['country_flags'] && !$config['allow_no_country']) || ($config['country_flags'] && $config['allow_no_country'] && !isset($_POST['no_country']))) {
$gi=geoip\geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
$gi=geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
function ipv4to6($ip) {
if (strpos($ip, ':') !== false) {
@ -540,10 +540,10 @@ if (isset($_POST['delete'])) {
return '::ffff:'.$part7.':'.$part8;
}
if ($country_code = geoip\geoip_country_code_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']))) {
if ($country_code = 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>';
"\n<tinyboard flag alt>" . geoip_country_name_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR'])) . '</tinyboard>';
}
}