Completed
Push — release-2.1 ( 562b90...7c6704 )
by Jeremy
15s
created
Themes/default/Post.template.php 1 patch
Braces   +108 added lines, -73 removed lines patch added patch discarded remove patch
@@ -22,24 +22,26 @@  discard block
 block discarded – undo
22 22
 		<script>';
23 23
 
24 24
 	// When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
25
-	if (isBrowser('is_firefox'))
26
-		echo '
25
+	if (isBrowser('is_firefox')) {
26
+			echo '
27 27
 			window.addEventListener("pageshow", reActivate, false);';
28
+	}
28 29
 
29 30
 	// Start with message icons - and any missing from this theme.
30 31
 	echo '
31 32
 			var icon_urls = {';
32 33
 
33
-	foreach ($context['icons'] as $icon)
34
-		echo '
34
+	foreach ($context['icons'] as $icon) {
35
+			echo '
35 36
 				\'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ',';
37
+	}
36 38
 
37 39
 	echo '
38 40
 			};';
39 41
 
40 42
 	// If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
41
-	if ($context['make_poll'])
42
-		echo '
43
+	if ($context['make_poll']) {
44
+			echo '
43 45
 			var pollOptionNum = 0, pollTabIndex;
44 46
 			var pollOptionId = ', $context['last_choice_id'], ';
45 47
 			function addPollOption()
@@ -58,11 +60,13 @@  discard block
 block discarded – undo
58 60
 
59 61
 				setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<dt><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>:</dt><dd><input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('"></dd><p id="pollMoreOptions"></p>'), ');
60 62
 			}';
63
+	}
61 64
 
62 65
 	// If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here.
63
-	if ($context['make_event'])
64
-		echo '
66
+	if ($context['make_event']) {
67
+			echo '
65 68
 			var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];';
69
+	}
66 70
 
67 71
 	// End of the javascript, start the form and display the link tree.
68 72
 	echo '
@@ -83,9 +87,10 @@  discard block
 block discarded – undo
83 87
 			</div>
84 88
 			<br>';
85 89
 
86
-	if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
87
-		echo '
90
+	if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) {
91
+			echo '
88 92
 			<input type="hidden" name="eventid" value="', $context['event']['id'], '">';
93
+	}
89 94
 
90 95
 	// Start the main table.
91 96
 	echo '
@@ -110,26 +115,29 @@  discard block
 block discarded – undo
110 115
 					</div>';
111 116
 
112 117
 	// If this won't be approved let them know!
113
-	if (!$context['becomes_approved'])
114
-		echo '
118
+	if (!$context['becomes_approved']) {
119
+			echo '
115 120
 					<div class="noticebox">
116 121
 						<em>', $txt['wait_for_approval'], '</em>
117 122
 						<input type="hidden" name="not_approved" value="1">
118 123
 					</div>';
124
+	}
119 125
 
120 126
 	// If it's locked, show a message to warn the replier.
121
-	if (!empty($context['locked']))
122
-	echo '
127
+	if (!empty($context['locked'])) {
128
+		echo '
123 129
 					<div class="errorbox">
124 130
 						', $txt['topic_locked_no_reply'], '
125 131
 					</div>';
132
+	}
126 133
 
127
-	if (!empty($modSettings['drafts_post_enabled']))
128
-		echo '
134
+	if (!empty($modSettings['drafts_post_enabled'])) {
135
+			echo '
129 136
 					<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>',
130 137
 						sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), '
131 138
 						', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), '
132 139
 					</div>';
140
+	}
133 141
 
134 142
 	// The post header... important stuff
135 143
 	echo '
@@ -139,14 +147,15 @@  discard block
 block discarded – undo
139 147
 	// Mod & theme authors can use the 'integrate_post_end' hook to modify or add to these (see Post.php)
140 148
 	if (!empty($context['posting_fields']) && is_array($context['posting_fields']))
141 149
 	{
142
-		foreach ($context['posting_fields'] as $pfid => $pf)
143
-			echo '
150
+		foreach ($context['posting_fields'] as $pfid => $pf) {
151
+					echo '
144 152
 						<dt class="clear', !is_numeric($pfid) ? ' pf_' . $pfid : '', '">
145 153
 							', $pf['dt'], '
146 154
 						</dt>
147 155
 						<dd', !is_numeric($pfid) ? ' class="pf_' . $pfid . '"' : '', '>
148 156
 							', preg_replace('~<(input|select|textarea|button|area|a|object)\b~', '<$1 tabindex="' . $context['tabindex']++ . '"', $pf['dd']), '
149 157
 						</dd>';
158
+		}
150 159
 	}
151 160
 
152 161
 	echo '
@@ -180,9 +189,10 @@  discard block
 block discarded – undo
180 189
 				echo '
181 190
 										<optgroup label="', $category['name'], '">';
182 191
 
183
-				foreach ($category['boards'] as $board)
184
-					echo '
192
+				foreach ($category['boards'] as $board) {
193
+									echo '
185 194
 											<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '</option>';
195
+				}
186 196
 				echo '
187 197
 										</optgroup>';
188 198
 			}
@@ -218,9 +228,10 @@  discard block
 block discarded – undo
218 228
 									<span class="label">', $txt['calendar_timezone'], '</span>
219 229
 									<select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>';
220 230
 
221
-		foreach ($context['all_timezones'] as $tz => $tzname)
222
-			echo '
231
+		foreach ($context['all_timezones'] as $tz => $tzname) {
232
+					echo '
223 233
 										<option', is_numeric($tz) ? ' value="" disabled' : ' value="' . $tz . '"', $tz === $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>';
234
+		}
224 235
 
225 236
 		echo '
226 237
 									</select>
@@ -249,14 +260,15 @@  discard block
 block discarded – undo
249 260
 								</dd>';
250 261
 
251 262
 		// Loop through all the choices and print them out.
252
-		foreach ($context['choices'] as $choice)
253
-			echo '
263
+		foreach ($context['choices'] as $choice) {
264
+					echo '
254 265
 								<dt>
255 266
 									<label for="options-', $choice['id'], '">', $txt['option'], ' ', $choice['number'], '</label>:
256 267
 								</dt>
257 268
 								<dd>
258 269
 									<input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255">
259 270
 								</dd>';
271
+		}
260 272
 
261 273
 		echo '
262 274
 								<p id="pollMoreOptions"></p>
@@ -286,14 +298,15 @@  discard block
 block discarded – undo
286 298
 									<input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', '>
287 299
 								</dd>';
288 300
 
289
-		if ($context['poll_options']['guest_vote_enabled'])
290
-			echo '
301
+		if ($context['poll_options']['guest_vote_enabled']) {
302
+					echo '
291 303
 								<dt>
292 304
 									<label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
293 305
 								</dt>
294 306
 								<dd>
295 307
 									<input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked' : '', '>
296 308
 								</dd>';
309
+		}
297 310
 
298 311
 		echo '
299 312
 								<dt>
@@ -314,8 +327,8 @@  discard block
 block discarded – undo
314 327
 					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
315 328
 
316 329
 	// If we're editing and displaying edit details, show a box where they can say why
317
-	if (isset($context['editing']) && $modSettings['show_modify'])
318
-		echo '
330
+	if (isset($context['editing']) && $modSettings['show_modify']) {
331
+			echo '
319 332
 					<dl>
320 333
 						<dt class="clear">
321 334
 							<span id="caption_edit_reason">', $txt['reason_for_edit'], ':</span>
@@ -324,20 +337,23 @@  discard block
 block discarded – undo
324 337
 							<input type="text" name="modify_reason"', isset($context['last_modified_reason']) ? ' value="' . $context['last_modified_reason'] . '"' : '', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80">
325 338
 						</dd>
326 339
 					</dl>';
340
+	}
327 341
 
328 342
 	// If this message has been edited in the past - display when it was.
329
-	if (isset($context['last_modified']))
330
-		echo '
343
+	if (isset($context['last_modified'])) {
344
+			echo '
331 345
 					<div class="padding smalltext">
332 346
 						', $context['last_modified_text'], '
333 347
 					</div>';
348
+	}
334 349
 
335 350
 	// If the admin has enabled the hiding of the additional options - show a link and image for it.
336
-	if (!empty($modSettings['additional_options_collapsable']))
337
-		echo '
351
+	if (!empty($modSettings['additional_options_collapsable'])) {
352
+			echo '
338 353
 					<div id="postAdditionalOptionsHeader">
339 354
 						<strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
340 355
 					</div>';
356
+	}
341 357
 
342 358
 	echo '
343 359
 					<div id="postAdditionalOptions">';
@@ -370,19 +386,21 @@  discard block
 block discarded – undo
370 386
 								', $txt['uncheck_unwatchd_attach'], ':
371 387
 							</dd>';
372 388
 
373
-		foreach ($context['current_attachments'] as $attachment)
374
-			echo '
389
+		foreach ($context['current_attachments'] as $attachment) {
390
+					echo '
375 391
 							<dd class="smalltext">
376 392
 								<label for="attachment_', $attachment['attachID'], '"><input type="checkbox" id="attachment_', $attachment['attachID'], '" name="attach_del[]" value="', $attachment['attachID'], '"', empty($attachment['unchecked']) ? ' checked' : '', '> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''),
377 393
 								!empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1024) / 1024), 0)) : '', '</label>
378 394
 							</dd>';
395
+		}
379 396
 
380 397
 		echo '
381 398
 						</dl>';
382 399
 
383
-		if (!empty($context['files_in_session_warning']))
384
-			echo '
400
+		if (!empty($context['files_in_session_warning'])) {
401
+					echo '
385 402
 						<div class="smalltext">', $context['files_in_session_warning'], '</div>';
403
+		}
386 404
 	}
387 405
 
388 406
 	// Is the user allowed to post any additional ones? If so give them the boxes to do it!
@@ -447,13 +465,14 @@  discard block
 block discarded – undo
447 465
 									<div class="fallback">
448 466
 										<input type="file" multiple="multiple" name="attachment[]" id="attachment1" class="fallback"> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';
449 467
 
450
-		if (!empty($modSettings['attachmentSizeLimit']))
451
-			echo '
468
+		if (!empty($modSettings['attachmentSizeLimit'])) {
469
+					echo '
452 470
 										<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1024 . '">';
471
+		}
453 472
 
454 473
 		// Show more boxes if they aren't approaching that limit.
455
-		if ($context['num_allowed_attachments'] > 1)
456
-			echo '
474
+		if ($context['num_allowed_attachments'] > 1) {
475
+					echo '
457 476
 										<script>
458 477
 											var allowed_attachments = ', $context['num_allowed_attachments'], ';
459 478
 											var current_attachment = 1;
@@ -473,6 +492,7 @@  discard block
 block discarded – undo
473 492
 										<a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a>
474 493
 									</div><!-- .fallback -->
475 494
 								</div><!-- #attachUpload -->';
495
+		}
476 496
 
477 497
 		echo '
478 498
 							</dd>';
@@ -484,21 +504,25 @@  discard block
 block discarded – undo
484 504
 							<dd class="smalltext">';
485 505
 
486 506
 		// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
487
-		if (!empty($modSettings['attachmentCheckExtensions']))
488
-			echo '
507
+		if (!empty($modSettings['attachmentCheckExtensions'])) {
508
+					echo '
489 509
 								', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br>';
510
+		}
490 511
 
491
-		if (!empty($context['attachment_restrictions']))
492
-			echo '
512
+		if (!empty($context['attachment_restrictions'])) {
513
+					echo '
493 514
 								', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br>';
515
+		}
494 516
 
495
-		if ($context['num_allowed_attachments'] == 0)
496
-			echo '
517
+		if ($context['num_allowed_attachments'] == 0) {
518
+					echo '
497 519
 								', $txt['attach_limit_nag'], '<br>';
520
+		}
498 521
 
499
-		if (!$context['can_post_attachment_unapproved'])
500
-			echo '
522
+		if (!$context['can_post_attachment_unapproved']) {
523
+					echo '
501 524
 								<span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br>';
525
+		}
502 526
 
503 527
 		echo '
504 528
 							</dd>
@@ -522,24 +546,26 @@  discard block
 block discarded – undo
522 546
 							<dt><strong>', $txt['subject'], '</strong></dt>
523 547
 							<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
524 548
 
525
-		foreach ($context['drafts'] as $draft)
526
-			echo '
549
+		foreach ($context['drafts'] as $draft) {
550
+					echo '
527 551
 							<dt>', $draft['link'], '</dt>
528 552
 							<dd>', $draft['poster_time'], '</dd>';
553
+		}
529 554
 		echo '
530 555
 						</dl>
531 556
 					</div>';
532 557
 	}
533 558
 
534 559
 	// Is visual verification enabled?
535
-	if ($context['require_verification'])
536
-		echo '
560
+	if ($context['require_verification']) {
561
+			echo '
537 562
 					<div class="post_verification">
538 563
 						<span', !empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '', '>
539 564
 							<strong>', $txt['verification'], ':</strong>
540 565
 						</span>
541 566
 						', template_control_verification($context['visual_verification_id'], 'all'), '
542 567
 					</div>';
568
+	}
543 569
 
544 570
 	// Finally, the submit buttons.
545 571
 	echo '
@@ -548,9 +574,10 @@  discard block
 block discarded – undo
548 574
 						', template_control_richedit_buttons($context['post_box_name']);
549 575
 
550 576
 	// Option to delete an event if user is editing one.
551
-	if ($context['make_event'] && !$context['event']['new'])
552
-		echo '
577
+	if ($context['make_event'] && !$context['event']['new']) {
578
+			echo '
553 579
 						<input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['event_delete_confirm'] ,'" class="button you_sure">';
580
+	}
554 581
 
555 582
 	echo '
556 583
 					</span>
@@ -559,9 +586,10 @@  discard block
 block discarded – undo
559 586
 			<br class="clear">';
560 587
 
561 588
 	// Assuming this isn't a new topic pass across the last message id.
562
-	if (isset($context['topic_last_message']))
563
-		echo '
589
+	if (isset($context['topic_last_message'])) {
590
+			echo '
564 591
 			<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '">';
592
+	}
565 593
 
566 594
 	echo '
567 595
 			<input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '">
@@ -704,9 +732,10 @@  discard block
 block discarded – undo
704 732
 
705 733
 						newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \'"><div id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \'&nbsp;&#187;</span> <span class="new_posts" id="image_new_\' + newPosts[i].getAttribute("id") + \'">', $txt['new'], '</span></div>\';';
706 734
 
707
-	if ($context['can_quote'])
708
-		echo '
735
+	if ($context['can_quote']) {
736
+			echo '
709 737
 						newPostsHTML += \'<ul class="quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');" class="quote_button"><span>', $txt['quote'], '</span><\' + \'/a></li></ul>\';';
738
+	}
710 739
 
711 740
 	echo '
712 741
 						newPostsHTML += \'<br class="clear">\';
@@ -749,8 +778,8 @@  discard block
 block discarded – undo
749 778
 			}';
750 779
 
751 780
 	// Code for showing and hiding additional options.
752
-	if (!empty($modSettings['additional_options_collapsable']))
753
-		echo '
781
+	if (!empty($modSettings['additional_options_collapsable'])) {
782
+			echo '
754 783
 			var oSwapAdditionalOptions = new smc_Toggle({
755 784
 				bToggleEnabled: true,
756 785
 				bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ',
@@ -778,10 +807,11 @@  discard block
 block discarded – undo
778 807
 					}
779 808
 				]
780 809
 			});';
810
+	}
781 811
 
782 812
 	// Code for showing and hiding drafts
783
-	if (!empty($context['drafts']))
784
-		echo '
813
+	if (!empty($context['drafts'])) {
814
+			echo '
785 815
 			var oSwapDraftOptions = new smc_Toggle({
786 816
 				bToggleEnabled: true,
787 817
 				bCurrentlyCollapsed: true,
@@ -803,6 +833,7 @@  discard block
 block discarded – undo
803 833
 					}
804 834
 				]
805 835
 			});';
836
+	}
806 837
 
807 838
 	echo '
808 839
 			var oEditorID = "', $context['post_box_name'] ,'";
@@ -823,8 +854,9 @@  discard block
 block discarded – undo
823 854
 		foreach ($context['previous_posts'] as $post)
824 855
 		{
825 856
 			$ignoring = false;
826
-			if (!empty($post['is_ignored']))
827
-				$ignored_posts[] = $ignoring = $post['id'];
857
+			if (!empty($post['is_ignored'])) {
858
+							$ignored_posts[] = $ignoring = $post['id'];
859
+			}
828 860
 
829 861
 			echo '
830 862
 			<div class="windowbg">
@@ -834,22 +866,24 @@  discard block
 block discarded – undo
834 866
 					</h5>
835 867
 					&nbsp;-&nbsp;', $post['time'];
836 868
 
837
-			if ($context['can_quote'])
838
-				echo '
869
+			if ($context['can_quote']) {
870
+							echo '
839 871
 					<ul class="quickbuttons" id="msg_', $post['id'], '_quote">
840 872
 						<li style="display:none;" id="quoteSelected_', $post['id'], '" data-msgid="', $post['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'] ,'</a></li>
841 873
 						<li id="post_modify"><a href="#postmodify" onclick="return insertQuoteFast(', $post['id'], ');"><span class="generic_icons quote"></span>', $txt['quote'], '</a></li>
842 874
 					</ul>';
875
+			}
843 876
 
844 877
 			echo '
845 878
 					<br class="clear">';
846 879
 
847
-			if ($ignoring)
848
-				echo '
880
+			if ($ignoring) {
881
+							echo '
849 882
 					<div id="msg_', $post['id'], '_ignored_prompt" class="smalltext">
850 883
 						', $txt['ignoring_user'], '
851 884
 						<a href="#" id="msg_', $post['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
852 885
 					</div>';
886
+			}
853 887
 
854 888
 			echo '
855 889
 					<div class="list_posts smalltext" id="msg_', $post['id'], '_body" data-msgid="', $post['id'], '">', $post['message'], '</div>
@@ -1004,10 +1038,10 @@  discard block
 block discarded – undo
1004 1038
 		<div id="temporary_posting_area" style="display: none;"></div>
1005 1039
 		<script>';
1006 1040
 
1007
-	if ($context['close_window'])
1008
-		echo '
1041
+	if ($context['close_window']) {
1042
+			echo '
1009 1043
 			window.close();';
1010
-	else
1044
+	} else
1011 1045
 	{
1012 1046
 		// Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;)
1013 1047
 		echo '
@@ -1061,11 +1095,12 @@  discard block
 block discarded – undo
1061 1095
 				</p>
1062 1096
 				<ul>';
1063 1097
 
1064
-	foreach ($context['groups'] as $group)
1065
-		echo '
1098
+	foreach ($context['groups'] as $group) {
1099
+			echo '
1066 1100
 					<li>
1067 1101
 						<label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em>
1068 1102
 					</li>';
1103
+	}
1069 1104
 
1070 1105
 	echo '
1071 1106
 					<li>
Please login to merge, or discard this patch.
Themes/default/MessageIndex.template.php 1 patch
Braces   +103 added lines, -72 removed lines patch added patch discarded remove patch
@@ -18,11 +18,12 @@  discard block
 block discarded – undo
18 18
 	global $context, $settings, $options, $scripturl, $modSettings, $txt;
19 19
 
20 20
 	// Let them know why their message became unapproved.
21
-	if ($context['becomesUnapproved'])
22
-		echo '
21
+	if ($context['becomesUnapproved']) {
22
+			echo '
23 23
 	<div class="noticebox">
24 24
 		', $txt['post_becomesUnapproved'], '
25 25
 	</div>';
26
+	}
26 27
 
27 28
 	if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0))
28 29
 	{
@@ -46,17 +47,19 @@  discard block
 block discarded – undo
46 47
 				</a>';
47 48
 
48 49
 			// Has it outstanding posts for approval?
49
-			if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
50
-				echo '
50
+			if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) {
51
+							echo '
51 52
 				<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';
53
+			}
52 54
 
53 55
 			echo '
54 56
 				<p class="board_description">', $board['description'], '</p>';
55 57
 
56 58
 			// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
57
-			if (!empty($board['moderators']) || !empty($board['moderator_groups']))
58
-				echo '
59
+			if (!empty($board['moderators']) || !empty($board['moderator_groups'])) {
60
+							echo '
59 61
 				<p class="moderators">', count($board['link_moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
62
+			}
60 63
 
61 64
 			// Show some basic information about the number of posts, etc.
62 65
 			echo '
@@ -68,9 +71,10 @@  discard block
 block discarded – undo
68 71
 			</div>
69 72
 			<div class="lastpost lpr_border">';
70 73
 
71
-			if (!empty($board['last_post']['id']))
72
-				echo '
74
+			if (!empty($board['last_post']['id'])) {
75
+							echo '
73 76
 				<p>', $board['last_post']['last_post_message'], '</p>';
77
+			}
74 78
 
75 79
 			echo '
76 80
 			</div>';
@@ -84,14 +88,16 @@  discard block
 block discarded – undo
84 88
 					id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
85 89
 				foreach ($board['children'] as $child)
86 90
 				{
87
-					if (!$child['is_redirect'])
88
-						$child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')" class="new_posts">' . $txt['new'] . '</a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
89
-					else
90
-						$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
91
+					if (!$child['is_redirect']) {
92
+											$child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')" class="new_posts">' . $txt['new'] . '</a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
93
+					} else {
94
+											$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
95
+					}
91 96
 
92 97
 					// Has it posts awaiting approval?
93
-					if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
94
-						$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
98
+					if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics'])) {
99
+											$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
100
+					}
95 101
 
96 102
 					$children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>';
97 103
 				}
@@ -113,11 +119,12 @@  discard block
 block discarded – undo
113 119
 	if (!$context['no_topic_listing'])
114 120
 	{
115 121
 		// Mobile action buttons (top)
116
-		if (!empty($context['normal_buttons']))
117
-		echo '
122
+		if (!empty($context['normal_buttons'])) {
123
+				echo '
118 124
 	<div class="mobile_buttons floatright">
119 125
 		<a class="button mobile_act">', $txt['mobile_action'], '</a>
120 126
 	</div>';
127
+		}
121 128
 
122 129
 		echo '
123 130
 	<div class="pagesection">
@@ -136,13 +143,15 @@  discard block
 block discarded – undo
136 143
 		<h3>', $context['name'], '</h3>
137 144
 		<p>';
138 145
 
139
-			if ($context['description'] != '')
140
-				echo '
146
+			if ($context['description'] != '') {
147
+							echo '
141 148
 			', $context['description'];
149
+			}
142 150
 
143
-			if (!empty($context['moderators']))
144
-				echo '
151
+			if (!empty($context['moderators'])) {
152
+							echo '
145 153
 			', count($context['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $context['link_moderators']), '.';
154
+			}
146 155
 
147 156
 			echo '
148 157
 		</p>
@@ -150,9 +159,10 @@  discard block
 block discarded – undo
150 159
 		}
151 160
 
152 161
 		// If Quick Moderation is enabled start the form.
153
-		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
154
-			echo '
162
+		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) {
163
+					echo '
155 164
 	<form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" class="clear" name="quickModForm" id="quickModForm">';
165
+		}
156 166
 
157 167
 		echo '
158 168
 		<div id="messageindex">';
@@ -162,11 +172,11 @@  discard block
 block discarded – undo
162 172
 			echo '
163 173
 			<div class="information">';
164 174
 
165
-			if ($settings['display_who_viewing'] == 1)
166
-				echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
167
-
168
-			else
169
-				echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
175
+			if ($settings['display_who_viewing'] == 1) {
176
+							echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
177
+			} else {
178
+							echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
179
+			}
170 180
 			echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'];
171 181
 
172 182
 		echo '
@@ -186,32 +196,36 @@  discard block
 block discarded – undo
186 196
 				<div class="lastpost">', $context['topics_headers']['last_post'], '</div>';
187 197
 
188 198
 			// Show a "select all" box for quick moderation?
189
-			if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1)
190
-				echo '
199
+			if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) {
200
+							echo '
191 201
 				<div class="moderation">
192 202
 					<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">
193 203
 				</div>';
204
+			}
194 205
 
195 206
 			// If it's on in "image" mode, don't show anything but the column.
196
-			elseif (!empty($context['can_quick_mod']))
197
-				echo '
207
+			elseif (!empty($context['can_quick_mod'])) {
208
+							echo '
198 209
 				<div class="moderation"></div>';
210
+			}
199 211
 		}
200 212
 
201 213
 		// No topics... just say, "sorry bub".
202
-		else
203
-			echo '
214
+		else {
215
+					echo '
204 216
 				<h3 class="titlebg">', $txt['topic_alert_none'], '</h3>';
217
+		}
205 218
 
206 219
 		echo '
207 220
 			</div><!-- #topic_header -->';
208 221
 
209 222
 		// If this person can approve items and we have some awaiting approval tell them.
210
-		if (!empty($context['unapproved_posts_message']))
211
-			echo '
223
+		if (!empty($context['unapproved_posts_message'])) {
224
+					echo '
212 225
 			<div class="information">
213 226
 				<span class="alert">!</span> ', $context['unapproved_posts_message'], '
214 227
 			</div>';
228
+		}
215 229
 
216 230
 		// Contain the topic list
217 231
 		echo '
@@ -232,25 +246,30 @@  discard block
 block discarded – undo
232 246
 			echo '
233 247
 							<div class="icons floatright">';
234 248
 
235
-			if ($topic['is_watched'])
236
-				echo '
249
+			if ($topic['is_watched']) {
250
+							echo '
237 251
 								<span class="generic_icons watch" title="', $txt['watching_this_topic'], '"></span>';
252
+			}
238 253
 
239
-			if ($topic['is_locked'])
240
-				echo '
254
+			if ($topic['is_locked']) {
255
+							echo '
241 256
 								<span class="generic_icons lock"></span>';
257
+			}
242 258
 
243
-			if ($topic['is_sticky'])
244
-				echo '
259
+			if ($topic['is_sticky']) {
260
+							echo '
245 261
 								<span class="generic_icons sticky"></span>';
262
+			}
246 263
 
247
-			if ($topic['is_redirect'])
248
-				echo '
264
+			if ($topic['is_redirect']) {
265
+							echo '
249 266
 								<span class="generic_icons move"></span>';
267
+			}
250 268
 
251
-			if ($topic['is_poll'])
252
-				echo '
269
+			if ($topic['is_poll']) {
270
+							echo '
253 271
 								<span class="generic_icons poll"></span>';
272
+			}
254 273
 
255 274
 			echo '
256 275
 							</div>';
@@ -282,26 +301,31 @@  discard block
 block discarded – undo
282 301
 				echo '
283 302
 					<div class="moderation">';
284 303
 
285
-				if ($options['display_quick_mod'] == 1)
286
-					echo '
304
+				if ($options['display_quick_mod'] == 1) {
305
+									echo '
287 306
 						<input type="checkbox" name="topics[]" value="', $topic['id'], '">';
288
-				else
307
+				} else
289 308
 				{
290 309
 					// Check permissions on each and show only the ones they are allowed to use.
291
-					if ($topic['quick_mod']['remove'])
292
-						echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>';
310
+					if ($topic['quick_mod']['remove']) {
311
+											echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>';
312
+					}
293 313
 
294
-					if ($topic['quick_mod']['lock'])
295
-						echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>';
314
+					if ($topic['quick_mod']['lock']) {
315
+											echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>';
316
+					}
296 317
 
297
-					if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
298
-						echo '<br>';
318
+					if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) {
319
+											echo '<br>';
320
+					}
299 321
 
300
-					if ($topic['quick_mod']['sticky'])
301
-						echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>';
322
+					if ($topic['quick_mod']['sticky']) {
323
+											echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>';
324
+					}
302 325
 
303
-					if ($topic['quick_mod']['move'])
304
-						echo '<a href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>';
326
+					if ($topic['quick_mod']['move']) {
327
+											echo '<a href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>';
328
+					}
305 329
 				}
306 330
 				echo '
307 331
 					</div><!-- .moderation -->';
@@ -319,18 +343,20 @@  discard block
 block discarded – undo
319 343
 				<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
320 344
 					<option value="">--------</option>';
321 345
 
322
-			foreach ($context['qmod_actions'] as $qmod_action)
323
-				if ($context['can_' . $qmod_action])
346
+			foreach ($context['qmod_actions'] as $qmod_action) {
347
+							if ($context['can_' . $qmod_action])
324 348
 					echo '
325 349
 					<option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>';
350
+			}
326 351
 
327 352
 			echo '
328 353
 				</select>';
329 354
 
330 355
 			// Show a list of boards they can move the topic to.
331
-			if ($context['can_move'])
332
-				echo '
356
+			if ($context['can_move']) {
357
+							echo '
333 358
 				<span id="quick_mod_jump_to"></span>';
359
+			}
334 360
 
335 361
 			echo '
336 362
 				<input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' &amp;&amp; confirm(\'', $txt['quickmod_confirm'], '\');" class="button qaction">
@@ -341,17 +367,19 @@  discard block
 block discarded – undo
341 367
 		</div><!-- #messageindex -->';
342 368
 
343 369
 		// Finish off the form - again.
344
-		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
345
-			echo '
370
+		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) {
371
+					echo '
346 372
 		<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '">
347 373
 	</form>';
374
+		}
348 375
 
349 376
 		// Mobile action buttons (bottom)
350
-		if (!empty($context['normal_buttons']))
351
-		echo '
377
+		if (!empty($context['normal_buttons'])) {
378
+				echo '
352 379
 	<div class="mobile_buttons floatright">
353 380
 		<a class="button mobile_act">', $txt['mobile_action'], '</a>
354 381
 	</div>';
382
+		}
355 383
 
356 384
 		echo '
357 385
 	<div class="pagesection">
@@ -367,8 +395,8 @@  discard block
 block discarded – undo
367 395
 	// Show breadcrumbs at the bottom too.
368 396
 	theme_linktree();
369 397
 
370
-	if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move'])
371
-		echo '
398
+	if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) {
399
+			echo '
372 400
 	<script>
373 401
 		if (typeof(window.XMLHttpRequest) != "undefined")
374 402
 			aJumpTo[aJumpTo.length] = new JumpTo({
@@ -387,6 +415,7 @@  discard block
 block discarded – undo
387 415
 				sCustomName: "move_to"
388 416
 			});
389 417
 	</script>';
418
+	}
390 419
 
391 420
 	// Javascript for inline editing.
392 421
 	echo '
@@ -423,8 +452,8 @@  discard block
 block discarded – undo
423 452
 		<div class="information">
424 453
 			<p class="floatright" id="message_index_jump_to"></p>';
425 454
 
