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

Passed
Pull Request — master (#812)
by Dan
12:02
created
engine/Default/planet_stockpile_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
 	$account->log(LOG_TYPE_PLANETS, 'Player takes ' . $amount . ' ' . Globals::getGoodName($var['good_id']) . ' from planet.', $player->getSectorID());
35 35
 
36 36
 // transfer to planet
37
-}
38
-elseif ($action == 'Planet') {
37
+} elseif ($action == 'Planet') {
39 38
 	// do we want transfer more than we have?
40 39
 	if ($amount > $ship->getCargo($var['good_id'])) {
41 40
 		create_error('You can\'t store more than you carry!');
Please login to merge, or discard this patch.
engine/Default/forces_drop_processing.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -129,8 +129,7 @@  discard block
 block discarded – undo
129 129
 	if ($change_combat_drones > 0) {
130 130
 		$ship->decreaseCDs($change_combat_drones, true);
131 131
 		$forces->addCDs($change_combat_drones);
132
-	}
133
-	else {
132
+	} else {
134 133
 		$ship->increaseCDs(-$change_combat_drones, true);
135 134
 		$forces->takeCDs(-$change_combat_drones);
136 135
 	}
@@ -140,8 +139,7 @@  discard block
 block discarded – undo
140 139
 	if ($change_scout_drones > 0) {
141 140
 		$ship->decreaseSDs($change_scout_drones);
142 141
 		$forces->addSDs($change_scout_drones);
143
-	}
144
-	else {
142
+	} else {
145 143
 		$ship->increaseSDs(-$change_scout_drones);
146 144
 		$forces->takeSDs(-$change_scout_drones);
147 145
 	}
@@ -155,8 +153,7 @@  discard block
 block discarded – undo
155 153
 			$ship->decloak();
156 154
 			$player->giveTurns(1);
157 155
 		}
158
-	}
159
-	else {
156
+	} else {
160 157
 		$ship->increaseMines(-$change_mines);
161 158
 		$forces->takeMines(-$change_mines);
162 159
 	}
@@ -191,8 +188,7 @@  discard block
 block discarded – undo
191 188
 			$scout_drones_message = 'added ';
192 189
 		}
193 190
 		$scout_drones_message .= $change_scout_drones . ' scout drone';
194
-	}
195
-	elseif ($change_scout_drones < 0) {
191
+	} elseif ($change_scout_drones < 0) {
196 192
 		$scout_drones_message = '';
197 193
 		if ((isset($combat_drones_message) && $change_combat_drones > 0) || (!isset($combat_drones_message) && $change_mines >= 0)) {
198 194
 			$scout_drones_message = 'removed ';
Please login to merge, or discard this patch.
engine/Default/shop_goods.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 //The player is sent here after trading and sees this if his offer is accepted.
25 25
 if (!empty($var['trade_msg'])) {
26 26
 	$template->assign('TradeMsg', $var['trade_msg']);
27
-}
28
-elseif ($player->getLastPort() != $player->getSectorID()) {
27
+} elseif ($player->getLastPort() != $player->getSectorID()) {
29 28
 	// test if we are searched, but only if we hadn't a previous trade here
30 29
 
31 30
 	$base_chance = 15;
@@ -72,8 +71,7 @@  discard block
 block discarded – undo
72 71
 						$player->setBank(5000);
73 72
 					}
74 73
 				}
75
-			}
76
-			else {
74
+			} else {
77 75
 				$player->decreaseCredits($fine);
78 76
 			}
79 77
 
@@ -85,8 +83,7 @@  discard block
 block discarded – undo
85 83
 			$ship->setCargo(GOODS_NARCOTICS, 0);
86 84
 			$account->log(LOG_TYPE_TRADING, 'Player gets caught with illegals', $player->getSectorID());
87 85
 
