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
Push — master ( bc8a60...3938d8 )
by Dan
03:51
created
admin/Default/1.6/check_map.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 	}
21 21
 }
22 22
 $missingLocs = array_diff(array_keys(SmrLocation::getAllLocations()),
23
-                          array_keys($existingLocs));
23
+						  array_keys($existingLocs));
24 24
 $missingLocNames = [];
25 25
 foreach ($missingLocs as $locID) {
26 26
 	$missingLocNames[] = SmrLocation::getLocation($locID)->getName();
Please login to merge, or discard this patch.
lib/Default/Routes/OneWayRoute.class.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,10 +82,11 @@
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	public function getTurnsForRoute() : int {
85
-		if ($this->goodId === GOOD_NOTHING)
86
-			$tradeTurns = 0;
87
-		else
88
-			$tradeTurns = 2 * TURNS_PER_TRADE;
85
+		if ($this->goodId === GOOD_NOTHING) {
86
+					$tradeTurns = 0;
87
+		} else {
88
+					$tradeTurns = 2 * TURNS_PER_TRADE;
89
+		}
89 90
 		return $this->distance->getTurns() + $tradeTurns;
90 91
 	}
91 92
 
Please login to merge, or discard this patch.
lib/Default/AbstractSmrAccount.class.php 2 patches
Spacing   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
10 10
 	protected const USER_RANKINGS_SCORE = array(
11 11
 		// [Stat, a, b]
12 12
 		// Used as: pow(Stat * a, USER_RANKINGS_EACH_STAT_POW) * b
13
-		array(array('Trade','Experience','Total'),.1,0.5),
14
-		array(array('Trade','Money','Profit'),0.00005,0.5),
15
-		array(array('Killing','Kills'),1000,1)
13
+		array(array('Trade', 'Experience', 'Total'), .1, 0.5),
14
+		array(array('Trade', 'Money', 'Profit'), 0.00005, 0.5),
15
+		array(array('Killing', 'Kills'), 1000, 1)
16 16
 		);
17 17
 
18 18
 	protected static $CACHE_ACCOUNTS = array();
19 19
 	protected const DEFAULT_HOTKEYS = array(
20
-		'MoveUp' => array('w','up'),
21
-		'ScanUp' => array('shift+w','shift+up'),
22
-		'MoveLeft' => array('a','left'),
23
-		'ScanLeft' => array('shift+a','shift+left'),
24
-		'MoveRight' => array('d','right'),
25
-		'ScanRight' => array('shift+d','shift+right'),
26
-		'MoveDown' => array('s','down'),
27
-		'ScanDown' => array('shift+s','shift+down'),
28
-		'MoveWarp' => array('e','0'),
29
-		'ScanWarp' => array('shift+e','shift+0'),
20
+		'MoveUp' => array('w', 'up'),
21
+		'ScanUp' => array('shift+w', 'shift+up'),
22
+		'MoveLeft' => array('a', 'left'),
23
+		'ScanLeft' => array('shift+a', 'shift+left'),
24
+		'MoveRight' => array('d', 'right'),
25
+		'ScanRight' => array('shift+d', 'shift+right'),
26
+		'MoveDown' => array('s', 'down'),
27
+		'ScanDown' => array('shift+s', 'shift+down'),
28
+		'MoveWarp' => array('e', '0'),
29
+		'ScanWarp' => array('shift+e', 'shift+0'),
30 30
 		'ScanCurrent' => array('shift+1'),
31 31
 		'CurrentSector' => array('1'),
32 32
 		'LocalMap' => array('2'),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	protected $oldAccountIDs = array();
68 68
 	protected $maxRankAchieved;
69 69
 	protected $referrerID;
70
-	protected $credits;       // SMR credits
70
+	protected $credits; // SMR credits
71 71
 	protected $rewardCredits; // SMR reward credits
72 72
 	protected $dateShort;
73 73
 	protected $timeShort;
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		return self::DEFAULT_HOTKEYS;
89 89
 	}
90 90
 
91
-	public static function getAccount($accountID,$forceUpdate = false) {
92
-		if($forceUpdate || !isset(self::$CACHE_ACCOUNTS[$accountID])) {
91
+	public static function getAccount($accountID, $forceUpdate = false) {
92
+		if ($forceUpdate || !isset(self::$CACHE_ACCOUNTS[$accountID])) {
93 93
 			self::$CACHE_ACCOUNTS[$accountID] = new SmrAccount($accountID);
94 94
 		}
95 95
 		return self::$CACHE_ACCOUNTS[$accountID];
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 	public static function getAccountByName($login, $forceUpdate = false) {
99 99
 		if (empty($login)) { return null; }
100 100
 		$db = new SmrMySqlDatabase();
101
-		$db->query('SELECT account_id FROM account WHERE login = '.$db->escapeString($login).' LIMIT 1');
102
-		if($db->nextRecord())
101
+		$db->query('SELECT account_id FROM account WHERE login = ' . $db->escapeString($login) . ' LIMIT 1');
102
+		if ($db->nextRecord())
103 103
 			return self::getAccount($db->getInt('account_id'), $forceUpdate);
104 104
 		$return = null;
105 105
 		return $return;
106 106
 	}
107 107
 
108
-	public static function getAccountByEmail($email, $forceUpdate=false) {
108
+	public static function getAccountByEmail($email, $forceUpdate = false) {
109 109
 		if (empty($email)) { return null; }
110 110
 		$db = new SmrMySqlDatabase();
111
-		$db->query('SELECT account_id FROM account WHERE email = '.$db->escapeString($email).' LIMIT 1');
111
+		$db->query('SELECT account_id FROM account WHERE email = ' . $db->escapeString($email) . ' LIMIT 1');
112 112
 		if ($db->nextRecord()) {
113 113
 			return self::getAccount($db->getInt('account_id'), $forceUpdate);
114 114
 		} else {
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 		}
117 117
 	}
118 118
 
119
-	public static function getAccountByDiscordId($id, $forceUpdate=false) {
119
+	public static function getAccountByDiscordId($id, $forceUpdate = false) {
120 120
 		if (empty($id)) { return null; }
121 121
 		$db = new SmrMySqlDatabase();
122
-		$db->query('SELECT account_id FROM account where discord_id = '.$db->escapeString($id).' LIMIT 1');
122
+		$db->query('SELECT account_id FROM account where discord_id = ' . $db->escapeString($id) . ' LIMIT 1');
123 123
 		if ($db->nextRecord()) {
124 124
 			return self::getAccount($db->getInt('account_id'), $forceUpdate);
125 125
 		} else {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public static function getAccountByIrcNick($nick, $forceUpdate = false) {
131 131
 		if (empty($nick)) { return null; }
132 132
 		$db = new SmrMySqlDatabase();
133
-		$db->query('SELECT account_id FROM account WHERE irc_nick = '.$db->escapeString($nick).' LIMIT 1');
133
+		$db->query('SELECT account_id FROM account WHERE irc_nick = ' . $db->escapeString($nick) . ' LIMIT 1');
134 134
 		if ($db->nextRecord()) {
135 135
 			return self::getAccount($db->getInt('account_id'), $forceUpdate);
136 136
 		} else {
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 	}
140 140
 
141
-	public static function getAccountBySocialLogin(SocialLogin $social, $forceUpdate=false) {
141
+	public static function getAccountBySocialLogin(SocialLogin $social, $forceUpdate = false) {
142 142
 		if (!$social->isValid()) { return null; }
143 143
 		$db = new SmrMySqlDatabase();
144 144
 		$db->query('SELECT account_id FROM account JOIN account_auth USING(account_id)
145
-		            WHERE login_type = '.$db->escapeString($social->getLoginType()).'
146
-		              AND auth_key = '.$db->escapeString($social->getUserID()).' LIMIT 1');
145
+		            WHERE login_type = '.$db->escapeString($social->getLoginType()) . '
146
+		              AND auth_key = '.$db->escapeString($social->getUserID()) . ' LIMIT 1');
147 147
 		if ($db->nextRecord()) {
148 148
 			return self::getAccount($db->getInt('account_id'), $forceUpdate);
149 149
 		} else {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	}
153 153
 
154 154
 	public static function createAccount($login, $password, $email, $timez, $referral) {
155
-		if($referral!=0) {
155
+		if ($referral != 0) {
156 156
 			// Will throw if referral account doesn't exist
157 157
 			SmrAccount::getAccount($referral);
158 158
 		}
@@ -160,60 +160,60 @@  discard block
 block discarded – undo
160 160
 		$passwordHash = password_hash($password, PASSWORD_DEFAULT);
161 161
 		$db->query('INSERT INTO account (login, password, email, validation_code, last_login, offset,referral_id,hof_name) VALUES(' .
162 162
 			$db->escapeString($login) . ', ' . $db->escapeString($passwordHash) . ', ' . $db->escapeString($email) . ', ' .
163
-			$db->escapeString(random_string(10)) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($timez) . ',' . $db->escapeNumber($referral).','.$db->escapeString($login).')');
163
+			$db->escapeString(random_string(10)) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($timez) . ',' . $db->escapeNumber($referral) . ',' . $db->escapeString($login) . ')');
164 164
 		return self::getAccountByName($login);
165 165
 	}
166 166
 
167 167
 	public static function getUserScoreCaseStatement($db) {
168 168
 		$userRankingTypes = array();
169 169
 		$case = 'FLOOR(SUM(CASE type ';
170
-		foreach(self::USER_RANKINGS_SCORE as $userRankingScore) {
171
-			$userRankingType = $db->escapeArray($userRankingScore[0],false,false,':',false);
170
+		foreach (self::USER_RANKINGS_SCORE as $userRankingScore) {
171
+			$userRankingType = $db->escapeArray($userRankingScore[0], false, false, ':', false);
172 172
 			$userRankingTypes[] = $userRankingType;
173
-			$case.= ' WHEN '.$db->escapeString($userRankingType).' THEN POW(amount*'.$userRankingScore[1].','.SmrAccount::USER_RANKINGS_EACH_STAT_POW.')*'.$userRankingScore[2];
173
+			$case .= ' WHEN ' . $db->escapeString($userRankingType) . ' THEN POW(amount*' . $userRankingScore[1] . ',' . SmrAccount::USER_RANKINGS_EACH_STAT_POW . ')*' . $userRankingScore[2];
174 174
 		}
175 175
 		$case .= ' END))';
176
-		return array('CASE'=>$case,'IN'=>$db->escapeArray($userRankingTypes));
176
+		return array('CASE'=>$case, 'IN'=>$db->escapeArray($userRankingTypes));
177 177
 	}
178 178
 
179 179
 	protected function __construct($accountID) {
180 180
 		$this->db = new SmrMySqlDatabase();
181 181
 		$this->SQL = 'account_id = ' . $this->db->escapeNumber($accountID);
182
-		$this->db->query('SELECT * FROM account WHERE '.$this->SQL.' LIMIT 1');
182
+		$this->db->query('SELECT * FROM account WHERE ' . $this->SQL . ' LIMIT 1');
183 183
 
184 184
 		if ($this->db->nextRecord()) {
185 185
 			$row = $this->db->getRow();
186
-			$this->account_id		= $row['account_id'];
186
+			$this->account_id = $row['account_id'];
187 187
 
188 188
 			$this->login			= $row['login'];
189
-			$this->passwordHash		= $row['password'];
189
+			$this->passwordHash = $row['password'];
190 190
 			$this->email			= $row['email'];
191
-			$this->validated		= $this->db->getBoolean('validated');
191
+			$this->validated = $this->db->getBoolean('validated');
192 192
 
193
-			$this->last_login		= $row['last_login'];
194
-			$this->validation_code 	= $row['validation_code'];
195
-			$this->veteranForced	= $this->db->getBoolean('veteran');
196
-			$this->logging			= $this->db->getBoolean('logging');
193
+			$this->last_login = $row['last_login'];
194
+			$this->validation_code = $row['validation_code'];
195
+			$this->veteranForced = $this->db->getBoolean('veteran');
196
+			$this->logging = $this->db->getBoolean('logging');
197 197
 			$this->offset			= $row['offset'];
198 198
 			$this->images			= $row['images'];
199
-			$this->fontSize			= $row['fontsize'];
199
+			$this->fontSize = $row['fontsize'];
200 200
 
201
-			$this->passwordReset	= $row['password_reset'];
202
-			$this->useAJAX			= $this->db->getBoolean('use_ajax');
203
-			$this->mailBanned		= (int)$row['mail_banned'];
201
+			$this->passwordReset = $row['password_reset'];
202
+			$this->useAJAX = $this->db->getBoolean('use_ajax');
203
+			$this->mailBanned = (int)$row['mail_banned'];
204 204
 			
205
-			$this->friendlyColour 	= $row['friendly_colour'];
206
-			$this->neutralColour 	= $row['neutral_colour'];
207
-			$this->enemyColour 		= $row['enemy_colour'];
205
+			$this->friendlyColour = $row['friendly_colour'];
206
+			$this->neutralColour = $row['neutral_colour'];
207
+			$this->enemyColour = $row['enemy_colour'];
208 208
 
209
-			$this->cssLink			= $row['css_link'];
210
-			$this->defaultCSSEnabled	= $this->db->getBoolean('default_css_enabled');
211
-			$this->centerGalaxyMapOnPlayer	= $this->db->getBoolean('center_galaxy_map_on_player');
209
+			$this->cssLink = $row['css_link'];
210
+			$this->defaultCSSEnabled = $this->db->getBoolean('default_css_enabled');
211
+			$this->centerGalaxyMapOnPlayer = $this->db->getBoolean('center_galaxy_map_on_player');
212 212
 
213 213
 			$this->messageNotifications = $this->db->getObject('message_notifications');
214 214
 			$this->hotkeys = $this->db->getObject('hotkeys');
215
-			foreach(self::DEFAULT_HOTKEYS as $hotkey => $binding) {
216
-				if(!isset($this->hotkeys[$hotkey])) {
215
+			foreach (self::DEFAULT_HOTKEYS as $hotkey => $binding) {
216
+				if (!isset($this->hotkeys[$hotkey])) {
217 217
 					$this->hotkeys[$hotkey] = $binding;
218 218
 				}
219 219
 			}
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 				$this->oldAccountIDs[$databaseName] = $row[$oldColumn];
223 223
 			}
224 224
 
225
-			$this->referrerID		= $row['referral_id'];
226
-			$this->maxRankAchieved	= $row['max_rank_achieved'];
225
+			$this->referrerID = $row['referral_id'];
226
+			$this->maxRankAchieved = $row['max_rank_achieved'];
227 227
 
228 228
 			$this->hofName			= $row['hof_name'];
229 229
 			$this->discordId		= $row['discord_id'];
@@ -233,19 +233,19 @@  discard block
 block discarded – undo
233 233
 			$this->timeShort		= $row['time_short'];
234 234
 
235 235
 			$this->template			= $row['template'];
236
-			$this->colourScheme		= $row['colour_scheme'];
236
+			$this->colourScheme = $row['colour_scheme'];
237 237
 
238
-			if(empty($this->hofName))
239
-				$this->hofName=$this->login;
238
+			if (empty($this->hofName))
239
+				$this->hofName = $this->login;
240 240
 		}
241 241
 		else {
242
-			throw new AccountNotFoundException('Account ID '.$accountID.' does not exist!');
242
+			throw new AccountNotFoundException('Account ID ' . $accountID . ' does not exist!');
243 243
 		}
244 244
 	}
245 245
 
246 246
 	public function isDisabled() {
247 247
 		$this->db->query('SELECT * FROM account_is_closed JOIN closing_reason USING(reason_id) ' .
248
-			'WHERE '.$this->SQL.' LIMIT 1');
248
+			'WHERE ' . $this->SQL . ' LIMIT 1');
249 249
 		if ($this->db->nextRecord()) {
250 250
 			// get the expire time
251 251
 			$expireTime = $this->db->getInt('expires');
@@ -267,64 +267,64 @@  discard block
 block discarded – undo
267 267
 	}
268 268
 
269 269
 	public function update() {
270
-		$this->db->query('UPDATE account SET email = '.$this->db->escapeString($this->email).
271
-			', validation_code = '.$this->db->escapeString($this->validation_code).
272
-			', validated = '.$this->db->escapeBoolean($this->validated).
273
-			', password = '.$this->db->escapeString($this->passwordHash).
274
-			', images = '.$this->db->escapeString($this->images).
275
-			', password_reset = '.$this->db->escapeString($this->passwordReset).
276
-			', use_ajax='.$this->db->escapeBoolean($this->useAJAX).
277
-			', mail_banned='.$this->db->escapeNumber($this->mailBanned).
278
-			', max_rank_achieved='.$this->db->escapeNumber($this->maxRankAchieved).
279
-			', default_css_enabled='.$this->db->escapeBoolean($this->defaultCSSEnabled).
280
-			', center_galaxy_map_on_player='.$this->db->escapeBoolean($this->centerGalaxyMapOnPlayer).
281
-			', message_notifications='.$this->db->escapeObject($this->messageNotifications).
282
-			', hotkeys='.$this->db->escapeObject($this->hotkeys).
283
-			', last_login = '.$this->db->escapeNumber($this->last_login).
284
-			', logging = '.$this->db->escapeBoolean($this->logging).
285
-			', time_short = ' . $this->db->escapeString($this->timeShort).
286
-			', date_short = ' . $this->db->escapeString($this->dateShort).
287
-			', discord_id = ' . $this->db->escapeString($this->discordId, true, true).
288
-			', irc_nick = ' . $this->db->escapeString($this->ircNick, true, true).
289
-			', hof_name = ' . $this->db->escapeString($this->hofName).
290
-			', colour_scheme = ' . $this->db->escapeString($this->colourScheme).
291
-			', fontsize = ' . $this->db->escapeNumber($this->fontSize).
292
-			', css_link = ' . $this->db->escapeString($this->cssLink,true,true).
293
-			', friendly_colour = ' . $this->db->escapeString($this->friendlyColour, true, true).
294
-			', neutral_colour = ' . $this->db->escapeString($this->neutralColour, true, true).
295
-			', enemy_colour = ' . $this->db->escapeString($this->enemyColour, true, true).
296
-			' WHERE '.$this->SQL.' LIMIT 1');
270
+		$this->db->query('UPDATE account SET email = ' . $this->db->escapeString($this->email) .
271
+			', validation_code = ' . $this->db->escapeString($this->validation_code) .
272
+			', validated = ' . $this->db->escapeBoolean($this->validated) .
273
+			', password = ' . $this->db->escapeString($this->passwordHash) .
274
+			', images = ' . $this->db->escapeString($this->images) .
275
+			', password_reset = ' . $this->db->escapeString($this->passwordReset) .
276
+			', use_ajax=' . $this->db->escapeBoolean($this->useAJAX) .
277
+			', mail_banned=' . $this->db->escapeNumber($this->mailBanned) .
278
+			', max_rank_achieved=' . $this->db->escapeNumber($this->maxRankAchieved) .
279
+			', default_css_enabled=' . $this->db->escapeBoolean($this->defaultCSSEnabled) .
280
+			', center_galaxy_map_on_player=' . $this->db->escapeBoolean($this->centerGalaxyMapOnPlayer) .
281
+			', message_notifications=' . $this->db->escapeObject($this->messageNotifications) .
282
+			', hotkeys=' . $this->db->escapeObject($this->hotkeys) .
283
+			', last_login = ' . $this->db->escapeNumber($this->last_login) .
284
+			', logging = ' . $this->db->escapeBoolean($this->logging) .
285
+			', time_short = ' . $this->db->escapeString($this->timeShort) .
286
+			', date_short = ' . $this->db->escapeString($this->dateShort) .
287
+			', discord_id = ' . $this->db->escapeString($this->discordId, true, true) .
288
+			', irc_nick = ' . $this->db->escapeString($this->ircNick, true, true) .
289
+			', hof_name = ' . $this->db->escapeString($this->hofName) .
290
+			', colour_scheme = ' . $this->db->escapeString($this->colourScheme) .
291
+			', fontsize = ' . $this->db->escapeNumber($this->fontSize) .
292
+			', css_link = ' . $this->db->escapeString($this->cssLink, true, true) .
293
+			', friendly_colour = ' . $this->db->escapeString($this->friendlyColour, true, true) .
294
+			', neutral_colour = ' . $this->db->escapeString($this->neutralColour, true, true) .
295
+			', enemy_colour = ' . $this->db->escapeString($this->enemyColour, true, true) .
296
+			' WHERE ' . $this->SQL . ' LIMIT 1');
297 297
 		$this->hasChanged = false;
298 298
 	}
299 299
 
300 300
 	public function updateIP() {
301 301
 		$curr_ip = getIpAddress();
302
-		$this->log(LOG_TYPE_LOGIN, 'logged in from '.$curr_ip);
302
+		$this->log(LOG_TYPE_LOGIN, 'logged in from ' . $curr_ip);
303 303
 
304 304
 		// more than 50 elements in it?
305 305
 
306
-		$this->db->query('SELECT time,ip FROM account_has_ip WHERE '.$this->SQL.' ORDER BY time ASC');
306
+		$this->db->query('SELECT time,ip FROM account_has_ip WHERE ' . $this->SQL . ' ORDER BY time ASC');
307 307
 		if ($this->db->getNumRows() > 50 && $this->db->nextRecord()) {
308 308
 			$delete_time = $this->db->getInt('time');
309 309
 			$delete_ip = $this->db->getField('ip');
310 310
 
311 311
 			$this->db->query('DELETE FROM account_has_ip
312
-				WHERE '.$this->SQL.' AND
313
-				time = '.$this->db->escapeNumber($delete_time).' AND
312
+				WHERE '.$this->SQL . ' AND
313
+				time = '.$this->db->escapeNumber($delete_time) . ' AND
314 314
 				ip = '.$this->db->escapeString($delete_ip));
315 315
 		}
316
-		list($fi,$se,$th,$fo) = preg_split('/[.\s,]/', $curr_ip, 4);
316
+		list($fi, $se, $th, $fo) = preg_split('/[.\s,]/', $curr_ip, 4);
317 317
 		if ($curr_ip != 'unknown' && $curr_ip != 'unknown...' && $curr_ip != 'unknown, unknown') {
318
-			$curr_ip = $fi.'.'.$se.'.'.$th.'.'.$fo;
318
+			$curr_ip = $fi . '.' . $se . '.' . $th . '.' . $fo;
319 319
 			$host = gethostbyaddr($curr_ip);
320 320
 		} else $host = 'unknown';
321 321
 
322 322
 		// save...first make sure there isn't one for these keys (someone could double click and get error)
323
-		$this->db->query('REPLACE INTO account_has_ip (account_id, time, ip, host) VALUES ('.$this->db->escapeNumber($this->account_id).', '.$this->db->escapeNumber(TIME).', '.$this->db->escapeString($curr_ip).', '.$this->db->escapeString($host).')');
323
+		$this->db->query('REPLACE INTO account_has_ip (account_id, time, ip, host) VALUES (' . $this->db->escapeNumber($this->account_id) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($curr_ip) . ', ' . $this->db->escapeString($host) . ')');
324 324
 	}
325 325
 
326 326
 	public function updateLastLogin() {
327
-		if($this->last_login == TIME)
327
+		if ($this->last_login == TIME)
328 328
 			return;
329 329
 		$this->last_login = TIME;
330 330
 		$this->hasChanged = true;
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 	}
337 337
 
338 338
 	public function setLoggingEnabled($bool) {
339
-		if($this->logging==$bool)
339
+		if ($this->logging == $bool)
340 340
 			return;
341
-		$this->logging=$bool;
341
+		$this->logging = $bool;
342 342
 		$this->hasChanged = true;
343 343
 		$this->update();
344 344
 	}
@@ -358,26 +358,26 @@  discard block
 block discarded – undo
358 358
 	}
359 359
 
360 360
 	public function isNPC() {
361
-		if(!isset($this->npc)) {
362
-			$this->db->query('SELECT login FROM npc_logins WHERE login = '.$this->db->escapeString($this->getLogin()).' LIMIT 1;');
361
+		if (!isset($this->npc)) {
362
+			$this->db->query('SELECT login FROM npc_logins WHERE login = ' . $this->db->escapeString($this->getLogin()) . ' LIMIT 1;');
363 363
 			$this->npc = $this->db->nextRecord();
364 364
 		}
365 365
 		return $this->npc;
366 366
 	}
367 367
 
368 368
 	protected function getHOFData() {
369
-		if(!isset($this->HOF)) {
369
+		if (!isset($this->HOF)) {
370 370
 			//Get Player HOF
371 371
 			$this->db->query('SELECT type,sum(amount) as amount FROM player_hof WHERE ' . $this->SQL . ' AND game_id IN (SELECT game_id FROM game WHERE ignore_stats = \'FALSE\') GROUP BY type');
372 372
 			$this->HOF = array();
373
-			while($this->db->nextRecord()) {
374
-				$hof =& $this->HOF;
375
-				$typeList = explode(':',$this->db->getField('type'));
376
-				foreach($typeList as $type) {
377
-					if(!isset($hof[$type])) {
373
+			while ($this->db->nextRecord()) {
374
+				$hof = & $this->HOF;
375
+				$typeList = explode(':', $this->db->getField('type'));
376
+				foreach ($typeList as $type) {
377
+					if (!isset($hof[$type])) {
378 378
 						$hof[$type] = array();
379 379
 					}
380
-					$hof =& $hof[$type];
380
+					$hof = & $hof[$type];
381 381
 				}
382 382
 				$hof = $this->db->getFloat('amount');
383 383
 			}
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 
387 387
 	public function getHOF(array $typeList = null) {
388 388
 		$this->getHOFData();
389
-		if($typeList==null)
389
+		if ($typeList == null)
390 390
 			return $this->HOF;
391
-		$hof=$this->HOF;
392
-		foreach($typeList as $type) {
393
-			if(!isset($hof[$type]))
391
+		$hof = $this->HOF;
392
+		foreach ($typeList as $type) {
393
+			if (!isset($hof[$type]))
394 394
 				return 0;
395 395
 			$hof = $hof[$type];
396 396
 		}
@@ -399,58 +399,58 @@  discard block
 block discarded – undo
399 399
 
400 400
 	public function getRankName() {
401 401
 		$rankings = Globals::getUserRanking();
402
-		if(isset($rankings[$this->getRank()]))
402
+		if (isset($rankings[$this->getRank()]))
403 403
 			return $rankings[$this->getRank()];
404 404
 		else
405 405
 			return end($rankings);
406 406
 	}
407 407
 
408 408
 	public function getScore() {
409
-		if(!isset($this->score)) {
410
-			$score=0;
411
-			foreach($this->getIndividualScores() as $each) {
412
-				$score+=$each['Score'];
409
+		if (!isset($this->score)) {
410
+			$score = 0;
411
+			foreach ($this->getIndividualScores() as $each) {
412
+				$score += $each['Score'];
413 413
 			}
414
-			$this->score=round($score);
414
+			$this->score = round($score);
415 415
 		}
416 416
 		return $this->score;
417 417
 	}
418 418
 
419 419
 	public function getIndividualScores(SmrPlayer $player = null) {
420
-		$gameID=0;
421
-		if($player!=null)
420
+		$gameID = 0;
421
+		if ($player != null)
422 422
 			$gameID = $player->getGameID();
423
-		if(!isset($this->individualScores[$gameID])) {
423
+		if (!isset($this->individualScores[$gameID])) {
424 424
 			$this->individualScores[$gameID] = array();
425
-			foreach(self::USER_RANKINGS_SCORE as $statScore) {
426
-				if($player==null)
425
+			foreach (self::USER_RANKINGS_SCORE as $statScore) {
426
+				if ($player == null)
427 427
 					$stat = $this->getHOF($statScore[0]);
428 428
 				else
429 429
 					$stat = $player->getHOF($statScore[0]);
430
-				$this->individualScores[$gameID][]=array('Stat'=>$statScore[0],'Score'=>pow($stat*$statScore[1],self::USER_RANKINGS_EACH_STAT_POW)*$statScore[2]);
430
+				$this->individualScores[$gameID][] = array('Stat'=>$statScore[0], 'Score'=>pow($stat * $statScore[1], self::USER_RANKINGS_EACH_STAT_POW) * $statScore[2]);
431 431
 			}
432 432
 		}
433 433
 		return $this->individualScores[$gameID];
434 434
 	}
435 435
 
436 436
 	public function getRank() : int {
437
-		$rank = ICeil(pow($this->getScore(),self::USER_RANKINGS_TOTAL_SCORE_POW)/self::USER_RANKINGS_RANK_BOUNDARY);
438
-		if($rank<1)
439
-			$rank=1;
440
-		if($rank > $this->maxRankAchieved)
437
+		$rank = ICeil(pow($this->getScore(), self::USER_RANKINGS_TOTAL_SCORE_POW) / self::USER_RANKINGS_RANK_BOUNDARY);
438
+		if ($rank < 1)
439
+			$rank = 1;
440
+		if ($rank > $this->maxRankAchieved)
441 441
 			$this->updateMaxRankAchieved($rank);
442 442
 		return $rank;
443 443
 	}
444 444
 
445 445
 	protected function updateMaxRankAchieved($rank) {
446
-		if($rank <= $this->maxRankAchieved)
446
+		if ($rank <= $this->maxRankAchieved)
447 447
 			throw new Exception('Trying to set max rank achieved to a lower value: ' . $rank);
448 448
 		$delta = $rank - $this->maxRankAchieved;
449
-		if($this->hasReferrer()) {
449
+		if ($this->hasReferrer()) {
450 450
 			$this->getReferrer()->increaseSmrRewardCredits($delta * CREDITS_PER_DOLLAR);
451 451
 		}
452
-		$this->maxRankAchieved+=$delta;
453
-		$this->hasChanged=true;
452
+		$this->maxRankAchieved += $delta;
453
+		$this->hasChanged = true;
454 454
 		$this->update();
455 455
 	}
456 456
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	}
460 460
 
461 461
 	public function hasReferrer() {
462
-		return $this->referrerID>0;
462
+		return $this->referrerID > 0;
463 463
 	}
464 464
 
465 465
 	public function getReferrer() {
@@ -470,15 +470,15 @@  discard block
 block discarded – undo
470 470
 		if ($this->isLoggingEnabled()) {
471 471
 			$this->db->query('INSERT INTO account_has_logs ' .
472 472
 				'(account_id, microtime, log_type_id, message, sector_id) ' .
473
-				'VALUES('.$this->db->escapeNumber($this->account_id).', '. $this->db->escapeMicrotime(MICRO_TIME) . ', '.$this->db->escapeNumber($log_type_id).', ' . $this->db->escapeString($msg) . ', '.$this->db->escapeNumber($sector_id).')');
473
+				'VALUES(' . $this->db->escapeNumber($this->account_id) . ', ' . $this->db->escapeMicrotime(MICRO_TIME) . ', ' . $this->db->escapeNumber($log_type_id) . ', ' . $this->db->escapeString($msg) . ', ' . $this->db->escapeNumber($sector_id) . ')');
474 474
 		}
475 475
 	}
476 476
 
477 477
 	protected function getSmrCreditsData() {
478
-		if(!isset($this->credits)||!isset($this->rewardCredits)) {
478
+		if (!isset($this->credits) || !isset($this->rewardCredits)) {
479 479
 			$this->credits = 0;
480 480
 			$this->rewardCredits = 0;
481
-			$this->db->query('SELECT * FROM account_has_credits WHERE '.$this->SQL.' LIMIT 1');
481
+			$this->db->query('SELECT * FROM account_has_credits WHERE ' . $this->SQL . ' LIMIT 1');
482 482
 			if ($this->db->nextRecord()) {
483 483
 				$this->credits = $this->db->getInt('credits_left');
484 484
 				$this->rewardCredits = $this->db->getInt('reward_credits');
@@ -491,26 +491,26 @@  discard block
 block discarded – undo
491 491
 	}
492 492
 
493 493
 	public function decreaseTotalSmrCredits($totalCredits) {
494
-		if($totalCredits==0)
494
+		if ($totalCredits == 0)
495 495
 			return;
496
-		if($totalCredits<0)
496
+		if ($totalCredits < 0)
497 497
 			throw new Exception('You cannot use negative total credits');
498
-		if($totalCredits>$this->getTotalSmrCredits())
498
+		if ($totalCredits > $this->getTotalSmrCredits())
499 499
 			throw new Exception('You do not have that many credits in total to use');
500 500
 
501
-		$rewardCredits=$this->rewardCredits;
502
-		$credits=$this->credits;
503
-		$rewardCredits-=$totalCredits;
504
-		if($rewardCredits<0) {
505
-			$credits+=$rewardCredits;
506
-			$rewardCredits=0;
501
+		$rewardCredits = $this->rewardCredits;
502
+		$credits = $this->credits;
503
+		$rewardCredits -= $totalCredits;
504
+		if ($rewardCredits < 0) {
505
+			$credits += $rewardCredits;
506
+			$rewardCredits = 0;
507 507
 		}
508
-		if($this->credits==0 && $this->rewardCredits==0)
509
-			$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).','.$this->db->escapeNumber($rewardCredits).')');
508
+		if ($this->credits == 0 && $this->rewardCredits == 0)
509
+			$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left, reward_credits) VALUES(' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($credits) . ',' . $this->db->escapeNumber($rewardCredits) . ')');
510 510
 		else
511
-			$this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).', reward_credits='.$this->db->escapeNumber($rewardCredits).' WHERE '.$this->SQL.' LIMIT 1');
512
-		$this->credits=$credits;
513
-		$this->rewardCredits=$rewardCredits;
511
+			$this->db->query('UPDATE account_has_credits SET credits_left=' . $this->db->escapeNumber($credits) . ', reward_credits=' . $this->db->escapeNumber($rewardCredits) . ' WHERE ' . $this->SQL . ' LIMIT 1');
512
+		$this->credits = $credits;
513
+		$this->rewardCredits = $rewardCredits;
514 514
 	}
515 515
 
516 516
 	public function getSmrCredits() {
@@ -524,49 +524,49 @@  discard block
 block discarded – undo
524 524
 	}
525 525
 
526 526
 	public function setSmrCredits($credits) {
527
-		if($this->getSmrCredits()==$credits)
527
+		if ($this->getSmrCredits() == $credits)
528 528
 			return;
529
-		if($this->credits==0 && $this->rewardCredits==0)
530
-			$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')');
529
+		if ($this->credits == 0 && $this->rewardCredits == 0)
530
+			$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left) VALUES(' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($credits) . ')');
531 531
 		else
532
-			$this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1');
533
-		$this->credits=$credits;
532
+			$this->db->query('UPDATE account_has_credits SET credits_left=' . $this->db->escapeNumber($credits) . ' WHERE ' . $this->SQL . ' LIMIT 1');
533
+		$this->credits = $credits;
534 534
 	}
535 535
 
536 536
 	public function increaseSmrCredits($credits) {
537
-		if($credits==0)
537
+		if ($credits == 0)
538 538
 			return;
539
-		if($credits<0)
539
+		if ($credits < 0)
540 540
 			throw new Exception('You cannot gain negative credits');
541
-		$this->setSmrCredits($this->getSmrCredits()+$credits);
541
+		$this->setSmrCredits($this->getSmrCredits() + $credits);
542 542
 	}
543 543
 
544 544
 	public function decreaseSmrCredits($credits) {
545
-		if($credits==0)
545
+		if ($credits == 0)
546 546
 			return;
547
-		if($credits<0)
547
+		if ($credits < 0)
548 548
 			throw new Exception('You cannot use negative credits');
549
-		if($credits>$this->getSmrCredits())
549
+		if ($credits > $this->getSmrCredits())
550 550
 			throw new Exception('You cannot use more credits than you have');
551
-		$this->setSmrCredits($this->getSmrCredits()-$credits);
551
+		$this->setSmrCredits($this->getSmrCredits() - $credits);
552 552
 	}
553 553
 
554 554
 	public function setSmrRewardCredits($credits) {
555
-		if($this->getSmrRewardCredits()==$credits)
555
+		if ($this->getSmrRewardCredits() == $credits)
556 556
 			return;
557
-		if($this->credits==0 && $this->rewardCredits==0)
558
-			$this->db->query('REPLACE INTO account_has_credits (account_id, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')');
557
+		if ($this->credits == 0 && $this->rewardCredits == 0)
558
+			$this->db->query('REPLACE INTO account_has_credits (account_id, reward_credits) VALUES(' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($credits) . ')');
559 559
 		else
560
-			$this->db->query('UPDATE account_has_credits SET reward_credits='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1');
561
-		$this->rewardCredits=$credits;
560
+			$this->db->query('UPDATE account_has_credits SET reward_credits=' . $this->db->escapeNumber($credits) . ' WHERE ' . $this->SQL . ' LIMIT 1');
561
+		$this->rewardCredits = $credits;
562 562
 	}
563 563
 
564 564
 	public function increaseSmrRewardCredits($credits) {
565
-		if($credits==0)
565
+		if ($credits == 0)
566 566
 			return;
567
-		if($credits<0)
567
+		if ($credits < 0)
568 568
 			throw new Exception('You cannot gain negative reward credits');
569
-		$this->setSmrRewardCredits($this->getSmrRewardCredits()+$credits);
569
+		$this->setSmrRewardCredits($this->getSmrRewardCredits() + $credits);
570 570
 	}
571 571
 
572 572
 	public function sendMessageToBox($boxTypeID, $message) {
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 		self::doMessageSendingToBox($this->getAccountID(), $boxTypeID, $message);
575 575
 	}
576 576
 
577
-	public static function doMessageSendingToBox($senderID, $boxTypeID, $message, $gameID=0) {
577
+	public static function doMessageSendingToBox($senderID, $boxTypeID, $message, $gameID = 0) {
578 578
 		$db = new SmrMySqlDatabase();
579 579
 		// send him the message
580 580
 		$db->query('INSERT INTO message_boxes
@@ -597,13 +597,13 @@  discard block
 block discarded – undo
597 597
 	}
598 598
 
599 599
 	public function getOldAccountID($dbName) {
600
-		return isset($this->oldAccountIDs[$dbName])?$this->oldAccountIDs[$dbName]:0;
600
+		return isset($this->oldAccountIDs[$dbName]) ? $this->oldAccountIDs[$dbName] : 0;
601 601
 	}
602 602
 
603
-	public function hasOldAccountID($dbName=false) {
604
-		if($dbName===false)
605
-			return count($this->getOldAccountIDs())!=0;
606
-		return $this->getOldAccountID($dbName)!=0;
603
+	public function hasOldAccountID($dbName = false) {
604
+		if ($dbName === false)
605
+			return count($this->getOldAccountIDs()) != 0;
606
+		return $this->getOldAccountID($dbName) != 0;
607 607
 	}
608 608
 
609 609
 	public function getLogin() {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	}
616 616
 
617 617
 	public function setEmail($email) {
618
-		if($this->email==$email) {
618
+		if ($this->email == $email) {
619 619
 			return;
620 620
 		}
621 621
 		$this->email = $email;
@@ -632,14 +632,14 @@  discard block
 block discarded – undo
632 632
 
633 633
 		// check if the host got a MX or at least an A entry
634 634
 		if (!checkdnsrr($host, 'MX') && !checkdnsrr($host, 'A')) {
635
-			create_error('This is not a valid email address! The domain '.$host.' does not exist.');
635
+			create_error('This is not a valid email address! The domain ' . $host . ' does not exist.');
636 636
 		}
637 637
 
638 638
 		if (strstr($email, ' ')) {
639 639
 			create_error('The email is invalid! It cannot contain any spaces.');
640 640
 		}
641 641
 
642
-		$this->db->query('SELECT 1 FROM account WHERE email = '.$this->db->escapeString($email).' and account_id != ' . $this->db->escapeNumber($this->getAccountID()) . ' LIMIT 1');
642
+		$this->db->query('SELECT 1 FROM account WHERE email = ' . $this->db->escapeString($email) . ' and account_id != ' . $this->db->escapeNumber($this->getAccountID()) . ' LIMIT 1');
643 643
 		if ($this->db->getNumRows() > 0) {
644 644
 			create_error('This email address is already registered.');
645 645
 		}
@@ -650,12 +650,12 @@  discard block
 block discarded – undo
650 650
 
651 651
 		// remember when we sent validation code
652 652
 		$this->db->query('REPLACE INTO notification (notification_type, account_id, time)
653
-				VALUES(\'validation_code\', '.$this->db->escapeNumber($this->getAccountID()).', ' . $this->db->escapeNumber(TIME) . ')');
653
+				VALUES(\'validation_code\', '.$this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber(TIME) . ')');
654 654
 
655 655
 		$emailMessage =
656
-			'You changed your email address registered with SMR and need to revalidate now!'.EOL.EOL.
657
-			'   Your new validation code is: '.$this->getValidationCode().EOL.EOL.
658
-			'The Space Merchant Realms server is on the web at '.URL;
656
+			'You changed your email address registered with SMR and need to revalidate now!' . EOL . EOL .
657
+			'   Your new validation code is: ' . $this->getValidationCode() . EOL . EOL .
658
+			'The Space Merchant Realms server is on the web at ' . URL;
659 659
 
660 660
 		$mail = setupMailer();
661 661
 		$mail->Subject = 'Your validation code!';
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	}
682 682
 
683 683
 	public function setFontSize($size) {
684
-		if($this->fontSize==$size)
684
+		if ($this->fontSize == $size)
685 685
 			return;
686 686
 		$this->fontSize = $size;
687 687
 		$this->hasChanged = true;
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 
696 696
 	// sets the extra CSS file linked in preferences
697 697
 	public function setCssLink($link) {
698
-		if($this->cssLink==$link)
698
+		if ($this->cssLink == $link)
699 699
 			return;
700 700
 		$this->cssLink = $link;
701 701
 		$this->hasChanged = true;
@@ -707,11 +707,11 @@  discard block
 block discarded – undo
707 707
 	}
708 708
 
709 709
 	public function setTemplate($template) {
710
-		if($this->template==$template)
710
+		if ($this->template == $template)
711 711
 			return;
712
-		if(!in_array($template,array_keys(Globals::getAvailableTemplates())))
713
-			throw new Exception('Template not allowed: '.$template);
714
-		$this->db->query('UPDATE account SET template = ' . $this->db->escapeString($template) . ' WHERE '.$this->SQL.' LIMIT 1');
712
+		if (!in_array($template, array_keys(Globals::getAvailableTemplates())))
713
+			throw new Exception('Template not allowed: ' . $template);
714
+		$this->db->query('UPDATE account SET template = ' . $this->db->escapeString($template) . ' WHERE ' . $this->SQL . ' LIMIT 1');
715 715
 		$this->template = $template;
716 716
 		$colourSchemes = Globals::getAvailableColourSchemes($template);
717 717
 		$this->setColourScheme($colourSchemes[0]);
@@ -722,10 +722,10 @@  discard block
 block discarded – undo
722 722
 	}
723 723
 
724 724
 	public function setColourScheme($colourScheme) {
725
-		if($this->colourScheme==$colourScheme)
725
+		if ($this->colourScheme == $colourScheme)
726 726
 			return;
727
-		if(!in_array($colourScheme,array_keys(Globals::getAvailableColourSchemes($this->getTemplate()))))
728
-			throw new Exception('Colour scheme not allowed: '.$colourScheme);
727
+		if (!in_array($colourScheme, array_keys(Globals::getAvailableColourSchemes($this->getTemplate()))))
728
+			throw new Exception('Colour scheme not allowed: ' . $colourScheme);
729 729
 		$this->colourScheme = $colourScheme;
730 730
 		$this->hasChanged = true;
731 731
 		$this->update();
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 * The Hall Of Fame name is not html-escaped in the database, so to display
746 746
 	 * it correctly we must escape html entities.
747 747
 	 */
748
-	public function getHofDisplayName($linked=false) {
748
+	public function getHofDisplayName($linked = false) {
749 749
 		$hofDisplayName = htmlspecialchars($this->getHofName());
750 750
 		if ($linked) {
751 751
 			return '<a href="' . $this->getPersonalHofHREF() . '">' . $hofDisplayName . '</a>';
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	}
760 760
 
761 761
 	public function setHofName($name) {
762
-		if($this->hofName==$name)
762
+		if ($this->hofName == $name)
763 763
 			return;
764 764
 		$this->hofName = $name;
765 765
 		$this->hasChanged = true;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	}
772 772
 
773 773
 	public function setIrcNick($nick) {
774
-		if($this->ircNick==$nick)
774
+		if ($this->ircNick == $nick)
775 775
 			return;
776 776
 		$this->ircNick = $nick;
777 777
 		$this->hasChanged = true;
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	}
793 793
 
794 794
 	public function getReferralLink() {
795
-		return URL . '/login_create.php?ref='.$this->getAccountID();
795
+		return URL . '/login_create.php?ref=' . $this->getAccountID();
796 796
 	}
797 797
 
798 798
 	public function getShortDateFormat() {
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	}
801 801
 
802 802
 	public function setShortDateFormat($format) {
803
-		if($this->dateShort==$format)
803
+		if ($this->dateShort == $format)
804 804
 			return;
805 805
 		$this->dateShort = $format;
806 806
 		$this->hasChanged = true;
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	}
813 813
 
814 814
 	public function setShortTimeFormat($format) {
815
-		if($this->timeShort==$format)
815
+		if ($this->timeShort == $format)
816 816
 			return;
817 817
 		$this->timeShort = $format;
818 818
 		$this->hasChanged = true;
@@ -824,15 +824,15 @@  discard block
 block discarded – undo
824 824
 	}
825 825
 
826 826
 	protected function setValidationCode($code) {
827
-		if($this->validation_code == $code)
827
+		if ($this->validation_code == $code)
828 828
 			return;
829
-		$this->validation_code=$code;
830
-		$this->hasChanged=true;
829
+		$this->validation_code = $code;
830
+		$this->hasChanged = true;
831 831
 		$this->update();
832 832
 	}
833 833
 
834 834
 	public function setValidated($bool) {
835
-		if($this->validated == $bool)
835
+		if ($this->validated == $bool)
836 836
 			return;
837 837
 		$this->validated = $bool;
838 838
 		$this->hasChanged = true;
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 	}
845 845
 
846 846
 	public function isLoggedIn() {
847
-		$this->db->query('SELECT 1 FROM active_session WHERE account_id = '.$this->db->escapeNumber($this->getAccountID()).' LIMIT 1');
847
+		$this->db->query('SELECT 1 FROM active_session WHERE account_id = ' . $this->db->escapeNumber($this->getAccountID()) . ' LIMIT 1');
848 848
 		return $this->db->nextRecord();
849 849
 	}
850 850
 
@@ -885,15 +885,15 @@  discard block
 block discarded – undo
885 885
 		$this->update();
886 886
 	}
887 887
 
888
-	public function addAuthMethod($loginType,$authKey) {
889
-		$this->db->query('SELECT account_id FROM account_auth WHERE login_type='.$this->db->escapeString($loginType).' AND auth_key = '.$this->db->escapeString($authKey).';');
890
-		if($this->db->nextRecord()) {
891
-			if($this->db->getInt('account_id')!=$this->getAccountID()) {
888
+	public function addAuthMethod($loginType, $authKey) {
889
+		$this->db->query('SELECT account_id FROM account_auth WHERE login_type=' . $this->db->escapeString($loginType) . ' AND auth_key = ' . $this->db->escapeString($authKey) . ';');
890
+		if ($this->db->nextRecord()) {
891
+			if ($this->db->getInt('account_id') != $this->getAccountID()) {
892 892
 				throw new Exception('Another account already uses this form of auth.');
893 893
 			}
894 894
 			return true;
895 895
 		}
896
-		$this->db->query('INSERT INTO account_auth values ('.$this->db->escapeNumber($this->getAccountID()).','.$this->db->escapeString($loginType).','.$this->db->escapeString($authKey).');');
896
+		$this->db->query('INSERT INTO account_auth values (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeString($loginType) . ',' . $this->db->escapeString($authKey) . ');');
897 897
 		return true;
898 898
 	}
899 899
 
@@ -906,10 +906,10 @@  discard block
 block discarded – undo
906 906
 	}
907 907
 
908 908
 	protected function setPasswordReset($passwordReset) {
909
-		if($this->passwordReset == $passwordReset)
909
+		if ($this->passwordReset == $passwordReset)
910 910
 			return;
911
-		$this->passwordReset=$passwordReset;
912
-		$this->hasChanged=true;
911
+		$this->passwordReset = $passwordReset;
912
+		$this->hasChanged = true;
913 913
 		$this->update();
914 914
 	}
915 915
 
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 	}
919 919
 
920 920
 	public function setDisplayShipImages($yesNo) {
921
-		if($this->images == $yesNo)
921
+		if ($this->images == $yesNo)
922 922
 			return;
923 923
 		$this->images = $yesNo;
924 924
 		$this->hasChanged = true;
@@ -930,10 +930,10 @@  discard block
 block discarded – undo
930 930
 	}
931 931
 
932 932
 	public function setUseAJAX($bool) {
933
-		if($this->useAJAX == $bool)
933
+		if ($this->useAJAX == $bool)
934 934
 			return;
935
-		$this->useAJAX=$bool;
936
-		$this->hasChanged=true;
935
+		$this->useAJAX = $bool;
936
+		$this->hasChanged = true;
937 937
 		$this->update();
938 938
 	}
939 939
 
@@ -942,16 +942,16 @@  discard block
 block discarded – undo
942 942
 	}
943 943
 
944 944
 	public function setDefaultCSSEnabled($bool) {
945
-		if($this->defaultCSSEnabled == $bool)
945
+		if ($this->defaultCSSEnabled == $bool)
946 946
 			return;
947
-		$this->defaultCSSEnabled=$bool;
948
-		$this->hasChanged=true;
947
+		$this->defaultCSSEnabled = $bool;
948
+		$this->hasChanged = true;
949 949
 		$this->update();
950 950
 	}
951 951
 
952 952
 	public function getHotkeys($hotkeyType = false) {
953
-		if($hotkeyType!==false) {
954
-			if(isset($this->hotkeys[$hotkeyType])) {
953
+		if ($hotkeyType !== false) {
954
+			if (isset($this->hotkeys[$hotkeyType])) {
955 955
 				return $this->hotkeys[$hotkeyType];
956 956
 			}
957 957
 			else {
@@ -961,42 +961,42 @@  discard block
 block discarded – undo
961 961
 		return $this->hotkeys;
962 962
 	}
963 963
 
964
-	public function setHotkey($hotkeyType,$binding) {
965
-		if($this->getHotkeys($hotkeyType) == $binding)
964
+	public function setHotkey($hotkeyType, $binding) {
965
+		if ($this->getHotkeys($hotkeyType) == $binding)
966 966
 			return;
967 967
 		$this->hotkeys[$hotkeyType] = $binding;
968
-		$this->hasChanged=true;
968
+		$this->hasChanged = true;
969 969
 		$this->update();
970 970
 	}
971 971
 
972 972
 	public function isReceivingMessageNotifications($messageTypeID) {
973
-		return isset($this->messageNotifications[$messageTypeID])?$this->messageNotifications[$messageTypeID]>0:false;
973
+		return isset($this->messageNotifications[$messageTypeID]) ? $this->messageNotifications[$messageTypeID] > 0 : false;
974 974
 	}
975 975
 
976 976
 	public function getMessageNotifications($messageTypeID) {
977
-		return isset($this->messageNotifications[$messageTypeID])?$this->messageNotifications[$messageTypeID]:0;
977
+		return isset($this->messageNotifications[$messageTypeID]) ? $this->messageNotifications[$messageTypeID] : 0;
978 978
 	}
979 979
 
980
-	public function setMessageNotifications($messageTypeID,$num) {
981
-		if($this->getMessageNotifications($messageTypeID) == $num)
980
+	public function setMessageNotifications($messageTypeID, $num) {
981
+		if ($this->getMessageNotifications($messageTypeID) == $num)
982 982
 			return;
983
-		$this->messageNotifications[$messageTypeID]=$num;
984
-		$this->hasChanged=true;
983
+		$this->messageNotifications[$messageTypeID] = $num;
984
+		$this->hasChanged = true;
985 985
 		$this->update();
986 986
 	}
987 987
 
988
-	public function increaseMessageNotifications($messageTypeID,$num) {
989
-		if($num==0)
988
+	public function increaseMessageNotifications($messageTypeID, $num) {
989
+		if ($num == 0)
990 990
 			return;
991
-		if($num<0)
991
+		if ($num < 0)
992 992
 			throw new Exception('You cannot increase by a negative amount');
993 993
 		$this->setMessageNotifications($messageTypeID, $this->getMessageNotifications($messageTypeID) + $num);
994 994
 	}
995 995
 
996
-	public function decreaseMessageNotifications($messageTypeID,$num) {
997
-		if($num==0)
996
+	public function decreaseMessageNotifications($messageTypeID, $num) {
997
+		if ($num == 0)
998 998
 			return;
999
-		if($num<0)
999
+		if ($num < 0)
1000 1000
 			throw new Exception('You cannot decrease by a negative amount');
1001 1001
 		$this->setMessageNotifications($messageTypeID, $this->getMessageNotifications($messageTypeID) - $num);
1002 1002
 	}
@@ -1006,10 +1006,10 @@  discard block
 block discarded – undo
1006 1006
 	}
1007 1007
 
1008 1008
 	public function setCenterGalaxyMapOnPlayer($bool) {
1009
-		if($this->centerGalaxyMapOnPlayer == $bool)
1009
+		if ($this->centerGalaxyMapOnPlayer == $bool)
1010 1010
 			return;
1011
-		$this->centerGalaxyMapOnPlayer=$bool;
1012
-		$this->hasChanged=true;
1011
+		$this->centerGalaxyMapOnPlayer = $bool;
1012
+		$this->hasChanged = true;
1013 1013
 		$this->update();
1014 1014
 	}
1015 1015
 
@@ -1018,26 +1018,26 @@  discard block
 block discarded – undo
1018 1018
 	}
1019 1019
 
1020 1020
 	public function isMailBanned() {
1021
-		return $this->mailBanned>TIME;
1021
+		return $this->mailBanned > TIME;
1022 1022
 	}
1023 1023
 
1024 1024
 	public function setMailBanned($time) {
1025
-		if($this->mailBanned == $time)
1025
+		if ($this->mailBanned == $time)
1026 1026
 			return;
1027
-		$this->mailBanned=$time;
1028
-		$this->hasChanged=true;
1027
+		$this->mailBanned = $time;
1028
+		$this->hasChanged = true;
1029 1029
 	}
1030 1030
 
1031 1031
 	public function increaseMailBanned($increaseTime) {
1032
-		$time = max(TIME,$this->getMailBanned());
1033
-		$this->setMailBanned($time+$increaseTime);
1032
+		$time = max(TIME, $this->getMailBanned());
1033
+		$this->setMailBanned($time + $increaseTime);
1034 1034
 	}
1035 1035
 	
1036 1036
 	public function getPermissions() {
1037
-		if(!isset($this->permissions)) {
1037
+		if (!isset($this->permissions)) {
1038 1038
 			$this->permissions = array();
1039 1039
 			$this->db->query('SELECT permission_id FROM account_has_permission WHERE ' . $this->SQL);
1040
-			while($this->db->nextRecord()) {
1040
+			while ($this->db->nextRecord()) {
1041 1041
 				$this->permissions[$this->db->getInt('permission_id')] = true;
1042 1042
 			}
1043 1043
 		}
@@ -1046,28 +1046,28 @@  discard block
 block discarded – undo
1046 1046
 
1047 1047
 	public function hasPermission($permissionID = false) {
1048 1048
 		$permissions = $this->getPermissions();
1049
-		if($permissionID === false) {
1049
+		if ($permissionID === false) {
1050 1050
 			return count($permissions) > 0;
1051 1051
 		}
1052 1052
 		return isset($permissions[$permissionID]) ? $permissions[$permissionID] : false;
1053 1053
 	}
1054 1054
 
1055 1055
 	public function getPoints() {
1056
-		if(!isset($this->points)) {
1057
-			$this->points=0;
1056
+		if (!isset($this->points)) {
1057
+			$this->points = 0;
1058 1058
 			$this->db->lockTable('account_has_points');
1059
-			$this->db->query('SELECT * FROM account_has_points WHERE '.$this->SQL.' LIMIT 1');
1060
-			if($this->db->nextRecord()) {
1061
-				$this->points=$this->db->getInt('points');
1059
+			$this->db->query('SELECT * FROM account_has_points WHERE ' . $this->SQL . ' LIMIT 1');
1060
+			if ($this->db->nextRecord()) {
1061
+				$this->points = $this->db->getInt('points');
1062 1062
 				$lastUpdate = $this->db->getInt('last_update');
1063 1063
 				//we are gonna check for reducing points...
1064
-				if($this->points>0 && $lastUpdate < TIME - (7 * 86400)) {
1065
-					$removePoints=0;
1066
-					while($lastUpdate < TIME - (7 * 86400)) {
1064
+				if ($this->points > 0 && $lastUpdate < TIME - (7 * 86400)) {
1065
+					$removePoints = 0;
1066
+					while ($lastUpdate < TIME - (7 * 86400)) {
1067 1067
 						$removePoints++;
1068 1068
 						$lastUpdate += (7 * 86400);
1069 1069
 					}
1070
-					$this->removePoints($removePoints,$lastUpdate);
1070
+					$this->removePoints($removePoints, $lastUpdate);
1071 1071
 				}
1072 1072
 			}
1073 1073
 			$this->db->unlock();
@@ -1075,30 +1075,30 @@  discard block
 block discarded – undo
1075 1075
 		return $this->points;
1076 1076
 	}
1077 1077
 
1078
-	public function setPoints($numPoints,$lastUpdate=false) {
1079
-		$numPoints = max($numPoints,0);
1080
-		if($this->getPoints()==$numPoints)
1078
+	public function setPoints($numPoints, $lastUpdate = false) {
1079
+		$numPoints = max($numPoints, 0);
1080
+		if ($this->getPoints() == $numPoints)
1081 1081
 			return;
1082
-		if ($this->points==0)
1083
-			$this->db->query('INSERT INTO account_has_points (account_id, points, last_update) VALUES ('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($numPoints).', '.$this->db->escapeNumber($lastUpdate?$lastUpdate:TIME).')');
1084
-		else if($numPoints<=0)
1085
-			$this->db->query('DELETE FROM account_has_points WHERE '.$this->SQL.' LIMIT 1');
1082
+		if ($this->points == 0)
1083
+			$this->db->query('INSERT INTO account_has_points (account_id, points, last_update) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($numPoints) . ', ' . $this->db->escapeNumber($lastUpdate ? $lastUpdate : TIME) . ')');
1084
+		else if ($numPoints <= 0)
1085
+			$this->db->query('DELETE FROM account_has_points WHERE ' . $this->SQL . ' LIMIT 1');
1086 1086
 		else
1087
-			$this->db->query('UPDATE account_has_points SET points = '.$this->db->escapeNumber($numPoints).($lastUpdate ? ', last_update = '.$this->db->escapeNumber(TIME) : '').' WHERE '.$this->SQL.' LIMIT 1');
1088
-		$this->points=$numPoints;
1087
+			$this->db->query('UPDATE account_has_points SET points = ' . $this->db->escapeNumber($numPoints) . ($lastUpdate ? ', last_update = ' . $this->db->escapeNumber(TIME) : '') . ' WHERE ' . $this->SQL . ' LIMIT 1');
1088
+		$this->points = $numPoints;
1089 1089
 	}
1090 1090
 
1091
-	public function removePoints($numPoints,$lastUpdate=false) {
1092
-		if($numPoints>0)
1093
-			$this->setPoints($this->getPoints()-$numPoints,$lastUpdate);
1091
+	public function removePoints($numPoints, $lastUpdate = false) {
1092
+		if ($numPoints > 0)
1093
+			$this->setPoints($this->getPoints() - $numPoints, $lastUpdate);
1094 1094
 	}
1095 1095
 
1096
-	public function addPoints($numPoints,SmrAccount $admin,$reasonID,$suspicion) {
1096
+	public function addPoints($numPoints, SmrAccount $admin, $reasonID, $suspicion) {
1097 1097
 		//do we have points
1098
-		$this->setPoints($this->getPoints() + $numPoints,TIME);
1098
+		$this->setPoints($this->getPoints() + $numPoints, TIME);
1099 1099
 		$totalPoints = $this->getPoints();
1100 1100
 		if ($totalPoints < 10)
1101
-			return false;//leave scripts its only a warning
1101
+			return false; //leave scripts its only a warning
1102 1102
 		elseif ($totalPoints < 20)
1103 1103
 			$days = 2;
1104 1104
 		elseif ($totalPoints < 30)
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 		elseif ($totalPoints < 50)
1107 1107
 			$days = 7;
1108 1108
 		elseif ($totalPoints < 75)
1109
-			$days = 15 ;
1109
+			$days = 15;
1110 1110
 		elseif ($totalPoints < 100)
1111 1111
 			$days = 30;
1112 1112
 		elseif ($totalPoints < 125)
@@ -1120,13 +1120,13 @@  discard block
 block discarded – undo
1120 1120
 		else
1121 1121
 			$days = 0; //Forever/indefinite
1122 1122
 
1123
-		if($days==0) {
1123
+		if ($days == 0) {
1124 1124
 			$expireTime = 0;
1125 1125
 		}
1126 1126
 		else {
1127 1127
 			$expireTime = TIME + $days * 86400;
1128 1128
 		}
1129
-		$this->banAccount($expireTime,$admin,$reasonID,$suspicion);
1129
+		$this->banAccount($expireTime, $admin, $reasonID, $suspicion);
1130 1130
 
1131 1131
 		return $days;
1132 1132
 	}
@@ -1153,12 +1153,12 @@  discard block
 block discarded – undo
1153 1153
 		$this->hasChanged = true;
1154 1154
 	}
1155 1155
 
1156
-	public function banAccount($expireTime,SmrAccount $admin,$reasonID,$suspicion,$removeExceptions = false) {
1156
+	public function banAccount($expireTime, SmrAccount $admin, $reasonID, $suspicion, $removeExceptions = false) {
1157 1157
 		$this->db->query('REPLACE INTO account_is_closed
1158 1158
 					(account_id, reason_id, suspicion, expires)
1159
-					VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($reasonID).', '.$this->db->escapeString($suspicion).', '.$this->db->escapeNumber($expireTime).')');
1159
+					VALUES('.$this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($reasonID) . ', ' . $this->db->escapeString($suspicion) . ', ' . $this->db->escapeNumber($expireTime) . ')');
1160 1160
 		$this->db->lockTable('active_session');
1161
-		$this->db->query('DELETE FROM active_session WHERE '.$this->SQL.' LIMIT 1');
1161
+		$this->db->query('DELETE FROM active_session WHERE ' . $this->SQL . ' LIMIT 1');
1162 1162
 		$this->db->unlock();
1163 1163
 
1164 1164
 		$this->db->query('INSERT INTO account_has_closing_history
@@ -1178,38 +1178,38 @@  discard block
 block discarded – undo
1178 1178
 			$player->update();
1179 1179
 		}
1180 1180
 		$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account closed by ' . $admin->getLogin() . '.');
1181
-		if($removeExceptions!==false)
1181
+		if ($removeExceptions !== false)
1182 1182
 			$this->db->query('DELETE FROM account_exceptions WHERE ' . $this->SQL);
1183 1183
 	}
1184 1184
 
1185
-	public function unbanAccount(SmrAccount $admin = null,$currException=false) {
1185
+	public function unbanAccount(SmrAccount $admin = null, $currException = false) {
1186 1186
 		$adminID = 0;
1187
-		if($admin!==null)
1187
+		if ($admin !== null)
1188 1188
 			$adminID = $admin->getAccountID();
1189 1189
 		$this->db->query('DELETE FROM account_is_closed WHERE ' . $this->SQL . ' LIMIT 1');
1190 1190
 		$this->db->query('INSERT INTO account_has_closing_history
1191 1191
 						(account_id, time, admin_id, action)
1192 1192
 						VALUES(' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeNumber($adminID) . ', ' . $this->db->escapeString('Opened') . ')');
1193 1193
 		$this->db->query('UPDATE player SET last_turn_update = GREATEST(' . $this->db->escapeNumber(TIME) . ', last_turn_update) WHERE ' . $this->SQL);
1194
-		if($admin!==null)
1194
+		if ($admin !== null)
1195 1195
 			$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account reopened by ' . $admin->getLogin() . '.');
1196 1196
 		else
1197 1197
 			$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account automatically reopened.');
1198
-		if($currException!==false)
1198
+		if ($currException !== false)
1199 1199
 			$this->db->query('REPLACE INTO account_exceptions (account_id, reason)
1200 1200
 							VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeString($currException) . ')');
1201 1201
 	}
1202 1202
 
1203 1203
 	public function getToggleAJAXHREF() {
1204 1204
 		global $var;
1205
-		return SmrSession::getNewHREF(create_container('skeleton.php','toggle_processing.php',array('toggle'=>'AJAX','referrer'=>$var['body'])));
1205
+		return SmrSession::getNewHREF(create_container('skeleton.php', 'toggle_processing.php', array('toggle'=>'AJAX', 'referrer'=>$var['body'])));
1206 1206
 	}
1207 1207
 
1208 1208
 	public function getUserRankingHREF() {
1209
-		return SmrSession::getNewHREF(create_container('skeleton.php','rankings_view.php'));
1209
+		return SmrSession::getNewHREF(create_container('skeleton.php', 'rankings_view.php'));
1210 1210
 	}
1211 1211
 
1212 1212
 	public function getPersonalHofHREF() {
1213
-		return SmrSession::getNewHREF(create_container('skeleton.php','hall_of_fame_player_detail.php',array('account_id' => $this->getAccountID())));
1213
+		return SmrSession::getNewHREF(create_container('skeleton.php', 'hall_of_fame_player_detail.php', array('account_id' => $this->getAccountID())));
1214 1214
 	}
1215 1215
 }
Please login to merge, or discard this patch.
Braces   +226 added lines, -165 removed lines patch added patch discarded remove patch
@@ -99,8 +99,9 @@  discard block
 block discarded – undo
99 99
 		if (empty($login)) { return null; }
100 100
 		$db = new SmrMySqlDatabase();
101 101
 		$db->query('SELECT account_id FROM account WHERE login = '.$db->escapeString($login).' LIMIT 1');
102
-		if($db->nextRecord())
103
-			return self::getAccount($db->getInt('account_id'), $forceUpdate);
102
+		if($db->nextRecord()) {
103
+					return self::getAccount($db->getInt('account_id'), $forceUpdate);
104
+		}
104 105
 		$return = null;
105 106
 		return $return;
106 107
 	}
@@ -235,10 +236,10 @@  discard block
 block discarded – undo
235 236
 			$this->template			= $row['template'];
236 237
 			$this->colourScheme		= $row['colour_scheme'];
237 238
 
238
-			if(empty($this->hofName))
239
-				$this->hofName=$this->login;
240
-		}
241
-		else {
239
+			if(empty($this->hofName)) {
240
+							$this->hofName=$this->login;
241
+			}
242
+		} else {
242 243
 			throw new AccountNotFoundException('Account ID '.$accountID.' does not exist!');
243 244
 		}
244 245
 	}
@@ -260,8 +261,7 @@  discard block
 block discarded – undo
260 261
 				'Reason' => $this->db->getField('reason'),
261 262
 				'ReasonID' => $this->db->getInt('reason_id')
262 263
 			);
263
-		}
264
-		else {
264
+		} else {
265 265
 			return false;
266 266
 		}
267 267
 	}
@@ -317,15 +317,18 @@  discard block
 block discarded – undo
317 317
 		if ($curr_ip != 'unknown' && $curr_ip != 'unknown...' && $curr_ip != 'unknown, unknown') {
318 318
 			$curr_ip = $fi.'.'.$se.'.'.$th.'.'.$fo;
319 319
 			$host = gethostbyaddr($curr_ip);
320
-		} else $host = 'unknown';
320
+		} else {
321
+			$host = 'unknown';
322
+		}
321 323
 
322 324
 		// save...first make sure there isn't one for these keys (someone could double click and get error)
323 325
 		$this->db->query('REPLACE INTO account_has_ip (account_id, time, ip, host) VALUES ('.$this->db->escapeNumber($this->account_id).', '.$this->db->escapeNumber(TIME).', '.$this->db->escapeString($curr_ip).', '.$this->db->escapeString($host).')');
324 326
 	}
325 327
 
326 328
 	public function updateLastLogin() {
327
-		if($this->last_login == TIME)
328
-			return;
329
+		if($this->last_login == TIME) {
330
+					return;
331
+		}
329 332
 		$this->last_login = TIME;
330 333
 		$this->hasChanged = true;
331 334
 		$this->update();
@@ -336,8 +339,9 @@  discard block
 block discarded – undo
336 339
 	}
337 340
 
338 341
 	public function setLoggingEnabled($bool) {
339
-		if($this->logging==$bool)
340
-			return;
342
+		if($this->logging==$bool) {
343
+					return;
344
+		}
341 345
 		$this->logging=$bool;
342 346
 		$this->hasChanged = true;
343 347
 		$this->update();
@@ -386,12 +390,14 @@  discard block
 block discarded – undo
386 390
 
387 391
 	public function getHOF(array $typeList = null) {
388 392
 		$this->getHOFData();
389
-		if($typeList==null)
390
-			return $this->HOF;
393
+		if($typeList==null) {
394
+					return $this->HOF;
395
+		}
391 396
 		$hof=$this->HOF;
392 397
 		foreach($typeList as $type) {
393
-			if(!isset($hof[$type]))
394
-				return 0;
398
+			if(!isset($hof[$type])) {
399
+							return 0;
400
+			}
395 401
 			$hof = $hof[$type];
396 402
 		}
397 403
 		return $hof;
@@ -399,10 +405,11 @@  discard block
 block discarded – undo
399 405
 
400 406
 	public function getRankName() {
401 407
 		$rankings = Globals::getUserRanking();
402
-		if(isset($rankings[$this->getRank()]))
403
-			return $rankings[$this->getRank()];
404
-		else
405
-			return end($rankings);
408
+		if(isset($rankings[$this->getRank()])) {
409
+					return $rankings[$this->getRank()];
410
+		} else {
411
+					return end($rankings);
412
+		}
406 413
 	}
407 414
 
408 415
 	public function getScore() {
@@ -418,15 +425,17 @@  discard block
 block discarded – undo
418 425
 
419 426
 	public function getIndividualScores(SmrPlayer $player = null) {
420 427
 		$gameID=0;
421
-		if($player!=null)
422
-			$gameID = $player->getGameID();
428
+		if($player!=null) {
429
+					$gameID = $player->getGameID();
430
+		}
423 431
 		if(!isset($this->individualScores[$gameID])) {
424 432
 			$this->individualScores[$gameID] = array();
425 433
 			foreach(self::USER_RANKINGS_SCORE as $statScore) {
426
-				if($player==null)
427
-					$stat = $this->getHOF($statScore[0]);
428
-				else
429
-					$stat = $player->getHOF($statScore[0]);
434
+				if($player==null) {
435
+									$stat = $this->getHOF($statScore[0]);
436
+				} else {
437
+									$stat = $player->getHOF($statScore[0]);
438
+				}
430 439
 				$this->individualScores[$gameID][]=array('Stat'=>$statScore[0],'Score'=>pow($stat*$statScore[1],self::USER_RANKINGS_EACH_STAT_POW)*$statScore[2]);
431 440
 			}
432 441
 		}
@@ -435,16 +444,19 @@  discard block
 block discarded – undo
435 444
 
436 445
 	public function getRank() : int {
437 446
 		$rank = ICeil(pow($this->getScore(),self::USER_RANKINGS_TOTAL_SCORE_POW)/self::USER_RANKINGS_RANK_BOUNDARY);
438
-		if($rank<1)
439
-			$rank=1;
440
-		if($rank > $this->maxRankAchieved)
441
-			$this->updateMaxRankAchieved($rank);
447
+		if($rank<1) {
448
+					$rank=1;
449
+		}
450
+		if($rank > $this->maxRankAchieved) {
451
+					$this->updateMaxRankAchieved($rank);
452
+		}
442 453
 		return $rank;
443 454
 	}
444 455
 
445 456
 	protected function updateMaxRankAchieved($rank) {
446
-		if($rank <= $this->maxRankAchieved)
447
-			throw new Exception('Trying to set max rank achieved to a lower value: ' . $rank);
457
+		if($rank <= $this->maxRankAchieved) {
458
+					throw new Exception('Trying to set max rank achieved to a lower value: ' . $rank);
459
+		}
448 460
 		$delta = $rank - $this->maxRankAchieved;
449 461
 		if($this->hasReferrer()) {
450 462
 			$this->getReferrer()->increaseSmrRewardCredits($delta * CREDITS_PER_DOLLAR);
@@ -491,12 +503,15 @@  discard block
 block discarded – undo
491 503
 	}
492 504
 
493 505
 	public function decreaseTotalSmrCredits($totalCredits) {
494
-		if($totalCredits==0)
495
-			return;
496
-		if($totalCredits<0)
497
-			throw new Exception('You cannot use negative total credits');
498
-		if($totalCredits>$this->getTotalSmrCredits())
499
-			throw new Exception('You do not have that many credits in total to use');
506
+		if($totalCredits==0) {
507
+					return;
508
+		}
509
+		if($totalCredits<0) {
510
+					throw new Exception('You cannot use negative total credits');
511
+		}
512
+		if($totalCredits>$this->getTotalSmrCredits()) {
513
+					throw new Exception('You do not have that many credits in total to use');
514
+		}
500 515
 
501 516
 		$rewardCredits=$this->rewardCredits;
502 517
 		$credits=$this->credits;
@@ -505,10 +520,11 @@  discard block
 block discarded – undo
505 520
 			$credits+=$rewardCredits;
506 521
 			$rewardCredits=0;
507 522
 		}
508
-		if($this->credits==0 && $this->rewardCredits==0)
509
-			$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).','.$this->db->escapeNumber($rewardCredits).')');
510
-		else
511
-			$this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).', reward_credits='.$this->db->escapeNumber($rewardCredits).' WHERE '.$this->SQL.' LIMIT 1');
523
+		if($this->credits==0 && $this->rewardCredits==0) {
524
+					$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).','.$this->db->escapeNumber($rewardCredits).')');
525
+		} else {
526
+					$this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).', reward_credits='.$this->db->escapeNumber($rewardCredits).' WHERE '.$this->SQL.' LIMIT 1');
527
+		}
512 528
 		$this->credits=$credits;
513 529
 		$this->rewardCredits=$rewardCredits;
514 530
 	}
@@ -524,48 +540,59 @@  discard block
 block discarded – undo
524 540
 	}
525 541
 
526 542
 	public function setSmrCredits($credits) {
527
-		if($this->getSmrCredits()==$credits)
528
-			return;
529
-		if($this->credits==0 && $this->rewardCredits==0)
530
-			$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')');
531
-		else
532
-			$this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1');
543
+		if($this->getSmrCredits()==$credits) {
544
+					return;
545
+		}
546
+		if($this->credits==0 && $this->rewardCredits==0) {
547
+					$this->db->query('REPLACE INTO account_has_credits (account_id, credits_left) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')');
548
+		} else {
549
+					$this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1');
550
+		}
533 551
 		$this->credits=$credits;
534 552
 	}
535 553
 
536 554
 	public function increaseSmrCredits($credits) {
537
-		if($credits==0)
538
-			return;
539
-		if($credits<0)
540
-			throw new Exception('You cannot gain negative credits');
555
+		if($credits==0) {
556
+					return;
557
+		}
558
+		if($credits<0) {
559
+					throw new Exception('You cannot gain negative credits');
560
+		}
541 561
 		$this->setSmrCredits($this->getSmrCredits()+$credits);
542 562
 	}
543 563
 
544 564
 	public function decreaseSmrCredits($credits) {
545
-		if($credits==0)
546
-			return;
547
-		if($credits<0)
548
-			throw new Exception('You cannot use negative credits');
549
-		if($credits>$this->getSmrCredits())
550
-			throw new Exception('You cannot use more credits than you have');
565
+		if($credits==0) {
566
+					return;
567
+		}
568
+		if($credits<0) {
569
+					throw new Exception('You cannot use negative credits');
570
+		}
571
+		if($credits>$this->getSmrCredits()) {
572
+					throw new Exception('You cannot use more credits than you have');
573
+		}
551 574
 		$this->setSmrCredits($this->getSmrCredits()-$credits);
552 575
 	}
553 576
 
554 577
 	public function setSmrRewardCredits($credits) {
555
-		if($this->getSmrRewardCredits()==$credits)
556
-			return;
557
-		if($this->credits==0 && $this->rewardCredits==0)
558
-			$this->db->query('REPLACE INTO account_has_credits (account_id, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')');
559
-		else
560
-			$this->db->query('UPDATE account_has_credits SET reward_credits='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1');
578
+		if($this->getSmrRewardCredits()==$credits) {
579
+					return;
580
+		}
581
+		if($this->credits==0 && $this->rewardCredits==0) {
582
+					$this->db->query('REPLACE INTO account_has_credits (account_id, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')');
583
+		} else {
584
+					$this->db->query('UPDATE account_has_credits SET reward_credits='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1');
585
+		}
561 586
 		$this->rewardCredits=$credits;
562 587
 	}
563 588
 
564 589
 	public function increaseSmrRewardCredits($credits) {
565
-		if($credits==0)
566
-			return;
567
-		if($credits<0)
568
-			throw new Exception('You cannot gain negative reward credits');
590
+		if($credits==0) {
591
+					return;
592
+		}
593
+		if($credits<0) {
594
+					throw new Exception('You cannot gain negative reward credits');
595
+		}
569 596
 		$this->setSmrRewardCredits($this->getSmrRewardCredits()+$credits);
570 597
 	}
571 598
 
@@ -601,8 +628,9 @@  discard block
 block discarded – undo
601 628
 	}
602 629
 
603 630
 	public function hasOldAccountID($dbName=false) {
604
-		if($dbName===false)
605
-			return count($this->getOldAccountIDs())!=0;
631
+		if($dbName===false) {
632
+					return count($this->getOldAccountIDs())!=0;
633
+		}
606 634
 		return $this->getOldAccountID($dbName)!=0;
607 635
 	}
608 636
 
@@ -681,8 +709,9 @@  discard block
 block discarded – undo
681 709
 	}
682 710
 
683 711
 	public function setFontSize($size) {
684
-		if($this->fontSize==$size)
685
-			return;
712
+		if($this->fontSize==$size) {
713
+					return;
714
+		}
686 715
 		$this->fontSize = $size;
687 716
 		$this->hasChanged = true;
688 717
 		$this->update();
@@ -695,8 +724,9 @@  discard block
 block discarded – undo
695 724
 
696 725
 	// sets the extra CSS file linked in preferences
697 726
 	public function setCssLink($link) {
698
-		if($this->cssLink==$link)
699
-			return;
727
+		if($this->cssLink==$link) {
728
+					return;
729
+		}
700 730
 		$this->cssLink = $link;
701 731
 		$this->hasChanged = true;
702 732
 		$this->update();
@@ -707,10 +737,12 @@  discard block
 block discarded – undo
707 737
 	}
708 738
 
709 739
 	public function setTemplate($template) {
710
-		if($this->template==$template)
711
-			return;
712
-		if(!in_array($template,array_keys(Globals::getAvailableTemplates())))
713
-			throw new Exception('Template not allowed: '.$template);
740
+		if($this->template==$template) {
741
+					return;
742
+		}
743
+		if(!in_array($template,array_keys(Globals::getAvailableTemplates()))) {
744
+					throw new Exception('Template not allowed: '.$template);
745
+		}
714 746
 		$this->db->query('UPDATE account SET template = ' . $this->db->escapeString($template) . ' WHERE '.$this->SQL.' LIMIT 1');
715 747
 		$this->template = $template;
716 748
 		$colourSchemes = Globals::getAvailableColourSchemes($template);
@@ -722,10 +754,12 @@  discard block
 block discarded – undo
722 754
 	}
723 755
 
724 756
 	public function setColourScheme($colourScheme) {
725
-		if($this->colourScheme==$colourScheme)
726
-			return;
727
-		if(!in_array($colourScheme,array_keys(Globals::getAvailableColourSchemes($this->getTemplate()))))
728
-			throw new Exception('Colour scheme not allowed: '.$colourScheme);
757
+		if($this->colourScheme==$colourScheme) {
758
+					return;
759
+		}
760
+		if(!in_array($colourScheme,array_keys(Globals::getAvailableColourSchemes($this->getTemplate())))) {
761
+					throw new Exception('Colour scheme not allowed: '.$colourScheme);
762
+		}
729 763
 		$this->colourScheme = $colourScheme;
730 764
 		$this->hasChanged = true;
731 765
 		$this->update();
@@ -759,8 +793,9 @@  discard block
 block discarded – undo
759 793
 	}
760 794
 
761 795
 	public function setHofName($name) {
762
-		if($this->hofName==$name)
763
-			return;
796
+		if($this->hofName==$name) {
797
+					return;
798
+		}
764 799
 		$this->hofName = $name;
765 800
 		$this->hasChanged = true;
766 801
 		$this->update();
@@ -771,8 +806,9 @@  discard block
 block discarded – undo
771 806
 	}
772 807
 
773 808
 	public function setIrcNick($nick) {
774
-		if($this->ircNick==$nick)
775
-			return;
809
+		if($this->ircNick==$nick) {
810
+					return;
811
+		}
776 812
 		$this->ircNick = $nick;
777 813
 		$this->hasChanged = true;
778 814
 		$this->update();
@@ -800,8 +836,9 @@  discard block
 block discarded – undo
800 836
 	}
801 837
 
802 838
 	public function setShortDateFormat($format) {
803
-		if($this->dateShort==$format)
804
-			return;
839
+		if($this->dateShort==$format) {
840
+					return;
841
+		}
805 842
 		$this->dateShort = $format;
806 843
 		$this->hasChanged = true;
807 844
 		$this->update();
@@ -812,8 +849,9 @@  discard block
 block discarded – undo
812 849
 	}
813 850
 
814 851
 	public function setShortTimeFormat($format) {
815
-		if($this->timeShort==$format)
816
-			return;
852
+		if($this->timeShort==$format) {
853
+					return;
854
+		}
817 855
 		$this->timeShort = $format;
818 856
 		$this->hasChanged = true;
819 857
 		$this->update();
@@ -824,16 +862,18 @@  discard block
 block discarded – undo
824 862
 	}
825 863
 
826 864
 	protected function setValidationCode($code) {
827
-		if($this->validation_code == $code)
828
-			return;
865
+		if($this->validation_code == $code) {
866
+					return;
867
+		}
829 868
 		$this->validation_code=$code;
830 869
 		$this->hasChanged=true;
831 870
 		$this->update();
832 871
 	}
833 872
 
834 873
 	public function setValidated($bool) {
835
-		if($this->validated == $bool)
836
-			return;
874
+		if($this->validated == $bool) {
875
+					return;
876
+		}
837 877
 		$this->validated = $bool;
838 878
 		$this->hasChanged = true;
839 879
 		$this->update();
@@ -906,8 +946,9 @@  discard block
 block discarded – undo
906 946
 	}
907 947
 
908 948
 	protected function setPasswordReset($passwordReset) {
909
-		if($this->passwordReset == $passwordReset)
910
-			return;
949
+		if($this->passwordReset == $passwordReset) {
950
+					return;
951
+		}
911 952
 		$this->passwordReset=$passwordReset;
912 953
 		$this->hasChanged=true;
913 954
 		$this->update();
@@ -918,8 +959,9 @@  discard block
 block discarded – undo
918 959
 	}
919 960
 
920 961
 	public function setDisplayShipImages($yesNo) {
921
-		if($this->images == $yesNo)
922
-			return;
962
+		if($this->images == $yesNo) {
963
+					return;
964
+		}
923 965
 		$this->images = $yesNo;
924 966
 		$this->hasChanged = true;
925 967
 		$this->update();
@@ -930,8 +972,9 @@  discard block
 block discarded – undo
930 972
 	}
931 973
 
932 974
 	public function setUseAJAX($bool) {
933
-		if($this->useAJAX == $bool)
934
-			return;
975
+		if($this->useAJAX == $bool) {
976
+					return;
977
+		}
935 978
 		$this->useAJAX=$bool;
936 979
 		$this->hasChanged=true;
937 980
 		$this->update();
@@ -942,8 +985,9 @@  discard block
 block discarded – undo
942 985
 	}
943 986
 
944 987
 	public function setDefaultCSSEnabled($bool) {
945
-		if($this->defaultCSSEnabled == $bool)
946
-			return;
988
+		if($this->defaultCSSEnabled == $bool) {
989
+					return;
990
+		}
947 991
 		$this->defaultCSSEnabled=$bool;
948 992
 		$this->hasChanged=true;
949 993
 		$this->update();
@@ -953,8 +997,7 @@  discard block
 block discarded – undo
953 997
 		if($hotkeyType!==false) {
954 998
 			if(isset($this->hotkeys[$hotkeyType])) {
955 999
 				return $this->hotkeys[$hotkeyType];
956
-			}
957
-			else {
1000
+			} else {
958 1001
 				return array();
959 1002
 			}
960 1003
 		}
@@ -962,8 +1005,9 @@  discard block
 block discarded – undo
962 1005
 	}
963 1006
 
964 1007
 	public function setHotkey($hotkeyType,$binding) {
965
-		if($this->getHotkeys($hotkeyType) == $binding)
966
-			return;
1008
+		if($this->getHotkeys($hotkeyType) == $binding) {
1009
+					return;
1010
+		}
967 1011
 		$this->hotkeys[$hotkeyType] = $binding;
968 1012
 		$this->hasChanged=true;
969 1013
 		$this->update();
@@ -978,26 +1022,31 @@  discard block
 block discarded – undo
978 1022
 	}
979 1023
 
980 1024
 	public function setMessageNotifications($messageTypeID,$num) {
981
-		if($this->getMessageNotifications($messageTypeID) == $num)
982
-			return;
1025
+		if($this->getMessageNotifications($messageTypeID) == $num) {
1026
+					return;
1027
+		}
983 1028
 		$this->messageNotifications[$messageTypeID]=$num;
984 1029
 		$this->hasChanged=true;
985 1030
 		$this->update();
986 1031
 	}
987 1032
 
988 1033
 	public function increaseMessageNotifications($messageTypeID,$num) {
989
-		if($num==0)
990
-			return;
991
-		if($num<0)
992
-			throw new Exception('You cannot increase by a negative amount');
1034
+		if($num==0) {
1035
+					return;
1036
+		}
1037
+		if($num<0) {
1038
+					throw new Exception('You cannot increase by a negative amount');
1039
+		}
993 1040
 		$this->setMessageNotifications($messageTypeID, $this->getMessageNotifications($messageTypeID) + $num);
994 1041
 	}
995 1042
 
996 1043
 	public function decreaseMessageNotifications($messageTypeID,$num) {
997
-		if($num==0)
998
-			return;
999
-		if($num<0)
1000
-			throw new Exception('You cannot decrease by a negative amount');
1044
+		if($num==0) {
1045
+					return;
1046
+		}
1047
+		if($num<0) {
1048
+					throw new Exception('You cannot decrease by a negative amount');
1049
+		}
1001 1050
 		$this->setMessageNotifications($messageTypeID, $this->getMessageNotifications($messageTypeID) - $num);
1002 1051
 	}
1003 1052
 
@@ -1006,8 +1055,9 @@  discard block
 block discarded – undo
1006 1055
 	}
1007 1056
 
1008 1057
 	public function setCenterGalaxyMapOnPlayer($bool) {
1009
-		if($this->centerGalaxyMapOnPlayer == $bool)
1010
-			return;
1058
+		if($this->centerGalaxyMapOnPlayer == $bool) {
1059
+					return;
1060
+		}
1011 1061
 		$this->centerGalaxyMapOnPlayer=$bool;
1012 1062
 		$this->hasChanged=true;
1013 1063
 		$this->update();
@@ -1022,8 +1072,9 @@  discard block
 block discarded – undo
1022 1072
 	}
1023 1073
 
1024 1074
 	public function setMailBanned($time) {
1025
-		if($this->mailBanned == $time)
1026
-			return;
1075
+		if($this->mailBanned == $time) {
1076
+					return;
1077
+		}
1027 1078
 		$this->mailBanned=$time;
1028 1079
 		$this->hasChanged=true;
1029 1080
 	}
@@ -1077,53 +1128,59 @@  discard block
 block discarded – undo
1077 1128
 
1078 1129
 	public function setPoints($numPoints,$lastUpdate=false) {
1079 1130
 		$numPoints = max($numPoints,0);
1080
-		if($this->getPoints()==$numPoints)
1081
-			return;
1082
-		if ($this->points==0)
1083
-			$this->db->query('INSERT INTO account_has_points (account_id, points, last_update) VALUES ('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($numPoints).', '.$this->db->escapeNumber($lastUpdate?$lastUpdate:TIME).')');
1084
-		else if($numPoints<=0)
1085
-			$this->db->query('DELETE FROM account_has_points WHERE '.$this->SQL.' LIMIT 1');
1086
-		else
1087
-			$this->db->query('UPDATE account_has_points SET points = '.$this->db->escapeNumber($numPoints).($lastUpdate ? ', last_update = '.$this->db->escapeNumber(TIME) : '').' WHERE '.$this->SQL.' LIMIT 1');
1131
+		if($this->getPoints()==$numPoints) {
1132
+					return;
1133
+		}
1134
+		if ($this->points==0) {
1135
+					$this->db->query('INSERT INTO account_has_points (account_id, points, last_update) VALUES ('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($numPoints).', '.$this->db->escapeNumber($lastUpdate?$lastUpdate:TIME).')');
1136
+		} else if($numPoints<=0) {
1137
+					$this->db->query('DELETE FROM account_has_points WHERE '.$this->SQL.' LIMIT 1');
1138
+		} else {
1139
+					$this->db->query('UPDATE account_has_points SET points = '.$this->db->escapeNumber($numPoints).($lastUpdate ? ', last_update = '.$this->db->escapeNumber(TIME) : '').' WHERE '.$this->SQL.' LIMIT 1');
1140
+		}
1088 1141
 		$this->points=$numPoints;
1089 1142
 	}
1090 1143
 
1091 1144
 	public function removePoints($numPoints,$lastUpdate=false) {
1092
-		if($numPoints>0)
1093
-			$this->setPoints($this->getPoints()-$numPoints,$lastUpdate);
1145
+		if($numPoints>0) {
1146
+					$this->setPoints($this->getPoints()-$numPoints,$lastUpdate);
1147
+		}
1094 1148
 	}
1095 1149
 
1096 1150
 	public function addPoints($numPoints,SmrAccount $admin,$reasonID,$suspicion) {
1097 1151
 		//do we have points
1098 1152
 		$this->setPoints($this->getPoints() + $numPoints,TIME);
1099 1153
 		$totalPoints = $this->getPoints();
1100
-		if ($totalPoints < 10)
1101
-			return false;//leave scripts its only a warning
1102
-		elseif ($totalPoints < 20)
1103
-			$days = 2;
1104
-		elseif ($totalPoints < 30)
1105
-			$days = 4;
1106
-		elseif ($totalPoints < 50)
1107
-			$days = 7;
1108
-		elseif ($totalPoints < 75)
1109
-			$days = 15 ;
1110
-		elseif ($totalPoints < 100)
1111
-			$days = 30;
1112
-		elseif ($totalPoints < 125)
1113
-			$days = 60;
1114
-		elseif ($totalPoints < 150)
1115
-			$days = 120;
1116
-		elseif ($totalPoints < 175)
1117
-			$days = 240;
1118
-		elseif ($totalPoints < 200)
1119
-			$days = 480;
1120
-		else
1121
-			$days = 0; //Forever/indefinite
1154
+		if ($totalPoints < 10) {
1155
+					return false;
1156
+		}
1157
+		//leave scripts its only a warning
1158
+		elseif ($totalPoints < 20) {
1159
+					$days = 2;
1160
+		} elseif ($totalPoints < 30) {
1161
+					$days = 4;
1162
+		} elseif ($totalPoints < 50) {
1163
+					$days = 7;
1164
+		} elseif ($totalPoints < 75) {
1165
+					$days = 15 ;
1166
+		} elseif ($totalPoints < 100) {
1167
+					$days = 30;
1168
+		} elseif ($totalPoints < 125) {
1169
+					$days = 60;
1170
+		} elseif ($totalPoints < 150) {
1171
+					$days = 120;
1172
+		} elseif ($totalPoints < 175) {
1173
+					$days = 240;
1174
+		} elseif ($totalPoints < 200) {
1175
+					$days = 480;
1176
+		} else {
1177
+					$days = 0;
1178
+		}
1179
+		//Forever/indefinite
1122 1180
 
1123 1181
 		if($days==0) {
1124 1182
 			$expireTime = 0;
1125
-		}
1126
-		else {
1183
+		} else {
1127 1184
 			$expireTime = TIME + $days * 86400;
1128 1185
 		}
1129 1186
 		$this->banAccount($expireTime,$admin,$reasonID,$suspicion);
@@ -1178,26 +1235,30 @@  discard block
 block discarded – undo
1178 1235
 			$player->update();
1179 1236
 		}
1180 1237
 		$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account closed by ' . $admin->getLogin() . '.');
1181
-		if($removeExceptions!==false)
1182
-			$this->db->query('DELETE FROM account_exceptions WHERE ' . $this->SQL);
1238
+		if($removeExceptions!==false) {
1239
+					$this->db->query('DELETE FROM account_exceptions WHERE ' . $this->SQL);
1240
+		}
1183 1241
 	}
1184 1242
 
1185 1243
 	public function unbanAccount(SmrAccount $admin = null,$currException=false) {
1186 1244
 		$adminID = 0;
1187
-		if($admin!==null)
1188
-			$adminID = $admin->getAccountID();
1245
+		if($admin!==null) {
1246
+					$adminID = $admin->getAccountID();
1247
+		}
1189 1248
 		$this->db->query('DELETE FROM account_is_closed WHERE ' . $this->SQL . ' LIMIT 1');
1190 1249
 		$this->db->query('INSERT INTO account_has_closing_history
1191 1250
 						(account_id, time, admin_id, action)
1192 1251
 						VALUES(' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeNumber($adminID) . ', ' . $this->db->escapeString('Opened') . ')');
1193 1252
 		$this->db->query('UPDATE player SET last_turn_update = GREATEST(' . $this->db->escapeNumber(TIME) . ', last_turn_update) WHERE ' . $this->SQL);
1194
-		if($admin!==null)
1195
-			$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account reopened by ' . $admin->getLogin() . '.');
1196
-		else
1197
-			$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account automatically reopened.');
1198
-		if($currException!==false)
1199
-			$this->db->query('REPLACE INTO account_exceptions (account_id, reason)
1253
+		if($admin!==null) {
1254
+					$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account reopened by ' . $admin->getLogin() . '.');
1255
+		} else {
1256
+					$this->log(LOG_TYPE_ACCOUNT_CHANGES, 'Account automatically reopened.');
1257
+		}
1258
+		if($currException!==false) {
1259
+					$this->db->query('REPLACE INTO account_exceptions (account_id, reason)
1200 1260
 							VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeString($currException) . ')');
1261
+		}
1201 1262
 	}
1202 1263
 
1203 1264
 	public function getToggleAJAXHREF() {
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.
tools/npc/npc.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		}
122 122
 
123 123
 		try {
124
-			$TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE'];
124
+			$TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE'];
125 125
 			debug('Action #' . $actions);
126 126
 
127 127
 			//We have to reload player on each loop
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 			}
141 141
 
142 142
 			if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set.
143
-				$TRADE_ROUTES =& findRoutes($player);
144
-				$TRADE_ROUTE =& changeRoute($TRADE_ROUTES);
143
+				$TRADE_ROUTES = & findRoutes($player);
144
+				$TRADE_ROUTE = & changeRoute($TRADE_ROUTES);
145 145
 			}
146 146
 
147 147
 			if ($player->isDead()) {
148 148
 				debug('Some evil person killed us, let\'s move on now.');
149 149
 				$previousContainer = null; //We died, we don't care what we were doing beforehand.
150
-				$TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route
150
+				$TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route
151 151
 				processContainer(create_container('death_processing.php'));
152 152
 			}
153 153
 			if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 							}
240 240
 							else {
241 241
 								//Move to next route or fed.
242
-								if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
242
+								if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) {
243 243
 									debug('Changing Route Failed');
244 244
 									processContainer(plotToFed($player));
245 245
 								}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 						}
272 272
 						else {
273 273
 							//Move to next route or fed.
274
-							if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
274
+							if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) {
275 275
 								debug('Changing Route Failed');
276 276
 								processContainer(plotToFed($player));
277 277
 							}
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
 	if (count($tradeRoutes) == 0)
600 600
 		return $false;
601 601
 	$routeKey = array_rand($tradeRoutes);
602
-	$tradeRoute =& $tradeRoutes[$routeKey];
602
+	$tradeRoute = & $tradeRoutes[$routeKey];
603 603
 	unset($tradeRoutes[$routeKey]);
604
-	$GLOBALS['TRADE_ROUTE'] =& $tradeRoute;
604
+	$GLOBALS['TRADE_ROUTE'] = & $tradeRoute;
605 605
 	debug('Switched route', $tradeRoute);
606 606
 	return $tradeRoute;
607 607
 }
Please login to merge, or discard this patch.
Braces   +55 added lines, -67 removed lines patch added patch discarded remove patch
@@ -89,12 +89,10 @@  discard block
 block discarded – undo
89 89
 
90 90
 	try {
91 91
 		changeNPCLogin();
92
-	}
93
-	catch (ForwardException $e) {}
92
+	} catch (ForwardException $e) {}
94 93
 
95 94
 	NPCStuff();
96
-}
97
-catch (Throwable $e) {
95
+} catch (Throwable $e) {
98 96
 	logException($e);
99 97
 	// Try to shut down cleanly
100 98
 	exitNPC();
@@ -157,8 +155,7 @@  discard block
 block discarded – undo
157 155
 			$fedContainer = null;
158 156
 			if ($var['url'] == 'shop_ship_processing.php' && ($fedContainer = plotToFed($player, true)) !== true) { //We just bought a ship, we should head back to our trade gal/uno - we use HQ for now as it's both in our gal and a UNO, plus it's safe which is always a bonus
159 157
 				processContainer($fedContainer);
160
-			}
161
-			else if ($player->getShip()->isUnderAttack() === true
158
+			} else if ($player->getShip()->isUnderAttack() === true
162 159
 				&&($player->hasPlottedCourse() === false || $player->getPlottedCourse()->getEndSector()->offersFederalProtection() === false)
163 160
 				&&($fedContainer == null ? $fedContainer = plotToFed($player, true) : $fedContainer) !== true) { //We're under attack and need to plot course to fed.
164 161
 				// Get the lock, remove under attack and update.
@@ -171,20 +168,16 @@  discard block
 block discarded – undo
171 168
 				debug('Under Attack');
172 169
 				$underAttack = true;
173 170
 				processContainer($fedContainer);
174
-			}
175
-			else if ($player->hasPlottedCourse() === true && $player->getPlottedCourse()->getEndSector()->offersFederalProtection()) { //We have a route to fed to follow, figure it's probably a damned sensible thing to follow.
171
+			} else if ($player->hasPlottedCourse() === true && $player->getPlottedCourse()->getEndSector()->offersFederalProtection()) { //We have a route to fed to follow, figure it's probably a damned sensible thing to follow.
176 172
 				debug('Follow Course: ' . $player->getPlottedCourse()->getNextOnPath());
177 173
 				processContainer(moveToSector($player, $player->getPlottedCourse()->getNextOnPath()));
178
-			}
179
-			else if (($container = canWeUNO($player, true)) !== false) { //We have money and are at a uno, let's uno!
174
+			} else if (($container = canWeUNO($player, true)) !== false) { //We have money and are at a uno, let's uno!
180 175
 				debug('We\'re UNOing');
181 176
 				processContainer($container);
182
-			}
183
-			else if ($player->hasPlottedCourse() === true) { //We have a route to follow, figure it's probably a sensible thing to follow.
177
+			} else if ($player->hasPlottedCourse() === true) { //We have a route to follow, figure it's probably a sensible thing to follow.
184 178
 				debug('Follow Course: ' . $player->getPlottedCourse()->getNextOnPath());
185 179
 				processContainer(moveToSector($player, $player->getPlottedCourse()->getNextOnPath()));
186
-			}
187
-			else if ($player->getTurns() < NPC_LOW_TURNS || ($player->getTurns() < $player->getMaxTurns() / 2 && $player->getNewbieTurns() < NPC_LOW_NEWBIE_TURNS) || $underAttack) { //We're low on turns or have been under attack and need to plot course to fed
180
+			} else if ($player->getTurns() < NPC_LOW_TURNS || ($player->getTurns() < $player->getMaxTurns() / 2 && $player->getNewbieTurns() < NPC_LOW_NEWBIE_TURNS) || $underAttack) { //We're low on turns or have been under attack and need to plot course to fed
188 181
 				if ($player->getTurns() < NPC_LOW_TURNS) {
189 182
 					debug('Low Turns:' . $player->getTurns());
190 183
 				}
@@ -201,16 +194,13 @@  discard block
 block discarded – undo
201 194
 				}
202 195
 				$ship = $player->getShip();
203 196
 				processContainer(plotToFed($player, !$ship->hasMaxShields() || !$ship->hasMaxArmour() || !$ship->hasMaxCargoHolds()));
204
-			}
205
-			else if (($container = checkForShipUpgrade($player)) !== false) { //We have money and are at a uno, let's uno!
197
+			} else if (($container = checkForShipUpgrade($player)) !== false) { //We have money and are at a uno, let's uno!
206 198
 				debug('We\'re reshipping!');
207 199
 				processContainer($container);
208
-			}
209
-			else if (($container = canWeUNO($player, false)) !== false) { //We need to UNO and have enough money to do it properly so let's do it sooner rather than later.
200
+			} else if (($container = canWeUNO($player, false)) !== false) { //We need to UNO and have enough money to do it properly so let's do it sooner rather than later.
210 201
 				debug('We need to UNO, so off we go!');
211 202
 				processContainer($container);
212
-			}
213
-			else if ($TRADE_ROUTE instanceof \Routes\Route) {
203
+			} else if ($TRADE_ROUTE instanceof \Routes\Route) {
214 204
 				debug('Trade Route');
215 205
 				$forwardRoute = $TRADE_ROUTE->getForwardRoute();
216 206
 				$returnRoute = $TRADE_ROUTE->getReturnRoute();
@@ -218,8 +208,7 @@  discard block
 block discarded – undo
218 208
 					if ($forwardRoute->getBuySectorId() == $player->getSectorID()) {
219 209
 						$buyRoute = $forwardRoute;
220 210
 						$sellRoute = $returnRoute;
221
-					}
222
-					else if ($returnRoute->getBuySectorId() == $player->getSectorID()) {
211
+					} else if ($returnRoute->getBuySectorId() == $player->getSectorID()) {
223 212
 						$buyRoute = $returnRoute;
224 213
 						$sellRoute = $forwardRoute;
225 214
 					}
@@ -236,30 +225,25 @@  discard block
 block discarded – undo
236 225
 								//Sell goods
237 226
 								debug('Sell Goods');
238 227
 								processContainer(tradeGoods($goodID, $player, $port));
239
-							}
240
-							else {
228
+							} else {
241 229
 								//Move to next route or fed.
242 230
 								if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
243 231
 									debug('Changing Route Failed');
244 232
 									processContainer(plotToFed($player));
245
-								}
246
-								else {
233
+								} else {
247 234
 									debug('Route Changed');
248 235
 									continue;
249 236
 								}
250 237
 							}
251
-						}
252
-						else if ($ship->hasCargo($buyRoute->getGoodID()) === true) { //We've bought goods, plot to sell
238
+						} else if ($ship->hasCargo($buyRoute->getGoodID()) === true) { //We've bought goods, plot to sell
253 239
 							debug('Plot To Sell: ' . $buyRoute->getSellSectorId());
254 240
 							processContainer(plotToSector($player, $buyRoute->getSellSectorId()));
255
-						}
256
-						else {
241
+						} else {
257 242
 							//Dump goods
258 243
 							debug('Dump Goods');
259 244
 							processContainer(dumpCargo($player));
260 245
 						}
261
-					}
262
-					else { //Buy goods
246
+					} else { //Buy goods
263 247
 						$goodID = $buyRoute->getGoodID();
264 248
 
265 249
 						$port = $player->getSector()->getPort();
@@ -268,26 +252,22 @@  discard block
 block discarded – undo
268 252
 						if ($tradeable === true && $port->getGoodAmount($goodID) >= $ship->getEmptyHolds()) { //Buy goods
269 253
 							debug('Buy Goods');
270 254
 							processContainer(tradeGoods($goodID, $player, $port));
271
-						}
272
-						else {
255
+						} else {
273 256
 							//Move to next route or fed.
274 257
 							if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
275 258
 								debug('Changing Route Failed');
276 259
 								processContainer(plotToFed($player));
277
-							}
278
-							else {
260
+							} else {
279 261
 								debug('Route Changed');
280 262
 								continue;
281 263
 							}
282 264
 						}
283 265
 					}
284
-				}
285
-				else {
266
+				} else {
286 267
 					debug('Plot To Buy: ' . $forwardRoute->getBuySectorId());
287 268
 					processContainer(plotToSector($player, $forwardRoute->getBuySectorId()));
288 269
 				}
289
-			}
290
-			else { //Something weird is going on.. Let's fed and wait.
270
+			} else { //Something weird is going on.. Let's fed and wait.
291 271
 				debug('No actual action? Wtf?');
292 272
 				processContainer(plotToFed($player));
293 273
 			}
@@ -299,8 +279,7 @@  discard block
 block discarded – undo
299 279
 				processContainer(moveToSector($player,$moveTo));
300 280
 			}
301 281
 			*/
302
-		}
303
-		catch (ForwardException $e) {
282
+		} catch (ForwardException $e) {
304 283
 			global $lock;
305 284
 			if ($lock) { //only save if we have the lock.
306 285
 				SmrSector::saveSectors();
@@ -308,8 +287,9 @@  discard block
 block discarded – undo
308 287
 				SmrPlayer::savePlayers();
309 288
 				SmrForce::saveForces();
310 289
 				SmrPort::savePorts();
311
-				if (class_exists('WeightedRandom', false))
312
-					WeightedRandom::saveWeightedRandoms();
290
+				if (class_exists('WeightedRandom', false)) {
291
+									WeightedRandom::saveWeightedRandoms();
292
+				}
313 293
 				release_lock();
314 294
 			}
315 295
 			//Clean up the caches as the data may get changed by other players
@@ -447,11 +427,13 @@  discard block
 block discarded – undo
447 427
 }
448 428
 
449 429
 function canWeUNO(AbstractSmrPlayer $player, $oppurtunisticOnly) {
450
-	if ($player->getCredits() < MINUMUM_RESERVE_CREDITS)
451
-		return false;
430
+	if ($player->getCredits() < MINUMUM_RESERVE_CREDITS) {
431
+			return false;
432
+	}
452 433
 	$ship = $player->getShip();
453
-	if ($ship->hasMaxShields() && $ship->hasMaxArmour() && $ship->hasMaxCargoHolds())
454
-		return false;
434
+	if ($ship->hasMaxShields() && $ship->hasMaxArmour() && $ship->hasMaxCargoHolds()) {
435
+			return false;
436
+	}
455 437
 	$sector = $player->getSector();
456 438
 
457 439
 	// We buy armour in preference to shields as it's cheaper.
@@ -465,8 +447,7 @@  discard block
 block discarded – undo
465 447
 			$hardwareSold = $location->getHardwareSold();
466 448
 			if ($player->getNewbieTurns() > MIN_NEWBIE_TURNS_TO_BUY_CARGO && !$ship->hasMaxCargoHolds() && isset($hardwareSold[HARDWARE_CARGO]) && ($amount = floor(($player->getCredits() - MINUMUM_RESERVE_CREDITS) / Globals::getHardwareCost(HARDWARE_CARGO))) > 0) { // Buy cargo holds first if we have plenty of newbie turns left.
467 449
 				$hardwareID = HARDWARE_CARGO;
468
-			}
469
-			else {
450
+			} else {
470 451
 				foreach ($hardwareArray as $hardwareArrayID) {
471 452
 					if (!$ship->hasMaxHardware($hardwareArrayID) && isset($hardwareSold[$hardwareArrayID]) && ($amount = floor(($player->getCredits() - MINUMUM_RESERVE_CREDITS) / Globals::getHardwareCost($hardwareArrayID))) > 0) {
472 453
 						$hardwareID = $hardwareArrayID;
@@ -480,11 +461,14 @@  discard block
 block discarded – undo
480 461
 		}
481 462
 	}
482 463
 
483
-	if ($oppurtunisticOnly === true)
484
-		return false;
464
+	if ($oppurtunisticOnly === true) {
465
+			return false;
466
+	}
485 467
 
486
-	if ($player->getCredits() - $ship->getCostToUNO() < MINUMUM_RESERVE_CREDITS)
487
-		return false; //Only do non-oppurtunistic UNO if we have the money to do it properly!
468
+	if ($player->getCredits() - $ship->getCostToUNO() < MINUMUM_RESERVE_CREDITS) {
469
+			return false;
470
+	}
471
+	//Only do non-oppurtunistic UNO if we have the money to do it properly!
488 472
 
489 473
 	foreach ($hardwareArray as $hardwareArrayID) {
490 474
 		if (!$ship->hasMaxHardware($hardwareArrayID)) {
@@ -573,8 +557,10 @@  discard block
 block discarded – undo
573 557
 
574 558
 function checkForShipUpgrade(AbstractSmrPlayer $player) {
575 559
 	foreach (SHIP_UPGRADE_PATH[$player->getRaceID()] as $upgradeShipID) {
576
-		if ($player->getShipTypeID() == $upgradeShipID) //We can't upgrade, only downgrade.
560
+		if ($player->getShipTypeID() == $upgradeShipID) {
561
+			//We can't upgrade, only downgrade.
577 562
 			return false;
563
+		}
578 564
 		$cost = $player->getShip()->getCostToUpgrade($upgradeShipID);
579 565
 		if ($cost <= 0 || $player->getCredits() - $cost > MINUMUM_RESERVE_CREDITS) {
580 566
 			return doShipUpgrade($player, $upgradeShipID);
@@ -596,8 +582,9 @@  discard block
 block discarded – undo
596 582
 
597 583
 function &changeRoute(array &$tradeRoutes) {
598 584
 	$false = false;
599
-	if (count($tradeRoutes) == 0)
600
-		return $false;
585
+	if (count($tradeRoutes) == 0) {
586
+			return $false;
587
+	}
601 588
 	$routeKey = array_rand($tradeRoutes);
602 589
 	$tradeRoute =& $tradeRoutes[$routeKey];
603 590
 	unset($tradeRoutes[$routeKey]);
@@ -611,10 +598,11 @@  discard block
 block discarded – undo
611 598
 
612 599
 	$tradeGoods = array(GOOD_NOTHING => false);
613 600
 	foreach (Globals::getGoods() as $goodID => $good) {
614
-		if ($player->meetsAlignmentRestriction($good['AlignRestriction']))
615
-			$tradeGoods[$goodID] = true;
616
-		else
617
-			$tradeGoods[$goodID] = false;
601
+		if ($player->meetsAlignmentRestriction($good['AlignRestriction'])) {
602
+					$tradeGoods[$goodID] = true;
603
+		} else {
604
+					$tradeGoods[$goodID] = false;
605
+		}
618 606
 	}
619 607
 	$tradeRaces = array();
620 608
 	foreach (Globals::getRaces() as $raceID => $race) {
@@ -638,8 +626,7 @@  discard block
 block discarded – undo
638 626
 		$routes = unserialize(gzuncompress($db->getField('routes')));
639 627
 		debug('Using Cached Routes: #' . count($routes));
640 628
 		return $routes;
641
-	}
642
-	else {
629
+	} else {
643 630
 		debug('Generating Routes');
644 631
 		$allSectors = array();
645 632
 		foreach (SmrGalaxy::getGameGalaxies($player->getGameID()) as $galaxy) {
@@ -648,10 +635,11 @@  discard block
 block discarded – undo
648 635
 
649 636
 		$distances = Plotter::calculatePortToPortDistances($allSectors, $maxDistance, $startSectorID, $endSectorID);
650 637
 
651
-		if ($maxNumberOfPorts == 1)
652
-			$allRoutes = \Routes\RouteGenerator::generateOneWayRoutes($allSectors, $distances, $tradeGoods, $tradeRaces, $routesForPort);
653
-		else
654
-			$allRoutes = \Routes\RouteGenerator::generateMultiPortRoutes($maxNumberOfPorts, $allSectors, $tradeGoods, $tradeRaces, $distances, $routesForPort, $numberOfRoutes);
638
+		if ($maxNumberOfPorts == 1) {
639
+					$allRoutes = \Routes\RouteGenerator::generateOneWayRoutes($allSectors, $distances, $tradeGoods, $tradeRaces, $routesForPort);
640
+		} else {
641
+					$allRoutes = \Routes\RouteGenerator::generateMultiPortRoutes($maxNumberOfPorts, $allSectors, $tradeGoods, $tradeRaces, $distances, $routesForPort, $numberOfRoutes);
642
+		}
655 643
 
656 644
 		unset($distances);
657 645
 
Please login to merge, or discard this patch.