Completed
Pull Request — release-2.1 (#4029)
by Mert
09:24 queued 21s
created
Sources/tasks/GroupReq-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 class GroupReq_Notify_Background extends SMF_BackgroundTask
21 21
 {
22 22
 	/**
23
-     * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed.
23
+	 * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed.
24 24
 	 * @return bool Always returns true.
25 25
 	 */
26 26
 	public function execute()
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 			)
38 38
 		);
39 39
 		$moderators = array();
40
-		while ($row = $smcFunc['db_fetch_assoc']($request))
41
-			$moderators[] = $row['id_member'];
40
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
41
+					$moderators[] = $row['id_member'];
42
+		}
42 43
 		$smcFunc['db_free_result']($request);
43 44
 
44 45
 		require_once($sourcedir . '/Subs-Members.php');
@@ -59,11 +60,13 @@  discard block
 block discarded – undo
59 60
 			{
60 61
 				if (!empty($prefs[$mod]['request_group']))
61 62
 				{
62
-					if ($prefs[$mod]['request_group'] & 0x01)
63
-						$data['alert'][] = $mod;
63
+					if ($prefs[$mod]['request_group'] & 0x01) {
64
+											$data['alert'][] = $mod;
65
+					}
64 66
 
65
-					if ($prefs[$mod]['request_group'] & 0x02)
66
-						$data['email'][] = $mod;
67
+					if ($prefs[$mod]['request_group'] & 0x02) {
68
+											$data['email'][] = $mod;
69
+					}
67 70
 				}
68 71
 			}
69 72
 
Please login to merge, or discard this patch.
Sources/CacheAPI-xcache.php 1 patch
Braces   +19 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
  * @version 2.1 Beta 3
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
@@ -46,8 +47,9 @@  discard block
 block discarded – undo
46 47
 
47 48
 		$supported = function_exists('xcache_get') && function_exists('xcache_set') && ini_get('xcache.var_size') > 0;
48 49
 
49
-		if ($test)
50
-			return $supported;
50
+		if ($test) {
51
+					return $supported;
52
+		}
51 53
 		return parent::isSupported() && $supported;
52 54
 	}
53 55
 
@@ -68,10 +70,11 @@  discard block
 block discarded – undo
68 70
 	{
69 71
 		$key = $this->prefix . strtr($key, ':/', '-_');
70 72
 
71
-		if ($value === null)
72
-			return xcache_unset($key);
73
-		else
74
-			return xcache_set($key, $value, $ttl);
73
+		if ($value === null) {
74
+					return xcache_unset($key);
75
+		} else {
76
+					return xcache_set($key, $value, $ttl);
77
+		}
75 78
 	}
76 79
 
77 80
 	/**
@@ -90,10 +93,12 @@  discard block
 block discarded – undo
90 93
 		}
91 94
 
92 95
 		// if passed a type, clear that type out
93
-		if ($type === '' || $type === 'user')
94
-			xcache_clear_cache(XC_TYPE_VAR, 0);
95
-		if ($type === '' || $type === 'data')
96
-			xcache_clear_cache(XC_TYPE_PHP, 0);
96
+		if ($type === '' || $type === 'user') {
97
+					xcache_clear_cache(XC_TYPE_VAR, 0);
98
+		}
99
+		if ($type === '' || $type === 'data') {
100
+					xcache_clear_cache(XC_TYPE_PHP, 0);
101
+		}
97 102
 
98 103
 		$this->invalidateCache();
99 104
 		return true;
@@ -112,8 +117,9 @@  discard block
 block discarded – undo
112 117
 		// While we could md5 this when saving, this could be tricky to be sure it doesn't get corrupted on additional saves.
113 118
 		$config_vars[] = array('xcache_adminpass', $txt['cache_xcache_adminpass'], 'db', 'text', 0);
114 119
 
115
-		if (!isset($context['settings_post_javascript']))
116
-			$context['settings_post_javascript'] = '';
120
+		if (!isset($context['settings_post_javascript'])) {
121
+					$context['settings_post_javascript'] = '';
122
+		}
117 123
 
118 124
 		$context['settings_post_javascript'] .= '
119 125
 			$("#cache_accelerator").change(function (e) {
Please login to merge, or discard this patch.
Sources/Profile-Actions.php 1 patch
Braces   +117 added lines, -86 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 3
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Activate an account.
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
 		logAction('approve_member', array('member' => $memID), 'admin');
49 50
 
50 51
 		// If we are doing approval, update the stats for the member just in case.
51
-		if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15)))
52
-			updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0)));
52
+		if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) {
53
+					updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0)));
54
+		}
53 55
 
54 56
 		// Make sure we update the stats too.
55 57
 		updateStats('member', false);
@@ -76,8 +78,9 @@  discard block
 block discarded – undo
76 78
 	$issueErrors = array();
77 79
 
78 80
 	// Doesn't hurt to be overly cautious.
79
-	if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning'))
80
-		fatal_lang_error('no_access', false);
81
+	if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) {
82
+			fatal_lang_error('no_access', false);
83
+	}
81 84
 
82 85
 	// Get the base (errors related) stuff done.
83 86
 	loadLanguage('Errors');
@@ -135,16 +138,18 @@  discard block
 block discarded – undo
135 138
 
136 139
 		// This cannot be empty!
137 140
 		$_POST['warn_reason'] = isset($_POST['warn_reason']) ? trim($_POST['warn_reason']) : '';
138
-		if ($_POST['warn_reason'] == '' && !$context['user']['is_owner'])
139
-			$issueErrors[] = 'warning_no_reason';
141
+		if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) {
142
+					$issueErrors[] = 'warning_no_reason';
143
+		}
140 144
 		$_POST['warn_reason'] = $smcFunc['htmlspecialchars']($_POST['warn_reason']);
141 145
 
142 146
 		$_POST['warning_level'] = (int) $_POST['warning_level'];
143 147
 		$_POST['warning_level'] = max(0, min(100, $_POST['warning_level']));
144
-		if ($_POST['warning_level'] < $context['min_allowed'])
145
-			$_POST['warning_level'] = $context['min_allowed'];
146
-		elseif ($_POST['warning_level'] > $context['max_allowed'])
147
-			$_POST['warning_level'] = $context['max_allowed'];
148
+		if ($_POST['warning_level'] < $context['min_allowed']) {
149
+					$_POST['warning_level'] = $context['min_allowed'];
150
+		} elseif ($_POST['warning_level'] > $context['max_allowed']) {
151
+					$_POST['warning_level'] = $context['max_allowed'];
152
+		}
148 153
 
149 154
 		// Do we actually have to issue them with a PM?
150 155
 		$id_notice = 0;
@@ -152,8 +157,9 @@  discard block
 block discarded – undo
152 157
 		{
153 158
 			$_POST['warn_sub'] = trim($_POST['warn_sub']);
154 159
 			$_POST['warn_body'] = trim($_POST['warn_body']);
155
-			if (empty($_POST['warn_sub']) || empty($_POST['warn_body']))
156
-				$issueErrors[] = 'warning_notify_blank';
160
+			if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) {
161
+							$issueErrors[] = 'warning_notify_blank';
162
+			}
157 163
 			// Send the PM?
158 164
 			else
159 165
 			{
@@ -190,8 +196,8 @@  discard block
 block discarded – undo
190 196
 		if (empty($issueErrors))
191 197
 		{
192 198
 			// Log what we've done!
193
-			if (!$context['user']['is_owner'])
194
-				$smcFunc['db_insert']('',
199
+			if (!$context['user']['is_owner']) {
200
+							$smcFunc['db_insert']('',
195 201
 					'{db_prefix}log_comments',
196 202
 					array(
197 203
 						'id_member' => 'int', 'member_name' => 'string', 'comment_type' => 'string', 'id_recipient' => 'int', 'recipient_name' => 'string-255',
@@ -203,14 +209,14 @@  discard block
 block discarded – undo
203 209
 					),
204 210
 					array('id_comment')
205 211
 				);
212
+			}
206 213
 
207 214
 			// Make the change.
208 215
 			updateMemberData($memID, array('warning' => $_POST['warning_level']));
209 216
 
210 217
 			// Leave a lovely message.
211 218
 			$context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : $txt['profile_warning_success'];
212
-		}
213
-		else
219
+		} else
214 220
 		{
215 221
 			// Try to remember some bits.
216 222
 			$context['warning_data'] = array(
@@ -229,8 +235,9 @@  discard block
 block discarded – undo
229 235
 	{
230 236
 		$warning_body = !empty($_POST['warn_body']) ? trim(censorText($_POST['warn_body'])) : '';
231 237
 		$context['preview_subject'] = !empty($_POST['warn_sub']) ? trim($smcFunc['htmlspecialchars']($_POST['warn_sub'])) : '';
232
-		if (empty($_POST['warn_sub']) || empty($_POST['warn_body']))
233
-			$issueErrors[] = 'warning_notify_blank';
238
+		if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) {
239
+					$issueErrors[] = 'warning_notify_blank';
240
+		}
234 241
 
235 242
 		if (!empty($_POST['warn_body']))
236 243
 		{
@@ -254,8 +261,9 @@  discard block
 block discarded – undo
254 261
 	{
255 262
 		// Fill in the suite of errors.
256 263
 		$context['post_errors'] = array();
257
-		foreach ($issueErrors as $error)
258
-			$context['post_errors'][] = $txt[$error];
264
+		foreach ($issueErrors as $error) {
265
+					$context['post_errors'][] = $txt[$error];
266
+		}
259 267
 	}
260 268
 
261 269
 
@@ -272,9 +280,10 @@  discard block
 block discarded – undo
272 280
 		$modSettings['warning_mute'] => $txt['profile_warning_effect_mute'],
273 281
 	);
274 282
 	$context['current_level'] = 0;
275
-	foreach ($context['level_effects'] as $limit => $dummy)
276
-		if ($context['member']['warning'] >= $limit)
283
+	foreach ($context['level_effects'] as $limit => $dummy) {
284
+			if ($context['member']['warning'] >= $limit)
277 285
 			$context['current_level'] = $limit;
286
+	}
278 287
 
279 288
 	$listOptions = array(
280 289
 		'id' => 'view_warnings',
@@ -337,11 +346,12 @@  discard block
 block discarded – undo
337 346
 							' . $warning['reason'] . '
338 347
 						</div>';
339 348
 
340
-						if (!empty($warning['id_notice']))
341
-							$ret .= '
349
+						if (!empty($warning['id_notice'])) {
350
+													$ret .= '
342 351
 						<div class="floatright">
343 352
 							<a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $warning['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" class="new_win" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a>
344 353
 						</div>';
354
+						}
345 355
 
346 356
 						return $ret;
347 357
 					},
@@ -413,8 +423,9 @@  discard block
 block discarded – undo
413 423
 	while ($row = $smcFunc['db_fetch_assoc']($request))
414 424
 	{
415 425
 		// If we're not warning for a message skip any that are.
416
-		if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false)
417
-			continue;
426
+		if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) {
427
+					continue;
428
+		}
418 429
 
419 430
 		$context['notification_templates'][] = array(
420 431
 			'title' => $row['template_title'],
@@ -424,16 +435,18 @@  discard block
 block discarded – undo
424 435
 	$smcFunc['db_free_result']($request);
425 436
 
426 437
 	// Setup the "default" templates.
427
-	foreach (array('spamming', 'offence', 'insulting') as $type)
428
-		$context['notification_templates'][] = array(
438
+	foreach (array('spamming', 'offence', 'insulting') as $type) {
439
+			$context['notification_templates'][] = array(
429 440
 			'title' => $txt['profile_warning_notify_title_' . $type],
430 441
 			'body' => sprintf($txt['profile_warning_notify_template_outline' . (!empty($context['warning_for_message']) ? '_post' : '')], $txt['profile_warning_notify_for_' . $type]),
431 442
 		);
443
+	}
432 444
 
433 445
 	// Replace all the common variables in the templates.
434
-	foreach ($context['notification_templates'] as $k => $name)
435
-		$context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team']));
436
-}
446
+	foreach ($context['notification_templates'] as $k => $name) {
447
+			$context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team']));
448
+	}
449
+	}
437 450
 
438 451
 /**
439 452
  * Get the number of warnings a user has. Callback for $listOptions['get_count'] in issueWarning()
@@ -517,10 +530,11 @@  discard block
 block discarded – undo
517 530
 {
518 531
 	global $txt, $context, $modSettings, $cur_profile;
519 532
 
520
-	if (!$context['user']['is_owner'])
521
-		isAllowedTo('profile_remove_any');
522
-	elseif (!allowedTo('profile_remove_any'))
523
-		isAllowedTo('profile_remove_own');
533
+	if (!$context['user']['is_owner']) {
534
+			isAllowedTo('profile_remove_any');
535
+	} elseif (!allowedTo('profile_remove_any')) {
536
+			isAllowedTo('profile_remove_own');
537
+	}
524 538
 
525 539
 	// Permissions for removing stuff...
526 540
 	$context['can_delete_posts'] = !$context['user']['is_owner'] && allowedTo('moderate_forum');
@@ -547,10 +561,11 @@  discard block
 block discarded – undo
547 561
 
548 562
 	// @todo Add a way to delete pms as well?
549 563
 
550
-	if (!$context['user']['is_owner'])
551
-		isAllowedTo('profile_remove_any');
552
-	elseif (!allowedTo('profile_remove_any'))
553
-		isAllowedTo('profile_remove_own');
564
+	if (!$context['user']['is_owner']) {
565
+			isAllowedTo('profile_remove_any');
566
+	} elseif (!allowedTo('profile_remove_any')) {
567
+			isAllowedTo('profile_remove_own');
568
+	}
554 569
 
555 570
 	checkSession();
556 571
 
@@ -576,8 +591,9 @@  discard block
 block discarded – undo
576 591
 		list ($another) = $smcFunc['db_fetch_row']($request);
577 592
 		$smcFunc['db_free_result']($request);
578 593
 
579
-		if (empty($another))
580
-			fatal_lang_error('at_least_one_admin', 'critical');
594
+		if (empty($another)) {
595
+					fatal_lang_error('at_least_one_admin', 'critical');
596
+		}
581 597
 	}
582 598
 
583 599
 	// This file is needed for the deleteMembers function.
@@ -656,8 +672,9 @@  discard block
 block discarded – undo
656 672
 					)
657 673
 				);
658 674
 				$topicIDs = array();
659
-				while ($row = $smcFunc['db_fetch_assoc']($request))
660
-					$topicIDs[] = $row['id_topic'];
675
+				while ($row = $smcFunc['db_fetch_assoc']($request)) {
676
+									$topicIDs[] = $row['id_topic'];
677
+				}
661 678
 				$smcFunc['db_free_result']($request);
662 679
 
663 680
 				// Actually remove the topics. Ignore recycling if we want to perma-delete things...
@@ -680,8 +697,9 @@  discard block
 block discarded – undo
680 697
 			// This could take a while... but ya know it's gonna be worth it in the end.
681 698
 			while ($row = $smcFunc['db_fetch_assoc']($request))
682 699
 			{
683
-				if (function_exists('apache_reset_timeout'))
684
-					@apache_reset_timeout();
700
+				if (function_exists('apache_reset_timeout')) {
701
+									@apache_reset_timeout();
702
+				}
685 703
 
686 704
 				removeMessage($row['id_msg']);
687 705
 			}
@@ -689,8 +707,9 @@  discard block
 block discarded – undo
689 707
 		}
690 708
 
691 709
 		// Only delete this poor members account if they are actually being booted out of camp.
692
-		if (isset($_POST['deleteAccount']))
693
-			deleteMembers($memID);
710
+		if (isset($_POST['deleteAccount'])) {
711
+					deleteMembers($memID);
712
+		}
694 713
 	}
695 714
 	// Do they need approval to delete?
696 715
 	elseif (!empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum'))
@@ -741,18 +760,18 @@  discard block
 block discarded – undo
741 760
 		{
742 761
 			foreach ($costs as $duration => $cost)
743 762
 			{
744
-				if ($cost != 0)
745
-					$cost_array[$duration] = $cost;
763
+				if ($cost != 0) {
764
+									$cost_array[$duration] = $cost;
765
+				}
746 766
 			}
747
-		}
748
-		else
767
+		} else
749 768
 		{
750 769
 			$cost_array['fixed'] = $costs['fixed'];
751 770
 		}
752 771
 
753
-		if (empty($cost_array))
754
-			unset($context['subscriptions'][$id]);
755
-		else
772
+		if (empty($cost_array)) {
773
+					unset($context['subscriptions'][$id]);
774
+		} else
756 775
 		{
757 776
 			$context['subscriptions'][$id]['member'] = 0;
758 777
 			$context['subscriptions'][$id]['subscribed'] = false;
@@ -765,13 +784,15 @@  discard block
 block discarded – undo
765 784
 	foreach ($gateways as $id => $gateway)
766 785
 	{
767 786
 		$gateways[$id] = new $gateway['display_class']();
768
-		if (!$gateways[$id]->gatewayEnabled())
769
-			unset($gateways[$id]);
787
+		if (!$gateways[$id]->gatewayEnabled()) {
788
+					unset($gateways[$id]);
789
+		}
770 790
 	}
771 791
 
772 792
 	// No gateways yet?
773
-	if (empty($gateways))
774
-		fatal_error($txt['paid_admin_not_setup_gateway']);
793
+	if (empty($gateways)) {
794
+			fatal_error($txt['paid_admin_not_setup_gateway']);
795
+	}
775 796
 
776 797
 	// Get the current subscriptions.
777 798
 	$request = $smcFunc['db_query']('', '
@@ -786,8 +807,9 @@  discard block
 block discarded – undo
786 807
 	while ($row = $smcFunc['db_fetch_assoc']($request))
787 808
 	{
788 809
 		// The subscription must exist!
789
-		if (!isset($context['subscriptions'][$row['id_subscribe']]))
790
-			continue;
810
+		if (!isset($context['subscriptions'][$row['id_subscribe']])) {
811
+					continue;
812
+		}
791 813
 
792 814
 		$context['current'][$row['id_subscribe']] = array(
793 815
 			'id' => $row['id_sublog'],
@@ -801,8 +823,9 @@  discard block
 block discarded – undo
801 823
 			'status_text' => $row['status'] == 0 ? ($row['payments_pending'] ? $txt['paid_pending'] : $txt['paid_finished']) : $txt['paid_active'],
802 824
 		);
803 825
 
804
-		if ($row['status'] == 1)
805
-			$context['subscriptions'][$row['id_subscribe']]['subscribed'] = true;
826
+		if ($row['status'] == 1) {
827
+					$context['subscriptions'][$row['id_subscribe']]['subscribed'] = true;
828
+		}
806 829
 	}
807 830
 	$smcFunc['db_free_result']($request);
808 831
 
@@ -853,21 +876,25 @@  discard block
 block discarded – undo
853 876
 	if (isset($_GET['confirm']) && isset($_POST['sub_id']) && is_array($_POST['sub_id']))
854 877
 	{
855 878
 		// Hopefully just one.
856
-		foreach ($_POST['sub_id'] as $k => $v)
857
-			$ID_SUB = (int) $k;
879
+		foreach ($_POST['sub_id'] as $k => $v) {
880
+					$ID_SUB = (int) $k;
881
+		}
858 882
 
859
-		if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0)
860
-			fatal_lang_error('paid_sub_not_active');
883
+		if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) {
884
+					fatal_lang_error('paid_sub_not_active');
885
+		}
861 886
 
862 887
 		// Simplify...
863 888
 		$context['sub'] = $context['subscriptions'][$ID_SUB];
864 889
 		$period = 'xx';
865
-		if ($context['sub']['flexible'])
866
-			$period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx';
890
+		if ($context['sub']['flexible']) {
891
+					$period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx';
892
+		}
867 893
 
868 894
 		// Check we have a valid cost.
869
-		if ($context['sub']['flexible'] && $period == 'xx')
870
-			fatal_lang_error('paid_sub_not_active');
895
+		if ($context['sub']['flexible'] && $period == 'xx') {
896
+					fatal_lang_error('paid_sub_not_active');
897
+		}
871 898
 
872 899
 		// Sort out the cost/currency.
873 900
 		$context['currency'] = $modSettings['paid_currency_code'];
@@ -880,8 +907,7 @@  discard block
 block discarded – undo
880 907
 			$context['cost'] = sprintf($modSettings['paid_currency_symbol'], $context['value']) . '/' . $txt[$_POST['cur'][$ID_SUB]];
881 908
 			// The period value for paypal.
882 909
 			$context['paypal_period'] = strtoupper(substr($_POST['cur'][$ID_SUB], 0, 1));
883
-		}
884
-		else
910
+		} else
885 911
 		{
886 912
 			// Real cost...
887 913
 			$context['value'] = $context['sub']['costs']['fixed'];
@@ -898,13 +924,15 @@  discard block
 block discarded – undo
898 924
 		foreach ($gateways as $id => $gateway)
899 925
 		{
900 926
 			$fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile;u=' . $memID . ';area=subscriptions;sub_id=' . $context['sub']['id'] . ';done');
901
-			if (!empty($fields['form']))
902
-				$context['gateways'][] = $fields;
927
+			if (!empty($fields['form'])) {
928
+							$context['gateways'][] = $fields;
929
+			}
903 930
 		}
904 931
 
905 932
 		// Bugger?!
906
-		if (empty($context['gateways']))
907
-			fatal_error($txt['paid_admin_not_setup_gateway']);
933
+		if (empty($context['gateways'])) {
934
+					fatal_error($txt['paid_admin_not_setup_gateway']);
935
+		}
908 936
 
909 937
 		// Now we are going to assume they want to take this out ;)
910 938
 		$new_data = array($context['sub']['id'], $context['value'], $period, 'prepay');
@@ -912,16 +940,19 @@  discard block
 block discarded – undo
912 940
 		{
913 941
 			// What are the details like?
914 942
 			$current_pending = array();
915
-			if ($context['current'][$context['sub']['id']]['pending_details'] != '')
916
-				$current_pending = smf_json_decode($context['current'][$context['sub']['id']]['pending_details'], true);
943
+			if ($context['current'][$context['sub']['id']]['pending_details'] != '') {
944
+							$current_pending = smf_json_decode($context['current'][$context['sub']['id']]['pending_details'], true);
945
+			}
917 946
 			// Don't get silly.
918
-			if (count($current_pending) > 9)
919
-				$current_pending = array();
947
+			if (count($current_pending) > 9) {
948
+							$current_pending = array();
949
+			}
920 950
 			$pending_count = 0;
921 951
 			// Only record real pending payments as will otherwise confuse the admin!
922
-			foreach ($current_pending as $pending)
923
-				if ($pending[3] == 'payback')
952
+			foreach ($current_pending as $pending) {
953
+							if ($pending[3] == 'payback')
924 954
 					$pending_count++;
955
+			}
925 956
 
926 957
 			if (!in_array($new_data, $current_pending))
927 958
 			{
@@ -966,9 +997,9 @@  discard block
 block discarded – undo
966 997
 
967 998
 		// Quit.
968 999
 		return;
1000
+	} else {
1001
+			$context['sub_template'] = 'user_subscription';
1002
+	}
969 1003
 	}
970
-	else
971
-		$context['sub_template'] = 'user_subscription';
972
-}
973 1004
 
974 1005
 ?>
975 1006
\ No newline at end of file
Please login to merge, or discard this patch.
Sources/Admin.php 1 patch
Braces   +75 added lines, -52 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 3
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * The main admin handling function.<br>
@@ -444,8 +445,9 @@  discard block
 block discarded – undo
444 445
 		foreach ($admin_includes as $include)
445 446
 		{
446 447
 			$include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
447
-			if (file_exists($include))
448
-				require_once($include);
448
+			if (file_exists($include)) {
449
+							require_once($include);
450
+			}
449 451
 		}
450 452
 	}
451 453
 
@@ -457,24 +459,27 @@  discard block
 block discarded – undo
457 459
 	unset($admin_areas);
458 460
 
459 461
 	// Nothing valid?
460
-	if ($admin_include_data == false)
461
-		fatal_lang_error('no_access', false);
462
+	if ($admin_include_data == false) {
463
+			fatal_lang_error('no_access', false);
464
+	}
462 465
 
463 466
 	// Build the link tree.
464 467
 	$context['linktree'][] = array(
465 468
 		'url' => $scripturl . '?action=admin',
466 469
 		'name' => $txt['admin_center'],
467 470
 	);
468
-	if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index')
469
-		$context['linktree'][] = array(
471
+	if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index') {
472
+			$context['linktree'][] = array(
470 473
 			'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';' . $context['session_var'] . '=' . $context['session_id'],
471 474
 			'name' => $admin_include_data['label'],
472 475
 		);
473
-	if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label'])
474
-		$context['linktree'][] = array(
476
+	}
477
+	if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label']) {
478
+			$context['linktree'][] = array(
475 479
 			'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';sa=' . $admin_include_data['current_subsection'] . ';' . $context['session_var'] . '=' . $context['session_id'],
476 480
 			'name' => $admin_include_data['subsections'][$admin_include_data['current_subsection']][0],
477 481
 		);
482
+	}
478 483
 
479 484
 	// Make a note of the Unique ID for this menu.
480 485
 	$context['admin_menu_id'] = $context['max_menu_id'];
@@ -484,16 +489,18 @@  discard block
 block discarded – undo
484 489
 	$context['admin_area'] = $admin_include_data['current_area'];
485 490
 
486 491
 	// Now - finally - call the right place!
487
-	if (isset($admin_include_data['file']))
488
-		require_once($sourcedir . '/' . $admin_include_data['file']);
492
+	if (isset($admin_include_data['file'])) {
493
+			require_once($sourcedir . '/' . $admin_include_data['file']);
494
+	}
489 495
 
490 496
 	// Get the right callable.
491 497
 	$call = call_helper($admin_include_data['function'], true);
492 498
 
493 499
 	// Is it valid?
494
-	if (!empty($call))
495
-		call_user_func($call);
496
-}
500
+	if (!empty($call)) {
501
+			call_user_func($call);
502
+	}
503
+	}
497 504
 
498 505
 /**
499 506
  * The main administration section.
@@ -547,13 +554,14 @@  discard block
 block discarded – undo
547 554
 
548 555
 	$context['sub_template'] = $context['admin_area'] == 'credits' ? 'credits' : 'admin';
549 556
 	$context['page_title'] = $context['admin_area'] == 'credits' ? $txt['support_credits_title'] : $txt['admin_center'];
550
-	if ($context['admin_area'] != 'credits')
551
-		$context[$context['admin_menu_name']]['tab_data'] = array(
557
+	if ($context['admin_area'] != 'credits') {
558
+			$context[$context['admin_menu_name']]['tab_data'] = array(
552 559
 			'title' => $txt['admin_center'],
553 560
 			'help' => '',
554 561
 			'description' => '<strong>' . $txt['hello_guest'] . ' ' . $context['user']['name'] . '!</strong>
555 562
 						' . sprintf($txt['admin_main_welcome'], $txt['admin_center'], $txt['help'], $txt['help']),
556 563
 		);
564
+	}
557 565
 
558 566
 	// Lastly, fill in the blanks in the support resources paragraphs.
559 567
 	$txt['support_resources_p1'] = sprintf($txt['support_resources_p1'],
@@ -571,9 +579,10 @@  discard block
 block discarded – undo
571 579
 		'http://www.simplemachines.org/redirect/customize_support'
572 580
 	);
573 581
 
574
-	if ($context['admin_area'] == 'admin')
575
-		loadJavaScriptFile('admin.js', array('defer' => false), 'smf_admin');
576
-}
582
+	if ($context['admin_area'] == 'admin') {
583
+			loadJavaScriptFile('admin.js', array('defer' => false), 'smf_admin');
584
+	}
585
+	}
577 586
 
578 587
 /**
579 588
  * Get one of the admin information files from Simple Machines.
@@ -584,8 +593,9 @@  discard block
 block discarded – undo
584 593
 
585 594
 	setMemoryLimit('32M');
586 595
 
587
-	if (empty($_REQUEST['filename']) || !is_string($_REQUEST['filename']))
588
-		fatal_lang_error('no_access', false);
596
+	if (empty($_REQUEST['filename']) || !is_string($_REQUEST['filename'])) {
597
+			fatal_lang_error('no_access', false);
598
+	}
589 599
 
590 600
 	// Strip off the forum cache part or we won't find it...
591 601
 	$_REQUEST['filename'] = str_replace($modSettings['browser_cache'], '', $_REQUEST['filename']);
@@ -600,27 +610,30 @@  discard block
 block discarded – undo
600 610
 		)
601 611
 	);
602 612
 
603
-	if ($smcFunc['db_num_rows']($request) == 0)
604
-		fatal_lang_error('admin_file_not_found', true, array($_REQUEST['filename']), 404);
613
+	if ($smcFunc['db_num_rows']($request) == 0) {
614
+			fatal_lang_error('admin_file_not_found', true, array($_REQUEST['filename']), 404);
615
+	}
605 616
 
606 617
 	list ($file_data, $filetype) = $smcFunc['db_fetch_row']($request);
607 618
 	$smcFunc['db_free_result']($request);
608 619
 
609 620
 	// @todo Temp
610 621
 	// Figure out if sesc is still being used.
611
-	if (strpos($file_data, ';sesc=') !== false && $filetype == 'text/javascript')
612
-		$file_data = '
622
+	if (strpos($file_data, ';sesc=') !== false && $filetype == 'text/javascript') {
623
+			$file_data = '
613 624
 if (!(\'smfForum_sessionvar\' in window))
614 625
 	window.smfForum_sessionvar = \'sesc\';
615 626
 ' . strtr($file_data, array(';sesc=' => ';\' + window.smfForum_sessionvar + \'='));
627
+	}
616 628
 
617 629
 	$context['template_layers'] = array();
618 630
 	// Lets make sure we aren't going to output anything nasty.
619 631
 	@ob_end_clean();
620
-	if (!empty($modSettings['enableCompressedOutput']))
621
-		@ob_start('ob_gzhandler');
622
-	else
623
-		@ob_start();
632
+	if (!empty($modSettings['enableCompressedOutput'])) {
633
+			@ob_start('ob_gzhandler');
634
+	} else {
635
+			@ob_start();
636
+	}
624 637
 
625 638
 	// Make sure they know what type of file we are.
626 639
 	header('Content-Type: ' . $filetype);
@@ -660,11 +673,12 @@  discard block
 block discarded – undo
660 673
 		updateAdminPreferences();
661 674
 	}
662 675
 
663
-	if (trim($context['search_term']) == '')
664
-		$context['search_results'] = array();
665
-	else
666
-		call_helper($subActions[$context['search_type']]);
667
-}
676
+	if (trim($context['search_term']) == '') {
677
+			$context['search_results'] = array();
678
+	} else {
679
+			call_helper($subActions[$context['search_type']]);
680
+	}
681
+	}
668 682
 
669 683
 /**
670 684
  * A complicated but relatively quick internal search.
@@ -728,8 +742,9 @@  discard block
 block discarded – undo
728 742
 
729 743
 	loadLanguage(implode('+', $language_files));
730 744
 
731
-	foreach ($include_files as $file)
732
-		require_once($sourcedir . '/' . $file . '.php');
745
+	foreach ($include_files as $file) {
746
+			require_once($sourcedir . '/' . $file . '.php');
747
+	}
733 748
 
734 749
 	/* This is the huge array that defines everything... it's a huge array of items formatted as follows:
735 750
 		0 = Language index (Can be array of indexes) to search through for this setting.
@@ -753,11 +768,12 @@  discard block
 block discarded – undo
753 768
 		foreach ($section['areas'] as $menu_key => $menu_item)
754 769
 		{
755 770
 			$search_data['sections'][] = array($menu_item['label'], 'area=' . $menu_key);
756
-			if (!empty($menu_item['subsections']))
757
-				foreach ($menu_item['subsections'] as $key => $sublabel)
771
+			if (!empty($menu_item['subsections'])) {
772
+							foreach ($menu_item['subsections'] as $key => $sublabel)
758 773
 				{
759 774
 					if (isset($sublabel['label']))
760 775
 						$search_data['sections'][] = array($sublabel['label'], 'area=' . $menu_key . ';sa=' . $key);
776
+			}
761 777
 				}
762 778
 		}
763 779
 	}
@@ -767,9 +783,10 @@  discard block
 block discarded – undo
767 783
 		// Get a list of their variables.
768 784
 		$config_vars = $setting_area[0](true);
769 785
 
770
-		foreach ($config_vars as $var)
771
-			if (!empty($var[1]) && !in_array($var[0], array('permissions', 'switch', 'desc')))
786
+		foreach ($config_vars as $var) {
787
+					if (!empty($var[1]) && !in_array($var[0], array('permissions', 'switch', 'desc')))
772 788
 				$search_data['settings'][] = array($var[(isset($var[2]) && in_array($var[2], array('file', 'db'))) ? 0 : 1], $setting_area[1]);
789
+		}
773 790
 	}
774 791
 
775 792
 	$context['page_title'] = $txt['admin_search_results'];
@@ -782,8 +799,9 @@  discard block
 block discarded – undo
782 799
 		foreach ($data as $item)
783 800
 		{
784 801
 			$found = false;
785
-			if (!is_array($item[0]))
786
-				$item[0] = array($item[0]);
802
+			if (!is_array($item[0])) {
803
+							$item[0] = array($item[0]);
804
+			}
787 805
 			foreach ($item[0] as $term)
788 806
 			{
789 807
 				if (stripos($term, $search_term) !== false || (isset($txt[$term]) && stripos($txt[$term], $search_term) !== false) || (isset($txt['setting_' . $term]) && stripos($txt['setting_' . $term], $search_term) !== false))
@@ -841,8 +859,9 @@  discard block
 block discarded – undo
841 859
 	$postVars = explode(' ', $context['search_term']);
842 860
 
843 861
 	// Encode the search data.
844
-	foreach ($postVars as $k => $v)
845
-		$postVars[$k] = urlencode($v);
862
+	foreach ($postVars as $k => $v) {
863
+			$postVars[$k] = urlencode($v);
864
+	}
846 865
 
847 866
 	// This is what we will send.
848 867
 	$postVars = implode('+', $postVars);
@@ -854,8 +873,9 @@  discard block
 block discarded – undo
854 873
 	$search_results = fetch_web_data($context['doc_apiurl'] . '?action=query&list=search&srprop=timestamp|snippet&format=xml&srwhat=text&srsearch=' . $postVars);
855 874
 
856 875
 	// If we didn't get any xml back we are in trouble - perhaps the doc site is overloaded?
857
-	if (!$search_results || preg_match('~<' . '\?xml\sversion="\d+\.\d+"\?' . '>\s*(<api>.+?</api>)~is', $search_results, $matches) != true)
858
-		fatal_lang_error('cannot_connect_doc_site');
876
+	if (!$search_results || preg_match('~<' . '\?xml\sversion="\d+\.\d+"\?' . '>\s*(<api>.+?</api>)~is', $search_results, $matches) != true) {
877
+			fatal_lang_error('cannot_connect_doc_site');
878
+	}
859 879
 
860 880
 	$search_results = $matches[1];
861 881
 
@@ -867,8 +887,9 @@  discard block
 block discarded – undo
867 887
 	$results = new xmlArray($search_results, false);
868 888
 
869 889
 	// Move through the api layer.
870
-	if (!$results->exists('api'))
871
-		fatal_lang_error('cannot_connect_doc_site');
890
+	if (!$results->exists('api')) {
891
+			fatal_lang_error('cannot_connect_doc_site');
892
+	}
872 893
 
873 894
 	// Are there actually some results?
874 895
 	if ($results->exists('api/query/search/p'))
@@ -904,8 +925,9 @@  discard block
 block discarded – undo
904 925
 	);
905 926
 
906 927
 	// If it's not got a sa set it must have come here for first time, pretend error log should be reversed.
907
-	if (!isset($_REQUEST['sa']))
908
-		$_REQUEST['desc'] = true;
928
+	if (!isset($_REQUEST['sa'])) {
929
+			$_REQUEST['desc'] = true;
930
+	}
909 931
 
910 932
 	// Setup some tab stuff.
911 933
 	$context[$context['admin_menu_name']]['tab_data'] = array(
@@ -955,9 +977,10 @@  discard block
 block discarded – undo
955 977
 	unset($_SESSION['admin_time']);
956 978
 
957 979
 	// Clean any admin tokens as well.
958
-	foreach ($_SESSION['token'] as $key => $token)
959
-		if (strpos($key, '-admin') !== false)
980
+	foreach ($_SESSION['token'] as $key => $token) {
981
+			if (strpos($key, '-admin') !== false)
960 982
 			unset($_SESSION['token'][$key]);
983
+	}
961 984
 
962 985
 	redirectexit();
963 986
 }
Please login to merge, or discard this patch.
Sources/Subs-Compat.php 1 patch
Braces   +27 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
  * @version 2.1 Beta 3
17 17
  */
