Minor improvements (#1482)

* Minor improvements

* Update functions.php

* Update functions.php

* Update CHANGELOG.md

* Update composer.lock
This commit is contained in:
Roman Kelesidis 2024-05-23 23:31:21 +07:00 committed by GitHub
commit 430825c3e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 188 deletions

View file

@ -19,7 +19,7 @@
- Demo mode: Allow registering torrents by default [\#1440](https://github.com/torrentpier/torrentpier/pull/1440) ([belomaxorka](https://github.com/belomaxorka))
- Temp: Removed showing forum description in `viewforum.php` [\#1465](https://github.com/torrentpier/torrentpier/pull/1465) ([belomaxorka](https://github.com/belomaxorka))
- Code refactoring [\#1441](https://github.com/torrentpier/torrentpier/pull/1441) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461), [\#1462](https://github.com/torrentpier/torrentpier/pull/1462), [\#1467](https://github.com/torrentpier/torrentpier/pull/1467), [\#1469](https://github.com/torrentpier/torrentpier/pull/1469), [\#1472](https://github.com/torrentpier/torrentpier/pull/1472), [\#1477](https://github.com/torrentpier/torrentpier/pull/1477), [\#1480](https://github.com/torrentpier/torrentpier/pull/1480), [\#1481](https://github.com/torrentpier/torrentpier/pull/1481) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461), [\#1462](https://github.com/torrentpier/torrentpier/pull/1462), [\#1467](https://github.com/torrentpier/torrentpier/pull/1467), [\#1469](https://github.com/torrentpier/torrentpier/pull/1469), [\#1472](https://github.com/torrentpier/torrentpier/pull/1472), [\#1477](https://github.com/torrentpier/torrentpier/pull/1477), [\#1480](https://github.com/torrentpier/torrentpier/pull/1480), [\#1481](https://github.com/torrentpier/torrentpier/pull/1481), [\#1482](https://github.com/torrentpier/torrentpier/pull/1482) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#1454](https://github.com/torrentpier/torrentpier/pull/1454), [\#1455](https://github.com/torrentpier/torrentpier/pull/1455), [\#1459](https://github.com/torrentpier/torrentpier/pull/1459), [\#1460](https://github.com/torrentpier/torrentpier/pull/1460) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453), [\#1468](https://github.com/torrentpier/torrentpier/pull/1468), [\#1473](https://github.com/torrentpier/torrentpier/pull/1473), [\#1476](https://github.com/torrentpier/torrentpier/pull/1476), [\#1479](https://github.com/torrentpier/torrentpier/pull/1479) ([Exileum](https://github.com/Exileum))

192
composer.lock generated
View file

@ -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": "3fb022a8706a580cdc67b5c4cdd52e8e",
"content-hash": "0262bbf45b724f07d7e21875b5eafa44",
"packages": [
{
"name": "arokettu/bencode",
@ -678,64 +678,6 @@
],
"time": "2023-11-03T12:00:00+00:00"
},
{
"name": "geoip2/geoip2",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/maxmind/GeoIP2-php.git",
"reference": "1a802ce9356cdd1c6b681c030fd9563750e11e6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/1a802ce9356cdd1c6b681c030fd9563750e11e6a",
"reference": "1a802ce9356cdd1c6b681c030fd9563750e11e6a",
"shasum": ""
},
"require": {
"ext-json": "*",
"maxmind-db/reader": "^1.11.1",
"maxmind/web-service-common": "~0.8",
"php": ">=8.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.*",
"phpstan/phpstan": "*",
"phpunit/phpunit": "^10.0",
"squizlabs/php_codesniffer": "3.*"
},
"type": "library",
"autoload": {
"psr-4": {
"GeoIp2\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com",
"homepage": "https://www.maxmind.com/"
}
],
"description": "MaxMind GeoIP2 PHP API",
"homepage": "https://github.com/maxmind/GeoIP2-php",
"keywords": [
"IP",
"geoip",
"geoip2",
"geolocation",
"maxmind"
],
"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": "gigablah/sphinxphp",
"version": "2.0.8",
@ -1476,122 +1418,6 @@
},
"time": "2016-10-23T20:08:46+00:00"
},
{
"name": "maxmind-db/reader",
"version": "v1.11.1",
"source": {
"type": "git",
"url": "https://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/1e66f73ffcf25e17c7a910a1317e9720a95497c7",
"reference": "1e66f73ffcf25e17c7a910a1317e9720a95497c7",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"conflict": {
"ext-maxminddb": "<1.11.1,>=2.0.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.*",
"php-coveralls/php-coveralls": "^2.1",
"phpstan/phpstan": "*",
"phpunit/phpcov": ">=6.0.0",
"phpunit/phpunit": ">=8.0.0,<10.0.0",
"squizlabs/php_codesniffer": "3.*"
},
"suggest": {
"ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
"ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
},
"type": "library",
"autoload": {
"psr-4": {
"MaxMind\\Db\\": "src/MaxMind/Db"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com",
"homepage": "https://www.maxmind.com/"
}
],
"description": "MaxMind DB Reader API",
"homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
"keywords": [
"database",
"geoip",
"geoip2",
"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.1"
},
"time": "2023-12-02T00:09:23+00:00"
},
{
"name": "maxmind/web-service-common",
"version": "v0.9.0",
"source": {
"type": "git",
"url": "https://github.com/maxmind/web-service-common-php.git",
"reference": "4dc5a3e8df38aea4ca3b1096cee3a038094e9b53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/4dc5a3e8df38aea4ca3b1096cee3a038094e9b53",
"reference": "4dc5a3e8df38aea4ca3b1096cee3a038094e9b53",
"shasum": ""
},
"require": {
"composer/ca-bundle": "^1.0.3",
"ext-curl": "*",
"ext-json": "*",
"php": ">=7.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.*",
"phpstan/phpstan": "*",
"phpunit/phpunit": "^8.0 || ^9.0",
"squizlabs/php_codesniffer": "3.*"
},
"type": "library",
"autoload": {
"psr-4": {
"MaxMind\\Exception\\": "src/Exception",
"MaxMind\\WebService\\": "src/WebService"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory Oschwald",
"email": "goschwald@maxmind.com"
}
],
"description": "Internal MaxMind Web Service API",
"homepage": "https://github.com/maxmind/web-service-common-php",
"support": {
"issues": "https://github.com/maxmind/web-service-common-php/issues",
"source": "https://github.com/maxmind/web-service-common-php/tree/v0.9.0"
},
"time": "2022-03-28T17:43:20+00:00"
},
{
"name": "monolog/monolog",
"version": "3.6.0",
@ -2025,20 +1851,20 @@
},
{
"name": "psr/http-factory",
"version": "1.0.2",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35"
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
@ -2062,7 +1888,7 @@
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
@ -2074,9 +1900,9 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
"source": "https://github.com/php-fig/http-factory"
},
"time": "2023-04-10T20:10:41+00:00"
"time": "2024-04-15T12:06:14+00:00"
},
{
"name": "psr/http-message",

View file

@ -2170,14 +2170,23 @@ function readUpdaterFile(): array|bool
*
* @param string $ipAddress
* @param int $port
* @return mixed|string|null
* @return array
*/
function infoByIP(string $ipAddress, int $port = 0): mixed
function infoByIP(string $ipAddress, int $port = 0): array
{
if (!$data = CACHE('bb_ip2countries')->get($ipAddress . '_' . $port)) {
$data = [];
$response = file_get_contents(API_IP_URL . $ipAddress);
$data = json_decode($response, true);
CACHE('bb_ip2countries')->set($ipAddress . '_' . $port, $data, 1200);
$json = json_decode($response, true);
if (is_array($json) && !empty($json)) {
$data = [
'ipVersion' => $json['ipVersion'],
'countryCode' => $json['countryCode'],
'continent' => $json['continent'],
'continentCode' => $json['continentCode']
];
CACHE('bb_ip2countries')->set($ipAddress . '_' . $port, $data, 1200);
}
}
return $data;