88
-		}
89
-		else {
86
+		} else {
90 87
 			$template->assign('IllegalsFound', false);
91 88
 			$player->increaseHOF(1, array('Trade', 'Search', 'Times Found Innocent'), HOF_PUBLIC);
92 89
 			$player->increaseAlignment(1);
Please login to merge, or discard this patch.
engine/Default/shop_hardware_processing.php 1 patch
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,11 +32,16 @@  discard block
 block discarded – undo
32 32
 	$ship->increaseHardware($hardware_id, $amount);
33 33
 
34 34
 	//HoF
35
-	if ($hardware_id == HARDWARE_COMBAT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE);
36
-	if ($hardware_id == HARDWARE_SCOUT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE);
37
-	if ($hardware_id == HARDWARE_MINE) $player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE);
38
-}
39
-else if ($action == 'Sell') {
35
+	if ($hardware_id == HARDWARE_COMBAT) {
36
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE);
37
+	}
38
+	if ($hardware_id == HARDWARE_SCOUT) {
39
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE);
40
+	}
41
+	if ($hardware_id == HARDWARE_MINE) {
42
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE);
43
+	}
44
+	} else if ($action == 'Sell') {
40 45
 	// We only allow selling combat drones
41 46
 	if ($hardware_id != HARDWARE_COMBAT) {
42 47
 		throw new Exception('This item cannot be sold!');
@@ -49,8 +54,7 @@  discard block
 block discarded – undo
49 54
 
50 55
 	$player->increaseCredits(IRound($cost * CDS_REFUND_PERCENT) * $amount);
51 56
 	$ship->decreaseCDs($amount, true); // 2nd arg avoids under attack warning
52
-}
53
-else {
57
+} else {
54 58
 	throw new Exception('Action must be either Buy or Sell.');
55 59
 }
56 60
 
Please login to merge, or discard this patch.
engine/Default/shop_goods_processing.php 1 patch
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,10 +58,14 @@  discard block
 block discarded – undo
58 58
 // get relations for us (global + personal)
59 59
 $relations = $player->getRelation($port->getRaceID());
60 60
 
61
-if (!isset($var['ideal_price'])) SmrSession::updateVar('ideal_price', $port->getIdealPrice($good_id, $transaction, $amount, $relations));
61
+if (!isset($var['ideal_price'])) {
62
+	SmrSession::updateVar('ideal_price', $port->getIdealPrice($good_id, $transaction, $amount, $relations));
63
+}
62 64
 $ideal_price = $var['ideal_price'];
63 65
 
64
-if (!isset($var['offered_price'])) SmrSession::updateVar('offered_price', $port->getOfferPrice($ideal_price, $relations, $transaction));
66
+if (!isset($var['offered_price'])) {
67
+	SmrSession::updateVar('offered_price', $port->getOfferPrice($ideal_price, $relations, $transaction));
68
+}
65 69
 $offered_price = $var['offered_price'];
66 70
 
67 71
 // nothing should happen here but just to avoid / by 0
@@ -120,8 +124,7 @@  discard block
 block discarded – undo
120 124
 		$player->increaseHOF($bargain_price, array('Trade', 'Money', 'Buying'), HOF_PUBLIC);
121 125
 		$port->buyGoods($portGood, $amount, $ideal_price, $bargain_price, $gained_exp);
122 126
 		$player->increaseRelationsByTrade($amount, $port->getRaceID());
123
-	}
124
-	elseif ($transaction == 'Sell') {
127
+	} elseif ($transaction == 'Sell') {
125 128
 		$msg_transaction = 'sold';
126 129
 		$ship->decreaseCargo($good_id, $amount);
127 130
 		$player->increaseCredits($bargain_price);
@@ -131,8 +134,7 @@  discard block
 block discarded – undo
131 134
 		$player->increaseHOF($bargain_price, array('Trade', 'Money', 'Selling'), HOF_PUBLIC);
132 135
 		$port->sellGoods($portGood, $amount, $ideal_price, $bargain_price, $gained_exp);
133 136
 		$player->increaseRelationsByTrade($amount, $port->getRaceID());
134
-	}
135
-	elseif ($transaction == 'Steal') {
137
+	} elseif ($transaction == 'Steal') {
136 138
 		$msg_transaction = 'stolen';
137 139
 		$ship->increaseCargo($good_id, $amount);
138 140
 		$player->increaseHOF($amount, array('Trade', 'Goods', 'Stolen'), HOF_ALLIANCE);
@@ -168,8 +170,7 @@  discard block
 block discarded – undo
168 170
 		$container['body'] = 'shop_goods.php';
169 171
 	}
