diff --git a/_backend/GeoLite2-City.mmdb b/_backend/GeoLite2-City.mmdb index ce96b61b4d..e52c3873c8 100644 Binary files a/_backend/GeoLite2-City.mmdb and b/_backend/GeoLite2-City.mmdb differ diff --git a/_backend/composer.json b/_backend/composer.json index 31b5983cb8..8d96b56ae6 100644 --- a/_backend/composer.json +++ b/_backend/composer.json @@ -2,6 +2,9 @@ "config": { "platform": { "php": "8.1" + }, + "allow-plugins": { + "php-http/discovery": true } }, "autoload": { @@ -14,7 +17,7 @@ "stripe/stripe-php": "13.14.0", "sentry/sdk": "^3.3.0", "erusev/parsedown-extra": "^0.8", - "geoip2/geoip2": "^2.0", + "geoip2/geoip2": "^3.0", "ext-intl": ">=7", "ext-json": ">=7" }, @@ -22,4 +25,4 @@ "league/climate": "^3.2", "squizlabs/php_codesniffer": "3.*" } -} \ No newline at end of file +} diff --git a/_backend/composer.lock b/_backend/composer.lock index a38fbf564e..30e63b907b 100644 --- a/_backend/composer.lock +++ b/_backend/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7c7504757f6fd4d73af78856d8045e21", + "content-hash": "dbf470e2e386cc18cee0c1c9fd6d00c8", "packages": [ { "name": "clue/stream-filter", @@ -74,28 +74,28 @@ }, { "name": "composer/ca-bundle", - "version": "1.3.5", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "74780ccf8c19d6acb8d65c5f39cd72110e132bbd" + "reference": "0c5ccfcfea312b5c5a190a21ac5cef93f74baf99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/74780ccf8c19d6acb8d65c5f39cd72110e132bbd", - "reference": "74780ccf8c19d6acb8d65c5f39cd72110e132bbd", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/0c5ccfcfea312b5c5a190a21ac5cef93f74baf99", + "reference": "0c5ccfcfea312b5c5a190a21ac5cef93f74baf99", "shasum": "" }, "require": { "ext-openssl": "*", "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", + "phpstan/phpstan": "^1.10", "psr/log": "^1.0", "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + "symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", "extra": { @@ -130,7 +130,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.5" + "source": "https://github.com/composer/ca-bundle/tree/1.5.0" }, "funding": [ { @@ -146,7 +146,7 @@ "type": "tidelift" } ], - "time": "2023-01-11T08:27:00+00:00" + "time": "2024-03-15T14:00:32+00:00" }, { "name": "erusev/parsedown", @@ -251,28 +251,28 @@ }, { "name": "geoip2/geoip2", - "version": "v2.13.0", + "version": "v3.0.0", "source": { "type": "git", - "url": "git@github.com:maxmind/GeoIP2-php.git", - "reference": "6a41d8fbd6b90052bc34dff3b4252d0f88067b23" + "url": "https://github.com/maxmind/GeoIP2-php.git", + "reference": "1a802ce9356cdd1c6b681c030fd9563750e11e6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/6a41d8fbd6b90052bc34dff3b4252d0f88067b23", - "reference": "6a41d8fbd6b90052bc34dff3b4252d0f88067b23", + "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/1a802ce9356cdd1c6b681c030fd9563750e11e6a", + "reference": "1a802ce9356cdd1c6b681c030fd9563750e11e6a", "shasum": "" }, "require": { "ext-json": "*", - "maxmind-db/reader": "~1.8", + "maxmind-db/reader": "^1.11.1", "maxmind/web-service-common": "~0.8", - "php": ">=7.2" + "php": ">=8.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "3.*", "phpstan/phpstan": "*", - "phpunit/phpunit": "^8.0 || ^9.0", + "phpunit/phpunit": "^10.0", "squizlabs/php_codesniffer": "3.*" }, "type": "library", @@ -301,7 +301,11 @@ "geolocation", "maxmind" ], - "time": "2022-08-05T20:32:58+00:00" + "support": { + "issues": "https://github.com/maxmind/GeoIP2-php/issues", + "source": "https://github.com/maxmind/GeoIP2-php/tree/v3.0.0" + }, + "time": "2023-12-04T17:16:34+00:00" }, { "name": "guzzlehttp/promises", @@ -621,23 +625,23 @@ }, { "name": "maxmind-db/reader", - "version": "v1.11.0", + "version": "v1.11.1", "source": { "type": "git", - "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", - "reference": "b1f3c0699525336d09cc5161a2861268d9f2ae5b" + "url": "git@github.com:maxmind/MaxMind-DB-Reader-php.git", + "reference": "1e66f73ffcf25e17c7a910a1317e9720a95497c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/b1f3c0699525336d09cc5161a2861268d9f2ae5b", - "reference": "b1f3c0699525336d09cc5161a2861268d9f2ae5b", + "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/1e66f73ffcf25e17c7a910a1317e9720a95497c7", + "reference": "1e66f73ffcf25e17c7a910a1317e9720a95497c7", "shasum": "" }, "require": { "php": ">=7.2" }, "conflict": { - "ext-maxminddb": "<1.10.1,>=2.0.0" + "ext-maxminddb": "<1.11.1,>=2.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "3.*", @@ -678,11 +682,7 @@ "geolocation", "maxmind" ], - "support": { - "issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues", - "source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.11.0" - }, - "time": "2021-10-18T15:23:10+00:00" + "time": "2023-12-02T00:09:23+00:00" }, { "name": "maxmind/web-service-common", diff --git a/_backend/classify.current.php b/_backend/geolocate.download.php similarity index 68% rename from _backend/classify.current.php rename to _backend/geolocate.download.php index 42240f3137..a8c59d784e 100644 --- a/_backend/classify.current.php +++ b/_backend/geolocate.download.php @@ -1,7 +1,9 @@ city($hostname); - $country = $record->country->isoCode; - } catch (\Exception $e) { - if ($debug) { - echo $e->getMessage(); - } else { - error_log($e->getMessage()); - } - $country = false; - } - - if ($debug) { - echo 'Country: "'.$country.'"'."\n"; - } - - return $country; -} - - function getCurrentLocation($hostname, $debug = false) { diff --git a/_backend/classify.get_ip.php b/_backend/geolocate.guess_ip.php similarity index 100% rename from _backend/classify.get_ip.php rename to _backend/geolocate.guess_ip.php diff --git a/_backend/geolocate.test.php b/_backend/geolocate.test.php new file mode 100644 index 0000000000..8311e8a74f --- /dev/null +++ b/_backend/geolocate.test.php @@ -0,0 +1,13 @@ += 11 (Majority) -} elseif (strrpos($ua, 'Trident/') !== false) { - $rv = strrpos($ua, 'rv:'); - $iev = intval(substr($ua, ($rv + 3), strrpos($ua, '.', $rv))); -} - -// No detection of 0 - 4 -// Rarely used. - -// If is IE, mark it as so. -if ($iev) { - $isie = true; -} - -if ( - // If DNT is on - isset($_SERVER['HTTP_DNT']) && - $_SERVER['HTTP_DNT'] && - ( - // AND you are not using IE 10 or later - $iev < 10 || - // OR we were asked to respect it - $respectIE - ) -) { - $dnt = true; -} - -$trackme = !$dnt; diff --git a/_backend/preload.php b/_backend/preload.php index 79995a2489..2d7203fdbd 100644 --- a/_backend/preload.php +++ b/_backend/preload.php @@ -3,12 +3,6 @@ require __DIR__ . '/bootstrap.php'; require_once __DIR__.'/log-echo.php'; -// Honor the IE do-not-track-header, -// even though it's set automatically. -$respectIE = true; -// Set the DNT variables. -require_once __DIR__.'/here-miss.php'; - date_default_timezone_set('UTC'); $sitewide['title'] = 'elementary'; diff --git a/api/config.php b/api/config.php index 6a90ab2d7b..75116b192e 100644 --- a/api/config.php +++ b/api/config.php @@ -5,9 +5,8 @@ * Live-generated JSON configuration for use in client side javascript */ -require_once __DIR__.'/../_backend/classify.current.php'; +require_once __DIR__.'/../_backend/geolocate.download.php'; // provides $region, $timecode require_once __DIR__.'/../_backend/config.loader.php'; -require_once __DIR__.'/../_backend/here-miss.php'; $output = array( 'release' => array( @@ -27,8 +26,7 @@ 'user' => array( 'ip' => $ip, 'region' => $region, - 'timecode' => $timecode, - 'trackme' => $trackme + 'timecode' => $timecode ) ); diff --git a/api/geolocate.php b/api/geolocate.php index dbdda6f36c..d5a098d2f8 100644 --- a/api/geolocate.php +++ b/api/geolocate.php @@ -1,7 +1,7 @@