From 36b76da5c95a07e90a6a6248ef2c6f808d38dda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Fri, 2 May 2014 15:20:25 +0200 Subject: [PATCH 1/5] removed unused variable added missing use statement --- application/core/Admin/ActionsMenu.php | 1 - application/core/Files/BackupUtil.php | 1 + application/core/ManiaExchange/ManiaExchangeList.php | 2 -- application/core/ManiaExchange/ManiaExchangeManager.php | 2 +- application/core/Maps/MapList.php | 2 +- 5 files changed, 3 insertions(+), 5 deletions(-) diff --git a/application/core/Admin/ActionsMenu.php b/application/core/Admin/ActionsMenu.php index 96e88945..88d67006 100644 --- a/application/core/Admin/ActionsMenu.php +++ b/application/core/Admin/ActionsMenu.php @@ -179,7 +179,6 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { } $manialink = new ManiaLink(self::MLID_MENU); - $script = $manialink->getScript(); /* * Admin Menu diff --git a/application/core/Files/BackupUtil.php b/application/core/Files/BackupUtil.php index b53f2234..f4f2ec4a 100644 --- a/application/core/Files/BackupUtil.php +++ b/application/core/Files/BackupUtil.php @@ -1,6 +1,7 @@ addFeature($paging); - $pagesId = 'MxListPages'; - // Main frame $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); $maniaLink->add($frame); diff --git a/application/core/ManiaExchange/ManiaExchangeManager.php b/application/core/ManiaExchange/ManiaExchangeManager.php index 3424f76d..d0fbbead 100644 --- a/application/core/ManiaExchange/ManiaExchangeManager.php +++ b/application/core/ManiaExchange/ManiaExchangeManager.php @@ -84,7 +84,7 @@ class ManiaExchangeManager { trigger_error($saveMapStatement->error); } - //Take the uid out of the vektor + //Take the uid out of the vector if (isset($this->mxIdUidVector[$mxMapInfo->id])) { $uid = $this->mxIdUidVector[$mxMapInfo->id]; } else { diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index 608e40f7..c364691b 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -121,7 +121,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $queueBuffer = $this->maniaControl->mapManager->mapQueue->getQueueBuffer(); // Get Maps - $mapList = array(); + $mapList = null; $pageCount = null; if (is_array($maps)) { $mapList = array_slice($maps, $chunk, self::MAX_PAGES_PER_CHUNK * self::MAX_MAPS_PER_PAGE); From e87a454ba7f0b7a16ada63ff19dbca131559231d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Fri, 2 May 2014 15:26:07 +0200 Subject: [PATCH 2/5] fixed typos / spelling --- application/core/Callbacks/TimerManager.php | 4 ++-- application/core/Chat.php | 2 +- application/core/Configurators/ScriptSettings.php | 2 +- application/core/Configurators/ServerSettings.php | 2 +- application/core/Formatter.php | 8 ++++---- application/core/ManiaExchange/ManiaExchangeList.php | 2 +- application/core/ManiaExchange/ManiaExchangeManager.php | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/application/core/Callbacks/TimerManager.php b/application/core/Callbacks/TimerManager.php index 273d99f6..6d3ac808 100644 --- a/application/core/Callbacks/TimerManager.php +++ b/application/core/Callbacks/TimerManager.php @@ -39,7 +39,7 @@ class TimerManager { } /** - * Unregisters a Timer Listening + * Unregister a Timer Listening * @param TimerListener $listener * @param $method * @return bool @@ -55,7 +55,7 @@ class TimerManager { } /** - * Registers a Timing Listening, note < 10ms it can get inaccurate + * Register a Timing Listening, note < 10ms it can get inaccurate * * @param TimerListener $listener * @param $method diff --git a/application/core/Chat.php b/application/core/Chat.php index d3791506..56e7685b 100644 --- a/application/core/Chat.php +++ b/application/core/Chat.php @@ -136,7 +136,7 @@ class Chat { * @return bool */ public function sendException(\Exception $exception, $login = null) { - $message = "Exception occured: '{$exception->getMessage()}' ({$exception->getCode()})"; + $message = "Exception occurred: '{$exception->getMessage()}' ({$exception->getCode()})"; $this->maniaControl->errorHandler->triggerDebugNotice($message); $this->sendError($message, $login); } diff --git a/application/core/Configurators/ScriptSettings.php b/application/core/Configurators/ScriptSettings.php index 44bc5e25..c9cc8801 100644 --- a/application/core/Configurators/ScriptSettings.php +++ b/application/core/Configurators/ScriptSettings.php @@ -148,7 +148,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { try { $this->maniaControl->client->setModeScriptSettings($loadedSettings); } catch(Exception $e) { - trigger_error('Error occured: ' . $e->getMessage()); + trigger_error('Error occurred: ' . $e->getMessage()); return false; } return true; diff --git a/application/core/Configurators/ServerSettings.php b/application/core/Configurators/ServerSettings.php index 7553c6a0..0596070e 100644 --- a/application/core/Configurators/ServerSettings.php +++ b/application/core/Configurators/ServerSettings.php @@ -181,7 +181,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { $id = 0; foreach($serverSettings as $name => $value) { // Continue on CurrentMaxPlayers... - $pos = strpos($name, "Current"); // TODO maybe current irgentwo anzeigen + $pos = strpos($name, "Current"); // TODO maybe display current somewhere if ($pos !== false) { continue; } diff --git a/application/core/Formatter.php b/application/core/Formatter.php index 39be0779..7c0d1818 100644 --- a/application/core/Formatter.php +++ b/application/core/Formatter.php @@ -35,7 +35,7 @@ abstract class Formatter { } /** - * Formats a Time to H:M:S + * Format a Time to H:M:S * * @param int $seconds * @return string @@ -54,9 +54,9 @@ abstract class Formatter { } /** - * Formatts a Elapset time String (2 days ago...) by a given timestamp + * Format an elapsed time String (2 days ago...) by a given timestamp * - * @param $ptime + * @param int $ptime * @return string */ public static function time_elapsed_string($ptime) { @@ -79,7 +79,7 @@ abstract class Formatter { } /** - * Formats the given Time (Seconds) to hh:mm:ss + * Format the given Time (Seconds) to hh:mm:ss * * @param int $seconds * @return string diff --git a/application/core/ManiaExchange/ManiaExchangeList.php b/application/core/ManiaExchange/ManiaExchangeList.php index 73961fba..771211b8 100644 --- a/application/core/ManiaExchange/ManiaExchangeList.php +++ b/application/core/ManiaExchange/ManiaExchangeList.php @@ -151,7 +151,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener $i = 0; $y = $height / 2 - 16; $pageFrames = array(); - foreach($maps as $map) { //TODO order possabilities + foreach($maps as $map) { //TODO order possibilities /** @var MxMapInfo $map */ if (!isset($pageFrame)) { $pageFrame = new Frame(); diff --git a/application/core/ManiaExchange/ManiaExchangeManager.php b/application/core/ManiaExchange/ManiaExchangeManager.php index d0fbbead..ca850b3b 100644 --- a/application/core/ManiaExchange/ManiaExchangeManager.php +++ b/application/core/ManiaExchange/ManiaExchangeManager.php @@ -118,7 +118,7 @@ class ManiaExchangeManager { */ public function fetchManiaExchangeMapInformations($map = null) { if (!$map) { - //Fetch Informations for whole Maplist + //Fetch Information for whole MapList $maps = $this->maniaControl->mapManager->getMaps(); } else { //Fetch Information for a single map From 7b5137d050d94e6d402a075e6b73ea10de376b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Fri, 2 May 2014 15:35:09 +0200 Subject: [PATCH 3/5] fixed method call --- application/core/ErrorHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/core/ErrorHandler.php b/application/core/ErrorHandler.php index 54f56dec..458b38ef 100644 --- a/application/core/ErrorHandler.php +++ b/application/core/ErrorHandler.php @@ -71,7 +71,7 @@ class ErrorHandler { if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) { $error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL); - $error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate(); + $error['ManiaControlVersion'] = $this->maniaControl->updateManager->getNightlyBuildDate(); } else { $error['UpdateChannel'] = ''; From f9a3c0f72e3e477cccda2e0c53d0150923db1b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Fri, 2 May 2014 15:35:35 +0200 Subject: [PATCH 4/5] fixed update url --- application/core/Update/UpdateManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/core/Update/UpdateManager.php b/application/core/Update/UpdateManager.php index df1b141c..3719deb1 100644 --- a/application/core/Update/UpdateManager.php +++ b/application/core/Update/UpdateManager.php @@ -405,7 +405,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener } $self = $this; - $this->maniaControl->fileReader->loadFile($updateData->url, function ($updateFileContent, $error) use(&$self, &$updateData, &$player) { + $this->maniaControl->fileReader->loadFile($this->coreUpdateData->url, function ($updateFileContent, $error) use(&$self, &$updateData, &$player) { $tempDir = FileUtil::getTempFolder(); $updateFileName = $tempDir . basename($updateData->url); From c059d7316c6124921072cc4fca1df7120582272c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Fri, 2 May 2014 15:35:52 +0200 Subject: [PATCH 5/5] type hints resolved warnings --- application/core/Commands/HelpManager.php | 6 +++++- .../core/Configurators/ManiaControlSettings.php | 1 + application/core/Database/Database.php | 16 ++++++++++++---- application/core/ManiaControl.php | 1 + application/core/Plugins/PluginManager.php | 3 ++- application/core/Update/PluginUpdateManager.php | 2 ++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/application/core/Commands/HelpManager.php b/application/core/Commands/HelpManager.php index bc49d2d9..513541de 100644 --- a/application/core/Commands/HelpManager.php +++ b/application/core/Commands/HelpManager.php @@ -3,6 +3,7 @@ namespace ManiaControl\Commands; use FML\Controls\Frame; +use FML\Controls\Label; use FML\Controls\Quads\Quad_BgsPlayerCard; use FML\ManiaLink; use FML\Script\Features\Paging; @@ -228,7 +229,10 @@ class HelpManager implements CommandListener, CallbackListener { $array = array($command['Name'] => $x + 5, $command['Description'] => $x + 50); $labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array); - $labels[0]->setWidth(40); + + /** @var Label $label */ + $label = $labels[0]; + $label->setWidth(40); $y -= 4; $i++; diff --git a/application/core/Configurators/ManiaControlSettings.php b/application/core/Configurators/ManiaControlSettings.php index 1476229f..bb7a6fd4 100644 --- a/application/core/Configurators/ManiaControlSettings.php +++ b/application/core/Configurators/ManiaControlSettings.php @@ -234,6 +234,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { $pageFrame = null; $index = 0; + $y = 0; foreach ($settings as $setting) { if (!$pageFrame) { $pageFrame = new Frame(); diff --git a/application/core/Database/Database.php b/application/core/Database/Database.php index c804d387..c1d90b34 100644 --- a/application/core/Database/Database.php +++ b/application/core/Database/Database.php @@ -36,10 +36,18 @@ class Database implements TimerListener { $user = $this->maniaControl->config->database->xpath('user'); $pass = $this->maniaControl->config->database->xpath('pass'); - if (!$host) trigger_error("Invalid database configuration (host).", E_USER_ERROR); - if (!$port) trigger_error("Invalid database configuration (port).", E_USER_ERROR); - if (!$user) trigger_error("Invalid database configuration (user).", E_USER_ERROR); - if (!$pass) trigger_error("Invalid database configuration (pass).", E_USER_ERROR); + if (!$host) { + trigger_error("Invalid database configuration (host).", E_USER_ERROR); + } + if (!$port) { + trigger_error("Invalid database configuration (port).", E_USER_ERROR); + } + if (!$user) { + trigger_error("Invalid database configuration (user).", E_USER_ERROR); + } + if (!$pass) { + trigger_error("Invalid database configuration (pass).", E_USER_ERROR); + } $host = (string) $host[0]; $port = (int) $port[0]; diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index e8587cb4..5c3db1d7 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -79,6 +79,7 @@ class ManiaControl implements CommandListener, TimerListener { public $server = null; public $settingManager = null; public $statisticManager = null; + /** @var UpdateManager $updateManager */ public $updateManager = null; public $errorHandler = null; public $timerManager = null; diff --git a/application/core/Plugins/PluginManager.php b/application/core/Plugins/PluginManager.php index 3930ba0a..c4c2ac7d 100644 --- a/application/core/Plugins/PluginManager.php +++ b/application/core/Plugins/PluginManager.php @@ -220,7 +220,8 @@ class PluginManager { continue; } array_push($newPluginClasses, $className); - + + /** @var Plugin $className */ $className::prepare($this->maniaControl); if ($this->getSavedPluginStatus($className)) { diff --git a/application/core/Update/PluginUpdateManager.php b/application/core/Update/PluginUpdateManager.php index 07e7aacd..2e028235 100644 --- a/application/core/Update/PluginUpdateManager.php +++ b/application/core/Update/PluginUpdateManager.php @@ -166,6 +166,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis if (!isset($pluginsData[$pluginId])) { continue; } + /** @var PluginUpdateData $pluginData */ $pluginData = $pluginsData[$pluginId]; $pluginVersion = $pluginClass::getVersion(); if ($pluginData->isNewerThan($pluginVersion)) { @@ -301,6 +302,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis */ $pluginId = $pluginClass::getId(); if (isset($pluginsUpdates[$pluginId])) { + /** @var PluginUpdateData $pluginUpdateData */ $pluginUpdateData = $pluginsUpdates[$pluginId]; $pluginVersion = $pluginClass::getVersion(); if ($pluginUpdateData->isNewerThan($pluginVersion)) {