18 18
 
19
-if (!defined('SMF'))
19
+if (!defined('SMF')) {
20 20
 	die('No direct access...');
21
+}
21 22
 
22 23
 
23 24
 /**
@@ -28,14 +29,16 @@  discard block
 block discarded – undo
28 29
 function sha1_smf($str)
29 30
 {
30 31
 	// If we have mhash loaded in, use it instead!
31
-	if (function_exists('mhash') && defined('MHASH_SHA1'))
32
-		return bin2hex(mhash(MHASH_SHA1, $str));
32
+	if (function_exists('mhash') && defined('MHASH_SHA1')) {
33
+			return bin2hex(mhash(MHASH_SHA1, $str));
34
+	}
33 35
 
34 36
 	$nblk = (strlen($str) + 8 >> 6) + 1;
35 37
 	$blks = array_pad(array(), $nblk * 16, 0);
36 38
 
37
-	for ($i = 0; $i < strlen($str); $i++)
38
-		$blks[$i >> 2] |= ord($str{$i}) << (24 - ($i % 4) * 8);
39
+	for ($i = 0; $i < strlen($str); $i++) {
40
+			$blks[$i >> 2] |= ord($str{$i}) << (24 - ($i % 4) * 8);
41
+	}
39 42
 
40 43
 	$blks[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8);
41 44
 
@@ -70,10 +73,11 @@  discard block
 block discarded – undo
70 73
 
71 74
 		for ($j = 0; $j < 80; $j++)
72 75
 		{
73
-			if ($j < 16)
74
-				$w[$j] = isset($x[$i + $j]) ? $x[$i + $j] : 0;
75
-			else
76
-				$w[$j] = sha1_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1);
76
+			if ($j < 16) {
77
+							$w[$j] = isset($x[$i + $j]) ? $x[$i + $j] : 0;
78
+			} else {
79
+							$w[$j] = sha1_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1);
80
+			}
77 81
 
78 82
 			$t = sha1_rol($a, 5) + sha1_ft($j, $b, $c, $d) + $e + $w[$j] + sha1_kt($j);
79 83
 			$e = $d;
@@ -103,12 +107,15 @@  discard block
 block discarded – undo
103 107
  */
104 108
 function sha1_ft($t, $b, $c, $d)
105 109
 {
106
-	if ($t < 20)
107
-		return ($b & $c) | ((~$b) & $d);
108
-	if ($t < 40)
109
-		return $b ^ $c ^ $d;
110
-	if ($t < 60)
111
-		return ($b & $c) | ($b & $d) | ($c & $d);
110
+	if ($t < 20) {
111
+			return ($b & $c) | ((~$b) & $d);
112
+	}
113
+	if ($t < 40) {
114
+			return $b ^ $c ^ $d;
115
+	}
116
+	if ($t < 60) {
117
+			return ($b & $c) | ($b & $d) | ($c & $d);
118
+	}
112 119
 
113 120
 	return $b ^ $c ^ $d;
114 121
 }
@@ -132,10 +139,11 @@  discard block
 block discarded – undo
132 139
 function sha1_rol($num, $cnt)
133 140
 {
134 141
 	// Unfortunately, PHP uses unsigned 32-bit longs only.  So we have to kludge it a bit.
135
-	if ($num & 0x80000000)
136
-		$a = ($num >> 1 & 0x7fffffff) >> (31 - $cnt);
137
-	else
138
-		$a = $num >> (32 - $cnt);
142
+	if ($num & 0x80000000) {
143
+			$a = ($num >> 1 & 0x7fffffff) >> (31 - $cnt);
144
+	} else {
145
+			$a = $num >> (32 - $cnt);
146
+	}
139 147
 
140 148
 	return ($num << $cnt) | $a;
141 149
 }
Please login to merge, or discard this patch.
Sources/Calendar.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -240,8 +240,8 @@
 block discarded – undo
240 240
 		$time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
241 241
 
242 242
 	$js_time_string = str_replace(
243
-		array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r',      '%R',  '%S', '%T',    '%X'),
244
-		array('H',  'G',  'h',  'g',  'i',  'A',  'a',  'h:i:s A', 'H:i', 's',  'H:i:s', 'H:i:s'),
243
+		array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'),
244
+		array('H', 'G', 'h', 'g', 'i', 'A', 'a', 'h:i:s A', 'H:i', 's', 'H:i:s', 'H:i:s'),
245 245
 		$time_string
246 246
 	);
247 247
 
Please login to merge, or discard this patch.
Braces   +125 added lines, -99 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 3
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Show the calendar.
@@ -47,12 +48,14 @@  discard block
 block discarded – undo
47 48
 		'post' => 'CalendarPost',
48 49
 	);
49 50
 
50
-	if (isset($_GET['sa']) && isset($subActions[$_GET['sa']]))
51
-		return call_helper($subActions[$_GET['sa']]);
51
+	if (isset($_GET['sa']) && isset($subActions[$_GET['sa']])) {
52
+			return call_helper($subActions[$_GET['sa']]);
53
+	}
52 54
 
53 55
 	// You can't do anything if the calendar is off.
54
-	if (empty($modSettings['cal_enabled']))
55
-		fatal_lang_error('calendar_off', false);
56
+	if (empty($modSettings['cal_enabled'])) {
57
+			fatal_lang_error('calendar_off', false);
58
+	}
56 59
 
57 60
 	// This is gonna be needed...
58 61
 	loadTemplate('Calendar');
@@ -80,8 +83,9 @@  discard block
 block discarded – undo
80 83
 				$_REQUEST['month'] = (int) $_REQUEST['month'];
81 84
 
82 85
 				// We want month view.
83
-				if (empty($_GET['viewmonth']))
84
-					$_GET['viewmonth'] = true;
86
+				if (empty($_GET['viewmonth'])) {
87
+									$_GET['viewmonth'] = true;
88
+				}
85 89
 
86 90
 				// And we definitely don't want weekly view.
87 91
 				unset ($_GET['viewweek']);
@@ -98,22 +102,25 @@  discard block
 block discarded – undo
98 102
 	$context['page_title'] = $txt['calendar'];
99 103
 
100 104
 	// Ensure a default view is defined
101
-	if (empty($modSettings['calendar_default_view']))
102
-		$modSettings['calendar_default_view'] = 'view_list';
105
+	if (empty($modSettings['calendar_default_view'])) {
106
+			$modSettings['calendar_default_view'] = 'view_list';
107
+	}
103 108
 
104 109
 	// What view do we want?
105
-	if (isset($_GET['viewweek']))
106
-		$context['calendar_view'] = 'view_week';
107
-	elseif (isset($_GET['viewmonth']))
108
-		$context['calendar_view'] = 'view_month';
109
-	elseif (isset($_GET['viewlist']))
110
-		$context['calendar_view'] = 'view_list';
111
-	else
112
-		$context['calendar_view'] = $modSettings['calendar_default_view'];
110
+	if (isset($_GET['viewweek'])) {
111
+			$context['calendar_view'] = 'view_week';
112
+	} elseif (isset($_GET['viewmonth'])) {
113
+			$context['calendar_view'] = 'view_month';
114
+	} elseif (isset($_GET['viewlist'])) {
115
+			$context['calendar_view'] = 'view_list';
116
+	} else {
117
+			$context['calendar_view'] = $modSettings['calendar_default_view'];
118
+	}
113 119
 
114 120
 	// Don't let search engines index the non-default calendar pages
115
-	if ($context['calendar_view'] !== $modSettings['calendar_default_view'])
116
-		$context['robot_no_index'] = true;
121
+	if ($context['calendar_view'] !== $modSettings['calendar_default_view']) {
122
+			$context['robot_no_index'] = true;
123
+	}
117 124
 
118 125
 	// Get the current day of month...
119 126
 	require_once($sourcedir . '/Subs-Calendar.php');
@@ -174,16 +181,19 @@  discard block
 block discarded – undo
174 181
 	);
175 182
 
176 183
 	// Make sure the year and month are in valid ranges.
177
-	if ($curPage['month'] < 1 || $curPage['month'] > 12)
178
-		fatal_lang_error('invalid_month', false);
179
-	if ($curPage['year'] < $modSettings['cal_minyear'] || $curPage['year'] > $modSettings['cal_maxyear'])
180
-		fatal_lang_error('invalid_year', false);
184
+	if ($curPage['month'] < 1 || $curPage['month'] > 12) {
185
+			fatal_lang_error('invalid_month', false);
186
+	}
187
+	if ($curPage['year'] < $modSettings['cal_minyear'] || $curPage['year'] > $modSettings['cal_maxyear']) {
188
+			fatal_lang_error('invalid_year', false);
189
+	}
181 190
 	// If we have a day clean that too.
182 191
 	if ($context['calendar_view'] != 'view_month')
183 192
 	{
184 193
 		$isValid = checkdate($curPage['month'], $curPage['day'], $curPage['year']);
185
-		if (!$isValid)
186
-			fatal_lang_error('invalid_day', false);
194
+		if (!$isValid) {
195
+					fatal_lang_error('invalid_day', false);
196
+		}
187 197
 	}
188 198
 
189 199
 	// Load all the context information needed to show the calendar grid.
@@ -205,23 +215,26 @@  discard block
 block discarded – undo
205 215
 	);
206 216
 
207 217
 	// Load up the main view.
208
-	if ($context['calendar_view'] == 'view_list')
209
-		$context['calendar_grid_main'] = getCalendarList($curPage['start_date'], $curPage['end_date'], $calendarOptions);
210
-	elseif ($context['calendar_view'] == 'view_week')
211
-		$context['calendar_grid_main'] = getCalendarWeek($curPage['month'], $curPage['year'], $curPage['day'], $calendarOptions);
212
-	else
213
-		$context['calendar_grid_main'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions);
218
+	if ($context['calendar_view'] == 'view_list') {
219
+			$context['calendar_grid_main'] = getCalendarList($curPage['start_date'], $curPage['end_date'], $calendarOptions);
220
+	} elseif ($context['calendar_view'] == 'view_week') {
221
+			$context['calendar_grid_main'] = getCalendarWeek($curPage['month'], $curPage['year'], $curPage['day'], $calendarOptions);
222
+	} else {
223
+			$context['calendar_grid_main'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions);
224
+	}
214 225
 
215 226
 	// Load up the previous and next months.
216 227
 	$context['calendar_grid_current'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions);
217 228
 
218 229
 	// Only show previous month if it isn't pre-January of the min-year
219
-	if ($context['calendar_grid_current']['previous_calendar']['year'] > $modSettings['cal_minyear'] || $curPage['month'] != 1)
220
-		$context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions, true);
230
+	if ($context['calendar_grid_current']['previous_calendar']['year'] > $modSettings['cal_minyear'] || $curPage['month'] != 1) {
231
+			$context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions, true);
232
+	}
221 233
 
222 234
 	// Only show next month if it isn't post-December of the max-year
223
-	if ($context['calendar_grid_current']['next_calendar']['year'] < $modSettings['cal_maxyear'] || $curPage['month'] != 12)
224
-		$context['calendar_grid_next'] = getCalendarGrid($context['calendar_grid_current']['next_calendar']['month'], $context['calendar_grid_current']['next_calendar']['year'], $calendarOptions);
235
+	if ($context['calendar_grid_current']['next_calendar']['year'] < $modSettings['cal_maxyear'] || $curPage['month'] != 12) {
236
+			$context['calendar_grid_next'] = getCalendarGrid($context['calendar_grid_current']['next_calendar']['month'], $context['calendar_grid_current']['next_calendar']['year'], $calendarOptions);
237
+	}
225 238
 
