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
Branch master (0a752f)
by Dan
03:57
created
engine/Default/forces_attack_processing.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,18 +72,18 @@
 block discarded – undo
72 72
 
73 73
 // If mines are bumped, the forces shoot first. Otherwise player shoots first.
74 74
 if ($bump) {
75
-	$results['Forces'] =& $forces->shootPlayers($attackers, $bump);
75
+	$results['Forces'] = & $forces->shootPlayers($attackers, $bump);
76 76
 }
77 77
 
78 78
 $results['Attackers'] = array('TotalDamage' => 0);
79 79
 foreach ($attackers as $attacker) {
80
-	$playerResults =& $attacker->shootForces($forces);
81
-	$results['Attackers']['Traders'][$attacker->getAccountID()] =& $playerResults;
80
+	$playerResults = & $attacker->shootForces($forces);
81
+	$results['Attackers']['Traders'][$attacker->getAccountID()] = & $playerResults;
82 82
 	$results['Attackers']['TotalDamage'] += $playerResults['TotalDamage'];
83 83
 }
84 84
 
85 85
 if (!$bump) {
86
-	$results['Forces'] =& $forces->shootPlayers($attackers, $bump);
86
+	$results['Forces'] = & $forces->shootPlayers($attackers, $bump);
87 87
 	$forces->updateExpire();
88 88
 }
89 89
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,16 +3,21 @@  discard block
 block discarded – undo
3 3
 $forces = SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);
4 4
 $forceOwner = $forces->getOwner();
5 5
 
6
-if ($player->hasNewbieTurns())
6
+if ($player->hasNewbieTurns()) {
7 7
 	create_error('You are under newbie protection!');
8
-if ($player->hasFederalProtection())
8
+}
9
+if ($player->hasFederalProtection()) {
9 10
 	create_error('You are under federal protection.');
10
-if ($player->isLandedOnPlanet())
11
+}
12
+if ($player->isLandedOnPlanet()) {
11 13
 	create_error('You cannot attack forces whilst on a planet!');
12
-if (!$player->canFight())
14
+}
15
+if (!$player->canFight()) {
13 16
 	create_error('You are not allowed to fight!');
14
-if ($player->forceNAPAlliance($forceOwner))
17
+}
18
+if ($player->forceNAPAlliance($forceOwner)) {
15 19
 	create_error('You cannot attack allied forces!');
20
+}
16 21
 
17 22
 // The attack is processed slightly differently if the attacker bumped into mines
18 23
 // when moving into sector
@@ -25,16 +30,20 @@  discard block
 block discarded – undo
25 30
 }
26 31
 
27 32
 if ($bump) {
28
-	if (!$forces->hasMines())
29
-		create_error('No mines in sector!');
30
-} else {
31
-	if (!$forces->exists())
32
-		create_error('These forces no longer exist.');
33
-	if ($player->getTurns() < $forces->getAttackTurnCost($ship))
34
-		create_error('You do not have enough turns to attack these forces!');
35
-	if (!$ship->hasWeapons() && !$ship->hasCDs())
36
-		create_error('You cannot attack without weapons!');
37
-}
33
+	if (!$forces->hasMines()) {
34
+			create_error('No mines in sector!');
35
+	}
36
+	} else {
37
+	if (!$forces->exists()) {
38
+			create_error('These forces no longer exist.');
39
+	}
40
+	if ($player->getTurns() < $forces->getAttackTurnCost($ship)) {
41
+			create_error('You do not have enough turns to attack these forces!');
42
+	}
43
+	if (!$ship->hasWeapons() && !$ship->hasCDs()) {
44
+			create_error('You cannot attack without weapons!');
45
+	}
46
+	}
38 47
 
39 48
 // take the turns
