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/game_join_processing.php 1 patch
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,14 +3,16 @@  discard block
 block discarded – undo
3 3
 // trim input now
4 4
 $player_name = trim($_REQUEST['player_name']);
5 5
 
6
-if(!defined('NPC_SCRIPT') && strpos($player_name,'NPC')===0)
6
+if(!defined('NPC_SCRIPT') && strpos($player_name,'NPC')===0) {
7 7
 	create_error('Player names cannot begin with "NPC".');
8
+}
8 9
 
9 10
 $limited_char = 0;
10 11
 for ($i = 0; $i < strlen($player_name); $i++) {
11 12
 	// disallow certain ascii chars
12
-	if (ord($player_name[$i]) < 32 || ord($player_name[$i]) > 127)
13
-		create_error('The player name contains invalid characters!');
13
+	if (ord($player_name[$i]) < 32 || ord($player_name[$i]) > 127) {
14
+			create_error('The player name contains invalid characters!');
15
+	}
14 16
 
15 17
 // numbers 48..57
16 18
 // Letters 65..90
@@ -22,17 +24,21 @@  discard block
 block discarded – undo
22 24
 	}
23 25
 }
24 26
 
25
-if ($limited_char > 4)
27
+if ($limited_char > 4) {
26 28
 	create_error('You cannot use a name with more than 4 special characters.');
29
+}
27 30
 
28
-if (empty($player_name))
31
+if (empty($player_name)) {
29 32
 	create_error('You must enter a player name!');
33
+}
30 34
 
31 35
 $race_id = $_REQUEST['race_id'];
32
-if (empty($race_id) || $race_id == 1)
36
+if (empty($race_id) || $race_id == 1) {
33 37
 	create_error('Please choose a race!');
34
-if(!is_numeric($var['game_id']))
38
+}
39
+if(!is_numeric($var['game_id'])) {
35 40
 	create_error('Game ID is not numeric');
41
+}
36 42
 
37 43
 $gameID = $var['game_id'];
38 44
 
@@ -40,11 +46,13 @@  discard block
 block discarded – undo
40 46
 $player_name = htmlentities($player_name);
41 47
 
42 48
 $db->query('SELECT 1 FROM player WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND player_name = ' . $db->escapeString($player_name) . ' LIMIT 1');
43
-if ($db->nextRecord() > 0)
49
+if ($db->nextRecord() > 0) {
44 50
 	create_error('The player name already exists.');
51
+}
45 52
 
46
-if (!Globals::isValidGame($gameID))
53
+if (!Globals::isValidGame($gameID)) {
47 54
 	create_error('Game not found!');
55
+}
48 56
 
49 57
 // does it cost something to join that game?
50 58
 $credits = Globals::getGameCreditsRequired($gameID);
@@ -65,8 +73,7 @@  discard block
 block discarded – undo
65 73
 	$ship_id = SHIP_TYPE_NEWBIE_MERCHANT_VESSEL;
66 74
 	$amount_shields = 75;
67 75
 	$amount_armour = 150;