170 172
 
171
-}
172
-else {
173
+} else {
173 174
 	// does the trader try to outsmart us?
174 175
 	$container = create_container('skeleton.php', 'shop_goods_trade.php');
175 176
 	transfer('ideal_price');
Please login to merge, or discard this patch.
engine/Default/message_send_processing.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,11 +28,9 @@
 block discarded – undo
28 28
 		$player->sendMessage($db->getInt('account_id'), MSG_ALLIANCE, $message, false);
29 29
 	}
30 30
 	$player->sendMessage($player->getAccountID(), MSG_ALLIANCE, $message, true, false);
31
-}
32
-else if (!empty($var['receiver'])) {
31
+} else if (!empty($var['receiver'])) {
33 32
 	$player->sendMessage($var['receiver'], MSG_PLAYER, $message);
34
-}
35
-else {
33
+} else {
36 34
 	$player->sendGlobalMessage($message);
37 35
 }
38 36
 
Please login to merge, or discard this patch.
engine/Default/preferences_processing.php 1 patch
Braces   +29 added lines, -40 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 $container = create_container('skeleton.php');
4 4
 if (SmrSession::hasGame()) {
5 5
 	$container['body'] = 'current_sector.php';
6
-}
7
-else {
6
+} else {
8 7
 	$container['body'] = 'game_play.php';
9 8
 }
10 9
 $action = $_REQUEST['action'];
@@ -17,8 +16,7 @@  discard block
 block discarded – undo
17 16
 	// overwrite container
18 17
 	$container['body'] = 'validate.php';
19 18
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your email address, you will now need to revalidate with the code sent to the new email address.';
20
-}
21
-elseif ($action == 'Change Password') {
19
+} elseif ($action == 'Change Password') {
22 20
 	$new_password = $_REQUEST['new_password'];
23 21
 	$old_password = $_REQUEST['old_password'];
24 22
 	$retype_password = $_REQUEST['retype_password'];
@@ -41,8 +39,7 @@  discard block
 block discarded – undo
41 39
 
42 40
 	$account->setPassword($new_password);
43 41
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your password.';
44
-}
45
-elseif ($action == 'Change Name') {
42
+} elseif ($action == 'Change Name') {
46 43
 	$HoF_name = trim($_REQUEST['HoF_name']);
47 44
 
48 45
 	$limited_char = 0;
@@ -67,18 +64,20 @@  discard block
 block discarded – undo
67 64
 	}
68 65
 
69 66
 	//disallow blank names
70
-	if (empty($HoF_name) || $HoF_name == '') create_error('You Hall of Fame name must contain characters!');
67
+	if (empty($HoF_name) || $HoF_name == '') {
68
+		create_error('You Hall of Fame name must contain characters!');
69
+	}
71 70
 
72 71
 	//no duplicates