226 239
 	// Basic template stuff.
227 240
 	$context['allow_calendar_event'] = allowedTo('calendar_post');
@@ -241,8 +254,9 @@  discard block
 block discarded – undo
241 254
 	$context['blocks_disabled'] = !empty($modSettings['cal_disable_prev_next']) ? 1 : 0;
242 255
 
243 256
 	// Set the page title to mention the month or week, too
244
-	if ($context['calendar_view'] != 'view_list')
245
-		$context['page_title'] .= ' - ' . ($context['calendar_view'] == 'view_week' ? $context['calendar_grid_main']['week_title'] : $txt['months'][$context['current_month']] . ' ' . $context['current_year']);
257
+	if ($context['calendar_view'] != 'view_list') {
258
+			$context['page_title'] .= ' - ' . ($context['calendar_view'] == 'view_week' ? $context['calendar_grid_main']['week_title'] : $txt['months'][$context['current_month']] . ' ' . $context['current_year']);
259
+	}
246 260
 
247 261
 	// Load up the linktree!
248 262
 	$context['linktree'][] = array(
@@ -255,17 +269,19 @@  discard block
 block discarded – undo
255 269
 		'name' => $txt['months'][$context['current_month']] . ' ' . $context['current_year']
256 270
 	);
257 271
 	// If applicable, add the current week to the linktree.
258
-	if ($context['calendar_view'] == 'view_week')
259
-		$context['linktree'][] = array(
272
+	if ($context['calendar_view'] == 'view_week') {
273
+			$context['linktree'][] = array(
260 274
 			'url' => $scripturl . '?action=calendar;viewweek;year=' . $context['current_year'] . ';month=' . $context['current_month'] . ';day=' . $context['current_day'],
261 275
 			'name' => $context['calendar_grid_main']['week_title'],
262 276
 		);
277
+	}
263 278
 
264 279
 	// Build the calendar button array.
265 280
 	$context['calendar_buttons'] = array();
266 281
 
267
-	if ($context['can_post'])
268
-		$context['calendar_buttons']['post_event'] = array('text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']);
282
+	if ($context['can_post']) {
283
+			$context['calendar_buttons']['post_event'] = array('text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']);
284
+	}
269 285
 
270 286
 	// Allow mods to add additional buttons here
271 287
 	call_integration_hook('integrate_calendar_buttons');
@@ -294,14 +310,16 @@  discard block
 block discarded – undo
294 310
 	require_once($sourcedir . '/Subs.php');
295 311
 
296 312
 	// Cast this for safety...
297
-	if (isset($_REQUEST['eventid']))
298
-		$_REQUEST['eventid'] = (int) $_REQUEST['eventid'];
313
+	if (isset($_REQUEST['eventid'])) {
314
+			$_REQUEST['eventid'] = (int) $_REQUEST['eventid'];
315
+	}
299 316
 
300 317
 	// We want a fairly compact version of the time, but as close as possible to the user's settings.
301
-	if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
302
-		$time_string = '%k:%M';
303
-	else
304
-		$time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
318
+	if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) {
319
+			$time_string = '%k:%M';
320
+	} else {
321
+			$time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
322
+	}
305 323
 
306 324
 	$js_time_string = str_replace(
307 325
 		array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r',      '%R',  '%S', '%T',    '%X'),
@@ -315,12 +333,14 @@  discard block
 block discarded – undo
315 333
 		checkSession();
316 334
 
317 335
 		// Validate the post...
318
-		if (!isset($_POST['link_to_board']))
319
-			validateEventPost();
336
+		if (!isset($_POST['link_to_board'])) {
337
+					validateEventPost();
338
+		}
320 339
 
321 340
 		// If you're not allowed to edit any events, you have to be the poster.
322
-		if ($_REQUEST['eventid'] > 0 && !allowedTo('calendar_edit_any'))
323
-			isAllowedTo('calendar_edit_' . (!empty($user_info['id']) && getEventPoster($_REQUEST['eventid']) == $user_info['id'] ? 'own' : 'any'));
341
+		if ($_REQUEST['eventid'] > 0 && !allowedTo('calendar_edit_any')) {
342
+					isAllowedTo('calendar_edit_' . (!empty($user_info['id']) && getEventPoster($_REQUEST['eventid']) == $user_info['id'] ? 'own' : 'any'));
343
+		}
324 344
 
325 345
 		// New - and directing?
326 346
 		if (isset($_POST['link_to_board']) || empty($modSettings['cal_allow_unlinked']))
@@ -343,8 +363,9 @@  discard block
 block discarded – undo
343 363
 		}
344 364
 
345 365
 		// Deleting...
346
-		elseif (isset($_REQUEST['deleteevent']))
347
-			removeEvent($_REQUEST['eventid']);
366
+		elseif (isset($_REQUEST['deleteevent'])) {
367
+					removeEvent($_REQUEST['eventid']);
368
+		}
348 369
 
349 370
 		// ... or just update it?
350 371
 		else
@@ -366,14 +387,12 @@  discard block
 block discarded – undo
366 387
 			$d = date_parse($_POST['start_date']);
367 388
 			$year = $d['year'];
368 389
 			$month = $d['month'];
369
-		}
370
-		elseif (isset($_POST['start_datetime']))
390
+		} elseif (isset($_POST['start_datetime']))
371 391
 		{
372 392
 			$d = date_parse($_POST['start_datetime']);
373 393
 			$year = $d['year'];
374 394
 			$month = $d['month'];
375
-		}
376
-		else
395
+		} else
377 396
 		{
378 397
 			$today = getdate();
379 398
 			$year = isset($_POST['year']) ? $_POST['year'] : $today['year'];
@@ -406,13 +425,13 @@  discard block
 block discarded – undo
406 425
 		$context['event'] = array_merge($context['event'], $eventDatetimes);
407 426
 
408 427
 		$context['event']['last_day'] = (int) strftime('%d', mktime(0, 0, 0, $context['event']['month'] == 12 ? 1 : $context['event']['month'] + 1, 0, $context['event']['month'] == 12 ? $context['event']['year'] + 1 : $context['event']['year']));
409
-	}
410
-	else
428
+	} else
411 429
 	{
412 430
 		$context['event'] = getEventProperties($_REQUEST['eventid']);
413 431
 
414
-		if ($context['event'] === false)
415
-			fatal_lang_error('no_access', false);
432
+		if ($context['event'] === false) {
433
+					fatal_lang_error('no_access', false);
434
+		}
416 435
 
417 436
 		// If it has a board, then they should be editing it within the topic.
418 437
 		if (!empty($context['event']['topic']['id']) && !empty($context['event']['topic']['first_msg']))
@@ -423,10 +442,11 @@  discard block
 block discarded – undo
423 442
 		}
424 443
 
425 444
 		// Make sure the user is allowed to edit this event.
426
-		if ($context['event']['member'] != $user_info['id'])
427
-			isAllowedTo('calendar_edit_any');
428
-		elseif (!allowedTo('calendar_edit_any'))
429
-			isAllowedTo('calendar_edit_own');
445
+		if ($context['event']['member'] != $user_info['id']) {
446
+					isAllowedTo('calendar_edit_any');
447
+		} elseif (!allowedTo('calendar_edit_any')) {
448
+					isAllowedTo('calendar_edit_own');
449
+		}
430 450
 	}
431 451
 
432 452
 	// An all day event? Set up some nice defaults in case the user wants to change that
@@ -460,8 +480,7 @@  discard block
 block discarded – undo
460 480
 	{
461 481
 		// You can post new events but can't link them to anything...
462 482
 		$context['event']['categories'] = array();
463
-	}
464
-	else
483
+	} else
465 484
 	{
466 485
 		// Load the list of boards and categories in the context.
467 486
 		require_once($sourcedir . '/Subs-MessageIndex.php');
@@ -548,12 +567,14 @@  discard block
 block discarded – undo
548 567
 	global $smcFunc, $sourcedir, $forum_version, $modSettings, $webmaster_email, $mbname;
549 568
 
550 569
 	// You can't export if the calendar export feature is off.
551
-	if (empty($modSettings['cal_export']))
552
-		fatal_lang_error('calendar_export_off', false);
570
+	if (empty($modSettings['cal_export'])) {
571
+			fatal_lang_error('calendar_export_off', false);
572
+	}
553 573
 
554 574
 	// Goes without saying that this is required.
555
-	if (!isset($_REQUEST['eventid']))
556
-		fatal_lang_error('no_access', false);
575
+	if (!isset($_REQUEST['eventid'])) {
576
+			fatal_lang_error('no_access', false);
577
+	}
557 578
 
558 579
 	// This is kinda wanted.
559 580
 	require_once($sourcedir . '/Subs-Calendar.php');
@@ -561,15 +582,17 @@  discard block
 block discarded – undo
561 582
 	// Load up the event in question and check it exists.
562 583
 	$event = getEventProperties($_REQUEST['eventid']);
563 584
 
564
-	if ($event === false)
565
-		fatal_lang_error('no_access', false);
585
+	if ($event === false) {
586
+			fatal_lang_error('no_access', false);
587
+	}
566 588
 
567 589
 	// Check the title isn't too long - iCal requires some formatting if so.
568 590
 	$title = str_split($event['title'], 30);
569 591
 	foreach ($title as $id => $line)
570 592
 	{
571
-		if ($id != 0)
572
-			$title[$id] = ' ' . $title[$id];
593
+		if ($id != 0) {
594
+					$title[$id] = ' ' . $title[$id];
595
+		}
573 596
 		$title[$id] .= "\n";
574 597
 	}
575 598
 
@@ -582,8 +605,7 @@  discard block
 block discarded – undo
582 605
 	{
583 606
 		$datestart = date_format($start_date, 'Ymd\THis');
584 607
 		$dateend = date_format($end_date, 'Ymd\THis');
585
-	}
586
-	else
608
+	} else
587 609
 	{
588 610
 		$datestart = date_format($start_date, 'Ymd');
589 611
 
@@ -604,15 +626,18 @@  discard block
 block discarded – undo
604 626
 	$filecontents .= 'DTSTART' . (!empty($event['start_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $datestart . "\n";
605 627
 
606 628
 	// event has a duration
607
-	if ($event['start_iso_gmdate'] != $event['end_iso_gmdate'])
608
-		$filecontents .= 'DTEND' . (!empty($event['end_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $dateend . "\n";
629
+	if ($event['start_iso_gmdate'] != $event['end_iso_gmdate']) {
630
+			$filecontents .= 'DTEND' . (!empty($event['end_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $dateend . "\n";
631
+	}
609 632
 
610 633
 	// event has changed? advance the sequence for this UID
611
-	if ($event['sequence'] > 0)
612
-		$filecontents .= 'SEQUENCE:' . $event['sequence'] . "\n";
634
+	if ($event['sequence'] > 0) {
635
+			$filecontents .= 'SEQUENCE:' . $event['sequence'] . "\n";
636
+	}
613 637
 
614
-	if (!empty($event['location']))
615
-		$filecontents .= 'LOCATION:' . str_replace(',', '\,', $event['location']) . "\n";
638
+	if (!empty($event['location'])) {
639
+			$filecontents .= 'LOCATION:' . str_replace(',', '\,', $event['location']) . "\n";
640
+	}
616 641
 
617 642
 	$filecontents .= 'SUMMARY:' . implode('', $title);
618 643
 	$filecontents .= 'UID:' . $event['eventid'] . '@' . str_replace(' ', '-', $mbname) . "\n";
@@ -621,23 +646,26 @@  discard block
 block discarded – undo
621 646
 
622 647
 	// Send some standard headers.
623 648
 	ob_end_clean();
624
-	if (!empty($modSettings['enableCompressedOutput']))
625
-		@ob_start('ob_gzhandler');
626
-	else
627
-		ob_start();
649
+	if (!empty($modSettings['enableCompressedOutput'])) {
650
+			@ob_start('ob_gzhandler');
651
+	} else {
652
+			ob_start();
653
+	}
628 654
 
629 655
 	// Send the file headers
630 656
 	header('Pragma: ');
631 657
 	header('Cache-Control: no-cache');
632
-	if (!isBrowser('gecko'))
633
-		header('Content-Transfer-Encoding: binary');
658
+	if (!isBrowser('gecko')) {
659
+			header('Content-Transfer-Encoding: binary');
660
+	}
634 661
 	header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
635 662
 	header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . 'GMT');
636 663
 	header('Accept-Ranges: bytes');
637 664
 	header('Connection: close');
638 665
 	header('Content-Disposition: attachment; filename="' . $event['title'] . '.ics"');
639
-	if (empty($modSettings['enableCompressedOutput']))
640
-		header('Content-Length: ' . $smcFunc['strlen']($filecontents));
666
+	if (empty($modSettings['enableCompressedOutput'])) {
667
+			header('Content-Length: ' . $smcFunc['strlen']($filecontents));
668
+	}
641 669
 
642 670
 	// This is a calendar item!
643 671
 	header('Content-Type: text/calendar');
@@ -676,20 +704,17 @@  discard block
 block discarded – undo
676 704
 		$context['sub_template'] = 'bcd';
677 705
 		$context['linktree'][] = array('url' => $scripturl . '?action=clock;bcd', 'name' => 'BCD');
678 706
 		$context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjI6ImgxIjthOjI6e2k6MDtpOjI7aToxO2k6MTt9czoyOiJoMiI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjI6Im0xIjthOjM6e2k6MDtpOjQ7aToxO2k6MjtpOjI7aToxO31zOjI6Im0yIjthOjQ6e2k6MDtpOjg7aToxO2k6NDtpOjI7aToyO2k6MztpOjE7fXM6MjoiczEiO2E6Mzp7aTowO2k6NDtpOjE7aToyO2k6MjtpOjE7fXM6MjoiczIiO2E6NDp7aTowO2k6ODtpOjE7aTo0O2k6MjtpOjI7aTozO2k6MTt9fQ=='));
679
-	}
680
-	elseif (!$omfg && !isset($_REQUEST['time']))
707
+	} elseif (!$omfg && !isset($_REQUEST['time']))
681 708
 	{
682 709
 		$context['sub_template'] = 'hms';
683 710
 		$context['linktree'][] = array('url' => $scripturl . '?action=clock', 'name' => 'Binary');
684 711
 		$context['clockicons'] = safe_unserialize(base64_decode('YTozOntzOjE6ImgiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czoxOiJtIjthOjY6e2k6MDtpOjMyO2k6MTtpOjE2O2k6MjtpOjg7aTozO2k6NDtpOjQ7aToyO2k6NTtpOjE7fXM6MToicyI7YTo2OntpOjA7aTozMjtpOjE7aToxNjtpOjI7aTo4O2k6MztpOjQ7aTo0O2k6MjtpOjU7aToxO319'));
685
-	}
686
-	elseif ($omfg)
712
+	} elseif ($omfg)
687 713
 	{
688 714
 		$context['sub_template'] = 'omfg';
689 715
 		$context['linktree'][] = array('url' => $scripturl . '?action=clock;omfg', 'name' => 'OMFG');
690 716
 		$context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjQ6InllYXIiO2E6Nzp7aTowO2k6NjQ7aToxO2k6MzI7aToyO2k6MTY7aTozO2k6ODtpOjQ7aTo0O2k6NTtpOjI7aTo2O2k6MTt9czo1OiJtb250aCI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjM6ImRheSI7YTo1OntpOjA7aToxNjtpOjE7aTo4O2k6MjtpOjQ7aTozO2k6MjtpOjQ7aToxO31zOjQ6ImhvdXIiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czozOiJtaW4iO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9czozOiJzZWMiO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9fQ=='));
691
-	}
692
-	elseif (isset($_REQUEST['time']))
717
+	} elseif (isset($_REQUEST['time']))
693 718
 	{
694 719
 		$context['sub_template'] = 'thetime';
695 720
 		$time = getdate($_REQUEST['time'] == 'now' ? time() : (int) $_REQUEST['time']);
@@ -749,12 +774,13 @@  discard block
 block discarded – undo
749 774
 			),
750 775
 		);
751 776
 
752
-		foreach ($context['clockicons'] as $t => $vs)
753
-			foreach ($vs as $v => $dumb)
777
+		foreach ($context['clockicons'] as $t => $vs) {
778
+					foreach ($vs as $v => $dumb)
754 779
 			{
755 780
 				if ($$t >= $v)
756 781
 				{
757 782
 					$$t -= $v;
783
+		}
758 784
 					$context['clockicons'][$t][$v] = true;
759 785
 				}
760 786
 			}
Please login to merge, or discard this patch.
other/install.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1622,8 +1622,7 @@
 block discarded – undo
1622 1622
 	updateStats('topic');
1623 1623
 
1624 1624
 	// This function is needed to do the updateStats('subject') call.
1625
-	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1626
-		function($string){
1625
+	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1627 1626
 			global $sourcedir;
1628 1627
 			if (function_exists('mb_strtolower'))
1629 1628
 				return mb_strtolower($string, 'UTF-8');
Please login to merge, or discard this patch.
Braces   +441 added lines, -328 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;',
@@ -74,12 +76,14 @@  discard block
 block discarded – undo
74 76
 			$value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value);
75 77
 
76 78
 			// Is it reserved?
77
-			if ($value == 'pg_')
78
-				return $txt['error_db_prefix_reserved'];
79
+			if ($value == 'pg_') {
80
+							return $txt['error_db_prefix_reserved'];
81
+			}
79 82
 
80 83
 			// Is the prefix numeric?
81
-			if (preg_match('~^\d~', $value))
82
-				return $txt['error_db_prefix_numeric'];
84
+			if (preg_match('~^\d~', $value)) {
85
+							return $txt['error_db_prefix_numeric'];
86
+			}
83 87
 
84 88
 			return true;
85 89
 		},
@@ -126,10 +130,11 @@  discard block
 block discarded – undo
126 130
 		$incontext['skip'] = false;
127 131
 
128 132
 		// Call the step and if it returns false that means pause!
129
-		if (function_exists($step[2]) && $step[2]() === false)
130
-			break;
131
-		elseif (function_exists($step[2]))
132
-			$incontext['current_step']++;
133
+		if (function_exists($step[2]) && $step[2]() === false) {
134
+					break;
135
+		} elseif (function_exists($step[2])) {
136
+					$incontext['current_step']++;
137
+		}
133 138
 
134 139
 		// No warnings pass on.
135 140
 		$incontext['warning'] = '';
@@ -145,12 +150,14 @@  discard block
 block discarded – undo
145 150
 	global $databases, $incontext;
146 151
 
147 152
 	// Just so people using older versions of PHP aren't left in the cold.
148
-	if (!isset($_SERVER['PHP_SELF']))
149
-		$_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php';
153
+	if (!isset($_SERVER['PHP_SELF'])) {
154
+			$_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php';
155
+	}
150 156
 
151 157
 	// Turn off magic quotes runtime and enable error reporting.
152
-	if (function_exists('set_magic_quotes_runtime'))
153
-		@set_magic_quotes_runtime(0);
158
+	if (function_exists('set_magic_quotes_runtime')) {
159
+			@set_magic_quotes_runtime(0);
160
+	}
154 161
 	error_reporting(E_ALL);
155 162
 
156 163
 	// Fun.  Low PHP version...
@@ -164,21 +171,23 @@  discard block
 block discarded – undo
164 171
 	{
165 172
 		ob_start();
166 173
 
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
174
+		if (ini_get('session.save_handler') == 'user') {
175
+					@ini_set('session.save_handler', 'files');
176
+		}
177
+		if (function_exists('session_start')) {
178
+					@session_start();
179
+		}
180
+	} else
173 181
 	{
174 182
 		ob_start('ob_gzhandler');
175 183
 
176
-		if (ini_get('session.save_handler') == 'user')
177
-			@ini_set('session.save_handler', 'files');
184
+		if (ini_get('session.save_handler') == 'user') {
185
+					@ini_set('session.save_handler', 'files');
186
+		}
178 187
 		session_start();
179 188
 
180
-		if (!headers_sent())
181
-			echo '<!DOCTYPE html>
189
+		if (!headers_sent()) {
190
+					echo '<!DOCTYPE html>
182 191
 <html>
183 192
 	<head>
184 193
 		<title>', htmlspecialchars($_GET['pass_string']), '</title>
@@ -187,6 +196,7 @@  discard block
 block discarded – undo
187 196
 		<strong>', htmlspecialchars($_GET['pass_string']), '</strong>
188 197
 	</body>
189 198
 </html>';
199
+		}
190 200
 		exit;
191 201
 	}
192 202
 
@@ -195,16 +205,18 @@  discard block
 block discarded – undo
195 205
 	{
196 206
 		$incontext['remote_files_available'] = false;
197 207
 		$test = @fsockopen('www.simplemachines.org', 80, $errno, $errstr, 1);
198
-		if ($test)
199
-			$incontext['remote_files_available'] = true;
208
+		if ($test) {
209
+					$incontext['remote_files_available'] = true;
210
+		}
200 211
 		@fclose($test);
201 212
 	}
202 213
 
203 214
 	// Add slashes, as long as they aren't already being added.
204
-	if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0)
205
-		foreach ($_POST as $k => $v)
215
+	if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) {
216
+			foreach ($_POST as $k => $v)
206 217
 			if (strpos($k, 'password') === false && strpos($k, 'db_passwd') === false)
207 218
 				$_POST[$k] = addslashes($v);
219
+	}
208 220
 
209 221
 	// This is really quite simple; if ?delete is on the URL, delete the installer...
210 222
 	if (isset($_GET['delete']))
@@ -225,8 +237,7 @@  discard block
 block discarded – undo
225 237
 			$ftp->close();
226 238
 
227 239
 			unset($_SESSION['installer_temp_ftp']);
228
-		}
229
-		else
240
+		} else
230 241
 		{
231 242
 			@unlink(__FILE__);
232 243
 
@@ -247,10 +258,11 @@  discard block
 block discarded – undo
247 258
 	{
248 259
 		// Get PHP's default timezone, if set
249 260
 		$ini_tz = ini_get('date.timezone');
250
-		if (!empty($ini_tz))
251
-			$timezone_id = $ini_tz;
252
-		else
253
-			$timezone_id = '';
261
+		if (!empty($ini_tz)) {
262
+					$timezone_id = $ini_tz;
263
+		} else {
264
+					$timezone_id = '';
265
+		}
254 266
 
255 267
 		// If date.timezone is unset, invalid, or just plain weird, make a best guess
256 268
 		if (!in_array($timezone_id, timezone_identifiers_list()))
@@ -280,8 +292,9 @@  discard block
 block discarded – undo
280 292
 		$dir = dir(dirname(__FILE__) . '/Themes/default/languages');
281 293
 		while ($entry = $dir->read())
282 294
 		{
283
-			if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php')
284
-				$incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12));
295
+			if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') {
296
+							$incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12));
297
+			}
285 298
 		}
286 299
 		$dir->close();
287 300
 	}
@@ -316,10 +329,11 @@  discard block
 block discarded – undo
316 329
 	}
317 330
 
318 331
 	// Override the language file?
319
-	if (isset($_GET['lang_file']))
320
-		$_SESSION['installer_temp_lang'] = $_GET['lang_file'];
321
-	elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file']))
322
-		$_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file'];
332
+	if (isset($_GET['lang_file'])) {
333
+			$_SESSION['installer_temp_lang'] = $_GET['lang_file'];
334
+	} elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) {
335
+			$_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file'];
336
+	}
323 337
 
324 338
 	// Make sure it exists, if it doesn't reset it.
325 339
 	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']))
@@ -328,8 +342,9 @@  discard block
 block discarded – undo
328 342
 		list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
329 343
 
330 344
 		// If we have english and some other language, use the other language.  We Americans hate english :P.
331
-		if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1)
332
-			list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
345
+		if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) {
346
+					list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']);
347
+		}
333 348
 	}
334 349
 
335 350
 	// And now include the actual language file itself.
@@ -342,15 +357,18 @@  discard block
 block discarded – undo
342 357
 	global $db_prefix, $db_connection, $sourcedir;
343 358
 	global $smcFunc, $modSettings, $db_type, $db_name, $db_user, $db_persist;
344 359
 
345
-	if (empty($sourcedir))
346
-		$sourcedir = dirname(__FILE__) . '/Sources';
360
+	if (empty($sourcedir)) {
361
+			$sourcedir = dirname(__FILE__) . '/Sources';
362
+	}
347 363
 
