Completed
Push — release-2.1 ( 67c86a...1ee551 )
by Michael
09:56
created
Themes/default/ManageBoards.template.php 1 patch
Braces   +99 added lines, -68 removed lines patch added patch discarded remove patch
@@ -25,18 +25,20 @@  discard block
 block discarded – undo
25 25
 		</div>
26 26
 		<div class="windowbg2 noup">';
27 27
 
28
-	if (!empty($context['move_board']))
29
-		echo '
28
+	if (!empty($context['move_board'])) {
29
+			echo '
30 30
 		<div class="noticebox">
31 31
 			', $context['move_title'], ' [<a href="', $scripturl, '?action=admin;area=manageboards">', $txt['mboards_cancel_moving'], '</a>]', '
32 32
 		</div>';
33
+	}
33 34
 
34 35
 	// No categories so show a label.
35
-	if (empty($context['categories']))
36
-		echo '
36
+	if (empty($context['categories'])) {
37
+			echo '
37 38
 		<div class="windowbg centertext">
38 39
 			', $txt['mboards_no_cats'], '
39 40
 		</div>';
41
+	}
40 42
 
41 43
 	// Loop through every category, listing the boards in each as we go.
42 44
 	foreach ($context['categories'] as $category)
@@ -54,9 +56,10 @@  discard block
 block discarded – undo
54 56
 		<form action="', $scripturl, '?action=admin;area=manageboards;sa=newboard;cat=', $category['id'], '" method="post" accept-charset="', $context['character_set'], '">
55 57
 				<ul id="category_', $category['id'], '" class="nolist">';
56 58
 
57
-		if (!empty($category['move_link']))
58
-			echo '
59
+		if (!empty($category['move_link'])) {
60
+					echo '
59 61
 					<li><a href="', $category['move_link']['href'], '" title="', $category['move_link']['label'], '"><span class="generic_icons select_above"></span></a></li>';
62
+		}
60 63
 
61 64
 		$recycle_board = '<a href="' . $scripturl . '?action=admin;area=manageboards;sa=settings"> <img src="' . $settings['images_url'] . '/post/recycled.png" alt="' . $txt['recycle_board'] . '" title="' . $txt['recycle_board'] . '"></a>';
62 65
 		$redirect_board = '<img src="' . $settings['images_url'] . '/new_redirect.png" alt="' . $txt['redirect_board_desc'] . '" title="' . $txt['redirect_board_desc'] . '">';
@@ -81,9 +84,10 @@  discard block
 block discarded – undo
81 84
 				echo '
82 85
 					<li class="windowbg" style="padding-', $context['right_to_left'] ? 'right' : 'left', ': ', 5 + 30 * $board['move_links'][0]['child_level'], 'px;">';
83 86
 
84
-				foreach ($board['move_links'] as $link)
85
-					echo '
87
+				foreach ($board['move_links'] as $link) {
88
+									echo '
86 89
 						<a href="', $link['href'], '" class="move_links" title="', $link['label'], '"><span class="generic_icons select_', $link['class'], '" title="', $link['label'], '"></span></a>';
90
+				}
87 91
 
88 92
 				echo '
89 93
 					</li>';
@@ -132,9 +136,10 @@  discard block
 block discarded – undo
132 136
 						<select name="cat_order">';
133 137
 
134 138
 		// Print every existing category into a select box.
135
-		foreach ($context['category_order'] as $order)
136
-			echo '
139
+		foreach ($context['category_order'] as $order) {
140
+					echo '
137 141
 							<option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
142
+		}
138 143
 		echo '
139 144
 						</select>
140 145
 					</dd>';
@@ -169,14 +174,15 @@  discard block
 block discarded – undo
169 174
 	{
170 175
 		foreach ($context['custom_category_settings'] as $catset_id => $catset)
171 176
 		{
172
-			if (!empty($catset['dt']) && !empty($catset['dd']))
173
-				echo '
177
+			if (!empty($catset['dt']) && !empty($catset['dd'])) {
178
+							echo '
174 179
 						<dt class="clear', !is_numeric($catset_id) ? ' catset_' . $catset_id : '', '">
175 180
 							', $catset['dt'], '
176 181
 						</dt>
177 182
 						<dd', !is_numeric($catset_id) ? ' class="catset_' . $catset_id . '"' : '', '>
178 183
 							', $catset['dd'], '
179 184
 						</dd>';
185
+			}
180 186
 		}
181 187
 	}
182 188
 
@@ -184,21 +190,23 @@  discard block
 block discarded – undo
184 190
 	echo '
185 191
 				</dl>';
186 192
 
187
-	if (isset($context['category']['is_new']))
188
-		echo '
193
+	if (isset($context['category']['is_new'])) {
194
+			echo '
189 195
 					<input type="submit" name="add" value="', $txt['mboards_add_cat_button'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit">';
190
-	else
191
-		echo '
196
+	} else {
197
+			echo '
192 198
 					<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit">
193 199
 					<input type="submit" name="delete" value="', $txt['mboards_delete_cat'], '" data-confirm="', $txt['catConfirm'], '" class="button_submit you_sure">';
200
+	}
194 201
 	echo '
195 202
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
196 203
 					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
197 204
 
198 205
 	// If this category is empty we don't bother with the next confirmation screen.
199
-	if ($context['category']['is_empty'])
200
-		echo '
206
+	if ($context['category']['is_empty']) {
207
+			echo '
201 208
 					<input type="hidden" name="empty" value="1">';
209
+	}
202 210
 
203 211
 	echo '
204 212
 			</div>
@@ -225,9 +233,10 @@  discard block
 block discarded – undo
225 233
 				<p>', $txt['mboards_delete_cat_contains'], ':</p>
226 234
 				<ul>';
227 235
 
228
-	foreach ($context['category']['children'] as $child)
229
-		echo '
236
+	foreach ($context['category']['children'] as $child) {
237
+			echo '
230 238
 					<li>', $child, '</li>';
239
+	}
231 240
 
232 241
 	echo '
233 242
 				</ul>
@@ -241,10 +250,11 @@  discard block
 block discarded – undo
241 250
 					<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', count($context['category_order']) == 1 ? ' disabled' : '', '>', $txt['mboards_delete_option2'], '</label>:
242 251
 					<select name="cat_to"', count($context['category_order']) == 1 ? ' disabled' : '', '>';
243 252
 
244
-	foreach ($context['category_order'] as $cat)
245
-		if ($cat['id'] != 0)
253
+	foreach ($context['category_order'] as $cat) {
254
+			if ($cat['id'] != 0)
246 255
 			echo '
247 256
 						<option value="', $cat['id'], '">', $cat['true_name'], '</option>';
257
+	}
248 258
 
249 259
 	echo '
250 260
 					</select>
@@ -288,9 +298,10 @@  discard block
 block discarded – undo
288 298
 					</dt>
289 299
 					<dd>
290 300
 						<select name="new_cat" onchange="if (this.form.order) {this.form.order.disabled = this.options[this.selectedIndex].value != 0; this.form.board_order.disabled = this.options[this.selectedIndex].value != 0 || this.form.order.options[this.form.order.selectedIndex].value == \'\';}">';
291
-		foreach ($context['categories'] as $category)
292
-			echo '
301
+		foreach ($context['categories'] as $category) {
302
+					echo '
293 303
 							<option', $category['selected'] ? ' selected' : '', ' value="', $category['id'], '">', $category['name'], '</option>';
304
+		}
294 305
 		echo '
295 306
 						</select>
296 307
 					</dd>';
@@ -317,9 +328,10 @@  discard block
 block discarded – undo
317 328
 	echo '
318 329
 						<select id="board_order" name="board_order"', !isset($context['board']['is_new']) ? ' disabled' : '', '>
319 330
 							', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '';
320
-	foreach ($context['board_order'] as $order)
321
-		echo '
331
+	foreach ($context['board_order'] as $order) {
332
+			echo '
322 333
 							<option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
334
+	}
323 335
 	echo '
324 336
 						</select>
325 337
 					</dd>';
@@ -348,13 +360,15 @@  discard block
 block discarded – undo
348 360
 					<dd>
349 361
 						<select name="profile">';
350 362
 
351
-	if (isset($context['board']['is_new']))
352
-		echo '
363
+	if (isset($context['board']['is_new'])) {
364
+			echo '
353 365
 							<option value="-1">[', $txt['permission_profile_inherit'], ']</option>';
366
+	}
354 367
 
355
-	foreach ($context['profiles'] as $id => $profile)
356
-		echo '
368
+	foreach ($context['profiles'] as $id => $profile) {
369
+			echo '
357 370
 							<option value="', $id, '"', $id == $context['board']['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
371
+	}
358 372
 
359 373
 	echo '
360 374
 						</select>
@@ -367,8 +381,8 @@  discard block
 block discarded – undo
367 381
 					</dt>
368 382
 					<dd>';
369 383
 
370
-	if (!empty($modSettings['deny_boards_access']))
371
-		echo '
384
+	if (!empty($modSettings['deny_boards_access'])) {
385
+			echo '
372 386
 						<table>
373 387
 							<tr>
374 388
 								<td></td>
@@ -376,10 +390,11 @@  discard block
 block discarded – undo
376 390
 								<th>', $txt['permissions_option_off'], '</th>
377 391
 								<th>', $txt['permissions_option_deny'], '</th>
378 392
 							</tr>';
393
+	}
379 394
 
380 395
 	// List all the membergroups so the user can choose who may access this board.
381
-	foreach ($context['groups'] as $group)
382
-		if (empty($modSettings['deny_boards_access']))
396
+	foreach ($context['groups'] as $group) {
397
+			if (empty($modSettings['deny_boards_access']))
383 398
 			echo '
384 399
 						<label for="groups_', $group['id'], '">
385 400
 							<input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', in_array($group['id'], $context['board_managers']) ? ' checked disabled' : ($group['allow'] ? ' checked' : ''), ' class="input_check">
@@ -387,8 +402,9 @@  discard block
 block discarded – undo
387 402
 								', $group['name'], '
388 403
 							</span>
389 404
 						</label><br>';
390
-		else
391
-			echo '
405
+	}
406
+		else {
407
+					echo '
392 408
 							<tr>
393 409
 								<td>
394 410
 									<label for="groups_', $group['id'], '_a">
@@ -408,16 +424,17 @@  discard block
 block discarded – undo
408 424
 								</td>
409 425
 								<td></td>
410 426
 							</tr>';
427
+		}
411 428
 
412
-	if (empty($modSettings['deny_boards_access']))
413
-		echo '
429
+	if (empty($modSettings['deny_boards_access'])) {
430
+			echo '
414 431
 						<span class="select_all_box">
415 432
 							<em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[\');">
416 433
 						</span>
417 434
 						<br><br>
418 435
 					</dd>';
419
-	else
420
-		echo '
436
+	} else {
437
+			echo '
421 438
 							<tr class="select_all_box">
422 439
 								<td>
423 440
 								</td>
@@ -436,6 +453,7 @@  discard block
 block discarded – undo
436 453
 							</tr>
437 454
 						</table>
438 455
 					</dd>';
456
+	}
439 457
 
440 458
 	// Options to choose moderators, specify as announcement board and choose whether to count posts here.
441 459
 	echo '
@@ -490,8 +508,8 @@  discard block
 block discarded – undo
490 508
 					</dl>
491 509
 				</div>';
492 510
 
493
-		if ($context['board']['redirect'])
494
-			echo '
511
+		if ($context['board']['redirect']) {
512
+					echo '
495 513
 				<div id="reset_redirect_div">
496 514
 					<dl class="settings">
497 515
 						<dt>
@@ -504,6 +522,7 @@  discard block
 block discarded – undo
504 522
 						</dd>
505 523
 					</dl>
506 524
 				</div>';
525
+		}
507 526
 	}
508 527
 
509 528
 	echo '
@@ -531,9 +550,10 @@  discard block
 block discarded – undo
531 550
 							<select name="boardtheme" id="boardtheme" onchange="refreshOptions();">
532 551
 								<option value="0"', $context['board']['theme'] == 0 ? ' selected' : '', '>', $txt['mboards_theme_default'], '</option>';
533 552
 
534
-	foreach ($context['themes'] as $theme)
535
-		echo '
553
+	foreach ($context['themes'] as $theme) {
554
+			echo '
536 555
 									<option value="', $theme['id'], '"', $context['board']['theme'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>';
556
+	}
537 557
 
538 558
 	echo '
539 559
 							</select>
@@ -562,14 +582,15 @@  discard block
 block discarded – undo
562 582
 
563 583
 		foreach ($context['custom_board_settings'] as $cbs_id => $cbs)
564 584
 		{
565
-			if (!empty($cbs['dt']) && !empty($cbs['dd']))
566
-				echo '
585
+			if (!empty($cbs['dt']) && !empty($cbs['dd'])) {
586
+							echo '
567 587
 						<dt class="clear', !is_numeric($cbs_id) ? ' cbs_' . $cbs_id : '', '">
568 588
 							', $cbs['dt'], '
569 589
 						</dt>
570 590
 						<dd', !is_numeric($cbs_id) ? ' class="cbs_' . $cbs_id . '"' : '', '>
571 591
 							', $cbs['dd'], '
572 592
 						</dd>';
593
+			}
573 594
 		}
574 595
 
575 596
 		echo '
@@ -577,9 +598,10 @@  discard block
 block discarded – undo
577 598
 				</div>';
578 599
 	}
579 600
 
580
-	if (!empty($context['board']['is_recycle']))
581
-		echo '
601
+	if (!empty($context['board']['is_recycle'])) {
602
+			echo '
582 603
 				<div class="noticebox">', $txt['mboards_recycle_disabled_delete'], '</div>';
604
+	}
583 605
 
584 606
 	echo '
585 607
 				<input type="hidden" name="rid" value="', $context['redirect_location'], '">
@@ -587,21 +609,24 @@  discard block
 block discarded – undo
587 609
 				<input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '">';
588 610
 
589 611
 	// If this board has no children don't bother with the next confirmation screen.
590
-	if ($context['board']['no_children'])
591
-		echo '
612
+	if ($context['board']['no_children']) {
613
+			echo '
592 614
 				<input type="hidden" name="no_children" value="1">';
615
+	}
593 616
 
594
-	if (isset($context['board']['is_new']))
595
-		echo '
617
+	if (isset($context['board']['is_new'])) {
618
+			echo '
596 619
 				<input type="hidden" name="cur_cat" value="', $context['board']['category'], '">
597 620
 				<input type="submit" name="add" value="', $txt['mboards_new_board'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">';
598
-	else
599
-		echo '
621
+	} else {
622
+			echo '
600 623
 				<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">';
624
+	}
601 625
 
602
-	if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle']))
603
-		echo '
626
+	if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle'])) {
627
+			echo '
604 628
 				<input type="submit" name="delete" value="', $txt['mboards_delete_board'], '" data-confirm="', $txt['boardConfirm'], '" class="button_submit you_sure">';
629
+	}
605 630
 	echo '
606 631
 			</div>
607 632
 		</form>
@@ -622,12 +647,13 @@  discard block
 block discarded – undo
622 647
 		sItemListContainerId: \'moderator_container\',
623 648
 		aListItems: [';
624 649
 
625
-	foreach ($context['board']['moderators'] as $id_member => $member_name)
626
-		echo '
650
+	foreach ($context['board']['moderators'] as $id_member => $member_name) {
651
+			echo '
627 652
 					{
628 653
 						sItemId: ', JavaScriptEscape($id_member), ',
629 654
 						sItemName: ', JavaScriptEscape($member_name), '
630 655
 					}', $id_member == $context['board']['last_moderator_id'] ? '' : ',';
656
+	}
631 657
 
632 658
 	echo '
633 659
 		]
@@ -647,12 +673,13 @@  discard block
 block discarded – undo
647 673
 		sItemListContainerId: \'moderator_group_container\',
648 674
 		aListItems: [';
649 675
 
650
-	foreach ($context['board']['moderator_groups'] as $id_group => $group_name)
651
-		echo '
676
+	foreach ($context['board']['moderator_groups'] as $id_group => $group_name) {
677
+			echo '
652 678
 					{
653 679
 						sItemId: ', JavaScriptEscape($id_group), ',
654 680
 						sItemName: ', JavaScriptEscape($group_name), '
655 681
 					}', $id_group == $context['board']['last_moderator_group_id'] ? '' : ',';
682
+	}
656 683
 
657 684
 		echo '
658 685
 			]
@@ -678,17 +705,19 @@  discard block
 block discarded – undo
678 705
 		echo '
679 706
 			document.getElementById("redirect_address_div").style.display = redirectEnabled ? "" : "none";';
680 707
 
681
-		if ($context['board']['redirect'])
682
-			echo '
708
+		if ($context['board']['redirect']) {
709
+					echo '
683 710
 			document.getElementById("reset_redirect_div").style.display = redirectEnabled ? "" : "none";';
711
+		}
684 712
 	}
685 713
 
686 714
 	// Include any JavaScript added by mods using the 'integrate_edit_board' hook.
687 715
 	if (!empty($context['custom_refreshOptions']) && is_array($context['custom_refreshOptions']))
688 716
 	{
689
-		foreach ($context['custom_refreshOptions'] as $refreshOption)
690
-			echo '
717
+		foreach ($context['custom_refreshOptions'] as $refreshOption) {
718
+					echo '
691 719
 			', $refreshOption;
720
+		}
692 721
 	}
693 722
 
694 723
 	echo '
@@ -717,9 +746,10 @@  discard block
 block discarded – undo
717 746
 				<p>', $txt['mboards_delete_board_contains'], '</p>
718 747
 					<ul>';
719 748
 
720
-	foreach ($context['children'] as $child)
721
-		echo '
749
+	foreach ($context['children'] as $child) {
750
+			echo '
722 751
 						<li>', $child['node']['name'], '</li>';
752
+	}
723 753
 
724 754
 	echo '
725 755
 					</ul>
@@ -733,10 +763,11 @@  discard block
 block discarded – undo
733 763
 					<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', empty($context['can_move_children']) ? ' disabled' : '', '>', $txt['mboards_delete_board_option2'], '</label>:
734 764
 					<select name="board_to"', empty($context['can_move_children']) ? ' disabled' : '', '>';
735 765
 
736
-	foreach ($context['board_order'] as $board)
737
-		if ($board['id'] != $context['board']['id'] && empty($board['is_child']))
766
+	foreach ($context['board_order'] as $board) {
767
+			if ($board['id'] != $context['board']['id'] && empty($board['is_child']))
738 768
 			echo '
739 769
 						<option value="', $board['id'], '">', $board['name'], '</option>';
770
+	}
740 771
 
741 772
 	echo '
742 773
 					</select>
Please login to merge, or discard this patch.
Themes/default/Display.template.php 1 patch
Braces   +221 added lines, -151 removed lines patch added patch discarded remove patch
@@ -51,11 +51,13 @@  discard block
 block discarded – undo
51 51
 				<p>';
52 52
 
53 53
 		// Show just numbers...?
54
-		if ($settings['display_who_viewing'] == 1)
55
-				echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
54
+		if ($settings['display_who_viewing'] == 1) {
55
+						echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
56
+		}
56 57
 		// Or show the actual people viewing the topic?
57
-		else
58
-			echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
58
+		else {
59
+					echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
60
+		}
59 61
 
60 62
 		// Now show how many guests are here too.
61 63
 		echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
@@ -93,10 +95,11 @@  discard block
 block discarded – undo
93 95
 						<dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
94 96
 						<dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">';
95 97
 
96
-				if ($context['allow_results_view'])
97
-					echo '
98
+				if ($context['allow_results_view']) {
99
+									echo '
98 100
 							', $option['bar_ndt'], '
99 101
 							<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';
102
+				}
100 103
 
101 104
 				echo '
102 105
 						</dd>';
@@ -105,9 +108,10 @@  discard block
 block discarded – undo
105 108
 			echo '
106 109
 					</dl>';
107 110
 
108
-			if ($context['allow_results_view'])
109
-				echo '
111
+			if ($context['allow_results_view']) {
112
+							echo '
110 113
 						<p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>';
114
+			}
111 115
 		}
112 116
 		// They are allowed to vote! Go to it!
113 117
 		else
@@ -116,17 +120,19 @@  discard block
 block discarded – undo
116 120
 						<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">';
117 121
 
118 122
 			// Show a warning if they are allowed more than one option.
119
-			if ($context['poll']['allowed_warning'])
120
-				echo '
123
+			if ($context['poll']['allowed_warning']) {
124
+							echo '
121 125
 							<p class="smallpadding">', $context['poll']['allowed_warning'], '</p>';
126
+			}
122 127
 
123 128
 			echo '
124 129
 							<ul class="options">';
125 130
 
126 131
 			// Show each option with its button - a radio likely.
127
-			foreach ($context['poll']['options'] as $option)
128
-				echo '
132
+			foreach ($context['poll']['options'] as $option) {
133
+							echo '
129 134
 								<li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
135
+			}
130 136
 
131 137
 			echo '
132 138
 							</ul>
@@ -138,9 +144,10 @@  discard block
 block discarded – undo
138 144
 		}
139 145
 
140 146
 		// Is the clock ticking?
141
-		if (!empty($context['poll']['expire_time']))
142
-			echo '
147
+		if (!empty($context['poll']['expire_time'])) {
148
+					echo '
143 149
 						<p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>';
150
+		}
144 151
 
145 152
 		echo '
146 153
 					</div>
@@ -170,11 +177,13 @@  discard block
 block discarded – undo
170 177
 					<li>
171 178
 						<b class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></b>';
172 179
 
173
-			if ($event['can_edit'])
174
-				echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
180
+			if ($event['can_edit']) {
181
+							echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
182
+			}
175 183
 
176
-			if ($event['can_export'])
177
-				echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
184
+			if ($event['can_export']) {
185
+							echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
186
+			}
178 187
 
179 188
 			echo '
180 189
 						<br>';
@@ -182,14 +191,14 @@  discard block
 block discarded – undo
182 191
 			if (!empty($event['allday']))
183 192
 			{
184 193
 				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : '';
185
-			}
186
-			else
194
+			} else
187 195
 			{
188 196
 				// Display event info relative to user's local timezone
189 197
 				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
190 198
 
191
-				if ($event['start_date_local'] != $event['end_date_local'])
192
-					echo trim($event['end_date_local']) . ', ';
199
+				if ($event['start_date_local'] != $event['end_date_local']) {
200
+									echo trim($event['end_date_local']) . ', ';
201
+				}
193 202
 
194 203
 				echo trim($event['end_time_local']);
195 204
 
@@ -198,23 +207,27 @@  discard block
 block discarded – undo
198 207
 				{
199 208
 					echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">';
200 209
 
201
-					if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig'])
202
-						echo trim($event['start_date_orig']), ', ';
210
+					if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) {
211
+											echo trim($event['start_date_orig']), ', ';
212
+					}
203 213
 
204 214
 					echo trim($event['start_time_orig']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
205 215
 
206
-					if ($event['start_date_orig'] != $event['end_date_orig'])
207
-						echo trim($event['end_date_orig']) . ', ';
216
+					if ($event['start_date_orig'] != $event['end_date_orig']) {
217
+											echo trim($event['end_date_orig']) . ', ';
218
+					}
208 219
 
209 220
 					echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)';
210 221
 				}
211 222
 				// Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion
212
-				else
213
-					echo ' ', $event['tz_abbrev'], '</time>';
223
+				else {
224
+									echo ' ', $event['tz_abbrev'], '</time>';
225
+				}
214 226
 			}
215 227
 
216
-			if (!empty($event['location']))
217
-				echo '<br>', $event['location'];
228
+			if (!empty($event['location'])) {
229
+							echo '<br>', $event['location'];
230
+			}
218 231
 
219 232
 			echo '
220 233
 					</li>';
@@ -252,8 +265,9 @@  discard block
 block discarded – undo