426
-	if (empty($context['no_topic_listing']))
427
-		echo '
455
+	if (empty($context['no_topic_listing'])) {
456
+			echo '
428 457
 			<p class="floatleft">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? '
429 458
 				<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="" class="centericon"> ' . $txt['participation_caption'] . '<br>' : '', '
430 459
 				'. ($modSettings['pollMode'] == '1' ? '<span class="generic_icons poll centericon"></span> ' . $txt['poll'] : '') . '<br>
@@ -434,9 +463,10 @@  discard block
 block discarded – undo
434 463
 				<span class="generic_icons lock centericon"></span> ' . $txt['locked_topic'] . '<br>
435 464
 				<span class="generic_icons sticky centericon"></span> ' . $txt['sticky_topic'] . '<br>
436 465
 			</p>';
466
+	}
437 467
 
438
-	if (!empty($context['jump_to']))
439
-		echo '
468
+	if (!empty($context['jump_to'])) {
469
+			echo '
440 470
 			<script>
441 471
 				if (typeof(window.XMLHttpRequest) != "undefined")
442 472
 					aJumpTo[aJumpTo.length] = new JumpTo({
@@ -452,6 +482,7 @@  discard block
 block discarded – undo
452 482
 						sGoButtonLabel: "', $txt['quick_mod_go'], '"
453 483
 					});
454 484
 			</script>';
485
+	}
455 486
 
456 487
 	echo '
457 488
 			<br class="clear">
Please login to merge, or discard this patch.
Themes/default/Display.template.php 1 patch
Braces   +254 added lines, -174 removed lines patch added patch discarded remove patch
@@ -18,18 +18,20 @@  discard block
 block discarded – undo
18 18
 	global $context, $settings, $options, $txt, $scripturl, $modSettings;
19 19
 
20 20
 	// Let them know, if their report was a success!
21
-	if ($context['report_sent'])
22
-		echo '
21
+	if ($context['report_sent']) {
22
+			echo '
23 23
 		<div class="infobox">
24 24
 			', $txt['report_sent'], '
25 25
 		</div>';
26
+	}
26 27
 
27 28
 	// Let them know why their message became unapproved.
28
-	if ($context['becomesUnapproved'])
29
-		echo '
29
+	if ($context['becomesUnapproved']) {
30
+			echo '
30 31
 		<div class="noticebox">
31 32
 			', $txt['post_becomesUnapproved'], '
32 33
 		</div>';
34
+	}
33 35
 
34 36
 	// Show new topic info here?
35 37
 	echo '
@@ -49,11 +51,13 @@  discard block
 block discarded – undo
49 51
 			<p>';
50 52
 
51 53
 		// Show just numbers...?
52
-		if ($settings['display_who_viewing'] == 1)
53
-			echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
54
+		if ($settings['display_who_viewing'] == 1) {
55
+					echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
56
+		}
54 57
 		// Or show the actual people viewing the topic?
55
-		else
56
-			echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
58
+		else {
59
+					echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
60
+		}
57 61
 
58 62
 		// Now show how many guests are here too.
59 63
 		echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
@@ -91,10 +95,11 @@  discard block
 block discarded – undo
91 95
 						<dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
92 96
 						<dd class="statsbar generic_bar', $option['voted_this'] ? ' voted' : '', '">';
93 97
 
94
-				if ($context['allow_results_view'])
95
-					echo '
98
+				if ($context['allow_results_view']) {
99
+									echo '
96 100
 							', $option['bar_ndt'], '
97 101
 							<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';
102
+				}
98 103
 
99 104
 				echo '
100 105
 						</dd>';
@@ -103,9 +108,10 @@  discard block
 block discarded – undo
103 108
 			echo '
104 109
 					</dl>';
105 110
 
106
-			if ($context['allow_results_view'])
107
-				echo '
111
+			if ($context['allow_results_view']) {
112
+							echo '
108 113
 					<p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>';
114
+			}
109 115
 		}
110 116
 		// They are allowed to vote! Go to it!
111 117
 		else
@@ -114,17 +120,19 @@  discard block
 block discarded – undo
114 120
 					<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">';
115 121
 
116 122
 			// Show a warning if they are allowed more than one option.
117
-			if ($context['poll']['allowed_warning'])
118
-				echo '
123
+			if ($context['poll']['allowed_warning']) {
124
+							echo '
119 125
 						<p class="smallpadding">', $context['poll']['allowed_warning'], '</p>';
126
+			}
120 127
 
121 128
 			echo '
122 129
 						<ul class="options">';
123 130
 
124 131
 			// Show each option with its button - a radio likely.
125
-			foreach ($context['poll']['options'] as $option)
126
-				echo '
132
+			foreach ($context['poll']['options'] as $option) {
133
+							echo '
127 134
 							<li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
135
+			}
128 136
 
129 137
 			echo '
130 138
 						</ul>
@@ -136,9 +144,10 @@  discard block
 block discarded – undo
136 144
 		}
137 145
 
138 146
 		// Is the clock ticking?
139
-		if (!empty($context['poll']['expire_time']))
140
-			echo '
147
+		if (!empty($context['poll']['expire_time'])) {
148
+					echo '
141 149
 					<p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>';
150
+		}
142 151
 
143 152
 		echo '
144 153
 				</div><!-- #poll_options -->
@@ -168,11 +177,13 @@  discard block
 block discarded – undo
168 177
 				<li>
169 178
 					<strong class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></strong>';
170 179
 
171
-			if ($event['can_edit'])
172
-				echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
180
+			if ($event['can_edit']) {
181
+							echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
182
+			}
173 183
 
174
-			if ($event['can_export'])
175
-				echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
184
+			if ($event['can_export']) {
185
+							echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
186
+			}
176 187
 
177 188
 			echo '
178 189
 					<br>';
@@ -180,14 +191,14 @@  discard block
 block discarded – undo
180 191
 			if (!empty($event['allday']))
181 192
 			{
182 193
 				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : '';
183
-			}
184
-			else
194
+			} else
185 195
 			{
186 196
 				// Display event info relative to user's local timezone
187 197
 				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
188 198
 
189
-				if ($event['start_date_local'] != $event['end_date_local'])
190
-					echo trim($event['end_date_local']) . ', ';
199
+				if ($event['start_date_local'] != $event['end_date_local']) {
200
+									echo trim($event['end_date_local']) . ', ';
201
+				}
191 202
 
192 203
 				echo trim($event['end_time_local']);
193 204
 
@@ -196,24 +207,28 @@  discard block
 block discarded – undo
196 207
 				{
197 208
 					echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">';
198 209
 
199
-					if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig'])
200
-						echo trim($event['start_date_orig']), ', ';
210
+					if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) {
211
+											echo trim($event['start_date_orig']), ', ';
212
+					}
201 213
 
202 214
 					echo trim($event['start_time_orig']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
203 215
 
204
-					if ($event['start_date_orig'] != $event['end_date_orig'])
205
-						echo trim($event['end_date_orig']) . ', ';
216
+					if ($event['start_date_orig'] != $event['end_date_orig']) {
217
+											echo trim($event['end_date_orig']) . ', ';
218
+					}
206 219
 
207 220
 					echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)';
208 221
 				}
209 222
 				// Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion
210
-				else
211
-					echo ' ', $event['tz_abbrev'], '</time>';
223
+				else {
224
+									echo ' ', $event['tz_abbrev'], '</time>';
225
+				}
212 226
 			}
213 227
 
214
-			if (!empty($event['location']))
215
-				echo '
228
+			if (!empty($event['location'])) {
229
+							echo '
216 230
 					<br>', $event['location'];
231
+			}
217 232
 
218 233
 			echo '
219 234
 				</li>';
@@ -235,12 +250,13 @@  discard block
 block discarded – undo
235 250
 		</div>';
236 251
 
237 252
 	// Mobile action - moderation buttons (top)
238
-	if (!empty($context['normal_buttons']))
239
-	echo '
253
+	if (!empty($context['normal_buttons'])) {
254
+		echo '
240 255
 		<div class="mobile_buttons floatright">
241 256
 			<a class="button mobile_act">', $txt['mobile_action'], '</a>
242 257
 			', !empty($context['mod_buttons']) ? '<a class="button mobile_mod">' . $txt['mobile_moderation'] . '</a>' : '', '
243 258
 		</div>';
259
+	}
244 260
 
245 261
 	// Show the topic information - icon, subject, etc.
246 262
 	echo '
@@ -251,20 +267,22 @@  discard block
 block discarded – undo
251 267
 	$context['removableMessageIDs'] = array();
252 268
 
253 269
 	// Get all the messages...
254
-	while ($message = $context['get_message']())
255
-		template_single_post($message);
270
+	while ($message = $context['get_message']()) {
271
+			template_single_post($message);
272
+	}
256 273
 
257 274
 	echo '
258 275
 			</form>
259 276
 		</div><!-- #forumposts -->';
260 277
 
261 278
 	// Mobile action - moderation buttons (bottom)
262
-	if (!empty($context['normal_buttons']))
263
-	echo '
279
+	if (!empty($context['normal_buttons'])) {
280
+		echo '
264 281
 		<div class="mobile_buttons floatright">
265 282
 			<a class="button mobile_act">', $txt['mobile_action'], '</a>
266 283
 			', !empty($context['mod_buttons']) ? '<a class="button mobile_mod">' . $txt['mobile_moderation'] . '</a>' : '', '
267 284
 		</div>';
285
+	}
268 286
 
269 287
 	// Show the page index... "Pages: [1]".
270 288
 	echo '
@@ -291,8 +309,9 @@  discard block
 block discarded – undo
291 309
 		<div id="display_jump_to"></div>';
292 310
 
293 311
 	// Show quickreply
294
-	if ($context['can_reply'])
295
-		template_quickreply();
312
+	if ($context['can_reply']) {
313
+			template_quickreply();
314
+	}
296 315
 
297 316
 	// User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device.
298 317
 	echo '
@@ -307,8 +326,8 @@  discard block
 block discarded – undo
307 326
 		</div>';
308 327
 
309 328
 	// Show the moderation button & pop (if there is anything to show)
310
-	if (!empty($context['mod_buttons']))
311
-		echo '
329
+	if (!empty($context['mod_buttons'])) {
330
+			echo '
312 331
 		<div id="mobile_moderation" class="popup_container">
313 332
 			<div class="popup_window description">
314 333
 				<div class="popup_heading">
@@ -320,6 +339,7 @@  discard block
 block discarded – undo
320 339
 				</div>
321 340
 			</div>
322 341
 		</div>';
342
+	}
323 343
 
324 344
 	echo '
325 345
 		<script>';
@@ -443,9 +463,10 @@  discard block
 block discarded – undo
443 463
 				});
444 464
 			}';
445 465
 
446
-	if (!empty($context['ignoredMsgs']))
447
-		echo '
466
+	if (!empty($context['ignoredMsgs'])) {
467
+			echo '
448 468
 			ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
469
+	}
449 470
 
450 471
 	echo '
451 472
 		</script>';
@@ -462,8 +483,9 @@  discard block
 block discarded – undo
462 483
 
463 484
 	$ignoring = false;
464 485
 
465
-	if ($message['can_remove'])
466
-		$context['removableMessageIDs'][] = $message['id'];
486
+	if ($message['can_remove']) {
487
+			$context['removableMessageIDs'][] = $message['id'];
488
+	}
467 489
 
468 490
 	// Are we ignoring this message?
469 491
 	if (!empty($message['is_ignored']))
@@ -490,9 +512,10 @@  discard block
 block discarded – undo
490 512
 							<div class="custom_fields_above_member">
491 513
 								<ul class="nolist">';
492 514
 
493
-		foreach ($message['custom_fields']['above_member'] as $custom)
494
-			echo '
515
+		foreach ($message['custom_fields']['above_member'] as $custom) {
516
+					echo '
495 517
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
518
+		}
496 519
 
497 520
 		echo '
498 521
 								</ul>
@@ -503,25 +526,28 @@  discard block
 block discarded – undo
503 526
 							<h4>';
504 527
 
505 528
 	// Show online and offline buttons?
506
-	if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
507
-		echo '
529
+	if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) {
530
+			echo '
508 531
 								', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : '';
532
+	}
509 533
 
510 534
 	// Custom fields BEFORE the username?
511
-	if (!empty($message['custom_fields']['before_member']))
512
-		foreach ($message['custom_fields']['before_member'] as $custom)
535
+	if (!empty($message['custom_fields']['before_member'])) {
536
+			foreach ($message['custom_fields']['before_member'] as $custom)
513 537
 			echo '
514 538
 								<span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>';
539
+	}
515 540
 
516 541
 	// Show a link to the member's profile.
517 542
 	echo '
518 543
 								', $message['member']['link'];
519 544
 
520 545
 	// Custom fields AFTER the username?
521
-	if (!empty($message['custom_fields']['after_member']))
522
-		foreach ($message['custom_fields']['after_member'] as $custom)
546
+	if (!empty($message['custom_fields']['after_member'])) {
547
+			foreach ($message['custom_fields']['after_member'] as $custom)
523 548
 			echo '
524 549
 								<span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>';
550
+	}
525 551
 
526 552
 	// Begin display of user info
527 553
 	echo '
@@ -529,50 +555,58 @@  discard block
 block discarded – undo
529 555
 							<ul class="user_info">';
530 556
 
531 557
 	// Show the user's avatar.
532
-	if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
533
-		echo '
558
+	if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
559
+			echo '
534 560
 								<li class="avatar">
535 561
 									<a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a>
536 562
 								</li>';
563
+	}
537 564
 
538 565
 	// Are there any custom fields below the avatar?
539
-	if (!empty($message['custom_fields']['below_avatar']))
540
-		foreach ($message['custom_fields']['below_avatar'] as $custom)
566
+	if (!empty($message['custom_fields']['below_avatar'])) {
567
+			foreach ($message['custom_fields']['below_avatar'] as $custom)
541 568
 			echo '
542 569
 								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
570
+	}
543 571
 
544 572
 	// Show the post group icons, but not for guests.
545
-	if (!$message['member']['is_guest'])
546
-		echo '
573
+	if (!$message['member']['is_guest']) {
574
+			echo '
547 575
 								<li class="icons">', $message['member']['group_icons'], '</li>';
576
+	}
548 577
 
549 578
 	// Show the member's primary group (like 'Administrator') if they have one.
550
-	if (!empty($message['member']['group']))
551
-		echo '
579
+	if (!empty($message['member']['group'])) {
580
+			echo '
552 581
 								<li class="membergroup">', $message['member']['group'], '</li>';
582
+	}
553 583
 
554 584
 	// Show the member's custom title, if they have one.
555
-	if (!empty($message['member']['title']))
556
-		echo '
585
+	if (!empty($message['member']['title'])) {
586
+			echo '
557 587
 								<li class="title">', $message['member']['title'], '</li>';
588
+	}
558 589
 
559 590
 	// Don't show these things for guests.
560 591
 	if (!$message['member']['is_guest'])
561 592
 	{
562 593
 		// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
563
-		if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group']))
564
-			echo '
594
+		if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) {
595
+					echo '
565 596
 								<li class="postgroup">', $message['member']['post_group'], '</li>';
597
+		}
566 598
 
567 599
 		// Show how many posts they have made.
568
-		if (!isset($context['disabled_fields']['posts']))
569
-			echo '
600
+		if (!isset($context['disabled_fields']['posts'])) {
601
+					echo '
570 602
 								<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
603
+		}
571 604
 
572 605
 		// Show their personal text?
573
-		if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb']))
574
-			echo '
606
+		if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) {
607
+					echo '
575 608
 								<li class="blurb">', $message['member']['blurb'], '</li>';
609
+		}
576 610
 
577 611
 		// Any custom fields to show as icons?
578 612
 		if (!empty($message['custom_fields']['icons']))
@@ -581,9 +615,10 @@  discard block
 block discarded – undo
581 615
 								<li class="im_icons">
582 616
 									<ol>';
583 617
 
584
-			foreach ($message['custom_fields']['icons'] as $custom)
585
-				echo '
618
+			foreach ($message['custom_fields']['icons'] as $custom) {
619
+							echo '
586 620
 										<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
621
+			}
587 622
 
588 623
 			echo '
589 624
 									</ol>
@@ -598,19 +633,22 @@  discard block
 block discarded – undo
598 633
 									<ol class="profile_icons">';
599 634
 
600 635
 			// Don't show an icon if they haven't specified a website.
601
-			if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website']))
602
-				echo '
636
+			if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) {
637
+							echo '
603 638
 										<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
639
+			}
604 640
 
605 641
 			// Since we know this person isn't a guest, you *can* message them.
606
-			if ($context['can_send_pm'])
607
-				echo '
642
+			if ($context['can_send_pm']) {
643
+							echo '
608 644
 										<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
645
+			}
609 646
 
610 647
 			// Show the email if necessary
611
-			if (!empty($message['member']['email']) && $message['member']['show_email'])
612
-				echo '
648
+			if (!empty($message['member']['email']) && $message['member']['show_email']) {
649
+							echo '
613 650
 										<li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
651
+			}
614 652
 
615 653
 			echo '
616 654
 									</ol>
@@ -618,57 +656,65 @@  discard block
 block discarded – undo
618 656
 		}
619 657
 
620 658
 		// Any custom fields for standard placement?
621
-		if (!empty($message['custom_fields']['standard']))
622
-			foreach ($message['custom_fields']['standard'] as $custom)
659
+		if (!empty($message['custom_fields']['standard'])) {
660
+					foreach ($message['custom_fields']['standard'] as $custom)
623 661
 				echo '
624 662
 								<li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>';
663
+		}
625 664
 	}
626 665
 	// Otherwise, show the guest's email.
627
-	elseif (!empty($message['member']['email']) && $message['member']['show_email'])
628
-		echo '
666
+	elseif (!empty($message['member']['email']) && $message['member']['show_email']) {
667
+			echo '
629 668
 								<li class="email">
630 669
 									<a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a>
631 670
 								</li>';
671
+	}
632 672
 
633 673
 	// Show the IP to this user for this post - because you can moderate?
634
-	if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
635
-		echo '
674
+	if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) {
675
+			echo '
636 676
 								<li class="poster_ip">
637 677
 									<a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a>
638 678
 								</li>';
679
+	}
639 680
 
640 681
 	// Or, should we show it because this is you?
641
-	elseif ($message['can_see_ip'])
642
-		echo '
682
+	elseif ($message['can_see_ip']) {
683
+			echo '
643 684
 								<li class="poster_ip">
644 685
 									<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a>
645 686
 								</li>';
687
+	}
646 688
 
647 689
 	// Okay, are you at least logged in? Then we can show something about why IPs are logged...
648
-	elseif (!$context['user']['is_guest'])
649
-		echo '
690
+	elseif (!$context['user']['is_guest']) {
691
+			echo '
650 692
 								<li class="poster_ip">
651 693
 									<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a>
652 694
 								</li>';
695
+	}
653 696
 
654 697
 	// Otherwise, you see NOTHING!
655
-	else
656
-		echo '
698
+	else {
699
+			echo '
657 700
 								<li class="poster_ip">', $txt['logged'], '</li>';
701
+	}
658 702
 
659 703
 	// Are we showing the warning status?
660 704
 	// Don't show these things for guests.
661
-	if (!$message['member']['is_guest'] && $message['member']['can_see_warning'])
662
-		echo '
705
+	if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) {
706
+			echo '
663 707
 								<li class="warning">
664 708
 									', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span>
665 709
 								</li>';
710
+	}
666 711
 
667 712
 	// Are there any custom fields to show at the bottom of the poster info?
668
-	if (!empty($message['custom_fields']['bottom_poster']))
669
-		foreach ($message['custom_fields']['bottom_poster'] as $custom)
713
+	if (!empty($message['custom_fields']['bottom_poster'])) {
714
+			foreach ($message['custom_fields']['bottom_poster'] as $custom)
670 715
 			echo '
671 716
 								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
717
+	}
672 718
 
673 719
 	// Poster info ends.
674 720
 	echo '
@@ -698,9 +744,10 @@  discard block
 block discarded – undo
698 744
 	echo '
699 745
 									<span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">';
700 746
 
701
-	if (!empty($modSettings['show_modify']) && !empty($message['modified']['name']))
702
-		echo
747
+	if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) {
748
+			echo
703 749
 										$message['modified']['last_edit_text'];
750
+	}
704 751
 
705 752
 	echo '
706 753
 									</span>
@@ -709,22 +756,24 @@  discard block
 block discarded – undo
709 756
 							</div><!-- .keyinfo -->';
710 757
 
711 758
 	// Ignoring this user? Hide the post.
712
-	if ($ignoring)
713
-		echo '
759
+	if ($ignoring) {
760
+			echo '
714 761
 							<div id="msg_', $message['id'], '_ignored_prompt">
715 762
 								', $txt['ignoring_user'], '
716 763
 								<a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
717 764
 							</div>';
765
+	}
718 766
 
719 767
 	// Show the post itself, finally!
720 768
 	echo '
721 769
 							<div class="post">';
722 770
 
723
-	if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
724
-		echo '
771
+	if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) {
772
+			echo '
725 773
 								<div class="approve_post">
726 774
 									', $txt['post_awaiting_approval'], '
727 775
 								</div>';
776
+	}
728 777
 	echo '
729 778
 								<div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>
730 779
 									', $message['body'], '
@@ -743,9 +792,9 @@  discard block
 block discarded – undo
743 792
 		foreach ($message['attachment'] as $attachment)
744 793
 		{
745 794
 			// Do we want this attachment to not be showed here?
746
-			if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']]))
747
-				continue;
748
-			elseif (!$div_output)
795
+			if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) {
796
+							continue;
797
+			} elseif (!$div_output)
749 798
 			{
750 799
 				$div_output = true;
751 800
 
@@ -762,9 +811,10 @@  discard block
 block discarded – undo
762 811
 									<legend>
763 812
 										', $txt['attach_awaiting_approve'];
764 813
 
765
-				if ($context['can_approve'])
766
-					echo '
814
+				if ($context['can_approve']) {
815
+									echo '
767 816
 										&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]';
817
+				}
768 818
 
769 819
 				echo '
770 820
 									</legend>';
@@ -778,12 +828,13 @@  discard block
 block discarded – undo
778 828
 				echo '
779 829
 										<div class="attachments_top">';
780 830
 
781
-				if ($attachment['thumbnail']['has_thumb'])
782
-					echo '
831
+				if ($attachment['thumbnail']['has_thumb']) {
832
+									echo '
783 833
 											<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>';
784
-				else
785
-					echo '
834
+				} else {
835
+									echo '
786 836
 											<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">';
837
+				}
787 838
 
788 839
 				echo '
789 840
 										</div><!-- .attachments_top -->';
@@ -793,9 +844,10 @@  discard block
 block discarded – undo
793 844
 										<div class="attachments_bot">
794 845
 											<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*">&nbsp;' . $attachment['name'] . '</a> ';
795 846
 
796
-			if (!$attachment['is_approved'] && $context['can_approve'])
797
-				echo '
847
+			if (!$attachment['is_approved'] && $context['can_approve']) {
848
+							echo '
798 849
 											[<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
850
+			}
799 851
 			echo '
800 852
 											<br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), '
801 853
 										</div><!-- .attachments_bot -->';
@@ -804,35 +856,40 @@  discard block
 block discarded – undo
804 856
 									</div><!-- .attached -->';
805 857
 
806 858
 			// Next attachment line ?
807
-			if (++$i % $attachments_per_line === 0)
808
-				echo '
859
+			if (++$i % $attachments_per_line === 0) {
860
+							echo '
809 861
 									<br>';
862
+			}
810 863
 		}
811 864
 
812 865
 		// If we had unapproved attachments clean up.
813
-		if ($last_approved_state == 0)
814
-			echo '
866
+		if ($last_approved_state == 0) {
867
+					echo '
815 868
 								</fieldset>';
869
+		}
816 870
 
817 871
 		// Only do this if we output a div above - otherwise it'll break things
818
-		if ($div_output)
819
-			echo '
872
+		if ($div_output) {
873
+					echo '
820 874
 							</div><!-- #msg_[id]_footer -->';
875
+		}
821 876
 	}
822 877
 
823 878
 	// And stuff below the attachments.
824
-	if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
825
-		echo '
879
+	if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) {
880
+			echo '
826 881
 							<div class="under_message">';
882
+	}
827 883
 
828 884
 	// Maybe they want to report this post to the moderator(s)?
829
-	if ($context['can_report_moderator'])
830
-		echo '
885
+	if ($context['can_report_moderator']) {
886
+			echo '
831 887
 								<ul class="floatright smalltext">
832 888
 									<li class="report_link">
833 889
 										<a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a>
834 890
 									</li>
835 891
 								</ul>';
892
+	}
836 893
 
837 894
 	// What about likes?
838 895
 	if (!empty($modSettings['enable_likes']))
@@ -879,83 +936,95 @@  discard block
 block discarded – undo
879 936
 								<ul class="quickbuttons">';
880 937
 
881 938
 		// Can they quote? if so they can select and quote as well!
882
-		if ($context['can_quote'])
883
-			echo '
939
+		if ($context['can_quote']) {
940
+					echo '
884 941
 									<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>
885 942
 									<li style="display:none;" id="quoteSelected_', $message['id'], '">
886 943
 										<a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a>
887 944
 									</li>';
945
+		}
888 946
 
889 947
 		// Can the user modify the contents of this post? Show the modify inline image.
890
-		if ($message['can_modify'])
891
-			echo '
948
+		if ($message['can_modify']) {
949
+					echo '
892 950
 									<li class="quick_edit">
893 951
 										<a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a>
894 952
 									</li>';
953
+		}
895 954
 
896
-		if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
897
-			echo '
955
+		if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
956
+					echo '
898 957
 									<li class="post_options">', $txt['post_options'];
958
+		}
899 959
 
900 960
 		echo '
901 961
 										<ul>';
902 962
 
903 963
 		// Can the user modify the contents of this post?
904
-		if ($message['can_modify'])
905
-			echo '
964
+		if ($message['can_modify']) {
965
+					echo '
906 966
 											<li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>';
967
+		}
907 968
 
908 969
 		// How about... even... remove it entirely?!
909
-		if ($context['can_delete'] && ($context['topic_first_message'] == $message['id']))
910
-			echo '
970
+		if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) {
971
+					echo '
911 972
 											<li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>';
912
-
913
-		elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id']))
914
-			echo '
973
+		} elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) {
974
+					echo '
915 975
 											<li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
976
+		}
916 977
 
917 978
 		// What about splitting it off the rest of the topic?
918
-		if ($context['can_split'] && !empty($context['real_num_replies']))
919
-			echo '
979
+		if ($context['can_split'] && !empty($context['real_num_replies'])) {
980
+					echo '
920 981
 											<li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>';
982
+		}
921 983
 
922 984
 		// Can we issue a warning because of this post? Remember, we can't give guests warnings.
923
-		if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest'])
924
-			echo '
985
+		if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) {
986
+					echo '
925 987
 											<li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>';
988
+		}
926 989
 
927 990
 		// Can we restore topics?
928
-		if ($context['can_restore_msg'])
929
-			echo '
991
+		if ($context['can_restore_msg']) {
992
+					echo '
930 993
 											<li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>';
994
+		}
931 995
 
932 996
 		// Maybe we can approve it, maybe we should?
933
-		if ($message['can_approve'])
934
-			echo '
997
+		if ($message['can_approve']) {
998
+					echo '
935 999
 											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>';
1000
+		}
936 1001
 
937 1002
 		// Maybe we can unapprove it?
938
-		if ($message['can_unapprove'])
939
-			echo '
1003
+		if ($message['can_unapprove']) {
1004
+					echo '
940 1005
 											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>';
1006
+		}
941 1007
 
942 1008
 		echo '
943 1009
 										</ul>
944 1010
 									</li>';
945 1011
 
946 1012
 		// Show a checkbox for quick moderation?
947
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
948
-			echo '
1013
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
1014
+					echo '
949 1015
 									<li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
1016
+		}
950 1017
 
951
-		if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
952
-			echo '
1018
+		if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
1019
+					echo '
953 1020
 								</ul><!-- .quickbuttons -->';
1021
+		}
954 1022
 	}
955 1023
 
956
-	if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
957
-		echo '
1024
+	if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) {
1025
+			echo '
958 1026
 							</div><!-- .under_message -->';
1027
+	}
959 1028
 
960 1029
 	echo '
961 1030
 						</div><!-- .postarea -->
@@ -968,9 +1037,10 @@  discard block
 block discarded – undo
968 1037
 							<div class="custom_fields_above_signature">
969 1038
 								<ul class="nolist">';
970 1039
 
971
-		foreach ($message['custom_fields']['above_signature'] as $custom)
972
-			echo '
1040
+		foreach ($message['custom_fields']['above_signature'] as $custom) {
1041
+					echo '
973 1042
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
1043
+		}
974 1044
 
975 1045
 		echo '
976 1046
 								</ul>
@@ -978,11 +1048,12 @@  discard block
 block discarded – undo
978 1048
 	}
979 1049
 
980 1050
 	// Show the member's signature?
981
-	if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
982
-		echo '
1051
+	if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
1052
+			echo '
983 1053
 							<div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>
984 1054
 								', $message['member']['signature'], '
985 1055
 							</div>';
1056
+	}
986 1057
 
987 1058
 
988 1059
 	// Are there any custom profile fields for below the signature?
@@ -992,9 +1063,10 @@  discard block
 block discarded – undo
992 1063
 							<div class="custom_fields_below_signature">
993 1064
 								<ul class="nolist">';
994 1065
 
995
-		foreach ($message['custom_fields']['below_signature'] as $custom)
996
-			echo '
1066
+		foreach ($message['custom_fields']['below_signature'] as $custom) {
1067
+					echo '
997 1068
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
1069
+		}
998 1070
 
999 1071
 		echo '
1000 1072
 								</ul>
@@ -1027,24 +1099,28 @@  discard block
 block discarded – undo
1027 1099
 				<div class="roundframe">';
1028 1100
 
1029 1101
 	// Are we hiding the full editor?
1030
-	if (empty($options['use_editor_quick_reply']))
1031
-		echo '
1102
+	if (empty($options['use_editor_quick_reply'])) {
1103
+			echo '
1032 1104
 					<p class="smalltext lefttext">', $txt['quick_reply_desc'], '</p>';
1105
+	}
1033 1106
 
1034 1107
 	// Is the topic locked?
1035
-	if ($context['is_locked'])
1036
-		echo '
1108
+	if ($context['is_locked']) {
1109
+			echo '
1037 1110
 					<p class="alert smalltext">', $txt['quick_reply_warning'], '</p>';
1111
+	}
1038 1112
 
1039 1113
 	// Show a warning if the topic is old
