Completed
Pull Request — release-2.1 (#4446)
by Mathias
12:43
created
Sources/Display.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -898,13 +898,13 @@
 block discarded – undo
898 898
 		if ($start_char === 'C')
899 899
 			$limit_seek = $limit;
900 900
 		else
901
-			$limit_seek  = $limit + 1;
901
+			$limit_seek = $limit + 1;
902 902
 
903 903
 		$request = $smcFunc['db_query']('', '
904 904
 			SELECT id_msg, id_member, approved
905 905
 			FROM {db_prefix}messages
906 906
 			WHERE id_topic = {int:current_topic}
907
-			AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : '
907
+			AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : '
908 908
 			AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . '
909 909
 			ORDER BY id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : '
910 910
 			LIMIT {int:limit}'),
Please login to merge, or discard this patch.
Braces   +292 added lines, -214 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * The central part of the board - topic display.
@@ -34,8 +35,9 @@  discard block
 block discarded – undo
34 35
 	global $messages_request, $language, $smcFunc;
35 36
 
36 37
 	// What are you gonna display if these are empty?!
37
-	if (empty($topic))
38
-		fatal_lang_error('no_board', false);
38
+	if (empty($topic)) {
39
+			fatal_lang_error('no_board', false);
40
+	}
39 41
 
40 42
 	// Load the proper template.
41 43
 	loadTemplate('Display');
@@ -52,15 +54,17 @@  discard block
 block discarded – undo
52 54
 	$context['messages_per_page'] = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];
53 55
 
54 56
 	// Let's do some work on what to search index.
55
-	if (count($_GET) > 2)
56
-		foreach ($_GET as $k => $v)
57
+	if (count($_GET) > 2) {
58
+			foreach ($_GET as $k => $v)
57 59
 		{
58 60
 			if (!in_array($k, array('topic', 'board', 'start', session_name())))
59 61
 				$context['robot_no_index'] = true;
62
+	}
60 63
 		}
61 64
 
62
-	if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0))
63
-		$context['robot_no_index'] = true;
65
+	if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0)) {
66
+			$context['robot_no_index'] = true;
67
+	}
64 68
 
65 69
 	// Find the previous or next topic.  Make a fuss if there are no more.
66 70
 	if (isset($_REQUEST['prev_next']) && ($_REQUEST['prev_next'] == 'prev' || $_REQUEST['prev_next'] == 'next'))
@@ -172,8 +176,9 @@  discard block
 block discarded – undo
172 176
 			$topic_parameters
173 177
 	);
174 178
 
175
-	if ($smcFunc['db_num_rows']($request) == 0)
176
-		fatal_lang_error('not_a_topic', false, 404);
179
+	if ($smcFunc['db_num_rows']($request) == 0) {
180
+			fatal_lang_error('not_a_topic', false, 404);
181
+	}
177 182
 	$context['topicinfo'] = $smcFunc['db_fetch_assoc']($request);
178 183
 	$smcFunc['db_free_result']($request);
179 184
 
@@ -210,8 +215,9 @@  discard block
 block discarded – undo
210 215
 	$context['topic_unwatched'] = isset($context['topicinfo']['unwatched']) ? $context['topicinfo']['unwatched'] : 0;
211 216
 
212 217
 	// Add up unapproved replies to get real number of replies...
213
-	if ($modSettings['postmod_active'] && $approve_posts)
214
-		$context['real_num_replies'] += $context['topicinfo']['unapproved_posts'] - ($context['topicinfo']['approved'] ? 0 : 1);
218
+	if ($modSettings['postmod_active'] && $approve_posts) {
219
+			$context['real_num_replies'] += $context['topicinfo']['unapproved_posts'] - ($context['topicinfo']['approved'] ? 0 : 1);
220
+	}
215 221
 
216 222
 	// If this topic has unapproved posts, we need to work out how many posts the user can see, for page indexing.
217 223
 	if ($modSettings['postmod_active'] && $context['topicinfo']['unapproved_posts'] && !$user_info['is_guest'] && !$approve_posts)
@@ -231,11 +237,11 @@  discard block
 block discarded – undo
231 237
 		$smcFunc['db_free_result']($request);
232 238
 
233 239
 		$context['total_visible_posts'] = $context['num_replies'] + $myUnapprovedPosts + ($context['topicinfo']['approved'] ? 1 : 0);
240
+	} elseif ($user_info['is_guest']) {
241
+			$context['total_visible_posts'] = $context['num_replies'] + ($context['topicinfo']['approved'] ? 1 : 0);
242
+	} else {
243
+			$context['total_visible_posts'] = $context['num_replies'] + $context['topicinfo']['unapproved_posts'] + ($context['topicinfo']['approved'] ? 1 : 0);
234 244
 	}
235
-	elseif ($user_info['is_guest'])
236
-		$context['total_visible_posts'] = $context['num_replies'] + ($context['topicinfo']['approved'] ? 1 : 0);
237
-	else
238
-		$context['total_visible_posts'] = $context['num_replies'] + $context['topicinfo']['unapproved_posts'] + ($context['topicinfo']['approved'] ? 1 : 0);
239 245
 
240 246
 	// The start isn't a number; it's information about what to do, where to go.
241 247
 	if (!is_numeric($_REQUEST['start']))
@@ -248,8 +254,7 @@  discard block
 block discarded – undo
248 254
 			{
249 255
 				$context['start_from'] = $context['total_visible_posts'] - 1;
250 256
 				$_REQUEST['start'] = empty($options['view_newest_first']) ? $context['start_from'] : 0;
251
-			}
252
-			else
257
+			} else
253 258
 			{
254 259
 				// Find the earliest unread message in the topic. (the use of topics here is just for both tables.)
255 260
 				$request = $smcFunc['db_query']('', '
@@ -277,9 +282,9 @@  discard block
 block discarded – undo
277 282
 		if (substr($_REQUEST['start'], 0, 4) == 'from')
278 283
 		{
279 284
 			$timestamp = (int) substr($_REQUEST['start'], 4);
280
-			if ($timestamp === 0)
281
-				$_REQUEST['start'] = 0;
282
-			else
285
+			if ($timestamp === 0) {
286
+							$_REQUEST['start'] = 0;
287
+			} else
283 288
 			{
284 289
 				// Find the number of messages posted before said time...
285 290
 				$request = $smcFunc['db_query']('', '
@@ -307,11 +312,11 @@  discard block
 block discarded – undo
307 312
 		elseif (substr($_REQUEST['start'], 0, 3) == 'msg')
308 313
 		{
309 314
 			$virtual_msg = (int) substr($_REQUEST['start'], 3);
310
-			if (!$context['topicinfo']['unapproved_posts'] && $virtual_msg >= $context['topicinfo']['id_last_msg'])
311
-				$context['start_from'] = $context['total_visible_posts'] - 1;
312
-			elseif (!$context['topicinfo']['unapproved_posts'] && $virtual_msg <= $context['topicinfo']['id_first_msg'])
313
-				$context['start_from'] = 0;
314
-			else
315
+			if (!$context['topicinfo']['unapproved_posts'] && $virtual_msg >= $context['topicinfo']['id_last_msg']) {
316
+							$context['start_from'] = $context['total_visible_posts'] - 1;
317
+			} elseif (!$context['topicinfo']['unapproved_posts'] && $virtual_msg <= $context['topicinfo']['id_first_msg']) {
318
+							$context['start_from'] = 0;
319
+			} else
315 320
 			{
316 321
 				// Find the start value for that message......
317 322
 				$request = $smcFunc['db_query']('', '
@@ -394,21 +399,25 @@  discard block
 block discarded – undo
394 399
 		);
395 400
 		while ($row = $smcFunc['db_fetch_assoc']($request))
396 401
 		{
397
-			if (empty($row['id_member']))
398
-				continue;
402
+			if (empty($row['id_member'])) {
403
+							continue;
404
+			}
399 405
 
400
-			if (!empty($row['online_color']))
401
-				$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
402
-			else
403
-				$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
406
+			if (!empty($row['online_color'])) {
407
+							$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
408
+			} else {
409
+							$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
410
+			}
404 411
 
405 412
 			$is_buddy = in_array($row['id_member'], $user_info['buddies']);
406
-			if ($is_buddy)
407
-				$link = '<strong>' . $link . '</strong>';
413
+			if ($is_buddy) {
414
+							$link = '<strong>' . $link . '</strong>';
415
+			}
408 416
 
409 417
 			// Add them both to the list and to the more detailed list.
410
-			if (!empty($row['show_online']) || allowedTo('moderate_forum'))
411
-				$context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link;
418
+			if (!empty($row['show_online']) || allowedTo('moderate_forum')) {
419
+							$context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link;
420
+			}
412 421
 			$context['view_members'][$row['log_time'] . $row['member_name']] = array(
413 422
 				'id' => $row['id_member'],
414 423
 				'username' => $row['member_name'],
@@ -420,8 +429,9 @@  discard block
 block discarded – undo
420 429
 				'hidden' => empty($row['show_online']),
421 430
 			);
422 431
 
423
-			if (empty($row['show_online']))
424
-				$context['view_num_hidden']++;
432
+			if (empty($row['show_online'])) {
433
+							$context['view_num_hidden']++;
434
+			}
425 435
 		}
426 436
 
427 437
 		// The number of guests is equal to the rows minus the ones we actually used ;).
@@ -435,11 +445,13 @@  discard block
 block discarded – undo
435 445
 
436 446
 	// If all is set, but not allowed... just unset it.
437 447
 	$can_show_all = !empty($modSettings['enableAllMessages']) && $context['total_visible_posts'] > $context['messages_per_page'] && $context['total_visible_posts'] < $modSettings['enableAllMessages'];
438
-	if (isset($_REQUEST['all']) && !$can_show_all)
439
-		unset($_REQUEST['all']);
448
+	if (isset($_REQUEST['all']) && !$can_show_all) {
449
+			unset($_REQUEST['all']);
450
+	}
440 451
 	// Otherwise, it must be allowed... so pretend start was -1.
441
-	elseif (isset($_REQUEST['all']))
442
-		$_REQUEST['start'] = -1;
452
+	elseif (isset($_REQUEST['all'])) {
453
+			$_REQUEST['start'] = -1;
454
+	}
443 455
 
444 456
 	// Construct the page index, allowing for the .START method...
445 457
 	$context['page_index'] = constructPageIndex($scripturl . '?topic=' . $topic . '.%1$d', $_REQUEST['start'], $context['total_visible_posts'], $context['messages_per_page'], true);
@@ -476,8 +488,9 @@  discard block
 block discarded – undo
476 488
 			$_REQUEST['start'] = 0;
477 489
 		}
478 490
 		// They aren't using it, but the *option* is there, at least.
479
-		else
480
-			$context['page_index'] .= '&nbsp;<a href="' . $scripturl . '?topic=' . $topic . '.0;all">' . $txt['all'] . '</a> ';
491
+		else {
492
+					$context['page_index'] .= '&nbsp;<a href="' . $scripturl . '?topic=' . $topic . '.0;all">' . $txt['all'] . '</a> ';
493
+		}
481 494
 	}
482 495
 
483 496
 	// Build the link tree.
@@ -493,14 +506,16 @@  discard block
 block discarded – undo
493 506
 	if (!empty($board_info['moderators']))
494 507
 	{
495 508
 		// Add a link for each moderator...
496
-		foreach ($board_info['moderators'] as $mod)
497
-			$context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>';
509
+		foreach ($board_info['moderators'] as $mod) {
510
+					$context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>';
511
+		}
498 512
 	}
499 513
 	if (!empty($board_info['moderator_groups']))
500 514
 	{
501 515
 		// Add a link for each moderator group as well...
502
-		foreach ($board_info['moderator_groups'] as $mod_group)
503
-			$context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=viewmemberes;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>';
516
+		foreach ($board_info['moderator_groups'] as $mod_group) {
517
+					$context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=viewmemberes;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>';
518
+		}
504 519
 	}
505 520
 
506 521
 	if (!empty($context['link_moderators']))
@@ -531,9 +546,9 @@  discard block
 block discarded – undo
531 546
 	// For quick reply we need a response prefix in the default forum language.
532 547
 	if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix', 600)))
533 548
 	{
534
-		if ($language === $user_info['language'])
535
-			$context['response_prefix'] = $txt['response_prefix'];
536
-		else
549
+		if ($language === $user_info['language']) {
550
+					$context['response_prefix'] = $txt['response_prefix'];
551
+		} else
537 552
 		{
538 553
 			loadLanguage('index', $language, false);
539 554
 			$context['response_prefix'] = $txt['response_prefix'];
@@ -565,8 +580,9 @@  discard block
 block discarded – undo
565 580
 			list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row);
566 581
 
567 582
 			// Sanity check
568
-			if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count']))
569
-				continue;
583
+			if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) {
584
+							continue;
585
+			}
570 586
 
571 587
 			$linked_calendar_event = array(
572 588
 				'id' => $row['id_event'],
@@ -615,8 +631,9 @@  discard block
 block discarded – undo
615 631
 		}
616 632
 		$smcFunc['db_free_result']($request);
617 633
 
618
-		if (!empty($context['linked_calendar_events']))
619
-			$context['linked_calendar_events'][count($context['linked_calendar_events']) - 1]['is_last'] = true;
634
+		if (!empty($context['linked_calendar_events'])) {
635
+					$context['linked_calendar_events'][count($context['linked_calendar_events']) - 1]['is_last'] = true;
636
+		}
620 637
 	}
621 638
 
622 639
 	// Create the poll info if it exists.
@@ -679,8 +696,9 @@  discard block
 block discarded – undo
679 696
 		$smcFunc['db_free_result']($request);
680 697
 
681 698
 		// Got we multi choice?
682
-		if ($pollinfo['max_votes'] > 1)
683
-			$realtotal = $pollinfo['total'];
699
+		if ($pollinfo['max_votes'] > 1) {
700
+					$realtotal = $pollinfo['total'];
701
+		}
684 702
 
685 703
 		// If this is a guest we need to do our best to work out if they have voted, and what they voted for.
686 704
 		if ($user_info['is_guest'] && $pollinfo['guest_vote'] && allowedTo('poll_vote'))
@@ -693,20 +711,21 @@  discard block
 block discarded – undo
693 711
 				foreach ($guestinfo as $i => $guestvoted)
694 712
 				{
695 713
 					$guestvoted = explode(',', $guestvoted);
696
-					if ($guestvoted[0] == $context['topicinfo']['id_poll'])
697
-						break;
714
+					if ($guestvoted[0] == $context['topicinfo']['id_poll']) {
715
+											break;
716
+					}
698 717
 				}
699 718
 				// Has the poll been reset since guest voted?
700 719
 				if ($pollinfo['reset_poll'] > $guestvoted[1])
701 720
 				{
702 721
 					// Remove the poll info from the cookie to allow guest to vote again
703 722
 					unset($guestinfo[$i]);
704
-					if (!empty($guestinfo))
705
-						$_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo);
706
-					else
707
-						unset($_COOKIE['guest_poll_vote']);
708
-				}
709
-				else
723
+					if (!empty($guestinfo)) {
724
+											$_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo);
725
+					} else {
726
+											unset($_COOKIE['guest_poll_vote']);
727
+					}
728
+				} else
710 729
 				{
711 730
 					// What did they vote for?
712 731
 					unset($guestvoted[0], $guestvoted[1]);
@@ -820,23 +839,29 @@  discard block
 block discarded – undo
820 839
 		// Build the poll moderation button array.
821 840
 		$context['poll_buttons'] = array();
822 841
 
823
-		if ($context['allow_return_vote'])
824
-			$context['poll_buttons']['vote'] = array('text' => 'poll_return_vote', 'image' => 'poll_options.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']);
842
+		if ($context['allow_return_vote']) {
843
+					$context['poll_buttons']['vote'] = array('text' => 'poll_return_vote', 'image' => 'poll_options.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']);
844
+		}
825 845
 