252 265
 	$context['removableMessageIDs'] = array();
253 266
 
254 267
 	// Get all the messages...
255
-	while ($message = $context['get_message']())
256
-		template_single_post($message);
268
+	while ($message = $context['get_message']()) {
269
+			template_single_post($message);
270
+	}
257 271
 
258 272
 	echo '
259 273
 				</form>
@@ -290,8 +304,9 @@  discard block
 block discarded – undo
290 304
 			<div id="display_jump_to">&nbsp;</div>';
291 305
 
292 306
 	// Show quickreply
293
-	if ($context['can_reply'])
294
-	template_quickreply();
307
+	if ($context['can_reply']) {
308
+		template_quickreply();
309
+	}
295 310
 
296 311
 	// User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device.
297 312
 	echo '
@@ -304,8 +319,8 @@  discard block
 block discarded – undo
304 319
 			</div>';
305 320
 
306 321
 	// Show the moderation button & pop only if user can moderate
307
-	if ($context['can_moderate_forum'] || $context['user']['is_mod'])
308
-		echo '
322
+	if ($context['can_moderate_forum'] || $context['user']['is_mod']) {
323
+			echo '
309 324
 			<div id="mobile_moderation" class="popup_container">
310 325
 				<div class="popup_window description">
311 326
 					<div class="popup_heading">', $txt['mobile_moderation'], '
@@ -315,6 +330,7 @@  discard block
 block discarded – undo
315 330
 					</div>
316 331
 				</div>
317 332
 			</div>';
333
+	}
318 334
 
319 335
 		echo '
320 336
 				<script>';
@@ -438,9 +454,10 @@  discard block
 block discarded – undo
438 454
 						});
439 455
 					}';
440 456
 
441
-	if (!empty($context['ignoredMsgs']))
442
-		echo '
457
+	if (!empty($context['ignoredMsgs'])) {
458
+			echo '
443 459
 					ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
460
+	}
444 461
 
445 462
 	echo '
446 463
 				</script>';
@@ -457,8 +474,9 @@  discard block
 block discarded – undo
457 474
 
458 475
 	$ignoring = false;
459 476
 
460
-	if ($message['can_remove'])
461
-		$context['removableMessageIDs'][] = $message['id'];
477
+	if ($message['can_remove']) {
478
+			$context['removableMessageIDs'][] = $message['id'];
479
+	}
462 480
 
463 481
 	// Are we ignoring this message?
464 482
 	if (!empty($message['is_ignored']))
@@ -484,9 +502,10 @@  discard block
 block discarded – undo
484 502
 							<div class="custom_fields_above_member">
485 503
 								<ul class="nolist">';
486 504
 
487
-		foreach ($message['custom_fields']['above_member'] as $custom)
488
-			echo '
505
+		foreach ($message['custom_fields']['above_member'] as $custom) {
506
+					echo '
489 507
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
508
+		}
490 509
 
491 510
 		echo '
492 511
 								</ul>
@@ -497,9 +516,10 @@  discard block
 block discarded – undo
497 516
 									<h4>';
498 517
 
499 518
 	// Show online and offline buttons?
500
-	if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
501
-		echo '
519
+	if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) {
520
+			echo '
502 521
 								', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : '';
522
+	}
503 523
 
504 524
 
505 525
 	// Show a link to the member's profile.
@@ -512,51 +532,59 @@  discard block
 block discarded – undo
512 532
 
513 533
 
514 534
 	// Show the user's avatar.
515
-	if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
516
-		echo '
535
+	if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
536
+			echo '
517 537
 								<li class="avatar">
518 538
 									<a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a>
519 539
 								</li>';
540
+	}
520 541
 
521 542
 	// Are there any custom fields below the avatar?
522
-	if (!empty($message['custom_fields']['below_avatar']))
523
-		foreach ($message['custom_fields']['below_avatar'] as $custom)
543
+	if (!empty($message['custom_fields']['below_avatar'])) {
544
+			foreach ($message['custom_fields']['below_avatar'] as $custom)
524 545
 			echo '
525 546
 								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
547
+	}
526 548
 
527 549
 	// Show the post group icons, but not for guests.
528
-	if (!$message['member']['is_guest'])
529
-		echo '
550
+	if (!$message['member']['is_guest']) {
551
+			echo '
530 552
 								<li class="icons">', $message['member']['group_icons'], '</li>';
553
+	}
531 554
 
532 555
 	// Show the member's primary group (like 'Administrator') if they have one.
533
-	if (!empty($message['member']['group']))
534
-		echo '
556
+	if (!empty($message['member']['group'])) {
557
+			echo '
535 558
 								<li class="membergroup">', $message['member']['group'], '</li>';
559
+	}
536 560
 
537 561
 	// Show the member's custom title, if they have one.
538
-	if (!empty($message['member']['title']))
539
-		echo '
562
+	if (!empty($message['member']['title'])) {
563
+			echo '
540 564
 								<li class="title">', $message['member']['title'], '</li>';
565
+	}
541 566
 
542 567
 	// Don't show these things for guests.
543 568
 	if (!$message['member']['is_guest'])
544 569
 	{
545 570
 
546 571
 		// 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.
547
-		if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group']))
548
-			echo '
572
+		if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) {
573
+					echo '
549 574
 								<li class="postgroup">', $message['member']['post_group'], '</li>';
575
+		}
550 576
 
551 577
 		// Show how many posts they have made.
552
-		if (!isset($context['disabled_fields']['posts']))
553
-			echo '
578
+		if (!isset($context['disabled_fields']['posts'])) {
579
+					echo '
554 580
 								<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
581
+		}
555 582
 
556 583
 		// Show their personal text?
557
-		if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb']))
558
-			echo '
584
+		if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) {
585
+					echo '
559 586
 								<li class="blurb">', $message['member']['blurb'], '</li>';
587
+		}
560 588
 
561 589
 		// Any custom fields to show as icons?
562 590
 		if (!empty($message['custom_fields']['icons']))
@@ -565,9 +593,10 @@  discard block
 block discarded – undo
565 593
 								<li class="im_icons">
566 594
 									<ol>';
567 595
 
568
-			foreach ($message['custom_fields']['icons'] as $custom)
569
-				echo '
596
+			foreach ($message['custom_fields']['icons'] as $custom) {
597
+							echo '
570 598
 										<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
599
+			}
571 600
 
572 601
 			echo '
573 602
 									</ol>
@@ -582,19 +611,22 @@  discard block
 block discarded – undo
582 611
 									<ol class="profile_icons">';
583 612
 
584 613
 			// Don't show an icon if they haven't specified a website.
585
-			if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website']))
586
-				echo '
614
+			if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) {
615
+							echo '
587 616
 										<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
617
+			}
588 618
 
589 619
 			// Since we know this person isn't a guest, you *can* message them.
590
-			if ($context['can_send_pm'])
591
-				echo '
620
+			if ($context['can_send_pm']) {
621
+							echo '
592 622
 										<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>';
623
+			}
593 624
 
594 625
 			// Show the email if necessary
595
-			if (!empty($message['member']['email']) && $message['member']['show_email'])
596
-				echo '
626
+			if (!empty($message['member']['email']) && $message['member']['show_email']) {
627
+							echo '
597 628
 										<li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
629
+			}
598 630
 
599 631
 				echo '
600 632
 									</ol>
@@ -602,48 +634,56 @@  discard block
 block discarded – undo
602 634
 		}
603 635
 
604 636
 		// Any custom fields for standard placement?
605
-		if (!empty($message['custom_fields']['standard']))
606
-			foreach ($message['custom_fields']['standard'] as $custom)
637
+		if (!empty($message['custom_fields']['standard'])) {
638
+					foreach ($message['custom_fields']['standard'] as $custom)
607 639
 				echo '
608 640
 								<li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>';
641
+		}
609 642
 
610 643
 	}
611 644
 	// Otherwise, show the guest's email.
612
-	elseif (!empty($message['member']['email']) && $message['member']['show_email'])
613
-		echo '
645
+	elseif (!empty($message['member']['email']) && $message['member']['show_email']) {
646
+			echo '
614 647
 								<li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
648
+	}
615 649
 
616 650
 	// Show the IP to this user for this post - because you can moderate?
617
-	if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
618
-		echo '
651
+	if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) {
652
+			echo '
619 653
 								<li class="poster_ip"><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></li>';
654
+	}
620 655
 
621 656
 	// Or, should we show it because this is you?
622
-	elseif ($message['can_see_ip'])
623
-		echo '
657
+	elseif ($message['can_see_ip']) {
658
+			echo '
624 659
 								<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>';
660
+	}
625 661
 
626 662
 	// Okay, are you at least logged in? Then we can show something about why IPs are logged...
627
-	elseif (!$context['user']['is_guest'])
628
-		echo '
663
+	elseif (!$context['user']['is_guest']) {
664
+			echo '
629 665
 								<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>';
666
+	}
630 667
 
631 668
 	// Otherwise, you see NOTHING!
632
-	else
633
-		echo '
669
+	else {
670
+			echo '
634 671
 								<li class="poster_ip">', $txt['logged'], '</li>';
672
+	}
635 673
 
636 674
 	// Are we showing the warning status?
637 675
 	// Don't show these things for guests.
638
-	if (!$message['member']['is_guest'] && $message['member']['can_see_warning'])
639
-		echo '
676
+	if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) {
677
+			echo '
640 678
 								<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>';
679
+	}
641 680
 
642 681
 	// Are there any custom fields to show at the bottom of the poster info?
643
-	if (!empty($message['custom_fields']['bottom_poster']))
644
-		foreach ($message['custom_fields']['bottom_poster'] as $custom)
682
+	if (!empty($message['custom_fields']['bottom_poster'])) {
683
+			foreach ($message['custom_fields']['bottom_poster'] as $custom)
645 684
 			echo '
646 685
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
686
+	}
647 687
 
648 688
 	// Poster info ends.
649 689
 	echo '
@@ -672,9 +712,10 @@  discard block
 block discarded – undo
672 712
 	echo '
673 713
 									<span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">';
674 714
 
675
-	if (!empty($modSettings['show_modify']) && !empty($message['modified']['name']))
676
-		echo
715
+	if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) {
716
+			echo
677 717
 										$message['modified']['last_edit_text'];
718
+	}
678 719
 
679 720
 	echo '
680 721
 									</span>
@@ -683,22 +724,24 @@  discard block
 block discarded – undo
683 724
 							</div>';
684 725
 
685 726
 	// Ignoring this user? Hide the post.
686
-	if ($ignoring)
687
-		echo '
727
+	if ($ignoring) {
728
+			echo '
688 729
 							<div id="msg_', $message['id'], '_ignored_prompt">
689 730
 								', $txt['ignoring_user'], '
690 731
 								<a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
691 732
 							</div>';
733
+	}
692 734
 
693 735
 	// Show the post itself, finally!
694 736
 	echo '
695 737
 							<div class="post">';
696 738
 
697
-	if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
698
-		echo '
739
+	if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) {
740
+			echo '
699 741
 								<div class="approve_post">
700 742
 									', $txt['post_awaiting_approval'], '
701 743
 								</div>';
744
+	}
702 745
 	echo '
703 746
 								<div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div>
704 747
 							</div>';
@@ -715,9 +758,9 @@  discard block
 block discarded – undo
715 758
 		foreach ($message['attachment'] as $attachment)
716 759
 		{
717 760
 			// Do we want this attachment to not be showed here?
718
-			if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']]))
719
-				continue;
720
-			elseif (!$div_output)
761
+			if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) {
762
+							continue;
763
+			} elseif (!$div_output)
721 764
 			{
722 765
 				$div_output = true;
723 766
 
@@ -733,9 +776,10 @@  discard block
 block discarded – undo
733 776
 								<fieldset>
734 777
 									<legend>', $txt['attach_awaiting_approve'];
735 778
 
736
-				if ($context['can_approve'])
737
-					echo '
779
+				if ($context['can_approve']) {
780
+									echo '
738 781
 										&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]';
782
+				}
739 783
 
740 784
 				echo '
741 785
 									</legend>';
@@ -749,12 +793,13 @@  discard block
 block discarded – undo
749 793
 				echo '
750 794
 										<div class="attachments_top">';
751 795
 
752
-				if ($attachment['thumbnail']['has_thumb'])
753
-					echo '
796
+				if ($attachment['thumbnail']['has_thumb']) {
797
+									echo '
754 798
 											<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>';
755
-				else
756
-					echo '
799
+				} else {
800
+									echo '
757 801
 											<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">';
802
+				}
758 803
 
759 804
 				echo '
760 805
 										</div>';
@@ -764,9 +809,10 @@  discard block
 block discarded – undo
764 809
 										<div class="attachments_bot">
765 810
 											<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*">&nbsp;' . $attachment['name'] . '</a> ';
766 811
 
767
-			if (!$attachment['is_approved'] && $context['can_approve'])
768
-				echo '
812
+			if (!$attachment['is_approved'] && $context['can_approve']) {
813
+							echo '
769 814
 											[<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
815
+			}
770 816
 			echo '
771 817
 											<br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), '
772 818
 										</div>';
@@ -775,33 +821,38 @@  discard block
 block discarded – undo
775 821
 									</div>';
776 822
 
777 823
 			// Next attachment line ?
778
-			if (++$i % $attachments_per_line === 0)
779
-				echo '
824
+			if (++$i % $attachments_per_line === 0) {
825
+							echo '
780 826
 									<br>';
827
+			}
781 828
 		}
782 829
 
783 830
 		// If we had unapproved attachments clean up.
784
-		if ($last_approved_state == 0)
785
-			echo '
831
+		if ($last_approved_state == 0) {
832
+					echo '
786 833
 								</fieldset>';
834
+		}
787 835
 
788 836
 		// Only do this if we output a div above - otherwise it'll break things
789
-		if ($div_output)
790
-			echo '
837
+		if ($div_output) {
838
+					echo '
791 839
 							</div>';
840
+		}
792 841
 	}
793 842
 
794 843
 	// And stuff below the attachments.
795
-	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
796
-	echo '
844
+	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) {
845
+		echo '
797 846
 							<div class="under_message">';
847
+	}
798 848
 
799 849
 	// Maybe they want to report this post to the moderator(s)?
800
-	if ($context['can_report_moderator'])
801
-		echo '
850
+	if ($context['can_report_moderator']) {
851
+			echo '
802 852
 								<ul class="floatright smalltext">
803 853
 									<li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li>
804 854
 								</ul>';
855
+	}
805 856
 
806 857
 	// What about likes?
807 858
 	if (!empty($modSettings['enable_likes']))
@@ -842,78 +893,91 @@  discard block
 block discarded – undo
842 893
 								<ul class="quickbuttons">';
843 894
 
844 895
 		// Can they quote? if so they can select and quote as well!
845
-		if ($context['can_quote'])
846
-			echo '
896
+		if ($context['can_quote']) {
897
+					echo '
847 898
 									<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>
848 899
 									<li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a></li>';
900
+		}
849 901
 
850 902
 		// Can the user modify the contents of this post? Show the modify inline image.
851
-		if ($message['can_modify'])
852
-			echo '
903
+		if ($message['can_modify']) {
904
+					echo '
853 905
 									<li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>';
906
+		}
854 907
 
855
-		if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
856
-			echo '
908
+		if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
909
+					echo '
857 910
 									<li class="post_options">', $txt['post_options'];
911
+		}
858 912
 
859 913
 		echo '
860 914
 										<ul>';
861 915
 
862 916
 		// Can the user modify the contents of this post?
863
-		if ($message['can_modify'])
864
-			echo '
917
+		if ($message['can_modify']) {
918
+					echo '
865 919
 											<li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>';
920
+		}
866 921
 
867 922
 		// How about... even... remove it entirely?!
868
-		if ($context['can_delete'] && ($context['topic_first_message'] == $message['id']))
869
-			echo '
923
+		if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) {
924
+					echo '
870 925
 											<li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>';
871
-		elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id']))
872
-			echo '
926
+		} elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) {
927
+					echo '
873 928
 											<li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
929
+		}
874 930
 
875 931
 		// What about splitting it off the rest of the topic?
876
-		if ($context['can_split'] && !empty($context['real_num_replies']))
877
-			echo '
932
+		if ($context['can_split'] && !empty($context['real_num_replies'])) {
933
+					echo '
878 934
 											<li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>';
935
+		}
879 936
 
880 937
 		// Can we issue a warning because of this post? Remember, we can't give guests warnings.
881
-		if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest'])
882
-			echo '
938
+		if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) {
939
+					echo '
883 940
 											<li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>';
941
+		}
884 942
 
885 943
 		// Can we restore topics?
886
-		if ($context['can_restore_msg'])
887
-			echo '
944
+		if ($context['can_restore_msg']) {
945
+					echo '
888 946
 											<li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>';
947
+		}
889 948
 
890 949
 		// Maybe we can approve it, maybe we should?
891
-		if ($message['can_approve'])
892
-			echo '
950
+		if ($message['can_approve']) {
951
+					echo '
893 952
 											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>';
953
+		}
894 954
 
895 955
 		// Maybe we can unapprove it?
896
-		if ($message['can_unapprove'])
897
-			echo '
956
+		if ($message['can_unapprove']) {
957
+					echo '
898 958
 											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>';
959
+		}
899 960
 
900 961
 		echo '
901 962
 										</ul>
902 963
 									</li>';
903 964
 
904 965
 		// Show a checkbox for quick moderation?
905
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
906
-			echo '
966
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
967
+					echo '
907 968
 									<li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
969
+		}
908 970
 
909
-		if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
910
-			echo '
971
+		if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
972
+					echo '
911 973
 								</ul>';
974
+		}
912 975
 	}
913 976
 
914
-	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
915
-	echo '
977
+	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) {
978
+		echo '
916 979
 							</div>';
980
+	}
917 981
 
918 982
 	echo '
919 983
 						</div>
@@ -926,9 +990,10 @@  discard block
 block discarded – undo
926 990
 							<div class="custom_fields_above_signature">
927 991
 								<ul class="nolist">';
928 992
 
929
-		foreach ($message['custom_fields']['above_signature'] as $custom)
930
-			echo '
993
+		foreach ($message['custom_fields']['above_signature'] as $custom) {
994
+					echo '
931 995
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
996
+		}
932 997
 
933 998
 		echo '
934 999
 								</ul>
@@ -936,9 +1001,10 @@  discard block
 block discarded – undo
936 1001
 	}
937 1002
 
938 1003
 	// Show the member's signature?
939
-	if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
940
-		echo '
1004
+	if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
1005
+			echo '
941 1006
 							<div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>';
1007
+	}
942 1008
 
943 1009
 
944 1010
 	// Are there any custom profile fields for below the signature?
@@ -948,9 +1014,10 @@  discard block
 block discarded – undo
948 1014
 							<div class="custom_fields_below_signature">
949 1015
 								<ul class="nolist">';
950 1016
 
951
-		foreach ($message['custom_fields']['below_signature'] as $custom)
952
-			echo '
1017
+		foreach ($message['custom_fields']['below_signature'] as $custom) {
1018
+					echo '
953 1019
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
1020
+		}
954 1021
 
955 1022
 		echo '
956 1023
 								</ul>
@@ -998,8 +1065,8 @@  discard block
 block discarded – undo
998 1065
 						<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">';
999 1066
 
1000 1067
 		// Guests just need more.
1001
-		if ($context['user']['is_guest'])
1002
-			echo '
1068
+		if ($context['user']['is_guest']) {
1069
+					echo '
1003 1070
 						<dl id="post_header">
1004 1071
 							<dt>
1005 1072
 								', $txt['name'], ':
@@ -1014,6 +1081,7 @@  discard block
 block discarded – undo
1014 1081
 								<input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required>
1015 1082
 							</dd>
1016 1083
 						</dl>';
1084
+		}
1017 1085
 
1018 1086
 		echo '
1019 1087
 						', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
@@ -1061,8 +1129,8 @@  discard block
 block discarded – undo
1061 1129
 		<br class="clear">';
1062 1130
 
1063 1131
 	// draft autosave available and the user has it enabled?
1064
-	if (!empty($context['drafts_autosave']))
1065
-		echo '
1132
+	if (!empty($context['drafts_autosave'])) {
1133
+			echo '
1066 1134
 			<script>
1067 1135
 				var oDraftAutoSave = new smf_DraftAutoSave({
1068 1136
 					sSelf: \'oDraftAutoSave\',
@@ -1074,10 +1142,12 @@  discard block
 block discarded – undo
1074 1142
 					iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), '
1075 1143
 				});
1076 1144
 			</script>';
1145
+	}
1077 1146
 
1078
-	if ($context['show_spellchecking'])
1079
-		echo '
1147
+	if ($context['show_spellchecking']) {
1148
+			echo '
1080 1149
 			<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>';
1150
+	}
1081 1151
 
1082 1152
 	echo '
1083 1153
 				<script>
Please login to merge, or discard this patch.
Themes/default/index.template.php 1 patch
Braces   +89 added lines, -61 removed lines patch added patch discarded remove patch
@@ -72,9 +72,10 @@  discard block
 block discarded – undo
72 72
 
73 73
 	// Allow css/js files to be disable for this specific theme.
74 74
 	// Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference.
75
-	if (!isset($settings['disable_files']))
76
-		$settings['disable_files'] = array();
77
-}
75
+	if (!isset($settings['disable_files'])) {
76
+			$settings['disable_files'] = array();
77
+	}
78
+	}
78 79
 
