minor cleanup
This commit is contained in:
parent
b1921fcc2b
commit
22707ea946
@ -90,10 +90,10 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
trigger_error($mysqli->error, E_USER_ERROR);
|
trigger_error($mysqli->error, E_USER_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$adminStatement->bind_param('si', $login, $masterAdminLevel);
|
|
||||||
$success = true;
|
$success = true;
|
||||||
foreach($masterAdmins as $masterAdmin) {
|
foreach($masterAdmins as $masterAdmin) {
|
||||||
$login = (string)$masterAdmin;
|
$login = (string)$masterAdmin;
|
||||||
|
$adminStatement->bind_param('si', $login, $masterAdminLevel);
|
||||||
$adminStatement->execute();
|
$adminStatement->execute();
|
||||||
if ($adminStatement->error) {
|
if ($adminStatement->error) {
|
||||||
trigger_error($adminStatement->error);
|
trigger_error($adminStatement->error);
|
||||||
|
@ -279,7 +279,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
|
|
||||||
$menuItemY = $menuHeight * 0.42;
|
$menuItemY = $menuHeight * 0.42;
|
||||||
$menuId = 0;
|
$menuId = 0;
|
||||||
foreach($this->menus as $index => $menu) {
|
foreach($this->menus as $menu) {
|
||||||
/** @var ConfiguratorMenu $menu */
|
/** @var ConfiguratorMenu $menu */
|
||||||
|
|
||||||
// Add title
|
// Add title
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Configurators;
|
namespace ManiaControl\Configurators;
|
||||||
|
|
||||||
use FML\Script\Pages;
|
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\Tooltips;
|
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -351,9 +351,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
$settingsCount = count($newSettings);
|
//$settingsCount = count($newSettings);
|
||||||
$settingIndex = 0;
|
$settingIndex = 0;
|
||||||
$title = $this->maniaControl->authenticationManager->getAuthLevelName($player->authLevel);
|
//$title = $this->maniaControl->authenticationManager->getAuthLevelName($player->authLevel);
|
||||||
// $chatMessage = '$ff0' . $title . ' $<' . $player->nickname . '$> set ScriptSetting' . ($settingsCount > 1 ? 's' : '') . ' ';
|
// $chatMessage = '$ff0' . $title . ' $<' . $player->nickname . '$> set ScriptSetting' . ($settingsCount > 1 ? 's' : '') . ' ';
|
||||||
|
|
||||||
foreach($newSettings as $setting => $value) {
|
foreach($newSettings as $setting => $value) {
|
||||||
|
@ -73,6 +73,7 @@ abstract class Formatter {
|
|||||||
return $r . ' ' . $str . ($r > 1 ? 's' : '') . ' ago';
|
return $r . ' ' . $str . ($r > 1 ? 's' : '') . ' ago';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,8 @@ class MXMapInfo {
|
|||||||
* Returns map object with all available data from MX map data
|
* Returns map object with all available data from MX map data
|
||||||
*
|
*
|
||||||
* @param String $prefix MX URL prefix
|
* @param String $prefix MX URL prefix
|
||||||
* @param Object $map The MX map data from MXInfoSearcher
|
* @param $mx
|
||||||
|
* @internal param Object $map The MX map data from MXInfoSearcher
|
||||||
* @return MXMapInfo
|
* @return MXMapInfo
|
||||||
*/
|
*/
|
||||||
public function __construct($prefix, $mx) {
|
public function __construct($prefix, $mx) {
|
||||||
|
@ -134,6 +134,7 @@ class PluginManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$plugin = new $pluginClass();
|
$plugin = new $pluginClass();
|
||||||
|
/** @var Plugin $plugin */
|
||||||
$this->activePlugins[$pluginClass] = $plugin;
|
$this->activePlugins[$pluginClass] = $plugin;
|
||||||
$this->savePluginStatus($pluginClass, true);
|
$this->savePluginStatus($pluginClass, true);
|
||||||
try {
|
try {
|
||||||
@ -164,6 +165,7 @@ class PluginManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$plugin = $this->activePlugins[$pluginClass];
|
$plugin = $this->activePlugins[$pluginClass];
|
||||||
|
/** @var Plugin $plugin */
|
||||||
unset($this->activePlugins[$pluginClass]);
|
unset($this->activePlugins[$pluginClass]);
|
||||||
$plugin->unload();
|
$plugin->unload();
|
||||||
$interfaces = class_implements($pluginClass);
|
$interfaces = class_implements($pluginClass);
|
||||||
|
@ -57,7 +57,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||||
*/
|
*/
|
||||||
public function getTitle() {
|
public function getTitle() {
|
||||||
@ -74,7 +73,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
||||||
*/
|
*/
|
||||||
public function getMenu($width, $height, Script $script) {
|
public function getMenu($width, $height, Script $script) {
|
||||||
@ -124,7 +122,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$y = 0;
|
$y = 0;
|
||||||
$index = 1;
|
$index = 1;
|
||||||
$settingHeight = 5.;
|
$settingHeight = 5.;
|
||||||
foreach($settings as $id => $setting) {
|
foreach($settings as $setting) {
|
||||||
if (!isset($pageFrame)) {
|
if (!isset($pageFrame)) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
@ -241,6 +239,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$pageFrames = array();
|
$pageFrames = array();
|
||||||
$y = 0.;
|
$y = 0.;
|
||||||
foreach($pluginClasses as $index => $pluginClass) {
|
foreach($pluginClasses as $index => $pluginClass) {
|
||||||
|
/** @var Plugin $pluginClass */
|
||||||
if (!isset($pageFrame)) {
|
if (!isset($pageFrame)) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
@ -325,7 +324,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
||||||
*/
|
*/
|
||||||
public function saveConfigData(array $configData, Player $player) {
|
public function saveConfigData(array $configData, Player $player) {
|
||||||
@ -351,7 +349,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maniaControl->settingManager->updateSetting($oldSetting->class, $oldSetting->setting, $setting['Value']);
|
$this->maniaControl->settingManager->setSetting($oldSetting->class, $oldSetting->setting, $setting['Value']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reopen the Menu
|
//Reopen the Menu
|
||||||
@ -381,6 +379,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
}
|
}
|
||||||
if ($enable) {
|
if ($enable) {
|
||||||
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_ENABLEPLUGIN));
|
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_ENABLEPLUGIN));
|
||||||
|
/** @var Plugin $pluginClass */
|
||||||
$activated = $this->maniaControl->pluginManager->activatePlugin($pluginClass, $player->login);
|
$activated = $this->maniaControl->pluginManager->activatePlugin($pluginClass, $player->login);
|
||||||
if ($activated) {
|
if ($activated) {
|
||||||
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' activated!', $player->login);
|
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' activated!', $player->login);
|
||||||
@ -391,6 +390,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
}
|
}
|
||||||
} else if ($disable) {
|
} else if ($disable) {
|
||||||
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_DISABLEPLUGIN));
|
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_DISABLEPLUGIN));
|
||||||
|
/** @var Plugin $pluginClass */
|
||||||
$deactivated = $this->maniaControl->pluginManager->deactivatePlugin($pluginClass);
|
$deactivated = $this->maniaControl->pluginManager->deactivatePlugin($pluginClass);
|
||||||
if ($deactivated) {
|
if ($deactivated) {
|
||||||
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' deactivated!', $player->login);
|
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' deactivated!', $player->login);
|
||||||
@ -442,9 +442,9 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
|
|
||||||
//Toggle value
|
//Toggle value
|
||||||
if ($oldSetting->value == "1") {
|
if ($oldSetting->value == "1") {
|
||||||
$this->maniaControl->settingManager->updateSetting($oldSetting->class, $oldSetting->setting, "0");
|
$this->maniaControl->settingManager->setSetting($oldSetting->class, $oldSetting->setting, "0");
|
||||||
} else {
|
} else {
|
||||||
$this->maniaControl->settingManager->updateSetting($oldSetting->class, $oldSetting->setting, "1");
|
$this->maniaControl->settingManager->setSetting($oldSetting->class, $oldSetting->setting, "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class RankingManager implements CallbackListener {
|
|||||||
public function getLeaders() {
|
public function getLeaders() {
|
||||||
$leaders = array();
|
$leaders = array();
|
||||||
$prev = -1;
|
$prev = -1;
|
||||||
foreach($this->rankings as $player => $score) {
|
foreach($this->rankings as $score) {
|
||||||
if ($prev != -1 && $prev < $score) {
|
if ($prev != -1 && $prev < $score) {
|
||||||
return $leaders;
|
return $leaders;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user