bugfix
This commit is contained in:
parent
b20c9517f8
commit
eca7ec86ae
@ -90,9 +90,10 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function loadSettingsFromDatabase() {
|
public function loadSettingsFromDatabase() {
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$serverId = $this->maniaControl->server->index;
|
||||||
$query = "SELECT * FROM `" . self::TABLE_SERVER_SETTINGS . "`;";
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
$result = $mysqli->query($query);
|
$query = "SELECT * FROM `" . self::TABLE_SERVER_SETTINGS . "` WHERE serverIndex = " . $serverId . ";";
|
||||||
|
$result = $mysqli->query($query);
|
||||||
if($mysqli->error) {
|
if($mysqli->error) {
|
||||||
trigger_error($mysqli->error);
|
trigger_error($mysqli->error);
|
||||||
return false;
|
return false;
|
||||||
@ -109,8 +110,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
settype($loadedSettings[$row->settingName], gettype($serverSettings[$row->settingName]));
|
settype($loadedSettings[$row->settingName], gettype($serverSettings[$row->settingName]));
|
||||||
}
|
}
|
||||||
$result->close();
|
$result->close();
|
||||||
if(!$loadedSettings)
|
if(!$loadedSettings) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings);
|
$success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
@ -308,8 +310,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
public function handleManialinkPageAnswer(array $callback) {
|
public function handleManialinkPageAnswer(array $callback) {
|
||||||
$actionId = $callback[1][2];
|
$actionId = $callback[1][2];
|
||||||
$boolSetting = (strpos($actionId, self::ACTION_SETTING_BOOL) === 0);
|
$boolSetting = (strpos($actionId, self::ACTION_SETTING_BOOL) === 0);
|
||||||
if(!$boolSetting)
|
if(!$boolSetting) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$login = $callback[1][1];
|
$login = $callback[1][1];
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
@ -326,8 +329,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
||||||
if(!$newSettings)
|
if(!$newSettings) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
$success = $this->maniaControl->client->query('SetServerOptions', $newSettings);
|
$success = $this->maniaControl->client->query('SetServerOptions', $newSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
||||||
|
@ -30,9 +30,8 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
|
|||||||
const SEARCH_ORDER_DIFFICULTY_HARDEST = 13;
|
const SEARCH_ORDER_DIFFICULTY_HARDEST = 13;
|
||||||
const SEARCH_ORDER_LENGHT_SHORTEST = 14;
|
const SEARCH_ORDER_LENGHT_SHORTEST = 14;
|
||||||
const SEARCH_ORDER_LENGHT_LONGEST = 15;
|
const SEARCH_ORDER_LENGHT_LONGEST = 15;
|
||||||
const MAPS_PER_MX_FETCH = 10;
|
const MAPS_PER_MX_FETCH = 50;
|
||||||
|
|
||||||
const MX_CHAR_LIMIT = 250;
|
|
||||||
/**
|
/**
|
||||||
* Private Propertieswc
|
* Private Propertieswc
|
||||||
*/
|
*/
|
||||||
@ -132,11 +131,10 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
|
|||||||
$id++;
|
$id++;
|
||||||
|
|
||||||
//If Max Maplimit is reached, or string gets too long send the request
|
//If Max Maplimit is reached, or string gets too long send the request
|
||||||
if(($id % self::MAPS_PER_MX_FETCH == 0) || ((strlen($mapIdString) + strlen($appendString)) > self::MX_CHAR_LIMIT)) {
|
if($id % self::MAPS_PER_MX_FETCH == 0) {
|
||||||
$maps = $this->getMaplistByMixedUidIdString($mapIdString);
|
$maps = $this->getMaplistByMixedUidIdString($mapIdString);
|
||||||
$this->updateMapObjectsWithManiaExchangeIds($maps);
|
$this->updateMapObjectsWithManiaExchangeIds($maps);
|
||||||
$mapIdString = '';
|
$mapIdString = '';
|
||||||
$id = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$mapIdString .= $appendString;
|
$mapIdString .= $appendString;
|
||||||
@ -157,7 +155,7 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
|
|||||||
$titlePrefix = strtolower(substr($titleId, 0, 2));
|
$titlePrefix = strtolower(substr($titleId, 0, 2));
|
||||||
|
|
||||||
// compile search URL
|
// compile search URL
|
||||||
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/' . $string;
|
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $string;
|
||||||
|
|
||||||
// $mapInfo = FileUtil::loadFile($url, "application/json"); //TODO use mc fileutil
|
// $mapInfo = FileUtil::loadFile($url, "application/json"); //TODO use mc fileutil
|
||||||
$mapInfo = $this->get_file($url);
|
$mapInfo = $this->get_file($url);
|
||||||
|
Loading…
Reference in New Issue
Block a user