79 80
 /**
80 81
  * The main sub template above the content.
@@ -111,8 +112,9 @@  discard block
 block discarded – undo
111 112
 		echo '
112 113
 	<meta';
113 114
 
114
-		foreach ($meta_tag as $meta_key => $meta_value)
115
-			echo ' ', $meta_key, '="', $meta_value, '"';
115
+		foreach ($meta_tag as $meta_key => $meta_value) {
116
+					echo ' ', $meta_key, '="', $meta_value, '"';
117
+		}
116 118
 
117 119
 		echo '>';
118 120
 	}
@@ -123,14 +125,16 @@  discard block
 block discarded – undo
123 125
 	<meta name="theme-color" content="#557EA0">';
124 126
 
125 127
 	// Please don't index these Mr Robot.
126
-	if (!empty($context['robot_no_index']))
127
-		echo '
128
+	if (!empty($context['robot_no_index'])) {
129
+			echo '
128 130
 	<meta name="robots" content="noindex">';
131
+	}
129 132
 
130 133
 	// Present a canonical url for search engines to prevent duplicate content in their indices.
131
-	if (!empty($context['canonical_url']))
132
-		echo '
134
+	if (!empty($context['canonical_url'])) {
135
+			echo '
133 136
 	<link rel="canonical" href="', $context['canonical_url'], '">';
137
+	}
134 138
 
135 139
 	// Show all the relative links, such as help, search, contents, and the like.
136 140
 	echo '
@@ -139,10 +143,11 @@  discard block
 block discarded – undo
139 143
 	<link rel="search" href="' . $scripturl . '?action=search">' : '');
140 144
 
141 145
 	// If RSS feeds are enabled, advertise the presence of one.
142
-	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
143
-		echo '
146
+	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) {
147
+			echo '
144 148
 	<link rel="alternate feed" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?action=.xml;type=rss2', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">
145 149
 	<link rel="alternate feed" type="application/atom+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?action=.xml;type=atom', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">';
150
+	}
146 151
 
147 152
 	// If we're viewing a topic, these should be the previous and next topics, respectively.
148 153
 	if (!empty($context['links']['next']))
@@ -158,9 +163,10 @@  discard block
 block discarded – undo
158 163
 	}
159 164
 
160 165
 	// If we're in a board, or a topic for that matter, the index will be the board's index.
161
-	if (!empty($context['current_board']))
162
-		echo '
166
+	if (!empty($context['current_board'])) {
167
+			echo '
163 168
 	<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">';
169
+	}
164 170
 
165 171
 	// Output any remaining HTML headers. (from mods, maybe?)
166 172
 	echo $context['html_headers'];
@@ -191,8 +197,9 @@  discard block
 block discarded – undo
191 197
 		<ul class="floatleft" id="top_info">
192 198
 			<li>
193 199
 				<a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">';
194
-					if (!empty($context['user']['avatar']))
195
-						echo $context['user']['avatar']['image'];
200
+					if (!empty($context['user']['avatar'])) {
201
+											echo $context['user']['avatar']['image'];
202
+					}
196 203
 					echo $context['user']['name'], '</a>
197 204
 				<div id="profile_menu" class="top_menu"></div>
198 205
 			</li>';
@@ -220,17 +227,18 @@  discard block
 block discarded – undo
220 227
 	}
221 228
 	// Otherwise they're a guest. Ask them to either register or login.
222 229
 	else
223
-		if (empty($maintenance))
224
-			echo '
230
+		if (empty($maintenance)) {
231
+					echo '
225 232
 			<ul class="floatleft welcome">
226 233
 				<li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li>
227 234
 			</ul>';
228
-		else
229
-			//In maintenance mode, only login is allowed and don't show OverlayDiv
235
+		} else {
236
+					//In maintenance mode, only login is allowed and don't show OverlayDiv
230 237
 			echo '
231 238
 			<ul class="floatleft welcome">
232 239
 				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li>
233 240
 			</ul>';
241
+		}
234 242
 
235 243
 	if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1)
236 244
 	{
@@ -238,9 +246,10 @@  discard block
 block discarded – undo
238 246
 		<form id="languages_form" method="get" class="floatright">
239 247
 			<select id="language_select" name="language" onchange="this.form.submit()">';
240 248
 
241
-		foreach ($context['languages'] as $language)
242
-			echo '
249
+		foreach ($context['languages'] as $language) {
250
+					echo '
243 251
 				<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>';
252
+		}
244 253
 
245 254
 		echo '
246 255
 			</select>
@@ -264,31 +273,36 @@  discard block
 block discarded – undo
264 273
 				<option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>';
265 274
 
266 275
 		// Can't limit it to a specific topic if we are not in one
267
-		if (!empty($context['current_topic']))
268
-			echo '
276
+		if (!empty($context['current_topic'])) {
277
+					echo '
269 278
 				<option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>';
279
+		}
270 280
 
271 281
 		// Can't limit it to a specific board if we are not in one
272
-		if (!empty($context['current_board']))
273
-			echo '
282
+		if (!empty($context['current_board'])) {
283
+					echo '
274 284
 				<option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>';
285
+		}
275 286
 
276 287
 		// Can't search for members if we can't see the memberlist
277
-		if (!empty($context['allow_memberlist']))
278
-			echo '
288
+		if (!empty($context['allow_memberlist'])) {
289
+					echo '
279 290
 				<option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>';
291
+		}
280 292
 
281 293
 		echo '
282 294
 			</select>';
283 295
 
284 296
 		// Search within current topic?
285
-		if (!empty($context['current_topic']))
286
-			echo '
297
+		if (!empty($context['current_topic'])) {
298
+					echo '
287 299
 			<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">';
300
+		}
288 301
 		// If we're on a certain board, limit it to this board ;).
289
-		elseif (!empty($context['current_board']))
290
-			echo '
302
+		elseif (!empty($context['current_board'])) {
303
+					echo '
291 304
 			<input type="hidden" name="sd_brd" value="', $context['current_board'], '">';
305
+		}
292 306
 
293 307
 		echo '
294 308
 			<input type="submit" name="search2" value="', $txt['search'], '" class="button_submit">
@@ -318,12 +332,13 @@  discard block
 block discarded – undo
318 332
 						', $context['current_time'], '
319 333
 					</div>';
320 334
 	// Show a random news item? (or you could pick one from news_lines...)
321
-	if (!empty($settings['enable_news']) && !empty($context['random_news_line']))
322
-		echo '
335
+	if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) {
336
+			echo '
323 337
 					<div class="news">
324 338
 						<h2>', $txt['news'], ': </h2>
325 339
 						<p>', $context['random_news_line'], '</p>
326 340
 					</div>';
341
+	}
327 342
 
328 343
 	echo '
329 344
 					<hr class="clear">
@@ -386,9 +401,10 @@  discard block
 block discarded – undo
386 401
 		</ul>';
387 402
 
388 403
 	// Show the load time?
389
-	if ($context['show_load_time'])
390
-		echo '
404
+	if ($context['show_load_time']) {
405
+			echo '
391 406
 		<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>';
407
+	}
392 408
 
393 409
 	echo '
394 410
 	</div>';
@@ -418,19 +434,21 @@  discard block
 block discarded – undo
418 434
 	global $context, $shown_linktree, $scripturl, $txt;
419 435
 
420 436
 	// If linktree is empty, just return - also allow an override.
421
-	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
422
-		return;
437
+	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) {
438
+			return;
439
+	}
423 440
 
424 441
 	echo '
425 442
 				<div class="navigate_section">
426 443
 					<ul>';
427 444
 
428
-	if ($context['user']['is_logged'])
429
-	echo '
445
+	if ($context['user']['is_logged']) {
446
+		echo '
430 447
 						<li class="unread_links">
431 448
 							<a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a>
432 449
 							<a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a>
433 450
 						</li>';
451
+	}
434 452
 
435 453
 	// Each tree item has a URL and name. Some may have extra_before and extra_after.
436 454
 	foreach ($context['linktree'] as $link_num => $tree)
@@ -441,25 +459,29 @@  discard block
 block discarded – undo
441 459
 		// Don't show a separator for the first one.
442 460
 		// Better here. Always points to the next level when the linktree breaks to a second line.
443 461
 		// Picked a better looking HTML entity, and added support for RTL plus a span for styling.
444
-		if ($link_num != 0)
445
-			echo '
462
+		if ($link_num != 0) {
463
+					echo '
446 464
 							<span class="dividers">', $context['right_to_left'] ? ' &#9668; ' : ' &#9658; ', '</span>';
465
+		}
447 466
 
448 467
 		// Show something before the link?
449
-		if (isset($tree['extra_before']))
450
-			echo $tree['extra_before'], ' ';
468
+		if (isset($tree['extra_before'])) {
469
+					echo $tree['extra_before'], ' ';
470
+		}
451 471
 
452 472
 		// Show the link, including a URL if it should have one.
453
-		if (isset($tree['url']))
454
-			echo '
473
+		if (isset($tree['url'])) {
474
+					echo '
455 475
 					<a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>';
456
-		else
457
-			echo '
476
+		} else {
477
+					echo '
458 478
 					<span>' . $tree['name'] . '</span>';
479
+		}
459 480
 
460 481
 		// Show something after the link...?
461
-		if (isset($tree['extra_after']))
462
-			echo ' ', $tree['extra_after'];
482
+		if (isset($tree['extra_after'])) {
483
+					echo ' ', $tree['extra_after'];
484
+		}
463 485
 
464 486
 		echo '
465 487
 						</li>';
@@ -509,13 +531,14 @@  discard block
 block discarded – undo
509 531
 					echo '
510 532
 									<ul>';
511 533
 
512
-					foreach ($childbutton['sub_buttons'] as $grandchildbutton)
513
-						echo '
534
+					foreach ($childbutton['sub_buttons'] as $grandchildbutton) {
535
+											echo '
514 536
 										<li>
515 537
 											<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
516 538
 												', $grandchildbutton['title'], '
517 539
 											</a>
518 540
 										</li>';
541
+					}
519 542
 
520 543
 					echo '
521 544
 									</ul>';
@@ -546,8 +569,9 @@  discard block
 block discarded – undo
546 569
 {
547 570
 	global $context, $txt;
548 571
 
549
-	if (!is_array($strip_options))
550
-		$strip_options = array();
572
+	if (!is_array($strip_options)) {
573
+			$strip_options = array();
574
+	}
551 575
 
552 576
 	// Create the buttons...
553 577
 	$buttons = array();
@@ -556,8 +580,9 @@  discard block
 block discarded – undo
556 580
 		// As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!)
557 581
 		if (!isset($value['test']) || !empty($context[$value['test']]))
558 582
 		{
559
-			if (!isset($value['id']))
560
-				$value['id'] = $key;
583
+			if (!isset($value['id'])) {
584
+							$value['id'] = $key;
585
+			}
561 586
 
562 587
 			$button = '
563 588
 				<a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';
@@ -570,13 +595,15 @@  discard block
 block discarded – undo
570 595
 							<div class="overview">';
571 596
 				foreach ($value['sub_buttons'] as $element)
572 597
 				{
573
-					if (isset($element['test']) && empty($context[$element['test']]))
574
-						continue;
598
+					if (isset($element['test']) && empty($context[$element['test']])) {
599
+											continue;
600
+					}
575 601
 
576 602
 					$button .= '
577 603
 								<a href="' . $element['url'] . '"><strong>' . $txt[$element['text']] . '</strong>';
578
-					if (isset($txt[$element['text'] . '_desc']))
579
-						$button .= '<br /><span>' . $txt[$element['text'] . '_desc'] . '</span>';
604
+					if (isset($txt[$element['text'] . '_desc'])) {
605
+											$button .= '<br /><span>' . $txt[$element['text'] . '_desc'] . '</span>';
606
+					}
580 607
 					$button .= '</a>';
581 608
 				}
582 609
 				$button .= '
@@ -590,8 +617,9 @@  discard block
 block discarded – undo
590 617
 	}
591 618
 
592 619
 	// No buttons? No button strip either.
593
-	if (empty($buttons))
594
-		return;
620
+	if (empty($buttons)) {
621
+			return;
622
+	}
595 623
 
596 624
 	echo '
597 625
 		<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '>
Please login to merge, or discard this patch.
Sources/Subscriptions-PayPal.php 1 patch
Braces   +83 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 // This won't be dedicated without this - this must exist in each gateway!
15 15
 // SMF Payment Gateway: paypal
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Class for returning available form data for this gateway
@@ -118,8 +119,7 @@  discard block
 block discarded – undo
118 119
 		{
119 120
 			$return_data['hidden']['p3'] = 1;
120 121
 			$return_data['hidden']['t3'] = strtoupper(substr($period, 0, 1));
121
-		}
122
-		else
122
+		} else
123 123
 		{
124 124
 			preg_match('~(\d*)(\w)~', $sub_data['real_length'], $match);
125 125
 			$unit = $match[1];
@@ -130,14 +130,15 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 
132 132
 		// If it's repeatable do some javascript to respect this idea.
133
-		if (!empty($sub_data['repeatable']))
134
-			$return_data['javascript'] = '
133
+		if (!empty($sub_data['repeatable'])) {
134
+					$return_data['javascript'] = '
135 135
 				document.write(\'<label for="do_paypal_recur"><input type="checkbox" name="do_paypal_recur" id="do_paypal_recur" checked onclick="switchPaypalRecur();" class="input_check">' . $txt['paid_make_recurring'] . '</label><br>\');
136 136
 
137 137
 				function switchPaypalRecur()
138 138
 				{
139 139
 					document.getElementById("paypal_cmd").value = document.getElementById("do_paypal_recur").checked ? "_xclick-subscriptions" : "_xclick";
140 140
 				}';
141
+		}
141 142
 
142 143
 		return $return_data;
143 144
 	}
@@ -160,20 +161,24 @@  discard block
 block discarded – undo
160 161
 		global $modSettings;
161 162
 
162 163
 		// Has the user set up an email address?
163
-		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email'])))
164
-			return false;
164
+		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email']))) {
165
+					return false;
166
+		}
165 167
 		// Check the correct transaction types are even here.
166
-		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email'])))
167
-			return false;
168
+		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email']))) {
169
+					return false;
170
+		}
168 171
 		// Correct email address?
169
-		if (!isset($_POST['business']))
170
-			$_POST['business'] = $_POST['receiver_email'];
172
+		if (!isset($_POST['business'])) {
173
+					$_POST['business'] = $_POST['receiver_email'];
174
+		}
171 175
 
172 176
 		// Are we testing?
173
-		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
174
-			return false;
175
-		elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails']))))
176
-			return false;
177
+		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
178
+					return false;
179
+		} elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails'])))) {
180
+					return false;
181
+		}
177 182
 		return true;
178 183
 	}
179 184
 
@@ -192,15 +197,17 @@  discard block
 block discarded – undo
192 197
 		global $modSettings, $txt;
193 198
 
194 199
 		// Put this to some default value.
195
-		if (!isset($_POST['txn_type']))
196
-			$_POST['txn_type'] = '';
200
+		if (!isset($_POST['txn_type'])) {
201
+					$_POST['txn_type'] = '';
202
+		}
197 203
 
198 204
 		// Build the request string - starting with the minimum requirement.
199 205
 		$requestString = 'cmd=_notify-validate';
200 206
 
201 207
 		// Now my dear, add all the posted bits in the order we got them
202
-		foreach ($_POST as $k => $v)
203
-			$requestString .= '&' . $k . '=' . urlencode($v);
208
+		foreach ($_POST as $k => $v) {
209
+					$requestString .= '&' . $k . '=' . urlencode($v);
210
+		}
204 211
 
205 212
 		// Can we use curl?
206 213
 		if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'https://www.') . 'paypal.com/cgi-bin/webscr'))
@@ -240,14 +247,16 @@  discard block
 block discarded – undo
240 247
 			$header .= 'Connection: close' . "\r\n\r\n";
241 248
 
242 249
 			// Open the connection.
243
-			if (!empty($modSettings['paidsubs_test']))
244
-				$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
245
-			else
246
-				$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
250
+			if (!empty($modSettings['paidsubs_test'])) {
251
+							$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
252
+			} else {
253
+							$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
254
+			}
247 255
 
248 256
 			// Did it work?
249
-			if (!$fp)
250
-				generateSubscriptionError($txt['paypal_could_not_connect']);
257
+			if (!$fp) {
258
+							generateSubscriptionError($txt['paypal_could_not_connect']);
259
+			}
251 260
 
252 261
 			// Put the data to the port.
253 262
 			fputs($fp, $header . $requestString);
@@ -256,8 +265,9 @@  discard block
 block discarded – undo
256 265
 			while (!feof($fp))
257 266
 			{
258 267
 				$this->return_data = fgets($fp, 1024);
259
-				if (strcmp(trim($this->return_data), 'VERIFIED') === 0)
260
-					break;
268
+				if (strcmp(trim($this->return_data), 'VERIFIED') === 0) {
269
+									break;
270
+				}
261 271
 			}
262 272
 
263 273
 			// Clean up.
@@ -265,28 +275,34 @@  discard block
 block discarded – undo
265 275
 		}
266 276
 
267 277
 		// If this isn't verified then give up...
268
-		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0)
269
-			exit;
278
+		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0) {
279
+					exit;
280
+		}
270 281
 
271 282
 		// Check that this is intended for us.
272
-		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
273
-			exit;
283
+		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
284
+					exit;
285
+		}
274 286
 
275 287
 		// Is this a subscription - and if so is it a secondary payment that we need to process?
276 288
 		// If so, make sure we get it in the expected format. Seems PayPal sometimes sends it without urlencoding.
277
-		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false)
278
-			$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
279
-		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false))
280
-			// Calculate the subscription it relates to!
289
+		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false) {
290
+					$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
291
+		}
292
+		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false)) {
293
+					// Calculate the subscription it relates to!
281 294
 			$this->_findSubscription();
295
+		}
282 296
 
283 297
 		// Verify the currency!
284
-		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code']))
285
-			exit;
298
+		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code'])) {
299
+					exit;
300
+		}
286 301
 
287 302
 		// Can't exist if it doesn't contain anything.
288
-		if (empty($_POST['item_number']))
289
-			exit;
303
+		if (empty($_POST['item_number'])) {
304
+					exit;
305
+		}
290 306
 
291 307
 		// Return the id_sub and id_member
292 308
 		return explode('+', $_POST['item_number']);
@@ -299,10 +315,11 @@  discard block
 block discarded – undo
299 315
 	 */
300 316
 	public function isRefund()
301 317
 	{
302
-		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed'))
303
-			return true;
304
-		else
305
-			return false;
318
+		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed')) {
319
+					return true;
320
+		} else {
321
+					return false;
322
+		}
306 323
 	}
307 324
 
308 325
 	/**
@@ -312,10 +329,11 @@  discard block
 block discarded – undo
312 329
 	 */
313 330
 	public function isSubscription()
314 331
 	{
315
-		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed')
316
-			return true;
317
-		else
318
-			return false;
332
+		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed') {
333
+					return true;
334
+		} else {
335
+					return false;
336
+		}
319 337
 	}
320 338
 
321 339
 	/**
@@ -325,10 +343,11 @@  discard block
 block discarded – undo
325 343
 	 */
326 344
 	public function isPayment()
327 345
 	{
328
-		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept')
329
-			return true;
330
-		else
331
-			return false;
346
+		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept') {
347
+					return true;
348
+		} else {
349
+					return false;
350
+		}
332 351
 	}
333 352
 
