Completed
Push — release-2.1 ( 4bdd41...11eb43 )
by Mathias
07:36
created
Sources/CacheAPI-memcache.php 1 patch
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
  * @version 2.1 Beta 4
12 12
  */
13 13
 
14
-if (!defined('SMF'))
14
+if (!defined('SMF')) {
15 15
 	die('Hacking attempt...');
16
+}
16 17
 
17 18
 /**
18 19
  * Our Cache API class
@@ -34,8 +35,9 @@  discard block
 block discarded – undo
34 35
 
35 36
 		$supported = class_exists('memcache');
36 37
 
37
-		if ($test)
38
-			return $supported;
38
+		if ($test) {
39
+					return $supported;
40
+		}
39 41
 		return parent::isSupported() && $supported && !empty($cache_memcached);
40 42
 	}
41 43
 
@@ -61,9 +63,9 @@  discard block
 block discarded – undo
61 63
 			$server = trim($servers[array_rand($servers)]);
62 64
 
63 65
 			// Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0.
64
-			if (strpos($server,'/') !== false)
65
-				$host = $server;
66
-			else
66
+			if (strpos($server,'/') !== false) {
67
+							$host = $server;
68
+			} else
67 69
 			{
68 70
 				$server = explode(':', $server);
69 71
 				$host = $server[0];
@@ -71,10 +73,11 @@  discard block
 block discarded – undo
71 73
 			}
72 74
 
73 75
 			// Don't wait too long: yes, we want the server, but we might be able to run the query faster!
74
-			if (empty($db_persist))
75
-				$connected = $this->memcache->connect($host, $port);
76
-			else
77
-				$connected = $this->memcache->pconnect($host, $port);
76
+			if (empty($db_persist)) {
77
+							$connected = $this->memcache->connect($host, $port);
78
+			} else {
79
+							$connected = $this->memcache->pconnect($host, $port);
80
+			}
78 81
 		}
79 82
 
80 83
 		return $connected;
@@ -90,8 +93,9 @@  discard block
 block discarded – undo
90 93
 		$value = $this->memcache->get($key);
91 94
 
92 95
 		// $value should return either data or false (from failure, key not found or empty array).
93
-		if ($value === false)
94
-			return null;
96
+		if ($value === false) {
97
+					return null;
98
+		}
95 99
 		return $value;
96 100
 	}
97 101
 
@@ -132,8 +136,9 @@  discard block
 block discarded – undo
132 136
 		$config_vars[] = $txt['cache_memcache_settings'];
133 137
 		$config_vars[] = array('cache_memcached', $txt['cache_memcache_servers'], 'file', 'text', 0, 'cache_memcached', 'postinput' => '<br><div class="smalltext"><em>' . $txt['cache_memcache_servers_subtext'] . '</em></div>');
134 138
 
135
-		if (!isset($context['settings_post_javascript']))
136
-			$context['settings_post_javascript'] = '';
139
+		if (!isset($context['settings_post_javascript'])) {
140
+					$context['settings_post_javascript'] = '';
141
+		}
137 142
 
138 143
 		$context['settings_post_javascript'] .= '
139 144
 			$("#cache_accelerator").change(function (e) {
Please login to merge, or discard this patch.
Sources/Class-CacheAPI.php 1 patch
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
  * @version 2.1 Beta 4
12 12
  */
13 13
 
14
-if (!defined('SMF'))
14
+if (!defined('SMF')) {
15 15
 	die('Hacking attempt...');
16
+}
16 17
 