348 364
 	// Need this to check whether we need the database password.
349 365
 	require(dirname(__FILE__) . '/Settings.php');
350
-	if (!defined('SMF'))
351
-		define('SMF', 1);
352
-	if (empty($smcFunc))
353
-		$smcFunc = array();
366
+	if (!defined('SMF')) {
367
+			define('SMF', 1);
368
+	}
369
+	if (empty($smcFunc)) {
370
+			$smcFunc = array();
371
+	}
354 372
 
355 373
 	$modSettings['disableQueryCheck'] = true;
356 374
 
@@ -358,8 +376,9 @@  discard block
 block discarded – undo
358 376
 	if (!$db_connection)
359 377
 	{
360 378
 		require_once($sourcedir . '/Subs-Db-' . $db_type . '.php');
361
-		if (version_compare(PHP_VERSION, '5', '<'))
362
-			require_once($sourcedir . '/Subs-Compat.php');
379
+		if (version_compare(PHP_VERSION, '5', '<')) {
380
+					require_once($sourcedir . '/Subs-Compat.php');
381
+		}
363 382
 
364 383
 		$db_options = array('persist' => $db_persist);
365 384
 		$port = '';
@@ -370,19 +389,20 @@  discard block
 block discarded – undo
370 389
 			if ($db_type == 'mysql')
371 390
 			{
372 391
 				$port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port'];
373
-			}
374
-			elseif ($db_type == 'postgresql')
392
+			} elseif ($db_type == 'postgresql')
375 393
 			{
376 394
 				// PostgreSQL doesn't have a default port setting in php.ini, so just check against the default
377 395
 				$port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port'];
378 396
 			}
379 397
 		}
380 398
 
381
-		if (!empty($port))
382
-			$db_options['port'] = $port;
399
+		if (!empty($port)) {
400
+					$db_options['port'] = $port;
401
+		}
383 402
 
384
-		if (!$db_connection)
385
-			$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options);
403
+		if (!$db_connection) {
404
+					$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options);
405
+		}
386 406
 	}
387 407
 }
388 408
 
@@ -410,8 +430,9 @@  discard block
 block discarded – undo
410 430
 		// @todo REMOVE THIS!!
411 431
 		else
412 432
 		{
413
-			if (function_exists('doStep' . $_GET['step']))
414
-				call_user_func('doStep' . $_GET['step']);
433
+			if (function_exists('doStep' . $_GET['step'])) {
434
+							call_user_func('doStep' . $_GET['step']);
435
+			}
415 436
 		}
416 437
 		// Show the footer.
417 438
 		template_install_below();
@@ -429,8 +450,9 @@  discard block
 block discarded – undo
429 450
 	$incontext['sub_template'] = 'welcome_message';
430 451
 
431 452
 	// Done the submission?
432
-	if (isset($_POST['contbutt']))
433
-		return true;
453
+	if (isset($_POST['contbutt'])) {
454
+			return true;
455
+	}
434 456
 
435 457
 	// See if we think they have already installed it?
436 458
 	if (is_readable(dirname(__FILE__) . '/Settings.php'))
@@ -438,14 +460,17 @@  discard block
 block discarded – undo
438 460
 		$probably_installed = 0;
439 461
 		foreach (file(dirname(__FILE__) . '/Settings.php') as $line)
440 462
 		{
441
-			if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line))
442
-				$probably_installed++;
443
-			if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line))
444
-				$probably_installed++;
463
+			if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) {
464
+							$probably_installed++;
465
+			}
466
+			if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) {
467
+							$probably_installed++;
468
+			}
445 469
 		}
446 470
 
447
-		if ($probably_installed == 2)
448
-			$incontext['warning'] = $txt['error_already_installed'];
471
+		if ($probably_installed == 2) {
472
+					$incontext['warning'] = $txt['error_already_installed'];
473
+		}
449 474
 	}
450 475
 
451 476
 	// Is some database support even compiled in?
@@ -460,36 +485,43 @@  discard block
 block discarded – undo
460 485
 				$databases[$key]['supported'] = false;
461 486
 				$notFoundSQLFile = true;
462 487
 				$txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql');
488
+			} else {
489
+							$incontext['supported_databases'][] = $db;
463 490
 			}
464
-			else
465
-				$incontext['supported_databases'][] = $db;
466 491
 		}
467 492
 	}
468 493
 
469 494
 	// Check the PHP version.
470
-	if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>')))
471
-		$error = 'error_php_too_low';
495
+	if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) {
496
+			$error = 'error_php_too_low';
497
+	}
472 498
 	// Make sure we have a supported database
473
-	elseif (empty($incontext['supported_databases']))
474
-		$error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing';
499
+	elseif (empty($incontext['supported_databases'])) {
500
+			$error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing';
501
+	}
475 502
 	// How about session support?  Some crazy sysadmin remove it?
476
-	elseif (!function_exists('session_start'))
477
-		$error = 'error_session_missing';
503
+	elseif (!function_exists('session_start')) {
504
+			$error = 'error_session_missing';
505
+	}
478 506
 	// Make sure they uploaded all the files.
479
-	elseif (!file_exists(dirname(__FILE__) . '/index.php'))
480
-		$error = 'error_missing_files';
507
+	elseif (!file_exists(dirname(__FILE__) . '/index.php')) {
508
+			$error = 'error_missing_files';
509
+	}
481 510
 	// Very simple check on the session.save_path for Windows.
482 511
 	// @todo Move this down later if they don't use database-driven sessions?
483
-	elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\')
484
-		$error = 'error_session_save_path';
512
+	elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') {
513
+			$error = 'error_session_save_path';
514
+	}
485 515
 
486 516
 	// Since each of the three messages would look the same, anyway...
487
-	if (isset($error))
488
-		$incontext['error'] = $txt[$error];
517
+	if (isset($error)) {
518
+			$incontext['error'] = $txt[$error];
519
+	}
489 520
 
490 521
 	// Mod_security blocks everything that smells funny. Let SMF handle security.
491
-	if (!fixModSecurity() && !isset($_GET['overmodsecurity']))
492
-		$incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again'];
522
+	if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) {
523
+			$incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again'];
524
+	}
493 525
 
494 526
 	return false;
495 527
 }
@@ -515,12 +547,14 @@  discard block
 block discarded – undo
515 547
 		'db_last_error.php',
516 548
 	);
517 549
 
518
-	foreach ($incontext['detected_languages'] as $lang => $temp)
519
-		$extra_files[] = 'Themes/default/languages/' . $lang;
550
+	foreach ($incontext['detected_languages'] as $lang => $temp) {
551
+			$extra_files[] = 'Themes/default/languages/' . $lang;
552
+	}
520 553
 
521 554
 	// With mod_security installed, we could attempt to fix it with .htaccess.
522
-	if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules()))
523
-		$writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.';
555
+	if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) {
556
+			$writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.';
557
+	}
524 558
 
525 559
 	$failed_files = array();
526 560
 
@@ -536,12 +570,14 @@  discard block
 block discarded – undo
536 570
 				@chmod(dirname(__FILE__) . '/' . $file, 0755);
537 571
 
538 572
 				// Well, 755 hopefully worked... if not, try 777.
539
-				if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777))
540
-					$failed_files[] = $file;
573
+				if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) {
574
+									$failed_files[] = $file;
575
+				}
541 576
 			}
542 577
 		}
543
-		foreach ($extra_files as $file)
544
-			@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
578
+		foreach ($extra_files as $file) {
579
+					@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
580
+		}
545 581
 	}
546 582
 	// Windows is trickier.  Let's try opening for r+...
547 583
 	else
@@ -551,30 +587,35 @@  discard block
 block discarded – undo
551 587
 		foreach ($writable_files as $file)
552 588
 		{
553 589
 			// Folders can't be opened for write... but the index.php in them can ;)
554
-			if (is_dir(dirname(__FILE__) . '/' . $file))
555
-				$file .= '/index.php';
590
+			if (is_dir(dirname(__FILE__) . '/' . $file)) {
591
+							$file .= '/index.php';
592
+			}
556 593
 
557 594
 			// Funny enough, chmod actually does do something on windows - it removes the read only attribute.
558 595
 			@chmod(dirname(__FILE__) . '/' . $file, 0777);
559 596
 			$fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+');
560 597
 
561 598
 			// Hmm, okay, try just for write in that case...
562
-			if (!is_resource($fp))
563
-				$fp = @fopen(dirname(__FILE__) . '/' . $file, 'w');
599
+			if (!is_resource($fp)) {
600
+							$fp = @fopen(dirname(__FILE__) . '/' . $file, 'w');
601
+			}
564 602
 
565
-			if (!is_resource($fp))
566
-				$failed_files[] = $file;
603
+			if (!is_resource($fp)) {
604
+							$failed_files[] = $file;
605
+			}
567 606
 
568 607
 			@fclose($fp);
569 608
 		}
570
-		foreach ($extra_files as $file)
571
-			@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
609
+		foreach ($extra_files as $file) {
610
+					@chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777);
611
+		}
572 612
 	}
573 613
 
574 614
 	$failure = count($failed_files) >= 1;
575 615
 
576
-	if (!isset($_SERVER))
577
-		return !$failure;
616
+	if (!isset($_SERVER)) {
617
+			return !$failure;
618
+	}
578 619
 
579 620
 	// Put the list into context.
580 621
 	$incontext['failed_files'] = $failed_files;
@@ -622,19 +663,23 @@  discard block
 block discarded – undo
622 663
 
623 664
 		if (!isset($ftp) || $ftp->error !== false)
624 665
 		{
625
-			if (!isset($ftp))
626
-				$ftp = new ftp_connection(null);
666
+			if (!isset($ftp)) {
667
+							$ftp = new ftp_connection(null);
668
+			}
627 669
 			// Save the error so we can mess with listing...
628
-			elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message))
629
-				$incontext['ftp_errors'][] = $ftp->last_message;
670
+			elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) {
671
+							$incontext['ftp_errors'][] = $ftp->last_message;
672
+			}
630 673
 
631 674
 			list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__));
632 675
 
633
-			if (empty($_POST['ftp_path']) && $found_path)
634
-				$_POST['ftp_path'] = $detect_path;
676
+			if (empty($_POST['ftp_path']) && $found_path) {
677
+							$_POST['ftp_path'] = $detect_path;
678
+			}
635 679
 
636
-			if (!isset($_POST['ftp_username']))
637
-				$_POST['ftp_username'] = $username;
680
+			if (!isset($_POST['ftp_username'])) {
681
+							$_POST['ftp_username'] = $username;
682
+			}
638 683
 
639 684
 			// Set the username etc, into context.
640 685
 			$incontext['ftp'] = array(
@@ -646,8 +691,7 @@  discard block
 block discarded – undo
646 691
 			);
647 692
 
648 693
 			return false;
649
-		}
650
-		else
694
+		} else
651 695
 		{
652 696
 			$_SESSION['installer_temp_ftp'] = array(
653 697
 				'server' => $_POST['ftp_server'],
@@ -661,10 +705,12 @@  discard block
 block discarded – undo
661 705
 
662 706
 			foreach ($failed_files as $file)
663 707
 			{
664
-				if (!is_writable(dirname(__FILE__) . '/' . $file))
665
-					$ftp->chmod($file, 0755);
666
-				if (!is_writable(dirname(__FILE__) . '/' . $file))
667
-					$ftp->chmod($file, 0777);
708
+				if (!is_writable(dirname(__FILE__) . '/' . $file)) {
709
+									$ftp->chmod($file, 0755);
710
+				}
711
+				if (!is_writable(dirname(__FILE__) . '/' . $file)) {
712
+									$ftp->chmod($file, 0777);
713
+				}
668 714
 				if (!is_writable(dirname(__FILE__) . '/' . $file))
669 715
 				{
670 716
 					$failed_files_updated[] = $file;
@@ -719,15 +765,17 @@  discard block
 block discarded – undo
719 765
 
720 766
 			if (!$foundOne)
721 767
 			{
722
-				if (isset($db['default_host']))
723
-					$incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost';
768
+				if (isset($db['default_host'])) {
769
+									$incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost';
770
+				}
724 771
 				if (isset($db['default_user']))
725 772
 				{
726 773
 					$incontext['db']['user'] = ini_get($db['default_user']);
727 774
 					$incontext['db']['name'] = ini_get($db['default_user']);
728 775
 				}
729
-				if (isset($db['default_password']))
730
-					$incontext['db']['pass'] = ini_get($db['default_password']);
776
+				if (isset($db['default_password'])) {
777
+									$incontext['db']['pass'] = ini_get($db['default_password']);
778
+				}
731 779
 
732 780
 				// For simplicity and less confusion, leave the port blank by default
733 781
 				$incontext['db']['port'] = '';
@@ -746,10 +794,10 @@  discard block
 block discarded – undo
746 794
 		$incontext['db']['server'] = $_POST['db_server'];
747 795
 		$incontext['db']['prefix'] = $_POST['db_prefix'];
748 796
 
749
-		if (!empty($_POST['db_port']))
750
-			$incontext['db']['port'] = $_POST['db_port'];
751
-	}
752
-	else
797
+		if (!empty($_POST['db_port'])) {
798
+					$incontext['db']['port'] = $_POST['db_port'];
799
+		}
800
+	} else
753 801
 	{
754 802
 		$incontext['db']['prefix'] = 'smf_';
755 803
 	}
@@ -785,10 +833,11 @@  discard block
 block discarded – undo
785 833
 		if (!empty($_POST['db_port']))
786 834
 		{
787 835
 			// For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though.
788
-			if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port'))
789
-				$vars['db_port'] = (int) $_POST['db_port'];
790
-			elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432)
791
-				$vars['db_port'] = (int) $_POST['db_port'];
836
+			if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) {
837
+							$vars['db_port'] = (int) $_POST['db_port'];
838
+			} elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) {
839
+							$vars['db_port'] = (int) $_POST['db_port'];
840
+			}
792 841
 		}
793 842
 
794 843
 		// God I hope it saved!
@@ -801,8 +850,9 @@  discard block
 block discarded – undo
801 850
 		// Make sure it works.
802 851
 		require(dirname(__FILE__) . '/Settings.php');
803 852
 
804
-		if (empty($sourcedir))
805
-			$sourcedir = dirname(__FILE__) . '/Sources';
853
+		if (empty($sourcedir)) {
854
+					$sourcedir = dirname(__FILE__) . '/Sources';
855
+		}
806 856
 
807 857
 		// Better find the database file!
808 858
 		if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php'))
@@ -812,18 +862,21 @@  discard block
 block discarded – undo
812 862
 		}
813 863
 
814 864
 		// Now include it for database functions!
815
-		if (!defined('SMF'))
816
-			define('SMF', 1);
865
+		if (!defined('SMF')) {
866
+					define('SMF', 1);
867
+		}
817 868
 
818 869
 		$modSettings['disableQueryCheck'] = true;
819
-		if (empty($smcFunc))
820
-			$smcFunc = array();
870
+		if (empty($smcFunc)) {
871
+					$smcFunc = array();
872
+		}
821 873
 
822 874
 			require_once($sourcedir . '/Subs-Db-' . $db_type . '.php');
823 875
 
824 876
 		// What - running PHP4? The shame!
825
-		if (version_compare(PHP_VERSION, '5', '<'))
826
-			require_once($sourcedir . '/Subs-Compat.php');
877
+		if (version_compare(PHP_VERSION, '5', '<')) {
878
+					require_once($sourcedir . '/Subs-Compat.php');
879
+		}
827 880
 
828 881
 		// Attempt a connection.
829 882
 		$needsDB = !empty($databases[$db_type]['always_has_db']);
@@ -911,12 +964,14 @@  discard block
 block discarded – undo
911 964
 	$incontext['page_title'] = $txt['install_settings'];
912 965
 
913 966
 	// Let's see if we got the database type correct.
914
-	if (isset($_POST['db_type'], $databases[$_POST['db_type']]))
915
-		$db_type = $_POST['db_type'];
967
+	if (isset($_POST['db_type'], $databases[$_POST['db_type']])) {
968
+			$db_type = $_POST['db_type'];
969
+	}
916 970
 
917 971
 	// Else we'd better be able to get the connection.
918
-	else
919
-		load_database();
972
+	else {
973
+			load_database();
974
+	}
920 975
 
921 976
 	$db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type;
922 977
 
@@ -936,12 +991,14 @@  discard block
 block discarded – undo
936 991
 	// Submitting?
937 992
 	if (isset($_POST['boardurl']))
938 993
 	{
939
-		if (substr($_POST['boardurl'], -10) == '/index.php')
940
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
941
-		elseif (substr($_POST['boardurl'], -1) == '/')
942
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
943
-		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://')
944
-			$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
994
+		if (substr($_POST['boardurl'], -10) == '/index.php') {
995
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
996
+		} elseif (substr($_POST['boardurl'], -1) == '/') {
997
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
998
+		}
999
+		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') {
1000
+					$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
1001
+		}
945 1002
 
946 1003
 		// Save these variables.
947 1004
 		$vars = array(
@@ -978,10 +1035,10 @@  discard block
 block discarded – undo
978 1035
 			{
979 1036
 				$incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']);
980 1037
 				return false;
981
-			}
982
-			else
983
-				// Set the character set here.
1038
+			} else {
1039
+							// Set the character set here.
984 1040
 				updateSettingsFile(array('db_character_set' => 'utf8'));
1041
+			}
985 1042
 		}
986 1043
 
987 1044
 		// Good, skip on.
@@ -1001,8 +1058,9 @@  discard block
 block discarded – undo
1001 1058
 	$incontext['continue'] = 1;
1002 1059
 
1003 1060
 	// Already done?
1004
-	if (isset($_POST['pop_done']))
1005
-		return true;
1061
+	if (isset($_POST['pop_done'])) {
1062
+			return true;
1063
+	}
1006 1064
 
1007 1065
 	// Reload settings.
1008 1066
 	require(dirname(__FILE__) . '/Settings.php');
@@ -1020,8 +1078,9 @@  discard block
 block discarded – undo
1020 1078
 	$modSettings = array();
1021 1079
 	if ($result !== false)
1022 1080
 	{
1023
-		while ($row = $smcFunc['db_fetch_assoc']($result))
1024
-			$modSettings[$row['variable']] = $row['value'];
1081
+		while ($row = $smcFunc['db_fetch_assoc']($result)) {
1082
+					$modSettings[$row['variable']] = $row['value'];
1083
+		}
1025 1084
 		$smcFunc['db_free_result']($result);
1026 1085
 
1027 1086
 		// Do they match?  If so, this is just a refresh so charge on!
@@ -1034,20 +1093,22 @@  discard block
 block discarded – undo
1034 1093
 	$modSettings['disableQueryCheck'] = true;
1035 1094
 
1036 1095
 	// If doing UTF8, select it. PostgreSQL requires passing it as a string...
1037
-	if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support']))
1038
-		$smcFunc['db_query']('', '
1096
+	if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) {
1097
+			$smcFunc['db_query']('', '
1039 1098
 			SET NAMES {string:utf8}',
1040 1099
 			array(
1041 1100
 				'db_error_skip' => true,
1042 1101
 				'utf8' => 'utf8',
1043 1102
 			)
1044 1103
 		);
1104
+	}
1045 1105
 
1046 1106
 	// Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments...
1047
-	if (substr(__DIR__, -1) == '\\')
1048
-		$attachdir = __DIR__ . 'attachments';
1049
-	else
1050
-		$attachdir = __DIR__ . '/attachments';
1107
+	if (substr(__DIR__, -1) == '\\') {
1108
+			$attachdir = __DIR__ . 'attachments';
1109
+	} else {
1110
+			$attachdir = __DIR__ . '/attachments';
1111
+	}
1051 1112
 
1052 1113
 	$replaces = array(
1053 1114
 		'{$db_prefix}' => $db_prefix,
@@ -1064,8 +1125,9 @@  discard block
 block discarded – undo
1064 1125
 
1065 1126
 	foreach ($txt as $key => $value)
1066 1127
 	{
1067
-		if (substr($key, 0, 8) == 'default_')
1068
-			$replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value);
1128
+		if (substr($key, 0, 8) == 'default_') {
1129
+					$replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value);
1130
+		}
1069 1131
 	}
1070 1132
 	$replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n'));
1071 1133
 
@@ -1080,8 +1142,9 @@  discard block
 block discarded – undo
1080 1142
 
1081 1143
 		while ($row = $smcFunc['db_fetch_assoc']($get_engines))
1082 1144
 		{
1083
-			if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT')
1084
-				$engines[] = $row['Engine'];
1145
+			if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') {
1146
+							$engines[] = $row['Engine'];
1147
+			}
1085 1148
 		}
1086 1149
 
1087 1150
 		// Done with this now
@@ -1105,8 +1168,7 @@  discard block
 block discarded – undo
1105 1168
 			$replaces['START TRANSACTION;'] = '';
1106 1169
 			$replaces['COMMIT;'] = '';
1107 1170
 		}
1108
-	}
1109
-	else
1171
+	} else
1110 1172
 	{
1111 1173
 		$has_innodb = false;
1112 1174
 	}
@@ -1128,21 +1190,24 @@  discard block
 block discarded – undo
1128 1190
 	foreach ($sql_lines as $count => $line)
1129 1191
 	{
1130 1192
 		// No comments allowed!
1131
-		if (substr(trim($line), 0, 1) != '#')
1132
-			$current_statement .= "\n" . rtrim($line);
1193
+		if (substr(trim($line), 0, 1) != '#') {
1194
+					$current_statement .= "\n" . rtrim($line);
1195
+		}
1133 1196
 
1134 1197
 		// Is this the end of the query string?
1135
-		if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines)))
1136
-			continue;
1198
+		if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) {
1199
+					continue;
1200
+		}
1137 1201
 
1138 1202
 		// Does this table already exist?  If so, don't insert more data into it!
1139 1203
 		if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists))
1140 1204
 		{
1141 1205
 			preg_match_all('~\)[,;]~', $current_statement, $matches);
1142
-			if (!empty($matches[0]))
1143
-				$incontext['sql_results']['insert_dups'] += count($matches[0]);
1144
-			else
1145
-				$incontext['sql_results']['insert_dups']++;
1206
+			if (!empty($matches[0])) {
1207
+							$incontext['sql_results']['insert_dups'] += count($matches[0]);
1208
+			} else {
1209
+							$incontext['sql_results']['insert_dups']++;
1210
+			}
1146 1211
 
1147 1212
 			$current_statement = '';
1148 1213
 			continue;
@@ -1151,8 +1216,9 @@  discard block
 block discarded – undo
1151 1216
 		if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false)
1152 1217
 		{
1153 1218
 			// Use the appropriate function based on the DB type
1154
-			if ($db_type == 'mysql' || $db_type == 'mysqli')
1155
-				$db_errorno = $db_type . '_errno';
1219
+			if ($db_type == 'mysql' || $db_type == 'mysqli') {
1220
+							$db_errorno = $db_type . '_errno';
1221
+			}
1156 1222
 
1157 1223
 			// Error 1050: Table already exists!
1158 1224
 			// @todo Needs to be made better!
@@ -1167,18 +1233,18 @@  discard block
 block discarded – undo
1167 1233
 				// MySQLi requires a connection object. It's optional with MySQL and Postgres
1168 1234
 				$incontext['failures'][$count] = $smcFunc['db_error']($db_connection);
1169 1235
 			}
1170
-		}
1171
-		else
1236
+		} else
1172 1237
 		{
1173
-			if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1174
-				$incontext['sql_results']['tables']++;
1175
-			elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1238
+			if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) {
1239
+							$incontext['sql_results']['tables']++;
1240
+			} elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1)
1176 1241
 			{
1177 1242
 				preg_match_all('~\)[,;]~', $current_statement, $matches);
1178
-				if (!empty($matches[0]))
1179
-					$incontext['sql_results']['inserts'] += count($matches[0]);
1180
-				else
1181
-					$incontext['sql_results']['inserts']++;
1243
+				if (!empty($matches[0])) {
1244
+									$incontext['sql_results']['inserts'] += count($matches[0]);
1245
+				} else {
1246
+									$incontext['sql_results']['inserts']++;
1247
+				}
1182 1248
 			}
