Merge remote-tracking branch 'origin/master'

This commit is contained in:
Max Klaversma 2014-05-02 16:02:50 +02:00
commit 7469d97712
18 changed files with 39 additions and 24 deletions

View File

@ -179,7 +179,6 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
} }
$manialink = new ManiaLink(self::MLID_MENU); $manialink = new ManiaLink(self::MLID_MENU);
$script = $manialink->getScript();
/* /*
* Admin Menu * Admin Menu

View File

@ -39,7 +39,7 @@ class TimerManager {
} }
/** /**
* Unregisters a Timer Listening * Unregister a Timer Listening
* @param TimerListener $listener * @param TimerListener $listener
* @param $method * @param $method
* @return bool * @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 TimerListener $listener
* @param $method * @param $method

View File

@ -136,7 +136,7 @@ class Chat {
* @return bool * @return bool
*/ */
public function sendException(\Exception $exception, $login = null) { 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->maniaControl->errorHandler->triggerDebugNotice($message);
$this->sendError($message, $login); $this->sendError($message, $login);
} }

View File

@ -3,6 +3,7 @@
namespace ManiaControl\Commands; namespace ManiaControl\Commands;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Quads\Quad_BgsPlayerCard; use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\ManiaLink; use FML\ManiaLink;
use FML\Script\Features\Paging; use FML\Script\Features\Paging;
@ -228,7 +229,10 @@ class HelpManager implements CommandListener, CallbackListener {
$array = array($command['Name'] => $x + 5, $command['Description'] => $x + 50); $array = array($command['Name'] => $x + 5, $command['Description'] => $x + 50);
$labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array); $labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
$labels[0]->setWidth(40);
/** @var Label $label */
$label = $labels[0];
$label->setWidth(40);
$y -= 4; $y -= 4;
$i++; $i++;

View File