1040
-	if (!empty($context['oldTopicError']))
1041
-		echo '
1114
+	if (!empty($context['oldTopicError'])) {
1115
+			echo '
1042 1116
 					<p class="alert smalltext">', sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']), '</p>';
1117
+	}
1043 1118
 
1044 1119
 	// Does the post need approval?
1045
-	if (!$context['can_reply_approved'])
1046
-		echo '
1120
+	if (!$context['can_reply_approved']) {
1121
+			echo '
1047 1122
 					<p><em>', $txt['wait_for_approval'], '</em></p>';
1123
+	}
1048 1124
 
1049 1125
 	echo '
1050 1126
 					<form action="', $scripturl, '?board=', $context['current_board'], ';action=post2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);">
@@ -1060,8 +1136,8 @@  discard block
 block discarded – undo
1060 1136
 						<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">';
1061 1137
 
1062 1138
 	// Guests just need more.
1063
-	if ($context['user']['is_guest'])
1064
-		echo '
1139
+	if ($context['user']['is_guest']) {
1140
+			echo '
1065 1141
 						<dl id="post_header">
1066 1142
 							<dt>
1067 1143
 								', $txt['name'], ':
@@ -1076,6 +1152,7 @@  discard block
 block discarded – undo
1076 1152
 								<input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" required>
1077 1153
 							</dd>
1078 1154
 						</dl>';
1155
+	}
1079 1156
 
1080 1157
 	echo '
1081 1158
 						', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
@@ -1100,12 +1177,13 @@  discard block
 block discarded – undo
1100 1177
 						</script>';
1101 1178
 
1102 1179
 	// Is visual verification enabled?
1103
-	if ($context['require_verification'])
1104
-		echo '
1180
+	if ($context['require_verification']) {
1181
+			echo '
1105 1182
 						<div class="post_verification">
1106 1183
 							<strong>', $txt['verification'], ':</strong>
1107 1184
 							', template_control_verification($context['visual_verification_id'], 'all'), '
1108 1185
 						</div>';
1186
+	}
1109 1187
 
1110 1188
 	// Finally, the submit buttons.
1111 1189
 	echo '
@@ -1121,8 +1199,8 @@  discard block
 block discarded – undo
1121 1199
 		<br class="clear">';
1122 1200
 
1123 1201
 	// Draft autosave available and the user has it enabled?
1124
-	if (!empty($context['drafts_autosave']))
1125
-		echo '
1202
+	if (!empty($context['drafts_autosave'])) {
1203
+			echo '
1126 1204
 		<script>
1127 1205
 			var oDraftAutoSave = new smf_DraftAutoSave({
1128 1206
 				sSelf: \'oDraftAutoSave\',
@@ -1134,12 +1212,14 @@  discard block
 block discarded – undo
1134 1212
 				iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), '
1135 1213
 			});
1136 1214
 		</script>';
1215
+	}
1137 1216
 
1138
-	if ($context['show_spellchecking'])
1139
-		echo '
1217
+	if ($context['show_spellchecking']) {
1218
+			echo '
1140 1219
 		<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow">
1141 1220
 			<input type="hidden" name="spellstring" value="">
1142 1221
 		</form>';
1222
+	}
1143 1223
 
1144 1224
 	echo '
1145 1225
 		<script>
Please login to merge, or discard this patch.
Sources/Stats.php 1 patch
Braces   +112 added lines, -78 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
  * Display some useful/interesting board statistics.
@@ -30,8 +31,9 @@  discard block
 block discarded – undo
30 31
 
31 32
 	isAllowedTo('view_stats');
32 33
 	// Page disabled - redirect them out
33
-	if (empty($modSettings['trackStats']))
34
-		fatal_lang_error('feature_disabled', true);
34
+	if (empty($modSettings['trackStats'])) {
35
+			fatal_lang_error('feature_disabled', true);
36
+	}
35 37
 
36 38
 	if (!empty($_REQUEST['expand']))
37 39
 	{
@@ -39,31 +41,34 @@  discard block
 block discarded – undo
39 41
 
40 42
 		$month = (int) substr($_REQUEST['expand'], 4);
41 43
 		$year = (int) substr($_REQUEST['expand'], 0, 4);
42
-		if ($year > 1900 && $year < 2200 && $month >= 1 && $month <= 12)
43
-			$_SESSION['expanded_stats'][$year][] = $month;
44
-	}
45
-	elseif (!empty($_REQUEST['collapse']))
44
+		if ($year > 1900 && $year < 2200 && $month >= 1 && $month <= 12) {
45
+					$_SESSION['expanded_stats'][$year][] = $month;
46
+		}
47
+	} elseif (!empty($_REQUEST['collapse']))
46 48
 	{
47 49
 		$context['robot_no_index'] = true;
48 50
 
49 51
 		$month = (int) substr($_REQUEST['collapse'], 4);
50 52
 		$year = (int) substr($_REQUEST['collapse'], 0, 4);
51
-		if (!empty($_SESSION['expanded_stats'][$year]))
52
-			$_SESSION['expanded_stats'][$year] = array_diff($_SESSION['expanded_stats'][$year], array($month));
53
+		if (!empty($_SESSION['expanded_stats'][$year])) {
54
+					$_SESSION['expanded_stats'][$year] = array_diff($_SESSION['expanded_stats'][$year], array($month));
55
+		}
53 56
 	}
54 57
 
55 58
 	// Handle the XMLHttpRequest.
56 59
 	if (isset($_REQUEST['xml']))
57 60
 	{
58 61
 		// Collapsing stats only needs adjustments of the session variables.
59
-		if (!empty($_REQUEST['collapse']))
60
-			obExit(false);
62
+		if (!empty($_REQUEST['collapse'])) {
63
+					obExit(false);
64
+		}
61 65
 
62 66
 		$context['sub_template'] = 'stats';
63 67
 		$context['yearly'] = array();
64 68
 
65
-		if (empty($month) || empty($year))
66
-			return;
69
+		if (empty($month) || empty($year)) {
70
+					return;
71
+		}
67 72
 
68 73
 		getDailyStats('YEAR(date) = {int:year} AND MONTH(date) = {int:month}', array('year' => $year, 'month' => $month));
69 74
 		$context['yearly'][$year]['months'][$month]['date'] = array(
@@ -221,8 +226,9 @@  discard block
 block discarded – undo
221 226
 			'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
222 227
 		);
223 228
 
224
-		if ($max_num_posts < $row_members['posts'])
225
-			$max_num_posts = $row_members['posts'];
229
+		if ($max_num_posts < $row_members['posts']) {
230
+					$max_num_posts = $row_members['posts'];
231
+		}
226 232
 	}
227 233
 	$smcFunc['db_free_result']($members_result);
228 234
 
@@ -258,8 +264,9 @@  discard block
 block discarded – undo
258 264
 			'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['name'] . '</a>'
259 265
 		);
260 266
 
261
-		if ($max_num_posts < $row_board['num_posts'])
262
-			$max_num_posts = $row_board['num_posts'];
267
+		if ($max_num_posts < $row_board['num_posts']) {
268
+					$max_num_posts = $row_board['num_posts'];
269
+		}
263 270
 	}
264 271
 	$smcFunc['db_free_result']($boards_result);
265 272
 
@@ -285,12 +292,13 @@  discard block
 block discarded – undo
285 292
 			)
286 293
 		);
287 294
 		$topic_ids = array();
288
-		while ($row = $smcFunc['db_fetch_assoc']($request))
289
-			$topic_ids[] = $row['id_topic'];
295
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
296
+					$topic_ids[] = $row['id_topic'];
297
+		}
290 298
 		$smcFunc['db_free_result']($request);
299
+	} else {
300
+			$topic_ids = array();
291 301
 	}
292
-	else
293
-		$topic_ids = array();
294 302
 
295 303
 	// Topic replies top 10.
296 304
 	$topic_reply_result = $smcFunc['db_query']('', '
@@ -330,8 +338,9 @@  discard block
 block discarded – undo
330 338
 			'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_reply['id_topic'] . '.0">' . $row_topic_reply['subject'] . '</a>'
331 339
 		);
332 340
 
333
-		if ($max_num_replies < $row_topic_reply['num_replies'])
334
-			$max_num_replies = $row_topic_reply['num_replies'];
341
+		if ($max_num_replies < $row_topic_reply['num_replies']) {
342
+					$max_num_replies = $row_topic_reply['num_replies'];
343
+		}
335 344
 	}
336 345
 	$smcFunc['db_free_result']($topic_reply_result);
337 346
 
@@ -355,12 +364,13 @@  discard block
 block discarded – undo
355 364
 			)
356 365
 		);
357 366
 		$topic_ids = array();
358
-		while ($row = $smcFunc['db_fetch_assoc']($request))
359
-			$topic_ids[] = $row['id_topic'];
367
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
368
+					$topic_ids[] = $row['id_topic'];
369
+		}
360 370
 		$smcFunc['db_free_result']($request);
371
+	} else {
372
+			$topic_ids = array();
361 373
 	}
362
-	else
363
-		$topic_ids = array();
364 374
 
365 375
 	// Topic views top 10.
366 376
 	$topic_view_result = $smcFunc['db_query']('', '
@@ -400,8 +410,9 @@  discard block
 block discarded – undo
400 410
 			'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0">' . $row_topic_views['subject'] . '</a>'
401 411
 		);
402 412
 
403
-		if ($max_num < $row_topic_views['num_views'])
404
-			$max_num = $row_topic_views['num_views'];
413
+		if ($max_num < $row_topic_views['num_views']) {
414
+					$max_num = $row_topic_views['num_views'];
415
+		}
405 416
 	}
406 417
 	$smcFunc['db_free_result']($topic_view_result);
407 418
 
@@ -426,15 +437,17 @@  discard block
 block discarded – undo
426 437
 			)
427 438
 		);
428 439
 		$members = array();
429
-		while ($row = $smcFunc['db_fetch_assoc']($request))
430
-			$members[$row['id_member_started']] = $row['hits'];
440
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
441
+					$members[$row['id_member_started']] = $row['hits'];
442
+		}
431 443
 		$smcFunc['db_free_result']($request);
432 444
 
433 445
 		cache_put_data('stats_top_starters', $members, 360);
434 446
 	}
435 447
 
436
-	if (empty($members))
437
-		$members = array(0 => 0);
448
+	if (empty($members)) {
449
+			$members = array(0 => 0);
450
+	}
438 451
 
439 452
 	// Topic poster top 10.
440 453
 	$members_result = $smcFunc['db_query']('', '
@@ -459,8 +472,9 @@  discard block
 block discarded – undo
459 472
 			'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
460 473
 		);
461 474
 
462
-		if ($max_num < $members[$row_members['id_member']])
463
-			$max_num = $members[$row_members['id_member']];
475
+		if ($max_num < $members[$row_members['id_member']]) {
476
+					$max_num = $members[$row_members['id_member']];
477
+		}
464 478
 	}
465 479
 	ksort($context['stats_blocks']['starters']);
466 480
 	$smcFunc['db_free_result']($members_result);
@@ -489,8 +503,9 @@  discard block
 block discarded – undo
489 503
 	while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
490 504
 	{
491 505
 		$temp2[] = (int) $row_members['id_member'];
492
-		if (count($context['stats_blocks']['time_online']) >= 10)
493
-			continue;
506
+		if (count($context['stats_blocks']['time_online']) >= 10) {
507
+					continue;
508
+		}
494 509
 
495 510
 		// Figure out the days, hours and minutes.
496 511
 		$timeDays = floor($row_members['total_time_logged_in'] / 86400);
@@ -498,10 +513,12 @@  discard block
 block discarded – undo
498 513
 
499 514
 		// Figure out which things to show... (days, hours, minutes, etc.)
500 515
 		$timelogged = '';
501
-		if ($timeDays > 0)
502
-			$timelogged .= $timeDays . $txt['totalTimeLogged5'];
503
-		if ($timeHours > 0)
504
-			$timelogged .= $timeHours . $txt['totalTimeLogged6'];
516
+		if ($timeDays > 0) {
517
+					$timelogged .= $timeDays . $txt['totalTimeLogged5'];
518
+		}
519
+		if ($timeHours > 0) {
520
+					$timelogged .= $timeHours . $txt['totalTimeLogged6'];
521
+		}
505 522
 		$timelogged .= floor(($row_members['total_time_logged_in'] % 3600) / 60) . $txt['totalTimeLogged7'];
506 523
 
507 524
 		$context['stats_blocks']['time_online'][] = array(
@@ -513,17 +530,20 @@  discard block
 block discarded – undo
513 530
 			'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
514 531
 		);
515 532
 
516
-		if ($max_time_online < $row_members['total_time_logged_in'])
517
-			$max_time_online = $row_members['total_time_logged_in'];
533
+		if ($max_time_online < $row_members['total_time_logged_in']) {
534
+					$max_time_online = $row_members['total_time_logged_in'];
535
+		}
518 536
 	}
519 537
 	$smcFunc['db_free_result']($members_result);
520 538
 
521
-	foreach ($context['stats_blocks']['time_online'] as $i => $member)
522
-		$context['stats_blocks']['time_online'][$i]['percent'] = round(($member['seconds_online'] * 100) / $max_time_online);
539
+	foreach ($context['stats_blocks']['time_online'] as $i => $member) {
540
+			$context['stats_blocks']['time_online'][$i]['percent'] = round(($member['seconds_online'] * 100) / $max_time_online);
541
+	}
523 542
 
524 543
 	// Cache the ones we found for a bit, just so we don't have to look again.
525
-	if ($temp !== $temp2)
526
-		cache_put_data('stats_total_time_members', $temp2, 480);
544
+	if ($temp !== $temp2) {
545
+			cache_put_data('stats_total_time_members', $temp2, 480);
546
+	}
527 547
 
528 548
 	// Likes.
529 549
 	if (!empty($modSettings['enable_likes']))
@@ -559,13 +579,15 @@  discard block
 block discarded – undo
559 579
 				'link' => '<a href="' . $scripturl . '?msg=' . $row_liked_message['id_msg'] .'">' . $row_liked_message['subject'] . '</a>'
560 580
 			);
561 581
 
562
-			if ($max_liked_message < $row_liked_message['likes'])
563
-				$max_liked_message = $row_liked_message['likes'];
582
+			if ($max_liked_message < $row_liked_message['likes']) {
583
+							$max_liked_message = $row_liked_message['likes'];
584
+			}
564 585
 		}
565 586
 		$smcFunc['db_free_result']($liked_messages);
566 587
 
567
-		foreach ($context['stats_blocks']['liked_messages'] as $i => $liked_messages)
568
-			$context['stats_blocks']['liked_messages'][$i]['percent'] = round(($liked_messages['num'] * 100) / $max_liked_message);
588
+		foreach ($context['stats_blocks']['liked_messages'] as $i => $liked_messages) {
589
+					$context['stats_blocks']['liked_messages'][$i]['percent'] = round(($liked_messages['num'] * 100) / $max_liked_message);
590
+		}
569 591
 
570 592
 		// Liked users top 10.
571 593
 		$context['stats_blocks']['liked_users'] = array();
@@ -596,14 +618,16 @@  discard block
 block discarded – undo
596 618
 				'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_liked_users['liked_user'] . '">' . $row_liked_users['real_name'] . '</a>',
597 619
 			);
598 620
 
599
-			if ($max_liked_users < $row_liked_users['count'])
600
-				$max_liked_users = $row_liked_users['count'];
621
+			if ($max_liked_users < $row_liked_users['count']) {
622
+							$max_liked_users = $row_liked_users['count'];
623
+			}
601 624
 		}
602 625
 
603 626
 		$smcFunc['db_free_result']($liked_users);
604 627
 
605
-		foreach ($context['stats_blocks']['liked_users'] as $i => $liked_users)
606
-			$context['stats_blocks']['liked_users'][$i]['percent'] = round(($liked_users['num'] * 100) / $max_liked_users);
628
+		foreach ($context['stats_blocks']['liked_users'] as $i => $liked_users) {
629
+					$context['stats_blocks']['liked_users'][$i]['percent'] = round(($liked_users['num'] * 100) / $max_liked_users);
630
+		}
607 631
 	}
608 632
 
609 633
 	// Activity by month.
@@ -621,8 +645,8 @@  discard block
 block discarded – undo
621 645
 		$ID_MONTH = $row_months['stats_year'] . sprintf('%02d', $row_months['stats_month']);
622 646
 		$expanded = !empty($_SESSION['expanded_stats'][$row_months['stats_year']]) && in_array($row_months['stats_month'], $_SESSION['expanded_stats'][$row_months['stats_year']]);
623 647
 
624
-		if (!isset($context['yearly'][$row_months['stats_year']]))
625
-			$context['yearly'][$row_months['stats_year']] = array(
648
+		if (!isset($context['yearly'][$row_months['stats_year']])) {
649
+					$context['yearly'][$row_months['stats_year']] = array(
626 650
 				'year' => $row_months['stats_year'],
627 651
 				'new_topics' => 0,
628 652
 				'new_posts' => 0,
@@ -634,6 +658,7 @@  discard block
 block discarded – undo
634 658
 				'expanded' => false,
635 659
 				'current_year' => $row_months['stats_year'] == date('Y'),
636 660
 			);
661
+		}
637 662
 
638 663
 		$context['yearly'][$row_months['stats_year']]['months'][(int) $row_months['stats_month']] = array(
639 664
 			'id' => $ID_MONTH,
@@ -679,29 +704,33 @@  discard block
 block discarded – undo
679 704
 		$context['yearly'][$year]['hits'] = comma_format($data['hits']);
680 705
 
681 706
 		// Keep a list of collapsed years.
682
-		if (!$data['expanded'] && !$data['current_year'])
683
-			$context['collapsed_years'][] = $year;
707
+		if (!$data['expanded'] && !$data['current_year']) {
708
+					$context['collapsed_years'][] = $year;
709
+		}
684 710
 	}
685 711
 
686 712
 	// Custom stats (just add a template_layer to add it to the template!)
687 713
 	call_integration_hook('integrate_forum_stats');
688 714
 
689
-	if (empty($_SESSION['expanded_stats']))
690
-		return;
715
+	if (empty($_SESSION['expanded_stats'])) {
716
+			return;
717
+	}
691 718
 
692 719
 	$condition_text = array();
693 720
 	$condition_params = array();
694
-	foreach ($_SESSION['expanded_stats'] as $year => $months)
695
-		if (!empty($months))
721
+	foreach ($_SESSION['expanded_stats'] as $year => $months) {
722
+			if (!empty($months))
696 723
 		{
697 724
 			$condition_text[] = 'YEAR(date) = {int:year_' . $year . '} AND MONTH(date) IN ({array_int:months_' . $year . '})';
725
+	}
698 726
 			$condition_params['year_' . $year] = $year;
699 727
 			$condition_params['months_' . $year] = $months;
700 728
 		}
701 729
 
702 730
 	// No daily stats to even look at?
703
-	if (empty($condition_text))
704
-		return;
731
+	if (empty($condition_text)) {
732
+			return;
733
+	}
705 734
 
706 735
 	getDailyStats(implode(' OR ', $condition_text), $condition_params);
707 736
 }
@@ -724,8 +753,8 @@  discard block
 block discarded – undo
724 753
 		ORDER BY stats_day ASC',
725 754
 		$condition_parameters
726 755
 	);
727
-	while ($row_days = $smcFunc['db_fetch_assoc']($days_result))
728
-		$context['yearly'][$row_days['stats_year']]['months'][(int) $row_days['stats_month']]['days'][] = array(
756
+	while ($row_days = $smcFunc['db_fetch_assoc']($days_result)) {
757
+			$context['yearly'][$row_days['stats_year']]['months'][(int) $row_days['stats_month']]['days'][] = array(
729 758
 			'day' => sprintf('%02d', $row_days['stats_day']),
730 759
 			'month' => sprintf('%02d', $row_days['stats_month']),
731 760
 			'year' => $row_days['stats_year'],
@@ -735,6 +764,7 @@  discard block
 block discarded – undo
735 764
 			'most_members_online' => comma_format($row_days['most_on']),
736 765
 			'hits' => comma_format($row_days['hits'])
737 766
 		);
767
+	}
738 768
 	$smcFunc['db_free_result']($days_result);
739 769
 }
740 770
 
@@ -752,16 +782,19 @@  discard block
 block discarded – undo
752 782
 	global $modSettings, $user_info, $forum_version, $sourcedir;
753 783
 
754 784
 	// First, is it disabled?
755
-	if (empty($modSettings['enable_sm_stats']) || empty($modSettings['sm_stats_key']))
756
-		die();
785
+	if (empty($modSettings['enable_sm_stats']) || empty($modSettings['sm_stats_key'])) {
786
+			die();
787
+	}
757 788
 
758 789
 	// Are we saying who we are, and are we right? (OR an admin)
759
-	if (!$user_info['is_admin'] && (!isset($_GET['sid']) || $_GET['sid'] != $modSettings['sm_stats_key']))
760
-		die();
790
+	if (!$user_info['is_admin'] && (!isset($_GET['sid']) || $_GET['sid'] != $modSettings['sm_stats_key'])) {
791
+			die();
792
+	}
761 793
 
762 794
 	// Verify the referer...
763
-	if (!$user_info['is_admin'] && (!isset($_SERVER['HTTP_REFERER']) || md5($_SERVER['HTTP_REFERER']) != '746cb59a1a0d5cf4bd240e5a67c73085'))
764
-		die();
795
+	if (!$user_info['is_admin'] && (!isset($_SERVER['HTTP_REFERER']) || md5($_SERVER['HTTP_REFERER']) != '746cb59a1a0d5cf4bd240e5a67c73085')) {
796
+			die();
797
+	}
765 798
 
766 799
 	// Get some server versions.
767 800
 	require_once($sourcedir . '/Subs-Admin.php');
@@ -787,16 +820,17 @@  discard block
 block discarded – undo
787 820
 	);
788 821
 
789 822
 	// Encode all the data, for security.
790
-	foreach ($stats_to_send as $k => $v)
791
-		$stats_to_send[$k] = urlencode($k) . '=' . urlencode($v);
823
+	foreach ($stats_to_send as $k => $v) {
824
+			$stats_to_send[$k] = urlencode($k) . '=' . urlencode($v);
825
+	}
792 826
 
793 827
 	// Turn this into the query string!
794 828
 	$stats_to_send = implode('&', $stats_to_send);
795 829
 
796 830
 	// If we're an admin, just plonk them out.
