Browse Source

GeoIP: Ignore country codes that aren't country codes: ap (Asia/Pacific), EU, etc.

pull/40/head
Michael Foster 11 years ago
parent
commit
3a27060503
  1. 5
      post.php

5
post.php

@ -430,8 +430,9 @@ if (isset($_POST['delete'])) {
error('GeoIP not available: ' . geoip_db_filename(GEOIP_COUNTRY_EDITION));
}
if ($country_code = @geoip_country_code_by_name($_SERVER['REMOTE_ADDR'])) {
$post['body'] .= "\n<tinyboard flag>" . strtolower($country_code) . "</tinyboard>" .
"\n<tinyboard flag alt>" . @geoip_country_name_by_name($_SERVER['REMOTE_ADDR']) . "</tinyboard>";
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_name($_SERVER['REMOTE_ADDR']) . "</tinyboard>";
}
}

Loading…
Cancel
Save