Completed
Pull Request — release-2.1 (#5028)
by 01
06:01
created
Themes/default/ManagePermissions.template.php 1 patch
Braces   +170 added lines, -128 removed lines patch added patch discarded remove patch
@@ -19,26 +19,28 @@  discard block
 block discarded – undo
19 19
 	global $context, $settings, $scripturl, $txt, $modSettings;
20 20
 
21 21
 	// Not allowed to edit?
22
-	if (!$context['can_modify'])
23
-		echo '
22
+	if (!$context['can_modify']) {
23
+			echo '
24 24
 	<div class="errorbox">
25 25
 		', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
26 26
 	</div>';
27
+	}
27 28
 
28 29
 	echo '
29 30
 	<div id="admin_form_wrapper">
30 31
 		<form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">';
31 32
 
32
-	if (!empty($context['profile']))
33
-		echo '
33
+	if (!empty($context['profile'])) {
34
+			echo '
34 35
 			<div class="cat_bar">
35 36
 				<h3 class="catbg">', $txt['permissions_for_profile'], ': &quot;', $context['profile']['name'], '&quot;</h3>
36 37
 			</div>';
37
-	else
38
-		echo '
38
+	} else {
39
+			echo '
39 40
 			<div class="cat_bar">
40 41
 				<h3 class="catbg">', $txt['permissions_title'], '</h3>
41 42
 			</div>';
43
+	}
42 44
 
43 45
 	echo '
44 46
 			<table class="table_grid">
@@ -47,13 +49,14 @@  discard block
 block discarded – undo
47 49
 						<th>', $txt['membergroups_name'], '</th>
48 50
 						<th class="small_table">', $txt['membergroups_members_top'], '</th>';
49 51
 
50
-	if (empty($modSettings['permission_enable_deny']))
51
-		echo '
52
+	if (empty($modSettings['permission_enable_deny'])) {
53
+			echo '
52 54
 						<th class="small_table">', $txt['membergroups_permissions'], '</th>';
53
-	else
54
-		echo '
55
+	} else {
56
+			echo '
55 57
 						<th class="small_table">', $txt['permissions_allowed'], '</th>
56 58
 						<th class="small_table">', $txt['permissions_denied'], '</th>';
59
+	}
57 60
 
58 61
 	echo '
59 62
 						<th class="small_table">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th>
@@ -71,26 +74,28 @@  discard block
 block discarded – undo
71 74
 						<td>
72 75
 							', !empty($group['help']) ? ' <a class="help" href="' . $scripturl . '?action=helpadmin;help=' . $group['help'] . '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a> ' : '<img class="icon" src="' . $settings['images_url'] . '/blank.png" alt="' . $txt['help'] . '">', '<span>', $group['name'], '</span>';
73 76
 
74
-		if (!empty($group['children']))
75
-			echo '
77
+		if (!empty($group['children'])) {
78
+					echo '
76 79
 							<br>
77 80
 							<span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
81
+		}
78 82
 
79 83
 		echo '
80 84
 						</td>
81 85
 						<td>', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>';
82 86
 
83
-		if (empty($modSettings['permission_enable_deny']))
84
-			echo '
87
+		if (empty($modSettings['permission_enable_deny'])) {
88
+					echo '
85 89
 						<td>', $group['num_permissions']['allowed'], '</td>';
86
-		else
87
-			echo '
90
+		} else {
91
+					echo '
88 92
 						<td ', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '>
89 93
 							', $group['num_permissions']['allowed'], '
90 94
 						</td>
91 95
 						<td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>
92 96
 							', $group['num_permissions']['denied'], '
93 97
 						</td>';
98
+		}
94 99
 
95 100
 		echo '
96 101
 						<td>
@@ -141,10 +146,11 @@  discard block
 block discarded – undo
141 146
 							<select name="copy_from">
142 147
 								<option value="empty">(', $txt['permissions_select_membergroup'], ')</option>';
143 148
 
144
-		foreach ($context['groups'] as $group)
145
-			if ($group['id'] != 1)
149
+		foreach ($context['groups'] as $group) {
150
+					if ($group['id'] != 1)
146 151
 				echo '
147 152
 								<option value="', $group['id'], '">', $group['name'], '</option>';
153
+		}
148 154
 
149 155
 		echo '
150 156
 							</select>
@@ -154,9 +160,10 @@  discard block
 block discarded – undo
154 160
 								<option value="add">', $txt['permissions_add'], '...</option>
155 161
 								<option value="clear">', $txt['permissions_remove'], '...</option>';
156 162
 
157
-		if (!empty($modSettings['permission_enable_deny']))
158
-			echo '
163
+		if (!empty($modSettings['permission_enable_deny'])) {
164
+					echo '
159 165
 								<option value="deny">', $txt['permissions_deny'], '...</option>';
166
+		}
160 167
 
161 168
 		echo '
162 169
 							</select>
@@ -167,31 +174,35 @@  discard block
 block discarded – undo
167 174
 
168 175
 		foreach ($context['permissions'] as $permissionType)
169 176
 		{
170
-			if ($permissionType['id'] == 'membergroup' && !empty($context['profile']))
171
-				continue;
177
+			if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) {
178
+							continue;
179
+			}
172 180
 
173 181
 			foreach ($permissionType['columns'] as $column)
174 182
 			{
175 183
 				foreach ($column as $permissionGroup)
176 184
 				{
177
-					if ($permissionGroup['hidden'])
178
-						continue;
185
+					if ($permissionGroup['hidden']) {
186
+											continue;
187
+					}
179 188
 
180 189
 					echo '
181 190
 								<option value="" disabled>[', $permissionGroup['name'], ']</option>';
182 191
 
183 192
 					foreach ($permissionGroup['permissions'] as $perm)
184 193
 					{
185
-						if ($perm['hidden'])
186
-							continue;
194
+						if ($perm['hidden']) {
195
+													continue;
196
+						}
187 197
 
188
-						if ($perm['has_own_any'])
189
-							echo '
198
+						if ($perm['has_own_any']) {
199
+													echo '
190 200
 								<option value="', $permissionType['id'], '/', $perm['own']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['own']['name'], ')</option>
191 201
 								<option value="', $permissionType['id'], '/', $perm['any']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['any']['name'], ')</option>';
192
-						else
193
-							echo '
202
+						} else {
203
+													echo '
194 204
 								<option value="', $permissionType['id'], '/', $perm['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], '</option>';
205
+						}
195 206
 					}
196 207
 				}
197 208
 			}
@@ -256,9 +267,10 @@  discard block
 block discarded – undo
256 267
 				}
257 268
 			</script>';
258 269
 
259
-		if (!empty($context['profile']))
260
-			echo '
270
+		if (!empty($context['profile'])) {
271
+					echo '
261 272
 			<input type="hidden" name="pid" value="', $context['profile']['id'], '">';
273
+		}
262 274
 
263 275
 		echo '
264 276
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -302,9 +314,10 @@  discard block
 block discarded – undo
302 314
 					<h3 class="subbg">', $category['name'], '</h3>
303 315
 				</div>';
304 316
 
305
-		if (!empty($category['boards']))
306
-			echo '
317
+		if (!empty($category['boards'])) {
318
+					echo '
307 319
 				<ul class="perm_boards flow_hidden">';
320
+		}
308 321
 
309 322
 		foreach ($category['boards'] as $board)
310 323
 		{
@@ -320,33 +333,36 @@  discard block
 block discarded – undo
320 333
 				echo '
321 334
 							<select name="boardprofile[', $board['id'], ']">';
322 335
 
323
-				foreach ($context['profiles'] as $id => $profile)
324
-					echo '
336
+				foreach ($context['profiles'] as $id => $profile) {
337
+									echo '
325 338
 								<option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
339
+				}
326 340
 
327 341
 				echo '
328 342
 							</select>';
329
-			}
330
-			else
331
-				echo '
343
+			} else {
344
+							echo '
332 345
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>';
346
+			}
333 347
 
334 348
 			echo '
335 349
 						</span>
336 350
 					</li>';
337 351
 		}
338 352
 
339
-		if (!empty($category['boards']))
340
-			echo '
353
+		if (!empty($category['boards'])) {
354
+					echo '
341 355
 				</ul>';
356
+		}
342 357
 	}
343 358
 
344
-	if ($context['edit_all'])
345
-		echo '
359
+	if ($context['edit_all']) {
360
+			echo '
346 361
 				<input type="submit" name="save_changes" value="', $txt['save'], '" class="button">';
347
-	else
348
-		echo '
362
+	} else {
363
+			echo '
349 364
 				<a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>';
365
+	}
350 366
 
351 367
 	echo '
352 368
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -385,12 +401,13 @@  discard block
 block discarded – undo
385 401
 					<tr class="windowbg">
386 402
 						<td>';
387 403
 
388
-		if (!empty($context['show_rename_boxes']) && $profile['can_edit'])
389
-			echo '
404
+		if (!empty($context['show_rename_boxes']) && $profile['can_edit']) {
405
+					echo '
390 406
 							<input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">';
391
-		else
392
-			echo '
407
+		} else {
408
+					echo '
393 409
 							<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>';
410
+		}
394 411
 
395 412
 		echo '
396 413
 						</td>
@@ -410,9 +427,10 @@  discard block
 block discarded – undo
410 427
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
411 428
 				<input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">';
412 429
 
413
-	if ($context['can_edit_something'])
414
-		echo '
430
+	if ($context['can_edit_something']) {
431
+			echo '
415 432
 				<input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">';
433
+	}
416 434
 
417 435
 	echo '
418 436
 				<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '>
@@ -437,9 +455,10 @@  discard block
 block discarded – undo
437 455
 					<dd>
438 456
 						<select name="copy_from">';
439 457
 
440
-	foreach ($context['profiles'] as $id => $profile)
441
-		echo '
458
+	foreach ($context['profiles'] as $id => $profile) {
459
+			echo '
442 460
 							<option value="', $id, '">', $profile['name'], '</option>';
461
+	}
443 462
 
444 463
 	echo '
445 464
 						</select>
@@ -461,13 +480,13 @@  discard block
 block discarded – undo
461 480
 	global $context, $scripturl, $txt, $modSettings;
462 481
 
463 482
 	// Cannot be edited?
464
-	if (!$context['profile']['can_modify'])
465
-		echo '
483
+	if (!$context['profile']['can_modify']) {
484
+			echo '
466 485
 	<div class="errorbox">
467 486
 		', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
468 487
 	</div>';
469
-	else
470
-		echo '
488
+	} else {
489
+			echo '
471 490
 	<script>
472 491
 		window.smf_usedDeny = false;
473 492
 
@@ -479,26 +498,29 @@  discard block
 block discarded – undo
479 498
 				return true;
480 499
 		}
481 500
 	</script>';
501
+	}
482 502
 
483 503
 	echo '
484 504
 		<form id="permissions" action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" onsubmit="return warnAboutDeny();">';
485 505
 
486
-	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1)
487
-		echo '
506
+	if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) {
507
+			echo '
488 508
 			<div class="information">
489 509
 				', $txt['permissions_option_desc'], '
490 510
 			</div>';
511
+	}
491 512
 
492 513
 	echo '
493 514
 			<div class="cat_bar">
494 515
 				<h3 class="catbg">';
495 516
 
496
-	if ($context['permission_type'] == 'board')
497
-		echo '
517
+	if ($context['permission_type'] == 'board') {
518
+			echo '
498 519
 				', $txt['permissions_local_for'], ' &quot;', $context['group']['name'], '&quot; ', $txt['permissions_on'], ' &quot;', $context['profile']['name'], '&quot;';
499
-	else
500
-		echo '
520
+	} else {
521
+			echo '
501 522
 				', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - &quot;', $context['group']['name'], '&quot;';
523
+	}
502 524
 	echo '
503 525
 				</h3>
504 526
 			</div>';
@@ -521,15 +543,17 @@  discard block
 block discarded – undo
521 543
 		template_modify_group_display('board');
522 544
 	}
523 545
 
524
-	if ($context['profile']['can_modify'])
525
-		echo '
546
+	if ($context['profile']['can_modify']) {
547
+			echo '
526 548
 			<div class="padding">
527 549
 				<input type="submit" value="', $txt['permissions_commit'], '" class="button">
528 550
 			</div>';
551
+	}
529 552
 
530
-	foreach ($context['hidden_perms'] as $hidden_perm)
531
-		echo '
553
+	foreach ($context['hidden_perms'] as $hidden_perm) {
554
+			echo '
532 555
 			<input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">';
556
+	}
533 557
 
534 558
 	echo '
535 559
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -556,17 +580,19 @@  discard block
 block discarded – undo
556 580
 
557 581
 		foreach ($column as $permissionGroup)
