Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Branch master (287493)
by Dan
06:08
created
engine/Default/preferences_confirm.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(isset($_REQUEST['amount']))
3
-	SmrSession::updateVar('amount',$_REQUEST['amount']);
4
-if(isset($_REQUEST['account_id']))
5
-	SmrSession::updateVar('account_id',$_REQUEST['account_id']);
2
+if (isset($_REQUEST['amount']))
3
+	SmrSession::updateVar('amount', $_REQUEST['amount']);
4
+if (isset($_REQUEST['account_id']))
5
+	SmrSession::updateVar('account_id', $_REQUEST['account_id']);
6 6
 $amount = $var['amount'];
7 7
 $account_id = $var['account_id'];
8 8
 if (!is_numeric($amount))
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
 if ($amount > $account->getSmrCredits())
17 17
 	create_error('You can\'t transfer more than you have!');
18 18
 
19
-$template->assign('PageTopic','Confirmation');
19
+$template->assign('PageTopic', 'Confirmation');
20 20
 
21
-$PHP_OUTPUT.=('Are you sure you want to transfer '.$amount.' credits to<br />');
21
+$PHP_OUTPUT .= ('Are you sure you want to transfer ' . $amount . ' credits to<br />');
22 22
 
23
-$PHP_OUTPUT.=('Player with HoF name '.SmrAccount::getAccount($account_id)->getHofName().'?<br />');
23
+$PHP_OUTPUT .= ('Player with HoF name ' . SmrAccount::getAccount($account_id)->getHofName() . '?<br />');
24 24
 
25
-$PHP_OUTPUT.=('<br/><h3>Please make sure this is definitely the correct person before confirming.</h3>');
26
-$PHP_OUTPUT.=('<p>&nbsp;</p>');
25
+$PHP_OUTPUT .= ('<br/><h3>Please make sure this is definitely the correct person before confirming.</h3>');
26
+$PHP_OUTPUT .= ('<p>&nbsp;</p>');
27 27
 
28 28
 $container = array();
29 29
 $container['url'] = 'preferences_processing.php';
30 30
 $container['account_id'] = $account_id;
31 31
 $container['amount'] = $amount;
32
-$PHP_OUTPUT.=create_echo_form($container);
32
+$PHP_OUTPUT .= create_echo_form($container);
33 33
 
