We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -53,8 +53,9 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function setAllianceID($ID) { |
| 56 | - if($this->allianceID == $ID) |
|
| 57 | - return; |
|
| 56 | + if($this->allianceID == $ID) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 58 | 59 | $this->allianceID=$ID; |
| 59 | 60 | } |
| 60 | 61 | |
@@ -93,8 +94,7 @@ discard block |
||
| 93 | 94 | if($db->nextRecord()) { |
| 94 | 95 | $return = unserialize($db->getField('info')); |
| 95 | 96 | return $return; |
| 96 | - } |
|
| 97 | - else { |
|
| 97 | + } else { |
|
| 98 | 98 | $return = new DummyPlayer(); |
| 99 | 99 | return $return; |
| 100 | 100 | } |
@@ -1,31 +1,31 @@ discard block |
||
| 1 | 1 | <?php declare(strict_types=1); |
| 2 | 2 | |
| 3 | 3 | class DummyPlayer extends AbstractSmrPlayer { |
| 4 | - public function __construct($gameID=0,$playerName='Dummy',$raceID=1,$experience=1000,$alignment=100,$allianceID=0,$shipTypeID=60) { |
|
| 4 | + public function __construct($gameID = 0, $playerName = 'Dummy', $raceID = 1, $experience = 1000, $alignment = 100, $allianceID = 0, $shipTypeID = 60) { |
|
| 5 | 5 | parent::__construct(); |
| 6 | 6 | $this->accountID = 0; |
| 7 | - $this->gameID = (int) $gameID; |
|
| 8 | - $this->playerName = (string) $playerName; |
|
| 7 | + $this->gameID = (int)$gameID; |
|
| 8 | + $this->playerName = (string)$playerName; |
|
| 9 | 9 | $this->playerID = 0; |
| 10 | 10 | $this->sectorID = 0; |
| 11 | - $this->lastSectorID = 0; |
|
| 11 | + $this->lastSectorID = 0; |
|
| 12 | 12 | $this->turns = 1000; |
| 13 | - $this->newbieTurns = 0; |
|
| 13 | + $this->newbieTurns = 0; |
|
| 14 | 14 | $this->lastNewsUpdate = 0; |
| 15 | 15 | $this->dead = false; |
| 16 | 16 | $this->landedOnPlanet = false; |
| 17 | - $this->lastActive = 0; |
|
| 18 | - $this->lastCPLAction = 0; |
|
| 19 | - $this->raceID = (int) $raceID; |
|
| 20 | - $this->credits = 0; |
|
| 21 | - $this->experience = (int) $experience; |
|
| 22 | - $this->alignment = (int) $alignment; |
|
| 23 | - $this->militaryPayment = 0; |
|
| 24 | - $this->allianceID = (int) $allianceID; |
|
| 25 | - $this->shipID = (int) $shipTypeID; |
|
| 17 | + $this->lastActive = 0; |
|
| 18 | + $this->lastCPLAction = 0; |
|
| 19 | + $this->raceID = (int)$raceID; |
|
| 20 | + $this->credits = 0; |
|
| 21 | + $this->experience = (int)$experience; |
|
| 22 | + $this->alignment = (int)$alignment; |
|
| 23 | + $this->militaryPayment = 0; |
|
| 24 | + $this->allianceID = (int)$allianceID; |
|
| 25 | + $this->shipID = (int)$shipTypeID; |
|
| 26 | 26 | $this->kills = 0; |
| 27 | 27 | $this->deaths = 0; |
| 28 | - $this->lastPort = 0; |
|
| 28 | + $this->lastPort = 0; |
|
| 29 | 29 | $this->bank = 0; |
| 30 | 30 | $this->zoom = 0; |
| 31 | 31 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function setAllianceID($ID) { |
| 56 | - if($this->allianceID == $ID) |
|
| 56 | + if ($this->allianceID == $ID) |
|
| 57 | 57 | return; |
| 58 | - $this->allianceID=$ID; |
|
| 58 | + $this->allianceID = $ID; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function &killPlayerByPlayer(AbstractSmrPlayer $killer) { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $db = new SmrMySqlDatabase(); |
| 82 | 82 | $db->query('REPLACE INTO cached_dummys ' . |
| 83 | 83 | '(type, id, info) ' . |
| 84 | - 'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeString($cache).')'); |
|
| 84 | + 'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeString($cache) . ')'); |
|
| 85 | 85 | unserialize($cache); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $db->query('SELECT info FROM cached_dummys |
| 91 | 91 | WHERE type = \'DummyPlayer\' |
| 92 | 92 | AND id = ' . $db->escapeString($name) . ' LIMIT 1'); |
| 93 | - if($db->nextRecord()) { |
|
| 93 | + if ($db->nextRecord()) { |
|
| 94 | 94 | $return = unserialize($db->getField('info')); |
| 95 | 95 | return $return; |
| 96 | 96 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $db->query('SELECT id FROM cached_dummys |
| 106 | 106 | WHERE type = \'DummyPlayer\''); |
| 107 | 107 | $dummyNames = array(); |
| 108 | - while($db->nextRecord()) { |
|
| 108 | + while ($db->nextRecord()) { |
|
| 109 | 109 | $dummyNames[] = $db->getField('id'); |
| 110 | 110 | } |
| 111 | 111 | return $dummyNames; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | } |
| 36 | 36 | $helper = self::getTwitterObj($_SESSION['TwitterToken']); |
| 37 | 37 | $accessToken = $helper->oauth('oauth/access_token', |
| 38 | - ['oauth_verifier' => $_REQUEST['oauth_verifier']]); |
|
| 38 | + ['oauth_verifier' => $_REQUEST['oauth_verifier']]); |
|
| 39 | 39 | $auth = self::getTwitterObj($accessToken); |
| 40 | 40 | $userInfo = $auth->get('account/verify_credentials', ['include_email' => 'true']); |
| 41 | 41 | if ($auth->getLastHttpCode() == 200) { |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | $shareFrom[$fromAccountId] = array( |
| 20 | 20 | 'Player ID' => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(), |
| 21 | 21 | 'Player Name' => $otherPlayer == null ? |
| 22 | - '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() : |
|
| 23 | - $otherPlayer->getPlayerName(), |
|
| 22 | + '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() : |
|
| 23 | + $otherPlayer->getPlayerName(), |
|
| 24 | 24 | 'All Games' => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>', |
| 25 | 25 | 'Game ID' => $gameId, |
| 26 | 26 | ); |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | $shareTo[$toAccountId] = array( |
| 41 | 41 | 'Player ID' => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(), |
| 42 | 42 | 'Player Name' => $otherPlayer == null ? |
| 43 | - '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() : |
|
| 44 | - $otherPlayer->getPlayerName(), |
|
| 43 | + '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() : |
|
| 44 | + $otherPlayer->getPlayerName(), |
|
| 45 | 45 | 'All Games' => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>', |
| 46 | 46 | 'Game ID' => $gameId, |
| 47 | 47 | ); |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | $shareFrom[$fromAccountId] = array( |
| 20 | 20 | 'Player ID' => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(), |
| 21 | 21 | 'Player Name' => $otherPlayer == null ? |
| 22 | - '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() : |
|
| 23 | - $otherPlayer->getPlayerName(), |
|
| 22 | + '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() : $otherPlayer->getPlayerName(), |
|
| 24 | 23 | 'All Games' => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>', |
| 25 | 24 | 'Game ID' => $gameId, |
| 26 | 25 | ); |
@@ -40,8 +39,7 @@ discard block |
||
| 40 | 39 | $shareTo[$toAccountId] = array( |
| 41 | 40 | 'Player ID' => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(), |
| 42 | 41 | 'Player Name' => $otherPlayer == null ? |
| 43 | - '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() : |
|
| 44 | - $otherPlayer->getPlayerName(), |
|
| 42 | + '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() : $otherPlayer->getPlayerName(), |
|
| 45 | 43 | 'All Games' => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>', |
| 46 | 44 | 'Game ID' => $gameId, |
| 47 | 45 | ); |
@@ -857,14 +857,14 @@ |
||
| 857 | 857 | |
| 858 | 858 | public function isFederal() { |
| 859 | 859 | return $this->getShipTypeID() == SHIP_TYPE_FEDERAL_DISCOVERY || |
| 860 | - $this->getShipTypeID() == SHIP_TYPE_FEDERAL_WARRANT || |
|
| 861 | - $this->getShipTypeID() == SHIP_TYPE_FEDERAL_ULTIMATUM; |
|
| 860 | + $this->getShipTypeID() == SHIP_TYPE_FEDERAL_WARRANT || |
|
| 861 | + $this->getShipTypeID() == SHIP_TYPE_FEDERAL_ULTIMATUM; |
|
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | public function isUnderground() { |
| 865 | 865 | return $this->getShipTypeID() == SHIP_TYPE_THIEF || |
| 866 | - $this->getShipTypeID() == SHIP_TYPE_ASSASSIN || |
|
| 867 | - $this->getShipTypeID() == SHIP_TYPE_DEATH_CRUISER; |
|
| 866 | + $this->getShipTypeID() == SHIP_TYPE_ASSASSIN || |
|
| 867 | + $this->getShipTypeID() == SHIP_TYPE_DEATH_CRUISER; |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | public function &shootPlayer(AbstractSmrPlayer $targetPlayer) { |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | public function setWeaponLocations(array $orderArray) { |
| 302 | 302 | $weapons = $this->weapons; |
| 303 | 303 | foreach ($orderArray as $newOrder => $oldOrder) { |
| 304 | - $this->weapons[$newOrder] =& $weapons[$oldOrder]; |
|
| 304 | + $this->weapons[$newOrder] = & $weapons[$oldOrder]; |
|
| 305 | 305 | } |
| 306 | 306 | $this->hasChangedWeapons = true; |
| 307 | 307 | } |
@@ -901,14 +901,14 @@ discard block |
||
| 901 | 901 | } |
| 902 | 902 | $results['DeadBeforeShot'] = false; |
| 903 | 903 | foreach ($this->weapons as $orderID => $weapon) { |
| 904 | - $results['Weapons'][$orderID] =& $weapon->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 904 | + $results['Weapons'][$orderID] = & $weapon->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 905 | 905 | if ($results['Weapons'][$orderID]['Hit']) { |
| 906 | 906 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 907 | 907 | } |
| 908 | 908 | } |
| 909 | 909 | if ($this->hasCDs()) { |
| 910 | 910 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
| 911 | - $results['Drones'] =& $thisCDs->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 911 | + $results['Drones'] = & $thisCDs->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 912 | 912 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 913 | 913 | } |
| 914 | 914 | $thisPlayer->increaseExperience(IRound($results['TotalDamage'] * self::EXP_PER_DAMAGE_PLAYER)); |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | } |
| 927 | 927 | $results['DeadBeforeShot'] = false; |
| 928 | 928 | foreach ($this->weapons as $orderID => $weapon) { |
| 929 | - $results['Weapons'][$orderID] =& $weapon->shootForces($thisPlayer, $forces); |
|
| 929 | + $results['Weapons'][$orderID] = & $weapon->shootForces($thisPlayer, $forces); |
|
| 930 | 930 | if ($results['Weapons'][$orderID]['Hit']) { |
| 931 | 931 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 932 | 932 | $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumMines'], array('Combat', 'Forces', 'Mines', 'Killed'), HOF_PUBLIC); |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | } |
| 941 | 941 | if ($this->hasCDs()) { |
| 942 | 942 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
| 943 | - $results['Drones'] =& $thisCDs->shootForces($thisPlayer, $forces); |
|
| 943 | + $results['Drones'] = & $thisCDs->shootForces($thisPlayer, $forces); |
|
| 944 | 944 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 945 | 945 | $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumMines'], array('Combat', 'Forces', 'Mines', 'Killed'), HOF_PUBLIC); |
| 946 | 946 | $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['Mines'], array('Combat', 'Forces', 'Mines', 'Damage Done'), HOF_PUBLIC); |
@@ -965,14 +965,14 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | $results['DeadBeforeShot'] = false; |
| 967 | 967 | foreach ($this->weapons as $orderID => $weapon) { |
| 968 | - $results['Weapons'][$orderID] =& $weapon->shootPort($thisPlayer, $port); |
|
| 968 | + $results['Weapons'][$orderID] = & $weapon->shootPort($thisPlayer, $port); |
|
| 969 | 969 | if ($results['Weapons'][$orderID]['Hit']) { |
| 970 | 970 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 971 | 971 | } |
| 972 | 972 | } |
| 973 | 973 | if ($this->hasCDs()) { |
| 974 | 974 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
| 975 | - $results['Drones'] =& $thisCDs->shootPort($thisPlayer, $port); |
|
| 975 | + $results['Drones'] = & $thisCDs->shootPort($thisPlayer, $port); |
|
| 976 | 976 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 977 | 977 | } |
| 978 | 978 | $thisPlayer->increaseExperience(IRound($results['TotalDamage'] * self::EXP_PER_DAMAGE_PORT)); |
@@ -1003,14 +1003,14 @@ discard block |
||
| 1003 | 1003 | } |
| 1004 | 1004 | $results['DeadBeforeShot'] = false; |
| 1005 | 1005 | foreach ($this->weapons as $orderID => $weapon) { |
| 1006 | - $results['Weapons'][$orderID] =& $weapon->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 1006 | + $results['Weapons'][$orderID] = & $weapon->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 1007 | 1007 | if ($results['Weapons'][$orderID]['Hit']) { |
| 1008 | 1008 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 1009 | 1009 | } |
| 1010 | 1010 | } |
| 1011 | 1011 | if ($this->hasCDs()) { |
| 1012 | 1012 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
| 1013 | - $results['Drones'] =& $thisCDs->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 1013 | + $results['Drones'] = & $thisCDs->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 1014 | 1014 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 1015 | 1015 | } |
| 1016 | 1016 | $thisPlayer->increaseExperience(IRound($results['TotalDamage'] * self::EXP_PER_DAMAGE_PLANET)); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $publishedGames = array(); |
| 18 | 18 | while ($db->nextRecord()) { |
| 19 | 19 | $publishedGames[] = array('game_name' => $db->getField('game_name'), |
| 20 | - 'game_id' => $db->getInt('game_id')); |
|
| 20 | + 'game_id' => $db->getInt('game_id')); |
|
| 21 | 21 | } |
| 22 | 22 | $template->assign('PublishedGames', $publishedGames); |
| 23 | 23 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $container['back'] = true; |
| 32 | 32 | |
| 33 | 33 | $pastEditions[] = array('title' => $db->getField('title'), |
| 34 | - 'online_since' => $db->getInt('online_since'), |
|
| 35 | - 'href' => SmrSession::getNewHREF($container)); |
|
| 34 | + 'online_since' => $db->getInt('online_since'), |
|
| 35 | + 'href' => SmrSession::getNewHREF($container)); |
|
| 36 | 36 | } |
| 37 | 37 | $template->assign('PastEditions', $pastEditions); |
@@ -202,7 +202,7 @@ |
||
| 202 | 202 | AND receiver_delete = ' . $db->escapeBoolean(false) . ' |
| 203 | 203 | ORDER BY send_time DESC'); |
| 204 | 204 | while ($db->nextRecord()) { |
| 205 | - $groupBox =& $messageBox['GroupedMessages'][$db->getInt('sender_id')]; |
|
| 205 | + $groupBox = & $messageBox['GroupedMessages'][$db->getInt('sender_id')]; |
|
| 206 | 206 | // Limit the number of messages in each group |
| 207 | 207 | if (!isset($groupBox['Messages']) || count($groupBox['Messages']) < MESSAGE_SCOUT_GROUP_LIMIT) { |
| 208 | 208 | displayMessage($groupBox, $db->getInt('message_id'), $db->getInt('account_id'), $db->getInt('sender_id'), stripslashes($db->getField('message_text')), $db->getInt('send_time'), $db->getBoolean('msg_read'), MSG_SCOUT); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | $db3 = new SmrMySqlDatabase(); |
| 8 | 8 | |
| 9 | 9 | // get current entry |
| 10 | - $db->query('SELECT * FROM manual WHERE topic_id = '.$db->escapeNumber($topic_id)); |
|
| 10 | + $db->query('SELECT * FROM manual WHERE topic_id = ' . $db->escapeNumber($topic_id)); |
|
| 11 | 11 | if ($db->nextRecord()) { |
| 12 | 12 | $parent_topic_id = $db->getInt('parent_topic_id'); |
| 13 | 13 | $order_id = $db->getInt('order_id'); |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | // ************************** |
| 20 | 20 | // ** PREVIOUS |
| 21 | 21 | // ************************** |
| 22 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($order_id - 1)); |
|
| 22 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($parent_topic_id) . ' AND order_id = ' . $db2->escapeNumber($order_id - 1)); |
|
| 23 | 23 | |
| 24 | 24 | // no result? |
| 25 | 25 | if (!$db2->getNumRows()) |
| 26 | - $db2->query('SELECT * FROM manual WHERE topic_id = '.$db2->escapeNumber($parent_topic_id)); |
|
| 26 | + $db2->query('SELECT * FROM manual WHERE topic_id = ' . $db2->escapeNumber($parent_topic_id)); |
|
| 27 | 27 | |
| 28 | 28 | echo ('<th width="32">'); |
| 29 | 29 | if ($db2->nextRecord()) { |
| 30 | 30 | $previous_topic_id = $db2->getInt('topic_id'); |
| 31 | 31 | $previous_topic = stripslashes($db2->getField('topic')); |
| 32 | - echo ('<a href="/manual.php?'.$previous_topic_id.'"><img src="/images/help/previous.jpg" width="32" height="32" border="0"></a>'); |
|
| 32 | + echo ('<a href="/manual.php?' . $previous_topic_id . '"><img src="/images/help/previous.jpg" width="32" height="32" border="0"></a>'); |
|
| 33 | 33 | } else |
| 34 | 34 | echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
| 35 | 35 | echo ('</th>'); |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | // ************************** |
| 38 | 38 | // ** UP |
| 39 | 39 | // ************************** |
| 40 | - $db2->query('SELECT * FROM manual WHERE topic_id = '.$db2->escapeNumber($parent_topic_id)); |
|
| 40 | + $db2->query('SELECT * FROM manual WHERE topic_id = ' . $db2->escapeNumber($parent_topic_id)); |
|
| 41 | 41 | echo ('<th width="32">'); |
| 42 | 42 | if ($db2->nextRecord()) { |
| 43 | 43 | $up_topic_id = $db2->getInt('topic_id'); |
| 44 | 44 | $up_topic = stripslashes($db2->getField('topic')); |
| 45 | - echo ('<a href="/manual.php?'.$up_topic_id.'"><img src="/images/help/up.jpg" width="32" height="32" border="0"></a>'); |
|
| 45 | + echo ('<a href="/manual.php?' . $up_topic_id . '"><img src="/images/help/up.jpg" width="32" height="32" border="0"></a>'); |
|
| 46 | 46 | } else |
| 47 | 47 | echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
| 48 | 48 | echo ('</th>'); |
@@ -50,35 +50,35 @@ discard block |
||
| 50 | 50 | // ************************** |
| 51 | 51 | // ** NEXT |
| 52 | 52 | // ************************** |
| 53 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($topic_id).' AND order_id = 1'); |
|
| 53 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($topic_id) . ' AND order_id = 1'); |
|
| 54 | 54 | |
| 55 | 55 | if (!$db2->getNumRows()) |
| 56 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($order_id + 1)); |
|
| 56 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($parent_topic_id) . ' AND order_id = ' . $db2->escapeNumber($order_id + 1)); |
|
| 57 | 57 | |
| 58 | 58 | $seenParentIDs = array(0); |
| 59 | 59 | $curr_parent_topic_id = $parent_topic_id; |
| 60 | 60 | while (!$db2->getNumRows() && !in_array($curr_parent_topic_id, $seenParentIDs)) { |
| 61 | 61 | $seenParentIDs[] = $curr_parent_topic_id; |
| 62 | - $db3->query('SELECT * FROM manual WHERE topic_id = '.$db3->escapeNumber($parent_topic_id)); |
|
| 62 | + $db3->query('SELECT * FROM manual WHERE topic_id = ' . $db3->escapeNumber($parent_topic_id)); |
|
| 63 | 63 | $db3->nextRecord(); |
| 64 | 64 | $curr_order_id = $db3->getInt('order_id'); |
| 65 | 65 | $curr_parent_topic_id = $db3->getInt('parent_topic_id'); |
| 66 | 66 | |
| 67 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($curr_order_id + 1)); |
|
| 67 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($parent_topic_id) . ' AND order_id = ' . $db2->escapeNumber($curr_order_id + 1)); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | echo ('<th width="32">'); |
| 71 | 71 | if ($db2->nextRecord()) { |
| 72 | 72 | $next_topic_id = $db2->getInt('topic_id'); |
| 73 | 73 | $next_topic = stripslashes($db2->getField('topic')); |
| 74 | - echo ('<a href="/manual.php?'.$next_topic_id.'"><img src="/images/help/next.jpg" width="32" height="32" border="0"></a>'); |
|
| 74 | + echo ('<a href="/manual.php?' . $next_topic_id . '"><img src="/images/help/next.jpg" width="32" height="32" border="0"></a>'); |
|
| 75 | 75 | } |
| 76 | 76 | else { |
| 77 | 77 | echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
| 78 | 78 | } |
| 79 | 79 | echo ('</th>'); |
| 80 | 80 | |
| 81 | - echo ('<th width="100%" class="center" validn="middle" style="font-size:18pt;font-weight:bold;">' . get_numbering($topic_id) . $topic.'</th>'); |
|
| 81 | + echo ('<th width="100%" class="center" validn="middle" style="font-size:18pt;font-weight:bold;">' . get_numbering($topic_id) . $topic . '</th>'); |
|
| 82 | 82 | echo ('<th width="32"><a href="/manual_toc.php"><img src="/images/help/contents.jpg" width="32" height="32" border="0"></a></th>'); |
| 83 | 83 | |
| 84 | 84 | echo ('</tr>'); |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | echo ('<tr>'); |
| 87 | 87 | echo ('<td colspan="5">'); |
| 88 | 88 | if (isset($previous_topic_id) && $previous_topic_id > 0) |
| 89 | - echo ('<b>Previous:</b> <a href="/manual.php?'.$previous_topic_id.'">' . get_numbering($previous_topic_id) . $previous_topic.'</a> '); |
|
| 89 | + echo ('<b>Previous:</b> <a href="/manual.php?' . $previous_topic_id . '">' . get_numbering($previous_topic_id) . $previous_topic . '</a> '); |
|
| 90 | 90 | if (isset($up_topic_id) && $up_topic_id > 0) |
| 91 | - echo ('<b>Up:</b> <a href="/manual.php?'.$up_topic_id.'">' . get_numbering($up_topic_id) . $up_topic.'</a> '); |
|
| 91 | + echo ('<b>Up:</b> <a href="/manual.php?' . $up_topic_id . '">' . get_numbering($up_topic_id) . $up_topic . '</a> '); |
|
| 92 | 92 | if (isset($next_topic_id) && $next_topic_id > 0) |
| 93 | - echo ('<b>Next:</b> <a href="/manual.php?'.$next_topic_id.'">' . get_numbering($next_topic_id) . $next_topic.'</a>'); |
|
| 93 | + echo ('<b>Next:</b> <a href="/manual.php?' . $next_topic_id . '">' . get_numbering($next_topic_id) . $next_topic . '</a>'); |
|
| 94 | 94 | echo ('</tr>'); |
| 95 | 95 | |
| 96 | 96 | echo ('</table>'); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $db = new SmrMySqlDatabase(); |
| 104 | 104 | |
| 105 | 105 | // get current entry |
| 106 | - $db->query('SELECT * FROM manual WHERE topic_id = '.$topic_id); |
|
| 106 | + $db->query('SELECT * FROM manual WHERE topic_id = ' . $topic_id); |
|
| 107 | 107 | if ($db->nextRecord()) { |
| 108 | 108 | $parent_topic_id = $db->getInt('parent_topic_id'); |
| 109 | 109 | $order_id = $db->getInt('order_id'); |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | $text = stripslashes($db->getField('text')); |
| 112 | 112 | |
| 113 | 113 | echo ('<div id="help_content">'); |
| 114 | - echo ('<h1>' . get_numbering($topic_id) . $topic.'</h1>'); |
|
| 115 | - echo ('<p>'.$text.'<p>'); |
|
| 114 | + echo ('<h1>' . get_numbering($topic_id) . $topic . '</h1>'); |
|
| 115 | + echo ('<p>' . $text . '<p>'); |
|
| 116 | 116 | echo ('</div>'); |
| 117 | 117 | } else |
| 118 | 118 | echo ('Invalid Topic!'); |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | function echo_subsection($topic_id) { |
| 122 | 122 | // database object |
| 123 | 123 | $db = new SmrMySqlDatabase(); |
| 124 | - $return=''; |
|
| 124 | + $return = ''; |
|
| 125 | 125 | // check if there are subsections |
| 126 | - $db->query('SELECT * FROM manual WHERE parent_topic_id = '.$db->escapeNumber($topic_id).' ORDER BY order_id'); |
|
| 126 | + $db->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db->escapeNumber($topic_id) . ' ORDER BY order_id'); |
|
| 127 | 127 | if ($db->getNumRows()) { |
| 128 | 128 | echo ('<hr noshade width="75%" size="1" class="center"/>'); |
| 129 | 129 | echo ('<div id="help_menu">'); |
@@ -137,19 +137,19 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | function echo_menu($topic_id) { |
| 140 | - $return=''; |
|
| 140 | + $return = ''; |
|
| 141 | 141 | // database object |
| 142 | 142 | $db = new SmrMySqlDatabase(); |
| 143 | 143 | |
| 144 | - $db->query('SELECT * FROM manual WHERE parent_topic_id = '.$db->escapeNumber($topic_id).' ORDER BY order_id'); |
|
| 144 | + $db->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db->escapeNumber($topic_id) . ' ORDER BY order_id'); |
|
| 145 | 145 | if ($db->getNumRows()) { |
| 146 | 146 | echo ('<ul type="disc">'); |
| 147 | - while($db->nextRecord()) { |
|
| 147 | + while ($db->nextRecord()) { |
|
| 148 | 148 | $sub_topic_id = $db->getInt('topic_id'); |
| 149 | 149 | $order_id = $db->getInt('order_id'); |
| 150 | 150 | $sub_topic = stripslashes($db->getField('topic')); |
| 151 | 151 | |
| 152 | - echo ('<li><a href="/manual.php?'.$sub_topic_id.'">' . get_numbering($sub_topic_id) . $sub_topic.'</a></li>'); |
|
| 152 | + echo ('<li><a href="/manual.php?' . $sub_topic_id . '">' . get_numbering($sub_topic_id) . $sub_topic . '</a></li>'); |
|
| 153 | 153 | echo_menu($sub_topic_id); |
| 154 | 154 | } |
| 155 | 155 | echo ('</ul>'); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | function get_numbering($topic_id) { |
| 161 | 161 | $db = new SmrMySqlDatabase(); |
| 162 | 162 | |
| 163 | - $db->query('SELECT * FROM manual WHERE topic_id = '.$db->escapeNumber($topic_id)); |
|
| 163 | + $db->query('SELECT * FROM manual WHERE topic_id = ' . $db->escapeNumber($topic_id)); |
|
| 164 | 164 | if ($db->nextRecord()) { |
| 165 | 165 | $up_topic_id = $db->getInt('parent_topic_id'); |
| 166 | 166 | $order_id = $db->getInt('order_id'); |
@@ -22,16 +22,18 @@ discard block |
||
| 22 | 22 | $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($order_id - 1)); |
| 23 | 23 | |
| 24 | 24 | // no result? |
| 25 | - if (!$db2->getNumRows()) |
|
| 26 | - $db2->query('SELECT * FROM manual WHERE topic_id = '.$db2->escapeNumber($parent_topic_id)); |
|
| 25 | + if (!$db2->getNumRows()) { |
|
| 26 | + $db2->query('SELECT * FROM manual WHERE topic_id = '.$db2->escapeNumber($parent_topic_id)); |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | echo ('<th width="32">'); |
| 29 | 30 | if ($db2->nextRecord()) { |
| 30 | 31 | $previous_topic_id = $db2->getInt('topic_id'); |
| 31 | 32 | $previous_topic = stripslashes($db2->getField('topic')); |
| 32 | 33 | echo ('<a href="/manual.php?'.$previous_topic_id.'"><img src="/images/help/previous.jpg" width="32" height="32" border="0"></a>'); |
| 33 | - } else |
|
| 34 | - echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
|
| 34 | + } else { |
|
| 35 | + echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
|
| 36 | + } |
|
| 35 | 37 | echo ('</th>'); |
| 36 | 38 | |
| 37 | 39 | // ************************** |
@@ -43,8 +45,9 @@ discard block |
||
| 43 | 45 | $up_topic_id = $db2->getInt('topic_id'); |
| 44 | 46 | $up_topic = stripslashes($db2->getField('topic')); |
| 45 | 47 | echo ('<a href="/manual.php?'.$up_topic_id.'"><img src="/images/help/up.jpg" width="32" height="32" border="0"></a>'); |
| 46 | - } else |
|
| 47 | - echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
|
| 48 | + } else { |
|
| 49 | + echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
|
| 50 | + } |
|
| 48 | 51 | echo ('</th>'); |
| 49 | 52 | |
| 50 | 53 | // ************************** |
@@ -52,8 +55,9 @@ discard block |
||
| 52 | 55 | // ************************** |
| 53 | 56 | $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($topic_id).' AND order_id = 1'); |
| 54 | 57 | |
| 55 | - if (!$db2->getNumRows()) |
|
| 56 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($order_id + 1)); |
|
| 58 | + if (!$db2->getNumRows()) { |
|
| 59 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($order_id + 1)); |
|
| 60 | + } |
|
| 57 | 61 | |
| 58 | 62 | $seenParentIDs = array(0); |
| 59 | 63 | $curr_parent_topic_id = $parent_topic_id; |
@@ -72,8 +76,7 @@ discard block |
||
| 72 | 76 | $next_topic_id = $db2->getInt('topic_id'); |
| 73 | 77 | $next_topic = stripslashes($db2->getField('topic')); |
| 74 | 78 | echo ('<a href="/manual.php?'.$next_topic_id.'"><img src="/images/help/next.jpg" width="32" height="32" border="0"></a>'); |
| 75 | - } |
|
| 76 | - else { |
|
| 79 | + } else { |
|
| 77 | 80 | echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
| 78 | 81 | } |
| 79 | 82 | echo ('</th>'); |
@@ -85,18 +88,22 @@ discard block |
||
| 85 | 88 | |
| 86 | 89 | echo ('<tr>'); |
| 87 | 90 | echo ('<td colspan="5">'); |
| 88 | - if (isset($previous_topic_id) && $previous_topic_id > 0) |
|
| 89 | - echo ('<b>Previous:</b> <a href="/manual.php?'.$previous_topic_id.'">' . get_numbering($previous_topic_id) . $previous_topic.'</a> '); |
|
| 90 | - if (isset($up_topic_id) && $up_topic_id > 0) |
|
| 91 | - echo ('<b>Up:</b> <a href="/manual.php?'.$up_topic_id.'">' . get_numbering($up_topic_id) . $up_topic.'</a> '); |
|
| 92 | - if (isset($next_topic_id) && $next_topic_id > 0) |
|
| 93 | - echo ('<b>Next:</b> <a href="/manual.php?'.$next_topic_id.'">' . get_numbering($next_topic_id) . $next_topic.'</a>'); |
|
| 91 | + if (isset($previous_topic_id) && $previous_topic_id > 0) { |
|
| 92 | + echo ('<b>Previous:</b> <a href="/manual.php?'.$previous_topic_id.'">' . get_numbering($previous_topic_id) . $previous_topic.'</a> '); |
|
| 93 | + } |
|
| 94 | + if (isset($up_topic_id) && $up_topic_id > 0) { |
|
| 95 | + echo ('<b>Up:</b> <a href="/manual.php?'.$up_topic_id.'">' . get_numbering($up_topic_id) . $up_topic.'</a> '); |
|
| 96 | + } |
|
| 97 | + if (isset($next_topic_id) && $next_topic_id > 0) { |
|
| 98 | + echo ('<b>Next:</b> <a href="/manual.php?'.$next_topic_id.'">' . get_numbering($next_topic_id) . $next_topic.'</a>'); |
|
| 99 | + } |
|
| 94 | 100 | echo ('</tr>'); |
| 95 | 101 | |
| 96 | 102 | echo ('</table>'); |
| 97 | - } else |
|
| 98 | - echo ('Invalid Topic!'); |
|
| 99 | -} |
|
| 103 | + } else { |
|
| 104 | + echo ('Invalid Topic!'); |
|
| 105 | + } |
|
| 106 | + } |
|
| 100 | 107 | |
| 101 | 108 | function echo_content($topic_id) { |
| 102 | 109 | // database object |
@@ -114,9 +121,10 @@ discard block |
||
| 114 | 121 | echo ('<h1>' . get_numbering($topic_id) . $topic.'</h1>'); |
| 115 | 122 | echo ('<p>'.$text.'<p>'); |
| 116 | 123 | echo ('</div>'); |
| 117 | - } else |
|
| 118 | - echo ('Invalid Topic!'); |
|
| 119 | -} |
|
| 124 | + } else { |
|
| 125 | + echo ('Invalid Topic!'); |
|
| 126 | + } |
|
| 127 | + } |
|
| 120 | 128 | |
| 121 | 129 | function echo_subsection($topic_id) { |
| 122 | 130 | // database object |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | $db = new $var['HistoryDatabase'](); |
| 13 | 13 | $db->query('SELECT start_date, type, end_date, game_name, speed, game_id ' . |
| 14 | - 'FROM game WHERE game_id = ' . $db->escapeNumber($game_id)); |
|
| 14 | + 'FROM game WHERE game_id = ' . $db->escapeNumber($game_id)); |
|
| 15 | 15 | $db->nextRecord(); |
| 16 | 16 | $template->assign('GameName', $game_name); |
| 17 | 17 | $template->assign('Start', date(DATE_DATE_SHORT, $db->getInt('start_date'))); |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | $game_id = $var['delete_game_id']; |
| 22 | 22 | |
| 23 | 23 | if ($save) { |
| 24 | - $db->query('SELECT * FROM alliance WHERE game_id = '.$db->escapeNumber($game_id)); |
|
| 24 | + $db->query('SELECT * FROM alliance WHERE game_id = ' . $db->escapeNumber($game_id)); |
|
| 25 | 25 | |
| 26 | 26 | while ($db->nextRecord()) { |
| 27 | 27 | $id = $db->getInt('alliance_id'); |
| 28 | 28 | //we need info for forces |
| 29 | 29 | //populate alliance list |
| 30 | 30 | $db2->query('SELECT * FROM player |
| 31 | - WHERE alliance_id = '.$db2->escapeNumber($id).' |
|
| 31 | + WHERE alliance_id = '.$db2->escapeNumber($id) . ' |
|
| 32 | 32 | AND game_id = '.$db2->escapeNumber($game_id)); |
| 33 | 33 | $list = array(0); |
| 34 | 34 | while ($db2->nextRecord()) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | $db2->query('SELECT sum(mines) as sum_m, sum(combat_drones) as cds, sum(scout_drones) as sds |
| 38 | 38 | FROM sector_has_forces |
| 39 | - WHERE owner_id IN ('.$db2->escapeArray($list).') AND game_id = '.$db2->escapeNumber($game_id)); |
|
| 39 | + WHERE owner_id IN ('.$db2->escapeArray($list) . ') AND game_id = ' . $db2->escapeNumber($game_id)); |
|
| 40 | 40 | if ($db2->nextRecord()) { |
| 41 | 41 | |
| 42 | 42 | $mines = $db2->getInt('sum_m'); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $deaths = $db->getInt('alliance_deaths'); |
| 57 | 57 | // insert into history db |
| 58 | 58 | $history_db_sql[] = 'INSERT INTO alliance (game_id, alliance_id, leader_id, kills, deaths, alliance_name, mines, cds, sds) ' . |
| 59 | - 'VALUES ('.$db->escapeNumber($game_id).', '.$db->escapeNumber($id).', '.$db->escapeNumber($leader).', '.$db->escapeNumber($kills).', '.$db->escapeNumber($deaths).', ' . $db->escapeString($name) . ', '.$db->escapeNumber($mines).', '.$db->escapeNumber($cds).', '.$db->escapeNumber($sds).')'; |
|
| 59 | + 'VALUES (' . $db->escapeNumber($game_id) . ', ' . $db->escapeNumber($id) . ', ' . $db->escapeNumber($leader) . ', ' . $db->escapeNumber($kills) . ', ' . $db->escapeNumber($deaths) . ', ' . $db->escapeString($name) . ', ' . $db->escapeNumber($mines) . ', ' . $db->escapeNumber($cds) . ', ' . $db->escapeNumber($sds) . ')'; |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,56 +65,56 @@ discard block |
||
| 65 | 65 | // these table is nothing worth without the players |
| 66 | 66 | //$smr_db_sql[] = 'DELETE FROM account_has_logs WHERE game_id = '.$game_id; |
| 67 | 67 | |
| 68 | - $smr_db_sql[] = 'UPDATE active_session SET game_id = 0 WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 69 | - $smr_db_sql[] = 'DELETE FROM alliance WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 70 | - $smr_db_sql[] = 'DELETE FROM alliance_bank_transactions WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 71 | - $smr_db_sql[] = 'DELETE FROM alliance_has_roles WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 72 | - $smr_db_sql[] = 'DELETE FROM alliance_thread WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 73 | - $smr_db_sql[] = 'DELETE FROM alliance_thread_topic WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 68 | + $smr_db_sql[] = 'UPDATE active_session SET game_id = 0 WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 69 | + $smr_db_sql[] = 'DELETE FROM alliance WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 70 | + $smr_db_sql[] = 'DELETE FROM alliance_bank_transactions WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 71 | + $smr_db_sql[] = 'DELETE FROM alliance_has_roles WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 72 | + $smr_db_sql[] = 'DELETE FROM alliance_thread WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 73 | + $smr_db_sql[] = 'DELETE FROM alliance_thread_topic WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 74 | 74 | |
| 75 | 75 | if ($save) { |
| 76 | 76 | |
| 77 | - $db->query('SELECT * FROM alliance_vs_alliance WHERE game_id = '.$db->escapeNumber($game_id)); |
|
| 77 | + $db->query('SELECT * FROM alliance_vs_alliance WHERE game_id = ' . $db->escapeNumber($game_id)); |
|
| 78 | 78 | while ($db->nextRecord()) { |
| 79 | 79 | |
| 80 | 80 | $alliance_1 = $db->getInt('alliance_id_1'); |
| 81 | 81 | $alliance_2 = $db->getInt('alliance_id_2'); |
| 82 | 82 | $kills = $db->getInt('kills'); |
| 83 | 83 | $history_db_sql[] = 'INSERT INTO alliance_vs_alliance (game_id, alliance_id_1, alliance_id_2, kills) ' . |
| 84 | - 'VALUES ('.$game_id.', '.$alliance_1.', '.$alliance_2.', '.$kills.')'; |
|
| 84 | + 'VALUES (' . $game_id . ', ' . $alliance_1 . ', ' . $alliance_2 . ', ' . $kills . ')'; |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | - $smr_db_sql[] = 'DELETE FROM alliance_vs_alliance WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 92 | - $smr_db_sql[] = 'DELETE FROM anon_bank WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 93 | - $smr_db_sql[] = 'DELETE FROM anon_bank_transactions WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 94 | - $smr_db_sql[] = 'DELETE FROM bar_tender WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 95 | - $smr_db_sql[] = 'DELETE FROM blackjack WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 96 | - $smr_db_sql[] = 'DELETE FROM galactic_post_applications WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 97 | - $smr_db_sql[] = 'DELETE FROM galactic_post_article WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 98 | - $smr_db_sql[] = 'DELETE FROM galactic_post_paper WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 99 | - $smr_db_sql[] = 'DELETE FROM galactic_post_paper_content WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 100 | - $smr_db_sql[] = 'DELETE FROM galactic_post_writer WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 101 | - $smr_db_sql[] = 'DELETE FROM game_galaxy WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 91 | + $smr_db_sql[] = 'DELETE FROM alliance_vs_alliance WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 92 | + $smr_db_sql[] = 'DELETE FROM anon_bank WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 93 | + $smr_db_sql[] = 'DELETE FROM anon_bank_transactions WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 94 | + $smr_db_sql[] = 'DELETE FROM bar_tender WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 95 | + $smr_db_sql[] = 'DELETE FROM blackjack WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 96 | + $smr_db_sql[] = 'DELETE FROM galactic_post_applications WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 97 | + $smr_db_sql[] = 'DELETE FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 98 | + $smr_db_sql[] = 'DELETE FROM galactic_post_paper WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 99 | + $smr_db_sql[] = 'DELETE FROM galactic_post_paper_content WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 100 | + $smr_db_sql[] = 'DELETE FROM galactic_post_writer WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 101 | + $smr_db_sql[] = 'DELETE FROM game_galaxy WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 102 | 102 | |
| 103 | 103 | if ($save) { |
| 104 | 104 | $game = SmrGame::getGame($game_id); |
| 105 | 105 | // insert into history db |
| 106 | 106 | $history_db_sql[] = 'INSERT INTO game (game_id, end_date, start_date, game_name, speed, type) VALUES ' . |
| 107 | - '('.$db->escapeNumber($game_id).', '.$game->getEndTime().', '.$game->getStartTime().', ' . $db->escapeString($game->getGameName()) . ', '.$game->getGameSpeed().', '.$db->escapeString($game->getGameType()).')'; |
|
| 107 | + '(' . $db->escapeNumber($game_id) . ', ' . $game->getEndTime() . ', ' . $game->getStartTime() . ', ' . $db->escapeString($game->getGameName()) . ', ' . $game->getGameSpeed() . ', ' . $db->escapeString($game->getGameType()) . ')'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $smr_db_sql[] = 'DELETE FROM location WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 111 | - $smr_db_sql[] = 'DELETE FROM mb_exceptions WHERE value LIKE '.$db->escapeString($game_id.'%'); |
|
| 112 | - $smr_db_sql[] = 'DELETE FROM message WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 113 | - $smr_db_sql[] = 'DELETE FROM message_notify WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 110 | + $smr_db_sql[] = 'DELETE FROM location WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 111 | + $smr_db_sql[] = 'DELETE FROM mb_exceptions WHERE value LIKE ' . $db->escapeString($game_id . '%'); |
|
| 112 | + $smr_db_sql[] = 'DELETE FROM message WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 113 | + $smr_db_sql[] = 'DELETE FROM message_notify WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 114 | 114 | |
| 115 | 115 | if ($save) { |
| 116 | 116 | |
| 117 | - $db->query('SELECT * FROM news WHERE game_id = '.$game_id.' AND type = \'regular\''); |
|
| 117 | + $db->query('SELECT * FROM news WHERE game_id = ' . $game_id . ' AND type = \'regular\''); |
|
| 118 | 118 | $id = 1; |
| 119 | 119 | |
| 120 | 120 | while ($db->nextRecord()) { |
@@ -124,17 +124,17 @@ discard block |
||
| 124 | 124 | $msg = $db->getField('news_message'); |
| 125 | 125 | |
| 126 | 126 | // insert into history db |
| 127 | - $history_db_sql[] = 'INSERT INTO news (game_id, news_id, time, message) VALUES ('.$game_id.', '.$id.', '.$time.', ' . $db->escapeString($msg) . ')'; |
|
| 127 | + $history_db_sql[] = 'INSERT INTO news (game_id, news_id, time, message) VALUES (' . $game_id . ', ' . $id . ', ' . $time . ', ' . $db->escapeString($msg) . ')'; |
|
| 128 | 128 | $id++; |
| 129 | 129 | |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $smr_db_sql[] = 'DELETE FROM news WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 133 | + $smr_db_sql[] = 'DELETE FROM news WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 134 | 134 | |
| 135 | 135 | if ($save) { |
| 136 | 136 | |
| 137 | - $db->query('SELECT * FROM planet WHERE game_id = '.$db->escapeNumber($game_id)); |
|
| 137 | + $db->query('SELECT * FROM planet WHERE game_id = ' . $db->escapeNumber($game_id)); |
|
| 138 | 138 | |
| 139 | 139 | while ($db->nextRecord()) { |
| 140 | 140 | |
@@ -142,34 +142,34 @@ discard block |
||
| 142 | 142 | $sector = $db->getInt('sector_id'); |
| 143 | 143 | $owner = $db->getInt('owner_id'); |
| 144 | 144 | |
| 145 | - $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 1'); |
|
| 145 | + $db2->query('SELECT * FROM planet_has_building WHERE game_id = ' . $game_id . ' AND sector_id = ' . $sector . ' AND construction_id = 1'); |
|
| 146 | 146 | if ($db2->nextRecord()) $gens = $db2->getInt('amount'); |
| 147 | 147 | else $gens = 0; |
| 148 | 148 | |
| 149 | - $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 2'); |
|
| 149 | + $db2->query('SELECT * FROM planet_has_building WHERE game_id = ' . $game_id . ' AND sector_id = ' . $sector . ' AND construction_id = 2'); |
|
| 150 | 150 | if ($db2->nextRecord()) $hangs = $db2->getInt('amount'); |
| 151 | 151 | else $hangs = 0; |
| 152 | 152 | |
| 153 | - $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 3'); |
|
| 153 | + $db2->query('SELECT * FROM planet_has_building WHERE game_id = ' . $game_id . ' AND sector_id = ' . $sector . ' AND construction_id = 3'); |
|
| 154 | 154 | if ($db2->nextRecord()) $turs = $db2->getInt('amount'); |
| 155 | 155 | else $turs = 0; |
| 156 | 156 | |
| 157 | 157 | // insert into history db |
| 158 | 158 | $history_db_sql[] = 'INSERT INTO planet (game_id, sector_id, owner_id, generators, hangers, turrets) VALUES ' . |
| 159 | - '('.$game_id.', '.$sector.', '.$owner.', '.$gens.', '.$hangs.', '.$turs.')'; |
|
| 159 | + '(' . $game_id . ', ' . $sector . ', ' . $owner . ', ' . $gens . ', ' . $hangs . ', ' . $turs . ')'; |
|
| 160 | 160 | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $smr_db_sql[] = 'DELETE FROM planet WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 166 | - $smr_db_sql[] = 'DELETE FROM planet_is_building WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 167 | - $smr_db_sql[] = 'DELETE FROM planet_has_cargo WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 168 | - $smr_db_sql[] = 'DELETE FROM planet_has_building WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 165 | + $smr_db_sql[] = 'DELETE FROM planet WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 166 | + $smr_db_sql[] = 'DELETE FROM planet_is_building WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 167 | + $smr_db_sql[] = 'DELETE FROM planet_has_cargo WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 168 | + $smr_db_sql[] = 'DELETE FROM planet_has_building WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 169 | 169 | |
| 170 | 170 | if ($save) { |
| 171 | 171 | |
| 172 | - $db->query('SELECT * FROM player WHERE game_id = '.$game_id); |
|
| 172 | + $db->query('SELECT * FROM player WHERE game_id = ' . $game_id); |
|
| 173 | 173 | |
| 174 | 174 | while ($db->nextRecord()) { |
| 175 | 175 | |
@@ -187,48 +187,48 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | $amount = 0; |
| 189 | 189 | $smrCredits = 0; |
| 190 | - $db2->query('SELECT sum(amount) as bounty_am, sum(smr_credits) as bounty_cred FROM bounty WHERE game_id = '.$game_id.' AND account_id = '.$acc_id.' AND claimer_id = 0'); |
|
| 190 | + $db2->query('SELECT sum(amount) as bounty_am, sum(smr_credits) as bounty_cred FROM bounty WHERE game_id = ' . $game_id . ' AND account_id = ' . $acc_id . ' AND claimer_id = 0'); |
|
| 191 | 191 | if ($db2->nextRecord()) { |
| 192 | 192 | if (is_int($db2->getField('bounty_am'))) $amount = $db2->getInt('bounty_am'); |
| 193 | 193 | if (is_int($db2->getField('bounty_cred'))) $smrCredits = $db2->getInt('bounty_cred'); |
| 194 | 194 | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $db2->query('SELECT * FROM ship_has_name WHERE game_id = '.$game_id.' AND account_id = '.$acc_id); |
|
| 197 | + $db2->query('SELECT * FROM ship_has_name WHERE game_id = ' . $game_id . ' AND account_id = ' . $acc_id); |
|
| 198 | 198 | if ($db2->nextRecord()) $ship_name = $db2->getField('ship_name'); |
| 199 | 199 | else $ship_name = 'None'; |
| 200 | 200 | |
| 201 | 201 | // insert into history db |
| 202 | 202 | $history_db_sql[] = 'INSERT INTO player (account_id, game_id, player_name, player_id, experience, ship, race, alignment, alliance_id, kills, deaths, bounty, bounty_cred, ship_name) ' . |
| 203 | - 'VALUES ('.$acc_id.', '.$game_id.', ' . $db->escapeString($name) . ', '.$id.', '.$exp.', '.$ship.', '.$race.', '.$align.', '.$alli.', '.$kills.', '.$deaths.', '.$amount.','.$smrCredits.', ' . $db->escapeString($ship_name) . ')'; |
|
| 203 | + 'VALUES (' . $acc_id . ', ' . $game_id . ', ' . $db->escapeString($name) . ', ' . $id . ', ' . $exp . ', ' . $ship . ', ' . $race . ', ' . $align . ', ' . $alli . ', ' . $kills . ', ' . $deaths . ', ' . $amount . ',' . $smrCredits . ', ' . $db->escapeString($ship_name) . ')'; |
|
| 204 | 204 | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - $smr_db_sql[] = 'DELETE FROM player WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 210 | - $smr_db_sql[] = 'DELETE FROM bounty WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 211 | - $smr_db_sql[] = 'DELETE FROM player_has_ticker WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 212 | - $smr_db_sql[] = 'DELETE FROM player_has_ticket WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 213 | - $smr_db_sql[] = 'DELETE FROM player_has_alliance_role WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 214 | - $smr_db_sql[] = 'DELETE FROM player_has_drinks WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 215 | - $smr_db_sql[] = 'DELETE FROM player_has_relation WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 216 | - $smr_db_sql[] = 'DELETE FROM player_has_unread_messages WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 217 | - $smr_db_sql[] = 'DELETE FROM player_plotted_course WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 218 | - $smr_db_sql[] = 'DELETE FROM player_read_thread WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 219 | - $smr_db_sql[] = 'DELETE FROM player_visited_port WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 220 | - $smr_db_sql[] = 'DELETE FROM player_visited_sector WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 221 | - $smr_db_sql[] = 'DELETE FROM player_votes_pact WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 222 | - $smr_db_sql[] = 'DELETE FROM player_votes_relation WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 223 | - $smr_db_sql[] = 'DELETE FROM plot_cache WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 224 | - $smr_db_sql[] = 'DELETE FROM port WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 225 | - $smr_db_sql[] = 'DELETE FROM port_has_goods WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 226 | - $smr_db_sql[] = 'DELETE FROM race_has_relation WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 227 | - $smr_db_sql[] = 'DELETE FROM race_has_voting WHERE game_id = '.$db->escapeNumber($game_id); |
|
| 209 | + $smr_db_sql[] = 'DELETE FROM player WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 210 | + $smr_db_sql[] = 'DELETE FROM bounty WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 211 | + $smr_db_sql[] = 'DELETE FROM player_has_ticker WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 212 | + $smr_db_sql[] = 'DELETE FROM player_has_ticket WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 213 | + $smr_db_sql[] = 'DELETE FROM player_has_alliance_role WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 214 | + $smr_db_sql[] = 'DELETE FROM player_has_drinks WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 215 | + $smr_db_sql[] = 'DELETE FROM player_has_relation WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 216 | + $smr_db_sql[] = 'DELETE FROM player_has_unread_messages WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 217 | + $smr_db_sql[] = 'DELETE FROM player_plotted_course WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 218 | + $smr_db_sql[] = 'DELETE FROM player_read_thread WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 219 | + $smr_db_sql[] = 'DELETE FROM player_visited_port WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 220 | + $smr_db_sql[] = 'DELETE FROM player_visited_sector WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 221 | + $smr_db_sql[] = 'DELETE FROM player_votes_pact WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 222 | + $smr_db_sql[] = 'DELETE FROM player_votes_relation WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 223 | + $smr_db_sql[] = 'DELETE FROM plot_cache WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 224 | + $smr_db_sql[] = 'DELETE FROM port WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 225 | + $smr_db_sql[] = 'DELETE FROM port_has_goods WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 226 | + $smr_db_sql[] = 'DELETE FROM race_has_relation WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 227 | + $smr_db_sql[] = 'DELETE FROM race_has_voting WHERE game_id = ' . $db->escapeNumber($game_id); |
|
| 228 | 228 | |
| 229 | 229 | if ($save) { |
| 230 | 230 | |
| 231 | - $db->query('SELECT * FROM sector WHERE game_id = '.$game_id); |
|
| 231 | + $db->query('SELECT * FROM sector WHERE game_id = ' . $game_id); |
|
| 232 | 232 | |
| 233 | 233 | while ($db->nextRecord()) { |
| 234 | 234 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $gal_id = $db->getInt('galaxy_id'); |
| 239 | 239 | |
| 240 | 240 | $db2->query('SELECT sum(mines) as sum_mines, sum(combat_drones) as cds, sum(scout_drones) as sds FROM sector_has_forces ' . |
| 241 | - 'WHERE sector_id = '.$sector.' AND game_id = '.$game_id.' GROUP BY sector_id'); |
|
| 241 | + 'WHERE sector_id = ' . $sector . ' AND game_id = ' . $game_id . ' GROUP BY sector_id'); |
|
| 242 | 242 | if ($db2->nextRecord()) { |
| 243 | 243 | |
| 244 | 244 | $mines = $db2->getInt('sum_mines'); |
@@ -258,32 +258,32 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | // insert into history db |
| 260 | 260 | $history_db_sql[] = 'INSERT INTO sector (game_id, sector_id, gal_id, mines, kills, combat, scouts) ' . |
| 261 | - 'VALUES ('.$game_id.','. $sector.','. $gal_id.','. $mines.','. $kills.','. $cds.','. $sds.')'; |
|
| 261 | + 'VALUES (' . $game_id . ',' . $sector . ',' . $gal_id . ',' . $mines . ',' . $kills . ',' . $cds . ',' . $sds . ')'; |
|
| 262 | 262 | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - $smr_db_sql[] = 'DELETE FROM sector WHERE game_id = '.$game_id; |
|
| 268 | - $smr_db_sql[] = 'DELETE FROM sector_has_forces WHERE game_id = '.$game_id; |
|
| 269 | - $smr_db_sql[] = 'DELETE FROM ship_has_cargo WHERE game_id = '.$game_id; |
|
| 270 | - $smr_db_sql[] = 'DELETE FROM ship_has_hardware WHERE game_id = '.$game_id; |
|
| 271 | - $smr_db_sql[] = 'DELETE FROM ship_has_name WHERE game_id = '.$game_id; |
|
| 272 | - $smr_db_sql[] = 'DELETE FROM ship_has_illusion WHERE game_id = '.$game_id; |
|
| 273 | - $smr_db_sql[] = 'DELETE FROM ship_has_weapon WHERE game_id = '.$game_id; |
|
| 274 | - $smr_db_sql[] = 'DELETE FROM ship_is_cloaked WHERE game_id = '.$game_id; |
|
| 275 | - $smr_db_sql[] = 'UPDATE game SET end_time='.TIME.' WHERE game_id = '.$game_id.' AND end_time > '.TIME; // Do not delete game placeholder, just make sure game is finished |
|
| 276 | - $smr_db_sql[] = 'UPDATE active_session SET game_id = 0 WHERE game_id = '.$game_id; |
|
| 267 | + $smr_db_sql[] = 'DELETE FROM sector WHERE game_id = ' . $game_id; |
|
| 268 | + $smr_db_sql[] = 'DELETE FROM sector_has_forces WHERE game_id = ' . $game_id; |
|
| 269 | + $smr_db_sql[] = 'DELETE FROM ship_has_cargo WHERE game_id = ' . $game_id; |
|
| 270 | + $smr_db_sql[] = 'DELETE FROM ship_has_hardware WHERE game_id = ' . $game_id; |
|
| 271 | + $smr_db_sql[] = 'DELETE FROM ship_has_name WHERE game_id = ' . $game_id; |
|
| 272 | + $smr_db_sql[] = 'DELETE FROM ship_has_illusion WHERE game_id = ' . $game_id; |
|
| 273 | + $smr_db_sql[] = 'DELETE FROM ship_has_weapon WHERE game_id = ' . $game_id; |
|
| 274 | + $smr_db_sql[] = 'DELETE FROM ship_is_cloaked WHERE game_id = ' . $game_id; |
|
| 275 | + $smr_db_sql[] = 'UPDATE game SET end_time=' . TIME . ' WHERE game_id = ' . $game_id . ' AND end_time > ' . TIME; // Do not delete game placeholder, just make sure game is finished |
|
| 276 | + $smr_db_sql[] = 'UPDATE active_session SET game_id = 0 WHERE game_id = ' . $game_id; |
|
| 277 | 277 | |
| 278 | 278 | // now do the sql stuff |
| 279 | - foreach($smr_db_sql as $sql) { |
|
| 279 | + foreach ($smr_db_sql as $sql) { |
|
| 280 | 280 | |
| 281 | 281 | $db->query($sql); |
| 282 | 282 | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $db = new SmrHistoryMySqlDatabase(); |
| 286 | - foreach($history_db_sql as $sql) { |
|
| 286 | + foreach ($history_db_sql as $sql) { |
|
| 287 | 287 | |
| 288 | 288 | $db->query($sql); |
| 289 | 289 | |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | $action = $_REQUEST['action']; |
| 12 | 12 | if ($_REQUEST['save'] == 'Yes') { |
| 13 | 13 | $save = true; |
| 14 | -} |
|
| 15 | -else { |
|
| 14 | +} else { |
|
| 16 | 15 | $save = false; |
| 17 | 16 | } |
| 18 | 17 | |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | $mines = $db2->getInt('sum_m'); |
| 43 | 42 | $cds = $db2->getInt('cds'); |
| 44 | 43 | $sds = $db2->getInt('sds'); |
| 45 | - } |
|
| 46 | - else { |
|
| 44 | + } else { |
|
| 47 | 45 | $mines = 0; |
| 48 | 46 | $cds = 0; |
| 49 | 47 | $sds = 0; |
@@ -143,16 +141,25 @@ discard block |
||
| 143 | 141 | $owner = $db->getInt('owner_id'); |
| 144 | 142 | |
| 145 | 143 | $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 1'); |
| 146 | - if ($db2->nextRecord()) $gens = $db2->getInt('amount'); |
|
| 147 | - else $gens = 0; |
|
| 144 | + if ($db2->nextRecord()) { |
|
| 145 | + $gens = $db2->getInt('amount'); |
|
| 146 | + } else { |
|
| 147 | + $gens = 0; |
|
| 148 | + } |
|
| 148 | 149 | |
| 149 | 150 | $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 2'); |
| 150 | - if ($db2->nextRecord()) $hangs = $db2->getInt('amount'); |
|
| 151 | - else $hangs = 0; |
|
| 151 | + if ($db2->nextRecord()) { |
|
| 152 | + $hangs = $db2->getInt('amount'); |
|
| 153 | + } else { |
|
| 154 | + $hangs = 0; |
|
| 155 | + } |
|
| 152 | 156 | |
| 153 | 157 | $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 3'); |
| 154 | - if ($db2->nextRecord()) $turs = $db2->getInt('amount'); |
|
| 155 | - else $turs = 0; |
|
| 158 | + if ($db2->nextRecord()) { |
|
| 159 | + $turs = $db2->getInt('amount'); |
|
| 160 | + } else { |
|
| 161 | + $turs = 0; |
|
| 162 | + } |
|
| 156 | 163 | |
| 157 | 164 | // insert into history db |
| 158 | 165 | $history_db_sql[] = 'INSERT INTO planet (game_id, sector_id, owner_id, generators, hangers, turrets) VALUES ' . |
@@ -189,14 +196,21 @@ discard block |
||
| 189 | 196 | $smrCredits = 0; |
| 190 | 197 | $db2->query('SELECT sum(amount) as bounty_am, sum(smr_credits) as bounty_cred FROM bounty WHERE game_id = '.$game_id.' AND account_id = '.$acc_id.' AND claimer_id = 0'); |
| 191 | 198 | if ($db2->nextRecord()) { |
| 192 | - if (is_int($db2->getField('bounty_am'))) $amount = $db2->getInt('bounty_am'); |
|
| 193 | - if (is_int($db2->getField('bounty_cred'))) $smrCredits = $db2->getInt('bounty_cred'); |
|
| 199 | + if (is_int($db2->getField('bounty_am'))) { |
|
| 200 | + $amount = $db2->getInt('bounty_am'); |
|
| 201 | + } |
|
| 202 | + if (is_int($db2->getField('bounty_cred'))) { |
|
| 203 | + $smrCredits = $db2->getInt('bounty_cred'); |
|
| 204 | + } |
|
| 194 | 205 | |
| 195 | 206 | } |
| 196 | 207 | |
| 197 | 208 | $db2->query('SELECT * FROM ship_has_name WHERE game_id = '.$game_id.' AND account_id = '.$acc_id); |
| 198 | - if ($db2->nextRecord()) $ship_name = $db2->getField('ship_name'); |
|
| 199 | - else $ship_name = 'None'; |
|
| 209 | + if ($db2->nextRecord()) { |
|
| 210 | + $ship_name = $db2->getField('ship_name'); |
|
| 211 | + } else { |
|
| 212 | + $ship_name = 'None'; |
|
| 213 | + } |
|
| 200 | 214 | |
| 201 | 215 | // insert into history db |
| 202 | 216 | $history_db_sql[] = 'INSERT INTO player (account_id, game_id, player_name, player_id, experience, ship, race, alignment, alliance_id, kills, deaths, bounty, bounty_cred, ship_name) ' . |
@@ -244,9 +258,15 @@ discard block |
||
| 244 | 258 | $mines = $db2->getInt('sum_mines'); |
| 245 | 259 | $cds = $db2->getInt('cds'); |
| 246 | 260 | $sds = $db2->getInt('sds'); |
| 247 | - if (!is_numeric($mines)) $mines = 0; |
|
| 248 | - if (!is_numeric($cds)) $cds = 0; |
|
| 249 | - if (!is_numeric($sds)) $sds = 0; |
|
| 261 | + if (!is_numeric($mines)) { |
|
| 262 | + $mines = 0; |
|
| 263 | + } |
|
| 264 | + if (!is_numeric($cds)) { |
|
| 265 | + $cds = 0; |
|
| 266 | + } |
|
| 267 | + if (!is_numeric($sds)) { |
|
| 268 | + $sds = 0; |
|
| 269 | + } |
|
| 250 | 270 | |
| 251 | 271 | } else { |
| 252 | 272 | |