1183 1249
 		}
1184 1250
 
@@ -1191,15 +1257,17 @@  discard block
 block discarded – undo
1191 1257
 	// Sort out the context for the SQL.
1192 1258
 	foreach ($incontext['sql_results'] as $key => $number)
1193 1259
 	{
1194
-		if ($number == 0)
1195
-			unset($incontext['sql_results'][$key]);
1196
-		else
1197
-			$incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number);
1260
+		if ($number == 0) {
1261
+					unset($incontext['sql_results'][$key]);
1262
+		} else {
1263
+					$incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number);
1264
+		}
1198 1265
 	}
1199 1266
 
1200 1267
 	// Make sure UTF will be used globally.
1201
-	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'])))
1202
-		$newSettings[] = array('global_character_set', 'UTF-8');
1268
+	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']))) {
1269
+			$newSettings[] = array('global_character_set', 'UTF-8');
1270
+	}
1203 1271
 
1204 1272
 	// Maybe we can auto-detect better cookie settings?
1205 1273
 	preg_match('~^http[s]?://([^\.]+?)([^/]*?)(/.*)?$~', $boardurl, $matches);
@@ -1210,16 +1278,20 @@  discard block
 block discarded – undo
1210 1278
 		$globalCookies = false;
1211 1279
 
1212 1280
 		// Okay... let's see.  Using a subdomain other than www.? (not a perfect check.)
1213
-		if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www'))))
1214
-			$globalCookies = true;
1281
+		if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) {
1282
+					$globalCookies = true;
1283
+		}
1215 1284
 		// If there's a / in the middle of the path, or it starts with ~... we want local.
1216
-		if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false))
1217
-			$localCookies = true;
1285
+		if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) {
1286
+					$localCookies = true;
1287
+		}
1218 1288
 
1219
-		if ($globalCookies)
1220
-			$newSettings[] = array('globalCookies', '1');
1221
-		if ($localCookies)
1222
-			$newSettings[] = array('localCookies', '1');
1289
+		if ($globalCookies) {
1290
+					$newSettings[] = array('globalCookies', '1');
1291
+		}
1292
+		if ($localCookies) {
1293
+					$newSettings[] = array('localCookies', '1');
1294
+		}
1223 1295
 	}
1224 1296
 
1225 1297
 	// Are we allowing stat collection?
@@ -1235,32 +1307,36 @@  discard block
 block discarded – undo
1235 1307
 			fwrite($fp, $out);
1236 1308
 
1237 1309
 			$return_data = '';
1238
-			while (!feof($fp))
1239
-				$return_data .= fgets($fp, 128);
1310
+			while (!feof($fp)) {
1311
+							$return_data .= fgets($fp, 128);
1312
+			}
1240 1313
 
1241 1314
 			fclose($fp);
1242 1315
 
1243 1316
 			// Get the unique site ID.
1244 1317
 			preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
1245 1318
 
1246
-			if (!empty($ID[1]))
1247
-				$newSettings[] = array('allow_sm_stats', $ID[1]);
1319
+			if (!empty($ID[1])) {
1320
+							$newSettings[] = array('allow_sm_stats', $ID[1]);
1321
+			}
1248 1322
 		}
1249 1323
 	}
1250 1324
 
1251 1325
 	// Are we enabling SSL?
1252
-	if (!empty($_POST['force_ssl']))
1253
-		$newSettings[] = array('force_ssl', 2);
1326
+	if (!empty($_POST['force_ssl'])) {
1327
+			$newSettings[] = array('force_ssl', 2);
1328
+	}
1254 1329
 
1255 1330
 	// Setting a timezone is required.
1256 1331
 	if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set'))
1257 1332
 	{
1258 1333
 		// Get PHP's default timezone, if set
1259 1334
 		$ini_tz = ini_get('date.timezone');
1260
-		if (!empty($ini_tz))
1261
-			$timezone_id = $ini_tz;
1262
-		else
1263
-			$timezone_id = '';
1335
+		if (!empty($ini_tz)) {
1336
+					$timezone_id = $ini_tz;
1337
+		} else {
1338
+					$timezone_id = '';
1339
+		}
1264 1340
 
1265 1341
 		// If date.timezone is unset, invalid, or just plain weird, make a best guess
1266 1342
 		if (!in_array($timezone_id, timezone_identifiers_list()))
@@ -1269,8 +1345,9 @@  discard block
 block discarded – undo
1269 1345
 			$timezone_id = timezone_name_from_abbr('', $server_offset, 0);
1270 1346
 		}
1271 1347
 
1272
-		if (date_default_timezone_set($timezone_id))
1273
-			$newSettings[] = array('default_timezone', $timezone_id);
1348
+		if (date_default_timezone_set($timezone_id)) {
1349
+					$newSettings[] = array('default_timezone', $timezone_id);
1350
+		}
1274 1351
 	}
1275 1352
 
1276 1353
 	if (!empty($newSettings))
@@ -1301,16 +1378,18 @@  discard block
 block discarded – undo
1301 1378
 	}
1302 1379
 
1303 1380
 	// MySQL specific stuff
1304
-	if (substr($db_type, 0, 5) != 'mysql')
1305
-		return false;
1381
+	if (substr($db_type, 0, 5) != 'mysql') {
1382
+			return false;
1383
+	}
1306 1384
 
1307 1385
 	// Find database user privileges.
1308 1386
 	$privs = array();
1309 1387
 	$get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array());
1310 1388
 	while ($row = $smcFunc['db_fetch_assoc']($get_privs))
1311 1389
 	{
1312
-		if ($row['Privilege'] == 'Alter')
1313
-			$privs[] = $row['Privilege'];
1390
+		if ($row['Privilege'] == 'Alter') {
1391
+					$privs[] = $row['Privilege'];
1392
+		}
1314 1393
 	}
1315 1394
 	$smcFunc['db_free_result']($get_privs);
1316 1395
 
@@ -1340,8 +1419,9 @@  discard block
 block discarded – undo
1340 1419
 	$incontext['continue'] = 1;
1341 1420
 
1342 1421
 	// Skipping?
1343
-	if (!empty($_POST['skip']))
1344
-		return true;
1422
+	if (!empty($_POST['skip'])) {
1423
+			return true;
1424
+	}
1345 1425
 
1346 1426
 	// Need this to check whether we need the database password.
1347 1427
 	require(dirname(__FILE__) . '/Settings.php');
@@ -1354,18 +1434,22 @@  discard block
 block discarded – undo
1354 1434
 	// We need this to properly hash the password for Admin
1355 1435
 	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1356 1436
 			global $sourcedir;
1357
-			if (function_exists('mb_strtolower'))
1358
-				return mb_strtolower($string, 'UTF-8');
1437
+			if (function_exists('mb_strtolower')) {
1438
+							return mb_strtolower($string, 'UTF-8');
1439
+			}
1359 1440
 			require_once($sourcedir . '/Subs-Charset.php');
1360 1441
 			return utf8_strtolower($string);
1361 1442
 		};
1362 1443
 
1363
-	if (!isset($_POST['username']))
1364
-		$_POST['username'] = '';
1365
-	if (!isset($_POST['email']))
1366
-		$_POST['email'] = '';
1367
-	if (!isset($_POST['server_email']))
1368
-		$_POST['server_email'] = '';
1444
+	if (!isset($_POST['username'])) {
1445
+			$_POST['username'] = '';
1446
+	}
1447
+	if (!isset($_POST['email'])) {
1448
+			$_POST['email'] = '';
1449
+	}
1450
+	if (!isset($_POST['server_email'])) {
1451
+			$_POST['server_email'] = '';
1452
+	}
1369 1453
 
1370 1454
 	$incontext['username'] = htmlspecialchars(stripslashes($_POST['username']));
1371 1455
 	$incontext['email'] = htmlspecialchars(stripslashes($_POST['email']));
@@ -1384,8 +1468,9 @@  discard block
 block discarded – undo
1384 1468
 			'admin_group' => 1,
1385 1469
 		)
1386 1470
 	);
1387
-	if ($smcFunc['db_num_rows']($request) != 0)
1388
-		$incontext['skip'] = 1;
1471
+	if ($smcFunc['db_num_rows']($request) != 0) {
1472
+			$incontext['skip'] = 1;
1473
+	}
1389 1474
 	$smcFunc['db_free_result']($request);
1390 1475
 
1391 1476
 	// Trying to create an account?
@@ -1416,8 +1501,9 @@  discard block
 block discarded – undo
1416 1501
 		}
1417 1502
 
1418 1503
 		// Update the webmaster's email?
1419
-		if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]'))
1420
-			updateSettingsFile(array('webmaster_email' => $_POST['server_email']));
1504
+		if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) {
1505
+					updateSettingsFile(array('webmaster_email' => $_POST['server_email']));
1506
+		}
1421 1507
 
1422 1508
 		// Work out whether we're going to have dodgy characters and remove them.
1423 1509
 		$invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0;
@@ -1440,32 +1526,27 @@  discard block
 block discarded – undo
1440 1526
 			$smcFunc['db_free_result']($result);
1441 1527
 
1442 1528
 			$incontext['account_existed'] = $txt['error_user_settings_taken'];
1443
-		}
1444
-		elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25)
1529
+		} elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25)
1445 1530
 		{
1446 1531
 			// Try the previous step again.
1447 1532
 			$incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long'];
1448 1533
 			return false;
1449
-		}
1450
-		elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false)
1534
+		} elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false)
1451 1535
 		{
1452 1536
 			// Try the previous step again.
1453 1537
 			$incontext['error'] = $txt['error_invalid_characters_username'];
1454 1538
 			return false;
1455
-		}
1456
-		elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255)
1539
+		} elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255)
1457 1540
 		{
1458 1541
 			// One step back, this time fill out a proper admin email address.
1459 1542
 			$incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']);
1460 1543
 			return false;
1461
-		}
1462
-		elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255)
1544
+		} elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255)
1463 1545
 		{
1464 1546
 			// One step back, this time fill out a proper admin email address.
1465 1547
 			$incontext['error'] = $txt['error_valid_server_email_needed'];
1466 1548
 			return false;
1467
-		}
1468
-		elseif ($_POST['username'] != '')
1549
+		} elseif ($_POST['username'] != '')
1469 1550
 		{
1470 1551
 			$incontext['member_salt'] = substr(md5(mt_rand()), 0, 4);
1471 1552
 
@@ -1531,17 +1612,19 @@  discard block
 block discarded – undo
1531 1612
 	require_once($sourcedir . '/Subs-Auth.php');
1532 1613
 
1533 1614
 	// Bring a warning over.
1534
-	if (!empty($incontext['account_existed']))
1535
-		$incontext['warning'] = $incontext['account_existed'];
1615
+	if (!empty($incontext['account_existed'])) {
1616
+			$incontext['warning'] = $incontext['account_existed'];
1617
+	}
1536 1618
 
1537
-	if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support']))
1538
-		$smcFunc['db_query']('', '
1619
+	if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) {
1620
+			$smcFunc['db_query']('', '
1539 1621
 			SET NAMES {string:db_character_set}',
1540 1622
 			array(
1541 1623
 				'db_character_set' => $db_character_set,
1542 1624
 				'db_error_skip' => true,
1543 1625
 			)
1544 1626
 		);
1627
+	}
1545 1628
 
1546 1629
 	// As track stats is by default enabled let's add some activity.
1547 1630
 	$smcFunc['db_insert']('ignore',
@@ -1562,14 +1645,16 @@  discard block
 block discarded – undo
1562 1645
 	// Only proceed if we can load the data.
1563 1646
 	if ($request)
1564 1647
 	{
1565
-		while ($row = $smcFunc['db_fetch_row']($request))
1566
-			$modSettings[$row[0]] = $row[1];
1648
+		while ($row = $smcFunc['db_fetch_row']($request)) {
1649
+					$modSettings[$row[0]] = $row[1];
1650
+		}
1567 1651
 		$smcFunc['db_free_result']($request);
1568 1652
 	}
1569 1653
 
1570 1654
 	// Automatically log them in ;)
1571
-	if (isset($incontext['member_id']) && isset($incontext['member_salt']))
1572
-		setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt']));
1655
+	if (isset($incontext['member_id']) && isset($incontext['member_salt'])) {
1656
+			setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt']));
1657
+	}
1573 1658
 
1574 1659
 	$result = $smcFunc['db_query']('', '
1575 1660
 		SELECT value
@@ -1580,13 +1665,14 @@  discard block
 block discarded – undo
1580 1665
 			'db_error_skip' => true,
1581 1666
 		)
1582 1667
 	);
1583
-	if ($smcFunc['db_num_rows']($result) != 0)
1584
-		list ($db_sessions) = $smcFunc['db_fetch_row']($result);
1668
+	if ($smcFunc['db_num_rows']($result) != 0) {
1669
+			list ($db_sessions) = $smcFunc['db_fetch_row']($result);
1670
+	}
1585 1671
 	$smcFunc['db_free_result']($result);
1586 1672
 
1587
-	if (empty($db_sessions))
1588
-		$_SESSION['admin_time'] = time();
1589
-	else
1673
+	if (empty($db_sessions)) {
1674
+			$_SESSION['admin_time'] = time();
1675
+	} else
1590 1676
 	{
1591 1677
 		$_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211);
1592 1678
 
@@ -1610,8 +1696,9 @@  discard block
 block discarded – undo
1610 1696
 	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1611 1697
 		function($string){
1612 1698
 			global $sourcedir;
1613
-			if (function_exists('mb_strtolower'))
1614
-				return mb_strtolower($string, 'UTF-8');
1699
+			if (function_exists('mb_strtolower')) {
1700
+							return mb_strtolower($string, 'UTF-8');
1701
+			}
1615 1702
 			require_once($sourcedir . '/Subs-Charset.php');
1616 1703
 			return utf8_strtolower($string);
1617 1704
 		};
@@ -1627,8 +1714,9 @@  discard block
 block discarded – undo
1627 1714
 		)
1628 1715
 	);
1629 1716
 	$context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8';
1630
-	if ($smcFunc['db_num_rows']($request) > 0)
1631
-		updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
1717
+	if ($smcFunc['db_num_rows']($request) > 0) {
1718
+			updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
1719
+	}
1632 1720
 	$smcFunc['db_free_result']($request);
1633 1721
 
1634 1722
 	// Now is the perfect time to fetch the SM files.
@@ -1647,8 +1735,9 @@  discard block
 block discarded – undo
1647 1735
 
1648 1736
 	// Check if we need some stupid MySQL fix.
1649 1737
 	$server_version = $smcFunc['db_server_info']();
1650
-	if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
1651
-		updateSettings(array('db_mysql_group_by_fix' => '1'));
1738
+	if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) {
1739
+			updateSettings(array('db_mysql_group_by_fix' => '1'));
1740
+	}
1652 1741
 
1653 1742
 	// Some final context for the template.
1654 1743
 	$incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\';
@@ -1668,8 +1757,9 @@  discard block
 block discarded – undo
1668 1757
 	$settingsArray = file(dirname(__FILE__) . '/Settings.php');
1669 1758
 
1670 1759
 	// @todo Do we just want to read the file in clean, and split it this way always?
1671
-	if (count($settingsArray) == 1)
1672
-		$settingsArray = preg_split('~[\r\n]~', $settingsArray[0]);
1760
+	if (count($settingsArray) == 1) {
1761
+			$settingsArray = preg_split('~[\r\n]~', $settingsArray[0]);
1762
+	}
1673 1763
 
1674 1764
 	for ($i = 0, $n = count($settingsArray); $i < $n; $i++)
1675 1765
 	{
@@ -1684,19 +1774,22 @@  discard block
 block discarded – undo
1684 1774
 			continue;
1685 1775
 		}
1686 1776
 
1687
-		if (trim($settingsArray[$i]) == '?' . '>')
1688
-			$settingsArray[$i] = '';
1777
+		if (trim($settingsArray[$i]) == '?' . '>') {
1778
+					$settingsArray[$i] = '';
1779
+		}
1689 1780
 
1690 1781
 		// Don't trim or bother with it if it's not a variable.
1691
-		if (substr($settingsArray[$i], 0, 1) != '$')
1692
-			continue;
1782
+		if (substr($settingsArray[$i], 0, 1) != '$') {
1783
+					continue;
1784
+		}
1693 1785
 
1694 1786
 		$settingsArray[$i] = rtrim($settingsArray[$i]) . "\n";
1695 1787
 
1696
-		foreach ($vars as $var => $val)
1697
-			if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0)
1788
+		foreach ($vars as $var => $val) {
1789
+					if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0)
1698 1790
 			{
1699 1791
 				$comment = strstr($settingsArray[$i], '#');
1792
+		}
1700 1793
 				$settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n");
1701 1794
 				unset($vars[$var]);
1702 1795
 			}
@@ -1706,36 +1799,41 @@  discard block
 block discarded – undo
1706 1799
 	if (!empty($vars))
1707 1800
 	{
1708 1801
 		$settingsArray[$i++] = '';
1709
-		foreach ($vars as $var => $val)
1710
-			$settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n";
1802
+		foreach ($vars as $var => $val) {
1803
+					$settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n";
1804
+		}
1711 1805
 	}
1712 1806
 
1713 1807
 	// Blank out the file - done to fix a oddity with some servers.
1714 1808
 	$fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w');
1715
-	if (!$fp)
1716
-		return false;
1809
+	if (!$fp) {
1810
+			return false;
1811
+	}
1717 1812
 	fclose($fp);
1718 1813
 
1719 1814
 	$fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+');
1720 1815
 
1721 1816
 	// Gotta have one of these ;)
1722
-	if (trim($settingsArray[0]) != '<?php')
1723
-		fwrite($fp, "<?php\n");
1817
+	if (trim($settingsArray[0]) != '<?php') {
1818
+			fwrite($fp, "<?php\n");
1819
+	}
1724 1820
 
1725 1821
 	$lines = count($settingsArray);
1726 1822
 	for ($i = 0; $i < $lines - 1; $i++)
1727 1823
 	{
1728 1824
 		// Don't just write a bunch of blank lines.
1729
-		if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '')
1730
-			fwrite($fp, strtr($settingsArray[$i], "\r", ''));
1825
+		if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') {
1826
+					fwrite($fp, strtr($settingsArray[$i], "\r", ''));
1827
+		}
1731 1828
 	}
1732 1829
 	fwrite($fp, $settingsArray[$i] . '?' . '>');
1733 1830
 	fclose($fp);
1734 1831
 
1735 1832
 	// Even though on normal installations the filemtime should prevent this being used by the installer incorrectly
1736 1833
 	// it seems that there are times it might not. So let's MAKE it dump the cache.
1737
-	if (function_exists('opcache_invalidate'))
1738
-		opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);
1834
+	if (function_exists('opcache_invalidate')) {
1835
+			opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);
1836
+	}
1739 1837
 
1740 1838
 	return true;
1741 1839
 }
@@ -1760,9 +1858,9 @@  discard block
 block discarded – undo
1760 1858
 	SecFilterScanPOST Off
1761 1859
 </IfModule>';
1762 1860
 
1763
-	if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules()))
1764
-		return true;
1765
-	elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess'))
1861
+	if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) {
1862
+			return true;
1863
+	} elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess'))
1766 1864
 	{
1767 1865
 		$current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess'));
1768 1866
 
@@ -1774,29 +1872,28 @@  discard block
 block discarded – undo
1774 1872
 				fwrite($ht_handle, $htaccess_addition);
1775 1873
 				fclose($ht_handle);
1776 1874
 				return true;
1875
+			} else {
1876
+							return false;
1777 1877
 			}
1778
-			else
1779
-				return false;
1878
+		} else {
1879
+					return true;
1780 1880
 		}
1781
-		else
1782
-			return true;
1783
-	}
1784
-	elseif (file_exists(dirname(__FILE__) . '/.htaccess'))
1785
-		return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false;
1786
-	elseif (is_writable(dirname(__FILE__)))
1881
+	} elseif (file_exists(dirname(__FILE__) . '/.htaccess')) {
1882
+			return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false;
1883
+	} elseif (is_writable(dirname(__FILE__)))
1787 1884
 	{
1788 1885
 		if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w'))
1789 1886
 		{
1790 1887
 			fwrite($ht_handle, $htaccess_addition);
1791 1888
 			fclose($ht_handle);
1792 1889
 			return true;
1890
+		} else {
1891
+					return false;
1793 1892
 		}
1794
-		else
1893
+	} else {
1795 1894
 			return false;
1796 1895
 	}
1797
-	else
1798
-		return false;
1799
-}
1896
+	}
1800 1897
 
1801 1898
 function template_install_above()
1802 1899
 {
@@ -1834,9 +1931,10 @@  discard block
 block discarded – undo
1834 1931
 								<label for="installer_language">', $txt['installer_language'], ':</label>
1835 1932
 								<select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">';
1836 1933
 
1837
-		foreach ($incontext['detected_languages'] as $lang => $name)
1838
-			echo '
1934
+		foreach ($incontext['detected_languages'] as $lang => $name) {
1935
+					echo '
1839 1936
 									<option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>';
1937
+		}
1840 1938
 
1841 1939
 		echo '
1842 1940
 								</select>
@@ -1856,9 +1954,10 @@  discard block
 block discarded – undo
1856 1954
 						<h2>', $txt['upgrade_progress'], '</h2>
1857 1955
 						<ul>';
1858 1956
 
1859
-	foreach ($incontext['steps'] as $num => $step)
1860
-		echo '
1957
+	foreach ($incontext['steps'] as $num => $step) {
1958
+			echo '
1861 1959
 							<li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>';
1960
+	}
1862 1961
 
1863 1962
 	echo '
1864 1963
 						</ul>
@@ -1883,20 +1982,23 @@  discard block
 block discarded – undo
1883 1982
 		echo '
1884 1983
 								<div>';
1885 1984
 
1886
-		if (!empty($incontext['continue']))
1887
-			echo '
1985
+		if (!empty($incontext['continue'])) {
1986
+					echo '
1888 1987
 									<input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button_submit" />';
1889
-		if (!empty($incontext['skip']))
1890
-			echo '
1988
+		}
1989
+		if (!empty($incontext['skip'])) {
1990
+					echo '
1891 1991
 									<input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button_submit" />';
1992
+		}
1892 1993
 		echo '
1893 1994
 								</div>';
1894 1995
 	}
1895 1996
 
1896 1997
 	// Show the closing form tag and other data only if not in the last step
1897
-	if (count($incontext['steps']) - 1 !== (int) $incontext['current_step'])
1898
-		echo '
1998
+	if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) {
1999
+			echo '
1899 2000
 							</form>';
2001
+	}
1900 2002
 
1901 2003
 	echo '
1902 2004
 						</div>
@@ -1931,13 +2033,15 @@  discard block
 block discarded – undo
1931 2033
 		</div>';
1932 2034
 
1933 2035
 	// Show the warnings, or not.
1934
-	if (template_warning_divs())
1935
-		echo '
2036
+	if (template_warning_divs()) {
2037
+			echo '
1936 2038
 		<h3>', $txt['install_all_lovely'], '</h3>';
2039
+	}
1937 2040
 
1938 2041
 	// Say we want the continue button!
1939
-	if (empty($incontext['error']))
1940
-		$incontext['continue'] = 1;
2042
+	if (empty($incontext['error'])) {
2043
+			$incontext['continue'] = 1;
2044
+	}
1941 2045
 
1942 2046
 	// For the latest version stuff.
1943 2047
 	echo '
@@ -1971,8 +2075,8 @@  discard block
 block discarded – undo
1971 2075
 	global $txt, $incontext;
1972 2076
 
1973 2077
 	// Errors are very serious..
1974
-	if (!empty($incontext['error']))
1975
-		echo '
2078
+	if (!empty($incontext['error'])) {
2079
+			echo '
1976 2080
 		<div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;">
1977 2081
 			<div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div>
1978 2082
 			<strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br>
@@ -1980,9 +2084,10 @@  discard block
 block discarded – undo
1980 2084
 				', $incontext['error'], '
1981 2085
 			</div>
1982 2086
 		</div>';
2087
+	}
1983 2088
 	// A warning message?