73 72
 	$db->query('SELECT * FROM account WHERE hof_name = ' . $db->escapeString($HoF_name) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
74
-	if ($db->nextRecord()) create_error('Someone is already using that name!');
73
+	if ($db->nextRecord()) {
74
+		create_error('Someone is already using that name!');
75
+	}
75 76
 
76 77
 	// set the HoF name in account stat
77 78
 	$account->setHofName($HoF_name);
78 79
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your hall of fame name.';
79
-}
80
-
81
-elseif ($action == 'Change Discord ID') {
80
+} elseif ($action == 'Change Discord ID') {
82 81
 	$discordId = trim($_REQUEST['discord_id']);
83 82
 
84 83
 	if (empty($discordId)) {
@@ -88,14 +87,14 @@  discard block
 block discarded – undo
88 87
 	} else {
89 88
 		// no duplicates
90 89
 		$db->query('SELECT * FROM account WHERE discord_id =' . $db->escapeString($discordId) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
91
-		if ($db->nextRecord()) create_error('Someone is already using that Discord User ID!');
90
+		if ($db->nextRecord()) {
91
+			create_error('Someone is already using that Discord User ID!');
92
+		}
92 93
 
93 94
 		$account->setDiscordId($discordId);
94 95
 		$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your Discord User ID.';
95 96
 	}
96
-}
97
-
98
-elseif ($action == 'Change IRC Nick') {
97
+} elseif ($action == 'Change IRC Nick') {
99 98
 	$ircNick = trim($_REQUEST['irc_nick']);
100 99
 
101 100
 	for ($i = 0; $i < strlen($ircNick); $i++) {
@@ -113,7 +112,9 @@  discard block
 block discarded – undo
113 112
 
114 113
 		// no duplicates
115 114
 		$db->query('SELECT * FROM account WHERE irc_nick = ' . $db->escapeString($ircNick) . ' AND account_id != ' . $db->escapeNumber($account->getAccountID()) . ' LIMIT 1');
116
-		if ($db->nextRecord()) create_error('Someone is already using that nick!');
115
+		if ($db->nextRecord()) {
116
+			create_error('Someone is already using that nick!');
117
+		}
117 118
 
118 119
 		// save irc nick in db and set message
119 120
 		$account->setIrcNick($ircNick);
@@ -121,8 +122,7 @@  discard block
 block discarded – undo
121 122
 
122 123
 	}
123 124
 
124
-}
125
-elseif ($action == 'Yes') {
125
+} elseif ($action == 'Yes') {
126 126
 	$account_id = $var['account_id'];
127 127
 	$amount = $var['amount'];
128 128
 
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
 	// add to him
135 135
 	$his_account->increaseSmrCredits($amount);
136 136
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have sent SMR credits.';
137
-}
138
-elseif ($action == 'Change Timezone') {
137
+} elseif ($action == 'Change Timezone') {
139 138
 	$timez = $_REQUEST['timez'];
140 139
 	if (!is_numeric($timez)) {
141 140
 		create_error('Numbers only please');
@@ -143,25 +142,20 @@  discard block
 block discarded – undo
143 142
 
144 143
 	$db->query('UPDATE account SET offset = ' . $db->escapeNumber($timez) . ' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
145 144
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your time offset.';
146
-}
147
-elseif ($action == 'Change Date Formats') {
145
+} elseif ($action == 'Change Date Formats') {
148 146
 	$account->setShortDateFormat($_REQUEST['dateformat']);
149 147
 	$account->setShortTimeFormat($_REQUEST['timeformat']);
150 148
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your date formats.';
151
-}
152
-elseif ($action == 'Change Images') {
149
+} elseif ($action == 'Change Images') {
153 150
 	$account->setDisplayShipImages($_REQUEST['images']);
154 151
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your ship images preferences.';
155
-}
156
-elseif ($action == 'Change Centering') {
152
+} elseif ($action == 'Change Centering') {
157 153
 	$account->setCenterGalaxyMapOnPlayer($_REQUEST['centergalmap'] == 'Yes');
158 154
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your centering galaxy map preferences.';
159
-}
160
-else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
155
+} else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
161 156
 	$account->setFontSize($_REQUEST['fontsize']);
162 157
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your font size.';
163
-}
164
-else if ($action == 'Change CSS Options') {
158
+} else if ($action == 'Change CSS Options') {
165 159
 	$account->setCssLink($_REQUEST['csslink']);
166 160
 	if ($_REQUEST['template'] == 'None') {
167 161
 		$account->setDefaultCSSEnabled(false);
@@ -172,24 +166,20 @@  discard block
 block discarded – undo
172 166
 		$account->setColourScheme($cssColourScheme);
173 167
 	}
174 168
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your CSS options.';
175
-}
176
-else if ($action == 'Change Kamikaze Setting') {
169
+} else if ($action == 'Change Kamikaze Setting') {
177 170
 	$player->setCombatDronesKamikazeOnMines($_REQUEST['kamikaze'] == 'Yes');
178 171
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your combat drones options.';
179
-}
180
-else if ($action == 'Change Message Setting') {
172
+} else if ($action == 'Change Message Setting') {
181 173
 	$player->setForceDropMessages($_REQUEST['forceDropMessages'] == 'Yes');
182 174
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your message options.';
183
-}
184
-else if ($action == 'Save Hotkeys') {
175
+} else if ($action == 'Save Hotkeys') {
185 176
 	foreach (AbstractSmrAccount::getDefaultHotkeys() as $hotkey => $binding) {
186 177
 		if (isset($_REQUEST[$hotkey])) {
187 178
 			$account->setHotkey($hotkey, explode(' ', $_REQUEST[$hotkey]));
188 179
 		}
189 180
 	}
190 181
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have saved your hotkeys.';
191
-}
192
-else if (strpos(trim($action), 'Alter Player') === 0) {
182
+} else if (strpos(trim($action), 'Alter Player') === 0) {
193 183
 	// trim input now
194 184
 	$player_name = trim($_POST['PlayerName']);
195 185
 
@@ -247,8 +237,7 @@  discard block
 block discarded – undo
247 237
 	$news = 'Please be advised that ' . $old_name . ' has changed their name to ' . $player->getBBLink();
248 238
 	$db->query('INSERT INTO news (time, news_message, game_id, type) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ', \'admin\')');
249 239
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your player name.';
250
-}
251
-else if ($action == 'Update Colours') {
240
+} else if ($action == 'Update Colours') {
252 241
 	$friendlyColour = $_REQUEST['friendly_color'];
253 242
 	$neutralColour = $_REQUEST['neutral_color'];
254 243
 	$enemyColour = $_REQUEST['enemy_color'];
Please login to merge, or discard this patch.
engine/Default/course_plot_nearest_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@
 block discarded – undo
2 2
 
3 3
 if (isset($var['RealX'])) {
4 4
 	$realX = $var['RealX'];
5
-}
6
-else {
5
+} else {
7 6
 	if (!isset($_REQUEST['xtype']) || !isset($_REQUEST['X'])) {
8 7
 		create_error('You have to select what you would like to find.');
9 8
 	}
Please login to merge, or discard this patch.
engine/Default/sector_jump_processing.php 1 patch
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,8 +4,11 @@  discard block
 block discarded – undo
4 4
 	create_error('You cannot move until the game has started!');
5 5
 }
6 6
 
7
-if (isset($_REQUEST['target'])) $target = trim($_REQUEST['target']);
8
-else $target = $var['target'];
7
+if (isset($_REQUEST['target'])) {
8
+	$target = trim($_REQUEST['target']);
9
+} else {
10
+	$target = $var['target'];
11
+}
9 12
 
10 13
 //allow hidden players (admins that don't play) to move without pinging, hitting mines, losing turns
11 14
 if (in_array($player->getAccountID(), Globals::getHiddenPlayers())) {
@@ -86,8 +89,7 @@  discard block
 block discarded – undo
86 89
 	}
87 90
 	$player->setSectorID($misjumpSector);
88 91
 	unset($distances);
89
-}
90
-else { // we hit it. exactly
92
+} else { // we hit it. exactly
91 93
 	$player->setSectorID($targetSector->getSectorID());
92 94
 }
93 95
 $player->takeTurns($turnsToJump, $turnsToJump);
@@ -124,8 +126,7 @@  discard block
 block discarded – undo
124 126
 		$container = create_container('skeleton.php', 'current_sector.php');
125 127
 		$container['msg'] = 'You have just flown past a sprinkle of mines.<br />Because of your newbie status you have been spared from the harsh reality of the forces.';
126 128
 		forward($container);
127
-	}
128
-	else {
129
+	} else {
129 130
 		$container = create_container('forces_attack_processing.php');
130 131
 		$container['action'] = 'bump';
131 132
 		$container['owner_id'] = $mineOwnerID;
Please login to merge, or discard this patch.