68
-}
69
-else {
76
+} else {
70 77
 	$startingNewbieTurns = STARTING_NEWBIE_TURNS_VET;
71 78
 	switch($race_id) {
72 79
 		case RACE_ALSKANT:
@@ -105,8 +112,7 @@  discard block
 block discarded – undo
105 112
 //// newbie leaders need to put into there alliances
106 113
 if ($account->getAccountID() == ACCOUNT_ID_NHL) {
107 114
 	$alliance_id = NHA_ID;
108
-}
109
-else {
115
+} else {
110 116
 	$alliance_id = 0;
111 117
 }
112 118
 
@@ -116,8 +122,7 @@  discard block
 block discarded – undo
116 122
 $db->query('SELECT MAX(player_id) FROM player WHERE game_id = ' . $db->escapeNumber($gameID));
117 123
 if ($db->nextRecord()) {
118 124
 	$player_id = $db->getInt('MAX(player_id)') + 1;
119
-}
120
-else {
125
+} else {
121 126
 	$player_id = 1;
122 127
 }
123 128
 
Please login to merge, or discard this patch.
engine/Default/bank_anon_detail.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
 	&& is_numeric($var['maxValue'])
35 35
 	&& $var['maxValue'] > 0) {
36 36
 	$maxValue = $var['maxValue'];
37
-}
38
-else {
37
+} else {
39 38
 	$db->query('SELECT MAX(transaction_id) FROM anon_bank_transactions
40 39
 				WHERE game_id=' . $db->escapeNumber($player->getGameID()) . '
41 40
 				AND anon_id=' . $db->escapeNumber($account_num)
Please login to merge, or discard this patch.
engine/Default/council_vote.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@
 block discarded – undo
20 20
 $voteRelations = array();
21 21
 $globalRelations = Globals::getRaceRelations($player->getGameID(), $player->getRaceID());
22 22
 foreach (Globals::getRaces() as $raceID => $raceInfo) {
23
-	if($raceID == RACE_NEUTRAL || $raceID == $player->getRaceID())
24
-		continue;
23
+	if($raceID == RACE_NEUTRAL || $raceID == $player->getRaceID()) {
24
+			continue;
25
+	}
25 26
 	$container = create_container('council_vote_processing.php', '', array('race_id' => $raceID));
26 27
 	$voteRelations[$raceID] = array(
27 28
 		'HREF' => SmrSession::getNewHREF($container),
Please login to merge, or discard this patch.
engine/Default/current_players.php 1 patch
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,10 +6,12 @@  discard block
 block discarded – undo
6 6
 			WHERE last_accessed >= ' . $db->escapeNumber(TIME - 600) . ' AND
7 7
 				game_id = ' . $db->escapeNumber($player->getGameID()));
8 8
 $count_real_last_active = 0;
9
-if($db->nextRecord())
9
+if($db->nextRecord()) {
10 10
 	$count_real_last_active = $db->getField('count');
11
-if(SmrSession::$last_accessed < TIME - 600)
11
+}
12
+if(SmrSession::$last_accessed < TIME - 600) {
12 13
 	++$count_real_last_active;
14
+}
13 15
 
14 16
 
15 17
 $db->query('SELECT * FROM player
@@ -19,8 +21,9 @@  discard block
 block discarded – undo
19 21
 $count_last_active = $db->getNumRows();
20 22
 
21 23
 // fix it if some1 is using the logoff button
22
-if ($count_real_last_active < $count_last_active)
24
+if ($count_real_last_active < $count_last_active) {
23 25
 	$count_real_last_active = $count_last_active;
26
+}
24 27
 
25 28
 // Get the summary text
26 29
 $summary = 'There ';
@@ -57,12 +60,15 @@  discard block
 block discarded – undo
57 60
 
58 61
 		// How should we style the row for this player?
59 62
 		$class='';
60
-		if ($player->equals($curr_player))
61
-			$class .= 'bold';
62
-		if ($curr_player->hasNewbieStatus())
63
-			$class.= ' newbie';
64
-		if ($class!='')
65
-			$class = ' class="'.trim($class).'"';
63
+		if ($player->equals($curr_player)) {
64
+					$class .= 'bold';
65
+		}
66
+		if ($curr_player->hasNewbieStatus()) {
67
+					$class.= ' newbie';
68
+		}
69
+		if ($class!='') {
70
+					$class = ' class="'.trim($class).'"';
71
+		}
66 72
 		$row['tr_class'] = $class;
67 73
 
68 74
 		// What should the player name be displayed as?
Please login to merge, or discard this patch.
engine/Default/bar_buy_drink_processing.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,14 +12,12 @@  discard block
 block discarded – undo
12 12
 	$message.= 'You ask the bartender for some water and you quickly down it.<br />You don\'t feel quite so intoxicated anymore.<br />';
13 13
 	$db->query('DELETE FROM player_has_drinks WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND account_id=' . $db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
14 14
 	$player->increaseHOF(1,array('Bar','Drinks', 'Water'), HOF_PUBLIC);
15
-}
16
-else {
15
+} else {
17 16
 	$random = mt_rand(1, 20);
18 17
 	//only get Azool or Spock drink if they are very lucky
19 18
 	if ($random != 1) {
20 19
 		$db->query('SELECT drink_id, drink_name FROM bar_drink WHERE drink_id != 1 && drink_id != 11 ORDER BY rand() LIMIT 1');
21
-	}
22
-	else {
20
+	} else {
23 21
 		$db->query('SELECT drink_id, drink_name FROM bar_drink ORDER BY rand() LIMIT 1');
24 22
 	}
25 23
 
@@ -30,8 +28,7 @@  discard block
 block discarded – undo
30 28
 		$db->query('SELECT drink_id FROM player_has_drinks WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER by drink_id DESC LIMIT 1');
31 29
 		if ($db->nextRecord()) {
32 30
 			$curr_drink_id = $db->getInt('drink_id') + 1;
33
-		}
34
-		else {
31
+		} else {
35 32
 			$curr_drink_id = 1;
36 33
 		}
37 34
 
@@ -39,8 +36,7 @@  discard block
 block discarded – undo
39 36
 			$message.=('You have bought a '.$drinkName.' for $10');
40 37
 			$db->query('INSERT INTO player_has_drinks (account_id, game_id, drink_id, time) VALUES (' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($curr_drink_id) . ', ' . $db->escapeNumber(TIME) . ')');
41 38
 			$player->increaseHOF(1,array('Bar','Drinks', 'Alcoholic'), HOF_PUBLIC);
42
-		}
43
-		else {
39
+		} else {
44 40
 			$message.=('The bartender says, Ive got something special for ya.<br />');
45 41
 			$message.=('The bartender turns around for a minute and whips up a '.$drinkName.'.<br />');
46 42
 
Please login to merge, or discard this patch.
engine/Default/council_politics.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,11 +19,9 @@
 block discarded – undo
19 19
 	if($otherRaceID != RACE_NEUTRAL && $raceID != $otherRaceID) {
20 20
 		if($raceRelations[$otherRaceID] >= RELATIONS_PEACE) {
21 21
 			$peaceRaces[$otherRaceID] = $raceInfo;
22
-		}
23
-		else if($raceRelations[$otherRaceID] <= RELATIONS_WAR) {
22
+		} else if($raceRelations[$otherRaceID] <= RELATIONS_WAR) {
24 23
 			$warRaces[$otherRaceID] = $raceInfo;
25
-		}
26
-		else {
24
+		} else {
27 25
 			$neutralRaces[$otherRaceID] = $raceInfo;
28 26
 		}
29 27
 	}
Please login to merge, or discard this patch.
engine/Default/galactic_post_make_paper_processing.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,10 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $db->query('SELECT * FROM galactic_post_paper WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY paper_id DESC');
4
-if ($db->nextRecord())
4
+if ($db->nextRecord()) {
5 5
 	$num = $db->getField('paper_id') + 1;
6
-else
6
+} else {
7 7
 	$num = 1;
8
+}
8 9
 $title = $_REQUEST['title'];
9 10
 $db->query('INSERT INTO galactic_post_paper (game_id, paper_id, title) VALUES (' . $db->escapeNumber($player->getGameID()) . ', '.$db->escapeNumber($num).', '.$db->escapeString($title).')');
10 11
 //send em back
Please login to merge, or discard this patch.
engine/Default/government_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@
 block discarded – undo
4 4
 $location = SmrLocation::getLocation($var['LocationID']);
5 5
 if ($location->isHQ()) {
6 6
 	$player->setAlignment(150);
7
-}
8
-elseif ($location->isUG()) {
7
+} elseif ($location->isUG()) {
9 8
 	$player->setAlignment(-150);
10 9
 }
11 10
 
Please login to merge, or discard this patch.
engine/Default/preferences_processing.php 1 patch
Braces   +62 added lines, -62 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,35 +16,38 @@  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'];
25 23
 
26
-	if (empty($new_password))
27
-		create_error('You must enter a non empty password!');
24
+	if (empty($new_password)) {
25
+			create_error('You must enter a non empty password!');
26
+	}
28 27
 
29
-	if (!$account->checkPassword($old_password))
30
-		create_error('Your current password is wrong!');
28
+	if (!$account->checkPassword($old_password)) {
29
+			create_error('Your current password is wrong!');
30
+	}
31 31
 
32
-	if ($new_password != $retype_password)
33
-		create_error('The passwords you entered don\'t match!');
32
+	if ($new_password != $retype_password) {
33
+			create_error('The passwords you entered don\'t match!');
34
+	}
34 35
 
35
-	if ($new_password == $account->getLogin())
36
-		create_error('Your chosen password is invalid!');
36
+	if ($new_password == $account->getLogin()) {
37
+			create_error('Your chosen password is invalid!');
38
+	}
37 39
 
38 40
 	$account->setPassword($new_password);
39 41
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your password.';
40
-}
41
-elseif ($action == 'Change Name') {
42
+} elseif ($action == 'Change Name') {
42 43
 	$HoF_name = trim($_REQUEST['HoF_name']);
43 44
 
44 45
 	$limited_char = 0;
45 46
 	for ($i = 0; $i < strlen($HoF_name); $i++) {
46 47
 		// disallow certain ascii chars
47
-		if (ord($HoF_name[$i]) < 32 || ord($HoF_name[$i]) > 127)
48
-			create_error('Your Hall Of Fame name contains invalid characters!');
48
+		if (ord($HoF_name[$i]) < 32 || ord($HoF_name[$i]) > 127) {
49
+					create_error('Your Hall Of Fame name contains invalid characters!');
50
+		}
49 51
 
50 52
 		// numbers 48..57
51 53
 		// Letters 65..90
@@ -57,23 +59,26 @@  discard block
 block discarded – undo
57 59
 		}
58 60
 	}
59 61
 
60
-	if ($limited_char > 4)
61
-		create_error('You cannot use a name with more than 4 special characters.');
62
+	if ($limited_char > 4) {
63
+			create_error('You cannot use a name with more than 4 special characters.');
64
+	}
62 65
 
63 66
 
64 67
 	//disallow blank names
65
-	if (empty($HoF_name) || $HoF_name == '') create_error('You Hall of Fame name must contain characters!');
68
+	if (empty($HoF_name) || $HoF_name == '') {
69
+		create_error('You Hall of Fame name must contain characters!');
70
+	}
66 71
 
67 72
 	//no duplicates
68 73
 	$db->query('SELECT * FROM account WHERE hof_name = ' . $db->escapeString($HoF_name) . ' AND account_id != '.$db->escapeNumber($account->getAccountID()).' LIMIT 1');
69
-	if ($db->nextRecord()) create_error('Someone is already using that name!');
74
+	if ($db->nextRecord()) {
75
+		create_error('Someone is already using that name!');
76
+	}
70 77
 
71 78
 	// set the HoF name in account stat
72 79
 	$account->setHofName($HoF_name);
73 80
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your hall of fame name.';
74
-}
75
-
76
-elseif ($action == 'Change Discord ID') {
81
+} elseif ($action == 'Change Discord ID') {
77 82
 	$discordId = trim($_REQUEST['discord_id']);
78 83
 
79 84
 	if (empty($discordId)) {
@@ -83,20 +88,21 @@  discard block
 block discarded – undo
83 88
 	} else {
84 89
 		// no duplicates
85 90
 		$db->query('SELECT * FROM account WHERE discord_id =' . $db->escapeString($discordId) . ' AND account_id != '.$db->escapeNumber($account->getAccountID()).' LIMIT 1');
86
-		if ($db->nextRecord()) create_error('Someone is already using that Discord User ID!');
91
+		if ($db->nextRecord()) {
92
+			create_error('Someone is already using that Discord User ID!');
93
+		}
87 94
 
88 95
 		$account->setDiscordId($discordId);
89 96
 		$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your Discord User ID.';
90 97
 	}
91
-}
92
-
93
-elseif ($action == 'Change IRC Nick') {
98
+} elseif ($action == 'Change IRC Nick') {
94 99
 	$ircNick = trim($_REQUEST['irc_nick']);
95 100
 
96 101
 	for ($i = 0; $i < strlen($ircNick); $i++) {
97 102
 		// disallow certain ascii chars (and whitespace!)
98
-		if (ord($ircNick[$i]) < 33 || ord($ircNick[$i]) > 127)
99
-			create_error('Your IRC Nick contains invalid characters!');
103
+		if (ord($ircNick[$i]) < 33 || ord($ircNick[$i]) > 127) {
104
+					create_error('Your IRC Nick contains invalid characters!');
105
+		}
100 106
 	}
101 107
 
102 108
 	// here you can delete your registered irc nick
@@ -107,7 +113,9 @@  discard block
 block discarded – undo
107 113
 
108 114
 		// no duplicates
109 115
 		$db->query('SELECT * FROM account WHERE irc_nick = ' . $db->escapeString($ircNick) . ' AND account_id != '.$db->escapeNumber($account->getAccountID()).' LIMIT 1');
110
-		if ($db->nextRecord()) create_error('Someone is already using that nick!');
116
+		if ($db->nextRecord()) {
117
+			create_error('Someone is already using that nick!');
118
+		}
111 119
 
112 120
 		// save irc nick in db and set message
113 121
 		$account->setIrcNick($ircNick);
@@ -115,8 +123,7 @@  discard block
 block discarded – undo
115 123
 
116 124
 	}
117 125
 
118
-}
119
-elseif ($action == 'Yes') {
126
+} elseif ($action == 'Yes') {
120 127
 	$account_id = $var['account_id'];
121 128
 	$amount = $var['amount'];
122 129
 
@@ -128,33 +135,28 @@  discard block
 block discarded – undo
128 135
 	// add to him
129 136
 	$his_account->increaseSmrCredits($amount);
130 137
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have sent SMR credits.';
131
-}
132
-elseif ($action == 'Change Timezone') {
138
+} elseif ($action == 'Change Timezone') {
133 139
 	$timez = $_REQUEST['timez'];
134
-	if (!is_numeric($timez))
135
-		create_error('Numbers only please');
140
+	if (!is_numeric($timez)) {
141
+			create_error('Numbers only please');
142
+	}
136 143
 
137 144
 	$db->query('UPDATE account SET offset = '.$db->escapeNumber($timez).' WHERE account_id = '.$db->escapeNumber($account->getAccountID()));
138 145
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your time offset.';
139
-}
140
-elseif ($action == 'Change Date Formats') {
146
+} elseif ($action == 'Change Date Formats') {
141 147
 	$account->setShortDateFormat($_REQUEST['dateformat']);
142 148
 	$account->setShortTimeFormat($_REQUEST['timeformat']);
143 149
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your date formats.';
144
-}
145
-elseif ($action == 'Change Images') {
150
+} elseif ($action == 'Change Images') {
146 151
 	$account->setDisplayShipImages($_REQUEST['images']);
147 152
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your ship images preferences.';
148
-}
149
-elseif ($action == 'Change Centering') {
153
+} elseif ($action == 'Change Centering') {
150 154
 	$account->setCenterGalaxyMapOnPlayer($_REQUEST['centergalmap']=='Yes');
151 155
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your centering galaxy map preferences.';
152
-}
153
-else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
156
+} else if ($action == 'Change Size' && is_numeric($_REQUEST['fontsize']) && $_REQUEST['fontsize'] >= 50) {
154 157
 	$account->setFontSize($_REQUEST['fontsize']);
155 158
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your font size.';
156
-}
157
-else if ($action == 'Change CSS Options') {
159
+} else if ($action == 'Change CSS Options') {
158 160
 	$account->setCssLink($_REQUEST['csslink']);
159 161
 	if ($_REQUEST['template'] == 'None') {
160 162
 		$account->setDefaultCSSEnabled(false);
@@ -165,24 +167,20 @@  discard block
 block discarded – undo
165 167
 		$account->setColourScheme($cssColourScheme);
166 168
 	}
167 169
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your CSS options.';
168
-}
169
-else if ($action == 'Change Kamikaze Setting') {
170
+} else if ($action == 'Change Kamikaze Setting') {
170 171
 	$player->setCombatDronesKamikazeOnMines($_REQUEST['kamikaze']=='Yes');
171 172
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your combat drones options.';
172
-}
173
-else if ($action == 'Change Message Setting') {
173
+} else if ($action == 'Change Message Setting') {
174 174
 	$player->setForceDropMessages($_REQUEST['forceDropMessages']=='Yes');
175 175
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your message options.';
176
-}
177
-else if ($action == 'Save Hotkeys') {
176
+} else if ($action == 'Save Hotkeys') {
178 177
 	foreach(AbstractSmrAccount::getDefaultHotkeys() as $hotkey => $binding) {
179 178
 		if(isset($_REQUEST[$hotkey])) {
180 179
 			$account->setHotkey($hotkey, explode(' ', $_REQUEST[$hotkey]));
181 180
 		}
182 181
 	}
183 182
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have saved your hotkeys.';
184
-}
185
-else if (strpos(trim($action),'Alter Player')===0) {
183
+} else if (strpos(trim($action),'Alter Player')===0) {
186 184
 	// trim input now
187 185
 	$player_name = trim($_POST['PlayerName']);
188 186
 
@@ -193,8 +191,9 @@  discard block
 block discarded – undo
193 191
 	$limited_char = 0;
194 192
 	for ($i = 0; $i < strlen($player_name); $i++) {
195 193
 		// disallow certain ascii chars
196
-		if (ord($player_name[$i]) < 32 || ord($player_name[$i]) > 127)
197
-			create_error('The player name contains invalid characters!');
194
+		if (ord($player_name[$i]) < 32 || ord($player_name[$i]) > 127) {
195
+					create_error('The player name contains invalid characters!');
196
+		}
198 197
 
199 198
 		// numbers 48..57
200 199
 		// Letters 65..90
@@ -206,11 +205,13 @@  discard block
 block discarded – undo
206 205
 		}
207 206
 	}
208 207
 
209
-	if ($limited_char > 4)
210
-		create_error('You cannot use a name with more than 4 special characters.');
208
+	if ($limited_char > 4) {
209
+			create_error('You cannot use a name with more than 4 special characters.');
210
+	}
211 211
 
212
-	if (empty($player_name))
213
-		create_error('You must enter a player name!');
212
+	if (empty($player_name)) {
213
+			create_error('You must enter a player name!');
214
+	}
214 215
 
215 216
 	// Escape html elements so the name displays correctly
216 217
 	$player_name = htmlentities($player_name);
@@ -237,8 +238,7 @@  discard block
 block discarded – undo
237 238
 	$news = '<span class="blue">ADMIN</span> Please be advised that ' . $old_name . ' has changed their name to ' . $player->getBBLink() . '</span>';
238 239
 	$db->query('INSERT INTO news (time, news_message, game_id, dead_id,dead_alliance) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ')');
239 240
 	$container['msg'] = '<span class="green">SUCCESS: </span>You have changed your player name.';
240
-}
241
-else if ($action == 'Update Colours') {
241
+} else if ($action == 'Update Colours') {
242 242
 	$friendlyColour = $_REQUEST['friendly_color'];
243 243
 	$neutralColour = $_REQUEST['neutral_color'];
244 244
 	$enemyColour = $_REQUEST['enemy_color'];
Please login to merge, or discard this patch.