558 582
 		{
559
-			if (empty($permissionGroup['permissions']))
560
-				continue;
583
+			if (empty($permissionGroup['permissions'])) {
584
+							continue;
585
+			}
561 586
 
562 587
 			// Are we likely to have something in this group to display or is it all hidden?
563 588
 			$has_display_content = false;
564 589
 			if (!$permissionGroup['hidden'])
565 590
 			{
566 591
 				// Before we go any further check we are going to have some data to print otherwise we just have a silly heading.
567
-				foreach ($permissionGroup['permissions'] as $permission)
568
-					if (!$permission['hidden'])
592
+				foreach ($permissionGroup['permissions'] as $permission) {
593
+									if (!$permission['hidden'])
569 594
 						$has_display_content = true;
595
+				}
570 596
 
571 597
 				if ($has_display_content)
572 598
 				{
@@ -575,10 +601,11 @@  discard block
 block discarded – undo
575 601
 							<th></th>
576 602
 							<th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>';
577 603
 
578
-					if ($context['group']['id'] != -1)
579
-						echo '
604
+					if ($context['group']['id'] != -1) {
605
+											echo '
580 606
 							<th>', $txt['permissions_option_own'], '</th>
581 607
 							<th>', $txt['permissions_option_any'], '</th>';
608
+					}
582 609
 
583 610
 					echo '
584 611
 						</tr>';
@@ -601,17 +628,18 @@  discard block
 block discarded – undo
601 628
 						// Guests can't do their own thing.
602 629
 						if ($context['group']['id'] != -1)
603 630
 						{
604
-							if (empty($modSettings['permission_enable_deny']))
605
-								echo '
631
+							if (empty($modSettings['permission_enable_deny'])) {
632
+															echo '
606 633
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" ', $disable_field, '>';
607
-							else
634
+							} else
608 635
 							{
609 636
 								echo '
610 637
 								<select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>';
611 638
 
612
-								foreach (array('on', 'off', 'deny') as $c)
613
-									echo '
639
+								foreach (array('on', 'off', 'deny') as $c) {
640
+																	echo '
614 641
 									<option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
642
+								}
615 643
 								echo '
616 644
 								</select>';
617 645
 							}
@@ -621,39 +649,41 @@  discard block
 block discarded – undo
621 649
 							<td>';
622 650
 						}
623 651
 
624
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
625
-							echo '
652
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
653
+													echo '
626 654
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>';
627
-						else
655
+						} else
628 656
 						{
629 657
 							echo '
630 658
 								<select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>';
631 659
 
632
-							foreach (array('on', 'off', 'deny') as $c)
633
-								echo '
660
+							foreach (array('on', 'off', 'deny') as $c) {
661
+															echo '
634 662
 									<option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
663
+							}
635 664
 							echo '
636 665
 								</select>';
637 666
 						}
638
-					}
639
-					else
667
+					} else
640 668
 					{
641
-						if ($context['group']['id'] != -1)
642
-							echo '
669
+						if ($context['group']['id'] != -1) {
670
+													echo '
643 671
 							</td>
644 672
 							<td>';
673
+						}
645 674
 
646
-						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
647
-							echo '
675
+						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) {
676
+													echo '
648 677
 								<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>';
649
-						else
678
+						} else
650 679
 						{
651 680
 							echo '
652 681
 								<select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>';
653 682
 
654
-							foreach (array('on', 'off', 'deny') as $c)
655
-								echo '
683
+							foreach (array('on', 'off', 'deny') as $c) {
684
+															echo '
656 685
 									<option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
686
+							}
657 687
 							echo '
658 688
 								</select>';
659 689
 						}
@@ -685,11 +715,11 @@  discard block
 block discarded – undo
685 715
 											<fieldset id="', $context['current_permission'], '">
686 716
 												<legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;" class="toggle_up"> ', $txt['avatar_select_permission'], '</a></legend>';
687 717
 
688
-	if (empty($modSettings['permission_enable_deny']))
689
-		echo '
718
+	if (empty($modSettings['permission_enable_deny'])) {
719
+			echo '
690 720
 												<ul>';
691
-	else
692
-		echo '
721
+	} else {
722
+			echo '
693 723
 												<div class="information">', $txt['permissions_option_desc'], '</div>
694 724
 												<dl class="settings">
695 725
 													<dt>
@@ -699,47 +729,52 @@  discard block
 block discarded – undo
699 729
 													</dt>
700 730
 													<dd>
701 731
 													</dd>';
732
+	}
702 733
 
703 734
 	foreach ($context['member_groups'] as $group)
704 735
 	{
705
-		if (!empty($modSettings['permission_enable_deny']))
706
-			echo '
736
+		if (!empty($modSettings['permission_enable_deny'])) {
737
+					echo '
707 738
 													<dt>';
708
-		else
709
-			echo '
739
+		} else {
740
+					echo '
710 741
 													<li>';
742
+		}
711 743
 
712
-		if (empty($modSettings['permission_enable_deny']))
713
-			echo '
744
+		if (empty($modSettings['permission_enable_deny'])) {
745
+					echo '
714 746
 														<input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>';
715
-		else
716
-			echo '
747
+		} else {
748
+					echo '
717 749
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span>
718 750
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span>
719 751
 														<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>';
752
+		}
720 753
 
721
-		if (!empty($modSettings['permission_enable_deny']))
722
-			echo '
754
+		if (!empty($modSettings['permission_enable_deny'])) {
755
+					echo '
723 756
 													</dt>
724 757
 													<dd>
725 758
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
726 759
 													</dd>';
727
-		else
728
-			echo '
760
+		} else {
761
+					echo '
729 762
 														<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
730 763
 													</li>';
764
+		}
731 765
 	}
732 766
 
733
-	if (empty($modSettings['permission_enable_deny']))
734
-		echo '
767
+	if (empty($modSettings['permission_enable_deny'])) {
768
+			echo '
735 769
 													<li>
736 770
 														<input type="checkbox" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');">
737 771
 														<span>', $txt['check_all'], '</span>
738 772
 													</li>
739 773
 												</ul>';
740
-	else
741
-		echo '
774
+	} else {
775
+			echo '
742 776
 												</dl>';
777
+	}
743 778
 
744 779
 	echo '
745 780
 											</fieldset>
@@ -779,9 +814,10 @@  discard block
 block discarded – undo
779 814
 	if (!empty($modSettings['postmod_active']))
780 815
 	{
781 816
 		// Got advanced permissions - if so warn!
782
-		if (!empty($modSettings['permission_enable_deny']))
783
-			echo '
817
+		if (!empty($modSettings['permission_enable_deny'])) {
818
+					echo '
784 819
 							<div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>';
820
+		}
785 821
 
786 822
 		echo '
787 823
 							<div class="padding">
@@ -796,10 +832,11 @@  discard block
 block discarded – undo
796 832
 									', $txt['permissions_post_moderation_select'], ':
797 833
 									<select name="pid" onchange="document.forms.postmodForm.submit();">';
798 834
 
799
-		foreach ($context['profiles'] as $profile)
800
-			if ($profile['can_modify'])
835
+		foreach ($context['profiles'] as $profile) {
836
+					if ($profile['can_modify'])
801 837
 				echo '
802 838
 										<option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
839
+		}
803 840
 
804 841
 		echo '
805 842
 									</select>
@@ -820,11 +857,12 @@  discard block
 block discarded – undo
820 857
 											', $txt['permissions_post_moderation_replies_any'], '
821 858
 										</th>';
822 859
 
823
-		if ($modSettings['attachmentEnable'] == 1)
824
-			echo '
860
+		if ($modSettings['attachmentEnable'] == 1) {
861
+					echo '
825 862
 										<th class="centercol" colspan="3">
826 863
 											', $txt['permissions_post_moderation_attachments'], '
827 864
 										</th>';
865
+		}
828 866
 
829 867
 		echo '
830 868
 									</tr>
@@ -842,11 +880,12 @@  discard block
 block discarded – undo
842 880
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
843 881
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
844 882
 
845
-		if ($modSettings['attachmentEnable'] == 1)
846
-			echo '
883
+		if ($modSettings['attachmentEnable'] == 1) {
884
+					echo '
847 885
 										<th><span class="generic_icons post_moderation_allow"></span></th>
848 886
 										<th><span class="generic_icons post_moderation_moderate"></span></th>
849 887
 										<th><span class="generic_icons post_moderation_deny"></span></th>';
888
+		}
850 889
 
851 890
 		echo '
852 891
 									</tr>
@@ -860,10 +899,11 @@  discard block
 block discarded – undo
860 899
 										<td class="half_table">
861 900
 											<span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>';
862 901
 
863
-				if (!empty($group['children']))
864
-					echo '
902
+				if (!empty($group['children'])) {
903
+									echo '
865 904
 											<br>
866 905
 											<span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
906
+				}
867 907
 
868 908
 				echo '
869 909
 										</td>
@@ -878,11 +918,11 @@  discard block
 block discarded – undo
878 918
 										</td>';
879 919
 
880 920
 				// Guests can't have "own" permissions
881
-				if ($group['id'] == '-1')
882
-					echo '
921
+				if ($group['id'] == '-1') {
922
+									echo '
883 923
 										<td colspan="3"></td>';
884
-				else
885
-					echo '
924
+				} else {
925
+									echo '
886 926
 										<td class="centercol">
887 927
 											<input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '>
888 928
 										</td>
@@ -892,6 +932,7 @@  discard block
 block discarded – undo
892 932
 										<td class="centercol">
893 933
 											<input type="radio" name="replies_own[', $group['id'], ']" value="disallow"', $group['replies_own'] == 'disallow' ? ' checked' : '', '>
894 934
 										</td>';
935
+				}
895 936
 
896 937
 				echo '
897 938
 										<td class="centercol">
@@ -904,8 +945,8 @@  discard block
 block discarded – undo
904 945
 											<input type="radio" name="replies_any[', $group['id'], ']" value="disallow"', $group['replies_any'] == 'disallow' ? ' checked' : '', '>
905 946
 										</td>';
906 947
 
907
-				if ($modSettings['attachmentEnable'] == 1)
908
-					echo '
948
+				if ($modSettings['attachmentEnable'] == 1) {
949
+									echo '
909 950
 										<td class="centercol">
910 951
 											<input type="radio" name="attachment[', $group['id'], ']" value="allow"', $group['attachment'] == 'allow' ? ' checked' : '', '>
911 952
 										</td>
@@ -915,6 +956,7 @@  discard block
 block discarded – undo
915 956
 										<td class="centercol">
916 957
 											<input type="radio" name="attachment[', $group['id'], ']" value="disallow"', $group['attachment'] == 'disallow' ? ' checked' : '', '>
917 958
 										</td>';
959
+				}
918 960
 
919 961
 				echo '
920 962
 									</tr>';
Please login to merge, or discard this patch.
Themes/default/ManageNews.template.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,9 +18,10 @@  discard block
 block discarded – undo
18 18
 	global $context, $txt, $scripturl;
19 19
 
20 20
 	// Are we done sending the newsletter?
21
-	if (!empty($context['newsletter_sent']))
22
-		echo '
21
+	if (!empty($context['newsletter_sent'])) {
22
+			echo '
23 23
 	<div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>';
24
+	}
24 25
 
25 26
 	echo '
26 27
 		<form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" id="admin_newsletters" class="flow_hidden" accept-charset="', $context['character_set'], '">
@@ -38,9 +39,10 @@  discard block
 block discarded – undo
38 39
 					</dt>
39 40
 					<dd>';
40 41
 
41
-	foreach ($context['groups'] as $group)
42
-		echo '
42
+	foreach ($context['groups'] as $group) {
43
+			echo '
43 44
 						<label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>';
45
+	}
44 46
 
45 47
 	echo '
46 48
 						<br>
@@ -79,9 +81,10 @@  discard block
 block discarded – undo
79 81
 						</dt>
80 82
 						<dd>';
81 83
 
82
-	foreach ($context['groups'] as $group)
83
-		echo '
84
+	foreach ($context['groups'] as $group) {
85
+			echo '
84 86
 							<label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>';
87
+	}
85 88
 
86 89
 	echo '
87 90
 							<br>
@@ -225,9 +228,10 @@  discard block
 block discarded – undo
225 228
 				<div id="bbcBox_message"></div>';
226 229
 
227 230
 	// What about smileys?
228
-	if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
229
-		echo '
231
+	if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) {
232
+			echo '
230 233
 				<div id="smileyBox_message"></div>';
234
+	}
231 235
 
232 236
 	// Show BBC buttons, smileys and textbox.
233 237
 	echo '
@@ -248,9 +252,10 @@  discard block
 block discarded – undo
248 252
 			<input type="hidden" name="email_force" value="', $context['email_force'], '">
249 253
 			<input type="hidden" name="total_emails" value="', $context['total_emails'], '">';
250 254
 
251
-	foreach ($context['recipients'] as $key => $values)
252
-		echo '
255
+	foreach ($context['recipients'] as $key => $values) {
256
+			echo '
253 257
 			<input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">';
258
+	}
254 259
 
255 260
 	echo '
256 261
 			<script>';
@@ -404,9 +409,10 @@  discard block
 block discarded – undo
404 409
 				<input type="hidden" name="parse_html" value="', $context['parse_html'], '">';
405 410
 
406 411
 	// All the things we must remember!
407
-	foreach ($context['recipients'] as $key => $values)
408
-		echo '
412
+	foreach ($context['recipients'] as $key => $values) {
413
+			echo '
409 414
 				<input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">';
415
+	}
410 416
 
411 417
 	echo '
412 418
 			</div><!-- .windowbg -->
@@ -438,9 +444,10 @@  discard block
 block discarded – undo
438 444
 {
439 445
 	global $context, $txt;
440 446
 
441
-	if (!empty($context['saved_successful']))
442
-		echo '
447
+	if (!empty($context['saved_successful'])) {
448
+			echo '
443 449
 			<div class="infobox">', $txt['settings_saved'], '</div>';
450
+	}
444 451
 
445 452
 	template_show_list('news_lists');
446 453
 }
Please login to merge, or discard this patch.
Themes/default/ManageSearch.template.php 1 patch
Braces   +23 added lines, -20 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 		<div class="windowbg">
125 125
 			<dl class="settings">';
