From e6444a5a47a4a788cfbb05557f22906eb3bef0d2 Mon Sep 17 00:00:00 2001 From: beu Date: Thu, 23 Jan 2025 19:33:22 +0100 Subject: [PATCH] merge Maniacontrol official repository changes --- changelog.txt | 7 +++++++ core/Database/Database.php | 3 +++ core/ManiaControl.php | 2 +- core/ManiaExchange/MXMapInfo.php | 2 +- core/ManiaExchange/ManiaExchangeManager.php | 6 +++--- core/ManiaExchange/ManiaExchangeMapSearch.php | 4 ++-- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index 51772c09..21839205 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +###v0.258### +#Changes +- MC compatibility with MX v2 api +###v0.257### +#Changes +- MC now supports php 8.0 and 8.1 + ###v0.255### #Additions - added optional descriptions to Settings (but no MC-settings have descriptions yet) diff --git a/core/Database/Database.php b/core/Database/Database.php index 53ac2871..eed02c66 100644 --- a/core/Database/Database.php +++ b/core/Database/Database.php @@ -44,6 +44,9 @@ class Database implements TimerListener { // Enable mysqli Reconnect ini_set('mysqli.reconnect', 'on'); + // Change error report mechanism -> used to set compatibility to php < 8.1 + mysqli_report(MYSQLI_REPORT_OFF); + // Open database connection $this->loadConfig(); $this->mysqli = @new \mysqli($this->config->host, $this->config->user, $this->config->pass, null, $this->config->port); diff --git a/core/ManiaControl.php b/core/ManiaControl.php index bd8a963d..de12ba40 100644 --- a/core/ManiaControl.php +++ b/core/ManiaControl.php @@ -56,7 +56,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, /* * Constants */ - const VERSION = '0.256'; + const VERSION = '0.258'; const ISTRACKMANIACONTROL = True; const API_VERSION = '2038-01-19'; const MIN_DEDIVERSION = '2020-07-01_00_00'; diff --git a/core/ManiaExchange/MXMapInfo.php b/core/ManiaExchange/MXMapInfo.php index a3551d69..4e5cb686 100644 --- a/core/ManiaExchange/MXMapInfo.php +++ b/core/ManiaExchange/MXMapInfo.php @@ -44,7 +44,7 @@ class MXMapInfo { } else { $this->dir = 'maps'; $this->id = $mx->MapID; - $this->uid = isset($mx->MapUID) ? $mx->MapUID : ''; + $this->uid = isset($mx->TrackUID) ? $mx->TrackUID : ''; // TODO: fix when migrating to new api; TrackUID is equal to MapUID } if (!isset($mx->GbxMapName) || $mx->GbxMapName === '?') { diff --git a/core/ManiaExchange/ManiaExchangeManager.php b/core/ManiaExchange/ManiaExchangeManager.php index 27488623..05a8c009 100644 --- a/core/ManiaExchange/ManiaExchangeManager.php +++ b/core/ManiaExchange/ManiaExchangeManager.php @@ -23,7 +23,7 @@ class ManiaExchangeManager implements UsageInformationAble { * Constants * @deprecated SEARCH Constants */ - //Search orders (prior parameter) https://api.mania-exchange.com/documents/enums#orderings + //Search orders (prior parameter) https://api2.mania.exchange/documents/enums#orderings const SEARCH_ORDER_NONE = -1; const SEARCH_ORDER_TRACK_NAME = 0; const SEARCH_ORDER_AUTHOR = 1; @@ -190,7 +190,7 @@ class ManiaExchangeManager implements UsageInformationAble { } // compile search URL - $url = "https://{$titlePrefix}/api/maps/get_map_info/multi/{$string}"; + $url = 'https://' . $titlePrefix . ".mania.exchange/api/maps/get_map_info/multi/{$string}"; /*if ($key = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KEY)) { $url .= "&key=" . $key; @@ -300,7 +300,7 @@ class ManiaExchangeManager implements UsageInformationAble { } // compile search URL - $url = "https://{$titlePrefix}/api/maps/get_map_info/multi/{$mapId}"; + $url = 'https://' . $titlePrefix . '.mania.exchange/' . 'api/maps/get_map_info/multi/' . $mapId; /*if ($key = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KEY)) { $url .= "&key=" . $key; diff --git a/core/ManiaExchange/ManiaExchangeMapSearch.php b/core/ManiaExchange/ManiaExchangeMapSearch.php index 5008afe7..7bb519bc 100644 --- a/core/ManiaExchange/ManiaExchangeMapSearch.php +++ b/core/ManiaExchange/ManiaExchangeMapSearch.php @@ -18,7 +18,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; class ManiaExchangeMapSearch implements UsageInformationAble { use UsageInformationTrait; - //Search orders (prior parameter) https://api.mania-exchange.com/documents/enums#orderings + //Search orders (prior parameter) https://api2.mania.exchange/documents/enums#orderings const SEARCH_ORDER_NONE = -1; const SEARCH_ORDER_TRACK_NAME = 0; const SEARCH_ORDER_AUTHOR = 1; @@ -41,7 +41,7 @@ class ManiaExchangeMapSearch implements UsageInformationAble { const SEARCH_ORDER_ONLINE_RATING_LTH = 26; const SEARCH_ORDER_ONLINE_RATING_HTL = 27; - //Special Search Orders (mode parameter): https://api.mania-exchange.com/documents/enums#modes + //Special Search Orders (mode parameter): https://api2.mania.exchange/documents/enums#modes const SEARCH_ORDER_SPECIAL_DEFAULT = 0; const SEARCH_ORDER_SPECIAL_USER_TRACKS = 1; const SEARCH_ORDER_SPECIAL_LATEST_TRACKS = 2;