bugfix
This commit is contained in:
parent
b20c9517f8
commit
eca7ec86ae
@ -90,9 +90,10 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
* @return bool
|
||||
*/
|
||||
public function loadSettingsFromDatabase() {
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$query = "SELECT * FROM `" . self::TABLE_SERVER_SETTINGS . "`;";
|
||||
$result = $mysqli->query($query);
|
||||
$serverId = $this->maniaControl->server->index;
|
||||
$mysqli = $this->maniaControl->database->mysqli;
|
||||
$query = "SELECT * FROM `" . self::TABLE_SERVER_SETTINGS . "` WHERE serverIndex = " . $serverId . ";";
|
||||
$result = $mysqli->query($query);
|
||||
if($mysqli->error) {
|
||||
trigger_error($mysqli->error);
|
||||
return false;
|
||||
@ -109,8 +110,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
settype($loadedSettings[$row->settingName], gettype($serverSettings[$row->settingName]));
|
||||
}
|
||||
$result->close();
|
||||
if(!$loadedSettings)
|
||||
if(!$loadedSettings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings);
|
||||
if(!$success) {
|
||||
@ -308,8 +310,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
public function handleManialinkPageAnswer(array $callback) {
|
||||
$actionId = $callback[1][2];
|
||||
$boolSetting = (strpos($actionId, self::ACTION_SETTING_BOOL) === 0);
|
||||
if(!$boolSetting)
|
||||
if(!$boolSetting) {
|
||||
return;
|
||||
}
|
||||
|
||||
$login = $callback[1][1];
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
@ -326,8 +329,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
* @return bool
|
||||
*/
|
||||
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
||||
if(!$newSettings)
|
||||
if(!$newSettings) {
|
||||
return true;
|
||||
}
|
||||
$success = $this->maniaControl->client->query('SetServerOptions', $newSettings);
|
||||
if(!$success) {
|
||||
$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_LENGHT_SHORTEST = 14;
|
||||
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
|
||||
*/
|
||||
@ -132,11 +131,10 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
|
||||
$id++;
|
||||
|
||||
//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);
|
||||
$this->updateMapObjectsWithManiaExchangeIds($maps);
|
||||
$mapIdString = '';
|
||||
$id = 1;
|
||||
}
|
||||
|
||||
$mapIdString .= $appendString;
|
||||
@ -157,7 +155,7 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
|
||||
$titlePrefix = strtolower(substr($titleId, 0, 2));
|
||||
|
||||
// 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 = $this->get_file($url);
|
||||
|
Loading…
Reference in New Issue
Block a user