40 49
 if ($bump) {
@@ -103,10 +112,11 @@  discard block
 block discarded – undo
103 112
 $container = create_container('skeleton.php', 'forces_attack.php');
104 113
 
105 114
 // If their target is dead there is no continue attack button
106
-if ($forces->exists())
115
+if ($forces->exists()) {
107 116
 	$container['owner_id'] = $forces->getOwnerID();
108
-else
117
+} else {
109 118
 	$container['owner_id'] = 0;
119
+}
110 120
 
111 121
 // If they died on the shot they get to see the results
112 122
 if ($player->isDead()) {
Please login to merge, or discard this patch.
tools/discord/commands/seedlist.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
4 4
 
5 5
 $fn_seedlist = function($message) {
6 6
 	$link = new GameLink($message->channel, $message->author);
7
-	if (!$link->valid) return;
7
+	if (!$link->valid) {
8
+		return;
9
+	}
8 10
 
9 11
 	// print the entire seedlist
10 12
 	$results = shared_channel_msg_seedlist($link->player);
@@ -13,7 +15,9 @@  discard block
 block discarded – undo
13 15
 
14 16
 $fn_seedlist_add = function($message, $sectors) {
15 17
 	$link = new GameLink($message->channel, $message->author);
16
-	if (!$link->valid) return;
18
+	if (!$link->valid) {
19
+		return;
20
+	}
17 21
 
18 22
 	// add sectors to the seedlist
19 23
 	$results = shared_channel_msg_seedlist_add($link->player, $sectors);
@@ -22,7 +26,9 @@  discard block
 block discarded – undo
22 26
 
23 27
 $fn_seedlist_del = function($message, $sectors) {
24 28
 	$link = new GameLink($message->channel, $message->author);
25
-	if (!$link->valid) return;
29
+	if (!$link->valid) {
30
+		return;
31
+	}
26 32
 
27 33
 	// delete sectors from the seedlist
28 34
 	$results = shared_channel_msg_seedlist_del($link->player, $sectors);
Please login to merge, or discard this patch.
tools/irc/channel_msg_sd.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
 		// delete any old entries in the list
46 46
 		foreach ($sds as $key => $value) {
47 47
 
48
-			if ($value[3] != $channel)
49
-				continue;
48
+			if ($value[3] != $channel) {
49
+							continue;
50
+			}
50 51
 
51 52
 			if ($value[0] == $sector) {
52 53
 				unset($sds[$key]);
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
 
83 84
 		foreach ($sds as $key => $sd) {
84 85
 
85
-			if ($sd[3] != $channel)
86
-				continue;
86
+			if ($sd[3] != $channel) {
87
+							continue;
88
+			}
87 89
 
88 90
 			if ($sd[0] == $sector) {
89 91
 				fputs($fp, 'PRIVMSG ' . $channel . ' :The supply/demand for sector ' . $sector . ' has been deleted.' . EOL);
@@ -121,7 +123,9 @@  discard block
 block discarded – undo
121 123
 			if ($sd[3] == $channel) {
122 124
 
123 125
 				$seconds_since_refresh = time() - $sd[2];
124
-				if ($seconds_since_refresh < 0) $seconds_since_refresh = 0;
126
+				if ($seconds_since_refresh < 0) {
127
+					$seconds_since_refresh = 0;
128
+				}
125 129
 				$amt_to_add = floor($seconds_since_refresh * $refresh_per_sec);
126 130
 
127 131
 				if ($sd[1] + $amt_to_add > 4000) {
Please login to merge, or discard this patch.
lib/Default/council.inc 1 patch
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,17 +16,19 @@  discard block
 block discarded – undo
16 16
 		$race_id_2 = $db->getInt('race_id_2');
17 17
 		$action = $db->getField('action');
18 18
 
19
-		if ($action == 'INC')
20
-			$relation_modifier = RELATIONS_VOTE_CHANGE;
21
-		else
22
-			$relation_modifier = -RELATIONS_VOTE_CHANGE;
19
+		if ($action == 'INC') {
20
+					$relation_modifier = RELATIONS_VOTE_CHANGE;
21
+		} else {
22
+					$relation_modifier = -RELATIONS_VOTE_CHANGE;
23
+		}
23 24
 
24 25
 		$db2->query('SELECT * FROM race_has_relation ' .
25 26
 					'WHERE race_id_1 = ' . $db2->escapeNumber($race_id_1) . '
26 27
 						AND race_id_2 = ' . $db2->escapeNumber($race_id_2) . '
27 28
 						AND game_id = ' . $db2->escapeNumber($player->getGameID()));
28
-		if ($db2->nextRecord())
29
-			$relation = $db2->getField('relation') + $relation_modifier;
29
+		if ($db2->nextRecord()) {
30
+					$relation = $db2->getField('relation') + $relation_modifier;
31
+		}
30 32
 
31 33
 		if ($relation < MIN_GLOBAL_RELATIONS) {
32 34
 			$relation = MIN_GLOBAL_RELATIONS;
@@ -107,10 +109,11 @@  discard block
 block discarded – undo
107 109
 					$expireTime = TIME + TIME_FOR_WAR_VOTE_FED_SAFETY;
108 110
 					$query = 'REPLACE INTO player_can_fed (account_id, game_id, race_id, expiry, allowed) VALUES ';
109 111
 					foreach ($currentlyParkedAccountIDs as $raceID => $accountIDs) {
110
-						if ($raceID == $race_id_1)
111
-							$message = 'We have declared war upon your race';
112
-						else
113
-							$message = 'Your race has declared war upon us';
112
+						if ($raceID == $race_id_1) {
113
+													$message = 'We have declared war upon your race';
114
+						} else {
115
+													$message = 'Your race has declared war upon us';
116
+						}
114 117
 						$message .= ', you have ' . format_time(TIME_FOR_WAR_VOTE_FED_SAFETY) . ' to vacate our federal space, after that time you will no longer be protected (unless you have strong personal relations).';
115 118
 						foreach ($accountIDs as $accountID) {
116 119
 							$query .= '(' . $db2->escapeNumber($accountID) . ',' . $db2->escapeNumber($player->getGameID()) . ',' . $db2->escapeNumber($raceID) . ',' . $db2->escapeNumber($expireTime) . ',' . $db2->escapeBoolean(true) . '),';
@@ -135,8 +138,7 @@  discard block
 block discarded – undo
135 138
 				$news = 'The [race=' . $race_id_1 . '] have declared <span class="red">WAR</span> on the [race=' . $race_id_2 . ']';
136 139
 				$db2->query('INSERT INTO news (game_id, time, news_message) VALUES ' .
137 140
 							'(' . $db2->escapeNumber($player->getGameID()) . ', ' . $db2->escapeNumber(TIME) . ', ' . $db2->escapeString($news) . ')');
138
-			}
139
-			elseif ($type == 'PEACE') {
141
+			} elseif ($type == 'PEACE') {
140 142
 				// get 'yes' votes
141 143
 				$db2->query('SELECT * FROM player_votes_pact
142 144
 							WHERE game_id = '.$db2->escapeNumber($player->getGameID()) . '
Please login to merge, or discard this patch.
lib/Default/message.functions.inc 1 patch
Braces   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,30 +26,30 @@
 block discarded – undo
26 26
 }
27 27
 
28 28
 function &getMessagePlayer($accountID, $gameID, $messageType = false) {
29
-	if ($accountID == ACCOUNT_ID_PORT)
30
-		$return = '<span class="yellow">Port Defenses</span>';
31
-	else if ($accountID == ACCOUNT_ID_ADMIN)
32
-		$return = '<span class="admin">Administrator</span>';
33
-	else if ($accountID == ACCOUNT_ID_PLANET)
34
-		$return = '<span class="yellow">Planetary Defenses</span>';
35
-	else if ($accountID == ACCOUNT_ID_ALLIANCE_AMBASSADOR)
36
-		$return = '<span class="green">Alliance Ambassador</span>';
37
-	else if ($accountID == ACCOUNT_ID_CASINO)
38
-		$return = '<span class="yellow">Casino</span>';
39
-	else if ($accountID == ACCOUNT_ID_FED_CLERK)
40
-		$return = '<span class="yellow">Federal Clerk</span>';
41
-	else if ($accountID == ACCOUNT_ID_OP_ANNOUNCE || $accountID == ACCOUNT_ID_ALLIANCE_COMMAND)
42
-		$return = '<span class="green">Alliance Command</span>';
43
-	else {
29
+	if ($accountID == ACCOUNT_ID_PORT) {
30
+			$return = '<span class="yellow">Port Defenses</span>';
31
+	} else if ($accountID == ACCOUNT_ID_ADMIN) {
32
+			$return = '<span class="admin">Administrator</span>';
33
+	} else if ($accountID == ACCOUNT_ID_PLANET) {
34
+			$return = '<span class="yellow">Planetary Defenses</span>';
35
+	} else if ($accountID == ACCOUNT_ID_ALLIANCE_AMBASSADOR) {
36
+			$return = '<span class="green">Alliance Ambassador</span>';
37
+	} else if ($accountID == ACCOUNT_ID_CASINO) {
38
+			$return = '<span class="yellow">Casino</span>';
39
+	} else if ($accountID == ACCOUNT_ID_FED_CLERK) {
40
+			$return = '<span class="yellow">Federal Clerk</span>';
41
+	} else if ($accountID == ACCOUNT_ID_OP_ANNOUNCE || $accountID == ACCOUNT_ID_ALLIANCE_COMMAND) {
42
+			$return = '<span class="green">Alliance Command</span>';
43
+	} else {
44 44
 		foreach (Globals::getRaces() as $raceID => $raceInfo) {
45 45
 			if ($accountID == ACCOUNT_ID_GROUP_RACES + $raceID) {
46 46
 				$return = '<span class="yellow">' . $raceInfo['Race Name'] . ' Government</span>';
47 47
 				return $return;
48 48
 			}
49 49
 		}
50
-		if (!empty($accountID))
51
-			$return = SmrPlayer::getPlayer($accountID, $gameID);
52
-		else {
50
+		if (!empty($accountID)) {
51
+					$return = SmrPlayer::getPlayer($accountID, $gameID);
52
+		} else {
53 53
 			switch ($messageType) {
54 54
 				case MSG_ADMIN:
55 55
 					$return = '<span class="admin">Administrator</span>';
Please login to merge, or discard this patch.
lib/Default/bar.functions.inc 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 		// Delete all tickets and re-insert the winning ticket
24 24
 		$db->query('DELETE FROM player_has_ticket WHERE game_id = ' . $db->escapeNumber($gameID));
25 25
 		$db->query('INSERT INTO player_has_ticket (game_id, account_id, time, prize) '
26
-		           .'VALUES (' . $db->escapeNumber($gameID) . ',' . $db->escapeNumber($winner_id) . ',\'0\',' . $db->escapeNumber($lottoInfo['Prize']) . ')');
26
+				   .'VALUES (' . $db->escapeNumber($gameID) . ',' . $db->escapeNumber($winner_id) . ',\'0\',' . $db->escapeNumber($lottoInfo['Prize']) . ')');
27 27
 
28 28
 		//get around locked table problem
29 29
 		$lottoWon = true;
Please login to merge, or discard this patch.
lib/Default/shop_goods.inc 1 patch
Braces   +46 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,17 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function checkPortTradeable($port, $player) {
4
-	if ($port->getSectorID() != $player->getSectorID())
5
-		return 'That port is not in this sector!';
4
+	if ($port->getSectorID() != $player->getSectorID()) {
5
+			return 'That port is not in this sector!';
6
+	}
6 7
 	
7
-	if (!$port->exists())
8
-		return 'There is no port in this sector!';
8
+	if (!$port->exists()) {
9
+			return 'There is no port in this sector!';
10
+	}
9 11
 	
10
-	if ($player->getRelation($port->getRaceID()) <= RELATIONS_WAR)
11
-		return 'We will not trade with our enemies!';
12
+	if ($player->getRelation($port->getRaceID()) <= RELATIONS_WAR) {
13
+			return 'We will not trade with our enemies!';
14
+	}
12 15
 	
13
-	if ($port->getReinforceTime() > TIME)
14
-		return 'We are still repairing damage caused during the last raid.';
16
+	if ($port->getReinforceTime() > TIME) {
17
+			return 'We are still repairing damage caused during the last raid.';
18
+	}
15 19
 	
16 20
 	return true;
17 21
 }
@@ -55,39 +59,43 @@  discard block
 block discarded – undo
55 59
 		if (abs($port_off_rel) > abs($trader_off_rel)) {
56 60
 			// get a random number between
57 61
 			// (port_off) and (100 +/- $trader_off_rel)
58
-			if (100 + $trader_off_rel < $port_off)
59
-				$offer_modifier = mt_rand(100 + $trader_off_rel, $port_off);
60
-			else
61
-				$offer_modifier = mt_rand($port_off, 100 + $trader_off_rel);
62
+			if (100 + $trader_off_rel < $port_off) {
63
+							$offer_modifier = mt_rand(100 + $trader_off_rel, $port_off);
64
+			} else {
65
+							$offer_modifier = mt_rand($port_off, 100 + $trader_off_rel);
66
+			}
62 67
 
63 68
 			$container['offered_price'] = round($container['ideal_price'] * $offer_modifier / 100);
64 69
 		}
70
+	} else {
71
+			$container['overall_number_of_bargains'] = mt_rand(2, 5);
72
+	}
65 73
 	}
66
-	else
67
-		$container['overall_number_of_bargains'] = mt_rand(2, 5);
68
-}
69 74
 
70 75
 function get_amount() {
71 76
 	global $var;
72 77
 
73 78
 	// retrieve amount
74
-	if (isset($var['amount']))
75
-		$amount = $var['amount'];
76
-	else if (isset($_REQUEST['amount']))
77
-		$amount = $_REQUEST['amount'];
78
-	else
79
-		$amount = 0;
79
+	if (isset($var['amount'])) {
80
+			$amount = $var['amount'];
81
+	} else if (isset($_REQUEST['amount'])) {
82
+			$amount = $_REQUEST['amount'];
83
+	} else {
84
+			$amount = 0;
85
+	}
80 86
 
81 87
 	// only numbers
82
-	if (!is_numeric($amount))
83
-		create_error('You must actually enter a number!');
88
+	if (!is_numeric($amount)) {
89
+			create_error('You must actually enter a number!');
90
+	}
84 91
 
85 92
 	// we take as it is but round it
86 93
 	$amount = floor($amount);
87 94
 
88 95
 	// no negative amounts are allowed
89
-	if ($amount <= 0)
90
-		create_error('You must actually enter an amount > 0!');
96
+	if ($amount <= 0) {
97
+			create_error('You must actually enter an amount > 0!');
98
+	}
91 99
 
92 100
 	return $amount;
93 101
 }
@@ -96,23 +104,26 @@  discard block
 block discarded – undo
96 104
 	global $var;
97 105
 
98 106
 	// we get it from form
99
-	if (isset($_REQUEST['bargain_price']))
100
-		$price = $_REQUEST['bargain_price'];
101
-	else if (isset($var['bargain_price']))
102
-		$price = $var['bargain_price'];
103
-	else
104
-		$price = 0;
107
+	if (isset($_REQUEST['bargain_price'])) {
108
+			$price = $_REQUEST['bargain_price'];
109
+	} else if (isset($var['bargain_price'])) {
110
+			$price = $var['bargain_price'];
111
+	} else {
112
+			$price = 0;
113
+	}
105 114
 
106 115
 	// only numbers
107
-	if (!is_numeric($price))
108
-		create_error('You must actually enter a number!');
116
+	if (!is_numeric($price)) {
117
+			create_error('You must actually enter a number!');
118
+	}
109 119
 
110 120
 	// we take as it is but round it
111 121
 	$price = floor($price);
112 122
 
113 123
 	// no negative amounts are allowed
114
-	if ($price < 0)
115
-		create_error('No negative prices are allowed!');
124
+	if ($price < 0) {
125
+			create_error('No negative prices are allowed!');
126
+	}
116 127
 
117 128
 	return $price;
118 129
 }
Please login to merge, or discard this patch.
admin/Default/newsletter_send_processing.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
 // Set the body of the e-mail
37 37
 set_mail_body($mail, $var['newsletter_html'], $var['newsletter_text'],
38
-              $_REQUEST['salutation']);
38
+			  $_REQUEST['salutation']);
39 39
 
40 40
 if ($_REQUEST['to_email'] == '*') {
41 41
 	// Send the newsletter to all players.
Please login to merge, or discard this patch.
admin/Default/notify_reply_processing.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,12 +7,14 @@  discard block
 block discarded – undo
7 7
 	transfer('offended');
8 8
 	transfer('game_id');
9 9
 	transfer('sender_id');
10
-	if (!empty($offenderReply))
11
-		$container['PreviewOffender'] = $offenderReply;
10
+	if (!empty($offenderReply)) {
11
+			$container['PreviewOffender'] = $offenderReply;
12
+	}
12 13
 	$container['OffenderBanPoints'] = $_REQUEST['offenderBanPoints'];
13 14
 
14
-	if (!empty($offendedReply))
15
-		$container['PreviewOffended'] = $offendedReply;
15
+	if (!empty($offendedReply)) {
16
+			$container['PreviewOffended'] = $offendedReply;
17
+	}
16 18
 	$container['OffendedBanPoints'] = $_REQUEST['offendedBanPoints'];
17 19
 	forward($container);
18 20
 }
@@ -28,7 +30,9 @@  discard block
 block discarded – undo
28 30
 		$offenderAccount->addPoints($_REQUEST['offenderBanPoints'], $account, 7, $suspicion);
29 31
 	}
30 32
 }
31
-if (isset($_REQUEST['offendedReply'])) $offendedReply = $_REQUEST['offendedReply'];
33
+if (isset($_REQUEST['offendedReply'])) {
34
+	$offendedReply = $_REQUEST['offendedReply'];
35
+}
32 36
 
33 37
 if (isset($offendedReply) && $offendedReply != '') {
34 38
 	//next message
Please login to merge, or discard this patch.