17 18
 /**
18 19
  * Interface cache_api_interface
@@ -182,8 +183,9 @@  discard block
 block discarded – undo
182 183
 	{
183 184
 		global $cache_enable;
184 185
 
185
-		if ($test)
186
-			return true;
186
+		if ($test) {
187
+					return true;
188
+		}
187 189
 		return !empty($cache_enable);
188 190
 	}
189 191
 
@@ -202,18 +204,20 @@  discard block
 block discarded – undo
202 204
 		global $boardurl, $cachedir;
203 205
 
204 206
 		// Find a valid good file to do mtime checks on.
205
-		if (file_exists($cachedir . '/' . 'index.php'))
206
-			$filemtime = $cachedir . '/' . 'index.php';
207
-		elseif (is_dir($cachedir . '/'))
208
-			$filemtime = $cachedir . '/';
209
-		else
210
-			$filemtime = $boardurl . '/index.php';
207
+		if (file_exists($cachedir . '/' . 'index.php')) {
208
+					$filemtime = $cachedir . '/' . 'index.php';
209
+		} elseif (is_dir($cachedir . '/')) {
210
+					$filemtime = $cachedir . '/';
211
+		} else {
212
+					$filemtime = $boardurl . '/index.php';
213
+		}
211 214
 
212 215
 		// Set the default if no prefix was specified.
213
-		if (empty($prefix))
214
-			$this->prefix = md5($boardurl . filemtime($filemtime)) . '-SMF-';
215
-		else
216
-			$this->prefix = $prefix;
216
+		if (empty($prefix)) {
217
+					$this->prefix = md5($boardurl . filemtime($filemtime)) . '-SMF-';
218
+		} else {
219
+					$this->prefix = $prefix;
220
+		}
217 221
 
218 222
 		return true;
219 223
 	}
@@ -276,8 +280,9 @@  discard block
 block discarded – undo
276 280
 
277 281
 		// Invalidate cache, to be sure!
278 282
 		// ... as long as index.php can be modified, anyway.
279
-		if (is_writable($cachedir . '/' . 'index.php'))
280
-			@touch($cachedir . '/' . 'index.php');
283
+		if (is_writable($cachedir . '/' . 'index.php')) {
284
+					@touch($cachedir . '/' . 'index.php');
285
+		}
281 286
 
282 287
 		return true;
283 288
 	}
Please login to merge, or discard this patch.
other/install.php 1 patch
Braces   +452 added lines, -336 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 // ><html dir="ltr"><head><title>Error!</title></head><body>Sorry, this installer requires PHP!<div style="display: none;">
21 21
 
22 22
 // Let's pull in useful classes
23
-if (!defined('SMF'))
23
+if (!defined('SMF')) {
24 24
 	define('SMF', 1);
25
+}
25 26
 
26 27
 require_once('Sources/Class-Package.php');
27 28
 
@@ -63,10 +64,11 @@  discard block
 block discarded – undo
63 64
 
64 65
 			list ($charcode) = pg_fetch_row($request);
65 66
 
66
-			if ($charcode == 'UTF8')
67
-				return true;
68
-			else
69
-				return false;
67
+			if ($charcode == 'UTF8') {
68
+							return true;
69
+			} else {
70
+							return false;
71
+			}
70 72
 		},
71 73
 		'utf8_version' => '8.0',
72 74
 		'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); list($pgl, $version) = explode(" ", $version); return $version;',
@@ -76,12 +78,14 @@  discard block
 block discarded – undo
76 78
 			$value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value);
77 79
 
78 80
 			// Is it reserved?
79
-			if ($value == 'pg_')
80
-				return $txt['error_db_prefix_reserved'];
81
+			if ($value == 'pg_') {
82
+							return $txt['error_db_prefix_reserved'];
83
+			}
81 84
 
82 85
 			// Is the prefix numeric?
83
-			if (preg_match('~^\d~', $value))
84
-				return $txt['error_db_prefix_numeric'];
86
+			if (preg_match('~^\d~', $value)) {
87
+							return $txt['error_db_prefix_numeric'];
88
+			}
85 89
 
86 90
 			return true;
87 91
 		},
@@ -128,10 +132,11 @@  discard block
 block discarded – undo
128 132
 		$incontext['skip'] = false;
129 133
 
130 134
 		// Call the step and if it returns false that means pause!
131
-		if (function_exists($step[2]) && $step[2]() === false)
132
-			break;
133
-		elseif (function_exists($step[2]))
134
-			$incontext['current_step']++;
135
+		if (function_exists($step[2]) && $step[2]() === false) {
136
+					break;
137
+		} elseif (function_exists($step[2])) {
138
+					$incontext['current_step']++;
139
+		}
135 140
 
136 141
 		// No warnings pass on.
137 142
 		$incontext['warning'] = '';
@@ -147,8 +152,9 @@  discard block
 block discarded – undo
147 152
 	global $databases;
148 153
 
149 154
 	// Just so people using older versions of PHP aren't left in the cold.
150
-	if (!isset($_SERVER['PHP_SELF']))
151
-		$_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php';
155
+	if (!isset($_SERVER['PHP_SELF'])) {
156
+			$_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php';
157
+	}
152 158
 
153 159
 	// Enable error reporting for fatal errors.
154 160
 	error_reporting(E_ERROR | E_PARSE);
@@ -164,21 +170,23 @@  discard block
 block discarded – undo
164 170
 	{
165 171
 		ob_start();
166 172
 
167
-		if (ini_get('session.save_handler') == 'user')
168
-			@ini_set('session.save_handler', 'files');
169
-		if (function_exists('session_start'))
170
-			@session_start();
171
-	}
172
-	else
173
+		if (ini_get('session.save_handler') == 'user') {
174
+					@ini_set('session.save_handler', 'files');
175
+		}
176
+		if (function_exists('session_start')) {
177
+					@session_start();
178
+		}
179
+	} else
173 180
 	{
174 181
 		ob_start('ob_gzhandler');
175 182
 
176
-		if (ini_get('session.save_handler') == 'user')
177
-			@ini_set('session.save_handler', 'files');
183
+		if (ini_get('session.save_handler') == 'user') {
184
+					@ini_set('session.save_handler', 'files');
185
+		}
178 186
 		session_start();
179 187
 
180
-		if (!headers_sent())
181
-			echo '<!DOCTYPE html>
188
+		if (!headers_sent()) {
189
+					echo '<!DOCTYPE html>
182 190
 <html>
183 191
 	<head>
184 192
 		<title>', htmlspecialchars($_GET['pass_string']), '</title>
@@ -187,14 +195,16 @@  discard block
 block discarded – undo
187 195
 		<strong>', htmlspecialchars($_GET['pass_string']), '</strong>
188 196
 	</body>
189 197
 </html>';
198
+		}
190 199
 		exit;
191 200
 	}
192 201
 
193 202
 	// Add slashes, as long as they aren't already being added.
194
-	if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0)
195
-		foreach ($_POST as $k => $v)
203
+	if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) {
204
+			foreach ($_POST as $k => $v)
196 205
 			if (strpos($k, 'password') === false && strpos($k, 'db_passwd') === false)
197 206
 				$_POST[$k] = addslashes($v);
207
+	}
198 208
 
199 209
 	// This is really quite simple; if ?delete is on the URL, delete the installer...
200 210
 	if (isset($_GET['delete']))
@@ -215,8 +225,7 @@  discard block
 block discarded – undo
215 225
 			$ftp->close();
216 226
 
217 227
 			unset($_SESSION['installer_temp_ftp']);
218
-		}
219
-		else
228
+		} else
220 229
 		{
221 230
 			@unlink(__FILE__);
222 231
 
@@ -237,10 +246,11 @@  discard block
 block discarded – undo
237 246
 	{
238 247
 		// Get PHP's default timezone, if set
239 248
 		$ini_tz = ini_get('date.timezone');
240
-		if (!empty($ini_tz))
241
-			$timezone_id = $ini_tz;
242
-		else
243
-			$timezone_id = '';
249
+		if (!empty($ini_tz)) {
250
+					$timezone_id = $ini_tz;
251
+		} else {
252
+					$timezone_id = '';
253
+		}
244 254
 
245 255
 		// If date.timezone is unset, invalid, or just plain weird, make a best guess
246 256
 		if (!in_array($timezone_id, timezone_identifiers_list()))
@@ -270,8 +280,9 @@  discard block
 block discarded – undo
270 280
 		$dir = dir(dirname(__FILE__) . '/Themes/default/languages');
271 281
 		while ($entry = $dir->read())
272 282
 		{
273
-			if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php')
274
-				$incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12));
283
+			if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') {
284
+							$incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12));
285
+			}
275 286
 		}
276 287
 		$dir->close();
277 288
 	}
@@ -306,10 +317,11 @@  discard block
 block discarded – undo
306 317
 	}
307 318
 
308 319
 	// Override the language file?
309
-	if (isset($_GET['lang_file']))
310
-		$_SESSION['installer_temp_lang'] = $_GET['lang_file'];
311
-	elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file']))
312
-		$_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file'];
320
+	if (isset($_GET['lang_file'])) {
321
+			$_SESSION['installer_temp_lang'] = $_GET['lang_file'];
322
+	} elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) {
323
+			$_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file'];
324
+	}
313 325
 
314 326
 	// Make sure it exists, if it doesn't reset it.
315 327
 	if (!isset($_SESSION['installer_temp_lang']) || preg_match('~[^\\w_\\-.]~', $_SESSION['installer_temp_lang']) === 1 || !file_exists(dirname(__FILE__) . '/Themes/default/languages/' . $_SESSION['installer_temp_lang']))
@@ -318,8 +330,9 @@  discard block
 block discarded – undo
318 330
 		list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
319 331
 
320 332
 		// If we have english and some other language, use the other language.  We Americans hate english :P.
321
-		if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1)
322
-			list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
333
+		if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) {
334
+					list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
335
+		}
323 336
 	}
324 337
 
325 338
 	// And now include the actual language file itself.
@@ -332,15 +345,18 @@  discard block
 block discarded – undo
332 345
 	global $db_prefix, $db_connection, $sourcedir, $smcFunc, $modSettings;
333 346
 	global $db_server, $db_passwd, $db_type, $db_name, $db_user, $db_persist;
334 347
 
335
-	if (empty($sourcedir))
336
-		$sourcedir = dirname(__FILE__) . '/Sources';
348
+	if (empty($sourcedir)) {
349
+			$sourcedir = dirname(__FILE__) . '/Sources';
350
+	}
337 351
 
338 352
 	// Need this to check whether we need the database password.
339 353
 	require(dirname(__FILE__) . '/Settings.php');
340
-	if (!defined('SMF'))
341
-		define('SMF', 1);
342
-	if (empty($smcFunc))
343
-		$smcFunc = array();
354
+	if (!defined('SMF')) {
355
+			define('SMF', 1);
356
+	}
357
+	if (empty($smcFunc)) {
358
+			$smcFunc = array();
359
+	}
344 360
 
345 361
 	$modSettings['disableQueryCheck'] = true;
346 362
 
@@ -348,8 +364,9 @@  discard block
 block discarded – undo
348 364
 	if (!$db_connection)
349 365
 	{
350 366
 		require_once($sourcedir . '/Subs-Db-' . $db_type . '.php');
351
-		if (version_compare(PHP_VERSION, '5', '<'))
352
-			require_once($sourcedir . '/Subs-Compat.php');
367
+		if (version_compare(PHP_VERSION, '5', '<')) {
368
+					require_once($sourcedir . '/Subs-Compat.php');
369
+		}
353 370
 
354 371
 		$db_options = array('persist' => $db_persist);
355 372
 		$port = '';
@@ -360,19 +377,20 @@  discard block
 block discarded – undo
360 377
 			if ($db_type == 'mysql')
361 378
 			{
362 379
 				$port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port'];
363
-			}
364
-			elseif ($db_type == 'postgresql')
380
+			} elseif ($db_type == 'postgresql')
365 381
 			{
366 382
 				// PostgreSQL doesn't have a default port setting in php.ini, so just check against the default
367 383
 				$port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port'];
368 384
 			}
369 385
 		}
370 386
 
371
-		if (!empty($port))
372
-			$db_options['port'] = $port;
387
+		if (!empty($port)) {
388
+					$db_options['port'] = $port;
389
+		}
373 390
 
374
-		if (!$db_connection)
375
-			$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options);
391
+		if (!$db_connection) {
392
+					$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options);
393
+		}
376 394
 	}
377 395
 }
378 396
 
@@ -400,8 +418,9 @@  discard block
 block discarded – undo
400 418
 		// @todo REMOVE THIS!!
401 419
 		else
402 420
 		{
403
-			if (function_exists('doStep' . $_GET['step']))
404
-				call_user_func('doStep' . $_GET['step']);
421
+			if (function_exists('doStep' . $_GET['step'])) {
422
+							call_user_func('doStep' . $_GET['step']);
423
+			}
405 424
 		}
406 425
 		// Show the footer.
407 426
 		template_install_below();
@@ -419,8 +438,9 @@  discard block
 block discarded – undo
419 438
 	$incontext['sub_template'] = 'welcome_message';
420 439
 
421 440
 	// Done the submission?
422
-	if (isset($_POST['contbutt']))
423
-		return true;
441
+	if (isset($_POST['contbutt'])) {
442
+			return true;
443
+	}
424 444
 
425 445
 	// See if we think they have already installed it?
426 446
 	if (is_readable(dirname(__FILE__) . '/Settings.php'))
@@ -428,14 +448,17 @@  discard block
 block discarded – undo
428 448
 		$probably_installed = 0;
429 449
 		foreach (file(dirname(__FILE__) . '/Settings.php') as $line)
430 450
 		{
431
-			if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line))
432
-				$probably_installed++;
433
-			if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line))
434
-				$probably_installed++;
451
+			if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) {
452
+							$probably_installed++;
453
+			}
454
+			if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) {
455
+							$probably_installed++;
456
+			}
435 457
 		}
436 458
 
437
-		if ($probably_installed == 2)
438
-			$incontext['warning'] = $txt['error_already_installed'];
459
+		if ($probably_installed == 2) {
460
+					$incontext['warning'] = $txt['error_already_installed'];
461
+		}
439 462
 	}
440 463
 
441 464
 	// Is some database support even compiled in?
@@ -450,45 +473,54 @@  discard block
 block discarded – undo
450 473
 				$databases[$key]['supported'] = false;
451 474
 				$notFoundSQLFile = true;
452 475
 				$txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql');
476
+			} else {
477
+							$incontext['supported_databases'][] = $db;
453 478
 			}
454
-			else
455
-				$incontext['supported_databases'][] = $db;
456 479
 		}
457 480
 	}
458 481
 
459 482
 	// Check the PHP version.
460
-	if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>=')))
461
-		$error = 'error_php_too_low';
483
+	if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) {
484
+			$error = 'error_php_too_low';
485
+	}
462 486
 	// Make sure we have a supported database
463
-	elseif (empty($incontext['supported_databases']))
464
-		$error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing';
487
+	elseif (empty($incontext['supported_databases'])) {
488
+			$error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing';
489
+	}
465 490
 	// How about session support?  Some crazy sysadmin remove it?
466
-	elseif (!function_exists('session_start'))
467
-		$error = 'error_session_missing';
491
+	elseif (!function_exists('session_start')) {
492
+			$error = 'error_session_missing';
493
+	}
468 494
 	// Make sure they uploaded all the files.
469
-	elseif (!file_exists(dirname(__FILE__) . '/index.php'))
470
-		$error = 'error_missing_files';
495
+	elseif (!file_exists(dirname(__FILE__) . '/index.php')) {
496
+			$error = 'error_missing_files';
497
+	}
471 498
 	// Very simple check on the session.save_path for Windows.
472 499
 	// @todo Move this down later if they don't use database-driven sessions?
473
-	elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\')
474
-		$error = 'error_session_save_path';
500
+	elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') {
501
+			$error = 'error_session_save_path';
502
+	}
475 503
 
476 504
 	// Since each of the three messages would look the same, anyway...
477
-	if (isset($error))
478
-		$incontext['error'] = $txt[$error];
505
+	if (isset($error)) {
506
+			$incontext['error'] = $txt[$error];
507
+	}
479 508
 
480 509
 	// Mod_security blocks everything that smells funny. Let SMF handle security.
481
-	if (!fixModSecurity() && !isset($_GET['overmodsecurity']))
482
-		$incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again'];
510
+	if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) {
511
+			$incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again'];
512
+	}
483 513
 
484 514
 	// Confirm mbstring is loaded...
485
-	if (!extension_loaded('mbstring'))
486
-		$incontext['error'] = $txt['install_no_mbstring'];
515
+	if (!extension_loaded('mbstring')) {
516
+			$incontext['error'] = $txt['install_no_mbstring'];
517
+	}
487 518
 
488 519
 	// Check for https stream support.
489 520
 	$supported_streams = stream_get_wrappers();
490
-	if (!in_array('https', $supported_streams))
491
-		$incontext['warning'] = $txt['install_no_https'];
521
+	if (!in_array('https', $supported_streams)) {
522
+			$incontext['warning'] = $txt['install_no_https'];
523
+	}
492 524
 
493 525
 	return false;
494 526
 }
@@ -514,12 +546,14 @@  discard block
 block discarded – undo
514 546
 		'db_last_error.php',
515 547
 	);
516 548
 
517
-	foreach ($incontext['detected_languages'] as $lang => $temp)
518
-		$extra_files[] = 'Themes/default/languages/' . $lang;
549
+	foreach ($incontext['detected_languages'] as $lang => $temp) {
550
+			$extra_files[] = 'Themes/default/languages/' . $lang;
551
+	}
519 552
 
520 553
 	// With mod_security installed, we could attempt to fix it with .htaccess.
521
-	if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules()))
522
-		$writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.';
554
+	if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) {
555
+			$writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.';
556
+	}
523 557
 
524 558
 	$failed_files = array();
525 559
 
@@ -531,20 +565,23 @@  discard block
 block discarded – undo
531 565
 		foreach ($writable_files as $file)
532 566
 		{
533 567
 			// Some files won't exist, try to address up front
534
-			if (!file_exists(dirname(__FILE__) . '/' . $file))
535
-				@touch(dirname(__FILE__) . '/' . $file);
568
+			if (!file_exists(dirname(__FILE__) . '/' . $file)) {
569
+							@touch(dirname(__FILE__) . '/' . $file);
570
+			}
536 571
 			// NOW do the writable check...
537 572
 			if (!is_writable(dirname(__FILE__) . '/' . $file))
538 573
 			{
539 574
 				@chmod(dirname(__FILE__) . '/' . $file, 0755);
540 575
 
541 576
 				// Well, 755 hopefully worked... if not, try 777.
542
-				if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777))
543
-					$failed_files[] = $file;
577
+				if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) {
578
+									$failed_files[] = $file;
579
+				}
544 580
 			}
545 581
 		}
546
-		foreach ($extra_files as $file)
547
-			@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
582
+		foreach ($extra_files as $file) {
583
+					@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
584
+		}
548 585
 	}
549 586
 	// Windows is trickier.  Let's try opening for r+...
550 587
 	else
@@ -554,30 +591,35 @@  discard block
 block discarded – undo
554 591
 		foreach ($writable_files as $file)
555 592
 		{
556 593
 			// Folders can't be opened for write... but the index.php in them can ;)
557
-			if (is_dir(dirname(__FILE__) . '/' . $file))
558
-				$file .= '/index.php';
594
+			if (is_dir(dirname(__FILE__) . '/' . $file)) {
595
+							$file .= '/index.php';
596
+			}
559 597
 
560 598
 			// Funny enough, chmod actually does do something on windows - it removes the read only attribute.
561 599
 			@chmod(dirname(__FILE__) . '/' . $file, 0777);
562 600
 			$fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+');
563 601
 
564 602
 			// Hmm, okay, try just for write in that case...
565
-			if (!is_resource($fp))
566
-				$fp = @fopen(dirname(__FILE__) . '/' . $file, 'w');
603
+			if (!is_resource($fp)) {
604
+							$fp = @fopen(dirname(__FILE__) . '/' . $file, 'w');
605
+			}
567 606
 
568
-			if (!is_resource($fp))
569
-				$failed_files[] = $file;
607
+			if (!is_resource($fp)) {
608
+							$failed_files[] = $file;
609
+			}
570 610
 
571 611
 			@fclose($fp);
572 612
 		}
573
-		foreach ($extra_files as $file)
574
-			@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
613
+		foreach ($extra_files as $file) {
614
+					@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
615
+		}
575 616
 	}
576 617
 
577 618
 	$failure = count($failed_files) >= 1;
578 619
 
579
-	if (!isset($_SERVER))
580
-		return !$failure;
620
+	if (!isset($_SERVER)) {
621
+			return !$failure;
622
+	}
581 623
 
582 624
 	// Put the list into context.
583 625
 	$incontext['failed_files'] = $failed_files;
@@ -625,19 +667,23 @@  discard block
 block discarded – undo
625 667
 
626 668
 		if (!isset($ftp) || $ftp->error !== false)
627 669
 		{
628
-			if (!isset($ftp))
629
-				$ftp = new ftp_connection(null);
670
+			if (!isset($ftp)) {
671
+							$ftp = new ftp_connection(null);
672
+			}
630 673
 			// Save the error so we can mess with listing...
631
-			elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message))
632
-				$incontext['ftp_errors'][] = $ftp->last_message;
674
+			elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) {
675
+							$incontext['ftp_errors'][] = $ftp->last_message;
676
+			}
633 677
 
634 678
 			list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__));
635 679
 
636
-			if (empty($_POST['ftp_path']) && $found_path)
637
-				$_POST['ftp_path'] = $detect_path;
680
+			if (empty($_POST['ftp_path']) && $found_path) {
681
+							$_POST['ftp_path'] = $detect_path;
682
+			}
638 683
 
639
-			if (!isset($_POST['ftp_username']))
640
-				$_POST['ftp_username'] = $username;
684
+			if (!isset($_POST['ftp_username'])) {
685
+							$_POST['ftp_username'] = $username;
686
+			}
641 687
 
642 688
 			// Set the username etc, into context.
643 689
 			$incontext['ftp'] = array(
@@ -649,8 +695,7 @@  discard block
 block discarded – undo
649 695
 			);
650 696
 
651 697
 			return false;
652
-		}
653
-		else
698
+		} else
654 699
 		{
655 700
 			$_SESSION['installer_temp_ftp'] = array(
656 701
 				'server' => $_POST['ftp_server'],
@@ -664,10 +709,12 @@  discard block
 block discarded – undo
664 709
 
665 710
 			foreach ($failed_files as $file)
666 711
 			{
667
-				if (!is_writable(dirname(__FILE__) . '/' . $file))
668
-					$ftp->chmod($file, 0755);
669
-				if (!is_writable(dirname(__FILE__) . '/' . $file))
670
-					$ftp->chmod($file, 0777);
712
+				if (!is_writable(dirname(__FILE__) . '/' . $file)) {
713
+									$ftp->chmod($file, 0755);
714
+				}
715
+				if (!is_writable(dirname(__FILE__) . '/' . $file)) {
716
+									$ftp->chmod($file, 0777);
717
+				}
671 718
 				if (!is_writable(dirname(__FILE__) . '/' . $file))
672 719
 				{
673 720
 					$failed_files_updated[] = $file;
@@ -723,15 +770,17 @@  discard block
 block discarded – undo
723 770
 
724 771
 			if (!$foundOne)
725 772
 			{
726
-				if (isset($db['default_host']))
727
-					$incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost';
773
+				if (isset($db['default_host'])) {
774
+									$incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost';
775
+				}
728 776
 				if (isset($db['default_user']))
729 777
 				{
730 778
 					$incontext['db']['user'] = ini_get($db['default_user']);
731 779
 					$incontext['db']['name'] = ini_get($db['default_user']);
732 780
 				}
733
-				if (isset($db['default_password']))
734
-					$incontext['db']['pass'] = ini_get($db['default_password']);
781
+				if (isset($db['default_password'])) {
782
+									$incontext['db']['pass'] = ini_get($db['default_password']);
783
+				}
735 784
 
736 785
 				// For simplicity and less confusion, leave the port blank by default
737 786
 				$incontext['db']['port'] = '';
@@ -750,10 +799,10 @@  discard block
 block discarded – undo
750 799
 		$incontext['db']['server'] = $_POST['db_server'];
751 800
 		$incontext['db']['prefix'] = $_POST['db_prefix'];
752 801
 
753
-		if (!empty($_POST['db_port']))
754
-			$incontext['db']['port'] = $_POST['db_port'];
755
-	}
756
-	else
802
+		if (!empty($_POST['db_port'])) {
803
+					$incontext['db']['port'] = $_POST['db_port'];
804
+		}
805
+	} else
757 806
 	{
758 807
 		$incontext['db']['prefix'] = 'smf_';
759 808
 	}
@@ -789,10 +838,11 @@  discard block
 block discarded – undo
789 838
 		if (!empty($_POST['db_port']))
790 839
 		{
791 840
 			// For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though.
792
-			if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port'))
793
-				$vars['db_port'] = (int) $_POST['db_port'];
794
-			elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432)
795
-				$vars['db_port'] = (int) $_POST['db_port'];
841
+			if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) {
842
+							$vars['db_port'] = (int) $_POST['db_port'];
843
+			} elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) {
844
+							$vars['db_port'] = (int) $_POST['db_port'];
845
+			}
796 846
 		}
797 847
 
798 848
 		// God I hope it saved!
@@ -805,8 +855,9 @@  discard block
 block discarded – undo
805 855
 		// Make sure it works.
806 856
 		require(dirname(__FILE__) . '/Settings.php');
807 857
 
808
-		if (empty($sourcedir))
809
-			$sourcedir = dirname(__FILE__) . '/Sources';
858
+		if (empty($sourcedir)) {
859
+					$sourcedir = dirname(__FILE__) . '/Sources';
860
+		}
810 861
 
811 862
 		// Better find the database file!
812 863
 		if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php'))
@@ -816,18 +867,21 @@  discard block
 block discarded – undo
816 867
 		}
817 868
 
818 869
 		// Now include it for database functions!
819
-		if (!defined('SMF'))
820
-			define('SMF', 1);
870
+		if (!defined('SMF')) {
871
+					define('SMF', 1);
872
+		}
821 873
 
822 874
 		$modSettings['disableQueryCheck'] = true;
823
-		if (empty($smcFunc))
824
-			$smcFunc = array();
875
+		if (empty($smcFunc)) {
876
+					$smcFunc = array();
877
+		}
825 878
 
826 879
 			require_once($sourcedir . '/Subs-Db-' . $db_type . '.php');
827 880
 
828 881
 		// What - running PHP4? The shame!
829
-		if (version_compare(PHP_VERSION, '5', '<'))
830
-			require_once($sourcedir . '/Subs-Compat.php');
882
+		if (version_compare(PHP_VERSION, '5', '<')) {
883
+					require_once($sourcedir . '/Subs-Compat.php');
884
+		}
831 885
 
832 886
 		// Attempt a connection.
833 887
 		$needsDB = !empty($databases[$db_type]['always_has_db']);
@@ -915,12 +969,14 @@  discard block
 block discarded – undo
915 969
 	$incontext['page_title'] = $txt['install_settings'];
916 970
 
917 971
 	// Let's see if we got the database type correct.
918
-	if (isset($_POST['db_type'], $databases[$_POST['db_type']]))
919
-		$db_type = $_POST['db_type'];
972
+	if (isset($_POST['db_type'], $databases[$_POST['db_type']])) {
973
+			$db_type = $_POST['db_type'];
974
+	}
920 975
 
921 976
 	// Else we'd better be able to get the connection.
922
-	else
923
-		load_database();
977
+	else {
978
+			load_database();
979
+	}
924 980
 
925 981
 	$db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type;
926 982
 
@@ -957,18 +1013,21 @@  discard block
 block discarded – undo
957 1013
 	// Submitting?
958 1014
 	if (isset($_POST['boardurl']))
959 1015
 	{
960
-		if (substr($_POST['boardurl'], -10) == '/index.php')
961
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
962
-		elseif (substr($_POST['boardurl'], -1) == '/')
963
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
964
-		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://')
965
-			$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
1016
+		if (substr($_POST['boardurl'], -10) == '/index.php') {
1017
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
1018
+		} elseif (substr($_POST['boardurl'], -1) == '/') {
1019
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
1020
+		}
1021
+		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') {
1022
+					$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
1023
+		}
966 1024
 
967 1025
 		//Make sure boardurl is aligned with ssl setting
968
-		if (empty($_POST['force_ssl']))
969
-			$_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://'));
970
-		else
971
-			$_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://'));		
1026
+		if (empty($_POST['force_ssl'])) {
1027
+					$_POST['boardurl'] = strtr($_POST['boardurl'], array('https://' => 'http://'));
1028
+		} else {
1029
+					$_POST['boardurl'] = strtr($_POST['boardurl'], array('http://' => 'https://'));
1030
+		}
972 1031
 
973 1032
 		// Save these variables.
974 1033
 		$vars = array(
@@ -1007,10 +1066,10 @@  discard block
 block discarded – undo
1007 1066
 			{
1008 1067
 				$incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']);
1009 1068
 				return false;
1010
-			}
1011
-			else
1012
-				// Set the character set here.
1069
+			} else {
1070
+							// Set the character set here.
1013 1071
 				updateSettingsFile(array('db_character_set' => 'utf8'));
1072
+			}
1014 1073
 		}
1015 1074
 
1016 1075
 		// Good, skip on.
@@ -1030,8 +1089,9 @@  discard block
 block discarded – undo
1030 1089
 	$incontext['continue'] = 1;
1031 1090
 
1032 1091
 	// Already done?
1033
-	if (isset($_POST['pop_done']))
1034
-		return true;
1092
+	if (isset($_POST['pop_done'])) {
1093
+			return true;
1094
+	}
1035 1095
 
1036 1096
 	// Reload settings.
1037 1097
 	require(dirname(__FILE__) . '/Settings.php');
@@ -1049,8 +1109,9 @@  discard block
 block discarded – undo
1049 1109
 	$modSettings = array();
1050 1110
 	if ($result !== false)
1051 1111
 	{
1052
-		while ($row = $smcFunc['db_fetch_assoc']($result))
1053
-			$modSettings[$row['variable']] = $row['value'];
1112
+		while ($row = $smcFunc['db_fetch_assoc']($result)) {
1113
+					$modSettings[$row['variable']] = $row['value'];
1114
+		}
1054 1115
 		$smcFunc['db_free_result']($result);
1055 1116
 
1056 1117
 		// Do they match?  If so, this is just a refresh so charge on!
@@ -1063,20 +1124,22 @@  discard block
 block discarded – undo
1063 1124
 	$modSettings['disableQueryCheck'] = true;
1064 1125
 
1065 1126
 	// If doing UTF8, select it. PostgreSQL requires passing it as a string...
1066
-	if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support']))
1067
-		$smcFunc['db_query']('', '
1127
+	if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) {
1128
+			$smcFunc['db_query']('', '
1068 1129
 			SET NAMES {string:utf8}',
1069 1130
 			array(
1070 1131
 				'db_error_skip' => true,
1071 1132
 				'utf8' => 'utf8',
1072 1133
 			)
1073 1134
 		);
1135
+	}
1074 1136
 
1075 1137
 	// Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments...
1076
-	if (substr(__DIR__, -1) == '\\')
1077
-		$attachdir = __DIR__ . 'attachments';
1078
-	else
1079
-		$attachdir = __DIR__ . '/attachments';
1138
+	if (substr(__DIR__, -1) == '\\') {
1139
+			$attachdir = __DIR__ . 'attachments';
1140
+	} else {
1141
+			$attachdir = __DIR__ . '/attachments';
1142
+	}
1080 1143
 
1081 1144
 	$replaces = array(
1082 1145
 		'{$db_prefix}' => $db_prefix,
@@ -1093,8 +1156,9 @@  discard block
 block discarded – undo
1093 1156
 
1094 1157
 	foreach ($txt as $key => $value)
1095 1158
 	{
1096
-		if (substr($key, 0, 8) == 'default_')
1097
-			$replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value);
1159
+		if (substr($key, 0, 8) == 'default_') {
1160
+					$replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value);
1161
+		}
1098 1162
 	}
1099 1163
 	$replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n'));
1100 1164
 
@@ -1109,8 +1173,9 @@  discard block
 block discarded – undo
1109 1173
 
1110 1174
 		while ($row = $smcFunc['db_fetch_assoc']($get_engines))
1111 1175
 		{
1112
-			if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT')
1113
-				$engines[] = $row['Engine'];
1176
+			if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') {
1177
+							$engines[] = $row['Engine'];
1178
+			}
1114 1179
 		}
1115 1180
 
1116 1181
 		// Done with this now
@@ -1134,8 +1199,7 @@  discard block
 block discarded – undo
1134 1199
 			$replaces['START TRANSACTION;'] = '';
1135 1200
 			$replaces['COMMIT;'] = '';
1136 1201
 		}
1137
-	}
1138
-	else
1202
+	} else
1139 1203
 	{
1140 1204
 		$has_innodb = false;
1141 1205
 	}
@@ -1157,21 +1221,24 @@  discard block
 block discarded – undo
1157 1221
 	foreach ($sql_lines as $count => $line)
1158 1222
 	{
1159 1223
 		// No comments allowed!
1160
-		if (substr(trim($line), 0, 1) != '#')
1161
-			$current_statement .= "\n" . rtrim($line);
1224
+		if (substr(trim($line), 0, 1) != '#') {
1225
+					$current_statement .= "\n" . rtrim($line);
1226
+		}
1162 1227
 
1163 1228
 		// Is this the end of the query string?
1164
-		if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines)))
1165
-			continue;
1229
+		if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) {
1230
+					continue;
1231
+		}
1166 1232
 
1167 1233
 		// Does this table already exist?  If so, don't insert more data into it!
1168 1234
 		if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists))
1169 1235
 		{
1170 1236
 			preg_match_all('~\)[,;]~', $current_statement, $matches);
1171
-			if (!empty($matches[0]))
1172
-				$incontext['sql_results']['insert_dups'] += count($matches[0]);
1173
-			else
1174
-				$incontext['sql_results']['insert_dups']++;
1237
+			if (!empty($matches[0])) {
1238
+							$incontext['sql_results']['insert_dups'] += count($matches[0]);
1239
+			} else {
1240
+							$incontext['sql_results']['insert_dups']++;
1241
+			}
1175 1242
 
1176 1243
 			$current_statement = '';
1177 1244
 			continue;
@@ -1180,8 +1247,9 @@  discard block
 block discarded – undo
1180 1247
 		if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false)
1181 1248
 		{
1182 1249
 			// Use the appropriate function based on the DB type
1183
-			if ($db_type == 'mysql' || $db_type == 'mysqli')
1184
-				$db_errorno = $db_type . '_errno';
1250
+			if ($db_type == 'mysql' || $db_type == 'mysqli') {
1251
+							$db_errorno = $db_type . '_errno';
1252
+			}
1185 1253
 
1186 1254
 			// Error 1050: Table already exists!
1187 1255
 			// @todo Needs to be made better!
@@ -1196,18 +1264,18 @@  discard block
 block discarded – undo
1196 1264
 				// MySQLi requires a connection object. It's optional with MySQL and Postgres
1197 1265
 				$incontext['failures'][$count] = $smcFunc['db_error']($db_connection);
1198 1266
 			}
1199
-		}
1200
-		else
1267
+		} else
1201 1268
 		{
1202
-			if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1203
-				$incontext['sql_results']['tables']++;
1204
-			elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1269
+			if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) {
1270
+							$incontext['sql_results']['tables']++;
1271
+			} elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1205 1272
 			{
1206 1273
 				preg_match_all('~\)[,;]~', $current_statement, $matches);
1207
-				if (!empty($matches[0]))
1208
-					$incontext['sql_results']['inserts'] += count($matches[0]);
1209
-				else
1210
-					$incontext['sql_results']['inserts']++;
1274
+				if (!empty($matches[0])) {
1275
+									$incontext['sql_results']['inserts'] += count($matches[0]);
1276
+				} else {
1277
+									$incontext['sql_results']['inserts']++;
1278
+				}
1211 1279
 			}
1212 1280
 		}
1213 1281
 
@@ -1220,15 +1288,17 @@  discard block
 block discarded – undo
1220 1288
 	// Sort out the context for the SQL.
1221 1289
 	foreach ($incontext['sql_results'] as $key => $number)
1222 1290
 	{
1223
-		if ($number == 0)
1224
-			unset($incontext['sql_results'][$key]);
1225
-		else
1226
-			$incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number);
1291
+		if ($number == 0) {
1292
+					unset($incontext['sql_results'][$key]);
1293
+		} else {
1294
+					$incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number);
1295
+		}
1227 1296
 	}
1228 1297
 
1229 1298
 	// Make sure UTF will be used globally.
1230
-	if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8'])))
1231
-		$newSettings[] = array('global_character_set', 'UTF-8');
1299
+	if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) {
1300
+			$newSettings[] = array('global_character_set', 'UTF-8');
1301
+	}
1232 1302
 
1233 1303
 	// Auto-detect local & global cookie settings
1234 1304
 	$url_parts = parse_url($boardurl);
@@ -1257,15 +1327,19 @@  discard block
 block discarded – undo
1257 1327
 
1258 1328
 		// Look for subfolder, if found, set localCookie
1259 1329
 		// Checking for len > 1 ensures you don't have just a slash...
1260
-		if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1)
1261
-			$localCookies = '1';
1330
+		if (!empty($url_parts['path']) && strlen($url_parts['path']) > 1) {
1331
+					$localCookies = '1';
1332
+		}
1262 1333
 
1263
-		if (isset($globalCookies))
1264
-			$newSettings[] = array('globalCookies', $globalCookies);
1265
-		if (isset($globalCookiesDomain))
1266
-			$newSettings[] = array('globalCookiesDomain', $globalCookiesDomain);
1267
-		if (isset($localCookies))
1268
-			$newSettings[] = array('localCookies', $localCookies);
1334
+		if (isset($globalCookies)) {
1335
+					$newSettings[] = array('globalCookies', $globalCookies);
1336
+		}
1337
+		if (isset($globalCookiesDomain)) {
1338
+					$newSettings[] = array('globalCookiesDomain', $globalCookiesDomain);
1339
+		}
1340
+		if (isset($localCookies)) {
1341
+					$newSettings[] = array('localCookies', $localCookies);
1342
+		}
1269 1343
 	}
1270 1344
 
1271 1345
 	// Are we allowing stat collection?
@@ -1283,16 +1357,17 @@  discard block
 block discarded – undo
1283 1357
 			fwrite($fp, $out);
1284 1358
 
1285 1359
 			$return_data = '';
1286
-			while (!feof($fp))
1287
-				$return_data .= fgets($fp, 128);
1360
+			while (!feof($fp)) {
1361
+							$return_data .= fgets($fp, 128);
1362
+			}
1288 1363
 
1289 1364
 			fclose($fp);
1290 1365
 
1291 1366
 			// Get the unique site ID.
1292 1367
 			preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
1293 1368
 
1294
-			if (!empty($ID[1]))
1295
-				$smcFunc['db_insert']('replace',
1369
+			if (!empty($ID[1])) {
1370
+							$smcFunc['db_insert']('replace',
1296 1371
 					$db_prefix . 'settings',
1297 1372
 					array('variable' => 'string', 'value' => 'string'),
1298 1373
 					array(
@@ -1301,11 +1376,12 @@  discard block
 block discarded – undo
1301 1376
 					),
1302 1377
 					array('variable')
1303 1378
 				);
1379
+			}
1304 1380
 		}
1305 1381
 	}
1306 1382
 	// Don't remove stat collection unless we unchecked the box for real, not from the loop.
1307
-	elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats']))
1308
-		$smcFunc['db_query']('', '
1383
+	elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) {
1384
+			$smcFunc['db_query']('', '
1309 1385
 			DELETE FROM {db_prefix}settings
1310 1386
 			WHERE variable = {string:enable_sm_stats}',
1311 1387
 			array(
@@ -1313,20 +1389,23 @@  discard block
 block discarded – undo
1313 1389
 				'db_error_skip' => true,
1314 1390
 			)
1315 1391
 		);
1392
+	}
1316 1393
 
1317 1394
 	// Are we enabling SSL?
1318
-	if (!empty($_POST['force_ssl']))
1319
-		$newSettings[] = array('force_ssl', 2);
1395
+	if (!empty($_POST['force_ssl'])) {
1396
+			$newSettings[] = array('force_ssl', 2);
1397
+	}
1320 1398
 
1321 1399
 	// Setting a timezone is required.
1322 1400
 	if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set'))
1323 1401
 	{
1324 1402
 		// Get PHP's default timezone, if set
1325 1403
 		$ini_tz = ini_get('date.timezone');
1326
-		if (!empty($ini_tz))
1327
-			$timezone_id = $ini_tz;
1328
-		else
1329
-			$timezone_id = '';
1404
+		if (!empty($ini_tz)) {
1405
+					$timezone_id = $ini_tz;
1406
+		} else {
1407
+					$timezone_id = '';
1408
+		}
1330 1409
 
1331 1410
 		// If date.timezone is unset, invalid, or just plain weird, make a best guess
1332 1411
 		if (!in_array($timezone_id, timezone_identifiers_list()))
@@ -1335,8 +1414,9 @@  discard block
 block discarded – undo
1335 1414
 			$timezone_id = timezone_name_from_abbr('', $server_offset, 0);
1336 1415
 		}
1337 1416
 
1338
-		if (date_default_timezone_set($timezone_id))
1339
-			$newSettings[] = array('default_timezone', $timezone_id);
1417
+		if (date_default_timezone_set($timezone_id)) {
1418
+					$newSettings[] = array('default_timezone', $timezone_id);
1419
+		}
1340 1420
 	}
1341 1421
 
1342 1422
 	if (!empty($newSettings))
@@ -1367,16 +1447,18 @@  discard block
 block discarded – undo
1367 1447
 	}
1368 1448
 
1369 1449
 	// MySQL specific stuff
1370
-	if (substr($db_type, 0, 5) != 'mysql')
1371
-		return false;
1450
+	if (substr($db_type, 0, 5) != 'mysql') {
1451
+			return false;
1452
+	}
1372 1453
 
1373 1454
 	// Find database user privileges.
1374 1455
 	$privs = array();
1375 1456
 	$get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array());
1376 1457
 	while ($row = $smcFunc['db_fetch_assoc']($get_privs))
1377 1458
 	{
1378
-		if ($row['Privilege'] == 'Alter')
1379
-			$privs[] = $row['Privilege'];
1459
+		if ($row['Privilege'] == 'Alter') {
1460
+					$privs[] = $row['Privilege'];
1461
+		}
1380 1462
 	}
1381 1463
 	$smcFunc['db_free_result']($get_privs);
1382 1464
 
@@ -1406,8 +1488,9 @@  discard block
 block discarded – undo
1406 1488
 	$incontext['continue'] = 1;
1407 1489
 
1408 1490
 	// Skipping?
1409
-	if (!empty($_POST['skip']))
1410
-		return true;
1491
+	if (!empty($_POST['skip'])) {
1492
+			return true;
1493
+	}
1411 1494
 
1412 1495
 	// Need this to check whether we need the database password.
1413 1496
 	require(dirname(__FILE__) . '/Settings.php');
@@ -1424,18 +1507,22 @@  discard block
 block discarded – undo
1424 1507
 	// We need this to properly hash the password for Admin
1425 1508
 	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1426 1509
 			global $sourcedir;
1427
-			if (function_exists('mb_strtolower'))
1428
-				return mb_strtolower($string, 'UTF-8');
1510
+			if (function_exists('mb_strtolower')) {
1511
+							return mb_strtolower($string, 'UTF-8');
1512
+			}
1429 1513
 			require_once($sourcedir . '/Subs-Charset.php');
1430 1514
 			return utf8_strtolower($string);
1431 1515
 		};
1432 1516
 
1433
-	if (!isset($_POST['username']))
1434
-		$_POST['username'] = '';
1435
-	if (!isset($_POST['email']))
1436
-		$_POST['email'] = '';
1437
-	if (!isset($_POST['server_email']))
1438
-		$_POST['server_email'] = '';
1517
+	if (!isset($_POST['username'])) {
1518
+			$_POST['username'] = '';
1519
+	}
1520
+	if (!isset($_POST['email'])) {
1521
+			$_POST['email'] = '';
1522
+	}
1523
+	if (!isset($_POST['server_email'])) {
1524
+			$_POST['server_email'] = '';
1525
+	}
1439 1526
 
1440 1527
 	$incontext['username'] = htmlspecialchars(stripslashes($_POST['username']));
1441 1528
 	$incontext['email'] = htmlspecialchars(stripslashes($_POST['email']));
@@ -1454,8 +1541,9 @@  discard block
 block discarded – undo
1454 1541
 			'admin_group' => 1,
1455 1542
 		)
1456 1543
 	);
1457
-	if ($smcFunc['db_num_rows']($request) != 0)
1458
-		$incontext['skip'] = 1;
1544
+	if ($smcFunc['db_num_rows']($request) != 0) {
1545
+			$incontext['skip'] = 1;
1546
+	}
1459 1547
 	$smcFunc['db_free_result']($request);
1460 1548
 
1461 1549
 	// Trying to create an account?
@@ -1486,8 +1574,9 @@  discard block
 block discarded – undo
1486 1574
 		}
1487 1575
 
1488 1576
 		// Update the webmaster's email?
1489
-		if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]'))
1490
-			updateSettingsFile(array('webmaster_email' => $_POST['server_email']));
1577
+		if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) {
1578
+					updateSettingsFile(array('webmaster_email' => $_POST['server_email']));
1579
+		}
1491 1580
 
1492 1581
 		// Work out whether we're going to have dodgy characters and remove them.
1493 1582
 		$invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0;
@@ -1510,32 +1599,27 @@  discard block
 block discarded – undo
1510 1599
 			$smcFunc['db_free_result']($result);
1511 1600
 
1512 1601
 			$incontext['account_existed'] = $txt['error_user_settings_taken'];
1513
-		}
1514
-		elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25)
1602
+		} elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25)
1515 1603
 		{
1516 1604
 			// Try the previous step again.
1517 1605
 			$incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long'];
1518 1606
 			return false;
1519
-		}
1520
-		elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false)
1607
+		} elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false)
1521 1608
 		{
1522 1609
 			// Try the previous step again.
1523 1610
 			$incontext['error'] = $txt['error_invalid_characters_username'];
1524 1611
 			return false;
1525
-		}
1526
-		elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255)
1612
+		} elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255)
1527 1613
 		{
1528 1614
 			// One step back, this time fill out a proper admin email address.
1529 1615
 			$incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']);
1530 1616
 			return false;
1531
-		}
1532
-		elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255)
1617
+		} elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255)
1533 1618
 		{
1534 1619
 			// One step back, this time fill out a proper admin email address.
1535 1620
 			$incontext['error'] = $txt['error_valid_server_email_needed'];
1536 1621
 			return false;
1537
-		}
1538
-		elseif ($_POST['username'] != '')
1622
+		} elseif ($_POST['username'] != '')
1539 1623
 		{
1540 1624
 			$incontext['member_salt'] = substr(md5(mt_rand()), 0, 4);
1541 1625
 
@@ -1603,17 +1687,19 @@  discard block
 block discarded – undo
1603 1687
 	reloadSettings();
1604 1688
 
1605 1689
 	// Bring a warning over.
1606
-	if (!empty($incontext['account_existed']))
1607
-		$incontext['warning'] = $incontext['account_existed'];
1690
+	if (!empty($incontext['account_existed'])) {
1691
+			$incontext['warning'] = $incontext['account_existed'];
1692
+	}
1608 1693
 
1609
-	if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support']))
1610
-		$smcFunc['db_query']('', '
1694
+	if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) {
1695
+			$smcFunc['db_query']('', '
1611 1696
 			SET NAMES {string:db_character_set}',
1612 1697
 			array(
1613 1698
 				'db_character_set' => $db_character_set,
1614 1699
 				'db_error_skip' => true,
1615 1700
 			)
1616 1701
 		);
1702
+	}
1617 1703
 
1618 1704
 	// As track stats is by default enabled let's add some activity.
1619 1705
 	$smcFunc['db_insert']('ignore',
@@ -1634,14 +1720,16 @@  discard block
 block discarded – undo
1634 1720
 	// Only proceed if we can load the data.
1635 1721
 	if ($request)
1636 1722
 	{
1637
-		while ($row = $smcFunc['db_fetch_row']($request))
1638
-			$modSettings[$row[0]] = $row[1];
1723
+		while ($row = $smcFunc['db_fetch_row']($request)) {
1724
+					$modSettings[$row[0]] = $row[1];
1725
+		}
1639 1726
 		$smcFunc['db_free_result']($request);
1640 1727
 	}
1641 1728
 
1642 1729
 	// Automatically log them in ;)
1643
-	if (isset($incontext['member_id']) && isset($incontext['member_salt']))
1644
-		setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt']));
1730
+	if (isset($incontext['member_id']) && isset($incontext['member_salt'])) {
1731
+			setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt']));
1732
+	}
1645 1733
 
1646 1734
 	$result = $smcFunc['db_query']('', '
1647 1735
 		SELECT value
@@ -1652,13 +1740,14 @@  discard block
 block discarded – undo
1652 1740
 			'db_error_skip' => true,
1653 1741
 		)
1654 1742
 	);
1655
-	if ($smcFunc['db_num_rows']($result) != 0)
1656
-		list ($db_sessions) = $smcFunc['db_fetch_row']($result);
1743
+	if ($smcFunc['db_num_rows']($result) != 0) {
1744
+			list ($db_sessions) = $smcFunc['db_fetch_row']($result);
1745
+	}
1657 1746
 	$smcFunc['db_free_result']($result);
1658 1747
 
1659
-	if (empty($db_sessions))
1660
-		$_SESSION['admin_time'] = time();
1661
-	else
1748
+	if (empty($db_sessions)) {
1749
+			$_SESSION['admin_time'] = time();
1750
+	} else
1662 1751
 	{
1663 1752
 		$_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211);
1664 1753
 
@@ -1682,8 +1771,9 @@  discard block
 block discarded – undo
1682 1771
 	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1683 1772
 		function($string){
1684 1773
 			global $sourcedir;
1685
-			if (function_exists('mb_strtolower'))
1686
-				return mb_strtolower($string, 'UTF-8');
1774
+			if (function_exists('mb_strtolower')) {
1775
+							return mb_strtolower($string, 'UTF-8');
1776
+			}
1687 1777
 			require_once($sourcedir . '/Subs-Charset.php');
1688 1778
 			return utf8_strtolower($string);
1689 1779
 		};
@@ -1699,8 +1789,9 @@  discard block
 block discarded – undo
1699 1789
 		)
1700 1790
 	);
1701 1791
 	$context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8';
1702
-	if ($smcFunc['db_num_rows']($request) > 0)
1703
-		updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
1792
+	if ($smcFunc['db_num_rows']($request) > 0) {
1793
+			updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
1794
+	}
1704 1795
 	$smcFunc['db_free_result']($request);
1705 1796
 
1706 1797
 	// Now is the perfect time to fetch the SM files.
@@ -1719,8 +1810,9 @@  discard block
 block discarded – undo
1719 1810
 
1720 1811
 	// Check if we need some stupid MySQL fix.
1721 1812
 	$server_version = $smcFunc['db_server_info']();
1722
-	if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
1723
-		updateSettings(array('db_mysql_group_by_fix' => '1'));
1813
+	if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) {
1814
+			updateSettings(array('db_mysql_group_by_fix' => '1'));
1815
+	}
1724 1816
 
1725 1817
 	// Some final context for the template.
1726 1818
 	$incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\';
@@ -1740,8 +1832,9 @@  discard block
 block discarded – undo
1740 1832
 	$settingsArray = file(dirname(__FILE__) . '/Settings.php');
1741 1833
 
1742 1834
 	// @todo Do we just want to read the file in clean, and split it this way always?
1743
-	if (count($settingsArray) == 1)
1744
-		$settingsArray = preg_split('~[\r\n]~', $settingsArray[0]);
1835
+	if (count($settingsArray) == 1) {
1836
+			$settingsArray = preg_split('~[\r\n]~', $settingsArray[0]);
1837
+	}
1745 1838
 
1746 1839
 	for ($i = 0, $n = count($settingsArray); $i < $n; $i++)
1747 1840
 	{
@@ -1756,19 +1849,22 @@  discard block
 block discarded – undo
1756 1849
 			continue;
1757 1850
 		}
1758 1851
 
1759
-		if (trim($settingsArray[$i]) == '?' . '>')
1760
-			$settingsArray[$i] = '';
1852
+		if (trim($settingsArray[$i]) == '?' . '>') {
1853
+					$settingsArray[$i] = '';
1854
+		}
1761 1855
 
1762 1856
 		// Don't trim or bother with it if it's not a variable.
1763
-		if (substr($settingsArray[$i], 0, 1) != '$')
1764
-			continue;
1857
+		if (substr($settingsArray[$i], 0, 1) != '$') {
1858
+					continue;
1859
+		}
1765 1860
 
1766 1861
 		$settingsArray[$i] = rtrim($settingsArray[$i]) . "\n";
1767 1862
 
1768
-		foreach ($vars as $var => $val)
1769
-			if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0)
1863
+		foreach ($vars as $var => $val) {
1864
+					if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0)
1770 1865
 			{
1771 1866
 				$comment = strstr($settingsArray[$i], '#');
1867
+		}
1772 1868
 				$settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n");
1773 1869
 				unset($vars[$var]);
1774 1870
 			}
@@ -1778,36 +1874,41 @@  discard block
 block discarded – undo
1778 1874
 	if (!empty($vars))
1779 1875
 	{
1780 1876
 		$settingsArray[$i++] = '';
1781
-		foreach ($vars as $var => $val)
1782
-			$settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n";
1877
+		foreach ($vars as $var => $val) {
1878
+					$settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n";
1879
+		}
1783 1880
 	}
1784 1881
 
1785 1882
 	// Blank out the file - done to fix a oddity with some servers.
1786 1883
 	$fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w');
1787
-	if (!$fp)
1788
-		return false;
1884
+	if (!$fp) {
1885
+			return false;
1886
+	}
1789 1887
 	fclose($fp);
1790 1888
 
1791 1889
 	$fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+');
1792 1890
 
1793 1891
 	// Gotta have one of these ;)
1794
-	if (trim($settingsArray[0]) != '<?php')
1795
-		fwrite($fp, "<?php\n");
1892
+	if (trim($settingsArray[0]) != '<?php') {
1893
+			fwrite($fp, "<?php\n");
1894
+	}
1796 1895
 
1797 1896
 	$lines = count($settingsArray);
1798 1897
 	for ($i = 0; $i < $lines - 1; $i++)
1799 1898
 	{
1800 1899
 		// Don't just write a bunch of blank lines.
1801
-		if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '')
1802
-			fwrite($fp, strtr($settingsArray[$i], "\r", ''));
1900
+		if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') {
1901
+					fwrite($fp, strtr($settingsArray[$i], "\r", ''));
1902
+		}
1803 1903
 	}
1804 1904
 	fwrite($fp, $settingsArray[$i] . '?' . '>');
1805 1905
 	fclose($fp);
1806 1906
 
1807 1907
 	// Even though on normal installations the filemtime should prevent this being used by the installer incorrectly
1808 1908
 	// it seems that there are times it might not. So let's MAKE it dump the cache.
1809
-	if (function_exists('opcache_invalidate'))
1810
-		opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);
1909
+	if (function_exists('opcache_invalidate')) {
1910
+			opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);
1911
+	}
1811 1912
 
1812 1913
 	return true;
1813 1914
 }
@@ -1832,9 +1933,9 @@  discard block
 block discarded – undo
1832 1933
 	SecFilterScanPOST Off
1833 1934
 </IfModule>';
1834 1935
 
1835
-	if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules()))
1836
-		return true;
1837
-	elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess'))
1936
+	if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) {
1937
+			return true;
1938
+	} elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess'))
1838 1939
 	{
1839 1940
 		$current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess'));
1840 1941
 
@@ -1846,29 +1947,28 @@  discard block
 block discarded – undo
1846 1947
 				fwrite($ht_handle, $htaccess_addition);
1847 1948
 				fclose($ht_handle);
1848 1949
 				return true;
1950
+			} else {
1951
+							return false;
1849 1952
 			}
1850
-			else
1851
-				return false;
1953
+		} else {
1954
+					return true;
1852 1955
 		}
1853
-		else
1854
-			return true;
1855
-	}
1856
-	elseif (file_exists(dirname(__FILE__) . '/.htaccess'))
1857
-		return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false;
1858
-	elseif (is_writable(dirname(__FILE__)))
1956
+	} elseif (file_exists(dirname(__FILE__) . '/.htaccess')) {
1957
+			return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false;
1958
+	} elseif (is_writable(dirname(__FILE__)))
1859 1959
 	{
1860 1960
 		if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w'))
1861 1961
 		{
1862 1962
 			fwrite($ht_handle, $htaccess_addition);
1863 1963
 			fclose($ht_handle);
1864 1964
 			return true;
1965
+		} else {
1966
+					return false;
1865 1967
 		}
1866
-		else
1968
+	} else {
1867 1969
 			return false;
1868 1970
 	}
1869
-	else
1870
-		return false;
1871
-}
1971
+	}
1872 1972
 
1873 1973
 function template_install_above()
1874 1974
 {
@@ -1906,9 +2006,10 @@  discard block
 block discarded – undo
1906 2006
 								<label for="installer_language">', $txt['installer_language'], ':</label>
1907 2007
 								<select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">';
1908 2008
 
1909
-		foreach ($incontext['detected_languages'] as $lang => $name)
1910
-			echo '
2009
+		foreach ($incontext['detected_languages'] as $lang => $name) {
2010
+					echo '
1911 2011
 									<option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>';
2012
+		}
1912 2013
 
1913 2014
 		echo '
1914 2015
 								</select>
@@ -1928,9 +2029,10 @@  discard block
 block discarded – undo
1928 2029
 						<h2>', $txt['upgrade_progress'], '</h2>
1929 2030
 						<ul>';
1930 2031
 
1931
-	foreach ($incontext['steps'] as $num => $step)
1932
-		echo '
2032
+	foreach ($incontext['steps'] as $num => $step) {
2033
+			echo '
1933 2034
 							<li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>';
2035
+	}
1934 2036
 
1935 2037
 	echo '
1936 2038
 						</ul>
@@ -1955,20 +2057,23 @@  discard block
 block discarded – undo
1955 2057
 		echo '
1956 2058
 								<div class="floatright">';
1957 2059
 
1958
-		if (!empty($incontext['continue']))
1959
-			echo '
2060
+		if (!empty($incontext['continue'])) {
2061
+					echo '
1960 2062
 									<input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button" />';
1961
-		if (!empty($incontext['skip']))
1962
-			echo '
2063
+		}
2064
+		if (!empty($incontext['skip'])) {
2065
+					echo '
1963 2066
 									<input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button" />';
2067
+		}
1964 2068
 		echo '
1965 2069
 								</div>';
1966 2070
 	}
1967 2071
 
1968 2072
 	// Show the closing form tag and other data only if not in the last step
1969
-	if (count($incontext['steps']) - 1 !== (int) $incontext['current_step'])
1970
-		echo '
2073
+	if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) {
2074
+			echo '
1971 2075
 							</form>';
2076
+	}
1972 2077
 
1973 2078
 	echo '
1974 2079
 						</div>
@@ -2003,13 +2108,15 @@  discard block
 block discarded – undo
2003 2108
 		</div>';
2004 2109
 
2005 2110
 	// Show the warnings, or not.
2006
-	if (template_warning_divs())
2007
-		echo '
2111
+	if (template_warning_divs()) {
2112
+			echo '
2008 2113
 		<h3>', $txt['install_all_lovely'], '</h3>';
2114
+	}
2009 2115
 
2010 2116
 	// Say we want the continue button!
2011
-	if (empty($incontext['error']))
2012
-		$incontext['continue'] = 1;
2117
+	if (empty($incontext['error'])) {
2118
+			$incontext['continue'] = 1;
2119
+	}
2013 2120
 
2014 2121
 	// For the latest version stuff.
2015 2122
 	echo '
@@ -2043,8 +2150,8 @@  discard block
 block discarded – undo
2043 2150
 	global $txt, $incontext;
2044 2151
 
2045 2152
 	// Errors are very serious..
2046
-	if (!empty($incontext['error']))
2047
-		echo '
2153
+	if (!empty($incontext['error'])) {
2154
+			echo '
2048 2155
 		<div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;">
2049 2156
 			<div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div>
2050 2157
 			<strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br>
@@ -2052,9 +2159,10 @@  discard block
 block discarded – undo
2052 2159
 				', $incontext['error'], '
2053 2160
 			</div>
2054 2161
 		</div>';
2162
+	}
2055 2163
 	// A warning message?
2056
-	elseif (!empty($incontext['warning']))
2057
-		echo '
2164
+	elseif (!empty($incontext['warning'])) {
2165
+			echo '
2058 2166
 		<div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;">
2059 2167
 			<div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div>
2060 2168
 			<strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br>
@@ -2062,6 +2170,7 @@  discard block
 block discarded – undo
2062 2170
 				', $incontext['warning'], '
2063 2171
 			</div>
2064 2172
 		</div>';
2173
+	}
2065 2174
 
2066 2175
 	return empty($incontext['error']) && empty($incontext['warning']);
2067 2176
 }
@@ -2077,27 +2186,30 @@  discard block
 block discarded – undo
2077 2186
 			<li>', $incontext['failed_files']), '</li>
2078 2187
 		</ul>';
2079 2188
 
2080
-	if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux')
2081
-		echo '
2189
+	if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') {
2190
+			echo '
2082 2191
 		<hr>
2083 2192
 		<p>', $txt['chmod_linux_info'], '</p>
2084 2193
 		<tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>';
2194
+	}
2085 2195
 
2086 2196
 	// This is serious!
2087
-	if (!template_warning_divs())
2088
-		return;
2197
+	if (!template_warning_divs()) {
2198
+			return;
2199
+	}
2089 2200
 
2090 2201
 	echo '
2091 2202
 		<hr>
2092 2203
 		<p>', $txt['ftp_setup_info'], '</p>';
2093 2204
 
2094
-	if (!empty($incontext['ftp_errors']))
2095
-		echo '
2205
+	if (!empty($incontext['ftp_errors'])) {
2206
+			echo '
2096 2207
 		<div class="error_message">
2097 2208
 			', $txt['error_ftp_no_connect'], '<br><br>
2098 2209
 			<code>', implode('<br>', $incontext['ftp_errors']), '</code>
2099 2210
 		</div>
2100 2211
 		<br>';
2212
+	}
2101 2213
 
2102 2214
 	echo '
2103 2215
 		<form action="', $incontext['form_url'], '" method="post">
@@ -2157,17 +2269,17 @@  discard block
 block discarded – undo
2157 2269
 				<td>
2158 2270
 					<select name="db_type" id="db_type_input" onchange="toggleDBInput();">';
2159 2271
 
2160
-	foreach ($incontext['supported_databases'] as $key => $db)
2161
-			echo '
2272
+	foreach ($incontext['supported_databases'] as $key => $db) {
2273
+				echo '
2162 2274
 						<option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>';
2275
+	}
2163 2276
 
2164 2277
 	echo '
2165 2278
 					</select>
2166 2279
 					<div class="smalltext block">', $txt['db_settings_type_info'], '</div>
2167 2280
 				</td>
2168 2281
 			</tr>';
2169
-	}
2170
-	else
2282
+	} else
2171 2283
 	{
2172 2284
 		echo '
2173 2285
 			<tr style="display: none;">
@@ -2360,9 +2472,10 @@  discard block
 block discarded – undo
2360 2472
 				<div style="color: red;">', $txt['error_db_queries'], '</div>
2361 2473
 				<ul>';
2362 2474
 
2363
-		foreach ($incontext['failures'] as $line => $fail)
2364
-			echo '
2475
+		foreach ($incontext['failures'] as $line => $fail) {
2476
+					echo '
2365 2477
 						<li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>';
2478
+		}
2366 2479
 
2367 2480
 		echo '
2368 2481
 				</ul>';
@@ -2423,15 +2536,16 @@  discard block
 block discarded – undo
2423 2536
 			</tr>
2424 2537
 		</table>';
2425 2538
 
2426
-	if ($incontext['require_db_confirm'])
2427
-		echo '
2539
+	if ($incontext['require_db_confirm']) {
2540
+			echo '
2428 2541
 		<h2>', $txt['user_settings_database'], '</h2>
2429 2542
 		<p>', $txt['user_settings_database_info'], '</p>
2430 2543
 
2431 2544
 		<div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;">
2432 2545
 			<input type="password" name="password3" size="30" />
2433 2546
 		</div>';
2434
-}
2547
+	}
2548
+	}
2435 2549
 
2436 2550
 // Tell them it's done, and to delete.
2437 2551
 function template_delete_install()
@@ -2444,14 +2558,15 @@  discard block
 block discarded – undo
2444 2558
 	template_warning_divs();
2445 2559
 
2446 2560
 	// Install directory still writable?
2447
-	if ($incontext['dir_still_writable'])
2448
-		echo '
2561
+	if ($incontext['dir_still_writable']) {
2562
+			echo '
2449 2563
 		<em>', $txt['still_writable'], '</em><br>
2450 2564
 		<br>';
2565
+	}
2451 2566
 
2452 2567
 	// Don't show the box if it's like 99% sure it won't work :P.
2453
-	if ($incontext['probably_delete_install'])
2454
-		echo '
2568
+	if ($incontext['probably_delete_install']) {
2569
+			echo '
2455 2570
 		<div style="margin: 1ex; font-weight: bold;">
2456 2571
 			<label for="delete_self"><input type="checkbox" id="delete_self" onclick="doTheDelete();" /> ', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</label>
2457 2572
 		</div>
@@ -2467,6 +2582,7 @@  discard block
 block discarded – undo
2467 2582
 			}
2468 2583
 		</script>
2469 2584
 		<br>';
2585
+	}
2470 2586
 
2471 2587
 	echo '
2472 2588
 		', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '<br>
Please login to merge, or discard this patch.
Themes/default/Profile.template.php 1 patch
Braces   +465 added lines, -346 removed lines patch added patch discarded remove patch
@@ -18,23 +18,25 @@  discard block
 block discarded – undo
18 18
 	global $context;
19 19
 
20 20
 	// Prevent Chrome from auto completing fields when viewing/editing other members profiles
21
-	if (isBrowser('is_chrome') && !$context['user']['is_owner'])
22
-		echo '
21
+	if (isBrowser('is_chrome') && !$context['user']['is_owner']) {
22
+			echo '
23 23
 	<script>
24 24
 		disableAutoComplete();
25 25
 	</script>';
26
+	}
26 27
 
27 28
 	// If an error occurred while trying to save previously, give the user a clue!
28 29
 	echo '
29 30
 					', template_error_message();
30 31
 
31 32
 	// If the profile was update successfully, let the user know this.
32
-	if (!empty($context['profile_updated']))
33
-		echo '
33
+	if (!empty($context['profile_updated'])) {
34
+			echo '
34 35
 					<div class="infobox">
35 36
 						', $context['profile_updated'], '
36 37
 					</div>';
37
-}
38
+	}
39
+	}
38 40
 
39 41
 /**
40 42
  * Template for any HTML needed below the profile (closing off divs/tables, etc.)
@@ -102,8 +104,7 @@  discard block
 block discarded – undo
102 104
 	if (empty($context['unread_alerts']))
103 105
 	{
104 106
 		template_alerts_all_read();
105
-	}
106
-	else
107
+	} else
107 108
 	{
108 109
 		foreach ($context['unread_alerts'] as $id_alert => $details)
109 110
 		{
@@ -164,10 +165,11 @@  discard block
 block discarded – undo
164 165
 			<div class="custom_fields_above_name">
165 166
 				<ul >';
166 167
 
167
-		foreach ($context['print_custom_fields']['above_member'] as $field)
168
-			if (!empty($field['output_html']))
168
+		foreach ($context['print_custom_fields']['above_member'] as $field) {
169
+					if (!empty($field['output_html']))
169 170
 				echo '
170 171
 					<li>', $field['output_html'], '</li>';
172
+		}
171 173
 
172 174
 		echo '
173 175
 				</ul>
@@ -188,10 +190,11 @@  discard block
 block discarded – undo
188 190
 			<div class="custom_fields_below_avatar">
189 191
 				<ul >';
190 192
 
191
-		foreach ($context['print_custom_fields']['below_avatar'] as $field)
192
-			if (!empty($field['output_html']))
193
+		foreach ($context['print_custom_fields']['below_avatar'] as $field) {
194
+					if (!empty($field['output_html']))
193 195
 				echo '
194 196
 					<li>', $field['output_html'], '</li>';
197
+		}
195 198
 
196 199
 		echo '
197 200
 				</ul>
@@ -202,22 +205,25 @@  discard block
 block discarded – undo
202 205
 		echo '
203 206
 			<ul class="clear">';
204 207
 	// Email is only visible if it's your profile or you have the moderate_forum permission
205
-	if ($context['member']['show_email'])
206
-		echo '
208
+	if ($context['member']['show_email']) {
209
+			echo '
207 210
 				<li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>';
211
+	}
208 212
 
209 213
 	// Don't show an icon if they haven't specified a website.
210
-	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
211
-		echo '
214
+	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) {
215
+			echo '
212 216
 				<li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
217
+	}
213 218
 
214 219
 	// Are there any custom profile fields as icons?
215 220
 	if (!empty($context['print_custom_fields']['icons']))
216 221
 	{
217
-		foreach ($context['print_custom_fields']['icons'] as $field)
218
-			if (!empty($field['output_html']))
222
+		foreach ($context['print_custom_fields']['icons'] as $field) {
223
+					if (!empty($field['output_html']))
219 224
 				echo '
220 225
 					<li class="custom_field">', $field['output_html'], '</li>';
226
+		}
221 227
 	}
222 228
 
223 229
 	echo '
@@ -225,23 +231,26 @@  discard block
 block discarded – undo
225 231
 			<span id="userstatus">', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : '';
226 232
 
227 233
 	// Can they add this member as a buddy?
228
-	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
229
-		echo '
234
+	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) {
235
+			echo '
230 236
 				<br><a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>';
237
+	}
231 238
 
232 239
 	echo '
233 240
 			</span>';
234 241
 
235
-	if (!$context['user']['is_owner'] && $context['can_send_pm'])
236
-		echo '
242
+	if (!$context['user']['is_owner'] && $context['can_send_pm']) {
243
+			echo '
237 244
 			<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>';
245
+	}
238 246
 
239 247
 	echo '
240 248
 			<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>';
241 249
 
242
-	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled']))
243
-		echo '
250
+	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) {
251
+			echo '
244 252
 			<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>';
253
+	}
245 254
 
246 255
 	echo '
247 256
 			<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>';
@@ -253,10 +262,11 @@  discard block
 block discarded – undo
253 262
 			<div class="custom_fields_bottom">
254 263
 				<ul class="nolist">';
255 264
 
256
-		foreach ($context['print_custom_fields']['bottom_poster'] as $field)
257
-			if (!empty($field['output_html']))
265
+		foreach ($context['print_custom_fields']['bottom_poster'] as $field) {
266
+					if (!empty($field['output_html']))
258 267
 				echo '
259 268
 					<li>', $field['output_html'], '</li>';
269
+		}
260 270
 
261 271
 		echo '
262 272
 				</ul>
@@ -270,15 +280,17 @@  discard block
 block discarded – undo
270 280
 		<div id="detailedinfo">
271 281
 			<dl class="settings">';
272 282
 
273
-	if ($context['user']['is_owner'] || $context['user']['is_admin'])
274
-		echo '
283
+	if ($context['user']['is_owner'] || $context['user']['is_admin']) {
284
+			echo '
275 285
 				<dt>', $txt['username'], ': </dt>
276 286
 				<dd>', $context['member']['username'], '</dd>';
287
+	}
277 288
 
278
-	if (!isset($context['disabled_fields']['posts']))
279
-		echo '
289
+	if (!isset($context['disabled_fields']['posts'])) {
290
+			echo '
280 291
 				<dt>', $txt['profile_posts'], ': </dt>
281 292
 				<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
293
+	}
282 294
 
283 295
 	if ($context['member']['show_email'])
284 296
 	{
@@ -287,15 +299,17 @@  discard block
 block discarded – undo
287 299
 				<dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>';
288 300
 	}
289 301
 
290
-	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
291
-		echo '
302
+	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) {
303
+			echo '
292 304
 				<dt>', $txt['custom_title'], ': </dt>
293 305
 				<dd>', $context['member']['title'], '</dd>';
306
+	}
294 307
 
295
-	if (!empty($context['member']['blurb']))
296
-		echo '
308
+	if (!empty($context['member']['blurb'])) {
309
+			echo '
297 310
 				<dt>', $txt['personal_text'], ': </dt>
298 311
 				<dd>', $context['member']['blurb'], '</dd>';
312
+	}
299 313
 
300 314
 	echo '
301 315
 				<dt>', $txt['age'], ':</dt>
@@ -309,19 +323,21 @@  discard block
 block discarded – undo
309 323
 	{
310 324
 		$fields = array();
311 325
 
312
-		foreach ($context['print_custom_fields']['standard'] as $field)
313
-			if (!empty($field['output_html']))
326
+		foreach ($context['print_custom_fields']['standard'] as $field) {
327
+					if (!empty($field['output_html']))
314 328
 				$fields[] = $field;
329
+		}
315 330
 
316 331
 		if (count($fields) > 0)
317 332
 		{
318 333
 			echo '
319 334
 				<dl class="settings">';
320 335
 
321
-			foreach ($fields as $field)
322
-				echo '
336
+			foreach ($fields as $field) {
337
+							echo '
323 338
 					<dt>', $field['name'], ':</dt>
324 339
 					<dd>', $field['output_html'], '</dd>';
340
+			}
325 341
 
326 342
 			echo '
327 343
 				</dl>';
@@ -341,9 +357,10 @@  discard block
 block discarded – undo
341 357
 						<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
342 358
 
343 359
 		// Can we provide information on what this means?
344
-		if (!empty($context['warning_status']))
345
-			echo '
360
+		if (!empty($context['warning_status'])) {
361
+					echo '
346 362
 						<span class="smalltext">(', $context['warning_status'], ')</span>';
363
+		}
347 364
 
348 365
 		echo '
349 366
 					</dd>';
@@ -354,9 +371,10 @@  discard block
 block discarded – undo
354 371
 	{
355 372
 
356 373
 		// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
357
-		if (!empty($context['activate_message']))
358
-			echo '
374
+		if (!empty($context['activate_message'])) {
375
+					echo '
359 376
 					<dt class="clear"><span class="alert">', $context['activate_message'], '</span>&nbsp;(<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>)</dt>';
377
+		}
360 378
 
361 379
 		// If the current member is banned, show a message and possibly a link to the ban.
362 380
 		if (!empty($context['member']['bans']))
@@ -366,9 +384,10 @@  discard block
 block discarded – undo
366 384
 					<dt class="clear" id="ban_info" style="display: none;">
367 385
 						<strong>', $txt['user_banned_by_following'], ':</strong>';
368 386
 
369
-			foreach ($context['member']['bans'] as $ban)
370
-				echo '
387
+			foreach ($context['member']['bans'] as $ban) {
388
+							echo '
371 389
 						<br><span class="smalltext">', $ban['explanation'], '</span>';
390
+			}
372 391
 
373 392
 			echo '
374 393
 					</dt>';
@@ -382,30 +401,34 @@  discard block
 block discarded – undo
382 401
 	// If the person looking is allowed, they can check the members IP address and hostname.
383 402
 	if ($context['can_see_ip'])
384 403
 	{
385
-		if (!empty($context['member']['ip']))
386
-		echo '
404
+		if (!empty($context['member']['ip'])) {
405
+				echo '
387 406
 					<dt>', $txt['ip'], ': </dt>
388 407
 					<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
408
+		}
389 409
 
390
-		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
391
-			echo '
410
+		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) {
411
+					echo '
392 412
 					<dt>', $txt['hostname'], ': </dt>
393 413
 					<dd>', $context['member']['hostname'], '</dd>';
414
+		}
394 415
 	}
395 416
 
396 417
 	echo '
397 418
 					<dt>', $txt['local_time'], ':</dt>
398 419
 					<dd>', $context['member']['local_time'], '</dd>';
399 420
 
400
-	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
401
-		echo '
421
+	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) {
422
+			echo '
402 423
 					<dt>', $txt['language'], ':</dt>
403 424
 					<dd>', $context['member']['language'], '</dd>';
425
+	}
404 426
 
405
-	if ($context['member']['show_last_login'])
406
-		echo '
427
+	if ($context['member']['show_last_login']) {
428
+			echo '
407 429
 					<dt>', $txt['lastLoggedIn'], ': </dt>
408 430
 					<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
431
+	}
409 432
 
410 433
 	echo '
411 434
 				</dl>';
@@ -417,10 +440,11 @@  discard block
 block discarded – undo
417 440
 				<div class="custom_fields_above_signature">
418 441
 					<ul class="nolist">';
419 442
 
420
-		foreach ($context['print_custom_fields']['above_signature'] as $field)
421
-			if (!empty($field['output_html']))
443
+		foreach ($context['print_custom_fields']['above_signature'] as $field) {
444
+					if (!empty($field['output_html']))
422 445
 				echo '
423 446
 						<li>', $field['output_html'], '</li>';
447
+		}
424 448
 
425 449
 		echo '
426 450
 					</ul>
@@ -428,12 +452,13 @@  discard block
 block discarded – undo
428 452
 	}
429 453
 
430 454
 	// Show the users signature.
431
-	if ($context['signature_enabled'] && !empty($context['member']['signature']))
432
-		echo '
455
+	if ($context['signature_enabled'] && !empty($context['member']['signature'])) {
456
+			echo '
433 457
 				<div class="signature">
434 458
 					<h5>', $txt['signature'], ':</h5>
435 459
 					', $context['member']['signature'], '
436 460
 				</div>';
461
+	}
437 462
 
438 463
 	// Are there any custom profile fields for below the signature?
439 464
 	if (!empty($context['print_custom_fields']['below_signature']))
@@ -442,10 +467,11 @@  discard block
 block discarded – undo
442 467
 				<div class="custom_fields_below_signature">
443 468
 					<ul class="nolist">';
444 469
 
445
-		foreach ($context['print_custom_fields']['below_signature'] as $field)
446
-			if (!empty($field['output_html']))
470
+		foreach ($context['print_custom_fields']['below_signature'] as $field) {
471
+					if (!empty($field['output_html']))
447 472
 				echo '
448 473
 						<li>', $field['output_html'], '</li>';
474
+		}
449 475
 
450 476
 		echo '
451 477
 					</ul>
@@ -490,62 +516,70 @@  discard block
 block discarded – undo
490 516
 				</div>
491 517
 				<div class="list_posts">';
492 518
 
493
-			if (!$post['approved'])
494
-				echo '
519
+			if (!$post['approved']) {
520
+							echo '
495 521
 					<div class="approve_post">
496 522
 						<em>', $txt['post_awaiting_approval'], '</em>
497 523
 					</div>';
524
+			}
498 525
 
499 526
 			echo '
500 527
 					', $post['body'], '
501 528
 				</div>';
502 529
 
503
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
504
-				echo '
530
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
531
+							echo '
505 532
 				<div class="floatright">
506 533
 					<ul class="quickbuttons">';
534
+			}
507 535
 
508 536
 			// If they *can* reply?
509
-			if ($post['can_reply'])
510
-				echo '
537
+			if ($post['can_reply']) {
538
+							echo '
511 539
 						<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
540
+			}
512 541
 
513 542
 			// If they *can* quote?
514
-			if ($post['can_quote'])
515
-				echo '
543
+			if ($post['can_quote']) {
544
+							echo '
516 545
 						<li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>';
546
+			}
517 547
 
518 548
 			// How about... even... remove it entirely?!
519
-			if ($post['can_delete'])
520
-				echo '
549
+			if ($post['can_delete']) {
550
+							echo '
521 551
 						<li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
552
+			}
522 553
 
523
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
524
-				echo '
554
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
555
+							echo '
525 556
 					</ul>
526 557
 				</div>';
558
+			}
527 559
 
528 560
 			echo '
529 561
 			</div>';
530 562
 		}
563
+	} else {
564
+			template_show_list('attachments');
531 565
 	}
532
-	else
533
-		template_show_list('attachments');
534 566
 
535 567
 	// No posts? Just end with a informative message.
536
-	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
537
-		echo '
568
+	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) {
569
+			echo '
538 570
 			<div class="windowbg2">
539 571
 				', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
540 572
 			</div>';
573
+	}
541 574
 
542 575
 	// Show more page numbers.
543
-	if (!empty($context['page_index']))
544
-		echo '
576
+	if (!empty($context['page_index'])) {
577
+			echo '
545 578
 		<div class="pagesection">
546 579
 			<div class="pagelinks">', $context['page_index'], '</div>
547 580
 		</div>';
548
-}
581
+	}
582
+	}
549 583
 
550 584
 /**
551 585
  * Template for showing alerts within the alerts popup
@@ -555,11 +589,12 @@  discard block
 block discarded – undo
555 589
 	global $context, $txt, $scripturl;
556 590
 
557 591
 	// Do we have an update message?
558
-	if (!empty($context['update_message']))
559
-		echo '
592
+	if (!empty($context['update_message'])) {
593
+			echo '
560 594
 		<div class="infobox">
561 595
 			', $context['update_message'], '.
562 596
 		</div>';
597
+	}
563 598
 
564 599
 	echo '
565 600
 		<div class="cat_bar">
@@ -568,13 +603,12 @@  discard block
 block discarded – undo
568 603
 			</h3>
569 604
 		</div>';
570 605
 
571
-	if (empty($context['alerts']))
572
-		echo '
606
+	if (empty($context['alerts'])) {
607
+			echo '
573 608
 		<div class="information">
574 609
 			', $txt['alerts_none'], '
575 610
 		</div>';
576
-
577
-	else
611
+	} else
578 612
 	{
579 613
 		// Start the form.
580 614
 		echo '
@@ -636,12 +670,12 @@  discard block
 block discarded – undo
636 670
 		</div>' : '';
637 671
 
638 672
 	// No drafts? Just show an informative message.
639
-	if (empty($context['drafts']))
640
-		echo '
673
+	if (empty($context['drafts'])) {
674
+			echo '
641 675
 		<div class="windowbg2 centertext">
642 676
 			', $txt['draft_none'], '
643 677
 		</div>';
644
-	else
678
+	} else
645 679
 	{
646 680
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
647 681
 		foreach ($context['drafts'] as $draft)
@@ -652,11 +686,13 @@  discard block
 block discarded – undo
652 686
 					<div class="topic_details">
653 687
 						<h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
654 688
 
655
-			if (!empty($draft['sticky']))
656
-				echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
689
+			if (!empty($draft['sticky'])) {
690
+							echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
691
+			}
657 692
 
658
-			if (!empty($draft['locked']))
659
-				echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
693
+			if (!empty($draft['locked'])) {
694
+							echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
695
+			}
660 696
 
661 697
 			echo '
662 698
 						</h5>
@@ -689,12 +725,13 @@  discard block
 block discarded – undo
689 725
 {
690 726
 	global $context, $scripturl, $txt;
691 727
 
692
-	if (!empty($context['saved_successful']))
693
-		echo '
728
+	if (!empty($context['saved_successful'])) {
729
+			echo '
694 730
 					<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
695
-	elseif (!empty($context['saved_failed']))
696
-		echo '
731
+	} elseif (!empty($context['saved_failed'])) {
732
+			echo '
697 733
 					<div class="errorbox">', $context['saved_failed'], '</div>';
734
+	}
698 735
 
699 736
 	echo '
700 737
 	<div id="edit_buddies">
@@ -708,24 +745,27 @@  discard block
 block discarded – undo
708 745
 				<th scope="col" class="quarter_table">', $txt['name'], '</th>
709 746
 				<th scope="col">', $txt['status'], '</th>';
710 747
 
711
-	if (allowedTo('moderate_forum'))
712
-		echo '
748
+	if (allowedTo('moderate_forum')) {
749
+			echo '
713 750
 				<th scope="col">', $txt['email'], '</th>';
751
+	}
714 752
 
715
-	if (!empty($context['custom_pf']))
716
-		foreach ($context['custom_pf'] as $column)
753
+	if (!empty($context['custom_pf'])) {
754
+			foreach ($context['custom_pf'] as $column)
717 755
 				echo '<th scope="col">', $column['label'], '</th>';
756
+	}
718 757
 
719 758
 	echo '
720 759
 				<th scope="col">', $txt['remove'], '</th>
721 760
 			</tr>';
722 761
 
723 762
 	// If they don't have any buddies don't list them!
724
-	if (empty($context['buddies']))
725
-		echo '
763
+	if (empty($context['buddies'])) {
764
+			echo '
726 765
 			<tr class="windowbg">
727 766
 				<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"><strong>', $txt['no_buddies'], '</strong></td>
728 767
 			</tr>';
768
+	}
729 769
 
730 770
 		// Now loop through each buddy showing info on each.
731 771
 	else
@@ -737,15 +777,17 @@  discard block
 block discarded – undo
737 777
 					<td>', $buddy['link'], '</td>
738 778
 					<td><a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a></td>';
739 779
 
740
-			if ($buddy['show_email'])
741
-				echo '
780
+			if ($buddy['show_email']) {
781
+							echo '
742 782
 					<td><a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a></td>';
783
+			}
743 784
 
744 785
 			// Show the custom profile fields for this user.
745
-			if (!empty($context['custom_pf']))
746
-				foreach ($context['custom_pf'] as $key => $column)
786
+			if (!empty($context['custom_pf'])) {
787
+							foreach ($context['custom_pf'] as $key => $column)
747 788
 					echo '
748 789
 						<td class="lefttext">', $buddy['options'][$key], '</td>';
790
+			}
749 791
 
750 792
 			echo '
751 793
 					<td><a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['buddy_remove'], '"></span></a></td>
@@ -775,9 +817,10 @@  discard block
 block discarded – undo
775 817
 			</dl>
776 818
 		</div>';
777 819
 
778
-	if (!empty($context['token_check']))
779
-		echo '
820
+	if (!empty($context['token_check'])) {
821
+			echo '
780 822
 			<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
823
+	}
781 824
 
782 825
 	echo '
783 826
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -803,12 +846,13 @@  discard block
 block discarded – undo
803 846
 {
804 847
 	global $context, $scripturl, $txt;
805 848
 
806
-	if (!empty($context['saved_successful']))
807
-		echo '
849
+	if (!empty($context['saved_successful'])) {
850
+			echo '
808 851
 					<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
809
-	elseif (!empty($context['saved_failed']))
810
-		echo '
852
+	} elseif (!empty($context['saved_failed'])) {
853
+			echo '
811 854
 					<div class="errorbox">', $context['saved_failed'], '</div>';
855
+	}
812 856
 
813 857
 	echo '
814 858
 	<div id="edit_buddies">
@@ -822,20 +866,22 @@  discard block
 block discarded – undo
822 866
 				<th scope="col" class="quarter_table">', $txt['name'], '</th>
823 867
 				<th scope="col">', $txt['status'], '</th>';
824 868
 
825
-	if (allowedTo('moderate_forum'))
826
-		echo '
869
+	if (allowedTo('moderate_forum')) {
870
+			echo '
827 871
 				<th scope="col">', $txt['email'], '</th>';
872
+	}
828 873
 
829 874
 	echo '
830 875
 				<th scope="col">', $txt['ignore_remove'], '</th>
831 876
 			</tr>';
832 877
 
833 878
 	// If they don't have anyone on their ignore list, don't list it!
834
-	if (empty($context['ignore_list']))
835
-		echo '
879
+	if (empty($context['ignore_list'])) {
880
+			echo '
836 881
 			<tr class="windowbg">
837 882
 				<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"><strong>', $txt['no_ignore'], '</strong></td>
838 883
 			</tr>';
884
+	}
839 885
 
840 886
 	// Now loop through each buddy showing info on each.
841 887
 	foreach ($context['ignore_list'] as $member)
@@ -845,9 +891,10 @@  discard block
 block discarded – undo
845 891
 				<td>', $member['link'], '</td>
846 892
 				<td><a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a></td>';
847 893
 
848
-		if ($member['show_email'])
849
-			echo '
894
+		if ($member['show_email']) {
895
+					echo '
850 896
 				<td><a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a></td>';
897
+		}
851 898
 		echo '
852 899
 				<td><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a></td>
853 900
 			</tr>';
@@ -874,9 +921,10 @@  discard block
 block discarded – undo
874 921
 			</dl>
875 922
 		</div>';
876 923
 
877
-	if (!empty($context['token_check']))
878
-		echo '
924
+	if (!empty($context['token_check'])) {
925
+			echo '
879 926
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
927
+	}
880 928
 
881 929
 	echo '
882 930
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -921,9 +969,10 @@  discard block
 block discarded – undo
921 969
 					<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
922 970
 
923 971
 	// Second address detected?
924
-	if (!empty($context['last_ip2']))
925
-		echo '
972
+	if (!empty($context['last_ip2'])) {
973
+			echo '
926 974
 					, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
975
+	}
927 976
 
928 977
 	echo '
929 978
 				</dd>';
@@ -988,9 +1037,10 @@  discard block
 block discarded – undo
988 1037
 				<h3 class="catbg">', $txt['whois_title'], ' ', $context['ip'], '</h3>
989 1038
 			</div>
990 1039
 			<div class="windowbg2 noup">';
991
-			foreach ($context['whois_servers'] as $server)
992
-			echo '
1040
+			foreach ($context['whois_servers'] as $server) {
1041
+						echo '
993 1042
 				<a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>';
1043
+			}
994 1044
 			echo '
995 1045
 			</div>
996 1046
 			<br>';
@@ -1001,10 +1051,10 @@  discard block
 block discarded – undo
1001 1051
 		<div class="cat_bar">
1002 1052
 			<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
1003 1053
 		</div>';
1004
-	if (empty($context['ips']))
1005
-		echo '
1054
+	if (empty($context['ips'])) {
1055
+			echo '
1006 1056
 		<p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>';
1007
-	else
1057
+	} else
1008 1058
 	{
1009 1059
 		echo '
1010 1060
 		<table class="table_grid">
@@ -1017,12 +1067,13 @@  discard block
 block discarded – undo
1017 1067
 			<tbody>';
1018 1068
 
1019 1069
 		// Loop through each of the members and display them.
1020
-		foreach ($context['ips'] as $ip => $memberlist)
1021
-			echo '
1070
+		foreach ($context['ips'] as $ip => $memberlist) {
1071
+					echo '
1022 1072
 				<tr class="windowbg">
1023 1073
 					<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
1024 1074
 					<td>', implode(', ', $memberlist), '</td>
1025 1075
 				</tr>';
1076
+		}
1026 1077
 
1027 1078
 		echo '
1028 1079
 			</tbody>
@@ -1068,8 +1119,7 @@  discard block
 block discarded – undo
1068 1119
 	{
1069 1120
 		echo '
1070 1121
 		<div class="information">', $txt['showPermissions_all'], '</div>';
1071
-	}
1072
-	else
1122
+	} else
1073 1123
 	{
1074 1124
 		echo '
1075 1125
 		<div class="information">',$txt['showPermissions_help'], '</div>
@@ -1083,9 +1133,10 @@  discard block
 block discarded – undo
1083 1133
 				</div>
1084 1134
 				<div class="windowbg smalltext">
1085 1135
 					', $txt['showPermissions_restricted_boards_desc'], ':<br>';
1086
-				foreach ($context['no_access_boards'] as $no_access_board)
1087
-					echo '
1136
+				foreach ($context['no_access_boards'] as $no_access_board) {
1137
+									echo '
1088 1138
 						<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
1139
+				}
1089 1140
 				echo '
1090 1141
 				</div>';
1091 1142
 		}
@@ -1117,12 +1168,13 @@  discard block
 block discarded – undo
1117 1168
 								</td>
1118 1169
 								<td class="smalltext">';
1119 1170
 
1120
-				if ($permission['is_denied'])
1121
-					echo '
1171
+				if ($permission['is_denied']) {
1172
+									echo '
1122 1173
 									<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1123
-				else
1124
-					echo '
1174
+				} else {
1175
+									echo '
1125 1176
 									', $txt['showPermissions_given'], ':&nbsp;', implode(', ', $permission['groups']['allowed']);
1177
+				}
1126 1178
 
1127 1179
 					echo '
1128 1180
 								</td>
@@ -1132,10 +1184,10 @@  discard block
 block discarded – undo
1132 1184
 						</tbody>
1133 1185
 					</table>
1134 1186
 				</div><br>';
1135
-		}
1136
-		else
1137
-			echo '
1187
+		} else {
1188
+					echo '
1138 1189
 			<p class="windowbg2">', $txt['showPermissions_none_general'], '</p>';
1190
+		}
1139 1191
 
1140 1192
 		// Board permission section.
1141 1193
 		echo '
@@ -1145,14 +1197,16 @@  discard block
 block discarded – undo
1145 1197
 						<a id="board_permissions"></a>', $txt['showPermissions_select'], ':
1146 1198
 						<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
1147 1199
 							<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '&nbsp;</option>';
1148
-				if (!empty($context['boards']))
1149
-					echo '
1200
+				if (!empty($context['boards'])) {
1201
+									echo '
1150 1202
 							<option value="" disabled>---------------------------</option>';
1203
+				}
1151 1204
 
1152 1205
 				// Fill the box with any local permission boards.
1153
-				foreach ($context['boards'] as $board)
1154
-					echo '
1206
+				foreach ($context['boards'] as $board) {
1207
+									echo '
1155 1208
 							<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
1209
+				}
1156 1210
 
1157 1211
 				echo '
1158 1212
 						</select>
@@ -1183,8 +1237,7 @@  discard block
 block discarded – undo
1183 1237
 				{
1184 1238
 					echo '
1185 1239
 							<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1186
-				}
1187
-				else
1240
+				} else
1188 1241
 				{
1189 1242
 					echo '
1190 1243
 							', $txt['showPermissions_given'], ': &nbsp;', implode(', ', $permission['groups']['allowed']);
@@ -1196,10 +1249,10 @@  discard block
 block discarded – undo
1196 1249
 			echo '
1197 1250
 				</tbody>
1198 1251
 			</table>';
1199
-		}
1200
-		else
1201
-			echo '
1252
+		} else {
1253
+					echo '
1202 1254
 			<p class="windowbg2">', $txt['showPermissions_none_board'], '</p>';
1255
+		}
1203 1256
 	echo '
1204 1257
 			</div>
1205 1258
 		</div>';
@@ -1241,9 +1294,10 @@  discard block
 block discarded – undo
1241 1294
 			</div>';
1242 1295
 
1243 1296
 	// If they haven't post at all, don't draw the graph.
1244
-	if (empty($context['posts_by_time']))
1245
-		echo '
1297
+	if (empty($context['posts_by_time'])) {
1298
+			echo '
1246 1299
 			<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1300
+	}
1247 1301
 	// Otherwise do!
1248 1302
 	else
1249 1303
 	{
@@ -1282,11 +1336,10 @@  discard block
 block discarded – undo
1282 1336
 					</h3>
1283 1337
 				</div>';
1284 1338
 
1285
-	if (empty($context['popular_boards']))
1286
-		echo '
1339
+	if (empty($context['popular_boards'])) {
1340
+			echo '
1287 1341
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1288
-
1289
-	else
1342
+	} else
1290 1343
 	{
1291 1344
 		echo '
1292 1345
 				<dl class="stats">';
@@ -1317,10 +1370,10 @@  discard block
 block discarded – undo
1317 1370
 					</h3>
1318 1371
 				</div>';
1319 1372
 
1320
-	if (empty($context['board_activity']))
1321
-		echo '
1373
+	if (empty($context['board_activity'])) {
1374
+			echo '
1322 1375
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1323
-	else
1376
+	} else
1324 1377
 	{
1325 1378
 		echo '
1326 1379
 				<dl class="stats">';
@@ -1368,41 +1421,46 @@  discard block
 block discarded – undo
1368 1421
 				<h3 class="catbg profile_hd">';
1369 1422
 
1370 1423
 		// Don't say "Profile" if this isn't the profile...
1371
-		if (!empty($context['profile_header_text']))
1372
-			echo '
1424
+		if (!empty($context['profile_header_text'])) {
1425
+					echo '
1373 1426
 					', $context['profile_header_text'];
1374
-		else
1375
-			echo '
1427
+		} else {
1428
+					echo '
1376 1429
 					', $txt['profile'];
1430
+		}
1377 1431
 
1378 1432
 		echo '
1379 1433
 				</h3>
1380 1434
 			</div>';
1381 1435
 
1382 1436
 	// Have we some description?
1383
-	if ($context['page_desc'])
1384
-		echo '
1437
+	if ($context['page_desc']) {
1438
+			echo '
1385 1439
 			<p class="information">', $context['page_desc'], '</p>';
1440
+	}
1386 1441
 
1387 1442
 	echo '
1388 1443
 			<div class="roundframe">';
1389 1444
 
1390 1445
 	// Any bits at the start?
1391
-	if (!empty($context['profile_prehtml']))
1392
-		echo '
1446
+	if (!empty($context['profile_prehtml'])) {
1447
+			echo '
1393 1448
 				<div>', $context['profile_prehtml'], '</div>';
1449
+	}
1394 1450
 
1395
-	if (!empty($context['profile_fields']))
1396
-		echo '
1451
+	if (!empty($context['profile_fields'])) {
1452
+			echo '
1397 1453
 				<dl class="settings">';
1454
+	}
1398 1455
 
1399 1456
 	// Start the big old loop 'of love.
1400 1457
 	$lastItem = 'hr';
1401 1458
 	foreach ($context['profile_fields'] as $key => $field)
1402 1459
 	{
1403 1460
 		// We add a little hack to be sure we never get more than one hr in a row!
1404
-		if ($lastItem == 'hr' && $field['type'] == 'hr')
1405
-			continue;
1461
+		if ($lastItem == 'hr' && $field['type'] == 'hr') {
1462
+					continue;
1463
+		}
1406 1464
 
1407 1465
 		$lastItem = $field['type'];
1408 1466
 		if ($field['type'] == 'hr')
@@ -1411,48 +1469,50 @@  discard block
 block discarded – undo
1411 1469
 				</dl>
1412 1470
 				<hr>
1413 1471
 				<dl class="settings">';
1414
-		}
1415
-		elseif ($field['type'] == 'callback')
1472
+		} elseif ($field['type'] == 'callback')
1416 1473
 		{
1417 1474
 			if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
1418 1475
 			{
1419 1476
 				$callback_func = 'template_profile_' . $field['callback_func'];
1420 1477
 				$callback_func();
1421 1478
 			}
1422
-		}
1423
-		else
1479
+		} else
1424 1480
 		{
1425 1481
 			echo '
1426 1482
 					<dt>
1427 1483
 						<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
1428 1484
 
1429 1485
 			// Does it have any subtext to show?
1430
-			if (!empty($field['subtext']))
1431
-				echo '
1486
+			if (!empty($field['subtext'])) {
1487
+							echo '
1432 1488
 						<br>
1433 1489
 						<span class="smalltext">', $field['subtext'], '</span>';
1490
+			}
1434 1491
 
1435 1492
 			echo '
1436 1493
 					</dt>
1437 1494
 					<dd>';
1438 1495
 
1439 1496
 			// Want to put something infront of the box?
1440
-			if (!empty($field['preinput']))
1441
-				echo '
1497
+			if (!empty($field['preinput'])) {
1498
+							echo '
1442 1499
 						', $field['preinput'];
1500
+			}
1443 1501
 
1444 1502
 			// What type of data are we showing?
1445
-			if ($field['type'] == 'label')
1446
-				echo '
1503
+			if ($field['type'] == 'label') {
1504
+							echo '
1447 1505
 						', $field['value'];
1506
+			}
1448 1507
 
1449 1508
 			// Maybe it's a text box - very likely!
1450 1509
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url')))
1451 1510
 			{
1452
-				if ($field['type'] == 'int' || $field['type'] == 'float')
1453
-					$type = 'number';
1454
-				else
1455
-					$type = $field['type'];
1511
+				if ($field['type'] == 'int' || $field['type'] == 'float') {
1512
+									$type = 'number';
1513
+				} else {
1514
+									$type = $field['type'];
1515
+				}
1456 1516
 				$step = $field['type'] == 'float' ? ' step="0.1"' : '';
1457 1517
 
1458 1518
 
@@ -1460,9 +1520,10 @@  discard block
 block discarded – undo
1460 1520
 						<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>';
1461 1521
 			}
1462 1522
 			// You "checking" me out? ;)
1463
-			elseif ($field['type'] == 'check')
1464
-				echo '
1523
+			elseif ($field['type'] == 'check') {
1524
+							echo '
1465 1525
 						<input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>';
1526
+			}
1466 1527
 
1467 1528
 			// Always fun - select boxes!
1468 1529
 			elseif ($field['type'] == 'select')
@@ -1473,13 +1534,15 @@  discard block
 block discarded – undo
1473 1534
 				if (isset($field['options']))
1474 1535
 				{
1475 1536
 					// Is this some code to generate the options?
1476
-					if (!is_array($field['options']))
1477
-						$field['options'] = $field['options']();
1537
+					if (!is_array($field['options'])) {
1538
+											$field['options'] = $field['options']();
1539
+					}
1478 1540
 					// Assuming we now have some!
1479
-					if (is_array($field['options']))
1480
-						foreach ($field['options'] as $value => $name)
1541
+					if (is_array($field['options'])) {
1542
+											foreach ($field['options'] as $value => $name)
1481 1543
 							echo '
1482 1544
 								<option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>';
1545
+					}
1483 1546
 				}
1484 1547
 
1485 1548
 				echo '
@@ -1487,25 +1550,28 @@  discard block
 block discarded – undo
1487 1550
 			}
1488 1551
 
1489 1552
 			// Something to end with?
1490
-			if (!empty($field['postinput']))
1491
-				echo '
1553
+			if (!empty($field['postinput'])) {
1554
+							echo '
1492 1555
 							', $field['postinput'];
1556
+			}
1493 1557
 
1494 1558
 			echo '
1495 1559
 					</dd>';
1496 1560
 		}
1497 1561
 	}
1498 1562
 
1499
-	if (!empty($context['profile_fields']))
1500
-		echo '
1563
+	if (!empty($context['profile_fields'])) {
1564
+			echo '
1501 1565
 				</dl>';
1566
+	}
1502 1567
 
1503 1568
 	// Are there any custom profile fields - if so print them!
1504 1569
 	if (!empty($context['custom_fields']))
1505 1570
 	{
1506
-		if ($lastItem != 'hr')
1507
-			echo '
1571
+		if ($lastItem != 'hr') {
1572
+					echo '
1508 1573
 				<hr>';
1574
+		}
1509 1575
 
1510 1576
 		echo '
1511 1577
 				<dl class="settings">';
@@ -1528,13 +1594,14 @@  discard block
 block discarded – undo
1528 1594
 	}
1529 1595
 
1530 1596
 	// Any closing HTML?
1531
-	if (!empty($context['profile_posthtml']))
1532
-		echo '
1597
+	if (!empty($context['profile_posthtml'])) {
1598
+			echo '
1533 1599
 				<div>', $context['profile_posthtml'], '</div>';
1600
+	}
1534 1601
 
1535 1602
 	// Only show the password box if it's actually needed.
1536
-	if ($context['require_password'])
1537
-		echo '
1603
+	if ($context['require_password']) {
1604
+			echo '
1538 1605
 				<dl class="settings">
1539 1606
 					<dt>
1540 1607
 						<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br>
@@ -1544,18 +1611,21 @@  discard block
 block discarded – undo
1544 1611
 						<input type="password" name="oldpasswrd" id="oldpasswrd" size="20">
1545 1612
 					</dd>
1546 1613
 				</dl>';
1614
+	}
1547 1615
 
1548 1616
 	// The button shouldn't say "Change profile" unless we're changing the profile...
1549
-	if (!empty($context['submit_button_text']))
1550
-		echo '
1617
+	if (!empty($context['submit_button_text'])) {
1618
+			echo '
1551 1619
 				<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">';
1552
-	else
1553
-		echo '
1620
+	} else {
1621
+			echo '
1554 1622
 				<input type="submit" name="save" value="', $txt['change_profile'], '" class="button">';
1623
+	}
1555 1624
 
1556
-	if (!empty($context['token_check']))
1557
-		echo '
1625
+	if (!empty($context['token_check'])) {
1626
+			echo '
1558 1627
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1628
+	}
1559 1629
 
1560 1630
 	echo '
1561 1631
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1565,10 +1635,11 @@  discard block
 block discarded – undo
1565 1635
 		</form>';
1566 1636
 
1567 1637
 	// Any final spellchecking stuff?
1568
-	if (!empty($context['show_spellchecking']))
1569
-		echo '
1638
+	if (!empty($context['show_spellchecking'])) {
1639
+			echo '
1570 1640
 		<form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>';
1571
-}
1641
+	}
1642
+	}
1572 1643
 
1573 1644
 /**
1574 1645
  * Personal Message settings.
@@ -1605,10 +1676,11 @@  discard block
 block discarded – undo
1605 1676
 										<select name="pm_receive_from" id="pm_receive_from">
1606 1677
 												<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
1607 1678
 
1608
-	if (!empty($modSettings['enable_buddylist']))
1609
-		echo '
1679
+	if (!empty($modSettings['enable_buddylist'])) {
1680
+			echo '
1610 1681
 												<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
1611 1682
 												<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
1683
+	}
1612 1684
 
1613 1685
 	echo '
1614 1686
 												<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
@@ -1651,11 +1723,12 @@  discard block
 block discarded – undo
1651 1723
 		if (empty($setting) || !is_array($setting))
1652 1724
 		{
1653 1725
 			// Insert a separator (unless this is the first item in the list)
1654
-			if ($i !== $first_option_key)
1655
-				echo '
1726
+			if ($i !== $first_option_key) {
1727
+							echo '
1656 1728
 				</dl>
1657 1729
 				<hr>
1658 1730
 				<dl class="settings">';
1731
+			}
1659 1732
 
1660 1733
 			// Should we give a name to this section?
1661 1734
 			if (is_string($setting) && !empty($setting))
@@ -1663,51 +1736,56 @@  discard block
 block discarded – undo
1663 1736
 				$titled_section = true;
1664 1737
 				echo '
1665 1738
 					<dt><strong>' . $setting . '</strong></dt><dd></dd>';
1739
+			} else {
1740
+							$titled_section = false;
1666 1741
 			}
1667
-			else
1668
-				$titled_section = false;
1669 1742
 
1670 1743
 			continue;
1671 1744
 		}
1672 1745
 
1673 1746
 		// Is this disabled?
1674
-		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
1675
-			continue;
1676
-		elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
1677
-			continue;
1678
-		elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
1679
-			continue;
1680
-		elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
1681
-			continue;
1682
-		elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
1683
-			continue;
1684
-		elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1685
-			continue;
1686
-		elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1687
-			continue;
1747
+		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) {
1748
+					continue;
1749
+		} elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) {
1750
+					continue;
1751
+		} elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) {
1752
+					continue;
1753
+		} elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) {
1754
+					continue;
1755
+		} elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) {
1756
+					continue;
1757
+		} elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1758
+					continue;
1759
+		} elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1760
+					continue;
1761
+		}
1688 1762
 
1689 1763
 		// Some of these may not be set...  Set to defaults here
1690 1764
 		$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod');
1691
-		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']]))
1692
-			$context['member']['options'][$setting['id']] = 0;
1765
+		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) {
1766
+					$context['member']['options'][$setting['id']] = 0;
1767
+		}
1693 1768
 
1694
-		if (!isset($setting['type']) || $setting['type'] == 'bool')
1695
-			$setting['type'] = 'checkbox';
1696
-		elseif ($setting['type'] == 'int' || $setting['type'] == 'integer')
1697
-			$setting['type'] = 'number';
1698
-		elseif ($setting['type'] == 'string')
1699
-			$setting['type'] = 'text';
1769
+		if (!isset($setting['type']) || $setting['type'] == 'bool') {
1770
+					$setting['type'] = 'checkbox';
1771
+		} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
1772
+					$setting['type'] = 'number';
1773
+		} elseif ($setting['type'] == 'string') {
1774
+					$setting['type'] = 'text';
1775
+		}
1700 1776
 
1701
-		if (isset($setting['options']))
1702
-			$setting['type'] = 'list';
1777
+		if (isset($setting['options'])) {
1778
+					$setting['type'] = 'list';
1779
+		}
1703 1780
 
1704 1781
 		echo '
1705 1782
 					<dt>
1706 1783
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
1707 1784
 
1708
-		if (isset($setting['description']))
1709
-			echo '
1785
+		if (isset($setting['description'])) {
1786
+					echo '
1710 1787
 						<br><span class="smalltext">', $setting['description'], '</span>';
1788
+		}
1711 1789
 		echo '
1712 1790
 					</dt>
1713 1791
 					<dd>';
@@ -1745,13 +1823,11 @@  discard block
 block discarded – undo
1745 1823
 
1746 1824
 				echo '
1747 1825
 						<input type="number"', $min . $max . $step;
1748
-			}
1749
-			else if (isset($setting['type']) && $setting['type'] == 'url')
1826
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
1750 1827
 			{
1751 1828
 				echo'
1752 1829
 						<input type="url"';
1753
-			}
1754
-			else
1830
+			} else
1755 1831
 			{
1756 1832
 				echo '
1757 1833
 						<input type="text"';
@@ -1790,8 +1866,8 @@  discard block
 block discarded – undo
1790 1866
 				<dl class="settings">';
1791 1867
 
1792 1868
 	// Allow notification on announcements to be disabled?
1793
-	if (!empty($modSettings['allow_disableAnnounce']))
1794
-		echo '
1869
+	if (!empty($modSettings['allow_disableAnnounce'])) {
1870
+			echo '
1795 1871
 					<dt>
1796 1872
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
1797 1873
 					</dt>
@@ -1799,9 +1875,10 @@  discard block
 block discarded – undo
1799 1875
 						<input type="hidden" name="notify_announcements" value="0">
1800 1876
 						<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '>
1801 1877
 					</dd>';
1878
+	}
1802 1879
 
1803
-	if (!empty($modSettings['enable_ajax_alerts']))
1804
-		echo '
1880
+	if (!empty($modSettings['enable_ajax_alerts'])) {
1881
+			echo '
1805 1882
 					<dt>
1806 1883
 						<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label>
1807 1884
 					</dt>
@@ -1809,6 +1886,7 @@  discard block
 block discarded – undo
1809 1886
 						<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '">
1810 1887
 					</dd>
1811 1888
 		';
1889
+	}
1812 1890
 
1813 1891
 	echo '
1814 1892
 				</dl>
@@ -1838,9 +1916,10 @@  discard block
 block discarded – undo
1838 1916
 					<td colspan="3">';
1839 1917
 				$label = $txt['alert_opt_' . $opts[1]];
1840 1918
 				$label_pos = isset($opts['label']) ? $opts['label'] : '';
1841
-				if ($label_pos == 'before')
1842
-					echo '
1919
+				if ($label_pos == 'before') {
1920
+									echo '
1843 1921
 					<label for="opt_', $opts[1], '">', $label, '</label>';
1922
+				}
1844 1923
 
1845 1924
 				$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
1846 1925
 				switch ($opts[0])
@@ -1852,17 +1931,19 @@  discard block
 block discarded – undo
1852 1931
 					case 'select':
1853 1932
 						echo '
1854 1933
 						<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
1855
-						foreach ($opts['opts'] as $k => $v)
1856
-							echo '
1934
+						foreach ($opts['opts'] as $k => $v) {
1935
+													echo '
1857 1936
 							<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
1937
+						}
1858 1938
 						echo '
1859 1939
 						</select>';
1860 1940
 						break;
1861 1941
 				}
1862 1942
 
1863
-				if ($label_pos == 'after')
1864
-					echo '
1943
+				if ($label_pos == 'after') {
1944
+									echo '
1865 1945
 					<label for="opt_', $opts[1], '">', $label, '</label>';
1946
+				}
1866 1947
 
1867 1948
 				echo '
1868 1949
 					</td>
@@ -1976,11 +2057,12 @@  discard block
 block discarded – undo
1976 2057
 			<p class="information">', $txt['groupMembership_info'], '</p>';
1977 2058
 
1978 2059
 	// Do we have an update message?
1979
-	if (!empty($context['update_message']))
1980
-		echo '
2060
+	if (!empty($context['update_message'])) {
2061
+			echo '
1981 2062
 			<div class="infobox">
1982 2063
 				', $context['update_message'], '.
1983 2064
 			</div>';
2065
+	}
1984 2066
 
1985 2067
 	echo '
1986 2068
 		<div id="groups">';
@@ -2002,8 +2084,7 @@  discard block
 block discarded – undo
2002 2084
 					</div>
2003 2085
 				</div>
2004 2086
 			</div>';
2005
-	}
2006
-	else
2087
+	} else
2007 2088
 	{
2008 2089
 		echo '
2009 2090
 			<div class="title_bar">
@@ -2015,27 +2096,30 @@  discard block
 block discarded – undo
2015 2096
 			echo '
2016 2097
 					<div class="windowbg" id="primdiv_', $group['id'], '">';
2017 2098
 
2018
-				if ($context['can_edit_primary'])
2019
-					echo '
2099
+				if ($context['can_edit_primary']) {
2100
+									echo '
2020 2101
 						<input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>';
2102
+				}
2021 2103
 
2022 2104
 				echo '
2023 2105
 						<label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>';
2024 2106
 
2025 2107
 				// Can they leave their group?
2026
-				if ($group['can_leave'])
2027
-					echo '
2108
+				if ($group['can_leave']) {
2109
+									echo '
2028 2110
 						<a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
2111
+				}
2029 2112
 
2030 2113
 				echo '
2031 2114
 					</div>';
2032 2115
 		}
2033 2116
 
2034
-		if ($context['can_edit_primary'])
2035
-			echo '
2117
+		if ($context['can_edit_primary']) {
2118
+					echo '
2036 2119
 			<div class="padding righttext">
2037 2120
 				<input type="submit" value="', $txt['make_primary'], '" class="button">
2038 2121
 			</div>';
2122
+		}
2039 2123
 
2040 2124
 		// Any groups they can join?
2041 2125
 		if (!empty($context['groups']['available']))
@@ -2051,15 +2135,16 @@  discard block
 block discarded – undo
2051 2135
 					<div class="windowbg">
2052 2136
 						<strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '';
2053 2137
 
2054
-				if ($group['type'] == 3)
2055
-					echo '
2138
+				if ($group['type'] == 3) {
2139
+									echo '
2056 2140
 						<a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>';
2057
-				elseif ($group['type'] == 2 && $group['pending'])
2058
-					echo '
2141
+				} elseif ($group['type'] == 2 && $group['pending']) {
2142
+									echo '
2059 2143
 						<span class="floatright">', $txt['approval_pending'], '</span>';
2060
-				elseif ($group['type'] == 2)
2061
-					echo '
2144
+				} elseif ($group['type'] == 2) {
2145
+									echo '
2062 2146
 						<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>';
2147
+				}
2063 2148
 
2064 2149
 				echo '
2065 2150
 					</div>';
@@ -2082,9 +2167,10 @@  discard block
 block discarded – undo
2082 2167
 
2083 2168
 			prevDiv.className = "windowbg";
2084 2169
 		}';
2085
-		if (isset($context['groups']['member'][$context['primary_group']]))
2086
-			echo '
2170
+		if (isset($context['groups']['member'][$context['primary_group']])) {
2171
+					echo '
2087 2172
 		highlightSelected("primdiv_' . $context['primary_group'] . '");';
2173
+		}
2088 2174
 		echo '
2089 2175
 	</script>';
2090 2176
 	}
@@ -2092,9 +2178,10 @@  discard block
 block discarded – undo
2092 2178
 	echo '
2093 2179
 		</div>';
2094 2180
 
2095
-	if (!empty($context['token_check']))
2096
-		echo '
2181
+	if (!empty($context['token_check'])) {
2182
+			echo '
2097 2183
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2184
+	}
2098 2185
 
2099 2186
 	echo '
2100 2187
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2141,14 +2228,15 @@  discard block
 block discarded – undo
2141 2228
 
2142 2229
 		foreach ($category['boards'] as $board)
2143 2230
 		{
2144
-			if ($i == $limit)
2145
-				echo '
2231
+			if ($i == $limit) {
2232
+							echo '
2146 2233
 						</ul>
2147 2234
 					</li>
2148 2235
 				</ul>
2149 2236
 				<ul class="ignoreboards floatright">
2150 2237
 					<li class="category">
2151 2238
 						<ul>';
2239
+			}
2152 2240
 
2153 2241
 			echo '
2154 2242
 							<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
@@ -2194,10 +2282,11 @@  discard block
 block discarded – undo
2194 2282
 
2195 2283
 	// Work out the starting color.
2196 2284
 	$context['current_color'] = $context['colors'][0];
2197
-	foreach ($context['colors'] as $limit => $color)
2198
-		if ($context['member']['warning'] >= $limit)
2285
+	foreach ($context['colors'] as $limit => $color) {
2286
+			if ($context['member']['warning'] >= $limit)
2199 2287
 			$context['current_color'] = $color;
2200
-}
2288
+	}
2289
+	}
2201 2290
 
2202 2291
 // Show all warnings of a user?
2203 2292
 function template_viewWarning()
@@ -2236,14 +2325,15 @@  discard block
 block discarded – undo
2236 2325
 				</dd>';
2237 2326
 
2238 2327
 		// There's some impact of this?
2239
-		if (!empty($context['level_effects'][$context['current_level']]))
2240
-			echo '
2328
+		if (!empty($context['level_effects'][$context['current_level']])) {
2329
+					echo '
2241 2330
 				<dt>
2242 2331
 					<strong>', $txt['profile_viewwarning_impact'], ':</strong>
2243 2332
 				</dt>
2244 2333
 				<dd>
2245 2334
 					', $context['level_effects'][$context['current_level']], '
2246 2335
 				</dd>';
2336
+		}
2247 2337
 
2248 2338
 		echo '
2249 2339
 			</dl>
@@ -2281,10 +2371,11 @@  discard block
 block discarded – undo
2281 2371
 
2282 2372
 			// Otherwise see what we can do...';
2283 2373
 
2284
-	foreach ($context['notification_templates'] as $k => $type)
2285
-		echo '
2374
+	foreach ($context['notification_templates'] as $k => $type) {
2375
+			echo '
2286 2376
 			if (index == ', $k, ')
2287 2377
 				document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
2378
+	}
2288 2379
 
2289 2380
 	echo '
2290 2381
 		}
@@ -2294,10 +2385,11 @@  discard block
 block discarded – undo
2294 2385
 			// Also set the right effect.
2295 2386
 			effectText = "";';
2296 2387
 
2297
-	foreach ($context['level_effects'] as $limit => $text)
2298
-		echo '
2388
+	foreach ($context['level_effects'] as $limit => $text) {
2389
+			echo '
2299 2390
 			if (slideAmount >= ', $limit, ')
2300 2391
 				effectText = "', $text, '";';
2392
+	}
2301 2393
 
2302 2394
 	echo '
2303 2395
 			setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\');
@@ -2312,31 +2404,34 @@  discard block
 block discarded – undo
2312 2404
 			</h3>
2313 2405
 		</div>';
2314 2406
 
2315
-	if (!$context['user']['is_owner'])
2316
-		echo '
2407
+	if (!$context['user']['is_owner']) {
2408
+			echo '
2317 2409
 		<p class="information">', $txt['profile_warning_desc'], '</p>';
2410
+	}
2318 2411
 
2319 2412
 	echo '
2320 2413
 		<div class="windowbg">
2321 2414
 			<dl class="settings">';
2322 2415
 
2323
-	if (!$context['user']['is_owner'])
2324
-		echo '
2416
+	if (!$context['user']['is_owner']) {
2417
+			echo '
2325 2418
 				<dt>
2326 2419
 					<strong>', $txt['profile_warning_name'], ':</strong>
2327 2420
 				</dt>
2328 2421
 				<dd>
2329 2422
 					<strong>', $context['member']['name'], '</strong>
2330 2423
 				</dd>';
2424
+	}
2331 2425
 
2332 2426
 	echo '
2333 2427
 				<dt>
2334 2428
 					<strong>', $txt['profile_warning_level'], ':</strong>';
2335 2429
 
2336 2430
 	// Is there only so much they can apply?
2337
-	if ($context['warning_limit'])
2338
-		echo '
2431
+	if ($context['warning_limit']) {
2432
+			echo '
2339 2433
 					<br><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
2434
+	}
2340 2435
 
2341 2436
 	echo '
2342 2437
 				</dt>
@@ -2389,9 +2484,10 @@  discard block
 block discarded – undo
2389 2484
 						<option value="-1">', $txt['profile_warning_notify_template'], '</option>
2390 2485
 						<option value="-1" disabled>------------------------------</option>';
2391 2486
 
2392
-		foreach ($context['notification_templates'] as $id_template => $template)
2393
-			echo '
2487
+		foreach ($context['notification_templates'] as $id_template => $template) {
2488
+					echo '
2394 2489
 						<option value="', $id_template, '">', $template['title'], '</option>';
2490
+		}
2395 2491
 
2396 2492
 		echo '
2397 2493
 					</select>
@@ -2404,9 +2500,10 @@  discard block
 block discarded – undo
2404 2500
 			</dl>
2405 2501
 			<div class="righttext">';
2406 2502
 
2407
-	if (!empty($context['token_check']))
2408
-		echo '
2503
+	if (!empty($context['token_check'])) {
2504
+			echo '
2409 2505
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2506
+	}
2410 2507
 
2411 2508
 	echo '
2412 2509
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2422,8 +2519,8 @@  discard block
 block discarded – undo
2422 2519
 	echo '
2423 2520
 	<script>';
2424 2521
 
2425
-	if (!$context['user']['is_owner'])
2426
-		echo '
2522
+	if (!$context['user']['is_owner']) {
2523
+			echo '
2427 2524
 		modifyWarnNotify();
2428 2525
 		$(document).ready(function() {
2429 2526
 			$("#preview_button").click(function() {
@@ -2462,6 +2559,7 @@  discard block
 block discarded – undo
2462 2559
 			});
2463 2560
 			return false;
2464 2561
 		}';
2562
+	}
2465 2563
 
2466 2564
 	echo '
2467 2565
 	</script>';
@@ -2484,16 +2582,18 @@  discard block
 block discarded – undo
2484 2582
 			</div>';
2485 2583
 
2486 2584
 	// If deleting another account give them a lovely info box.
2487
-	if (!$context['user']['is_owner'])
2488
-		echo '
2585
+	if (!$context['user']['is_owner']) {
2586
+			echo '
2489 2587
 			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2588
+	}
2490 2589
 	echo '
2491 2590
 			<div class="windowbg2">';
2492 2591
 
2493 2592
 	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2494
-	if ($context['needs_approval'])
2495
-		echo '
2593
+	if ($context['needs_approval']) {
2594
+			echo '
2496 2595
 				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2596
+	}
2497 2597
 
2498 2598
 	// If the user is deleting their own account warn them first - and require a password!
2499 2599
 	if ($context['user']['is_owner'])
@@ -2505,9 +2605,10 @@  discard block
 block discarded – undo
2505 2605
 					<input type="password" name="oldpasswrd" size="20">&nbsp;&nbsp;&nbsp;&nbsp;
2506 2606
 					<input type="submit" value="', $txt['yes'], '" class="button">';
2507 2607
 
2508
-		if (!empty($context['token_check']))
2509
-			echo '
2608
+		if (!empty($context['token_check'])) {
2609
+					echo '
2510 2610
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2611
+		}
2511 2612
 
2512 2613
 		echo '
2513 2614
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2533,9 +2634,10 @@  discard block
 block discarded – undo
2533 2634
 						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2534 2635
 					</select>';
2535 2636
 
2536
-			if ($context['show_perma_delete'])
2537
-				echo '
2637
+			if ($context['show_perma_delete']) {
2638
+							echo '
2538 2639
 					<br><label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
2640
+			}
2539 2641
 
2540 2642
 			echo '
2541 2643
 				</div>';
@@ -2548,9 +2650,10 @@  discard block
 block discarded – undo
2548 2650
 				<div>
2549 2651
 					<input type="submit" value="', $txt['delete'], '" class="button">';
2550 2652
 
2551
-		if (!empty($context['token_check']))
2552
-			echo '
2653
+		if (!empty($context['token_check'])) {
2654
+					echo '
2553 2655
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2656
+		}
2554 2657
 
2555 2658
 		echo '
2556 2659
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2576,8 +2679,8 @@  discard block
 block discarded – undo
2576 2679
 					<hr>';
2577 2680
 
2578 2681
 	// Only show the password box if it's actually needed.
2579
-	if ($context['require_password'])
2580
-		echo '
2682
+	if ($context['require_password']) {
2683
+			echo '
2581 2684
 					<dl class="settings">
2582 2685
 						<dt>
2583 2686
 							<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
@@ -2587,13 +2690,15 @@  discard block
 block discarded – undo
2587 2690
 							<input type="password" name="oldpasswrd" size="20">
2588 2691
 						</dd>
2589 2692
 					</dl>';
2693
+	}
2590 2694
 
2591 2695
 	echo '
2592 2696
 					<div class="righttext">';
2593 2697
 
2594
-		if (!empty($context['token_check']))
2595
-			echo '
2698
+		if (!empty($context['token_check'])) {
2699
+					echo '
2596 2700
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2701
+		}
2597 2702
 
2598 2703
 	echo '
2599 2704
 						<input type="submit" value="', $txt['change_profile'], '" class="button">
@@ -2620,9 +2725,10 @@  discard block
 block discarded – undo
2620 2725
 			<ul id="list_errors">';
2621 2726
 
2622 2727
 		// Cycle through each error and display an error message.
2623
-		foreach ($context['post_errors'] as $error)
2624
-			echo '
2728
+		foreach ($context['post_errors'] as $error) {
2729
+					echo '
2625 2730
 				<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
2731
+		}
2626 2732
 
2627 2733
 		echo '
2628 2734
 			</ul>';
@@ -2648,12 +2754,13 @@  discard block
 block discarded – undo
2648 2754
 								<select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 &amp;&amp; !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>';
2649 2755
 
2650 2756
 		// Fill the select box with all primary member groups that can be assigned to a member.
2651
-		foreach ($context['member_groups'] as $member_group)
2652
-			if (!empty($member_group['can_be_primary']))
2757
+		foreach ($context['member_groups'] as $member_group) {
2758
+					if (!empty($member_group['can_be_primary']))
2653 2759
 				echo '
2654 2760
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
2655 2761
 										', $member_group['name'], '
2656 2762
 									</option>';
2763
+		}
2657 2764
 		echo '
2658 2765
 								</select>
2659 2766
 							</dd>
@@ -2665,10 +2772,11 @@  discard block
 block discarded – undo
2665 2772
 									<input type="hidden" name="additional_groups[]" value="0">';
2666 2773
 
2667 2774
 		// For each membergroup show a checkbox so members can be assigned to more than one group.
2668
-		foreach ($context['member_groups'] as $member_group)
2669
-			if ($member_group['can_be_additional'])
2775
+		foreach ($context['member_groups'] as $member_group) {
2776
+					if ($member_group['can_be_additional'])
2670 2777
 				echo '
2671 2778
 									<label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>';
2779
+		}
2672 2780
 		echo '
2673 2781
 								</span>
2674 2782
 								<a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;" class="toggle_down">', $txt['additional_membergroups_show'], '</a>
@@ -2728,9 +2836,10 @@  discard block
 block discarded – undo
2728 2836
 								<span class="smalltext">', $txt['sig_info'], '</span><br>
2729 2837
 								<br>';
2730 2838
 
2731
-	if ($context['show_spellchecking'])
2732
-		echo '
2839
+	if ($context['show_spellchecking']) {
2840
+			echo '
2733 2841
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">';
2842
+	}
2734 2843
 
2735 2844
 		echo '
2736 2845
 							</dt>
@@ -2738,17 +2847,20 @@  discard block
 block discarded – undo
2738 2847
 								<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>';
2739 2848
 
2740 2849
 	// If there is a limit at all!
2741
-	if (!empty($context['signature_limits']['max_length']))
2742
-		echo '
2850
+	if (!empty($context['signature_limits']['max_length'])) {
2851
+			echo '
2743 2852
 								<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
2853
+	}
2744 2854
 
2745
-	if (!empty($context['show_preview_button']))
2746
-		echo '
2855
+	if (!empty($context['show_preview_button'])) {
2856
+			echo '
2747 2857
 								<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">';
2858
+	}
2748 2859
 
2749
-	if ($context['signature_warning'])
2750
-		echo '
2860
+	if ($context['signature_warning']) {
2861
+			echo '
2751 2862
 								<span class="smalltext">', $context['signature_warning'], '</span>';
2863
+	}
2752 2864
 
2753 2865
 	// Some javascript used to count how many characters have been used so far in the signature.
2754 2866
 	echo '
@@ -2792,9 +2904,10 @@  discard block
 block discarded – undo
2792 2904
 									<div>
2793 2905
 										<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
2794 2906
 		// This lists all the file categories.
2795
-		foreach ($context['avatars'] as $avatar)
2796
-			echo '
2907
+		foreach ($context['avatars'] as $avatar) {
2908
+					echo '
2797 2909
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
2910
+		}
2798 2911
 		echo '
2799 2912
 										</select>
2800 2913
 									</div>
@@ -2849,16 +2962,17 @@  discard block
 block discarded – undo
2849 2962
 								<div id="avatar_gravatar">
2850 2963
 									<img src="' . $context['member']['avatar']['href'] . '" alt="" />';
2851 2964
 
2852
-		if (empty($modSettings['gravatarAllowExtraEmail']))
2853
-			echo '
2965
+		if (empty($modSettings['gravatarAllowExtraEmail'])) {
2966
+					echo '
2854 2967
 									<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>';
2855
-		else
2968
+		} else
2856 2969
 		{
2857 2970
 			// Depending on other stuff, the stored value here might have some odd things in it from other areas.
2858
-			if ($context['member']['avatar']['external'] == $context['member']['email'])
2859
-				$textbox_value = '';
2860
-			else
2861
-				$textbox_value = $context['member']['avatar']['external'];
2971
+			if ($context['member']['avatar']['external'] == $context['member']['email']) {
2972
+							$textbox_value = '';
2973
+			} else {
2974
+							$textbox_value = $context['member']['avatar']['external'];
2975
+			}
2862 2976
 
2863 2977
 			echo '
2864 2978
 									<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div>
@@ -2930,8 +3044,9 @@  discard block
 block discarded – undo
2930 3044
 	$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
2931 3045
 
2932 3046
 	$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
2933
-	if (empty($suffix))
2934
-		return;
3047
+	if (empty($suffix)) {
3048
+			return;
3049
+	}
2935 3050
 
2936 3051
 	echo '
2937 3052
 									<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
@@ -2953,9 +3068,10 @@  discard block
 block discarded – undo
2953 3068
 							<dd>
2954 3069
 								<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">';
2955 3070
 	// Help the user by showing a list of common time formats.
2956
-	foreach ($context['easy_timeformats'] as $time_format)
2957
-		echo '
3071
+	foreach ($context['easy_timeformats'] as $time_format) {
3072
+			echo '
2958 3073
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
3074
+	}
2959 3075
 	echo '
2960 3076
 								</select><br>
2961 3077
 								<input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30">
@@ -2991,9 +3107,10 @@  discard block
 block discarded – undo
2991 3107
 							</dt>
2992 3108
 							<dd>
2993 3109
 								<select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">';
2994
-	foreach ($context['smiley_sets'] as $set)
2995
-		echo '
3110
+	foreach ($context['smiley_sets'] as $set) {
3111
+			echo '
2996 3112
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
3113
+	}
2997 3114
 	echo '
2998 3115
 								</select>
2999 3116
 								<img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.gif' : $settings['images_url'] . '/blank.png', '" alt=":)">
@@ -3044,10 +3161,11 @@  discard block
 block discarded – undo
3044 3161
 										<img src="', $context['tfa_qr_url'], '" alt="">
3045 3162
 									</div>';
3046 3163
 
3047
-	if (!empty($context['from_ajax']))
3048
-		echo '
3164
+	if (!empty($context['from_ajax'])) {
3165
+			echo '
3049 3166
 									<br>
3050 3167
 									<a href="javascript:self.close();"></a>';
3168
+	}
3051 3169
 
3052 3170
 	echo '
3053 3171
 								</div>
@@ -3086,15 +3204,16 @@  discard block
 block discarded – undo
3086 3204
 								<br><div class="smalltext">', $txt['tfa_profile_desc'], '</div>
3087 3205
 							</dt>
3088 3206
 							<dd>';
3089
-	if (!$context['tfa_enabled'] && $context['user']['is_owner'])
3090
-		echo '
3207
+	if (!$context['tfa_enabled'] && $context['user']['is_owner']) {
3208
+			echo '
3091 3209
 								<a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>';
3092
-	elseif (!$context['tfa_enabled'])
3093
-		echo '
3210
+	} elseif (!$context['tfa_enabled']) {
3211
+			echo '
3094 3212
 								', $txt['tfa_profile_disabled'];
3095
-	else
3096
-		echo '
3213
+	} else {
3214
+			echo '
3097 3215
 							', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable');
3216
+	}
3098 3217
 	echo '
3099 3218
 							</dd>';
3100 3219
 }
Please login to merge, or discard this patch.
Themes/default/Search.template.php 1 patch
Braces   +85 added lines, -60 removed lines patch added patch discarded remove patch
@@ -25,13 +25,15 @@  discard block
 block discarded – undo
25 25
 			</h3>
26 26
 		</div>';
27 27
 
28
-	if (!empty($context['search_errors']))
29
-		echo '
28
+	if (!empty($context['search_errors'])) {
29
+			echo '
30 30
 		<div class="errorbox">', implode('<br>', $context['search_errors']['messages']), '</div>';
31
+	}
31 32
 
32
-	if (!empty($context['search_ignored']))
33
-		echo '
33
+	if (!empty($context['search_ignored'])) {
34
+			echo '
34 35
 		<p class="noticebox">', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>';
36
+	}
35 37
 
36 38
 	echo '
37 39
 		<div id="advanced_search" class="roundframe">
@@ -42,9 +44,10 @@  discard block
 block discarded – undo
42 44
 				<dd>
43 45
 					<input type="search" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40">';
44 46
 
45
-	if (empty($modSettings['search_simple_fulltext']))
46
-		echo '
47
+	if (empty($modSettings['search_simple_fulltext'])) {
48
+			echo '
47 49
 					<br><em class="smalltext">', $txt['search_example'], '</em>';
50
+	}
48 51
 
49 52
 	echo '
50 53
 				</dd>
@@ -115,11 +118,12 @@  discard block
 block discarded – undo
115 118
 	}
116 119
 
117 120
 	// If $context['search_params']['topic'] is set, that means we're searching just one topic.
118
-	if (!empty($context['search_params']['topic']))
119
-		echo '
121
+	if (!empty($context['search_params']['topic'])) {
122
+			echo '
120 123
 				<p>', $txt['search_specific_topic'], ' &quot;', $context['search_topic']['link'], '&quot;.</p>
121 124
 				<input type="hidden" name="topic" value="', $context['search_topic']['id'], '">
122 125
 				<input type="submit" name="b_search" value="', $txt['search'], '" class="button">';
126
+	}
123 127
 
124 128
 	echo '
125 129
 		</div>';
@@ -149,14 +153,15 @@  discard block
 block discarded – undo
149 153
 
150 154
 			foreach ($category['boards'] as $board)
151 155
 			{
152
-				if ($i == $limit)
153
-					echo '
156
+				if ($i == $limit) {
157
+									echo '
154 158
 							</ul>
155 159
 						</li>
156 160
 					</ul>
157 161
 					<ul class="ignoreboards floatright">
158 162
 						<li class="category">
159 163
 							<ul>';
164
+				}
160 165
 
161 166
 				echo '
162 167
 								<li class="board">
@@ -244,13 +249,15 @@  discard block
 block discarded – undo
244 249
 		<div class="roundframe">';
245 250
 
246 251
 		// Did they make any typos or mistakes, perhaps?
247
-		if (isset($context['did_you_mean']))
248
-			echo '
252
+		if (isset($context['did_you_mean'])) {
253
+					echo '
249 254
 			<p>', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search2;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>.</p>';
255
+		}
250 256
 
251
-		if (!empty($context['search_ignored']))
252
-			echo '
257
+		if (!empty($context['search_ignored'])) {
258
+					echo '
253 259
 			<p>', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>';
260
+		}
254 261
 
255 262
 		echo '
256 263
 			<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
@@ -272,10 +279,11 @@  discard block
 block discarded – undo
272 279
 					<input type="hidden" name="maxage" value="', !empty($context['search_params']['maxage']) ? $context['search_params']['maxage'] : '9999', '">
273 280
 					<input type="hidden" name="sort" value="', !empty($context['search_params']['sort']) ? $context['search_params']['sort'] : 'relevance', '">
274 281
 				</div>';
275
-		if (!empty($context['search_params']['brd']))
276
-			foreach ($context['search_params']['brd'] as $board_id)
282
+		if (!empty($context['search_params']['brd'])) {
283
+					foreach ($context['search_params']['brd'] as $board_id)
277 284
 				echo '
278 285
 				<input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '">';
286
+		}
279 287
 
280 288
 		echo '
281 289
 			</form>
@@ -286,17 +294,19 @@  discard block
 block discarded – undo
286 294
 	if ($context['compact'])
287 295
 	{
288 296
 		// Quick moderation set to checkboxes? Oh, how fun :/.
289
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
290
-			echo '
297
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
298
+					echo '
291 299
 	<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="topicForm">';
300
+		}
292 301
 
293 302
 	echo '
294 303
 		<div class="cat_bar">
295 304
 			<h3 class="catbg">
296 305
 				<span class="floatright">';
297
-					if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
298
-					echo '
306
+					if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
307
+										echo '
299 308
 							<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">';
309
+					}
300 310
 				echo '
301 311
 				</span>
302 312
 				<span class="generic_icons filter"></span>&nbsp;', $txt['mlist_search_results'], ':&nbsp;', $context['search_params']['search'], '
@@ -304,14 +314,15 @@  discard block
 block discarded – undo
304 314
 		</div>';
305 315
 
306 316
 		// was anything even found?
307
-		if (!empty($context['topics']))
308
-		echo'
317
+		if (!empty($context['topics'])) {
318
+				echo'
309 319
 		<div class="pagesection">
310 320
 			<span>', $context['page_index'], '</span>
311 321
 		</div>';
312
-		else
313
-			echo '
322
+		} else {
323
+					echo '
314 324
 			<div class="roundframe">', $txt['find_no_results'], '</div>';
325
+		}
315 326
 
316 327
 		// while we have results to show ...
317 328
 		while ($topic = $context['get_topics']())
@@ -339,38 +350,43 @@  discard block
 block discarded – undo
339 350
 					{
340 351
 						echo '
341 352
 						<input type="checkbox" name="topics[]" value="', $topic['id'], '">';
342
-					}
343
-					else
353
+					} else
344 354
 					{
345
-						if ($topic['quick_mod']['remove'])
346
-							echo '
355
+						if ($topic['quick_mod']['remove']) {
356
+													echo '
347 357
 						<a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>';
358
+						}
348 359
 
349
-						if ($topic['quick_mod']['lock'])
350
-							echo '
360
+						if ($topic['quick_mod']['lock']) {
361
+													echo '
351 362
 						<a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>';
363
+						}
352 364
 
353
-						if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
354
-							echo '
365
+						if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) {
366
+													echo '
355 367
 						<br>';
368
+						}
356 369
 
357
-						if ($topic['quick_mod']['sticky'])
358
-							echo '
370
+						if ($topic['quick_mod']['sticky']) {
371
+													echo '
359 372
 						<a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>';
373
+						}
360 374
 
361
-						if ($topic['quick_mod']['move'])
362
-							echo '
375
+						if ($topic['quick_mod']['move']) {
376
+													echo '
363 377
 						<a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>';
378
+						}
364 379
 					}
365 380
 
366 381
 					echo '
367 382
 					</div>';
368 383
 				}
369 384
 
370
-				if ($message['body_highlighted'] != '')
371
-					echo '
385
+				if ($message['body_highlighted'] != '') {
386
+									echo '
372 387
 					<br class="clear">
373 388
 					<div class="list_posts double_height">', $message['body_highlighted'], '</div>';
389
+				}
374 390
 			}
375 391
 
376 392
 			echo '
@@ -378,11 +394,12 @@  discard block
 block discarded – undo
378 394
 			</div>';
379 395
 
380 396
 		}
381
-		if (!empty($context['topics']))
382
-		echo '
397
+		if (!empty($context['topics'])) {
398
+				echo '
383 399
 		<div class="pagesection">
384 400
 			<span>', $context['page_index'], '</span>
385 401
 		</div>';
402
+		}
386 403
 
387 404
 		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
388 405
 		{
@@ -392,17 +409,19 @@  discard block
 block discarded – undo
392 409
 					<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
393 410
 						<option value="">--------</option>';
394 411
 
395
-			foreach ($context['qmod_actions'] as $qmod_action)
396
-				if ($context['can_' . $qmod_action])
412
+			foreach ($context['qmod_actions'] as $qmod_action) {
413
+							if ($context['can_' . $qmod_action])
397 414
 					echo '
398 415
 							<option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>';
416
+			}
399 417
 
400 418
 			echo '
401 419
 					</select>';
402 420
 
403
-			if ($context['can_move'])
404
-				echo '
421
+			if ($context['can_move']) {
422
+							echo '
405 423
 				<span id="quick_mod_jump_to">&nbsp;</span>';
424
+			}
406 425
 
407 426
 			echo '
408 427
 					<input type="hidden" name="redirect_url" value="', $scripturl . '?action=search2;params=' . $context['params'], '">
@@ -412,13 +431,13 @@  discard block
 block discarded – undo
412 431
 		}
413 432
 
414 433
 
415
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
416
-			echo '
434
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) {
435
+					echo '
417 436
 			<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '">
418 437
 		</form>';
438
+		}
419 439
 
420
-	}
421
-	else
440
+	} else
422 441
 	{
423 442
 		echo '
424 443
 		<div class="cat_bar">
@@ -430,9 +449,10 @@  discard block
 block discarded – undo
430 449
 			<span>', $context['page_index'], '</span>
431 450
 		</div>';
432 451
 
433
-		if (empty($context['topics']))
434
-			echo '
452
+		if (empty($context['topics'])) {
453
+					echo '
435 454
 		<div class="information">(', $txt['search_no_results'], ')</div>';
455
+		}
436 456
 
437 457
 		while ($topic = $context['get_topics']())
438 458
 		{
@@ -447,23 +467,27 @@  discard block
 block discarded – undo
447 467
 					</div>
448 468
 					<div class="list_posts">', $message['body_highlighted'], '</div>';
449 469
 
450
-			if ($topic['can_reply'])
451
-				echo '
470
+			if ($topic['can_reply']) {
471
+							echo '
452 472
 						<ul class="quickbuttons">';
473
+			}
453 474
 
454 475
 				// If they *can* reply?
455
-			if ($topic['can_reply'])
456
-				echo '
476
+			if ($topic['can_reply']) {
477
+							echo '
457 478
 							<li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
479
+			}
458 480
 
459 481
 				// If they *can* quote?
460
-			if ($topic['can_quote'])
461
-				echo '
482
+			if ($topic['can_quote']) {
483
+							echo '
462 484
 							<li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'] . ';quote=' . $message['id'] . '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>';
485
+			}
463 486
 
464
-			if ($topic['can_reply'])
465
-				echo '
487
+			if ($topic['can_reply']) {
488
+							echo '
466 489
 						</ul>';
490
+			}
467 491
 			echo '
468 492
 					<br class="clear">
469 493
 				</div>';
@@ -482,8 +506,8 @@  discard block
 block discarded – undo
482 506
 		<div class="smalltext righttext" id="search_jump_to">&nbsp;</div>
483 507
 		<script>';
484 508
 
485
-	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move'])
486
-		echo '
509
+	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) {
510
+			echo '
487 511
 				if (typeof(window.XMLHttpRequest) != "undefined")
488 512
 					aJumpTo[aJumpTo.length] = new JumpTo({
489 513
 						sContainerId: "quick_mod_jump_to",
@@ -498,6 +522,7 @@  discard block
 block discarded – undo
498 522
 						bDisabled: true,
499 523
 						sCustomName: "move_to"
500 524
 					});';
525
+	}
501 526
 
502 527
 	echo '
503 528
 			if (typeof(window.XMLHttpRequest) != "undefined")
Please login to merge, or discard this patch.
Themes/default/index.template.php 1 patch
Braces   +89 added lines, -61 removed lines patch added patch discarded remove patch
@@ -72,9 +72,10 @@  discard block
 block discarded – undo
72 72
 
73 73
 	// Allow css/js files to be disable for this specific theme.
74 74
 	// Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference.
75
-	if (!isset($settings['disable_files']))
76
-		$settings['disable_files'] = array();
77
-}
75
+	if (!isset($settings['disable_files'])) {
76
+			$settings['disable_files'] = array();
77
+	}
78
+	}
78 79
 
79 80
 /**
80 81
  * The main sub template above the content.
@@ -111,8 +112,9 @@  discard block
 block discarded – undo
111 112
 		echo '
112 113
 	<meta';
113 114
 
114
-		foreach ($meta_tag as $meta_key => $meta_value)
115
-			echo ' ', $meta_key, '="', $meta_value, '"';
115
+		foreach ($meta_tag as $meta_key => $meta_value) {
116
+					echo ' ', $meta_key, '="', $meta_value, '"';
117
+		}
116 118
 
117 119
 		echo '>';
118 120
 	}
@@ -123,14 +125,16 @@  discard block
 block discarded – undo
123 125
 	<meta name="theme-color" content="#557EA0">';
124 126
 
125 127
 	// Please don't index these Mr Robot.
126
-	if (!empty($context['robot_no_index']))
127
-		echo '
128
+	if (!empty($context['robot_no_index'])) {
129
+			echo '
128 130
 	<meta name="robots" content="noindex">';
131
+	}
129 132
 
130 133
 	// Present a canonical url for search engines to prevent duplicate content in their indices.
131
-	if (!empty($context['canonical_url']))
132
-		echo '
134
+	if (!empty($context['canonical_url'])) {
135
+			echo '
133 136
 	<link rel="canonical" href="', $context['canonical_url'], '">';
137
+	}
134 138
 
135 139
 	// Show all the relative links, such as help, search, contents, and the like.
136 140
 	echo '
@@ -139,10 +143,11 @@  discard block
 block discarded – undo
139 143
 	<link rel="search" href="' . $scripturl . '?action=search">' : '');
140 144
 
141 145
 	// If RSS feeds are enabled, advertise the presence of one.
142
-	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
143
-		echo '
146
+	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) {
147
+			echo '
144 148
 	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?action=.xml;type=rss2', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">
145 149
 	<link rel="alternate" type="application/atom+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?action=.xml;type=atom', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">';
150
+	}
146 151
 
147 152
 	// If we're viewing a topic, these should be the previous and next topics, respectively.
148 153
 	if (!empty($context['links']['next']))
@@ -158,9 +163,10 @@  discard block
 block discarded – undo
158 163
 	}
159 164
 
160 165
 	// If we're in a board, or a topic for that matter, the index will be the board's index.
161
-	if (!empty($context['current_board']))
162
-		echo '
166
+	if (!empty($context['current_board'])) {
167
+			echo '
163 168
 	<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">';
169
+	}
164 170
 
165 171
 	// Output any remaining HTML headers. (from mods, maybe?)
166 172
 	echo $context['html_headers'];
@@ -192,8 +198,9 @@  discard block
 block discarded – undo
192 198
 			<ul class="floatleft" id="top_info">
193 199
 				<li>
194 200
 					<a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">';
195
-			if (!empty($context['user']['avatar']))
196
-				echo $context['user']['avatar']['image'];
201
+			if (!empty($context['user']['avatar'])) {
202
+							echo $context['user']['avatar']['image'];
203
+			}
197 204
 			echo $context['user']['name'], '</a>
198 205
 					<div id="profile_menu" class="top_menu"></div>
199 206
 				</li>';
@@ -221,17 +228,18 @@  discard block
 block discarded – undo
221 228
 	}
222 229
 	// Otherwise they're a guest. Ask them to either register or login.
223 230
 	else
224
-		if (empty($maintenance))
225
-			echo '
231
+		if (empty($maintenance)) {
232
+					echo '
226 233
 			<ul class="floatleft welcome">
227 234
 				<li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li>
228 235
 			</ul>';
229
-		else
230
-			//In maintenance mode, only login is allowed and don't show OverlayDiv
236
+		} else {
237
+					//In maintenance mode, only login is allowed and don't show OverlayDiv
231 238
 			echo '
232 239
 			<ul class="floatleft welcome">
233 240
 				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li>
234 241
 			</ul>';
242
+		}
235 243
 
236 244
 	if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1)
237 245
 	{
@@ -239,9 +247,10 @@  discard block
 block discarded – undo
239 247
 			<form id="languages_form" method="get" class="floatright">
240 248
 				<select id="language_select" name="language" onchange="this.form.submit()">';
241 249
 
242
-		foreach ($context['languages'] as $language)
243
-			echo '
250
+		foreach ($context['languages'] as $language) {
251
+					echo '
244 252
 					<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>';
253
+		}
245 254
 
246 255
 		echo '
247 256
 				</select>
@@ -265,31 +274,36 @@  discard block
 block discarded – undo
265 274
 					<option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>';
266 275
 
267 276
 		// Can't limit it to a specific topic if we are not in one
268
-		if (!empty($context['current_topic']))
269
-			echo '
277
+		if (!empty($context['current_topic'])) {
278
+					echo '
270 279
 					<option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>';
280
+		}
271 281
 
272 282
 		// Can't limit it to a specific board if we are not in one
273
-		if (!empty($context['current_board']))
274
-			echo '
283
+		if (!empty($context['current_board'])) {
284
+					echo '
275 285
 					<option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>';
286
+		}
276 287
 
277 288
 		// Can't search for members if we can't see the memberlist
278
-		if (!empty($context['allow_memberlist']))
279
-			echo '
289
+		if (!empty($context['allow_memberlist'])) {
290
+					echo '
280 291
 					<option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>';
292
+		}
281 293
 
282 294
 		echo '
283 295
 				</select>';
284 296
 
285 297
 		// Search within current topic?
286
-		if (!empty($context['current_topic']))
287
-			echo '
298
+		if (!empty($context['current_topic'])) {
299
+					echo '
288 300
 				<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">';
301
+		}
289 302
 		// If we're on a certain board, limit it to this board ;).
290
-		elseif (!empty($context['current_board']))
291
-			echo '
303
+		elseif (!empty($context['current_board'])) {
304
+					echo '
292 305
 				<input type="hidden" name="sd_brd" value="', $context['current_board'], '">';
306
+		}
293 307
 
294 308
 		echo '
295 309
 				<input type="submit" name="search2" value="', $txt['search'], '" class="button">
@@ -320,12 +334,13 @@  discard block
 block discarded – undo
320 334
 						', $context['current_time'], '
321 335
 					</div>';
322 336
 	// Show a random news item? (or you could pick one from news_lines...)
323
-	if (!empty($settings['enable_news']) && !empty($context['random_news_line']))
324
-		echo '
337
+	if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) {
338
+			echo '
325 339
 					<div class="news">
326 340
 						<h2>', $txt['news'], ': </h2>
327 341
 						<p>', $context['random_news_line'], '</p>
328 342
 					</div>';
343
+	}
329 344
 
330 345
 	echo '
331 346
 					<hr class="clear">
@@ -388,9 +403,10 @@  discard block
 block discarded – undo
388 403
 		</ul>';
389 404
 
390 405
 	// Show the load time?
391
-	if ($context['show_load_time'])
392
-		echo '
406
+	if ($context['show_load_time']) {
407
+			echo '
393 408
 		<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>';
409
+	}
394 410
 
395 411
 	echo '
396 412
 		</div>
@@ -421,19 +437,21 @@  discard block
 block discarded – undo
421 437
 	global $context, $shown_linktree, $scripturl, $txt;
422 438
 
423 439
 	// If linktree is empty, just return - also allow an override.
424
-	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
425
-		return;
440
+	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) {
441
+			return;
442
+	}
426 443
 
427 444
 	echo '
428 445
 				<div class="navigate_section">
429 446
 					<ul>';
430 447
 
431
-	if ($context['user']['is_logged'])
432
-	echo '
448
+	if ($context['user']['is_logged']) {
449
+		echo '
433 450
 						<li class="unread_links">
434 451
 							<a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a>
435 452
 							<a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a>
436 453
 						</li>';
454
+	}
437 455
 
438 456
 	// Each tree item has a URL and name. Some may have extra_before and extra_after.
439 457
 	foreach ($context['linktree'] as $link_num => $tree)
@@ -444,25 +462,29 @@  discard block
 block discarded – undo
444 462
 		// Don't show a separator for the first one.
445 463
 		// Better here. Always points to the next level when the linktree breaks to a second line.
446 464
 		// Picked a better looking HTML entity, and added support for RTL plus a span for styling.
447
-		if ($link_num != 0)
448
-			echo '
465
+		if ($link_num != 0) {
466
+					echo '
449 467
 							<span class="dividers">', $context['right_to_left'] ? ' &#9668; ' : ' &#9658; ', '</span>';
468
+		}
450 469
 
451 470
 		// Show something before the link?
452
-		if (isset($tree['extra_before']))
453
-			echo $tree['extra_before'], ' ';
471
+		if (isset($tree['extra_before'])) {
472
+					echo $tree['extra_before'], ' ';
473
+		}
454 474
 
455 475
 		// Show the link, including a URL if it should have one.
456
-		if (isset($tree['url']))
457
-			echo '
476
+		if (isset($tree['url'])) {
477
+					echo '
458 478
 					<a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>';
459
-		else
460
-			echo '
479
+		} else {
480
+					echo '
461 481
 					<span>' . $tree['name'] . '</span>';
482
+		}
462 483
 
463 484
 		// Show something after the link...?
464
-		if (isset($tree['extra_after']))
465
-			echo ' ', $tree['extra_after'];
485
+		if (isset($tree['extra_after'])) {
486
+					echo ' ', $tree['extra_after'];
487
+		}
466 488
 
467 489
 		echo '
468 490
 						</li>';
@@ -512,13 +534,14 @@  discard block
 block discarded – undo
512 534
 					echo '
513 535
 									<ul>';
514 536
 
515
-					foreach ($childbutton['sub_buttons'] as $grandchildbutton)
516
-						echo '
537
+					foreach ($childbutton['sub_buttons'] as $grandchildbutton) {
538
+											echo '
517 539
 										<li>
518 540
 											<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
519 541
 												', $grandchildbutton['title'], '
520 542
 											</a>
521 543
 										</li>';
544
+					}
522 545
 
523 546
 					echo '
524 547
 									</ul>';
@@ -549,8 +572,9 @@  discard block
 block discarded – undo
549 572
 {
550 573
 	global $context, $txt;
551 574
 
552
-	if (!is_array($strip_options))
553
-		$strip_options = array();
575
+	if (!is_array($strip_options)) {
576
+			$strip_options = array();
577
+	}
554 578
 
555 579
 	// Create the buttons...
556 580
 	$buttons = array();
@@ -559,8 +583,9 @@  discard block
 block discarded – undo
559 583
 		// As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!)
560 584
 		if (!isset($value['test']) || !empty($context[$value['test']]))
561 585
 		{
562
-			if (!isset($value['id']))
563
-				$value['id'] = $key;
586
+			if (!isset($value['id'])) {
587
+							$value['id'] = $key;
588
+			}
564 589
 
565 590
 			$button = '
566 591
 				<a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';
@@ -573,13 +598,15 @@  discard block
 block discarded – undo
573 598
 							<div class="overview">';
574 599
 				foreach ($value['sub_buttons'] as $element)
575 600
 				{
576
-					if (isset($element['test']) && empty($context[$element['test']]))
577
-						continue;
601
+					if (isset($element['test']) && empty($context[$element['test']])) {
602
+											continue;
603
+					}
578 604
 
579 605
 					$button .= '
580 606
 								<a href="' . $element['url'] . '"><strong>' . $txt[$element['text']] . '</strong>';
581
-					if (isset($txt[$element['text'] . '_desc']))
582
-						$button .= '<br><span>' . $txt[$element['text'] . '_desc'] . '</span>';
607
+					if (isset($txt[$element['text'] . '_desc'])) {
608
+											$button .= '<br><span>' . $txt[$element['text'] . '_desc'] . '</span>';
609
+					}
583 610
 					$button .= '</a>';
584 611
 				}
585 612
 				$button .= '
@@ -593,8 +620,9 @@  discard block
 block discarded – undo
593 620
 	}
594 621
 
595 622
 	// No buttons? No button strip either.
596
-	if (empty($buttons))
597
-		return;
623
+	if (empty($buttons)) {
624
+			return;
625
+	}
598 626
 
599 627
 	echo '
600 628
 		<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '>
Please login to merge, or discard this patch.
Themes/default/Recent.template.php 1 patch
Braces   +74 added lines, -52 removed lines patch added patch discarded remove patch
@@ -43,28 +43,33 @@  discard block
 block discarded – undo
43 43
 					</div>
44 44
 					<div class="list_posts">', $post['message'], '</div>';
45 45
 
46
-		if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
47
-			echo '
46
+		if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
47
+					echo '
48 48
 					<ul class="quickbuttons">';
49
+		}
49 50
 
50 51
 		// If they *can* reply?
51
-		if ($post['can_reply'])
52
-			echo '
52
+		if ($post['can_reply']) {
53
+					echo '
53 54
 						<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
55
+		}
54 56
 
55 57
 		// If they *can* quote?
56
-		if ($post['can_quote'])
57
-			echo '
58
+		if ($post['can_quote']) {
59
+					echo '
58 60
 						<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>';
61
+		}
59 62
 
60 63
 		// How about... even... remove it entirely?!
61
-		if ($post['can_delete'])
62
-			echo '
64
+		if ($post['can_delete']) {
65
+					echo '
63 66
 						<li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';recent;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
67
+		}
64 68
 
65
-		if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
66
-			echo '
69
+		if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
70
+					echo '
67 71
 					</ul>';
72
+		}
68 73
 
69 74
 		echo '
70 75
 			</div>';
@@ -86,12 +91,13 @@  discard block
 block discarded – undo
86 91
 	echo '
87 92
 	<div id="recent" class="main_content">';
88 93
 
89
-	if ($context['showCheckboxes'])
90
-		echo '
94
+	if ($context['showCheckboxes']) {
95
+			echo '
91 96
 		<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm">
92 97
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
93 98
 			<input type="hidden" name="qaction" value="markread">
94 99
 			<input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">';
100
+	}
95 101
 
96 102
 	if (!empty($context['topics']))
97 103
 	{
@@ -120,11 +126,12 @@  discard block
 block discarded – undo
120 126
 					</div>';
121 127
 
122 128
 		// Show a "select all" box for quick moderation?
123
-		if ($context['showCheckboxes'])
124
-			echo '
129
+		if ($context['showCheckboxes']) {
130
+					echo '
125 131
 					<div class="moderation">
126 132
 						<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">
127 133
 					</div>';
134
+		}
128 135
 
129 136
 		echo '
130 137
 				</div>
@@ -143,15 +150,18 @@  discard block
 block discarded – undo
143 150
 			// Now we handle the icons
144 151
 			echo '
145 152
 							<div class="icons floatright">';
146
-			if ($topic['is_locked'])
147
-				echo '
153
+			if ($topic['is_locked']) {
154
+							echo '
148 155
 								<span class="generic_icons lock"></span>';
149
-			if ($topic['is_sticky'])
150
-				echo '
156
+			}
157
+			if ($topic['is_sticky']) {
158
+							echo '
151 159
 								<span class="generic_icons sticky"></span>';
152
-			if ($topic['is_poll'])
153
-				echo '
160
+			}
161
+			if ($topic['is_poll']) {
162
+							echo '
154 163
 								<span class="generic_icons poll"></span>';
164
+			}
155 165
 			echo '
156 166
 							</div>';
157 167
 
@@ -176,19 +186,21 @@  discard block
 block discarded – undo
176 186
 							', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), '
177 187
 						</div>';
178 188
 
179
-			if ($context['showCheckboxes'])
180
-				echo '
189
+			if ($context['showCheckboxes']) {
190
+							echo '
181 191
 						<div class="moderation">
182 192
 							<input type="checkbox" name="topics[]" value="', $topic['id'], '">
183 193
 						</div>';
194
+			}
184 195
 
185 196
 				echo '
186 197
 					</div>';
187 198
 		}
188 199
 
189
-		if (empty($context['topics']))
190
-			echo '
200
+		if (empty($context['topics'])) {
201
+					echo '
191 202
 						<div style="display: none;"></div>';
203
+		}
192 204
 
193 205
 		echo '
194 206
 				</div>
@@ -203,25 +215,27 @@  discard block
 block discarded – undo
203 215
 					', $context['page_index'], '
204 216
 				</div>
205 217
 			</div>';
206
-	}
207
-	else
208
-		echo '
218
+	} else {
219
+			echo '
209 220
 			<div class="cat_bar">
210 221
 				<h3 class="catbg centertext">
211 222
 					', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], '
212 223
 				</h3>
213 224
 			</div>';
225
+	}
214 226
 
215
-	if ($context['showCheckboxes'])
216
-		echo '
227
+	if ($context['showCheckboxes']) {
228
+			echo '
217 229
 		</form>';
230
+	}
218 231
 
219 232
 	echo '
220 233
 	</div>';
221 234
 
222
-	if (empty($context['no_topic_listing']))
223
-		template_topic_legend();
224
-}
235
+	if (empty($context['no_topic_listing'])) {
236
+			template_topic_legend();
237
+	}
238
+	}
225 239
 
226 240
 /**
227 241
  * Template for showing unread replies (eg new replies to topics you've posted in)
@@ -233,12 +247,13 @@  discard block
 block discarded – undo
233 247
 	echo '
234 248
 	<div id="recent">';
235 249
 
236
-	if ($context['showCheckboxes'])
237
-		echo '
250
+	if ($context['showCheckboxes']) {
251
+			echo '
238 252
 		<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm">
239 253
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
240 254
 			<input type="hidden" name="qaction" value="markread">
241 255
 			<input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">';
256
+	}
242 257
 
243 258
 	if (!empty($context['topics']))
244 259
 	{
@@ -267,11 +282,12 @@  discard block
 block discarded – undo
267 282
 					</div>';
268 283
 
269 284
 		// Show a "select all" box for quick moderation?
270
-		if ($context['showCheckboxes'])
271
-				echo '
285
+		if ($context['showCheckboxes']) {
286
+						echo '
272 287
 					<div class="moderation">
273 288
 						<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">
274 289
 					</div>';
290
+		}
275 291
 
276 292
 		echo '
277 293
 				</div>
@@ -290,15 +306,18 @@  discard block
 block discarded – undo
290 306
 			// Now we handle the icons
291 307
 			echo '
292 308
 								<div class="icons floatright">';
293
-			if ($topic['is_locked'])
294
-				echo '
309
+			if ($topic['is_locked']) {
310
+							echo '
295 311
 									<span class="generic_icons lock"></span>';
296
-			if ($topic['is_sticky'])
297
-				echo '
312
+			}
313
+			if ($topic['is_sticky']) {
314
+							echo '
298 315
 									<span class="generic_icons sticky"></span>';
299
-			if ($topic['is_poll'])
300
-				echo '
316
+			}
317
+			if ($topic['is_poll']) {
318
+							echo '
301 319
 									<span class="generic_icons poll"></span>';
320
+			}
302 321
 			echo '
303 322
 								</div>';
304 323
 
@@ -323,11 +342,12 @@  discard block
 block discarded – undo
323 342
 								', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), '
324 343
 							</div>';
325 344
 
326
-			if ($context['showCheckboxes'])
327
-				echo '
345
+			if ($context['showCheckboxes']) {
346
+							echo '
328 347
 							<div class="moderation">
329 348
 								<input type="checkbox" name="topics[]" value="', $topic['id'], '">
330 349
 							</div>';
350
+			}
331 351
 			echo '
332 352
 						</div>';
333 353
 		}
@@ -343,24 +363,26 @@  discard block
 block discarded – undo
343 363
 					', $context['page_index'], '
344 364
 				</div>
345 365
 			</div>';
346
-	}
347
-	else
348
-		echo '
366
+	} else {
367
+			echo '
349 368
 			<div class="cat_bar">
350 369
 				<h3 class="catbg centertext">
351 370
 					', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], '
352 371
 				</h3>
353 372
 			</div>';
373
+	}
354 374
 
355
-	if ($context['showCheckboxes'])
356
-		echo '
375
+	if ($context['showCheckboxes']) {
376
+			echo '
357 377
 		</form>';
378
+	}
358 379
 
359 380
 	echo '
360 381
 	</div>';
361 382
 
362
-	if (empty($context['no_topic_listing']))
363
-		template_topic_legend();
364
-}
383
+	if (empty($context['no_topic_listing'])) {
384
+			template_topic_legend();
385
+	}
386
+	}
365 387
 
366 388
 ?>
367 389
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/Themes.template.php 1 patch
Braces   +103 added lines, -80 removed lines patch added patch discarded remove patch
@@ -54,9 +54,10 @@  discard block
 block discarded – undo
54 54
 					<dd>
55 55
 						<div id="known_themes_list">';
56 56
 
57
-	foreach ($context['themes'] as $theme)
58
-		echo '
57
+	foreach ($context['themes'] as $theme) {
58
+			echo '
59 59
 							<label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', '> ', $theme['name'], '</label><br>';
60
+	}
60 61
 
61 62
 		echo '
62 63
 						</div>
@@ -73,9 +74,10 @@  discard block
 block discarded – undo
73 74
 						<select name="options[theme_guests]" id="theme_guests">';
74 75
 
75 76
 	// Put an option for each theme in the select box.
76
-	foreach ($context['themes'] as $theme)
77
-		echo '
77
+	foreach ($context['themes'] as $theme) {
78
+			echo '
78 79
 							<option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>';
80
+	}
79 81
 
80 82
 	echo '
81 83
 						</select>
@@ -90,9 +92,10 @@  discard block
 block discarded – undo
90 92
 							<option value="0">', $txt['theme_forum_default'], '</option>';
91 93
 
92 94
 	// Same thing, this time for changing the theme of everyone.
93
-	foreach ($context['themes'] as $theme)
94
-		echo '
95
+	foreach ($context['themes'] as $theme) {
96
+			echo '
95 97
 							<option value="', $theme['id'], '">', $theme['name'], '</option>';
98
+	}
96 99
 
97 100
 	echo '
98 101
 						</select>
@@ -189,11 +192,12 @@  discard block
 block discarded – undo
189 192
 	global $context, $scripturl, $txt;
190 193
 
191 194
 	// Show a nice confirmation message.
192
-	if (isset($_GET['done']))
193
-		echo '
195
+	if (isset($_GET['done'])) {
196
+			echo '
194 197
 	<div class="infobox">
195 198
 		', $txt['theme_confirmed_' . $_GET['done']], '
196 199
 	</div>';
200
+	}
197 201
 
198 202
 	echo '
199 203
 	<div id="admincenter">';
@@ -357,11 +361,12 @@  discard block
 block discarded – undo
357 361
 		if (empty($setting) || !is_array($setting))
358 362
 		{
359 363
 			// Insert a separator (unless this is the first item in the list)
360
-			if ($i !== $first_option_key)
361
-				echo '
364
+			if ($i !== $first_option_key) {
365
+							echo '
362 366
 				</dl>
363 367
 				<hr>
364 368
 				<dl class="settings">';
369
+			}
365 370
 
366 371
 			// Should we give a name to this section?
367 372
 			if (is_string($setting) && !empty($setting))
@@ -369,9 +374,9 @@  discard block
 block discarded – undo
369 374
 				$titled_section = true;
370 375
 				echo '
371 376
 					<dt><strong>' . $setting . '</strong></dt><dd></dd>';
377
+			} else {
378
+							$titled_section = false;
372 379
 			}
373
-			else
374
-				$titled_section = false;
375 380
 
376 381
 			continue;
377 382
 		}
@@ -380,19 +385,21 @@  discard block
 block discarded – undo
380 385
 					<dt>';
381 386
 
382 387
 		// Show the change option box ?
383
-		if ($context['theme_options_reset'])
384
-			echo '
388
+		if ($context['theme_options_reset']) {
389
+					echo '
385 390
 						<span class="floatleft"><select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;">
386 391
 							<option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option>
387 392
 							<option value="1">', $txt['themeadmin_reset_options_change'], '</option>
388 393
 							<option value="2">', $txt['themeadmin_reset_options_default'], '</option>
389 394
 						</select>&nbsp;</span>';
395
+		}
390 396
 
391 397
 		echo '
392 398
 						<label for="options_', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
393
-		if (isset($setting['description']))
394
-			echo '
399
+		if (isset($setting['description'])) {
400
+					echo '
395 401
 						<br><span class="smalltext">', $setting['description'], '</span>';
402
+		}
396 403
 		echo '
397 404
 					</dt>';
398 405
 
@@ -434,13 +441,11 @@  discard block
 block discarded – undo
434 441
 
435 442
 				echo '
436 443
 						<input type="number"', $min . $max . $step;
437
-			}
438
-			else if (isset($setting['type']) && $setting['type'] == 'url')
444
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
439 445
 			{
440 446
 				echo'
441 447
 						<input type="url"';
442
-			}
443
-			else
448
+			} else
444 449
 			{
445 450
 				echo '
446 451
 						<input type="text"';
@@ -484,8 +489,8 @@  discard block
 block discarded – undo
484 489
 			<br>';
485 490
 
486 491
 	// @todo Why can't I edit the default theme popup.
487
-	if ($context['theme_settings']['theme_id'] != 1)
488
-		echo '
492
+	if ($context['theme_settings']['theme_id'] != 1) {
493
+			echo '
489 494
 			<div class="cat_bar">
490 495
 				<h3 class="catbg config_hd">
491 496
 					', $txt['theme_edit'], '
@@ -501,6 +506,7 @@  discard block
 block discarded – undo
501 506
 					</li>
502 507
 				</ul>
503 508
 			</div>';
509
+	}
504 510
 
505 511
 	echo '
506 512
 			<div class="cat_bar">
@@ -554,9 +560,10 @@  discard block
 block discarded – undo
554 560
 					<dd>
555 561
 						<select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">';
556 562
 
557
-		foreach ($context['theme_variants'] as $key => $variant)
558
-			echo '
563
+		foreach ($context['theme_variants'] as $key => $variant) {
564
+					echo '
559 565
 							<option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>';
566
+		}
560 567
 
561 568
 		echo '
562 569
 						</select>
@@ -592,11 +599,12 @@  discard block
 block discarded – undo
592 599
 		if (empty($setting) || !is_array($setting))
593 600
 		{
594 601
 			// We don't need a separator before the first list element
595
-			if ($i !== $first_setting_key)
596
-				echo '
602
+			if ($i !== $first_setting_key) {
603
+							echo '
597 604
 				</dl>
598 605
 				<hr>
599 606
 				<dl class="settings">';
607
+			}
600 608
 
601 609
 			// Add a fake heading?
602 610
 			if (is_string($setting) && !empty($setting))
@@ -604,9 +612,9 @@  discard block
 block discarded – undo
604 612
 				$titled_section = true;
605 613
 				echo '
606 614
 					<dt><strong>' . $setting . '</strong></dt><dd></dd>';
615
+			} else {
616
+							$titled_section = false;
607 617
 			}
608
-			else
609
-				$titled_section = false;
610 618
 
611 619
 			continue;
612 620
 		}
@@ -615,9 +623,10 @@  discard block
 block discarded – undo
615 623
 					<dt>
616 624
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>:';
617 625
 
618
-		if (isset($setting['description']))
619
-			echo '<br>
626
+		if (isset($setting['description'])) {
627
+					echo '<br>
620 628
 						<span class="smalltext">', $setting['description'], '</span>';
629
+		}
621 630
 
622 631
 		echo '
623 632
 					</dt>';
@@ -638,9 +647,10 @@  discard block
 block discarded – undo
638 647
 					<dd>
639 648
 						<select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">';
640 649
 
641
-			foreach ($setting['options'] as $value => $label)
642
-				echo '
650
+			foreach ($setting['options'] as $value => $label) {
651
+							echo '
643 652
 							<option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>';
653
+			}
644 654
 
645 655
 			echo '
646 656
 						</select>
@@ -669,13 +679,11 @@  discard block
 block discarded – undo
669 679
 
670 680
 				echo '
671 681
 						<input type="number"', $min . $max . $step;
672
-			}
673
-			else if (isset($setting['type']) && $setting['type'] == 'url')
682
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
674 683
 			{
675 684
 				echo'
676 685
 						<input type="url"';
677
-			}
678
-			else
686
+			} else
679 687
 			{
680 688
 				echo '
681 689
 						<input type="text"';
@@ -828,21 +836,23 @@  discard block
 block discarded – undo
828 836
 		<div class="windowbg">';
829 837
 
830 838
 	// Oops! there was an error :(
831
-	if (!empty($context['error_message']))
832
-		echo '
839
+	if (!empty($context['error_message'])) {
840
+			echo '
833 841
 			<p>
834 842
 				', $context['error_message'], '
835 843
 			</p>';
844
+	}
836 845
 
837 846
 	// Not much to show except a link back...
838
-	else
839
-		echo '
847
+	else {
848
+			echo '
840 849
 			<p>
841 850
 				<a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], '
842 851
 			</p>
843 852
 			<p>
844 853
 				<a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a>
845 854
 			</p>';
855
+	}
846 856
 
847 857
 	echo '
848 858
 		</div>
@@ -909,10 +919,11 @@  discard block
 block discarded – undo
909 919
 					<span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span>
910 920
 					<span class="floatright">';
911 921
 
912
-		if ($template['can_copy'])
913
-			echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>';
914
-		else
915
-			echo $txt['themeadmin_edit_no_copy'];
922
+		if ($template['can_copy']) {
923
+					echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>';
924
+		} else {
925
+					echo $txt['themeadmin_edit_no_copy'];
926
+		}
916 927
 
917 928
 		echo '
918 929
 					</span>
@@ -935,11 +946,12 @@  discard block
 block discarded – undo
935 946
 	echo '
936 947
 	<div id="admincenter">';
937 948
 
938
-	if (!empty($context['browse_title']))
939
-		echo '
949
+	if (!empty($context['browse_title'])) {
950
+			echo '
940 951
 		<div class="cat_bar">
941 952
 			<h3 class="catbg">', $context['browse_title'], '</h3>
942 953
 		</div>';
954
+	}
943 955
 
944 956
 	echo '
945 957
 		<table class="table_grid tborder">
@@ -959,14 +971,13 @@  discard block
 block discarded – undo
959 971
 			<tr class="windowbg">
960 972
 				<td>';
961 973
 
962
-		if ($file['is_editable'])
963
-			echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>';
964
-
965
-		elseif ($file['is_directory'])
966
-			echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>';
967
-
968
-		else
969
-			echo $file['filename'];
974
+		if ($file['is_editable']) {
975
+					echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>';
976
+		} elseif ($file['is_directory']) {
977
+					echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>';
978
+		} else {
979
+					echo $file['filename'];
980
+		}
970 981
 
971 982
 		echo '
972 983
 				</td>
@@ -988,11 +999,12 @@  discard block
 block discarded – undo
988 999
 {
989 1000
 	global $context, $settings, $scripturl, $txt;
990 1001
 
991
-	if ($context['session_error'])
992
-		echo '
1002
+	if ($context['session_error']) {
1003
+			echo '
993 1004
 	<div class="errorbox">
994 1005
 		', $txt['error_session_timeout'], '
995 1006
 	</div>';
1007
+	}
996 1008
 
997 1009
 	// From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com.
998 1010
 	echo '
@@ -1055,17 +1067,18 @@  discard block
 block discarded – undo
1055 1067
 					try
1056 1068
 					{
1057 1069
 					';
1058
-	if (isBrowser('is_ie'))
1059
-		echo '
1070
+	if (isBrowser('is_ie')) {
1071
+			echo '
1060 1072
 						var sheets = frames["css_preview_box"].document.styleSheets;
1061 1073
 						for (var j = 0; j < sheets.length; j++)
1062 1074
 						{
1063 1075
 							if (sheets[j].id == "css_preview_box")
1064 1076
 								sheets[j].cssText = document.forms.stylesheetForm.entire_file.value;
1065 1077
 						}';
1066
-	else
1067
-		echo '
1078
+	} else {
1079
+			echo '
1068 1080
 						setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);';
1081
+	}
1069 1082
 	echo '
1070 1083
 					}
1071 1084
 					catch (e)
@@ -1117,9 +1130,10 @@  discard block
 block discarded – undo
1117 1130
 			</div>
1118 1131
 			<div class="windowbg">';
1119 1132
 
1120
-	if (!$context['allow_save'])
1121
-		echo '
1133
+	if (!$context['allow_save']) {
1134
+			echo '
1122 1135
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1136
+	}
1123 1137
 
1124 1138
 	echo '
1125 1139
 				<textarea class="edit_file" name="entire_file" cols="80" rows="20" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea>
@@ -1133,9 +1147,10 @@  discard block
 block discarded – undo
1133 1147
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1134 1148
 
1135 1149
 	// Hopefully it exists.
1136
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1137
-		echo '
1150
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1151
+			echo '
1138 1152
 			<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1153
+	}
1139 1154
 
1140 1155
 	echo '
1141 1156
 		</form>
@@ -1149,18 +1164,20 @@  discard block
 block discarded – undo
1149 1164
 {
1150 1165
 	global $context, $scripturl, $txt;
1151 1166
 
1152
-	if ($context['session_error'])
1153
-		echo '
1167
+	if ($context['session_error']) {
1168
+			echo '
1154 1169
 	<div class="errorbox">
1155 1170
 		', $txt['error_session_timeout'], '
1156 1171
 	</div>';
1172
+	}
1157 1173
 
1158
-	if (isset($context['parse_error']))
1159
-		echo '
1174
+	if (isset($context['parse_error'])) {
1175
+			echo '
1160 1176
 	<div class="errorbox">
1161 1177
 		', $txt['themeadmin_edit_error'], '
1162 1178
 			<div><pre>', $context['parse_error'], '</pre></div>
1163 1179
 	</div>';
1180
+	}
1164 1181
 
1165 1182
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1166 1183
 	echo '
@@ -1171,16 +1188,18 @@  discard block
 block discarded – undo
1171 1188
 			</div>
1172 1189
 			<div class="windowbg">';
1173 1190
 
1174
-	if (!$context['allow_save'])
1175
-		echo '
1191
+	if (!$context['allow_save']) {
1192
+			echo '
1176 1193
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1194
+	}
1177 1195
 
1178
-	foreach ($context['file_parts'] as $part)
1179
-		echo '
1196
+	foreach ($context['file_parts'] as $part) {
1197
+			echo '
1180 1198
 				<label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br>
1181 1199
 				<div class="centertext">
1182 1200
 					<textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea>
1183 1201
 				</div>';
1202
+	}
1184 1203
 
1185 1204
 	echo '
1186 1205
 				<div class="padding righttext">
@@ -1189,9 +1208,10 @@  discard block
 block discarded – undo
1189 1208
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1190 1209
 
1191 1210
 	// Hopefully it exists.
1192
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1193
-		echo '
1211
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1212
+			echo '
1194 1213
 					<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1214
+	}
1195 1215
 
1196 1216
 	echo '
1197 1217
 				</div>
@@ -1207,18 +1227,20 @@  discard block
 block discarded – undo
1207 1227
 {
1208 1228
 	global $context, $scripturl, $txt;
1209 1229
 
1210
-	if ($context['session_error'])
1211
-		echo '
1230
+	if ($context['session_error']) {
1231
+			echo '
1212 1232
 	<div class="errorbox">
1213 1233
 		', $txt['error_session_timeout'], '
1214 1234
 	</div>';
1235
+	}
1215 1236
 
1216 1237
 	//Is this file writeable?
1217
-	if (!$context['allow_save'])
1218
-		echo '
1238
+	if (!$context['allow_save']) {
1239
+			echo '
1219 1240
 	<div class="errorbox">
1220 1241
 		', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '
1221 1242
 	</div>';
1243
+	}
1222 1244
 
1223 1245
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1224 1246
 	echo '
@@ -1234,9 +1256,10 @@  discard block
 block discarded – undo
1234 1256
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1235 1257
 
1236 1258
 	// Hopefully it exists.
1237
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1238
-		echo '
1259
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1260
+			echo '
1239 1261
 				<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1262
+	}
1240 1263
 
1241 1264
 	echo '
1242 1265
 			</div>
Please login to merge, or discard this patch.
Themes/default/ManagePermissions.template.php 1 patch
Braces   +159 added lines, -122 removed lines patch added patch discarded remove patch
@@ -19,26 +19,28 @@  discard block
 block discarded – undo
19 19
 	global $context, $settings, $scripturl, $txt, $modSettings;
20 20
 
21 21
 	// Not allowed to edit?
22
-	if (!$context['can_modify'])
23
-		echo '
22
+	if (!$context['can_modify']) {
23
+			echo '
24 24
 	<div class="errorbox">
25 25
 		', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
26 26
 	</div>';
27
+	}
27 28
 
28 29
 	echo '
29 30
 	<div id="admin_form_wrapper">
30 31
 		<form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">';
31 32
 
32
-		if (!empty($context['profile']))
33
-			echo '
33
+		if (!empty($context['profile'])) {
34
+					echo '
34 35
 			<div class="cat_bar">
35 36
 				<h3 class="catbg">', $txt['permissions_for_profile'], ': &quot;', $context['profile']['name'], '&quot;</h3>
36 37
 			</div>';
37
-		else
38
-			echo '
38
+		} else {
39
+					echo '
39 40
 			<div class="cat_bar">
40 41
 				<h3 class="catbg">', $txt['permissions_title'], '</h3>
41 42
 			</div>';
43
+		}
42 44
 
43 45
 		echo '
44 46
 			<table class="table_grid">
@@ -47,13 +49,14 @@  discard block
 block discarded – undo
47 49
 						<th>', $txt['membergroups_name'], '</th>
48 50
 						<th class="small_table">', $txt['membergroups_members_top'], '</th>';
49 51
 
50
-			if (empty($modSettings['permission_enable_deny']))
51
-				echo '
52
+			if (empty($modSettings['permission_enable_deny'])) {
53
+							echo '
52 54
 						<th class="small_table">', $txt['membergroups_permissions'], '</th>';
53
-			else
54
-				echo '
55
+			} else {
56
+							echo '
55 57
 						<th class="small_table">', $txt['permissions_allowed'], '</th>
56 58
 						<th class="small_table">', $txt['permissions_denied'], '</th>';
59
+			}
57 60
 
58 61
 			echo '
59 62
 						<th class="small_table">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th>
@@ -71,22 +74,24 @@  discard block
 block discarded – undo
71 74
 						<td>
72 75
 							', !empty($group['help']) ? ' <a class="help" href="' . $scripturl . '?action=helpadmin;help=' . $group['help'] . '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a>' : '<img class="icon" src="' . $settings['images_url'] . '/blank.png" alt="' . $txt['help'] . '">', '&nbsp;<span>', $group['name'], '</span>';
73 76
 
74
-		if (!empty($group['children']))
75
-			echo '
77
+		if (!empty($group['children'])) {
78
+					echo '
76 79
 							<br>
77 80
 							<span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
81
+		}
78 82
 
79 83
 		echo '
80 84
 						</td>
81 85
 						<td>', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>';
82 86
 
83
-		if (empty($modSettings['permission_enable_deny']))
84
-			echo '
87
+		if (empty($modSettings['permission_enable_deny'])) {
88
+					echo '
85 89
 						<td>', $group['num_permissions']['allowed'], '</td>';
86
-		else
87
-			echo '
90
+		} else {
91
+					echo '
88 92
 						<td ', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '>', $group['num_permissions']['allowed'], '</td>
89 93
 						<td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>', $group['num_permissions']['denied'], '</td>';
94
+		}
90 95
 
91 96
 		echo '
92 97
 						<td>', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']) . '</a>' : '', '</td>
@@ -133,9 +138,10 @@  discard block
 block discarded – undo
133 138
 								<option value="empty">(', $txt['permissions_select_membergroup'], ')</option>';
134 139
 		foreach ($context['groups'] as $group)
135 140
 		{
136
-			if ($group['id'] != 1)
137
-				echo '
141
+			if ($group['id'] != 1) {
142
+							echo '
138 143
 								<option value="', $group['id'], '">', $group['name'], '</option>';
144
+			}
139 145
 		}
140 146
 
141 147
 		echo '
@@ -145,9 +151,10 @@  discard block
 block discarded – undo
145 151
 							<select name="add_remove">
146 152
 								<option value="add">', $txt['permissions_add'], '...</option>
147 153
 								<option value="clear">', $txt['permissions_remove'], '...</option>';
148
-		if (!empty($modSettings['permission_enable_deny']))
149
-			echo '
154
+		if (!empty($modSettings['permission_enable_deny'])) {
155
+					echo '
150 156
 								<option value="deny">', $txt['permissions_deny'], '...</option>';
157
+		}
151 158
 		echo '
152 159
 							</select>
153 160
 						</dt>
@@ -156,30 +163,34 @@  discard block
 block discarded – undo
156 163
 								<option value="">(', $txt['permissions_select_permission'], ')</option>';
157 164
 		foreach ($context['permissions'] as $permissionType)
158 165
 		{
159
-			if ($permissionType['id'] == 'membergroup' && !empty($context['profile']))
160
-				continue;
166
+			if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) {
167
+							continue;
168
+			}
161 169
 
162 170
 			foreach ($permissionType['columns'] as $column)
163 171
 			{
164 172
 				foreach ($column as $permissionGroup)
165 173
 				{
166
-					if ($permissionGroup['hidden'])
167
-						continue;
174
+					if ($permissionGroup['hidden']) {
175
+											continue;
176
+					}
168 177
 
169 178
 					echo '
170 179
 								<option value="" disabled>[', $permissionGroup['name'], ']</option>';
171 180
 					foreach ($permissionGroup['permissions'] as $perm)
172 181
 					{
173
-						if ($perm['hidden'])
174
-							continue;
182
+						if ($perm['hidden']) {
183
+													continue;
184
+						}
175 185
 
176
-						if ($perm['has_own_any'])
177
-							echo '
186
+						if ($perm['has_own_any']) {
187
+													echo '
178 188
 								<option value="', $permissionType['id'], '/', $perm['own']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['own']['name'], ')</option>
179 189
 								<option value="', $permissionType['id'], '/', $perm['any']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['any']['name'], ')</option>';
180
-						else
181
-							echo '
190
+						} else {
191
+													echo '
182 192
 								<option value="', $permissionType['id'], '/', $perm['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], '</option>';
193
+						}
183 194
 					}
184 195
 				}
185 196
 			}
@@ -246,9 +257,10 @@  discard block
 block discarded – undo
246 257
 		}
247 258
 	</script>';
248 259
 
249
-		if (!empty($context['profile']))
250
-			echo '
260
+		if (!empty($context['profile'])) {
261
+					echo '
251 262
 			<input type="hidden" name="pid" value="', $context['profile']['id'], '">';
263
+		}
252 264
 
253 265
 		echo '
254 266
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -293,9 +305,10 @@  discard block
 block discarded – undo
293 305
 				<h3 class="subbg">', $category['name'], '</h3>
294 306
 			</div>';
295 307
 
296
-		if (!empty($category['boards']))
297
-			echo '
308
+		if (!empty($category['boards'])) {
309
+					echo '
298 310
 				<ul class="perm_boards flow_hidden">';
311
+		}
299 312
 
300 313
 		foreach ($category['boards'] as $board)
301 314
 		{
@@ -312,33 +325,36 @@  discard block
 block discarded – undo
312 325
 				echo '
313 326
 							<select name="boardprofile[', $board['id'], ']">';
314 327
 
315
-				foreach ($context['profiles'] as $id => $profile)
316
-					echo '
328
+				foreach ($context['profiles'] as $id => $profile) {
329
+									echo '
317 330
 								<option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
331
+				}
318 332
 
319 333
 				echo '
320 334
 							</select>';
321
-			}
322
-			else
323
-				echo '
335
+			} else {
336
+							echo '
324 337
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>';
338
+			}
325 339
 
326 340
 			echo '
327 341
 						</span>
328 342
 					</li>';
329 343
 		}
330 344
 
331
-		if (!empty($category['boards']))
332
-			echo '
345
+		if (!empty($category['boards'])) {
346
+					echo '
333 347
 				</ul>';
348
+		}
334 349
 	}
335 350
 
336
-	if ($context['edit_all'])
337
-		echo '
351
+	if ($context['edit_all']) {
352
+			echo '
338 353
 			<input type="submit" name="save_changes" value="', $txt['save'], '" class="button">';
339
-	else
340
-		echo '
354
+	} else {
355
+			echo '
341 356
 			<a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>';
357
+	}
342 358
 
343 359
 	echo '
344 360
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -378,12 +394,13 @@  discard block
 block discarded – undo
378 394
 					<tr class="windowbg">
379 395
 						<td>';
380 396
 
381
-		if (!empty($context['show_rename_boxes']) && $profile['can_edit'])
382
-			echo '
397
+		if (!empty($context['show_rename_boxes']) && $profile['can_edit']) {
398
+					echo '
383 399
 							<input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">';
384
-		else
385
-			echo '
400
+		} else {
401
+					echo '
386 402
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>';
403
+		}
387 404
 
388 405
 		echo '
389 406
 						</td>
@@ -403,9 +420,10 @@  discard block
 block discarded – undo
403 420
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
404 421
 				<input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">';
405 422
 
406
-	if ($context['can_edit_something'])
407
-		echo '
423
+	if ($context['can_edit_something']) {
424
+			echo '
408 425
 				<input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">';
426
+	}
409 427
 
410 428
 	echo '
411 429
 				<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '/>
@@ -430,9 +448,10 @@  discard block
 block discarded – undo
430 448
 					<dd>
431 449
 						<select name="copy_from">';
432 450
 
433
-	foreach ($context['profiles'] as $id => $profile)
434
-		echo '
451
+	foreach ($context['profiles'] as $id => $profile) {
452
+			echo '
435 453
 							<option value="', $id, '">', $profile['name'], '</option>';
454
+	}
436 455
 
437 456
 	echo '
438 457
 						</select>
@@ -460,8 +479,7 @@  discard block
 block discarded – undo
460 479
 		<div class="errorbox">
461 480
 			', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
462 481
 		</div>';
463
-	}
464
-	else
482
+	} else
465 483
 	{
466 484
 		echo '
467 485
 		<script>
@@ -481,21 +499,23 @@  discard block
 block discarded – undo
481 499
 	<div id="admincenter">
482 500
 		<form id="permissions" action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" onsubmit="return warnAboutDeny();">';
483 501
 
484
-	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1)
485
-		echo '
502
+	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) {
503
+			echo '
486 504
 			<div class="information">
487 505
 				', $txt['permissions_option_desc'], '
488 506
 			</div>';
507
+	}
489 508
 
490 509
 	echo '
491 510
 			<div class="cat_bar">
492 511
 				<h3 class="catbg">';
493
-	if ($context['permission_type'] == 'board')
494
-		echo '
512
+	if ($context['permission_type'] == 'board') {
513
+			echo '
495 514
 				', $txt['permissions_local_for'], ' &quot;', $context['group']['name'], '&quot; ', $txt['permissions_on'], ' &quot;', $context['profile']['name'], '&quot;';
496
-	else
497
-		echo '
515
+	} else {
516
+			echo '
498 517
 				', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - &quot;', $context['group']['name'], '&quot;';
518
+	}
499 519
 	echo '
500 520
 				</h3>
501 521
 			</div>';
@@ -518,15 +538,17 @@  discard block
 block discarded – undo
518 538
 		template_modify_group_display('board');
519 539
 	}
520 540
 
521
-	if ($context['profile']['can_modify'])
522
-		echo '
541
+	if ($context['profile']['can_modify']) {
542
+			echo '
523 543
 			<div class="padding">
524 544
 				<input type="submit" value="', $txt['permissions_commit'], '" class="button">
525 545
 			</div>';
546
+	}
526 547
 
527
-	foreach ($context['hidden_perms'] as $hidden_perm)
528
-		echo '
548
+	foreach ($context['hidden_perms'] as $hidden_perm) {
549
+			echo '
529 550
 			<input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">';
551
+	}
530 552
 
531 553
 	echo '
532 554
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -554,17 +576,19 @@  discard block
 block discarded – undo
554 576
 
555 577
 		foreach ($column as $permissionGroup)
556 578
 		{
557
-			if (empty($permissionGroup['permissions']))
558
-				continue;
579
+			if (empty($permissionGroup['permissions'])) {
580
+							continue;
581
+			}
559 582
 
560 583
 			// Are we likely to have something in this group to display or is it all hidden?
561 584
 			$has_display_content = false;
562 585
 			if (!$permissionGroup['hidden'])
563 586
 			{
564 587
 				// Before we go any further check we are going to have some data to print otherwise we just have a silly heading.
565
-				foreach ($permissionGroup['permissions'] as $permission)
566
-					if (!$permission['hidden'])
588
+				foreach ($permissionGroup['permissions'] as $permission) {
589
+									if (!$permission['hidden'])
567 590
 						$has_display_content = true;
591
+				}
568 592
 
569 593
 				if ($has_display_content)
570 594
 				{
@@ -573,10 +597,11 @@  discard block
 block discarded – undo
573 597
 							<th></th>
574 598
 							<th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>';
575 599
 
576
-					if ($context['group']['id'] != -1)
577
-						echo '
600
+					if ($context['group']['id'] != -1) {
601
+											echo '
578 602
 							<th>', $txt['permissions_option_own'], '</th>
579 603
 							<th>', $txt['permissions_option_any'], '</th>';
604
+					}
580 605
 
581 606
 						echo '
582 607
 						</tr>';
@@ -599,17 +624,18 @@  discard block
 block discarded – undo
599 624
 						// Guests can't do their own thing.
600 625
 						if ($context['group']['id'] != -1)
601 626
 						{
602
-							if (empty($modSettings['permission_enable_deny']))
603
-								echo '
627
+							if (empty($modSettings['permission_enable_deny'])) {
628
+															echo '
604 629
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" ', $disable_field, '/>';
605
-							else
630
+							} else
606 631
 							{
607 632
 								echo '
608 633
 								<select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>';
609 634
 
610
-								foreach (array('on', 'off', 'deny') as $c)
611
-									echo '
635
+								foreach (array('on', 'off', 'deny') as $c) {
636
+																	echo '
612 637
 									<option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
638
+								}
613 639
 							echo '
614 640
 								</select>';
615 641
 							}
@@ -619,39 +645,41 @@  discard block
 block discarded – undo
619 645
 							<td>';
620 646
 						}
621 647
 
622
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
623
-							echo '
648
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
649
+													echo '
624 650
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '/>';
625
-						else
651
+						} else
626 652
 						{
627 653
 							echo '
628 654
 								<select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>';
629 655
 
630
-							foreach (array('on', 'off', 'deny') as $c)
631
-								echo '
656
+							foreach (array('on', 'off', 'deny') as $c) {
657
+															echo '
632 658
 									<option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
659
+							}
633 660
 							echo '
634 661
 								</select>';
635 662
 						}
636
-					}
637
-					else
663
+					} else
638 664
 					{
639
-						if ($context['group']['id'] != -1)
640
-							echo '
665
+						if ($context['group']['id'] != -1) {
666
+													echo '
641 667
 							</td>
642 668
 							<td>';
669
+						}
643 670
 
644
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
645
-							echo '
671
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
672
+													echo '
646 673
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '/>';
647
-						else
674
+						} else
648 675
 						{
649 676
 							echo '
650 677
 								<select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>';
651 678
 
652
-							foreach (array('on', 'off', 'deny') as $c)
653
-								echo '
679
+							foreach (array('on', 'off', 'deny') as $c) {
680
+															echo '
654 681
 									<option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
682
+							}
655 683
 							echo '
656 684
 								</select>';
657 685
 						}
@@ -681,11 +709,11 @@  discard block
 block discarded – undo
681 709
 	echo '
682 710
 											<fieldset id="', $context['current_permission'], '">
683 711
 												<legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;" class="toggle_up"> ', $txt['avatar_select_permission'], '</a></legend>';
684
-	if (empty($modSettings['permission_enable_deny']))
685
-		echo '
712
+	if (empty($modSettings['permission_enable_deny'])) {
713
+			echo '
686 714
 												<ul>';
687
-	else
688
-		echo '
715
+	} else {
716
+			echo '
689 717
 												<div class="information">', $txt['permissions_option_desc'], '</div>
690 718
 												<dl class="settings">
691 719
 													<dt>
@@ -695,46 +723,51 @@  discard block
 block discarded – undo
695 723
 													</dt>
696 724
 													<dd>
697 725
 													</dd>';
726
+	}
698 727
 	foreach ($context['member_groups'] as $group)
699 728
 	{
700
-		if (!empty($modSettings['permission_enable_deny']))
701
-			echo '
729
+		if (!empty($modSettings['permission_enable_deny'])) {
730
+					echo '
702 731
 													<dt>';
703
-		else
704
-			echo '
732
+		} else {
733
+					echo '
705 734
 													<li>';
735
+		}
706 736
 
707
-		if (empty($modSettings['permission_enable_deny']))
708
-			echo '
737
+		if (empty($modSettings['permission_enable_deny'])) {
738
+					echo '
709 739
 														<input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>';
710
-		else
711
-			echo '
740
+		} else {
741
+					echo '
712 742
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span>
713 743
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span>
714 744
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>';
745
+		}
715 746
 
716
-		if (!empty($modSettings['permission_enable_deny']))
717
-			echo '
747
+		if (!empty($modSettings['permission_enable_deny'])) {
748
+					echo '
718 749
 													</dt>
719 750
 													<dd>
720 751
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
721 752
 													</dd>';
722
-		else
723
-			echo '
753
+		} else {
754
+					echo '
724 755
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
725 756
 													</li>';
757
+		}
726 758
 	}
727 759
 
728
-	if (empty($modSettings['permission_enable_deny']))
729
-		echo '
760
+	if (empty($modSettings['permission_enable_deny'])) {
761
+			echo '
730 762
 													<li>
731 763
 														<input type="checkbox" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');">
732 764
 														<span>', $txt['check_all'], '</span>
733 765
 													</li>
734 766
 												</ul>';
735
-	else
736
-		echo '
767
+	} else {
768
+			echo '
737 769
 												</dl>';
770
+	}
738 771
 
739 772
 	echo '
740 773
 											</fieldset>
@@ -774,9 +807,10 @@  discard block
 block discarded – undo
774 807
 	if (!empty($modSettings['postmod_active']))
775 808
 	{
776 809
 		// Got advanced permissions - if so warn!
777
-		if (!empty($modSettings['permission_enable_deny']))
778
-			echo '
810
+		if (!empty($modSettings['permission_enable_deny'])) {
811
+					echo '
779 812
 							<div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>';
813
+		}
780 814
 
781 815
 		echo '
782 816
 							<div class="padding">
@@ -791,10 +825,11 @@  discard block
 block discarded – undo
791 825
 									', $txt['permissions_post_moderation_select'], ':
792 826
 									<select name="pid" onchange="document.forms.postmodForm.submit();">';
793 827
 
794
-		foreach ($context['profiles'] as $profile)
795
-			if ($profile['can_modify'])
828
+		foreach ($context['profiles'] as $profile) {
829
+					if ($profile['can_modify'])
796 830
 				echo '
797 831
 										<option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
832
+		}
798 833
 
799 834
 		echo '
800 835
 									</select>
@@ -815,11 +850,12 @@  discard block
 block discarded – undo
815 850
 											', $txt['permissions_post_moderation_replies_any'], '
816 851
 										</th>';
817 852
 
818
-		if ($modSettings['attachmentEnable'] == 1)
819
-			echo '
853
+		if ($modSettings['attachmentEnable'] == 1) {
854
+					echo '
820 855
 										<th class="centercol" colspan="3">
821 856
 											', $txt['permissions_post_moderation_attachments'], '
822 857
 										</th>';
858
+		}
823 859
 
824 860
 		echo '
825 861
 									</tr>
@@ -837,11 +873,12 @@  discard block
 block discarded – undo
837 873
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
838 874
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
839 875
 
840
-		if ($modSettings['attachmentEnable'] == 1)
841
-			echo '
876
+		if ($modSettings['attachmentEnable'] == 1) {
877
+					echo '
842 878
 										<th><span class="generic_icons post_moderation_allow"></span></th>
843 879
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
844 880
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
881
+		}
845 882
 
846 883
 		echo '
847 884
 									</tr>
@@ -854,9 +891,10 @@  discard block
 block discarded – undo
854 891
 									<tr class="windowbg">
855 892
 										<td class="half_table">
856 893
 											<span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>';
857
-				if (!empty($group['children']))
858
-					echo '
894
+				if (!empty($group['children'])) {
895
+									echo '
859 896
 											<br><span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
897
+				}
860 898
 
861 899
 				echo '
862 900
 										</td>
@@ -869,8 +907,7 @@  discard block
 block discarded – undo
869 907
 				{
870 908
 				echo '
871 909
 										<td colspan="3"></td>';
872
-				}
873
-				else
910
+				} else
874 911
 				{
875 912
 					echo '
876 913
 										<td class="centercol"><input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '></td>
Please login to merge, or discard this patch.