126 126
 
127
-	if (!empty($context['table_info']))
128
-		echo '
127
+	if (!empty($context['table_info'])) {
128
+			echo '
129 129
 				<dt>
130 130
 					<strong>', $txt['search_method_messages_table_space'], ':</strong>
131 131
 				</dt>
@@ -138,6 +138,7 @@  discard block
 block discarded – undo
138 138
 				<dd>
139 139
 					', $context['table_info']['index_length'], '
140 140
 				</dd>';
141
+	}
141 142
 	echo '
142 143
 			</dl>
143 144
 			', $context['double_index'] ? '<div class="noticebox">
@@ -160,17 +161,17 @@  discard block
 block discarded – undo
160 161
 					<dd>
161 162
 						<span class="smalltext">';
162 163
 
163
-		if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext']))
164
-			echo '
164
+		if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) {
165
+					echo '
165 166
 							<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]';
166
-
167
-		elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext']))
168
-			echo '
167
+		} elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) {
168
+					echo '
169 169
 							<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create'];
170
-		else
171
-			echo '
170
+		} else {
171
+					echo '
172 172
 							<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br>
173 173
 							<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length'];
174
+		}
174 175
 		echo '
175 176
 						</span>
176 177
 					</dd>';
@@ -184,26 +185,27 @@  discard block
 block discarded – undo
184 185
 					<dd>
185 186
 						<span class="smalltext">';
186 187
 
187
-	if ($context['custom_index'])
188
-		echo '
188
+	if ($context['custom_index']) {
189
+			echo '
189 190
 							<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br>
190 191
 							<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
191
-
192
-	elseif ($context['partial_custom_index'])
193
-		echo '
192
+	} elseif ($context['partial_custom_index']) {
193
+			echo '
194 194
 							<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br>
195 195
 							<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
196
-	else
197
-		echo '
196
+	} else {
197
+			echo '
198 198
 							<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]';
199
+	}
199 200
 	echo '
200 201
 						</span>
201 202
 					</dd>';
202 203
 
203 204
 	foreach ($context['search_apis'] as $api)
204 205
 	{
205
-		if (empty($api['label']) || $api['has_template'])
206
-			continue;
206
+		if (empty($api['label']) || $api['has_template']) {
207
+					continue;
208
+		}
207 209
 
208 210
 		echo '
209 211
 					<dt>
@@ -211,11 +213,12 @@  discard block
 block discarded – undo
211 213
 						', $api['label'], '
212 214
 					</dt>';
213 215
 
214
-		if ($api['desc'])
215
-			echo '
216
+		if ($api['desc']) {
217
+					echo '
216 218
 					<dd>
217 219
 						<span class="smalltext">', $api['desc'], '</span>
218 220
 					</dd>';
221
+		}
219 222
 	}
220 223
 
221 224
 	echo '
Please login to merge, or discard this patch.
Sources/tasks/CreatePost-Notify.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 {
20 20
 	/**
21 21
 	 * Constants for receiving email notfications.
22
-	*/
22
+	 */
23 23
 	const RECEIVE_NOTIFY_EMAIL = 0x02;
24 24
 	const RECEIVE_NOTIFY_ALERT = 0x01;
25 25
 
26 26
 	/**
27 27
 	 * Constants for reply types.
28
-	*/
28
+	 */
29 29
 	const NOTIFY_TYPE_REPLY_AND_MODIFY = 1;
30 30
 	const NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING = 2;
31 31
 	const NOTIFY_TYPE_ONLY_REPLIES = 3;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 	/**
35 35
 	 * Constants for frequencies.
36
-	*/
36
+	 */
37 37
 	const FREQUENCY_NOTHING = 0;
38 38
 	const FREQUENCY_EVERYTHING = 1;
39 39
 	const FREQUENCY_FIRST_UNREAD_MSG = 2;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	const FREQUENCY_WEEKLY_DIGEST = 4;
42 42
 
43 43
 	/**
44
-     * This handles notifications when a new post is created - new topic, reply, quotes and mentions.
44
+	 * This handles notifications when a new post is created - new topic, reply, quotes and mentions.
45 45
 	 * @return bool Always returns true
46 46
 	 */
47 47
 	public function execute()
Please login to merge, or discard this patch.
Braces   +74 added lines, -54 removed lines patch added patch discarded remove patch
@@ -96,8 +96,9 @@  discard block
 block discarded – undo
96 96
 		while ($row = $smcFunc['db_fetch_assoc']($request))
97 97
 		{
98 98
 			$groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups'])));
99
-			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0)
100
-				continue;
99
+			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) {
100
+							continue;
101
+			}
101 102
 
102 103
 			$members[] = $row['id_member'];
103 104
 			$watched[$row['id_member']] = $row;
@@ -105,8 +106,9 @@  discard block
 block discarded – undo
105 106
 
106 107
 		$smcFunc['db_free_result']($request);
107 108
 
108
-		if (empty($members))
109
-			return true;
109
+		if (empty($members)) {
110
+					return true;
111
+		}
110 112
 
111 113
 		$members = array_unique($members);
112 114
 		$prefs = getNotifyPrefs($members, '', true);
@@ -122,8 +124,9 @@  discard block
 block discarded – undo
122 124
 		self::handleQuoteNotifications($msgOptions, $posterOptions, $quotedMembers, $prefs, $done_members, $alert_rows);
123 125
 
124 126
 		// Save ourselves a bit of work in the big loop below
125
-		foreach ($done_members as $done_member)
126
-			unset($watched[$done_member]);
127
+		foreach ($done_members as $done_member) {
128
+					unset($watched[$done_member]);
129
+		}
127 130
 
128 131
 		// Handle rest of the notifications for watched topics and boards
129 132
 		foreach ($watched as $member => $data)
@@ -132,26 +135,31 @@  discard block
 block discarded – undo
132 135
 			$notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : self::NOTIFY_TYPE_REPLY_AND_MODIFY;
133 136
 
134 137
 			// Don't send a notification if the watching member ignored the member who made the action.
135
-			if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list'])))
136
-				continue;
137
-			if (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING && $member != $data['id_member_started'])
138
-				continue;
139
-			elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id'])
140
-				continue;
141
-			elseif (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_ONLY_REPLIES)
142
-				continue;
143
-			elseif ($notify_types == self::NOTIFY_TYPE_NOTHING)
144
-				continue;
138
+			if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) {
139
+							continue;
140
+			}
141
+			if (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING && $member != $data['id_member_started']) {
142
+							continue;
143
+			} elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) {
144
+							continue;
145
+			} elseif (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_ONLY_REPLIES) {
146
+							continue;
147
+			} elseif ($notify_types == self::NOTIFY_TYPE_NOTHING) {
148
+							continue;
149
+			}
145 150
 
146 151
 			// Don't send a notification if they don't want any...
147
-			if (in_array($frequency, array(self::FREQUENCY_NOTHING, self::FREQUENCY_DAILY_DIGEST, self::FREQUENCY_WEEKLY_DIGEST)))
148
-				continue;
152
+			if (in_array($frequency, array(self::FREQUENCY_NOTHING, self::FREQUENCY_DAILY_DIGEST, self::FREQUENCY_WEEKLY_DIGEST))) {
153
+							continue;
154
+			}
149 155
 			// ... or if we already sent one and they don't want more...
150
-			elseif ($frequency === self::FREQUENCY_FIRST_UNREAD_MSG && $data['sent'])
151
-				continue;
156
+			elseif ($frequency === self::FREQUENCY_FIRST_UNREAD_MSG && $data['sent']) {
157
+							continue;
158
+			}
152 159
 			// ... or if they aren't on the bouncer's list.
153
-			elseif (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))
154
-				continue;
160
+			elseif (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only'])) {
161
+							continue;
162
+			}
155 163
 
156 164
 			// Watched topic?
157 165
 			if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member]))
@@ -161,10 +169,12 @@  discard block
 block discarded – undo
161 169
 
162 170
 				if ($type == 'reply')
163 171
 				{
164
-					if (!empty($prefs[$member]['msg_receive_body']))
165
-						$message_type .= '_body';
166
-					if (!empty($frequency))
167
-						$message_type .= '_once';
172
+					if (!empty($prefs[$member]['msg_receive_body'])) {
173
+											$message_type .= '_body';
174
+					}
175
+					if (!empty($frequency)) {
176
+											$message_type .= '_once';
177
+					}
168 178
 				}
169 179
 
170 180
 				$content_type = 'topic';
@@ -177,12 +187,14 @@  discard block
 block discarded – undo
177 187
 				$content_type = 'board';
178 188
 
179 189
 				$message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards';
180
-				if (!empty($prefs[$member]['msg_receive_body']))
181
-					$message_type .= '_body';
190
+				if (!empty($prefs[$member]['msg_receive_body'])) {
191
+									$message_type .= '_body';
192
+				}
182 193
 			}
183 194
 			// If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip
184
-			else
185
-				continue;
195
+			else {
196
+							continue;
197
+			}
186 198
 
187 199
 			// Bitwise check: Receiving a email notification?
188 200
 			if ($pref & self::RECEIVE_NOTIFY_EMAIL)
@@ -199,8 +211,9 @@  discard block
 block discarded – undo
199 211
 				$mail_result = sendmail($data['email_address'], $emaildata['subject'], $emaildata['body'], null, 'm' . $topicOptions['id'], $emaildata['is_html']);
200 212
 
201 213
 				// We failed, don't trigger a alert as we don't have a way to attempt to resend just the email currently.
202
-				if ($mail_result === false)
203
-					continue;
214
+				if ($mail_result === false) {
215
+									continue;
216
+				}
204 217
 			}
205 218
 
206 219
 			// Bitwise check: Receiving a alert?
@@ -251,14 +264,15 @@  discard block
 block discarded – undo
251 264
 		);
252 265
 
253 266
 		// Insert the alerts if any
254
-		if (!empty($alert_rows))
255
-			$smcFunc['db_insert']('',
267
+		if (!empty($alert_rows)) {
268
+					$smcFunc['db_insert']('',
256 269
 				'{db_prefix}user_alerts',
257 270
 				array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string',
258 271
 					'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'),
259 272
 				$alert_rows,
260 273
 				array()
261 274
 			);
275
+		}
262 276
 
263 277
 		return true;
264 278
 	}
@@ -269,8 +283,9 @@  discard block
 block discarded – undo
269 283
 
270 284
 		foreach ($quotedMembers as $id => $member)
271 285
 		{
272
-			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote']))
273
-				continue;
286
+			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) {
287
+							continue;
288
+			}
274 289
 
275 290
 			$done_members[] = $id;
276 291
 
@@ -324,32 +339,35 @@  discard block
 block discarded – undo
324 339
 		{
325 340
 			if (preg_match('/\[quote(.*)?\]/i', $block, $matches))
326 341
 			{
327
-				if ($quote_level == 0)
328
-					$message .= '[quote' . $matches[1] . ']';
342
+				if ($quote_level == 0) {
343
+									$message .= '[quote' . $matches[1] . ']';
344
+				}
329 345
 				$quote_level++;
330
-			}
331
-			elseif (preg_match('/\[\/quote\]/i', $block))
346
+			} elseif (preg_match('/\[\/quote\]/i', $block))
332 347
 			{
333
-				if ($quote_level <= 1)
334
-					$message .= '[/quote]';
348
+				if ($quote_level <= 1) {
349
+									$message .= '[/quote]';
350
+				}
335 351
 				if ($quote_level >= 1)
336 352
 				{
337 353
 					$quote_level--;
338 354
 					$message .= "\n";
339 355
 				}
356
+			} elseif ($quote_level <= 1) {
357
+							$message .= $block;
340 358
 			}
341
-			elseif ($quote_level <= 1)
342
-				$message .= $block;
343 359
 		}
344 360
 
345 361
 		preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches);
346 362
 
347 363
 		$id_msgs = $matches[1];
348
-		foreach ($id_msgs as $k => $id_msg)
349
-			$id_msgs[$k] = (int) $id_msg;
364
+		foreach ($id_msgs as $k => $id_msg) {
365
+					$id_msgs[$k] = (int) $id_msg;
366
+		}
350 367
 
351
-		if (empty($id_msgs))
352
-			return array();
368
+		if (empty($id_msgs)) {
369
+					return array();
370
+		}
353 371
 
354 372
 		// Get the messages