1984
-	elseif (!empty($incontext['warning']))
1985
-		echo '
2089
+	elseif (!empty($incontext['warning'])) {
2090
+			echo '
1986 2091
 		<div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;">
1987 2092
 			<div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div>
1988 2093
 			<strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br>
@@ -1990,6 +2095,7 @@  discard block
 block discarded – undo
1990 2095
 				', $incontext['warning'], '
1991 2096
 			</div>
1992 2097
 		</div>';
2098
+	}
1993 2099
 
1994 2100
 	return empty($incontext['error']) && empty($incontext['warning']);
1995 2101
 }
@@ -2005,27 +2111,30 @@  discard block
 block discarded – undo
2005 2111
 			<li>', $incontext['failed_files']), '</li>
2006 2112
 		</ul>';
2007 2113
 
2008
-	if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux')
2009
-		echo '
2114
+	if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') {
2115
+			echo '
2010 2116
 		<hr>
2011 2117
 		<p>', $txt['chmod_linux_info'], '</p>
2012 2118
 		<tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>';
2119
+	}
2013 2120
 
2014 2121
 	// This is serious!
2015
-	if (!template_warning_divs())
2016
-		return;
2122
+	if (!template_warning_divs()) {
2123
+			return;
2124
+	}
2017 2125
 
2018 2126
 	echo '
2019 2127
 		<hr>
2020 2128
 		<p>', $txt['ftp_setup_info'], '</p>';
2021 2129
 
2022
-	if (!empty($incontext['ftp_errors']))
2023
-		echo '
2130
+	if (!empty($incontext['ftp_errors'])) {
2131
+			echo '
2024 2132
 		<div class="error_message">
2025 2133
 			', $txt['error_ftp_no_connect'], '<br><br>
2026 2134
 			<code>', implode('<br>', $incontext['ftp_errors']), '</code>
2027 2135
 		</div>
2028 2136
 		<br>';
2137
+	}
2029 2138
 
2030 2139
 	echo '
2031 2140
 		<form action="', $incontext['form_url'], '" method="post">
@@ -2085,17 +2194,17 @@  discard block
 block discarded – undo
2085 2194
 				<td>
2086 2195
 					<select name="db_type" id="db_type_input" onchange="toggleDBInput();">';
2087 2196
 
2088
-	foreach ($incontext['supported_databases'] as $key => $db)
2089
-			echo '
2197
+	foreach ($incontext['supported_databases'] as $key => $db) {
2198
+				echo '
2090 2199
 						<option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>';
2200
+	}
2091 2201
 
2092 2202
 	echo '
2093 2203
 					</select>
2094 2204
 					<div class="smalltext block">', $txt['db_settings_type_info'], '</div>
2095 2205
 				</td>
2096 2206
 			</tr>';
2097
-	}
2098
-	else
2207
+	} else
2099 2208
 	{
2100 2209
 		echo '
2101 2210
 			<tr style="display: none;">
@@ -2287,9 +2396,10 @@  discard block
 block discarded – undo
2287 2396
 				<div style="color: red;">', $txt['error_db_queries'], '</div>
2288 2397
 				<ul>';
2289 2398
 
2290
-		foreach ($incontext['failures'] as $line => $fail)
2291
-			echo '
2399
+		foreach ($incontext['failures'] as $line => $fail) {
2400
+					echo '
2292 2401
 						<li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>';
2402
+		}
2293 2403
 
2294 2404
 		echo '
2295 2405
 				</ul>';
@@ -2350,15 +2460,16 @@  discard block
 block discarded – undo
2350 2460
 			</tr>
2351 2461
 		</table>';
2352 2462
 
2353
-	if ($incontext['require_db_confirm'])
2354
-		echo '
2463
+	if ($incontext['require_db_confirm']) {
2464
+			echo '
2355 2465
 		<h2>', $txt['user_settings_database'], '</h2>
2356 2466
 		<p>', $txt['user_settings_database_info'], '</p>
2357 2467
 
2358 2468
 		<div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;">
2359 2469
 			<input type="password" name="password3" size="30" class="input_password" />
2360 2470
 		</div>';
2361
-}
2471
+	}
2472
+	}
2362 2473
 
2363 2474
 // Tell them it's done, and to delete.
2364 2475
 function template_delete_install()
@@ -2371,14 +2482,15 @@  discard block
 block discarded – undo
2371 2482
 	template_warning_divs();
2372 2483
 
2373 2484
 	// Install directory still writable?
2374
-	if ($incontext['dir_still_writable'])
2375
-		echo '
2485
+	if ($incontext['dir_still_writable']) {
2486
+			echo '
2376 2487
 		<em>', $txt['still_writable'], '</em><br>
2377 2488
 		<br>';
2489
+	}
2378 2490
 
2379 2491
 	// Don't show the box if it's like 99% sure it won't work :P.
2380
-	if ($incontext['probably_delete_install'])
2381
-		echo '
2492
+	if ($incontext['probably_delete_install']) {
2493
+			echo '
2382 2494
 		<div style="margin: 1ex; font-weight: bold;">
2383 2495
 			<label for="delete_self"><input type="checkbox" id="delete_self" onclick="doTheDelete();" class="input_check" /> ', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</label>
2384 2496
 		</div>
@@ -2394,6 +2506,7 @@  discard block
 block discarded – undo
2394 2506
 			}
2395 2507
 		</script>
2396 2508
 		<br>';
2509
+	}
2397 2510
 
2398 2511
 	echo '
2399 2512
 		', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '<br>
Please login to merge, or discard this patch.
index.php 2 patches
Braces   +37 added lines, -25 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 // Get everything started up...
27 27
 define('SMF', 1);
28
-if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(), '5.3.0') < 0)
28
+if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(), '5.3.0') < 0) {
29 29
 	@set_magic_quotes_runtime(0);
30
+}
30 31
 error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
31 32
 $time_start = microtime();
32 33
 
@@ -34,16 +35,18 @@  discard block
 block discarded – undo
34 35
 ob_start();
35 36
 
36 37
 // Do some cleaning, just in case.
37
-foreach (array('db_character_set', 'cachedir') as $variable)
38
+foreach (array('db_character_set', 'cachedir') as $variable) {
38 39
 	if (isset($GLOBALS[$variable]))
39 40
 		unset($GLOBALS[$variable], $GLOBALS[$variable]);
41
+}
40 42
 
41 43
 // Load the settings...
42 44
 require_once(dirname(__FILE__) . '/Settings.php');
43 45
 
44 46
 // Make absolutely sure the cache directory is defined.
45
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
47
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
46 48
 	$cachedir = $boarddir . '/cache';
49
+}
47 50
 
48 51
 // Without those we can't go anywhere
49 52
 require_once($sourcedir . '/QueryString.php');
@@ -53,8 +56,9 @@  discard block
 block discarded – undo
53 56
 require_once($sourcedir . '/Load.php');
54 57
 
55 58
 // If $maintenance is set specifically to 2, then we're upgrading or something.
56
-if (!empty($maintenance) && $maintenance == 2)
59
+if (!empty($maintenance) && $maintenance == 2) {
57 60
 	display_maintenance_message();
61
+}
58 62
 
59 63
 // Create a variable to store some SMF specific functions in.
60 64
 $smcFunc = array();
@@ -69,8 +73,9 @@  discard block
 block discarded – undo
69 73
 cleanRequest();
70 74
 
71 75
 // Seed the random generator.
72
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
76
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
73 77
 	smf_seed_generator();
78
+}
74 79
 
75 80
 // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out!
76 81
 if (isset($_GET['scheduled']))
@@ -90,9 +95,9 @@  discard block
 block discarded – undo
90 95
 if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
91 96
 {
92 97
 	// If zlib is being used, turn off output compression.
93
-	if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler')
94
-		$modSettings['enableCompressedOutput'] = '0';
95
-	else
98
+	if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') {
99
+			$modSettings['enableCompressedOutput'] = '0';
100
+	} else
96 101
 	{
97 102
 		ob_end_clean();
98 103
 		ob_start('ob_gzhandler');
@@ -141,18 +146,21 @@  discard block
 block discarded – undo
141 146
 	loadPermissions();
142 147
 
143 148
 	// Attachments don't require the entire theme to be loaded.
144
-	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach')
145
-		detectBrowser();
149
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') {
150
+			detectBrowser();
151
+	}
146 152
 	// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
147
-	else
148
-		loadTheme();
153
+	else {
154
+			loadTheme();
155
+	}
149 156
 
150 157
 	// Check if the user should be disallowed access.
151 158
 	is_not_banned();
152 159
 
153 160
 	// If we are in a topic and don't have permission to approve it then duck out now.
154
-	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
155
-		fatal_lang_error('not_a_topic', false);
161
+	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
162
+			fatal_lang_error('not_a_topic', false);
163
+	}
156 164
 
157 165
 	$no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile');
158 166
 	call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
@@ -163,8 +171,9 @@  discard block
 block discarded – undo
163 171
 		writeLog();
164 172
 
165 173
 		// Track forum statistics and hits...?
166
-		if (!empty($modSettings['hitStats']))
167
-			trackStats(array('hits' => '+'));
174
+		if (!empty($modSettings['hitStats'])) {
175
+					trackStats(array('hits' => '+'));
176
+		}
168 177
 	}
169 178
 	unset($no_stat_actions);
170 179
 
@@ -178,13 +187,14 @@  discard block
 block discarded – undo
178 187
 			return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout'));
179 188
 		}
180 189
 		// Don't even try it, sonny.
181
-		else
182
-			return 'InMaintenance';
190
+		else {
191
+					return 'InMaintenance';
192
+		}
183 193
 	}
184 194
 	// If guest access is off, a guest can only do one of the very few following actions.
185
-	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2'))))
186
-		return 'KickGuest';
187
-	elseif (empty($_REQUEST['action']))
195
+	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) {
196
+			return 'KickGuest';
197
+	} elseif (empty($_REQUEST['action']))
188 198
 	{
189 199
 		// Action and board are both empty... BoardIndex! Unless someone else wants to do something different.
190 200
 		if (empty($board) && empty($topic))
@@ -200,8 +210,9 @@  discard block
 block discarded – undo
200 210
 
201 211
 				$call = call_helper($defaultAction, true);
202 212
 
203
-				if (!empty($call))
204
-					return $call;
213
+				if (!empty($call)) {
214
+									return $call;
215
+				}
205 216
 			}
206 217
 
207 218
 			// No default action huh? then go to our good old BoardIndex.
@@ -331,8 +342,9 @@  discard block
 block discarded – undo
331 342
 
332 343
 			$call = call_helper($fallbackAction, true);
333 344
 
334
-			if (!empty($call))
335
-				return $call;
345
+			if (!empty($call)) {
346
+							return $call;
347
+			}
336 348
 		}
337 349
 
338 350
 		// No fallback action, huh?
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
  *
105 105
  * @param string $class The fully-qualified class name.
106 106
  */
107
-spl_autoload_register(function ($class) use ($sourcedir)
107
+spl_autoload_register(function($class) use ($sourcedir)
108 108
 {
109 109
 	$classMap = array(
110 110
 		'ReCaptcha\\' => 'ReCaptcha/',
Please login to merge, or discard this patch.
Themes/default/Profile.template.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3031,8 +3031,7 @@
 block discarded – undo
3031 3031
 							<div class="roundframe">
3032 3032
 								<div>
3033 3033
 		', !empty($context['tfa_backup']) ? '
3034
-									<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' :
3035
-			($modSettings['tfa_mode'] == 2 ? '
3034
+									<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : ($modSettings['tfa_mode'] == 2 ? '
3036 3035
 									<div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), '
3037 3036
 									<div class="smalltext">', $txt['tfa_desc'], '</div>
3038 3037
 									<div id="basicinfo" style="width: 60%">
Please login to merge, or discard this patch.
Braces   +461 added lines, -344 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" class="new_win">', ($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>
@@ -310,11 +324,12 @@  discard block
 block discarded – undo
310 324
 		echo '
311 325
 				<dl class="settings">';
312 326
 
313
-		foreach ($context['print_custom_fields']['standard'] as $field)
314
-			if (!empty($field['output_html']))
327
+		foreach ($context['print_custom_fields']['standard'] as $field) {
328
+					if (!empty($field['output_html']))
315 329
 				echo '
316 330
 					<dt>', $field['name'], ':</dt>
317 331
 					<dd>', $field['output_html'], '</dd>';
332
+		}
318 333
 
319 334
 		echo '
320 335
 				</dl>';
@@ -332,9 +347,10 @@  discard block
 block discarded – undo
332 347
 						<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
333 348
 
334 349
 		// Can we provide information on what this means?
335
-		if (!empty($context['warning_status']))
336
-			echo '
350
+		if (!empty($context['warning_status'])) {
351
+					echo '
337 352
 						<span class="smalltext">(', $context['warning_status'], ')</span>';
353
+		}
338 354
 
339 355
 		echo '
340 356
 					</dd>';
@@ -345,9 +361,10 @@  discard block
 block discarded – undo
345 361
 	{
346 362
 
347 363
 		// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
348
-		if (!empty($context['activate_message']))
349
-			echo '
364
+		if (!empty($context['activate_message'])) {
365
+					echo '
350 366
 					<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>';
367
+		}
351 368
 
352 369
 		// If the current member is banned, show a message and possibly a link to the ban.
353 370
 		if (!empty($context['member']['bans']))
@@ -357,9 +374,10 @@  discard block
 block discarded – undo
357 374
 					<dt class="clear" id="ban_info" style="display: none;">
358 375
 						<strong>', $txt['user_banned_by_following'], ':</strong>';
359 376
 
360
-			foreach ($context['member']['bans'] as $ban)
361
-				echo '
377
+			foreach ($context['member']['bans'] as $ban) {
378
+							echo '
362 379
 						<br><span class="smalltext">', $ban['explanation'], '</span>';
380
+			}
363 381
 
364 382
 			echo '
365 383
 					</dt>';
@@ -373,30 +391,34 @@  discard block
 block discarded – undo
373 391
 	// If the person looking is allowed, they can check the members IP address and hostname.
374 392
 	if ($context['can_see_ip'])
375 393
 	{
376
-		if (!empty($context['member']['ip']))
377
-		echo '
394
+		if (!empty($context['member']['ip'])) {
395
+				echo '
378 396
 					<dt>', $txt['ip'], ': </dt>
379 397
 					<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
398
+		}
380 399
 
381
-		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
382
-			echo '
400
+		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) {
401
+					echo '
383 402
 					<dt>', $txt['hostname'], ': </dt>
384 403
 					<dd>', $context['member']['hostname'], '</dd>';
404
+		}
385 405
 	}
386 406
 
387 407
 	echo '
388 408
 					<dt>', $txt['local_time'], ':</dt>
389 409
 					<dd>', $context['member']['local_time'], '</dd>';
390 410
 
391
-	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
392
-		echo '
411
+	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) {
412
+			echo '
393 413
 					<dt>', $txt['language'], ':</dt>
394 414
 					<dd>', $context['member']['language'], '</dd>';
415
+	}
395 416
 
396
-	if ($context['member']['show_last_login'])
397
-		echo '
417
+	if ($context['member']['show_last_login']) {
418
+			echo '
398 419
 					<dt>', $txt['lastLoggedIn'], ': </dt>
399 420
 					<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
421
+	}
400 422
 
401 423
 	echo '
402 424
 				</dl>';
@@ -408,10 +430,11 @@  discard block
 block discarded – undo
408 430
 				<div class="custom_fields_above_signature">
409 431
 					<ul class="nolist">';
410 432
 
411
-		foreach ($context['print_custom_fields']['above_signature'] as $field)
412
-			if (!empty($field['output_html']))
433
+		foreach ($context['print_custom_fields']['above_signature'] as $field) {
434
+					if (!empty($field['output_html']))
413 435
 				echo '
414 436
 						<li>', $field['output_html'], '</li>';
437
+		}
415 438
 
416 439
 		echo '
417 440
 					</ul>
@@ -419,12 +442,13 @@  discard block
 block discarded – undo
419 442
 	}
420 443
 
421 444
 	// Show the users signature.
422
-	if ($context['signature_enabled'] && !empty($context['member']['signature']))
423
-		echo '
445
+	if ($context['signature_enabled'] && !empty($context['member']['signature'])) {
446
+			echo '
424 447
 				<div class="signature">
425 448
 					<h5>', $txt['signature'], ':</h5>
426 449
 					', $context['member']['signature'], '
427 450
 				</div>';
451
+	}
428 452
 
429 453
 	// Are there any custom profile fields for below the signature?
430 454
 	if (!empty($context['print_custom_fields']['below_signature']))
@@ -433,10 +457,11 @@  discard block
 block discarded – undo
433 457
 				<div class="custom_fields_below_signature">
434 458
 					<ul class="nolist">';
435 459
 
436
-		foreach ($context['print_custom_fields']['below_signature'] as $field)
437
-			if (!empty($field['output_html']))
460
+		foreach ($context['print_custom_fields']['below_signature'] as $field) {
461
+					if (!empty($field['output_html']))
438 462
 				echo '
439 463
 						<li>', $field['output_html'], '</li>';
464
+		}
440 465
 
441 466
 		echo '
442 467
 					</ul>
@@ -481,62 +506,70 @@  discard block
 block discarded – undo
481 506
 				</div>
482 507
 				<div class="list_posts">';
483 508
 
484
-			if (!$post['approved'])
485
-				echo '
509
+			if (!$post['approved']) {
510
+							echo '
486 511
 					<div class="approve_post">
487 512
 						<em>', $txt['post_awaiting_approval'], '</em>
488 513
 					</div>';
514
+			}
489 515
 
490 516
 			echo '
491 517
 					', $post['body'], '
492 518
 				</div>';
493 519
 
494
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
495
-				echo '
520
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
521
+							echo '
496 522
 				<div class="floatright">
497 523
 					<ul class="quickbuttons">';
524
+			}
498 525
 
499 526
 			// If they *can* reply?
500
-			if ($post['can_reply'])
501
-				echo '
527
+			if ($post['can_reply']) {
528
+							echo '
502 529
 						<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
530
+			}
503 531
 
504 532
 			// If they *can* quote?
505
-			if ($post['can_quote'])
506
-				echo '
533
+			if ($post['can_quote']) {
534
+							echo '
507 535
 						<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>';
536
+			}
508 537
 
509 538
 			// How about... even... remove it entirely?!
510
-			if ($post['can_delete'])
511
-				echo '
539
+			if ($post['can_delete']) {
540
+							echo '
512 541
 						<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>';
542
+			}
513 543
 
514
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
515
-				echo '
544
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
545
+							echo '
516 546
 					</ul>
517 547
 				</div>';
548
+			}
518 549
 
519 550
 			echo '
520 551
 			</div>';
521 552
 		}
553
+	} else {
554
+			template_show_list('attachments');
522 555
 	}
523
-	else
524
-		template_show_list('attachments');
525 556
 
526 557
 	// No posts? Just end with a informative message.
527
-	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
528
-		echo '
558
+	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) {
559
+			echo '
529 560
 			<div class="windowbg2">
530 561
 				', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
531 562
 			</div>';
563
+	}
532 564
 
533 565
 	// Show more page numbers.
534
-	if (!empty($context['page_index']))
535
-		echo '
566
+	if (!empty($context['page_index'])) {
567
+			echo '
536 568
 		<div class="pagesection">
537 569
 			<div class="pagelinks">', $context['page_index'], '</div>
538 570
 		</div>';
539
-}
571
+	}
572
+	}
540 573
 