797
-	if ($user_info['is_admin'])
798
-		echo $stats_to_send;
799
-	else
831
+	if ($user_info['is_admin']) {
832
+			echo $stats_to_send;
833
+	} else
800 834
 	{
801 835
 		// Connect to the collection script.
802 836
 		$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
Please login to merge, or discard this patch.
Sources/ManageServer.php 1 patch
Braces   +315 added lines, -243 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
  * @version 2.1 Beta 4
60 60
  */
61 61
 
62
-if (!defined('SMF'))
62
+if (!defined('SMF')) {
63 63
 	die('No direct access...');
64
+}
64 65
 
65 66
 /**
66 67
  * This is the main dispatcher. Sets up all the available sub-actions, all the tabs and selects
@@ -111,10 +112,11 @@  discard block
 block discarded – undo
111 112
 	$settings_not_writable = !is_writable($boarddir . '/Settings.php');
112 113
 	$settings_backup_fail = !@is_writable($boarddir . '/Settings_bak.php') || !@copy($boarddir . '/Settings.php', $boarddir . '/Settings_bak.php');
113 114
 
114
-	if ($settings_not_writable)
115
-		$context['settings_message'] = '<div class="centertext"><strong>' . $txt['settings_not_writable'] . '</strong></div><br>';
116
-	elseif ($settings_backup_fail)
117
-		$context['settings_message'] = '<div class="centertext"><strong>' . $txt['admin_backup_fail'] . '</strong></div><br>';
115
+	if ($settings_not_writable) {
116
+			$context['settings_message'] = '<div class="centertext"><strong>' . $txt['settings_not_writable'] . '</strong></div><br>';
117
+	} elseif ($settings_backup_fail) {
118
+			$context['settings_message'] = '<div class="centertext"><strong>' . $txt['admin_backup_fail'] . '</strong></div><br>';
119
+	}
118 120
 
119 121
 	$context['settings_not_writable'] = $settings_not_writable;
120 122
 
@@ -142,10 +144,11 @@  discard block
 block discarded – undo
142 144
 
143 145
 	// If no cert, force_ssl must remain 0
144 146
 	require_once($sourcedir . '/Subs.php');
145
-	if (!ssl_cert_found($boardurl) && empty($modSettings['force_ssl']))
146
-		$disable_force_ssl = true;
147
-	else
148
-		$disable_force_ssl = false;
147
+	if (!ssl_cert_found($boardurl) && empty($modSettings['force_ssl'])) {
148
+			$disable_force_ssl = true;
149
+	} else {
150
+			$disable_force_ssl = false;
151
+	}
149 152
 
150 153
 	/* If you're writing a mod, it's a bad idea to add things here....
151 154
 	For each option:
@@ -174,8 +177,9 @@  discard block
 block discarded – undo
174 177
 
175 178
 	call_integration_hook('integrate_general_settings', array(&$config_vars));
176 179
 
177
-	if ($return_config)
178
-		return $config_vars;
180
+	if ($return_config) {
181
+			return $config_vars;
182
+	}
179 183
 
180 184
 	// Setup the template stuff.
181 185
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=general;save';
@@ -192,16 +196,18 @@  discard block
 block discarded – undo
192 196
 			$registerSMStats = registerSMStats();
193 197
 
194 198
 			// Failed to register, disable it again.
195
-			if (empty($registerSMStats))
196
-				$_POST['enable_sm_stats'] = 0;
199
+			if (empty($registerSMStats)) {
200
+							$_POST['enable_sm_stats'] = 0;
201
+			}
197 202
 		}
198 203
 
199 204
 		// Ensure all URLs are aligned with the new force_ssl setting
200 205
 		// Treat unset like 0
201
-		if (isset($_POST['force_ssl']))
202
-			AlignURLsWithSSLSetting($_POST['force_ssl']);
203
-		else
204
-			AlignURLsWithSSLSetting(0);
206
+		if (isset($_POST['force_ssl'])) {
207
+					AlignURLsWithSSLSetting($_POST['force_ssl']);
208
+		} else {
209
+					AlignURLsWithSSLSetting(0);
210
+		}
205 211
 
206 212
 		saveSettings($config_vars);
207 213
 		$_SESSION['adm-save'] = true;
@@ -254,10 +260,11 @@  discard block
 block discarded – undo
254 260
 	require_once($sourcedir . '/Subs-Admin.php');
255 261
 
256 262
 	// Check $boardurl
257
-	if (!empty($new_force_ssl))
258
-		$newval = strtr($boardurl, array('http://' => 'https://'));
259
-	else
260
-		$newval = strtr($boardurl, array('https://' => 'http://'));
263
+	if (!empty($new_force_ssl)) {
264
+			$newval = strtr($boardurl, array('http://' => 'https://'));
265
+	} else {
266
+			$newval = strtr($boardurl, array('https://' => 'http://'));
267
+	}
261 268
 	updateSettingsFile(array('boardurl' => '\'' . addslashes($newval) . '\''));
262 269
 
263 270
 	$new_settings = array();
@@ -265,20 +272,22 @@  discard block
 block discarded – undo
265 272
 	// Check $smileys_url, but only if it points to a subfolder of $boardurl
266 273
 	if (BoardurlMatch($modSettings['smileys_url']))
267 274
 	{
268
-		if (!empty($new_force_ssl))
269
-			$newval = strtr($modSettings['smileys_url'], array('http://' => 'https://'));
270
-		else
271
-			$newval = strtr($modSettings['smileys_url'], array('https://' => 'http://'));
275
+		if (!empty($new_force_ssl)) {
276
+					$newval = strtr($modSettings['smileys_url'], array('http://' => 'https://'));
277
+		} else {
278
+					$newval = strtr($modSettings['smileys_url'], array('https://' => 'http://'));
279
+		}
272 280
 		$new_settings['smileys_url'] = $newval;
273 281
 	}
274 282
 
275 283
 	// Check $avatar_url, but only if it points to a subfolder of $boardurl
276 284
 	if (BoardurlMatch($modSettings['avatar_url']))
277 285
 	{
278
-		if (!empty($new_force_ssl))
279
-			$newval = strtr($modSettings['avatar_url'], array('http://' => 'https://'));
280
-		else
281
-			$newval = strtr($modSettings['avatar_url'], array('https://' => 'http://'));
286
+		if (!empty($new_force_ssl)) {
287
+					$newval = strtr($modSettings['avatar_url'], array('http://' => 'https://'));
288
+		} else {
289
+					$newval = strtr($modSettings['avatar_url'], array('https://' => 'http://'));
290
+		}
282 291
 		$new_settings['avatar_url'] = $newval;
283 292
 	}
284 293
 
@@ -286,16 +295,18 @@  discard block
 block discarded – undo
286 295
 	// This one had been optional in the past, make sure it is set first
287 296
 	if (isset($modSettings['custom_avatar_url']) && BoardurlMatch($modSettings['custom_avatar_url']))
288 297
 	{
289
-		if (!empty($new_force_ssl))
290
-			$newval = strtr($modSettings['custom_avatar_url'], array('http://' => 'https://'));
291
-		else
292
-			$newval = strtr($modSettings['custom_avatar_url'], array('https://' => 'http://'));
298
+		if (!empty($new_force_ssl)) {
299
+					$newval = strtr($modSettings['custom_avatar_url'], array('http://' => 'https://'));
300
+		} else {
301
+					$newval = strtr($modSettings['custom_avatar_url'], array('https://' => 'http://'));
302
+		}
293 303
 		$new_settings['custom_avatar_url'] = $newval;
294 304
 	}
295 305
 
296 306
 	// Save updates to the settings table
297
-	if (!empty($new_settings))
298
-		updateSettings($new_settings, true);
307
+	if (!empty($new_settings)) {
308
+			updateSettings($new_settings, true);
309
+	}
299 310
 
300 311
 	// Now we move onto the themes.
301 312
 	// First, get a list of theme URLs...
@@ -316,10 +327,11 @@  discard block
 block discarded – undo
316 327
 		// First check to see if it points to a subfolder of $boardurl
317 328
 		if (BoardurlMatch($row['value']))
318 329
 		{
319
-			if (!empty($new_force_ssl))
320
-				$newval = strtr($row['value'], array('http://' => 'https://'));
321
-			else
322
-				$newval = strtr($row['value'], array('https://' => 'http://'));
330
+			if (!empty($new_force_ssl)) {
331
+							$newval = strtr($row['value'], array('http://' => 'https://'));
332
+			} else {
333
+							$newval = strtr($row['value'], array('https://' => 'http://'));
334
+			}
323 335
 			$smcFunc['db_query']('', '
324 336
 				UPDATE {db_prefix}themes
325 337
 				   SET value = {string:theme_val}
@@ -359,11 +371,12 @@  discard block
 block discarded – undo
359 371
 
360 372
 	// If leftmost portion of path matches boardurl, return true
361 373
 	$result = strpos($urlpath, $boardurlpath);
362
-	if ($result === false || $result != 0)
363
-		return false;
364
-	else
365
-		return true;
366
-}
374
+	if ($result === false || $result != 0) {
375
+			return false;
376
+	} else {
377
+			return true;
378
+	}
379
+	}
367 380
 
368 381
 /**
369 382
  * Basic database and paths settings - database name, host, etc.
@@ -402,8 +415,9 @@  discard block
 block discarded – undo
402 415
 		$request = $smcFunc['db_query']('', 'SELECT cfgname FROM pg_ts_config', array());
403 416
 		$fts_language = array();
404 417
 
405
-		while ($row = $smcFunc['db_fetch_assoc']($request))
406
-			$fts_language[$row['cfgname']] = $row['cfgname'];
418
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
419
+					$fts_language[$row['cfgname']] = $row['cfgname'];
420
+		}
407 421
 
408 422
 		$config_vars = array_merge ($config_vars, array(
409 423
 				'',
@@ -415,20 +429,22 @@  discard block
 block discarded – undo
415 429
 
416 430
 	call_integration_hook('integrate_database_settings', array(&$config_vars));
417 431
 
418
-	if ($return_config)
419
-		return $config_vars;
432
+	if ($return_config) {
433
+			return $config_vars;
434
+	}
420 435
 
421 436
 	// Setup the template stuff.
422 437
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=database;save';
423 438
 	$context['settings_title'] = $txt['database_settings'];
424 439
 	$context['save_disabled'] = $context['settings_not_writable'];
425 440
 
426
-	if (!$smcFunc['db_allow_persistent']())
427
-		addInlineJavaScript('
441
+	if (!$smcFunc['db_allow_persistent']()) {
442
+			addInlineJavaScript('
428 443
 			$(function()
429 444
 			{
430 445
 				$("#db_persist").prop("disabled", true);
431 446
 			});', true);
447
+	}
432 448
 
433 449
 	// Saving settings?
434 450
 	if (isset($_REQUEST['save']))
@@ -498,13 +514,15 @@  discard block
 block discarded – undo
498 514
 		hideGlobalCookies();
499 515
 	});', true);
500 516
 
501
-	if (empty($user_settings['tfa_secret']))
502
-		addInlineJavaScript('');
517
+	if (empty($user_settings['tfa_secret'])) {
518
+			addInlineJavaScript('');
519
+	}
503 520
 
504 521
 	call_integration_hook('integrate_cookie_settings', array(&$config_vars));
505 522
 
506
-	if ($return_config)
507
-		return $config_vars;
523
+	if ($return_config) {
524
+			return $config_vars;
525
+	}
508 526
 
509 527
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cookie;save';
510 528
 	$context['settings_title'] = $txt['cookies_sessions_settings'];
@@ -515,14 +533,17 @@  discard block
 block discarded – undo
515 533
 		call_integration_hook('integrate_save_cookie_settings');
516 534
 
517 535
 		// Local and global do not play nicely together.
518
-		if (!empty($_POST['localCookies']) && empty($_POST['globalCookies']))
519
-			unset ($_POST['globalCookies']);
536
+		if (!empty($_POST['localCookies']) && empty($_POST['globalCookies'])) {
537
+					unset ($_POST['globalCookies']);
538
+		}
520 539
 
521
-		if (empty($modSettings['localCookies']) != empty($_POST['localCookies']) || empty($modSettings['globalCookies']) != empty($_POST['globalCookies']))
522
-			$scope_changed = true;
540
+		if (empty($modSettings['localCookies']) != empty($_POST['localCookies']) || empty($modSettings['globalCookies']) != empty($_POST['globalCookies'])) {
541
+					$scope_changed = true;
542
+		}
523 543
 
524
-		if (!empty($_POST['globalCookiesDomain']) && strpos($boardurl, $_POST['globalCookiesDomain']) === false)
525
-			fatal_lang_error('invalid_cookie_domain', false);
544
+		if (!empty($_POST['globalCookiesDomain']) && strpos($boardurl, $_POST['globalCookiesDomain']) === false) {
545
+					fatal_lang_error('invalid_cookie_domain', false);
546
+		}
526 547
 
527 548
 		saveSettings($config_vars);
528 549
 
@@ -605,8 +626,9 @@  discard block
 block discarded – undo
605 626
 
606 627
 	call_integration_hook('integrate_general_security_settings', array(&$config_vars));
607 628
 
608
-	if ($return_config)
609
-		return $config_vars;
629
+	if ($return_config) {
630
+			return $config_vars;
631
+	}
610 632
 
611 633
 	// Saving?
612 634
 	if (isset($_GET['save']))
@@ -645,8 +667,7 @@  discard block
 block discarded – undo
645 667
 		$txt['cache_settings_message'] = $txt['detected_no_caching'];
646 668
 		$cache_level = array($txt['cache_off']);
647 669
 		$detected['none'] = $txt['cache_off'];
648
-	}
649
-	else
670
+	} else
650 671
 	{
651 672
 		$txt['cache_settings_message'] = sprintf($txt['detected_accelerators'], implode(', ', $detected));
652 673
 		$cache_level = array($txt['cache_off'], $txt['cache_level1'], $txt['cache_level2'], $txt['cache_level3']);
@@ -683,8 +704,9 @@  discard block
 block discarded – undo
683 704
 			}
684 705
 		}
685 706
 	}
686
-	if ($return_config)
687
-		return $config_vars;
707
+	if ($return_config) {
708
+			return $config_vars;
709
+	}
688 710
 
689 711
 	// Saving again?
690 712
 	if (isset($_GET['save']))
@@ -712,8 +734,9 @@  discard block
 block discarded – undo
712 734
 	$context['save_disabled'] = $context['settings_not_writable'];
713 735
 
714 736
 	// Decide what message to show.
715
-	if (!$context['save_disabled'])
716
-		$context['settings_message'] = $txt['caching_information'];
737
+	if (!$context['save_disabled']) {
738
+			$context['settings_message'] = $txt['caching_information'];
739
+	}
717 740
 
718 741
 	// Prepare the template.
719 742
 	prepareServerSettingsContext($config_vars);
@@ -736,24 +759,25 @@  discard block
 block discarded – undo
736 759
 	if (stripos(PHP_OS, 'win') === 0)
737 760
 	{
738 761
 		$context['settings_message'] = $txt['loadavg_disabled_windows'];
739
-		if (isset($_GET['save']))
740
-			$_SESSION['adm-save'] = $txt['loadavg_disabled_windows'];
741
-	}
742
-	elseif (stripos(PHP_OS, 'darwin') === 0)
762
+		if (isset($_GET['save'])) {
763
+					$_SESSION['adm-save'] = $txt['loadavg_disabled_windows'];
764
+		}
765
+	} elseif (stripos(PHP_OS, 'darwin') === 0)
743 766
 	{
744 767
 		$context['settings_message'] = $txt['loadavg_disabled_osx'];
745
-		if (isset($_GET['save']))
746
-			$_SESSION['adm-save'] = $txt['loadavg_disabled_osx'];
747
-	}
748
-	else
768
+		if (isset($_GET['save'])) {
769
+					$_SESSION['adm-save'] = $txt['loadavg_disabled_osx'];
770
+		}
771
+	} else
749 772
 	{
750 773
 		$modSettings['load_average'] = @file_get_contents('/proc/loadavg');
751
-		if (!empty($modSettings['load_average']) && preg_match('~^([^ ]+?) ([^ ]+?) ([^ ]+)~', $modSettings['load_average'], $matches) !== 0)
752
-			$modSettings['load_average'] = (float) $matches[1];
753
-		elseif (($modSettings['load_average'] = @`uptime`) !== null && preg_match('~load averages?: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)~i', $modSettings['load_average'], $matches) !== 0)
754
-			$modSettings['load_average'] = (float) $matches[1];
755
-		else
756
-			unset($modSettings['load_average']);
774
+		if (!empty($modSettings['load_average']) && preg_match('~^([^ ]+?) ([^ ]+?) ([^ ]+)~', $modSettings['load_average'], $matches) !== 0) {
775
+					$modSettings['load_average'] = (float) $matches[1];
776
+		} elseif (($modSettings['load_average'] = @`uptime`) !== null && preg_match('~load averages?: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)~i', $modSettings['load_average'], $matches) !== 0) {
777
+					$modSettings['load_average'] = (float) $matches[1];
778
+		} else {
779
+					unset($modSettings['load_average']);
780
+		}
757 781
 
758 782
 		if (!empty($modSettings['load_average']) || (isset($modSettings['load_average']) && $modSettings['load_average'] === 0.0))
759 783
 		{
@@ -789,8 +813,9 @@  discard block
 block discarded – undo
789 813
 
790 814
 	call_integration_hook('integrate_loadavg_settings', array(&$config_vars));
791 815
 
792
-	if ($return_config)
793
-		return $config_vars;
816
+	if ($return_config) {
817
+			return $config_vars;
818
+	}
794 819
 
795 820
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=loads;save';
796 821
 	$context['settings_title'] = $txt['load_balancing_settings'];
@@ -801,24 +826,27 @@  discard block
 block discarded – undo
801 826
 		// Stupidity is not allowed.
802 827
 		foreach ($_POST as $key => $value)
803 828
 		{
804
-			if (strpos($key, 'loadavg') === 0 || $key === 'loadavg_enable' || !in_array($key, array_keys($default_values)))
805
-				continue;
806
-			else
807
-				$_POST[$key] = (float) $value;
808
-
809
-			if ($key == 'loadavg_auto_opt' && $value <= 1)
810
-				$_POST['loadavg_auto_opt'] = 1.0;
811
-			elseif ($key == 'loadavg_forum' && $value < 10)
812
-				$_POST['loadavg_forum'] = 10.0;
813
-			elseif ($value < 2)
814
-				$_POST[$key] = 2.0;
829
+			if (strpos($key, 'loadavg') === 0 || $key === 'loadavg_enable' || !in_array($key, array_keys($default_values))) {
830
+							continue;
831
+			} else {
832
+							$_POST[$key] = (float) $value;
833
+			}
834
+
835
+			if ($key == 'loadavg_auto_opt' && $value <= 1) {
836
+							$_POST['loadavg_auto_opt'] = 1.0;
837
+			} elseif ($key == 'loadavg_forum' && $value < 10) {
838
+							$_POST['loadavg_forum'] = 10.0;
839
+			} elseif ($value < 2) {
840
+							$_POST[$key] = 2.0;
841
+			}
815 842
 		}
816 843
 
817 844
 		call_integration_hook('integrate_save_loadavg_settings');
818 845
 
819 846
 		saveDBSettings($config_vars);
820
-		if (!isset($_SESSION['adm-save']))
821
-			$_SESSION['adm-save'] = true;
847
+		if (!isset($_SESSION['adm-save'])) {
848
+					$_SESSION['adm-save'] = true;
849
+		}
822 850
 		redirectexit('action=admin;area=serversettings;sa=loads;' . $context['session_var'] . '=' . $context['session_id']);
823 851
 	}
824 852
 
@@ -854,10 +882,11 @@  discard block
 block discarded – undo
854 882
 
855 883
 	if (isset($_SESSION['adm-save']))
856 884
 	{
857
-		if ($_SESSION['adm-save'] === true)
858
-			$context['saved_successful'] = true;
859
-		else
860
-			$context['saved_failed'] = $_SESSION['adm-save'];
885
+		if ($_SESSION['adm-save'] === true) {
886
+					$context['saved_successful'] = true;
887
+		} else {
888
+					$context['saved_failed'] = $_SESSION['adm-save'];
889
+		}
861 890
 
862 891
 		unset($_SESSION['adm-save']);
863 892
 	}
@@ -865,9 +894,9 @@  discard block
 block discarded – undo
865 894
 	$context['config_vars'] = array();
866 895
 	foreach ($config_vars as $identifier => $config_var)
867 896
 	{
868
-		if (!is_array($config_var) || !isset($config_var[1]))
869
-			$context['config_vars'][] = $config_var;
870
-		else
897
+		if (!is_array($config_var) || !isset($config_var[1])) {
898
+					$context['config_vars'][] = $config_var;
899
+		} else
871 900
 		{
872 901
 			$varname = $config_var[0];
873 902
 			global $$varname;
@@ -902,16 +931,19 @@  discard block
 block discarded – undo
902 931
 			if ($config_var[3] == 'int' || $config_var[3] == 'float')
903 932
 			{
904 933
 				// Default to a min of 0 if one isn't set
905
-				if (isset($config_var['min']))
906
-					$context['config_vars'][$config_var[0]]['min'] = $config_var['min'];
907
-				else
908
-					$context['config_vars'][$config_var[0]]['min'] = 0;
934
+				if (isset($config_var['min'])) {
935
+									$context['config_vars'][$config_var[0]]['min'] = $config_var['min'];
936
+				} else {
937
+									$context['config_vars'][$config_var[0]]['min'] = 0;
938
+				}
909 939
 
910
-				if (isset($config_var['max']))
911
-					$context['config_vars'][$config_var[0]]['max'] = $config_var['max'];
940
+				if (isset($config_var['max'])) {
941
+									$context['config_vars'][$config_var[0]]['max'] = $config_var['max'];
942
+				}
912 943
 
913
-				if (isset($config_var['step']))
914
-					$context['config_vars'][$config_var[0]]['step'] = $config_var['step'];
944
+				if (isset($config_var['step'])) {
945
+									$context['config_vars'][$config_var[0]]['step'] = $config_var['step'];
946
+				}
915 947
 			}
916 948
 
917 949
 			// If this is a select box handle any data.
@@ -919,12 +951,13 @@  discard block
 block discarded – undo
919 951
 			{
920 952
 				// If it's associative
921 953
 				$config_values = array_values($config_var[4]);
922
-				if (isset($config_values[0]) && is_array($config_values[0]))
923
-					$context['config_vars'][$config_var[0]]['data'] = $config_var[4];
924
-				else
954
+				if (isset($config_values[0]) && is_array($config_values[0])) {
955
+									$context['config_vars'][$config_var[0]]['data'] = $config_var[4];
956
+				} else
925 957
 				{
926
-					foreach ($config_var[4] as $key => $item)
927
-						$context['config_vars'][$config_var[0]]['data'][] = array($key, $item);
958
+					foreach ($config_var[4] as $key => $item) {
959
+											$context['config_vars'][$config_var[0]]['data'][] = array($key, $item);
960
+					}
928 961
 				}
929 962
 			}
930 963
 		}
@@ -949,10 +982,11 @@  discard block
 block discarded – undo
949 982
 
950 983
 	if (isset($_SESSION['adm-save']))
951 984
 	{
952
-		if ($_SESSION['adm-save'] === true)
953
-			$context['saved_successful'] = true;
954
-		else
955
-			$context['saved_failed'] = $_SESSION['adm-save'];
985
+		if ($_SESSION['adm-save'] === true) {
986
+					$context['saved_successful'] = true;
987
+		} else {
988
+					$context['saved_failed'] = $_SESSION['adm-save'];
989
+		}
956 990
 
957 991
 		unset($_SESSION['adm-save']);
958 992
 	}
@@ -964,26 +998,30 @@  discard block
 block discarded – undo
964 998
 	foreach ($config_vars as $config_var)
965 999
 	{
966 1000
 		// HR?
967
-		if (!is_array($config_var))
968
-			$context['config_vars'][] = $config_var;
969
-		else
1001
+		if (!is_array($config_var)) {
1002
+					$context['config_vars'][] = $config_var;
1003
+		} else
970 1004
 		{
971 1005
 			// If it has no name it doesn't have any purpose!
972
-			if (empty($config_var[1]))
973
-				continue;
1006
+			if (empty($config_var[1])) {
1007
+							continue;
1008
+			}
974 1009
 
975 1010
 			// Special case for inline permissions
976
-			if ($config_var[0] == 'permissions' && allowedTo('manage_permissions'))
977
-				$inlinePermissions[] = $config_var[1];
978
-			elseif ($config_var[0] == 'permissions')
979
-				continue;
1011
+			if ($config_var[0] == 'permissions' && allowedTo('manage_permissions')) {
1012
+							$inlinePermissions[] = $config_var[1];
1013
+			} elseif ($config_var[0] == 'permissions') {
1014
+							continue;
1015
+			}
980 1016
 
981
-			if ($config_var[0] == 'boards')
982
-				$board_list = true;
1017
+			if ($config_var[0] == 'boards') {
1018
+							$board_list = true;
1019
+			}
983 1020
 
984 1021
 			// Are we showing the BBC selection box?
985
-			if ($config_var[0] == 'bbc')
986
-				$bbcChoice[] = $config_var[1];
1022
+			if ($config_var[0] == 'bbc') {
1023
+							$bbcChoice[] = $config_var[1];
1024
+			}
987 1025
 
988 1026
 			// We need to do some parsing of the value before we pass it in.
989 1027
 			if (isset($modSettings[$config_var[1]]))
@@ -1002,8 +1040,7 @@  discard block
 block discarded – undo
1002 1040
 					default:
1003 1041
 						$value = $smcFunc['htmlspecialchars']($modSettings[$config_var[1]]);
1004 1042
 				}
1005
-			}
1006
-			else
1043
+			} else
1007 1044
 			{
1008 1045
 				// Darn, it's empty. What type is expected?
1009 1046
 				switch ($config_var[0])
@@ -1043,16 +1080,19 @@  discard block
 block discarded – undo
1043 1080
 			if ($config_var[0] == 'int' || $config_var[0] == 'float')
1044 1081
 			{
1045 1082
 				// Default to a min of 0 if one isn't set
1046
-				if (isset($config_var['min']))
1047
-					$context['config_vars'][$config_var[1]]['min'] = $config_var['min'];
1048
-				else
1049
-					$context['config_vars'][$config_var[1]]['min'] = 0;
1083
+				if (isset($config_var['min'])) {
1084
+									$context['config_vars'][$config_var[1]]['min'] = $config_var['min'];
1085
+				} else {
1086
+									$context['config_vars'][$config_var[1]]['min'] = 0;
1087
+				}
1050 1088
 
1051
-				if (isset($config_var['max']))
1052
-					$context['config_vars'][$config_var[1]]['max'] = $config_var['max'];
1089
+				if (isset($config_var['max'])) {
1090
+									$context['config_vars'][$config_var[1]]['max'] = $config_var['max'];
1091
+				}
1053 1092
 
1054
-				if (isset($config_var['step']))
1055
-					$context['config_vars'][$config_var[1]]['step'] = $config_var['step'];
1093
+				if (isset($config_var['step'])) {
1094
+									$context['config_vars'][$config_var[1]]['step'] = $config_var['step'];
1095
+				}
1056 1096
 			}
1057 1097
 
1058 1098
 			// If this is a select box handle any data.
@@ -1066,12 +1106,13 @@  discard block
 block discarded – undo
1066 1106
 				}
1067 1107
 
1068 1108
 				// If it's associative
1069
-				if (isset($config_var[2][0]) && is_array($config_var[2][0]))
1070
-					$context['config_vars'][$config_var[1]]['data'] = $config_var[2];
1071
-				else
1109
+				if (isset($config_var[2][0]) && is_array($config_var[2][0])) {
1110
+									$context['config_vars'][$config_var[1]]['data'] = $config_var[2];
1111
+				} else
1072 1112
 				{
1073
-					foreach ($config_var[2] as $key => $item)
1074
-						$context['config_vars'][$config_var[1]]['data'][] = array($key, $item);
1113
+					foreach ($config_var[2] as $key => $item) {
1114
+											$context['config_vars'][$config_var[1]]['data'][] = array($key, $item);
1115
+					}
1075 1116
 				}
1076 1117
 			}
1077 1118
 
@@ -1080,17 +1121,19 @@  discard block
 block discarded – undo
1080 1121
 			{
1081 1122
 				if (!is_numeric($k))
1082 1123
 				{
1083
-					if (substr($k, 0, 2) == 'on')
1084
-						$context['config_vars'][$config_var[1]]['javascript'] .= ' ' . $k . '="' . $v . '"';
1085
-					else
1086
-						$context['config_vars'][$config_var[1]][$k] = $v;
1124
+					if (substr($k, 0, 2) == 'on') {
1125
+											$context['config_vars'][$config_var[1]]['javascript'] .= ' ' . $k . '="' . $v . '"';
1126
+					} else {
1127
+											$context['config_vars'][$config_var[1]][$k] = $v;
1128
+					}
1087 1129
 				}
1088 1130
 
1089 1131
 				// See if there are any other labels that might fit?
1090
-				if (isset($txt['setting_' . $config_var[1]]))
1091
-					$context['config_vars'][$config_var[1]]['label'] = $txt['setting_' . $config_var[1]];
1092
-				elseif (isset($txt['groups_' . $config_var[1]]))
1093
-					$context['config_vars'][$config_var[1]]['label'] = $txt['groups_' . $config_var[1]];
1132
+				if (isset($txt['setting_' . $config_var[1]])) {
1133
+									$context['config_vars'][$config_var[1]]['label'] = $txt['setting_' . $config_var[1]];
1134
+				} elseif (isset($txt['groups_' . $config_var[1]])) {
1135
+									$context['config_vars'][$config_var[1]]['label'] = $txt['groups_' . $config_var[1]];
1136
+				}
1094 1137
 			}
1095 1138
 
1096 1139
 			// Set the subtext in case it's part of the label.
@@ -1123,8 +1166,9 @@  discard block
 block discarded – undo
1123 1166
 		// What are the options, eh?
1124 1167
 		$temp = parse_bbc(false);
1125 1168
 		$bbcTags = array();
1126
-		foreach ($temp as $tag)
1127
-			$bbcTags[] = $tag['tag'];
1169
+		foreach ($temp as $tag) {
1170
+					$bbcTags[] = $tag['tag'];
1171
+		}
1128 1172
 
1129 1173
 		$bbcTags = array_unique($bbcTags);
1130 1174
 		$totalTags = count($bbcTags);
@@ -1139,8 +1183,9 @@  discard block
 block discarded – undo
1139 1183
 		$col = 0; $i = 0;
1140 1184
 		foreach ($bbcTags as $tag)
1141 1185
 		{
1142
-			if ($i % $tagsPerColumn == 0 && $i != 0)
1143
-				$col++;
1186
+			if ($i % $tagsPerColumn == 0 && $i != 0) {
1187
+							$col++;
1188
+			}
1144 1189
 
1145 1190
 			$context['bbc_columns'][$col][] = array(
1146 1191
 				'tag' => $tag,
@@ -1183,18 +1228,21 @@  discard block
 block discarded – undo
1183 1228
 	validateToken('admin-ssc');
1184 1229
 
1185 1230
 	// Fix the darn stupid cookiename! (more may not be allowed, but these for sure!)
1186
-	if (isset($_POST['cookiename']))
1187
-		$_POST['cookiename'] = preg_replace('~[,;\s\.$]+~' . ($context['utf8'] ? 'u' : ''), '', $_POST['cookiename']);
1231
+	if (isset($_POST['cookiename'])) {
1232
+			$_POST['cookiename'] = preg_replace('~[,;\s\.$]+~' . ($context['utf8'] ? 'u' : ''), '', $_POST['cookiename']);
1233
+	}
1188 1234
 
1189 1235
 	// Fix the forum's URL if necessary.
1190 1236
 	if (isset($_POST['boardurl']))
1191 1237
 	{
1192
-		if (substr($_POST['boardurl'], -10) == '/index.php')
1193
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
1194
-		elseif (substr($_POST['boardurl'], -1) == '/')
1195
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
1196
-		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://')
1197
-			$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
1238
+		if (substr($_POST['boardurl'], -10) == '/index.php') {
1239
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
1240
+		} elseif (substr($_POST['boardurl'], -1) == '/') {
1241
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
1242
+		}
1243
+		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') {
1244
+					$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
1245
+		}
1198 1246
 	}
1199 1247
 
1200 1248
 	// Any passwords?
@@ -1229,21 +1277,21 @@  discard block
 block discarded – undo
1229 1277
 	// Figure out which config vars we're saving here...
1230 1278
 	foreach ($config_vars as $var)
1231 1279
 	{
1232
-		if (!is_array($var) || $var[2] != 'file' || (!in_array($var[0], $config_bools) && !isset($_POST[$var[0]])))
1233
-			continue;
1280
+		if (!is_array($var) || $var[2] != 'file' || (!in_array($var[0], $config_bools) && !isset($_POST[$var[0]]))) {
1281
+					continue;
1282
+		}
1234 1283
 
1235 1284
 		$config_var = $var[0];
1236 1285
 
1237 1286
 		if (in_array($config_var, $config_passwords))
1238 1287
 		{
1239
-			if (isset($_POST[$config_var][1]) && $_POST[$config_var][0] == $_POST[$config_var][1])
1240
-				$new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var][0], '\'\\') . '\'';
1241
-		}
1242
-		elseif (in_array($config_var, $config_strs))
1288
+			if (isset($_POST[$config_var][1]) && $_POST[$config_var][0] == $_POST[$config_var][1]) {
1289
+							$new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var][0], '\'\\') . '\'';
1290
+			}
1291
+		} elseif (in_array($config_var, $config_strs))
1243 1292
 		{
1244 1293
 			$new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var], '\'\\') . '\'';
1245
-		}
1246
-		elseif (in_array($config_var, $config_ints))
1294
+		} elseif (in_array($config_var, $config_ints))
1247 1295
 		{
1248 1296
 			$new_settings[$config_var] = (int) $_POST[$config_var];
1249 1297
 
@@ -1252,17 +1300,17 @@  discard block
 block discarded – undo
1252 1300
 			$new_settings[$config_var] = max($min, $new_settings[$config_var]);
1253 1301
 
1254 1302
 			// Is there a max value for this as well?
1255
-			if (isset($var['max']))
1256
-				$new_settings[$config_var] = min($var['max'], $new_settings[$config_var]);
1257
-		}
1258
-		elseif (in_array($config_var, $config_bools))
1303
+			if (isset($var['max'])) {
1304
+							$new_settings[$config_var] = min($var['max'], $new_settings[$config_var]);
1305
+			}
1306
+		} elseif (in_array($config_var, $config_bools))
1259 1307
 		{
1260
-			if (!empty($_POST[$config_var]))
1261
-				$new_settings[$config_var] = '1';
1262
-			else
1263
-				$new_settings[$config_var] = '0';
1264
-		}
1265
-		else
1308
+			if (!empty($_POST[$config_var])) {
1309
+							$new_settings[$config_var] = '1';
1310
+			} else {
1311
+							$new_settings[$config_var] = '0';
1312
+			}
1313
+		} else
1266 1314
 		{
1267 1315
 			// This shouldn't happen, but it might...
1268 1316
 			fatal_error('Unknown config_var \'' . $config_var . '\'');
@@ -1278,30 +1326,35 @@  discard block
 block discarded – undo
1278 1326
 	foreach ($config_vars as $config_var)
1279 1327
 	{
1280 1328
 		// We just saved the file-based settings, so skip their definitions.
1281
-		if (!is_array($config_var) || $config_var[2] == 'file')
1282
-			continue;
1329
+		if (!is_array($config_var) || $config_var[2] == 'file') {
1330
+					continue;
1331
+		}
1283 1332
 
1284 1333
 		$new_setting = array($config_var[3], $config_var[0]);
1285 1334
 
1286 1335
 		// Select options need carried over, too.
1287
-		if (isset($config_var[4]))
1288
-			$new_setting[] = $config_var[4];
1336
+		if (isset($config_var[4])) {
1337
+					$new_setting[] = $config_var[4];
1338
+		}
1289 1339
 
1290 1340
 		// Include min and max if necessary
1291
-		if (isset($config_var['min']))
1292
-			$new_setting['min'] = $config_var['min'];
1341
+		if (isset($config_var['min'])) {
1342
+					$new_setting['min'] = $config_var['min'];
1343
+		}
1293 1344
 
1294
-		if (isset($config_var['max']))
1295
-			$new_setting['max'] = $config_var['max'];
1345
+		if (isset($config_var['max'])) {
1346
+					$new_setting['max'] = $config_var['max'];
1347
+		}
1296 1348
 
1297 1349
 		// Rewrite the definition a bit.
1298 1350
 		$new_settings[] = $new_setting;
1299 1351
 	}
1300 1352
 
1301 1353
 	// Save the new database-based settings, if any.
1302
-	if (!empty($new_settings))
1303
-		saveDBSettings($new_settings);
1304
-}
1354
+	if (!empty($new_settings)) {
1355
+			saveDBSettings($new_settings);
1356
+	}
1357
+	}
1305 1358
 
1306 1359
 /**
1307 1360
  * Helper function for saving database settings.
@@ -1319,22 +1372,25 @@  discard block
 block discarded – undo
1319 1372
 	$inlinePermissions = array();
1320 1373
 	foreach ($config_vars as $var)
1321 1374
 	{
1322
-		if (!isset($var[1]) || (!isset($_POST[$var[1]]) && $var[0] != 'check' && $var[0] != 'permissions' && $var[0] != 'boards' && ($var[0] != 'bbc' || !isset($_POST[$var[1] . '_enabledTags']))))
1323
-			continue;
1375
+		if (!isset($var[1]) || (!isset($_POST[$var[1]]) && $var[0] != 'check' && $var[0] != 'permissions' && $var[0] != 'boards' && ($var[0] != 'bbc' || !isset($_POST[$var[1] . '_enabledTags'])))) {
1376
+					continue;
1377
+		}
1324 1378
 
1325 1379
 		// Checkboxes!
1326
-		elseif ($var[0] == 'check')
1327
-			$setArray[$var[1]] = !empty($_POST[$var[1]]) ? '1' : '0';
1380
+		elseif ($var[0] == 'check') {
1381
+					$setArray[$var[1]] = !empty($_POST[$var[1]]) ? '1' : '0';
1382
+		}
1328 1383
 		// Select boxes!
1329
-		elseif ($var[0] == 'select' && in_array($_POST[$var[1]], array_keys($var[2])))
1330
-			$setArray[$var[1]] = $_POST[$var[1]];
1331
-		elseif ($var[0] == 'select' && !empty($var['multiple']) && array_intersect($_POST[$var[1]], array_keys($var[2])) != array())
1384
+		elseif ($var[0] == 'select' && in_array($_POST[$var[1]], array_keys($var[2]))) {
1385
+					$setArray[$var[1]] = $_POST[$var[1]];
1386
+		} elseif ($var[0] == 'select' && !empty($var['multiple']) && array_intersect($_POST[$var[1]], array_keys($var[2])) != array())
1332 1387
 		{
1333 1388
 			// For security purposes we validate this line by line.
1334 1389
 			$lOptions = array();
1335
-			foreach ($_POST[$var[1]] as $invar)
1336
-				if (in_array($invar, array_keys($var[2])))
1390
+			foreach ($_POST[$var[1]] as $invar) {
1391
+							if (in_array($invar, array_keys($var[2])))
1337 1392
 					$lOptions[] = $invar;
1393
+			}
1338 1394
 
1339 1395
 			$setArray[$var[1]] = $smcFunc['json_encode']($lOptions);
1340 1396
 		}
@@ -1348,18 +1404,20 @@  discard block
 block discarded – undo
1348 1404
 				$request = $smcFunc['db_query']('', '
1349 1405
 					SELECT id_board
1350 1406
 					FROM {db_prefix}boards');
1351
-				while ($row = $smcFunc['db_fetch_row']($request))
1352
-					$board_list[$row[0]] = true;
1407
+				while ($row = $smcFunc['db_fetch_row']($request)) {
1408
+									$board_list[$row[0]] = true;
1409
+				}
1353 1410
 
1354 1411
 				$smcFunc['db_free_result']($request);
1355 1412
 			}
1356 1413
 
1357 1414
 			$lOptions = array();
1358 1415
 
1359
-			if (!empty($_POST[$var[1]]))
1360
-				foreach ($_POST[$var[1]] as $invar => $dummy)
1416
+			if (!empty($_POST[$var[1]])) {
1417
+							foreach ($_POST[$var[1]] as $invar => $dummy)
1361 1418
 					if (isset($board_list[$invar]))
1362 1419
 						$lOptions[] = $invar;
1420
+			}
1363 1421
 
1364 1422
 			$setArray[$var[1]] = !empty($lOptions) ? implode(',', $lOptions) : '';
1365 1423
 		}
@@ -1373,8 +1431,9 @@  discard block
 block discarded – undo
1373 1431
 			$setArray[$var[1]] = max($min, $setArray[$var[1]]);
1374 1432
 
1375 1433
 			// Do we have a max value for this as well?
1376
-			if (isset($var['max']))
1377
-				$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1434
+			if (isset($var['max'])) {
1435
+							$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1436
+			}
1378 1437
 		}
1379 1438
 		// Floating point!
1380 1439
 		elseif ($var[0] == 'float')
@@ -1386,39 +1445,46 @@  discard block
 block discarded – undo
1386 1445
 			$setArray[$var[1]] = max($min, $setArray[$var[1]]);
1387 1446
 
1388 1447
 			// Do we have a max value for this as well?
1389
-			if (isset($var['max']))
1390
-				$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1448
+			if (isset($var['max'])) {
1449
+							$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1450
+			}
1391 1451
 		}
1392 1452
 		// Text!
1393
-		elseif (in_array($var[0], array('text', 'large_text', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time')))
1394
-			$setArray[$var[1]] = $_POST[$var[1]];
1453
+		elseif (in_array($var[0], array('text', 'large_text', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'))) {
1454
+					$setArray[$var[1]] = $_POST[$var[1]];
1455
+		}
1395 1456
 		// Passwords!
1396 1457
 		elseif ($var[0] == 'password')
1397 1458
 		{
1398
-			if (isset($_POST[$var[1]][1]) && $_POST[$var[1]][0] == $_POST[$var[1]][1])
1399
-				$setArray[$var[1]] = $_POST[$var[1]][0];
1459
+			if (isset($_POST[$var[1]][1]) && $_POST[$var[1]][0] == $_POST[$var[1]][1]) {
1460
+							$setArray[$var[1]] = $_POST[$var[1]][0];
1461
+			}
1400 1462
 		}
1401 1463
 		// BBC.
1402 1464
 		elseif ($var[0] == 'bbc')
1403 1465
 		{
1404 1466
 			$bbcTags = array();
1405
-			foreach (parse_bbc(false) as $tag)
1406
-				$bbcTags[] = $tag['tag'];
1467
+			foreach (parse_bbc(false) as $tag) {
1468
+							$bbcTags[] = $tag['tag'];
1469
+			}
1407 1470
 
1408
-			if (!isset($_POST[$var[1] . '_enabledTags']))
1409
-				$_POST[$var[1] . '_enabledTags'] = array();
1410
-			elseif (!is_array($_POST[$var[1] . '_enabledTags']))
1411
-				$_POST[$var[1] . '_enabledTags'] = array($_POST[$var[1] . '_enabledTags']);
1471
+			if (!isset($_POST[$var[1] . '_enabledTags'])) {
1472
+							$_POST[$var[1] . '_enabledTags'] = array();
1473
+			} elseif (!is_array($_POST[$var[1] . '_enabledTags'])) {
1474
+							$_POST[$var[1] . '_enabledTags'] = array($_POST[$var[1] . '_enabledTags']);
1475
+			}
1412 1476
 
1413 1477
 			$setArray[$var[1]] = implode(',', array_diff($bbcTags, $_POST[$var[1] . '_enabledTags']));
1414 1478
 		}
1415 1479
 		// Permissions?
1416
-		elseif ($var[0] == 'permissions')
1417
-			$inlinePermissions[] = $var[1];
1480
+		elseif ($var[0] == 'permissions') {
1481
+					$inlinePermissions[] = $var[1];
1482
+		}
1418 1483
 	}
1419 1484
 
1420
-	if (!empty($setArray))
1421
-		updateSettings($setArray);
1485
+	if (!empty($setArray)) {
1486
+			updateSettings($setArray);
1487
+	}
1422 1488
 
1423 1489
 	// If we have inline permissions we need to save them.
1424 1490
 	if (!empty($inlinePermissions) && allowedTo('manage_permissions'))
@@ -1455,18 +1521,21 @@  discard block
 block discarded – undo
1455 1521
 	// put all of it into an array
1456 1522
 	foreach ($info_lines as $line)
1457 1523
 	{
1458
-		if (preg_match('~(' . $remove . ')~', $line))
1459
-			continue;
1524
+		if (preg_match('~(' . $remove . ')~', $line)) {
1525
+					continue;
1526
+		}
1460 1527
 
1461 1528
 		// new category?
1462
-		if (strpos($line, '<h2>') !== false)
1463
-			$category = preg_match('~<h2>(.*)</h2>~', $line, $title) ? $category = $title[1] : $category;
1529
+		if (strpos($line, '<h2>') !== false) {
1530
+					$category = preg_match('~<h2>(.*)</h2>~', $line, $title) ? $category = $title[1] : $category;
1531
+		}
1464 1532
 
1465 1533
 		// load it as setting => value or the old setting local master
1466
-		if (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val))
1467
-			$pinfo[$category][$val[1]] = $val[2];
1468
-		elseif (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val))
1469
-			$pinfo[$category][$val[1]] = array($txt['phpinfo_localsettings'] => $val[2], $txt['phpinfo_defaultsettings'] => $val[3]);
1534
+		if (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val)) {
1535
+					$pinfo[$category][$val[1]] = $val[2];
1536
+		} elseif (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val)) {
1537
+					$pinfo[$category][$val[1]] = array($txt['phpinfo_localsettings'] => $val[2], $txt['phpinfo_defaultsettings'] => $val[3]);
1538
+		}
1470 1539
 	}
1471 1540
 
1472 1541
 	// load it in to context and display it
@@ -1501,8 +1570,9 @@  discard block
 block discarded – undo
1501 1570
 				$testAPI = new $cache_class_name();
1502 1571
 
1503 1572
 				// No Support?  NEXT!
1504
-				if (!$testAPI->isSupported(true))
1505
-					continue;
1573
+				if (!$testAPI->isSupported(true)) {
1574
+									continue;
1575
+				}
1506 1576
 
1507 1577
 				$apis[$tryCache] = isset($txt[$tryCache . '_cache']) ? $txt[$tryCache . '_cache'] : $tryCache;
1508 1578
 			}
@@ -1527,8 +1597,9 @@  discard block
 block discarded – undo
1527 1597
 	global $modSettings, $boardurl, $smcFunc;
1528 1598
 
1529 1599
 	// Already have a key?  Can't register again.
1530
-	if (!empty($modSettings['sm_stats_key']))
1531
-		return true;
1600
+	if (!empty($modSettings['sm_stats_key'])) {
1601
+			return true;
1602
+	}
1532 1603
 
1533 1604
 	$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
1534 1605
 	if ($fp)
@@ -1539,8 +1610,9 @@  discard block
 block discarded – undo
1539 1610
 		fwrite($fp, $out);
1540 1611
 
1541 1612
 		$return_data = '';
1542
-		while (!feof($fp))
1543
-			$return_data .= fgets($fp, 128);
1613
+		while (!feof($fp)) {
1614
+					$return_data .= fgets($fp, 128);
1615
+		}
1544 1616
 
1545 1617
 		fclose($fp);
1546 1618
 
Please login to merge, or discard this patch.
Sources/Errors.php 1 patch
Braces   +133 added lines, -95 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
  * @version 2.1 Beta 4
16 16
  */
17 17
 
18
-if (!defined('SMF'))
18
+if (!defined('SMF')) {
19 19
 	die('No direct access...');
20
+}
20 21
 
21 22
 /**
22 23
  * Log an error, if the error logging is enabled.
@@ -39,10 +40,11 @@  discard block
 block discarded – undo
39 40
 	$error_call++;
40 41
 
41 42
 	// Collect a backtrace
42
-	if (!isset($db_show_debug) || $db_show_debug === false)
43
-		$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
44
-	else
45
-		$backtrace = debug_backtrace();
43
+	if (!isset($db_show_debug) || $db_show_debug === false) {
44
+			$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
45
+	} else {
46
+			$backtrace = debug_backtrace();
47
+	}
46 48
 
47 49
 	// are we in a loop?
48 50
 	if($error_call > 2)
@@ -52,8 +54,9 @@  discard block
 block discarded – undo
52 54
 	}
53 55
 
54 56
 	// Check if error logging is actually on.
55
-	if (empty($modSettings['enableErrorLogging']))
56
-		return $error_message;
57
+	if (empty($modSettings['enableErrorLogging'])) {
58
+			return $error_message;
59
+	}
57 60
 
58 61
 	// Basically, htmlspecialchars it minus &. (for entities!)
59 62
 	$error_message = strtr($error_message, array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;'));
@@ -61,33 +64,39 @@  discard block
 block discarded – undo
61 64
 
62 65
 	// Add a file and line to the error message?
63 66
 	// Don't use the actual txt entries for file and line but instead use %1$s for file and %2$s for line
64
-	if ($file == null)
65
-		$file = '';
66
-	else
67
-		// Window style slashes don't play well, lets convert them to the unix style.
67
+	if ($file == null) {
68
+			$file = '';
69
+	} else {
70
+			// Window style slashes don't play well, lets convert them to the unix style.
68 71
 		$file = str_replace('\\', '/', $file);
72
+	}
69 73
 
70
-	if ($line == null)
71
-		$line = 0;
72
-	else
73
-		$line = (int) $line;
74
+	if ($line == null) {
75
+			$line = 0;
76
+	} else {
77
+			$line = (int) $line;
78
+	}
74 79
 
75 80
 	// Just in case there's no id_member or IP set yet.
76
-	if (empty($user_info['id']))
77
-		$user_info['id'] = 0;
78
-	if (empty($user_info['ip']))
79
-		$user_info['ip'] = '';
81
+	if (empty($user_info['id'])) {
82
+			$user_info['id'] = 0;
83
+	}
84
+	if (empty($user_info['ip'])) {
85
+			$user_info['ip'] = '';
86
+	}
80 87
 
81 88
 	// Find the best query string we can...
82 89
 	$query_string = empty($_SERVER['QUERY_STRING']) ? (empty($_SERVER['REQUEST_URL']) ? '' : str_replace($scripturl, '', $_SERVER['REQUEST_URL'])) : $_SERVER['QUERY_STRING'];
83 90
 
84 91
 	// Don't log the session hash in the url twice, it's a waste.
85
-	if (!empty($smcFunc['htmlspecialchars']))
86
-		$query_string = $smcFunc['htmlspecialchars']((SMF == 'SSI' || SMF == 'BACKGROUND' ? '' : '?') . preg_replace(array('~;sesc=[^&;]+~', '~' . session_name() . '=' . session_id() . '[&;]~'), array(';sesc', ''), $query_string));
92
+	if (!empty($smcFunc['htmlspecialchars'])) {
93
+			$query_string = $smcFunc['htmlspecialchars']((SMF == 'SSI' || SMF == 'BACKGROUND' ? '' : '?') . preg_replace(array('~;sesc=[^&;]+~', '~' . session_name() . '=' . session_id() . '[&;]~'), array(';sesc', ''), $query_string));
94
+	}
87 95
 
88 96
 	// Just so we know what board error messages are from.
89
-	if (isset($_POST['board']) && !isset($_GET['board']))
90
-		$query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board'];
97
+	if (isset($_POST['board']) && !isset($_GET['board'])) {
98
+			$query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board'];
99
+	}
91 100
 
92 101
 	// What types of categories do we have?
93 102
 	$known_error_types = array(
@@ -140,9 +149,9 @@  discard block
 block discarded – undo
140 149
 
141 150
 			list($context['num_errors']) = $smcFunc['db_fetch_row']($query);
142 151
 			$smcFunc['db_free_result']($query);
152
+		} else {
153
+					$context['num_errors']++;
143 154
 		}
144
-		else
145
-			$context['num_errors']++;
146 155
 	}
147 156
 
148 157
 	// reset error call
@@ -164,12 +173,14 @@  discard block
 block discarded – undo
164 173
 	global $txt;
165 174
 
166 175
 	// Send the appropriate HTTP status header - set this to 0 or false if you don't want to send one at all
167
-	if (!empty($status))
168
-		send_http_status($status);
176
+	if (!empty($status)) {
177
+			send_http_status($status);
178
+	}
169 179
 
170 180
 	// We don't have $txt yet, but that's okay...
171
-	if (empty($txt))
172
-		die($error);
181
+	if (empty($txt)) {
182
+			die($error);
183
+	}
173 184
 
174 185
 	log_error_online($error, false);
175 186
 	setup_fatal_error_context($log ? log_error($error, $log) : $error);
@@ -196,8 +207,9 @@  discard block
 block discarded – undo
196 207
 	static $fatal_error_called = false;
197 208
 
198 209
 	// Send the status header - set this to 0 or false if you don't want to send one at all
199
-	if (!empty($status))
200
-		send_http_status($status);
210
+	if (!empty($status)) {
211
+			send_http_status($status);
212
+	}
201 213
 
202 214
 	// Try to load a theme if we don't have one.
203 215
 	if (empty($context['theme_loaded']) && empty($fatal_error_called))
@@ -207,8 +219,9 @@  discard block
 block discarded – undo
207 219
 	}
208 220
 
209 221
 	// If we have no theme stuff we can't have the language file...
210
-	if (empty($context['theme_loaded']))
211
-		die($error);
222
+	if (empty($context['theme_loaded'])) {
223
+			die($error);
224
+	}
212 225
 
213 226
 	$reload_lang_file = true;
214 227
 	// Log the error in the forum's language, but don't waste the time if we aren't logging
@@ -244,8 +257,9 @@  discard block
 block discarded – undo
244 257
 	global $settings, $modSettings, $db_show_debug;
245 258
 
246 259
 	// Ignore errors if we're ignoring them or they are strict notices from PHP 5
247
-	if (error_reporting() == 0)
248
-		return;
260
+	if (error_reporting() == 0) {
261
+			return;
262
+	}
249 263
 
250 264
 	if (strpos($file, 'eval()') !== false && !empty($settings['current_include_filename']))
251 265
 	{
@@ -253,19 +267,22 @@  discard block
 block discarded – undo
253 267
 		$count = count($array);
254 268
 		for ($i = 0; $i < $count; $i++)
255 269
 		{
256
-			if ($array[$i]['function'] != 'loadSubTemplate')
257
-				continue;
270
+			if ($array[$i]['function'] != 'loadSubTemplate') {
271
+							continue;
272
+			}
258 273
 
259 274
 			// This is a bug in PHP, with eval, it seems!
260
-			if (empty($array[$i]['args']))
261
-				$i++;
275
+			if (empty($array[$i]['args'])) {
276
+							$i++;
277
+			}
262 278
 			break;
263 279
 		}
264 280
 
265
-		if (isset($array[$i]) && !empty($array[$i]['args']))
266
-			$file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)';
267
-		else
268
-			$file = realpath($settings['current_include_filename']) . ' (eval?)';
281
+		if (isset($array[$i]) && !empty($array[$i]['args'])) {
282
+					$file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)';
283
+		} else {
284
+					$file = realpath($settings['current_include_filename']) . ' (eval?)';
285
+		}
269 286
 	}
270 287
 
271 288
 	if (isset($db_show_debug) && $db_show_debug === true)
@@ -274,8 +291,9 @@  discard block
 block discarded – undo
274 291
 		if ($error_level % 255 != E_ERROR)
275 292
 		{
276 293
 			$temporary = ob_get_contents();
277
-			if (substr($temporary, -2) == '="')
278
-				echo '"';
294
+			if (substr($temporary, -2) == '="') {
295
+							echo '"';
296
+			}
279 297
 		}
280 298
 
281 299
 		// Debugging!  This should look like a PHP error message.
@@ -291,23 +309,27 @@  discard block
 block discarded – undo
291 309
 	call_integration_hook('integrate_output_error', array($message, $error_type, $error_level, $file, $line));
292 310
 
293 311
 	// Dying on these errors only causes MORE problems (blank pages!)
294
-	if ($file == 'Unknown')
295
-		return;
312
+	if ($file == 'Unknown') {
313
+			return;
314
+	}
296 315
 
297 316
 	// If this is an E_ERROR or E_USER_ERROR.... die.  Violently so.
298
-	if ($error_level % 255 == E_ERROR)
299
-		obExit(false);
300
-	else
301
-		return;
317
+	if ($error_level % 255 == E_ERROR) {
318
+			obExit(false);
319
+	} else {
320
+			return;
321
+	}
302 322
 
303 323
 	// If this is an E_ERROR, E_USER_ERROR, E_WARNING, or E_USER_WARNING.... die.  Violently so.
304
-	if ($error_level % 255 == E_ERROR || $error_level % 255 == E_WARNING)
305
-		fatal_error(allowedTo('admin_forum') ? $message : $error_string, false);
324
+	if ($error_level % 255 == E_ERROR || $error_level % 255 == E_WARNING) {
325
+			fatal_error(allowedTo('admin_forum') ? $message : $error_string, false);
326
+	}
306 327
 
307 328
 	// We should NEVER get to this point.  Any fatal error MUST quit, or very bad things can happen.
308
-	if ($error_level % 255 == E_ERROR)
309
-		die('No direct access...');
310
-}
329
+	if ($error_level % 255 == E_ERROR) {
330
+			die('No direct access...');
331
+	}
332
+	}
311 333
 
312 334
 /**
313 335
  * It is called by {@link fatal_error()} and {@link fatal_lang_error()}.
@@ -323,24 +345,28 @@  discard block
 block discarded – undo
323 345
 
324 346
 	// Attempt to prevent a recursive loop.
325 347
 	++$level;
326
-	if ($level > 1)
327
-		return false;
348
+	if ($level > 1) {
349
+			return false;
350
+	}
328 351
 
329 352
 	// Maybe they came from dlattach or similar?
330
-	if (SMF != 'SSI' && SMF != 'BACKGROUND' && empty($context['theme_loaded']))
331
-		loadTheme();
353
+	if (SMF != 'SSI' && SMF != 'BACKGROUND' && empty($context['theme_loaded'])) {
354
+			loadTheme();
355
+	}
332 356
 
333 357
 	// Don't bother indexing errors mate...
334 358
 	$context['robot_no_index'] = true;
335 359
 
336
-	if (!isset($context['error_title']))
337
-		$context['error_title'] = $txt['error_occured'];
360
+	if (!isset($context['error_title'])) {
361
+			$context['error_title'] = $txt['error_occured'];
362
+	}
338 363
 	$context['error_message'] = isset($context['error_message']) ? $context['error_message'] : $error_message;
339 364
 
340 365
 	$context['error_code'] = isset($error_code) ? 'id="' . $error_code . '" ' : '';
341 366
 
342
-	if (empty($context['page_title']))
343
-		$context['page_title'] = $context['error_title'];
367
+	if (empty($context['page_title'])) {
368
+			$context['page_title'] = $context['error_title'];
369
+	}
344 370
 
345 371
 	loadTemplate('Errors');
346 372
 	$context['sub_template'] = 'fatal_error';
@@ -348,23 +374,26 @@  discard block
 block discarded – undo
348 374
 	// If this is SSI, what do they want us to do?
349 375
 	if (SMF == 'SSI')
350 376
 	{
351
-		if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method))
352
-			$ssi_on_error_method();
353
-		elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true)
354
-			loadSubTemplate('fatal_error');
377
+		if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) {
378
+					$ssi_on_error_method();
379
+		} elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) {
380
+					loadSubTemplate('fatal_error');
381
+		}
355 382
 
356 383
 		// No layers?
357
-		if (empty($ssi_on_error_method) || $ssi_on_error_method !== true)
358
-			exit;
384
+		if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) {
385
+					exit;
386
+		}
359 387
 	}
360 388
 	// Alternatively from the cron call?
361 389
 	elseif (SMF == 'BACKGROUND')
362 390
 	{
363 391
 		// We can't rely on even having language files available.
364
-		if (defined('FROM_CLI') && FROM_CLI)
365
-			echo 'cron error: ', $context['error_message'];
366
-		else
367
-			echo 'An error occurred. More information may be available in your logs.';
392
+		if (defined('FROM_CLI') && FROM_CLI) {
393
+					echo 'cron error: ', $context['error_message'];
394
+		} else {
395
+					echo 'An error occurred. More information may be available in your logs.';
396
+		}
368 397
 		exit;
369 398
 	}
370 399
 
@@ -392,8 +421,8 @@  discard block
 block discarded – undo
392 421
 
393 422
 	set_fatal_error_headers();
394 423
 
395
-	if (!empty($maintenance))
396
-		echo '<!DOCTYPE html>
424
+	if (!empty($maintenance)) {
425
+			echo '<!DOCTYPE html>
397 426
 <html>
398 427
 	<head>
399 428
 		<meta name="robots" content="noindex">
@@ -404,6 +433,7 @@  discard block
 block discarded – undo
404 433
 		', $mmessage, '
405 434
 	</body>
406 435
 </html>';
436
+	}
407 437
 
408 438
 	die();
409 439
 }
@@ -425,15 +455,17 @@  discard block
 block discarded – undo
425 455
 	// For our purposes, we're gonna want this on if at all possible.
426 456
 	$modSettings['cache_enable'] = '1';
427 457
 
428
-	if (($temp = cache_get_data('db_last_error', 600)) !== null)
429
-		$db_last_error = max($db_last_error, $temp);
458
+	if (($temp = cache_get_data('db_last_error', 600)) !== null) {
459
+			$db_last_error = max($db_last_error, $temp);
460
+	}
430 461
 
431 462
 	if ($db_last_error < time() - 3600 * 24 * 3 && empty($maintenance) && !empty($db_error_send))
432 463
 	{
433 464
 		// Avoid writing to the Settings.php file if at all possible; use shared memory instead.
434 465
 		cache_put_data('db_last_error', time(), 600);
435
-		if (($temp = cache_get_data('db_last_error', 600)) === null)
436
-			logLastDatabaseError();
466
+		if (($temp = cache_get_data('db_last_error', 600)) === null) {
467
+					logLastDatabaseError();
468
+		}
437 469
 
438 470
 		// Language files aren't loaded yet :(.
439 471
 		$db_error = @$smcFunc['db_error']($db_connection);
@@ -490,8 +522,9 @@  discard block
 block discarded – undo
490 522
  */
491 523
 function set_fatal_error_headers()
492 524
 {
493
-	if (headers_sent())
494
-		return;
525
+	if (headers_sent()) {
526
+			return;
527
+	}
495 528
 
496 529
 	// Don't cache this page!
497 530
 	header('expires: Mon, 26 Jul 1997 05:00:00 GMT');
@@ -517,12 +550,14 @@  discard block
 block discarded – undo
517 550
 	global $smcFunc, $user_info, $modSettings;
518 551
 
519 552
 	// Don't bother if Who's Online is disabled.
520
-	if (empty($modSettings['who_enabled']))
521
-		return;
553
+	if (empty($modSettings['who_enabled'])) {
554
+			return;
555
+	}
522 556
 
523 557
 	// Maybe they came from SSI or similar where sessions are not recorded?
524
-	if (SMF == 'SSI' || SMF == 'BACKGROUND')
525
-		return;
558
+	if (SMF == 'SSI' || SMF == 'BACKGROUND') {
559
+			return;
560
+	}
526 561
 
527 562
 	$session_id = !empty($user_info['is_guest']) ? 'ip' . $user_info['ip'] : session_id();
528 563
 
@@ -548,11 +583,13 @@  discard block
 block discarded – undo
548 583
 		$url = $smcFunc['json_decode']($url, true);
549 584
 		$url['error'] = $error;
550 585
 		// Url field got a max length of 1024 in db
551
-		if (strlen($url['error']) > 500)
552
-			$url['error'] = substr($url['error'],0,500);
586
+		if (strlen($url['error']) > 500) {
587
+					$url['error'] = substr($url['error'],0,500);
588
+		}
553 589
 
554
-		if (!empty($sprintf))
555
-			$url['error_params'] = $sprintf;
590
+		if (!empty($sprintf)) {
591
+					$url['error_params'] = $sprintf;
592
+		}
556 593
 
557 594
 		$smcFunc['db_query']('', '
558 595
 			UPDATE {db_prefix}log_online
@@ -583,10 +620,11 @@  discard block
 block discarded – undo
583 620
 
584 621
 	$protocol = preg_match('~HTTP/1\.[01]~i', $_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
585 622
 
586
-	if (!isset($statuses[$code]))
587
-		header($protocol . ' 500 Internal Server Error');
588
-	else
589
-		header($protocol . ' ' . $code . ' ' . $statuses[$code]);
590
-}
623
+	if (!isset($statuses[$code])) {
624
+			header($protocol . ' 500 Internal Server Error');
625
+	} else {
626
+			header($protocol . ' ' . $code . ' ' . $statuses[$code]);
627
+	}
628
+	}
591 629
 
592 630
 ?>
593 631
\ No newline at end of file
Please login to merge, or discard this patch.
Sources/ManageBans.php 1 patch
Braces   +257 added lines, -207 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Ban center. The main entrance point for all ban center functions.
@@ -120,10 +121,11 @@  discard block
 block discarded – undo
120 121
 	}
121 122
 
122 123
 	// Create a date string so we don't overload them with date info.
123
-	if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
124
-		$context['ban_time_format'] = $user_info['time_format'];
125
-	else
126
-		$context['ban_time_format'] = $matches[0];
124
+	if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) {
125
+			$context['ban_time_format'] = $user_info['time_format'];
126
+	} else {
127
+			$context['ban_time_format'] = $matches[0];
128
+	}
127 129
 
