diff --git a/cal.php b/cal.php
index 68b5ca1331..0ee2bc2e83 100644
--- a/cal.php
+++ b/cal.php
@@ -232,7 +232,7 @@ function date_for_recur($recur, $day, $bom, $eom)
function display_events_for_day($day, $events): void
{
// For preservation of state in the links
- global $cm, $cy, $COUNTRY;
+ global $cm, $cy;
// For all events, try to find the events for this day
foreach ($events as $event) {
@@ -241,12 +241,10 @@ function display_events_for_day($day, $events): void
if (($event['type'] == 2 && $event['start'] <= $day && $event['end'] >= $day)
|| ($event['start'] == $day)) {
echo '
';
}
}
diff --git a/include/ip-to-country.inc b/include/ip-to-country.inc
index 995d55e85e..87b38514cf 100644
--- a/include/ip-to-country.inc
+++ b/include/ip-to-country.inc
@@ -1,188 +1,4 @@
= $idxpart && $ip_chunk < (int) $data[0]) {
- return [$recnum, (int) $data[1]];
- }
-
- // Store for next compare
- $idxpart = (int) $data[0];
- $recnum = (int) $data[1];
- }
-
- // Return record number found
- return [$recnum, -1];
-}
-
-// Find the country searching from record $idx
-// $ip should be an IP number and not an IP address
-function i2c_search_in_db($ip, $idx)
-{
- // Default range and country
- $range_start = 0; $range_end = 0;
- $country = "NA";
-
- // Open DB for reading
- $ipdb = fopen(
- $_SERVER['DOCUMENT_ROOT'] . "/backend/ip-to-country.db",
- "r",
- );
-
- // Return with "NA" in case of we cannot open the db
- if (!$ipdb) { return $country; }
-
- // Jump to record $idx
- fseek($ipdb, ($idx[0] ? (($idx[0] - 1) * 24) : 0));
-
- // Read records until we hit the end of the file,
- // or we find the range where this IP is, or we
- // reach the next indexed part [where the IP should
- // not be found, so there is no point in searching further]
- while (!feof($ipdb) && !($range_start <= $ip && $range_end >= $ip)) {
-
- // We had run out of the indexed region,
- // where we expected to find the IP
- if ($idx[1] != -1 && $idx[0] > $idx[1]) {
- $country = "NA"; break;
- }
-
- // Try to read record
- $record = fread($ipdb, 24);
-
- // Unable to read the record => error
- if (strlen($record) != 24) { $country = "NA"; break; }
-
- // Split the record to it's parts
- $range_start = (float) substr($record, 0, 10);
- $range_end = (float) substr($record, 10, 10);
- $country = substr($record, 20, 3);
-
- // Getting closer to the end of the indexed region
- $idx[0] += 1;
- }
-
- // Close datafile
- fclose($ipdb);
-
- // Return with the country found
- return $country;
-}
-
-// Check if the current country is valid
-function i2c_valid_country()
-{
- global $COUNTRY, $COUNTRIES;
- return (!empty($COUNTRY) && $COUNTRY != "NA" && isset($COUNTRIES[$COUNTRY]));
-}
-
// Returns the real IP address of the user
function i2c_realip()
{
diff --git a/include/prepend.inc b/include/prepend.inc
index 1ffd80f1b0..83e50b8260 100644
--- a/include/prepend.inc
+++ b/include/prepend.inc
@@ -71,7 +71,6 @@ unset($RSIDEBAR_DATA);
unset($SIDEBAR_DATA);
unset($SEARCH_BASE);
unset($LANG);
-unset($COUNTRY);
unset($ONLOAD);
unset($LAST_UPDATED);
@@ -86,7 +85,7 @@ include __DIR__ . '/site.inc';
// Choose language used for translated parts
include __DIR__ . '/langchooser.inc';
-// Get country of the user and set it in a cookie
+// Import function to get the real IP address
include __DIR__ . '/ip-to-country.inc';
// Common layout functions
diff --git a/my.php b/my.php
index 1fdb9d2824..88ccab0b74 100644
--- a/my.php
+++ b/my.php
@@ -146,25 +146,6 @@
language selection pages, etc.
-Your country
-
-
- The PHP.net site tries to detect your country
- using the Directi
- Ip-to-Country Database. This information is used to mark
- the events in your country specially.
-
-
-
-" . $COUNTRIES[$COUNTRY] . "";
-} else {
- echo "We were unable to detect your country";
-}
-?>
-
-
URL search fallback