Completed
Push — release-2.1 ( c939ca...591842 )
by Colin
07:28
created
Themes/default/Themes.template.php 1 patch
Braces   +103 added lines, -80 removed lines patch added patch discarded remove patch
@@ -54,9 +54,10 @@  discard block
 block discarded – undo
54 54
 					<dd>
55 55
 						<div id="known_themes_list">';
56 56
 
57
-	foreach ($context['themes'] as $theme)
58
-		echo '
57
+	foreach ($context['themes'] as $theme) {
58
+			echo '
59 59
 							<label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', '> ', $theme['name'], '</label><br>';
60
+	}
60 61
 
61 62
 	echo '
62 63
 						</div>
@@ -73,9 +74,10 @@  discard block
 block discarded – undo
73 74
 						<select name="options[theme_guests]" id="theme_guests">';
74 75
 
75 76
 	// Put an option for each theme in the select box.
76
-	foreach ($context['themes'] as $theme)
77
-		echo '
77
+	foreach ($context['themes'] as $theme) {
78
+			echo '
78 79
 							<option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>';
80
+	}
79 81
 
80 82
 	echo '
81 83
 						</select>
@@ -90,9 +92,10 @@  discard block
 block discarded – undo
90 92
 							<option value="0">', $txt['theme_forum_default'], '</option>';
91 93
 
92 94
 	// Same thing, this time for changing the theme of everyone.
93
-	foreach ($context['themes'] as $theme)
94
-		echo '
95
+	foreach ($context['themes'] as $theme) {
96
+			echo '
95 97
 							<option value="', $theme['id'], '">', $theme['name'], '</option>';
98
+	}
96 99
 
97 100
 	echo '
98 101
 						</select>
@@ -189,11 +192,12 @@  discard block
 block discarded – undo
189 192
 	global $context, $scripturl, $txt;
190 193
 
191 194
 	// Show a nice confirmation message.
192
-	if (isset($_GET['done']))
193
-		echo '
195
+	if (isset($_GET['done'])) {
196
+			echo '
194 197
 	<div class="infobox">
195 198
 		', $txt['theme_confirmed_' . $_GET['done']], '
196 199
 	</div>';
200
+	}
197 201
 
198 202
 	echo '
199 203
 	<div id="admincenter">';
@@ -358,11 +362,12 @@  discard block
 block discarded – undo
358 362
 		if (empty($setting) || !is_array($setting))
359 363
 		{
360 364
 			// Insert a separator (unless this is the first item in the list)
361
-			if ($i !== $first_option_key)
362
-				echo '
365
+			if ($i !== $first_option_key) {
366
+							echo '
363 367
 				</dl>
364 368
 				<hr>
365 369
 				<dl class="settings">';
370
+			}
366 371
 
367 372
 			// Should we give a name to this section?
368 373
 			if (is_string($setting) && !empty($setting))
@@ -371,9 +376,9 @@  discard block
 block discarded – undo
371 376
 				echo '
372 377
 					<dt><strong>' . $setting . '</strong></dt>
373 378
 					<dd></dd>';
379
+			} else {
380
+							$titled_section = false;
374 381
 			}
375
-			else
376
-				$titled_section = false;
377 382
 
378 383
 			continue;
379 384
 		}
@@ -382,8 +387,8 @@  discard block
 block discarded – undo
382 387
 					<dt>';
383 388
 
384 389
 		// Show the change option box?
385
-		if ($context['theme_options_reset'])
386
-			echo '
390
+		if ($context['theme_options_reset']) {
391
+					echo '
387 392
 						<span class="floatleft">
388 393
 							<select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;">
389 394
 								<option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option>
@@ -391,14 +396,16 @@  discard block
 block discarded – undo
391 396
 								<option value="2">', $txt['themeadmin_reset_options_default'], '</option>
392 397
 							</select>
393 398
 						</span>';
399
+		}
394 400
 
395 401
 		echo '
396 402
 						<label for="options_', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
397 403
 
398
-		if (isset($setting['description']))
399
-			echo '
404
+		if (isset($setting['description'])) {
405
+					echo '
400 406
 						<br>
401 407
 						<span class="smalltext">', $setting['description'], '</span>';
408
+		}
402 409
 		echo '
403 410
 					</dt>';
404 411
 
@@ -440,13 +447,11 @@  discard block
 block discarded – undo
440 447
 
441 448
 				echo '
442 449
 						<input type="number"', $min . $max . $step;
443
-			}
444
-			else if (isset($setting['type']) && $setting['type'] == 'url')
450
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
445 451
 			{
446 452
 				echo'
447 453
 						<input type="url"';
448
-			}
449
-			else
454
+			} else
450 455
 			{
451 456
 				echo '
452 457
 						<input type="text"';
@@ -490,8 +495,8 @@  discard block
 block discarded – undo
490 495
 			<br>';
491 496
 
492 497
 	// @todo Why can't I edit the default theme popup.
493
-	if ($context['theme_settings']['theme_id'] != 1)
494
-		echo '
498
+	if ($context['theme_settings']['theme_id'] != 1) {
499
+			echo '
495 500
 			<div class="cat_bar">
496 501
 				<h3 class="catbg config_hd">
497 502
 					', $txt['theme_edit'], '
@@ -507,6 +512,7 @@  discard block
 block discarded – undo
507 512
 					</li>
508 513
 				</ul>
509 514
 			</div>';
515
+	}
510 516
 
511 517
 	echo '
512 518
 			<div class="cat_bar">
@@ -560,9 +566,10 @@  discard block
 block discarded – undo
560 566
 					<dd>
561 567
 						<select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">';
562 568
 
563
-		foreach ($context['theme_variants'] as $key => $variant)
564
-			echo '
569
+		foreach ($context['theme_variants'] as $key => $variant) {
570
+					echo '
565 571
 							<option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>';
572
+		}
566 573
 
567 574
 		echo '
568 575
 						</select>
@@ -598,11 +605,12 @@  discard block
 block discarded – undo
598 605
 		if (empty($setting) || !is_array($setting))
599 606
 		{
600 607
 			// We don't need a separator before the first list element
601
-			if ($i !== $first_setting_key)
602
-				echo '
608
+			if ($i !== $first_setting_key) {
609
+							echo '
603 610
 				</dl>
604 611
 				<hr>
605 612
 				<dl class="settings">';
613
+			}
606 614
 
607 615
 			// Add a fake heading?
608 616
 			if (is_string($setting) && !empty($setting))
@@ -611,9 +619,9 @@  discard block
 block discarded – undo
611 619
 				echo '
612 620
 					<dt><strong>' . $setting . '</strong></dt>
613 621
 					<dd></dd>';
622
+			} else {
623
+							$titled_section = false;
614 624
 			}
615
-			else
616
-				$titled_section = false;
617 625
 
618 626
 			continue;
619 627
 		}
@@ -622,9 +630,10 @@  discard block
 block discarded – undo
622 630
 					<dt>
623 631
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>:';
624 632
 
625
-		if (isset($setting['description']))
626
-			echo '<br>
633
+		if (isset($setting['description'])) {
634
+					echo '<br>
627 635
 						<span class="smalltext">', $setting['description'], '</span>';
636
+		}
628 637
 
629 638
 		echo '
630 639
 					</dt>';
@@ -645,9 +654,10 @@  discard block
 block discarded – undo
645 654
 					<dd>
646 655
 						<select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">';
647 656
 
648
-			foreach ($setting['options'] as $value => $label)
649
-				echo '
657
+			foreach ($setting['options'] as $value => $label) {
658
+							echo '
650 659
 							<option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>';
660
+			}
651 661
 
652 662
 			echo '
653 663
 						</select>
@@ -676,13 +686,11 @@  discard block
 block discarded – undo
676 686
 
677 687
 				echo '
678 688
 						<input type="number"', $min . $max . $step;
679
-			}
680
-			else if (isset($setting['type']) && $setting['type'] == 'url')
689
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
681 690
 			{
682 691
 				echo'
683 692
 						<input type="url"';
684
-			}
685
-			else
693
+			} else
686 694
 			{
687 695
 				echo '
688 696
 						<input type="text"';
@@ -839,21 +847,23 @@  discard block
 block discarded – undo
839 847
 		<div class="windowbg">';
840 848
 
841 849
 	// Oops! there was an error :(
842
-	if (!empty($context['error_message']))
843
-		echo '
850
+	if (!empty($context['error_message'])) {
851
+			echo '
844 852
 			<p>
845 853
 				', $context['error_message'], '
846 854
 			</p>';
855
+	}
847 856
 
848 857
 	// Not much to show except a link back...
849
-	else
850
-		echo '
858
+	else {
859
+			echo '
851 860
 			<p>
852 861
 				<a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], '
853 862
 			</p>
854 863
 			<p>
855 864
 				<a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a>
856 865
 			</p>';
866
+	}
857 867
 
858 868
 	echo '
859 869
 		</div><!-- .windowbg -->
@@ -920,11 +930,12 @@  discard block
 block discarded – undo
920 930
 					<span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span>
921 931
 					<span class="floatright">';
922 932
 
923
-		if ($template['can_copy'])
924
-			echo '
933
+		if ($template['can_copy']) {
934
+					echo '
925 935
 						<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>';
926
-		else
927
-			echo $txt['themeadmin_edit_no_copy'];
936
+		} else {
937
+					echo $txt['themeadmin_edit_no_copy'];
938
+		}
928 939
 
929 940
 		echo '
930 941
 					</span>
@@ -947,11 +958,12 @@  discard block
 block discarded – undo
947 958
 	echo '
948 959
 	<div id="admincenter">';
949 960
 
950
-	if (!empty($context['browse_title']))
951
-		echo '
961
+	if (!empty($context['browse_title'])) {
962
+			echo '
952 963
 		<div class="cat_bar">
953 964
 			<h3 class="catbg">', $context['browse_title'], '</h3>
954 965
 		</div>';
966
+	}
955 967
 
956 968
 	echo '
957 969
 		<table class="table_grid tborder">
@@ -971,16 +983,15 @@  discard block
 block discarded – undo
971 983
 				<tr class="windowbg">
972 984
 					<td>';
973 985
 
974
-		if ($file['is_editable'])
975
-			echo '
986
+		if ($file['is_editable']) {
987
+					echo '
976 988
 						<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>';
977
-
978
-		elseif ($file['is_directory'])
979
-			echo '
989
+		} elseif ($file['is_directory']) {
990
+					echo '
980 991
 						<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>';
981
-
982
-		else
983
-			echo $file['filename'];
992
+		} else {
993
+					echo $file['filename'];
994
+		}
984 995
 
985 996
 		echo '
986 997
 					</td>
@@ -1002,11 +1013,12 @@  discard block
 block discarded – undo
1002 1013
 {
1003 1014
 	global $context, $settings, $scripturl, $txt;
1004 1015
 
1005
-	if ($context['session_error'])
1006
-		echo '
1016
+	if ($context['session_error']) {
1017
+			echo '
1007 1018
 	<div class="errorbox">
1008 1019
 		', $txt['error_session_timeout'], '
1009 1020
 	</div>';
1021
+	}
1010 1022
 
1011 1023
 	// From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com.
1012 1024
 	echo '
@@ -1069,17 +1081,18 @@  discard block
 block discarded – undo
1069 1081
 					try
1070 1082
 					{
1071 1083
 					';
1072
-	if (isBrowser('is_ie'))
1073
-		echo '
1084
+	if (isBrowser('is_ie')) {
1085
+			echo '
1074 1086
 						var sheets = frames["css_preview_box"].document.styleSheets;
1075 1087
 						for (var j = 0; j < sheets.length; j++)
1076 1088
 						{
1077 1089
 							if (sheets[j].id == "css_preview_box")
1078 1090
 								sheets[j].cssText = document.forms.stylesheetForm.entire_file.value;
1079 1091
 						}';
1080
-	else
1081
-		echo '
1092
+	} else {
1093
+			echo '
1082 1094
 						setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);';
1095
+	}
1083 1096
 	echo '
1084 1097
 					}
1085 1098
 					catch (e)
@@ -1131,9 +1144,10 @@  discard block
 block discarded – undo
1131 1144
 			</div>
1132 1145
 			<div class="windowbg">';
1133 1146
 
1134
-	if (!$context['allow_save'])
1135
-		echo '
1147
+	if (!$context['allow_save']) {
1148
+			echo '
1136 1149
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1150
+	}
1137 1151
 
1138 1152
 	echo '
1139 1153
 				<textarea class="edit_file" name="entire_file" cols="80" rows="20" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea>
@@ -1147,9 +1161,10 @@  discard block
 block discarded – undo
1147 1161
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1148 1162
 
1149 1163
 	// Hopefully it exists.
1150
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1151
-		echo '
1164
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1165
+			echo '
1152 1166
 			<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1167
+	}
1153 1168
 
1154 1169
 	echo '
1155 1170
 		</form>
@@ -1163,18 +1178,20 @@  discard block
 block discarded – undo
1163 1178
 {
1164 1179
 	global $context, $scripturl, $txt;
1165 1180
 
1166
-	if ($context['session_error'])
1167
-		echo '
1181
+	if ($context['session_error']) {
1182
+			echo '
1168 1183
 	<div class="errorbox">
1169 1184
 		', $txt['error_session_timeout'], '
1170 1185
 	</div>';
1186
+	}
1171 1187
 
1172
-	if (isset($context['parse_error']))
1173
-		echo '
1188
+	if (isset($context['parse_error'])) {
1189
+			echo '
1174 1190
 	<div class="errorbox">
1175 1191
 		', $txt['themeadmin_edit_error'], '
1176 1192
 		<div><pre>', $context['parse_error'], '</pre></div>
1177 1193
 	</div>';
1194
+	}
1178 1195
 
1179 1196
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1180 1197
 	echo '
@@ -1185,16 +1202,18 @@  discard block
 block discarded – undo
1185 1202
 			</div>
1186 1203
 			<div class="windowbg">';
1187 1204
 
1188
-	if (!$context['allow_save'])
1189
-		echo '
1205
+	if (!$context['allow_save']) {
1206
+			echo '
1190 1207
 				', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>';
1208
+	}
1191 1209
 
1192
-	foreach ($context['file_parts'] as $part)
1193
-		echo '
1210
+	foreach ($context['file_parts'] as $part) {
1211
+			echo '
1194 1212
 				<label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br>
1195 1213
 				<div class="centertext">
1196 1214
 					<textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea>
1197 1215
 				</div>';
1216
+	}
1198 1217
 
1199 1218
 	echo '
1200 1219
 				<div class="padding righttext">
@@ -1203,9 +1222,10 @@  discard block
 block discarded – undo
1203 1222
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1204 1223
 
1205 1224
 	// Hopefully it exists.
1206
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1207
-		echo '
1225
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1226
+			echo '
1208 1227
 					<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1228
+	}
1209 1229
 