355 373
 		$request = $smcFunc['db_query']('', '
@@ -367,8 +385,9 @@  discard block
 block discarded – undo
367 385
 		$members = array();
368 386
 		while ($row = $smcFunc['db_fetch_assoc']($request))
369 387
 		{
370
-			if ($posterOptions['id'] == $row['id_member'])
371
-				continue;
388
+			if ($posterOptions['id'] == $row['id_member']) {
389
+							continue;
390
+			}
372 391
 
373 392
 			$members[$row['id_member']] = $row;
374 393
 		}
@@ -382,10 +401,11 @@  discard block
 block discarded – undo
382 401
 
383 402
 		foreach ($members as $id => $member)
384 403
 		{
385
-			if (!empty($prefs[$id]['msg_mention']))
386
-				$done_members[] = $id;
387
-			else
388
-				continue;
404
+			if (!empty($prefs[$id]['msg_mention'])) {
405
+							$done_members[] = $id;
406
+			} else {
407
+							continue;
408
+			}
389 409
 
390 410
 			// Alerts' emails are always instant
391 411
 			if ($prefs[$id]['msg_mention'] & self::RECEIVE_NOTIFY_EMAIL)
Please login to merge, or discard this patch.
Sources/ManageMail.php 1 patch
Braces   +30 added lines, -21 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
  * Main dispatcher. This function checks permissions and passes control through to the relevant section.
@@ -246,8 +247,9 @@  discard block
 block discarded – undo
246 247
 	while ($row = $smcFunc['db_fetch_assoc']($request))
247 248
 	{
248 249
 		// Private PM/email subjects and similar shouldn't be shown in the mailbox area.
249
-		if (!empty($row['private']))
250
-			$row['subject'] = $txt['personal_message'];
250
+		if (!empty($row['private'])) {
251
+					$row['subject'] = $txt['personal_message'];
252
+		}
251 253
 
252 254
 		$mails[] = $row;
253 255
 	}
@@ -301,8 +303,9 @@  discard block
 block discarded – undo
301 303
 		$element = substr($key, strrpos($key, '_') + 1);
302 304
 		$processedBirthdayEmails[$index][$element] = $value;
303 305
 	}
304
-	foreach ($processedBirthdayEmails as $index => $dummy)
305
-		$emails[$index] = $index;
306
+	foreach ($processedBirthdayEmails as $index => $dummy) {
307
+			$emails[$index] = $index;
308
+	}
306 309
 
307 310
 	$config_vars = array(
308 311
 			// Mail queue stuff, this rocks ;)
@@ -323,8 +326,9 @@  discard block
 block discarded – undo
323 326
 
324 327
 	call_integration_hook('integrate_modify_mail_settings', array(&$config_vars));
325 328
 
326
-	if ($return_config)
327
-		return $config_vars;
329
+	if ($return_config) {
330
+			return $config_vars;
331
+	}
328 332
 
329 333
 	// Saving?
330 334
 	if (isset($_GET['save']))
@@ -399,9 +403,9 @@  discard block
 block discarded – undo
399 403
 		);
400 404
 		list ($_GET['te']) = $smcFunc['db_fetch_row']($request);
401 405
 		$smcFunc['db_free_result']($request);
406
+	} else {
407
+			$_GET['te'] = (int) $_GET['te'];
402 408
 	}
403
-	else
404
-		$_GET['te'] = (int) $_GET['te'];
405 409
 
406 410
 	$_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0;
407 411
 
@@ -425,12 +429,14 @@  discard block
 block discarded – undo
425 429
 
426 430
 	// Try get more time...
427 431
 	@set_time_limit(600);
428
-	if (function_exists('apache_reset_timeout'))
429
-		@apache_reset_timeout();
432
+	if (function_exists('apache_reset_timeout')) {
433
+			@apache_reset_timeout();
434
+	}
430 435
 
431 436
 	// Have we already used our maximum time?
432
-	if ((time() - $time_start) < 5)
433
-		return;
437
+	if ((time() - $time_start) < 5) {
438
+			return;
439
+	}
434 440
 
435 441
 	$context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id'];
436 442
 	$context['page_title'] = $txt['not_done_title'];
@@ -480,9 +486,10 @@  discard block
 block discarded – undo
480 486
 	}
481 487
 
482 488
 	// The result.
483
-	if (isset($_GET['result']))
484
-		$context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure');
485
-}
489
+	if (isset($_GET['result'])) {
490
+			$context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure');
491
+	}
492
+	}
486 493
 
