From 43b46aaf01e6375c192dead8cfdbc733058b0d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sun, 15 Dec 2013 09:00:30 +0100 Subject: [PATCH] Removed Closing PHP Tags --- application/core/Admin/AdminMenu.php | 2 - application/core/Admin/AuthCommands.php | 2 - .../core/Admin/AuthenticationManager.php | 2 - .../core/Callbacks/CallbackListener.php | 2 - application/core/Chat.php | 2 - application/core/ColorUtil.php | 2 - application/core/Commands/CommandListener.php | 2 - .../core/Configurators/Configurator.php | 2 - .../core/Configurators/ConfiguratorMenu.php | 2 - .../core/Configurators/ScriptSettings.php | 2 - application/core/Database.php | 2 - application/core/FileUtil.php | 2 - application/core/Formatter.php | 2 - application/core/ManiaControl.php | 2 - .../core/Manialinks/ManialinkManager.php | 2 - .../ManialinkPageAnswerListener.php | 2 - application/core/Manialinks/StyleManager.php | 2 - application/core/Maps/MapCommands.php | 74 +++++++++---------- application/core/Players/Player.php | 2 - application/core/Players/PlayerCommands.php | 2 - application/core/Plugins/Plugin.php | 2 - application/core/Plugins/PluginManager.php | 2 - application/core/Plugins/PluginMenu.php | 2 - application/core/Server/Server.php | 2 - application/core/Server/ServerCommands.php | 2 - application/core/Settings/SettingManager.php | 2 - 26 files changed, 36 insertions(+), 88 deletions(-) diff --git a/application/core/Admin/AdminMenu.php b/application/core/Admin/AdminMenu.php index 4c83a3c0..a35903fc 100644 --- a/application/core/Admin/AdminMenu.php +++ b/application/core/Admin/AdminMenu.php @@ -147,5 +147,3 @@ class AdminMenu implements CallbackListener { $this->manialink = $manialink; } } - -?> diff --git a/application/core/Admin/AuthCommands.php b/application/core/Admin/AuthCommands.php index a42e52f5..36b1d530 100644 --- a/application/core/Admin/AuthCommands.php +++ b/application/core/Admin/AuthCommands.php @@ -157,5 +157,3 @@ class AuthCommands implements CommandListener { return $this->maniaControl->chat->sendUsageInfo($message, $player->login); } } - -?> diff --git a/application/core/Admin/AuthenticationManager.php b/application/core/Admin/AuthenticationManager.php index bb9f48b2..5a0b2ab3 100644 --- a/application/core/Admin/AuthenticationManager.php +++ b/application/core/Admin/AuthenticationManager.php @@ -202,5 +202,3 @@ class AuthenticationManager { return self::AUTH_LEVEL_PLAYER; } } - -?> diff --git a/application/core/Callbacks/CallbackListener.php b/application/core/Callbacks/CallbackListener.php index c054f209..7a2adc37 100644 --- a/application/core/Callbacks/CallbackListener.php +++ b/application/core/Callbacks/CallbackListener.php @@ -13,5 +13,3 @@ interface CallbackListener { */ const CALLBACKLISTENER_INTERFACE = __CLASS__; } - -?> diff --git a/application/core/Chat.php b/application/core/Chat.php index 7b09a9fc..706fd18c 100644 --- a/application/core/Chat.php +++ b/application/core/Chat.php @@ -126,5 +126,3 @@ class Chat { return $this->sendChat($format . $message, $login); } } - -?> diff --git a/application/core/ColorUtil.php b/application/core/ColorUtil.php index 7ea9b685..3dbc9fdb 100644 --- a/application/core/ColorUtil.php +++ b/application/core/ColorUtil.php @@ -53,5 +53,3 @@ abstract class ColorUtil { return $codes[$value]; } } - -?> diff --git a/application/core/Commands/CommandListener.php b/application/core/Commands/CommandListener.php index b3b0faf2..3a4c1d29 100644 --- a/application/core/Commands/CommandListener.php +++ b/application/core/Commands/CommandListener.php @@ -9,5 +9,3 @@ namespace ManiaControl\Commands; */ interface CommandListener { } - -?> diff --git a/application/core/Configurators/Configurator.php b/application/core/Configurators/Configurator.php index ec6a2d58..ddc04d9c 100644 --- a/application/core/Configurators/Configurator.php +++ b/application/core/Configurators/Configurator.php @@ -281,5 +281,3 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener { $this->maniaControl->adminMenu->addMenuItem($itemQuad, 5); } } - -?> diff --git a/application/core/Configurators/ConfiguratorMenu.php b/application/core/Configurators/ConfiguratorMenu.php index 01310a44..9b842860 100644 --- a/application/core/Configurators/ConfiguratorMenu.php +++ b/application/core/Configurators/ConfiguratorMenu.php @@ -39,5 +39,3 @@ interface ConfiguratorMenu { */ public function saveConfigData(array $configData, Player $player); } - -?> diff --git a/application/core/Configurators/ScriptSettings.php b/application/core/Configurators/ScriptSettings.php index 8cd03e35..0d1a3b64 100644 --- a/application/core/Configurators/ScriptSettings.php +++ b/application/core/Configurators/ScriptSettings.php @@ -173,5 +173,3 @@ class ScriptSettings implements ConfiguratorMenu { } } } - -?> diff --git a/application/core/Database.php b/application/core/Database.php index 08e0bff5..03a45831 100644 --- a/application/core/Database.php +++ b/application/core/Database.php @@ -148,5 +148,3 @@ class Database { return true; } } - -?> diff --git a/application/core/FileUtil.php b/application/core/FileUtil.php index 641ae701..98833cd6 100644 --- a/application/core/FileUtil.php +++ b/application/core/FileUtil.php @@ -86,5 +86,3 @@ abstract class FileUtil { return str_replace(array('\\', '/', ':', '*', '?', '"', '<', '>', '|'), '_', $fileName); } } - -?> diff --git a/application/core/Formatter.php b/application/core/Formatter.php index 0428f472..2c823d1a 100644 --- a/application/core/Formatter.php +++ b/application/core/Formatter.php @@ -85,5 +85,3 @@ abstract class Formatter { return preg_replace('/(? diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index c7269f4e..77fdcd71 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -285,5 +285,3 @@ class ManiaControl implements CommandListener { logMessage('Script callbacks successfully enabled.'); } } - -?> diff --git a/application/core/Manialinks/ManialinkManager.php b/application/core/Manialinks/ManialinkManager.php index ddcfc409..6969e5b2 100644 --- a/application/core/Manialinks/ManialinkManager.php +++ b/application/core/Manialinks/ManialinkManager.php @@ -161,5 +161,3 @@ class ManialinkManager implements CallbackListener { return $this->maniaControl->client->query('TriggerModeScriptEvent', 'LibXmlRpc_DisableAltMenu', $player->login); } } - -?> diff --git a/application/core/Manialinks/ManialinkPageAnswerListener.php b/application/core/Manialinks/ManialinkPageAnswerListener.php index c9397fb5..e5d4c6f3 100644 --- a/application/core/Manialinks/ManialinkPageAnswerListener.php +++ b/application/core/Manialinks/ManialinkPageAnswerListener.php @@ -13,5 +13,3 @@ interface ManialinkPageAnswerListener { */ const MANIALINKPAGEANSWERLISTENER_INTERFACE = __CLASS__; } - -?> diff --git a/application/core/Manialinks/StyleManager.php b/application/core/Manialinks/StyleManager.php index f540a2c1..1726976e 100644 --- a/application/core/Manialinks/StyleManager.php +++ b/application/core/Manialinks/StyleManager.php @@ -63,5 +63,3 @@ class StyleManager { return $this->maniaControl->settingManager->getSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE); } } - -?> diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index df36d698..06f14e15 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -28,13 +28,14 @@ class MapCommands implements CommandListener { public function __construct(ManiaControl $maniaControl) { $this->maniaControl = $maniaControl; - $this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_NextMap',true); - $this->maniaControl->commandManager->registerCommandListener('restartmap', $this, 'command_RestartMap',true); - $this->maniaControl->commandManager->registerCommandListener('addmap', $this, 'command_AddMap',true); - $this->maniaControl->commandManager->registerCommandListener('removemap', $this, 'command_RemoveMap',true); - - // Register for player commands - $this->maniaControl->commandManager->registerCommandListener('list', $this, 'command_list'); + $this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_NextMap', true); + $this->maniaControl->commandManager->registerCommandListener('restartmap', $this, 'command_RestartMap', true); + $this->maniaControl->commandManager->registerCommandListener('addmap', $this, 'command_AddMap', true); + $this->maniaControl->commandManager->registerCommandListener('removemap', $this, 'command_RemoveMap', true); + + // Register for chat commands + $this->maniaControl->commandManager->registerCommandListener('list', $this, 'command_List'); + $this->maniaControl->commandManager->registerCommandListener('maps', $this, 'command_List'); } /** @@ -42,27 +43,25 @@ class MapCommands implements CommandListener { * * @param array $chat * @param \ManiaControl\Players\Player $player - * @return bool */ public function command_RemoveMap(array $chat, Player $player) { if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) { $this->maniaControl->authenticationManager->sendNotAllowed($player); - return false; + return; } // Get map $map = $this->maniaControl->mapManager->getCurrentMap(); if (!$map) { $this->maniaControl->chat->sendError("Couldn't remove map.", $player->login); - return false; + return; } // Remove map if (!$this->maniaControl->client->query('RemoveMap', $map->fileName)) { trigger_error("Couldn't remove current map. " . $this->maniaControl->getClientErrorText()); $this->maniaControl->chat->sendError("Couldn't remove map.", $player->login); - return false; + return; } $this->maniaControl->chat->sendSuccess('Map removed.', $player->login); - return true; } /** @@ -70,37 +69,36 @@ class MapCommands implements CommandListener { * * @param array $chatCallback * @param \ManiaControl\Players\Player $player - * @return bool */ public function command_AddMap(array $chatCallback, Player $player) { if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) { $this->maniaControl->authenticationManager->sendNotAllowed($player); - return false; + return; } // TODO: user mx fetcher $params = explode(' ', $chatCallback[1][2], 2); if (count($params) < 2) { $this->maniaControl->chat->sendUsageInfo('Usage example: //addmap 1234', $player->login); - return false; + return; } // Check if ManiaControl can even write to the maps dir if (!$this->maniaControl->client->query('GetMapsDirectory')) { trigger_error("Couldn't get map directory. " . $this->maniaControl->getClientErrorText()); $this->maniaControl->chat->sendError("ManiaControl couldn't retrieve the maps directory.", $player->login); - return false; + return; } $mapDir = $this->maniaControl->client->getResponse(); if (!is_dir($mapDir)) { trigger_error("ManiaControl doesn't have have access to the maps directory in '{$mapDir}'."); $this->maniaControl->chat->sendError("ManiaControl doesn't have access to the maps directory.", $player->login); - return false; + return; } $downloadDirectory = $this->maniaControl->settingManager->getSetting($this, 'MapDownloadDirectory', 'MX'); // Create download directory if necessary if (!is_dir($mapDir . $downloadDirectory) && !mkdir($mapDir . $downloadDirectory)) { trigger_error("ManiaControl doesn't have to rights to save maps in '{$mapDir}{$downloadDirectory}'."); $this->maniaControl->chat->sendError("ManiaControl doesn't have the rights to save maps.", $player->login); - return false; + return; } $mapDir .= $downloadDirectory . '/'; // Download the map @@ -115,7 +113,7 @@ class MapCommands implements CommandListener { if (!$mapInfo || strlen($mapInfo) <= 0) { // Invalid id $this->maniaControl->chat->sendError('Invalid MX-Id!', $player->login); - return false; + return; } $mapInfo = json_decode($mapInfo, true); $url = "http://{$title}.mania-exchange.com/tracks/download/{$mapId}"; @@ -123,7 +121,7 @@ class MapCommands implements CommandListener { if (!$file) { // Download error $this->maniaControl->chat->sendError('Download failed!', $player->login); - return false; + return; } // Save map $fileName = $mapInfo['TrackID'] . '_' . $mapInfo['Name'] . '.Map.Gbx'; @@ -131,31 +129,30 @@ class MapCommands implements CommandListener { if (!file_put_contents($mapDir . $fileName, $file)) { // Save error $this->maniaControl->chat->sendError('Saving map failed!', $player->login); - return false; + return; } // Check for valid map $mapFileName = $downloadDirectory . '/' . $fileName; if (!$this->maniaControl->client->query('CheckMapForCurrentServerParams', $mapFileName)) { trigger_error("Couldn't check if map is valid ('{$mapFileName}'). " . $this->maniaControl->getClientErrorText()); $this->maniaControl->chat->sendError('Error checking map!', $player->login); - return false; + return; } $response = $this->maniaControl->client->getResponse(); if (!$response) { // Invalid map type $this->maniaControl->chat->sendError("Invalid map type.", $player->login); - return false; + return; } // Add map to map list if (!$this->maniaControl->client->query('InsertMap', $mapFileName)) { $this->maniaControl->chat->sendError("Couldn't add map to match settings!", $player->login); - return false; + return; } $this->maniaControl->chat->sendSuccess('Map $<' . $mapInfo['Name'] . '$> added!'); - return true; + return; } // TODO: add local map by filename - return false; } /** @@ -163,37 +160,38 @@ class MapCommands implements CommandListener { * * @param array $chat * @param \ManiaControl\Players\Player $player - * @return bool */ public function command_NextMap(array $chat, Player $player) { if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) { $this->maniaControl->authenticationManager->sendNotAllowed($player); - return false; + return; } - return $this->maniaControl->client->query('NextMap'); + $this->maniaControl->client->query('NextMap'); } /** - * Handle retartmap command + * Handle restartmap command * * @param array $chat * @param \ManiaControl\Players\Player $player - * @return bool */ public function command_RestartMap(array $chat, Player $player) { if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) { $this->maniaControl->authenticationManager->sendNotAllowed($player); - return false; + return; } - return $this->maniaControl->client->query('RestartMap'); + $this->maniaControl->client->query('RestartMap'); } - public function command_list(array $chatCallback, Player $player){ - // var_dump($chatCallback); - + /** + * Handle list maps command + * + * @param array $chatCallback + * @param Player $player + */ + public function command_List(array $chatCallback, Player $player) { + // var_dump($chatCallback); $mapList = new MapList($this->maniaControl); $mapList->showMapList($player); } } - -?> diff --git a/application/core/Players/Player.php b/application/core/Players/Player.php index 3b8437bb..ab585b74 100644 --- a/application/core/Players/Player.php +++ b/application/core/Players/Player.php @@ -106,5 +106,3 @@ class Player { return $this->path; } } - -?> \ No newline at end of file diff --git a/application/core/Players/PlayerCommands.php b/application/core/Players/PlayerCommands.php index 2219e4fb..06aaa7db 100644 --- a/application/core/Players/PlayerCommands.php +++ b/application/core/Players/PlayerCommands.php @@ -213,5 +213,3 @@ class PlayerCommands implements CommandListener { $this->maniaControl->chat->sendSuccess('Fake players disconnected!', $player->login); } } - -?> diff --git a/application/core/Plugins/Plugin.php b/application/core/Plugins/Plugin.php index ed23245a..4aeaa363 100644 --- a/application/core/Plugins/Plugin.php +++ b/application/core/Plugins/Plugin.php @@ -63,5 +63,3 @@ interface Plugin { */ public static function getDescription(); } - -?> diff --git a/application/core/Plugins/PluginManager.php b/application/core/Plugins/PluginManager.php index 7e9fd9c9..73e74c08 100644 --- a/application/core/Plugins/PluginManager.php +++ b/application/core/Plugins/PluginManager.php @@ -291,5 +291,3 @@ class PluginManager { return $active; } } - -?> diff --git a/application/core/Plugins/PluginMenu.php b/application/core/Plugins/PluginMenu.php index d16c85c0..b6e08bba 100644 --- a/application/core/Plugins/PluginMenu.php +++ b/application/core/Plugins/PluginMenu.php @@ -214,5 +214,3 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu { } } } - -?> diff --git a/application/core/Server/Server.php b/application/core/Server/Server.php index 50390f30..700c841c 100644 --- a/application/core/Server/Server.php +++ b/application/core/Server/Server.php @@ -308,5 +308,3 @@ class Server { return true; } } - -?> diff --git a/application/core/Server/ServerCommands.php b/application/core/Server/ServerCommands.php index e0ad01f5..953f0896 100644 --- a/application/core/Server/ServerCommands.php +++ b/application/core/Server/ServerCommands.php @@ -414,5 +414,3 @@ class ServerCommands implements CallbackListener, CommandListener { return true; } } - -?> diff --git a/application/core/Settings/SettingManager.php b/application/core/Settings/SettingManager.php index 1f3ad42e..da9133a0 100644 --- a/application/core/Settings/SettingManager.php +++ b/application/core/Settings/SettingManager.php @@ -359,5 +359,3 @@ class SettingManager { return $settings; } } - -?>