334 353
 	/**
@@ -341,10 +360,11 @@  discard block
 block discarded – undo
341 360
 		// subscr_cancel is sent when the user cancels, subscr_eot is sent when the subscription reaches final payment
342 361
 		// Neither require us to *do* anything as per performCancel().
343 362
 		// subscr_eot, if sent, indicates an end of payments term.
344
-		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot')
345
-			return true;
346
-		else
347
-			return false;
363
+		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot') {
364
+					return true;
365
+		} else {
366
+					return false;
367
+		}
348 368
 	}
349 369
 
350 370
 	/**
@@ -409,8 +429,9 @@  discard block
 block discarded – undo
409 429
 		global $smcFunc;
410 430
 
411 431
 		// Assume we have this?
412
-		if (empty($_POST['subscr_id']))
413
-			return false;
432
+		if (empty($_POST['subscr_id'])) {
433
+					return false;
434
+		}
414 435
 
415 436
 		// Do we have this in the database?
416 437
 		$request = $smcFunc['db_query']('', '
@@ -439,11 +460,12 @@  discard block
 block discarded – undo
439 460
 						'payer_email' => $_POST['payer_email'],
440 461
 					)
441 462
 				);
442
-				if ($smcFunc['db_num_rows']($request) === 0)
443
-					return false;
463
+				if ($smcFunc['db_num_rows']($request) === 0) {
464
+									return false;
465
+				}
466
+			} else {
467
+							return false;
444 468
 			}
445
-			else
446
-				return false;
447 469
 		}
448 470
 		list ($member_id, $subscription_id) = $smcFunc['db_fetch_row']($request);
449 471
 		$_POST['item_number'] = $member_id . '+' . $subscription_id;
Please login to merge, or discard this patch.
Themes/default/Post.template.php 1 patch
Braces   +89 added lines, -61 removed lines patch added patch discarded remove patch
@@ -22,22 +22,24 @@  discard block
 block discarded – undo
22 22
 		<script>';
23 23
 
24 24
 	// When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
25
-	if (isBrowser('is_firefox'))
26
-		echo '
25
+	if (isBrowser('is_firefox')) {
26
+			echo '
27 27
 			window.addEventListener("pageshow", reActivate, false);';
28
+	}
28 29
 
29 30
 	// Start with message icons - and any missing from this theme.
30 31
 	echo '
31 32
 			var icon_urls = {';
32
-	foreach ($context['icons'] as $icon)
33
-		echo '
33
+	foreach ($context['icons'] as $icon) {
34
+			echo '
34 35
 				\'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ',';
36
+	}
35 37
 	echo '
36 38
 			};';
37 39
 
38 40
 	// If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
39
-	if ($context['make_poll'])
40
-		echo '
41
+	if ($context['make_poll']) {
42
+			echo '
41 43
 			var pollOptionNum = 0, pollTabIndex;
42 44
 			var pollOptionId = ', $context['last_choice_id'], ';
43 45
 			function addPollOption()
@@ -56,11 +58,13 @@  discard block
 block discarded – undo
56 58
 
57 59
 				setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<dt><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>:</dt><dd><input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text"></dd><p id="pollMoreOptions"></p>'), ');
58 60
 			}';
61
+	}
59 62
 
60 63
 	// If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here.
61
-	if ($context['make_event'])
62
-		echo '
64
+	if ($context['make_event']) {
65
+			echo '
63 66
 			var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];';
67
+	}
64 68
 
65 69
 	// End of the javascript, start the form and display the link tree.
66 70
 	echo '
@@ -80,9 +84,10 @@  discard block
 block discarded – undo
80 84
 				</div>
81 85
 			</div><br>';
82 86
 
83
-	if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
84
-		echo '
87
+	if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) {
88
+			echo '
85 89
 			<input type="hidden" name="eventid" value="', $context['event']['id'], '">';
90
+	}
86 91
 
87 92
 	// Start the main table.
88 93
 	echo '
@@ -117,18 +122,20 @@  discard block
 block discarded – undo
117 122
 	}
118 123
 
119 124
 	// If it's locked, show a message to warn the replier.
120
-	if (!empty($context['locked']))
121
-	echo '
125
+	if (!empty($context['locked'])) {
126
+		echo '
122 127
 					<p class="errorbox">
123 128
 						', $txt['topic_locked_no_reply'], '
124 129
 					</p>';
130
+	}
125 131
 
126
-	if (!empty($modSettings['drafts_post_enabled']))
127
-		echo '
132
+	if (!empty($modSettings['drafts_post_enabled'])) {
133
+			echo '
128 134
 					<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>',
129 135
 						sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), '
130 136
 						', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), '
131 137
 					</div>';
138
+	}
132 139
 
133 140
 	// The post header... important stuff
134 141
 	echo '
@@ -180,9 +187,10 @@  discard block
 block discarded – undo
180 187
 				{
181 188
 					echo '
182 189
 										<optgroup label="', $category['name'], '">';
183
-					foreach ($category['boards'] as $board)
184
-						echo '
190
+					foreach ($category['boards'] as $board) {
191
+											echo '
185 192
 											<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
193
+					}
186 194
 					echo '
187 195
 										</optgroup>';
188 196
 				}
@@ -218,9 +226,10 @@  discard block
 block discarded – undo
218 226
 									<span class="label">', $txt['calendar_timezone'], '</span>
219 227
 									<select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>';
220 228
 
221
-			foreach ($context['all_timezones'] as $tz => $tzname)
222
-				echo '
229
+			foreach ($context['all_timezones'] as $tz => $tzname) {
230
+							echo '
223 231
 										<option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>';
232
+			}
224 233
 
225 234
 			echo '
226 235
 									</select>
@@ -286,14 +295,15 @@  discard block
 block discarded – undo
286 295
 									<input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', ' class="input_check">
287 296
 								</dd>';
288 297
 
289
-		if ($context['poll_options']['guest_vote_enabled'])
290
-			echo '
298
+		if ($context['poll_options']['guest_vote_enabled']) {
299
+					echo '
291 300
 								<dt>
292 301
 									<label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
293 302
 								</dt>
294 303
 								<dd>
295 304
 									<input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked' : '', ' class="input_check">
296 305
 								</dd>';
306
+		}
297 307
 
298 308
 		echo '
299 309
 								<dt>
@@ -314,8 +324,8 @@  discard block
 block discarded – undo
314 324
 					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
315 325
 
316 326
 	// If we're editing and displaying edit details, show a box where they can say why
317
-	if (isset($context['editing']) && $modSettings['show_modify'])
318
-		echo '
327
+	if (isset($context['editing']) && $modSettings['show_modify']) {
328
+			echo '
319 329
 					<dl>
320 330
 						<dt class="clear">
321 331
 							<span id="caption_edit_reason">', $txt['reason_for_edit'], ':</span>
@@ -324,20 +334,23 @@  discard block
 block discarded – undo
324 334
 							<input type="text" name="modify_reason"', isset($context['last_modified_reason']) ? ' value="' . $context['last_modified_reason'] . '"' : '', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text">
325 335
 						</dd>
326 336
 					</dl>';
337
+	}
327 338
 
328 339
 	// If this message has been edited in the past - display when it was.
329
-	if (isset($context['last_modified']))
330
-		echo '
340
+	if (isset($context['last_modified'])) {
341
+			echo '
331 342
 					<div class="padding smalltext">
332 343
 						', $context['last_modified_text'], '
333 344
 					</div>';
345
+	}
334 346
 
335 347
 	// If the admin has enabled the hiding of the additional options - show a link and image for it.
336
-	if (!empty($modSettings['additional_options_collapsable']))
337
-		echo '
348
+	if (!empty($modSettings['additional_options_collapsable'])) {
349
+			echo '
338 350
 					<div id="postAdditionalOptionsHeader">
339 351
 						<strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
340 352
 					</div>';
353
+	}
341 354
 
342 355
 	echo '
343 356
 					<div id="postAdditionalOptions">';
@@ -369,19 +382,21 @@  discard block
 block discarded – undo
369 382
 								<input type="hidden" name="attach_del[]" value="0">
370 383
 								', $txt['uncheck_unwatchd_attach'], ':
371 384
 							</dd>';
372
-		foreach ($context['current_attachments'] as $attachment)
373
-			echo '
385
+		foreach ($context['current_attachments'] as $attachment) {
386
+					echo '
374 387
 							<dd class="smalltext">
375 388
 								<label for="attachment_', $attachment['attachID'], '"><input type="checkbox" id="attachment_', $attachment['attachID'], '" name="attach_del[]" value="', $attachment['attachID'], '"', empty($attachment['unchecked']) ? ' checked' : '', ' class="input_check"> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''),
376 389
 								!empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1028) / 1028), 0)) : '', '</label>
377 390
 							</dd>';
391
+		}
378 392
 
379 393
 		echo '
380 394
 						</dl>';
381 395
 
382
-		if (!empty($context['files_in_session_warning']))
383
-			echo '
396
+		if (!empty($context['files_in_session_warning'])) {
397
+					echo '
384 398
 						<div class="smalltext">', $context['files_in_session_warning'], '</div>';
399
+		}
385 400
 	}
386 401
 
387 402
 	// Is the user allowed to post any additional ones? If so give them the boxes to do it!
@@ -434,8 +449,8 @@  discard block
 block discarded – undo
434 449
 								', empty($modSettings['attachmentSizeLimit']) ? '' : ('<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1028 . '">');
435 450
 
436 451
 		// Show more boxes if they aren't approaching that limit.
437
-		if ($context['num_allowed_attachments'] > 1)
438
-			echo '
452
+		if ($context['num_allowed_attachments'] > 1) {
453
+					echo '
439 454
 										<script>
440 455
 											var allowed_attachments = ', $context['num_allowed_attachments'], ';
441 456
 											var current_attachment = 1;
@@ -456,9 +471,10 @@  discard block
 block discarded – undo
456 471
 									</div>
457 472
 								</div>
458 473
 							</dd>';
459
-		else
460
-			echo '
474
+		} else {
475
+					echo '
461 476
 							</dd>';
477
+		}
462 478
 
463 479
 		// Add any template changes for an alternative upload system here.
464 480
 		call_integration_hook('integrate_upload_template');
@@ -467,21 +483,25 @@  discard block
 block discarded – undo
467 483
 							<dd class="smalltext">';
468 484
 
469 485
 		// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
470
-		if (!empty($modSettings['attachmentCheckExtensions']))
471
-			echo '
486
+		if (!empty($modSettings['attachmentCheckExtensions'])) {
487
+					echo '
472 488
 								', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br>';
489
+		}
473 490
 
474
-		if (!empty($context['attachment_restrictions']))
475
-			echo '
491
+		if (!empty($context['attachment_restrictions'])) {
492
+					echo '
476 493
 								', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br>';
494
+		}
477 495
 
478
-		if ($context['num_allowed_attachments'] == 0)
479
-			echo '
496
+		if ($context['num_allowed_attachments'] == 0) {
497
+					echo '
480 498
 								', $txt['attach_limit_nag'], '<br>';
499
+		}
481 500
 
482
-		if (!$context['can_post_attachment_unapproved'])
483
-			echo '
501
+		if (!$context['can_post_attachment_unapproved']) {
502
+					echo '
484 503
 								<span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br>';
504
+		}
485 505
 
486 506
 		echo '
487 507
 							</dd>
@@ -504,10 +524,11 @@  discard block
 block discarded – undo
504 524
 							<dt><strong>', $txt['subject'], '</strong></dt>
505 525
 							<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
506 526
 
507
-		foreach ($context['drafts'] as $draft)
508
-			echo '
527
+		foreach ($context['drafts'] as $draft) {
528
+					echo '
509 529
 							<dt>', $draft['link'], '</dt>
510 530
 							<dd>', $draft['poster_time'], '</dd>';
531
+		}
511 532
 		echo '
512 533
 						</dl>
513 534
 					</div>';
@@ -532,9 +553,10 @@  discard block
 block discarded – undo
532 553
 						', template_control_richedit_buttons($context['post_box_name']);
533 554
 
534 555
 	// Option to delete an event if user is editing one.
535
-	if ($context['make_event'] && !$context['event']['new'])
536
-		echo '
556
+	if ($context['make_event'] && !$context['event']['new']) {
557
+			echo '
537 558
 						<input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['event_delete_confirm'] ,'" class="button_submit you_sure">';
559
+	}
538 560
 
539 561
 	echo '
540 562
 					</span>
@@ -543,9 +565,10 @@  discard block
 block discarded – undo
543 565
 			<br class="clear">';
544 566
 
545 567
 	// Assuming this isn't a new topic pass across the last message id.
546
-	if (isset($context['topic_last_message']))
547
-		echo '
568
+	if (isset($context['topic_last_message'])) {
569
+			echo '
548 570
 			<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '">';
571
+	}
549 572
 
550 573
 	echo '
551 574
 			<input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '">
@@ -687,9 +710,10 @@  discard block
 block discarded – undo
687 710
 
688 711
 						newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \'"><div id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \'&nbsp;&#187;</span> <span class="new_posts" id="image_new_\' + newPosts[i].getAttribute("id") + \'">', $txt['new'], '</span></div>\';';
689 712
 
690
-	if ($context['can_quote'])
691
-		echo '
713
+	if ($context['can_quote']) {
714
+			echo '
692 715
 						newPostsHTML += \'<ul class="quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');" class="quote_button"><span>', $txt['quote'], '</span><\' + \'/a></li></ul>\';';
716
+	}
693 717
 
694 718
 	echo '
695 719
 						newPostsHTML += \'<br class="clear">\';
@@ -732,8 +756,8 @@  discard block
 block discarded – undo
732 756
 			}';
733 757
 
734 758
 	// Code for showing and hiding additional options.
735
-	if (!empty($modSettings['additional_options_collapsable']))
736
-		echo '
759
+	if (!empty($modSettings['additional_options_collapsable'])) {
760
+			echo '
737 761
 			var oSwapAdditionalOptions = new smc_Toggle({
738 762
 				bToggleEnabled: true,
739 763
 				bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ',
@@ -761,10 +785,11 @@  discard block
 block discarded – undo
761 785
 					}
762 786
 				]
763 787
 			});';
788
+	}
764 789
 
765 790
 	// Code for showing and hiding drafts
766
-	if (!empty($context['drafts']))
767
-		echo '
791
+	if (!empty($context['drafts'])) {
792
+			echo '
768 793
 			var oSwapDraftOptions = new smc_Toggle({
769 794
 				bToggleEnabled: true,
770 795
 				bCurrentlyCollapsed: true,
@@ -786,6 +811,7 @@  discard block
 block discarded – undo
786 811
 					}
787 812
 				]
788 813
 			});';
814
+	}
789 815
 
790 816
 	echo '
791 817
 			var oEditorID = "', $context['post_box_name'] ,'";
@@ -806,8 +832,9 @@  discard block
 block discarded – undo
806 832
 		foreach ($context['previous_posts'] as $post)
807 833
 		{
808 834
 			$ignoring = false;
809
-			if (!empty($post['is_ignored']))
810
-				$ignored_posts[] = $ignoring = $post['id'];
835
+			if (!empty($post['is_ignored'])) {
836
+							$ignored_posts[] = $ignoring = $post['id'];
837
+			}
811 838
 
812 839
 			echo '
813 840
 			<div class="windowbg">
@@ -990,10 +1017,10 @@  discard block
 block discarded – undo
990 1017
 		<div id="temporary_posting_area" style="display: none;"></div>
991 1018
 		<script>';
992 1019
 
993
-	if ($context['close_window'])
994
-		echo '
1020
+	if ($context['close_window']) {
1021
+			echo '
995 1022
 			window.close();';
996
-	else
1023
+	} else
997 1024
 	{
998 1025
 		// Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;).
999 1026
 		echo '
@@ -1047,11 +1074,12 @@  discard block
 block discarded – undo
1047 1074
 				</p>
1048 1075
 				<ul>';
1049 1076
 
1050
-	foreach ($context['groups'] as $group)
1051
-		echo '
1077
+	foreach ($context['groups'] as $group) {
1078
+			echo '
1052 1079
 					<li>
1053 1080
 						<label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked class="input_check"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em>
1054 1081
 					</li>';
1082
+	}
1055 1083
 
1056 1084
 	echo '
1057 1085
 					<li>
Please login to merge, or discard this patch.
SSI.php 1 patch
Braces   +426 added lines, -304 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Don't do anything if SMF is already loaded.
15
-if (defined('SMF'))
15
+if (defined('SMF')) {
16 16
 	return true;
17
+}
17 18
 
18 19
 define('SMF', 'SSI');
19 20
 
@@ -28,16 +29,18 @@  discard block
 block discarded – undo
28 29
 $time_start = microtime();
29 30
 
30 31
 // Just being safe...
31
-foreach (array('db_character_set', 'cachedir') as $variable)
32
+foreach (array('db_character_set', 'cachedir') as $variable) {
32 33
 	if (isset($GLOBALS[$variable]))
33 34
 		unset($GLOBALS[$variable]);
35
+}
34 36
 
35 37
 // Get the forum's settings for database and file paths.
36 38
 require_once(dirname(__FILE__) . '/Settings.php');
37 39
 
38 40
 // Make absolutely sure the cache directory is defined.
39
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
41
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
40 42
 	$cachedir = $boarddir . '/cache';
43
+}
41 44
 
42 45
 $ssi_error_reporting = error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
43 46
 /* Set this to one of three values depending on what you want to happen in the case of a fatal error.
@@ -48,12 +51,14 @@  discard block
 block discarded – undo
48 51
 $ssi_on_error_method = false;
49 52
 
50 53
 // Don't do john didley if the forum's been shut down completely.
51
-if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true))
54
+if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) {
52 55
 	die($mmessage);
56
+}
53 57
 
54 58
 // Fix for using the current directory as a path.
55
-if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
59
+if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') {
56 60
 	$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);
61
+}
57 62
 
58 63
 // Load the important includes.
59 64
 require_once($sourcedir . '/QueryString.php');
@@ -78,34 +83,38 @@  discard block
 block discarded – undo
78 83
 cleanRequest();
79 84
 
80 85
 // Seed the random generator?
81
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
86
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
82 87
 	smf_seed_generator();
88
+}
83 89
 
84 90
 // Check on any hacking attempts.
85
-if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
91
+if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
86 92
 	die('No direct access...');
87
-elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme)
93
+} elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) {
88 94
 	die('No direct access...');
89
-elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme)
95
+} elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) {
90 96
 	die('No direct access...');
91
-elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers)
97
+} elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) {
92 98
 	die('No direct access...');
93
-if (isset($_REQUEST['context']))
99
+}
100
+if (isset($_REQUEST['context'])) {
94 101
 	die('No direct access...');
102
+}
95 103
 
96 104
 // Gzip output? (because it must be boolean and true, this can't be hacked.)
97
-if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>='))
105
+if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) {
98 106
 	ob_start('ob_gzhandler');
99
-else
107
+} else {
100 108
 	$modSettings['enableCompressedOutput'] = '0';
109
+}
101 110
 
102 111
 // Primarily, this is to fix the URLs...
103 112
 ob_start('ob_sessrewrite');
104 113
 
105 114
 // Start the session... known to scramble SSI includes in cases...
106
-if (!headers_sent())
115
+if (!headers_sent()) {
107 116
 	loadSession();
108
-else
117
+} else
109 118
 {
110 119
 	if (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()]))
111 120
 	{
@@ -139,12 +148,14 @@  discard block
 block discarded – undo
139 148
 loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0);
140 149
 
141 150
 // @todo: probably not the best place, but somewhere it should be set...
142
-if (!headers_sent())
151
+if (!headers_sent()) {
143 152
 	header('Content-Type: text/html; charset=' . (empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set']));
153
+}
144 154
 
145 155
 // Take care of any banning that needs to be done.
146
-if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true))
156
+if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) {
147 157
 	is_not_banned();
158
+}
148 159
 
149 160
 // Do we allow guests in here?
150 161
 if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php')
@@ -159,17 +170,19 @@  discard block
 block discarded – undo
159 170
 {
160 171
 	$context['template_layers'] = $ssi_layers;
161 172
 	template_header();
162
-}
163
-else
173
+} else {
164 174
 	setupThemeContext();
175
+}
165 176
 
166 177
 // Make sure they didn't muss around with the settings... but only if it's not cli.
167
-if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '')
178
+if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') {
168 179
 	trigger_error($txt['ssi_session_broken'], E_USER_NOTICE);
180
+}
169 181
 
170 182
 // Without visiting the forum this session variable might not be set on submit.
171
-if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote'))
183
+if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) {
172 184
 	$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
185
+}
173 186
 
174 187
 // Have the ability to easily add functions to SSI.
175 188
 call_integration_hook('integrate_SSI');
@@ -178,11 +191,13 @@  discard block
 block discarded – undo
178 191
 if (basename($_SERVER['PHP_SELF']) == 'SSI.php')
179 192
 {
180 193
 	// You shouldn't just access SSI.php directly by URL!!
181
-	if (!isset($_GET['ssi_function']))
182
-		die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
194
+	if (!isset($_GET['ssi_function'])) {
195
+			die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
196
+	}
183 197
 	// Call a function passed by GET.
184
-	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest']))
185
-		call_user_func('ssi_' . $_GET['ssi_function']);
198
+	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) {
199
+			call_user_func('ssi_' . $_GET['ssi_function']);
200
+	}
186 201
 	exit;
187 202
 }
188 203
 
@@ -199,9 +214,10 @@  discard block
 block discarded – undo
199 214
  */
200 215
 function ssi_shutdown()
201 216
 {
202
-	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown')
203
-		template_footer();
204
-}
217
+	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') {
218
+			template_footer();
219
+	}
220
+	}
205 221
 
206 222
 /**
207 223
  * Display a welcome message, like: Hey, User, you have 0 messages, 0 are new.
@@ -214,15 +230,17 @@  discard block
 block discarded – undo
214 230
 
215 231
 	if ($output_method == 'echo')
216 232
 	{
217
-		if ($context['user']['is_guest'])
218
-			echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
219
-		else
220
-			echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
233
+		if ($context['user']['is_guest']) {
234
+					echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
235
+		} else {
236
+					echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
237
+		}
221 238
 	}
222 239
 	// Don't echo... then do what?!
223
-	else
224
-		return $context['user'];
225
-}
240
+	else {
241
+			return $context['user'];
242
+	}
243
+	}
226 244
 
227 245
 /**
228 246
  * Display a menu bar, like is displayed at the top of the forum.
@@ -233,12 +251,14 @@  discard block
 block discarded – undo
233 251
 {
234 252
 	global $context;
235 253
 
236
-	if ($output_method == 'echo')
237
-		template_menu();
254
+	if ($output_method == 'echo') {
255
+			template_menu();
256
+	}
238 257
 	// What else could this do?
239
-	else
240
-		return $context['menu_buttons'];
241
-}
258
+	else {
259
+			return $context['menu_buttons'];
260
+	}
261
+	}
242 262
 
243 263
 /**
244 264
  * Show a logout link.
@@ -250,20 +270,23 @@  discard block
 block discarded – undo
250 270
 {
251 271
 	global $context, $txt, $scripturl;
252 272
 
253
-	if ($redirect_to != '')
254
-		$_SESSION['logout_url'] = $redirect_to;
273
+	if ($redirect_to != '') {
274
+			$_SESSION['logout_url'] = $redirect_to;
275
+	}
255 276
 
256 277
 	// Guests can't log out.
257
-	if ($context['user']['is_guest'])
258
-		return false;
278
+	if ($context['user']['is_guest']) {
279
+			return false;
280
+	}
259 281
 
260 282
 	$link = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['logout'] . '</a>';
261 283
 
262
-	if ($output_method == 'echo')
263
-		echo $link;
264
-	else
265
-		return $link;
266
-}
284
+	if ($output_method == 'echo') {
285
+			echo $link;
286
+	} else {
287
+			return $link;
288
+	}
289
+	}
267 290
 
268 291
 /**
269 292
  * Recent post list:   [board] Subject by Poster    Date
@@ -279,17 +302,17 @@  discard block
 block discarded – undo
279 302
 	global $modSettings, $context;
280 303
 
281 304
 	// Excluding certain boards...
282
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
283
-		$exclude_boards = array($modSettings['recycle_board']);
284
-	else
285
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
305
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
306
+			$exclude_boards = array($modSettings['recycle_board']);
307
+	} else {
308
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
309
+	}
286 310
 
287 311
 	// What about including certain boards - note we do some protection here as pre-2.0 didn't have this parameter.
288 312
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
289 313
 	{
290 314
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
291
-	}
292
-	elseif ($include_boards != null)
315
+	} elseif ($include_boards != null)
293 316
 	{
294 317
 		$include_boards = array();
295 318
 	}
@@ -326,8 +349,9 @@  discard block
 block discarded – undo
326 349
 {
327 350
 	global $modSettings;
328 351
 
329
-	if (empty($post_ids))
330
-		return;
352
+	if (empty($post_ids)) {
353
+			return;
354
+	}
331 355
 
332 356
 	// Allow the user to request more than one - why not?
333 357
 	$post_ids = is_array($post_ids) ? $post_ids : array($post_ids);
@@ -362,8 +386,9 @@  discard block
 block discarded – undo
362 386
 	global $scripturl, $txt, $user_info;
363 387
 	global $modSettings, $smcFunc, $context;
364 388
 
365
-	if (!empty($modSettings['enable_likes']))
366
-		$context['can_like'] = allowedTo('likes_like');
389
+	if (!empty($modSettings['enable_likes'])) {
390
+			$context['can_like'] = allowedTo('likes_like');
391
+	}
367 392
 
368 393
 	// Find all the posts. Newer ones will have higher IDs.
369 394
 	$request = $smcFunc['db_query']('substring', '
@@ -429,12 +454,13 @@  discard block
 block discarded – undo
429 454
 		);
430 455
 
431 456
 		// Get the likes for each message.
432
-		if (!empty($modSettings['enable_likes']))
433
-			$posts[$row['id_msg']]['likes'] = array(
457
+		if (!empty($modSettings['enable_likes'])) {
458
+					$posts[$row['id_msg']]['likes'] = array(
434 459
 				'count' => $row['likes'],
435 460
 				'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])),
436 461
 				'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']),
437 462
 			);
463
+		}
438 464
 	}
439 465
 	$smcFunc['db_free_result']($request);
440 466
 
@@ -442,13 +468,14 @@  discard block
 block discarded – undo
442 468
 	call_integration_hook('integrate_ssi_queryPosts', array(&$posts));
443 469
 
444 470
 	// Just return it.
445
-	if ($output_method != 'echo' || empty($posts))
446
-		return $posts;
471
+	if ($output_method != 'echo' || empty($posts)) {
472
+			return $posts;
473
+	}
447 474
 
448 475
 	echo '
449 476
 		<table style="border: none" class="ssi_table">';
450
-	foreach ($posts as $post)
451
-		echo '
477
+	foreach ($posts as $post) {
478
+			echo '
452 479
 			<tr>
453 480
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
454 481
 					[', $post['board']['link'], ']
@@ -462,6 +489,7 @@  discard block
 block discarded – undo
462 489
 					', $post['time'], '
463 490
 				</td>
464 491
 			</tr>';
492
+	}
465 493
 	echo '
466 494
 		</table>';
467 495
 }
@@ -479,25 +507,26 @@  discard block
 block discarded – undo
479 507
 	global $settings, $scripturl, $txt, $user_info;
480 508
 	global $modSettings, $smcFunc, $context;
481 509
 
482
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
483
-		$exclude_boards = array($modSettings['recycle_board']);
484
-	else
485
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
510
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
511
+			$exclude_boards = array($modSettings['recycle_board']);
512
+	} else {
513
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
514
+	}
486 515
 
487 516
 	// Only some boards?.
488 517
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
489 518
 	{
490 519
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
491
-	}
492
-	elseif ($include_boards != null)
520
+	} elseif ($include_boards != null)
493 521
 	{
494 522
 		$output_method = $include_boards;
495 523
 		$include_boards = array();
496 524
 	}
497 525
 
498 526
 	$icon_sources = array();
499
-	foreach ($context['stable_icons'] as $icon)
500
-		$icon_sources[$icon] = 'images_url';
527
+	foreach ($context['stable_icons'] as $icon) {
528
+			$icon_sources[$icon] = 'images_url';
529
+	}
501 530
 
502 531
 	// Find all the posts in distinct topics.  Newer ones will have higher IDs.
503 532
 	$request = $smcFunc['db_query']('substring', '
@@ -522,13 +551,15 @@  discard block
 block discarded – undo
522 551
 		)
523 552
 	);
524 553
 	$topics = array();
525
-	while ($row = $smcFunc['db_fetch_assoc']($request))
526
-		$topics[$row['id_topic']] = $row;
554
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
555
+			$topics[$row['id_topic']] = $row;
556
+	}
527 557
 	$smcFunc['db_free_result']($request);
528 558
 
529 559
 	// Did we find anything? If not, bail.
530
-	if (empty($topics))
531
-		return array();
560
+	if (empty($topics)) {
561
+			return array();
562
+	}
532 563
 
533 564
 	$recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
534 565
 
@@ -556,19 +587,22 @@  discard block
 block discarded – undo
556 587
 	while ($row = $smcFunc['db_fetch_assoc']($request))
557 588
 	{
558 589
 		$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => '&#10;')));
559
-		if ($smcFunc['strlen']($row['body']) > 128)
560
-			$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
590
+		if ($smcFunc['strlen']($row['body']) > 128) {
591
+					$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
592
+		}
561 593
 
562 594
 		// Censor the subject.
563 595
 		censorText($row['subject']);
564 596
 		censorText($row['body']);
565 597
 
566 598
 		// Recycled icon
567
-		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board'])
568
-			$row['icon'] = 'recycled';
599
+		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) {
600
+					$row['icon'] = 'recycled';
601
+		}
569 602
 
570
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
571
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
603
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
604
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
605
+		}
572 606
 
573 607
 		// Build the array.
574 608
 		$posts[] = array(
@@ -607,13 +641,14 @@  discard block
 block discarded – undo
607 641
 	call_integration_hook('integrate_ssi_recentTopics', array(&$posts));
608 642
 
609 643
 	// Just return it.
610
-	if ($output_method != 'echo' || empty($posts))
611
-		return $posts;
644
+	if ($output_method != 'echo' || empty($posts)) {
645
+			return $posts;
646
+	}
612 647
 
613 648
 	echo '
614 649
 		<table style="border: none" class="ssi_table">';
615
-	foreach ($posts as $post)
616
-		echo '
650
+	foreach ($posts as $post) {
651
+			echo '
617 652
 			<tr>
618 653
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
619 654
 					[', $post['board']['link'], ']
@@ -627,6 +662,7 @@  discard block
 block discarded – undo
627 662
 					', $post['time'], '
628 663
 				</td>
629 664
 			</tr>';
665
+	}
630 666
 	echo '
631 667
 		</table>';
632 668
 }
@@ -651,27 +687,30 @@  discard block
 block discarded – undo
651 687
 		)
652 688
 	);
653 689
 	$return = array();
654
-	while ($row = $smcFunc['db_fetch_assoc']($request))
655
-		$return[] = array(
690
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
691
+			$return[] = array(
656 692
 			'id' => $row['id_member'],
657 693
 			'name' => $row['real_name'],
658 694
 			'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
659 695
 			'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
660 696
 			'posts' => $row['posts']
661 697
 		);
698
+	}
662 699
 	$smcFunc['db_free_result']($request);
663 700
 
664 701
 	// If mods want to do somthing with this list of members, let them do that now.
665 702
 	call_integration_hook('integrate_ssi_topPoster', array(&$return));
666 703
 
667 704
 	// Just return all the top posters.
668
-	if ($output_method != 'echo')
669
-		return $return;
705
+	if ($output_method != 'echo') {
706
+			return $return;
707
+	}
670 708
 
671 709
 	// Make a quick array to list the links in.
672 710
 	$temp_array = array();
673
-	foreach ($return as $member)
674
-		$temp_array[] = $member['link'];
711
+	foreach ($return as $member) {
712
+			$temp_array[] = $member['link'];
713
+	}
675 714
 
676 715
 	echo implode(', ', $temp_array);
677 716
 }
@@ -703,8 +742,8 @@  discard block
 block discarded – undo
703 742
 		)
704 743
 	);
705 744
 	$boards = array();
706
-	while ($row = $smcFunc['db_fetch_assoc']($request))
707
-		$boards[] = array(
745
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
746
+			$boards[] = array(
708 747
 			'id' => $row['id_board'],
709 748
 			'num_posts' => $row['num_posts'],
710 749
 			'num_topics' => $row['num_topics'],
@@ -713,14 +752,16 @@  discard block
 block discarded – undo
713 752
 			'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
714 753
 			'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'
715 754
 		);
755
+	}
716 756
 	$smcFunc['db_free_result']($request);
717 757
 
718 758
 	// If mods want to do somthing with this list of boards, let them do that now.
719 759
 	call_integration_hook('integrate_ssi_topBoards', array(&$boards));
720 760
 
721 761
 	// If we shouldn't output or have nothing to output, just jump out.
722
-	if ($output_method != 'echo' || empty($boards))
723
-		return $boards;
762
+	if ($output_method != 'echo' || empty($boards)) {
763
+			return $boards;
764
+	}
724 765
 
725 766
 	echo '
726 767
 		<table class="ssi_table">
@@ -729,13 +770,14 @@  discard block
 block discarded – undo
729 770
 				<th style="text-align: left">', $txt['board_topics'], '</th>
730 771
 				<th style="text-align: left">', $txt['posts'], '</th>
731 772
 			</tr>';
732
-	foreach ($boards as $sBoard)
733
-		echo '
773
+	foreach ($boards as $sBoard) {
774
+			echo '
734 775
 			<tr>
735 776
 				<td>', $sBoard['link'], $sBoard['new'] ? ' <a href="' . $sBoard['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>' : '', '</td>
736 777
 				<td style="text-align: right">', comma_format($sBoard['num_topics']), '</td>
737 778
 				<td style="text-align: right">', comma_format($sBoard['num_posts']), '</td>
738 779
 			</tr>';
780
+	}
739 781
 	echo '
740 782
 		</table>';
741 783
 }
@@ -768,12 +810,13 @@  discard block
 block discarded – undo
768 810
 			)
769 811
 		);
770 812
 		$topic_ids = array();
771
-		while ($row = $smcFunc['db_fetch_assoc']($request))
772
-			$topic_ids[] = $row['id_topic'];
813
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
814
+					$topic_ids[] = $row['id_topic'];
815
+		}
773 816
 		$smcFunc['db_free_result']($request);
817
+	} else {
818
+			$topic_ids = array();
774 819
 	}
775
-	else
776
-		$topic_ids = array();
777 820
 
778 821
 	$request = $smcFunc['db_query']('', '
779 822
 		SELECT m.subject, m.id_topic, t.num_views, t.num_replies
@@ -812,8 +855,9 @@  discard block
 block discarded – undo
812 855
 	// If mods want to do somthing with this list of topics, let them do that now.
813 856
 	call_integration_hook('integrate_ssi_topTopics', array(&$topics, $type));
814 857
 
815
-	if ($output_method != 'echo' || empty($topics))
816
-		return $topics;
858
+	if ($output_method != 'echo' || empty($topics)) {
859
+			return $topics;
860
+	}
817 861
 
818 862
 	echo '
819 863
 		<table class="ssi_table">
@@ -822,8 +866,8 @@  discard block
 block discarded – undo
822 866
 				<th style="text-align: left">', $txt['views'], '</th>
823 867
 				<th style="text-align: left">', $txt['replies'], '</th>
824 868
 			</tr>';
825
-	foreach ($topics as $sTopic)
826
-		echo '
869
+	foreach ($topics as $sTopic) {
870
+			echo '
827 871
 			<tr>
828 872
 				<td style="text-align: left">
829 873
 					', $sTopic['link'], '
@@ -831,6 +875,7 @@  discard block
 block discarded – undo
831 875
 				<td style="text-align: right">', comma_format($sTopic['num_views']), '</td>
832 876
 				<td style="text-align: right">', comma_format($sTopic['num_replies']), '</td>
833 877
 			</tr>';
878
+	}
834 879
 	echo '
835 880
 		</table>';
836 881
 }
@@ -866,12 +911,13 @@  discard block
 block discarded – undo
866 911
 {
867 912
 	global $txt, $context;
868 913
 
869
-	if ($output_method == 'echo')
870
-		echo '
914
+	if ($output_method == 'echo') {
915
+			echo '
871 916
 	', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br>';
872
-	else
873
-		return $context['common_stats']['latest_member'];
874
-}
917
+	} else {
918
+			return $context['common_stats']['latest_member'];
919
+	}
920
+	}
875 921
 
876 922
 /**
877 923
  * Fetches a random member.
@@ -920,8 +966,9 @@  discard block
 block discarded – undo
920 966
 	}
921 967
 
922 968
 	// Just to be sure put the random generator back to something... random.
923
-	if ($random_type != '')
924
-		mt_srand(time());
969
+	if ($random_type != '') {
970
+			mt_srand(time());
971
+	}
925 972
 
926 973
 	return $result;
927 974
 }
@@ -934,8 +981,9 @@  discard block
 block discarded – undo
934 981
  */