487 494
 /**
488 495
  * Little utility function to calculate how long ago a time was.
@@ -494,8 +501,9 @@  discard block
 block discarded – undo
494 501
 {
495 502
 	global $txt;
496 503
 
497
-	if ($time_diff < 0)
498
-		$time_diff = 0;
504
+	if ($time_diff < 0) {
505
+			$time_diff = 0;
506
+	}
499 507
 
500 508
 	// Just do a bit of an if fest...
501 509
 	if ($time_diff > 86400)
@@ -516,8 +524,9 @@  discard block
 block discarded – undo
516 524
 		return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes);
517 525
 	}
518 526
 	// Otherwise must be second
519
-	else
520
-		return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff);
521
-}
527
+	else {
528
+			return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff);
529
+	}
530
+	}
522 531
 
523 532
 ?>
524 533
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/ManageMail.template.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,9 +48,10 @@
 block discarded – undo
48 48
 	global $context, $txt;
49 49
 
50 50
 	// The results.
51
-	if (!empty($context['result']))
52
-		echo '
51
+	if (!empty($context['result'])) {
52
+			echo '
53 53
 					<div class="', $context['result'] == 'success' ? 'infobox' : 'errorbox', '">', $txt['mailtest_result_' . $context['result']], '</div>';
54
+	}
54 55
 
55 56
 	echo '
56 57
 	<form id="admin_form_wrapper" action="', $context['post_url'], '" method="post">
Please login to merge, or discard this patch.
Themes/default/PersonalMessage.template.php 2 patches
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>
@@ -744,11 +790,12 @@  discard block
 block discarded – undo
744 790
 {
745 791
 	global $context, $scripturl, $txt;
746 792
 
747
-	if (!empty($context['search_errors']))
748
-		echo '
793
+	if (!empty($context['search_errors'])) {
794
+			echo '
749 795
 		<div class="errorbox">
750 796
 			', implode('<br>', $context['search_errors']['messages']), '
751 797
 		</div>';
798
+	}
752 799
 
753 800
 	echo '
754 801
 	<form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">
@@ -816,9 +863,10 @@  discard block
 block discarded – undo
816 863
 				</dd>
817 864
 			</dl>';
818 865
 
819
-	if (!$context['currently_using_labels'])
820
-		echo '
866
+	if (!$context['currently_using_labels']) {
867
+			echo '
821 868
 				<input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button floatright">';
869
+	}
822 870
 
823 871
 	echo '
824 872
 		</div><!-- .roundframe -->';
@@ -837,12 +885,13 @@  discard block
 block discarded – undo
837 885
 				<div id="advanced_panel_div">
838 886
 					<ul id="searchLabelsExpand">';
839 887
 
840
-		foreach ($context['search_labels'] as $label)
841
-			echo '
888
+		foreach ($context['search_labels'] as $label) {
889
+					echo '
842 890
 						<li>
843 891
 							<label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '>
844 892
 							', $label['name'], '</label>
845 893
 						</li>';
894
+		}
846 895
 
847 896
 		echo '
848 897
 					</ul>
@@ -904,8 +953,8 @@  discard block
 block discarded – undo
904 953
 		</div>';
905 954
 
906 955
 	// Complete results?
907
-	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
908
-		echo '
956
+	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) {
957
+			echo '
909 958
 		<table class="table_grid">
910 959
 			<thead>
911 960
 				<tr class="title_bar">
@@ -915,6 +964,7 @@  discard block
 block discarded – undo
915 964
 				</tr>
916 965
 			</thead>
917 966
 			<tbody>';
967
+	}
918 968
 
919 969
 	// Print each message out...
920 970
 	foreach ($context['personal_messages'] as $message)
@@ -934,12 +984,14 @@  discard block
 block discarded – undo
934 984
 
935 985
 			// Show the recipients.
936 986
 			// @todo This doesn't deal with the sent item searching quite right for bcc.
937
-			if (!empty($message['recipients']['to']))
938
-				echo implode(', ', $message['recipients']['to']);
987
+			if (!empty($message['recipients']['to'])) {
988
+							echo implode(', ', $message['recipients']['to']);
989
+			}
939 990
 
940 991
 			// Otherwise, we're just going to say "some people"...
941
-			elseif ($context['folder'] != 'sent')
942
-				echo '(', $txt['pm_undisclosed_recipients'], ')';
992
+			elseif ($context['folder'] != 'sent') {
993
+							echo '(', $txt['pm_undisclosed_recipients'], ')';
994
+			}
943 995
 
944 996
 			echo '
945 997
 				</h3>
@@ -954,15 +1006,17 @@  discard block
 block discarded – undo
954 1006
 				$reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"');
955 1007
 
956 1008
 				// You can only reply if they are not a guest...
957
-				if (!$message['member']['is_guest'])
958
-					echo '
1009
+				if (!$message['member']['is_guest']) {
1010
+									echo '
959 1011
 					<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'], '
960 1012
 					<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'];
1013
+				}
961 1014
 
962 1015
 				// This is for "forwarding" - even if the member is gone.
963
-				else
964
-					echo '
1016
+				else {
1017
+									echo '
965 1018
 					<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'];
1019
+				}
966 1020
 			}
967 1021
 
968 1022
 			echo '
@@ -971,27 +1025,30 @@  discard block
 block discarded – undo
971 1025
 		}
972 1026
 		// Otherwise just a simple list!
973 1027
 		// @todo No context at all of the search?
974
-		else
975
-			echo '
1028
+		else {
1029
+					echo '
976 1030
 				<tr class="windowbg">
977 1031
 					<td>', $message['time'], '</td>
978 1032
 					<td>', $message['link'], '</td>
979 1033
 					<td>', $message['member']['link'], '</td>
980 1034
 				</tr>';
1035
+		}
981 1036
 	}
982 1037
 
983 1038
 	// Finish off the page...
984
-	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
985
-		echo '
1039
+	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) {
1040
+			echo '
986 1041
 			</tbody>
987 1042
 		</table>';
1043
+	}
988 1044
 
989 1045
 	// No results?
990
-	if (empty($context['personal_messages']))
991
-		echo '
1046
+	if (empty($context['personal_messages'])) {
1047
+			echo '
992 1048
 		<div class="windowbg">
993 1049
 			<p class="centertext">', $txt['pm_search_none_found'], '</p>
994 1050
 		</div>';
1051
+	}
995 1052
 
996 1053
 	echo '
997 1054
 		<div class="pagesection">
@@ -1016,15 +1073,17 @@  discard block
 block discarded – undo
1016 1073
 		</div>
1017 1074
 		<div class="windowbg">';
1018 1075
 
1019
-		if (!empty($context['send_log']['sent']))
1020
-			foreach ($context['send_log']['sent'] as $log_entry)
1076
+		if (!empty($context['send_log']['sent'])) {
1077
+					foreach ($context['send_log']['sent'] as $log_entry)
1021 1078
 				echo '
1022 1079
 			<span class="error">', $log_entry, '</span><br>';
1080
+		}
1023 1081
 
1024
-		if (!empty($context['send_log']['failed']))
1025
-			foreach ($context['send_log']['failed'] as $log_entry)
1082
+		if (!empty($context['send_log']['failed'])) {
1083
+					foreach ($context['send_log']['failed'] as $log_entry)
1026 1084
 				echo '
1027 1085
 			<span class="error">', $log_entry, '</span><br>';
1086
+		}
1028 1087
 
1029 1088
 		echo '
1030 1089
 		</div>
@@ -1070,12 +1129,13 @@  discard block
 block discarded – undo
1070 1129
 					</dl>
1071 1130
 				</div>';
1072 1131
 
1073
-	if (!empty($modSettings['drafts_pm_enabled']))
1074
-		echo '
1132
+	if (!empty($modSettings['drafts_pm_enabled'])) {
1133
+			echo '
1075 1134
 				<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>',
1076 1135
 					sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), '
1077 1136
 					', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), '
1078 1137
 				</div>';
1138
+	}
1079 1139
 
1080 1140
 	echo '
1081 1141
 				<dl id="post_header">';
@@ -1141,22 +1201,24 @@  discard block
 block discarded – undo
1141 1201
 						<dt><strong>', $txt['subject'], '</strong></dt>
1142 1202
 						<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
1143 1203
 
1144
-		foreach ($context['drafts'] as $draft)
1145
-			echo '
1204
+		foreach ($context['drafts'] as $draft) {
1205
+					echo '
1146 1206
 						<dt>', $draft['link'], '</dt>
1147 1207
 						<dd>', $draft['poster_time'], '</dd>';
1208
+		}
1148 1209
 		echo '
1149 1210
 					</dl>
1150 1211
 				</div>';
1151 1212
 	}
1152 1213
 
1153 1214
 	// Require an image to be typed to save spamming?
1154
-	if ($context['require_verification'])
1155
-		echo '
1215
+	if ($context['require_verification']) {
1216
+			echo '
1156 1217
 				<div class="post_verification">
1157 1218
 					<strong>', $txt['pm_visual_verification_label'], ':</strong>
1158 1219
 					', template_control_verification($context['visual_verification_id'], 'all'), '
1159 1220
 				</div>';
1221
+	}
1160 1222
 
1161 1223
 	// Send, Preview, spellcheck buttons.
1162 1224
 	echo '
@@ -1274,8 +1336,8 @@  discard block
 block discarded – undo
1274 1336
 			}';
1275 1337
 
1276 1338
 	// Code for showing and hiding drafts
1277
-	if (!empty($context['drafts']))
1278
-		echo '
1339
+	if (!empty($context['drafts'])) {
1340
+			echo '
1279 1341
 			var oSwapDraftOptions = new smc_Toggle({
1280 1342
 				bToggleEnabled: true,
1281 1343
 				bCurrentlyCollapsed: true,
@@ -1297,13 +1359,14 @@  discard block
 block discarded – undo
1297 1359
 					}
1298 1360
 				]
1299 1361
 			});';
1362
+	}
1300 1363
 
1301 1364
 	echo '
1302 1365
 		</script>';
1303 1366
 
1304 1367
 	// Show the message you're replying to.
1305
-	if ($context['reply'])
1306
-		echo '
1368
+	if ($context['reply']) {
1369
+			echo '
1307 1370
 		<br><br>
1308 1371
 		<div class="cat_bar">
1309 1372
 			<h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3>
@@ -1317,6 +1380,7 @@  discard block
 block discarded – undo
1317 1380
 			', $context['quoted_message']['body'], '
1318 1381
 		</div>
1319 1382
 		<br class="clear">';
1383
+	}
1320 1384
 
1321 1385
 	echo '
1322 1386
 		<script>
@@ -1328,23 +1392,25 @@  discard block
 block discarded – undo
1328 1392
 				sToControlId: \'to_control\',
1329 1393
 				aToRecipients: [';
1330 1394
 
1331
-	foreach ($context['recipients']['to'] as $i => $member)
1332
-		echo '
1395
+	foreach ($context['recipients']['to'] as $i => $member) {
1396
+			echo '
1333 1397
 					{
1334 1398
 						sItemId: ', JavaScriptEscape($member['id']), ',
1335 1399
 						sItemName: ', JavaScriptEscape($member['name']), '
1336 1400
 					}', $i == count($context['recipients']['to']) - 1 ? '' : ',';
1401
+	}
1337 1402
 
1338 1403
 	echo '
1339 1404
 				],
1340 1405
 				aBccRecipients: [';
1341 1406
 
1342
-	foreach ($context['recipients']['bcc'] as $i => $member)
1343
-		echo '
1407
+	foreach ($context['recipients']['bcc'] as $i => $member) {
1408
+			echo '
1344 1409
 					{
1345 1410
 						sItemId: ', JavaScriptEscape($member['id']), ',
1346 1411
 						sItemName: ', JavaScriptEscape($member['name']), '
1347 1412
 					}', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
1413
+	}
1348 1414
 
1349 1415
 	echo '
1350 1416
 				],
@@ -1433,26 +1499,28 @@  discard block
 block discarded – undo
1433 1499
 					</th>
1434 1500
 					<th class="centertext table_icon">';
1435 1501
 
1436
-	if (count($context['labels']) > 2)
1437
-		echo '
1502
+	if (count($context['labels']) > 2) {
1503
+			echo '
1438 1504
 						<input type="checkbox" onclick="invertAll(this, this.form);">';
1505
+	}
1439 1506
 
1440 1507
 	echo '
1441 1508
 					</th>
1442 1509
 				</tr>
1443 1510
 			</thead>
1444 1511
 			<tbody>';
1445
-	if (count($context['labels']) < 2)
1446
-		echo '
1512
+	if (count($context['labels']) < 2) {
1513
+			echo '
1447 1514
 				<tr class="windowbg">
1448 1515
 					<td colspan="2">', $txt['pm_labels_no_exist'], '</td>
1449 1516
 				</tr>';
1450
-	else
1517
+	} else
1451 1518
 	{
1452 1519
 		foreach ($context['labels'] as $label)
1453 1520
 		{
1454
-			if ($label['id'] == -1)
1455
-				continue;
1521
+			if ($label['id'] == -1) {
1522
+							continue;
1523
+			}
1456 1524
 
1457 1525
 				echo '
1458 1526
 				<tr class="windowbg">
@@ -1467,12 +1535,13 @@  discard block
 block discarded – undo
1467 1535
 			</tbody>
1468 1536
 		</table>';
1469 1537
 
1470
-	if (!count($context['labels']) < 2)
1471
-		echo '
1538
+	if (!count($context['labels']) < 2) {
1539
+			echo '
1472 1540
 		<div class="block righttext">
1473 1541
 			<input type="submit" name="save" value="', $txt['save'], '" class="button">
1474 1542
 			<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure">
1475 1543
 		</div>';
1544
+	}
1476 1545
 
1477 1546
 	echo '
1478 1547
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1528,9 +1597,10 @@  discard block
 block discarded – undo
1528 1597
 					<select name="id_admin">
1529 1598
 						<option value="0">', $txt['pm_report_all_admins'], '</option>';
1530 1599
 
1531
-		foreach ($context['admins'] as $id => $name)
1532
-			echo '
1600
+		foreach ($context['admins'] as $id => $name) {
1601
+					echo '
1533 1602
 						<option value="', $id, '">', $name, '</option>';
1603
+		}
1534 1604
 
1535 1605
 		echo '
1536 1606
 					</select>
@@ -1593,9 +1663,10 @@  discard block
 block discarded – undo
1593 1663
 					</th>
1594 1664
 					<th class="centertext table_icon">';
1595 1665
 
1596
-	if (!empty($context['rules']))
1597
-		echo '
1666
+	if (!empty($context['rules'])) {
1667
+			echo '
1598 1668
 						<input type="checkbox" onclick="invertAll(this, this.form);">';
1669
+	}
1599 1670
 
1600 1671
 	echo '
1601 1672
 					</th>
@@ -1603,16 +1674,17 @@  discard block
 block discarded – undo
1603 1674
 			</thead>
1604 1675
 			<tbody>';
1605 1676
 
1606
-	if (empty($context['rules']))
1607
-		echo '
1677
+	if (empty($context['rules'])) {
1678
+			echo '
1608 1679
 				<tr class="windowbg">
1609 1680
 					<td colspan="2">
1610 1681
 						', $txt['pm_rules_none'], '
1611 1682
 					</td>
1612 1683
 				</tr>';
1684
+	}
1613 1685
 
1614
-	foreach ($context['rules'] as $rule)
1615
-		echo '
1686
+	foreach ($context['rules'] as $rule) {
1687
+			echo '
1616 1688
 				<tr class="windowbg">
1617 1689
 					<td>
1618 1690
 						<a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a>
@@ -1621,6 +1693,7 @@  discard block
 block discarded – undo
1621 1693
 						<input type="checkbox" name="delrule[', $rule['id'], ']">
1622 1694
 					</td>
1623 1695
 				</tr>';
1696
+	}
1624 1697
 
1625 1698
 	echo '
1626 1699
 			</tbody>
@@ -1628,14 +1701,16 @@  discard block
 block discarded – undo
1628 1701
 		<div class="righttext">
1629 1702
 			<a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>';
1630 1703
 
1631
-	if (!empty($context['rules']))
1632
-		echo '
1704
+	if (!empty($context['rules'])) {
1705
+			echo '
1633 1706
 			[<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>]';
1707
+	}
1634 1708
 
1635
-	if (!empty($context['rules']))
1636
-		echo '
1709
+	if (!empty($context['rules'])) {
1710
+			echo '
1637 1711
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1638 1712
 			<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">';
1713
+	}
1639 1714
 
1640 1715
 	echo '
1641 1716
 		</div>
@@ -1657,14 +1732,16 @@  discard block
 block discarded – undo
1657 1732
 		var groups = new Array()
1658 1733
 		var labels = new Array()';
1659 1734
 
1660
-	foreach ($context['groups'] as $id => $title)
1661
-		echo '
1735
+	foreach ($context['groups'] as $id => $title) {
1736
+			echo '
1662 1737
 		groups[', $id, '] = "', addslashes($title), '";';
1738
+	}
1663 1739
 
1664
-	foreach ($context['labels'] as $label)
1665
-		if ($label['id'] != -1)
1740
+	foreach ($context['labels'] as $label) {
1741
+			if ($label['id'] != -1)
1666 1742
 			echo '
1667 1743
 		labels[', ($label['id']), '] = "', addslashes($label['name']), '";';
1744
+	}
1668 1745
 
1669 1746
 	echo '
1670 1747
 		function addCriteriaOption()
@@ -1679,8 +1756,9 @@  discard block
 block discarded – undo
1679 1756
 
1680 1757
 			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>';
1681 1758
 
1682
-	foreach ($context['groups'] as $id => $group)
1683
-		echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>';
1759
+	foreach ($context['groups'] as $id => $group) {
1760
+			echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>';
1761
+	}
1684 1762
 
1685 1763
 	echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\');
1686 1764
 			}
@@ -1697,9 +1775,10 @@  discard block
 block discarded – undo
1697 1775
 
1698 1776
 				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>';
1699 1777
 
1700
-	foreach ($context['labels'] as $label)
1701
-		if ($label['id'] != -1)
1778
+	foreach ($context['labels'] as $label) {
1779
+			if ($label['id'] != -1)
1702 1780
 			echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>';
1781
+	}
1703 1782
 
1704 1783
 	echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\');
1705 1784
 			}
@@ -1813,19 +1892,20 @@  discard block
 block discarded – undo
1813 1892
 	$isFirst = true;
1814 1893
 	foreach ($context['rule']['criteria'] as $k => $criteria)
1815 1894
 	{
1816
-		if (!$isFirst && $criteria['t'] == '')
1817
-			echo '<div id="removeonjs1">';
1818
-
1819
-		elseif (!$isFirst)
1820
-			echo '<br>';
1895
+		if (!$isFirst && $criteria['t'] == '') {
1896
+					echo '<div id="removeonjs1">';
1897
+		} elseif (!$isFirst) {
1898
+					echo '<br>';
1899
+		}
1821 1900
 
1822 1901
 		echo '
1823 1902
 				<select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();">
1824 1903
 					<option value="">', $txt['pm_rule_criteria_pick'], ':</option>';
1825 1904
 
1826
-		foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr)
1827
-			echo '
1905
+		foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) {
1906
+					echo '
1828 1907
 					<option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>';
1908
+		}
1829 1909
 
1830 1910
 		echo '
1831 1911
 				</select>
@@ -1836,19 +1916,20 @@  discard block
 block discarded – undo
1836 1916
 					<select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();">
1837 1917
 						<option value="">', $txt['pm_rule_sel_group'], '</option>';
1838 1918
 
1839
-		foreach ($context['groups'] as $id => $group)
1840
-			echo '
1919
+		foreach ($context['groups'] as $id => $group) {
1920
+					echo '
1841 1921
 						<option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>';
1922
+		}
1842 1923
 		echo '
1843 1924
 					</select>
1844 1925
 				</span>';
1845 1926
 
1846 1927
 		// If this is the dummy we add a means to hide for non js users.
1847
-		if ($isFirst)
1848
-			$isFirst = false;
1849
-
1850
-		elseif ($criteria['t'] == '')
1851
-			echo '</div><!-- .removeonjs1 -->';
1928
+		if ($isFirst) {
1929
+					$isFirst = false;
1930
+		} elseif ($criteria['t'] == '') {
1931
+					echo '</div><!-- .removeonjs1 -->';
1932
+		}
1852 1933
 	}
1853 1934
 
1854 1935
 	echo '
@@ -1871,10 +1952,11 @@  discard block
 block discarded – undo
1871 1952
 	$isFirst = true;
1872 1953
 	foreach ($context['rule']['actions'] as $k => $action)
1873 1954
 	{
1874
-		if (!$isFirst && $action['t'] == '')
1875
-			echo '<div id="removeonjs2">';
1876
-		elseif (!$isFirst)
1877
-			echo '<br>';
1955
+		if (!$isFirst && $action['t'] == '') {
1956
+					echo '<div id="removeonjs2">';
1957
+		} elseif (!$isFirst) {
1958
+					echo '<br>';
1959
+		}
1878 1960
 
1879 1961
 		echo '
1880 1962
 				<select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();">
@@ -1886,20 +1968,21 @@  discard block
 block discarded – undo
1886 1968
 					<select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();">
1887 1969
 						<option value="">', $txt['pm_rule_sel_label'], '</option>';
1888 1970
 
1889
-		foreach ($context['labels'] as $label)
1890
-			if ($label['id'] != -1)
1971
+		foreach ($context['labels'] as $label) {
1972
+					if ($label['id'] != -1)
1891 1973
 				echo '
1892 1974
 						<option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>';
1975
+		}
1893 1976
 
1894 1977
 		echo '
1895 1978
 					</select>
1896 1979
 				</span>';
1897 1980
 
1898
-		if ($isFirst)
1899
-			$isFirst = false;
1900
-
1901
-		elseif ($action['t'] == '')
1902
-			echo '</div><!-- .removeonjs2 -->';
1981
+		if ($isFirst) {
1982
+					$isFirst = false;
1983
+		} elseif ($action['t'] == '') {
1984
+					echo '</div><!-- .removeonjs2 -->';
1985
+		}
1903 1986
 	}
1904 1987
 
1905 1988
 	echo '
@@ -1923,22 +2006,25 @@  discard block
 block discarded – undo
1923 2006
 		echo '
1924 2007
 	<script>';
1925 2008
 
1926
-	foreach ($context['rule']['criteria'] as $k => $c)
1927
-		echo '
2009
+	foreach ($context['rule']['criteria'] as $k => $c) {
2010
+			echo '
1928 2011
 			updateRuleDef(', $k, ');';
2012
+	}
1929 2013
 
1930
-	foreach ($context['rule']['actions'] as $k => $c)
1931
-		echo '
2014
+	foreach ($context['rule']['actions'] as $k => $c) {
2015
+			echo '
1932 2016
 			updateActionDef(', $k, ');';
2017
+	}
1933 2018
 
1934 2019
 	echo '
1935 2020
 			rebuildRuleDesc();';
1936 2021
 
1937 2022
 	// If this isn't a new rule and we have JS enabled remove the JS compatibility stuff.
1938
-	if ($context['rid'])
1939
-		echo '
2023
+	if ($context['rid']) {
2024
+			echo '
1940 2025
 			document.getElementById("removeonjs1").style.display = "none";
1941 2026
 			document.getElementById("removeonjs2").style.display = "none";';
2027
+	}
1942 2028
 
1943 2029
 	echo '
1944 2030
 			document.getElementById("addonjs1").style.display = "";
@@ -1966,12 +2052,12 @@  discard block
 block discarded – undo
1966 2052
 		</div>';
1967 2053
 
1968 2054
 	// No drafts? Just show an informative message.
1969
-	if (empty($context['drafts']))
1970
-		echo '
2055
+	if (empty($context['drafts'])) {
2056
+			echo '
1971 2057
 		<div class="windowbg centertext">
1972 2058
 			', $txt['draft_none'], '
1973 2059
 		</div>';
1974
-	else
2060
+	} else
1975 2061
 	{
1976 2062
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
1977 2063
 		foreach ($context['drafts'] as $draft)
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 				foreach ($message['custom_fields']['above_member'] as $custom)
232 232
 					echo '
233
-							<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
233
+							<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
234 234
 
235 235
 				echo '
236 236
 						</ul>
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 			if (!empty($message['custom_fields']['below_avatar']))
280 280
 				foreach ($message['custom_fields']['below_avatar'] as $custom)
281 281
 					echo '
282
-						<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
282
+						<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
283 283
 
284 284
 			if (!$message['member']['is_guest'])
285 285
 				echo '
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 					foreach ($message['custom_fields']['icons'] as $custom)
323 323
 						echo '
324
-								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
324
+								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
325 325
 
326 326
 					echo '
327 327
 							</ol>
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 				if (!empty($message['custom_fields']['standard']))
386 386
 					foreach ($message['custom_fields']['standard'] as $custom)
387 387
 						echo '
388
-						<li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>';
388
+						<li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>';
389 389
 
390 390
 				// Are we showing the warning status?
391 391
 				if ($message['member']['can_see_warning'])
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 				if (!empty($message['custom_fields']['bottom_poster']))
397 397
 					foreach ($message['custom_fields']['bottom_poster'] as $custom)
398 398
 						echo '
399
-						<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
399
+						<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
400 400
 			}
401 401
 
402 402
 			// Done with the information about the poster... on to the post itself.
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
 				foreach ($message['custom_fields']['above_signature'] as $custom)
499 499
 					echo '
500
-								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
500
+								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
501 501
 
502 502
 				echo '
503 503
 							</ul>
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
 				foreach ($message['custom_fields']['below_signature'] as $custom)
522 522
 					echo '
523
-								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
523
+								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
524 524
 
525 525
 				echo '
526 526
 							</ul>
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	while ($message = $context['get_pmessage']('subject'))
657 657
 	{
658 658
 		echo '
659
-			<tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '','">
659
+			<tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '', '">
660 660
 				<td class="table_icon pm_icon">
661 661
 					<script>
662 662
 						currentLabels[', $message['id'], '] = {';
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 				<td class="pm_time">', $message['time'], '</td>
681 681
 				<td class="pm_subject">
682 682
 					', ($context['display_mode'] != 0 && $context['current_pm'] == $message['id'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt="*">' : ''), '<a href="', ($context['display_mode'] == 0 || $context['current_pm'] == $message['id'] ? '' : ($scripturl . '?action=pm;pmid=' . $message['id'] . ';kstart;f=' . $context['folder'] . ';start=' . $context['start'] . ';sort=' . $context['sort_by'] . ($context['sort_direction'] == 'up' ? ';' : ';desc') . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : ''))), '#msg', $message['id'], '">', $message['subject'], $message['is_unread'] ? '&nbsp;<span class="new_posts">' . $txt['new'] . '</span>' : '', '</a>
683
-					<span class="pm_inline_time"><span class="generic_icons ', ($context['from_or_to']=='to' && count($message['recipients']['to'])>1) ? 'people' : 'members', '"></span> ', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), '  <span class="generic_icons time_online"></span> ', $message['time'], '</span>
683
+					<span class="pm_inline_time"><span class="generic_icons ', ($context['from_or_to'] == 'to' && count($message['recipients']['to']) > 1) ? 'people' : 'members', '"></span> ', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), '  <span class="generic_icons time_online"></span> ', $message['time'], '</span>
684 684
 				</td>
685 685
 				<td class="pm_from_to">
686 686
 					', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), '
@@ -957,13 +957,13 @@  discard block
 block discarded – undo
957 957
 				// You can only reply if they are not a guest...
958 958
 				if (!$message['member']['is_guest'])
959 959
 					echo '
960
-					<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'], '
961
-					<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'];
960
+					<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'], '
961
+					<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'];
962 962
 
963 963
 				// This is for "forwarding" - even if the member is gone.
964 964
 				else
965 965
 					echo '
966
-					<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'];
966
+					<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'];
967 967
 			}
968 968
 
969 969
 			echo '
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 				<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
1064 1064
 					<dl>
1065 1065
 						<dt>
1066
-							<strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
1066
+							<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
1067 1067
 						</dt>
1068 1068
 						<dd class="error" id="error_list">
1069 1069
 							', empty($context['post_error']['messages']) ? '' : implode('<br>', $context['post_error']['messages']), '
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 						<span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' id="caption_subject">', $txt['subject'], ':</span>
1120 1120
 					</dt>
1121 1121
 					<dd id="pm_subject">
1122
-						<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"',isset($context['post_error']['no_subject']) ? ' class="error"' : '', '>
1122
+						<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', '>
1123 1123
 					</dd>
1124 1124
 				</dl>';
1125 1125
 
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 		echo '
1473 1473
 		<div class="block righttext">
1474 1474
 			<input type="submit" name="save" value="', $txt['save'], '" class="button">
1475
-			<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure">
1475
+			<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'], '" class="button you_sure">
1476 1476
 		</div>';
1477 1477
 
1478 1478
 	echo '
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 	if (!empty($context['rules']))
1637 1637
 		echo '
1638 1638
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1639
-			<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">';
1639
+			<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'], '" class="button smalltext you_sure">';
1640 1640
 
1641 1641
 	echo '
1642 1642
 		</div>
@@ -1879,9 +1879,9 @@  discard block
 block discarded – undo
1879 1879
 
1880 1880
 		echo '
1881 1881
 				<select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();">
1882
-					<option value="">', $txt['pm_rule_sel_action'] , ':</option>
1883
-					<option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'] , '</option>
1884
-					<option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'] , '</option>
1882
+					<option value="">', $txt['pm_rule_sel_action'], ':</option>
1883
+					<option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'], '</option>
1884
+					<option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'], '</option>
1885 1885
 				</select>
1886 1886
 				<span id="labdiv', $k, '">
1887 1887
 					<select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();">
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
 			</div>
1994 1994
 			<ul class="quickbuttons">
1995 1995
 				<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;id_draft=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons modifybutton"></span>', $txt['draft_edit'], '</a></li>
1996
-				<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'] ,'?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li>
1996
+				<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'], '?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li>
1997 1997
 			</ul>
1998 1998
 		</div><!-- .windowbg -->';
1999 1999
 		}
Please login to merge, or discard this patch.
Sources/Notify.php 1 patch
Braces   +20 added lines, -18 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
  * Turn off/on notification for a particular board.
@@ -34,8 +35,9 @@  discard block
 block discarded – undo
34 35
 	is_not_guest();
35 36
 
36 37
 	// You have to specify a board to turn notifications on!
37
-	if (empty($board))
38
-		fatal_lang_error('no_board', false);
38
+	if (empty($board)) {
39
+			fatal_lang_error('no_board', false);
40
+	}
39 41
 
40 42
 	// No subaction: find out what to do.
41 43
 	if (isset($_GET['mode']))
@@ -48,16 +50,16 @@  discard block
 block discarded – undo
48 50
 		require_once($sourcedir . '/Subs-Notify.php');
49 51
 		setNotifyPrefs($user_info['id'], array('board_notify_' . $board => $alertPref));
50 52
 
51
-		if ($mode > 1)
52
-			// Turn notification on.  (note this just blows smoke if it's already on.)
53
+		if ($mode > 1) {
54
+					// Turn notification on.  (note this just blows smoke if it's already on.)
53 55
 			$smcFunc['db_insert']('ignore',
54 56
 				'{db_prefix}log_notify',
55 57
 				array('id_member' => 'int', 'id_board' => 'int'),
56 58
 				array($user_info['id'], $board),
57 59
 				array('id_member', 'id_board')
58 60
 			);
59
-		else
60
-			$smcFunc['db_query']('', '
61
+		} else {
62
+					$smcFunc['db_query']('', '
61 63
 				DELETE FROM {db_prefix}log_notify
62 64
 				WHERE id_member = {int:current_member}
63 65
 				AND id_board = {int:current_board}',
@@ -66,6 +68,7 @@  discard block
 block discarded – undo
66 68
 					'current_member' => $user_info['id'],
67 69
 				)
68 70
 			);
71
+		}
69 72
 	}
70 73
 
71 74
 	// Back to the board!
@@ -80,10 +83,10 @@  discard block
 block discarded – undo
80 83
 			),
81 84
 		);
82 85
 		$context['sub_template'] = 'generic_xml';
86
+	} else {
87
+			redirectexit('board=' . $board . '.' . $_REQUEST['start']);
88
+	}
83 89
 	}
84
-	else
85
-		redirectexit('board=' . $board . '.' . $_REQUEST['start']);
86
-}
87 90
 
88 91
 /**
89 92
  * Turn off/on unread replies subscription for a topic as well as sets individual topic's alert preferences
@@ -128,8 +131,7 @@  discard block
 block discarded – undo
128 131
 					'id_msg' => 0,
129 132
 					'unwatched' => empty($mode) ? 1 : 0,
130 133
 				);
131
-			}
132
-			else
134
+			} else
133 135
 			{
134 136
 				$insert = false;
135 137
 				$log['unwatched'] = empty($mode) ? 1 : 0;
@@ -156,9 +158,8 @@  discard block
 block discarded – undo
156 158
 					array($user_info['id'], $log['id_topic']),
157 159
 					array('id_member', 'id_board')
158 160
 				);
159
-			}
160
-			else
161
-				$smcFunc['db_query']('', '
161
+			} else {
162
+							$smcFunc['db_query']('', '
162 163
 					DELETE FROM {db_prefix}log_notify
163 164
 					WHERE id_topic = {int:topic}
164 165
 						AND id_member = {int:member}',
@@ -166,6 +167,7 @@  discard block
 block discarded – undo
166 167
 						'topic' => $log['id_topic'],
167 168
 						'member' => $user_info['id'],
168 169
 					));
170
+			}
169 171
 		}
170 172
 	}
171 173
 
@@ -181,9 +183,9 @@  discard block
 block discarded – undo
181 183
 			),
182 184
 		);
183 185
 		$context['sub_template'] = 'generic_xml';
186
+	} else {
187
+			redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
188
+	}
184 189
 	}
185
-	else
186
-		redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
187
-}
188 190
 
189 191
 ?>
190 192
\ No newline at end of file
Please login to merge, or discard this patch.
Sources/RepairBoards.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 					LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
247 247
 				WHERE t.id_topic IS NULL
248 248
 				GROUP BY m.id_topic, m.id_board',
249
-			'fix_processing' => function ($row) use ($smcFunc)
249
+			'fix_processing' => function($row) use ($smcFunc)
250 250
 			{
251 251
 				global $salvageBoardID;
252 252
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			// Remove all topics that have zero messages in the messages table.
333 333
 			'fix_collect' => array(
334 334
 				'index' => 'id_topic',
335
-				'process' => function ($topics) use ($smcFunc)
335
+				'process' => function($topics) use ($smcFunc)
336 336
 				{
337 337
 					$smcFunc['db_query']('', '
338 338
 						DELETE FROM {db_prefix}topics
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 				  AND p.id_poll IS NULL
370 370
 				GROUP BY o.id_poll, t.id_topic, t.id_board, t.id_member_started, m.member_name
371 371
 				  ',
372
-			'fix_processing' => function ($row) use ($smcFunc, $txt)
372
+			'fix_processing' => function($row) use ($smcFunc, $txt)
373 373
 			{
374 374
 				global $salvageBoardID;
375 375
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 					LEFT JOIN {db_prefix}topics AS t ON (t.id_poll = p.id_poll)
507 507
 				WHERE p.id_poll BETWEEN {STEP_LOW} AND {STEP_HIGH}
508 508
 					AND t.id_poll IS NULL',
509
-			'fix_processing' => function ($row) use ($smcFunc, $txt)
509
+			'fix_processing' => function($row) use ($smcFunc, $txt)
510 510
 			{
511 511
 				global $salvageBoardID;
512 512
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 				WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH}
618 618
 				GROUP BY t.id_topic, t.id_first_msg, t.id_last_msg, t.approved, mf.approved
619 619
 				ORDER BY t.id_topic',
620
-			'fix_processing' => function ($row) use ($smcFunc)
620
+			'fix_processing' => function($row) use ($smcFunc)
621 621
 			{
622 622
 				$row['firstmsg_approved'] = (int) $row['firstmsg_approved'];
623 623
 				$row['myid_first_msg'] = (int) $row['myid_first_msg'];
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 					)
647 647
 				);
648 648
 			},
649
-			'message_function' => function ($row) use ($txt, &$context)
649
+			'message_function' => function($row) use ($txt, &$context)
650 650
 			{
651 651
 				// A pretend error?
652 652
 				if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved'])
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 				WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH}
681 681
 				GROUP BY t.id_topic, t.num_replies, mf.approved
682 682
 				ORDER BY t.id_topic',
683
-			'fix_processing' => function ($row)
683
+			'fix_processing' => function($row)
684 684
 			{
685 685
 				global $smcFunc;
686 686
 				$row['my_num_replies'] = (int) $row['my_num_replies'];
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 					)
700 700
 				);
701 701
 			},
702
-			'message_function' => function ($row)
702
+			'message_function' => function($row)
703 703
 			{
704 704
 				global $txt, $context;
705 705
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 				GROUP BY t.id_topic, t.unapproved_posts
731 731
 				HAVING unapproved_posts != COUNT(mu.id_msg)
732 732
 				ORDER BY t.id_topic',
733
-			'fix_processing' => function ($row)
733
+			'fix_processing' => function($row)
734 734
 			{
735 735
 				global $smcFunc;
736 736
 				$row['my_unapproved_posts'] = (int) $row['my_unapproved_posts'];
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 				WHERE b.id_board IS NULL
771 771
 					AND t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH}
772 772
 				GROUP BY t.id_board',
773
-			'fix_processing' => function ($row)
773
+			'fix_processing' => function($row)
774 774
 			{
775 775
 				global $smcFunc, $salvageCatID, $txt;
776 776
 				createSalvageArea();
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 				ORDER BY b.id_cat, b.id_board',
818 818
 			'fix_collect' => array(
819 819
 				'index' => 'id_cat',
820
-				'process' => function ($cats)
820
+				'process' => function($cats)
821 821
 				{
822 822
 					global $smcFunc, $salvageCatID;
823 823
 					createSalvageArea();
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 			// Last step-make sure all non-guest posters still exist.
854 854
 			'fix_collect' => array(
855 855
 				'index' => 'id_msg',
856
-				'process' => function ($msgs)
856
+				'process' => function($msgs)
857 857
 				{
858 858
 					global $smcFunc;
859 859
 					$smcFunc['db_query']('', '
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 				ORDER BY b.id_parent, b.id_board',
881 881
 			'fix_collect' => array(
882 882
 				'index' => 'id_parent',
883
-				'process' => function ($parents)
883
+				'process' => function($parents)
884 884
 				{
885 885
 					global $smcFunc, $salvageBoardID, $salvageCatID;
886 886
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 					AND p.id_poll IS NULL',
918 918
 			'fix_collect' => array(
919 919
 				'index' => 'id_poll',
920
-				'process' => function ($polls)
920
+				'process' => function($polls)
921 921
 				{
922 922
 					global $smcFunc;
923 923
 					$smcFunc['db_query']('', '
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 				ORDER BY cal.id_topic',
950 950
 			'fix_collect' => array(
951 951
 				'index' => 'id_topic',
952
-				'process' => function ($events)
952
+				'process' => function($events)
953 953
 				{
954 954
 					global $smcFunc;
955 955
 					$smcFunc['db_query']('', '
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 					AND lt.id_member BETWEEN {STEP_LOW} AND {STEP_HIGH}',
980 980
 			'fix_collect' => array(
981 981
 				'index' => 'id_topic',
982
-				'process' => function ($topics)
982
+				'process' => function($topics)
983 983
 				{
984 984
 					global $smcFunc;
985 985
 					$smcFunc['db_query']('', '
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 				GROUP BY lt.id_member',
1010 1010
 			'fix_collect' => array(
1011 1011
 				'index' => 'id_member',
1012
-				'process' => function ($members)
1012
+				'process' => function($members)
1013 1013
 				{
1014 1014
 					global $smcFunc;
1015 1015
 					$smcFunc['db_query']('', '
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 				GROUP BY lb.id_board',
1040 1040
 			'fix_collect' => array(
1041 1041
 				'index' => 'id_board',
1042
-				'process' => function ($boards)
1042
+				'process' => function($boards)
1043 1043
 				{
1044 1044
 					global $smcFunc;
1045 1045
 					$smcFunc['db_query']('', '
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 				GROUP BY lb.id_member',
1070 1070
 			'fix_collect' => array(
1071 1071
 				'index' => 'id_member',
1072
-				'process' => function ($members) use ($smcFunc)
1072
+				'process' => function($members) use ($smcFunc)
1073 1073
 				{
1074 1074
 					$smcFunc['db_query']('', '
1075 1075
 						DELETE FROM {db_prefix}log_boards
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 				GROUP BY lmr.id_board',
1099 1099
 			'fix_collect' => array(
1100 1100
 				'index' => 'id_board',
1101
-				'process' => function ($boards) use ($smcFunc)
1101
+				'process' => function($boards) use ($smcFunc)
1102 1102
 				{
1103 1103
 					$smcFunc['db_query']('', '
1104 1104
 						DELETE FROM {db_prefix}log_mark_read
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 				GROUP BY lmr.id_member',
1128 1128
 			'fix_collect' => array(
1129 1129
 				'index' => 'id_member',
1130
-				'process' => function ($members) use ($smcFunc)
1130
+				'process' => function($members) use ($smcFunc)
1131 1131
 				{
1132 1132
 					$smcFunc['db_query']('', '
1133 1133
 						DELETE FROM {db_prefix}log_mark_read
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 				GROUP BY pmr.id_pm',
1157 1157
 			'fix_collect' => array(
1158 1158
 				'index' => 'id_pm',
1159
-				'process' => function ($pms) use ($smcFunc)
1159
+				'process' => function($pms) use ($smcFunc)
1160 1160
 				{
1161 1161
 					$smcFunc['db_query']('', '
1162 1162
 						DELETE FROM {db_prefix}pm_recipients
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 				GROUP BY pmr.id_member',
1187 1187
 			'fix_collect' => array(
1188 1188
 				'index' => 'id_member',
1189
-				'process' => function ($members)
1189
+				'process' => function($members)
1190 1190
 				{
1191 1191
 					global $smcFunc;
1192 1192
 					$smcFunc['db_query']('', '
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 					AND mem.id_member IS NULL',
1217 1217
 			'fix_collect' => array(
1218 1218
 				'index' => 'id_pm',
1219
-				'process' => function ($guestMessages)
1219
+				'process' => function($guestMessages)
1220 1220
 				{
1221 1221
 					global $smcFunc;
1222 1222
 					$smcFunc['db_query']('', '
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 				GROUP BY ln.id_member',
1247 1247
 			'fix_collect' => array(
1248 1248
 				'index' => 'id_member',
1249
-				'process' => function ($members) use ($smcFunc)
1249
+				'process' => function($members) use ($smcFunc)
1250 1250
 				{
1251 1251
 					$smcFunc['db_query']('', '
1252 1252
 						DELETE FROM {db_prefix}log_notify
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 					LEFT JOIN {db_prefix}log_search_subjects AS lss ON (lss.id_topic = t.id_topic)
1274 1274
 				WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH}
1275 1275
 					AND lss.id_topic IS NULL',
1276
-			'fix_full_processing' => function ($result)
1276
+			'fix_full_processing' => function($result)
1277 1277
 			{
1278 1278
 				global $smcFunc;
1279 1279
 
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 						array('word', 'id_topic')
1303 1303
 					);
1304 1304
 			},
1305
-			'message_function' => function ($row)
1305
+			'message_function' => function($row)
1306 1306
 			{
1307 1307
 				global $txt, $context;
1308 1308
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 					AND t.id_topic IS NULL',
1331 1331
 			'fix_collect' => array(
1332 1332
 				'index' => 'id_topic',
1333
-				'process' => function ($deleteTopics)
1333
+				'process' => function($deleteTopics)
1334 1334
 				{
1335 1335
 					global $smcFunc;
1336 1336
 					$smcFunc['db_query']('', '
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 					AND mem.id_member IS NULL',
1361 1361
 			'fix_collect' => array(
1362 1362
 				'index' => 'id_member',
1363
-				'process' => function ($members)
1363
+				'process' => function($members)
1364 1364
 				{
1365 1365
 					global $smcFunc;
1366 1366
 					$smcFunc['db_query']('', '
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 					AND p.id_poll IS NULL',
1390 1390
 			'fix_collect' => array(
1391 1391
 				'index' => 'id_poll',
1392
-				'process' => function ($polls)
1392
+				'process' => function($polls)
1393 1393
 				{
1394 1394
 					global $smcFunc;
1395 1395
 					$smcFunc['db_query']('', '
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 					AND lrc.id_report IS NULL',
1419 1419
 			'fix_collect' => array(
1420 1420
 				'index' => 'id_report',
1421
-				'process' => function ($reports)
1421
+				'process' => function($reports)
1422 1422
 				{
1423 1423
 					global $smcFunc;
1424 1424
 					$smcFunc['db_query']('', '
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 					AND lr.id_report IS NULL',
1448 1448
 			'fix_collect' => array(
1449 1449
 				'index' => 'id_report',
1450
-				'process' => function ($reports)
1450
+				'process' => function($reports)
1451 1451
 				{
1452 1452
 					global $smcFunc;
1453 1453
 					$smcFunc['db_query']('', '
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 				GROUP BY lgr.id_member',
1478 1478
 			'fix_collect' => array(
1479 1479
 				'index' => 'id_member',
1480
-				'process' => function ($members)
1480
+				'process' => function($members)
1481 1481
 				{
1482 1482
 					global $smcFunc;
1483 1483
 					$smcFunc['db_query']('', '
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 				GROUP BY lgr.id_group',
1508 1508
 			'fix_collect' => array(
1509 1509
 				'index' => 'id_group',
1510
-				'process' => function ($groups)
1510
+				'process' => function($groups)
1511 1511
 				{
1512 1512
 					global $smcFunc;
1513 1513
 					$smcFunc['db_query']('', '
Please login to merge, or discard this patch.
Braces   +119 added lines, -85 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
  * Finds or repairs errors in the database to fix possible problems.
@@ -50,8 +51,9 @@  discard block
 block discarded – undo
50 51
 	);
51 52
 
52 53
 	// Start displaying errors without fixing them.
53
-	if (isset($_GET['fixErrors']))
54
-		checkSession('get');
54
+	if (isset($_GET['fixErrors'])) {
55
+			checkSession('get');
56
+	}
55 57
 
56 58
 	// Will want this.
57 59
 	loadForumTests();
@@ -69,14 +71,14 @@  discard block
 block discarded – undo
69 71
 			$_SESSION['repairboards_to_fix'] = $context['to_fix'];
70 72
 			$_SESSION['repairboards_to_fix2'] = null;
71 73
 
72
-			if (empty($context['repair_errors']))
73
-				$context['repair_errors'][] = '???';
74
+			if (empty($context['repair_errors'])) {
75
+							$context['repair_errors'][] = '???';
76
+			}
74 77
 		}
75 78
 
76 79
 		// Need a token here.
77 80
 		createToken('admin-repairboards', 'request');
78
-	}
79
-	else
81
+	} else
80 82
 	{
81 83
 		// Validate the token, create a new one and tell the not done template.
82 84
 		validateToken('admin-repairboards', 'request');
@@ -134,16 +136,19 @@  discard block
 block discarded – undo
134 136
 
135 137
 	// More time, I need more time!
136 138
 	@set_time_limit(600);
137
-	if (function_exists('apache_reset_timeout'))
138
-		@apache_reset_timeout();
139
+	if (function_exists('apache_reset_timeout')) {
140
+			@apache_reset_timeout();
141
+	}
139 142
 
140 143
 	// Errr, wait.  How much time has this taken already?
141
-	if (!$force && (time() - $time_start) < 3)
142
-		return;
144
+	if (!$force && (time() - $time_start) < 3) {
145
+			return;
146
+	}
143 147
 
144 148
 	// Restore the query cache if interested.
145
-	if (!empty($db_temp_cache))
146
-		$db_cache = $db_temp_cache;
149
+	if (!empty($db_temp_cache)) {
150
+			$db_cache = $db_temp_cache;
151
+	}
147 152
 
148 153
 	$context['continue_get_data'] = '?action=admin;area=repairboards' . (isset($_GET['fixErrors']) ? ';fixErrors' : '') . ';step=' . $_GET['step'] . ';substep=' . $_GET['substep'] . ';' . $context['session_var'] . '=' . $context['session_id'];
149 154
 	$context['page_title'] = $txt['not_done_title'];
@@ -152,10 +157,11 @@  discard block
 block discarded – undo
152 157
 	$context['sub_template'] = 'not_done';
153 158
 
154 159
 	// Change these two if more steps are added!
155
-	if (empty($max_substep))
156
-		$context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']);
157
-	else
158
-		$context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']);
160
+	if (empty($max_substep)) {
161
+			$context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']);
162
+	} else {
163
+			$context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']);
164
+	}
159 165
 
160 166
 	// Never more than 100%!
161 167
 	$context['continue_percent'] = min($context['continue_percent'], 100);
@@ -624,8 +630,9 @@  discard block
 block discarded – undo
624 630
 				$row['myid_last_msg'] = (int) $row['myid_last_msg'];
625 631
 
626 632
 				// Not really a problem?
627
-				if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved'])
628
-					return false;
633
+				if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) {
634
+									return false;
635
+				}
629 636
 
630 637
 				$memberStartedID = (int) getMsgMemberID($row['myid_first_msg']);
631 638
 				$memberUpdatedID = (int) getMsgMemberID($row['myid_last_msg']);
@@ -649,15 +656,19 @@  discard block
 block discarded – undo
649 656
 			'message_function' => function ($row) use ($txt, &$context)
650 657
 			{
651 658
 				// A pretend error?
652
-				if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved'])
653
-					return false;
659
+				if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) {
660
+									return false;
661
+				}
654 662
 
655
-				if ($row['id_first_msg'] != $row['myid_first_msg'])
656
-					$context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']);
657
-				if ($row['id_last_msg'] != $row['myid_last_msg'])
658
-					$context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']);
659
-				if ($row['approved'] != $row['firstmsg_approved'])
660
-					$context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']);
663
+				if ($row['id_first_msg'] != $row['myid_first_msg']) {
664
+									$context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']);
665
+				}
666
+				if ($row['id_last_msg'] != $row['myid_last_msg']) {
667
+									$context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']);
668
+				}
669
+				if ($row['approved'] != $row['firstmsg_approved']) {
670
+									$context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']);
671
+				}
661 672
 
662 673
 				return true;
663 674
 			},
@@ -686,8 +697,9 @@  discard block
 block discarded – undo
686 697
 				$row['my_num_replies'] = (int) $row['my_num_replies'];
687 698
 
688 699
 				// Not really a problem?
689
-				if ($row['my_num_replies'] == $row['num_replies'])
690
-					return false;
700
+				if ($row['my_num_replies'] == $row['num_replies']) {
701
+									return false;
702
+				}
691 703
 
692 704
 				$smcFunc['db_query']('', '
693 705
 					UPDATE {db_prefix}topics
@@ -704,11 +716,13 @@  discard block
 block discarded – undo
704 716
 				global $txt, $context;
705 717
 
706 718
 				// Just joking?
707
-				if ($row['my_num_replies'] == $row['num_replies'])
708
-					return false;
719
+				if ($row['my_num_replies'] == $row['num_replies']) {
720
+									return false;
721
+				}
709 722
 
710
-				if ($row['num_replies'] != $row['my_num_replies'])
711
-					$context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']);
723
+				if ($row['num_replies'] != $row['my_num_replies']) {
724
+									$context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']);
725
+				}
712 726
 
713 727
 				return true;
714 728
 			},
@@ -1280,8 +1294,9 @@  discard block
 block discarded – undo
1280 1294
 				$inserts = array();
1281 1295
 				while ($row = $smcFunc['db_fetch_assoc']($result))
1282 1296
 				{
1283
-					foreach (text2words($row['subject']) as $word)
1284
-						$inserts[] = array($word, $row['id_topic']);
1297
+					foreach (text2words($row['subject']) as $word) {
1298
+											$inserts[] = array($word, $row['id_topic']);
1299
+					}
1285 1300
 					if (count($inserts) > 500)
1286 1301
 					{
1287 1302
 						$smcFunc['db_insert']('ignore',
@@ -1294,13 +1309,14 @@  discard block
 block discarded – undo
1294 1309
 					}
1295 1310
 				}
1296 1311
 
1297
-				if (!empty($inserts))
1298
-					$smcFunc['db_insert']('ignore',
1312
+				if (!empty($inserts)) {
1313
+									$smcFunc['db_insert']('ignore',
1299 1314
 						'{db_prefix}log_search_subjects',
1300 1315
 						array('word' => 'string', 'id_topic' => 'int'),
1301 1316
 						$inserts,
1302 1317
 						array('word', 'id_topic')
1303 1318
 					);
1319
+				}
1304 1320
 			},
1305 1321
 			'message_function' => function ($row)
1306 1322
 			{
@@ -1559,8 +1575,9 @@  discard block
 block discarded – undo
1559 1575
 		$current_step++;
1560 1576
 
1561 1577
 		// Already done this?
1562
-		if ($_GET['step'] > $current_step)
1563
-			continue;
1578
+		if ($_GET['step'] > $current_step) {
1579
+					continue;
1580
+		}
1564 1581
 
1565 1582
 		// If we're fixing it but it ain't broke why try?
1566 1583
 		if ($do_fix && !in_array($error_type, $to_fix))
@@ -1589,14 +1606,16 @@  discard block
 block discarded – undo
1589 1606
 		while (!$done)
1590 1607
 		{
1591 1608
 			// Make sure there's at least one ID to test.
1592
-			if (isset($test['substeps']) && empty($step_max))
1593
-				break;
1609
+			if (isset($test['substeps']) && empty($step_max)) {
1610
+							break;
1611
+			}
1594 1612
 
1595 1613
 			// What is the testing query (Changes if we are testing or fixing)
1596
-			if (!$do_fix)
1597
-				$test_query = 'check_query';
1598
-			else
1599
-				$test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query';
1614
+			if (!$do_fix) {
1615
+							$test_query = 'check_query';
1616
+			} else {
1617
+							$test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query';
1618
+			}
1600 1619
 
1601 1620
 			// Do the test...
1602 1621
 			$request = $smcFunc['db_query']('',
@@ -1606,10 +1625,11 @@  discard block
 block discarded – undo
1606 1625
 			);
1607 1626
 
1608 1627
 			// Does it need a fix?
1609
-			if (!empty($test['check_type']) && $test['check_type'] == 'count')
1610
-				list ($needs_fix) = $smcFunc['db_fetch_row']($request);
1611
-			else
1612
-				$needs_fix = $smcFunc['db_num_rows']($request);
1628
+			if (!empty($test['check_type']) && $test['check_type'] == 'count') {
1629
+							list ($needs_fix) = $smcFunc['db_fetch_row']($request);
1630
+			} else {
1631
+							$needs_fix = $smcFunc['db_num_rows']($request);
1632
+			}
1613 1633
 
1614 1634
 			$total_queries++;
1615 1635
 
@@ -1621,8 +1641,9 @@  discard block
 block discarded – undo
1621 1641
 					// Assume need to fix.
1622 1642
 					$found_errors = true;
1623 1643
 
1624
-					if (isset($test['message']))
1625
-						$context['repair_errors'][] = $txt[$test['message']];
1644
+					if (isset($test['message'])) {
1645
+											$context['repair_errors'][] = $txt[$test['message']];
1646
+					}
1626 1647
 
1627 1648
 					// One per row!
1628 1649
 					elseif (isset($test['messages']))
@@ -1632,10 +1653,11 @@  discard block
 block discarded – undo
1632 1653
 							$variables = $test['messages'];
1633 1654
 							foreach ($variables as $k => $v)
1634 1655
 							{
1635
-								if ($k == 0 && isset($txt[$v]))
1636
-									$variables[$k] = $txt[$v];
1637
-								elseif ($k > 0 && isset($row[$v]))
1638
-									$variables[$k] = $row[$v];
1656
+								if ($k == 0 && isset($txt[$v])) {
1657
+																	$variables[$k] = $txt[$v];
1658
+								} elseif ($k > 0 && isset($row[$v])) {
1659
+																	$variables[$k] = $row[$v];
1660
+								}
1639 1661
 							}
1640 1662
 							$context['repair_errors'][] = call_user_func_array('sprintf', $variables);
1641 1663
 						}
@@ -1646,13 +1668,15 @@  discard block
 block discarded – undo
1646 1668
 					{
1647 1669
 						// Find out if there are actually errors.
1648 1670
 						$found_errors = false;
1649
-						while ($row = $smcFunc['db_fetch_assoc']($request))
1650
-							$found_errors |= $test['message_function']($row);
1671
+						while ($row = $smcFunc['db_fetch_assoc']($request)) {
1672
+													$found_errors |= $test['message_function']($row);
1673
+						}
1651 1674
 					}
1652 1675
 
1653 1676
 					// Actually have something to fix?
1654
-					if ($found_errors)
1655
-						$to_fix[] = $error_type;
1677
+					if ($found_errors) {
1678
+											$to_fix[] = $error_type;
1679
+					}
1656 1680
 				}
1657 1681
 
1658 1682
 				// We want to fix, we need to fix - so work out what exactly to do!
@@ -1662,8 +1686,9 @@  discard block
 block discarded – undo
1662 1686
 					if (isset($test['fix_collect']))
1663 1687
 					{
1664 1688
 						$ids = array();
1665
-						while ($row = $smcFunc['db_fetch_assoc']($request))
1666
-							$ids[] = $row[$test['fix_collect']['index']];
1689
+						while ($row = $smcFunc['db_fetch_assoc']($request)) {
1690
+													$ids[] = $row[$test['fix_collect']['index']];
1691
+						}
1667 1692
 						if (!empty($ids))
1668 1693
 						{
1669 1694
 							// Fix it!
@@ -1672,30 +1697,34 @@  discard block
 block discarded – undo
1672 1697
 					}
1673 1698
 
1674 1699
 					// Simply executing a fix it query?
1675
-					elseif (isset($test['fix_it_query']))
1676
-						$smcFunc['db_query']('',
1700
+					elseif (isset($test['fix_it_query'])) {
1701
+											$smcFunc['db_query']('',
1677 1702
 							$test['fix_it_query'],
1678 1703
 							array(
1679 1704
 							)
1680 1705
 						);
1706
+					}
1681 1707
 
1682 1708
 					// Do we have some processing to do?
1683 1709
 					elseif (isset($test['fix_processing']))
1684 1710
 					{
1685
-						while ($row = $smcFunc['db_fetch_assoc']($request))
1686
-							$test['fix_processing']($row);
1711
+						while ($row = $smcFunc['db_fetch_assoc']($request)) {
1712
+													$test['fix_processing']($row);
1713
+						}
1687 1714
 					}
1688 1715
 
1689 1716
 					// What about the full set of processing?
1690
-					elseif (isset($test['fix_full_processing']))
1691
-						$test['fix_full_processing']($request);
1717
+					elseif (isset($test['fix_full_processing'])) {
1718
+											$test['fix_full_processing']($request);
1719
+					}
1692 1720
 
1693 1721
 					// Do we have other things we need to fix as a result?
1694 1722
 					if (!empty($test['force_fix']))
1695 1723
 					{
1696
-						foreach ($test['force_fix'] as $item)
1697
-							if (!in_array($item, $to_fix))
1724
+						foreach ($test['force_fix'] as $item) {
1725
+													if (!in_array($item, $to_fix))
1698 1726
 								$to_fix[] = $item;
1727
+						}
1699 1728
 					}
1700 1729
 				}
1701 1730
 			}
@@ -1713,16 +1742,17 @@  discard block
 block discarded – undo
1713 1742
 				if ($_GET['substep'] <= $step_max)
1714 1743
 				{
1715 1744
 					pauseRepairProcess($to_fix, $error_type, $step_max);
1745
+				} else {
1746
+									$done = true;
1716 1747
 				}
1717
-				else
1718
-					$done = true;
1748
+			} else {
1749
+							$done = true;
1719 1750
 			}
1720
-			else
1721
-				$done = true;
1722 1751
 
1723 1752
 			// Don't allow more than 1000 queries at a time.
1724
-			if ($total_queries >= 1000)
1725
-				pauseRepairProcess($to_fix, $error_type, $step_max, true);
1753
+			if ($total_queries >= 1000) {
1754
+							pauseRepairProcess($to_fix, $error_type, $step_max, true);
1755
+			}
1726 1756
 		}
1727 1757
 
1728 1758
 		// Keep going.
@@ -1735,8 +1765,9 @@  discard block
 block discarded – undo
1735 1765
 		if ($do_fix)
1736 1766
 		{
1737 1767
 			$key = array_search($error_type, $to_fix);
1738
-			if ($key !== false && isset($to_fix[$key]))
1739
-				unset($to_fix[$key]);
1768
+			if ($key !== false && isset($to_fix[$key])) {
1769
+							unset($to_fix[$key]);
1770
+			}
1740 1771
 		}
1741 1772
 
1742 1773
 		// Are we done?
@@ -1759,10 +1790,11 @@  discard block
 block discarded – undo
1759 1790
 	static $createOnce = false;
1760 1791
 
1761 1792
 	// Have we already created it?
1762
-	if ($createOnce)
1763
-		return;
1764
-	else
1765
-		$createOnce = true;
1793
+	if ($createOnce) {
1794
+			return;
1795
+	} else {
1796
+			$createOnce = true;
1797
+	}
1766 1798
 
1767 1799
 	// Back to the forum's default language.
1768 1800
 	loadLanguage('Admin', $language);
@@ -1777,8 +1809,9 @@  discard block
 block discarded – undo
1777 1809
 			'cat_name' => $txt['salvaged_category_name'],
1778 1810
 		)
1779 1811
 	);
1780
-	if ($smcFunc['db_num_rows']($result) != 0)
1781
-		list ($salvageCatID) = $smcFunc['db_fetch_row']($result);
1812
+	if ($smcFunc['db_num_rows']($result) != 0) {
1813
+			list ($salvageCatID) = $smcFunc['db_fetch_row']($result);
1814
+	}
1782 1815
 	$smcFunc['db_free_result']($result);
1783 1816
 
1784 1817
 	if (empty($salvageCatID))
@@ -1810,8 +1843,9 @@  discard block
 block discarded – undo
1810 1843
 			'board_name' => $txt['salvaged_board_name'],
1811 1844
 		)
1812 1845
 	);
1813
-	if ($smcFunc['db_num_rows']($result) != 0)
1814
-		list ($salvageBoardID) = $smcFunc['db_fetch_row']($result);
1846
+	if ($smcFunc['db_num_rows']($result) != 0) {
1847
+			list ($salvageBoardID) = $smcFunc['db_fetch_row']($result);
1848
+	}
1815 1849
 	$smcFunc['db_free_result']($result);
1816 1850
 
1817 1851
 	if (empty($salvageBoardID))
Please login to merge, or discard this patch.