1210 1230
 	echo '
1211 1231
 				</div><!-- .righttext -->
@@ -1221,18 +1241,20 @@  discard block
 block discarded – undo
1221 1241
 {
1222 1242
 	global $context, $scripturl, $txt;
1223 1243
 
1224
-	if ($context['session_error'])
1225
-		echo '
1244
+	if ($context['session_error']) {
1245
+			echo '
1226 1246
 	<div class="errorbox">
1227 1247
 		', $txt['error_session_timeout'], '
1228 1248
 	</div>';
1249
+	}
1229 1250
 
1230 1251
 	// Is this file writeable?
1231
-	if (!$context['allow_save'])
1232
-		echo '
1252
+	if (!$context['allow_save']) {
1253
+			echo '
1233 1254
 	<div class="errorbox">
1234 1255
 		', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '
1235 1256
 	</div>';
1257
+	}
1236 1258
 
1237 1259
 	// Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.)
1238 1260
 	echo '
@@ -1248,9 +1270,10 @@  discard block
 block discarded – undo
1248 1270
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">';
1249 1271
 
1250 1272
 	// Hopefully it exists.
1251
-	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token']))
1252
-		echo '
1273
+	if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) {
1274
+			echo '
1253 1275
 				<input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">';
1276
+	}
1254 1277
 
1255 1278
 	echo '
1256 1279
 			</div><!-- .windowbg -->
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
@@ -3078,8 +3078,7 @@
 block discarded – undo
3078 3078
 			<div class="roundframe">
3079 3079
 				<div>
3080 3080
 		', !empty($context['tfa_backup']) ? '
3081
-					<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' :
3082
-			($modSettings['tfa_mode'] == 2 ? '
3081
+					<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : ($modSettings['tfa_mode'] == 2 ? '
3083 3082
 									<div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), '
3084 3083
 									<div class="smalltext">', $txt['tfa_desc'], '</div>
3085 3084
 									<div class="floatleft">
Please login to merge, or discard this patch.
Braces   +465 added lines, -347 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>
@@ -190,10 +192,11 @@  discard block
 block discarded – undo
190 192
 			<div class="custom_fields_below_avatar">
191 193
 				<ul>';
192 194
 
193
-		foreach ($context['print_custom_fields']['below_avatar'] as $field)
194
-			if (!empty($field['output_html']))
195
+		foreach ($context['print_custom_fields']['below_avatar'] as $field) {
196
+					if (!empty($field['output_html']))
195 197
 				echo '
196 198
 					<li>', $field['output_html'], '</li>';
199
+		}
197 200
 
198 201
 		echo '
199 202
 				</ul>
@@ -205,22 +208,25 @@  discard block
 block discarded – undo
205 208
 			<ul class="clear">';
206 209
 
207 210
 	// Email is only visible if it's your profile or you have the moderate_forum permission
208
-	if ($context['member']['show_email'])
209
-		echo '
211
+	if ($context['member']['show_email']) {
212
+			echo '
210 213
 				<li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>';
214
+	}
211 215
 
212 216
 	// Don't show an icon if they haven't specified a website.
213
-	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
214
-		echo '
217
+	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) {
218
+			echo '
215 219
 				<li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
220
+	}
216 221
 
217 222
 	// Are there any custom profile fields as icons?
218 223
 	if (!empty($context['print_custom_fields']['icons']))
219 224
 	{
220
-		foreach ($context['print_custom_fields']['icons'] as $field)
221
-			if (!empty($field['output_html']))
225
+		foreach ($context['print_custom_fields']['icons'] as $field) {
226
+					if (!empty($field['output_html']))
222 227
 				echo '
223 228
 				<li class="custom_field">', $field['output_html'], '</li>';
229
+		}
224 230
 	}
225 231
 
226 232
 	echo '
@@ -229,24 +235,27 @@  discard block
 block discarded – undo
229 235
 				', $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>' : '';
230 236
 
231 237
 	// Can they add this member as a buddy?
232
-	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
233
-		echo '
238
+	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) {
239
+			echo '
234 240
 				<br>
235 241
 				<a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>';
242
+	}
236 243
 
237 244
 	echo '
238 245
 			</span>';
239 246
 
240
-	if (!$context['user']['is_owner'] && $context['can_send_pm'])
241
-		echo '
247
+	if (!$context['user']['is_owner'] && $context['can_send_pm']) {
248
+			echo '
242 249
 			<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>';
250
+	}
243 251
 
244 252
 	echo '
245 253
 			<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>';
246 254
 
247
-	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled']))
248
-		echo '
255
+	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) {
256
+			echo '
249 257
 			<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>';
258
+	}
250 259
 
251 260
 	echo '
252 261
 			<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>';
@@ -258,10 +267,11 @@  discard block
 block discarded – undo
258 267
 			<div class="custom_fields_bottom">
259 268
 				<ul class="nolist">';
260 269
 
261
-		foreach ($context['print_custom_fields']['bottom_poster'] as $field)
262
-			if (!empty($field['output_html']))
270
+		foreach ($context['print_custom_fields']['bottom_poster'] as $field) {
271
+					if (!empty($field['output_html']))
263 272
 				echo '
264 273
 					<li>', $field['output_html'], '</li>';
274
+		}
265 275
 
266 276
 		echo '
267 277
 				</ul>
@@ -274,15 +284,17 @@  discard block
 block discarded – undo
274 284
 		<div id="detailedinfo">
275 285
 			<dl class="settings">';
276 286
 
277
-	if ($context['user']['is_owner'] || $context['user']['is_admin'])
278
-		echo '
287
+	if ($context['user']['is_owner'] || $context['user']['is_admin']) {
288
+			echo '
279 289
 				<dt>', $txt['username'], ': </dt>
280 290
 				<dd>', $context['member']['username'], '</dd>';
291
+	}
281 292
 
282
-	if (!isset($context['disabled_fields']['posts']))
283
-		echo '
293
+	if (!isset($context['disabled_fields']['posts'])) {
294
+			echo '
284 295
 				<dt>', $txt['profile_posts'], ': </dt>
285 296
 				<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
297
+	}
286 298
 
287 299
 	if ($context['member']['show_email'])
288 300
 	{
@@ -291,15 +303,17 @@  discard block
 block discarded – undo
291 303
 				<dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>';
292 304
 	}
293 305
 
294
-	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
295
-		echo '
306
+	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) {
307
+			echo '
296 308
 				<dt>', $txt['custom_title'], ': </dt>
297 309
 				<dd>', $context['member']['title'], '</dd>';
310
+	}
298 311
 
299
-	if (!empty($context['member']['blurb']))
300
-		echo '
312
+	if (!empty($context['member']['blurb'])) {
313
+			echo '
301 314
 				<dt>', $txt['personal_text'], ': </dt>
302 315
 				<dd>', $context['member']['blurb'], '</dd>';
316
+	}
303 317
 
304 318
 	echo '
305 319
 				<dt>', $txt['age'], ':</dt>
@@ -313,19 +327,21 @@  discard block
 block discarded – undo
313 327
 	{
314 328
 		$fields = array();
315 329
 
316
-		foreach ($context['print_custom_fields']['standard'] as $field)
317
-			if (!empty($field['output_html']))
330
+		foreach ($context['print_custom_fields']['standard'] as $field) {
331
+					if (!empty($field['output_html']))
318 332
 				$fields[] = $field;
333
+		}
319 334
 
320 335
 		if (count($fields) > 0)
321 336
 		{
322 337
 			echo '
323 338
 			<dl class="settings">';
324 339
 
325
-			foreach ($fields as $field)
326
-				echo '
340
+			foreach ($fields as $field) {
341
+							echo '
327 342
 				<dt>', $field['name'], ':</dt>
328 343
 				<dd>', $field['output_html'], '</dd>';
344
+			}
329 345
 
330 346
 			echo '
331 347
 			</dl>';
@@ -345,9 +361,10 @@  discard block
 block discarded – undo
345 361
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
346 362
 
347 363
 		// Can we provide information on what this means?
348
-		if (!empty($context['warning_status']))
349
-			echo '
364
+		if (!empty($context['warning_status'])) {
365
+					echo '
350 366
 					<span class="smalltext">(', $context['warning_status'], ')</span>';
367
+		}
351 368
 
352 369
 		echo '
353 370
 				</dd>';
@@ -358,9 +375,10 @@  discard block
 block discarded – undo
358 375
 	{
359 376
 
360 377
 		// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
361
-		if (!empty($context['activate_message']))
362
-			echo '
378
+		if (!empty($context['activate_message'])) {
379
+					echo '
363 380
 				<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>';
381
+		}
364 382
 
365 383
 		// If the current member is banned, show a message and possibly a link to the ban.
366 384
 		if (!empty($context['member']['bans']))
@@ -372,10 +390,11 @@  discard block
 block discarded – undo
372 390
 				<dt class="clear" id="ban_info" style="display: none;">
373 391
 					<strong>', $txt['user_banned_by_following'], ':</strong>';
374 392
 
375
-			foreach ($context['member']['bans'] as $ban)
376
-				echo '
393
+			foreach ($context['member']['bans'] as $ban) {
394
+							echo '
377 395
 					<br>
378 396
 					<span class="smalltext">', $ban['explanation'], '</span>';
397
+			}
379 398
 
380 399
 			echo '
381 400
 				</dt>';
@@ -389,30 +408,34 @@  discard block
 block discarded – undo
389 408
 	// If the person looking is allowed, they can check the members IP address and hostname.
390 409
 	if ($context['can_see_ip'])
391 410
 	{
392
-		if (!empty($context['member']['ip']))
393
-		echo '
411
+		if (!empty($context['member']['ip'])) {
412
+				echo '
394 413
 				<dt>', $txt['ip'], ': </dt>
395 414
 				<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
415
+		}
396 416
 
397
-		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
398
-			echo '
417
+		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) {
418
+					echo '
399 419
 				<dt>', $txt['hostname'], ': </dt>
400 420
 				<dd>', $context['member']['hostname'], '</dd>';
421
+		}
401 422
 	}
402 423
 
403 424
 	echo '
404 425
 				<dt>', $txt['local_time'], ':</dt>
405 426
 				<dd>', $context['member']['local_time'], '</dd>';
406 427
 
407
-	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
408
-		echo '
428
+	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) {
429
+			echo '
409 430
 				<dt>', $txt['language'], ':</dt>
410 431
 				<dd>', $context['member']['language'], '</dd>';
432
+	}
411 433
 
412
-	if ($context['member']['show_last_login'])
413
-		echo '
434
+	if ($context['member']['show_last_login']) {
435
+			echo '
414 436
 				<dt>', $txt['lastLoggedIn'], ': </dt>
415 437
 				<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
438
+	}
416 439
 
417 440
 	echo '
418 441
 			</dl>';
@@ -424,10 +447,11 @@  discard block
 block discarded – undo
424 447
 			<div class="custom_fields_above_signature">
425 448
 				<ul class="nolist">';
426 449
 
427
-		foreach ($context['print_custom_fields']['above_signature'] as $field)
428
-			if (!empty($field['output_html']))
450
+		foreach ($context['print_custom_fields']['above_signature'] as $field) {
451
+					if (!empty($field['output_html']))
429 452
 				echo '
430 453
 					<li>', $field['output_html'], '</li>';
454
+		}
431 455
 
432 456
 		echo '
433 457
 				</ul>
@@ -435,12 +459,13 @@  discard block
 block discarded – undo
435 459
 	}
436 460
 
437 461
 	// Show the users signature.
438
-	if ($context['signature_enabled'] && !empty($context['member']['signature']))
439
-		echo '
462
+	if ($context['signature_enabled'] && !empty($context['member']['signature'])) {
463
+			echo '
440 464
 			<div class="signature">
441 465
 				<h5>', $txt['signature'], ':</h5>
442 466
 				', $context['member']['signature'], '
443 467
 			</div>';
468
+	}
444 469
 
445 470
 	// Are there any custom profile fields for below the signature?
446 471
 	if (!empty($context['print_custom_fields']['below_signature']))
@@ -449,10 +474,11 @@  discard block
 block discarded – undo
449 474
 			<div class="custom_fields_below_signature">
450 475
 				<ul class="nolist">';
451 476
 
452
-		foreach ($context['print_custom_fields']['below_signature'] as $field)
453
-			if (!empty($field['output_html']))
477
+		foreach ($context['print_custom_fields']['below_signature'] as $field) {
478
+					if (!empty($field['output_html']))
454 479
 				echo '
455 480
 					<li>', $field['output_html'], '</li>';
481
+		}
456 482
 
457 483
 		echo '
458 484
 				</ul>
@@ -498,62 +524,70 @@  discard block
 block discarded – undo
498 524
 			</div>
499 525
 			<div class="list_posts">';
500 526
 
501
-			if (!$post['approved'])
502
-				echo '
527
+			if (!$post['approved']) {
528
+							echo '
503 529
 				<div class="approve_post">
504 530
 					<em>', $txt['post_awaiting_approval'], '</em>
505 531
 				</div>';
532
+			}
506 533
 
507 534
 			echo '
508 535
 				', $post['body'], '
509 536
 			</div>';
510 537
 
511
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
512
-				echo '
538
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
539
+							echo '
513 540
 			<div class="floatright">
514 541
 				<ul class="quickbuttons">';
542
+			}
515 543
 
516 544
 			// If they *can* reply?
517
-			if ($post['can_reply'])
518
-				echo '
545
+			if ($post['can_reply']) {
546
+							echo '
519 547
 					<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
548
+			}
520 549
 