541 574
 /**
542 575
  * Template for showing alerts within the alerts popup
@@ -546,11 +579,12 @@  discard block
 block discarded – undo
546 579
 	global $context, $txt, $scripturl;
547 580
 
548 581
 	// Do we have an update message?
549
-	if (!empty($context['update_message']))
550
-		echo '
582
+	if (!empty($context['update_message'])) {
583
+			echo '
551 584
 		<div class="infobox">
552 585
 			', $context['update_message'], '.
553 586
 		</div>';
587
+	}
554 588
 
555 589
 	echo '
556 590
 		<div class="cat_bar">
@@ -559,13 +593,12 @@  discard block
 block discarded – undo
559 593
 			</h3>
560 594
 		</div>';
561 595
 
562
-	if (empty($context['alerts']))
563
-		echo '
596
+	if (empty($context['alerts'])) {
597
+			echo '
564 598
 		<div class="information">
565 599
 			', $txt['alerts_none'], '
566 600
 		</div>';
567
-
568
-	else
601
+	} else
569 602
 	{
570 603
 		// Start the form.
571 604
 		echo '
@@ -627,12 +660,12 @@  discard block
 block discarded – undo
627 660
 		</div>' : '';
628 661
 
629 662
 	// No drafts? Just show an informative message.
630
-	if (empty($context['drafts']))
631
-		echo '
663
+	if (empty($context['drafts'])) {
664
+			echo '
632 665
 		<div class="windowbg2 centertext">
633 666
 			', $txt['draft_none'], '
634 667
 		</div>';
635
-	else
668
+	} else
636 669
 	{
637 670
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
638 671
 		foreach ($context['drafts'] as $draft)
@@ -643,11 +676,13 @@  discard block
 block discarded – undo
643 676
 					<div class="topic_details">
644 677
 						<h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
645 678
 
646
-			if (!empty($draft['sticky']))
647
-				echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
679
+			if (!empty($draft['sticky'])) {
680
+							echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
681
+			}
648 682
 
649
-			if (!empty($draft['locked']))
650
-				echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
683
+			if (!empty($draft['locked'])) {
684
+							echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
685
+			}
651 686
 
652 687
 			echo '
653 688
 						</h5>
@@ -680,12 +715,13 @@  discard block
 block discarded – undo
680 715
 {
681 716
 	global $context, $scripturl, $txt;
682 717
 
683
-	if (!empty($context['saved_successful']))
684
-		echo '
718
+	if (!empty($context['saved_successful'])) {
719
+			echo '
685 720
 					<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
686
-	elseif (!empty($context['saved_failed']))
687
-		echo '
721
+	} elseif (!empty($context['saved_failed'])) {
722
+			echo '
688 723
 					<div class="errorbox">', $context['saved_failed'], '</div>';
724
+	}
689 725
 
690 726
 	echo '
691 727
 	<div id="edit_buddies">
@@ -699,24 +735,27 @@  discard block
 block discarded – undo
699 735
 				<th scope="col" class="quarter_table">', $txt['name'], '</th>
700 736
 				<th scope="col">', $txt['status'], '</th>';
701 737
 
702
-	if (allowedTo('moderate_forum'))
703
-		echo '
738
+	if (allowedTo('moderate_forum')) {
739
+			echo '
704 740
 				<th scope="col">', $txt['email'], '</th>';
741
+	}
705 742
 
706
-	if (!empty($context['custom_pf']))
707
-		foreach ($context['custom_pf'] as $column)
743
+	if (!empty($context['custom_pf'])) {
744
+			foreach ($context['custom_pf'] as $column)
708 745
 				echo '<th scope="col">', $column['label'], '</th>';
746
+	}
709 747
 
710 748
 	echo '
711 749
 				<th scope="col">', $txt['remove'], '</th>
712 750
 			</tr>';
713 751
 
714 752
 	// If they don't have any buddies don't list them!
715
-	if (empty($context['buddies']))
716
-		echo '
753
+	if (empty($context['buddies'])) {
754
+			echo '
717 755
 			<tr class="windowbg">
718 756
 				<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"><strong>', $txt['no_buddies'], '</strong></td>
719 757
 			</tr>';
758
+	}
720 759
 
721 760
 		// Now loop through each buddy showing info on each.
722 761
 	else
@@ -728,15 +767,17 @@  discard block
 block discarded – undo
728 767
 					<td>', $buddy['link'], '</td>
729 768
 					<td><a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a></td>';
730 769
 
731
-			if ($buddy['show_email'])
732
-				echo '
770
+			if ($buddy['show_email']) {
771
+							echo '
733 772
 					<td><a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a></td>';
773
+			}
734 774
 
735 775
 			// Show the custom profile fields for this user.
736
-			if (!empty($context['custom_pf']))
737
-				foreach ($context['custom_pf'] as $key => $column)
776
+			if (!empty($context['custom_pf'])) {
777
+							foreach ($context['custom_pf'] as $key => $column)
738 778
 					echo '
739 779
 						<td class="lefttext">', $buddy['options'][$key], '</td>';
780
+			}
740 781
 
741 782
 			echo '
742 783
 					<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>
@@ -766,9 +807,10 @@  discard block
 block discarded – undo
766 807
 			</dl>
767 808
 		</div>';
768 809
 
769
-	if (!empty($context['token_check']))
770
-		echo '
810
+	if (!empty($context['token_check'])) {
811
+			echo '
771 812
 			<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
813
+	}
772 814
 
773 815
 	echo '
774 816
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -794,12 +836,13 @@  discard block
 block discarded – undo
794 836
 {
795 837
 	global $context, $scripturl, $txt;
796 838
 
797
-	if (!empty($context['saved_successful']))
798
-		echo '
839
+	if (!empty($context['saved_successful'])) {
840
+			echo '
799 841
 					<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
800
-	elseif (!empty($context['saved_failed']))
801
-		echo '
842
+	} elseif (!empty($context['saved_failed'])) {
843
+			echo '
802 844
 					<div class="errorbox">', $context['saved_failed'], '</div>';
845
+	}
803 846
 
804 847
 	echo '
805 848
 	<div id="edit_buddies">
@@ -813,20 +856,22 @@  discard block
 block discarded – undo
813 856
 				<th scope="col" class="quarter_table">', $txt['name'], '</th>
814 857
 				<th scope="col">', $txt['status'], '</th>';
815 858
 
816
-	if (allowedTo('moderate_forum'))
817
-		echo '
859
+	if (allowedTo('moderate_forum')) {
860
+			echo '
818 861
 				<th scope="col">', $txt['email'], '</th>';
862
+	}
819 863
 
820 864
 	echo '
821 865
 				<th scope="col">', $txt['ignore_remove'], '</th>
822 866
 			</tr>';
823 867
 
824 868
 	// If they don't have anyone on their ignore list, don't list it!
825
-	if (empty($context['ignore_list']))
826
-		echo '
869
+	if (empty($context['ignore_list'])) {
870
+			echo '
827 871
 			<tr class="windowbg">
828 872
 				<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"><strong>', $txt['no_ignore'], '</strong></td>
829 873
 			</tr>';
874
+	}
830 875
 
831 876
 	// Now loop through each buddy showing info on each.
832 877
 	foreach ($context['ignore_list'] as $member)
@@ -836,9 +881,10 @@  discard block
 block discarded – undo
836 881
 				<td>', $member['link'], '</td>
837 882
 				<td><a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a></td>';
838 883
 
839
-		if ($member['show_email'])
840
-			echo '
884
+		if ($member['show_email']) {
885
+					echo '
841 886
 				<td><a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a></td>';
887
+		}
842 888
 		echo '
843 889
 				<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>
844 890
 			</tr>';
@@ -865,9 +911,10 @@  discard block
 block discarded – undo
865 911
 			</dl>
866 912
 		</div>';
867 913
 
868
-	if (!empty($context['token_check']))
869
-		echo '
914
+	if (!empty($context['token_check'])) {
915
+			echo '
870 916
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
917
+	}
871 918
 
872 919
 	echo '
873 920
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -912,9 +959,10 @@  discard block
 block discarded – undo
912 959
 					<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
913 960
 
914 961
 	// Second address detected?
915
-	if (!empty($context['last_ip2']))
916
-		echo '
962
+	if (!empty($context['last_ip2'])) {
963
+			echo '
917 964
 					, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
965
+	}
918 966
 
919 967
 	echo '
920 968
 				</dd>';
@@ -979,9 +1027,10 @@  discard block
 block discarded – undo
979 1027
 				<h3 class="catbg">', $txt['whois_title'], ' ', $context['ip'], '</h3>
980 1028
 			</div>
981 1029
 			<div class="windowbg2 noup">';
982
-			foreach ($context['whois_servers'] as $server)
983
-			echo '
1030
+			foreach ($context['whois_servers'] as $server) {
1031
+						echo '
984 1032
 				<a href="', $server['url'], '" target="_blank" class="new_win"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>';
1033
+			}
985 1034
 			echo '
986 1035
 			</div>
987 1036
 			<br>';
@@ -992,10 +1041,10 @@  discard block
 block discarded – undo
992 1041
 		<div class="cat_bar">
993 1042
 			<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
994 1043
 		</div>';
995
-	if (empty($context['ips']))
996
-		echo '
1044
+	if (empty($context['ips'])) {
1045
+			echo '
997 1046
 		<p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>';
998
-	else
1047
+	} else
999 1048
 	{
1000 1049
 		echo '
1001 1050
 		<table class="table_grid">
@@ -1008,12 +1057,13 @@  discard block
 block discarded – undo
1008 1057
 			<tbody>';
1009 1058
 
1010 1059
 		// Loop through each of the members and display them.
1011
-		foreach ($context['ips'] as $ip => $memberlist)
1012
-			echo '
1060
+		foreach ($context['ips'] as $ip => $memberlist) {
1061
+					echo '
1013 1062
 				<tr class="windowbg">
1014 1063
 					<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
1015 1064
 					<td>', implode(', ', $memberlist), '</td>
1016 1065
 				</tr>';
1066
+		}
1017 1067
 
1018 1068
 		echo '
1019 1069
 			</tbody>
@@ -1059,8 +1109,7 @@  discard block
 block discarded – undo
1059 1109
 	{
1060 1110
 		echo '
1061 1111
 		<div class="information">', $txt['showPermissions_all'], '</div>';
1062
-	}
1063
-	else
1112
+	} else
1064 1113
 	{
1065 1114
 		echo '
1066 1115
 		<div class="information">',$txt['showPermissions_help'], '</div>
@@ -1074,9 +1123,10 @@  discard block
 block discarded – undo
1074 1123
 				</div>
1075 1124
 				<div class="windowbg smalltext">
1076 1125
 					', $txt['showPermissions_restricted_boards_desc'], ':<br>';
1077
-				foreach ($context['no_access_boards'] as $no_access_board)
1078
-					echo '
1126
+				foreach ($context['no_access_boards'] as $no_access_board) {
1127
+									echo '
1079 1128
 						<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
1129
+				}
1080 1130
 				echo '
1081 1131
 				</div>';
1082 1132
 		}
@@ -1108,12 +1158,13 @@  discard block
 block discarded – undo
1108 1158
 								</td>
1109 1159
 								<td class="smalltext">';
1110 1160
 
1111
-				if ($permission['is_denied'])
1112
-					echo '
1161
+				if ($permission['is_denied']) {
1162
+									echo '
1113 1163
 									<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1114
-				else
1115
-					echo '
1164
+				} else {
1165
+									echo '
1116 1166
 									', $txt['showPermissions_given'], ':&nbsp;', implode(', ', $permission['groups']['allowed']);
1167
+				}
1117 1168
 
1118 1169
 					echo '
1119 1170
 								</td>
@@ -1123,10 +1174,10 @@  discard block
 block discarded – undo
1123 1174
 						</tbody>
1124 1175
 					</table>
1125 1176
 				</div><br>';
1126
-		}
1127
-		else
1128
-			echo '
1177
+		} else {
1178
+					echo '
1129 1179
 			<p class="windowbg2">', $txt['showPermissions_none_general'], '</p>';
1180
+		}
1130 1181
 
1131 1182
 		// Board permission section.
1132 1183
 		echo '
@@ -1136,14 +1187,16 @@  discard block
 block discarded – undo
1136 1187
 						<a id="board_permissions"></a>', $txt['showPermissions_select'], ':
1137 1188
 						<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
1138 1189
 							<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '&nbsp;</option>';
1139
-				if (!empty($context['boards']))
1140
-					echo '
1190
+				if (!empty($context['boards'])) {
1191
+									echo '
1141 1192
 							<option value="" disabled>---------------------------</option>';
1193
+				}
1142 1194
 
1143 1195
 				// Fill the box with any local permission boards.
1144
-				foreach ($context['boards'] as $board)
1145
-					echo '
1196
+				foreach ($context['boards'] as $board) {
1197
+									echo '
1146 1198
 							<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
1199
+				}
1147 1200
 
1148 1201
 				echo '
1149 1202
 						</select>
@@ -1174,8 +1227,7 @@  discard block
 block discarded – undo
1174 1227
 				{
1175 1228
 					echo '
1176 1229
 							<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1177
-				}
1178
-				else
1230
+				} else
1179 1231
 				{
1180 1232
 					echo '
1181 1233
 							', $txt['showPermissions_given'], ': &nbsp;', implode(', ', $permission['groups']['allowed']);
@@ -1187,10 +1239,10 @@  discard block
 block discarded – undo
1187 1239
 			echo '
1188 1240
 				</tbody>
1189 1241
 			</table>';
1190
-		}
1191
-		else
1192
-			echo '
1242
+		} else {
1243
+					echo '
1193 1244
 			<p class="windowbg2">', $txt['showPermissions_none_board'], '</p>';
1245
+		}
1194 1246
 	echo '
1195 1247
 			</div>
1196 1248
 		</div>';
@@ -1232,9 +1284,10 @@  discard block
 block discarded – undo
1232 1284
 			</div>';
1233 1285
 
1234 1286
 	// If they haven't post at all, don't draw the graph.
1235
-	if (empty($context['posts_by_time']))
1236
-		echo '
1287
+	if (empty($context['posts_by_time'])) {
1288
+			echo '
1237 1289
 			<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1290
+	}
1238 1291
 	// Otherwise do!
1239 1292
 	else
1240 1293
 	{
@@ -1273,11 +1326,10 @@  discard block
 block discarded – undo
1273 1326
 					</h3>
1274 1327
 				</div>';
1275 1328
 
1276
-	if (empty($context['popular_boards']))
1277
-		echo '
1329
+	if (empty($context['popular_boards'])) {
1330
+			echo '
1278 1331
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1279
-
1280
-	else
1332
+	} else
1281 1333
 	{
1282 1334
 		echo '
1283 1335
 				<dl class="stats">';
@@ -1308,10 +1360,10 @@  discard block
 block discarded – undo
1308 1360
 					</h3>
1309 1361
 				</div>';
1310 1362
 
1311
-	if (empty($context['board_activity']))
1312
-		echo '
1363
+	if (empty($context['board_activity'])) {
1364
+			echo '
1313 1365
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1314
-	else
1366
+	} else
1315 1367
 	{
1316 1368
 		echo '
1317 1369
 				<dl class="stats">';
@@ -1359,41 +1411,46 @@  discard block
 block discarded – undo
1359 1411
 				<h3 class="catbg profile_hd">';
1360 1412
 
1361 1413
 		// Don't say "Profile" if this isn't the profile...
1362
-		if (!empty($context['profile_header_text']))
1363
-			echo '
1414
+		if (!empty($context['profile_header_text'])) {
1415
+					echo '
1364 1416
 					', $context['profile_header_text'];
1365
-		else
1366
-			echo '
1417
+		} else {
1418
+					echo '
1367 1419
 					', $txt['profile'];
1420
+		}
1368 1421
 
1369 1422
 		echo '
1370 1423
 				</h3>
1371 1424
 			</div>';
1372 1425
 
1373 1426
 	// Have we some description?
1374
-	if ($context['page_desc'])
1375
-		echo '
1427
+	if ($context['page_desc']) {
1428
+			echo '
1376 1429
 			<p class="information">', $context['page_desc'], '</p>';
1430
+	}
1377 1431
 
1378 1432
 	echo '
1379 1433
 			<div class="roundframe">';
1380 1434
 
1381 1435
 	// Any bits at the start?
1382
-	if (!empty($context['profile_prehtml']))
1383
-		echo '
1436
+	if (!empty($context['profile_prehtml'])) {
1437
+			echo '
1384 1438
 				<div>', $context['profile_prehtml'], '</div>';
1439
+	}
1385 1440
 
1386
-	if (!empty($context['profile_fields']))
1387
-		echo '
1441
+	if (!empty($context['profile_fields'])) {
1442
+			echo '
1388 1443
 				<dl class="settings">';
1444
+	}
1389 1445
 
1390 1446
 	// Start the big old loop 'of love.
1391 1447
 	$lastItem = 'hr';
1392 1448
 	foreach ($context['profile_fields'] as $key => $field)
1393 1449
 	{
1394 1450
 		// We add a little hack to be sure we never get more than one hr in a row!
1395
-		if ($lastItem == 'hr' && $field['type'] == 'hr')
1396
-			continue;
1451
+		if ($lastItem == 'hr' && $field['type'] == 'hr') {
1452
+					continue;
1453
+		}
1397 1454
 
1398 1455
 		$lastItem = $field['type'];
1399 1456
 		if ($field['type'] == 'hr')
@@ -1402,48 +1459,50 @@  discard block
 block discarded – undo
1402 1459
 				</dl>
1403 1460
 				<hr>
1404 1461
 				<dl class="settings">';
1405
-		}
1406
-		elseif ($field['type'] == 'callback')
1462
+		} elseif ($field['type'] == 'callback')
1407 1463
 		{
1408 1464
 			if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
1409 1465
 			{
1410 1466
 				$callback_func = 'template_profile_' . $field['callback_func'];
1411 1467
 				$callback_func();
1412 1468
 			}
1413
-		}
1414
-		else
1469
+		} else
1415 1470
 		{
1416 1471
 			echo '
1417 1472
 					<dt>
1418 1473
 						<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
1419 1474
 
1420 1475
 			// Does it have any subtext to show?
1421
-			if (!empty($field['subtext']))
1422
-				echo '
1476
+			if (!empty($field['subtext'])) {
1477
+							echo '
1423 1478
 						<br>
1424 1479
 						<span class="smalltext">', $field['subtext'], '</span>';
1480
+			}
1425 1481
 
1426 1482
 			echo '
1427 1483
 					</dt>
1428 1484
 					<dd>';
1429 1485
 
1430 1486
 			// Want to put something infront of the box?
1431
-			if (!empty($field['preinput']))
1432
-				echo '
1487
+			if (!empty($field['preinput'])) {
1488
+							echo '
1433 1489
 						', $field['preinput'];
1490
+			}
1434 1491
 
1435 1492
 			// What type of data are we showing?
1436
-			if ($field['type'] == 'label')
1437
-				echo '
1493
+			if ($field['type'] == 'label') {
1494
+							echo '
1438 1495
 						', $field['value'];
1496
+			}
1439 1497
 
1440 1498
 			// Maybe it's a text box - very likely!
1441 1499
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url')))
1442 1500
 			{
1443
-				if ($field['type'] == 'int' || $field['type'] == 'float')
1444
-					$type = 'number';
1445
-				else
1446
-					$type = $field['type'];
1501
+				if ($field['type'] == 'int' || $field['type'] == 'float') {
1502
+									$type = 'number';
1503
+				} else {
1504
+									$type = $field['type'];
1505
+				}
1447 1506
 				$step = $field['type'] == 'float' ? ' step="0.1"' : '';
1448 1507
 
1449 1508
 
@@ -1451,9 +1510,10 @@  discard block
 block discarded – undo
1451 1510
 						<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '"', $step, '>';
1452 1511
 			}
1453 1512
 			// You "checking" me out? ;)
1454
-			elseif ($field['type'] == 'check')
1455
-				echo '
1513
+			elseif ($field['type'] == 'check') {
1514
+							echo '
1456 1515
 						<input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" class="input_check" ', $field['input_attr'], '>';
1516
+			}
1457 1517
 
1458 1518
 			// Always fun - select boxes!
1459 1519
 			elseif ($field['type'] == 'select')
@@ -1464,13 +1524,15 @@  discard block
 block discarded – undo
1464 1524
 				if (isset($field['options']))
1465 1525
 				{
1466 1526
 					// Is this some code to generate the options?
1467
-					if (!is_array($field['options']))
1468
-						$field['options'] = $field['options']();
1527
+					if (!is_array($field['options'])) {
1528
+											$field['options'] = $field['options']();
1529
+					}
1469 1530
 					// Assuming we now have some!
1470
-					if (is_array($field['options']))
1471
-						foreach ($field['options'] as $value => $name)
1531
+					if (is_array($field['options'])) {
1532
+											foreach ($field['options'] as $value => $name)
1472 1533
 							echo '
1473 1534
 								<option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>';
1535
+					}
1474 1536
 				}
1475 1537
 
1476 1538
 				echo '
@@ -1478,25 +1540,28 @@  discard block
 block discarded – undo
1478 1540
 			}
1479 1541
 
1480 1542
 			// Something to end with?
1481
-			if (!empty($field['postinput']))
1482
-				echo '
1543
+			if (!empty($field['postinput'])) {
1544
+							echo '
1483 1545
 							', $field['postinput'];
1546
+			}
1484 1547
 
1485 1548
 			echo '
1486 1549
 					</dd>';
1487 1550
 		}
1488 1551
 	}
1489 1552
 
1490
-	if (!empty($context['profile_fields']))
1491
-		echo '
1553
+	if (!empty($context['profile_fields'])) {
1554
+			echo '
1492 1555
 				</dl>';
1556
+	}
1493 1557
 
1494 1558
 	// Are there any custom profile fields - if so print them!
1495 1559
 	if (!empty($context['custom_fields']))
1496 1560
 	{
1497
-		if ($lastItem != 'hr')
1498
-			echo '
1561
+		if ($lastItem != 'hr') {
1562
+					echo '
1499 1563
 				<hr>';
1564
+		}
1500 1565
 
1501 1566
 		echo '
1502 1567
 				<dl class="settings">';
@@ -1519,13 +1584,14 @@  discard block
 block discarded – undo
1519 1584
 	}
1520 1585
 
1521 1586
 	// Any closing HTML?
1522
-	if (!empty($context['profile_posthtml']))
1523
-		echo '
1587
+	if (!empty($context['profile_posthtml'])) {
1588
+			echo '
1524 1589
 				<div>', $context['profile_posthtml'], '</div>';
1590
+	}
1525 1591
 
1526 1592
 	// Only show the password box if it's actually needed.
1527
-	if ($context['require_password'])
1528
-		echo '
1593
+	if ($context['require_password']) {
1594
+			echo '
1529 1595
 				<dl class="settings">
1530 1596
 					<dt>
1531 1597
 						<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br>
@@ -1535,18 +1601,21 @@  discard block
 block discarded – undo
1535 1601
 						<input type="password" name="oldpasswrd" id="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password">
1536 1602
 					</dd>
1537 1603
 				</dl>';
1604
+	}
1538 1605
 
1539 1606
 	// The button shouldn't say "Change profile" unless we're changing the profile...
1540
-	if (!empty($context['submit_button_text']))
1541
-		echo '
1607
+	if (!empty($context['submit_button_text'])) {
1608
+			echo '
1542 1609
 				<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button_submit">';
1543
-	else
1544
-		echo '
1610
+	} else {
1611
+			echo '
1545 1612
 				<input type="submit" name="save" value="', $txt['change_profile'], '" class="button_submit">';
1613
+	}
1546 1614
 
1547
-	if (!empty($context['token_check']))
1548
-		echo '
1615
+	if (!empty($context['token_check'])) {
1616
+			echo '
1549 1617
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1618
+	}
1550 1619
 
1551 1620
 	echo '
1552 1621
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1556,10 +1625,11 @@  discard block
 block discarded – undo
1556 1625
 		</form>';
1557 1626
 
1558 1627
 	// Any final spellchecking stuff?
1559
-	if (!empty($context['show_spellchecking']))
1560
-		echo '
1628
+	if (!empty($context['show_spellchecking'])) {
1629
+			echo '
1561 1630
 		<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>';
1562
-}
1631
+	}
1632
+	}
1563 1633
 
1564 1634
 /**
1565 1635
  * Personal Message settings.
@@ -1596,10 +1666,11 @@  discard block
 block discarded – undo
1596 1666
 										<select name="pm_receive_from" id="pm_receive_from">
1597 1667
 												<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
1598 1668
 
1599
-	if (!empty($modSettings['enable_buddylist']))
1600
-		echo '
1669
+	if (!empty($modSettings['enable_buddylist'])) {
1670
+			echo '
1601 1671
 												<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
1602 1672
 												<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
1673
+	}
1603 1674
 
1604 1675
 	echo '
1605 1676
 												<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
@@ -1641,11 +1712,12 @@  discard block
 block discarded – undo
1641 1712
 		if (empty($setting) || !is_array($setting))
1642 1713
 		{
1643 1714
 			// Insert a separator (unless this is the first item in the list)
1644
-			if ($i !== $first_option_key)
1645
-				echo '
1715
+			if ($i !== $first_option_key) {
1716
+							echo '
1646 1717
 				</dl>
1647 1718
 				<hr>
1648 1719
 				<dl class="settings">';
1720
+			}
1649 1721
 
1650 1722
 			// Should we give a name to this section?
1651 1723
 			if (is_string($setting) && !empty($setting))
@@ -1653,48 +1725,52 @@  discard block
 block discarded – undo
1653 1725
 				$titled_section = true;
1654 1726
 				echo '
1655 1727
 					<dt><b>' . $setting . '</b></dt><dd></dd>';
1728
+			} else {
1729
+							$titled_section = false;
1656 1730
 			}
1657
-			else
1658
-				$titled_section = false;
1659 1731
 
1660 1732
 			continue;
1661 1733
 		}
1662 1734
 
1663 1735
 		// Is this disabled?
1664
-		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
1665
-			continue;
1666
-		elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
1667
-			continue;
1668
-		elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
1669
-			continue;
1670
-		elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
1671
-			continue;
1672
-		elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
1673
-			continue;
1674
-		elseif ($setting['id'] == 'topics_per_page' && !empty($modSettings['disableCustomPerPage']))
1675
-			continue;
1676
-		elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1677
-			continue;
1678
-		elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1679
-			continue;
1736
+		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) {
1737
+					continue;
1738
+		} elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) {
1739
+					continue;
1740
+		} elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) {
1741
+					continue;
1742
+		} elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) {
1743
+					continue;
1744
+		} elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) {
1745
+					continue;
1746
+		} elseif ($setting['id'] == 'topics_per_page' && !empty($modSettings['disableCustomPerPage'])) {
1747
+					continue;
1748
+		} elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1749
+					continue;
1750
+		} elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1751
+					continue;
1752
+		}
1680 1753
 
1681
-		if (!isset($setting['type']) || $setting['type'] == 'bool')
1682
-			$setting['type'] = 'checkbox';
1683
-		elseif ($setting['type'] == 'int' || $setting['type'] == 'integer')
1684
-			$setting['type'] = 'number';
1685
-		elseif ($setting['type'] == 'string')
1686
-			$setting['type'] = 'text';
1754
+		if (!isset($setting['type']) || $setting['type'] == 'bool') {
1755
+					$setting['type'] = 'checkbox';
1756
+		} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
1757
+					$setting['type'] = 'number';
1758
+		} elseif ($setting['type'] == 'string') {
1759
+					$setting['type'] = 'text';
1760
+		}
1687 1761
 
1688
-		if (isset($setting['options']))
1689
-			$setting['type'] = 'list';
1762
+		if (isset($setting['options'])) {
1763
+					$setting['type'] = 'list';
1764
+		}
1690 1765
 
1691 1766
 		echo '
1692 1767
 					<dt>
1693 1768
 						<label for="', $setting['id'], '">', !$titled_section ? '<b>' : '', $setting['label'], !$titled_section ? '</b>' : '', '</label>';
1694 1769
 
1695
-		if (isset($setting['description']))
1696
-			echo '
1770
+		if (isset($setting['description'])) {
1771
+					echo '
1697 1772
 						<br><span class="smalltext">', $setting['description'], '</span>';
1773
+		}
1698 1774
 		echo '
1699 1775
 					</dt>
1700 1776
 					<dd>';
@@ -1732,13 +1808,11 @@  discard block
 block discarded – undo
1732 1808
 
1733 1809
 				echo '
1734 1810
 						<input type="number"', $min . $max . $step;
1735
-			}
1736
-			else if (isset($setting['type']) && $setting['type'] == 'url')
1811
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
1737 1812
 			{
1738 1813
 				echo'
1739 1814
 						<input type="url"';
1740
-			}
1741
-			else
1815
+			} else
1742 1816
 			{
1743 1817
 				echo '
1744 1818
 						<input type="text"';
@@ -1777,8 +1851,8 @@  discard block
 block discarded – undo
1777 1851
 				<dl class="settings">';
1778 1852
 
1779 1853
 	// Allow notification on announcements to be disabled?
1780
-	if (!empty($modSettings['allow_disableAnnounce']))
1781
-		echo '
1854
+	if (!empty($modSettings['allow_disableAnnounce'])) {
1855
+			echo '
1782 1856
 					<dt>
1783 1857
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
1784 1858
 					</dt>
@@ -1786,9 +1860,10 @@  discard block
 block discarded – undo
1786 1860
 						<input type="hidden" name="notify_announcements" value="0">
1787 1861
 						<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', ' class="input_check">
1788 1862
 					</dd>';
1863
+	}
1789 1864
 
1790
-	if (!empty($modSettings['enable_ajax_alerts']))
1791
-		echo '
1865
+	if (!empty($modSettings['enable_ajax_alerts'])) {
1866
+			echo '
1792 1867
 					<dt>
1793 1868
 						<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label>
1794 1869
 					</dt>
@@ -1796,6 +1871,7 @@  discard block
 block discarded – undo
1796 1871
 						<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '" class="input_text">
1797 1872
 					</dd>
1798 1873
 		';
1874
+	}
1799 1875
 
1800 1876
 	echo '
1801 1877
 				</dl>
@@ -1825,9 +1901,10 @@  discard block
 block discarded – undo
1825 1901
 					<td colspan="3">';
1826 1902
 				$label = $txt['alert_opt_' . $opts[1]];
1827 1903
 				$label_pos = isset($opts['label']) ? $opts['label'] : '';
1828
-				if ($label_pos == 'before')
1829
-					echo '
1904
+				if ($label_pos == 'before') {
1905
+									echo '
1830 1906
 					<label for="opt_', $opts[1], '">', $label, '</label>';
1907
+				}
1831 1908
 
1832 1909
 				$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
1833 1910
 				switch ($opts[0])
@@ -1839,17 +1916,19 @@  discard block
 block discarded – undo
1839 1916
 					case 'select':
1840 1917
 						echo '
1841 1918
 						<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
1842
-						foreach ($opts['opts'] as $k => $v)
1843
-							echo '
1919
+						foreach ($opts['opts'] as $k => $v) {
1920
+													echo '
1844 1921
 							<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
1922
+						}
1845 1923
 						echo '
1846 1924
 						</select>';
1847 1925
 						break;
1848 1926
 				}
1849 1927
 
1850
-				if ($label_pos == 'after')
1851
-					echo '
1928
+				if ($label_pos == 'after') {
1929
+									echo '
1852 1930
 					<label for="opt_', $opts[1], '">', $label, '</label>';
1931
+				}
1853 1932
 
1854 1933
 				echo '
1855 1934
 					</td>
@@ -1963,11 +2042,12 @@  discard block
 block discarded – undo
1963 2042
 			<p class="information">', $txt['groupMembership_info'], '</p>';
1964 2043
 
1965 2044
 	// Do we have an update message?
1966
-	if (!empty($context['update_message']))
1967
-		echo '
2045
+	if (!empty($context['update_message'])) {
2046
+			echo '
1968 2047
 			<div class="infobox">
1969 2048
 				', $context['update_message'], '.
1970 2049
 			</div>';
2050
+	}
1971 2051
 
1972 2052
 	echo '
1973 2053
 		<div id="groups">';
@@ -1989,8 +2069,7 @@  discard block
 block discarded – undo
1989 2069
 					</div>
1990 2070
 				</div>
1991 2071
 			</div>';
1992
-	}
1993
-	else
2072
+	} else
1994 2073
 	{
1995 2074
 		echo '
1996 2075
 			<div class="title_bar">
@@ -2002,27 +2081,30 @@  discard block
 block discarded – undo
2002 2081
 			echo '
2003 2082
 					<div class="windowbg" id="primdiv_', $group['id'], '">';
2004 2083
 
2005
-				if ($context['can_edit_primary'])
2006
-					echo '
2084
+				if ($context['can_edit_primary']) {
2085
+									echo '
2007 2086
 						<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', ' class="input_radio">';
2087
+				}
2008 2088
 
2009 2089
 				echo '
2010 2090
 						<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>';
2011 2091
 
2012 2092
 				// Can they leave their group?
2013
-				if ($group['can_leave'])
2014
-					echo '
2093
+				if ($group['can_leave']) {
2094
+									echo '
2015 2095
 						<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>';
2096
+				}
2016 2097
 
2017 2098
 				echo '
2018 2099
 					</div>';
2019 2100
 		}
2020 2101
 
2021
-		if ($context['can_edit_primary'])
2022
-			echo '
2102
+		if ($context['can_edit_primary']) {
2103
+					echo '
2023 2104
 			<div class="padding righttext">
2024 2105
 				<input type="submit" value="', $txt['make_primary'], '" class="button_submit">
2025 2106
 			</div>';
2107
+		}
2026 2108
 
2027 2109
 		// Any groups they can join?
2028 2110
 		if (!empty($context['groups']['available']))
@@ -2038,15 +2120,16 @@  discard block
 block discarded – undo
2038 2120
 					<div class="windowbg">
2039 2121
 						<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>' : ''), '';
2040 2122
 
2041
-				if ($group['type'] == 3)
2042
-					echo '
2123
+				if ($group['type'] == 3) {
2124
+									echo '
2043 2125
 						<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>';
2044
-				elseif ($group['type'] == 2 && $group['pending'])
2045
-					echo '
2126
+				} elseif ($group['type'] == 2 && $group['pending']) {
2127
+									echo '
2046 2128
 						<span class="floatright">', $txt['approval_pending'], '</span>';
2047
-				elseif ($group['type'] == 2)
2048
-					echo '
2129
+				} elseif ($group['type'] == 2) {
2130
+									echo '
2049 2131
 						<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>';
2132
+				}
2050 2133
 
2051 2134
 				echo '
2052 2135
 					</div>';
@@ -2069,9 +2152,10 @@  discard block
 block discarded – undo
2069 2152
 
2070 2153
 			prevDiv.className = "windowbg";
2071 2154
 		}';
2072
-		if (isset($context['groups']['member'][$context['primary_group']]))
2073
-			echo '
2155
+		if (isset($context['groups']['member'][$context['primary_group']])) {
2156
+					echo '
2074 2157
 		highlightSelected("primdiv_' . $context['primary_group'] . '");';
2158
+		}
2075 2159
 		echo '
2076 2160
 	</script>';
2077 2161
 	}
@@ -2079,9 +2163,10 @@  discard block
 block discarded – undo
2079 2163
 	echo '
2080 2164
 		</div>';
2081 2165
 
2082
-	if (!empty($context['token_check']))
2083
-		echo '
2166
+	if (!empty($context['token_check'])) {
2167
+			echo '
2084 2168
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2169
+	}
2085 2170
 
2086 2171
 	echo '
2087 2172
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2128,14 +2213,15 @@  discard block
 block discarded – undo
2128 2213
 
2129 2214
 		foreach ($category['boards'] as $board)
2130 2215
 		{
2131
-			if ($i == $limit)
2132
-				echo '
2216
+			if ($i == $limit) {
2217
+							echo '
2133 2218
 						</ul>
2134 2219
 					</li>
2135 2220
 				</ul>
2136 2221
 				<ul class="ignoreboards floatright">
2137 2222
 					<li class="category">
2138 2223
 						<ul>';
2224
+			}
2139 2225
 
2140 2226
 			echo '
2141 2227
 							<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
@@ -2181,10 +2267,11 @@  discard block
 block discarded – undo
2181 2267
 
2182 2268
 	// Work out the starting color.
2183 2269
 	$context['current_color'] = $context['colors'][0];
2184
-	foreach ($context['colors'] as $limit => $color)
2185
-		if ($context['member']['warning'] >= $limit)
2270
+	foreach ($context['colors'] as $limit => $color) {
2271
+			if ($context['member']['warning'] >= $limit)
2186 2272
 			$context['current_color'] = $color;
2187
-}
2273
+	}
2274
+	}
2188 2275
 
2189 2276
 // Show all warnings of a user?
2190 2277
 function template_viewWarning()
@@ -2223,14 +2310,15 @@  discard block
 block discarded – undo
2223 2310
 				</dd>';
2224 2311
 
2225 2312
 		// There's some impact of this?
2226
-		if (!empty($context['level_effects'][$context['current_level']]))
2227
-			echo '
2313
+		if (!empty($context['level_effects'][$context['current_level']])) {
2314
+					echo '
2228 2315
 				<dt>
2229 2316
 					<strong>', $txt['profile_viewwarning_impact'], ':</strong>
2230 2317
 				</dt>
2231 2318
 				<dd>
2232 2319
 					', $context['level_effects'][$context['current_level']], '
2233 2320
 				</dd>';
2321
+		}
2234 2322
 
2235 2323
 		echo '
2236 2324
 			</dl>
@@ -2268,10 +2356,11 @@  discard block
 block discarded – undo
2268 2356
 
2269 2357
 			// Otherwise see what we can do...';
2270 2358
 
2271
-	foreach ($context['notification_templates'] as $k => $type)
2272
-		echo '
2359
+	foreach ($context['notification_templates'] as $k => $type) {
2360
+			echo '
2273 2361
 			if (index == ', $k, ')
2274 2362
 				document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
2363
+	}
2275 2364
 
2276 2365
 	echo '
2277 2366
 		}
@@ -2281,10 +2370,11 @@  discard block
 block discarded – undo
2281 2370
 			// Also set the right effect.
2282 2371
 			effectText = "";';
2283 2372
 
2284
-	foreach ($context['level_effects'] as $limit => $text)
2285
-		echo '
2373
+	foreach ($context['level_effects'] as $limit => $text) {
2374
+			echo '
2286 2375
 			if (slideAmount >= ', $limit, ')
2287 2376
 				effectText = "', $text, '";';
2377
+	}
2288 2378
 
2289 2379
 	echo '
2290 2380
 			setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\');
@@ -2299,31 +2389,34 @@  discard block
 block discarded – undo
2299 2389
 			</h3>
2300 2390
 		</div>';
2301 2391
 
2302
-	if (!$context['user']['is_owner'])
2303
-		echo '
2392
+	if (!$context['user']['is_owner']) {
2393
+			echo '
2304 2394
 		<p class="information">', $txt['profile_warning_desc'], '</p>';
2395
+	}
2305 2396
 
2306 2397
 	echo '
2307 2398
 		<div class="windowbg">
2308 2399
 			<dl class="settings">';
2309 2400
 
2310
-	if (!$context['user']['is_owner'])
2311
-		echo '
2401
+	if (!$context['user']['is_owner']) {
2402
+			echo '
2312 2403
 				<dt>
2313 2404
 					<strong>', $txt['profile_warning_name'], ':</strong>
2314 2405
 				</dt>
2315 2406
 				<dd>
2316 2407
 					<strong>', $context['member']['name'], '</strong>
2317 2408
 				</dd>';
2409
+	}
2318 2410
 
2319 2411
 	echo '
2320 2412
 				<dt>
2321 2413
 					<strong>', $txt['profile_warning_level'], ':</strong>';
2322 2414
 
2323 2415
 	// Is there only so much they can apply?
2324
-	if ($context['warning_limit'])
2325
-		echo '
2416
+	if ($context['warning_limit']) {
2417
+			echo '
2326 2418
 					<br><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
2419
+	}
2327 2420
 
2328 2421
 	echo '
2329 2422
 				</dt>
@@ -2376,9 +2469,10 @@  discard block
 block discarded – undo
2376 2469
 						<option value="-1">', $txt['profile_warning_notify_template'], '</option>
2377 2470
 						<option value="-1" disabled>------------------------------</option>';
2378 2471
 
2379
-		foreach ($context['notification_templates'] as $id_template => $template)
2380
-			echo '
2472
+		foreach ($context['notification_templates'] as $id_template => $template) {
2473
+					echo '
2381 2474
 						<option value="', $id_template, '">', $template['title'], '</option>';
2475
+		}
2382 2476
 
2383 2477
 		echo '
2384 2478
 					</select>
@@ -2390,9 +2484,10 @@  discard block
 block discarded – undo
2390 2484
 			</dl>
2391 2485
 			<div class="righttext">';
2392 2486
 
2393
-	if (!empty($context['token_check']))
2394
-		echo '
2487
+	if (!empty($context['token_check'])) {
2488
+			echo '
2395 2489
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2490
+	}
2396 2491
 
2397 2492
 	echo '
2398 2493
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2408,8 +2503,8 @@  discard block
 block discarded – undo
2408 2503
 	echo '
2409 2504
 	<script>';
2410 2505
 
2411
-	if (!$context['user']['is_owner'])
2412
-		echo '
2506
+	if (!$context['user']['is_owner']) {
2507
+			echo '
2413 2508
 		modifyWarnNotify();
2414 2509
 		$(document).ready(function() {
2415 2510
 			$("#preview_button").click(function() {
@@ -2448,6 +2543,7 @@  discard block
 block discarded – undo
2448 2543
 			});
2449 2544
 			return false;
2450 2545
 		}';
2546
+	}
2451 2547
 
2452 2548
 	echo '
2453 2549
 	</script>';
@@ -2470,16 +2566,18 @@  discard block
 block discarded – undo
2470 2566
 			</div>';
2471 2567
 
2472 2568
 	// If deleting another account give them a lovely info box.
2473
-	if (!$context['user']['is_owner'])
2474
-		echo '
2569
+	if (!$context['user']['is_owner']) {
2570
+			echo '
2475 2571
 			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2572
+	}
2476 2573
 	echo '
2477 2574
 			<div class="windowbg2">';
2478 2575
 
2479 2576
 	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2480
-	if ($context['needs_approval'])
2481
-		echo '
2577
+	if ($context['needs_approval']) {
2578
+			echo '
2482 2579
 				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2580
+	}
2483 2581
 
2484 2582
 	// If the user is deleting their own account warn them first - and require a password!
2485 2583
 	if ($context['user']['is_owner'])
@@ -2491,9 +2589,10 @@  discard block
 block discarded – undo
2491 2589
 					<input type="password" name="oldpasswrd" size="20" class="input_password">&nbsp;&nbsp;&nbsp;&nbsp;
2492 2590
 					<input type="submit" value="', $txt['yes'], '" class="button_submit">';
2493 2591
 
2494
-		if (!empty($context['token_check']))
2495
-			echo '
2592
+		if (!empty($context['token_check'])) {
2593
+					echo '
2496 2594
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2595
+		}
2497 2596
 
2498 2597
 		echo '
2499 2598
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2519,9 +2618,10 @@  discard block
 block discarded – undo
2519 2618
 						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2520 2619
 					</select>';
2521 2620
 
2522
-			if ($context['show_perma_delete'])
2523
-				echo '
2621
+			if ($context['show_perma_delete']) {
2622
+							echo '
2524 2623
 					<br><label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1" class="input_check">', $txt['deleteAccount_permanent'], ':</label>';
2624
+			}
2525 2625
 
2526 2626
 			echo '
2527 2627
 				</div>';
@@ -2534,9 +2634,10 @@  discard block
 block discarded – undo
2534 2634
 				<div>
2535 2635
 					<input type="submit" value="', $txt['delete'], '" class="button_submit">';
2536 2636
 
2537
-		if (!empty($context['token_check']))
2538
-			echo '
2637
+		if (!empty($context['token_check'])) {
2638
+					echo '
2539 2639
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2640
+		}
2540 2641
 
2541 2642
 		echo '
2542 2643
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2562,8 +2663,8 @@  discard block
 block discarded – undo
2562 2663
 					<hr>';
2563 2664
 
2564 2665
 	// Only show the password box if it's actually needed.
2565
-	if ($context['require_password'])
2566
-		echo '
2666
+	if ($context['require_password']) {
2667
+			echo '
2567 2668
 					<dl class="settings">
2568 2669
 						<dt>
2569 2670
 							<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
@@ -2573,13 +2674,15 @@  discard block
 block discarded – undo
2573 2674
 							<input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password">
2574 2675
 						</dd>
2575 2676
 					</dl>';
2677
+	}
2576 2678
 
2577 2679
 	echo '
2578 2680
 					<div class="righttext">';
2579 2681
 
2580
-		if (!empty($context['token_check']))
2581
-			echo '
2682
+		if (!empty($context['token_check'])) {
2683
+					echo '
2582 2684
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2685
+		}
2583 2686
 
2584 2687
 	echo '
2585 2688
 						<input type="submit" value="', $txt['change_profile'], '" class="button_submit">
@@ -2606,9 +2709,10 @@  discard block
 block discarded – undo
2606 2709
 			<ul id="list_errors">';
2607 2710
 
2608 2711
 		// Cycle through each error and display an error message.
2609
-		foreach ($context['post_errors'] as $error)
2610
-			echo '
2712
+		foreach ($context['post_errors'] as $error) {
2713
+					echo '
2611 2714
 				<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
2715
+		}
2612 2716
 
2613 2717
 		echo '
2614 2718
 			</ul>';
@@ -2634,12 +2738,13 @@  discard block
 block discarded – undo
2634 2738
 								<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;"' : ''), '>';
2635 2739
 
2636 2740
 		// Fill the select box with all primary member groups that can be assigned to a member.
2637
-		foreach ($context['member_groups'] as $member_group)
2638
-			if (!empty($member_group['can_be_primary']))
2741
+		foreach ($context['member_groups'] as $member_group) {
2742
+					if (!empty($member_group['can_be_primary']))
2639 2743
 				echo '
2640 2744
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
2641 2745
 										', $member_group['name'], '
2642 2746
 									</option>';
2747
+		}
2643 2748
 		echo '
2644 2749
 								</select>
2645 2750
 							</dd>
@@ -2651,10 +2756,11 @@  discard block
 block discarded – undo
2651 2756
 									<input type="hidden" name="additional_groups[]" value="0">';
2652 2757
 
2653 2758
 		// For each membergroup show a checkbox so members can be assigned to more than one group.
2654
-		foreach ($context['member_groups'] as $member_group)
2655
-			if ($member_group['can_be_additional'])
2759
+		foreach ($context['member_groups'] as $member_group) {
2760
+					if ($member_group['can_be_additional'])
2656 2761
 				echo '
2657 2762
 									<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' : '', ' class="input_check"> ', $member_group['name'], '</label><br>';
2763
+		}
2658 2764
 		echo '
2659 2765
 								</span>
2660 2766
 								<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>
@@ -2714,9 +2820,10 @@  discard block
 block discarded – undo
2714 2820
 								<span class="smalltext">', $txt['sig_info'], '</span><br>
2715 2821
 								<br>';
2716 2822
 
2717
-	if ($context['show_spellchecking'])
2718
-		echo '
2823
+	if ($context['show_spellchecking']) {
2824
+			echo '
2719 2825
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button_submit">';
2826
+	}
2720 2827
 
2721 2828
 		echo '
2722 2829
 							</dt>
@@ -2724,17 +2831,20 @@  discard block
 block discarded – undo
2724 2831
 								<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50" style="min-width: 50%; max-width: 99%;">', $context['member']['signature'], '</textarea><br>';
2725 2832
 
2726 2833
 	// If there is a limit at all!
2727
-	if (!empty($context['signature_limits']['max_length']))
2728
-		echo '
2834
+	if (!empty($context['signature_limits']['max_length'])) {
2835
+			echo '
2729 2836
 								<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
2837
+	}
2730 2838
 
2731
-	if (!empty($context['show_preview_button']))
2732
-		echo '
2839
+	if (!empty($context['show_preview_button'])) {
2840
+			echo '
2733 2841
 								<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button_submit">';
2842
+	}
2734 2843
 
2735
-	if ($context['signature_warning'])
2736
-		echo '
2844
+	if ($context['signature_warning']) {
2845
+			echo '
2737 2846
 								<span class="smalltext">', $context['signature_warning'], '</span>';
2847
+	}
2738 2848
 
2739 2849
 	// Some javascript used to count how many characters have been used so far in the signature.
2740 2850
 	echo '
@@ -2778,9 +2888,10 @@  discard block
 block discarded – undo
2778 2888
 									<div>
2779 2889
 										<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
2780 2890
 		// This lists all the file categories.
2781
-		foreach ($context['avatars'] as $avatar)
2782
-			echo '
2891
+		foreach ($context['avatars'] as $avatar) {
2892
+					echo '
2783 2893
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
2894
+		}
2784 2895
 		echo '
2785 2896
 										</select>
2786 2897
 									</div>
@@ -2835,16 +2946,17 @@  discard block
 block discarded – undo
2835 2946
 								<div id="avatar_gravatar">
2836 2947
 									<img src="' . $context['member']['avatar']['href'] . '" alt="" />';
2837 2948
 
2838
-		if (empty($modSettings['gravatarAllowExtraEmail']))
2839
-			echo '
2949
+		if (empty($modSettings['gravatarAllowExtraEmail'])) {
2950
+					echo '
2840 2951
 									<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>';
2841
-		else
2952
+		} else
2842 2953
 		{
2843 2954
 			// Depending on other stuff, the stored value here might have some odd things in it from other areas.
2844
-			if ($context['member']['avatar']['external'] == $context['member']['email'])
2845
-				$textbox_value = '';
2846
-			else
2847
-				$textbox_value = $context['member']['avatar']['external'];
2955
+			if ($context['member']['avatar']['external'] == $context['member']['email']) {
2956
+							$textbox_value = '';
2957
+			} else {
2958
+							$textbox_value = $context['member']['avatar']['external'];
2959
+			}
2848 2960
 
2849 2961
 			echo '
2850 2962
 									<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div>
@@ -2916,8 +3028,9 @@  discard block
 block discarded – undo
2916 3028
 	$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
2917 3029
 
2918 3030
 	$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
2919
-	if (empty($suffix))
2920
-		return;
3031
+	if (empty($suffix)) {
3032
+			return;
3033
+	}
2921 3034
 
2922 3035
 	echo '
2923 3036
 									<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
@@ -2939,9 +3052,10 @@  discard block
 block discarded – undo
2939 3052
 							<dd>
2940 3053
 								<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">';
2941 3054
 	// Help the user by showing a list of common time formats.
2942
-	foreach ($context['easy_timeformats'] as $time_format)
2943
-		echo '
3055
+	foreach ($context['easy_timeformats'] as $time_format) {
3056
+			echo '
2944 3057
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
3058
+	}
2945 3059
 	echo '
2946 3060
 								</select><br>
2947 3061
 								<input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30" class="input_text">
@@ -2977,9 +3091,10 @@  discard block
 block discarded – undo
2977 3091
 							</dt>
2978 3092
 							<dd>
2979 3093
 								<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\';">';
2980
-	foreach ($context['smiley_sets'] as $set)
2981
-		echo '
3094
+	foreach ($context['smiley_sets'] as $set) {
3095
+			echo '
2982 3096
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
3097
+	}
2983 3098
 	echo '
2984 3099
 								</select> <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=":)"  style="padding-left: 20px;">
2985 3100
 							</dd>';
@@ -3030,10 +3145,11 @@  discard block
 block discarded – undo
3030 3145
 									</div>
3031 3146
 									<div class="clear"></div>';
3032 3147
 
3033
-	if (!empty($context['from_ajax']))
3034
-		echo '
3148
+	if (!empty($context['from_ajax'])) {
3149
+			echo '
3035 3150
 									<br>
3036 3151
 									<a href="javascript:self.close();"></a>';
3152
+	}
3037 3153
 
3038 3154
 	echo '
3039 3155
 								</div>
@@ -3072,15 +3188,16 @@  discard block
 block discarded – undo
3072 3188
 								<br /><div class="smalltext">', $txt['tfa_profile_desc'], '</div>
3073 3189
 							</dt>
3074 3190
 							<dd>';
3075
-	if (!$context['tfa_enabled'] && $context['user']['is_owner'])
3076
-		echo '
3191
+	if (!$context['tfa_enabled'] && $context['user']['is_owner']) {
3192
+			echo '
3077 3193
 								<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>';
3078
-	elseif (!$context['tfa_enabled'])
3079
-		echo '
3194
+	} elseif (!$context['tfa_enabled']) {
3195
+			echo '
3080 3196
 								', $txt['tfa_profile_disabled'];
3081
-	else
3082
-		echo '
3197
+	} else {
3198
+			echo '
3083 3199
 							', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable');
3200
+	}
3084 3201
 	echo '
3085 3202
 							</dd>';
3086 3203
 }
Please login to merge, or discard this patch.