34
-$PHP_OUTPUT.=create_submit('Yes');
35
-$PHP_OUTPUT.=('&nbsp;&nbsp;');
36
-$PHP_OUTPUT.=create_submit('No');
37
-$PHP_OUTPUT.=('</form>');
34
+$PHP_OUTPUT .= create_submit('Yes');
35
+$PHP_OUTPUT .= ('&nbsp;&nbsp;');
36
+$PHP_OUTPUT .= create_submit('No');
37
+$PHP_OUTPUT .= ('</form>');
Please login to merge, or discard this patch.
engine/Default/beta_func_processing.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 }
43 43
 elseif ($var['func'] == 'Warp') {
44 44
 	$sector_to = trim($_REQUEST['sector_to']);
45
-	if(!is_numeric($sector_to)) {
45
+	if (!is_numeric($sector_to)) {
46 46
 		create_error('Sector ID has to be a number.');
47 47
 	}
48 48
 	if (!SmrSector::sectorExists($player->getGameID(), $sector_to)) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	$player->setExperience($exp);
60 60
 }
61 61
 elseif ($var['func'] == 'Align') {
62
-	$align=max(-500, min(500, (int)$_REQUEST['align']));
62
+	$align = max(-500, min(500, (int)$_REQUEST['align']));
63 63
 	$player->setAlignment($align);
64 64
 }
65 65
 elseif ($var['func'] == 'RemWeapon') {
@@ -74,22 +74,22 @@  discard block
 block discarded – undo
74 74
 elseif ($var['func'] == 'Relations') {
75 75
 	$amount = (int)$_REQUEST['amount'];
76 76
 	$race = (int)$_REQUEST['race'];
77
-	$player->setRelations($amount,$race);
77
+	$player->setRelations($amount, $race);
78 78
 }
79 79
 elseif ($var['func'] == 'Race_Relations') {
80 80
 	$amount = $_REQUEST['amount'];
81 81
 	$race = $_REQUEST['race'];
82
-	if(!is_numeric($amount) || !is_numeric($race)) {
82
+	if (!is_numeric($amount) || !is_numeric($race)) {
83 83
 		create_error('Amount and Race IDs have to be numbers.');
84 84
 	}
85
-	if($player->getRaceID()==$race) {
85
+	if ($player->getRaceID() == $race) {
86 86
 		create_error('You cannot change race relations with your own race.');
87 87
 	}
88 88
 	$db->query('UPDATE race_has_relation SET relation = ' . $db->escapeNumber($amount) . ' WHERE race_id_1 = ' . $db->escapeNumber($player->getRaceID()) . ' AND race_id_2 = ' . $db->escapeNumber($race) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
89 89
 	$db->query('UPDATE race_has_relation SET relation = ' . $db->escapeNumber($amount) . ' WHERE race_id_1 = ' . $db->escapeNumber($race) . ' AND race_id_2 = ' . $db->escapeNumber($player->getRaceID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
90 90
 } elseif ($var['func'] == 'Race') {
91 91
 	$race = $_REQUEST['race'];
92
-	if(!is_numeric($race)) {
92
+	if (!is_numeric($race)) {
93 93
 		create_error('Amount and Race IDs have to be numbers.');
94 94
 	}
95 95
 	$player->setRaceID($race);
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 
119 119
 function doUNO($ship) {
120 120
 	$maxHardware = $ship->getMaxHardware();
121
-	foreach($maxHardware as $key => $max) {
122
-		$ship->setHardware($key,$max);
121
+	foreach ($maxHardware as $key => $max) {
122
+		$ship->setHardware($key, $max);
123 123
 	}
124 124
 	$ship->removeUnderAttack();
125 125
 }
Please login to merge, or discard this patch.
engine/Default/current_sector.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // If on a planet, forward to planet_main.php
4
-if($player->isLandedOnPlanet()) {
4
+if ($player->isLandedOnPlanet()) {
5 5
 	forward(create_container('skeleton.php', 'planet_main.php', $var));
6 6
 }
7 7
 
8
-$template->assign('SpaceView',true);
8
+$template->assign('SpaceView', true);
9 9
 
10
-$template->assign('PageTopic','Current Sector: ' . $player->getSectorID() . ' (' .$sector->getGalaxyName() . ')');
10
+$template->assign('PageTopic', 'Current Sector: ' . $player->getSectorID() . ' (' . $sector->getGalaxyName() . ')');
11 11
 
12 12
 Menu::navigation($template, $player);
13 13
 
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
 
29 29
 $unvisited = array();
30 30
 
31
-$db->query('SELECT sector_id FROM player_visited_sector WHERE sector_id IN (' . $db->escapeString($links,false) . ') AND account_id=' . $db->escapeNumber($player->getAccountID()) . ' AND game_id=' . $db->escapeNumber($player->getGameID()));
32
-while($db->nextRecord()) {
31
+$db->query('SELECT sector_id FROM player_visited_sector WHERE sector_id IN (' . $db->escapeString($links, false) . ') AND account_id=' . $db->escapeNumber($player->getAccountID()) . ' AND game_id=' . $db->escapeNumber($player->getGameID()));
32
+while ($db->nextRecord()) {
33 33
 	$unvisited[$db->getField('sector_id')] = TRUE;
34 34
 }
35 35
 
36
-foreach($links as $key => $linkArray) {
37
-	if($linkArray['ID']>0 && $linkArray['ID']!=$player->getSectorID()) {
36
+foreach ($links as $key => $linkArray) {
37
+	if ($linkArray['ID'] > 0 && $linkArray['ID'] != $player->getSectorID()) {
38 38
 		if ($player->getLastSectorID() == $linkArray['ID']) $class = 'lastVisited';
39
-		else if(isset($unvisited[$linkArray['ID']])) $class = 'unvisited';
39
+		else if (isset($unvisited[$linkArray['ID']])) $class = 'unvisited';
40 40
 		else $class = 'visited';
41
-		$links[$key]['Class']=$class;
41
+		$links[$key]['Class'] = $class;
42 42
 	}
43 43
 }
44 44
 
45
-$template->assign('Sectors',$links);
45
+$template->assign('Sectors', $links);
46 46
 
47 47
 doTickerAssigns($template, $player, $db);
48 48
 
49
-if(!isset($var['UnreadMissions'])) {
49
+if (!isset($var['UnreadMissions'])) {
50 50
 	$unreadMissions = $player->markMissionsRead();
51 51
 	SmrSession::updateVar('UnreadMissions', $unreadMissions);
52 52
 }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 if ($game->getStartTurnsDate() > TIME) {
63 63
 	$turnsMessage = 'Turns will be given when the game starts in ' . format_time($game->getStartTurnsDate() - TIME) . '!';
64 64
 } else {
65
-	switch($player->getTurnsLevel()) {
65
+	switch ($player->getTurnsLevel()) {
66 66
 		case 'NONE':
67 67
 			$turnsMessage = '<span class="red">WARNING</span>: You have run out of turns!';
68 68
 		break;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		break;
75 75
 	}
76 76
 }
77
-$template->assign('TurnsMessage',$turnsMessage);
77
+$template->assign('TurnsMessage', $turnsMessage);
78 78
 
79 79
 $protectionMessage = '';
80 80
 if ($player->getNewbieTurns()) {
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 elseif ($player->hasFederalProtection()) {
88 88
 	$protectionMessage = '<span class="blue">PROTECTION</span>: You are under <span class="blue">FEDERAL</span> protection.';
89 89
 }
90
-elseif($sector->offersFederalProtection())
90
+elseif ($sector->offersFederalProtection())
91 91
 	$protectionMessage = '<span class="blue">PROTECTION</span>: You are <span class="red">NOT</span> under protection.';
92 92
 
93
-if(!empty($protectionMessage))
94
-	$template->assign('ProtectionMessage',$protectionMessage);
93
+if (!empty($protectionMessage))
94
+	$template->assign('ProtectionMessage', $protectionMessage);
95 95
 
96 96
 //enableProtectionDependantRefresh($template,$player);
97 97
 
@@ -133,43 +133,43 @@  discard block
 block discarded – undo
133 133
 // *
134 134
 // *******************************************
135 135
 
136
-if($sector->hasPort()) {
136
+if ($sector->hasPort()) {
137 137
 	$port = $sector->getPort();
138
-	$template->assign('PortIsAtWar',$player->getRelation($port->getRaceID()) < RELATIONS_WAR);
138
+	$template->assign('PortIsAtWar', $player->getRelation($port->getRaceID()) < RELATIONS_WAR);
139 139
 }
140 140
 
141 141
 function checkForForceRefreshMessage(&$msg) {
142
-	global $db,$player,$template;
142
+	global $db, $player, $template;
143 143
 	$contains = 0;
144
-	$msg = str_replace('[Force Check]','',$msg,$contains);
145
-	if($contains>0) {
146
-		if(!$template->hasTemplateVar('ForceRefreshMessage')) {
147
-			$forceRefreshMessage ='';
144
+	$msg = str_replace('[Force Check]', '', $msg, $contains);
145
+	if ($contains > 0) {
146
+		if (!$template->hasTemplateVar('ForceRefreshMessage')) {
147
+			$forceRefreshMessage = '';
148 148
 			$db->query('SELECT refresh_at FROM sector_has_forces WHERE refresh_at >= ' . $db->escapeNumber(TIME) . ' AND sector_id = ' . $db->escapeNumber($player->getSectorID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND refresher = ' . $db->escapeNumber($player->getAccountID()) . ' ORDER BY refresh_at DESC LIMIT 1');
149 149
 			if ($db->nextRecord()) {
150 150
 				$remainingTime = $db->getField('refresh_at') - TIME;
151
-				$forceRefreshMessage = '<span class="green">REFRESH</span>: All forces will be refreshed in '.$remainingTime.' seconds.';
151
+				$forceRefreshMessage = '<span class="green">REFRESH</span>: All forces will be refreshed in ' . $remainingTime . ' seconds.';
152 152
 				$db->query('REPLACE INTO sector_message (game_id, account_id, message) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getAccountID()) . ', \'[Force Check]\')');
153 153
 			}
154 154
 			else $forceRefreshMessage = '<span class="green">REFRESH</span>: All forces have finished refreshing.';
155
-			$template->assign('ForceRefreshMessage',$forceRefreshMessage);
155
+			$template->assign('ForceRefreshMessage', $forceRefreshMessage);
156 156
 		}
157 157
 	}
158 158
 }
159 159
 
160 160
 function checkForAttackMessage(&$msg) {
161
-	global $db,$player,$template;
161
+	global $db, $player, $template;
162 162
 	$contains = 0;
163
-	$msg = str_replace('[ATTACK_RESULTS]','',$msg,$contains);
164
-	if($contains>0) {
165
-		SmrSession::updateVar('AttackMessage','[ATTACK_RESULTS]'.$msg);
166
-		if(!$template->hasTemplateVar('AttackResults')) {
163
+	$msg = str_replace('[ATTACK_RESULTS]', '', $msg, $contains);
164
+	if ($contains > 0) {
165
+		SmrSession::updateVar('AttackMessage', '[ATTACK_RESULTS]' . $msg);
166
+		if (!$template->hasTemplateVar('AttackResults')) {
167 167
 			$db->query('SELECT sector_id,result,type FROM combat_logs WHERE log_id=' . $db->escapeNumber($msg) . ' LIMIT 1');
168
-			if($db->nextRecord()) {
169
-				if($player->getSectorID()==$db->getField('sector_id')) {
168
+			if ($db->nextRecord()) {
169
+				if ($player->getSectorID() == $db->getField('sector_id')) {
170 170
 					$results = unserialize(gzuncompress($db->getField('result')));
171
-					$template->assign('AttackResultsType',$db->getField('type'));
172
-					$template->assign('AttackResults',$results);
171
+					$template->assign('AttackResultsType', $db->getField('type'));
172
+					$template->assign('AttackResults', $results);
173 173
 				}
174 174
 			}
175 175
 		}
Please login to merge, or discard this patch.
engine/Default/council_embassy_processing.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!$player->isPresident()) {
3
+if (!$player->isPresident()) {
4 4
 	create_error('Only the president can view the embassy.');
5 5
 }
6 6
 
7 7
 $race_id = $var['race_id'];
8 8
 $type = strtoupper($_REQUEST['action']);
9
-$time = TIME + TIME_FOR_COUNCIL_VOTE;// / Globals::getGameSpeed($player->getGameID());
9
+$time = TIME + TIME_FOR_COUNCIL_VOTE; // / Globals::getGameSpeed($player->getGameID());
10 10
 
11 11
 $db->query('SELECT count(*) FROM race_has_voting
12 12
 			WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 
18 18
 if ($type == 'PEACE') {
19 19
 	$db->query('SELECT 1 FROM race_has_voting
20
-				WHERE race_id_1='.$db->escapeNumber($race_id).' AND race_id_2='.$db->escapeNumber($player->getRaceID()).' AND game_id = '.$db->escapeNumber($player->getGameID()));
21
-	if($db->nextRecord()) {
20
+				WHERE race_id_1='.$db->escapeNumber($race_id) . ' AND race_id_2=' . $db->escapeNumber($player->getRaceID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
21
+	if ($db->nextRecord()) {
22 22
 		create_error('You cannot start a vote with that race.');
23 23
 	}
24 24
 }
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 // Create the vote for the player's race
27 27
 $db->query('REPLACE INTO race_has_voting
28 28
 			(game_id, race_id_1, race_id_2, type, end_time)
29
-			VALUES(' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getRaceID()) . ', '.$db->escapeNumber($race_id).', '.$db->escapeString($type).', '.$db->escapeNumber($time).')');
29
+			VALUES(' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getRaceID()) . ', ' . $db->escapeNumber($race_id) . ', ' . $db->escapeString($type) . ', ' . $db->escapeNumber($time) . ')');
30 30
 
31 31
 // If voting for peace, the other race also has to vote
32 32
 if ($type == 'PEACE') {
33 33
 	$db->query('REPLACE INTO race_has_voting
34 34
 				(game_id, race_id_1, race_id_2, type, end_time)
35
-				VALUES(' . $db->escapeNumber($player->getGameID()) . ', '.$race_id.', ' . $db->escapeNumber($player->getRaceID()) . ', '.$db->escapeString($type).', '.$time.')');
35
+				VALUES(' . $db->escapeNumber($player->getGameID()) . ', ' . $race_id . ', ' . $db->escapeNumber($player->getRaceID()) . ', ' . $db->escapeString($type) . ', ' . $time . ')');
36 36
 }
37 37
 
38 38
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
            . "! You have " . format_time(TIME_FOR_COUNCIL_VOTE)
55 55
            . " to cast your vote.";
56 56
 
57
-foreach($councilMembers as $accountID) {
57
+foreach ($councilMembers as $accountID) {
58 58
 	// don't send to the player who started the vote
59 59
 	if ($player->getAccountID() != $accountID) {
60 60
 		SmrPlayer::sendMessageFromRace($player->getRaceID(), $player->getGameID(),
Please login to merge, or discard this patch.
engine/Default/validate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if(isset($var['msg']))
2
+if (isset($var['msg']))
3 3
 	$template->assign('Message', $var['msg']);
4 4
 
5 5
 $template->assign('PageTopic', 'Validation Reminder');
Please login to merge, or discard this patch.
engine/Default/galactic_post_read.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 		$template->assign('BackHREF', SmrSession::getNewHREF($container));
15 15
 	}
16 16
 
17
-	$db->query('SELECT * FROM galactic_post_paper WHERE game_id = ' . $db->escapeNumber($var['game_id']) . ' AND paper_id = '.$var['paper_id']);
17
+	$db->query('SELECT * FROM galactic_post_paper WHERE game_id = ' . $db->escapeNumber($var['game_id']) . ' AND paper_id = ' . $var['paper_id']);
18 18
 	$db->nextRecord();
19 19
 	$paper_name = bbifyMessage($db->getField('title'));
20
-	$template->assign('PageTopic','Reading <i>Galactic Post</i> Edition : '.$paper_name);
20
+	$template->assign('PageTopic', 'Reading <i>Galactic Post</i> Edition : ' . $paper_name);
21 21
 
22 22
 	//now get the articles in this paper.
23
-	$db->query('SELECT * FROM galactic_post_paper_content JOIN galactic_post_article USING(game_id, article_id) WHERE paper_id = '.$db->escapeNumber($var['paper_id']).' AND game_id = '.$db->escapeNumber($var['game_id']));
23
+	$db->query('SELECT * FROM galactic_post_paper_content JOIN galactic_post_article USING(game_id, article_id) WHERE paper_id = ' . $db->escapeNumber($var['paper_id']) . ' AND game_id = ' . $db->escapeNumber($var['game_id']));
24 24
 
25 25
 	$articles = [];
26 26
 	while ($db->nextRecord()) {
@@ -44,5 +44,5 @@  discard block
 block discarded – undo
44 44
 	$template->assign('ArticleLayout', $articleLayout);
45 45
 }
46 46
 else {
47
-	$template->assign('PageTopic','Galactic Post');
47
+	$template->assign('PageTopic', 'Galactic Post');
48 48
 }
Please login to merge, or discard this patch.
engine/Default/forces_drop.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@
 block discarded – undo
2 2
 
3 3
 if (isset($var['owner_id'])) {
4 4
 	$owner = SmrPlayer::getPlayer($var['owner_id'], $player->getGameID());
5
-	$template->assign('PageTopic','Change '.$owner->getPlayerName().'\'s Forces');
5
+	$template->assign('PageTopic', 'Change ' . $owner->getPlayerName() . '\'s Forces');
6 6
 	$owner_id = $var['owner_id'];
7 7
 }
8 8
 else {
9
-	$template->assign('PageTopic','Drop Forces');
9
+	$template->assign('PageTopic', 'Drop Forces');
10 10
 	$owner_id = $player->getAccountID();
11 11
 }
12 12
 
13 13
 $forces = SmrForce::getForce($player->getGameID(), $player->getSectorID(), $owner_id);
14 14
 
15 15
 $container = array();
16
-$container['url']		= 'forces_drop_processing.php';
17
-$container['owner_id']	= $owner_id;
16
+$container['url'] = 'forces_drop_processing.php';
17
+$container['owner_id'] = $owner_id;
18 18
 
19 19
 $template->assign('Forces', $forces);
20 20
 $template->assign('SubmitHREF', SmrSession::getNewHREF($container));
Please login to merge, or discard this patch.
engine/Default/combat_simulator.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,91 +1,91 @@
 block discarded – undo
1 1
 <?php
2
-$template->assign('PageTopic','Combat Simulator');
2
+$template->assign('PageTopic', 'Combat Simulator');
3 3
 
4
-$template->assign('EditDummysLink',SmrSession::getNewHREF(create_container('skeleton.php','edit_dummys.php')));
4
+$template->assign('EditDummysLink', SmrSession::getNewHREF(create_container('skeleton.php', 'edit_dummys.php')));
5 5
 $template->assign('DummyNames', DummyPlayer::getDummyPlayerNames());
6 6
 
7 7
 $duplicates = false;
8 8
 $usedNames = array();
9 9
 $realAttackers = array();
10 10
 $attackers = array();
11
-$i=1;
12
-if(isset($_POST['attackers']))
13
-	foreach($_POST['attackers'] as $attackerName) {
14
-		if($attackerName=='none')
11
+$i = 1;
12
+if (isset($_POST['attackers']))
13
+	foreach ($_POST['attackers'] as $attackerName) {
14
+		if ($attackerName == 'none')
15 15
 			continue;
16
-		if(isset($usedNames[$attackerName])) {
16
+		if (isset($usedNames[$attackerName])) {
17 17
 			$duplicates = true;
18 18
 			continue;
19 19
 		}
20 20
 		$usedNames[$attackerName] = true;
21
-		$attackers[$i] =& DummyPlayer::getCachedDummyPlayer($attackerName);
21
+		$attackers[$i] = & DummyPlayer::getCachedDummyPlayer($attackerName);
22 22
 		$attackers[$i]->setAllianceID(1);
23
-		$realAttackers[$i] =& $attackers[$i];
23
+		$realAttackers[$i] = & $attackers[$i];
24 24
 		++$i;
25 25
 	}
26 26
 
27
-for(;$i<=10;++$i)
27
+for (;$i <= 10; ++$i)
28 28
 	$attackers[$i] = null;
29
-$template->assign('Attackers',$attackers);
29
+$template->assign('Attackers', $attackers);
30 30
 
31
-$i=1;
31
+$i = 1;
32 32
 $realDefenders = array();
33 33
 $defenders = array();
34
-if(isset($_POST['defenders']))
35
-	foreach($_POST['defenders'] as $defenderName) {
36
-		if($defenderName=='none')
34
+if (isset($_POST['defenders']))
35
+	foreach ($_POST['defenders'] as $defenderName) {
36
+		if ($defenderName == 'none')
37 37
 			continue;
38
-		if(isset($usedNames[$defenderName])) {
38
+		if (isset($usedNames[$defenderName])) {
39 39
 			$duplicates = true;
40 40
 			continue;
41 41
 		}
42 42
 		$usedNames[$attackerName] = true;
43
-		$defenders[$i] =& DummyPlayer::getCachedDummyPlayer($defenderName);
43
+		$defenders[$i] = & DummyPlayer::getCachedDummyPlayer($defenderName);
44 44
 		$defenders[$i]->setAllianceID(2);
45
-		$realDefenders[$i] =& $defenders[$i];
45
+		$realDefenders[$i] = & $defenders[$i];
46 46
 		++$i;
47 47
 	}
48 48
 	
49
-for(;$i<=10;++$i)
49
+for (;$i <= 10; ++$i)
50 50
 	$defenders[$i] = null;
51
-$template->assign('Defenders',$defenders);
51
+$template->assign('Defenders', $defenders);
52 52
 
53
-$template->assign('Duplicates',$duplicates);
53
+$template->assign('Duplicates', $duplicates);
54 54
 
55
-$template->assign('CombatSimHREF',SmrSession::getNewHREF(create_container('skeleton.php','combat_simulator.php')));
55
+$template->assign('CombatSimHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'combat_simulator.php')));
56 56
 
57
-if(is_array($realAttackers) && is_array($realDefenders) && count($realAttackers)>0 && count($realDefenders)>0) {
58
-	if(isset($_REQUEST['run'])) {
59
-		runAnAttack($realAttackers,$realDefenders);
57
+if (is_array($realAttackers) && is_array($realDefenders) && count($realAttackers) > 0 && count($realDefenders) > 0) {
58
+	if (isset($_REQUEST['run'])) {
59
+		runAnAttack($realAttackers, $realDefenders);
60 60
 	}
61
-	if(isset($_REQUEST['death_run'])) {
62
-		while(count($realAttackers)>0 && count($realDefenders)>0) {
63
-			runAnAttack($realAttackers,$realDefenders);
64
-			foreach($realAttackers as $key => &$teamPlayer) {
65
-				if($teamPlayer->isDead())
61
+	if (isset($_REQUEST['death_run'])) {
62
+		while (count($realAttackers) > 0 && count($realDefenders) > 0) {
63
+			runAnAttack($realAttackers, $realDefenders);
64
+			foreach ($realAttackers as $key => &$teamPlayer) {
65
+				if ($teamPlayer->isDead())
66 66
 					unset($realAttackers[$key]);
67 67
 			} unset($teamPlayer);
68
-			foreach($realDefenders as $key => &$teamPlayer) {
69
-				if($teamPlayer->isDead())
68
+			foreach ($realDefenders as $key => &$teamPlayer) {
69
+				if ($teamPlayer->isDead())
70 70
 					unset($realDefenders[$key]);
71 71
 			} unset($teamPlayer);
72 72
 		}
73 73
 	}
74 74
 }
75 75
 
76
-function runAnAttack($realAttackers,$realDefenders) {
76
+function runAnAttack($realAttackers, $realDefenders) {
77 77
 	global $template;
78 78
 	$results = array('Attackers' => array('Traders' => array(), 'TotalDamage' => 0), 
79 79
 					'Defenders' => array('Traders' => array(), 'TotalDamage' => 0));
80
-	foreach($realAttackers as $accountID => &$teamPlayer) {
81
-		$playerResults =& $teamPlayer->shootPlayers($realDefenders);
82
-		$results['Attackers']['Traders'][] =& $playerResults;
80
+	foreach ($realAttackers as $accountID => &$teamPlayer) {
81
+		$playerResults = & $teamPlayer->shootPlayers($realDefenders);
82
+		$results['Attackers']['Traders'][] = & $playerResults;
83 83
 		$results['Attackers']['TotalDamage'] += $playerResults['TotalDamage'];
84 84
 	} unset($teamPlayer);
85
-	foreach($realDefenders as $accountID => &$teamPlayer) {
86
-		$playerResults =& $teamPlayer->shootPlayers($realAttackers);
87
-		$results['Defenders']['Traders'][]  =& $playerResults;
85
+	foreach ($realDefenders as $accountID => &$teamPlayer) {
86
+		$playerResults = & $teamPlayer->shootPlayers($realAttackers);
87
+		$results['Defenders']['Traders'][] = & $playerResults;
88 88
 		$results['Defenders']['TotalDamage'] += $playerResults['TotalDamage'];
89 89
 	} unset($teamPlayer);
90
-	$template->assign('TraderCombatResults',$results);
90
+	$template->assign('TraderCombatResults', $results);
91 91
 }
Please login to merge, or discard this patch.
engine/Default/alliance_message_view.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (!isset($var['alliance_id'])) {
3
-	SmrSession::updateVar('alliance_id',$player->getAllianceID());
3
+	SmrSession::updateVar('alliance_id', $player->getAllianceID());
4 4
 }
5 5
 
6 6
 $alliance = SmrAlliance::getAlliance($var['alliance_id'], $player->getGameID());
7 7
 $thread_index = $var['thread_index'];
8 8
 $thread_id = $var['thread_ids'][$thread_index];
9 9
 
10
-if(empty($thread_id)) {
10
+if (empty($thread_id)) {
11 11
 	create_error('Unable to find thread id.');
12 12
 }
13 13
 
14
-$template->assign('PageTopic',$var['thread_topics'][$thread_index]);
14
+$template->assign('PageTopic', $var['thread_topics'][$thread_index]);
15 15
 Menu::alliance($alliance->getAllianceID(), $alliance->getLeaderID());
16 16
 
17 17
 $db->query('REPLACE INTO player_read_thread
18 18
 			(account_id, game_id, alliance_id, thread_id, time)
19
-			VALUES(' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($alliance->getAllianceID()) . ', ' . $db->escapeNumber($thread_id) . ', ' . $db->escapeNumber(TIME+2) . ')');
19
+			VALUES(' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($alliance->getAllianceID()) . ', ' . $db->escapeNumber($thread_id) . ', ' . $db->escapeNumber(TIME + 2) . ')');
20 20
 
21 21
 $mbWrite = true;
22 22
 if ($alliance->getAllianceID() != $player->getAllianceID()) {
23 23
 	$db->query('SELECT mb_read FROM alliance_treaties
24
-					WHERE (alliance_id_1 = ' . $db->escapeNumber($alliance->getAllianceID()) . ' OR alliance_id_1 = ' . $db->escapeNumber($player->getAllianceID()) . ')'.
25
-					' AND (alliance_id_2 = ' . $db->escapeNumber($alliance->getAllianceID()) . ' OR alliance_id_2 = ' . $db->escapeNumber($player->getAllianceID()) . ')'.
24
+					WHERE (alliance_id_1 = ' . $db->escapeNumber($alliance->getAllianceID()) . ' OR alliance_id_1 = ' . $db->escapeNumber($player->getAllianceID()) . ')' .
25
+					' AND (alliance_id_2 = ' . $db->escapeNumber($alliance->getAllianceID()) . ' OR alliance_id_2 = ' . $db->escapeNumber($player->getAllianceID()) . ')' .
26 26
 					' AND game_id = ' . $db->escapeNumber($player->getGameID()) .
27 27
 					' AND mb_write = 1 AND official = \'TRUE\'');
28 28
 	$mbWrite = $db->nextRecord();
29 29
 }
30 30
 
31
-$container = create_container('skeleton.php','alliance_message_view.php',$var);
31
+$container = create_container('skeleton.php', 'alliance_message_view.php', $var);
32 32
 
33 33
 if (isset($var['thread_ids'][$thread_index - 1])) {
34 34
 	$container['thread_index'] = $thread_index - 1;
35
-	$template->assign('PrevThread',array('Topic' => $var['thread_topics'][$thread_index - 1], 'Href' => SmrSession::getNewHREF($container)));
35
+	$template->assign('PrevThread', array('Topic' => $var['thread_topics'][$thread_index - 1], 'Href' => SmrSession::getNewHREF($container)));
36 36
 }
37 37
 if (isset($var['thread_ids'][$thread_index + 1])) {
38 38
 	$container['thread_index'] = $thread_index + 1;
39
-	$template->assign('NextThread',array('Topic' => $var['thread_topics'][$thread_index + 1], 'Href' => SmrSession::getNewHREF($container)));
39
+	$template->assign('NextThread', array('Topic' => $var['thread_topics'][$thread_index + 1], 'Href' => SmrSession::getNewHREF($container)));
40 40
 }
41 41
 
42 42
 $thread = array();
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 
69 69
 $thread['CanDelete'] = $db->getNumRows() > 1 && $thread['CanDelete'];
70 70
 $thread['Replies'] = array();
71
-$container = create_container('alliance_message_delete_processing.php','',$var);
71
+$container = create_container('alliance_message_delete_processing.php', '', $var);
72 72
 $container['thread_id'] = $thread_id;
73 73
 while ($db->nextRecord()) {
74 74
 	$thread['Replies'][$db->getInt('reply_id')] = array('Sender' => $players[$db->getInt('sender_id')], 'Message' => $db->getField('text'), 'SendTime' => $db->getInt('time'));
75
-	if($thread['CanDelete']) {
75
+	if ($thread['CanDelete']) {
76 76
 		$container['reply_id'] = $db->getInt('reply_id');
77 77
 		$thread['Replies'][$db->getInt('reply_id')]['DeleteHref'] = SmrSession::getNewHREF($container);
78 78
 	}
79 79
 }
80 80
 
81 81
 if ($mbWrite || in_array($player->getAccountID(), Globals::getHiddenPlayers())) {
82
-	$container = create_container('alliance_message_add_processing.php','',$var);
82
+	$container = create_container('alliance_message_add_processing.php', '', $var);
83 83
 	$container['thread_index'] = $thread_index;
84 84
 	$thread['CreateThreadReplyFormHref'] = SmrSession::getNewHREF($container);
85 85
 }
86
-$template->assign('Thread',$thread);
87
-if(isset($var['preview'])) {
86
+$template->assign('Thread', $thread);
87
+if (isset($var['preview'])) {
88 88
 	$template->assign('Preview', $var['preview']);
89 89
 }
Please login to merge, or discard this patch.