mx update
This commit is contained in:
parent
66c0c4a8e5
commit
de2e9cae84
@ -6,7 +6,6 @@ use ManiaControl\Files\AsynchronousFileReader;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Maps\Map;
|
||||
use ManiaControl\Maps\MapManager;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* Mania Exchange Manager Class
|
||||
@ -44,6 +43,8 @@ class ManiaExchangeManager {
|
||||
|
||||
const MIN_EXE_BUILD = "2014-04-01_00_00";
|
||||
|
||||
const SETTING_MX_KEY = "Mania exchange Key";
|
||||
|
||||
/*
|
||||
* Private properties
|
||||
*/
|
||||
@ -58,6 +59,8 @@ class ManiaExchangeManager {
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
|
||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MX_KEY, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,6 +162,10 @@ class ManiaExchangeManager {
|
||||
// compile search URL
|
||||
$url = "https://api.mania-exchange.com/{$titlePrefix}/maps/?ids={$string}";
|
||||
|
||||
if ($key = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KEY)) {
|
||||
$url .= "&key=" . $key;
|
||||
}
|
||||
|
||||
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) {
|
||||
if ($error) {
|
||||
trigger_error("Error: '{$error}' for Url '{$url}'");
|
||||
@ -252,6 +259,10 @@ class ManiaExchangeManager {
|
||||
// compile search URL
|
||||
$url = 'https://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $mapId;
|
||||
|
||||
if ($key = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KEY)) {
|
||||
$url .= "&key=" . $key;
|
||||
}
|
||||
|
||||
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
|
||||
$mxMapInfo = null;
|
||||
if ($error) {
|
||||
@ -286,7 +297,6 @@ class ManiaExchangeManager {
|
||||
* @param string $env
|
||||
* @param int $maxMapsReturned
|
||||
* @param int $searchOrder
|
||||
*
|
||||
* @deprecated
|
||||
* @see \ManiaControl\ManiaExchange\ManiaExchangeMapSearch
|
||||
*/
|
||||
|
@ -99,6 +99,11 @@ class ManiaExchangeMapSearch {
|
||||
|
||||
$this->url = 'https://' . $this->titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on';
|
||||
|
||||
if($key = $this->maniaControl->getSettingManager()->getSettingValue($this, ManiaExchangeManager::SETTING_MX_KEY)){
|
||||
$this->url .= "&key=" . $key;
|
||||
}
|
||||
|
||||
|
||||
//Set some defaults:
|
||||
$this->mapLimit = 100;
|
||||
$this->priorityOrder = self::SEARCH_ORDER_UPDATED_NEWEST;
|
||||
|
@ -354,8 +354,14 @@ class MapManager implements CallbackListener, CommunicationListener {
|
||||
return;
|
||||
}
|
||||
|
||||
$url = $mapInfo->downloadurl;
|
||||
|
||||
if ($key = $this->maniaControl->getSettingManager()->getSettingValue($this, ManiaExchangeManager::SETTING_MX_KEY)) {
|
||||
$url .= "&key=" . $key;
|
||||
}
|
||||
|
||||
// Download the file
|
||||
$this->maniaControl->getFileReader()->loadFile($mapInfo->downloadurl, function ($file, $error) use (
|
||||
$this->maniaControl->getFileReader()->loadFile($url, function ($file, $error) use (
|
||||
&$login, &$mapInfo, &$update
|
||||
) {
|
||||
if (!$file || $error) {
|
||||
|
Loading…
Reference in New Issue
Block a user