@ -234,6 +234,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageFrame = null; $pageFrame = null;
$index = 0; $index = 0;
$y = 0;
foreach ($settings as $setting) { foreach ($settings as $setting) {
if (!$pageFrame) { if (!$pageFrame) {
$pageFrame = new Frame(); $pageFrame = new Frame();

View File

@ -148,7 +148,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
try { try {
$this->maniaControl->client->setModeScriptSettings($loadedSettings); $this->maniaControl->client->setModeScriptSettings($loadedSettings);
} catch(Exception $e) { } catch(Exception $e) {
trigger_error('Error occured: ' . $e->getMessage()); trigger_error('Error occurred: ' . $e->getMessage());
return false; return false;
} }
return true; return true;

View File

@ -181,7 +181,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
$id = 0; $id = 0;
foreach($serverSettings as $name => $value) { foreach($serverSettings as $name => $value) {
// Continue on CurrentMaxPlayers... // Continue on CurrentMaxPlayers...
$pos = strpos($name, "Current"); // TODO maybe current irgentwo anzeigen $pos = strpos($name, "Current"); // TODO maybe display current somewhere
if ($pos !== false) { if ($pos !== false) {
continue; continue;
} }

View File

@ -36,10 +36,18 @@ class Database implements TimerListener {
$user = $this->maniaControl->config->database->xpath('user'); $user = $this->maniaControl->config->database->xpath('user');
$pass = $this->maniaControl->config->database->xpath('pass'); $pass = $this->maniaControl->config->database->xpath('pass');
if (!$host) trigger_error("Invalid database configuration (host).", E_USER_ERROR); if (!$host) {
if (!$port) trigger_error("Invalid database configuration (port).", E_USER_ERROR); trigger_error("Invalid database configuration (host).", 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 (!$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]; $host = (string) $host[0];
$port = (int) $port[0]; $port = (int) $port[0];

View File

@ -71,7 +71,7 @@ class ErrorHandler {
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) { if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL); $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 { else {
$error['UpdateChannel'] = ''; $error['UpdateChannel'] = '';

View File

@ -1,6 +1,7 @@
<?php <?php
namespace ManiaControl\Files; namespace ManiaControl\Files;
use ManiaControl\ManiaControl;
/** /**
* Backup Utility Class * Backup Utility Class

View File

@ -35,7 +35,7 @@ abstract class Formatter {
} }
/** /**
* Formats a Time to H:M:S * Format a Time to H:M:S
* *
* @param int $seconds * @param int $seconds
* @return string * @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 * @return string
*/ */
public static function time_elapsed_string($ptime) { 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 * @param int $seconds
* @return string * @return string

View File

@ -79,6 +79,7 @@ class ManiaControl implements CommandListener, TimerListener {
public $server = null; public $server = null;
public $settingManager = null; public $settingManager = null;
public $statisticManager = null; public $statisticManager = null;
/** @var UpdateManager $updateManager */
public $updateManager = null; public $updateManager = null;
public $errorHandler = null; public $errorHandler = null;
public $timerManager = null; public $timerManager = null;

View File

@ -133,8 +133,6 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$paging = new Paging(); $paging = new Paging();
$script->addFeature($paging); $script->addFeature($paging);
$pagesId = 'MxListPages';
// Main frame // Main frame
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging);
$maniaLink->add($frame); $maniaLink->add($frame);
@ -153,7 +151,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$i = 0; $i = 0;
$y = $height / 2 - 16; $y = $height / 2 - 16;
$pageFrames = array(); $pageFrames = array();
foreach($maps as $map) { //TODO order possabilities foreach($maps as $map) { //TODO order possibilities
/** @var MxMapInfo $map */ /** @var MxMapInfo $map */
if (!isset($pageFrame)) { if (!isset($pageFrame)) {
$pageFrame = new Frame(); $pageFrame = new Frame();

View File

@ -84,7 +84,7 @@ class ManiaExchangeManager {
trigger_error($saveMapStatement->error); trigger_error($saveMapStatement->error);
} }
//Take the uid out of the vektor //Take the uid out of the vector
if (isset($this->mxIdUidVector[$mxMapInfo->id])) { if (isset($this->mxIdUidVector[$mxMapInfo->id])) {
$uid = $this->mxIdUidVector[$mxMapInfo->id]; $uid = $this->mxIdUidVector[$mxMapInfo->id];
} else { } else {
@ -118,7 +118,7 @@ class ManiaExchangeManager {
*/ */
public function fetchManiaExchangeMapInformations($map = null) { public function fetchManiaExchangeMapInformations($map = null) {
if (!$map) { if (!$map) {
//Fetch Informations for whole Maplist //Fetch Information for whole MapList
$maps = $this->maniaControl->mapManager->getMaps(); $maps = $this->maniaControl->mapManager->getMaps();
} else { } else {
//Fetch Information for a single map //Fetch Information for a single map

View File

@ -121,7 +121,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$queueBuffer = $this->maniaControl->mapManager->mapQueue->getQueueBuffer(); $queueBuffer = $this->maniaControl->mapManager->mapQueue->getQueueBuffer();
// Get Maps // Get Maps
$mapList = array(); $mapList = null;
$pageCount = null; $pageCount = null;
if (is_array($maps)) { if (is_array($maps)) {
$mapList = array_slice($maps, $chunk, self::MAX_PAGES_PER_CHUNK * self::MAX_MAPS_PER_PAGE); $mapList = array_slice($maps, $chunk, self::MAX_PAGES_PER_CHUNK * self::MAX_MAPS_PER_PAGE);

View File

@ -221,6 +221,7 @@ class PluginManager {
} }
array_push($newPluginClasses, $className); array_push($newPluginClasses, $className);
/** @var Plugin $className */
$className::prepare($this->maniaControl); $className::prepare($this->maniaControl);
if ($this->getSavedPluginStatus($className)) { if ($this->getSavedPluginStatus($className)) {

View File

@ -166,6 +166,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
if (!isset($pluginsData[$pluginId])) { if (!isset($pluginsData[$pluginId])) {
continue; continue;
} }
/** @var PluginUpdateData $pluginData */
$pluginData = $pluginsData[$pluginId]; $pluginData = $pluginsData[$pluginId];
$pluginVersion = $pluginClass::getVersion(); $pluginVersion = $pluginClass::getVersion();
if ($pluginData->isNewerThan($pluginVersion)) { if ($pluginData->isNewerThan($pluginVersion)) {
@ -301,6 +302,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
*/ */
$pluginId = $pluginClass::getId(); $pluginId = $pluginClass::getId();
if (isset($pluginsUpdates[$pluginId])) { if (isset($pluginsUpdates[$pluginId])) {
/** @var PluginUpdateData $pluginUpdateData */
$pluginUpdateData = $pluginsUpdates[$pluginId]; $pluginUpdateData = $pluginsUpdates[$pluginId];
$pluginVersion = $pluginClass::getVersion(); $pluginVersion = $pluginClass::getVersion();
if ($pluginUpdateData->isNewerThan($pluginVersion)) { if ($pluginUpdateData->isNewerThan($pluginVersion)) {

View File

@ -405,7 +405,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
} }
$self = $this; $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(); $tempDir = FileUtil::getTempFolder();
$updateFileName = $tempDir . basename($updateData->url); $updateFileName = $tempDir . basename($updateData->url);