128 130
 	$listOptions = array(
129 131
 		'id' => 'ban_list',
@@ -201,16 +203,19 @@  discard block
 block discarded – undo
201 203
 					'function' => function($rowData) use ($txt)
202 204
 					{
203 205
 						// This ban never expires...whahaha.
204
-						if ($rowData['expire_time'] === null)
205
-							return $txt['never'];
206
+						if ($rowData['expire_time'] === null) {
207
+													return $txt['never'];
208
+						}
206 209
 
207 210
 						// This ban has already expired.
208
-						elseif ($rowData['expire_time'] < time())
209
-							return sprintf('<span class="red">%1$s</span>', $txt['ban_expired']);
211
+						elseif ($rowData['expire_time'] < time()) {
212
+													return sprintf('<span class="red">%1$s</span>', $txt['ban_expired']);
213
+						}
210 214
 
211 215
 						// Still need to wait a few days for this ban to expire.
212
-						else
213
-							return sprintf('%1$d&nbsp;%2$s', ceil(($rowData['expire_time'] - time()) / (60 * 60 * 24)), $txt['ban_days']);
216
+						else {
217
+													return sprintf('%1$d&nbsp;%2$s', ceil(($rowData['expire_time'] - time()) / (60 * 60 * 24)), $txt['ban_days']);
218
+						}
214 219
 					},
215 220
 				),
216 221
 				'sort' => array(
@@ -320,8 +325,9 @@  discard block
 block discarded – undo
320 325
 		)
321 326
 	);
322 327
 	$bans = array();
323
-	while ($row = $smcFunc['db_fetch_assoc']($request))
324
-		$bans[] = $row;
328
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
329
+			$bans[] = $row;
330
+	}
325 331
 
326 332
 	$smcFunc['db_free_result']($request);
327 333
 
@@ -363,8 +369,9 @@  discard block
 block discarded – undo
