removed weird != null comparing
(why are you doing this??)
This commit is contained in:
parent
43badf4baa
commit
2c066f7b62
@ -119,7 +119,7 @@ class DatabaseConverter { //TODO move bind param before loop everywhere, convert
|
|||||||
*/
|
*/
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
$this->mysqli->close();
|
$this->mysqli->close();
|
||||||
if ($this->sourceMysqli != null) {
|
if ($this->sourceMysqli) {
|
||||||
$this->sourceMysqli->close();
|
$this->sourceMysqli->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
foreach($this->adminListShown as $login => $shown) {
|
foreach($this->adminListShown as $login => $shown) {
|
||||||
if ($shown) {
|
if ($shown) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->showAdminLists($player);
|
$this->showAdminLists($player);
|
||||||
} else {
|
} else {
|
||||||
unset($this->adminListShown[$login]);
|
unset($this->adminListShown[$login]);
|
||||||
|
@ -248,9 +248,9 @@ class ManiaExchangeManager{
|
|||||||
|
|
||||||
$maps = array();
|
$maps = array();
|
||||||
foreach($mxMapList as $map) {
|
foreach($mxMapList as $map) {
|
||||||
if ($map != null) {
|
if ($map) {
|
||||||
$mxMapObject = new MXMapInfo($titlePrefix, $map);
|
$mxMapObject = new MXMapInfo($titlePrefix, $map);
|
||||||
if ($mxMapObject != null) {
|
if ($mxMapObject) {
|
||||||
array_push($maps, $mxMapObject);
|
array_push($maps, $mxMapObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class Map {
|
|||||||
*/
|
*/
|
||||||
public function updateAvailable() {
|
public function updateAvailable() {
|
||||||
|
|
||||||
if ($this->mx != null && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) {
|
if ($this->mx && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -98,7 +98,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
*/
|
*/
|
||||||
public function command_ShowNextMap(array $chat, Player $player) {
|
public function command_ShowNextMap(array $chat, Player $player) {
|
||||||
$nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap();
|
$nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap();
|
||||||
if ($nextQueued != null) {
|
if ($nextQueued) {
|
||||||
/** @var Player $requester */
|
/** @var Player $requester */
|
||||||
$requester = $nextQueued[0];
|
$requester = $nextQueued[0];
|
||||||
/** @var Map $map */
|
/** @var Map $map */
|
||||||
|
@ -566,7 +566,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
foreach($this->mapListShown as $login => $shown) {
|
foreach($this->mapListShown as $login => $shown) {
|
||||||
if ($shown) {
|
if ($shown) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->showMapList($player);
|
$this->showMapList($player);
|
||||||
} else {
|
} else {
|
||||||
unset($this->mapListShown[$login]);
|
unset($this->mapListShown[$login]);
|
||||||
|
@ -325,7 +325,7 @@ class MapManager implements CallbackListener {
|
|||||||
|
|
||||||
$this->fetchCurrentMap();
|
$this->fetchCurrentMap();
|
||||||
|
|
||||||
if ($admin != null) {
|
if ($admin) {
|
||||||
$message = '$<' . $admin->nickname . '$> shuffled the Maplist!';
|
$message = '$<' . $admin->nickname . '$> shuffled the Maplist!';
|
||||||
$this->maniaControl->chat->sendSuccess($message);
|
$this->maniaControl->chat->sendSuccess($message);
|
||||||
$this->maniaControl->log($message, true);
|
$this->maniaControl->log($message, true);
|
||||||
@ -619,7 +619,7 @@ class MapManager implements CallbackListener {
|
|||||||
*/
|
*/
|
||||||
private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) {
|
private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) {
|
||||||
// Check if map is already on the server
|
// Check if map is already on the server
|
||||||
if ($this->getMapByUid($mapInfo->uid) != null) {
|
if ($this->getMapByUid($mapInfo->uid)) {
|
||||||
// Download error
|
// Download error
|
||||||
$this->maniaControl->chat->sendError('Map is already on the server!', $login);
|
$this->maniaControl->chat->sendError('Map is already on the server!', $login);
|
||||||
return;
|
return;
|
||||||
|
@ -151,7 +151,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
$player = $queuedMap[0];
|
$player = $queuedMap[0];
|
||||||
|
|
||||||
//found player, so play this map
|
//found player, so play this map
|
||||||
if ($this->maniaControl->playerManager->getPlayer($player->login) != null) {
|
if ($this->maniaControl->playerManager->getPlayer($player->login)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$this->playersListShown[$login] = false;
|
$this->playersListShown[$login] = false;
|
||||||
}
|
}
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->showPlayerList($player);
|
$this->showPlayerList($player);
|
||||||
} else {
|
} else {
|
||||||
// if player with the open widget disconnected remove him from the shownlist
|
// if player with the open widget disconnected remove him from the shownlist
|
||||||
|
@ -267,7 +267,7 @@ class StatisticCollector implements CallbackListener {
|
|||||||
$victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]);
|
$victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]);
|
||||||
if (isset($callback[1][1][0])) {
|
if (isset($callback[1][1][0])) {
|
||||||
$shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]);
|
$shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]);
|
||||||
if ($shooter != null) {
|
if ($shooter) {
|
||||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ class StatisticCollector implements CallbackListener {
|
|||||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_DEATH, $victim);
|
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_DEATH, $victim);
|
||||||
if (isset($paramsObject->Event->Shooter->Login)) {
|
if (isset($paramsObject->Event->Shooter->Login)) {
|
||||||
$shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login);
|
$shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login);
|
||||||
if ($shooter != null) {
|
if ($shooter) {
|
||||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
||||||
}
|
}
|
||||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
||||||
|
@ -396,15 +396,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
*/
|
*/
|
||||||
private function performCoreUpdate(UpdateData $updateData, Player $player = null) {
|
private function performCoreUpdate(UpdateData $updateData, Player $player = null) {
|
||||||
if (!$this->checkPermissions()) {
|
if (!$this->checkPermissions()) {
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->maniaControl->chat->sendError('Update failed: Incorrect Filesystem permissions!', $player->login);
|
$this->maniaControl->chat->sendError('Update failed: Incorrect file system permissions!', $player->login);
|
||||||
}
|
}
|
||||||
$this->maniaControl->log('Update failed!');
|
$this->maniaControl->log('Update failed!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($updateData->url) && !isset($updateData->releaseDate)) {
|
if (!isset($updateData->url) && !isset($updateData->releaseDate)) {
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->maniaControl->chat->sendError('Update failed: No update Data available!', $player->login);
|
$this->maniaControl->chat->sendError('Update failed: No update Data available!', $player->login);
|
||||||
}
|
}
|
||||||
$this->maniaControl->log('Update failed: No update Data available!');
|
$this->maniaControl->log('Update failed: No update Data available!');
|
||||||
@ -421,7 +421,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
$bytes = file_put_contents($updateFileName, $updateFileContent);
|
$bytes = file_put_contents($updateFileName, $updateFileContent);
|
||||||
if (!$bytes || $bytes <= 0) {
|
if (!$bytes || $bytes <= 0) {
|
||||||
trigger_error("Couldn't save Update Zip.");
|
trigger_error("Couldn't save Update Zip.");
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->maniaControl->chat->sendError('Update failed: Couldn\'t save Update zip!', $player->login);
|
$this->maniaControl->chat->sendError('Update failed: Couldn\'t save Update zip!', $player->login);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -430,7 +430,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
$result = $zip->open($updateFileName);
|
$result = $zip->open($updateFileName);
|
||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
trigger_error("Couldn't open Update Zip. ({$result})");
|
trigger_error("Couldn't open Update Zip. ({$result})");
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->maniaControl->chat->sendError('Update failed: Couldn\'t open Update zip!', $player->login);
|
$this->maniaControl->chat->sendError('Update failed: Couldn\'t open Update zip!', $player->login);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -444,7 +444,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
//Set the Nightly Build Date
|
//Set the Nightly Build Date
|
||||||
$this->setNightlyBuildDate($updateData->releaseDate);
|
$this->setNightlyBuildDate($updateData->releaseDate);
|
||||||
|
|
||||||
if ($player != null) {
|
if ($player) {
|
||||||
$this->maniaControl->chat->sendSuccess('Update finished!', $player->login);
|
$this->maniaControl->chat->sendSuccess('Update finished!', $player->login);
|
||||||
}
|
}
|
||||||
$this->maniaControl->log("Update finished!");
|
$this->maniaControl->log("Update finished!");
|
||||||
|
@ -315,7 +315,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
$type = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MIN_RANKING_TYPE);
|
$type = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MIN_RANKING_TYPE);
|
||||||
|
|
||||||
$message = '';
|
$message = '';
|
||||||
if ($rankObj != null) {
|
if ($rankObj) {
|
||||||
switch($type) {
|
switch($type) {
|
||||||
case self::RANKING_TYPE_RATIOS:
|
case self::RANKING_TYPE_RATIOS:
|
||||||
$kd = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index);
|
$kd = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index);
|
||||||
@ -426,7 +426,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
public function showNextRank(Player $player) {
|
public function showNextRank(Player $player) {
|
||||||
$rankObject = $this->getRank($player);
|
$rankObject = $this->getRank($player);
|
||||||
|
|
||||||
if ($rankObject != null) {
|
if ($rankObject) {
|
||||||
if ($rankObject->rank > 1) {
|
if ($rankObject->rank > 1) {
|
||||||
$nextRank = $this->getNextRank($player);
|
$nextRank = $this->getNextRank($player);
|
||||||
$nextPlayer = $this->maniaControl->playerManager->getPlayerByIndex($nextRank->playerIndex);
|
$nextPlayer = $this->maniaControl->playerManager->getPlayerByIndex($nextRank->playerIndex);
|
||||||
|
@ -492,7 +492,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
$label->setText($author);
|
$label->setText($author);
|
||||||
$label->setTextColor("FFF");
|
$label->setTextColor("FFF");
|
||||||
|
|
||||||
if ($requester != null) {
|
if ($requester) {
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user