935 982
 function ssi_fetchMember($member_ids = array(), $output_method = 'echo')
936 983
 {
937
-	if (empty($member_ids))
938
-		return;
984
+	if (empty($member_ids)) {
985
+			return;
986
+	}
939 987
 
940 988
 	// Can have more than one member if you really want...
941 989
 	$member_ids = is_array($member_ids) ? $member_ids : array($member_ids);
@@ -960,8 +1008,9 @@  discard block
 block discarded – undo
960 1008
  */
961 1009
 function ssi_fetchGroupMembers($group_id = null, $output_method = 'echo')
962 1010
 {
963
-	if ($group_id === null)
964
-		return;
1011
+	if ($group_id === null) {
1012
+			return;
1013
+	}
965 1014
 
966 1015
 	$query_where = '
967 1016
 		id_group = {int:id_group}
@@ -988,8 +1037,9 @@  discard block
 block discarded – undo
988 1037
 {
989 1038
 	global $smcFunc, $memberContext;
990 1039
 
991
-	if ($query_where === null)
992
-		return;
1040
+	if ($query_where === null) {
1041
+			return;
1042
+	}
993 1043
 
994 1044
 	// Fetch the members in question.
995 1045
 	$request = $smcFunc['db_query']('', '
@@ -1002,12 +1052,14 @@  discard block
 block discarded – undo
1002 1052
 		))
1003 1053
 	);
1004 1054
 	$members = array();
1005
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1006
-		$members[] = $row['id_member'];
1055
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1056
+			$members[] = $row['id_member'];
1057
+	}
1007 1058
 	$smcFunc['db_free_result']($request);
1008 1059
 
1009
-	if (empty($members))
1010
-		return array();
1060
+	if (empty($members)) {
1061
+			return array();
1062
+	}
1011 1063
 
1012 1064
 	// If mods want to do somthing with this list of members, let them do that now.
1013 1065
 	call_integration_hook('integrate_ssi_queryMembers', array(&$members));
@@ -1016,23 +1068,25 @@  discard block
 block discarded – undo
1016 1068
 	loadMemberData($members);
1017 1069
 
1018 1070
 	// Draw the table!
1019
-	if ($output_method == 'echo')
1020
-		echo '
1071
+	if ($output_method == 'echo') {
1072
+			echo '
1021 1073
 		<table style="border: none" class="ssi_table">';
1074
+	}
1022 1075
 
1023 1076
 	$query_members = array();
1024 1077
 	foreach ($members as $member)
1025 1078
 	{
1026 1079
 		// Load their context data.
1027
-		if (!loadMemberContext($member))
1028
-			continue;
1080
+		if (!loadMemberContext($member)) {
1081
+					continue;
1082
+		}
1029 1083
 
1030 1084
 		// Store this member's information.
1031 1085
 		$query_members[$member] = $memberContext[$member];
1032 1086
 
1033 1087
 		// Only do something if we're echo'ing.
1034
-		if ($output_method == 'echo')
1035
-			echo '
1088
+		if ($output_method == 'echo') {
1089
+					echo '
1036 1090
 			<tr>
1037 1091
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
1038 1092
 					', $query_members[$member]['link'], '
@@ -1040,12 +1094,14 @@  discard block
 block discarded – undo
1040 1094
 					<br>', $query_members[$member]['avatar']['image'], '
1041 1095
 				</td>
1042 1096
 			</tr>';
1097
+		}
1043 1098
 	}
1044 1099
 
1045 1100
 	// End the table if appropriate.
1046
-	if ($output_method == 'echo')
1047
-		echo '
1101
+	if ($output_method == 'echo') {
1102
+			echo '
1048 1103
 		</table>';
1104
+	}
1049 1105
 
1050 1106
 	// Send back the data.
1051 1107
 	return $query_members;
@@ -1060,8 +1116,9 @@  discard block
 block discarded – undo
1060 1116
 {
1061 1117
 	global $txt, $scripturl, $modSettings, $smcFunc;
1062 1118
 
1063
-	if (!allowedTo('view_stats'))
1064
-		return;
1119
+	if (!allowedTo('view_stats')) {
1120
+			return;
1121
+	}
1065 1122
 
1066 1123
 	$totals = array(
1067 1124
 		'members' => $modSettings['totalMembers'],
@@ -1090,8 +1147,9 @@  discard block
 block discarded – undo
1090 1147
 	// If mods want to do somthing with the board stats, let them do that now.
1091 1148
 	call_integration_hook('integrate_ssi_boardStats', array(&$totals));
1092 1149
 
1093
-	if ($output_method != 'echo')
1094
-		return $totals;
1150
+	if ($output_method != 'echo') {
1151
+			return $totals;
1152
+	}
1095 1153
 
1096 1154
 	echo '
1097 1155
 		', $txt['total_members'], ': <a href="', $scripturl . '?action=mlist">', comma_format($totals['members']), '</a><br>
@@ -1120,8 +1178,8 @@  discard block
 block discarded – undo
1120 1178
 	call_integration_hook('integrate_ssi_whosOnline', array(&$return));
1121 1179
 
1122 1180
 	// Add some redundancy for backwards compatibility reasons.
1123
-	if ($output_method != 'echo')
1124
-		return $return + array(
1181
+	if ($output_method != 'echo') {
1182
+			return $return + array(
1125 1183
 			'users' => $return['users_online'],
1126 1184
 			'guests' => $return['num_guests'],
1127 1185
 			'hidden' => $return['num_users_hidden'],
@@ -1129,29 +1187,35 @@  discard block
 block discarded – undo
1129 1187
 			'num_users' => $return['num_users_online'],
1130 1188
 			'total_users' => $return['num_users_online'] + $return['num_guests'],
1131 1189
 		);
1190
+	}
1132 1191
 
1133 1192
 	echo '
1134 1193
 		', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
1135 1194
 
1136 1195
 	$bracketList = array();
1137
-	if (!empty($user_info['buddies']))
1138
-		$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1139
-	if (!empty($return['num_spiders']))
1140
-		$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1141
-	if (!empty($return['num_users_hidden']))
1142
-		$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1196
+	if (!empty($user_info['buddies'])) {
1197
+			$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1198
+	}
1199
+	if (!empty($return['num_spiders'])) {
1200
+			$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1201
+	}
1202
+	if (!empty($return['num_users_hidden'])) {
1203
+			$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1204
+	}
1143 1205
 
1144
-	if (!empty($bracketList))
1145
-		echo ' (' . implode(', ', $bracketList) . ')';
1206
+	if (!empty($bracketList)) {
1207
+			echo ' (' . implode(', ', $bracketList) . ')';
1208
+	}
1146 1209
 
1147 1210
 	echo '<br>
1148 1211
 			', implode(', ', $return['list_users_online']);
1149 1212
 
1150 1213
 	// Showing membergroups?
1151
-	if (!empty($settings['show_group_key']) && !empty($return['membergroups']))
1152
-		echo '<br>
1214
+	if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) {
1215
+			echo '<br>
1153 1216
 			[' . implode(']&nbsp;&nbsp;[', $return['membergroups']) . ']';
1154
-}
1217
+	}
1218
+	}
1155 1219
 