363 369
 {
364 370
 	global $txt, $modSettings, $context, $scripturl, $smcFunc, $sourcedir;
365 371
 
366
-	if ((isset($_POST['add_ban']) || isset($_POST['modify_ban']) || isset($_POST['remove_selection'])) && empty($context['ban_errors']))
367
-		BanEdit2();
372
+	if ((isset($_POST['add_ban']) || isset($_POST['modify_ban']) || isset($_POST['remove_selection'])) && empty($context['ban_errors'])) {
373
+			BanEdit2();
374
+	}
368 375
 
369 376
 	$ban_group_id = isset($context['ban']['id']) ? $context['ban']['id'] : (isset($_REQUEST['bg']) ? (int) $_REQUEST['bg'] : 0);
370 377
 
@@ -373,11 +380,10 @@  discard block
 block discarded – undo
373 380
 	createToken('admin-bet');
374 381
 	$context['form_url'] = $scripturl . '?action=admin;area=ban;sa=edit';
375 382
 
376
-	if (!empty($context['ban_errors']))
377
-		foreach ($context['ban_errors'] as $error)
383
+	if (!empty($context['ban_errors'])) {
384
+			foreach ($context['ban_errors'] as $error)
378 385
 			$context['error_messages'][$error] = $txt[$error];
379
-
380
-	else
386
+	} else
381 387
 	{
382 388
 		// If we're editing an existing ban, get it from the database.
383 389
 		if (!empty($ban_group_id))
@@ -413,12 +419,13 @@  discard block
 block discarded – undo
413 419
 						'data' => array(
414 420
 							'function' => function($ban_item) use ($txt)
415 421
 							{
416
-								if (in_array($ban_item['type'], array('ip', 'hostname', 'email')))
417
-									return '<strong>' . $txt[$ban_item['type']] . ':</strong>&nbsp;' . $ban_item[$ban_item['type']];
418
-								elseif ($ban_item['type'] == 'user')
419
-									return '<strong>' . $txt['username'] . ':</strong>&nbsp;' . $ban_item['user']['link'];
420
-								else
421
-									return '<strong>' . $txt['unknown'] . ':</strong>&nbsp;' . $ban_item['no_bantype_selected'];
422
+								if (in_array($ban_item['type'], array('ip', 'hostname', 'email'))) {
423
+																	return '<strong>' . $txt[$ban_item['type']] . ':</strong>&nbsp;' . $ban_item[$ban_item['type']];
424
+								} elseif ($ban_item['type'] == 'user') {
425
+																	return '<strong>' . $txt['username'] . ':</strong>&nbsp;' . $ban_item['user']['link'];
426
+								} else {
427
+																	return '<strong>' . $txt['unknown'] . ':</strong>&nbsp;' . $ban_item['no_bantype_selected'];
428
+								}
422 429
 							},
423 430
 							'style' => 'text-align: left;',
424 431
 						),
@@ -556,8 +563,9 @@  discard block
 block discarded – undo
556 563
 					$context['ban']['from_user'] = true;
557 564
 
558 565
 					// Would be nice if we could also ban the hostname.
559
-					if ((preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $context['ban_suggestions']['main_ip']) == 1 || isValidIPv6($context['ban_suggestions']['main_ip'])) && empty($modSettings['disableHostnameLookup']))
560
-						$context['ban_suggestions']['hostname'] = host_from_ip($context['ban_suggestions']['main_ip']);
566
+					if ((preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $context['ban_suggestions']['main_ip']) == 1 || isValidIPv6($context['ban_suggestions']['main_ip'])) && empty($modSettings['disableHostnameLookup'])) {
567
+											$context['ban_suggestions']['hostname'] = host_from_ip($context['ban_suggestions']['main_ip']);
568
+					}
561 569
 
562 570
 					$context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']);
563 571
 				}
@@ -625,8 +633,9 @@  discard block
 block discarded – undo
625 633
 			'items_per_page' => $items_per_page,
626 634
 		)
627 635
 	);
628
-	if ($smcFunc['db_num_rows']($request) == 0)
629
-		fatal_lang_error('ban_not_found', false);
636
+	if ($smcFunc['db_num_rows']($request) == 0) {
637
+			fatal_lang_error('ban_not_found', false);
638
+	}
630 639
 
631 640
 	while ($row = $smcFunc['db_fetch_assoc']($request))
632 641
 	{
@@ -663,18 +672,15 @@  discard block
 block discarded – undo
663 672
 			{
664 673
 				$ban_items[$row['id_ban']]['type'] = 'ip';
665 674
 				$ban_items[$row['id_ban']]['ip'] = range2ip($row['ip_low'], $row['ip_high']);
666
-			}
667
-			elseif (!empty($row['hostname']))
675
+			} elseif (!empty($row['hostname']))
668 676
 			{
669 677
 				$ban_items[$row['id_ban']]['type'] = 'hostname';
670 678
 				$ban_items[$row['id_ban']]['hostname'] = str_replace('%', '*', $row['hostname']);
671
-			}
672
-			elseif (!empty($row['email_address']))
679
+			} elseif (!empty($row['email_address']))
673 680
 			{
674 681
 				$ban_items[$row['id_ban']]['type'] = 'email';
675 682
 				$ban_items[$row['id_ban']]['email'] = str_replace('%', '*', $row['email_address']);
676
-			}
677
-			elseif (!empty($row['id_member']))
683
+			} elseif (!empty($row['id_member']))
678 684
 			{
679 685
 				$ban_items[$row['id_ban']]['type'] = 'user';
680 686
 				$ban_items[$row['id_ban']]['user'] = array(
@@ -740,9 +746,10 @@  discard block
 block discarded – undo
740 746
 	$search_list += array('ips_in_messages' => 'banLoadAdditionalIPsMember', 'ips_in_errors' => 'banLoadAdditionalIPsError');
741 747
 
742 748
 	$return = array();
743
-	foreach ($search_list as $key => $callable)
744
-		if (is_callable($callable))
749
+	foreach ($search_list as $key => $callable) {
750
+			if (is_callable($callable))
745 751
 			$return[$key] = call_user_func($callable, $member_id);
752
+	}
746 753
 
747 754
 	return $return;
748 755
 }
@@ -767,8 +774,9 @@  discard block
 block discarded – undo
767 774
 			'current_user' => $member_id,
768 775
 		)
769 776
 	);
770
-	while ($row = $smcFunc['db_fetch_assoc']($request))
771
-		$message_ips[] = inet_dtop($row['poster_ip']);
777
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
778
+			$message_ips[] = inet_dtop($row['poster_ip']);
779
+	}
772 780
 	$smcFunc['db_free_result']($request);
773 781
 
774 782
 	return $message_ips;
@@ -793,8 +801,9 @@  discard block
 block discarded – undo
793 801
 			'current_user' => $member_id,
794 802
 		)
795 803
 	);
796
-	while ($row = $smcFunc['db_fetch_assoc']($request))
797
-	    $error_ips[] = inet_dtop($row['ip']);
804
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
805
+		    $error_ips[] = inet_dtop($row['ip']);
806
+	}
798 807
 	$smcFunc['db_free_result']($request);
799 808
 
800 809
 	return $error_ips;
@@ -835,11 +844,13 @@  discard block
 block discarded – undo
835 844
 		$ban_info['cannot']['login'] = !empty($ban_info['full_ban']) || empty($_POST['cannot_login']) ? 0 : 1;
836 845
 
837 846
 		// Adding a new ban group
838
-		if (empty($_REQUEST['bg']))
839
-			$ban_group_id = insertBanGroup($ban_info);
847
+		if (empty($_REQUEST['bg'])) {
848
+					$ban_group_id = insertBanGroup($ban_info);
849
+		}
840 850
 		// Editing an existing ban group
841
-		else
842
-			$ban_group_id = updateBanGroup($ban_info);
851
+		else {
852
+					$ban_group_id = updateBanGroup($ban_info);
853
+		}
843 854
 
844 855
 		if (is_numeric($ban_group_id))
845 856
 		{
@@ -850,9 +861,10 @@  discard block
 block discarded – undo
850 861
 		$context['ban'] = $ban_info;
851 862
 	}
852 863
 
853
-	if (isset($_POST['ban_suggestions']))
854
-		// @TODO: is $_REQUEST['bi'] ever set?
864
+	if (isset($_POST['ban_suggestions'])) {
865
+			// @TODO: is $_REQUEST['bi'] ever set?
855 866
 		$saved_triggers = saveTriggers($_POST['ban_suggestions'], $ban_info['id'], isset($_REQUEST['u']) ? (int) $_REQUEST['u'] : 0, isset($_REQUEST['bi']) ? (int) $_REQUEST['bi'] : 0);
867
+	}
856 868
 
857 869
 	// Something went wrong somewhere... Oh well, let's go back.
858 870
 	if (!empty($context['ban_errors']))
@@ -862,8 +874,9 @@  discard block
 block discarded – undo
862 874
 		$context['ban_suggestions'] = array_merge($context['ban_suggestions'], getMemberData((int) $_REQUEST['u']));
863 875
 
864 876
 		// Not strictly necessary, but it's nice
865
-		if (!empty($context['ban_suggestions']['member']['id']))
866
-			$context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']);
877
+		if (!empty($context['ban_suggestions']['member']['id'])) {
878
+					$context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']);
879
+		}
867 880
 		return BanEdit();
868 881
 	}
869 882
 	$context['ban_suggestions']['saved_triggers'] = !empty($saved_triggers) ? $saved_triggers : array();
@@ -910,10 +923,11 @@  discard block
 block discarded – undo
910 923
 
911 924
 	foreach ($suggestions as $key => $value)
912 925
 	{
913
-		if (is_array($value))
914
-			$triggers[$key] = $value;
915
-		else
916
-			$triggers[$value] = !empty($_POST[$value]) ? $_POST[$value] : '';
926
+		if (is_array($value)) {
927
+					$triggers[$key] = $value;
928
+		} else {
929
+					$triggers[$value] = !empty($_POST[$value]) ? $_POST[$value] : '';
930
+		}
917 931
 	}
918 932
 
919 933
 	$ban_triggers = validateTriggers($triggers);
@@ -921,16 +935,18 @@  discard block
 block discarded – undo
921 935
 	// Time to save!
922 936
 	if (!empty($ban_triggers['ban_triggers']) && empty($context['ban_errors']))
923 937
 	{
924
-		if (empty($ban_id))
925
-			addTriggers($ban_group, $ban_triggers['ban_triggers'], $ban_triggers['log_info']);
926
-		else
927
-			updateTriggers($ban_id, $ban_group, array_shift($ban_triggers['ban_triggers']), $ban_triggers['log_info']);
938
+		if (empty($ban_id)) {
939
+					addTriggers($ban_group, $ban_triggers['ban_triggers'], $ban_triggers['log_info']);
940
+		} else {
941
+					updateTriggers($ban_id, $ban_group, array_shift($ban_triggers['ban_triggers']), $ban_triggers['log_info']);
942
+		}
943
+	}
944
+	if (!empty($context['ban_errors'])) {
945
+			return $triggers;
946
+	} else {
947
+			return false;
948
+	}
928 949
 	}
929
-	if (!empty($context['ban_errors']))
930
-		return $triggers;
931
-	else
932
-		return false;
933
-}
934 950
 
935 951
 /**
936 952
  * This function removes a bunch of triggers based on ids
@@ -944,14 +960,17 @@  discard block
 block discarded – undo
944 960
 {
945 961
 	global $smcFunc, $scripturl;
946 962
 
947
-	if ($group_id !== false)
948
-		$group_id = (int) $group_id;
963
+	if ($group_id !== false) {
964
+			$group_id = (int) $group_id;
965
+	}
949 966
 
950
-	if (empty($group_id) && empty($items_ids))
951
-		return false;
967
+	if (empty($group_id) && empty($items_ids)) {
968
+			return false;
969
+	}
952 970
 
953
-	if (!is_array($items_ids))
954
-		$items_ids = array($items_ids);
971
+	if (!is_array($items_ids)) {
972
+			$items_ids = array($items_ids);
973
+	}
955 974
 
956 975
 	$log_info = array();
957 976
 	$ban_items = array();
@@ -989,8 +1008,7 @@  discard block
 block discarded – undo
989 1008
 					'bantype' => ($is_range ? 'ip_range' : 'main_ip'),
990 1009
 					'value' => $ban_items[$row['id_ban']]['ip'],
991 1010
 				);
992
-			}
993
-			elseif (!empty($row['hostname']))
1011
+			} elseif (!empty($row['hostname']))
994 1012
 			{
995 1013
 				$ban_items[$row['id_ban']]['type'] = 'hostname';
996 1014
 				$ban_items[$row['id_ban']]['hostname'] = str_replace('%', '*', $row['hostname']);
@@ -998,8 +1016,7 @@  discard block
 block discarded – undo
998 1016
 					'bantype' => 'hostname',
999 1017
 					'value' => $row['hostname'],
1000 1018
 				);
1001
-			}
1002
-			elseif (!empty($row['email_address']))
1019
+			} elseif (!empty($row['email_address']))
1003 1020
 			{
1004 1021
 				$ban_items[$row['id_ban']]['type'] = 'email';
1005 1022
 				$ban_items[$row['id_ban']]['email'] = str_replace('%', '*', $row['email_address']);
@@ -1007,8 +1024,7 @@  discard block
 block discarded – undo
1007 1024
 					'bantype' => 'email',
1008 1025
 					'value' => $ban_items[$row['id_ban']]['email'],
1009 1026
 				);
1010
-			}
1011
-			elseif (!empty($row['id_member']))
1027
+			} elseif (!empty($row['id_member']))
1012 1028
 			{
1013 1029
 				$ban_items[$row['id_ban']]['type'] = 'user';
1014 1030
 				$ban_items[$row['id_ban']]['user'] = array(
@@ -1041,8 +1057,7 @@  discard block
 block discarded – undo
1041 1057
 				'ban_group' => $group_id,
1042 1058
 			)
1043 1059
 		);
1044
-	}
1045
-	elseif (!empty($items_ids))
1060
+	} elseif (!empty($items_ids))
1046 1061
 	{
1047 1062
 		$smcFunc['db_query']('', '
1048 1063
 			DELETE FROM {db_prefix}ban_items
@@ -1067,13 +1082,15 @@  discard block
 block discarded – undo
1067 1082
 {
1068 1083
 	global $smcFunc;
1069 1084
 
1070
-	if (!is_array($group_ids))
1071
-		$group_ids = array($group_ids);
1085
+	if (!is_array($group_ids)) {
1086
+			$group_ids = array($group_ids);
1087
+	}
1072 1088
 
1073 1089
 	$group_ids = array_unique($group_ids);
1074 1090
 
1075
-	if (empty($group_ids))
1076
-		return false;
1091
+	if (empty($group_ids)) {
1092
+			return false;
1093
+	}
1077 1094
 
1078 1095
 	$smcFunc['db_query']('', '
1079 1096
 		DELETE FROM {db_prefix}ban_groups
@@ -1097,21 +1114,23 @@  discard block
 block discarded – undo
1097 1114
 {
1098 1115
 	global $smcFunc;
1099 1116
 
1100
-	if (empty($ids))
1101
-		$smcFunc['db_query']('truncate_table', '
1117
+	if (empty($ids)) {
1118
+			$smcFunc['db_query']('truncate_table', '
1102 1119
 			TRUNCATE {db_prefix}log_banned',
1103 1120
 			array(
1104 1121
 			)
1105 1122
 		);
1106
-	else
1123
+	} else
1107 1124
 	{
1108
-		if (!is_array($ids))
1109
-			$ids = array($ids);
1125
+		if (!is_array($ids)) {
1126
+					$ids = array($ids);
1127
+		}
1110 1128
 
1111 1129
 		$ids = array_unique($ids);
1112 1130
 
1113
-		if (empty($ids))
1114
-			return false;
1131
+		if (empty($ids)) {
1132
+					return false;
1133
+		}
1115 1134
 
1116 1135
 		$smcFunc['db_query']('', '
1117 1136
 			DELETE FROM {db_prefix}log_banned
@@ -1137,8 +1156,9 @@  discard block
 block discarded – undo
1137 1156
 {
1138 1157
 	global $context, $smcFunc;
1139 1158
 
1140
-	if (empty($triggers))
1141
-		$context['ban_erros'][] = 'ban_empty_triggers';
1159
+	if (empty($triggers)) {
1160
+			$context['ban_erros'][] = 'ban_empty_triggers';
1161
+	}
1142 1162
 
1143 1163
 	$ban_triggers = array();
1144 1164
 	$log_info = array();
@@ -1147,39 +1167,39 @@  discard block
 block discarded – undo
1147 1167
 	{
1148 1168
 		if (!empty($value))
1149 1169
 		{
1150
-			if ($key == 'member')
1151
-				continue;
1170
+			if ($key == 'member') {
1171
+							continue;
1172
+			}
1152 1173
 
1153 1174
 			if ($key == 'main_ip')
1154 1175
 			{
1155 1176
 				$value = trim($value);
1156 1177
 				$ip_parts = ip2range($value);
1157
-				if (!checkExistingTriggerIP($ip_parts, $value))
1158
-					$context['ban_erros'][] = 'invalid_ip';
1159
-				else
1178
+				if (!checkExistingTriggerIP($ip_parts, $value)) {
1179
+									$context['ban_erros'][] = 'invalid_ip';
1180
+				} else
1160 1181
 				{
1161 1182
 					$ban_triggers['main_ip'] = array(
1162 1183
 						'ip_low' => $ip_parts['low'],
1163 1184
 						'ip_high' => $ip_parts['high']
1164 1185
 					);
1165 1186
 				}
1166
-			}
1167
-			elseif ($key == 'hostname')
1187
+			} elseif ($key == 'hostname')
1168 1188
 			{
1169
-				if (preg_match('/[^\w.\-*]/', $value) == 1)
1170
-					$context['ban_erros'][] = 'invalid_hostname';
1171
-				else
1189
+				if (preg_match('/[^\w.\-*]/', $value) == 1) {
1190
+									$context['ban_erros'][] = 'invalid_hostname';
1191
+				} else
1172 1192
 				{
1173 1193
 					// Replace the * wildcard by a MySQL wildcard %.
1174 1194
 					$value = substr(str_replace('*', '%', $value), 0, 255);
1175 1195
 
1176 1196
 					$ban_triggers['hostname']['hostname'] = $value;
1177 1197
 				}
1178
-			}
1179
-			elseif ($key == 'email')
1198
+			} elseif ($key == 'email')
1180 1199
 			{
1181
-				if (preg_match('/[^\w.\-\+*@]/', $value) == 1)
1182
-					$context['ban_erros'][] = 'invalid_email';
1200
+				if (preg_match('/[^\w.\-\+*@]/', $value) == 1) {
1201
+									$context['ban_erros'][] = 'invalid_email';
1202
+				}
1183 1203
 
1184 1204
 				// Check the user is not banning an admin.
1185 1205
 				$request = $smcFunc['db_query']('', '
@@ -1193,15 +1213,15 @@  discard block
 block discarded – undo
1193 1213
 						'email' => $value,
1194 1214
 					)
1195 1215
 				);
1196
-				if ($smcFunc['db_num_rows']($request) != 0)
1197
-					$context['ban_erros'][] = 'no_ban_admin';
1216
+				if ($smcFunc['db_num_rows']($request) != 0) {
1217
+									$context['ban_erros'][] = 'no_ban_admin';
1218
+				}
1198 1219
 				$smcFunc['db_free_result']($request);
1199 1220
 
1200 1221
 				$value = substr(strtolower(str_replace('*', '%', $value)), 0, 255);
1201 1222
 
1202 1223
 				$ban_triggers['email']['email_address'] = $value;
1203
-			}
1204
-			elseif ($key == 'user')
1224
+			} elseif ($key == 'user')
1205 1225
 			{
1206 1226
 				$user = preg_replace('~&amp;#(\d{4,5}|[2-9]\d{2,4}|1[2-9]\d);~', '&#$1;', $smcFunc['htmlspecialchars']($value, ENT_QUOTES));
1207 1227
 
@@ -1215,8 +1235,9 @@  discard block
 block discarded – undo
1215 1235
 						'username' => $user,
1216 1236
 					)
1217 1237
 				);
1218
-				if ($smcFunc['db_num_rows']($request) == 0)
1219
-					$context['ban_erros'][] = 'invalid_username';
1238
+				if ($smcFunc['db_num_rows']($request) == 0) {
1239
+									$context['ban_erros'][] = 'invalid_username';
1240
+				}
1220 1241
 				list ($value, $isAdmin) = $smcFunc['db_fetch_row']($request);
1221 1242
 				$smcFunc['db_free_result']($request);
1222 1243
 
@@ -1224,25 +1245,25 @@  discard block
 block discarded – undo
1224 1245
 				{
1225 1246
 					unset($value);
1226 1247
 					$context['ban_erros'][] = 'no_ban_admin';
1248
+				} else {
1249
+									$ban_triggers['user']['id_member'] = $value;
1227 1250
 				}
1228
-				else
1229
-					$ban_triggers['user']['id_member'] = $value;
1230
-			}
1231
-			elseif (in_array($key, array('ips_in_messages', 'ips_in_errors')))
1251
+			} elseif (in_array($key, array('ips_in_messages', 'ips_in_errors')))
1232 1252
 			{
1233 1253
 				// Special case, those two are arrays themselves
1234 1254
 				$values = array_unique($value);
1235 1255
 				// Don't add the main IP again.
1236
-				if (isset($triggers['main_ip']))
1237
-					$values = array_diff($values, array($triggers['main_ip']));
1256
+				if (isset($triggers['main_ip'])) {
1257
+									$values = array_diff($values, array($triggers['main_ip']));
1258
+				}
1238 1259
 				unset($value);
1239 1260
 				foreach ($values as $val)
1240 1261
 				{
1241 1262
 					$val = trim($val);
1242 1263
 					$ip_parts = ip2range($val);
1243
-					if (!checkExistingTriggerIP($ip_parts, $val))
1244
-						$context['ban_erros'][] = 'invalid_ip';
1245
-					else
1264
+					if (!checkExistingTriggerIP($ip_parts, $val)) {
1265
+											$context['ban_erros'][] = 'invalid_ip';
1266
+					} else
1246 1267
 					{
1247 1268
 						$ban_triggers[$key][] = array(
1248 1269
 							'ip_low' => $ip_parts['low'],
@@ -1255,15 +1276,16 @@  discard block
 block discarded – undo
1255 1276
 						);
1256 1277
 					}
1257 1278
 				}
1279
+			} else {
1280
+							$context['ban_erros'][] = 'no_bantype_selected';
1258 1281
 			}
1259
-			else
1260
-				$context['ban_erros'][] = 'no_bantype_selected';
1261 1282
 
1262
-			if (isset($value) && !is_array($value))
1263
-				$log_info[] = array(
1283
+			if (isset($value) && !is_array($value)) {
1284
+							$log_info[] = array(
1264 1285
 					'value' => $value,
1265 1286
 					'bantype' => $key,
1266 1287
 				);
1288
+			}
1267 1289
 		}
1268 1290
 	}
1269 1291
 	return array('ban_triggers' => $ban_triggers, 'log_info' => $log_info);
@@ -1283,8 +1305,9 @@  discard block
 block discarded – undo
1283 1305
 {
1284 1306
 	global $smcFunc, $context;
1285 1307
 
1286
-	if (empty($group_id))
1287
-		$context['ban_errors'][] = 'ban_id_empty';
1308
+	if (empty($group_id)) {
1309
+			$context['ban_errors'][] = 'ban_id_empty';
1310
+	}
1288 1311
 
1289 1312
 	// Preset all values that are required.
1290 1313
 	$values = array(
@@ -1309,18 +1332,21 @@  discard block
 block discarded – undo
1309 1332
 	foreach ($triggers as $key => $trigger)
1310 1333
 	{
1311 1334
 		// Exceptions, exceptions, exceptions...always exceptions... :P
1312
-		if (in_array($key, array('ips_in_messages', 'ips_in_errors')))
1313
-			foreach ($trigger as $real_trigger)
1335
+		if (in_array($key, array('ips_in_messages', 'ips_in_errors'))) {
1336
+					foreach ($trigger as $real_trigger)
1314 1337
 				$insertTriggers[] = array_merge($values, $real_trigger);
1315
-		else
1316
-			$insertTriggers[] = array_merge($values, $trigger);
1338
+		} else {
1339
+					$insertTriggers[] = array_merge($values, $trigger);
1340
+		}
1317 1341
 	}
1318 1342
 
1319
-	if (empty($insertTriggers))
1320
-		$context['ban_errors'][] = 'ban_no_triggers';
1343
+	if (empty($insertTriggers)) {
1344
+			$context['ban_errors'][] = 'ban_no_triggers';
1345
+	}
1321 1346
 
1322
-	if (!empty($context['ban_errors']))
1323
-		return false;
1347
+	if (!empty($context['ban_errors'])) {
1348
+			return false;
1349
+	}
1324 1350
 
1325 1351
 	$smcFunc['db_insert']('',
1326 1352
 		'{db_prefix}ban_items',
@@ -1348,15 +1374,19 @@  discard block
 block discarded – undo
1348 1374
 {
1349 1375
 	global $smcFunc, $context;
1350 1376
 
1351
-	if (empty($ban_item))
1352
-		$context['ban_errors'][] = 'ban_ban_item_empty';
1353
-	if (empty($group_id))
1354
-		$context['ban_errors'][] = 'ban_id_empty';
1355
-	if (empty($trigger))
1356
-		$context['ban_errors'][] = 'ban_no_triggers';
1377
+	if (empty($ban_item)) {
1378
+			$context['ban_errors'][] = 'ban_ban_item_empty';
1379
+	}
1380
+	if (empty($group_id)) {
1381
+			$context['ban_errors'][] = 'ban_id_empty';
1382
+	}
1383
+	if (empty($trigger)) {
1384
+			$context['ban_errors'][] = 'ban_no_triggers';
1385
+	}
1357 1386
 
1358
-	if (!empty($context['ban_errors']))
1359
-		return;
1387
+	if (!empty($context['ban_errors'])) {
1388
+			return;
1389
+	}
1360 1390
 
1361 1391
 	// Preset all values that are required.
1362 1392
 	$values = array(
@@ -1397,8 +1427,9 @@  discard block
 block discarded – undo
1397 1427
  */
1398 1428
 function logTriggersUpdates($logs, $new = true, $removal = false)