826
-		if ($context['show_view_results_button'])
827
-			$context['poll_buttons']['results'] = array('text' => 'poll_results', 'image' => 'poll_results.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults');
846
+		if ($context['show_view_results_button']) {
847
+					$context['poll_buttons']['results'] = array('text' => 'poll_results', 'image' => 'poll_results.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults');
848
+		}
828 849
 
829
-		if ($context['allow_change_vote'])
830
-			$context['poll_buttons']['change_vote'] = array('text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']);
850
+		if ($context['allow_change_vote']) {
851
+					$context['poll_buttons']['change_vote'] = array('text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']);
852
+		}
831 853
 
832
-		if ($context['allow_lock_poll'])
833
-			$context['poll_buttons']['lock'] = array('text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
854
+		if ($context['allow_lock_poll']) {
855
+					$context['poll_buttons']['lock'] = array('text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
856
+		}
834 857
 
835
-		if ($context['allow_edit_poll'])
836
-			$context['poll_buttons']['edit'] = array('text' => 'poll_edit', 'image' => 'poll_edit.png', 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']);
858
+		if ($context['allow_edit_poll']) {
859
+					$context['poll_buttons']['edit'] = array('text' => 'poll_edit', 'image' => 'poll_edit.png', 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']);
860
+		}
837 861
 
838
-		if ($context['can_remove_poll'])
839
-			$context['poll_buttons']['remove_poll'] = array('text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'custom' => 'data-confirm="' . $txt['poll_remove_warn'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
862
+		if ($context['can_remove_poll']) {
863
+					$context['poll_buttons']['remove_poll'] = array('text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'custom' => 'data-confirm="' . $txt['poll_remove_warn'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
864
+		}
840 865
 
841 866
 		// Allow mods to add additional buttons here
842 867
 		call_integration_hook('integrate_poll_buttons');
@@ -871,9 +896,9 @@  discard block
 block discarded – undo
871 896
 	{
872 897
 		$start_char = 'C';
873 898
 		$page_id = $context['topicinfo']['id_first_msg'];
899
+	} else {
900
+			$start_char = null;
874 901
 	}
875
-	else
876
-		$start_char = null;
877 902
 
878 903
 	$limit = $context['messages_per_page'];
879 904
 
@@ -888,17 +913,17 @@  discard block
 block discarded – undo
888 913
 		{
889 914
 			$ascending = true;
890 915
 			$page_operator = '>=';
891
-		}
892
-		else
916
+		} else
893 917
 		{
894 918
 			$ascending = false;
895 919
 			$page_operator = '<=';
896 920
 		}
897 921
 
898
-		if ($start_char === 'C')
899
-			$limit_seek = $limit;
900
-		else
901
-			$limit_seek  = $limit + 1;
922
+		if ($start_char === 'C') {
923
+					$limit_seek = $limit;
924
+		} else {
925
+					$limit_seek  = $limit + 1;
926
+		}
902 927
 
903 928
 		$request = $smcFunc['db_query']('', '
904 929
 			SELECT id_msg, id_member, approved
@@ -921,21 +946,23 @@  discard block
 block discarded – undo
921 946
 		$found_msg = false;
922 947
 
923 948
 		// Fallback
924
-		if ($smcFunc['db_num_rows']($request) < 1)
925
-			unset($start_char);
926
-		else
949
+		if ($smcFunc['db_num_rows']($request) < 1) {
950
+					unset($start_char);
951
+		} else
927 952
 		{
928 953
 			while ($row = $smcFunc['db_fetch_assoc']($request))
929 954
 			{
930 955
 				// Check if the start msg is in our result
931
-				if ($row['id_msg'] == $page_id)
932
-					$found_msg = true;
956
+				if ($row['id_msg'] == $page_id) {
957
+									$found_msg = true;
958
+				}
933 959
 
934 960
 				// Skip the the start msg if we not in mode C
935 961
 				if ($start_char === 'C' || $row['id_msg'] != $page_id)
936 962
 				{
937
-					if (!empty($row['id_member']))
938
-						$all_posters[$row['id_msg']] = $row['id_member'];
963
+					if (!empty($row['id_member'])) {
964
+											$all_posters[$row['id_msg']] = $row['id_member'];
965
+					}
939 966
 
940 967
 					$messages[] = $row['id_msg'];
941 968
 				}
@@ -951,8 +978,9 @@  discard block
 block discarded – undo
951 978
 		}
952 979
 
953 980
 		// Before Page bring in the right order
954
-		if (!empty($start_char) && $start_char === 'L')
955
-			krsort($messages);
981
+		if (!empty($start_char) && $start_char === 'L') {
982
+					krsort($messages);
983
+		}
956 984
 	}
957 985
 
958 986
 	// Jump to page
@@ -989,14 +1017,16 @@  discard block
 block discarded – undo
989 1017
 
990 1018
 		while ($row = $smcFunc['db_fetch_assoc']($request))
991 1019
 		{
992
-			if (!empty($row['id_member']))
993
-				$all_posters[$row['id_msg']] = $row['id_member'];
1020
+			if (!empty($row['id_member'])) {
1021
+							$all_posters[$row['id_msg']] = $row['id_member'];
1022
+			}
994 1023
 			$messages[] = $row['id_msg'];
995 1024
 		}
996 1025
 
997 1026
 		// Sort the messages into the correct display order
998
-		if (!$ascending)
999
-			sort($messages);
1027
+		if (!$ascending) {
1028
+					sort($messages);
1029
+		}
1000 1030
 	}
1001 1031
 
1002 1032
 	// Remember the paging data for next time
@@ -1016,8 +1046,9 @@  discard block
 block discarded – undo
1016 1046
 	if (!$user_info['is_guest'] && !empty($messages))
1017 1047
 	{
1018 1048
 		$mark_at_msg = max($messages);
1019
-		if ($mark_at_msg >= $context['topicinfo']['id_last_msg'])
1020
-			$mark_at_msg = $modSettings['maxMsgID'];
1049
+		if ($mark_at_msg >= $context['topicinfo']['id_last_msg']) {
1050
+					$mark_at_msg = $modSettings['maxMsgID'];
1051
+		}
1021 1052
 		if ($mark_at_msg >= $context['topicinfo']['new_from'])
1022 1053
 		{
1023 1054
 			$smcFunc['db_insert']($context['topicinfo']['new_from'] == 0 ? 'ignore' : 'replace',
@@ -1049,8 +1080,9 @@  discard block
 block discarded – undo
1049 1080
 		while ($row = $smcFunc['db_fetch_assoc']($request))
1050 1081
 		{
1051 1082
 			// Find if this topic is marked for notification...
1052
-			if (!empty($row['id_topic']))
1053
-				$context['is_marked_notify'] = true;
1083
+			if (!empty($row['id_topic'])) {
1084
+							$context['is_marked_notify'] = true;
1085
+			}
1054 1086
 
1055 1087
 			// Only do this once, but mark the notifications as "not sent yet" for next time.
1056 1088
 			if (!empty($row['sent']) && $do_once)
@@ -1072,8 +1104,9 @@  discard block
 block discarded – undo
1072 1104
 		}
1073 1105
 
1074 1106
 		// Have we recently cached the number of new topics in this board, and it's still a lot?
1075
-		if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5)
1076
-			$_SESSION['topicseen_cache'][$board]--;
1107
+		if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5) {
1108
+					$_SESSION['topicseen_cache'][$board]--;
1109
+		}
1077 1110
 		// Mark board as seen if this is the only new topic.
1078 1111
 		elseif (isset($_REQUEST['topicseen']))
1079 1112
 		{
@@ -1097,14 +1130,16 @@  discard block
 block discarded – undo
1097 1130
 			$smcFunc['db_free_result']($request);
1098 1131
 
1099 1132
 			// If there're no real new topics in this board, mark the board as seen.
1100
-			if (empty($numNewTopics))
1101
-				$_REQUEST['boardseen'] = true;
1102
-			else
1103
-				$_SESSION['topicseen_cache'][$board] = $numNewTopics;
1133
+			if (empty($numNewTopics)) {
1134
+							$_REQUEST['boardseen'] = true;
1135
+			} else {
1136
+							$_SESSION['topicseen_cache'][$board] = $numNewTopics;
1137
+			}
1104 1138
 		}
1105 1139
 		// Probably one less topic - maybe not, but even if we decrease this too fast it will only make us look more often.
1106
-		elseif (isset($_SESSION['topicseen_cache'][$board]))
1107
-			$_SESSION['topicseen_cache'][$board]--;
1140
+		elseif (isset($_SESSION['topicseen_cache'][$board])) {
1141
+					$_SESSION['topicseen_cache'][$board]--;
1142
+		}
1108 1143
 
1109 1144
 		// Mark board as seen if we came using last post link from BoardIndex. (or other places...)
1110 1145
 		if (isset($_REQUEST['boardseen']))
@@ -1161,23 +1196,26 @@  discard block
 block discarded – undo
1161 1196
 			$temp = array();
1162 1197
 			while ($row = $smcFunc['db_fetch_assoc']($request))
1163 1198
 			{
1164
-				if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id']))
1165
-					continue;
1199
+				if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id'])) {
1200
+									continue;
1201
+				}
1166 1202
 
1167 1203
 				$temp[$row['id_attach']] = $row;
1168 1204
 				$temp[$row['id_attach']]['topic'] = $topic;
1169 1205
 				$temp[$row['id_attach']]['board'] = $board;
1170 1206
 
1171
-				if (!isset($context['loaded_attachments'][$row['id_msg']]))
1172
-					$context['loaded_attachments'][$row['id_msg']] = array();
1207
+				if (!isset($context['loaded_attachments'][$row['id_msg']])) {
1208
+									$context['loaded_attachments'][$row['id_msg']] = array();
1209
+				}
1173 1210
 			}
1174 1211
 			$smcFunc['db_free_result']($request);
1175 1212
 
1176 1213
 			// This is better than sorting it with the query...
1177 1214
 			ksort($temp);
1178 1215
 
1179
-			foreach ($temp as $row)
1180
-				$context['loaded_attachments'][$row['id_msg']][] = $row;
1216
+			foreach ($temp as $row) {
1217
+							$context['loaded_attachments'][$row['id_msg']][] = $row;
1218
+			}
1181 1219
 		}
1182 1220
 
1183 1221
 		$msg_parameters = array(
@@ -1204,21 +1242,23 @@  discard block
 block discarded – undo
1204 1242
 		);
1205 1243
 
1206 1244
 		// And the likes
1207
-		if (!empty($modSettings['enable_likes']))
1208
-			$context['my_likes'] = $context['user']['is_guest'] ? array() : prepareLikesContext($topic);
1245
+		if (!empty($modSettings['enable_likes'])) {
1246
+					$context['my_likes'] = $context['user']['is_guest'] ? array() : prepareLikesContext($topic);
1247
+		}
1209 1248
 
1210 1249
 		// Go to the last message if the given time is beyond the time of the last message.
1211
-		if (isset($context['start_from']) && $context['start_from'] >= $context['topicinfo']['num_replies'])
1212
-			$context['start_from'] = $context['topicinfo']['num_replies'];
1250
+		if (isset($context['start_from']) && $context['start_from'] >= $context['topicinfo']['num_replies']) {
1251
+					$context['start_from'] = $context['topicinfo']['num_replies'];
1252
+		}
1213 1253
 
1214 1254
 		// Since the anchor information is needed on the top of the page we load these variables beforehand.
1215 1255
 		$context['first_message'] = isset($messages[$firstIndex]) ? $messages[$firstIndex] : $messages[0];
1216
-		if (empty($options['view_newest_first']))
1217
-			$context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['start_from'];
1218
-		else
1219
-			$context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['topicinfo']['num_replies'] - $context['start_from'];
1220
-	}
1221
-	else
1256
+		if (empty($options['view_newest_first'])) {
1257
+					$context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['start_from'];
1258
+		} else {
1259
+					$context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['topicinfo']['num_replies'] - $context['start_from'];
1260
+		}
1261
+	} else
1222 1262
 	{
1223 1263
 		$messages_request = false;
1224 1264
 		$context['first_message'] = 0;
@@ -1253,8 +1293,9 @@  discard block
 block discarded – undo
1253 1293
 		'can_restore_msg' => 'move_any',
1254 1294
 		'can_like' => 'likes_like',
1255 1295
 	);
1256
-	foreach ($common_permissions as $contextual => $perm)
1257
-		$context[$contextual] = allowedTo($perm);
1296
+	foreach ($common_permissions as $contextual => $perm) {
1297
+			$context[$contextual] = allowedTo($perm);
1298
+	}
1258 1299
 
1259 1300
 	// Permissions with _any/_own versions.  $context[YYY] => ZZZ_any/_own.
1260 1301
 	$anyown_permissions = array(
@@ -1267,8 +1308,9 @@  discard block
 block discarded – undo
1267 1308
 		'can_reply_unapproved' => 'post_unapproved_replies',
1268 1309
 		'can_view_warning' => 'profile_warning',
1269 1310
 	);
1270
-	foreach ($anyown_permissions as $contextual => $perm)
1271
-		$context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));
1311
+	foreach ($anyown_permissions as $contextual => $perm) {
1312
+			$context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));
1313
+	}
1272 1314
 
1273 1315
 	if (!$user_info['is_admin'] && $context['can_move'] && !$modSettings['topic_move_any'])
1274 1316
 	{
@@ -1314,8 +1356,9 @@  discard block
 block discarded – undo
1314 1356
 	// Check if the draft functions are enabled and that they have permission to use them (for quick reply.)
1315 1357
 	$context['drafts_save'] = !empty($modSettings['drafts_post_enabled']) && allowedTo('post_draft') && $context['can_reply'];
1316 1358
 	$context['drafts_autosave'] = !empty($context['drafts_save']) && !empty($modSettings['drafts_autosave_enabled']);
1317
-	if (!empty($context['drafts_save']))
1318
-		loadLanguage('Drafts');
1359
+	if (!empty($context['drafts_save'])) {
1360
+			loadLanguage('Drafts');
1361
+	}
1319 1362
 
1320 1363
 	// When was the last time this topic was replied to?  Should we warn them about it?
1321 1364
 	if (!empty($modSettings['oldTopicDays']) && ($context['can_reply'] || $context['can_reply_unapproved']) && empty($context['topicinfo']['is_sticky']))
@@ -1376,26 +1419,31 @@  discard block
 block discarded – undo
1376 1419
 	// Message icons - customized icons are off?
1377 1420
 	$context['icons'] = getMessageIcons($board);
1378 1421
 
1379
-	if (!empty($context['icons']))
1380
-		$context['icons'][count($context['icons']) - 1]['is_last'] = true;
1422
+	if (!empty($context['icons'])) {
1423
+			$context['icons'][count($context['icons']) - 1]['is_last'] = true;
1424
+	}
1381 1425
 
1382 1426
 	// Build the normal button array.
1383 1427
 	$context['normal_buttons'] = array();
1384 1428
 
1385
-	if ($context['can_reply'])
1386
-		$context['normal_buttons']['reply'] = array('text' => 'reply', 'image' => 'reply.png', 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true);
1429
+	if ($context['can_reply']) {
1430
+			$context['normal_buttons']['reply'] = array('text' => 'reply', 'image' => 'reply.png', 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true);
1431
+	}
1387 1432
 
1388
-	if ($context['can_add_poll'])
1389
-		$context['normal_buttons']['add_poll'] = array('text' => 'add_poll', 'image' => 'add_poll.png', 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']);
1433
+	if ($context['can_add_poll']) {
1434
+			$context['normal_buttons']['add_poll'] = array('text' => 'add_poll', 'image' => 'add_poll.png', 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']);
1435
+	}
1390 1436
 
1391
-	if ($context['can_mark_unread'])
1392
-		$context['normal_buttons']['mark_unread'] = array('text' => 'mark_unread', 'image' => 'markunread.png', 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1437
+	if ($context['can_mark_unread']) {
1438
+			$context['normal_buttons']['mark_unread'] = array('text' => 'mark_unread', 'image' => 'markunread.png', 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1439
+	}
1393 1440
 
1394
-	if ($context['can_print'])
1395
-		$context['normal_buttons']['print'] = array('text' => 'print', 'image' => 'print.png', 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0');
1441
+	if ($context['can_print']) {
1442
+			$context['normal_buttons']['print'] = array('text' => 'print', 'image' => 'print.png', 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0');
1443
+	}
1396 1444
 
1397
-	if ($context['can_set_notify'])
1398
-		$context['normal_buttons']['notify'] = array(
1445
+	if ($context['can_set_notify']) {
1446
+			$context['normal_buttons']['notify'] = array(
1399 1447
 			'text' => 'notify_topic_' . $context['topic_notification_mode'],
1400 1448
 			'sub_buttons' => array(
1401 1449
 				array(
@@ -1417,38 +1465,47 @@  discard block
 block discarded – undo
1417 1465
 				),
1418 1466
 			),
1419 1467
 		);
1468
+	}
1420 1469
 
1421 1470
 	// Build the mod button array
1422 1471
 	$context['mod_buttons'] = array();
1423 1472
 
1424
-	if ($context['can_move'])
1425
-		$context['mod_buttons']['move'] = array('text' => 'move_topic', 'image' => 'admin_move.png', 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0');
1473
+	if ($context['can_move']) {
1474
+			$context['mod_buttons']['move'] = array('text' => 'move_topic', 'image' => 'admin_move.png', 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0');
1475
+	}
1426 1476
 
1427
-	if ($context['can_delete'])
1428
-		$context['mod_buttons']['delete'] = array('text' => 'remove_topic', 'image' => 'admin_rem.png', 'custom' => 'data-confirm="' . $txt['are_sure_remove_topic'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']);
1477
+	if ($context['can_delete']) {
1478
+			$context['mod_buttons']['delete'] = array('text' => 'remove_topic', 'image' => 'admin_rem.png', 'custom' => 'data-confirm="' . $txt['are_sure_remove_topic'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']);
1479
+	}
1429 1480
 
1430
-	if ($context['can_lock'])
1431
-		$context['mod_buttons']['lock'] = array('text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1481
+	if ($context['can_lock']) {
1482
+			$context['mod_buttons']['lock'] = array('text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1483
+	}
1432 1484
 
1433
-	if ($context['can_sticky'])
1434
-		$context['mod_buttons']['sticky'] = array('text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1485
+	if ($context['can_sticky']) {
1486
+			$context['mod_buttons']['sticky'] = array('text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1487
+	}
1435 1488
 
1436
-	if ($context['can_merge'])
1437
-		$context['mod_buttons']['merge'] = array('text' => 'merge', 'image' => 'merge.png', 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']);
1489
+	if ($context['can_merge']) {
1490
+			$context['mod_buttons']['merge'] = array('text' => 'merge', 'image' => 'merge.png', 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']);
1491
+	}
1438 1492
 
1439
-	if ($context['calendar_post'])
1440
-		$context['mod_buttons']['calendar'] = array('text' => 'calendar_link', 'image' => 'linktocal.png', 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0');
1493
+	if ($context['calendar_post']) {
1494
+			$context['mod_buttons']['calendar'] = array('text' => 'calendar_link', 'image' => 'linktocal.png', 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0');
1495
+	}
1441 1496
 
1442 1497
 	// Restore topic. eh?  No monkey business.
1443
-	if ($context['can_restore_topic'])
1444
-		$context['mod_buttons']['restore_topic'] = array('text' => 'restore_topic', 'image' => '', 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1498
+	if ($context['can_restore_topic']) {
1499
+			$context['mod_buttons']['restore_topic'] = array('text' => 'restore_topic', 'image' => '', 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
1500
+	}
1445 1501
 
1446 1502
 	// Show a message in case a recently posted message became unapproved.
1447 1503
 	$context['becomesUnapproved'] = !empty($_SESSION['becomesUnapproved']) ? true : false;
1448 1504
 
1449 1505
 	// Don't want to show this forever...
1450
-	if ($context['becomesUnapproved'])
1451
-		unset($_SESSION['becomesUnapproved']);
1506
+	if ($context['becomesUnapproved']) {
1507
+			unset($_SESSION['becomesUnapproved']);
1508
+	}
1452 1509
 
1453 1510
 	// Allow adding new mod buttons easily.
1454 1511
 	// Note: $context['normal_buttons'] and $context['mod_buttons'] are added for backward compatibility with 2.0, but are deprecated and should not be used
@@ -1457,12 +1514,14 @@  discard block
 block discarded – undo
1457 1514
 	call_integration_hook('integrate_mod_buttons', array(&$context['mod_buttons']));
1458 1515
 
1459 1516
 	// Load the drafts js file
1460
-	if ($context['drafts_autosave'])
1461
-		loadJavaScriptFile('drafts.js', array('defer' => false), 'smf_drafts');
1517
+	if ($context['drafts_autosave']) {
1518
+			loadJavaScriptFile('drafts.js', array('defer' => false), 'smf_drafts');
1519
+	}
1462 1520
 
1463 1521
 	// Spellcheck
1464
-	if ($context['show_spellchecking'])
1465
-		loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck');
1522
+	if ($context['show_spellchecking']) {
1523
+			loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck');
1524
+	}
1466 1525
 
1467 1526
 	// topic.js
1468 1527
 	loadJavaScriptFile('topic.js', array('defer' => false), 'smf_topic');
@@ -1496,16 +1555,19 @@  discard block
 block discarded – undo
1496 1555
 	static $counter = null;
1497 1556
 
1498 1557
 	// If the query returned false, bail.
1499
-	if ($messages_request == false)
1500
-		return false;
1558
+	if ($messages_request == false) {
1559
+			return false;
1560
+	}
1501 1561
 
1502 1562
 	// Remember which message this is.  (ie. reply #83)
1503
-	if ($counter === null || $reset)
1504
-		$counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start'];
1563
+	if ($counter === null || $reset) {
1564
+			$counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start'];
1565
+	}
1505 1566
 
1506 1567
 	// Start from the beginning...
1507
-	if ($reset)
1508
-		return @$smcFunc['db_data_seek']($messages_request, 0);
1568
+	if ($reset) {
1569
+			return @$smcFunc['db_data_seek']($messages_request, 0);
1570
+	}
1509 1571
 
1510 1572
 	// Attempt to get the next message.
1511 1573
 	$message = $smcFunc['db_fetch_assoc']($messages_request);
@@ -1519,19 +1581,21 @@  discard block
 block discarded – undo
1519 1581
 	if (empty($context['icon_sources']))
1520 1582
 	{
1521 1583
 		$context['icon_sources'] = array();
1522
-		foreach ($context['stable_icons'] as $icon)
1523
-			$context['icon_sources'][$icon] = 'images_url';
1584
+		foreach ($context['stable_icons'] as $icon) {
1585
+					$context['icon_sources'][$icon] = 'images_url';
1586
+		}
1524 1587
 	}
1525 1588
 
1526 1589
 	// Message Icon Management... check the images exist.
1527 1590
 	if (empty($modSettings['messageIconChecks_disable']))
1528 1591
 	{
1529 1592
 		// If the current icon isn't known, then we need to do something...
1530
-		if (!isset($context['icon_sources'][$message['icon']]))
1531
-			$context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url';
1593
+		if (!isset($context['icon_sources'][$message['icon']])) {
1594
+					$context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url';
1595
+		}
1596
+	} elseif (!isset($context['icon_sources'][$message['icon']])) {
1597
+			$context['icon_sources'][$message['icon']] = 'images_url';
1532 1598
 	}
1533
-	elseif (!isset($context['icon_sources'][$message['icon']]))
1534
-		$context['icon_sources'][$message['icon']] = 'images_url';
1535 1599
 
1536 1600
 	// If you're a lazy bum, you probably didn't give a subject...
1537 1601
 	$message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
@@ -1556,8 +1620,7 @@  discard block
 block discarded – undo
1556 1620
 		$memberContext[$message['id_member']]['email'] = $message['poster_email'];
1557 1621
 		$memberContext[$message['id_member']]['show_email'] = allowedTo('moderate_forum');
1558 1622
 		$memberContext[$message['id_member']]['is_guest'] = true;
1559
-	}
1560
-	else
1623
+	} else
1561 1624
 	{
1562 1625
 		// Define this here to make things a bit more readable
1563 1626
 		$can_view_warning = $context['user']['can_mod'] || allowedTo('view_warning_any') || ($message['id_member'] == $user_info['id'] && allowedTo('view_warning_own'));
@@ -1580,8 +1643,9 @@  discard block
 block discarded – undo
1580 1643
 	$message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);
1581 1644
 
1582 1645
 	// If it's in the recycle bin we need to override whatever icon we did have.
1583
-	if (!empty($board_info['recycle']))
1584
-		$message['icon'] = 'recycled';
1646
+	if (!empty($board_info['recycle'])) {
1647
+			$message['icon'] = 'recycled';
1648
+	}
1585 1649
 
1586 1650
 	require_once($sourcedir . '/Subs-Attachments.php');
1587 1651
 
@@ -1625,32 +1689,36 @@  discard block
 block discarded – undo
1625 1689
 	}
1626 1690
 
1627 1691
 	// Are likes enable?
1628
-	if (!empty($modSettings['enable_likes']))
1629
-		$output['likes'] = array(
1692
+	if (!empty($modSettings['enable_likes'])) {
1693
+			$output['likes'] = array(
1630 1694
 			'count' => $message['likes'],
1631 1695
 			'you' => in_array($message['id_msg'], $context['my_likes']),
1632 1696
 			'can_like' => !$context['user']['is_guest'] && $message['id_member'] != $context['user']['id'] && !empty($context['can_like']),
1633 1697
 		);
1698
+	}
1634 1699
 
1635 1700
 	// Is this user the message author?
1636 1701
 	$output['is_message_author'] = $message['id_member'] == $user_info['id'];
1637
-	if (!empty($output['modified']['name']))
1638
-		$output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']);
1702
+	if (!empty($output['modified']['name'])) {
1703
+			$output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']);
1704
+	}
1639 1705
 
1640 1706
 	// Did they give a reason for editing?
1641
-	if (!empty($output['modified']['name']) && !empty($output['modified']['reason']))
1642
-		$output['modified']['last_edit_text'] .= '&nbsp;' . sprintf($txt['last_edit_reason'], $output['modified']['reason']);
1707
+	if (!empty($output['modified']['name']) && !empty($output['modified']['reason'])) {
1708
+			$output['modified']['last_edit_text'] .= '&nbsp;' . sprintf($txt['last_edit_reason'], $output['modified']['reason']);
1709
+	}
1643 1710
 
1644 1711
 	// Any custom profile fields?
1645
-	if (!empty($memberContext[$message['id_member']]['custom_fields']))
1646
-		foreach ($memberContext[$message['id_member']]['custom_fields'] as $custom)
1712
+	if (!empty($memberContext[$message['id_member']]['custom_fields'])) {
1713
+			foreach ($memberContext[$message['id_member']]['custom_fields'] as $custom)
1647 1714
 			$output['custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom;
1715
+	}
1648 1716
 
1649
-	if (empty($options['view_newest_first']))
1650
-		$counter++;
1651
-
1652
-	else
1653
-		$counter--;
1717
+	if (empty($options['view_newest_first'])) {
1718
+			$counter++;
1719
+	} else {
1720
+			$counter--;
1721
+	}
1654 1722
 
1655 1723
 	call_integration_hook('integrate_prepare_display_context', array(&$output, &$message, $counter));
1656 1724
 
@@ -1676,8 +1744,9 @@  discard block
 block discarded – undo
1676 1744
  */
1677 1745
 function approved_attach_sort($a, $b)
1678 1746
 {
1679
-	if ($a['is_approved'] == $b['is_approved'])
1680
-		return 0;
1747
+	if ($a['is_approved'] == $b['is_approved']) {
1748
+			return 0;
1749
+	}
1681 1750
 
1682 1751
 	return $a['is_approved'] > $b['is_approved'] ? -1 : 1;
1683 1752
 }
@@ -1694,16 +1763,19 @@  discard block
 block discarded – undo
1694 1763
 
1695 1764
 	require_once($sourcedir . '/RemoveTopic.php');
1696 1765
 
1697
-	if (empty($_REQUEST['msgs']))
1698
-		redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
1766
+	if (empty($_REQUEST['msgs'])) {
1767
+			redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
1768
+	}
1699 1769
 
1700 1770
 	$messages = array();
1701
-	foreach ($_REQUEST['msgs'] as $dummy)
1702
-		$messages[] = (int) $dummy;
1771
+	foreach ($_REQUEST['msgs'] as $dummy) {
1772
+			$messages[] = (int) $dummy;
1773
+	}
1703 1774
 
1704 1775
 	// We are restoring messages. We handle this in another place.
1705
-	if (isset($_REQUEST['restore_selected']))
1706
-		redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']);
1776
+	if (isset($_REQUEST['restore_selected'])) {
1777
+			redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']);
1778
+	}
1707 1779
 	if (isset($_REQUEST['split_selection']))
1708 1780
 	{
1709 1781
 		$request = $smcFunc['db_query']('', '
@@ -1722,8 +1794,9 @@  discard block
 block discarded – undo
1722 1794
 	}
1723 1795
 
1724 1796
 	// Allowed to delete any message?
1725
-	if (allowedTo('delete_any'))
1726
-		$allowed_all = true;
1797
+	if (allowedTo('delete_any')) {
1798
+			$allowed_all = true;
1799
+	}
1727 1800
 	// Allowed to delete replies to their messages?
1728 1801
 	elseif (allowedTo('delete_replies'))
1729 1802
 	{
@@ -1740,13 +1813,14 @@  discard block
 block discarded – undo
1740 1813
 		$smcFunc['db_free_result']($request);
1741 1814
 
1742 1815
 		$allowed_all = $starter == $user_info['id'];
1816
+	} else {
1817
+			$allowed_all = false;
1743 1818
 	}
1744
-	else
1745
-		$allowed_all = false;
1746 1819
 
1747 1820
 	// Make sure they're allowed to delete their own messages, if not any.
1748
-	if (!$allowed_all)
1749
-		isAllowedTo('delete_own');
1821
+	if (!$allowed_all) {
1822
+			isAllowedTo('delete_own');
1823
+	}
1750 1824
 
1751 1825
 	// Allowed to remove which messages?
1752 1826
 	$request = $smcFunc['db_query']('', '
@@ -1766,8 +1840,9 @@  discard block
 block discarded – undo
1766 1840
 	$messages = array();
1767 1841
 	while ($row = $smcFunc['db_fetch_assoc']($request))
1768 1842
 	{
1769
-		if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time())
1770
-			continue;
1843
+		if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time()) {
1844
+					continue;
1845
+		}
1771 1846
 
1772 1847
 		$messages[$row['id_msg']] = array($row['subject'], $row['id_member']);
1773 1848
 	}
@@ -1790,17 +1865,20 @@  discard block
 block discarded – undo
1790 1865
 	foreach ($messages as $message => $info)
1791 1866
 	{
1792 1867
 		// Just skip the first message - if it's not the last.
1793
-		if ($message == $first_message && $message != $last_message)
1794
-			continue;
1868
+		if ($message == $first_message && $message != $last_message) {
1869
+					continue;
1870
+		}
1795 1871
 		// If the first message is going then don't bother going back to the topic as we're effectively deleting it.
1796
-		elseif ($message == $first_message)
1797
-			$topicGone = true;
1872
+		elseif ($message == $first_message) {
1873
+					$topicGone = true;
1874
+		}
1798 1875
 
1799 1876
 		removeMessage($message);
1800 1877
 
1801 1878
 		// Log this moderation action ;).
1802
-		if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id']))
1803
-			logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board));
1879
+		if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) {
1880
+					logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board));
1881
+		}
1804 1882
 	}
1805 1883
 
1806 1884
 	redirectexit(!empty($topicGone) ? 'board=' . $board : 'topic=' . $topic . '.' . $_REQUEST['start']);
Please login to merge, or discard this patch.
Sources/Admin.php 1 patch
Braces   +75 added lines, -52 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * The main admin handling function.<br>
@@ -444,8 +445,9 @@  discard block
 block discarded – undo
444 445
 		foreach ($admin_includes as $include)
445 446
 		{
446 447
 			$include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
447
-			if (file_exists($include))
448
-				require_once($include);
448
+			if (file_exists($include)) {
449
+							require_once($include);
450
+			}
449 451
 		}
450 452
 	}
451 453
 
@@ -457,24 +459,27 @@  discard block
 block discarded – undo
457 459
 	unset($admin_areas);
458 460
 
459 461
 	// Nothing valid?
460
-	if ($admin_include_data == false)
461
-		fatal_lang_error('no_access', false);
462
+	if ($admin_include_data == false) {
463
+			fatal_lang_error('no_access', false);
464
+	}
462 465
 
463 466
 	// Build the link tree.
464 467
 	$context['linktree'][] = array(
465 468
 		'url' => $scripturl . '?action=admin',
466 469
 		'name' => $txt['admin_center'],
467 470
 	);
468
-	if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index')
469
-		$context['linktree'][] = array(
471
+	if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index') {
472
+			$context['linktree'][] = array(
470 473
 			'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';' . $context['session_var'] . '=' . $context['session_id'],
471 474
 			'name' => $admin_include_data['label'],
472 475
 		);
473
-	if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label'])
474
-		$context['linktree'][] = array(
476
+	}
477
+	if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label']) {
478
+			$context['linktree'][] = array(
475 479
 			'url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';sa=' . $admin_include_data['current_subsection'] . ';' . $context['session_var'] . '=' . $context['session_id'],
476 480
 			'name' => $admin_include_data['subsections'][$admin_include_data['current_subsection']][0],
477 481
 		);
482
+	}
478 483
 
479 484
 	// Make a note of the Unique ID for this menu.
480 485
 	$context['admin_menu_id'] = $context['max_menu_id'];
@@ -484,16 +489,18 @@  discard block
 block discarded – undo
484 489
 	$context['admin_area'] = $admin_include_data['current_area'];
485 490
 
486 491
 	// Now - finally - call the right place!
487
-	if (isset($admin_include_data['file']))
488
-		require_once($sourcedir . '/' . $admin_include_data['file']);
492
+	if (isset($admin_include_data['file'])) {
493
+			require_once($sourcedir . '/' . $admin_include_data['file']);
494
+	}
489 495
 
490 496
 	// Get the right callable.
491 497
 	$call = call_helper($admin_include_data['function'], true);
492 498
 
493 499
 	// Is it valid?
494
-	if (!empty($call))
495
-		call_user_func($call);
496
-}
500
+	if (!empty($call)) {
501
+			call_user_func($call);
502
+	}
503
+	}
497 504
 
498 505
 /**
499 506
  * The main administration section.
@@ -547,13 +554,14 @@  discard block
 block discarded – undo
547 554
 
548 555
 	$context['sub_template'] = $context['admin_area'] == 'credits' ? 'credits' : 'admin';
549 556
 	$context['page_title'] = $context['admin_area'] == 'credits' ? $txt['support_credits_title'] : $txt['admin_center'];
550
-	if ($context['admin_area'] != 'credits')
551
-		$context[$context['admin_menu_name']]['tab_data'] = array(
557
+	if ($context['admin_area'] != 'credits') {
558
+			$context[$context['admin_menu_name']]['tab_data'] = array(
552 559
 			'title' => $txt['admin_center'],
553 560
 			'help' => '',
554 561
 			'description' => '<strong>' . $txt['hello_guest'] . ' ' . $context['user']['name'] . '!</strong>
555 562
 						' . sprintf($txt['admin_main_welcome'], $txt['admin_center'], $txt['help'], $txt['help']),
556 563
 		);
564
+	}
557 565
 
558 566
 	// Lastly, fill in the blanks in the support resources paragraphs.
559 567
 	$txt['support_resources_p1'] = sprintf($txt['support_resources_p1'],
@@ -571,9 +579,10 @@  discard block
 block discarded – undo
571 579
 		'https://www.simplemachines.org/redirect/customize_support'
572 580
 	);
573 581
 
574
-	if ($context['admin_area'] == 'admin')
575
-		loadJavaScriptFile('admin.js', array('defer' => false), 'smf_admin');
576
-}
582
+	if ($context['admin_area'] == 'admin') {
583
+			loadJavaScriptFile('admin.js', array('defer' => false), 'smf_admin');
584
+	}
585
+	}
577 586
 
578 587
 /**
579 588
  * Get one of the admin information files from Simple Machines.
@@ -584,8 +593,9 @@  discard block
 block discarded – undo
584 593
 
585 594
 	setMemoryLimit('32M');
586 595
 
587
-	if (empty($_REQUEST['filename']) || !is_string($_REQUEST['filename']))
588
-		fatal_lang_error('no_access', false);
596
+	if (empty($_REQUEST['filename']) || !is_string($_REQUEST['filename'])) {
597
+			fatal_lang_error('no_access', false);
598
+	}
589 599
 
590 600
 	// Strip off the forum cache part or we won't find it...
591 601
 	$_REQUEST['filename'] = str_replace($modSettings['browser_cache'], '', $_REQUEST['filename']);
@@ -600,27 +610,30 @@  discard block
 block discarded – undo
600 610
 		)
601 611
 	);
602 612
 
603
-	if ($smcFunc['db_num_rows']($request) == 0)
604
-		fatal_lang_error('admin_file_not_found', true, array($_REQUEST['filename']), 404);
613
+	if ($smcFunc['db_num_rows']($request) == 0) {
614
+			fatal_lang_error('admin_file_not_found', true, array($_REQUEST['filename']), 404);
615
+	}
605 616
 
606 617
 	list ($file_data, $filetype) = $smcFunc['db_fetch_row']($request);
607 618
 	$smcFunc['db_free_result']($request);
608 619
 
609 620
 	// @todo Temp
610 621
 	// Figure out if sesc is still being used.
611
-	if (strpos($file_data, ';sesc=') !== false && $filetype == 'text/javascript')
612
-		$file_data = '
622
+	if (strpos($file_data, ';sesc=') !== false && $filetype == 'text/javascript') {
623
+			$file_data = '
613 624
 if (!(\'smfForum_sessionvar\' in window))
614 625
 	window.smfForum_sessionvar = \'sesc\';
615 626
 ' . strtr($file_data, array(';sesc=' => ';\' + window.smfForum_sessionvar + \'='));
627
+	}
616 628
 
617 629
 	$context['template_layers'] = array();
618 630
 	// Lets make sure we aren't going to output anything nasty.
619 631
 	@ob_end_clean();
620
-	if (!empty($modSettings['enableCompressedOutput']))
621
-		@ob_start('ob_gzhandler');
622
-	else
623
-		@ob_start();
632
+	if (!empty($modSettings['enableCompressedOutput'])) {
633
+			@ob_start('ob_gzhandler');
634
+	} else {
635
+			@ob_start();
636
+	}
624 637
 
625 638
 	// Make sure they know what type of file we are.
626 639
 	header('Content-Type: ' . $filetype);
@@ -660,11 +673,12 @@  discard block
 block discarded – undo
660 673
 		updateAdminPreferences();
661 674
 	}
662 675
 
663
-	if (trim($context['search_term']) == '')
664
-		$context['search_results'] = array();
665
-	else
666
-		call_helper($subActions[$context['search_type']]);
667
-}
676
+	if (trim($context['search_term']) == '') {
677
+			$context['search_results'] = array();
678
+	} else {
679
+			call_helper($subActions[$context['search_type']]);
680
+	}
681
+	}
668 682
 
669 683
 /**
670 684
  * A complicated but relatively quick internal search.
@@ -728,8 +742,9 @@  discard block
 block discarded – undo
728 742
 
729 743
 	loadLanguage(implode('+', $language_files));
730 744
 
731
-	foreach ($include_files as $file)
732
-		require_once($sourcedir . '/' . $file . '.php');
745
+	foreach ($include_files as $file) {
746
+			require_once($sourcedir . '/' . $file . '.php');
747
+	}
733 748
 
734 749
 	/* This is the huge array that defines everything... it's a huge array of items formatted as follows:
735 750
 		0 = Language index (Can be array of indexes) to search through for this setting.
@@ -753,11 +768,12 @@  discard block
 block discarded – undo
753 768
 		foreach ($section['areas'] as $menu_key => $menu_item)
754 769
 		{
755 770
 			$search_data['sections'][] = array($menu_item['label'], 'area=' . $menu_key);
756
-			if (!empty($menu_item['subsections']))
757
-				foreach ($menu_item['subsections'] as $key => $sublabel)
771
+			if (!empty($menu_item['subsections'])) {
772
+							foreach ($menu_item['subsections'] as $key => $sublabel)
758 773
 				{
759 774
 					if (isset($sublabel['label']))
760 775
 						$search_data['sections'][] = array($sublabel['label'], 'area=' . $menu_key . ';sa=' . $key);
776
+			}
761 777
 				}
762 778
 		}
763 779
 	}
@@ -767,9 +783,10 @@  discard block
 block discarded – undo
767 783
 		// Get a list of their variables.
768 784
 		$config_vars = $setting_area[0](true);
769 785
 
770
-		foreach ($config_vars as $var)
771
-			if (!empty($var[1]) && !in_array($var[0], array('permissions', 'switch', 'desc')))
786
+		foreach ($config_vars as $var) {
787
+					if (!empty($var[1]) && !in_array($var[0], array('permissions', 'switch', 'desc')))
772 788
 				$search_data['settings'][] = array($var[(isset($var[2]) && in_array($var[2], array('file', 'db'))) ? 0 : 1], $setting_area[1], 'alttxt' => (isset($var[2]) && in_array($var[2], array('file', 'db'))) || isset($var[3]) ? (in_array($var[2], array('file', 'db')) ? $var[1] : $var[3]) : '');
789
+		}
773 790
 	}
774 791
 
775 792
 	$context['page_title'] = $txt['admin_search_results'];
@@ -782,8 +799,9 @@  discard block
 block discarded – undo
782 799
 		foreach ($data as $item)
783 800
 		{
784 801
 			$found = false;
785
-			if (!is_array($item[0]))
786
-				$item[0] = array($item[0]);
802
+			if (!is_array($item[0])) {
803
+							$item[0] = array($item[0]);
804
+			}
787 805
 			foreach ($item[0] as $term)
788 806
 			{
789 807
 				if (stripos($term, $search_term) !== false || (isset($txt[$term]) && stripos($txt[$term], $search_term) !== false) || (isset($txt['setting_' . $term]) && stripos($txt['setting_' . $term], $search_term) !== false))
@@ -841,8 +859,9 @@  discard block
 block discarded – undo
841 859
 	$postVars = explode(' ', $context['search_term']);
842 860
 
843 861
 	// Encode the search data.
844
-	foreach ($postVars as $k => $v)
845
-		$postVars[$k] = urlencode($v);
862
+	foreach ($postVars as $k => $v) {
863
+			$postVars[$k] = urlencode($v);
864
+	}
846 865
 
847 866
 	// This is what we will send.
848 867
 	$postVars = implode('+', $postVars);
@@ -854,8 +873,9 @@  discard block
 block discarded – undo
854 873
 	$search_results = fetch_web_data($context['doc_apiurl'] . '?action=query&list=search&srprop=timestamp|snippet&format=xml&srwhat=text&srsearch=' . $postVars);
855 874
 
856 875
 	// If we didn't get any xml back we are in trouble - perhaps the doc site is overloaded?
857
-	if (!$search_results || preg_match('~<' . '\?xml\sversion="\d+\.\d+"\?' . '>\s*(<api>.+?</api>)~is', $search_results, $matches) != true)
858
-		fatal_lang_error('cannot_connect_doc_site');
876
+	if (!$search_results || preg_match('~<' . '\?xml\sversion="\d+\.\d+"\?' . '>\s*(<api>.+?</api>)~is', $search_results, $matches) != true) {
877
+			fatal_lang_error('cannot_connect_doc_site');
878
+	}
859 879
 
860 880
 	$search_results = $matches[1];
861 881
 
@@ -867,8 +887,9 @@  discard block
 block discarded – undo
867 887
 	$results = new xmlArray($search_results, false);
868 888
 
869 889
 	// Move through the api layer.
870
-	if (!$results->exists('api'))
871
-		fatal_lang_error('cannot_connect_doc_site');
890
+	if (!$results->exists('api')) {
891
+			fatal_lang_error('cannot_connect_doc_site');
892
+	}
872 893
 
873 894
 	// Are there actually some results?
874 895
 	if ($results->exists('api/query/search/p'))
@@ -904,8 +925,9 @@  discard block
 block discarded – undo
904 925
 	);
905 926
 
906 927
 	// If it's not got a sa set it must have come here for first time, pretend error log should be reversed.
907
-	if (!isset($_REQUEST['sa']))
908
-		$_REQUEST['desc'] = true;
928
+	if (!isset($_REQUEST['sa'])) {
929
+			$_REQUEST['desc'] = true;
930
+	}
909 931
 
910 932
 	// Setup some tab stuff.
911 933
 	$context[$context['admin_menu_name']]['tab_data'] = array(
@@ -955,9 +977,10 @@  discard block
 block discarded – undo
955 977
 	unset($_SESSION['admin_time']);
956 978
 
957 979
 	// Clean any admin tokens as well.
958
-	foreach ($_SESSION['token'] as $key => $token)
959
-		if (strpos($key, '-admin') !== false)
980
+	foreach ($_SESSION['token'] as $key => $token) {
981
+			if (strpos($key, '-admin') !== false)
960 982
 			unset($_SESSION['token'][$key]);
983
+	}
961 984
 
962 985
 	redirectexit();
963 986
 }
Please login to merge, or discard this patch.
Themes/default/ManageNews.template.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,9 +18,10 @@  discard block
 block discarded – undo
18 18
 	global $context, $txt, $scripturl;
19 19
 
20 20
 	// Are we done sending the newsletter?
21
-	if (!empty($context['newsletter_sent']))
22
-		echo '
21
+	if (!empty($context['newsletter_sent'])) {
22
+			echo '
23 23
 	<div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>';
24
+	}
24 25
 
25 26
 	echo '
26 27
 	<div id="admincenter">
@@ -39,9 +40,10 @@  discard block
 block discarded – undo
39 40
 					</dt>
40 41
 					<dd>';
41 42
 
42
-	foreach ($context['groups'] as $group)
43
-		echo '
43
+	foreach ($context['groups'] as $group) {
44
+			echo '
44 45
 						<label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>';
46
+	}
45 47
 
46 48
 	echo '
47 49
 						<br>
@@ -82,9 +84,10 @@  discard block
 block discarded – undo
82 84
 						</dt>
83 85
 						<dd>';
84 86
 
85
-	foreach ($context['groups'] as $group)
86
-		echo '
87
+	foreach ($context['groups'] as $group) {
88
+			echo '
87 89
 							<label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>';
90
+	}
88 91
 
89 92
 	echo '
90 93
 							<br>
@@ -230,9 +233,10 @@  discard block
 block discarded – undo
230 233
 				<div id="bbcBox_message"></div>';
231 234
 
232 235
 	// What about smileys?
233
-	if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
234
-		echo '
236
+	if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) {
237
+			echo '
235 238
 				<div id="smileyBox_message"></div>';
239
+	}
236 240
 
237 241
 	// Show BBC buttons, smileys and textbox.
238 242
 	echo '
@@ -253,9 +257,10 @@  discard block
 block discarded – undo
253 257
 			<input type="hidden" name="email_force" value="', $context['email_force'], '">
254 258
 			<input type="hidden" name="total_emails" value="', $context['total_emails'], '">';
255 259
 
256
-	foreach ($context['recipients'] as $key => $values)
257
-		echo '
260
+	foreach ($context['recipients'] as $key => $values) {
261
+			echo '
258 262
 			<input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">';
263
+	}
259 264
 
260 265
 	echo '
261 266
 			<script>';
@@ -411,9 +416,10 @@  discard block
 block discarded – undo
411 416
 				<input type="hidden" name="parse_html" value="', $context['parse_html'], '">';
412 417
 
413 418
 	// All the things we must remember!
414
-	foreach ($context['recipients'] as $key => $values)
415
-		echo '
419
+	foreach ($context['recipients'] as $key => $values) {
420
+			echo '
416 421
 				<input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">';
422
+	}
417 423
 
418 424
 	echo '
419 425
 			</div><!-- .windowbg -->
@@ -446,9 +452,10 @@  discard block
 block discarded – undo
446 452
 {
447 453
 	global $context, $txt;
448 454
 
449
-	if (!empty($context['saved_successful']))
450
-		echo '
455
+	if (!empty($context['saved_successful'])) {
456
+			echo '
451 457
 			<div class="infobox">', $txt['settings_saved'], '</div>';
458
+	}
452 459
 
453 460
 	template_show_list('news_lists');
454 461
 }
Please login to merge, or discard this patch.
Themes/default/Stats.template.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,10 +44,11 @@  discard block
 block discarded – undo
44 44
 				<dt>', $txt['users_online_today'], ':</dt>
45 45
 				<dd>', $context['online_today'], '</dd>';
46 46
 
47
-	if (!empty($modSettings['hitStats']))
48
-		echo '
47
+	if (!empty($modSettings['hitStats'])) {
48
+			echo '
49 49
 				<dt>', $txt['num_hits'], ':</dt>
50 50
 				<dd>', $context['num_hits'], '</dd>';
51
+	}
51 52
 
52 53
 	echo '
53 54
 			</dl>
@@ -71,17 +72,19 @@  discard block
 block discarded – undo
71 72
 				<dt>', $txt['gender_stats'], ':</dt>
72 73
 				<dd>';
73 74
 
74
-		foreach ($context['gender'] as $g => $n)
75
-			echo $g, ': ', $n, '<br>';
75
+		foreach ($context['gender'] as $g => $n) {
76
+					echo $g, ': ', $n, '<br>';
77
+		}
76 78
 
77 79
 		echo '
78 80
 				</dd>';
79 81
 	}
80 82
 
81
-	if (!empty($modSettings['hitStats']))
82
-		echo '
83
+	if (!empty($modSettings['hitStats'])) {
84
+			echo '
83 85
 				<dt>', $txt['average_hits'], ':</dt>
84 86
 				<dd>', $context['average_hits'], '</dd>';
87
+	}
85 88
 
86 89
 	echo '
87 90
 			</dl>';
@@ -105,14 +108,15 @@  discard block
 block discarded – undo
105 108
 					</dt>
106 109
 					<dd class="statsbar">';
107 110
 
108
-			if (!empty($item['percent']))
109
-				echo '
111
+			if (!empty($item['percent'])) {
112
+							echo '
110 113
 						<div class="bar" style="width: ', $item['percent'], '%;">
111 114
 							<span class="righttext">', $item['num'], '</span>
112 115
 						</div>';
113
-			else
114
-				echo '
116
+			} else {
117
+							echo '
115 118
 						<div class="bar empty"><span class="righttext">', $item['num'], '</span></div>';
119
+			}
116 120
 
117 121
 			echo '
118 122
 					</dd>';
@@ -144,9 +148,10 @@  discard block
 block discarded – undo
144 148
 					<th>', $txt['stats_new_members'], '</th>
145 149
 					<th>', $txt['most_online'], '</th>';
146 150
 
147
-		if (!empty($modSettings['hitStats']))
148
-			echo '
151
+		if (!empty($modSettings['hitStats'])) {
152
+					echo '
149 153
 					<th>', $txt['page_views'], '</th>';
154
+		}
150 155
 
151 156
 		echo '
152 157
 				</tr>
@@ -165,9 +170,10 @@  discard block
 block discarded – undo
165 170
 					<th>', $year['new_members'], '</th>
166 171
 					<th>', $year['most_members_online'], '</th>';
167 172
 
168
-			if (!empty($modSettings['hitStats']))
169
-				echo '
173
+			if (!empty($modSettings['hitStats'])) {
174
+							echo '
170 175
 					<th>', $year['hits'], '</th>';
176
+			}
171 177
 
172 178
 			echo '
173 179
 				</tr>';
@@ -184,9 +190,10 @@  discard block
 block discarded – undo
184 190
 					<th>', $month['new_members'], '</th>
185 191
 					<th>', $month['most_members_online'], '</th>';
186 192
 
187
-				if (!empty($modSettings['hitStats']))
188
-					echo '
193
+				if (!empty($modSettings['hitStats'])) {
194
+									echo '
189 195
 					<th>', $month['hits'], '</th>';
196
+				}
190 197
 
191 198
 				echo '
192 199
 				</tr>';
@@ -203,9 +210,10 @@  discard block
 block discarded – undo
203 210
 					<td>', $day['new_members'], '</td>
204 211
 					<td>', $day['most_members_online'], '</td>';
205 212
 
206
-						if (!empty($modSettings['hitStats']))
207
-							echo '
213
+						if (!empty($modSettings['hitStats'])) {
214
+													echo '
208 215
 					<td>', $day['hits'], '</td>';
216
+						}
209 217
 
210 218
 						echo '
211 219
 				</tr>';
Please login to merge, or discard this patch.
Themes/default/Poll.template.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 				<h3 class="catbg">', $context['page_title'], '</h3>
47 47
 			</div>';
48 48
 
49
-	if (!empty($context['poll_error']['messages']))
50
-		echo '
49
+	if (!empty($context['poll_error']['messages'])) {
50
+			echo '
51 51
 			<div class="errorbox">
52 52
 				<dl class="poll_error">
53 53
 					<dt>
@@ -58,6 +58,7 @@  discard block
 block discarded – undo
58 58
 					</dt>
59 59
 				</dl>
60 60
 			</div>';
61
+	}
61 62
 
62 63
 	echo '
63 64
 			<div>
@@ -79,8 +80,9 @@  discard block
 block discarded – undo
79 80
 								<input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" size="80" maxlength="255">';
80 81
 
81 82
 		// Does this option have a vote count yet, or is it new?
82
-		if ($choice['votes'] != -1)
83
-			echo ' (', $choice['votes'], ' ', $txt['votes'], ')';
83
+		if ($choice['votes'] != -1) {
84
+					echo ' (', $choice['votes'], ' ', $txt['votes'], ')';
85
+		}
84 86
 
85 87
 		echo '
86 88
 							</dd>';
@@ -118,14 +120,15 @@  discard block
 block discarded – undo
118 120
 								<input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', '>
119 121
 							</dd>';
120 122
 
121
-		if ($context['poll']['guest_vote_allowed'])
122
-			echo '
123
+		if ($context['poll']['guest_vote_allowed']) {
124
+					echo '
123 125
 							<dt>
124 126
 								<label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
125 127
 							</dt>
126 128
 							<dd>
127 129
 								<input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll']['guest_vote']) ? ' checked' : '', '>
128 130
 							</dd>';
131
+		}
129 132
 	}
130 133
 
131 134
 	echo '
@@ -141,12 +144,13 @@  discard block
 block discarded – undo
141 144
 					</fieldset>';
142 145
 
143 146
 	// If this is an edit, we can allow them to reset the vote counts.
144
-	if ($context['is_edit'])
145
-		echo '
147
+	if ($context['is_edit']) {
148
+			echo '
146 149
 					<fieldset id="poll_reset">
147 150
 						<legend>', $txt['reset_votes'], '</legend>
148 151
 						<input type="checkbox" name="resetVoteCount" value="on"> ' . $txt['reset_votes_check'] . '
149 152
 					</fieldset>';
153
+	}
150 154
 	echo '
151 155
 					<input type="submit" name="post" value="', $txt['save'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button">
152 156
 				</div><!-- .roundframe -->
Please login to merge, or discard this patch.
Themes/default/ManageMembers.template.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 				</thead>
149 149
 				<tbody>';
150 150
 
151
-	foreach ($context['membergroups'] as $membergroup)
152
-		echo '
151
+	foreach ($context['membergroups'] as $membergroup) {
152
+			echo '
153 153
 					<tr class="windowbg">
154 154
 						<td>', $membergroup['name'], '</td>
155 155
 						<td class="centercol">
@@ -159,6 +159,7 @@  discard block
 block discarded – undo
159 159
 							', $membergroup['can_be_additional'] ? '<input type="checkbox" name="membergroups[2][]" value="' . $membergroup['id'] . '" checked>' : '', '
160 160
 						</td>
161 161
 					</tr>';
162
+	}
162 163
 
163 164
 	echo '
164 165
 					<tr class="windowbg">
@@ -185,8 +186,8 @@  discard block
 block discarded – undo
185 186
 				</thead>
186 187
 				<tbody>';
187 188
 
188
-	foreach ($context['postgroups'] as $postgroup)
189
-		echo '
189
+	foreach ($context['postgroups'] as $postgroup) {
190
+			echo '
190 191
 					<tr class="windowbg">
191 192
 						<td>
192 193
 							', $postgroup['name'], '
@@ -195,6 +196,7 @@  discard block
 block discarded – undo
195 196
 							<input type="checkbox" name="postgroups[]" value="', $postgroup['id'], '" checked>
196 197
 						</td>
197 198
 					</tr>';
199
+	}
198 200
 
199 201
 	echo '
200 202
 					<tr class="windowbg">
Please login to merge, or discard this patch.
Themes/default/index.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 			// In maintenance mode, only login is allowed and don't show OverlayDiv
233 233
 			echo '
234 234
 			<ul class="floatleft welcome">
235
-				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li>
235
+				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl . '?action=login', 'return true;'), '</li>
236 236
 			</ul>';
237 237
 
238 238
 	if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1)
Please login to merge, or discard this patch.
Braces   +98 added lines, -67 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 disabled 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.
@@ -112,8 +113,9 @@  discard block
 block discarded – undo
112 113
 		echo '
113 114
 	<meta';
114 115
 
115
-		foreach ($meta_tag as $meta_key => $meta_value)
116
-			echo ' ', $meta_key, '="', $meta_value, '"';
116
+		foreach ($meta_tag as $meta_key => $meta_value) {
117
+					echo ' ', $meta_key, '="', $meta_value, '"';
118
+		}
117 119
 
118 120
 		echo '>';
119 121
 	}
@@ -124,14 +126,16 @@  discard block
 block discarded – undo
124 126
 	<meta name="theme-color" content="#557EA0">';
125 127
 
126 128
 	// Please don't index these Mr Robot.
127
-	if (!empty($context['robot_no_index']))
128
-		echo '
129
+	if (!empty($context['robot_no_index'])) {
130
+			echo '
129 131
 	<meta name="robots" content="noindex">';
132
+	}
130 133
 
131 134
 	// Present a canonical url for search engines to prevent duplicate content in their indices.
132
-	if (!empty($context['canonical_url']))
133
-		echo '
135
+	if (!empty($context['canonical_url'])) {
136
+			echo '
134 137
 	<link rel="canonical" href="', $context['canonical_url'], '">';
138
+	}
135 139
 
136 140
 	// Show all the relative links, such as help, search, contents, and the like.
137 141
 	echo '
@@ -140,24 +144,28 @@  discard block
 block discarded – undo
140 144
 	<link rel="search" href="' . $scripturl . '?action=search">' : '');
141 145
 
142 146
 	// If RSS feeds are enabled, advertise the presence of one.
143
-	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
144
-		echo '
147
+	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) {
148
+			echo '
145 149
 	<link rel="alternate" 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'] : '', '">
146 150
 	<link rel="alternate" 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'] : '', '">';
151
+	}
147 152
 
148 153
 	// If we're viewing a topic, these should be the previous and next topics, respectively.
149
-	if (!empty($context['links']['next']))
150
-		echo '
154
+	if (!empty($context['links']['next'])) {
155
+			echo '
151 156
 	<link rel="next" href="', $context['links']['next'], '">';
157
+	}
152 158
 
153
-	if (!empty($context['links']['prev']))
154
-		echo '
159
+	if (!empty($context['links']['prev'])) {
160
+			echo '
155 161
 	<link rel="prev" href="', $context['links']['prev'], '">';
162
+	}
156 163
 
157 164
 	// If we're in a board, or a topic for that matter, the index will be the board's index.
158
-	if (!empty($context['current_board']))
159
-		echo '
165
+	if (!empty($context['current_board'])) {
166
+			echo '
160 167
 	<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">';
168
+	}
161 169
 
162 170
 	// Output any remaining HTML headers. (from mods, maybe?)
163 171
 	echo $context['html_headers'];
@@ -190,20 +198,22 @@  discard block
 block discarded – undo
190 198
 				<li>
191 199
 					<a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">';
192 200
 
193
-		if (!empty($context['user']['avatar']))
194
-			echo $context['user']['avatar']['image'];
201
+		if (!empty($context['user']['avatar'])) {
202
+					echo $context['user']['avatar']['image'];
203
+		}
195 204
 
196 205
 		echo $context['user']['name'], '</a>
197 206
 					<div id="profile_menu" class="top_menu"></div>
198 207
 				</li>';
199 208
 
200 209
 		// Secondly, PMs if we're doing them
201
-		if ($context['allow_pm'])
202
-			echo '
210
+		if ($context['allow_pm']) {
211
+					echo '
203 212
 				<li>
204 213
 					<a href="', $scripturl, '?action=pm"', !empty($context['self_pm']) ? ' class="active"' : '', ' id="pm_menu_top">', $txt['pm_short'], !empty($context['user']['unread_messages']) ? ' <span class="amt">' . $context['user']['unread_messages'] . '</span>' : '', '</a>
205 214
 					<div id="pm_menu" class="top_menu scrollable"></div>
206 215
 				</li>';
216
+		}
207 217
 
208 218
 		// Thirdly, alerts
209 219
 		echo '
@@ -218,17 +228,18 @@  discard block
 block discarded – undo
218 228
 	}
219 229
 	// Otherwise they're a guest. Ask them to either register or login.
220 230
 	else
221
-		if (empty($maintenance))
222
-			echo '
231
+		if (empty($maintenance)) {
232
+					echo '
223 233
 			<ul class="floatleft welcome">
224 234
 				<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>
225 235
 			</ul>';
226
-		else
227
-			// In maintenance mode, only login is allowed and don't show OverlayDiv
236
+		} else {
237
+					// In maintenance mode, only login is allowed and don't show OverlayDiv
228 238
 			echo '
229 239
 			<ul class="floatleft welcome">
230 240
 				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li>
231 241
 			</ul>';
242
+		}
232 243
 
233 244
 	if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1)
234 245
 	{
@@ -236,9 +247,10 @@  discard block
 block discarded – undo
236 247
 			<form id="languages_form" method="get" class="floatright">
237 248
 				<select id="language_select" name="language" onchange="this.form.submit()">';
238 249
 
239
-		foreach ($context['languages'] as $language)
240
-			echo '
250
+		foreach ($context['languages'] as $language) {
251
+					echo '
241 252
 					<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>';
253
+		}
242 254
 
243 255
 		echo '
244 256
 				</select>
@@ -262,32 +274,37 @@  discard block
 block discarded – undo
262 274
 					<option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>';
263 275
 
264 276
 		// Can't limit it to a specific topic if we are not in one
265
-		if (!empty($context['current_topic']))
266
-			echo '
277
+		if (!empty($context['current_topic'])) {
278
+					echo '
267 279
 					<option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>';
280
+		}
268 281
 
269 282
 		// Can't limit it to a specific board if we are not in one
270
-		if (!empty($context['current_board']))
271
-			echo '
283
+		if (!empty($context['current_board'])) {
284
+					echo '
272 285
 					<option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>';
286
+		}
273 287
 
274 288
 		// Can't search for members if we can't see the memberlist
275
-		if (!empty($context['allow_memberlist']))
276
-			echo '
289
+		if (!empty($context['allow_memberlist'])) {
290
+					echo '
277 291
 					<option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>';
292
+		}
278 293
 
279 294
 		echo '
280 295
 				</select>';
281 296
 
282 297
 		// Search within current topic?
283
-		if (!empty($context['current_topic']))
284
-			echo '
298
+		if (!empty($context['current_topic'])) {
299
+					echo '
285 300
 				<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">';
301
+		}
286 302
 
287 303
 		// If we're on a certain board, limit it to this board ;).
288
-		elseif (!empty($context['current_board']))
289
-			echo '
304
+		elseif (!empty($context['current_board'])) {
305
+					echo '
290 306
 				<input type="hidden" name="sd_brd" value="', $context['current_board'], '">';
307
+		}
291 308
 
292 309
 		echo '
293 310
 				<input type="submit" name="search2" value="', $txt['search'], '" class="button">
@@ -319,12 +336,13 @@  discard block
 block discarded – undo
319 336
 					</div>';
320 337
 
321 338
 	// Show a random news item? (or you could pick one from news_lines...)
322
-	if (!empty($settings['enable_news']) && !empty($context['random_news_line']))
323
-		echo '
339
+	if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) {
340
+			echo '
324 341
 					<div class="news">
325 342
 						<h2>', $txt['news'], ': </h2>
326 343
 						<p>', $context['random_news_line'], '</p>
327 344
 					</div>';
345
+	}
328 346
 
329 347
 	echo '
330 348
 					<hr class="clear">
@@ -385,9 +403,10 @@  discard block
 block discarded – undo
385 403
 		</ul>';
386 404
 
387 405
 	// Show the load time?
388
-	if ($context['show_load_time'])
389
-		echo '
406
+	if ($context['show_load_time']) {
407
+			echo '
390 408
 		<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>';
409
+	}
391 410
 
392 411
 	echo '
393 412
 		</div>
@@ -418,18 +437,20 @@  discard block
 block discarded – undo
418 437
 	global $context, $shown_linktree, $scripturl, $txt;
419 438
 
420 439
 	// If linktree is empty, just return - also allow an override.
421
-	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
422
-		return;
440
+	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) {
441
+			return;
442
+	}
423 443
 		echo '
424 444
 				<div class="navigate_section">
425 445
 					<ul>';
426 446
 
427
-	if ($context['user']['is_logged'])
428
-		echo '
447
+	if ($context['user']['is_logged']) {
448
+			echo '
429 449
 						<li class="unread_links">
430 450
 							<a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a>
431 451
 							<a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a>
432 452
 						</li>';
453
+	}
433 454
 
434 455
 	// Each tree item has a URL and name. Some may have extra_before and extra_after.
435 456
 	foreach ($context['linktree'] as $link_num => $tree)
@@ -440,25 +461,29 @@  discard block
 block discarded – undo
440 461
 		// Don't show a separator for the first one.
441 462
 		// Better here. Always points to the next level when the linktree breaks to a second line.
442 463
 		// Picked a better looking HTML entity, and added support for RTL plus a span for styling.
443
-		if ($link_num != 0)
444
-			echo '
464
+		if ($link_num != 0) {
465
+					echo '
445 466
 							<span class="dividers">', $context['right_to_left'] ? ' &#9668; ' : ' &#9658; ', '</span>';
467
+		}
446 468
 
447 469
 		// Show something before the link?
448
-		if (isset($tree['extra_before']))
449
-			echo $tree['extra_before'], ' ';
470
+		if (isset($tree['extra_before'])) {
471
+					echo $tree['extra_before'], ' ';
472
+		}
450 473
 
451 474
 		// Show the link, including a URL if it should have one.
452
-		if (isset($tree['url']))
453
-			echo '
475
+		if (isset($tree['url'])) {
476
+					echo '
454 477
 							<a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>';
455
-		else
456
-			echo '
478
+		} else {
479
+					echo '
457 480
 							<span>' . $tree['name'] . '</span>';
481
+		}
458 482
 
459 483
 		// Show something after the link...?
460
-		if (isset($tree['extra_after']))
461
-			echo ' ', $tree['extra_after'];
484
+		if (isset($tree['extra_after'])) {
485
+					echo ' ', $tree['extra_after'];
486
+		}
462 487
 
463 488
 		echo '
464 489
 						</li>';
@@ -509,13 +534,14 @@  discard block
 block discarded – undo
509 534
 					echo '
510 535
 									<ul>';
511 536
 
512
-					foreach ($childbutton['sub_buttons'] as $grandchildbutton)
513
-						echo '
537
+					foreach ($childbutton['sub_buttons'] as $grandchildbutton) {
538
+											echo '
514 539
 										<li>
515 540
 											<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
516 541
 												', $grandchildbutton['title'], '
517 542
 											</a>
518 543
 										</li>';
544
+					}
519 545
 
520 546
 					echo '
521 547
 									</ul>';
@@ -546,8 +572,9 @@  discard block
 block discarded – undo
546 572
 {
547 573
 	global $context, $txt;
548 574
 
549
-	if (!is_array($strip_options))
550
-		$strip_options = array();
575
+	if (!is_array($strip_options)) {
576
+			$strip_options = array();
577
+	}
551 578
 
552 579
 	// Create the buttons...
553 580
 	$buttons = array();
@@ -556,8 +583,9 @@  discard block
 block discarded – undo
556 583
 		// 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 584
 		if (!isset($value['test']) || !empty($context[$value['test']]))
558 585
 		{
559
-			if (!isset($value['id']))
560
-				$value['id'] = $key;
586
+			if (!isset($value['id'])) {
587
+							$value['id'] = $key;
588
+			}
561 589
 
562 590
 			$button = '
563 591
 				<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 +598,15 @@  discard block
 block discarded – undo
570 598
 							<div class="overview">';
571 599
 				foreach ($value['sub_buttons'] as $element)
572 600
 				{
573
-					if (isset($element['test']) && empty($context[$element['test']]))
574
-						continue;
601
+					if (isset($element['test']) && empty($context[$element['test']])) {
602
+											continue;
603
+					}
575 604
 
576 605
 					$button .= '
577 606
 								<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>';
607
+					if (isset($txt[$element['text'] . '_desc'])) {
608
+											$button .= '<br><span>' . $txt[$element['text'] . '_desc'] . '</span>';
609
+					}
580 610
 					$button .= '</a>';
581 611
 				}
582 612
 				$button .= '
@@ -590,8 +620,9 @@  discard block
 block discarded – undo
590 620
 	}
591 621
 
592 622
 	// No buttons? No button strip either.
593
-	if (empty($buttons))
594
-		return;
623
+	if (empty($buttons)) {
624
+			return;
625
+	}
595 626
 
596 627
 	echo '
597 628
 		<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.
Themes/default/Admin.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -945,7 +945,7 @@
 block discarded – undo
945 945
 				}
946 946
 
947 947
 				echo isset($config_var['postinput']) ? '
948
-											' . $config_var['postinput'] : '','
948
+											' . $config_var['postinput'] : '', '
949 949
 									</dd>';
950 950
 			}
951 951
 		}
Please login to merge, or discard this patch.
Braces   +179 added lines, -128 removed lines patch added patch discarded remove patch
@@ -65,9 +65,10 @@  discard block
 block discarded – undo
65 65
 										', implode(', ', $context['administrators']);
66 66
 
67 67
 	// If we have lots of admins... don't show them all.
68
-	if (!empty($context['more_admins_link']))
69
-		echo '
68
+	if (!empty($context['more_admins_link'])) {
69
+			echo '
70 70
 										(', $context['more_admins_link'], ')';
71
+	}
71 72
 
72 73
 	echo '
73 74
 									</div><!-- #version_details -->
@@ -84,17 +85,19 @@  discard block
 block discarded – undo
84 85
 		foreach ($area['areas'] as $item_id => $item)
85 86
 		{
86 87
 			// No point showing the 'home' page here, we're already on it!
87
-			if ($area_id == 'forum' && $item_id == 'index')
88
-				continue;
88
+			if ($area_id == 'forum' && $item_id == 'index') {
89
+							continue;
90
+			}
89 91
 
90 92
 			$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'] : '');
91 93
 
92
-			if (!empty($item['icon_file']))
93
-				echo '
94
+			if (!empty($item['icon_file'])) {
95
+							echo '
94 96
 							<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>';
95
-			else
96
-				echo '
97
+			} else {
98
+							echo '
97 99
 							<a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>';
100
+			}
98 101
 		}
99 102
 
100 103
 		echo '
@@ -105,10 +108,11 @@  discard block
 block discarded – undo
105 108
 					</div><!-- #admincenter -->';
106 109
 
107 110
 	// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
108
-	if (empty($modSettings['disable_smf_js']))
109
-		echo '
111
+	if (empty($modSettings['disable_smf_js'])) {
112
+			echo '
110 113
 					<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
111 114
 					<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
115
+	}
112 116
 
113 117
 	// This sets the announcements and current versions themselves ;).
114 118
 	echo '
@@ -187,9 +191,10 @@  discard block
 block discarded – undo
187 191
 								<em>', $version['version'], '</em>';
188 192
 
189 193
 		// more details for this item, show them a link
190
-		if ($context['can_admin'] && isset($version['more']))
191
-			echo
194
+		if ($context['can_admin'] && isset($version['more'])) {
195
+					echo
192 196
 								' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>';
197
+		}
193 198
 		echo '
194 199
 								<br>';
195 200
 	}
@@ -220,21 +225,23 @@  discard block
 block discarded – undo
220 225
 
221 226
 	foreach ($context['credits'] as $section)
222 227
 	{
223
-		if (isset($section['pretext']))
224
-			echo '
228
+		if (isset($section['pretext'])) {
229
+					echo '
225 230
 								<p>', $section['pretext'], '</p>
226 231
 								<hr>';
232
+		}
227 233
 
228 234
 		echo '
229 235
 								<dl>';
230 236
 
231 237
 		foreach ($section['groups'] as $group)
232 238
 		{
233
-			if (isset($group['title']))
234
-				echo '
239
+			if (isset($group['title'])) {
240
+							echo '
235 241
 									<dt>
236 242
 										<strong>', $group['title'], ':</strong>
237 243
 									</dt>';
244
+			}
238 245
 
239 246
 			echo '
240 247
 									<dd>', implode(', ', $group['members']), '</dd>';
@@ -243,10 +250,11 @@  discard block
 block discarded – undo
243 250
 		echo '
244 251
 								</dl>';
245 252
 
246
-		if (isset($section['posttext']))
247
-			echo '
253
+		if (isset($section['posttext'])) {
254
+					echo '
248 255
 								<hr>
249 256
 								<p>', $section['posttext'], '</p>';
257
+		}
250 258
 	}
251 259
 
252 260
 	echo '
@@ -262,9 +270,10 @@  discard block
 block discarded – undo
262 270
 						smfSupportVersions.forum = "', $context['forum_version'], '";';
263 271
 
264 272
 	// Don't worry, none of this is logged, it's just used to give information that might be of use.
265
-	foreach ($context['current_versions'] as $variable => $version)
266
-		echo '
273
+	foreach ($context['current_versions'] as $variable => $version) {
274
+			echo '
267 275
 						smfSupportVersions.', $variable, ' = "', $version['version'], '";';
276
+	}
268 277
 
269 278
 	// Now we just have to include the script and wait ;).
270 279
 	echo '
@@ -361,8 +370,8 @@  discard block
 block discarded – undo
361 370
 								<tbody>';
362 371
 
363 372
 	// Loop through every source file displaying its version - using javascript.
364
-	foreach ($context['file_versions'] as $filename => $version)
365
-		echo '
373
+	foreach ($context['file_versions'] as $filename => $version) {
374
+			echo '
366 375
 									<tr class="windowbg">
367 376
 										<td class="half_table">
368 377
 											', $filename, '
@@ -374,6 +383,7 @@  discard block
 block discarded – undo
374 383
 											<em id="currentSources', $filename, '">??</em>
375 384
 										</td>
376 385
 									</tr>';
386
+	}
377 387
 
378 388
 	// Default template files.
379 389
 	echo '
@@ -399,8 +409,8 @@  discard block
 block discarded – undo
399 409
 							<table id="Default" class="table_grid">
400 410
 								<tbody>';
401 411
 
402
-	foreach ($context['default_template_versions'] as $filename => $version)
403
-		echo '
412
+	foreach ($context['default_template_versions'] as $filename => $version) {
413
+			echo '
404 414
 									<tr class="windowbg">
405 415
 										<td class="half_table">
406 416
 											', $filename, '
@@ -412,6 +422,7 @@  discard block
 block discarded – undo
412 422
 											<em id="currentDefault', $filename, '">??</em>
413 423
 										</td>
414 424
 									</tr>';
425
+	}
415 426
 
416 427
 	// Now the language files...
417 428
 	echo '
@@ -439,8 +450,8 @@  discard block
 block discarded – undo
439 450
 
440 451
 	foreach ($context['default_language_versions'] as $language => $files)
441 452
 	{
442
-		foreach ($files as $filename => $version)
443
-			echo '
453
+		foreach ($files as $filename => $version) {
454
+					echo '
444 455
 									<tr class="windowbg">
445 456
 										<td class="half_table">
446 457
 											', $filename, '.<em>', $language, '</em>.php
@@ -452,6 +463,7 @@  discard block
 block discarded – undo
452 463
 											<em id="current', $filename, '.', $language, '">??</em>
453 464
 										</td>
454 465
 									</tr>';
466
+		}
455 467
 	}
456 468
 
457 469
 	echo '
@@ -481,8 +493,8 @@  discard block
 block discarded – undo
481 493
 							<table id="Templates" class="table_grid">
482 494
 								<tbody>';
483 495
 
484
-		foreach ($context['template_versions'] as $filename => $version)
485
-			echo '
496
+		foreach ($context['template_versions'] as $filename => $version) {
497
+					echo '
486 498
 									<tr class="windowbg">
487 499
 										<td class="half_table">
488 500
 											', $filename, '
@@ -494,6 +506,7 @@  discard block
 block discarded – undo
494 506
 											<em id="currentTemplates', $filename, '">??</em>
495 507
 										</td>
496 508
 									</tr>';
509
+		}
497 510
 
498 511
 		echo '
499 512
 								</tbody>
@@ -523,8 +536,8 @@  discard block
 block discarded – undo
523 536
 							<table id="Tasks" class="table_grid">
524 537
 								<tbody>';
525 538
 
526
-		foreach ($context['tasks_versions'] as $filename => $version)
527
-			echo '
539
+		foreach ($context['tasks_versions'] as $filename => $version) {
540
+					echo '
528 541
 									<tr class="windowbg">
529 542
 										<td class="half_table">
530 543
 											', $filename, '
@@ -536,6 +549,7 @@  discard block
 block discarded – undo
536 549
 											<em id="currentTasks', $filename, '">??</em>
537 550
 										</td>
538 551
 									</tr>';
552
+		}
539 553
 
540 554
 		echo '
541 555
 								</tbody>
@@ -577,9 +591,10 @@  discard block
 block discarded – undo
577 591
 {
578 592
 	global $context, $scripturl, $txt, $modSettings;
579 593
 
580
-	if (!empty($context['saved_successful']))
581
-		echo '
594
+	if (!empty($context['saved_successful'])) {
595
+			echo '
582 596
 					<div class="infobox">', $txt['settings_saved'], '</div>';
597
+	}
583 598
 
584 599
 	// First section is for adding/removing words from the censored list.
585 600
 	echo '
@@ -594,11 +609,12 @@  discard block
 block discarded – undo
594 609
 								<p>', $txt['admin_censored_where'], '</p>';
595 610
 
596 611
 	// Show text boxes for censoring [bad   ] => [good  ].
597
-	foreach ($context['censored_words'] as $vulgar => $proper)
598
-		echo '
612
+	foreach ($context['censored_words'] as $vulgar => $proper) {
613
+			echo '
599 614
 								<div class="block">
600 615
 									<input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> =&gt; <input type="text" name="censor_proper[]" value="', $proper, '" size="30">
601 616
 								</div>';
617
+	}
602 618
 
603 619
 	// Now provide a way to censor more words.
604 620
 	echo '
@@ -673,19 +689,21 @@  discard block
 block discarded – undo
673 689
 						<div class="windowbg2 noup">
674 690
 							', $txt['not_done_reason'];
675 691
 
676
-	if (!empty($context['continue_percent']))
677
-		echo '
692
+	if (!empty($context['continue_percent'])) {
693
+			echo '
678 694
 							<div class="progress_bar">
679 695
 								<div class="full_bar">', $context['continue_percent'], '%</div>
680 696
 								<div class="green_percent" style="width: ', $context['continue_percent'], '%;"></div>
681 697
 							</div>';
698
+	}
682 699
 
683
-	if (!empty($context['substep_enabled']))
684
-		echo '
700
+	if (!empty($context['substep_enabled'])) {
701
+			echo '
685 702
 							<div class="progress_bar">
686 703
 								<div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div>
687 704
 								<div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;"></div>
688 705
 							</div>';
706
+	}
689 707
 
690 708
 	echo '
691 709
 							<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
@@ -720,35 +738,40 @@  discard block
 block discarded – undo
720 738
 {
721 739
 	global $context, $txt, $scripturl;
722 740
 
723
-	if (!empty($context['saved_successful']))
724
-		echo '
741
+	if (!empty($context['saved_successful'])) {
742
+			echo '
725 743
 					<div class="infobox">', $txt['settings_saved'], '</div>';
726
-	elseif (!empty($context['saved_failed']))
727
-		echo '
744
+	} elseif (!empty($context['saved_failed'])) {
745
+			echo '
728 746
 					<div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>';
747
+	}
729 748
 
730
-	if (!empty($context['settings_pre_javascript']))
731
-		echo '
749
+	if (!empty($context['settings_pre_javascript'])) {
750
+			echo '
732 751
 					<script>', $context['settings_pre_javascript'], '</script>';
752
+	}
733 753
 
734
-	if (!empty($context['settings_insert_above']))
735
-		echo $context['settings_insert_above'];
754
+	if (!empty($context['settings_insert_above'])) {
755
+			echo $context['settings_insert_above'];
756
+	}
736 757
 
737 758
 	echo '
738 759
 					<div id="admincenter">
739 760
 						<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'] . '"' : '', '>';
740 761
 
741 762
 	// Is there a custom title?
742
-	if (isset($context['settings_title']))
743
-		echo '
763
+	if (isset($context['settings_title'])) {
764
+			echo '
744 765
 							<div class="cat_bar">
745 766
 								<h3 class="catbg">', $context['settings_title'], '</h3>
746 767
 							</div>';
768
+	}
747 769
 
748 770
 	// Have we got a message to display?
749
-	if (!empty($context['settings_message']))
750
-		echo '
771
+	if (!empty($context['settings_message'])) {
772
+			echo '
751 773
 							<div class="information">', $context['settings_message'], '</div>';
774
+	}
752 775
 
753 776
 	// Now actually loop through all the variables.
754 777
 	$is_open = false;
@@ -801,8 +824,9 @@  discard block
 block discarded – undo
801 824
 		// Hang about? Are you pulling my leg - a callback?!
802 825
 		if (is_array($config_var) && $config_var['type'] == 'callback')
803 826
 		{
804
-			if (function_exists('template_callback_' . $config_var['name']))
805
-				call_user_func('template_callback_' . $config_var['name']);
827
+			if (function_exists('template_callback_' . $config_var['name'])) {
828
+							call_user_func('template_callback_' . $config_var['name']);
829
+			}
806 830
 
807 831
 			continue;
808 832
 		}
@@ -832,9 +856,10 @@  discard block
 block discarded – undo
832 856
 				$text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time');
833 857
 
834 858
 				// Show the [?] button.
835
-				if ($config_var['help'])
836
-					echo '
859
+				if ($config_var['help']) {
860
+									echo '
837 861
 										<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> ';
862
+				}
838 863
 
839 864
 				echo '
840 865
 										<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>
@@ -843,23 +868,26 @@  discard block
 block discarded – undo
843 868
 										$config_var['preinput'];
844 869
 
845 870
 				// Show a check box.
846
-				if ($config_var['type'] == 'check')
847
-					echo '
871
+				if ($config_var['type'] == 'check') {
872
+									echo '
848 873
 										<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">';
874
+				}
849 875
 				// Escape (via htmlspecialchars.) the text box.
850
-				elseif ($config_var['type'] == 'password')
851
-					echo '
876
+				elseif ($config_var['type'] == 'password') {
877
+									echo '
852 878
 										<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;"><br>
853 879
 										<input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>';
880
+				}
854 881
 				// Show a selection box.
855 882
 				elseif ($config_var['type'] == 'select')
856 883
 				{
857 884
 					echo '
858 885
 										<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'] . '"' : ''), '>';
859 886
 
860
-					foreach ($config_var['data'] as $option)
861
-						echo '
887
+					foreach ($config_var['data'] as $option) {
888
+											echo '
862 889
 											<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>';
890
+					}
863 891
 					echo '
864 892
 										</select>';
865 893
 				}
@@ -876,16 +904,18 @@  discard block
 block discarded – undo
876 904
 
877 905
 					foreach ($context['board_list'] as $id_cat => $cat)
878 906
 					{
879
-						if (!$first)
880
-							echo '
907
+						if (!$first) {
908
+													echo '
881 909
 											<hr>';
910
+						}
882 911
 						echo '
883 912
 											<strong>', $cat['name'], '</strong>
884 913
 											<ul>';
885 914
 
886
-						foreach ($cat['boards'] as $id_board => $brd)
887
-							echo '
915
+						foreach ($cat['boards'] as $id_board => $brd) {
916
+													echo '
888 917
 												<li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat('&nbsp; &nbsp;', $brd['child_level']) : '', $brd['name'], '</label></li>';
918
+						}
889 919
 
890 920
 						echo '
891 921
 											</ul>';
@@ -895,12 +925,14 @@  discard block
 block discarded – undo
895 925
 										</fieldset>';
896 926
 				}
897 927
 				// Text area?
898
-				elseif ($config_var['type'] == 'large_text')
899
-					echo '
928
+				elseif ($config_var['type'] == 'large_text') {
929
+									echo '
900 930
 										<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>';
931
+				}
901 932
 				// Permission group?
902
-				elseif ($config_var['type'] == 'permissions')
903
-					theme_inline_permissions($config_var['name']);
933
+				elseif ($config_var['type'] == 'permissions') {
934
+									theme_inline_permissions($config_var['name']);
935
+				}
904 936
 
905 937
 				// BBC selection?
906 938
 				elseif ($config_var['type'] == 'bbc')
@@ -912,22 +944,24 @@  discard block
 block discarded – undo
912 944
 
913 945
 					foreach ($context['bbc_columns'] as $bbcColumn)
914 946
 					{
915
-						foreach ($bbcColumn as $bbcTag)
916
-							echo '
947
+						foreach ($bbcColumn as $bbcTag) {
948
+													echo '
917 949
 												<li class="list_bbc floatleft">
918 950
 													<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' : '', '> <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>)' : '', '
919 951
 												</li>';
952
+						}
920 953
 					}
921 954
 					echo '					</ul>
922 955
 											<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' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label>
923 956
 										</fieldset>';
924 957
 				}
925 958
 				// A simple message?
926
-				elseif ($config_var['type'] == 'var_message')
927
-					echo '
959
+				elseif ($config_var['type'] == 'var_message') {
960
+									echo '
928 961
 										<div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>
929 962
 											', $config_var['var_message'], '
930 963
 										</div>';
964
+				}
931 965
 				// Assume it must be a text box
932 966
 				else
933 967
 				{
@@ -952,62 +986,70 @@  discard block
 block discarded – undo
952 986
 											' . $config_var['postinput'] : '','
953 987
 									</dd>';
954 988
 			}
955
-		}
956
-		else
989
+		} else
957 990
 		{
958 991
 			// Just show a separator.
959
-			if ($config_var == '')
960
-				echo '
992
+			if ($config_var == '') {
993
+							echo '
961 994
 								</dl>
962 995
 								<hr>
963 996
 								<dl class="settings">';
964
-			else
965
-				echo '
997
+			} else {
998
+							echo '
966 999
 									<dd>
967 1000
 										<strong>' . $config_var . '</strong>
968 1001
 									</dd>';
1002
+			}
969 1003
 		}
970 1004
 	}
971 1005
 
972
-	if ($is_open)
973
-		echo '
1006
+	if ($is_open) {
1007
+			echo '
974 1008
 								</dl>';
1009
+	}
975 1010
 
976
-	if (empty($context['settings_save_dont_show']))
977
-		echo '
1011
+	if (empty($context['settings_save_dont_show'])) {
1012
+			echo '
978 1013
 								<input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">';
1014
+	}
979 1015
 
980
-	if ($is_open)
981
-		echo '
1016
+	if ($is_open) {
1017
+			echo '
982 1018
 							</div><!-- .windowbg2 -->';
1019
+	}
983 1020
 
984 1021
 
985 1022
 	// At least one token has to be used!
986
-	if (isset($context['admin-ssc_token']))
987
-		echo '
1023
+	if (isset($context['admin-ssc_token'])) {
1024
+			echo '
988 1025
 							<input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">';
1026
+	}
989 1027
 
990
-	if (isset($context['admin-dbsc_token']))
991
-		echo '
1028
+	if (isset($context['admin-dbsc_token'])) {
1029
+			echo '
992 1030
 							<input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">';
1031
+	}
993 1032
 
994
-	if (isset($context['admin-mp_token']))
995
-		echo '
1033
+	if (isset($context['admin-mp_token'])) {
1034
+			echo '
996 1035
 							<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">';
1036
+	}
997 1037
 
998 1038
 	echo '
999 1039
 							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1000 1040
 						</form>
1001 1041
 					</div><!-- #admincenter -->';
1002 1042
 
1003
-	if (!empty($context['settings_post_javascript']))
1004
-		echo '
1043
+	if (!empty($context['settings_post_javascript'])) {
1044
+			echo '
1005 1045
 					<script>
1006 1046
 						', $context['settings_post_javascript'], '
1007 1047
 					</script>';
1048
+	}
1008 1049
 
1009
-	if (!empty($context['settings_insert_below']))
1010
-		echo $context['settings_insert_below'];
1050
+	if (!empty($context['settings_insert_below'])) {
1051
+			echo $context['settings_insert_below'];
1052
+	}
1011 1053
 
1012 1054
 	// We may have added a board listing. If we did, we need to make it work.
1013 1055
 	addInlineJavascript('
@@ -1030,9 +1072,10 @@  discard block
 block discarded – undo
1030 1072
 {
1031 1073
 	global $context, $txt;
1032 1074
 
1033
-	if (!empty($context['saved_successful']))
1034
-		echo '
1075
+	if (!empty($context['saved_successful'])) {
1076
+			echo '
1035 1077
 					<div class="infobox">', $txt['settings_saved'], '</div>';
1078
+	}
1036 1079
 
1037 1080
 	// Standard fields.
1038 1081
 	template_show_list('standard_profile_fields');
@@ -1066,11 +1109,12 @@  discard block
 block discarded – undo
1066 1109
 	{
1067 1110
 		loadLanguage('Errors');
1068 1111
 
1069
-		if (isset($txt['custom_option_' . $_GET['msg']]))
1070
-			echo '
1112
+		if (isset($txt['custom_option_' . $_GET['msg']])) {
1113
+					echo '
1071 1114
 					<div class="errorbox">',
1072 1115
 						$txt['custom_option_' . $_GET['msg']], '
1073 1116
 					</div>';
1117
+		}
1074 1118
 	}
1075 1119
 
1076 1120
 	echo '
@@ -1137,9 +1181,10 @@  discard block
 block discarded – undo
1137 1181
 										<dd>
1138 1182
 											<select name="placement" id="placement">';
1139 1183
 
1140
-	foreach ($context['cust_profile_fields_placement'] as $order => $name)
1141
-		echo '
1184
+	foreach ($context['cust_profile_fields_placement'] as $order => $name) {
1185
+			echo '
1142 1186
 												<option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>';
1187
+	}
1143 1188
 
1144 1189
 	echo '
1145 1190
 											</select>
@@ -1163,9 +1208,10 @@  discard block
 block discarded – undo
1163 1208
 										<dd>
1164 1209
 											<select name="field_type" id="field_type" onchange="updateInputBoxes();">';
1165 1210
 
1166
-	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type)
1167
-		echo '
1211
+	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) {
1212
+			echo '
1168 1213
 												<option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>';
1214
+	}
1169 1215
 
1170 1216
 	echo '
1171 1217
 											</select>
@@ -1197,9 +1243,10 @@  discard block
 block discarded – undo
1197 1243
 										</dt>
1198 1244
 										<dd id="options_dd">';
1199 1245
 
1200
-	foreach ($context['field']['options'] as $k => $option)
1201
-		echo '
1246
+	foreach ($context['field']['options'] as $k => $option) {
1247
+			echo '
1202 1248
 											', $k == 0 ? '' : '<br>', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked' : '', '><input type="text" name="select_option[', $k, ']" value="', $option, '">';
1249
+	}
1203 1250
 
1204 1251
 	echo '
1205 1252
 											<span id="addopt"></span>
@@ -1263,9 +1310,10 @@  discard block
 block discarded – undo
1263 1310
 								</fieldset>
1264 1311
 								<input type="submit" name="save" value="', $txt['save'], '" class="button">';
1265 1312
 
1266
-	if ($context['fid'])
1267
-		echo '
1313
+	if ($context['fid']) {
1314
+			echo '
1268 1315
 								<input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">';
1316
+	}
1269 1317
 
1270 1318
 	echo '
1271 1319
 							</div><!-- .windowbg2 -->
@@ -1312,8 +1360,7 @@  discard block
 block discarded – undo
1312 1360
 							<p class="centertext">
1313 1361
 								<strong>', $txt['admin_search_results_none'], '</strong>
1314 1362
 							</p>';
1315
-	}
1316
-	else
1363
+	} else
1317 1364
 	{
1318 1365
 		echo '
1319 1366
 							<ol class="search_results">';
@@ -1340,9 +1387,10 @@  discard block
 block discarded – undo
1340 1387
 								<li>
1341 1388
 									<a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']';
1342 1389
 
1343
-				if ($result['help'])
1344
-					echo '
1390
+				if ($result['help']) {
1391
+									echo '
1345 1392
 									<p class="double_height">', $result['help'], '</p>';
1393
+				}
1346 1394
 
1347 1395
 				echo '
1348 1396
 								</li>';
@@ -1382,10 +1430,11 @@  discard block
 block discarded – undo
1382 1430
 									<strong>', $txt['setup_verification_answer'], '</strong>
1383 1431
 								</dd>';
1384 1432
 
1385
-		if (!empty($context['qa_by_lang'][$lang_id]))
1386
-			foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1433
+		if (!empty($context['qa_by_lang'][$lang_id])) {
1434
+					foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1387 1435
 			{
1388 1436
 				$question = $context['question_answers'][$q_id];
1437
+		}
1389 1438
 
1390 1439
 				echo '
1391 1440
 								<dt>
@@ -1393,9 +1442,10 @@  discard block
 block discarded – undo
1393 1442
 								</dt>
1394 1443
 								<dd>';
1395 1444
 
1396
-				foreach ($question['answers'] as $answer)
1397
-					echo '
1445
+				foreach ($question['answers'] as $answer) {
1446
+									echo '
1398 1447
 									<input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">';
1448
+				}
1399 1449
 
1400 1450
 				echo '
1401 1451
 									<div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div>
@@ -1434,11 +1484,12 @@  discard block
 block discarded – undo
1434 1484
 							', $txt['errors_found'], ':
1435 1485
 							<ul>';
1436 1486
 
1437
-			foreach ($context['repair_errors'] as $error)
1438
-				echo '
1487
+			foreach ($context['repair_errors'] as $error) {
1488
+							echo '
1439 1489
 								<li>
1440 1490
 									', $error, '
1441 1491
 								</li>';
1492
+			}
1442 1493
 
1443 1494
 			echo '
1444 1495
 							</ul>
@@ -1448,16 +1499,15 @@  discard block
 block discarded – undo
1448 1499
 							<p class="padding">
1449 1500
 								<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>
1450 1501
 							</p>';
1451
-		}
1452
-		else
1453
-			echo '
1502
+		} else {
1503
+					echo '
1454 1504
 							<p>', $txt['maintain_no_errors'], '</p>
1455 1505
 							<p class="padding">
1456 1506
 								<a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
1457 1507
 							</p>';
1508
+		}
1458 1509
 
1459
-	}
1460
-	else
1510
+	} else
1461 1511
 	{
1462 1512
 		if (!empty($context['redirect_to_recount']))
1463 1513
 		{
@@ -1469,8 +1519,7 @@  discard block
 block discarded – undo
1469 1519
 								<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1470 1520
 								<input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '">
1471 1521
 							</form>';
1472
-		}
1473
-		else
1522
+		} else
1474 1523
 		{
1475 1524
 			echo '
1476 1525
 							<p>', $txt['errors_fixed'], '</p>
@@ -1561,9 +1610,10 @@  discard block
 block discarded – undo
1561 1610
 								<tr class="windowbg">
1562 1611
 									<td class="equal_table">', $key, '</td>';
1563 1612
 
1564
-				foreach ($setting as $key_lm => $value)
1565
-					echo '
1613
+				foreach ($setting as $key_lm => $value) {
1614
+									echo '
1566 1615
 									<td class="equal_table">', $value, '</td>';
1616
+				}
1567 1617
 
1568 1618
 				echo '
1569 1619
 								</tr>';
@@ -1623,8 +1673,8 @@  discard block
 block discarded – undo
1623 1673
 {
1624 1674
 	global $context, $txt;
1625 1675
 
1626
-	if ($context['user']['is_admin'])
1627
-		echo '
1676
+	if ($context['user']['is_admin']) {
1677
+			echo '
1628 1678
 								<span class="floatright admin_search">
1629 1679
 									<span class="generic_icons filter centericon"></span>
1630 1680
 									<input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';">
@@ -1635,6 +1685,7 @@  discard block
 block discarded – undo
1635 1685
 									</select>
1636 1686
 									<input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button">
1637 1687
 								</span>';
1638
-}
1688
+	}
1689
+	}
1639 1690
 
1640 1691
 ?>
1641 1692
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/Printpage.template.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -144,11 +144,12 @@  discard block
 block discarded – undo
144 144
 				<div class="question">', $txt['poll_question'], ': <strong>', $context['poll']['question'], '</strong>';
145 145
 
146 146
 		$options = 1;
147
-		foreach ($context['poll']['options'] as $option)
148
-			echo '
147
+		foreach ($context['poll']['options'] as $option) {
148
+					echo '
149 149
 					<div class="', $option['voted_this'] ? 'voted' : '', '">', $txt['option'], ' ', $options++, ': <strong>', $option['option'], '</strong>
150 150
 						', $context['allow_poll_view'] ? $txt['votes'] . ': ' . $option['votes'] . '' : '', '
151 151
 					</div>';
152
+		}
152 153
 
153 154
 		echo '
154 155
 			</div>';
@@ -170,9 +171,10 @@  discard block
 block discarded – undo
170 171
 			echo '
171 172
 				<hr>';
172 173
 
173
-			foreach ($context['printattach'][$post['id_msg']] as $attach)
174
-				echo '
174
+			foreach ($context['printattach'][$post['id_msg']] as $attach) {
175
+							echo '
175 176
 					<img width="' . $attach['width'] . '" height="' . $attach['height'] . '" src="', $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attach['id_attach'] . '" alt="">';
177
+			}
176 178
 		}
177 179
 
178 180
 		echo '
@@ -207,12 +209,13 @@  discard block
 block discarded – undo
207 209
 		<div class="print_options">';
208 210
 
209 211
 	// Which option is set, text or text&images
210
-	if (isset($_REQUEST['images']))
211
-		echo '
212
+	if (isset($_REQUEST['images'])) {
213
+			echo '
212 214
 			<a href="', $url_text, '">', $txt['print_page_text'], '</a> | <strong><a href="', $url_images, '">', $txt['print_page_images'], '</a></strong>';
213
-	else
214
-		echo '
215
+	} else {
216
+			echo '
215 217
 			<strong><a href="', $url_text, '">', $txt['print_page_text'], '</a></strong> | <a href="', $url_images, '">', $txt['print_page_images'], '</a>';
218
+	}
216 219
 
217 220
 	echo '
218 221
 		</div><!-- .print_options -->';
Please login to merge, or discard this patch.