1156 1220
 /**
1157 1221
  * Just like whosOnline except it also logs the online presence.
@@ -1162,11 +1226,12 @@  discard block
 block discarded – undo
1162 1226
 {
1163 1227
 	writeLog();
1164 1228
 
1165
-	if ($output_method != 'echo')
1166
-		return ssi_whosOnline($output_method);
1167
-	else
1168
-		ssi_whosOnline($output_method);
1169
-}
1229
+	if ($output_method != 'echo') {
1230
+			return ssi_whosOnline($output_method);
1231
+	} else {
1232
+			ssi_whosOnline($output_method);
1233
+	}
1234
+	}
1170 1235
 
1171 1236
 // Shows a login box.
1172 1237
 /**
@@ -1179,11 +1244,13 @@  discard block
 block discarded – undo
1179 1244
 {
1180 1245
 	global $scripturl, $txt, $user_info, $context;
1181 1246
 
1182
-	if ($redirect_to != '')
1183
-		$_SESSION['login_url'] = $redirect_to;
1247
+	if ($redirect_to != '') {
1248
+			$_SESSION['login_url'] = $redirect_to;
1249
+	}
1184 1250
 
1185
-	if ($output_method != 'echo' || !$user_info['is_guest'])
1186
-		return $user_info['is_guest'];
1251
+	if ($output_method != 'echo' || !$user_info['is_guest']) {
1252
+			return $user_info['is_guest'];
1253
+	}
1187 1254
 
1188 1255
 	// Create a login token
1189 1256
 	createToken('login');
@@ -1235,8 +1302,9 @@  discard block
 block discarded – undo
1235 1302
 
1236 1303
 	$boardsAllowed = array_intersect(boardsAllowedTo('poll_view'), boardsAllowedTo('poll_vote'));
1237 1304
 
1238
-	if (empty($boardsAllowed))
1239
-		return array();
1305
+	if (empty($boardsAllowed)) {
1306
+			return array();
1307
+	}
1240 1308
 
1241 1309
 	$request = $smcFunc['db_query']('', '
1242 1310
 		SELECT p.id_poll, p.question, t.id_topic, p.max_votes, p.guest_vote, p.hide_results, p.expire_time
@@ -1269,12 +1337,14 @@  discard block
 block discarded – undo
1269 1337
 	$smcFunc['db_free_result']($request);
1270 1338
 
1271 1339
 	// This user has voted on all the polls.
1272
-	if (empty($row) || !is_array($row))
1273
-		return array();
1340
+	if (empty($row) || !is_array($row)) {
1341
+			return array();
1342
+	}
1274 1343
 
1275 1344
 	// If this is a guest who's voted we'll through ourselves to show poll to show the results.
1276
-	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))))
1277
-		return ssi_showPoll($row['id_topic'], $output_method);
1345
+	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) {
1346
+			return ssi_showPoll($row['id_topic'], $output_method);
1347
+	}
1278 1348
 
1279 1349
 	$request = $smcFunc['db_query']('', '
1280 1350
 		SELECT COUNT(DISTINCT id_member)
@@ -1338,8 +1408,9 @@  discard block
 block discarded – undo
1338 1408
 	// If mods want to do somthing with this list of polls, let them do that now.
1339 1409
 	call_integration_hook('integrate_ssi_recentPoll', array(&$return, $topPollInstead));
1340 1410
 
1341
-	if ($output_method != 'echo')
1342
-		return $return;
1411
+	if ($output_method != 'echo') {
1412
+			return $return;
1413
+	}
1343 1414
 
1344 1415
 	if ($allow_view_results)
1345 1416
 	{
@@ -1348,19 +1419,20 @@  discard block
 block discarded – undo
1348 1419
 			<strong>', $return['question'], '</strong><br>
1349 1420
 			', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1350 1421
 
1351
-		foreach ($return['options'] as $option)
1352
-			echo '
1422
+		foreach ($return['options'] as $option) {
1423
+					echo '
1353 1424
 			<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1425
+		}
1354 1426
 
1355 1427
 		echo '
1356 1428
 			<input type="submit" value="', $txt['poll_vote'], '" class="button_submit">
1357 1429
 			<input type="hidden" name="poll" value="', $return['id'], '">
1358 1430
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1359 1431
 		</form>';
1432
+	} else {
1433
+			echo $txt['poll_cannot_see'];
1434
+	}
1360 1435
 	}
1361
-	else
1362
-		echo $txt['poll_cannot_see'];
1363
-}
1364 1436
 
1365 1437
 /**
1366 1438
  * Shows the poll from the specified topic
@@ -1374,13 +1446,15 @@  discard block
 block discarded – undo
1374 1446
 
1375 1447
 	$boardsAllowed = boardsAllowedTo('poll_view');
1376 1448
 
1377
-	if (empty($boardsAllowed))
1378
-		return array();
1449
+	if (empty($boardsAllowed)) {
1450
+			return array();
1451
+	}
1379 1452
 
1380
-	if ($topic === null && isset($_REQUEST['ssi_topic']))
1381
-		$topic = (int) $_REQUEST['ssi_topic'];
1382
-	else
1383
-		$topic = (int) $topic;
1453
+	if ($topic === null && isset($_REQUEST['ssi_topic'])) {
1454
+			$topic = (int) $_REQUEST['ssi_topic'];
1455
+	} else {
1456
+			$topic = (int) $topic;
1457
+	}
1384 1458
 
1385 1459
 	$request = $smcFunc['db_query']('', '
1386 1460
 		SELECT
@@ -1401,17 +1475,18 @@  discard block
 block discarded – undo
1401 1475
 	);
1402 1476
 
1403 1477
 	// Either this topic has no poll, or the user cannot view it.
1404
-	if ($smcFunc['db_num_rows']($request) == 0)
1405
-		return array();
1478
+	if ($smcFunc['db_num_rows']($request) == 0) {
1479
+			return array();
1480
+	}
1406 1481
 
1407 1482
 	$row = $smcFunc['db_fetch_assoc']($request);
1408 1483
 	$smcFunc['db_free_result']($request);
1409 1484
 
1410 1485
 	// Check if they can vote.
1411 1486
 	$already_voted = false;
1412
-	if (!empty($row['expire_time']) && $row['expire_time'] < time())
1413
-		$allow_vote = false;
1414
-	elseif ($user_info['is_guest'])
1487
+	if (!empty($row['expire_time']) && $row['expire_time'] < time()) {
1488
+			$allow_vote = false;
1489
+	} elseif ($user_info['is_guest'])
1415 1490
 	{
1416 1491
 		// There's a difference between "allowed to vote" and "already voted"...
1417 1492
 		$allow_vote = $row['guest_vote'];
@@ -1421,10 +1496,9 @@  discard block
 block discarded – undo
1421 1496
 		{
1422 1497
 			$already_voted = true;
1423 1498
 		}
1424
-	}
1425
-	elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board']))
1426
-		$allow_vote = false;
1427
-	else
1499
+	} elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) {
1500
+			$allow_vote = false;
1501
+	} else
1428 1502
 	{
1429 1503
 		$request = $smcFunc['db_query']('', '
1430 1504
 			SELECT id_member
@@ -1506,8 +1580,9 @@  discard block
 block discarded – undo
1506 1580
 	// If mods want to do somthing with this poll, let them do that now.
1507 1581
 	call_integration_hook('integrate_ssi_showPoll', array(&$return));
1508 1582
 
1509
-	if ($output_method != 'echo')
1510
-		return $return;
1583
+	if ($output_method != 'echo') {
1584
+			return $return;
1585
+	}
1511 1586
 
1512 1587
 	if ($return['allow_vote'])
1513 1588
 	{
@@ -1516,17 +1591,17 @@  discard block
 block discarded – undo
1516 1591
 				<strong>', $return['question'], '</strong><br>
1517 1592
 				', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1518 1593
 
1519
-		foreach ($return['options'] as $option)
1520
-			echo '
1594
+		foreach ($return['options'] as $option) {
1595
+					echo '
1521 1596
 				<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1597
+		}
1522 1598
 
1523 1599
 		echo '
1524 1600
 				<input type="submit" value="', $txt['poll_vote'], '" class="button_submit">
1525 1601
 				<input type="hidden" name="poll" value="', $return['id'], '">
1526 1602
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1527 1603
 			</form>';
1528
-	}
1529
-	else
1604
+	} else
1530 1605
 	{
1531 1606
 		echo '
1532 1607
 			<div class="ssi_poll">
@@ -1606,27 +1681,32 @@  discard block
 block discarded – undo
1606 1681
 			'is_approved' => 1,
1607 1682
 		)
1608 1683
 	);
1609
-	if ($smcFunc['db_num_rows']($request) == 0)
1610
-		die;
1684
+	if ($smcFunc['db_num_rows']($request) == 0) {
1685
+			die;
1686
+	}
1611 1687
 	$row = $smcFunc['db_fetch_assoc']($request);
1612 1688
 	$smcFunc['db_free_result']($request);
1613 1689
 
1614
-	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time']))
1615
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1690
+	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) {
1691
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1692
+	}
1616 1693
 
1617 1694
 	// Too many options checked?
1618
-	if (count($_REQUEST['options']) > $row['max_votes'])
1619
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1695
+	if (count($_REQUEST['options']) > $row['max_votes']) {
1696
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1697
+	}
1620 1698
 
1621 1699
 	// It's a guest who has already voted?
1622 1700
 	if ($user_info['is_guest'])
1623 1701
 	{
1624 1702
 		// Guest voting disabled?
1625
-		if (!$row['guest_vote'])
1626
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1703
+		if (!$row['guest_vote']) {
1704
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1705
+		}
1627 1706
 		// Already voted?
1628
-		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))
1629
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1707
+		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) {
1708
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1709
+		}
1630 1710
 	}
1631 1711
 
1632 1712
 	$sOptions = array();
@@ -1680,11 +1760,13 @@  discard block
 block discarded – undo
1680 1760
 {
1681 1761
 	global $scripturl, $txt, $context;
1682 1762
 
1683
-	if (!allowedTo('search_posts'))
1684
-		return;
1763
+	if (!allowedTo('search_posts')) {
1764
+			return;
1765
+	}
1685 1766
 
1686
-	if ($output_method != 'echo')
1687
-		return $scripturl . '?action=search';
1767
+	if ($output_method != 'echo') {
1768
+			return $scripturl . '?action=search';
1769
+	}
1688 1770
 
1689 1771
 	echo '
1690 1772
 		<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
@@ -1706,8 +1788,9 @@  discard block
 block discarded – undo
1706 1788
 	// If mods want to do somthing with the news, let them do that now. Don't need to pass the news line itself, since it is already in $context.
1707 1789
 	call_integration_hook('integrate_ssi_news');
1708 1790
 
1709
-	if ($output_method != 'echo')
1710
-		return $context['random_news_line'];
1791
+	if ($output_method != 'echo') {
1792
+			return $context['random_news_line'];
1793
+	}
1711 1794
 
1712 1795
 	echo $context['random_news_line'];
1713 1796
 }
@@ -1721,8 +1804,9 @@  discard block
 block discarded – undo
1721 1804
 {
1722 1805
 	global $scripturl, $modSettings, $user_info;
1723 1806
 
1724
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view'))
1725
-		return;
1807
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) {
1808
+			return;
1809
+	}
1726 1810
 
1727 1811
 	$eventOptions = array(
1728 1812
 		'include_birthdays' => true,
@@ -1733,13 +1817,15 @@  discard block
 block discarded – undo
1733 1817
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1734 1818
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1735 1819
 
1736
-	if ($output_method != 'echo')
1737
-		return $return['calendar_birthdays'];
1820
+	if ($output_method != 'echo') {
1821
+			return $return['calendar_birthdays'];
1822
+	}
1738 1823
 
1739
-	foreach ($return['calendar_birthdays'] as $member)
1740
-		echo '
1824
+	foreach ($return['calendar_birthdays'] as $member) {
1825
+			echo '
1741 1826
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">' . $member['name'] . '</span>' . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : '');
1742
-}
1827
+	}
1828
+	}
1743 1829
 
1744 1830
 /**
1745 1831
  * Shows today's holidays.
@@ -1750,8 +1836,9 @@  discard block
 block discarded – undo
1750 1836
 {
1751 1837
 	global $modSettings, $user_info;
1752 1838
 
1753
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1754
-		return;
1839
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1840
+			return;
1841
+	}
1755 1842
 
1756 1843
 	$eventOptions = array(
1757 1844
 		'include_holidays' => true,
@@ -1762,8 +1849,9 @@  discard block
 block discarded – undo
1762 1849
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1763 1850
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1764 1851
 
1765
-	if ($output_method != 'echo')
1766
-		return $return['calendar_holidays'];
1852
+	if ($output_method != 'echo') {
1853
+			return $return['calendar_holidays'];
1854
+	}
1767 1855
 
1768 1856
 	echo '
1769 1857
 		', implode(', ', $return['calendar_holidays']);
@@ -1777,8 +1865,9 @@  discard block
 block discarded – undo
1777 1865
 {
1778 1866
 	global $modSettings, $user_info;
1779 1867
 
1780
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1781
-		return;
1868
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1869
+			return;
1870
+	}
1782 1871
 
1783 1872
 	$eventOptions = array(
1784 1873
 		'include_events' => true,
@@ -1789,14 +1878,16 @@  discard block
 block discarded – undo
1789 1878
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1790 1879
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1791 1880
 
1792
-	if ($output_method != 'echo')
1793
-		return $return['calendar_events'];
1881
+	if ($output_method != 'echo') {
1882
+			return $return['calendar_events'];
1883
+	}
1794 1884
 
1795 1885
 	foreach ($return['calendar_events'] as $event)
1796 1886
 	{
1797
-		if ($event['can_edit'])
1798
-			echo '
1887
+		if ($event['can_edit']) {
1888
+					echo '
1799 1889
 	<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1890
+		}
1800 1891
 		echo '
1801 1892
 	' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1802 1893
 	}
@@ -1811,8 +1902,9 @@  discard block
 block discarded – undo
1811 1902
 {
1812 1903
 	global $modSettings, $txt, $scripturl, $user_info;
1813 1904
 
1814
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1815
-		return;
1905
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1906
+			return;
1907
+	}
1816 1908
 
1817 1909
 	$eventOptions = array(
1818 1910
 		'include_birthdays' => allowedTo('profile_view'),
@@ -1825,19 +1917,22 @@  discard block
 block discarded – undo
1825 1917
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1826 1918
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1827 1919
 
1828
-	if ($output_method != 'echo')
1829
-		return $return;
1920
+	if ($output_method != 'echo') {
1921
+			return $return;
1922
+	}
1830 1923
 
1831
-	if (!empty($return['calendar_holidays']))
1832
-		echo '
1924
+	if (!empty($return['calendar_holidays'])) {
1925
+			echo '
1833 1926
 			<span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br></span>';
1927
+	}
1834 1928
 	if (!empty($return['calendar_birthdays']))
1835 1929
 	{
1836 1930
 		echo '
1837 1931
 			<span class="birthday">' . $txt['birthdays_upcoming'] . '</span> ';
1838
-		foreach ($return['calendar_birthdays'] as $member)
1839
-			echo '
1932
+		foreach ($return['calendar_birthdays'] as $member) {
1933
+					echo '
1840 1934
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : '';
1935
+		}
1841 1936
 		echo '
1842 1937
 			<br>';
1843 1938
 	}
@@ -1847,9 +1942,10 @@  discard block
 block discarded – undo
1847 1942
 			<span class="event">' . $txt['events_upcoming'] . '</span> ';
1848 1943
 		foreach ($return['calendar_events'] as $event)
1849 1944
 		{
1850
-			if ($event['can_edit'])
1851
-				echo '
1945
+			if ($event['can_edit']) {
1946
+							echo '
1852 1947
 			<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1948
+			}
1853 1949
 			echo '
1854 1950
 			' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1855 1951
 		}
@@ -1873,25 +1969,29 @@  discard block
 block discarded – undo
1873 1969
 	loadLanguage('Stats');
1874 1970
 
1875 1971
 	// Must be integers....
1876
-	if ($limit === null)
1877
-		$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
1878
-	else
1879
-		$limit = (int) $limit;
1880
-
1881
-	if ($start === null)
1882
-		$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
1883
-	else
1884
-		$start = (int) $start;
1885
-
1886
-	if ($board !== null)
1887
-		$board = (int) $board;
1888
-	elseif (isset($_GET['board']))
1889
-		$board = (int) $_GET['board'];
1890
-
1891
-	if ($length === null)
1892
-		$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
1893
-	else
1894
-		$length = (int) $length;
1972
+	if ($limit === null) {
1973
+			$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
1974
+	} else {
1975
+			$limit = (int) $limit;
1976
+	}
1977
+
1978
+	if ($start === null) {
1979
+			$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
1980
+	} else {
1981
+			$start = (int) $start;
1982
+	}
1983
+
1984
+	if ($board !== null) {
1985
+			$board = (int) $board;
1986
+	} elseif (isset($_GET['board'])) {
1987
+			$board = (int) $_GET['board'];
1988
+	}
1989
+
1990
+	if ($length === null) {
1991
+			$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
1992
+	} else {
1993
+			$length = (int) $length;
1994
+	}
1895 1995
 
1896 1996
 	$limit = max(0, $limit);
1897 1997
 	$start = max(0, $start);
@@ -1909,17 +2009,19 @@  discard block
 block discarded – undo
1909 2009
 	);
1910 2010
 	if ($smcFunc['db_num_rows']($request) == 0)
1911 2011
 	{
1912
-		if ($output_method == 'echo')
1913
-			die($txt['ssi_no_guests']);
1914
-		else
1915
-			return array();
2012
+		if ($output_method == 'echo') {
2013
+					die($txt['ssi_no_guests']);
2014
+		} else {
2015
+					return array();
2016
+		}
1916 2017
 	}
1917 2018
 	list ($board) = $smcFunc['db_fetch_row']($request);
1918 2019
 	$smcFunc['db_free_result']($request);
1919 2020
 
1920 2021
 	$icon_sources = array();
1921
-	foreach ($context['stable_icons'] as $icon)
1922
-		$icon_sources[$icon] = 'images_url';
2022
+	foreach ($context['stable_icons'] as $icon) {
2023
+			$icon_sources[$icon] = 'images_url';
2024
+	}
1923 2025
 
1924 2026
 	if (!empty($modSettings['enable_likes']))
1925 2027
 	{
@@ -1943,12 +2045,14 @@  discard block
 block discarded – undo
1943 2045
 		)
1944 2046
 	);
1945 2047
 	$posts = array();
1946
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1947
-		$posts[] = $row['id_first_msg'];
2048
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2049
+			$posts[] = $row['id_first_msg'];
2050
+	}
1948 2051
 	$smcFunc['db_free_result']($request);
1949 2052
 
1950
-	if (empty($posts))
1951
-		return array();
2053
+	if (empty($posts)) {
2054
+			return array();
2055
+	}
1952 2056
 
1953 2057
 	// Find the posts.
1954 2058
 	$request = $smcFunc['db_query']('', '
@@ -1978,24 +2082,28 @@  discard block
 block discarded – undo
1978 2082
 			$last_space = strrpos($row['body'], ' ');
1979 2083
 			$last_open = strrpos($row['body'], '<');
1980 2084
 			$last_close = strrpos($row['body'], '>');
1981
-			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6)
1982
-				$cutoff = $last_open;
1983
-			elseif (empty($last_close) || $last_close < $last_open)
1984
-				$cutoff = $last_space;
2085
+			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) {
2086
+							$cutoff = $last_open;
2087
+			} elseif (empty($last_close) || $last_close < $last_open) {
2088
+							$cutoff = $last_space;
2089
+			}
1985 2090
 
1986
-			if ($cutoff !== false)
1987
-				$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2091
+			if ($cutoff !== false) {
2092
+							$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2093
+			}
1988 2094
 			$row['body'] .= '...';
1989 2095
 		}
1990 2096
 
1991 2097
 		$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
1992 2098
 
1993
-		if (!empty($recycle_board) && $row['id_board'] == $recycle_board)
1994
-			$row['icon'] = 'recycled';
2099
+		if (!empty($recycle_board) && $row['id_board'] == $recycle_board) {
2100
+					$row['icon'] = 'recycled';
2101
+		}
1995 2102
 
1996 2103
 		// Check that this message icon is there...
1997
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
1998
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2104
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
2105
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2106
+		}
1999 2107
 
2000 2108
 		censorText($row['subject']);
2001 2109
 		censorText($row['body']);
@@ -2032,16 +2140,18 @@  discard block
 block discarded – undo
2032 2140
 	}
2033 2141
 	$smcFunc['db_free_result']($request);
2034 2142
 
2035
-	if (empty($return))
2036
-		return $return;
2143
+	if (empty($return)) {
2144
+			return $return;
2145
+	}
2037 2146
 
2038 2147
 	$return[count($return) - 1]['is_last'] = true;
2039 2148
 
2040 2149
 	// If mods want to do somthing with this list of posts, let them do that now.
2041 2150
 	call_integration_hook('integrate_ssi_boardNews', array(&$return));
2042 2151
 
2043
-	if ($output_method != 'echo')
2044
-		return $return;
2152
+	if ($output_method != 'echo') {
2153
+			return $return;
2154
+	}
2045 2155
 
2046 2156
 	foreach ($return as $news)
2047 2157
 	{
@@ -2093,9 +2203,10 @@  discard block
 block discarded – undo
2093 2203
 		echo '
2094 2204
 			</div>';
2095 2205
 
2096
-		if (!$news['is_last'])
2097
-			echo '
2206
+		if (!$news['is_last']) {
2207
+					echo '
2098 2208
 			<hr>';
2209
+		}
2099 2210
 	}
2100 2211
 }
2101 2212
 
@@ -2109,8 +2220,9 @@  discard block
 block discarded – undo
2109 2220
 {
2110 2221
 	global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc;
2111 2222
 
2112
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
2113
-		return;
2223
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
2224
+			return;
2225
+	}
2114 2226
 
2115 2227
 	// Find all events which are happening in the near future that the member can see.
2116 2228
 	$request = $smcFunc['db_query']('', '
@@ -2136,20 +2248,23 @@  discard block
 block discarded – undo
2136 2248
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2137 2249
 	{
2138 2250
 		// Check if we've already come by an event linked to this same topic with the same title... and don't display it if we have.
2139
-		if (!empty($duplicates[$row['title'] . $row['id_topic']]))
2140
-			continue;
2251
+		if (!empty($duplicates[$row['title'] . $row['id_topic']])) {
2252
+					continue;
2253
+		}
2141 2254
 
2142 2255
 		// Censor the title.
2143 2256
 		censorText($row['title']);
2144 2257
 
2145
-		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false)))
2146
-			$date = strftime('%Y-%m-%d', forum_time(false));
2147
-		else
2148
-			$date = $row['start_date'];
2258
+		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) {
2259
+					$date = strftime('%Y-%m-%d', forum_time(false));
2260
+		} else {
2261
+					$date = $row['start_date'];
2262
+		}
2149 2263
 
2150 2264
 		// If the topic it is attached to is not approved then don't link it.
2151
-		if (!empty($row['id_first_msg']) && !$row['approved'])
2152
-			$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2265
+		if (!empty($row['id_first_msg']) && !$row['approved']) {
2266
+					$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2267
+		}
2153 2268
 
2154 2269
 		$allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false;
2155 2270
 
@@ -2175,24 +2290,27 @@  discard block
 block discarded – undo
2175 2290
 	}
2176 2291
 	$smcFunc['db_free_result']($request);
2177 2292
 
2178
-	foreach ($return as $mday => $array)
2179
-		$return[$mday][count($array) - 1]['is_last'] = true;
2293
+	foreach ($return as $mday => $array) {
2294
+			$return[$mday][count($array) - 1]['is_last'] = true;
2295
+	}
2180 2296
 
2181 2297
 	// If mods want to do somthing with this list of events, let them do that now.
2182 2298
 	call_integration_hook('integrate_ssi_recentEvents', array(&$return));
2183 2299
 
2184
-	if ($output_method != 'echo' || empty($return))
2185
-		return $return;
2300
+	if ($output_method != 'echo' || empty($return)) {
2301
+			return $return;
2302
+	}
2186 2303
 
2187 2304
 	// Well the output method is echo.
2188 2305
 	echo '
2189 2306
 			<span class="event">' . $txt['events'] . '</span> ';
2190
-	foreach ($return as $mday => $array)
2191
-		foreach ($array as $event)
2307
+	foreach ($return as $mday => $array) {
2308
+			foreach ($array as $event)
2192 2309
 		{
2193 2310
 			if ($event['can_edit'])
2194 2311
 				echo '
2195 2312
 				<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
2313
+	}
2196 2314
 
2197 2315
 			echo '
2198 2316
 				' . $event['link'] . (!$event['is_last'] ? ', ' : '');
@@ -2211,8 +2329,9 @@  discard block
 block discarded – undo
2211 2329
 	global $smcFunc;
2212 2330
 
2213 2331
 	// If $id is null, this was most likely called from a query string and should do nothing.
2214
-	if ($id === null)
2215
-		return;
2332
+	if ($id === null) {
2333
+			return;
2334
+	}
2216 2335
 
2217 2336
 	$request = $smcFunc['db_query']('', '
2218 2337
 		SELECT passwd, member_name, is_activated
@@ -2244,8 +2363,9 @@  discard block
 block discarded – undo
2244 2363
 	$attachments_boards = boardsAllowedTo('view_attachments');
2245 2364
 
2246 2365
 	// No boards?  Adios amigo.
2247
-	if (empty($attachments_boards))
2248
-		return array();
2366
+	if (empty($attachments_boards)) {
2367
+			return array();
2368
+	}
2249 2369
 
2250 2370
 	// Is it an array?
2251 2371
 	$attachment_ext = (array) $attachment_ext;
@@ -2329,8 +2449,9 @@  discard block
 block discarded – undo
2329 2449
 	call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments));
2330 2450
 
2331 2451
 	// So you just want an array?  Here you can have it.
2332
-	if ($output_method == 'array' || empty($attachments))
2333
-		return $attachments;
2452
+	if ($output_method == 'array' || empty($attachments)) {
2453
+			return $attachments;
2454
+	}
2334 2455
 
2335 2456
 	// Give them the default.
2336 2457
 	echo '
@@ -2341,14 +2462,15 @@  discard block
 block discarded – undo
2341 2462
 				<th style="text-align: left; padding: 2">', $txt['downloads'], '</th>
2342 2463
 				<th style="text-align: left; padding: 2">', $txt['filesize'], '</th>
2343 2464
 			</tr>';
2344
-	foreach ($attachments as $attach)
2345
-		echo '
2465
+	foreach ($attachments as $attach) {
2466
+			echo '
2346 2467
 			<tr>
2347 2468
 				<td>', $attach['file']['link'], '</td>
2348 2469
 				<td>', $attach['member']['link'], '</td>
2349 2470
 				<td style="text-align: center">', $attach['file']['downloads'], '</td>
2350 2471
 				<td>', $attach['file']['filesize'], '</td>
2351 2472
 			</tr>';
2473
+	}
2352 2474
 	echo '
2353 2475
 		</table>';
2354 2476
 }
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +35 added lines, -24 removed lines patch added patch discarded remove patch
@@ -32,16 +32,18 @@  discard block
 block discarded – undo
32 32
 ob_start();
33 33
 
34 34
 // Do some cleaning, just in case.
35
-foreach (array('db_character_set', 'cachedir') as $variable)
35
+foreach (array('db_character_set', 'cachedir') as $variable) {
36 36
 	if (isset($GLOBALS[$variable]))
37 37
 		unset($GLOBALS[$variable], $GLOBALS[$variable]);
38
+}
38 39
 
39 40
 // Load the settings...
40 41
 require_once(dirname(__FILE__) . '/Settings.php');
41 42
 
42 43
 // Make absolutely sure the cache directory is defined.
43
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
44
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
44 45
 	$cachedir = $boarddir . '/cache';
46
+}
45 47
 
46 48
 // Without those we can't go anywhere
47 49
 require_once($sourcedir . '/QueryString.php');
@@ -51,8 +53,9 @@  discard block
 block discarded – undo
51 53
 require_once($sourcedir . '/Load.php');
52 54
 
53 55
 // If $maintenance is set specifically to 2, then we're upgrading or something.
54
-if (!empty($maintenance) && $maintenance == 2)
56
+if (!empty($maintenance) && $maintenance == 2) {
55 57
 	display_maintenance_message();
58
+}
56 59
 
57 60
 // Create a variable to store some SMF specific functions in.
58 61
 $smcFunc = array();
@@ -67,8 +70,9 @@  discard block
 block discarded – undo
67 70
 cleanRequest();
68 71
 
69 72
 // Seed the random generator.
70
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
73
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
71 74
 	smf_seed_generator();
75
+}
72 76
 
73 77
 // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out!
74 78
 if (isset($_GET['scheduled']))
@@ -88,9 +92,9 @@  discard block
 block discarded – undo
88 92
 if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
89 93
 {
90 94
 	// If zlib is being used, turn off output compression.
91
-	if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler')
92
-		$modSettings['enableCompressedOutput'] = '0';
93
-	else
95
+	if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') {
96
+			$modSettings['enableCompressedOutput'] = '0';
97
+	} else
94 98
 	{
95 99
 		ob_end_clean();
96 100
 		ob_start('ob_gzhandler');
@@ -182,18 +186,21 @@  discard block
 block discarded – undo
182 186
 	loadPermissions();
183 187
 
184 188
 	// Attachments don't require the entire theme to be loaded.
185
-	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach')
186
-		detectBrowser();
189
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') {
190
+			detectBrowser();
191
+	}
187 192
 	// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
188
-	else
189
-		loadTheme();
193
+	else {
194
+			loadTheme();
195
+	}
190 196
 
191 197
 	// Check if the user should be disallowed access.
192 198
 	is_not_banned();
193 199
 
194 200
 	// If we are in a topic and don't have permission to approve it then duck out now.
195
-	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
196
-		fatal_lang_error('not_a_topic', false);
201
+	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
202
+			fatal_lang_error('not_a_topic', false);
203
+	}
197 204
 
198 205
 	$no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile');
199 206
 	call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
@@ -204,8 +211,9 @@  discard block
 block discarded – undo
204 211
 		writeLog();
205 212
 
206 213
 		// Track forum statistics and hits...?
207
-		if (!empty($modSettings['hitStats']))
208
-			trackStats(array('hits' => '+'));
214
+		if (!empty($modSettings['hitStats'])) {
215
+					trackStats(array('hits' => '+'));
216
+		}
209 217
 	}
210 218
 	unset($no_stat_actions);
211 219
 
@@ -219,13 +227,14 @@  discard block
 block discarded – undo
219 227
 			return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout'));
220 228
 		}
221 229
 		// Don't even try it, sonny.
222
-		else
223
-			return 'InMaintenance';
230
+		else {
231
+					return 'InMaintenance';
232
+		}
224 233
 	}
225 234
 	// If guest access is off, a guest can only do one of the very few following actions.
226
-	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2'))))
227
-		return 'KickGuest';
228
-	elseif (empty($_REQUEST['action']))
235
+	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) {
236
+			return 'KickGuest';
237
+	} elseif (empty($_REQUEST['action']))
229 238
 	{
230 239
 		// Action and board are both empty... BoardIndex! Unless someone else wants to do something different.
231 240
 		if (empty($board) && empty($topic))
@@ -239,8 +248,9 @@  discard block
 block discarded – undo
239 248
 
240 249
 				$call = call_helper($defaultAction, true);
241 250
 
242
-				if (!empty($call))
243
-					return $call;
251
+				if (!empty($call)) {
252
+									return $call;
253
+				}
244 254
 			}
245 255
 
246 256
 			// No default action huh? then go to our good old BoardIndex.
@@ -370,8 +380,9 @@  discard block
 block discarded – undo
370 380
 
371 381
 			$call = call_helper($fallbackAction, true);
372 382
 
373
-			if (!empty($call))
374
-				return $call;
383
+			if (!empty($call)) {
384
+							return $call;
385
+			}
375 386
 		}
376 387
 
377 388
 		// No fallback action, huh?
Please login to merge, or discard this patch.
Themes/default/Admin.template.php 1 patch
Braces   +173 added lines, -125 removed lines patch added patch discarded remove patch
@@ -64,9 +64,10 @@  discard block
 block discarded – undo
64 64
 										<strong>', $txt['administrators'], ':</strong>
65 65
 										', implode(', ', $context['administrators']);
66 66
 	// If we have lots of admins... don't show them all.
67
-	if (!empty($context['more_admins_link']))
68
-		echo '
67
+	if (!empty($context['more_admins_link'])) {
68
+			echo '
69 69
 							(', $context['more_admins_link'], ')';
70
+	}
70 71
 
71 72
 	echo '
72 73
 									</div>
@@ -83,16 +84,18 @@  discard block
 block discarded – undo
83 84
 		foreach ($area['areas'] as $item_id => $item)
84 85
 		{
85 86
 			// No point showing the 'home' page here, we're already on it!
86
-			if ($area_id == 'forum' && $item_id == 'index')
87
-				continue;
87
+			if ($area_id == 'forum' && $item_id == 'index') {
88
+							continue;
89
+			}
88 90
 
89 91
 			$url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : '');
90
-			if (!empty($item['icon_file']))
91
-				echo '
92
+			if (!empty($item['icon_file'])) {
93
+							echo '
92 94
 							<a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>';
93
-			else
94
-				echo '
95
+			} else {
96
+							echo '
95 97
 							<a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>';
98
+			}
96 99
 		}
97 100
 
98 101
 		echo '
@@ -103,10 +106,11 @@  discard block
 block discarded – undo
103 106
 					</div>';
104 107
 
105 108
 	// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
106
-	if (empty($modSettings['disable_smf_js']))
107
-		echo '
109
+	if (empty($modSettings['disable_smf_js'])) {
110
+			echo '
108 111
 					<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
109 112
 					<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
113
+	}
110 114
 
111 115
 	// This sets the announcements and current versions themselves ;).
112 116
 	echo '
@@ -185,9 +189,10 @@  discard block
 block discarded – undo
185 189
 								<em>', $version['version'], '</em>';
186 190
 
187 191
 		// more details for this item, show them a link
188
-		if ($context['can_admin'] && isset($version['more']))
189
-			echo
192
+		if ($context['can_admin'] && isset($version['more'])) {
193
+					echo
190 194
 								' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>';
195
+		}
191 196
 		echo '
192 197
 								<br>';
193 198
 	}
@@ -218,20 +223,22 @@  discard block
 block discarded – undo
218 223
 
219 224
 	foreach ($context['credits'] as $section)
220 225
 	{
221
-		if (isset($section['pretext']))
222
-			echo '
226
+		if (isset($section['pretext'])) {
227
+					echo '
223 228
 								<p>', $section['pretext'], '</p><hr>';
229
+		}
224 230
 
225 231
 		echo '
226 232
 								<dl>';
227 233
 
228 234
 		foreach ($section['groups'] as $group)
229 235
 		{
230
-			if (isset($group['title']))
231
-				echo '
236
+			if (isset($group['title'])) {
237
+							echo '
232 238
 									<dt>
233 239
 										<strong>', $group['title'], ':</strong>
234 240
 									</dt>';
241
+			}
235 242
 
236 243
 			echo '
237 244
 									<dd>', implode(', ', $group['members']), '</dd>';
@@ -240,10 +247,11 @@  discard block
 block discarded – undo
240 247
 		echo '
241 248
 								</dl>';
242 249
 
243
-		if (isset($section['posttext']))
244
-			echo '
250
+		if (isset($section['posttext'])) {
251
+					echo '
245 252
 								<hr>
246 253
 								<p>', $section['posttext'], '</p>';
254
+		}
247 255
 	}
248 256
 
249 257
 	echo '
@@ -259,9 +267,10 @@  discard block
 block discarded – undo
259 267
 							smfSupportVersions.forum = "', $context['forum_version'], '";';
260 268
 
261 269
 	// Don't worry, none of this is logged, it's just used to give information that might be of use.
262
-	foreach ($context['current_versions'] as $variable => $version)
263
-		echo '
270
+	foreach ($context['current_versions'] as $variable => $version) {
271
+			echo '
264 272
 							smfSupportVersions.', $variable, ' = "', $version['version'], '";';
273
+	}
265 274
 
266 275
 	// Now we just have to include the script and wait ;).
267 276
 	echo '
@@ -358,8 +367,8 @@  discard block
 block discarded – undo
358 367
 							<tbody>';
359 368
 
360 369
 	// Loop through every source file displaying its version - using javascript.
361
-	foreach ($context['file_versions'] as $filename => $version)
362
-		echo '
370
+	foreach ($context['file_versions'] as $filename => $version) {
371
+			echo '
363 372
 								<tr class="windowbg">
364 373
 									<td class="half_table">
365 374
 										', $filename, '
@@ -371,6 +380,7 @@  discard block
 block discarded – undo
371 380
 										<em id="currentSources', $filename, '">??</em>
372 381
 									</td>
373 382
 								</tr>';
383
+	}
374 384
 
375 385
 	// Default template files.
376 386
 	echo '
@@ -396,8 +406,8 @@  discard block
 block discarded – undo
396 406
 							<table id="Default" class="table_grid">
397 407
 								<tbody>';
398 408
 
399
-	foreach ($context['default_template_versions'] as $filename => $version)
400
-		echo '
409
+	foreach ($context['default_template_versions'] as $filename => $version) {
410
+			echo '
401 411
 									<tr class="windowbg">
402 412
 										<td class="half_table">
403 413
 											', $filename, '
@@ -409,6 +419,7 @@  discard block
 block discarded – undo
409 419
 											<em id="currentDefault', $filename, '">??</em>
410 420
 										</td>
411 421
 									</tr>';
422
+	}
412 423
 
413 424
 	// Now the language files...
414 425
 	echo '
@@ -436,8 +447,8 @@  discard block
 block discarded – undo
436 447
 
437 448
 	foreach ($context['default_language_versions'] as $language => $files)
438 449
 	{
439
-		foreach ($files as $filename => $version)
440
-			echo '
450
+		foreach ($files as $filename => $version) {
451
+					echo '
441 452
 									<tr class="windowbg">
442 453
 										<td class="half_table">
443 454
 											', $filename, '.<em>', $language, '</em>.php
@@ -449,6 +460,7 @@  discard block
 block discarded – undo
449 460
 											<em id="current', $filename, '.', $language, '">??</em>
450 461
 										</td>
451 462
 									</tr>';
463
+		}
452 464
 	}
453 465
 
454 466
 	echo '
@@ -478,8 +490,8 @@  discard block
 block discarded – undo
478 490
 							<table id="Templates" class="table_grid">
479 491
 								<tbody>';
480 492
 
481
-		foreach ($context['template_versions'] as $filename => $version)
482
-			echo '
493
+		foreach ($context['template_versions'] as $filename => $version) {
494
+					echo '
483 495
 									<tr class="windowbg">
484 496
 										<td class="half_table">
485 497
 											', $filename, '
@@ -491,6 +503,7 @@  discard block
 block discarded – undo
491 503
 											<em id="currentTemplates', $filename, '">??</em>
492 504
 										</td>
493 505
 									</tr>';
506
+		}
494 507
 
495 508
 		echo '
496 509
 								</tbody>
@@ -520,8 +533,8 @@  discard block
 block discarded – undo
520 533
 							<table id="Tasks" class="table_grid">
521 534
 								<tbody>';
522 535
 
523
-		foreach ($context['tasks_versions'] as $filename => $version)
524
-			echo '
536
+		foreach ($context['tasks_versions'] as $filename => $version) {
537
+					echo '
525 538
 									<tr class="windowbg">
526 539
 										<td class="half_table">
527 540
 											', $filename, '
@@ -533,6 +546,7 @@  discard block
 block discarded – undo
533 546
 											<em id="currentTasks', $filename, '">??</em>
534 547
 										</td>
535 548
 									</tr>';
549
+		}
536 550
 
537 551
 		echo '
538 552
 								</tbody>
@@ -574,9 +588,10 @@  discard block
 block discarded – undo
574 588
 {
575 589
 	global $context, $scripturl, $txt, $modSettings;
576 590
 
577
-	if (!empty($context['saved_successful']))
578
-		echo '
591
+	if (!empty($context['saved_successful'])) {
592
+			echo '
579 593
 					<div class="infobox">', $txt['settings_saved'], '</div>';
594
+	}
580 595
 
581 596
 	// First section is for adding/removing words from the censored list.
582 597
 	echo '
@@ -591,11 +606,12 @@  discard block
 block discarded – undo
591 606
 								<p>', $txt['admin_censored_where'], '</p>';
592 607
 
593 608
 	// Show text boxes for censoring [bad   ] => [good  ].
594
-	foreach ($context['censored_words'] as $vulgar => $proper)
595
-		echo '
609
+	foreach ($context['censored_words'] as $vulgar => $proper) {
610
+			echo '
596 611
 								<div class="block">
597 612
 									<input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> =&gt; <input type="text" name="censor_proper[]" value="', $proper, '" size="30">
598 613
 								</div>';
614
+	}
599 615
 
600 616
 	// Now provide a way to censor more words.
601 617
 	echo '
@@ -669,19 +685,21 @@  discard block
 block discarded – undo
669 685
 						<div class="windowbg2 noup">
670 686
 							', $txt['not_done_reason'];
671 687
 
672
-	if (!empty($context['continue_percent']))
673
-		echo '
688
+	if (!empty($context['continue_percent'])) {
689
+			echo '
674 690
 							<div class="progress_bar">
675 691
 								<div class="full_bar">', $context['continue_percent'], '%</div>
676 692
 								<div class="green_percent" style="width: ', $context['continue_percent'], '%;">&nbsp;</div>
677 693
 							</div>';
694
+	}
678 695
 
679
-	if (!empty($context['substep_enabled']))
680
-		echo '
696
+	if (!empty($context['substep_enabled'])) {
697
+			echo '
681 698
 							<div class="progress_bar">
682 699
 								<div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div>
683 700
 								<div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;">&nbsp;</div>
684 701
 							</div>';
702
+	}
685 703
 
686 704
 	echo '
687 705
 							<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
@@ -716,35 +734,40 @@  discard block
 block discarded – undo
716 734
 {
717 735
 	global $context, $txt, $scripturl;
718 736
 
719
-	if (!empty($context['saved_successful']))
720
-		echo '
737
+	if (!empty($context['saved_successful'])) {
738
+			echo '
721 739
 					<div class="infobox">', $txt['settings_saved'], '</div>';
722
-	elseif (!empty($context['saved_failed']))
723
-		echo '
740
+	} elseif (!empty($context['saved_failed'])) {
741
+			echo '
724 742
 					<div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>';
743
+	}
725 744
 
726
-	if (!empty($context['settings_pre_javascript']))
727
-		echo '
745
+	if (!empty($context['settings_pre_javascript'])) {
746
+			echo '
728 747
 					<script>', $context['settings_pre_javascript'], '</script>';
748
+	}
729 749
 
730
-	if (!empty($context['settings_insert_above']))
731
-		echo $context['settings_insert_above'];
750
+	if (!empty($context['settings_insert_above'])) {
751
+			echo $context['settings_insert_above'];
752
+	}
732 753
 
733 754
 	echo '
734 755
 					<div id="admincenter">
735 756
 						<form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
736 757
 
737 758
 	// Is there a custom title?
738
-	if (isset($context['settings_title']))
739
-		echo '
759
+	if (isset($context['settings_title'])) {
760
+			echo '
740 761
 							<div class="cat_bar">
741 762
 								<h3 class="catbg">', $context['settings_title'], '</h3>
742 763
 							</div>';
764
+	}
743 765
 
744 766
 	// Have we got a message to display?
745
-	if (!empty($context['settings_message']))
746
-		echo '
767
+	if (!empty($context['settings_message'])) {
768
+			echo '
747 769
 							<div class="information">', $context['settings_message'], '</div>';
770
+	}
748 771
 
749 772
 	// Now actually loop through all the variables.
750 773
 	$is_open = false;
@@ -797,8 +820,9 @@  discard block
 block discarded – undo
797 820
 		// Hang about? Are you pulling my leg - a callback?!
798 821
 		if (is_array($config_var) && $config_var['type'] == 'callback')
799 822
 		{
800
-			if (function_exists('template_callback_' . $config_var['name']))
801
-				call_user_func('template_callback_' . $config_var['name']);
823
+			if (function_exists('template_callback_' . $config_var['name'])) {
824
+							call_user_func('template_callback_' . $config_var['name']);
825
+			}
802 826
 
803 827
 			continue;
804 828
 		}
@@ -828,9 +852,10 @@  discard block
 block discarded – undo
828 852
 				$text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time');
829 853
 
830 854
 				// Show the [?] button.
831
-				if ($config_var['help'])
832
-					echo '
855
+				if ($config_var['help']) {
856
+									echo '
833 857
 							<a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ';
858
+				}
834 859
 
835 860
 				echo '
836 861
 										<a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
@@ -839,22 +864,25 @@  discard block
 block discarded – undo
839 864
 										$config_var['preinput'];
840 865
 
841 866
 				// Show a check box.
842
-				if ($config_var['type'] == 'check')
843
-					echo '
867
+				if ($config_var['type'] == 'check') {
868
+									echo '
844 869
 										<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1" class="input_check">';
870
+				}
845 871
 				// Escape (via htmlspecialchars.) the text box.
846
-				elseif ($config_var['type'] == 'password')
847
-					echo '
872
+				elseif ($config_var['type'] == 'password') {
873
+									echo '
848 874
 										<input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;" class="input_password"><br>
849 875
 										<input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_password">';
876
+				}
850 877
 				// Show a selection box.
851 878
 				elseif ($config_var['type'] == 'select')
852 879
 				{
853 880
 					echo '
854 881
 										<select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>';
855
-					foreach ($config_var['data'] as $option)
856
-						echo '
882
+					foreach ($config_var['data'] as $option) {
883
+											echo '
857 884
 											<option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>';
885
+					}
858 886
 					echo '
859 887
 										</select>';
860 888
 				}
@@ -868,15 +896,17 @@  discard block
 block discarded – undo
868 896
 												<legend class="board_selector"><a href="#">', $txt['select_boards_from_list'], '</a></legend>';
869 897
 					foreach ($context['board_list'] as $id_cat => $cat)
870 898
 					{
871
-						if (!$first)
872
-							echo '
899
+						if (!$first) {
900
+													echo '
873 901
 											<hr>';
902
+						}
874 903
 						echo '
875 904
 											<strong>', $cat['name'], '</strong>
876 905
 											<ul>';
877
-						foreach ($cat['boards'] as $id_board => $brd)
878
-							echo '
906
+						foreach ($cat['boards'] as $id_board => $brd) {
907
+													echo '
879 908
 												<li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1" class="input_check"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat('&nbsp; &nbsp;', $brd['child_level']) : '', $brd['name'], '</label></li>';
909
+						}
880 910
 
881 911
 						echo '
882 912
 											</ul>';
@@ -886,12 +916,14 @@  discard block
 block discarded – undo
886 916
 											</fieldset>';
887 917
 				}
888 918
 				// Text area?
889
-				elseif ($config_var['type'] == 'large_text')
890
-					echo '
919
+				elseif ($config_var['type'] == 'large_text') {
920
+									echo '
891 921
 											<textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
922
+				}
892 923
 				// Permission group?
893
-				elseif ($config_var['type'] == 'permissions')
894
-					theme_inline_permissions($config_var['name']);
924
+				elseif ($config_var['type'] == 'permissions') {
925
+									theme_inline_permissions($config_var['name']);
926
+				}
895 927
 				// BBC selection?
896 928
 				elseif ($config_var['type'] == 'bbc')
897 929
 				{
@@ -902,20 +934,22 @@  discard block
 block discarded – undo
902 934
 
903 935
 					foreach ($context['bbc_columns'] as $bbcColumn)
904 936
 					{
905
-						foreach ($bbcColumn as $bbcTag)
906
-							echo '
937
+						foreach ($bbcColumn as $bbcTag) {
938
+													echo '
907 939
 														<li class="list_bbc floatleft">
908 940
 															<input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', ' class="input_check"> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', '
909 941
 														</li>';
942
+						}
910 943
 					}
911 944
 					echo '							</ul>
912 945
 												<input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', ' class="input_check"> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label>
913 946
 											</fieldset>';
914 947
 				}
915 948
 				// A simple message?
916
-				elseif ($config_var['type'] == 'var_message')
917
-					echo '
949
+				elseif ($config_var['type'] == 'var_message') {
950
+									echo '
918 951
 											<div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>';
952
+				}
919 953
 				// Assume it must be a text box
920 954
 				else
921 955
 				{
@@ -940,63 +974,70 @@  discard block
 block discarded – undo
940 974
 											' . $config_var['postinput'] : '',
941 975
 										'</dd>';
942 976
 			}
943
-		}
944
-
945
-		else
977
+		} else
946 978
 		{
947 979
 			// Just show a separator.
948
-			if ($config_var == '')
949
-				echo '
980
+			if ($config_var == '') {
981
+							echo '
950 982
 								</dl>
951 983
 								<hr>
952 984
 								<dl class="settings">';
953
-			else
954
-				echo '
985
+			} else {
986
+							echo '
955 987
 									<dd>
956 988
 										<strong>' . $config_var . '</strong>
957 989
 									</dd>';
990
+			}
958 991
 		}
959 992
 	}
960 993
 
961
-	if ($is_open)
962
-		echo '
994
+	if ($is_open) {
995
+			echo '
963 996
 								</dl>';
997
+	}
964 998
 
965
-	if (empty($context['settings_save_dont_show']))
966
-		echo '
999
+	if (empty($context['settings_save_dont_show'])) {
1000
+			echo '
967 1001
 								<input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit">';
1002
+	}
968 1003
 
969
-	if ($is_open)
970
-		echo '
1004
+	if ($is_open) {
1005
+			echo '
971 1006
 							</div>';
1007
+	}
972 1008
 
973 1009
 
974 1010
 	// At least one token has to be used!
975
-	if (isset($context['admin-ssc_token']))
976
-		echo '
1011
+	if (isset($context['admin-ssc_token'])) {
1012
+			echo '
977 1013
 							<input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">';
1014
+	}
978 1015
 
979
-	if (isset($context['admin-dbsc_token']))
980
-		echo '
1016
+	if (isset($context['admin-dbsc_token'])) {
1017
+			echo '
981 1018
 							<input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">';
1019
+	}
982 1020
 
983
-	if (isset($context['admin-mp_token']))
984
-		echo '
1021
+	if (isset($context['admin-mp_token'])) {
1022
+			echo '
985 1023
 							<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">';
1024
+	}
986 1025
 
987 1026
 	echo '
988 1027
 							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
989 1028
 						</form>
990 1029
 					</div>';
991 1030
 
992
-	if (!empty($context['settings_post_javascript']))
993
-		echo '
1031
+	if (!empty($context['settings_post_javascript'])) {
1032
+			echo '
994 1033
 					<script>
995 1034
 					', $context['settings_post_javascript'], '
996 1035
 					</script>';
1036
+	}
997 1037
 
998
-	if (!empty($context['settings_insert_below']))
999
-		echo $context['settings_insert_below'];
1038
+	if (!empty($context['settings_insert_below'])) {
1039
+			echo $context['settings_insert_below'];
1040
+	}
1000 1041
 
1001 1042
 	// We may have added a board listing. If we did, we need to make it work.
1002 1043
 	addInlineJavascript('
@@ -1019,9 +1060,10 @@  discard block
 block discarded – undo
1019 1060
 {
1020 1061
 	global $context, $txt;
1021 1062
 
1022
-	if (!empty($context['saved_successful']))
1023
-		echo '
1063
+	if (!empty($context['saved_successful'])) {
1064
+			echo '
1024 1065
 					<div class="infobox">', $txt['settings_saved'], '</div>';
1066
+	}
1025 1067
 
1026 1068
 	// Standard fields.
1027 1069
 	template_show_list('standard_profile_fields');
@@ -1053,11 +1095,12 @@  discard block
 block discarded – undo
1053 1095
 	if (isset($_GET['msg']))
1054 1096
 	{
1055 1097
 		loadLanguage('Errors');
1056
-		if (isset($txt['custom_option_' . $_GET['msg']]))
1057
-			echo '
1098
+		if (isset($txt['custom_option_' . $_GET['msg']])) {
1099
+					echo '
1058 1100
 					<div class="errorbox">',
1059 1101
 						$txt['custom_option_' . $_GET['msg']], '
1060 1102
 					</div>';
1103
+		}
1061 1104
 	}
1062 1105
 
1063 1106
 	echo '
@@ -1123,9 +1166,10 @@  discard block
 block discarded – undo
1123 1166
 										<dd>
1124 1167
 											<select name="placement" id="placement">';
1125 1168
 
1126
-	foreach ($context['cust_profile_fields_placement'] as $order => $name)
1127
-		echo '
1169
+	foreach ($context['cust_profile_fields_placement'] as $order => $name) {
1170
+			echo '
1128 1171
 												<option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>';
1172
+	}
1129 1173
 
1130 1174
 	echo '
1131 1175
 											</select>
@@ -1148,9 +1192,10 @@  discard block
 block discarded – undo
1148 1192
 										</dt>
1149 1193
 										<dd>
1150 1194
 											<select name="field_type" id="field_type" onchange="updateInputBoxes();">';
1151
-	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type)
1152
-		echo '
1195
+	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) {
1196
+			echo '
1153 1197
 												<option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>';
1198
+	}
1154 1199
 
1155 1200
 	echo '
1156 1201
 											</select>
@@ -1251,9 +1296,10 @@  discard block
 block discarded – undo
1251 1296
 								</fieldset>
1252 1297
 									<input type="submit" name="save" value="', $txt['save'], '" class="button_submit">';
1253 1298
 
1254
-	if ($context['fid'])
1255
-		echo '
1299
+	if ($context['fid']) {
1300
+			echo '
1256 1301
 									<input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button_submit you_sure">';
1302
+	}
1257 1303
 
1258 1304
 	echo '
1259 1305
 							</div>
@@ -1296,8 +1342,7 @@  discard block
 block discarded – undo
1296 1342
 	{
1297 1343
 		echo '
1298 1344
 						<p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>';
1299
-	}
1300
-	else
1345
+	} else
1301 1346
 	{
1302 1347
 		echo '
1303 1348
 						<ol class="search_results">';
@@ -1323,9 +1368,10 @@  discard block
 block discarded – undo
1323 1368
 							<li>
1324 1369
 								<a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']';
1325 1370
 
1326
-				if ($result['help'])
1327
-					echo '
1371
+				if ($result['help']) {
1372
+									echo '
1328 1373
 								<p class="double_height">', $result['help'], '</p>';
1374
+				}
1329 1375
 
1330 1376
 				echo '
1331 1377
 							</li>';
@@ -1365,18 +1411,20 @@  discard block
 block discarded – undo
1365 1411
 									<strong>', $txt['setup_verification_answer'], '</strong>
1366 1412
 								</dd>';
1367 1413
 
1368
-		if (!empty($context['qa_by_lang'][$lang_id]))
1369
-			foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1414
+		if (!empty($context['qa_by_lang'][$lang_id])) {
1415
+					foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1370 1416
 			{
1371 1417
 				$question = $context['question_answers'][$q_id];
1418
+		}
1372 1419
 				echo '
1373 1420
 								<dt>
1374 1421
 									<input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="input_text verification_question">
1375 1422
 								</dt>
1376 1423
 								<dd>';
1377
-				foreach ($question['answers'] as $answer)
1378
-					echo '
1424
+				foreach ($question['answers'] as $answer) {
1425
+									echo '
1379 1426
 									<input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="input_text verification_answer">';
1427
+				}
1380 1428
 
1381 1429
 				echo '
1382 1430
 									<div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div>
@@ -1415,11 +1463,12 @@  discard block
 block discarded – undo
1415 1463
 							', $txt['errors_found'], ':
1416 1464
 							<ul>';
1417 1465
 
1418
-			foreach ($context['repair_errors'] as $error)
1419
-				echo '
1466
+			foreach ($context['repair_errors'] as $error) {
1467
+							echo '
1420 1468
 								<li>
1421 1469
 									', $error, '
1422 1470
 								</li>';
1471
+			}
1423 1472
 
1424 1473
 			echo '
1425 1474
 							</ul>
@@ -1429,16 +1478,15 @@  discard block
 block discarded – undo
1429 1478
 							<p class="padding">
1430 1479
 								<strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong>
1431 1480
 							</p>';
1432
-		}
1433
-		else
1434
-			echo '
1481
+		} else {
1482
+					echo '
1435 1483
 							<p>', $txt['maintain_no_errors'], '</p>
1436 1484
 							<p class="padding">
1437 1485
 								<a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
1438 1486
 							</p>';
1487
+		}
1439 1488
 
1440
-	}
1441
-	else
1489
+	} else
1442 1490
 	{
1443 1491
 		if (!empty($context['redirect_to_recount']))
1444 1492
 		{
@@ -1450,8 +1498,7 @@  discard block
 block discarded – undo
1450 1498
 								<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1451 1499
 								<input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '">
1452 1500
 							</form>';
1453
-		}
1454
-		else
1501
+		} else
1455 1502
 		{
1456 1503
 			echo '
1457 1504
 							<p>', $txt['errors_fixed'], '</p>
@@ -1603,8 +1650,8 @@  discard block
 block discarded – undo
1603 1650
 function template_admin_quick_search()
1604 1651
 {
1605 1652
 	global $context, $txt;
1606
-	if ($context['user']['is_admin'])
1607
-		echo '
1653
+	if ($context['user']['is_admin']) {
1654
+			echo '
1608 1655
 								<span class="floatright admin_search">
1609 1656
 									<span class="generic_icons filter centericon"></span>
1610 1657
 									<input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text">
@@ -1615,6 +1662,7 @@  discard block
 block discarded – undo
1615 1662
 									</select>
1616 1663
 									<input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit">
1617 1664
 								</span>';
1618
-}
1665
+	}
1666
+	}
1619 1667
 
1620 1668
 ?>
1621 1669
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/Calendar.template.php 1 patch
Braces   +154 added lines, -118 removed lines patch added patch discarded remove patch
@@ -40,16 +40,14 @@  discard block
 block discarded – undo
40 40
 				', template_show_upcoming_list('main'), '
41 41
 			</div>
42 42
 		';
43
-	}
44
-	elseif ($context['calendar_view'] == 'viewweek')
43
+	} elseif ($context['calendar_view'] == 'viewweek')
45 44
 	{
46 45
 		echo '
47 46
 			<div id="main_grid">
48 47
 				', template_show_week_grid('main'), '
49 48
 			</div>
50 49
 		';
51
-	}
52
-	else
50
+	} else
53 51
 	{
54 52
 		echo '
55 53
 			<div id="main_grid">
@@ -75,8 +73,9 @@  discard block
 block discarded – undo
75 73
 	global $context, $scripturl, $txt;
76 74
 
77 75
 	// Bail out if we have nothing to work with
78
-	if (!isset($context['calendar_grid_' . $grid_name]))
79
-		return false;
76
+	if (!isset($context['calendar_grid_' . $grid_name])) {
77
+			return false;
78
+	}
80 79
 
81 80
 	// Protect programmer sanity
82 81
 	$calendar_data = &$context['calendar_grid_' . $grid_name];
@@ -113,11 +112,13 @@  discard block
 block discarded – undo
113 112
 					<li class="windowbg">
114 113
 						<b class="event_title">', $event['link'], '</b>';
115 114
 
116
-				if ($event['can_edit'])
117
-					echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
115
+				if ($event['can_edit']) {
116
+									echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
117
+				}
118 118
 
119
-				if ($event['can_export'])
120
-					echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
119
+				if ($event['can_export']) {
120
+									echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
121
+				}
121 122
 
122 123
 				echo '
123 124
 						<br>';
@@ -125,14 +126,14 @@  discard block
 block discarded – undo
125 126
 				if (!empty($event['allday']))
126 127
 				{
127 128
 					echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : '';
128
-				}
129
-				else
129
+				} else
130 130
 				{
131 131
 					// Display event info relative to user's local timezone
132 132
 					echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
133 133
 
134
-					if ($event['start_date_local'] != $event['end_date_local'])
135
-						echo trim($event['end_date_local']) . ', ';
134
+					if ($event['start_date_local'] != $event['end_date_local']) {
135
+											echo trim($event['end_date_local']) . ', ';
136
+					}
136 137
 
137 138
 					echo trim($event['end_time_local']);
138 139
 
@@ -141,23 +142,27 @@  discard block
 block discarded – undo
141 142
 					{
142 143
 						echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">';
143 144
 
144
-						if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig'])
145
-							echo trim($event['start_date_orig']), ', ';
145
+						if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) {
146
+													echo trim($event['start_date_orig']), ', ';
147
+						}
146 148
 
147 149
 						echo trim($event['start_time_orig']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
148 150
 
149
-						if ($event['start_date_orig'] != $event['end_date_orig'])
150
-							echo trim($event['end_date_orig']) . ', ';
151
+						if ($event['start_date_orig'] != $event['end_date_orig']) {
152
+													echo trim($event['end_date_orig']) . ', ';
153
+						}
151 154
 
152 155
 						echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)';
153 156
 					}
154 157
 					// Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion
155
-					else
156
-						echo ' ', $event['tz_abbrev'], '</time>';
158
+					else {
159
+											echo ' ', $event['tz_abbrev'], '</time>';
160
+					}
157 161
 				}
158 162
 
159
-				if (!empty($event['location']))
160
-					echo '<br>', $event['location'];
163
+				if (!empty($event['location'])) {
164
+									echo '<br>', $event['location'];
165
+				}
161 166
 
162 167
 				echo '
163 168
 					</li>';
@@ -189,8 +194,9 @@  discard block
 block discarded – undo
189 194
 
190 195
 			$birthdays = array();
191 196
 
192
-			foreach ($date as $member)
193
-				$birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>';
197
+			foreach ($date as $member) {
198
+							$birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>';
199
+			}
194 200
 
195 201
 			echo implode(', ', $birthdays);
196 202
 
@@ -221,8 +227,9 @@  discard block
 block discarded – undo
221 227
 			$date_local = $date['date_local'];
222 228
 			unset($date['date_local']);
223 229
 
224
-			foreach ($date as $holiday)
225
-				$holidays[] = $holiday . ' (' . $date_local . ')';
230
+			foreach ($date as $holiday) {
231
+							$holidays[] = $holiday . ' (' . $date_local . ')';
232
+			}
226 233
 		}
227 234
 
228 235
 		echo implode(', ', $holidays);
@@ -245,17 +252,19 @@  discard block
 block discarded – undo
245 252
 	global $context, $txt, $scripturl, $modSettings;
246 253
 
247 254
 	// If the grid doesn't exist, no point in proceeding.
248
-	if (!isset($context['calendar_grid_' . $grid_name]))
249
-		return false;
255
+	if (!isset($context['calendar_grid_' . $grid_name])) {
256
+			return false;
257
+	}
250 258
 
251 259
 	// A handy little pointer variable.
252 260
 	$calendar_data = &$context['calendar_grid_' . $grid_name];
253 261
 
254 262
 	// Some conditions for whether or not we should show the week links *here*.
255
-	if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false)))
256
-		$show_week_links = true;
257
-	else
258
-		$show_week_links = false;
263
+	if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) {
264
+			$show_week_links = true;
265
+	} else {
266
+			$show_week_links = false;
267
+	}
259 268
 
260 269
 	// Assuming that we've not disabled it, show the title block!
261 270
 	if (empty($calendar_data['disable_title']))
@@ -294,8 +303,9 @@  discard block
 block discarded – undo
294 303
 	}
295 304
 
296 305
 	// Show the controls on main grids
297
-	if ($is_mini === false)
298
-		template_calendar_top($calendar_data);
306
+	if ($is_mini === false) {
307
+			template_calendar_top($calendar_data);
308
+	}
299 309
 
300 310
 	// Finally, the main calendar table.
301 311
 	echo '<table class="calendar_table">';
@@ -306,8 +316,9 @@  discard block
 block discarded – undo
306 316
 		echo '<tr>';
307 317
 
308 318
 		// If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared!
309
-		if ($show_week_links === true)
310
-			echo '<th>&nbsp;</th>';
319
+		if ($show_week_links === true) {
320
+					echo '<th>&nbsp;</th>';
321
+		}
311 322
 
312 323
 		// Now, loop through each actual day of the week.
313 324
 		foreach ($calendar_data['week_days'] as $day)
@@ -354,27 +365,29 @@  discard block
 block discarded – undo
354 365
 				// Additional classes are given for events, holidays, and birthdays.
355 366
 				if (!empty($day['events']) && !empty($calendar_data['highlight']['events']))
356 367
 				{
357
-					if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3)))
358
-						$classes[] = 'events';
359
-					elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3)))
360
-						$classes[] = 'events';
368
+					if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) {
369
+											$classes[] = 'events';
370
+					} elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) {
371
+											$classes[] = 'events';
372
+					}
361 373
 				}
362 374
 				if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays']))
363 375
 				{
364
-					if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3)))
365
-						$classes[] = 'holidays';
366
-					elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3)))
367
-						$classes[] = 'holidays';
376
+					if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) {
377
+											$classes[] = 'holidays';
378
+					} elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) {
379
+											$classes[] = 'holidays';
380
+					}
368 381
 				}
369 382
 				if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays']))
370 383
 				{
371
-					if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3)))
372
-						$classes[] = 'birthdays';
373
-					elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3)))
374
-						$classes[] = 'birthdays';
384
+					if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) {
385
+											$classes[] = 'birthdays';
386
+					} elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) {
387
+											$classes[] = 'birthdays';
388
+					}
375 389
 				}
376
-			}
377
-			else
390
+			} else
378 391
 			{
379 392
 				// Default Classes (either compact or comfortable and disabled).
380 393
 				$classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable';
@@ -392,19 +405,21 @@  discard block
 block discarded – undo
392 405
 				$title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : '';
393 406
 
394 407
 				// The actual day number - be it a link, or just plain old text!
395
-				if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
396
-					echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>';
397
-				elseif ($is_mini)
398
-					echo '<a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>';
399
-				else
400
-					echo '<span class="day_text">', $title_prefix, $day['day'], '</span>';
408
+				if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) {
409
+									echo '<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>';
410
+				} elseif ($is_mini) {
411
+									echo '<a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>';
412
+				} else {
413
+									echo '<span class="day_text">', $title_prefix, $day['day'], '</span>';
414
+				}
401 415
 
402 416
 				// A lot of stuff, we're not showing on mini-calendars to conserve space.
403 417
 				if ($is_mini === false)
404 418
 				{
405 419
 					// Holidays are always fun, let's show them!
406
-					if (!empty($day['holidays']))
407
-						echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>';
420
+					if (!empty($day['holidays'])) {
421
+											echo '<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>';
422
+					}
408 423
 
409 424
 					// Happy Birthday Dear, Member!
410 425
 					if (!empty($day['birthdays']))
@@ -422,14 +437,16 @@  discard block
 block discarded – undo
422 437
 							echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] || ($count == 10 && $use_js_hide) ? '' : ', ';
423 438
 
424 439
 							// 9...10! Let's stop there.
425
-							if ($birthday_count == 10 && $use_js_hide)
426
-								// !!TODO - Inline CSS and JavaScript should be moved.
440
+							if ($birthday_count == 10 && $use_js_hide) {
441
+															// !!TODO - Inline CSS and JavaScript should be moved.
427 442
 								echo '<span class="hidelink" id="bdhidelink_', $day['day'], '">...<br><a href="', $scripturl, '?action=calendar;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';showbd" onclick="document.getElementById(\'bdhide_', $day['day'], '\').style.display = \'\'; document.getElementById(\'bdhidelink_', $day['day'], '\').style.display = \'none\'; return false;">(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')</a></span><span id="bdhide_', $day['day'], '" style="display: none;">, ';
443
+							}
428 444
 
429 445
 							++$birthday_count;
430 446
 						}
431
-						if ($use_js_hide)
432
-							echo '</span>';
447
+						if ($use_js_hide) {
448
+													echo '</span>';
449
+						}
433 450
 
434 451
 						echo '</div>';
435 452
 					}
@@ -439,8 +456,9 @@  discard block
 block discarded – undo
439 456
 					{
440 457
 						// Sort events by start time (all day events will be listed first)
441 458
 						uasort($day['events'], function($a, $b) {
442
-						    if ($a['start_timestamp'] == $b['start_timestamp'])
443
-						        return 0;
459
+						    if ($a['start_timestamp'] == $b['start_timestamp']) {
460
+						    						        return 0;
461
+						    }
444 462
 						    return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1;
445 463
 						});
446 464
 
@@ -456,17 +474,19 @@  discard block
 block discarded – undo
456 474
 
457 475
 							echo '<div class="event_wrapper', $event['starts_today'] == true ? ' event_starts_today' : '', $event['ends_today'] == true ? ' event_ends_today' : '', $event['allday'] == true ? ' allday' : '', $event['is_selected'] ? ' sel_event' : '', '">', $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">';
458 476
 
459
-							if (!empty($event['start_time_local']) && $event['starts_today'] == true)
460
-								echo trim(str_replace(':00 ', ' ', $event['start_time_local']));
461
-							elseif (!empty($event['end_time_local']) && $event['ends_today'] == true)
462
-								echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local']));
463
-							elseif (!empty($event['allday']))
464
-								echo $txt['calendar_allday'];
477
+							if (!empty($event['start_time_local']) && $event['starts_today'] == true) {
478
+															echo trim(str_replace(':00 ', ' ', $event['start_time_local']));
479
+							} elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) {
480
+															echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local']));
481
+							} elseif (!empty($event['allday'])) {
482
+															echo $txt['calendar_allday'];
483
+							}
465 484
 
466 485
 							echo '</span>';
467 486
 
468
-							if (!empty($event['location']))
469
-								echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
487
+							if (!empty($event['location'])) {
488
+															echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
489
+							}
470 490
 
471 491
 							if ($event['can_edit'] || $event['can_export'])
472 492
 							{
@@ -503,10 +523,11 @@  discard block
 block discarded – undo
503 523
 			// Otherwise, assuming it's not a mini-calendar, we can show previous / next month days!
504 524
 			elseif ($is_mini === false)
505 525
 			{
506
-				if (empty($current_month_started) && !empty($context['calendar_grid_prev']))
507
-					echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>';
508
-				elseif (!empty($current_month_started) && !empty($context['calendar_grid_next']))
509
-					echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>';
526
+				if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) {
527
+									echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>';
528
+				} elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) {
529
+									echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>';
530
+				}
510 531
 			}
511 532
 
512 533
 			// Close this day and increase var count.
@@ -532,8 +553,9 @@  discard block
 block discarded – undo
532 553
 	global $context, $txt, $scripturl, $modSettings;
533 554
 
534 555
 	// We might have no reason to proceed, if the variable isn't there.
535
-	if (!isset($context['calendar_grid_' . $grid_name]))
536
-		return false;
556
+	if (!isset($context['calendar_grid_' . $grid_name])) {
557
+			return false;
558
+	}
537 559
 
538 560
 	// Handy pointer.
539 561
 	$calendar_data = &$context['calendar_grid_' . $grid_name];
@@ -568,8 +590,9 @@  discard block
 block discarded – undo
568 590
 					}
569 591
 
570 592
 					// The Month Title + Week Number...
571
-					if (!empty($calendar_data['week_title']))
572
-							echo $calendar_data['week_title'];
593
+					if (!empty($calendar_data['week_title'])) {
594
+												echo $calendar_data['week_title'];
595
+					}
573 596
 
574 597
 					echo '
575 598
 					</h3>
@@ -608,10 +631,11 @@  discard block
 block discarded – undo
608 631
 						<tr class="days_wrapper">
609 632
 							<td class="', implode(' ', $classes), ' act_day">';
610 633
 							// Should the day number be a link?
611
-							if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
612
-								echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>';
613
-							else
614
-								echo $txt['days'][$day['day_of_week']], ' - ', $day['day'];
634
+							if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) {
635
+															echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>';
636
+							} else {
637
+															echo $txt['days'][$day['day_of_week']], ' - ', $day['day'];
638
+							}
615 639
 
616 640
 							echo '</td>
617 641
 							<td class="', implode(' ', $classes), '', empty($day['events']) ? (' disabled' . ($context['can_post'] ? ' week_post' : '')) : ' events', ' event_col" data-css-prefix="' . $txt['events'] . ' ', (empty($day['events']) && empty($context['can_post'])) ? $txt['none'] : '', '">';
@@ -620,8 +644,9 @@  discard block
 block discarded – undo
620 644
 							{
621 645
 								// Sort events by start time (all day events will be listed first)
622 646
 								uasort($day['events'], function($a, $b) {
623
-								    if ($a['start_timestamp'] == $b['start_timestamp'])
624
-								        return 0;
647
+								    if ($a['start_timestamp'] == $b['start_timestamp']) {
648
+								    								        return 0;
649
+								    }
625 650
 								    return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1;
626 651
 								});
627 652
 
@@ -633,15 +658,17 @@  discard block
 block discarded – undo
633 658
 
634 659
 									echo $event['link'], '<br><span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">';
635 660
 
636
-									if (!empty($event['start_time_local']))
637
-										echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' &ndash; ' . trim($event['end_time_local']) : '';
638
-									else
639
-										echo $txt['calendar_allday'];
661
+									if (!empty($event['start_time_local'])) {
662
+																			echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' &ndash; ' . trim($event['end_time_local']) : '';
663
+									} else {
664
+																			echo $txt['calendar_allday'];
665
+									}
640 666
 
641 667
 									echo '</span>';
642 668
 
643
-									if (!empty($event['location']))
644
-										echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
669
+									if (!empty($event['location'])) {
670
+																			echo '<br><span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>';
671
+									}
645 672
 
646 673
 									if (!empty($event_icons_needed))
647 674
 									{
@@ -678,8 +705,7 @@  discard block
 block discarded – undo
678 705
 									</div>
679 706
 									<br class="clear">';
680 707
 								}
681
-							}
682
-							else
708
+							} else
683 709
 							{
684 710
 								if (!empty($context['can_post']))
685 711
 								{
@@ -692,8 +718,9 @@  discard block
 block discarded – undo
692 718
 							echo '</td>
693 719
 							<td class="', implode(' ', $classes), !empty($day['holidays']) ? ' holidays' : ' disabled', ' holiday_col" data-css-prefix="' . $txt['calendar_prompt'] . ' ">';
694 720
 							// Show any holidays!
695
-							if (!empty($day['holidays']))
696
-								echo implode('<br>', $day['holidays']);
721
+							if (!empty($day['holidays'])) {
722
+															echo implode('<br>', $day['holidays']);
723
+							}
697 724
 
698 725
 							echo '</td>
699 726
 							<td class="', implode(' ', $classes), '', !empty($day['birthdays']) ? ' birthdays' : ' disabled', ' birthday_col" data-css-prefix="' . $txt['birthdays'] . ' ">';
@@ -751,8 +778,7 @@  discard block
 block discarded – undo
751 778
 				<input type="text" name="end_date" id="end_date" maxlength="10" value="', $calendar_data['end_date'], '" tabindex="', $context['tabindex']++, '" class="input_text date_input end" data-type="date">
752 779
 				<input type="submit" class="button_submit" style="float:none" id="view_button" value="', $txt['view'], '">
753 780
 			</form>';
754
-	}
755
-	else
781
+	} else
756 782
 	{
757 783
 		echo'
758 784
 			<form action="', $scripturl, '?action=calendar" id="calendar_navigation" method="post" accept-charset="', $context['character_set'], '">
@@ -794,8 +820,9 @@  discard block
 block discarded – undo
794 820
 	echo '
795 821
 		<form action="', $scripturl, '?action=calendar;sa=post" method="post" name="postevent" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);smc_saveEntities(\'postevent\', [\'evtitle\']);" style="margin: 0;">';
796 822
 
797
-	if (!empty($context['event']['new']))
798
-		echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">';
823
+	if (!empty($context['event']['new'])) {
824
+			echo '<input type="hidden" name="eventid" value="', $context['event']['eventid'], '">';
825
+	}
799 826
 
800 827
 	// Start the main table.
801 828
 	echo '
@@ -845,9 +872,10 @@  discard block
 block discarded – undo
845 872
 		{
846 873
 			echo '
847 874
 								<optgroup label="', $category['name'], '">';
848
-			foreach ($category['boards'] as $board)
849
-				echo '
875
+			foreach ($category['boards'] as $board) {
876
+							echo '
850 877
 									<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
878
+			}
851 879
 			echo '
852 880
 								</optgroup>';
853 881
 		}
@@ -883,9 +911,10 @@  discard block
 block discarded – undo
883 911
 							<span class="label">', $txt['calendar_timezone'], '</span>
884 912
 							<select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>';
885 913
 
886
-	foreach ($context['all_timezones'] as $tz => $tzname)
887
-		echo '
914
+	foreach ($context['all_timezones'] as $tz => $tzname) {
915
+			echo '
888 916
 								<option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>';
917
+	}
889 918
 
890 919
 	echo '
891 920
 							</select>
@@ -900,9 +929,10 @@  discard block
 block discarded – undo
900 929
 	echo '
901 930
 				<input type="submit" value="', empty($context['event']['new']) ? $txt['save'] : $txt['post'], '" class="button_submit">';
902 931
 	// Delete button?
903
-	if (empty($context['event']['new']))
904
-		echo '
932
+	if (empty($context['event']['new'])) {
933
+			echo '
905 934
 				<input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['calendar_confirm_delete'], '" class="button_submit you_sure">';
935
+	}
906 936
 
907 937
 	echo '
908 938
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -946,9 +976,10 @@  discard block
 block discarded – undo
946 976
 
947 977
 		foreach ($context['clockicons'] as $t => $v)
948 978
 		{
949
-			foreach ($v as $i)
950
-				echo '
979
+			foreach ($v as $i) {
980
+							echo '
951 981
 			icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
982
+			}
952 983
 		}
953 984
 
954 985
 		echo '
@@ -973,13 +1004,14 @@  discard block
 block discarded – undo
973 1004
 
974 1005
 		foreach ($context['clockicons'] as $t => $v)
975 1006
 		{
976
-			foreach ($v as $i)
977
-				echo '
1007
+			foreach ($v as $i) {
1008
+							echo '
978 1009
 			if (', $t, ' >= ', $i, ')
979 1010
 			{
980 1011
 				turnon.push("', $t, '_', $i, '");
981 1012
 				', $t, ' -= ', $i, ';
982 1013
 			}';
1014
+			}
983 1015
 		}
984 1016
 
985 1017
 		echo '
@@ -1043,9 +1075,10 @@  discard block
 block discarded – undo
1043 1075
 
1044 1076
 	foreach ($context['clockicons'] as $t => $v)
1045 1077
 	{
1046
-		foreach ($v as $i)
1047
-			echo '
1078
+		foreach ($v as $i) {
1079
+					echo '
1048 1080
 		icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
1081
+		}
1049 1082
 	}
1050 1083
 
1051 1084
 	echo '
@@ -1062,13 +1095,14 @@  discard block
 block discarded – undo
1062 1095
 
1063 1096
 	foreach ($context['clockicons'] as $t => $v)
1064 1097
 	{
1065
-		foreach ($v as $i)
1066
-			echo '
1098
+		foreach ($v as $i) {
1099
+					echo '
1067 1100
 		if (', $t, ' >= ', $i, ')
1068 1101
 		{
1069 1102
 			turnon.push("', $t, '_', $i, '");
1070 1103
 			', $t, ' -= ', $i, ';
1071 1104
 		}';
1105
+		}
1072 1106
 	}
1073 1107
 
1074 1108
 	echo '
@@ -1127,9 +1161,10 @@  discard block
 block discarded – undo
1127 1161
 
1128 1162
 	foreach ($context['clockicons'] as $t => $v)
1129 1163
 	{
1130
-		foreach ($v as $i)
1131
-			echo '
1164
+		foreach ($v as $i) {
1165
+					echo '
1132 1166
 		icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
1167
+		}
1133 1168
 	}
1134 1169
 
1135 1170
 	echo '
@@ -1150,13 +1185,14 @@  discard block
 block discarded – undo
1150 1185
 
1151 1186
 	foreach ($context['clockicons'] as $t => $v)
1152 1187
 	{
1153
-		foreach ($v as $i)
1154
-		echo '
1188
+		foreach ($v as $i) {
1189
+				echo '
1155 1190
 		if (', $t, ' >= ', $i, ')
1156 1191
 		{
1157 1192
 			turnon.push("', $t, '_', $i, '");
1158 1193
 			', $t, ' -= ', $i, ';
1159 1194
 		}';
1195
+		}
1160 1196
 	}
1161 1197
 
1162 1198
 	echo '
Please login to merge, or discard this patch.