1399 1429
 {
1400
-	if (empty($logs))
1401
-		return;
1430
+	if (empty($logs)) {
1431
+			return;
1432
+	}
1402 1433
 
1403 1434
 	$log_name_map = array(
1404 1435
 		'main_ip' => 'ip_range',
@@ -1409,14 +1440,15 @@  discard block
 block discarded – undo
1409 1440
 	);
1410 1441
 
1411 1442
 	// Log the addion of the ban entries into the moderation log.
1412
-	foreach ($logs as $log)
1413
-		logAction('ban' . ($removal == true ? 'remove' : ''), array(
1443
+	foreach ($logs as $log) {
1444
+			logAction('ban' . ($removal == true ? 'remove' : ''), array(
1414 1445
 			$log_name_map[$log['bantype']] => $log['value'],
1415 1446
 			'new' => empty($new) ? 0 : 1,
1416 1447
 			'remove' => empty($removal) ? 0 : 1,
1417 1448
 			'type' => $log['bantype'],
1418 1449
 		));
1419
-}
1450
+	}
1451
+	}
1420 1452
 
1421 1453
 /**
1422 1454
  * Updates an existing ban group
@@ -1430,12 +1462,15 @@  discard block
 block discarded – undo
1430 1462
 {
1431 1463
 	global $smcFunc, $context;
1432 1464
 
1433
-	if (empty($ban_info['name']))
1434
-		$context['ban_errors'][] = 'ban_name_empty';
1435
-	if (empty($ban_info['id']))
1436
-		$context['ban_errors'][] = 'ban_id_empty';
1437
-	if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login']))
1438
-		$context['ban_errors'][] = 'ban_unknown_restriction_type';
1465
+	if (empty($ban_info['name'])) {
1466
+			$context['ban_errors'][] = 'ban_name_empty';
1467
+	}
1468
+	if (empty($ban_info['id'])) {
1469
+			$context['ban_errors'][] = 'ban_id_empty';
1470
+	}
1471
+	if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) {
1472
+			$context['ban_errors'][] = 'ban_unknown_restriction_type';
1473
+	}
1439 1474
 
1440 1475
 	if (!empty($ban_info['id']))
1441 1476
 	{
@@ -1450,8 +1485,9 @@  discard block
 block discarded – undo
1450 1485
 			)
1451 1486
 		);
1452 1487
 
1453
-		if ($smcFunc['db_num_rows']($request) == 0)
1454
-			$context['ban_errors'][] = 'ban_not_found';
1488
+		if ($smcFunc['db_num_rows']($request) == 0) {
1489
+					$context['ban_errors'][] = 'ban_not_found';
1490
+		}
1455 1491
 		$smcFunc['db_free_result']($request);
1456 1492
 	}
1457 1493
 
@@ -1469,13 +1505,15 @@  discard block
 block discarded – undo
1469 1505
 				'new_ban_name' => $ban_info['name'],
1470 1506
 			)
1471 1507
 		);
1472
-		if ($smcFunc['db_num_rows']($request) != 0)
1473
-			$context['ban_errors'][] = 'ban_name_exists';
1508
+		if ($smcFunc['db_num_rows']($request) != 0) {
1509
+					$context['ban_errors'][] = 'ban_name_exists';
1510
+		}
1474 1511
 		$smcFunc['db_free_result']($request);
1475 1512
 	}
1476 1513
 
1477
-	if (!empty($context['ban_errors']))
1478
-		return $ban_info['id'];
1514
+	if (!empty($context['ban_errors'])) {
1515
+			return $ban_info['id'];
1516
+	}
1479 1517
 
1480 1518
 	$smcFunc['db_query']('', '
1481 1519
 		UPDATE {db_prefix}ban_groups
@@ -1519,10 +1557,12 @@  discard block
 block discarded – undo
1519 1557
 {
1520 1558
 	global $smcFunc, $context;
1521 1559
 
1522
-	if (empty($ban_info['name']))
1523
-		$context['ban_errors'][] = 'ban_name_empty';
1524
-	if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login']))
1525
-		$context['ban_errors'][] = 'ban_unknown_restriction_type';
1560
+	if (empty($ban_info['name'])) {
1561
+			$context['ban_errors'][] = 'ban_name_empty';
1562
+	}
1563
+	if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) {
1564
+			$context['ban_errors'][] = 'ban_unknown_restriction_type';
1565
+	}
1526 1566
 
1527 1567
 	if (!empty($ban_info['name']))
1528 1568
 	{
@@ -1537,13 +1577,15 @@  discard block
 block discarded – undo
1537 1577
 			)
1538 1578
 		);
1539 1579
 
1540
-		if ($smcFunc['db_num_rows']($request) == 1)
1541
-			$context['ban_errors'][] = 'ban_name_exists';
1580
+		if ($smcFunc['db_num_rows']($request) == 1) {
1581
+					$context['ban_errors'][] = 'ban_name_exists';
1582
+		}
1542 1583
 		$smcFunc['db_free_result']($request);
1543 1584
 	}
1544 1585
 
1545
-	if (!empty($context['ban_errors']))
1546
-		return;
1586
+	if (!empty($context['ban_errors'])) {
1587
+			return;
1588
+	}
1547 1589
 
1548 1590
 	// Yes yes, we're ready to add now.
1549 1591
 	$ban_info['id'] = $smcFunc['db_insert']('',
@@ -1560,8 +1602,9 @@  discard block
 block discarded – undo
1560 1602
 		1
1561 1603
 	);
1562 1604
 
1563
-	if (empty($ban_info['id']))
1564
-		$context['ban_errors'][] = 'impossible_insert_new_bangroup';
1605
+	if (empty($ban_info['id'])) {
1606
+			$context['ban_errors'][] = 'impossible_insert_new_bangroup';
1607
+	}
1565 1608
 
1566 1609
 	return $ban_info['id'];
1567 1610
 }
@@ -1586,24 +1629,24 @@  discard block
 block discarded – undo
1586 1629
 	$ban_group = isset($_REQUEST['bg']) ? (int) $_REQUEST['bg'] : 0;
1587 1630
 	$ban_id = isset($_REQUEST['bi']) ? (int) $_REQUEST['bi'] : 0;
1588 1631
 
1589
-	if (empty($ban_group))
1590
-		fatal_lang_error('ban_not_found', false);
1632
+	if (empty($ban_group)) {
1633
+			fatal_lang_error('ban_not_found', false);
1634
+	}
1591 1635
 
1592 1636
 	if (isset($_POST['add_new_trigger']) && !empty($_POST['ban_suggestions']))
1593 1637
 	{
1594 1638
 		saveTriggers($_POST['ban_suggestions'], $ban_group, 0, $ban_id);
1595 1639
 		redirectexit('action=admin;area=ban;sa=edit' . (!empty($ban_group) ? ';bg=' . $ban_group : ''));
1596
-	}
1597
-	elseif (isset($_POST['edit_trigger']) && !empty($_POST['ban_suggestions']))
1640
+	} elseif (isset($_POST['edit_trigger']) && !empty($_POST['ban_suggestions']))
1598 1641
 	{
1599 1642
 		// The first replaces the old one, the others are added new (simplification, otherwise it would require another query and some work...)
1600 1643
 		saveTriggers(array_shift($_POST['ban_suggestions']), $ban_group, 0, $ban_id);
1601
-		if (!empty($_POST['ban_suggestions']))
1602
-			saveTriggers($_POST['ban_suggestions'], $ban_group);
1644
+		if (!empty($_POST['ban_suggestions'])) {
1645
+					saveTriggers($_POST['ban_suggestions'], $ban_group);
1646
+		}
1603 1647
 
1604 1648
 		redirectexit('action=admin;area=ban;sa=edit' . (!empty($ban_group) ? ';bg=' . $ban_group : ''));
1605
-	}
1606
-	elseif (isset($_POST['edit_trigger']))
1649
+	} elseif (isset($_POST['edit_trigger']))
1607 1650
 	{
1608 1651
 		removeBanTriggers($ban_id);
1609 1652
 		redirectexit('action=admin;area=ban;sa=edit' . (!empty($ban_group) ? ';bg=' . $ban_group : ''));
@@ -1634,8 +1677,7 @@  discard block
 block discarded – undo
1634 1677
 			),
1635 1678
 			'is_new' => true,
1636 1679
 		);
1637
-	}
1638
-	else
1680
+	} else
1639 1681
 	{
1640 1682
 		$request = $smcFunc['db_query']('', '
1641 1683
 			SELECT
@@ -1652,8 +1694,9 @@  discard block
 block discarded – undo
1652 1694
 				'ban_group' => $ban_group,
1653 1695
 			)
1654 1696
 		);
1655
-		if ($smcFunc['db_num_rows']($request) == 0)
1656
-			fatal_lang_error('ban_not_found', false);
1697
+		if ($smcFunc['db_num_rows']($request) == 0) {
1698
+					fatal_lang_error('ban_not_found', false);
1699
+		}
1657 1700
 		$row = $smcFunc['db_fetch_assoc']($request);
1658 1701
 		$smcFunc['db_free_result']($request);
1659 1702
 
@@ -1702,8 +1745,9 @@  discard block
 block discarded – undo
1702 1745
 		removeBanTriggers($_POST['remove']);
1703 1746
 
1704 1747
 		// Rehabilitate some members.
1705
-		if ($_REQUEST['entity'] == 'member')
1706
-			updateBanMembers();
1748
+		if ($_REQUEST['entity'] == 'member') {
1749
+					updateBanMembers();
1750
+		}
1707 1751
 
1708 1752
 		// Make sure the ban cache is refreshed.
1709 1753
 		updateSettings(array('banLastUpdated' => time()));
@@ -1816,8 +1860,7 @@  discard block
 block discarded – undo
1816 1860
 			'default' => 'bi.ip_low, bi.ip_high, bi.ip_low',
1817 1861
 			'reverse' => 'bi.ip_low DESC, bi.ip_high DESC',
1818 1862
 		);
1819
-	}
1820
-	elseif ($context['selected_entity'] === 'hostname')
1863
+	} elseif ($context['selected_entity'] === 'hostname')
1821 1864
 	{
1822 1865
 		$listOptions['columns']['banned_entity']['data'] = array(
1823 1866
 			'function' => function($rowData) use ($smcFunc)
@@ -1829,8 +1872,7 @@  discard block
 block discarded – undo
1829 1872
 			'default' => 'bi.hostname',
1830 1873
 			'reverse' => 'bi.hostname DESC',
1831 1874
 		);
1832
-	}
1833
-	elseif ($context['selected_entity'] === 'email')
1875
+	} elseif ($context['selected_entity'] === 'email')
1834 1876
 	{
1835 1877
 		$listOptions['columns']['banned_entity']['data'] = array(
1836 1878
 			'function' => function($rowData) use ($smcFunc)
@@ -1842,8 +1884,7 @@  discard block
 block discarded – undo
1842 1884
 			'default' => 'bi.email_address',
1843 1885
 			'reverse' => 'bi.email_address DESC',
1844 1886
 		);
1845
-	}
1846
-	elseif ($context['selected_entity'] === 'member')
1887
+	} elseif ($context['selected_entity'] === 'member')
1847 1888
 	{
1848 1889
 		$listOptions['columns']['banned_entity']['data'] = array(
1849 1890
 			'sprintf' => array(
@@ -1907,8 +1948,9 @@  discard block
 block discarded – undo
1907 1948
 		)
1908 1949
 	);
1909 1950
 	$ban_triggers = array();
1910
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1911
-		$ban_triggers[] = $row;
1951
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1952
+			$ban_triggers[] = $row;
1953
+	}
1912 1954
 	$smcFunc['db_free_result']($request);
1913 1955
 
1914 1956
 	return $ban_triggers;
@@ -1964,8 +2006,9 @@  discard block
 block discarded – undo
1964 2006
 		validateToken('admin-bl');
1965 2007
 
1966 2008
 		// 'Delete all entries' button was pressed.
1967
-		if (!empty($_POST['removeAll']))
1968
-			removeBanLogs();
2009
+		if (!empty($_POST['removeAll'])) {
2010
+					removeBanLogs();
2011
+		}
1969 2012
 		// 'Delete selection' button was pressed.
1970 2013
 		else
1971 2014
 		{
@@ -2174,12 +2217,15 @@  discard block
 block discarded – undo
2174 2217
 	$low = inet_dtop($low);
2175 2218
 	$high = inet_dtop($high);
2176 2219
 
2177
-	if ($low == '255.255.255.255') return 'unknown';
2178
-	if ($low == $high)
2179
-	    return $low;
2180
-	else
2181
-	    return $low . '-' . $high;
2182
-}
2220
+	if ($low == '255.255.255.255') {
2221
+		return 'unknown';
2222
+	}
2223
+	if ($low == $high) {
2224
+		    return $low;
2225
+	} else {
2226
+		    return $low . '-' . $high;
2227
+	}
2228
+	}
2183 2229
 
2184 2230
 /**
2185 2231
  * Checks whether a given IP range already exists in the trigger list.
@@ -2255,15 +2301,17 @@  discard block
 block discarded – undo
2255 2301
 	$memberEmailWild = array();
2256 2302
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2257 2303
 	{
2258
-		if ($row['id_member'])
2259
-			$memberIDs[$row['id_member']] = $row['id_member'];
2304
+		if ($row['id_member']) {
2305
+					$memberIDs[$row['id_member']] = $row['id_member'];
2306
+		}
2260 2307
 		if ($row['email_address'])
2261 2308
 		{
2262 2309
 			// Does it have a wildcard - if so we can't do a IN on it.
2263
-			if (strpos($row['email_address'], '%') !== false)
2264
-				$memberEmailWild[$row['email_address']] = $row['email_address'];
2265
-			else
2266
-				$memberEmails[$row['email_address']] = $row['email_address'];
2310
+			if (strpos($row['email_address'], '%') !== false) {
2311
+							$memberEmailWild[$row['email_address']] = $row['email_address'];
2312
+			} else {
2313
+							$memberEmails[$row['email_address']] = $row['email_address'];
2314
+			}
2267 2315
 		}
2268 2316
 	}
2269 2317
 	$smcFunc['db_free_result']($request);
@@ -2314,14 +2362,15 @@  discard block
 block discarded – undo
2314 2362
 	}
2315 2363
 
2316 2364
 	// We welcome our new members in the realm of the banned.
2317
-	if (!empty($newMembers))
2318
-		$smcFunc['db_query']('', '
2365
+	if (!empty($newMembers)) {
2366
+			$smcFunc['db_query']('', '
2319 2367
 			DELETE FROM {db_prefix}log_online
2320 2368
 			WHERE id_member IN ({array_int:new_banned_members})',
2321 2369
 			array(
2322 2370
 				'new_banned_members' => $newMembers,
2323 2371
 			)
2324 2372
 		);
2373
+	}
2325 2374
 
2326 2375
 	// Find members that are wrongfully marked as banned.
2327 2376
 	$request = $smcFunc['db_query']('', '
@@ -2348,9 +2397,10 @@  discard block
 block discarded – undo
2348 2397
 	}
2349 2398
 	$smcFunc['db_free_result']($request);
2350 2399
 
2351
-	if (!empty($updates))
2352
-		foreach ($updates as $newStatus => $members)
2400
+	if (!empty($updates)) {
2401
+			foreach ($updates as $newStatus => $members)
2353 2402
 			updateMemberData($members, array('is_activated' => $newStatus));
2403
+	}
2354 2404
 
2355 2405
 	// Update the latest member and our total members as banning may change them.
2356 2406
 	updateStats('member');
Please login to merge, or discard this patch.
Themes/default/PersonalMessage.template.php 1 patch
Braces   +285 added lines, -199 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 	<div id="personal_messages">';
22 22
 
23 23
 	// Show the capacity bar, if available.
24
-	if (!empty($context['limit_bar']))
25
-		echo '
24
+	if (!empty($context['limit_bar'])) {
25
+			echo '
26 26
 		<div class="cat_bar">
27 27
 			<h3 class="catbg">
28 28
 				<span class="floatleft">', $txt['pm_capacity'], ':</span>
@@ -32,14 +32,16 @@  discard block
 block discarded – undo
32 32
 				<span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span>
33 33
 			</h3>
34 34
 		</div>';
35
+	}
35 36
 
36 37
 	// Message sent? Show a small indication.
37
-	if (isset($context['pm_sent']))
38
-		echo '
38
+	if (isset($context['pm_sent'])) {
39
+			echo '
39 40
 		<div class="infobox">
40 41
 			', $txt['pm_sent'], '
41 42
 		</div>';
42
-}
43
+	}
44
+	}
43 45
 
44 46
 /**
45 47
  * Just the end of the index bar, nothing special.
@@ -68,13 +70,13 @@  discard block
 block discarded – undo
68 70
 		</div>
69 71
 		<div class="pm_unread">';
70 72
 
71
-	if (empty($context['unread_pms']))
72
-		echo '
73
+	if (empty($context['unread_pms'])) {
74
+			echo '
73 75
 			<div class="no_unread">', $txt['pm_no_unread'], '</div>';
74
-	else
76
+	} else
75 77
 	{
76
-		foreach ($context['unread_pms'] as $id_pm => $pm_details)
77
-			echo '
78
+		foreach ($context['unread_pms'] as $id_pm => $pm_details) {
79
+					echo '
78 80
 			<div class="unread">
79 81
 				', !empty($pm_details['member']) ? $pm_details['member']['avatar']['image'] : '', '
80 82
 				<div class="details">
@@ -85,6 +87,7 @@  discard block
 block discarded – undo
85 87
 					</div>
86 88
 				</div>
87 89
 			</div>';
90
+		}
88 91
 	}
89 92
 
90 93
 	echo '
@@ -193,14 +196,15 @@  discard block
 block discarded – undo
193 196
 	if ($context['get_pmessage']('message', true))
194 197
 	{
195 198
 		// Show the helpful titlebar - generally.
196
-		if ($context['display_mode'] != 1)
197
-			echo '
199
+		if ($context['display_mode'] != 1) {
200
+					echo '
198 201
 			<div class="cat_bar">
199 202
 				<h3 class="catbg">
200 203
 					<span id="author">', $txt['author'], '</span>
201 204
 					<span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span>
202 205
 				</h3>
203 206
 			</div>';
207
+		}
204 208
 
205 209
 		// Show a few buttons if we are in conversation mode and outputting the first message.
206 210
 		if ($context['display_mode'] == 2)
@@ -228,9 +232,10 @@  discard block
 block discarded – undo
228 232
 					<div class="custom_fields_above_member">
229 233
 						<ul class="nolist">';
230 234
 
231
-				foreach ($message['custom_fields']['above_member'] as $custom)
232
-					echo '
235
+				foreach ($message['custom_fields']['above_member'] as $custom) {
236
+									echo '
233 237
 							<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
238
+				}
234 239
 
235 240
 				echo '
236 241
 						</ul>
@@ -242,25 +247,28 @@  discard block
 block discarded – undo
242 247
 						<a id="msg', $message['id'], '"></a>';
243 248
 
244 249
 			// Show online and offline buttons?
245
-			if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
246
-				echo '
250
+			if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) {
251
+							echo '
247 252
 						<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>';
253
+			}
248 254
 
249 255
 			// Custom fields BEFORE the username?
250
-			if (!empty($message['custom_fields']['before_member']))
251
-				foreach ($message['custom_fields']['before_member'] as $custom)
256
+			if (!empty($message['custom_fields']['before_member'])) {
257
+							foreach ($message['custom_fields']['before_member'] as $custom)
252 258
 					echo '
253 259
 						<span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>';
260
+			}
254 261
 
255 262
 			// Show a link to the member's profile.
256 263
 			echo '
257 264
 				', $message['member']['link'];
258 265
 
259 266
 				// Custom fields AFTER the username?
260
-				if (!empty($message['custom_fields']['after_member']))
261
-					foreach ($message['custom_fields']['after_member'] as $custom)
267
+				if (!empty($message['custom_fields']['after_member'])) {
268
+									foreach ($message['custom_fields']['after_member'] as $custom)
262 269
 						echo '
263 270
 						<span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>';
271
+				}
264 272
 
265 273
 			echo '
266 274
 					</h4>';
@@ -269,48 +277,56 @@  discard block
 block discarded – undo
269 277
 					<ul class="user_info">';
270 278
 
271 279
 			// Show the user's avatar.
272
-			if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
273
-				echo '
280
+			if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
281
+							echo '
274 282
 						<li class="avatar">
275 283
 							<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a>
276 284
 						</li>';
285
+			}
277 286
 
278 287
 			// Are there any custom fields below the avatar?
279
-			if (!empty($message['custom_fields']['below_avatar']))
280
-				foreach ($message['custom_fields']['below_avatar'] as $custom)
288
+			if (!empty($message['custom_fields']['below_avatar'])) {
289
+							foreach ($message['custom_fields']['below_avatar'] as $custom)
281 290
 					echo '
282 291
 						<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
292
+			}
283 293
 
284
-			if (!$message['member']['is_guest'])
285
-				echo '
294
+			if (!$message['member']['is_guest']) {
295
+							echo '
286 296
 						<li class="icons">', $message['member']['group_icons'], '</li>';
297
+			}
287 298
 			// Show the member's primary group (like 'Administrator') if they have one.
288
-			if (isset($message['member']['group']) && $message['member']['group'] != '')
289
-				echo '
299
+			if (isset($message['member']['group']) && $message['member']['group'] != '') {
300
+							echo '
290 301
 						<li class="membergroup">', $message['member']['group'], '</li>';
302
+			}
291 303
 
292 304
 			// Show the member's custom title, if they have one.
293
-			if (isset($message['member']['title']) && $message['member']['title'] != '')
294
-				echo '
305
+			if (isset($message['member']['title']) && $message['member']['title'] != '') {
306
+							echo '
295 307
 						<li class="title">', $message['member']['title'], '</li>';
308
+			}
296 309
 
297 310
 			// Don't show these things for guests.
298 311
 			if (!$message['member']['is_guest'])
299 312
 			{
300 313
 				// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
301
-				if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
302
-					echo '
314
+				if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') {
315
+									echo '
303 316
 						<li class="postgroup">', $message['member']['post_group'], '</li>';
317
+				}
304 318
 
305 319
 				// Show how many posts they have made.
306
-				if (!isset($context['disabled_fields']['posts']))
307
-					echo '
320
+				if (!isset($context['disabled_fields']['posts'])) {
321
+									echo '
308 322
 						<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
323
+				}
309 324
 
310 325
 				// Show their personal text?
311
-				if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '')
312
-					echo '
326
+				if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') {
327
+									echo '
313 328
 						<li class="blurb">', $message['member']['blurb'], '</li>';
329
+				}
314 330
 
315 331
 				// Any custom fields to show as icons?
316 332
 				if (!empty($message['custom_fields']['icons']))
@@ -319,9 +335,10 @@  discard block
 block discarded – undo
319 335
 						<li class="im_icons">
320 336
 							<ol>';
321 337
 
322
-					foreach ($message['custom_fields']['icons'] as $custom)
323
-						echo '
338
+					foreach ($message['custom_fields']['icons'] as $custom) {
339
+											echo '
324 340
 								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
341
+					}
325 342
 
326 343
 					echo '
327 344
 							</ol>
@@ -329,25 +346,28 @@  discard block
 block discarded – undo
329 346
 				}
330 347
 
331 348
 				// Show the IP to this user for this post - because you can moderate?
332
-				if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
333
-					echo '
349
+				if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) {
350
+									echo '
334 351
 						<li class="poster_ip">
335 352
 							<a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a>
336 353
 						</li>';
354
+				}
337 355
 
338 356
 				// Or, should we show it because this is you?
339
-				elseif ($message['can_see_ip'])
340
-					echo '
357
+				elseif ($message['can_see_ip']) {
358
+									echo '
341 359
 						<li class="poster_ip">
342 360
 							<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a>
343 361
 						</li>';
362
+				}
344 363
 
345 364
 				// Okay, you are logged in, then we can show something about why IPs are logged...
346
-				else
347
-					echo '
365
+				else {
366
+									echo '
348 367
 						<li class="poster_ip">
349 368
 							<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a>
350 369
 						</li>';
370
+				}
351 371
 
352 372
 				// Show the profile, website, email address, and personal message buttons.
353 373
 				if ($message['member']['show_profile_buttons'])
@@ -357,24 +377,28 @@  discard block
 block discarded – undo
357 377
 							<ol class="profile_icons">';
358 378
 
359 379
 					// Show the profile button
360
-					if ($message['member']['can_view_profile'])
361
-						echo '
380
+					if ($message['member']['can_view_profile']) {
381
+											echo '
362 382
 								<li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>';
383
+					}
363 384
 
364 385
 					// Don't show an icon if they haven't specified a website.
365
-					if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website']))
366
-						echo '
386
+					if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) {
387
+											echo '
367 388
 								<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
389
+					}
368 390
 
369 391
 					// Don't show the email address if they want it hidden.
370
-					if ($message['member']['show_email'])
371
-						echo '
392
+					if ($message['member']['show_email']) {
393
+											echo '
372 394
 								<li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
395
+					}
373 396
 
374 397
 					// Since we know this person isn't a guest, you *can* message them.
375
-					if ($context['can_send_pm'])
376
-						echo '
398
+					if ($context['can_send_pm']) {
399
+											echo '
377 400
 								<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
401
+					}
378 402
 
379 403
 					echo '
380 404
 							</ol>
@@ -382,21 +406,24 @@  discard block
 block discarded – undo
382 406
 				}
383 407
 
384 408
 				// Any custom fields for standard placement?
385
-				if (!empty($message['custom_fields']['standard']))
386
-					foreach ($message['custom_fields']['standard'] as $custom)
409
+				if (!empty($message['custom_fields']['standard'])) {
410
+									foreach ($message['custom_fields']['standard'] as $custom)
387 411
 						echo '
388 412
 						<li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>';
413
+				}
389 414
 
390 415
 				// Are we showing the warning status?
391
-				if ($message['member']['can_see_warning'])
392
-					echo '
416
+				if ($message['member']['can_see_warning']) {
417
+									echo '
393 418
 						<li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
419
+				}
394 420
 
395 421
 				// Are there any custom fields to show at the bottom of the poster info?
396
-				if (!empty($message['custom_fields']['bottom_poster']))
397
-					foreach ($message['custom_fields']['bottom_poster'] as $custom)
422
+				if (!empty($message['custom_fields']['bottom_poster'])) {
423
+									foreach ($message['custom_fields']['bottom_poster'] as $custom)
398 424
 						echo '
399 425
 						<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
426
+				}
400 427
 			}
401 428
 
402 429
 			// Done with the information about the poster... on to the post itself.
@@ -415,25 +442,29 @@  discard block
 block discarded – undo
415 442
 							<span class="smalltext">&#171; <strong> ', $txt['sent_to'], ':</strong> ';
416 443
 
417 444
 			// People it was sent directly to....
418
-			if (!empty($message['recipients']['to']))
419
-				echo implode(', ', $message['recipients']['to']);
445
+			if (!empty($message['recipients']['to'])) {
446
+							echo implode(', ', $message['recipients']['to']);
447
+			}
420 448
 
421 449
 			// Otherwise, we're just going to say "some people"...
422
-			elseif ($context['folder'] != 'sent')
423
-				echo '(', $txt['pm_undisclosed_recipients'], ')';
450
+			elseif ($context['folder'] != 'sent') {
451
+							echo '(', $txt['pm_undisclosed_recipients'], ')';
452
+			}
424 453
 
425 454
 			echo '
426 455
 								<strong> ', $txt['on'], ':</strong> ', $message['time'], ' &#187;
427 456
 							</span>';
428 457
 
429 458
 			// If we're in the sent items, show who it was sent to besides the "To:" people.
430
-			if (!empty($message['recipients']['bcc']))
431
-				echo '<br>
459
+			if (!empty($message['recipients']['bcc'])) {
460
+							echo '<br>
432 461
 							<span class="smalltext">&#171; <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' &#187;</span>';
462
+			}
433 463
 
434
-			if (!empty($message['is_replied_to']))
435
-				echo '<br>
464
+			if (!empty($message['is_replied_to'])) {
465
+							echo '<br>
436 466
 							<span class="smalltext">&#171; ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' &#187;</span>';
467
+			}
437 468
 
438 469
 			echo '
439 470
 						</div><!-- .keyinfo -->
@@ -443,13 +474,15 @@  discard block
 block discarded – undo
443 474
 							', $message['body'], '
444 475
 						</div>';
445 476
 
446
-			if ($message['can_report'] || $context['can_send_pm'])
447
-				echo '
477
+			if ($message['can_report'] || $context['can_send_pm']) {
478
+							echo '
448 479
 						<div class="under_message">';
480
+			}
449 481
 
450
-			if ($message['can_report'])
451
-				echo '
482
+			if ($message['can_report']) {
483
+							echo '
452 484
 							<a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>';
485
+			}
453 486
 
454 487
 			echo '
455 488
 							<ul class="quickbuttons">';
@@ -461,32 +494,36 @@  discard block
 block discarded – undo
461 494
 				if (!$message['member']['is_guest'])
462 495
 				{
463 496
 					// Is there than more than one recipient you can reply to?
464
-					if ($message['number_recipients'] > 1)
465
-						echo '
497
+					if ($message['number_recipients'] > 1) {
498
+											echo '
466 499
 								<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>';
500
+					}
467 501
 
468 502
 					echo '
469 503
 								<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>
470 504
 								<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>';
471 505
 				}
472 506
 				// This is for "forwarding" - even if the member is gone.
473
-				else
474
-					echo '
507
+				else {
508
+									echo '
475 509
 								<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>';
510
+				}
476 511
 			}
477 512
 			echo '
478 513
 								<li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>';
479 514
 
480
-			if (empty($context['display_mode']))
481
-				echo '
515
+			if (empty($context['display_mode'])) {
516
+							echo '
482 517
 								<li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;"></li>';
518
+			}
483 519
 
484 520
 			echo '
485 521
 							</ul>';
486 522
 
487
-			if ($message['can_report'] || $context['can_send_pm'])
488
-			echo '
523
+			if ($message['can_report'] || $context['can_send_pm']) {
524
+						echo '
489 525
 						</div><!-- .under_message -->';
526
+			}
490 527
 
491 528
 			// Are there any custom profile fields for above the signature?
492 529
 			if (!empty($message['custom_fields']['above_signature']))
@@ -495,9 +532,10 @@  discard block
 block discarded – undo
495 532
 						<div class="custom_fields_above_signature">
496 533
 							<ul class="nolist">';
497 534
 
498
-				foreach ($message['custom_fields']['above_signature'] as $custom)
499
-					echo '
535
+				foreach ($message['custom_fields']['above_signature'] as $custom) {
536
+									echo '
500 537
 								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
538
+				}
501 539
 
502 540
 				echo '
503 541
 							</ul>
@@ -505,11 +543,12 @@  discard block
 block discarded – undo
505 543
 			}
506 544
 
507 545
 			// Show the member's signature?
508
-			if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
509
-				echo '
546
+			if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
547
+							echo '
510 548
 						<div class="signature">
511 549
 							', $message['member']['signature'], '
512 550
 						</div>';
551
+			}
513 552
 
514 553
 			// Are there any custom profile fields for below the signature?
515 554
 			if (!empty($message['custom_fields']['below_signature']))
@@ -518,9 +557,10 @@  discard block
 block discarded – undo
518 557
 						<div class="custom_fields_below_signature">
519 558
 							<ul class="nolist">';
520 559
 
521
-				foreach ($message['custom_fields']['below_signature'] as $custom)
522
-					echo '
560
+				foreach ($message['custom_fields']['below_signature'] as $custom) {
561
+									echo '
523 562
 								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
563
+				}
524 564
 
525 565
 				echo '
526 566
 							</ul>
@@ -547,10 +587,11 @@  discard block
 block discarded – undo
547 587
 						echo '
548 588
 								<option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>';
549 589
 
550
-						foreach ($context['labels'] as $label)
551
-							if (!isset($message['labels'][$label['id']]))
590
+						foreach ($context['labels'] as $label) {
591
+													if (!isset($message['labels'][$label['id']]))
552 592
 								echo '
553 593
 								<option value="', $label['id'], '">', $label['name'], '</option>';
594
+						}
554 595
 					}
555 596
 
556 597
 					// ... and are there any that can be removed?
@@ -559,9 +600,10 @@  discard block
 block discarded – undo
559 600
 						echo '
560 601
 								<option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>';
561 602
 
562
-						foreach ($message['labels'] as $label)
563
-							echo '
603
+						foreach ($message['labels'] as $label) {
604
+													echo '
564 605
 								<option value="', $label['id'], '">&nbsp;', $label['name'], '</option>';
606
+						}
565 607
 					}
566 608
 					echo '
567 609
 							</select>
@@ -580,14 +622,15 @@  discard block
 block discarded – undo
580 622
 			</div><!-- .windowbg -->';
581 623
 		}
582 624
 
583
-		if (empty($context['display_mode']))
584
-			echo '
625
+		if (empty($context['display_mode'])) {
626
+					echo '
585 627
 			<div class="pagesection">
586 628
 				<div class="floatleft">', $context['page_index'], '</div>
587 629
 				<div class="floatright">
588 630
 					<input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button">
589 631
 				</div>
590 632
 			</div>';
633
+		}
591 634
 
592 635
 		// Show a few buttons if we are in conversation mode and outputting the first message.
593 636
 		elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons']))
@@ -647,11 +690,12 @@  discard block
 block discarded – undo
647 690
 		</thead>
648 691
 		<tbody>';
649 692
 
650
-	if (!$context['show_delete'])
651
-		echo '
693
+	if (!$context['show_delete']) {
694
+			echo '
652 695
 			<tr class="windowbg">
653 696
 				<td colspan="5">', $txt['pm_alert_none'], '</td>
654 697
 			</tr>';
698
+	}
655 699
 
656 700
 	while ($message = $context['get_pmessage']('subject'))
657 701
 	{
@@ -709,17 +753,19 @@  discard block
 block discarded – undo
709 753
 
710 754
 			foreach ($context['labels'] as $label)
711 755
 			{
712
-				if ($label['id'] != $context['current_label_id'])
713
-					echo '
756
+				if ($label['id'] != $context['current_label_id']) {
757
+									echo '
714 758
 				<option value="add_', $label['id'], '">&nbsp;', $label['name'], '</option>';
759
+				}
715 760
 			}
716 761
 
717 762
 			echo '
718 763
 				<option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>';
719 764
 
720
-			foreach ($context['labels'] as $label)
721
-				echo '
765
+			foreach ($context['labels'] as $label) {
766
+							echo '
722 767
 				<option value="rem_', $label['id'], '">&nbsp;', $label['name'], '</option>';
768
+			}
723 769
 
724 770
 			echo '
725 771
 			</select>
@@ -750,11 +796,12 @@  discard block
 block discarded – undo
750 796
 			<h3 class="catbg">', $txt['pm_search_title'], '</h3>
751 797
 		</div>';
752 798
 
753
-	if (!empty($context['search_errors']))
754
-		echo '
799
+	if (!empty($context['search_errors'])) {
800
+			echo '
755 801
 		<div class="errorbox">
756 802
 			', implode('<br>', $context['search_errors']['messages']), '
757 803
 		</div>';
804
+	}
758 805
 
759 806
 
760 807
 	echo '
@@ -803,9 +850,10 @@  discard block
 block discarded – undo
803 850
 					</dd>
804 851
 				</dl>';
805 852
 
806
-	if (!$context['currently_using_labels'])
807
-		echo '
853
+	if (!$context['currently_using_labels']) {
854
+			echo '
808 855
 				<input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button">';
856
+	}
809 857
 
810 858
 	echo '
811 859
 				<br class="clear_right">
@@ -826,12 +874,13 @@  discard block
 block discarded – undo
826 874
 				<div id="advanced_panel_div">
827 875
 					<ul id="searchLabelsExpand">';
828 876
 
829
-		foreach ($context['search_labels'] as $label)
830
-			echo '
877
+		foreach ($context['search_labels'] as $label) {
878
+					echo '
831 879
 						<li>
832 880
 							<label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '>
833 881
 							', $label['name'], '</label>
834 882
 						</li>';
883
+		}
835 884
 
836 885
 		echo '
837 886
 					</ul>
@@ -893,8 +942,8 @@  discard block
 block discarded – undo
893 942
 		</div>';
894 943
 
895 944
 	// Complete results?
896
-	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
897
-		echo '
945
+	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) {
946
+			echo '
898 947
 		<table class="table_grid">
899 948
 			<thead>
900 949
 				<tr class="title_bar">
@@ -904,6 +953,7 @@  discard block
 block discarded – undo
904 953
 				</tr>
905 954
 			</thead>
906 955
 			<tbody>';
956
+	}
907 957
 
908 958
 	// Print each message out...
909 959
 	foreach ($context['personal_messages'] as $message)
@@ -923,12 +973,14 @@  discard block
 block discarded – undo
923 973
 
924 974
 			// Show the recipients.
925 975
 			// @todo This doesn't deal with the sent item searching quite right for bcc.
926
-			if (!empty($message['recipients']['to']))
927
-				echo implode(', ', $message['recipients']['to']);
976
+			if (!empty($message['recipients']['to'])) {
977
+							echo implode(', ', $message['recipients']['to']);
978
+			}
928 979
 
929 980
 			// Otherwise, we're just going to say "some people"...
930
-			elseif ($context['folder'] != 'sent')
931
-				echo '(', $txt['pm_undisclosed_recipients'], ')';
981
+			elseif ($context['folder'] != 'sent') {
982
+							echo '(', $txt['pm_undisclosed_recipients'], ')';
983
+			}
932 984
 
933 985
 			echo '
934 986
 				</h3>
@@ -943,15 +995,17 @@  discard block
 block discarded – undo
943 995
 				$reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"');
944 996
 
945 997
 				// You can only reply if they are not a guest...
946
-				if (!$message['member']['is_guest'])
947
-					echo '
998
+				if (!$message['member']['is_guest']) {
999
+									echo '
948 1000
 					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], '
949 1001
 					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator'];
1002
+				}
950 1003
 
951 1004
 				// This is for "forwarding" - even if the member is gone.
952
-				else
953
-					echo '
1005
+				else {
1006
+									echo '
954 1007
 					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator'];
1008
+				}
955 1009
 			}
956 1010
 
957 1011
 			echo '
@@ -960,27 +1014,30 @@  discard block
 block discarded – undo
960 1014
 		}
961 1015
 		// Otherwise just a simple list!
962 1016
 		// @todo No context at all of the search?
963
-		else
964
-			echo '
1017
+		else {
1018
+					echo '
965 1019
 				<tr class="windowbg">
966 1020
 					<td>', $message['time'], '</td>
967 1021
 					<td>', $message['link'], '</td>
968 1022
 					<td>', $message['member']['link'], '</td>
969 1023
 				</tr>';
1024
+		}
970 1025
 	}
971 1026
 
972 1027
 	// Finish off the page...
973
-	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
974
-		echo '
1028
+	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) {
1029
+			echo '
975 1030
 			</tbody>
976 1031
 		</table>';
1032
+	}
977 1033
 
978 1034
 	// No results?
979
-	if (empty($context['personal_messages']))
980
-		echo '
1035
+	if (empty($context['personal_messages'])) {
1036
+			echo '
981 1037
 		<div class="windowbg">
982 1038
 			<p class="centertext">', $txt['pm_search_none_found'], '</p>
983 1039
 		</div>';
1040
+	}
984 1041
 
985 1042
 	echo '
986 1043
 		<div class="pagesection">
@@ -1005,15 +1062,17 @@  discard block
 block discarded – undo
1005 1062
 		</div>
1006 1063
 		<div class="windowbg">';
1007 1064
 
1008
-		if (!empty($context['send_log']['sent']))
1009
-			foreach ($context['send_log']['sent'] as $log_entry)
1065
+		if (!empty($context['send_log']['sent'])) {
1066
+					foreach ($context['send_log']['sent'] as $log_entry)
1010 1067
 				echo '
1011 1068
 			<span class="error">', $log_entry, '</span><br>';
1069
+		}
1012 1070
 
1013
-		if (!empty($context['send_log']['failed']))
1014
-			foreach ($context['send_log']['failed'] as $log_entry)
1071
+		if (!empty($context['send_log']['failed'])) {
1072
+					foreach ($context['send_log']['failed'] as $log_entry)
1015 1073
 				echo '
1016 1074
 			<span class="error">', $log_entry, '</span><br>';
1075
+		}
1017 1076
 
1018 1077
 		echo '
1019 1078
 		</div>
@@ -1061,12 +1120,13 @@  discard block
 block discarded – undo
1061 1120
 					</dl>
1062 1121
 				</div>';
1063 1122
 
1064
-	if (!empty($modSettings['drafts_pm_enabled']))
1065
-		echo '
1123
+	if (!empty($modSettings['drafts_pm_enabled'])) {
1124
+			echo '
1066 1125
 				<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>',
1067 1126
 					sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), '
1068 1127
 					', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), '
1069 1128
 				</div>';
1129
+	}
1070 1130
 
1071 1131
 	echo '
1072 1132
 				<dl id="post_header">';
@@ -1132,22 +1192,24 @@  discard block
 block discarded – undo
1132 1192
 						<dt><strong>', $txt['subject'], '</strong></dt>
1133 1193
 						<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
1134 1194
 
1135
-		foreach ($context['drafts'] as $draft)
1136
-			echo '
1195
+		foreach ($context['drafts'] as $draft) {
1196
+					echo '
1137 1197
 						<dt>', $draft['link'], '</dt>
1138 1198
 						<dd>', $draft['poster_time'], '</dd>';
1199
+		}
1139 1200
 		echo '
1140 1201
 					</dl>
1141 1202
 				</div>';
1142 1203
 	}
1143 1204
 
1144 1205
 	// Require an image to be typed to save spamming?
1145
-	if ($context['require_verification'])
1146
-		echo '
1206
+	if ($context['require_verification']) {
1207
+			echo '
1147 1208
 				<div class="post_verification">
1148 1209
 					<strong>', $txt['pm_visual_verification_label'], ':</strong>
1149 1210
 					', template_control_verification($context['visual_verification_id'], 'all'), '
1150 1211
 				</div>';
1212
+	}
1151 1213
 
1152 1214
 	// Send, Preview, spellcheck buttons.
1153 1215
 	echo '
@@ -1265,8 +1327,8 @@  discard block
 block discarded – undo
1265 1327
 			}';
1266 1328
 
1267 1329
 	// Code for showing and hiding drafts
1268
-	if (!empty($context['drafts']))
1269
-		echo '
1330
+	if (!empty($context['drafts'])) {
1331
+			echo '
1270 1332
 			var oSwapDraftOptions = new smc_Toggle({
1271 1333
 				bToggleEnabled: true,
1272 1334
 				bCurrentlyCollapsed: true,
@@ -1288,13 +1350,14 @@  discard block
 block discarded – undo
1288 1350
 					}
1289 1351
 				]
1290 1352
 			});';
1353
+	}
1291 1354
 
1292 1355
 	echo '
1293 1356
 		</script>';
1294 1357
 
1295 1358
 	// Show the message you're replying to.
1296
-	if ($context['reply'])
1297
-		echo '
1359
+	if ($context['reply']) {
1360
+			echo '
1298 1361
 		<br><br>
1299 1362
 		<div class="cat_bar">
1300 1363
 			<h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3>
@@ -1308,6 +1371,7 @@  discard block
 block discarded – undo
1308 1371
 			', $context['quoted_message']['body'], '
1309 1372
 		</div>
1310 1373
 		<br class="clear">';
1374
+	}
1311 1375
 
1312 1376
 	echo '
1313 1377
 		<script>
@@ -1319,23 +1383,25 @@  discard block
 block discarded – undo
1319 1383
 				sToControlId: \'to_control\',
1320 1384
 				aToRecipients: [';
1321 1385
 
1322
-	foreach ($context['recipients']['to'] as $i => $member)
1323
-		echo '
1386
+	foreach ($context['recipients']['to'] as $i => $member) {
1387
+			echo '
1324 1388
 					{
1325 1389
 						sItemId: ', JavaScriptEscape($member['id']), ',
1326 1390
 						sItemName: ', JavaScriptEscape($member['name']), '
1327 1391
 					}', $i == count($context['recipients']['to']) - 1 ? '' : ',';
1392
+	}
1328 1393
 
1329 1394
 	echo '
1330 1395
 				],
1331 1396
 				aBccRecipients: [';
1332 1397
 
1333
-	foreach ($context['recipients']['bcc'] as $i => $member)
1334
-		echo '
1398
+	foreach ($context['recipients']['bcc'] as $i => $member) {
1399
+			echo '
1335 1400
 					{
1336 1401
 						sItemId: ', JavaScriptEscape($member['id']), ',
1337 1402
 						sItemName: ', JavaScriptEscape($member['name']), '
1338 1403
 					}', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
1404
+	}
1339 1405
 
1340 1406
 	echo '
1341 1407
 				],
@@ -1424,26 +1490,28 @@  discard block
 block discarded – undo
1424 1490
 					</th>
1425 1491
 					<th class="centertext table_icon">';
1426 1492
 
1427
-	if (count($context['labels']) > 2)
1428
-		echo '
1493
+	if (count($context['labels']) > 2) {
1494
+			echo '
1429 1495
 						<input type="checkbox" onclick="invertAll(this, this.form);">';
1496
+	}
1430 1497
 
1431 1498
 	echo '
1432 1499
 					</th>
1433 1500
 				</tr>
1434 1501
 			</thead>
1435 1502
 			<tbody>';
1436
-	if (count($context['labels']) < 2)
1437
-		echo '
1503
+	if (count($context['labels']) < 2) {
1504
+			echo '
1438 1505
 				<tr class="windowbg">
1439 1506
 					<td colspan="2">', $txt['pm_labels_no_exist'], '</td>
1440 1507
 				</tr>';
1441
-	else
1508
+	} else
1442 1509
 	{
1443 1510
 		foreach ($context['labels'] as $label)
1444 1511
 		{
1445
-			if ($label['id'] == -1)
1446
-				continue;
1512
+			if ($label['id'] == -1) {
1513
+							continue;
1514
+			}
1447 1515
 
1448 1516
 				echo '
1449 1517
 				<tr class="windowbg">
@@ -1458,12 +1526,13 @@  discard block
 block discarded – undo
1458 1526
 			</tbody>
1459 1527
 		</table>';
1460 1528
 
1461
-	if (!count($context['labels']) < 2)
1462
-		echo '
1529
+	if (!count($context['labels']) < 2) {
1530
+			echo '
1463 1531
 		<div class="padding">
1464 1532
 			<input type="submit" name="save" value="', $txt['save'], '" class="button">
1465 1533
 			<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure">
1466 1534
 		</div>';
1535
+	}
1467 1536
 
1468 1537
 	echo '
1469 1538
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1520,9 +1589,10 @@  discard block
 block discarded – undo
1520 1589
 					<select name="id_admin">
1521 1590
 						<option value="0">', $txt['pm_report_all_admins'], '</option>';
1522 1591
 
1523
-		foreach ($context['admins'] as $id => $name)
1524
-			echo '
1592
+		foreach ($context['admins'] as $id => $name) {
1593
+					echo '
1525 1594
 						<option value="', $id, '">', $name, '</option>';
1595
+		}
1526 1596
 
1527 1597
 		echo '
1528 1598
 					</select>
@@ -1585,9 +1655,10 @@  discard block
 block discarded – undo
1585 1655
 					</th>
1586 1656
 					<th class="centertext table_icon">';
1587 1657
 
1588
-	if (!empty($context['rules']))
1589
-		echo '
1658
+	if (!empty($context['rules'])) {
1659
+			echo '
1590 1660
 						<input type="checkbox" onclick="invertAll(this, this.form);">';
1661
+	}
1591 1662
 
1592 1663
 	echo '
1593 1664
 					</th>
@@ -1595,16 +1666,17 @@  discard block
 block discarded – undo
1595 1666
 			</thead>
1596 1667
 			<tbody>';
1597 1668
 
1598
-	if (empty($context['rules']))
1599
-		echo '
1669
+	if (empty($context['rules'])) {
1670
+			echo '
1600 1671
 				<tr class="windowbg">
1601 1672
 					<td colspan="2">
1602 1673
 						', $txt['pm_rules_none'], '
1603 1674
 					</td>
1604 1675
 				</tr>';
1676
+	}
1605 1677
 
1606
-	foreach ($context['rules'] as $rule)
1607
-		echo '
1678
+	foreach ($context['rules'] as $rule) {
1679
+			echo '
1608 1680
 				<tr class="windowbg">
1609 1681
 					<td>
1610 1682
 						<a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a>
@@ -1613,6 +1685,7 @@  discard block
 block discarded – undo
1613 1685
 						<input type="checkbox" name="delrule[', $rule['id'], ']">
1614 1686
 					</td>
1615 1687
 				</tr>';
1688
+	}
1616 1689
 
1617 1690
 	echo '
1618 1691
 			</tbody>
@@ -1620,14 +1693,16 @@  discard block
 block discarded – undo
1620 1693
 		<div class="righttext">
1621 1694
 			<a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>';
1622 1695
 
1623
-	if (!empty($context['rules']))
1624
-		echo '
1696
+	if (!empty($context['rules'])) {
1697
+			echo '
1625 1698
 			[<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]';
1699
+	}
1626 1700
 
1627
-	if (!empty($context['rules']))
1628
-		echo '
1701
+	if (!empty($context['rules'])) {
1702
+			echo '
1629 1703
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1630 1704
 			<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">';
1705
+	}
1631 1706
 
1632 1707
 	echo '
1633 1708
 		</div>
@@ -1649,14 +1724,16 @@  discard block
 block discarded – undo
1649 1724
 		var groups = new Array()
1650 1725
 		var labels = new Array()';
1651 1726
 
1652
-	foreach ($context['groups'] as $id => $title)
1653
-		echo '
1727
+	foreach ($context['groups'] as $id => $title) {
1728
+			echo '
1654 1729
 		groups[', $id, '] = "', addslashes($title), '";';
1730
+	}
1655 1731
 
1656
-	foreach ($context['labels'] as $label)
1657
-		if ($label['id'] != -1)
1732
+	foreach ($context['labels'] as $label) {
1733
+			if ($label['id'] != -1)
1658 1734
 			echo '
1659 1735
 		labels[', ($label['id']), '] = "', addslashes($label['name']), '";';
1736
+	}
1660 1737
 
1661 1738
 	echo '
1662 1739
 		function addCriteriaOption()
@@ -1671,8 +1748,9 @@  discard block
 block discarded – undo
1671 1748
 
1672 1749
 			setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select>&nbsp;<span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value=""><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>';
1673 1750
 
1674
-	foreach ($context['groups'] as $id => $group)
1675
-		echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>';
1751
+	foreach ($context['groups'] as $id => $group) {
1752
+			echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>';
1753
+	}
1676 1754
 
1677 1755
 	echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\');
1678 1756
 			}
@@ -1689,9 +1767,10 @@  discard block
 block discarded – undo
1689 1767
 
1690 1768
 				setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select>&nbsp;<span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>';
1691 1769
 
1692
-	foreach ($context['labels'] as $label)
1693
-		if ($label['id'] != -1)
1770
+	foreach ($context['labels'] as $label) {
1771
+			if ($label['id'] != -1)
1694 1772
 			echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>';
1773
+	}
1695 1774
 
1696 1775
 	echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\');
1697 1776
 			}
@@ -1805,19 +1884,20 @@  discard block
 block discarded – undo
1805 1884
 	$isFirst = true;
1806 1885
 	foreach ($context['rule']['criteria'] as $k => $criteria)
1807 1886
 	{
1808
-		if (!$isFirst && $criteria['t'] == '')
1809
-			echo '<div id="removeonjs1">';
1810
-
1811
-		elseif (!$isFirst)
1812
-			echo '<br>';
1887
+		if (!$isFirst && $criteria['t'] == '') {
1888
+					echo '<div id="removeonjs1">';
1889
+		} elseif (!$isFirst) {
1890
+					echo '<br>';
1891
+		}
1813 1892
 
1814 1893
 		echo '
1815 1894
 				<select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();">
1816 1895
 					<option value="">', $txt['pm_rule_criteria_pick'], ':</option>';
1817 1896
 
1818
-		foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr)
1819
-			echo '
1897
+		foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) {
1898
+					echo '
1820 1899
 					<option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>';
1900
+		}
1821 1901
 
1822 1902
 		echo '
1823 1903
 				</select>
@@ -1828,19 +1908,20 @@  discard block
 block discarded – undo
1828 1908
 					<select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();">
1829 1909
 						<option value="">', $txt['pm_rule_sel_group'], '</option>';
1830 1910
 
1831
-		foreach ($context['groups'] as $id => $group)
1832
-			echo '
1911
+		foreach ($context['groups'] as $id => $group) {
1912
+					echo '
1833 1913
 						<option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>';
1914
+		}
1834 1915
 		echo '
1835 1916
 					</select>
1836 1917
 				</span>';
1837 1918
 
1838 1919
 		// If this is the dummy we add a means to hide for non js users.
1839
-		if ($isFirst)
1840
-			$isFirst = false;
1841
-
1842
-		elseif ($criteria['t'] == '')
1843
-			echo '</div><!-- .removeonjs1 -->';
1920
+		if ($isFirst) {
1921
+					$isFirst = false;
1922
+		} elseif ($criteria['t'] == '') {
1923
+					echo '</div><!-- .removeonjs1 -->';
1924
+		}
1844 1925
 	}
1845 1926
 
1846 1927
 	echo '
@@ -1863,10 +1944,11 @@  discard block
 block discarded – undo
1863 1944
 	$isFirst = true;
1864 1945
 	foreach ($context['rule']['actions'] as $k => $action)
1865 1946
 	{
1866
-		if (!$isFirst && $action['t'] == '')
1867
-			echo '<div id="removeonjs2">';
1868
-		elseif (!$isFirst)
1869
-			echo '<br>';
1947
+		if (!$isFirst && $action['t'] == '') {
1948
+					echo '<div id="removeonjs2">';
1949
+		} elseif (!$isFirst) {
1950
+					echo '<br>';
1951
+		}
1870 1952
 
1871 1953
 		echo '
1872 1954
 				<select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();">
@@ -1878,20 +1960,21 @@  discard block
 block discarded – undo
1878 1960
 					<select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();">
1879 1961
 						<option value="">', $txt['pm_rule_sel_label'], '</option>';
1880 1962
 
1881
-		foreach ($context['labels'] as $label)
1882
-			if ($label['id'] != -1)
1963
+		foreach ($context['labels'] as $label) {
1964
+					if ($label['id'] != -1)
1883 1965
 				echo '
1884 1966
 						<option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>';
1967
+		}
1885 1968
 
1886 1969
 		echo '
1887 1970
 					</select>
1888 1971
 				</span>';
1889 1972
 
1890
-		if ($isFirst)
1891
-			$isFirst = false;
1892
-
1893
-		elseif ($action['t'] == '')
1894
-			echo '</div><!-- .removeonjs2 -->';
1973
+		if ($isFirst) {
1974
+					$isFirst = false;
1975
+		} elseif ($action['t'] == '') {
1976
+					echo '</div><!-- .removeonjs2 -->';
1977
+		}
1895 1978
 	}
1896 1979
 
1897 1980
 	echo '
@@ -1915,22 +1998,25 @@  discard block
 block discarded – undo
1915 1998
 		echo '
1916 1999
 	<script>';
1917 2000
 
1918
-	foreach ($context['rule']['criteria'] as $k => $c)
1919
-		echo '
2001
+	foreach ($context['rule']['criteria'] as $k => $c) {
2002
+			echo '
1920 2003
 			updateRuleDef(', $k, ');';
2004
+	}
1921 2005
 
1922
-	foreach ($context['rule']['actions'] as $k => $c)
1923
-		echo '
2006
+	foreach ($context['rule']['actions'] as $k => $c) {
2007
+			echo '
1924 2008
 			updateActionDef(', $k, ');';
2009
+	}
1925 2010
 
1926 2011
 	echo '
1927 2012
 			rebuildRuleDesc();';
1928 2013
 
1929 2014
 	// If this isn't a new rule and we have JS enabled remove the JS compatibility stuff.
1930
-	if ($context['rid'])
1931
-		echo '
2015
+	if ($context['rid']) {
2016
+			echo '
1932 2017
 			document.getElementById("removeonjs1").style.display = "none";
1933 2018
 			document.getElementById("removeonjs2").style.display = "none";';
2019
+	}
1934 2020
 
1935 2021
 	echo '
1936 2022
 			document.getElementById("addonjs1").style.display = "";
@@ -1958,12 +2044,12 @@  discard block
 block discarded – undo
1958 2044
 		</div>';
1959 2045
 
1960 2046
 	// No drafts? Just show an informative message.
1961
-	if (empty($context['drafts']))
1962
-		echo '
2047
+	if (empty($context['drafts'])) {
2048
+			echo '
1963 2049
 		<div class="windowbg centertext">
1964 2050
 			', $txt['draft_none'], '
1965 2051
 		</div>';
1966
-	else
2052
+	} else
1967 2053
 	{
1968 2054
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
1969 2055
 		foreach ($context['drafts'] as $draft)
Please login to merge, or discard this patch.
Themes/default/ReportedContent.template.php 1 patch
Braces   +66 added lines, -44 removed lines patch added patch discarded remove patch
@@ -18,11 +18,12 @@  discard block
 block discarded – undo
18 18
 	global $context, $txt, $scripturl;
19 19
 
20 20
 	// Let them know the action was a success.
21
-	if (!empty($context['report_post_action']))
22
-		echo '
21
+	if (!empty($context['report_post_action'])) {
22
+			echo '
23 23
 	<div class="infobox">
24 24
 		', $txt['report_action_' . $context['report_post_action']], '
25 25
 	</div>';
26
+	}
26 27
 
27 28
 	echo '
28 29
 	<form id="reported_posts" action="', $scripturl, '?action=moderate;area=reportedposts;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
 
53 54
 		// Prepare the comments...
54 55
 		$comments = array();
55
-		foreach ($report['comments'] as $comment)
56
-			$comments[$comment['member']['id']] = $comment['member']['link'];
56
+		foreach ($report['comments'] as $comment) {
57
+					$comments[$comment['member']['id']] = $comment['member']['link'];
58
+		}
57 59
 
58 60
 		echo '
59 61
 				', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
@@ -69,18 +71,21 @@  discard block
 block discarded – undo
69 71
 				<li><a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
70 72
 
71 73
 		// Delete message button.
72
-		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
73
-			echo '
74
+		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards']))) {
75
+					echo '
74 76
 				<li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'], '.0;msg=', $report['topic']['id_msg'], ';modcenter;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['mc_reportedp_delete_confirm'], '" class="you_sure">', $delete_button, '</a></li>';
77
+		}
75 78
 
76 79
 		// Ban this user button.
77
-		if (!$report['closed'] && !empty($context['report_manage_bans']))
78
-			echo '
80
+		if (!$report['closed'] && !empty($context['report_manage_bans'])) {
81
+					echo '
79 82
 				<li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u=' . $report['author']['id'] : ';msg=' . $report['topic']['id_msg']), ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
83
+		}
80 84
 
81
-		if (!$context['view_closed'])
82
-			echo '
85
+		if (!$context['view_closed']) {
86
+					echo '
83 87
 				<li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';
88
+		}
84 89
 
85 90
 		echo '
86 91
 			</ul>
@@ -88,18 +93,20 @@  discard block
 block discarded – undo
88 93
 	}
89 94
 
90 95
 	// Were none found?
91
-	if (empty($context['reports']))
92
-		echo '
96
+	if (empty($context['reports'])) {
97
+			echo '
93 98
 		<div class="windowbg">
94 99
 			<p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
95 100
 		</div>';
101
+	}
96 102
 
97 103
 	echo '
98 104
 		<div class="pagesection">';
99 105
 
100
-	if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many'])
101
-		echo '
106
+	if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many']) {
107
+			echo '
102 108
 			<div class="pagelinks floatleft">' . $context['page_index'] . '</div>';
109
+	}
103 110
 
104 111
 	echo '
105 112
 			<div class="floatright">', !$context['view_closed'] ? '
@@ -130,18 +137,20 @@  discard block
 block discarded – undo
130 137
 			<div class="modbox">
131 138
 				<ul>';
132 139
 
133
-	foreach ($context['reported_posts'] as $report)
134
-		echo '
140
+	foreach ($context['reported_posts'] as $report) {
141
+			echo '
135 142
 					<li class="smalltext">
136 143
 						<a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
137 144
 					</li>';
145
+	}
138 146
 
139 147
 	// Don't have any watched users right now?
140
-	if (empty($context['reported_posts']))
141
-		echo '
148
+	if (empty($context['reported_posts'])) {
149
+			echo '
142 150
 					<li>
143 151
 						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
144 152
 					</li>';
153
+	}
145 154
 
146 155
 	echo '
147 156
 				</ul>
@@ -189,11 +198,12 @@  discard block
 block discarded – undo
189 198
 	global $context, $scripturl, $txt;
190 199
 
191 200
 	// Let them know the action was a success.
192
-	if (!empty($context['report_post_action']))
193
-		echo '
201
+	if (!empty($context['report_post_action'])) {
202
+			echo '
194 203
 	<div class="infobox">
195 204
 		', $txt['report_action_' . $context['report_post_action']], '
196 205
 	</div>';
206
+	}
197 207
 
198 208
 	echo '
199 209
 	<div id="modcenter">
@@ -229,14 +239,15 @@  discard block
 block discarded – undo
229 239
 				<h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
230 240
 			</div>';
231 241
 
232
-	foreach ($context['report']['comments'] as $comment)
233
-		echo '
242
+	foreach ($context['report']['comments'] as $comment) {
243
+			echo '
234 244
 			<div class="windowbg">
235 245
 				<p class="smalltext">
236 246
 					', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
237 247
 				</p>
238 248
 				<p>', $comment['message'], '</p>
239 249
 			</div>';
250
+	}
240 251
 
241 252
 	echo '
242 253
 			<br>
@@ -245,11 +256,12 @@  discard block
 block discarded – undo
245 256
 			</div>
246 257
 			<div>';
247 258
 
248
-	if (empty($context['report']['mod_comments']))
249
-		echo '
259
+	if (empty($context['report']['mod_comments'])) {
260
+			echo '
250 261
 				<div class="information">
251 262
 					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
252 263
 				</div>';
264
+	}
253 265
 
254 266
 	foreach ($context['report']['mod_comments'] as $comment)
255 267
 	{
@@ -335,18 +347,20 @@  discard block
 block discarded – undo
335 347
 			<div class="modbox">
336 348
 				<ul>';
337 349
 
338
-	foreach ($context['reported_members'] as $report)
339
-		echo '
350
+	foreach ($context['reported_members'] as $report) {
351
+			echo '
340 352
 					<li class="smalltext">
341 353
 						<a href="', $report['report_href'], '">', $report['user_name'], '</a>
342 354
 					</li>';
355
+	}
343 356
 
344 357
 	// Don't have any reported members right now?
345
-	if (empty($context['reported_members']))
346
-		echo '
358
+	if (empty($context['reported_members'])) {
359
+			echo '
347 360
 					<li>
348 361
 						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
349 362
 					</li>';
363
+	}
350 364
 
351 365
 	echo '
352 366
 				</ul>
@@ -394,11 +408,12 @@  discard block
 block discarded – undo
394 408
 	global $context, $txt, $scripturl;
395 409
 
396 410
 	// Let them know the action was a success.
397
-	if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']]))
398
-		echo '
411
+	if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']])) {
412
+			echo '
399 413
 	<div class="infobox">
400 414
 		', $txt['report_action_' . $context['report_post_action']], '
401 415
 	</div>';
416
+	}
402 417
 
403 418
 	echo '
404 419
 	<form id="reported_members" action="', $scripturl, '?action=moderate;area=reportedmembers;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
@@ -430,8 +445,9 @@  discard block
 block discarded – undo
430 445
 
431 446
 		// Prepare the comments...
432 447
 		$comments = array();
433
-		foreach ($report['comments'] as $comment)
434
-			$comments[$comment['member']['id']] = $comment['member']['link'];
448
+		foreach ($report['comments'] as $comment) {
449
+					$comments[$comment['member']['id']] = $comment['member']['link'];
450
+		}
435 451
 
436 452
 		echo '
437 453
 				', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
@@ -443,13 +459,15 @@  discard block
 block discarded – undo
443 459
 				<li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
444 460
 
445 461
 		// Ban this user button.
446
-		if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id']))
447
-			echo '
462
+		if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id'])) {
463
+					echo '
448 464
 				<li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
465
+		}
449 466
 
450
-		if (!$context['view_closed'])
451
-			echo '
467
+		if (!$context['view_closed']) {
468
+					echo '
452 469
 				<li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';
470
+		}
453 471
 
454 472
 			echo '
455 473
 			</ul>
@@ -457,11 +475,12 @@  discard block
 block discarded – undo
457 475
 	}
458 476
 
459 477
 	// Were none found?
460
-	if (empty($context['reports']))
461
-		echo '
478
+	if (empty($context['reports'])) {
479
+			echo '
462 480
 		<div class="windowbg">
463 481
 			<p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
464 482
 		</div>';
483
+	}
465 484
 
466 485
 	echo '
467 486
 		<div class="pagesection">
@@ -482,11 +501,12 @@  discard block
 block discarded – undo
482 501
 	global $context, $scripturl, $txt;
483 502
 
484 503
 	// Let them know the action was a success.
485
-	if (!empty($context['report_post_action']))
486
-		echo '
504
+	if (!empty($context['report_post_action'])) {
505
+			echo '
487 506
 	<div class="infobox">
488 507
 		', $txt['report_action_' . $context['report_post_action']], '
489 508
 	</div>';
509
+	}
490 510
 
491 511
 	echo '
492 512
 	<div id="modcenter">
@@ -519,14 +539,15 @@  discard block
 block discarded – undo
519 539
 				<h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
520 540
 			</div>';
521 541
 
522
-	foreach ($context['report']['comments'] as $comment)
523
-		echo '
542
+	foreach ($context['report']['comments'] as $comment) {
543
+			echo '
524 544
 			<div class="windowbg">
525 545
 				<p class="smalltext">
526 546
 					', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
527 547
 				</p>
528 548
 				<p>', $comment['message'], '</p>
529 549
 			</div>';
550
+	}
530 551
 
531 552
 	echo '
532 553
 			<br>
@@ -535,11 +556,12 @@  discard block
 block discarded – undo
535 556
 			</div>
536 557
 			<div>';
537 558
 
538
-	if (empty($context['report']['mod_comments']))
539
-		echo '
559
+	if (empty($context['report']['mod_comments'])) {
560
+			echo '
540 561
 				<div class="information">
541 562
 					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
542 563
 				</div>';
564
+	}
543 565
 
544 566
 	foreach ($context['report']['mod_comments'] as $comment)
545 567
 	{
Please login to merge, or discard this patch.