521 550
 			// If they *can* quote?
522
-			if ($post['can_quote'])
523
-				echo '
551
+			if ($post['can_quote']) {
552
+							echo '
524 553
 					<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>';
554
+			}
525 555
 
526 556
 			// How about... even... remove it entirely?!
527
-			if ($post['can_delete'])
528
-				echo '
557
+			if ($post['can_delete']) {
558
+							echo '
529 559
 					<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>';
560
+			}
530 561
 
531
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
532
-				echo '
562
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
563
+							echo '
533 564
 				</ul>
534 565
 			</div><!-- .floatright -->';
566
+			}
535 567
 
536 568
 			echo '
537 569
 		</div><!-- $post[css_class] -->';
538 570
 		}
571
+	} else {
572
+			template_show_list('attachments');
539 573
 	}
540
-	else
541
-		template_show_list('attachments');
542 574
 
543 575
 	// No posts? Just end with a informative message.
544
-	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
545
-		echo '
576
+	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) {
577
+			echo '
546 578
 		<div class="windowbg2">
547 579
 			', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
548 580
 		</div>';
581
+	}
549 582
 
550 583
 	// Show more page numbers.
551
-	if (!empty($context['page_index']))
552
-		echo '
584
+	if (!empty($context['page_index'])) {
585
+			echo '
553 586
 		<div class="pagesection">
554 587
 			<div class="pagelinks">', $context['page_index'], '</div>
555 588
 		</div>';
556
-}
589
+	}
590
+	}
557 591
 
558 592
 /**
559 593
  * Template for showing alerts within the alerts popup
@@ -563,11 +597,12 @@  discard block
 block discarded – undo
563 597
 	global $context, $txt, $scripturl;
564 598
 
565 599
 	// Do we have an update message?
566
-	if (!empty($context['update_message']))
567
-		echo '
600
+	if (!empty($context['update_message'])) {
601
+			echo '
568 602
 		<div class="infobox">
569 603
 			', $context['update_message'], '.
570 604
 		</div>';
605
+	}
571 606
 
572 607
 	echo '
573 608
 		<div class="cat_bar">
@@ -576,13 +611,12 @@  discard block
 block discarded – undo
576 611
 			</h3>
577 612
 		</div>';
578 613
 
579
-	if (empty($context['alerts']))
580
-		echo '
614
+	if (empty($context['alerts'])) {
615
+			echo '
581 616
 		<div class="information">
582 617
 			', $txt['alerts_none'], '
583 618
 		</div>';
584
-
585
-	else
619
+	} else
586 620
 	{
587 621
 		// Start the form.
588 622
 		echo '
@@ -644,12 +678,12 @@  discard block
 block discarded – undo
644 678
 		</div>' : '';
645 679
 
646 680
 	// No drafts? Just show an informative message.
647
-	if (empty($context['drafts']))
648
-		echo '
681
+	if (empty($context['drafts'])) {
682
+			echo '
649 683
 		<div class="windowbg2 centertext">
650 684
 			', $txt['draft_none'], '
651 685
 		</div>';
652
-	else
686
+	} else
653 687
 	{
654 688
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
655 689
 		foreach ($context['drafts'] as $draft)
@@ -661,13 +695,15 @@  discard block
 block discarded – undo
661 695
 				<h5>
662 696
 					<strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
663 697
 
664
-			if (!empty($draft['sticky']))
665
-				echo '
698
+			if (!empty($draft['sticky'])) {
699
+							echo '
666 700
 					<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
701
+			}
667 702
 
668
-			if (!empty($draft['locked']))
669
-				echo '
703
+			if (!empty($draft['locked'])) {
704
+							echo '
670 705
 					<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
706
+			}
671 707
 
672 708
 			echo '
673 709
 				</h5>
@@ -700,13 +736,13 @@  discard block
 block discarded – undo
700 736
 {
701 737
 	global $context, $scripturl, $txt;
702 738
 
703
-	if (!empty($context['saved_successful']))
704
-		echo '
739
+	if (!empty($context['saved_successful'])) {
740
+			echo '
705 741
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
706
-
707
-	elseif (!empty($context['saved_failed']))
708
-		echo '
742
+	} elseif (!empty($context['saved_failed'])) {
743
+			echo '
709 744
 	<div class="errorbox">', $context['saved_failed'], '</div>';
745
+	}
710 746
 
711 747
 	echo '
712 748
 	<div id="edit_buddies">
@@ -721,14 +757,16 @@  discard block
 block discarded – undo
721 757
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
722 758
 					<th scope="col">', $txt['status'], '</th>';
723 759
 
724
-	if (allowedTo('moderate_forum'))
725
-		echo '
760
+	if (allowedTo('moderate_forum')) {
761
+			echo '
726 762
 					<th scope="col">', $txt['email'], '</th>';
763
+	}
727 764
 
728
-	if (!empty($context['custom_pf']))
729
-		foreach ($context['custom_pf'] as $column)
765
+	if (!empty($context['custom_pf'])) {
766
+			foreach ($context['custom_pf'] as $column)
730 767
 				echo '
731 768
 					<th scope="col">', $column['label'], '</th>';
769
+	}
732 770
 
733 771
 	echo '
734 772
 					<th scope="col">', $txt['remove'], '</th>
@@ -737,13 +775,14 @@  discard block
 block discarded – undo
737 775
 			<tbody>';
738 776
 
739 777
 	// If they don't have any buddies don't list them!
740
-	if (empty($context['buddies']))
741
-		echo '
778
+	if (empty($context['buddies'])) {
779
+			echo '
742 780
 				<tr class="windowbg">
743 781
 					<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '">
744 782
 						<strong>', $txt['no_buddies'], '</strong>
745 783
 					</td>
746 784
 				</tr>';
785
+	}
747 786
 
748 787
 		// Now loop through each buddy showing info on each.
749 788
 	else
@@ -757,17 +796,19 @@  discard block
 block discarded – undo
757 796
 						<a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a>
758 797
 					</td>';
759 798
 
760
-			if ($buddy['show_email'])
761
-				echo '
799
+			if ($buddy['show_email']) {
800
+							echo '
762 801
 					<td>
763 802
 						<a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a>
764 803
 					</td>';
804
+			}
765 805
 
766 806
 			// Show the custom profile fields for this user.
767
-			if (!empty($context['custom_pf']))
768
-				foreach ($context['custom_pf'] as $key => $column)
807
+			if (!empty($context['custom_pf'])) {
808
+							foreach ($context['custom_pf'] as $key => $column)
769 809
 					echo '
770 810
 					<td class="lefttext">', $buddy['options'][$key], '</td>';
811
+			}
771 812
 
772 813
 			echo '
773 814
 					<td>
@@ -800,9 +841,10 @@  discard block
 block discarded – undo
800 841
 			</dl>
801 842
 		</div>';
802 843
 
803
-	if (!empty($context['token_check']))
804
-		echo '
844
+	if (!empty($context['token_check'])) {
845
+			echo '
805 846
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
847
+	}
806 848
 
807 849
 	echo '
808 850
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -828,12 +870,13 @@  discard block
 block discarded – undo
828 870
 {
829 871
 	global $context, $scripturl, $txt;
830 872
 
831
-	if (!empty($context['saved_successful']))
832
-		echo '
873
+	if (!empty($context['saved_successful'])) {
874
+			echo '
833 875
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
834
-	elseif (!empty($context['saved_failed']))
835
-		echo '
876
+	} elseif (!empty($context['saved_failed'])) {
877
+			echo '
836 878
 	<div class="errorbox">', $context['saved_failed'], '</div>';
879
+	}
837 880
 
838 881
 	echo '
839 882
 	<div id="edit_buddies">
@@ -848,9 +891,10 @@  discard block
 block discarded – undo
848 891
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
849 892
 					<th scope="col">', $txt['status'], '</th>';
850 893
 
851
-	if (allowedTo('moderate_forum'))
852
-		echo '
894
+	if (allowedTo('moderate_forum')) {
895
+			echo '
853 896
 					<th scope="col">', $txt['email'], '</th>';
897
+	}
854 898
 
855 899
 	echo '
856 900
 					<th scope="col">', $txt['ignore_remove'], '</th>
@@ -859,13 +903,14 @@  discard block
 block discarded – undo
859 903
 			<tbody>';
860 904
 
861 905
 	// If they don't have anyone on their ignore list, don't list it!
862
-	if (empty($context['ignore_list']))
863
-		echo '
906
+	if (empty($context['ignore_list'])) {
907
+			echo '
864 908
 				<tr class="windowbg">
865 909
 					<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '">
866 910
 						<strong>', $txt['no_ignore'], '</strong>
867 911
 					</td>
868 912
 				</tr>';
913
+	}
869 914
 
870 915
 	// Now loop through each buddy showing info on each.
871 916
 	foreach ($context['ignore_list'] as $member)
@@ -877,11 +922,12 @@  discard block
 block discarded – undo
877 922
 						<a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a>
878 923
 					</td>';
879 924
 
880
-		if ($member['show_email'])
881
-			echo '
925
+		if ($member['show_email']) {
926
+					echo '
882 927
 					<td>
883 928
 						<a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a>
884 929
 					</td>';
930
+		}
885 931
 		echo '
886 932
 					<td>
887 933
 						<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>
@@ -911,9 +957,10 @@  discard block
 block discarded – undo
911 957
 			</dl>
912 958
 		</div>';
913 959
 
914
-	if (!empty($context['token_check']))
915
-		echo '
960
+	if (!empty($context['token_check'])) {
961
+			echo '
916 962
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
963
+	}
917 964
 
918 965
 	echo '
919 966
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -959,9 +1006,10 @@  discard block
 block discarded – undo
959 1006
 					<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
960 1007
 
961 1008
 	// Second address detected?
962
-	if (!empty($context['last_ip2']))
963
-		echo '
1009
+	if (!empty($context['last_ip2'])) {
1010
+			echo '
964 1011
 					, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
1012
+	}
965 1013
 
966 1014
 	echo '
967 1015
 				</dd>';
@@ -1027,9 +1075,10 @@  discard block
 block discarded – undo
1027 1075
 		</div>
1028 1076
 		<div class="windowbg2 noup">';
1029 1077
 
1030
-		foreach ($context['whois_servers'] as $server)
1031
-		echo '
1078
+		foreach ($context['whois_servers'] as $server) {
1079
+				echo '
1032 1080
 			<a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>';
1081
+		}
1033 1082
 		echo '
1034 1083
 		</div>
1035 1084
 		<br>';
@@ -1040,10 +1089,10 @@  discard block
 block discarded – undo
1040 1089
 		<div class="cat_bar">
1041 1090
 			<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
1042 1091
 		</div>';
1043
-	if (empty($context['ips']))
1044
-		echo '
1092
+	if (empty($context['ips'])) {
1093
+			echo '
1045 1094
 		<p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>';
1046
-	else
1095
+	} else
1047 1096
 	{
1048 1097
 		echo '
1049 1098
 		<table class="table_grid">
@@ -1056,12 +1105,13 @@  discard block
 block discarded – undo
1056 1105
 			<tbody>';
1057 1106
 
1058 1107
 		// Loop through each of the members and display them.
1059
-		foreach ($context['ips'] as $ip => $memberlist)
1060
-			echo '
1108
+		foreach ($context['ips'] as $ip => $memberlist) {
1109
+					echo '
1061 1110
 				<tr class="windowbg">
1062 1111
 					<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
1063 1112
 					<td>', implode(', ', $memberlist), '</td>
1064 1113
 				</tr>';
1114
+		}
1065 1115
 
1066 1116
 		echo '
1067 1117
 			</tbody>
@@ -1107,8 +1157,7 @@  discard block
 block discarded – undo
1107 1157
 	{
1108 1158
 		echo '
1109 1159
 		<div class="information">', $txt['showPermissions_all'], '</div>';
1110
-	}
1111
-	else
1160
+	} else
1112 1161
 	{
1113 1162
 		echo '
1114 1163
 		<div class="information">',$txt['showPermissions_help'], '</div>
@@ -1123,9 +1172,10 @@  discard block
 block discarded – undo
1123 1172
 			<div class="windowbg smalltext">
1124 1173
 				', $txt['showPermissions_restricted_boards_desc'], ':<br>';
1125 1174
 			
1126
-			foreach ($context['no_access_boards'] as $no_access_board)
1127
-				echo '
1175
+			foreach ($context['no_access_boards'] as $no_access_board) {
1176
+							echo '
1128 1177
 				<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
1178
+			}
1129 1179
 			echo '
1130 1180
 			</div>';
1131 1181
 		}
@@ -1157,12 +1207,13 @@  discard block
 block discarded – undo
1157 1207
 							</td>
1158 1208
 							<td class="smalltext">';
1159 1209
 
1160
-				if ($permission['is_denied'])
1161
-					echo '
1210
+				if ($permission['is_denied']) {
1211
+									echo '
1162 1212
 								<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1163
-				else
1164
-					echo '
1213
+				} else {
1214
+									echo '
1165 1215
 								', $txt['showPermissions_given'], ':&nbsp;', implode(', ', $permission['groups']['allowed']);
1216
+				}
1166 1217
 
1167 1218
 				echo '
1168 1219
 							</td>
@@ -1173,10 +1224,10 @@  discard block
 block discarded – undo
1173 1224
 				</table>
1174 1225
 			</div><!-- .tborder -->
1175 1226
 			<br>';
1176
-		}
1177
-		else
1178
-			echo '
1227
+		} else {
1228
+					echo '
1179 1229
 			<p class="windowbg2">', $txt['showPermissions_none_general'], '</p>';
1230
+		}
1180 1231
 
1181 1232
 		// Board permission section.
1182 1233
 		echo '
@@ -1186,14 +1237,16 @@  discard block
 block discarded – undo
1186 1237
 						<a id="board_permissions"></a>', $txt['showPermissions_select'], ':
1187 1238
 						<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
1188 1239
 							<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '&nbsp;</option>';
1189
-		if (!empty($context['boards']))
1190
-			echo '
1240
+		if (!empty($context['boards'])) {
1241
+					echo '
1191 1242
 							<option value="" disabled>---------------------------</option>';
1243
+		}
1192 1244
 
1193 1245
 		// Fill the box with any local permission boards.
1194
-		foreach ($context['boards'] as $board)
1195
-			echo '
1246
+		foreach ($context['boards'] as $board) {
1247
+					echo '
1196 1248
 							<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
1249
+		}
1197 1250
 
1198 1251
 		echo '
1199 1252
 						</select>
@@ -1224,8 +1277,7 @@  discard block
 block discarded – undo
1224 1277
 				{
1225 1278
 					echo '
1226 1279
 							<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1227
-				}
1228
-				else
1280
+				} else
1229 1281
 				{
1230 1282
 					echo '
1231 1283
 							', $txt['showPermissions_given'], ': &nbsp;', implode(', ', $permission['groups']['allowed']);
@@ -1237,10 +1289,10 @@  discard block
 block discarded – undo
1237 1289
 			echo '
1238 1290
 				</tbody>
1239 1291
 			</table>';
1240
-		}
1241
-		else
1242
-			echo '
1292
+		} else {
1293
+					echo '
1243 1294
 			<p class="windowbg2">', $txt['showPermissions_none_board'], '</p>';
1295
+		}
1244 1296
 	echo '
1245 1297
 		</div><!-- #permissions -->';
1246 1298
 	}
@@ -1281,9 +1333,10 @@  discard block
 block discarded – undo
1281 1333
 			</div>';
1282 1334
 
1283 1335
 	// If they haven't post at all, don't draw the graph.
1284
-	if (empty($context['posts_by_time']))
1285
-		echo '
1336
+	if (empty($context['posts_by_time'])) {
1337
+			echo '
1286 1338
 			<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1339
+	}
1287 1340
 	// Otherwise do!
1288 1341
 	else
1289 1342
 	{
@@ -1321,11 +1374,10 @@  discard block
 block discarded – undo
1321 1374
 					</h3>
1322 1375
 				</div>';
1323 1376
 
1324
-	if (empty($context['popular_boards']))
1325
-		echo '
1377
+	if (empty($context['popular_boards'])) {
1378
+			echo '
1326 1379
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1327
-
1328
-	else
1380
+	} else
1329 1381
 	{
1330 1382
 		echo '
1331 1383
 				<dl class="stats">';
@@ -1355,10 +1407,10 @@  discard block
 block discarded – undo
1355 1407
 					</h3>
1356 1408
 				</div>';
1357 1409
 
1358
-	if (empty($context['board_activity']))
1359
-		echo '
1410
+	if (empty($context['board_activity'])) {
1411
+			echo '
1360 1412
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1361
-	else
1413
+	} else
1362 1414
 	{
1363 1415
 		echo '
1364 1416
 				<dl class="stats">';
@@ -1409,41 +1461,46 @@  discard block
 block discarded – undo
1409 1461
 				<h3 class="catbg profile_hd">';
1410 1462
 
1411 1463
 		// Don't say "Profile" if this isn't the profile...
1412
-		if (!empty($context['profile_header_text']))
1413
-			echo '
1464
+		if (!empty($context['profile_header_text'])) {
1465
+					echo '
1414 1466
 					', $context['profile_header_text'];
1415
-		else
1416
-			echo '
1467
+		} else {
1468
+					echo '
1417 1469
 					', $txt['profile'];
1470
+		}
1418 1471
 
1419 1472
 		echo '
1420 1473
 				</h3>
1421 1474
 			</div>';
1422 1475
 
1423 1476
 	// Have we some description?
1424
-	if ($context['page_desc'])
1425
-		echo '
1477
+	if ($context['page_desc']) {
1478
+			echo '
1426 1479
 			<p class="information">', $context['page_desc'], '</p>';
1480
+	}
1427 1481
 
1428 1482
 	echo '
1429 1483
 			<div class="roundframe">';
1430 1484
 
1431 1485
 	// Any bits at the start?
1432
-	if (!empty($context['profile_prehtml']))
1433
-		echo '
1486
+	if (!empty($context['profile_prehtml'])) {
1487
+			echo '
1434 1488
 				<div>', $context['profile_prehtml'], '</div>';
1489
+	}
1435 1490
 
1436
-	if (!empty($context['profile_fields']))
1437
-		echo '
1491
+	if (!empty($context['profile_fields'])) {
1492
+			echo '
1438 1493
 				<dl class="settings">';
1494
+	}
1439 1495
 
1440 1496
 	// Start the big old loop 'of love.
1441 1497
 	$lastItem = 'hr';
1442 1498
 	foreach ($context['profile_fields'] as $key => $field)
1443 1499
 	{
1444 1500
 		// We add a little hack to be sure we never get more than one hr in a row!
1445
-		if ($lastItem == 'hr' && $field['type'] == 'hr')
1446
-			continue;
1501
+		if ($lastItem == 'hr' && $field['type'] == 'hr') {
1502
+					continue;
1503
+		}
1447 1504
 
1448 1505
 		$lastItem = $field['type'];
1449 1506
 		if ($field['type'] == 'hr')
@@ -1452,48 +1509,50 @@  discard block
 block discarded – undo
1452 1509
 				</dl>
1453 1510
 				<hr>
1454 1511
 				<dl class="settings">';
1455
-		}
1456
-		elseif ($field['type'] == 'callback')
1512
+		} elseif ($field['type'] == 'callback')
1457 1513
 		{
1458 1514
 			if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
1459 1515
 			{
1460 1516
 				$callback_func = 'template_profile_' . $field['callback_func'];
1461 1517
 				$callback_func();
1462 1518
 			}
1463
-		}
1464
-		else
1519
+		} else
1465 1520
 		{
1466 1521
 			echo '
1467 1522
 					<dt>
1468 1523
 						<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
1469 1524
 
1470 1525
 			// Does it have any subtext to show?
1471
-			if (!empty($field['subtext']))
1472
-				echo '
1526
+			if (!empty($field['subtext'])) {
1527
+							echo '
1473 1528
 						<br>
1474 1529
 						<span class="smalltext">', $field['subtext'], '</span>';
1530
+			}
1475 1531
 
1476 1532
 			echo '
1477 1533
 					</dt>
1478 1534
 					<dd>';
1479 1535
 
1480 1536
 			// Want to put something infront of the box?
1481
-			if (!empty($field['preinput']))
1482
-				echo '
1537
+			if (!empty($field['preinput'])) {
1538
+							echo '
1483 1539
 						', $field['preinput'];
1540
+			}
1484 1541
 
1485 1542
 			// What type of data are we showing?
1486
-			if ($field['type'] == 'label')
1487
-				echo '
1543
+			if ($field['type'] == 'label') {
1544
+							echo '
1488 1545
 						', $field['value'];
1546
+			}
1489 1547
 
1490 1548
 			// Maybe it's a text box - very likely!
1491 1549
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url')))
1492 1550
 			{
1493
-				if ($field['type'] == 'int' || $field['type'] == 'float')
1494
-					$type = 'number';
1495
-				else
1496
-					$type = $field['type'];
1551
+				if ($field['type'] == 'int' || $field['type'] == 'float') {
1552
+									$type = 'number';
1553
+				} else {
1554
+									$type = $field['type'];
1555
+				}
1497 1556
 				$step = $field['type'] == 'float' ? ' step="0.1"' : '';
1498 1557
 
1499 1558
 
@@ -1501,10 +1560,11 @@  discard block
 block discarded – undo
1501 1560
 						<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>';
1502 1561
 			}
1503 1562
 			// You "checking" me out? ;)
1504
-			elseif ($field['type'] == 'check')
1505
-				echo '
1563
+			elseif ($field['type'] == 'check') {
1564
+							echo '
1506 1565
 						<input type="hidden" name="', $key, '" value="0">
1507 1566
 						<input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>';
1567
+			}
1508 1568
 
1509 1569
 			// Always fun - select boxes!
1510 1570
 			elseif ($field['type'] == 'select')
@@ -1515,14 +1575,16 @@  discard block
 block discarded – undo
1515 1575
 				if (isset($field['options']))
1516 1576
 				{
1517 1577
 					// Is this some code to generate the options?
1518
-					if (!is_array($field['options']))
1519
-						$field['options'] = $field['options']();
1578
+					if (!is_array($field['options'])) {
1579
+											$field['options'] = $field['options']();
1580
+					}
1520 1581
 
1521 1582
 					// Assuming we now have some!
1522
-					if (is_array($field['options']))
1523
-						foreach ($field['options'] as $value => $name)
1583
+					if (is_array($field['options'])) {
1584
+											foreach ($field['options'] as $value => $name)
1524 1585
 							echo '
1525 1586
 							<option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>';
1587
+					}
1526 1588
 				}
1527 1589
 
1528 1590
 				echo '
@@ -1530,25 +1592,28 @@  discard block
 block discarded – undo
1530 1592
 			}
1531 1593
 
1532 1594
 			// Something to end with?
1533
-			if (!empty($field['postinput']))
1534
-				echo '
1595
+			if (!empty($field['postinput'])) {
1596
+							echo '
1535 1597
 						', $field['postinput'];
1598
+			}
1536 1599
 
1537 1600
 			echo '
1538 1601
 					</dd>';
1539 1602
 		}
1540 1603
 	}
1541 1604
 
1542
-	if (!empty($context['profile_fields']))
1543
-		echo '
1605
+	if (!empty($context['profile_fields'])) {
1606
+			echo '
1544 1607
 				</dl>';
1608
+	}
1545 1609
 
1546 1610
 	// Are there any custom profile fields - if so print them!
1547 1611
 	if (!empty($context['custom_fields']))
1548 1612
 	{
1549
-		if ($lastItem != 'hr')
1550
-			echo '
1613
+		if ($lastItem != 'hr') {
1614
+					echo '
1551 1615
 				<hr>';
1616
+		}
1552 1617
 
1553 1618
 		echo '
1554 1619
 				<dl class="settings">';
@@ -1571,13 +1636,14 @@  discard block
 block discarded – undo
1571 1636
 	}
1572 1637
 
1573 1638
 	// Any closing HTML?
1574
-	if (!empty($context['profile_posthtml']))
1575
-		echo '
1639
+	if (!empty($context['profile_posthtml'])) {
1640
+			echo '
1576 1641
 				<div>', $context['profile_posthtml'], '</div>';
1642
+	}
1577 1643
 
1578 1644
 	// Only show the password box if it's actually needed.
1579
-	if ($context['require_password'])
1580
-		echo '
1645
+	if ($context['require_password']) {
1646
+			echo '
1581 1647
 				<dl class="settings">
1582 1648
 					<dt>
1583 1649
 						<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br>
@@ -1587,18 +1653,21 @@  discard block
 block discarded – undo
1587 1653
 						<input type="password" name="oldpasswrd" id="oldpasswrd" size="20">
1588 1654
 					</dd>
1589 1655
 				</dl>';
1656
+	}
1590 1657
 
1591 1658
 	// The button shouldn't say "Change profile" unless we're changing the profile...
1592
-	if (!empty($context['submit_button_text']))
1593
-		echo '
1659
+	if (!empty($context['submit_button_text'])) {
1660
+			echo '
1594 1661
 				<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">';
1595
-	else
1596
-		echo '
1662
+	} else {
1663
+			echo '
1597 1664
 				<input type="submit" name="save" value="', $txt['change_profile'], '" class="button">';
1665
+	}
1598 1666
 
1599
-	if (!empty($context['token_check']))
1600
-		echo '
1667
+	if (!empty($context['token_check'])) {
1668
+			echo '
1601 1669
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1670
+	}
1602 1671
 
1603 1672
 	echo '
1604 1673
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1608,10 +1677,11 @@  discard block
 block discarded – undo
1608 1677
 		</form>';
1609 1678
 
1610 1679
 	// Any final spellchecking stuff?
1611
-	if (!empty($context['show_spellchecking']))
1612
-		echo '
1680
+	if (!empty($context['show_spellchecking'])) {
1681
+			echo '
1613 1682
 		<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>';
1614
-}
1683
+	}
1684
+	}
1615 1685
 
1616 1686
 /**
1617 1687
  * Personal Message settings.
@@ -1648,10 +1718,11 @@  discard block
 block discarded – undo
1648 1718
 						<select name="pm_receive_from" id="pm_receive_from">
1649 1719
 							<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
1650 1720
 
1651
-	if (!empty($modSettings['enable_buddylist']))
1652
-		echo '
1721
+	if (!empty($modSettings['enable_buddylist'])) {
1722
+			echo '
1653 1723
 							<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
1654 1724
 							<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
1725
+	}
1655 1726
 
1656 1727
 	echo '
1657 1728
 							<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
@@ -1694,11 +1765,12 @@  discard block
 block discarded – undo
1694 1765
 		if (empty($setting) || !is_array($setting))
1695 1766
 		{
1696 1767
 			// Insert a separator (unless this is the first item in the list)
1697
-			if ($i !== $first_option_key)
1698
-				echo '
1768
+			if ($i !== $first_option_key) {
1769
+							echo '
1699 1770
 				</dl>
1700 1771
 				<hr>
1701 1772
 				<dl class="settings">';
1773
+			}
1702 1774
 
1703 1775
 			// Should we give a name to this section?
1704 1776
 			if (is_string($setting) && !empty($setting))
@@ -1707,52 +1779,57 @@  discard block
 block discarded – undo
1707 1779
 				echo '
1708 1780
 					<dt><strong>' . $setting . '</strong></dt>
1709 1781
 					<dd></dd>';
1782
+			} else {
1783
+							$titled_section = false;
1710 1784
 			}
1711
-			else
1712
-				$titled_section = false;
1713 1785
 
1714 1786
 			continue;
1715 1787
 		}
1716 1788
 
1717 1789
 		// Is this disabled?
1718
-		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
1719
-			continue;
1720
-		elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
1721
-			continue;
1722
-		elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
1723
-			continue;
1724
-		elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
1725
-			continue;
1726
-		elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
1727
-			continue;
1728
-		elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1729
-			continue;
1730
-		elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1731
-			continue;
1790
+		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) {
1791
+					continue;
1792
+		} elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) {
1793
+					continue;
1794
+		} elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) {
1795
+					continue;
1796
+		} elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) {
1797
+					continue;
1798
+		} elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) {
1799
+					continue;
1800
+		} elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1801
+					continue;
1802
+		} elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1803
+					continue;
1804
+		}
1732 1805
 
1733 1806
 		// Some of these may not be set...  Set to defaults here
1734 1807
 		$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod');
1735
-		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']]))
1736
-			$context['member']['options'][$setting['id']] = 0;
1808
+		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) {
1809
+					$context['member']['options'][$setting['id']] = 0;
1810
+		}
1737 1811
 
1738
-		if (!isset($setting['type']) || $setting['type'] == 'bool')
1739
-			$setting['type'] = 'checkbox';
1740
-		elseif ($setting['type'] == 'int' || $setting['type'] == 'integer')
1741
-			$setting['type'] = 'number';
1742
-		elseif ($setting['type'] == 'string')
1743
-			$setting['type'] = 'text';
1812
+		if (!isset($setting['type']) || $setting['type'] == 'bool') {
1813
+					$setting['type'] = 'checkbox';
1814
+		} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
1815
+					$setting['type'] = 'number';
1816
+		} elseif ($setting['type'] == 'string') {
1817
+					$setting['type'] = 'text';
1818
+		}
1744 1819
 
1745
-		if (isset($setting['options']))
1746
-			$setting['type'] = 'list';
1820
+		if (isset($setting['options'])) {
1821
+					$setting['type'] = 'list';
1822
+		}
1747 1823
 
1748 1824
 		echo '
1749 1825
 					<dt>
1750 1826
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
1751 1827
 
1752
-		if (isset($setting['description']))
1753
-			echo '
1828
+		if (isset($setting['description'])) {
1829
+					echo '
1754 1830
 						<br>
1755 1831
 						<span class="smalltext">', $setting['description'], '</span>';
1832
+		}
1756 1833
 		echo '
1757 1834
 					</dt>
1758 1835
 					<dd>';
@@ -1790,13 +1867,11 @@  discard block
 block discarded – undo
1790 1867
 
1791 1868
 				echo '
1792 1869
 						<input type="number"', $min . $max . $step;
1793
-			}
1794
-			else if (isset($setting['type']) && $setting['type'] == 'url')
1870
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
1795 1871
 			{
1796 1872
 				echo'
1797 1873
 						<input type="url"';
1798
-			}
1799
-			else
1874
+			} else
1800 1875
 			{
1801 1876
 				echo '
1802 1877
 						<input type="text"';
@@ -1837,8 +1912,8 @@  discard block
 block discarded – undo
1837 1912
 				<dl class="settings">';
1838 1913
 
1839 1914
 	// Allow notification on announcements to be disabled?
1840
-	if (!empty($modSettings['allow_disableAnnounce']))
1841
-		echo '
1915
+	if (!empty($modSettings['allow_disableAnnounce'])) {
1916
+			echo '
1842 1917
 					<dt>
1843 1918
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
1844 1919
 					</dt>
@@ -1846,15 +1921,17 @@  discard block
 block discarded – undo
1846 1921
 						<input type="hidden" name="notify_announcements" value="0">
1847 1922
 						<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '>
1848 1923
 					</dd>';
1924
+	}
1849 1925
 
1850
-	if (!empty($modSettings['enable_ajax_alerts']))
1851
-		echo '
1926
+	if (!empty($modSettings['enable_ajax_alerts'])) {
1927
+			echo '
1852 1928
 					<dt>
1853 1929
 						<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label>
1854 1930
 					</dt>
1855 1931
 					<dd>
1856 1932
 						<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '">
1857 1933
 					</dd>';
1934
+	}
1858 1935
 
1859 1936
 	echo '
1860 1937
 				</dl>
@@ -1884,9 +1961,10 @@  discard block
 block discarded – undo
1884 1961
 					<td colspan="3">';
1885 1962
 				$label = $txt['alert_opt_' . $opts[1]];
1886 1963
 				$label_pos = isset($opts['label']) ? $opts['label'] : '';
1887
-				if ($label_pos == 'before')
1888
-					echo '
1964
+				if ($label_pos == 'before') {
1965
+									echo '
1889 1966
 						<label for="opt_', $opts[1], '">', $label, '</label>';
1967
+				}
1890 1968
 
1891 1969
 				$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
1892 1970
 				switch ($opts[0])
@@ -1898,17 +1976,19 @@  discard block
 block discarded – undo
1898 1976
 					case 'select':
1899 1977
 						echo '
1900 1978
 						<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
1901
-						foreach ($opts['opts'] as $k => $v)
1902
-							echo '
1979
+						foreach ($opts['opts'] as $k => $v) {
1980
+													echo '
1903 1981
 							<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
1982
+						}
1904 1983
 						echo '
1905 1984
 						</select>';
1906 1985
 						break;
1907 1986
 				}
1908 1987
 
1909
-				if ($label_pos == 'after')
1910
-					echo '
1988
+				if ($label_pos == 'after') {
1989
+									echo '
1911 1990
 						<label for="opt_', $opts[1], '">', $label, '</label>';
1991
+				}
1912 1992
 
1913 1993
 				echo '
1914 1994
 					</td>
@@ -2024,11 +2104,12 @@  discard block
 block discarded – undo
2024 2104
 			<p class="information">', $txt['groupMembership_info'], '</p>';
2025 2105
 
2026 2106
 	// Do we have an update message?
2027
-	if (!empty($context['update_message']))
2028
-		echo '
2107
+	if (!empty($context['update_message'])) {
2108
+			echo '
2029 2109
 			<div class="infobox">
2030 2110
 				', $context['update_message'], '.
2031 2111
 			</div>';
2112
+	}
2032 2113
 
2033 2114
 	echo '
2034 2115
 			<div id="groups">';
@@ -2050,8 +2131,7 @@  discard block
 block discarded – undo
2050 2131
 						</div>
2051 2132
 					</div>
2052 2133
 				</div><!-- .groupmembership -->';
2053
-	}
2054
-	else
2134
+	} else
2055 2135
 	{
2056 2136
 		echo '
2057 2137
 				<div class="title_bar">
@@ -2063,27 +2143,30 @@  discard block
 block discarded – undo
2063 2143
 			echo '
2064 2144
 				<div class="windowbg" id="primdiv_', $group['id'], '">';
2065 2145
 
2066
-				if ($context['can_edit_primary'])
2067
-					echo '
2146
+				if ($context['can_edit_primary']) {
2147
+									echo '
2068 2148
 					<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', '>';
2149
+				}
2069 2150
 
2070 2151
 				echo '
2071 2152
 					<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>';
2072 2153
 
2073 2154
 				// Can they leave their group?
2074
-				if ($group['can_leave'])
2075
-					echo '
2155
+				if ($group['can_leave']) {
2156
+									echo '
2076 2157
 					<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>';
2158
+				}
2077 2159
 
2078 2160
 				echo '
2079 2161
 				</div><!-- .windowbg -->';
2080 2162
 		}
2081 2163
 
2082
-		if ($context['can_edit_primary'])
2083
-			echo '
2164
+		if ($context['can_edit_primary']) {
2165
+					echo '
2084 2166
 				<div class="padding righttext">
2085 2167
 					<input type="submit" value="', $txt['make_primary'], '" class="button">
2086 2168
 				</div>';
2169
+		}
2087 2170
 
2088 2171
 		// Any groups they can join?
2089 2172
 		if (!empty($context['groups']['available']))
@@ -2099,15 +2182,16 @@  discard block
 block discarded – undo
2099 2182
 				<div class="windowbg">
2100 2183
 					<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>' : ''), '';
2101 2184
 
2102
-				if ($group['type'] == 3)
2103
-					echo '
2185
+				if ($group['type'] == 3) {
2186
+									echo '
2104 2187
 					<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>';
2105
-				elseif ($group['type'] == 2 && $group['pending'])
2106
-					echo '
2188
+				} elseif ($group['type'] == 2 && $group['pending']) {
2189
+									echo '
2107 2190
 					<span class="floatright">', $txt['approval_pending'], '</span>';
2108
-				elseif ($group['type'] == 2)
2109
-					echo '
2191
+				} elseif ($group['type'] == 2) {
2192
+									echo '
2110 2193
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>';
2194
+				}
2111 2195
 
2112 2196
 				echo '
2113 2197
 				</div><!-- .windowbg -->';
@@ -2130,9 +2214,10 @@  discard block
 block discarded – undo
2130 2214
 
2131 2215
 						prevDiv.className = "windowbg";
2132 2216
 					}';
2133
-		if (isset($context['groups']['member'][$context['primary_group']]))
2134
-			echo '
2217
+		if (isset($context['groups']['member'][$context['primary_group']])) {
2218
+					echo '
2135 2219
 					highlightSelected("primdiv_' . $context['primary_group'] . '");';
2220
+		}
2136 2221
 		echo '
2137 2222
 				</script>';
2138 2223
 	}
@@ -2140,9 +2225,10 @@  discard block
 block discarded – undo
2140 2225
 	echo '
2141 2226
 			</div><!-- #groups -->';
2142 2227
 
2143
-	if (!empty($context['token_check']))
2144
-		echo '
2228
+	if (!empty($context['token_check'])) {
2229
+			echo '
2145 2230
 			<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2231
+	}
2146 2232
 
2147 2233
 	echo '
2148 2234
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2190,14 +2276,15 @@  discard block
 block discarded – undo
2190 2276
 
2191 2277
 		foreach ($category['boards'] as $board)
2192 2278
 		{
2193
-			if ($i == $limit)
2194
-				echo '
2279
+			if ($i == $limit) {
2280
+							echo '
2195 2281
 						</ul>
2196 2282
 					</li>
2197 2283
 				</ul>
2198 2284
 				<ul class="ignoreboards floatright">
2199 2285
 					<li class="category">
2200 2286
 						<ul>';
2287
+			}
2201 2288
 
2202 2289
 			echo '
2203 2290
 							<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
@@ -2243,10 +2330,11 @@  discard block
 block discarded – undo
2243 2330
 
2244 2331
 	// Work out the starting color.
2245 2332
 	$context['current_color'] = $context['colors'][0];
2246
-	foreach ($context['colors'] as $limit => $color)
2247
-		if ($context['member']['warning'] >= $limit)
2333
+	foreach ($context['colors'] as $limit => $color) {
2334
+			if ($context['member']['warning'] >= $limit)
2248 2335
 			$context['current_color'] = $color;
2249
-}
2336
+	}
2337
+	}
2250 2338
 
2251 2339
 // Show all warnings of a user?
2252 2340
 function template_viewWarning()
@@ -2285,14 +2373,15 @@  discard block
 block discarded – undo
2285 2373
 				</dd>';
2286 2374
 
2287 2375
 	// There's some impact of this?
2288
-	if (!empty($context['level_effects'][$context['current_level']]))
2289
-		echo '
2376
+	if (!empty($context['level_effects'][$context['current_level']])) {
2377
+			echo '
2290 2378
 				<dt>
2291 2379
 					<strong>', $txt['profile_viewwarning_impact'], ':</strong>
2292 2380
 				</dt>
2293 2381
 				<dd>
2294 2382
 					', $context['level_effects'][$context['current_level']], '
2295 2383
 				</dd>';
2384
+	}
2296 2385
 
2297 2386
 	echo '
2298 2387
 			</dl>
@@ -2330,10 +2419,11 @@  discard block
 block discarded – undo
2330 2419
 
2331 2420
 			// Otherwise see what we can do...';
2332 2421
 
2333
-	foreach ($context['notification_templates'] as $k => $type)
2334
-		echo '
2422
+	foreach ($context['notification_templates'] as $k => $type) {
2423
+			echo '
2335 2424
 			if (index == ', $k, ')
2336 2425
 				document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
2426
+	}
2337 2427
 
2338 2428
 	echo '
2339 2429
 		}
@@ -2343,10 +2433,11 @@  discard block
 block discarded – undo
2343 2433
 			// Also set the right effect.
2344 2434
 			effectText = "";';
2345 2435
 
2346
-	foreach ($context['level_effects'] as $limit => $text)
2347
-		echo '
2436
+	foreach ($context['level_effects'] as $limit => $text) {
2437
+			echo '
2348 2438
 			if (slideAmount >= ', $limit, ')
2349 2439
 				effectText = "', $text, '";';
2440
+	}
2350 2441
 
2351 2442
 	echo '
2352 2443
 			setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\');
@@ -2361,32 +2452,35 @@  discard block
 block discarded – undo
2361 2452
 			</h3>
2362 2453
 		</div>';
2363 2454
 
2364
-	if (!$context['user']['is_owner'])
2365
-		echo '
2455
+	if (!$context['user']['is_owner']) {
2456
+			echo '
2366 2457
 		<p class="information">', $txt['profile_warning_desc'], '</p>';
2458
+	}
2367 2459
 
2368 2460
 	echo '
2369 2461
 		<div class="windowbg">
2370 2462
 			<dl class="settings">';
2371 2463
 
2372
-	if (!$context['user']['is_owner'])
2373
-		echo '
2464
+	if (!$context['user']['is_owner']) {
2465
+			echo '
2374 2466
 				<dt>
2375 2467
 					<strong>', $txt['profile_warning_name'], ':</strong>
2376 2468
 				</dt>
2377 2469
 				<dd>
2378 2470
 					<strong>', $context['member']['name'], '</strong>
2379 2471
 				</dd>';
2472
+	}
2380 2473
 
2381 2474
 	echo '
2382 2475
 				<dt>
2383 2476
 					<strong>', $txt['profile_warning_level'], ':</strong>';
2384 2477
 
2385 2478
 	// Is there only so much they can apply?
2386
-	if ($context['warning_limit'])
2387
-		echo '
2479
+	if ($context['warning_limit']) {
2480
+			echo '
2388 2481
 					<br>
2389 2482
 					<span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
2483
+	}
2390 2484
 
2391 2485
 	echo '
2392 2486
 				</dt>
@@ -2441,9 +2535,10 @@  discard block
 block discarded – undo
2441 2535
 						<option value="-1">', $txt['profile_warning_notify_template'], '</option>
2442 2536
 						<option value="-1" disabled>------------------------------</option>';
2443 2537
 
2444
-		foreach ($context['notification_templates'] as $id_template => $template)
2445
-			echo '
2538
+		foreach ($context['notification_templates'] as $id_template => $template) {
2539
+					echo '
2446 2540
 						<option value="', $id_template, '">', $template['title'], '</option>';
2541
+		}
2447 2542
 
2448 2543
 		echo '
2449 2544
 					</select>
@@ -2456,9 +2551,10 @@  discard block
 block discarded – undo
2456 2551
 			</dl>
2457 2552
 			<div class="righttext">';
2458 2553
 
2459
-	if (!empty($context['token_check']))
2460
-		echo '
2554
+	if (!empty($context['token_check'])) {
2555
+			echo '
2461 2556
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2557
+	}
2462 2558
 
2463 2559
 	echo '
2464 2560
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2474,8 +2570,8 @@  discard block
 block discarded – undo
2474 2570
 	echo '
2475 2571
 	<script>';
2476 2572
 
2477
-	if (!$context['user']['is_owner'])
2478
-		echo '
2573
+	if (!$context['user']['is_owner']) {
2574
+			echo '
2479 2575
 		modifyWarnNotify();
2480 2576
 		$(document).ready(function() {
2481 2577
 			$("#preview_button").click(function() {
@@ -2514,6 +2610,7 @@  discard block
 block discarded – undo
2514 2610
 			});
2515 2611
 			return false;
2516 2612
 		}';
2613
+	}
2517 2614
 
2518 2615
 	echo '
2519 2616
 	</script>';
@@ -2536,16 +2633,18 @@  discard block
 block discarded – undo
2536 2633
 			</div>';
2537 2634
 
2538 2635
 	// If deleting another account give them a lovely info box.
2539
-	if (!$context['user']['is_owner'])
2540
-		echo '
2636
+	if (!$context['user']['is_owner']) {
2637
+			echo '
2541 2638
 			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2639
+	}
2542 2640
 	echo '
2543 2641
 			<div class="windowbg2">';
2544 2642
 
2545 2643
 	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2546
-	if ($context['needs_approval'])
2547
-		echo '
2644
+	if ($context['needs_approval']) {
2645
+			echo '
2548 2646
 				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2647
+	}
2549 2648
 
2550 2649
 	// If the user is deleting their own account warn them first - and require a password!
2551 2650
 	if ($context['user']['is_owner'])
@@ -2557,9 +2656,10 @@  discard block
 block discarded – undo
2557 2656
 					<input type="password" name="oldpasswrd" size="20">&nbsp;&nbsp;&nbsp;&nbsp;
2558 2657
 					<input type="submit" value="', $txt['yes'], '" class="button">';
2559 2658
 
2560
-		if (!empty($context['token_check']))
2561
-			echo '
2659
+		if (!empty($context['token_check'])) {
2660
+					echo '
2562 2661
 					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2662
+		}
2563 2663
 
2564 2664
 		echo '
2565 2665
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2589,10 +2689,11 @@  discard block
 block discarded – undo
2589 2689
 						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2590 2690
 					</select>';
2591 2691
 
2592
-			if ($context['show_perma_delete'])
2593
-				echo '
2692
+			if ($context['show_perma_delete']) {
2693
+							echo '
2594 2694
 					<br>
2595 2695
 					<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
2696
+			}
2596 2697
 
2597 2698
 			echo '
2598 2699
 				</div>';
@@ -2605,9 +2706,10 @@  discard block
 block discarded – undo
2605 2706
 				<div>
2606 2707
 					<input type="submit" value="', $txt['delete'], '" class="button">';
2607 2708
 
2608
-		if (!empty($context['token_check']))
2609
-			echo '
2709
+		if (!empty($context['token_check'])) {
2710
+					echo '
2610 2711
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2712
+		}
2611 2713
 
2612 2714
 		echo '
2613 2715
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2633,8 +2735,8 @@  discard block
 block discarded – undo
2633 2735
 					<hr>';
2634 2736
 
2635 2737
 	// Only show the password box if it's actually needed.
2636
-	if ($context['require_password'])
2637
-		echo '
2738
+	if ($context['require_password']) {
2739
+			echo '
2638 2740
 					<dl class="settings">
2639 2741
 						<dt>
2640 2742
 							<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
@@ -2644,13 +2746,15 @@  discard block
 block discarded – undo
2644 2746
 							<input type="password" name="oldpasswrd" size="20">
2645 2747
 						</dd>
2646 2748
 					</dl>';
2749
+	}
2647 2750
 
2648 2751
 	echo '
2649 2752
 					<div class="righttext">';
2650 2753
 
2651
-	if (!empty($context['token_check']))
2652
-		echo '
2754
+	if (!empty($context['token_check'])) {
2755
+			echo '
2653 2756
 						<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2757
+	}
2654 2758
 
2655 2759
 	echo '
2656 2760
 						<input type="submit" value="', $txt['change_profile'], '" class="button">
@@ -2677,9 +2781,10 @@  discard block
 block discarded – undo
2677 2781
 			<ul id="list_errors">';
2678 2782
 
2679 2783
 		// Cycle through each error and display an error message.
2680
-		foreach ($context['post_errors'] as $error)
2681
-			echo '
2784
+		foreach ($context['post_errors'] as $error) {
2785
+					echo '
2682 2786
 				<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
2787
+		}
2683 2788
 
2684 2789
 		echo '
2685 2790
 			</ul>';
@@ -2705,12 +2810,13 @@  discard block
 block discarded – undo
2705 2810
 								<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;"' : ''), '>';
2706 2811
 
2707 2812
 	// Fill the select box with all primary member groups that can be assigned to a member.
2708
-	foreach ($context['member_groups'] as $member_group)
2709
-		if (!empty($member_group['can_be_primary']))
2813
+	foreach ($context['member_groups'] as $member_group) {
2814
+			if (!empty($member_group['can_be_primary']))
2710 2815
 			echo '
2711 2816
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
2712 2817
 										', $member_group['name'], '
2713 2818
 									</option>';
2819
+	}
2714 2820
 	echo '
2715 2821
 								</select>
2716 2822
 							</dd>
@@ -2722,10 +2828,11 @@  discard block
 block discarded – undo
2722 2828
 									<input type="hidden" name="additional_groups[]" value="0">';
2723 2829
 
2724 2830
 	// For each membergroup show a checkbox so members can be assigned to more than one group.
2725
-	foreach ($context['member_groups'] as $member_group)
2726
-		if ($member_group['can_be_additional'])
2831
+	foreach ($context['member_groups'] as $member_group) {
2832
+			if ($member_group['can_be_additional'])
2727 2833
 			echo '
2728 2834
 									<label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>';
2835
+	}
2729 2836
 	echo '
2730 2837
 								</span>
2731 2838
 								<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>
@@ -2785,9 +2892,10 @@  discard block
 block discarded – undo
2785 2892
 								<span class="smalltext">', $txt['sig_info'], '</span><br>
2786 2893
 								<br>';
2787 2894
 
2788
-	if ($context['show_spellchecking'])
2789
-		echo '
2895
+	if ($context['show_spellchecking']) {
2896
+			echo '
2790 2897
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">';
2898
+	}
2791 2899
 
2792 2900
 		echo '
2793 2901
 							</dt>
@@ -2795,17 +2903,20 @@  discard block
 block discarded – undo
2795 2903
 								<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>';
2796 2904
 
2797 2905
 	// If there is a limit at all!
2798
-	if (!empty($context['signature_limits']['max_length']))
2799
-		echo '
2906
+	if (!empty($context['signature_limits']['max_length'])) {
2907
+			echo '
2800 2908
 								<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
2909
+	}
2801 2910
 
2802
-	if (!empty($context['show_preview_button']))
2803
-		echo '
2911
+	if (!empty($context['show_preview_button'])) {
2912
+			echo '
2804 2913
 								<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">';
2914
+	}
2805 2915
 
2806
-	if ($context['signature_warning'])
2807
-		echo '
2916
+	if ($context['signature_warning']) {
2917
+			echo '
2808 2918
 								<span class="smalltext">', $context['signature_warning'], '</span>';
2919
+	}
2809 2920
 
2810 2921
 	// Some javascript used to count how many characters have been used so far in the signature.
2811 2922
 	echo '
@@ -2850,9 +2961,10 @@  discard block
 block discarded – undo
2850 2961
 										<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
2851 2962
 
2852 2963
 		// This lists all the file categories.
2853
-		foreach ($context['avatars'] as $avatar)
2854
-			echo '
2964
+		foreach ($context['avatars'] as $avatar) {
2965
+					echo '
2855 2966
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
2967
+		}
2856 2968
 		echo '
2857 2969
 										</select>
2858 2970
 									</div>
@@ -2909,16 +3021,17 @@  discard block
 block discarded – undo
2909 3021
 								<div id="avatar_gravatar">
2910 3022
 									<img src="' . $context['member']['avatar']['href'] . '" alt="" />';
2911 3023
 
2912
-		if (empty($modSettings['gravatarAllowExtraEmail']))
2913
-			echo '
3024
+		if (empty($modSettings['gravatarAllowExtraEmail'])) {
3025
+					echo '
2914 3026
 									<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>';
2915
-		else
3027
+		} else
2916 3028
 		{
2917 3029
 			// Depending on other stuff, the stored value here might have some odd things in it from other areas.
2918
-			if ($context['member']['avatar']['external'] == $context['member']['email'])
2919
-				$textbox_value = '';
2920
-			else
2921
-				$textbox_value = $context['member']['avatar']['external'];
3030
+			if ($context['member']['avatar']['external'] == $context['member']['email']) {
3031
+							$textbox_value = '';
3032
+			} else {
3033
+							$textbox_value = $context['member']['avatar']['external'];
3034
+			}
2922 3035
 
2923 3036
 			echo '
2924 3037
 									<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div>
@@ -2990,8 +3103,9 @@  discard block
 block discarded – undo
2990 3103
 	$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
2991 3104
 
2992 3105
 	$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
2993
-	if (empty($suffix))
2994
-		return;
3106
+	if (empty($suffix)) {
3107
+			return;
3108
+	}
2995 3109
 
2996 3110
 	echo '
2997 3111
 								<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
@@ -3016,9 +3130,10 @@  discard block
 block discarded – undo
3016 3130
 								<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">';
3017 3131
 
3018 3132
 	// Help the user by showing a list of common time formats.
3019
-	foreach ($context['easy_timeformats'] as $time_format)
3020
-		echo '
3133
+	foreach ($context['easy_timeformats'] as $time_format) {
3134
+			echo '
3021 3135
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
3136
+	}
3022 3137
 	echo '
3023 3138
 								</select><br>
3024 3139
 								<input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30">
@@ -3055,9 +3170,10 @@  discard block
 block discarded – undo
3055 3170
 							<dd>
3056 3171
 								<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\';">';
3057 3172
 	
3058
-	foreach ($context['smiley_sets'] as $set)
3059
-		echo '
3173
+	foreach ($context['smiley_sets'] as $set) {
3174
+			echo '
3060 3175
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
3176
+	}
3061 3177
 	echo '
3062 3178
 								</select>
3063 3179
 								<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=":)">
@@ -3108,10 +3224,11 @@  discard block
 block discarded – undo
3108 3224
 										<img src="', $context['tfa_qr_url'], '" alt="">
3109 3225
 									</div>';
3110 3226
 
3111
-	if (!empty($context['from_ajax']))
3112
-		echo '
3227
+	if (!empty($context['from_ajax'])) {
3228
+			echo '
3113 3229
 					<br>
3114 3230
 					<a href="javascript:self.close();"></a>';
3231
+	}
3115 3232
 
3116 3233
 	echo '
3117 3234
 				</div>
@@ -3150,15 +3267,16 @@  discard block
 block discarded – undo
3150 3267
 								<div class="smalltext">', $txt['tfa_profile_desc'], '</div>
3151 3268
 							</dt>
3152 3269
 							<dd>';
3153
-	if (!$context['tfa_enabled'] && $context['user']['is_owner'])
3154
-		echo '
3270
+	if (!$context['tfa_enabled'] && $context['user']['is_owner']) {
3271
+			echo '
3155 3272
 								<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>';
3156
-	elseif (!$context['tfa_enabled'])
3157
-		echo '
3273
+	} elseif (!$context['tfa_enabled']) {
3274
+			echo '
3158 3275
 								', $txt['tfa_profile_disabled'];
3159
-	else
3160
-		echo '
3276
+	} else {
3277
+			echo '
3161 3278
 							', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable');
3279
+	}
3162 3280
 	echo '
3163 3281
 							</dd>';
3164 3282
 }
Please login to merge, or discard this patch.
Themes/default/ManageBans.template.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,9 +26,10 @@  discard block
 block discarded – undo
26 26
 				</h3>
27 27
 			</div>';
28 28
 
29
-	if ($context['ban']['is_new'])
30
-		echo '
29
+	if ($context['ban']['is_new']) {
30
+			echo '
31 31
 			<div class="information noup">', $txt['ban_add_notes'], '</div>';
32
+	}
32 33
 
33 34
 	// If there were errors creating the ban, show them.
34 35
 	if (!empty($context['error_messages']))
@@ -38,9 +39,10 @@  discard block
 block discarded – undo
38 39
 				<strong>', $txt['ban_errors_detected'], '</strong>
39 40
 				<ul>';
40 41
 
41
-		foreach ($context['error_messages'] as $error)
42
-			echo '
42
+		foreach ($context['error_messages'] as $error) {
43
+					echo '
43 44
 					<li class="error">', $error, '</li>';
45
+		}
44 46
 
45 47
 		echo '
46 48
 				</ul>
@@ -57,8 +59,8 @@  discard block
 block discarded – undo
57 59
 						<input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60">
58 60
 					</dd>';
59 61
 
60
-	if (isset($context['ban']['reason']))
61
-		echo '
62
+	if (isset($context['ban']['reason'])) {
63
+			echo '
62 64
 					<dt>
63 65
 						<strong><label for="reason">', $txt['ban_reason'], ':</label></strong><br>
64 66
 						<span class="smalltext">', $txt['ban_reason_desc'], '</span>
@@ -66,9 +68,10 @@  discard block
 block discarded – undo
66 68
 					<dd>
67 69
 						<textarea name="reason" id="reason" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['reason'], '</textarea>
68 70
 					</dd>';
71
+	}
69 72
 
70
-	if (isset($context['ban']['notes']))
71
-		echo '
73
+	if (isset($context['ban']['notes'])) {
74
+			echo '
72 75
 					<dt>
73 76
 						<strong><label for="ban_notes">', $txt['ban_notes'], ':</label></strong><br>
74 77
 						<span class="smalltext">', $txt['ban_notes_desc'], '</span>
@@ -76,6 +79,7 @@  discard block
 block discarded – undo
76 79
 					<dd>
77 80
 						<textarea name="notes" id="ban_notes" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['notes'], '</textarea>
78 81
 					</dd>';
82
+	}
79 83
 
80 84
 	echo '
81 85
 				</dl>
@@ -115,8 +119,8 @@  discard block
 block discarded – undo
115 119
 							<input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
116 120
 						</dd>';
117 121
 
118
-		if (empty($modSettings['disableHostnameLookup']))
119
-			echo '
122
+		if (empty($modSettings['disableHostnameLookup'])) {
123
+					echo '
120 124
 						<dt>
121 125
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', !empty($context['ban_suggestions']['hostname']) ? ' checked' : '', '>
122 126
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -124,6 +128,7 @@  discard block
 block discarded – undo
124 128
 						<dd>
125 129
 							<input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
126 130
 						</dd>';
131
+		}
127 132
 
128 133
 		echo '
129 134
 						<dt>
@@ -153,14 +158,15 @@  discard block
 block discarded – undo
153 158
 					<dl class="settings">';
154 159
 
155 160
 					$count = 0;
156
-					foreach ($ban_ips as $ip)
157
-						echo '
161
+					foreach ($ban_ips as $ip) {
162
+											echo '
158 163
 						<dt>
159 164
 							<input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]"', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? ' checked' : '', ' value="', $ip, '">
160 165
 						</dt>
161 166
 						<dd>
162 167
 							<label for="suggestions_', $key, '_', $count++, '">', $ip, '</label>
163 168
 						</dd>';
169
+					}
164 170
 
165 171
 					echo '
166 172
 					</dl>';
@@ -202,8 +208,8 @@  discard block
 block discarded – undo
202 208
 		addLoadEvent(fUpdateStatus);';
203 209
 
204 210
 	// Auto suggest only needed for adding new bans, not editing
205
-	if ($context['ban']['is_new'] && empty($_REQUEST['u']))
206
-		echo '
211
+	if ($context['ban']['is_new'] && empty($_REQUEST['u'])) {
212
+			echo '
207 213
 		var oAddMemberSuggest = new smc_AutoSuggest({
208 214
 			sSelf: \'oAddMemberSuggest\',
209 215
 			sSessionId: smf_session_id,
@@ -221,6 +227,7 @@  discard block
 block discarded – undo
221 227
 			return true;
222 228
 		}
223 229
 		oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\');';
230
+	}
224 231
 
225 232
 	echo '
226 233
 		function confirmBan(aForm)
@@ -269,8 +276,8 @@  discard block
 block discarded – undo
269 276
 							<input type="text" name="main_ip" value="', $context['ban_trigger']['ip']['value'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
270 277
 						</dd>';
271 278
 
272
-	if (empty($modSettings['disableHostnameLookup']))
273
-		echo '
279
+	if (empty($modSettings['disableHostnameLookup'])) {
280
+			echo '
274 281
 						<dt>
275 282
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', $context['ban_trigger']['hostname']['selected'] ? ' checked' : '', '>
276 283
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -278,6 +285,7 @@  discard block
 block discarded – undo
278 285
 						<dd>
279 286
 							<input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
280 287
 						</dd>';
288
+	}
281 289
 
282 290
 	echo '
283 291
 						<dt>
Please login to merge, or discard this patch.
Themes/default/ManageMembergroups.template.php 1 patch
Braces   +92 added lines, -66 removed lines patch added patch discarded remove patch
@@ -55,9 +55,10 @@  discard block
 block discarded – undo
55 55
 							<legend>', $txt['membergroups_edit_select_group_type'], '</legend>
56 56
 							<label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
57 57
 
58
-		if ($context['allow_protected'])
59
-			echo '
58
+		if ($context['allow_protected']) {
59
+					echo '
60 60
 							<label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
61
+		}
61 62
 
62 63
 		echo '
63 64
 							<label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
@@ -67,14 +68,15 @@  discard block
 block discarded – undo
67 68
 					</dd>';
68 69
 	}
69 70
 
70
-	if ($context['post_group'] || $context['undefined_group'])
71
-		echo '
71
+	if ($context['post_group'] || $context['undefined_group']) {
72
+			echo '
72 73
 					<dt id="min_posts_text">
73 74
 						<strong>', $txt['membergroups_min_posts'], ':</strong>
74 75
 					</dt>
75 76
 					<dd>
76 77
 						<input type="number" name="min_posts" id="min_posts_input" size="5">
77 78
 					</dd>';
79
+	}
78 80
 
79 81
 	if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups']))
80 82
 	{
@@ -92,9 +94,10 @@  discard block
 block discarded – undo
92 94
 								<option value="-1">', $txt['membergroups_guests'], '</option>
93 95
 								<option value="0" selected>', $txt['membergroups_members'], '</option>';
94 96
 
95
-		foreach ($context['groups'] as $group)
96
-			echo '
97
+		foreach ($context['groups'] as $group) {
98
+					echo '
97 99
 								<option value="', $group['id'], '">', $group['name'], '</option>';
100
+		}
98 101
 
99 102
 		echo '
100 103
 							</select>
@@ -105,9 +108,10 @@  discard block
 block discarded – undo
105 108
 								<option value="-1">', $txt['membergroups_guests'], '</option>
106 109
 								<option value="0" selected>', $txt['membergroups_members'], '</option>';
107 110
 
108
-		foreach ($context['groups'] as $group)
109
-			echo '
111
+		foreach ($context['groups'] as $group) {
112
+					echo '
110 113
 								<option value="', $group['id'], '">', $group['name'], '</option>';
114
+		}
111 115
 
112 116
 		echo '
113 117
 							</select>
@@ -183,8 +187,8 @@  discard block
 block discarded – undo
183 187
 						<input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30">
184 188
 					</dd>';
185 189
 
186
-	if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
187
-		echo '
190
+	if ($context['group']['id'] != 3 && $context['group']['id'] != 4) {
191
+			echo '
188 192
 
189 193
 					<dt id="group_desc_text">
190 194
 						<label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label>
@@ -192,6 +196,7 @@  discard block
 block discarded – undo
192 196
 					<dd>
193 197
 						<textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea>
194 198
 					</dd>';
199
+	}
195 200
 
196 201
 	// Group type...
197 202
 	if ($context['group']['allow_post_group'])
@@ -205,9 +210,10 @@  discard block
 block discarded – undo
205 210
 							<legend>', $txt['membergroups_edit_select_group_type'], '</legend>
206 211
 							<label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0"', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
207 212
 
208
-		if ($context['group']['allow_protected'])
209
-			echo '
213
+		if ($context['group']['allow_protected']) {
214
+					echo '
210 215
 							<label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1"', $context['group']['type'] == 1 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
216
+		}
211 217
 
212 218
 		echo '
213 219
 							<label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2"', $context['group']['type'] == 2 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
@@ -217,8 +223,8 @@  discard block
 block discarded – undo
217 223
 					</dd>';
218 224
 	}
219 225
 
220
-	if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
221
-		echo '
226
+	if ($context['group']['id'] != 3 && $context['group']['id'] != 4) {
227
+			echo '
222 228
 					<dt id="group_moderators_text">
223 229
 						<label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label>
224 230
 					</dt>
@@ -236,6 +242,7 @@  discard block
 block discarded – undo
236 242
 							<option value="2"', $context['group']['hidden'] == 2 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_all'], '</option>
237 243
 						</select>
238 244
 					</dd>';
245
+	}
239 246
 
240 247
 	// Can they inherit permissions?
241 248
 	if ($context['group']['id'] > 1 && $context['group']['id'] != 3)
@@ -252,9 +259,10 @@  discard block
 block discarded – undo
252 259
 							<option value="0"', $context['group']['inherited_from'] == 0 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>';
253 260
 
254 261
 		// For all the inheritable groups show an option.
255
-		foreach ($context['inheritable_groups'] as $id => $group)
256
-			echo '
262
+		foreach ($context['inheritable_groups'] as $id => $group) {
263
+					echo '
257 264
 							<option value="', $id, '"', $context['group']['inherited_from'] == $id ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>';
265
+		}
258 266
 
259 267
 		echo '
260 268
 						</select>
@@ -262,8 +270,8 @@  discard block
 block discarded – undo
262 270
 					</dd>';
263 271
 	}
264 272
 
265
-	if ($context['group']['allow_post_group'])
266
-		echo '
273
+	if ($context['group']['allow_post_group']) {
274
+			echo '
267 275
 
268 276
 					<dt id="min_posts_text">
269 277
 						<label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label>
@@ -271,6 +279,7 @@  discard block
 block discarded – undo
271 279
 					<dd>
272 280
 						<input type="number" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6">
273 281
 					</dd>';
282
+	}
274 283
 
275 284
 	echo '
276 285
 					<dt>
@@ -313,9 +322,10 @@  discard block
 block discarded – undo
313 322
 	}
314 323
 
315 324
 	// No? Hide the entire control.
316
-	else
317
-		echo '
325
+	else {
326
+			echo '
318 327
 					<input type="hidden" name="icon_image" value="">';
328
+	}
319 329
 
320 330
 	echo '
321 331
 					<dt>
@@ -327,8 +337,8 @@  discard block
 block discarded – undo
327 337
 					</dd>';
328 338
 
329 339
 	// Force 2FA for this membergroup?
330
-	if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2)
331
-		echo '
340
+	if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) {
341
+			echo '
332 342
 					<dt>
333 343
 						<label for="group_tfa_force_input"><strong>', $txt['membergroups_tfa_force'], ':</strong></label><br>
334 344
 						<span class="smalltext">', $txt['membergroups_tfa_force_note'], '</span>
@@ -336,6 +346,7 @@  discard block
 block discarded – undo
336 346
 					<dd>
337 347
 						<input type="checkbox" name="group_tfa_force"', $context['group']['tfa_required'] ? ' checked' : '', '>
338 348
 					</dd>';
349
+	}
339 350
 
340 351
 	if (!empty($context['categories']))
341 352
 	{
@@ -346,11 +357,11 @@  discard block
 block discarded – undo
346 357
 					</dt>
347 358
 					<dd>';
348 359
 
349
-		if (!empty($context['can_manage_boards']))
350
-			echo $txt['membergroups_can_manage_access'];
351
-
352
-		else
353
-			template_add_edit_group_boards_list();
360
+		if (!empty($context['can_manage_boards'])) {
361
+					echo $txt['membergroups_can_manage_access'];
362
+		} else {
363
+					template_add_edit_group_boards_list();
364
+		}
354 365
 
355 366
 		echo '
356 367
 					</dd>';
@@ -379,20 +390,21 @@  discard block
 block discarded – undo
379 390
 			sItemListContainerId: \'moderator_container\',
380 391
 			aListItems: [';
381 392
 
382
-	foreach ($context['group']['moderators'] as $id_member => $member_name)
383
-		echo '
393
+	foreach ($context['group']['moderators'] as $id_member => $member_name) {
394
+			echo '
384 395
 				{
385 396
 					sItemId: ', JavaScriptEscape($id_member), ',
386 397
 					sItemName: ', JavaScriptEscape($member_name), '
387 398
 				}', $id_member == $context['group']['last_moderator_id'] ? '' : ',';
399
+	}
388 400
 
389 401
 	echo '
390 402
 			]
391 403
 		});
392 404
 	</script>';
393 405
 
394
-	if ($context['group']['allow_post_group'])
395
-		echo '
406
+	if ($context['group']['allow_post_group']) {
407
+			echo '
396 408
 	<script>
397 409
 		function swapPostGroup(isChecked)
398 410
 		{
@@ -440,7 +452,8 @@  discard block
 block discarded – undo
440 452
 
441 453
 		swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', ');
442 454
 	</script>';
443
-}
455
+	}
456
+	}
444 457
 
445 458
 /**
446 459
  * The template for determining which boards a group has access to.
@@ -458,13 +471,13 @@  discard block
 block discarded – undo
458 471
 
459 472
 	foreach ($context['categories'] as $category)
460 473
 	{
461
-		if (empty($modSettings['deny_boards_access']))
462
-			echo '
474
+		if (empty($modSettings['deny_boards_access'])) {
475
+					echo '
463 476
 									<li class="category">
464 477
 										<a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a>
465 478
 										<ul style="width:100%">';
466
-		else
467
-			echo '
479
+		} else {
480
+					echo '
468 481
 									<li class="category">
469 482
 										<strong>', $category['name'], '</strong>
470 483
 										<span class="select_all_box">
@@ -477,16 +490,17 @@  discard block
 block discarded – undo
477 490
 											</select>
478 491
 										</span>
479 492
 										<ul style="width:100%" id="boards_list_', $category['id'], '">';
493
+		}
480 494
 
481 495
 		foreach ($category['boards'] as $board)
482 496
 		{
483
-			if (empty($modSettings['deny_boards_access']))
484
-				echo '
497
+			if (empty($modSettings['deny_boards_access'])) {
498
+							echo '
485 499
 											<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
486 500
 												<input type="checkbox" name="boardaccess[', $board['id'], ']" id="brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', '> <label for="brd', $board['id'], '">', $board['name'], '</label>
487 501
 											</li>';
488
-			else
489
-				echo '
502
+			} else {
503
+							echo '
490 504
 											<li class="board" style="width:100%">
491 505
 												<span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span>
492 506
 												<span style="width:50%;float:right">
@@ -495,6 +509,7 @@  discard block
 block discarded – undo
495 509
 													<input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny"', $board['deny'] ? ' checked' : '', '> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label>
496 510
 												</span>
497 511
 											</li>';
512
+			}
498 513
 		}
499 514
 
500 515
 		echo '
@@ -505,14 +520,14 @@  discard block
 block discarded – undo
505 520
 	echo '
506 521
 								</ul>';
507 522
 
508
-	if (empty($modSettings['deny_boards_access']))
509
-		echo '
523
+	if (empty($modSettings['deny_boards_access'])) {
524
+			echo '
510 525
 								<br class="clear"><br>
511 526
 								<input type="checkbox" id="checkall_check" onclick="invertAll(this, this.form, \'boardaccess\');">
512 527
 								<label for="checkall_check"><em>', $txt['check_all'], '</em></label>
513 528
 							</fieldset>';
514
-	else
515
-		echo '
529
+	} else {
530
+			echo '
516 531
 								<br class="clear">
517 532
 								<span class="select_all_box">
518 533
 									<em>', $txt['all'], ': </em>
@@ -528,15 +543,17 @@  discard block
 block discarded – undo
528 543
 									});
529 544
 								});
530 545
 							</script>';
546
+	}
531 547
 
532
-	if ($collapse)
533
-		echo '
548
+	if ($collapse) {
549
+			echo '
534 550
 							<a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a>
535 551
 							<script>
536 552
 								document.getElementById("visible_boards_link").style.display = "";
537 553
 								document.getElementById("visible_boards").style.display = "none";
538 554
 							</script>';
539
-}
555
+	}
556
+	}
540 557
 
541 558
 /**
542 559
  * Templatine for viewing the members of a group.
@@ -561,14 +578,15 @@  discard block
 block discarded – undo
561 578
 					</dd>';
562 579
 
563 580
 	// Any description to show?
564
-	if (!empty($context['group']['description']))
565
-		echo '
581
+	if (!empty($context['group']['description'])) {
582
+			echo '
566 583
 					<dt>
567 584
 						<strong>' . $txt['membergroups_members_description'] . ':</strong>
568 585
 					</dt>
569 586
 					<dd>
570 587
 						', $context['group']['description'], '
571 588
 					</dd>';
589
+	}
572 590
 
573 591
 	echo '
574 592
 					<dt>
@@ -582,8 +600,9 @@  discard block
 block discarded – undo
582 600
 	if (!empty($context['group']['moderators']))
583 601
 	{
584 602
 		$moderators = array();
585
-		foreach ($context['group']['moderators'] as $moderator)
586
-			$moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
603
+		foreach ($context['group']['moderators'] as $moderator) {
604
+					$moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
605
+		}
587 606
 
588 607
 		echo '
589 608
 					<dt>
@@ -608,9 +627,10 @@  discard block
 block discarded – undo
608 627
 					<tr class="title_bar">
609 628
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
610 629
 
611
-	if ($context['can_send_email'])
612
-		echo '
630
+	if ($context['can_send_email']) {
631
+			echo '
613 632
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
633
+	}
614 634
 
615 635
 	echo '
616 636
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
@@ -619,19 +639,21 @@  discard block
 block discarded – undo
619 639
 							<a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a>
620 640
 						</th>';
621 641
 
622
-	if (!empty($context['group']['assignable']))
623
-		echo '
642
+	if (!empty($context['group']['assignable'])) {
643
+			echo '
624 644
 						<th style="width: 4%"><input type="checkbox" onclick="invertAll(this, this.form);"></th>';
645
+	}
625 646
 	echo '
626 647
 					</tr>
627 648
 				</thead>
628 649
 				<tbody>';
629 650
 
630
-	if (empty($context['members']))
631
-		echo '
651
+	if (empty($context['members'])) {
652
+			echo '
632 653
 					<tr class="windowbg">
633 654
 						<td colspan="6">', $txt['membergroups_members_no_members'], '</td>
634 655
 					</tr>';
656
+	}
635 657
 
636 658
 	foreach ($context['members'] as $member)
637 659
 	{
@@ -652,9 +674,10 @@  discard block
 block discarded – undo
652 674
 						<td>', $member['registered'], '</td>
653 675
 						<td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>';
654 676
 
655
-		if (!empty($context['group']['assignable']))
656
-			echo '
677
+		if (!empty($context['group']['assignable'])) {
678
+					echo '
657 679
 						<td style="width: 4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>';
680
+		}
658 681
 		echo '
659 682
 					</tr>';
660 683
 	}
@@ -663,11 +686,12 @@  discard block
 block discarded – undo
663 686
 				</tbody>
664 687
 			</table>';
665 688
 
666
-	if (!empty($context['group']['assignable']))
667
-		echo '
689
+	if (!empty($context['group']['assignable'])) {
690
+			echo '
668 691
 			<div class="floatright">
669 692
 				<input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button ">
670 693
 			</div>';
694
+	}
671 695
 
672 696
 	echo '
673 697
 			<div class="pagesection flow_hidden">
@@ -701,8 +725,8 @@  discard block
 block discarded – undo
701 725
 		</form>
702 726
 	</div><!-- #admincenter -->';
703 727
 
704
-	if (!empty($context['group']['assignable']))
705
-		echo '
728
+	if (!empty($context['group']['assignable'])) {
729
+			echo '
706 730
 	<script>
707 731
 		var oAddMemberSuggest = new smc_AutoSuggest({
708 732
 			sSelf: \'oAddMemberSuggest\',
@@ -718,7 +742,8 @@  discard block
 block discarded – undo
718 742
 			sItemListContainerId: \'toAddItemContainer\'
719 743
 		});
720 744
 	</script>';
721
-}
745
+	}
746
+	}
722 747
 
723 748
 /**
724 749
  * Allow the moderator to enter a reason to each user being rejected.
@@ -738,8 +763,8 @@  discard block
 block discarded – undo
738 763
 				<dl class="settings">';
739 764
 
740 765
 	// Loop through and print out a reason box for each...
741
-	foreach ($context['group_requests'] as $request)
742
-		echo '
766
+	foreach ($context['group_requests'] as $request) {
767
+			echo '
743 768
 					<dt>
744 769
 						<strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong>
745 770
 					</dt>
@@ -747,6 +772,7 @@  discard block
 block discarded – undo
747 772
 						<input type="hidden" name="groupr[]" value="', $request['id'], '">
748 773
 						<textarea name="groupreason[', $request['id'], ']" rows="3" cols="40" style="min-width: 80%; max-width: 99%;"></textarea>
749 774
 					</dd>';
775
+	}
750 776
 
751 777
 	echo '
752 778
 				</dl>
Please login to merge, or discard this patch.
Sources/ShowAttachments.php 1 patch
Braces   +59 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 4
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
  * Downloads an avatar or attachment based on $_GET['attach'], and increments the download count.
@@ -40,11 +41,11 @@  discard block
 block discarded – undo
40 41
 
41 42
 	if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0)
42 43
 	{
43
-		if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler')
44
-			$modSettings['enableCompressedOutput'] = 0;
45
-
46
-		else
47
-			ob_start('ob_gzhandler');
44
+		if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') {
45
+					$modSettings['enableCompressedOutput'] = 0;
46
+		} else {
47
+					ob_start('ob_gzhandler');
48
+		}
48 49
 	}
49 50
 
50 51
 	if (empty($modSettings['enableCompressedOutput']))
@@ -76,8 +77,9 @@  discard block
 block discarded – undo
76 77
 	}
77 78
 
78 79
 	// Use cache when possible.
79
-	if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null)
80
-		list($file, $thumbFile) = $cache;
80
+	if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) {
81
+			list($file, $thumbFile) = $cache;
82
+	}
81 83
 
82 84
 	// Get the info from the DB.
83 85
 	if (empty($file) || empty($thumbFile) && !empty($file['id_thumb']))
@@ -85,10 +87,9 @@  discard block
 block discarded – undo
85 87
 		// Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request.
86 88
 		$attachRequest = null;
87 89
 		call_integration_hook('integrate_download_request', array(&$attachRequest));
88
-		if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest))
89
-			$request = $attachRequest;
90
-
91
-		else
90
+		if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) {
91
+					$request = $attachRequest;
92
+		} else
92 93
 		{
93 94
 			// Make sure this attachment is on this board and load its info while we are at it.
94 95
 			$request = $smcFunc['db_query']('', '
@@ -181,13 +182,15 @@  discard block
 block discarded – undo
181 182
 		}
182 183
 
183 184
 		// Cache it.
184
-		if (!empty($file) || !empty($thumbFile))
185
-			cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900));
185
+		if (!empty($file) || !empty($thumbFile)) {
186
+					cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900));
187
+		}
186 188
 	}
187 189
 
188 190
 	// Replace the normal file with its thumbnail if it has one!
189
-	if (!empty($showThumb) && !empty($thumbFile))
190
-		$file = $thumbFile;
191
+	if (!empty($showThumb) && !empty($thumbFile)) {
192
+			$file = $thumbFile;
193
+	}
191 194
 
192 195
 	// No point in a nicer message, because this is supposed to be an attachment anyway...
193 196
 	if (!file_exists($file['filePath']))
@@ -237,8 +240,8 @@  discard block
 block discarded – undo
237 240
 	}
238 241
 
239 242
 	// Update the download counter (unless it's a thumbnail or resuming an incomplete download).
240
-	if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0)
241
-		$smcFunc['db_query']('', '
243
+	if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) {
244
+			$smcFunc['db_query']('', '
242 245
 			UPDATE {db_prefix}attachments
243 246
 			SET downloads = downloads + 1
244 247
 			WHERE id_attach = {int:id_attach}',
@@ -246,12 +249,14 @@  discard block
 block discarded – undo
246 249
 				'id_attach' => $attachId,
247 250
 			)
248 251
 		);
252
+	}
249 253
 
250 254
 	// Send the attachment headers.
251 255
 	header('Pragma: ');
252 256
 
253
-	if (!isBrowser('gecko'))
254
-		header('Content-Transfer-Encoding: binary');
257
+	if (!isBrowser('gecko')) {
258
+			header('Content-Transfer-Encoding: binary');
259
+	}
255 260
 
256 261
 	header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
257 262
 	header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file['filePath'])) . ' GMT');
@@ -260,18 +265,19 @@  discard block
 block discarded – undo
260 265
 	header('ETag: ' . $eTag);
261 266
 
262 267
 	// Make sure the mime type warrants an inline display.
263
-	if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0)
264
-		unset($_REQUEST['image']);
268
+	if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) {
269
+			unset($_REQUEST['image']);
270
+	}
265 271
 
266 272
 	// Does this have a mime type?
267
-	elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff'))))
268
-		header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp')));
269
-
270
-	else
273
+	elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) {
274
+			header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp')));
275
+	} else
271 276
 	{
272 277
 		header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream'));
273
-		if (isset($_REQUEST['image']))
274
-			unset($_REQUEST['image']);
278
+		if (isset($_REQUEST['image'])) {
279
+					unset($_REQUEST['image']);
280
+		}
275 281
 	}
276 282
 
277 283
 	// Convert the file to UTF-8, cuz most browsers dig that.
@@ -279,24 +285,22 @@  discard block
 block discarded – undo
279 285
 	$disposition = !isset($_REQUEST['image']) ? 'attachment' : 'inline';
280 286
 
281 287
 	// Different browsers like different standards...
282
-	if (isBrowser('firefox'))
283
-		header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)));
284
-
285
-	elseif (isBrowser('opera'))
286
-		header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"');
287
-
288
-	elseif (isBrowser('ie'))
289
-		header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"');
290
-
291
-	else
292
-		header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"');
288
+	if (isBrowser('firefox')) {
289
+			header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)));
290
+	} elseif (isBrowser('opera')) {
291
+			header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"');
292
+	} elseif (isBrowser('ie')) {
293
+			header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"');
294
+	} else {
295
+			header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"');
296
+	}
293 297
 
294 298
 	// If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE.
295
-	if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff')))
296
-		header('Cache-Control: no-cache');
297
-
298
-	else
299
-		header('Cache-Control: max-age=' . (525600 * 60) . ', private');
299
+	if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) {
300
+			header('Cache-Control: no-cache');
301
+	} else {
302
+			header('Cache-Control: max-age=' . (525600 * 60) . ', private');
303
+	}
300 304
 
301 305
 	// Multipart and resuming support
302 306
 	if (isset($_SERVER['HTTP_RANGE']))
@@ -304,9 +308,9 @@  discard block
 block discarded – undo
304 308
 		header("HTTP/1.1 206 Partial Content");
305 309
 		header("Content-Length: $new_length");
306 310
 		header("Content-Range: bytes $range-$range_end/$size");
311
+	} else {
312
+			header("Content-Length: " . $size);
307 313
 	}
308
-	else
309
-		header("Content-Length: " . $size);
310 314
 
311 315
 
312 316
 	// Try to buy some time...
@@ -315,8 +319,9 @@  discard block
 block discarded – undo
315 319
 	// For multipart/resumable downloads, send the requested chunk(s) of the file
316 320
 	if (isset($_SERVER['HTTP_RANGE']))
317 321
 	{
318
-		while (@ob_get_level() > 0)
319
-			@ob_end_clean();
322
+		while (@ob_get_level() > 0) {
323
+					@ob_end_clean();
324
+		}
320 325
 
321 326
 		// 40 kilobytes is a good-ish amount
322 327
 		$chunksize = 40 * 1024;
@@ -340,8 +345,9 @@  discard block
 block discarded – undo
340 345
 	elseif ($size > 4194304)
341 346
 	{
342 347
 		// Forcibly end any output buffering going on.
343
-		while (@ob_get_level() > 0)
344
-			@ob_end_clean();
348
+		while (@ob_get_level() > 0) {
349
+					@ob_end_clean();
350
+		}
345 351
 
346 352
 		$fp = fopen($file['filePath'], 'rb');
347 353
 		while (!feof($fp))
@@ -353,8 +359,9 @@  discard block
 block discarded – undo
353 359
 	}
354 360
 
355 361
 	// On some of the less-bright hosts, readfile() is disabled.  It's just a faster, more byte safe, version of what's in the if.
356
-	elseif (@readfile($file['filePath']) === null)
357
-		echo file_get_contents($file['filePath']);
362
+	elseif (@readfile($file['filePath']) === null) {
363
+			echo file_get_contents($file['filePath']);
364
+	}
358 365
 
359 366
 	die();
360 367
 }
Please login to merge, or discard this patch.