forked from leftypol/leftypol
geoip: compatibility fix; this allows to have both versions of geoip loaded
This commit is contained in:
parent
9dad842c24
commit
bcb47a1d33
2 changed files with 53 additions and 51 deletions
6
post.php
6
post.php
|
@ -448,7 +448,7 @@ if (isset($_POST['delete'])) {
|
|||
|
||||
if ($config['country_flags']) {
|
||||
require 'inc/lib/geoip/geoip.inc';
|
||||
$gi=geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
|
||||
$gi=geoip\geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
|
||||
|
||||
function ipv4to6($ip) {
|
||||
if (strpos($ip, ':') !== false) {
|
||||
|
@ -462,10 +462,10 @@ if (isset($_POST['delete'])) {
|
|||
return '::ffff:'.$part7.':'.$part8;
|
||||
}
|
||||
|
||||
if ($country_code = geoip_country_code_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']))) {
|
||||
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_country_name_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']))."</tinyboard>";
|
||||
"\n<tinyboard flag alt>".geoip\geoip_country_name_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']))."</tinyboard>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue