Completed
Push — release-2.1 ( 754615...97bd11 )
by Colin
08:23
created
Sources/Profile-View.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 	$smcFunc['db_free_result']($request);
252 252
 
253
-	if($withSender)
253
+	if ($withSender)
254 254
 	{
255 255
 		$senders = loadMemberData($senders);
256 256
 		foreach ($senders as $member)
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 	if (count($context['ip']) !== 2)
1897 1897
 		fatal_lang_error('invalid_tracking_ip', false);
1898 1898
 
1899
-	$ip_string = array('{inet:ip_address_low}','{inet:ip_address_high}');
1899
+	$ip_string = array('{inet:ip_address_low}', '{inet:ip_address_high}');
1900 1900
 	$fields = array(
1901 1901
 			'ip_address_low' => $context['ip']['low'],
1902 1902
 			'ip_address_high' => $context['ip']['high'],
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 
1905 1905
 	$ip_var = $context['ip'];
1906 1906
 
1907
-	if ($context['ip']['low'] !==  $context['ip']['high'])
1907
+	if ($context['ip']['low'] !== $context['ip']['high'])
1908 1908
 		$context['ip'] = $context['ip']['low'] . ' - ' . $context['ip']['high'];
1909 1909
 	else
1910 1910
 		$context['ip'] = $context['ip']['low'];
Please login to merge, or discard this patch.
Braces   +304 added lines, -223 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
  * @version 2.1 Beta 4
12 12
  */
13 13
 
14
-if (!defined('SMF'))
14
+if (!defined('SMF')) {
15 15
 	die('No direct access...');
16
+}
16 17
 
17 18
 /**
18 19
  * View a summary.
@@ -23,8 +24,9 @@  discard block
 block discarded – undo
23 24
 	global $context, $memberContext, $txt, $modSettings, $user_profile, $sourcedir, $scripturl, $smcFunc;
24 25
 
25 26
 	// Attempt to load the member's profile data.
26
-	if (!loadMemberContext($memID) || !isset($memberContext[$memID]))
27
-		fatal_lang_error('not_a_user', false, 404);
27
+	if (!loadMemberContext($memID) || !isset($memberContext[$memID])) {
28
+			fatal_lang_error('not_a_user', false, 404);
29
+	}
28 30
 
29 31
 	// Set up the stuff and load the user.
30 32
 	$context += array(
@@ -49,19 +51,21 @@  discard block
 block discarded – undo
49 51
 
50 52
 	// See if they have broken any warning levels...
51 53
 	list ($modSettings['warning_enable'], $modSettings['user_limit']) = explode(',', $modSettings['warning_settings']);
52
-	if (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $context['member']['warning'])
53
-		$context['warning_status'] = $txt['profile_warning_is_muted'];
54
-	elseif (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $context['member']['warning'])
55
-		$context['warning_status'] = $txt['profile_warning_is_moderation'];
56
-	elseif (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $context['member']['warning'])
57
-		$context['warning_status'] = $txt['profile_warning_is_watch'];
54
+	if (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $context['member']['warning']) {
55
+			$context['warning_status'] = $txt['profile_warning_is_muted'];
56
+	} elseif (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $context['member']['warning']) {
57
+			$context['warning_status'] = $txt['profile_warning_is_moderation'];
58
+	} elseif (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $context['member']['warning']) {
59
+			$context['warning_status'] = $txt['profile_warning_is_watch'];
60
+	}
58 61
 
59 62
 	// They haven't even been registered for a full day!?
60 63
 	$days_registered = (int) ((time() - $user_profile[$memID]['date_registered']) / (3600 * 24));
61
-	if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1)
62
-		$context['member']['posts_per_day'] = $txt['not_applicable'];
63
-	else
64
-		$context['member']['posts_per_day'] = comma_format($context['member']['real_posts'] / $days_registered, 3);
64
+	if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1) {
65
+			$context['member']['posts_per_day'] = $txt['not_applicable'];
66
+	} else {
67
+			$context['member']['posts_per_day'] = comma_format($context['member']['real_posts'] / $days_registered, 3);
68
+	}
65 69
 
66 70
 	// Set the age...
67 71
 	if (empty($context['member']['birth_date']) || substr($context['member']['birth_date'], 0, 4) < 1002)
@@ -70,8 +74,7 @@  discard block
 block discarded – undo
70 74
 			'age' => $txt['not_applicable'],
71 75
 			'today_is_birthday' => false
72 76
 		);
73
-	}
74
-	else
77
+	} else
75 78
 	{
76 79
 		list ($birth_year, $birth_month, $birth_day) = sscanf($context['member']['birth_date'], '%d-%d-%d');
77 80
 		$datearray = getdate(forum_time());
@@ -84,15 +87,16 @@  discard block
 block discarded – undo
84 87
 	if (allowedTo('moderate_forum'))
85 88
 	{
86 89
 		// Make sure it's a valid ip address; otherwise, don't bother...
87
-		if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $memberContext[$memID]['ip']) == 1 && empty($modSettings['disableHostnameLookup']))
88
-			$context['member']['hostname'] = host_from_ip($memberContext[$memID]['ip']);
89
-		else
90
-			$context['member']['hostname'] = '';
90
+		if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $memberContext[$memID]['ip']) == 1 && empty($modSettings['disableHostnameLookup'])) {
91
+					$context['member']['hostname'] = host_from_ip($memberContext[$memID]['ip']);
92
+		} else {
93
+					$context['member']['hostname'] = '';
94
+		}
91 95
 
92 96
 		$context['can_see_ip'] = true;
97
+	} else {
98
+			$context['can_see_ip'] = false;
93 99
 	}
94
-	else
95
-		$context['can_see_ip'] = false;
96 100
 
97 101
 	// Are they hidden?
98 102
 	$context['member']['is_hidden'] = empty($user_profile[$memID]['show_online']);
@@ -103,8 +107,9 @@  discard block
 block discarded – undo
103 107
 		include_once($sourcedir . '/Who.php');
104 108
 		$action = determineActions($user_profile[$memID]['url']);
105 109
 
106
-		if ($action !== false)
107
-			$context['member']['action'] = $action;
110
+		if ($action !== false) {
111
+					$context['member']['action'] = $action;
112
+		}
108 113
 	}
109 114
 
110 115
 	// If the user is awaiting activation, and the viewer has permission - setup some activation context messages.
@@ -167,13 +172,15 @@  discard block
 block discarded – undo
167 172
 		{
168 173
 			// Work out what restrictions we actually have.
169 174
 			$ban_restrictions = array();
170
-			foreach (array('access', 'login', 'post') as $type)
171
-				if ($row['cannot_' . $type])
175
+			foreach (array('access', 'login', 'post') as $type) {
176
+							if ($row['cannot_' . $type])
172 177
 					$ban_restrictions[] = $txt['ban_type_' . $type];
178
+			}
173 179
 
174 180
 			// No actual ban in place?
175
-			if (empty($ban_restrictions))
176
-				continue;
181
+			if (empty($ban_restrictions)) {
182
+							continue;
183
+			}
177 184
 
178 185
 			// Prepare the link for context.
179 186
 			$ban_explanation = sprintf($txt['user_cannot_due_to'], implode(', ', $ban_restrictions), '<a href="' . $scripturl . '?action=admin;area=ban;sa=edit;bg=' . $row['id_ban_group'] . '">' . $row['name'] . '</a>');
@@ -195,9 +202,10 @@  discard block
 block discarded – undo
195 202
 	$context['print_custom_fields'] = array();
196 203
 
197 204
 	// Any custom profile fields?
198
-	if (!empty($context['custom_fields']))
199
-		foreach ($context['custom_fields'] as $custom)
205
+	if (!empty($context['custom_fields'])) {
206
+			foreach ($context['custom_fields'] as $custom)
200 207
 			$context['print_custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom;
208
+	}
201 209
 
202 210
 }
203 211
 
@@ -245,16 +253,18 @@  discard block
 block discarded – undo
245 253
 		$row['extra'] = !empty($row['extra']) ? $smcFunc['json_decode']($row['extra'], true) : array();
246 254
 		$alerts[$id_alert] = $row;
247 255
 
248
-		if (!empty($row['sender_id']))
249
-			$senders[] = $row['sender_id'];
256
+		if (!empty($row['sender_id'])) {
257
+					$senders[] = $row['sender_id'];
258
+		}
250 259
 	}
251 260
 	$smcFunc['db_free_result']($request);
252 261
 
253 262
 	if($withSender)
254 263
 	{
255 264
 		$senders = loadMemberData($senders);
256
-		foreach ($senders as $member)
257
-			loadMemberContext($member);
265
+		foreach ($senders as $member) {
266
+					loadMemberContext($member);
267
+		}
258 268
 	}
259 269
 
260 270
 	// Now go through and actually make with the text.
@@ -269,12 +279,15 @@  discard block
 block discarded – undo
269 279
 	$msgs = array();
270 280
 	foreach ($alerts as $id_alert => $alert)
271 281
 	{
272
-		if (isset($alert['extra']['board']))
273
-			$boards[$alert['extra']['board']] = $txt['board_na'];
274
-		if (isset($alert['extra']['topic']))
275
-			$topics[$alert['extra']['topic']] = $txt['topic_na'];
276
-		if ($alert['content_type'] == 'msg')
277
-			$msgs[$alert['content_id']] = $txt['topic_na'];
282
+		if (isset($alert['extra']['board'])) {
283
+					$boards[$alert['extra']['board']] = $txt['board_na'];
284
+		}
285
+		if (isset($alert['extra']['topic'])) {
286
+					$topics[$alert['extra']['topic']] = $txt['topic_na'];
287
+		}
288
+		if ($alert['content_type'] == 'msg') {
289
+					$msgs[$alert['content_id']] = $txt['topic_na'];
290
+		}
278 291
 	}
279 292
 
280 293
 	// Having figured out what boards etc. there are, let's now get the names of them if we can see them. If not, there's already a fallback set up.
@@ -289,8 +302,9 @@  discard block
 block discarded – undo
289 302
 				'boards' => array_keys($boards),
290 303
 			)
291 304
 		);
292
-		while ($row = $smcFunc['db_fetch_assoc']($request))
293
-			$boards[$row['id_board']] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
305
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
306
+					$boards[$row['id_board']] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
307
+		}
294 308
 	}
295 309
 	if (!empty($topics))
296 310
 	{
@@ -305,8 +319,9 @@  discard block
 block discarded – undo
305 319
 				'topics' => array_keys($topics),
306 320
 			)
307 321
 		);
308
-		while ($row = $smcFunc['db_fetch_assoc']($request))
309
-			$topics[$row['id_topic']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>';
322
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
323
+					$topics[$row['id_topic']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>';
324
+		}
310 325
 	}
311 326
 	if (!empty($msgs))
312 327
 	{
@@ -321,44 +336,51 @@  discard block
 block discarded – undo
321 336
 				'msgs' => array_keys($msgs),
322 337
 			)
323 338
 		);
324
-		while ($row = $smcFunc['db_fetch_assoc']($request))
325
-			$msgs[$row['id_msg']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
339
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
340
+					$msgs[$row['id_msg']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
341
+		}
326 342
 	}
327 343
 
328 344
 	// Now to go back through the alerts, reattach this extra information and then try to build the string out of it (if a hook didn't already)
329 345
 	foreach ($alerts as $id_alert => $alert)
330 346
 	{
331
-		if (!empty($alert['text']))
332
-			continue;
333
-		if (isset($alert['extra']['board']))
334
-			if ($boards[$alert['extra']['board']] == $txt['board_na'])
347
+		if (!empty($alert['text'])) {
348
+					continue;
349
+		}
350
+		if (isset($alert['extra']['board'])) {
351
+					if ($boards[$alert['extra']['board']] == $txt['board_na'])
335 352
 			{
336 353
 				unset($alerts[$id_alert]);
354
+		}
337 355
 				continue;
356
+			} else {
357
+							$alerts[$id_alert]['extra']['board_msg'] = $boards[$alert['extra']['board']];
338 358
 			}
339
-			else
340
-				$alerts[$id_alert]['extra']['board_msg'] = $boards[$alert['extra']['board']];
341
-		if (isset($alert['extra']['topic']))
342
-			if ($alert['extra']['topic'] == $txt['topic_na'])
359
+		if (isset($alert['extra']['topic'])) {
360
+					if ($alert['extra']['topic'] == $txt['topic_na'])
343 361
 			{
344 362
 				unset($alerts[$id_alert]);
363
+		}
345 364
 				continue;
365
+			} else {
366
+							$alerts[$id_alert]['extra']['topic_msg'] = $topics[$alert['extra']['topic']];
346 367
 			}
347
-			else
348
-				$alerts[$id_alert]['extra']['topic_msg'] = $topics[$alert['extra']['topic']];
349
-		if ($alert['content_type'] == 'msg')
350
-			if ($msgs[$alert['content_id']] == $txt['topic_na'])
368
+		if ($alert['content_type'] == 'msg') {
369
+					if ($msgs[$alert['content_id']] == $txt['topic_na'])
351 370
 			{
352 371
 				unset($alerts[$id_alert]);
372
+		}
353 373
 				continue;
374
+			} else {
375
+							$alerts[$id_alert]['extra']['msg_msg'] = $msgs[$alert['content_id']];
354 376
 			}
355
-			else
356
-				$alerts[$id_alert]['extra']['msg_msg'] = $msgs[$alert['content_id']];
357
-		if ($alert['content_type'] == 'profile')
358
-			$alerts[$id_alert]['extra']['profile_msg'] = '<a href="' . $scripturl . '?action=profile;u=' . $alerts[$id_alert]['content_id'] . '">' . $alerts[$id_alert]['extra']['user_name'] . '</a>';
377
+		if ($alert['content_type'] == 'profile') {
378
+					$alerts[$id_alert]['extra']['profile_msg'] = '<a href="' . $scripturl . '?action=profile;u=' . $alerts[$id_alert]['content_id'] . '">' . $alerts[$id_alert]['extra']['user_name'] . '</a>';
379
+		}
359 380
 
360
-		if (!empty($memberContext[$alert['sender_id']]))
361
-			$alerts[$id_alert]['sender'] = &$memberContext[$alert['sender_id']];
381
+		if (!empty($memberContext[$alert['sender_id']])) {
382
+					$alerts[$id_alert]['sender'] = &$memberContext[$alert['sender_id']];
383
+		}
362 384
 
363 385
 		$string = 'alert_' . $alert['content_type'] . '_' . $alert['content_action'];
364 386
 		if (isset($txt[$string]))
@@ -446,11 +468,11 @@  discard block
 block discarded – undo
446 468
 		checkSession('request');
447 469
 
448 470
 		// Call it!
449
-		if ($action == 'remove')
450
-			alert_delete($toMark, $memID);
451
-
452
-		else
453
-			alert_mark($memID, $toMark, $action == 'read' ? 1 : 0);
471
+		if ($action == 'remove') {
472
+					alert_delete($toMark, $memID);
473
+		} else {
474
+					alert_mark($memID, $toMark, $action == 'read' ? 1 : 0);
475
+		}
454 476
 
455 477
 		// Set a nice update message.
456 478
 		$_SESSION['update_message'] = true;
@@ -500,23 +522,27 @@  discard block
 block discarded – undo
500 522
 	);
501 523
 
502 524
 	// Set the page title
503
-	if (isset($_GET['sa']) && array_key_exists($_GET['sa'], $title))
504
-		$context['page_title'] = $txt['show' . $title[$_GET['sa']]];
505
-	else
506
-		$context['page_title'] = $txt['showPosts'];
525
+	if (isset($_GET['sa']) && array_key_exists($_GET['sa'], $title)) {
526
+			$context['page_title'] = $txt['show' . $title[$_GET['sa']]];
527
+	} else {
528
+			$context['page_title'] = $txt['showPosts'];
529
+	}
507 530
 
508 531
 	$context['page_title'] .= ' - ' . $user_profile[$memID]['real_name'];
509 532
 
510 533
 	// Is the load average too high to allow searching just now?
511
-	if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts'])
512
-		fatal_lang_error('loadavg_show_posts_disabled', false);
534
+	if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts']) {
535
+			fatal_lang_error('loadavg_show_posts_disabled', false);
536
+	}
513 537
 
514 538
 	// If we're specifically dealing with attachments use that function!
515
-	if (isset($_GET['sa']) && $_GET['sa'] == 'attach')
516
-		return showAttachments($memID);
539
+	if (isset($_GET['sa']) && $_GET['sa'] == 'attach') {
540
+			return showAttachments($memID);
541
+	}
517 542
 	// Instead, if we're dealing with unwatched topics (and the feature is enabled) use that other function.
518
-	elseif (isset($_GET['sa']) && $_GET['sa'] == 'unwatchedtopics')
519
-		return showUnwatched($memID);
543
+	elseif (isset($_GET['sa']) && $_GET['sa'] == 'unwatchedtopics') {
544
+			return showUnwatched($memID);
545
+	}
520 546
 
521 547
 	// Are we just viewing topics?
522 548
 	$context['is_topics'] = isset($_GET['sa']) && $_GET['sa'] == 'topics' ? true : false;
@@ -539,27 +565,30 @@  discard block
 block discarded – undo
539 565
 		$smcFunc['db_free_result']($request);
540 566
 
541 567
 		// Trying to remove a message that doesn't exist.
542
-		if (empty($info))
543
-			redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
568
+		if (empty($info)) {
569
+					redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
570
+		}
544 571
 
545 572
 		// We can be lazy, since removeMessage() will check the permissions for us.
546 573
 		require_once($sourcedir . '/RemoveTopic.php');
547 574
 		removeMessage((int) $_GET['delete']);
548 575
 
549 576
 		// Add it to the mod log.
550
-		if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id']))
551
-			logAction('delete', array('topic' => $info[2], 'subject' => $info[0], 'member' => $info[1], 'board' => $info[3]));
577
+		if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) {
578
+					logAction('delete', array('topic' => $info[2], 'subject' => $info[0], 'member' => $info[1], 'board' => $info[3]));
579
+		}
552 580
 
553 581
 		// Back to... where we are now ;).
554 582
 		redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
555 583
 	}
556 584
 
557 585
 	// Default to 10.
558
-	if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount']))
559
-		$_REQUEST['viewscount'] = '10';
586
+	if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount'])) {
587
+			$_REQUEST['viewscount'] = '10';
588
+	}
560 589
 
561
-	if ($context['is_topics'])
562
-		$request = $smcFunc['db_query']('', '
590
+	if ($context['is_topics']) {
591
+			$request = $smcFunc['db_query']('', '
563 592
 			SELECT COUNT(*)
564 593
 			FROM {db_prefix}topics AS t' . ($user_info['query_see_board'] == '1=1' ? '' : '
565 594
 				INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board AND {query_see_board})') . '
@@ -572,8 +601,8 @@  discard block
 block discarded – undo
572 601
 				'board' => $board,
573 602
 			)
574 603
 		);
575
-	else
576
-		$request = $smcFunc['db_query']('', '
604
+	} else {
605
+			$request = $smcFunc['db_query']('', '
577 606
 			SELECT COUNT(*)
578 607
 			FROM {db_prefix}messages AS m' . ($user_info['query_see_board'] == '1=1' ? '' : '
579 608
 				INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board AND {query_see_board})') . '
@@ -586,6 +615,7 @@  discard block
 block discarded – undo
586 615
 				'board' => $board,
587 616
 			)
588 617
 		);
618
+	}
589 619
 	list ($msgCount) = $smcFunc['db_fetch_row']($request);
590 620
 	$smcFunc['db_free_result']($request);
591 621
 
@@ -606,10 +636,11 @@  discard block
 block discarded – undo
606 636
 
607 637
 	$range_limit = '';
608 638
 
609
-	if ($context['is_topics'])
610
-		$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
611
-	else
612
-		$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];
639
+	if ($context['is_topics']) {
640
+			$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
641
+	} else {
642
+			$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];
643
+	}
613 644
 
614 645
 	$maxIndex = $maxPerPage;
615 646
 
@@ -635,9 +666,9 @@  discard block
 block discarded – undo
635 666
 		{
636 667
 			$margin *= 5;
637 668
 			$range_limit = $reverse ? 't.id_first_msg < ' . ($min_msg_member + $margin) : 't.id_first_msg > ' . ($max_msg_member - $margin);
669
+		} else {
670
+					$range_limit = $reverse ? 'm.id_msg < ' . ($min_msg_member + $margin) : 'm.id_msg > ' . ($max_msg_member - $margin);
638 671
 		}
639
-		else
640
-			$range_limit = $reverse ? 'm.id_msg < ' . ($min_msg_member + $margin) : 'm.id_msg > ' . ($max_msg_member - $margin);
641 672
 	}
642 673
 
643 674
 	// Find this user's posts.  The left join on categories somehow makes this faster, weird as it looks.
@@ -669,8 +700,7 @@  discard block
 block discarded – undo
669 700
 					'max' => $maxIndex,
670 701
 				)
671 702
 			);
672
-		}
673
-		else
703
+		} else
674 704
 		{
675 705
 			$request = $smcFunc['db_query']('', '
676 706
 				SELECT
@@ -699,8 +729,9 @@  discard block
 block discarded – undo
699 729
 		}
700 730
 
701 731
 		// Make sure we quit this loop.
702
-		if ($smcFunc['db_num_rows']($request) === $maxIndex || $looped || $range_limit == '')
703
-			break;
732
+		if ($smcFunc['db_num_rows']($request) === $maxIndex || $looped || $range_limit == '') {
733
+					break;
734
+		}
704 735
 		$looped = true;
705 736
 		$range_limit = '';
706 737
 	}
@@ -744,19 +775,21 @@  discard block
 block discarded – undo
744 775
 			'css_class' => $row['approved'] ? 'windowbg' : 'approvebg',
745 776
 		);
746 777
 
747
-		if ($user_info['id'] == $row['id_member_started'])
748
-			$board_ids['own'][$row['id_board']][] = $counter;
778
+		if ($user_info['id'] == $row['id_member_started']) {
779
+					$board_ids['own'][$row['id_board']][] = $counter;
780
+		}
749 781
 		$board_ids['any'][$row['id_board']][] = $counter;
750 782
 	}
751 783
 	$smcFunc['db_free_result']($request);
752 784
 
753 785
 	// All posts were retrieved in reverse order, get them right again.
754
-	if ($reverse)
755
-		$context['posts'] = array_reverse($context['posts'], true);
786
+	if ($reverse) {
787
+			$context['posts'] = array_reverse($context['posts'], true);
788
+	}
756 789
 
757 790
 	// These are all the permissions that are different from board to board..
758
-	if ($context['is_topics'])
759
-		$permissions = array(
791
+	if ($context['is_topics']) {
792
+			$permissions = array(
760 793
 			'own' => array(
761 794
 				'post_reply_own' => 'can_reply',
762 795
 			),
@@ -764,8 +797,8 @@  discard block
 block discarded – undo
764 797
 				'post_reply_any' => 'can_reply',
765 798
 			)
766 799
 		);
767
-	else
768
-		$permissions = array(
800
+	} else {
801
+			$permissions = array(
769 802
 			'own' => array(
770 803
 				'post_reply_own' => 'can_reply',
771 804
 				'delete_own' => 'can_delete',
@@ -775,6 +808,7 @@  discard block
 block discarded – undo
775 808
 				'delete_any' => 'can_delete',
776 809
 			)
777 810
 		);
811
+	}
778 812
 
779 813
 	// For every permission in the own/any lists...
780 814
 	foreach ($permissions as $type => $list)
@@ -785,19 +819,22 @@  discard block
 block discarded – undo
785 819
 			$boards = boardsAllowedTo($permission);
786 820
 
787 821
 			// Hmm, they can do it on all boards, can they?
788
-			if (!empty($boards) && $boards[0] == 0)
789
-				$boards = array_keys($board_ids[$type]);
822
+			if (!empty($boards) && $boards[0] == 0) {
823
+							$boards = array_keys($board_ids[$type]);
824
+			}
790 825
 
791 826
 			// Now go through each board they can do the permission on.
792 827
 			foreach ($boards as $board_id)
793 828
 			{
794 829
 				// There aren't any posts displayed from this board.
795
-				if (!isset($board_ids[$type][$board_id]))
796
-					continue;
830
+				if (!isset($board_ids[$type][$board_id])) {
831
+									continue;
832
+				}
797 833
 
798 834
 				// Set the permission to true ;).
799
-				foreach ($board_ids[$type][$board_id] as $counter)
800
-					$context['posts'][$counter][$allowed] = true;
835
+				foreach ($board_ids[$type][$board_id] as $counter) {
836
+									$context['posts'][$counter][$allowed] = true;
837
+				}
801 838
 			}
802 839
 		}
803 840
 	}
@@ -828,8 +865,9 @@  discard block
 block discarded – undo
828 865
 	$boardsAllowed = boardsAllowedTo('view_attachments');
829 866
 
830 867
 	// Make sure we can't actually see anything...
831
-	if (empty($boardsAllowed))
832
-		$boardsAllowed = array(-1);
868
+	if (empty($boardsAllowed)) {
869
+			$boardsAllowed = array(-1);
870
+	}
833 871
 
834 872
 	require_once($sourcedir . '/Subs-List.php');
835 873
 
@@ -980,8 +1018,8 @@  discard block
 block discarded – undo
980 1018
 		)
981 1019
 	);
982 1020
 	$attachments = array();
983
-	while ($row = $smcFunc['db_fetch_assoc']($request))
984
-		$attachments[] = array(
1021
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1022
+			$attachments[] = array(
985 1023
 			'id' => $row['id_attach'],
986 1024
 			'filename' => $row['filename'],
987 1025
 			'downloads' => $row['downloads'],
@@ -993,6 +1031,7 @@  discard block
 block discarded – undo
993 1031
 			'board_name' => $row['name'],
994 1032
 			'approved' => $row['approved'],
995 1033
 		);
1034
+	}
996 1035
 
997 1036
 	$smcFunc['db_free_result']($request);
998 1037
 
@@ -1047,8 +1086,9 @@  discard block
 block discarded – undo
1047 1086
 	global $txt, $user_info, $scripturl, $modSettings, $context, $sourcedir;
1048 1087
 
1049 1088
 	// Only the owner can see the list (if the function is enabled of course)
1050
-	if ($user_info['id'] != $memID)
1051
-		return;
1089
+	if ($user_info['id'] != $memID) {
1090
+			return;
1091
+	}
1052 1092
 
1053 1093
 	require_once($sourcedir . '/Subs-List.php');
1054 1094
 
@@ -1194,8 +1234,9 @@  discard block
 block discarded – undo
1194 1234
 	);
1195 1235
 
1196 1236
 	$topics = array();
1197
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1198
-		$topics[] = $row['id_topic'];
1237
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1238
+			$topics[] = $row['id_topic'];
1239
+	}
1199 1240
 
1200 1241
 	$smcFunc['db_free_result']($request);
1201 1242
 
@@ -1215,8 +1256,9 @@  discard block
 block discarded – undo
1215 1256
 				'topics' => $topics,
1216 1257
 			)
1217 1258
 		);
1218
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1219
-			$topicsInfo[] = $row;
1259
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1260
+					$topicsInfo[] = $row;
1261
+		}
1220 1262
 		$smcFunc['db_free_result']($request);
1221 1263
 	}
1222 1264
 
@@ -1264,8 +1306,9 @@  discard block
 block discarded – undo
1264 1306
 	$context['page_title'] = $txt['statPanel_showStats'] . ' ' . $user_profile[$memID]['real_name'];
1265 1307
 
1266 1308
 	// Is the load average too high to allow searching just now?
1267
-	if (!empty($context['load_average']) && !empty($modSettings['loadavg_userstats']) && $context['load_average'] >= $modSettings['loadavg_userstats'])
1268
-		fatal_lang_error('loadavg_userstats_disabled', false);
1309
+	if (!empty($context['load_average']) && !empty($modSettings['loadavg_userstats']) && $context['load_average'] >= $modSettings['loadavg_userstats']) {
1310
+			fatal_lang_error('loadavg_userstats_disabled', false);
1311
+	}
1269 1312
 
1270 1313
 	// General user statistics.
1271 1314
 	$timeDays = floor($user_profile[$memID]['total_time_logged_in'] / 86400);
@@ -1408,11 +1451,13 @@  discard block
 block discarded – undo
1408 1451
 	}
1409 1452
 	$smcFunc['db_free_result']($result);
1410 1453
 
1411
-	if ($maxPosts > 0)
1412
-		for ($hour = 0; $hour < 24; $hour++)
1454
+	if ($maxPosts > 0) {
1455
+			for ($hour = 0;
1456
+	}
1457
+	$hour < 24; $hour++)
1413 1458
 		{
1414
-			if (!isset($context['posts_by_time'][$hour]))
1415
-				$context['posts_by_time'][$hour] = array(
1459
+			if (!isset($context['posts_by_time'][$hour])) {
1460
+							$context['posts_by_time'][$hour] = array(
1416 1461
 					'hour' => $hour,
1417 1462
 					'hour_format' => stripos($user_info['time_format'], '%p') === false ? $hour : date('g a', mktime($hour)),
1418 1463
 					'posts' => 0,
@@ -1420,7 +1465,7 @@  discard block
 block discarded – undo
1420 1465
 					'relative_percent' => 0,
1421 1466
 					'is_last' => $hour == 23,
1422 1467
 				);
1423
-			else
1468
+			} else
1424 1469
 			{
1425 1470
 				$context['posts_by_time'][$hour]['posts_percent'] = round(($context['posts_by_time'][$hour]['posts'] * 100) / $realPosts);
1426 1471
 				$context['posts_by_time'][$hour]['relative_percent'] = round(($context['posts_by_time'][$hour]['posts'] * 100) / $maxPosts);
@@ -1453,8 +1498,9 @@  discard block
 block discarded – undo
1453 1498
 
1454 1499
 	foreach ($subActions as $sa => $action)
1455 1500
 	{
1456
-		if (!allowedTo($action[2]))
1457
-			unset($subActions[$sa]);
1501
+		if (!allowedTo($action[2])) {
1502
+					unset($subActions[$sa]);
1503
+		}
1458 1504
 	}
1459 1505
 
1460 1506
 	// Create the tabs for the template.
@@ -1472,15 +1518,18 @@  discard block
 block discarded – undo
1472 1518
 	);
1473 1519
 
1474 1520
 	// Moderation must be on to track edits.
1475
-	if (empty($modSettings['userlog_enabled']))
1476
-		unset($context[$context['profile_menu_name']]['tab_data']['edits'], $subActions['edits']);
1521
+	if (empty($modSettings['userlog_enabled'])) {
1522
+			unset($context[$context['profile_menu_name']]['tab_data']['edits'], $subActions['edits']);
1523
+	}
1477 1524
 
1478 1525
 	// Group requests must be active to show it...
1479
-	if (empty($modSettings['show_group_membership']))
1480
-		unset($context[$context['profile_menu_name']]['tab_data']['groupreq'], $subActions['groupreq']);
1526
+	if (empty($modSettings['show_group_membership'])) {
1527
+			unset($context[$context['profile_menu_name']]['tab_data']['groupreq'], $subActions['groupreq']);
1528
+	}
1481 1529
 
1482
-	if (empty($subActions))
1483
-		fatal_lang_error('no_access', false);
1530
+	if (empty($subActions)) {
1531
+			fatal_lang_error('no_access', false);
1532
+	}
1484 1533
 
1485 1534
 	$keys = array_keys($subActions);
1486 1535
 	$default = array_shift($keys);
@@ -1493,9 +1542,10 @@  discard block
 block discarded – undo
1493 1542
 	$context['sub_template'] = $subActions[$context['tracking_area']][0];
1494 1543
 	$call = call_helper($subActions[$context['tracking_area']][0], true);
1495 1544
 
1496
-	if (!empty($call))
1497
-		call_user_func($call, $memID);
1498
-}
1545
+	if (!empty($call)) {
1546
+			call_user_func($call, $memID);
1547
+	}
1548
+	}
1499 1549
 
1500 1550
 /**
1501 1551
  * Handles tracking a user's activity
@@ -1511,8 +1561,9 @@  discard block
 block discarded – undo
1511 1561
 	isAllowedTo('moderate_forum');
1512 1562
 
1513 1563
 	$context['last_ip'] = $user_profile[$memID]['member_ip'];
1514
-	if ($context['last_ip'] != $user_profile[$memID]['member_ip2'])
1515
-		$context['last_ip2'] = $user_profile[$memID]['member_ip2'];
1564
+	if ($context['last_ip'] != $user_profile[$memID]['member_ip2']) {
1565
+			$context['last_ip2'] = $user_profile[$memID]['member_ip2'];
1566
+	}
1516 1567
 	$context['member']['name'] = $user_profile[$memID]['real_name'];
1517 1568
 
1518 1569
 	// Set the options for the list component.
@@ -1679,8 +1730,9 @@  discard block
 block discarded – undo
1679 1730
 			)
1680 1731
 		);
1681 1732
 		$message_members = array();
1682
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1683
-			$message_members[] = $row['id_member'];
1733
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1734
+					$message_members[] = $row['id_member'];
1735
+		}
1684 1736
 		$smcFunc['db_free_result']($request);
1685 1737
 
1686 1738
 		// Fetch their names, cause of the GROUP BY doesn't like giving us that normally.
@@ -1695,8 +1747,9 @@  discard block
 block discarded – undo
1695 1747
 					'ip_list' => $ips,
1696 1748
 				)
1697 1749
 			);
1698
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1699
-				$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1750
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1751
+							$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1752
+			}
1700 1753
 			$smcFunc['db_free_result']($request);
1701 1754
 		}
1702 1755
 
@@ -1710,8 +1763,9 @@  discard block
 block discarded – undo
1710 1763
 				'ip_list' => $ips,
1711 1764
 			)
1712 1765
 		);
1713
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1714
-			$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1766
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1767
+					$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1768
+		}
1715 1769
 		$smcFunc['db_free_result']($request);
1716 1770
 	}
1717 1771
 }
@@ -1771,8 +1825,8 @@  discard block
 block discarded – undo
1771 1825
 		))
1772 1826
 	);
1773 1827
 	$error_messages = array();
1774
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1775
-		$error_messages[] = array(
1828
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1829
+			$error_messages[] = array(
1776 1830
 			'ip' => inet_dtop($row['ip']),
1777 1831
 			'member_link' => $row['id_member'] > 0 ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>' : $row['display_name'],
1778 1832
 			'message' => strtr($row['message'], array('&lt;span class=&quot;remove&quot;&gt;' => '', '&lt;/span&gt;' => '')),
@@ -1780,6 +1834,7 @@  discard block
 block discarded – undo
1780 1834
 			'time' => timeformat($row['log_time']),
1781 1835
 			'timestamp' => forum_time(true, $row['log_time']),
1782 1836
 		);
1837
+	}
1783 1838
 	$smcFunc['db_free_result']($request);
1784 1839
 
1785 1840
 	return $error_messages;
@@ -1842,8 +1897,8 @@  discard block
 block discarded – undo
1842 1897
 		))
1843 1898
 	);
1844 1899
 	$messages = array();
1845
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1846
-		$messages[] = array(
1900
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1901
+			$messages[] = array(
1847 1902
 			'ip' => inet_dtop($row['poster_ip']),
1848 1903
 			'member_link' => empty($row['id_member']) ? $row['display_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>',
1849 1904
 			'board' => array(
@@ -1856,6 +1911,7 @@  discard block
 block discarded – undo
1856 1911
 			'time' => timeformat($row['poster_time']),
1857 1912
 			'timestamp' => forum_time(true, $row['poster_time'])
1858 1913
 		);
1914
+	}
1859 1915
 	$smcFunc['db_free_result']($request);
1860 1916
 
1861 1917
 	return $messages;
@@ -1882,19 +1938,20 @@  discard block
 block discarded – undo
1882 1938
 		$context['sub_template'] = 'trackIP';
1883 1939
 		$context['page_title'] = $txt['profile'];
1884 1940
 		$context['base_url'] = $scripturl . '?action=trackip';
1885
-	}
1886
-	else
1941
+	} else
1887 1942
 	{
1888 1943
 		$context['ip'] = ip2range($user_profile[$memID]['member_ip']);
1889 1944
 		$context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID;
1890 1945
 	}
1891 1946
 
1892 1947
 	// Searching?
1893
-	if (isset($_REQUEST['searchip']))
1894
-		$context['ip'] = ip2range(trim($_REQUEST['searchip']));
1948
+	if (isset($_REQUEST['searchip'])) {
1949
+			$context['ip'] = ip2range(trim($_REQUEST['searchip']));
1950
+	}
1895 1951
 
1896
-	if (count($context['ip']) !== 2)
1897
-		fatal_lang_error('invalid_tracking_ip', false);
1952
+	if (count($context['ip']) !== 2) {
1953
+			fatal_lang_error('invalid_tracking_ip', false);
1954
+	}
1898 1955
 
1899 1956
 	$ip_string = array('{inet:ip_address_low}','{inet:ip_address_high}');
1900 1957
 	$fields = array(
@@ -1904,13 +1961,15 @@  discard block
 block discarded – undo
1904 1961
 
1905 1962
 	$ip_var = $context['ip'];
1906 1963
 
1907
-	if ($context['ip']['low'] !==  $context['ip']['high'])
1908
-		$context['ip'] = $context['ip']['low'] . ' - ' . $context['ip']['high'];
1909
-	else
1910
-		$context['ip'] = $context['ip']['low'];
1964
+	if ($context['ip']['low'] !==  $context['ip']['high']) {
1965
+			$context['ip'] = $context['ip']['low'] . ' - ' . $context['ip']['high'];
1966
+	} else {
1967
+			$context['ip'] = $context['ip']['low'];
1968
+	}
1911 1969
 
1912
-	if (empty($context['tracking_area']))
1913
-		$context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip'];
1970
+	if (empty($context['tracking_area'])) {
1971
+			$context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip'];
1972
+	}
1914 1973
 
1915 1974
 	$request = $smcFunc['db_query']('', '
1916 1975
 		SELECT id_member, real_name AS display_name, member_ip
@@ -1919,8 +1978,9 @@  discard block
 block discarded – undo
1919 1978
 		$fields
1920 1979
 	);
1921 1980
 	$context['ips'] = array();
1922
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1923
-		$context['ips'][inet_dtop($row['member_ip'])][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>';
1981
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1982
+			$context['ips'][inet_dtop($row['member_ip'])][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>';
1983
+	}
1924 1984
 	$smcFunc['db_free_result']($request);
1925 1985
 
1926 1986
 	ksort($context['ips']);
@@ -2150,10 +2210,11 @@  discard block
 block discarded – undo
2150 2210
 	// Gonna want this for the list.
2151 2211
 	require_once($sourcedir . '/Subs-List.php');
2152 2212
 
2153
-	if ($memID == 0)
2154
-		$context['base_url'] = $scripturl . '?action=trackip';
2155
-	else
2156
-		$context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID;
2213
+	if ($memID == 0) {
2214
+			$context['base_url'] = $scripturl . '?action=trackip';
2215
+	} else {
2216
+			$context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID;
2217
+	}
2157 2218
 
2158 2219
 	// Start with the user messages.
2159 2220
 	$listOptions = array(
@@ -2263,12 +2324,13 @@  discard block
 block discarded – undo
2263 2324
 		)
2264 2325
 	);
2265 2326
 	$logins = array();
2266
-	while ($row = $smcFunc['db_fetch_assoc']($request))
2267
-		$logins[] = array(
2327
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2328
+			$logins[] = array(
2268 2329
 			'time' => timeformat($row['time']),
2269 2330
 			'ip' => inet_dtop($row['ip']),
2270 2331
 			'ip2' => inet_dtop($row['ip2']),
2271 2332
 		);
2333
+	}
2272 2334
 	$smcFunc['db_free_result']($request);
2273 2335
 
2274 2336
 	return $logins;
@@ -2293,11 +2355,12 @@  discard block
 block discarded – undo
2293 2355
 		)
2294 2356
 	);
2295 2357
 	$context['custom_field_titles'] = array();
2296
-	while ($row = $smcFunc['db_fetch_assoc']($request))
2297
-		$context['custom_field_titles']['customfield_' . $row['col_name']] = array(
2358
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2359
+			$context['custom_field_titles']['customfield_' . $row['col_name']] = array(
2298 2360
 			'title' => $row['field_name'],
2299 2361
 			'parse_bbc' => $row['bbc'],
2300 2362
 		);
2363
+	}
2301 2364
 	$smcFunc['db_free_result']($request);
2302 2365
 
2303 2366
 	// Set the options for the error lists.
@@ -2436,19 +2499,22 @@  discard block
 block discarded – undo
2436 2499
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2437 2500
 	{
2438 2501
 		$extra = $smcFunc['json_decode']($row['extra'], true);
2439
-		if (!empty($extra['applicator']))
2440
-			$members[] = $extra['applicator'];
2502
+		if (!empty($extra['applicator'])) {
2503
+					$members[] = $extra['applicator'];
2504
+		}
2441 2505
 
2442 2506
 		// Work out what the name of the action is.
2443
-		if (isset($txt['trackEdit_action_' . $row['action']]))
2444
-			$action_text = $txt['trackEdit_action_' . $row['action']];
2445
-		elseif (isset($txt[$row['action']]))
2446
-			$action_text = $txt[$row['action']];
2507
+		if (isset($txt['trackEdit_action_' . $row['action']])) {
2508
+					$action_text = $txt['trackEdit_action_' . $row['action']];
2509
+		} elseif (isset($txt[$row['action']])) {
2510
+					$action_text = $txt[$row['action']];
2511
+		}
2447 2512
 		// Custom field?
2448
-		elseif (isset($context['custom_field_titles'][$row['action']]))
2449
-			$action_text = $context['custom_field_titles'][$row['action']]['title'];
2450
-		else
2451
-			$action_text = $row['action'];
2513
+		elseif (isset($context['custom_field_titles'][$row['action']])) {
2514
+					$action_text = $context['custom_field_titles'][$row['action']]['title'];
2515
+		} else {
2516
+					$action_text = $row['action'];
2517
+		}
2452 2518
 
2453 2519
 		// Parse BBC?
2454 2520
 		$parse_bbc = isset($context['custom_field_titles'][$row['action']]) && $context['custom_field_titles'][$row['action']]['parse_bbc'] ? true : false;
@@ -2480,13 +2546,15 @@  discard block
 block discarded – undo
2480 2546
 			)
2481 2547
 		);
2482 2548
 		$members = array();
2483
-		while ($row = $smcFunc['db_fetch_assoc']($request))
2484
-			$members[$row['id_member']] = $row['real_name'];
2549
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
2550
+					$members[$row['id_member']] = $row['real_name'];
2551
+		}
2485 2552
 		$smcFunc['db_free_result']($request);
2486 2553
 
2487
-		foreach ($edits as $key => $value)
2488
-			if (isset($members[$value['id_member']]))
2554
+		foreach ($edits as $key => $value) {
2555
+					if (isset($members[$value['id_member']]))
2489 2556
 				$edits[$key]['member_link'] = '<a href="' . $scripturl . '?action=profile;u=' . $value['id_member'] . '">' . $members[$value['id_member']] . '</a>';
2557
+		}
2490 2558
 	}
2491 2559
 
2492 2560
 	return $edits;
@@ -2687,10 +2755,11 @@  discard block
 block discarded – undo
2687 2755
 	$context['board'] = $board;
2688 2756
 
2689 2757
 	// Determine which groups this user is in.
2690
-	if (empty($user_profile[$memID]['additional_groups']))
2691
-		$curGroups = array();
2692
-	else
2693
-		$curGroups = explode(',', $user_profile[$memID]['additional_groups']);
2758
+	if (empty($user_profile[$memID]['additional_groups'])) {
2759
+			$curGroups = array();
2760
+	} else {
2761
+			$curGroups = explode(',', $user_profile[$memID]['additional_groups']);
2762
+	}
2694 2763
 	$curGroups[] = $user_profile[$memID]['id_group'];
2695 2764
 	$curGroups[] = $user_profile[$memID]['id_post_group'];
2696 2765
 
@@ -2710,28 +2779,30 @@  discard block
 block discarded – undo
2710 2779
 	$context['no_access_boards'] = array();
2711 2780
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2712 2781
 	{
2713
-		if (count(array_intersect($curGroups, explode(',', $row['member_groups']))) === 0 && !$row['is_mod'])
2714
-			$context['no_access_boards'][] = array(
2782
+		if (count(array_intersect($curGroups, explode(',', $row['member_groups']))) === 0 && !$row['is_mod']) {
2783
+					$context['no_access_boards'][] = array(
2715 2784
 				'id' => $row['id_board'],
2716 2785
 				'name' => $row['name'],
2717 2786
 				'is_last' => false,
2718 2787
 			);
2719
-		elseif ($row['id_profile'] != 1 || $row['is_mod'])
2720
-			$context['boards'][$row['id_board']] = array(
2788
+		} elseif ($row['id_profile'] != 1 || $row['is_mod']) {
2789
+					$context['boards'][$row['id_board']] = array(
2721 2790
 				'id' => $row['id_board'],
2722 2791
 				'name' => $row['name'],
2723 2792
 				'selected' => $board == $row['id_board'],
2724 2793
 				'profile' => $row['id_profile'],
2725 2794
 				'profile_name' => $context['profiles'][$row['id_profile']]['name'],
2726 2795
 			);
2796
+		}
2727 2797
 	}
2728 2798
 	$smcFunc['db_free_result']($request);
2729 2799
 
2730 2800
 	require_once($sourcedir . '/Subs-Boards.php');
2731 2801
 	sortBoards($context['boards']);
2732 2802
 
2733
-	if (!empty($context['no_access_boards']))
2734
-		$context['no_access_boards'][count($context['no_access_boards']) - 1]['is_last'] = true;
2803
+	if (!empty($context['no_access_boards'])) {
2804
+			$context['no_access_boards'][count($context['no_access_boards']) - 1]['is_last'] = true;
2805
+	}
2735 2806
 
2736 2807
 	$context['member']['permissions'] = array(
2737 2808
 		'general' => array(),
@@ -2740,8 +2811,9 @@  discard block
 block discarded – undo
2740 2811
 
2741 2812
 	// If you're an admin we know you can do everything, we might as well leave.
2742 2813
 	$context['member']['has_all_permissions'] = in_array(1, $curGroups);
2743
-	if ($context['member']['has_all_permissions'])
2744
-		return;
2814
+	if ($context['member']['has_all_permissions']) {
2815
+			return;
2816
+	}
2745 2817
 
2746 2818
 	$denied = array();
2747 2819
 
@@ -2760,21 +2832,24 @@  discard block
 block discarded – undo
2760 2832
 	while ($row = $smcFunc['db_fetch_assoc']($result))
2761 2833
 	{
2762 2834
 		// We don't know about this permission, it doesn't exist :P.
2763
-		if (!isset($txt['permissionname_' . $row['permission']]))
2764
-			continue;
2835
+		if (!isset($txt['permissionname_' . $row['permission']])) {
2836
+					continue;
2837
+		}
2765 2838
 
2766
-		if (empty($row['add_deny']))
2767
-			$denied[] = $row['permission'];
2839
+		if (empty($row['add_deny'])) {
2840
+					$denied[] = $row['permission'];
2841
+		}
2768 2842
 
2769 2843
 		// Permissions that end with _own or _any consist of two parts.
2770
-		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)]))
2771
-			$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2772
-		else
2773
-			$name = $txt['permissionname_' . $row['permission']];
2844
+		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) {
2845
+					$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2846
+		} else {
2847
+					$name = $txt['permissionname_' . $row['permission']];
2848
+		}
2774 2849
 
2775 2850
 		// Add this permission if it doesn't exist yet.
2776
-		if (!isset($context['member']['permissions']['general'][$row['permission']]))
2777
-			$context['member']['permissions']['general'][$row['permission']] = array(
2851
+		if (!isset($context['member']['permissions']['general'][$row['permission']])) {
2852
+					$context['member']['permissions']['general'][$row['permission']] = array(
2778 2853
 				'id' => $row['permission'],
2779 2854
 				'groups' => array(
2780 2855
 					'allowed' => array(),
@@ -2784,6 +2859,7 @@  discard block
 block discarded – undo
2784 2859
 				'is_denied' => false,
2785 2860
 				'is_global' => true,
2786 2861
 			);
2862
+		}
2787 2863
 
2788 2864
 		// Add the membergroup to either the denied or the allowed groups.
2789 2865
 		$context['member']['permissions']['general'][$row['permission']]['groups'][empty($row['add_deny']) ? 'denied' : 'allowed'][] = $row['id_group'] == 0 ? $txt['membergroups_members'] : $row['group_name'];
@@ -2817,18 +2893,20 @@  discard block
 block discarded – undo
2817 2893
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2818 2894
 	{
2819 2895
 		// We don't know about this permission, it doesn't exist :P.
2820
-		if (!isset($txt['permissionname_' . $row['permission']]))
2821
-			continue;
2896
+		if (!isset($txt['permissionname_' . $row['permission']])) {
2897
+					continue;
2898
+		}
2822 2899
 
2823 2900
 		// The name of the permission using the format 'permission name' - 'own/any topic/event/etc.'.
2824
-		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)]))
2825
-			$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2826
-		else
2827
-			$name = $txt['permissionname_' . $row['permission']];
2901
+		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) {
2902
+					$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2903
+		} else {
2904
+					$name = $txt['permissionname_' . $row['permission']];
2905
+		}
2828 2906
 
2829 2907
 		// Create the structure for this permission.
2830
-		if (!isset($context['member']['permissions']['board'][$row['permission']]))
2831
-			$context['member']['permissions']['board'][$row['permission']] = array(
2908
+		if (!isset($context['member']['permissions']['board'][$row['permission']])) {
2909
+					$context['member']['permissions']['board'][$row['permission']] = array(
2832 2910
 				'id' => $row['permission'],
2833 2911
 				'groups' => array(
2834 2912
 					'allowed' => array(),
@@ -2838,6 +2916,7 @@  discard block
 block discarded – undo
2838 2916
 				'is_denied' => false,
2839 2917
 				'is_global' => empty($board),
2840 2918
 			);
2919
+		}
2841 2920
 
2842 2921
 		$context['member']['permissions']['board'][$row['permission']]['groups'][empty($row['add_deny']) ? 'denied' : 'allowed'][$row['id_group']] = $row['id_group'] == 0 ? $txt['membergroups_members'] : $row['group_name'];
2843 2922
 
@@ -2856,8 +2935,9 @@  discard block
 block discarded – undo
2856 2935
 	global $modSettings, $context, $sourcedir, $txt, $scripturl;
2857 2936
 
2858 2937
 	// Firstly, can we actually even be here?
2859
-	if (!($context['user']['is_owner'] && allowedTo('view_warning_own')) && !allowedTo('view_warning_any') && !allowedTo('issue_warning') && !allowedTo('moderate_forum'))
2860
-		fatal_lang_error('no_access', false);
2938
+	if (!($context['user']['is_owner'] && allowedTo('view_warning_own')) && !allowedTo('view_warning_any') && !allowedTo('issue_warning') && !allowedTo('moderate_forum')) {
2939
+			fatal_lang_error('no_access', false);
2940
+	}
2861 2941
 
2862 2942
 	// Make sure things which are disabled stay disabled.
2863 2943
 	$modSettings['warning_watch'] = !empty($modSettings['warning_watch']) ? $modSettings['warning_watch'] : 110;
@@ -2944,9 +3024,10 @@  discard block
 block discarded – undo
2944 3024
 		$modSettings['warning_mute'] => $txt['profile_warning_effect_own_muted'],
2945 3025
 	);
2946 3026
 	$context['current_level'] = 0;
2947
-	foreach ($context['level_effects'] as $limit => $dummy)
2948
-		if ($context['member']['warning'] >= $limit)
3027
+	foreach ($context['level_effects'] as $limit => $dummy) {
3028
+			if ($context['member']['warning'] >= $limit)
2949 3029
 			$context['current_level'] = $limit;
2950
-}
3030
+	}
3031
+	}
2951 3032
 
2952 3033
 ?>
2953 3034
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/Profile.template.php 1 patch
Braces   +523 added lines, -402 removed lines patch added patch discarded remove patch
@@ -18,23 +18,25 @@  discard block
 block discarded – undo
18 18
 	global $context;
19 19
 
20 20
 	// Prevent Chrome from auto completing fields when viewing/editing other members profiles
21
-	if (isBrowser('is_chrome') && !$context['user']['is_owner'])
22
-		echo '
21
+	if (isBrowser('is_chrome') && !$context['user']['is_owner']) {
22
+			echo '
23 23
 			<script>
24 24
 				disableAutoComplete();
25 25
 			</script>';
26
+	}
26 27
 
27 28
 	// If an error occurred while trying to save previously, give the user a clue!
28 29
 	echo '
29 30
 			', template_error_message();
30 31
 
31 32
 	// If the profile was update successfully, let the user know this.
32
-	if (!empty($context['profile_updated']))
33
-		echo '
33
+	if (!empty($context['profile_updated'])) {
34
+			echo '
34 35
 			<div class="infobox">
35 36
 				', $context['profile_updated'], '
36 37
 			</div>';
37
-}
38
+	}
39
+	}
38 40
 
39 41
 /**
40 42
  * Template for any HTML needed below the profile (closing off divs/tables, etc.)
@@ -99,19 +101,19 @@  discard block
 block discarded – undo
99 101
 		</div>
100 102
 		<div class="alerts_unread">';
101 103
 
102
-	if (empty($context['unread_alerts']))
103
-		template_alerts_all_read();
104
-
105
-	else
104
+	if (empty($context['unread_alerts'])) {
105
+			template_alerts_all_read();
106
+	} else
106 107
 	{
107
-		foreach ($context['unread_alerts'] as $id_alert => $details)
108
-			echo '
108
+		foreach ($context['unread_alerts'] as $id_alert => $details) {
109
+					echo '
109 110
 			<div class="unread">
110 111
 				', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', '
111 112
 				<div class="details">
112 113
 					', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], '
113 114
 				</div>
114 115
 			</div>';
116
+		}
115 117
 	}
116 118
 
117 119
 	echo '
@@ -158,37 +160,41 @@  discard block
 block discarded – undo
158 160
 	if (!empty($context['print_custom_fields']['above_member']))
159 161
 	{
160 162
 		$fields = '';
161
-		foreach ($context['print_custom_fields']['above_member'] as $field)
162
-			if (!empty($field['output_html']))
163
+		foreach ($context['print_custom_fields']['above_member'] as $field) {
164
+					if (!empty($field['output_html']))
163 165
 				$fields .= '
164 166
 					<li>' . $field['output_html'] . '</li>';
167
+		}
165 168
 
166
-		if (!empty($fields))
167
-			echo '
169
+		if (!empty($fields)) {
170
+					echo '
168 171
 			<div class="custom_fields_above_name">
169 172
 				<ul>', $fields, '
170 173
 				</ul>
171 174
 			</div>';
175
+		}
172 176
 	}
173 177
 
174 178
 	echo '
175 179
 			<div class="username clear">
176 180
 				<h4>';
177 181
 
178
-	if (!empty($context['print_custom_fields']['before_member']))
179
-		foreach ($context['print_custom_fields']['before_member'] as $field)
182
+	if (!empty($context['print_custom_fields']['before_member'])) {
183
+			foreach ($context['print_custom_fields']['before_member'] as $field)
180 184
 			if (!empty($field['output_html']))
181 185
 				echo '
182 186
 					<span>', $field['output_html'], '</span>';
187
+	}
183 188
 
184 189
 	echo '
185 190
 					', $context['member']['name'];
186 191
 
187
-	if (!empty($context['print_custom_fields']['after_member']))
188
-		foreach ($context['print_custom_fields']['after_member'] as $field)
192
+	if (!empty($context['print_custom_fields']['after_member'])) {
193
+			foreach ($context['print_custom_fields']['after_member'] as $field)
189 194
 			if (!empty($field['output_html']))
190 195
 				echo '
191 196
 					<span>', $field['output_html'], '</span>';
197
+	}
192 198
 
193 199
 
194 200
 	echo '
@@ -201,39 +207,44 @@  discard block
 block discarded – undo
201 207
 	if (!empty($context['print_custom_fields']['below_avatar']))
202 208
 	{
203 209
 		$fields = '';
204
-		foreach ($context['print_custom_fields']['below_avatar'] as $field)
205
-			if (!empty($field['output_html']))
210
+		foreach ($context['print_custom_fields']['below_avatar'] as $field) {
211
+					if (!empty($field['output_html']))
206 212
 				$fields .= '
207 213
 					<li>' . $field['output_html'] . '</li>';
214
+		}
208 215
 
209
-		if (!empty($fields))
210
-			echo '
216
+		if (!empty($fields)) {
217
+					echo '
211 218
 			<div class="custom_fields_below_avatar">
212 219
 				<ul>', $fields, '
213 220
 				</ul>
214 221
 			</div>';
222
+		}
215 223
 	}
216 224
 
217 225
 	echo '
218 226
 			<ul class="icon_fields clear">';
219 227
 
220 228
 	// Email is only visible if it's your profile or you have the moderate_forum permission
221
-	if ($context['member']['show_email'])
222
-		echo '
229
+	if ($context['member']['show_email']) {
230
+			echo '
223 231
 				<li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>';
232
+	}
224 233
 
225 234
 	// Don't show an icon if they haven't specified a website.
226
-	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
227
-		echo '
235
+	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) {
236
+			echo '
228 237
 				<li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
238
+	}
229 239
 
230 240
 	// Are there any custom profile fields as icons?
231 241
 	if (!empty($context['print_custom_fields']['icons']))
232 242
 	{
233
-		foreach ($context['print_custom_fields']['icons'] as $field)
234
-			if (!empty($field['output_html']))
243
+		foreach ($context['print_custom_fields']['icons'] as $field) {
244
+					if (!empty($field['output_html']))
235 245
 				echo '
236 246
 				<li class="custom_field">', $field['output_html'], '</li>';
247
+		}
237 248
 	}
238 249
 
239 250
 	echo '
@@ -242,24 +253,27 @@  discard block
 block discarded – undo
242 253
 				', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : '';
243 254
 
244 255
 	// Can they add this member as a buddy?
245
-	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
246
-		echo '
256
+	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) {
257
+			echo '
247 258
 				<br>
248 259
 				<a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>';
260
+	}
249 261
 
250 262
 	echo '
251 263
 			</span>';
252 264
 
253
-	if (!$context['user']['is_owner'] && $context['can_send_pm'])
254
-		echo '
265
+	if (!$context['user']['is_owner'] && $context['can_send_pm']) {
266
+			echo '
255 267
 			<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>';
268
+	}
256 269
 
257 270
 	echo '
258 271
 			<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>';
259 272
 
260
-	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled']))
261
-		echo '
273
+	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) {
274
+			echo '
262 275
 			<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>';
276
+	}
263 277
 
264 278
 	echo '
265 279
 			<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>';
@@ -268,17 +282,19 @@  discard block
 block discarded – undo
268 282
 	if (!empty($context['print_custom_fields']['bottom_poster']))
269 283
 	{
270 284
 		$fields = '';
271
-		foreach ($context['print_custom_fields']['bottom_poster'] as $field)
272
-			if (!empty($field['output_html']))
285
+		foreach ($context['print_custom_fields']['bottom_poster'] as $field) {
286
+					if (!empty($field['output_html']))
273 287
 				$fields .= '
274 288
 					<li>' . $field['output_html'] . '</li>';
289
+		}
275 290
 
276
-		if (!empty($fields))
277
-			echo '
291
+		if (!empty($fields)) {
292
+					echo '
278 293
 			<div class="custom_fields_bottom">
279 294
 				<ul class="nolist">', $fields, '
280 295
 				</ul>
281 296
 			</div>';
297
+		}
282 298
 	}
283 299
 
284 300
 	echo '
@@ -287,30 +303,35 @@  discard block
 block discarded – undo
287 303
 		<div id="detailedinfo">
288 304
 			<dl class="settings">';
289 305
 
290
-	if ($context['user']['is_owner'] || $context['user']['is_admin'])
291
-		echo '
306
+	if ($context['user']['is_owner'] || $context['user']['is_admin']) {
307
+			echo '
292 308
 				<dt>', $txt['username'], ': </dt>
293 309
 				<dd>', $context['member']['username'], '</dd>';
310
+	}
294 311
 
295
-	if (!isset($context['disabled_fields']['posts']))
296
-		echo '
312
+	if (!isset($context['disabled_fields']['posts'])) {
313
+			echo '
297 314
 				<dt>', $txt['profile_posts'], ': </dt>
298 315
 				<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
316
+	}
299 317
 
300
-	if ($context['member']['show_email'])
301
-		echo '
318
+	if ($context['member']['show_email']) {
319
+			echo '
302 320
 				<dt>', $txt['email'], ': </dt>
303 321
 				<dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>';
322
+	}
304 323
 
305
-	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
306
-		echo '
324
+	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) {
325
+			echo '
307 326
 				<dt>', $txt['custom_title'], ': </dt>
308 327
 				<dd>', $context['member']['title'], '</dd>';
328
+	}
309 329
 
310
-	if (!empty($context['member']['blurb']))
311
-		echo '
330
+	if (!empty($context['member']['blurb'])) {
331
+			echo '
312 332
 				<dt>', $txt['personal_text'], ': </dt>
313 333
 				<dd>', $context['member']['blurb'], '</dd>';
334
+	}
314 335
 
315 336
 	echo '
316 337
 				<dt>', $txt['age'], ':</dt>
@@ -324,19 +345,21 @@  discard block
 block discarded – undo
324 345
 	{
325 346
 		$fields = array();
326 347
 
327
-		foreach ($context['print_custom_fields']['standard'] as $field)
328
-			if (!empty($field['output_html']))
348
+		foreach ($context['print_custom_fields']['standard'] as $field) {
349
+					if (!empty($field['output_html']))
329 350
 				$fields[] = $field;
351
+		}
330 352
 
331 353
 		if (count($fields) > 0)
332 354
 		{
333 355
 			echo '
334 356
 			<dl class="settings">';
335 357
 
336
-			foreach ($fields as $field)
337
-				echo '
358
+			foreach ($fields as $field) {
359
+							echo '
338 360
 				<dt>', $field['name'], ':</dt>
339 361
 				<dd>', $field['output_html'], '</dd>';
362
+			}
340 363
 
341 364
 			echo '
342 365
 			</dl>';
@@ -356,9 +379,10 @@  discard block
 block discarded – undo
356 379
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
357 380
 
358 381
 		// Can we provide information on what this means?
359
-		if (!empty($context['warning_status']))
360
-			echo '
382
+		if (!empty($context['warning_status'])) {
383
+					echo '
361 384
 					<span class="smalltext">(', $context['warning_status'], ')</span>';
385
+		}
362 386
 
363 387
 		echo '
364 388
 				</dd>';
@@ -369,11 +393,12 @@  discard block
 block discarded – undo
369 393
 	{
370 394
 
371 395
 		// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
372
-		if (!empty($context['activate_message']))
373
-			echo '
396
+		if (!empty($context['activate_message'])) {
397
+					echo '
374 398
 				<dt class="clear">
375 399
 					<span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>)
376 400
 				</dt>';
401
+		}
377 402
 
378 403
 		// If the current member is banned, show a message and possibly a link to the ban.
379 404
 		if (!empty($context['member']['bans']))
@@ -385,10 +410,11 @@  discard block
 block discarded – undo
385 410
 				<dt class="clear" id="ban_info" style="display: none;">
386 411
 					<strong>', $txt['user_banned_by_following'], ':</strong>';
387 412
 
388
-			foreach ($context['member']['bans'] as $ban)
389
-				echo '
413
+			foreach ($context['member']['bans'] as $ban) {
414
+							echo '
390 415
 					<br>
391 416
 					<span class="smalltext">', $ban['explanation'], '</span>';
417
+			}
392 418
 
393 419
 			echo '
394 420
 				</dt>';
@@ -402,30 +428,34 @@  discard block
 block discarded – undo
402 428
 	// If the person looking is allowed, they can check the members IP address and hostname.
403 429
 	if ($context['can_see_ip'])
404 430
 	{
405
-		if (!empty($context['member']['ip']))
406
-		echo '
431
+		if (!empty($context['member']['ip'])) {
432
+				echo '
407 433
 				<dt>', $txt['ip'], ': </dt>
408 434
 				<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
435
+		}
409 436
 
410
-		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
411
-			echo '
437
+		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) {
438
+					echo '
412 439
 				<dt>', $txt['hostname'], ': </dt>
413 440
 				<dd>', $context['member']['hostname'], '</dd>';
441
+		}
414 442
 	}
415 443
 
416 444
 	echo '
417 445
 				<dt>', $txt['local_time'], ':</dt>
418 446
 				<dd>', $context['member']['local_time'], '</dd>';
419 447
 
420
-	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
421
-		echo '
448
+	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) {
449
+			echo '
422 450
 				<dt>', $txt['language'], ':</dt>
423 451
 				<dd>', $context['member']['language'], '</dd>';
452
+	}
424 453
 
425
-	if ($context['member']['show_last_login'])
426
-		echo '
454
+	if ($context['member']['show_last_login']) {
455
+			echo '
427 456
 				<dt>', $txt['lastLoggedIn'], ': </dt>
428 457
 				<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
458
+	}
429 459
 
430 460
 	echo '
431 461
 			</dl>';
@@ -434,42 +464,47 @@  discard block
 block discarded – undo
434 464
 	if (!empty($context['print_custom_fields']['above_signature']))
435 465
 	{
436 466
 		$fields = '';
437
-		foreach ($context['print_custom_fields']['above_signature'] as $field)
438
-			if (!empty($field['output_html']))
467
+		foreach ($context['print_custom_fields']['above_signature'] as $field) {
468
+					if (!empty($field['output_html']))
439 469
 				$fields .= '
440 470
 					<li>' . $field['output_html'] . '</li>';
471
+		}
441 472
 
442
-		if (!empty($fields))
443
-			echo '
473
+		if (!empty($fields)) {
474
+					echo '
444 475
 			<div class="custom_fields_above_signature">
445 476
 				<ul class="nolist">', $fields, '
446 477
 				</ul>
447 478
 			</div>';
479
+		}
448 480
 	}
449 481
 
450 482
 	// Show the users signature.
451
-	if ($context['signature_enabled'] && !empty($context['member']['signature']))
452
-		echo '
483
+	if ($context['signature_enabled'] && !empty($context['member']['signature'])) {
484
+			echo '
453 485
 			<div class="signature">
454 486
 				<h5>', $txt['signature'], ':</h5>
455 487
 				', $context['member']['signature'], '
456 488
 			</div>';
489
+	}
457 490
 
458 491
 	// Are there any custom profile fields for below the signature?
459 492
 	if (!empty($context['print_custom_fields']['below_signature']))
460 493
 	{
461 494
 		$fields = '';
462
-		foreach ($context['print_custom_fields']['below_signature'] as $field)
463
-			if (!empty($field['output_html']))
495
+		foreach ($context['print_custom_fields']['below_signature'] as $field) {
496
+					if (!empty($field['output_html']))
464 497
 				$fields .=  '
465 498
 					<li>' . $field['output_html'] . '</li>';
499
+		}
466 500
 
467
-		if (!empty($fields))
468
-			echo '
501
+		if (!empty($fields)) {
502
+					echo '
469 503
 			<div class="custom_fields_below_signature">
470 504
 				<ul class="nolist">', $fields, '
471 505
 				</ul>
472 506
 			</div>';
507
+		}
473 508
 	}
474 509
 
475 510
 	echo '
@@ -511,62 +546,70 @@  discard block
 block discarded – undo
511 546
 			</div>
512 547
 			<div class="list_posts">';
513 548
 
514
-			if (!$post['approved'])
515
-				echo '
549
+			if (!$post['approved']) {
550
+							echo '
516 551
 				<div class="approve_post">
517 552
 					<em>', $txt['post_awaiting_approval'], '</em>
518 553
 				</div>';
554
+			}
519 555
 
520 556
 			echo '
521 557
 				', $post['body'], '
522 558
 			</div>';
523 559
 
524
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
525
-				echo '
560
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
561
+							echo '
526 562
 			<div class="floatright">
527 563
 				<ul class="quickbuttons">';
564
+			}
528 565
 
529 566
 			// If they *can* reply?
530
-			if ($post['can_reply'])
531
-				echo '
567
+			if ($post['can_reply']) {
568
+							echo '
532 569
 					<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
570
+			}
533 571
 
534 572
 			// If they *can* quote?
535
-			if ($post['can_quote'])
536
-				echo '
573
+			if ($post['can_quote']) {
574
+							echo '
537 575
 					<li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>';
576
+			}
538 577
 
539 578
 			// How about... even... remove it entirely?!
540
-			if ($post['can_delete'])
541
-				echo '
579
+			if ($post['can_delete']) {
580
+							echo '
542 581
 					<li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
582
+			}
543 583
 
544
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
545
-				echo '
584
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
585
+							echo '
546 586
 				</ul>
547 587
 			</div><!-- .floatright -->';
588
+			}
548 589
 
549 590
 			echo '
550 591
 		</div><!-- $post[css_class] -->';
551 592
 		}
593
+	} else {
594
+			template_show_list('attachments');
552 595
 	}
553
-	else
554
-		template_show_list('attachments');
555 596
 
556 597
 	// No posts? Just end with a informative message.
557
-	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
558
-		echo '
598
+	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) {
599
+			echo '
559 600
 		<div class="windowbg2">
560 601
 			', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
561 602
 		</div>';
603
+	}
562 604
 
563 605
 	// Show more page numbers.
564
-	if (!empty($context['page_index']))
565
-		echo '
606
+	if (!empty($context['page_index'])) {
607
+			echo '
566 608
 		<div class="pagesection">
567 609
 			<div class="pagelinks">', $context['page_index'], '</div>
568 610
 		</div>';
569
-}
611
+	}
612
+	}
570 613
 
571 614
 /**
572 615
  * Template for showing alerts within the alerts popup
@@ -576,11 +619,12 @@  discard block
 block discarded – undo
576 619
 	global $context, $txt, $scripturl;
577 620
 
578 621
 	// Do we have an update message?
579
-	if (!empty($context['update_message']))
580
-		echo '
622
+	if (!empty($context['update_message'])) {
623
+			echo '
581 624
 		<div class="infobox">
582 625
 			', $context['update_message'], '
583 626
 		</div>';
627
+	}
584 628
 
585 629
 	echo '
586 630
 		<div class="cat_bar">
@@ -589,13 +633,12 @@  discard block
 block discarded – undo
589 633
 			</h3>
590 634
 		</div>';
591 635
 
592
-	if (empty($context['alerts']))
593
-		echo '
636
+	if (empty($context['alerts'])) {
637
+			echo '
594 638
 		<div class="information">
595 639
 			', $txt['alerts_none'], '
596 640
 		</div>';
597
-
598
-	else
641
+	} else
599 642
 	{
600 643
 		// Start the form.
601 644
 		echo '
@@ -657,12 +700,12 @@  discard block
 block discarded – undo
657 700
 		</div>' : '';
658 701
 
659 702
 	// No drafts? Just show an informative message.
660
-	if (empty($context['drafts']))
661
-		echo '
703
+	if (empty($context['drafts'])) {
704
+			echo '
662 705
 		<div class="windowbg2 centertext">
663 706
 			', $txt['draft_none'], '
664 707
 		</div>';
665
-	else
708
+	} else
666 709
 	{
667 710
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
668 711
 		foreach ($context['drafts'] as $draft)
@@ -674,13 +717,15 @@  discard block
 block discarded – undo
674 717
 				<h5>
675 718
 					<strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
676 719
 
677
-			if (!empty($draft['sticky']))
678
-				echo '
720
+			if (!empty($draft['sticky'])) {
721
+							echo '
679 722
 					<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
723
+			}
680 724
 
681
-			if (!empty($draft['locked']))
682
-				echo '
725
+			if (!empty($draft['locked'])) {
726
+							echo '
683 727
 					<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
728
+			}
684 729
 
685 730
 			echo '
686 731
 				</h5>
@@ -713,13 +758,13 @@  discard block
 block discarded – undo
713 758
 {
714 759
 	global $context, $scripturl, $txt;
715 760
 
716
-	if (!empty($context['saved_successful']))
717
-		echo '
761
+	if (!empty($context['saved_successful'])) {
762
+			echo '
718 763
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
719
-
720
-	elseif (!empty($context['saved_failed']))
721
-		echo '
764
+	} elseif (!empty($context['saved_failed'])) {
765
+			echo '
722 766
 	<div class="errorbox">', $context['saved_failed'], '</div>';
767
+	}
723 768
 
724 769
 	echo '
725 770
 	<div id="edit_buddies">
@@ -734,14 +779,16 @@  discard block
 block discarded – undo
734 779
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
735 780
 					<th scope="col">', $txt['status'], '</th>';
736 781
 
737
-	if (allowedTo('moderate_forum'))
738
-		echo '
782
+	if (allowedTo('moderate_forum')) {
783
+			echo '
739 784
 					<th scope="col">', $txt['email'], '</th>';
785
+	}
740 786
 
741
-	if (!empty($context['custom_pf']))
742
-		foreach ($context['custom_pf'] as $column)
787
+	if (!empty($context['custom_pf'])) {
788
+			foreach ($context['custom_pf'] as $column)
743 789
 				echo '
744 790
 					<th scope="col">', $column['label'], '</th>';
791
+	}
745 792
 
746 793
 	echo '
747 794
 					<th scope="col">', $txt['remove'], '</th>
@@ -750,13 +797,14 @@  discard block
 block discarded – undo
750 797
 			<tbody>';
751 798
 
752 799
 	// If they don't have any buddies don't list them!
753
-	if (empty($context['buddies']))
754
-		echo '
800
+	if (empty($context['buddies'])) {
801
+			echo '
755 802
 				<tr class="windowbg">
756 803
 					<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '">
757 804
 						<strong>', $txt['no_buddies'], '</strong>
758 805
 					</td>
759 806
 				</tr>';
807
+	}
760 808
 
761 809
 		// Now loop through each buddy showing info on each.
762 810
 	else
@@ -770,17 +818,19 @@  discard block
 block discarded – undo
770 818
 						<a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a>
771 819
 					</td>';
772 820
 
773
-			if ($buddy['show_email'])
774
-				echo '
821
+			if ($buddy['show_email']) {
822
+							echo '
775 823
 					<td>
776 824
 						<a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a>
777 825
 					</td>';
826
+			}
778 827
 
779 828
 			// Show the custom profile fields for this user.
780
-			if (!empty($context['custom_pf']))
781
-				foreach ($context['custom_pf'] as $key => $column)
829
+			if (!empty($context['custom_pf'])) {
830
+							foreach ($context['custom_pf'] as $key => $column)
782 831
 					echo '
783 832
 					<td class="lefttext">', $buddy['options'][$key], '</td>';
833
+			}
784 834
 
785 835
 			echo '
786 836
 					<td>
@@ -813,9 +863,10 @@  discard block
 block discarded – undo
813 863
 			</dl>
814 864
 		</div>';
815 865
 
816
-	if (!empty($context['token_check']))
817
-		echo '
866
+	if (!empty($context['token_check'])) {
867
+			echo '
818 868
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
869
+	}
819 870
 
820 871
 	echo '
821 872
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -841,13 +892,13 @@  discard block
 block discarded – undo
841 892
 {
842 893
 	global $context, $scripturl, $txt;
843 894
 
844
-	if (!empty($context['saved_successful']))
845
-		echo '
895
+	if (!empty($context['saved_successful'])) {
896
+			echo '
846 897
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
847
-
848
-	elseif (!empty($context['saved_failed']))
849
-		echo '
898
+	} elseif (!empty($context['saved_failed'])) {
899
+			echo '
850 900
 	<div class="errorbox">', $context['saved_failed'], '</div>';
901
+	}
851 902
 
852 903
 	echo '
853 904
 	<div id="edit_buddies">
@@ -862,9 +913,10 @@  discard block
 block discarded – undo
862 913
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
863 914
 					<th scope="col">', $txt['status'], '</th>';
864 915
 
865
-	if (allowedTo('moderate_forum'))
866
-		echo '
916
+	if (allowedTo('moderate_forum')) {
917
+			echo '
867 918
 					<th scope="col">', $txt['email'], '</th>';
919
+	}
868 920
 
869 921
 	echo '
870 922
 					<th scope="col">', $txt['ignore_remove'], '</th>
@@ -873,13 +925,14 @@  discard block
 block discarded – undo
873 925
 			<tbody>';
874 926
 
875 927
 	// If they don't have anyone on their ignore list, don't list it!
876
-	if (empty($context['ignore_list']))
877
-		echo '
928
+	if (empty($context['ignore_list'])) {
929
+			echo '
878 930
 				<tr class="windowbg">
879 931
 					<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '">
880 932
 						<strong>', $txt['no_ignore'], '</strong>
881 933
 					</td>
882 934
 				</tr>';
935
+	}
883 936
 
884 937
 	// Now loop through each buddy showing info on each.
885 938
 	foreach ($context['ignore_list'] as $member)
@@ -891,11 +944,12 @@  discard block
 block discarded – undo
891 944
 						<a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a>
892 945
 					</td>';
893 946
 
894
-		if ($member['show_email'])
895
-			echo '
947
+		if ($member['show_email']) {
948
+					echo '
896 949
 					<td>
897 950
 						<a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a>
898 951
 					</td>';
952
+		}
899 953
 		echo '
900 954
 					<td>
901 955
 						<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a>
@@ -925,9 +979,10 @@  discard block
 block discarded – undo
925 979
 			</dl>
926 980
 		</div>';
927 981
 
928
-	if (!empty($context['token_check']))
929
-		echo '
982
+	if (!empty($context['token_check'])) {
983
+			echo '
930 984
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
985
+	}
931 986
 
932 987
 	echo '
933 988
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -973,9 +1028,10 @@  discard block
 block discarded – undo
973 1028
 					<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
974 1029
 
975 1030
 	// Second address detected?
976
-	if (!empty($context['last_ip2']))
977
-		echo '
1031
+	if (!empty($context['last_ip2'])) {
1032
+			echo '
978 1033
 					, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
1034
+	}
979 1035
 
980 1036
 	echo '
981 1037
 				</dd>';
@@ -1041,9 +1097,10 @@  discard block
 block discarded – undo
1041 1097
 		</div>
1042 1098
 		<div class="windowbg2 noup">';
1043 1099
 
1044
-		foreach ($context['whois_servers'] as $server)
1045
-			echo '
1100
+		foreach ($context['whois_servers'] as $server) {
1101
+					echo '
1046 1102
 			<a href="', $server['url'], '" target="_blank" rel="noopener"', '>', $server['name'], '</a><br>';
1103
+		}
1047 1104
 		echo '
1048 1105
 		</div>
1049 1106
 		<br>';
@@ -1055,13 +1112,12 @@  discard block
 block discarded – undo
1055 1112
 			<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
1056 1113
 		</div>';
1057 1114
 
1058
-	if (empty($context['ips']))
1059
-		echo '
1115
+	if (empty($context['ips'])) {
1116
+			echo '
1060 1117
 		<p class="windowbg2 description">
1061 1118
 			<em>', $txt['no_members_from_ip'], '</em>
1062 1119
 		</p>';
1063
-
1064
-	else
1120
+	} else
1065 1121
 	{
1066 1122
 		echo '
1067 1123
 		<table class="table_grid">
@@ -1074,12 +1130,13 @@  discard block
 block discarded – undo
1074 1130
 			<tbody>';
1075 1131
 
1076 1132
 		// Loop through each of the members and display them.
1077
-		foreach ($context['ips'] as $ip => $memberlist)
1078
-			echo '
1133
+		foreach ($context['ips'] as $ip => $memberlist) {
1134
+					echo '
1079 1135
 				<tr class="windowbg">
1080 1136
 					<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
1081 1137
 					<td>', implode(', ', $memberlist), '</td>
1082 1138
 				</tr>';
1139
+		}
1083 1140
 
1084 1141
 		echo '
1085 1142
 			</tbody>
@@ -1121,11 +1178,10 @@  discard block
 block discarded – undo
1121 1178
 			</h3>
1122 1179
 		</div>';
1123 1180
 
1124
-	if ($context['member']['has_all_permissions'])
1125
-		echo '
1181
+	if ($context['member']['has_all_permissions']) {
1182
+			echo '
1126 1183
 		<div class="information">', $txt['showPermissions_all'], '</div>';
1127
-
1128
-	else
1184
+	} else
1129 1185
 	{
1130 1186
 		echo '
1131 1187
 		<div class="information">',$txt['showPermissions_help'], '</div>
@@ -1140,9 +1196,10 @@  discard block
 block discarded – undo
1140 1196
 			<div class="windowbg smalltext">
1141 1197
 				', $txt['showPermissions_restricted_boards_desc'], ':<br>';
1142 1198
 
1143
-			foreach ($context['no_access_boards'] as $no_access_board)
1144
-				echo '
1199
+			foreach ($context['no_access_boards'] as $no_access_board) {
1200
+							echo '
1145 1201
 				<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
1202
+			}
1146 1203
 			echo '
1147 1204
 			</div>';
1148 1205
 		}
@@ -1174,12 +1231,13 @@  discard block
 block discarded – undo
1174 1231
 							</td>
1175 1232
 							<td class="smalltext">';
1176 1233
 
1177
-				if ($permission['is_denied'])
1178
-					echo '
1234
+				if ($permission['is_denied']) {
1235
+									echo '
1179 1236
 								<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>';
1180
-				else
1181
-					echo '
1237
+				} else {
1238
+									echo '
1182 1239
 								', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']);
1240
+				}
1183 1241
 
1184 1242
 				echo '
1185 1243
 							</td>
@@ -1190,10 +1248,10 @@  discard block
 block discarded – undo
1190 1248
 				</table>
1191 1249
 			</div><!-- .tborder -->
1192 1250
 			<br>';
1193
-		}
1194
-		else
1195
-			echo '
1251
+		} else {
1252
+					echo '
1196 1253
 			<p class="windowbg2">', $txt['showPermissions_none_general'], '</p>';
1254
+		}
1197 1255
 
1198 1256
 		// Board permission section.
1199 1257
 		echo '
@@ -1204,14 +1262,16 @@  discard block
 block discarded – undo
1204 1262
 						<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
1205 1263
 							<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>';
1206 1264
 
1207
-		if (!empty($context['boards']))
1208
-			echo '
1265
+		if (!empty($context['boards'])) {
1266
+					echo '
1209 1267
 							<option value="" disabled>---------------------------</option>';
1268
+		}
1210 1269
 
1211 1270
 		// Fill the box with any local permission boards.
1212
-		foreach ($context['boards'] as $board)
1213
-			echo '
1271
+		foreach ($context['boards'] as $board) {
1272
+					echo '
1214 1273
 							<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
1274
+		}
1215 1275
 
1216 1276
 		echo '
1217 1277
 						</select>
@@ -1240,13 +1300,13 @@  discard block
 block discarded – undo
1240 1300
 						</td>
1241 1301
 						<td class="smalltext">';
1242 1302
 
1243
-				if ($permission['is_denied'])
1244
-					echo '
1303
+				if ($permission['is_denied']) {
1304
+									echo '
1245 1305
 							<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>';
1246
-
1247
-				else
1248
-					echo '
1306
+				} else {
1307
+									echo '
1249 1308
 							', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']);
1309
+				}
1250 1310
 
1251 1311
 				echo '
1252 1312
 						</td>
@@ -1255,10 +1315,10 @@  discard block
 block discarded – undo
1255 1315
 			echo '
1256 1316
 				</tbody>
1257 1317
 			</table>';
1258
-		}
1259
-		else
1260
-			echo '
1318
+		} else {
1319
+					echo '
1261 1320
 			<p class="windowbg2">', $txt['showPermissions_none_board'], '</p>';
1321
+		}
1262 1322
 	echo '
1263 1323
 		</div><!-- #permissions -->';
1264 1324
 	}
@@ -1299,9 +1359,10 @@  discard block
 block discarded – undo
1299 1359
 			</div>';
1300 1360
 
1301 1361
 	// If they haven't post at all, don't draw the graph.
1302
-	if (empty($context['posts_by_time']))
1303
-		echo '
1362
+	if (empty($context['posts_by_time'])) {
1363
+			echo '
1304 1364
 			<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1365
+	}
1305 1366
 
1306 1367
 	// Otherwise do!
1307 1368
 	else
@@ -1310,8 +1371,8 @@  discard block
 block discarded – undo
1310 1371
 			<ul class="activity_stats flow_hidden">';
1311 1372
 
1312 1373
 		// The labels.
1313
-		foreach ($context['posts_by_time'] as $time_of_day)
1314
-			echo '
1374
+		foreach ($context['posts_by_time'] as $time_of_day) {
1375
+					echo '
1315 1376
 				<li', $time_of_day['is_last'] ? ' class="last"' : '', '>
1316 1377
 					<div class="bar" style="padding-top: ', ((int) (100 - $time_of_day['relative_percent'])), 'px;" title="', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '">
1317 1378
 						<div style="height: ', (int) $time_of_day['relative_percent'], 'px;">
@@ -1320,6 +1381,7 @@  discard block
 block discarded – undo
1320 1381
 					</div>
1321 1382
 					<span class="stats_hour">', $time_of_day['hour_format'], '</span>
1322 1383
 				</li>';
1384
+		}
1323 1385
 
1324 1386
 		echo '
1325 1387
 			</ul>';
@@ -1338,11 +1400,10 @@  discard block
 block discarded – undo
1338 1400
 					</h3>
1339 1401
 				</div>';
1340 1402
 
1341
-	if (empty($context['popular_boards']))
1342
-		echo '
1403
+	if (empty($context['popular_boards'])) {
1404
+			echo '
1343 1405
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1344
-
1345
-	else
1406
+	} else
1346 1407
 	{
1347 1408
 		echo '
1348 1409
 				<dl class="stats">';
@@ -1372,10 +1433,10 @@  discard block
 block discarded – undo
1372 1433
 					</h3>
1373 1434
 				</div>';
1374 1435
 
1375
-	if (empty($context['board_activity']))
1376
-		echo '
1436
+	if (empty($context['board_activity'])) {
1437
+			echo '
1377 1438
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1378
-	else
1439
+	} else
1379 1440
 	{
1380 1441
 		echo '
1381 1442
 				<dl class="stats">';
@@ -1426,90 +1487,97 @@  discard block
 block discarded – undo
1426 1487
 				<h3 class="catbg profile_hd">';
1427 1488
 
1428 1489
 		// Don't say "Profile" if this isn't the profile...
1429
-		if (!empty($context['profile_header_text']))
1430
-			echo '
1490
+		if (!empty($context['profile_header_text'])) {
1491
+					echo '
1431 1492
 					', $context['profile_header_text'];
1432
-		else
1433
-			echo '
1493
+		} else {
1494
+					echo '
1434 1495
 					', $txt['profile'];
1496
+		}
1435 1497
 
1436 1498
 		echo '
1437 1499
 				</h3>
1438 1500
 			</div>';
1439 1501
 
1440 1502
 	// Have we some description?
1441
-	if ($context['page_desc'])
1442
-		echo '
1503
+	if ($context['page_desc']) {
1504
+			echo '
1443 1505
 			<p class="information">', $context['page_desc'], '</p>';
1506
+	}
1444 1507
 
1445 1508
 	echo '
1446 1509
 			<div class="roundframe">';
1447 1510
 
1448 1511
 	// Any bits at the start?
1449
-	if (!empty($context['profile_prehtml']))
1450
-		echo '
1512
+	if (!empty($context['profile_prehtml'])) {
1513
+			echo '
1451 1514
 				<div>', $context['profile_prehtml'], '</div>';
1515
+	}
1452 1516
 
1453
-	if (!empty($context['profile_fields']))
1454
-		echo '
1517
+	if (!empty($context['profile_fields'])) {
1518
+			echo '
1455 1519
 				<dl class="settings">';
1520
+	}
1456 1521
 
1457 1522
 	// Start the big old loop 'of love.
1458 1523
 	$lastItem = 'hr';
1459 1524
 	foreach ($context['profile_fields'] as $key => $field)
1460 1525
 	{
1461 1526
 		// We add a little hack to be sure we never get more than one hr in a row!
1462
-		if ($lastItem == 'hr' && $field['type'] == 'hr')
1463
-			continue;
1527
+		if ($lastItem == 'hr' && $field['type'] == 'hr') {
1528
+					continue;
1529
+		}
1464 1530
 
1465 1531
 		$lastItem = $field['type'];
1466
-		if ($field['type'] == 'hr')
1467
-			echo '
1532
+		if ($field['type'] == 'hr') {
1533
+					echo '
1468 1534
 				</dl>
1469 1535
 				<hr>
1470 1536
 				<dl class="settings">';
1471
-
1472
-		elseif ($field['type'] == 'callback')
1537
+		} elseif ($field['type'] == 'callback')
1473 1538
 		{
1474 1539
 			if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
1475 1540
 			{
1476 1541
 				$callback_func = 'template_profile_' . $field['callback_func'];
1477 1542
 				$callback_func();
1478 1543
 			}
1479
-		}
1480
-		else
1544
+		} else
1481 1545
 		{
1482 1546
 			echo '
1483 1547
 					<dt>
1484 1548
 						<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
1485 1549
 
1486 1550
 			// Does it have any subtext to show?
1487
-			if (!empty($field['subtext']))
1488
-				echo '
1551
+			if (!empty($field['subtext'])) {
1552
+							echo '
1489 1553
 						<br>
1490 1554
 						<span class="smalltext">', $field['subtext'], '</span>';
1555
+			}
1491 1556
 
1492 1557
 			echo '
1493 1558
 					</dt>
1494 1559
 					<dd>';
1495 1560
 
1496 1561
 			// Want to put something infront of the box?
1497
-			if (!empty($field['preinput']))
1498
-				echo '
1562
+			if (!empty($field['preinput'])) {
1563
+							echo '
1499 1564
 						', $field['preinput'];
1565
+			}
1500 1566
 
1501 1567
 			// What type of data are we showing?
1502
-			if ($field['type'] == 'label')
1503
-				echo '
1568
+			if ($field['type'] == 'label') {
1569
+							echo '
1504 1570
 						', $field['value'];
1571
+			}
1505 1572
 
1506 1573
 			// Maybe it's a text box - very likely!
1507 1574
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url')))
1508 1575
 			{
1509
-				if ($field['type'] == 'int' || $field['type'] == 'float')
1510
-					$type = 'number';
1511
-				else
1512
-					$type = $field['type'];
1576
+				if ($field['type'] == 'int' || $field['type'] == 'float') {
1577
+									$type = 'number';
1578
+				} else {
1579
+									$type = $field['type'];
1580
+				}
1513 1581
 				$step = $field['type'] == 'float' ? ' step="0.1"' : '';
1514 1582
 
1515 1583
 
@@ -1517,10 +1585,11 @@  discard block
 block discarded – undo
1517 1585
 						<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>';
1518 1586
 			}
1519 1587
 			// You "checking" me out? ;)
1520
-			elseif ($field['type'] == 'check')
1521
-				echo '
1588
+			elseif ($field['type'] == 'check') {
1589
+							echo '
1522 1590
 						<input type="hidden" name="', $key, '" value="0">
1523 1591
 						<input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>';
1592
+			}
1524 1593
 
1525 1594
 			// Always fun - select boxes!
1526 1595
 			elseif ($field['type'] == 'select')
@@ -1531,14 +1600,16 @@  discard block
 block discarded – undo
1531 1600
 				if (isset($field['options']))
1532 1601
 				{
1533 1602
 					// Is this some code to generate the options?
1534
-					if (!is_array($field['options']))
1535
-						$field['options'] = $field['options']();
1603
+					if (!is_array($field['options'])) {
1604
+											$field['options'] = $field['options']();
1605
+					}
1536 1606
 
1537 1607
 					// Assuming we now have some!
1538
-					if (is_array($field['options']))
1539
-						foreach ($field['options'] as $value => $name)
1608
+					if (is_array($field['options'])) {
1609
+											foreach ($field['options'] as $value => $name)
1540 1610
 							echo '
1541 1611
 							<option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>';
1612
+					}
1542 1613
 				}
1543 1614
 
1544 1615
 				echo '
@@ -1546,31 +1617,34 @@  discard block
 block discarded – undo
1546 1617
 			}
1547 1618
 
1548 1619
 			// Something to end with?
1549
-			if (!empty($field['postinput']))
1550
-				echo '
1620
+			if (!empty($field['postinput'])) {
1621
+							echo '
1551 1622
 						', $field['postinput'];
1623
+			}
1552 1624
 
1553 1625
 			echo '
1554 1626
 					</dd>';
1555 1627
 		}
1556 1628
 	}
1557 1629
 
1558
-	if (!empty($context['profile_fields']))
1559
-		echo '
1630
+	if (!empty($context['profile_fields'])) {
1631
+			echo '
1560 1632
 				</dl>';
1633
+	}
1561 1634
 
1562 1635
 	// Are there any custom profile fields - if so print them!
1563 1636
 	if (!empty($context['custom_fields']))
1564 1637
 	{
1565
-		if ($lastItem != 'hr')
1566
-			echo '
1638
+		if ($lastItem != 'hr') {
1639
+					echo '
1567 1640
 				<hr>';
1641
+		}
1568 1642
 
1569 1643
 		echo '
1570 1644
 				<dl class="settings">';
1571 1645
 
1572
-		foreach ($context['custom_fields'] as $field)
1573
-			echo '
1646
+		foreach ($context['custom_fields'] as $field) {
1647
+					echo '
1574 1648
 					<dt>
1575 1649
 						<strong>', $field['name'], ': </strong><br>
1576 1650
 						<span class="smalltext">', $field['desc'], '</span>
@@ -1578,6 +1652,7 @@  discard block
 block discarded – undo
1578 1652
 					<dd>
1579 1653
 						', $field['input_html'], '
1580 1654
 					</dd>';
1655
+		}
1581 1656
 
1582 1657
 		echo '
1583 1658
 				</dl>';
@@ -1585,13 +1660,14 @@  discard block
 block discarded – undo
1585 1660
 	}
1586 1661
 
1587 1662
 	// Any closing HTML?
1588
-	if (!empty($context['profile_posthtml']))
1589
-		echo '
1663
+	if (!empty($context['profile_posthtml'])) {
1664
+			echo '
1590 1665
 				<div>', $context['profile_posthtml'], '</div>';
1666
+	}
1591 1667
 
1592 1668
 	// Only show the password box if it's actually needed.
1593
-	if ($context['require_password'])
1594
-		echo '
1669
+	if ($context['require_password']) {
1670
+			echo '
1595 1671
 				<dl class="settings">
1596 1672
 					<dt>
1597 1673
 						<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br>
@@ -1601,18 +1677,21 @@  discard block
 block discarded – undo
1601 1677
 						<input type="password" name="oldpasswrd" id="oldpasswrd" size="20">
1602 1678
 					</dd>
1603 1679
 				</dl>';
1680
+	}
1604 1681
 
1605 1682
 	// The button shouldn't say "Change profile" unless we're changing the profile...
1606
-	if (!empty($context['submit_button_text']))
1607
-		echo '
1683
+	if (!empty($context['submit_button_text'])) {
1684
+			echo '
1608 1685
 				<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button floatright">';
1609
-	else
1610
-		echo '
1686
+	} else {
1687
+			echo '
1611 1688
 				<input type="submit" name="save" value="', $txt['change_profile'], '" class="button floatright">';
1689
+	}
1612 1690
 
1613
-	if (!empty($context['token_check']))
1614
-		echo '
1691
+	if (!empty($context['token_check'])) {
1692
+			echo '
1615 1693
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1694
+	}
1616 1695
 
1617 1696
 	echo '
1618 1697
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1622,10 +1701,11 @@  discard block
 block discarded – undo
1622 1701
 		</form>';
1623 1702
 
1624 1703
 	// Any final spellchecking stuff?
1625
-	if (!empty($context['show_spellchecking']))
1626
-		echo '
1704
+	if (!empty($context['show_spellchecking'])) {
1705
+			echo '
1627 1706
 		<form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>';
1628
-}
1707
+	}
1708
+	}
1629 1709
 
1630 1710
 /**
1631 1711
  * Personal Message settings.
@@ -1662,10 +1742,11 @@  discard block
 block discarded – undo
1662 1742
 						<select name="pm_receive_from" id="pm_receive_from">
1663 1743
 							<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
1664 1744
 
1665
-	if (!empty($modSettings['enable_buddylist']))
1666
-		echo '
1745
+	if (!empty($modSettings['enable_buddylist'])) {
1746
+			echo '
1667 1747
 							<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
1668 1748
 							<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
1749
+	}
1669 1750
 
1670 1751
 	echo '
1671 1752
 							<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
@@ -1708,11 +1789,12 @@  discard block
 block discarded – undo
1708 1789
 		if (empty($setting) || !is_array($setting))
1709 1790
 		{
1710 1791
 			// Insert a separator (unless this is the first item in the list)
1711
-			if ($i !== $first_option_key)
1712
-				echo '
1792
+			if ($i !== $first_option_key) {
1793
+							echo '
1713 1794
 				</dl>
1714 1795
 				<hr>
1715 1796
 				<dl class="settings">';
1797
+			}
1716 1798
 
1717 1799
 			// Should we give a name to this section?
1718 1800
 			if (is_string($setting) && !empty($setting))
@@ -1721,69 +1803,67 @@  discard block
 block discarded – undo
1721 1803
 				echo '
1722 1804
 					<dt><strong>' . $setting . '</strong></dt>
1723 1805
 					<dd></dd>';
1806
+			} else {
1807
+							$titled_section = false;
1724 1808
 			}
1725
-			else
1726
-				$titled_section = false;
1727 1809
 
1728 1810
 			continue;
1729 1811
 		}
1730 1812
 
1731 1813
 		// Is this disabled?
1732
-		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
1733
-			continue;
1734
-
1735
-		elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
1736
-			continue;
1737
-
1738
-		elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
1739
-			continue;
1740
-
1741
-		elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
1742
-			continue;
1743
-
1744
-		elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
1745
-			continue;
1746
-
1747
-		elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1748
-			continue;
1749
-
1750
-		elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1751
-			continue;
1814
+		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) {
1815
+					continue;
1816
+		} elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) {
1817
+					continue;
1818
+		} elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) {
1819
+					continue;
1820
+		} elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) {
1821
+					continue;
1822
+		} elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) {
1823
+					continue;
1824
+		} elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1825
+					continue;
1826
+		} elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1827
+					continue;
1828
+		}
1752 1829
 
1753 1830
 		// Some of these may not be set...  Set to defaults here
1754 1831
 		$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod');
1755
-		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']]))
1756
-			$context['member']['options'][$setting['id']] = 0;
1757
-
1758
-		if (!isset($setting['type']) || $setting['type'] == 'bool')
1759
-			$setting['type'] = 'checkbox';
1760
-
1761
-		elseif ($setting['type'] == 'int' || $setting['type'] == 'integer')
1762
-			$setting['type'] = 'number';
1832
+		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) {
1833
+					$context['member']['options'][$setting['id']] = 0;
1834
+		}
1763 1835
 
1764
-		elseif ($setting['type'] == 'string')
1765
-			$setting['type'] = 'text';
1836
+		if (!isset($setting['type']) || $setting['type'] == 'bool') {
1837
+					$setting['type'] = 'checkbox';
1838
+		} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
1839
+					$setting['type'] = 'number';
1840
+		} elseif ($setting['type'] == 'string') {
1841
+					$setting['type'] = 'text';
1842
+		}
1766 1843
 
1767
-		if (isset($setting['options']))
1768
-			$setting['type'] = 'list';
1844
+		if (isset($setting['options'])) {
1845
+					$setting['type'] = 'list';
1846
+		}
1769 1847
 
1770 1848
 		echo '
1771 1849
 					<dt>
1772 1850
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
1773 1851
 
1774
-		if (isset($setting['description']))
1775
-			echo '
1852
+		if (isset($setting['description'])) {
1853
+					echo '
1776 1854
 						<br>
1777 1855
 						<span class="smalltext">', $setting['description'], '</span>';
1856
+		}
1778 1857
 		echo '
1779 1858
 					</dt>
1780 1859
 					<dd>';
1781 1860
 
1782 1861
 		// Display checkbox options
1783
-		if ($setting['type'] == 'checkbox')
1784
-			echo '
1862
+		if ($setting['type'] == 'checkbox') {
1863
+					echo '
1785 1864
 						<input type="hidden" name="default_options[' . $setting['id'] . ']" value="0">
1786 1865
 						<input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">';
1866
+		}
1787 1867
 
1788 1868
 		// How about selection lists, we all love them
1789 1869
 		elseif ($setting['type'] == 'list')
@@ -1791,9 +1871,10 @@  discard block
 block discarded – undo
1791 1871
 			echo '
1792 1872
 						<select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>';
1793 1873
 
1794
-			foreach ($setting['options'] as $value => $label)
1795
-				echo '
1874
+			foreach ($setting['options'] as $value => $label) {
1875
+							echo '
1796 1876
 							<option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>';
1877
+			}
1797 1878
 
1798 1879
 			echo '
1799 1880
 						</select>';
@@ -1809,14 +1890,13 @@  discard block
 block discarded – undo
1809 1890
 
1810 1891
 				echo '
1811 1892
 						<input type="number"', $min . $max . $step;
1812
-			}
1813
-			elseif (isset($setting['type']) && $setting['type'] == 'url')
1814
-				echo'
1893
+			} elseif (isset($setting['type']) && $setting['type'] == 'url') {
1894
+							echo'
1815 1895
 						<input type="url"';
1816
-
1817
-			else
1818
-				echo '
1896
+			} else {
1897
+							echo '
1819 1898
 						<input type="text"';
1899
+			}
1820 1900
 
1821 1901
 			echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>';
1822 1902
 		}
@@ -1853,8 +1933,8 @@  discard block
 block discarded – undo
1853 1933
 				<dl class="settings">';
1854 1934
 
1855 1935
 	// Allow notification on announcements to be disabled?
1856
-	if (!empty($modSettings['allow_disableAnnounce']))
1857
-		echo '
1936
+	if (!empty($modSettings['allow_disableAnnounce'])) {
1937
+			echo '
1858 1938
 					<dt>
1859 1939
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
1860 1940
 					</dt>
@@ -1862,15 +1942,17 @@  discard block
 block discarded – undo
1862 1942
 						<input type="hidden" name="notify_announcements" value="0">
1863 1943
 						<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '>
1864 1944
 					</dd>';
1945
+	}
1865 1946
 
1866
-	if (!empty($modSettings['enable_ajax_alerts']))
1867
-		echo '
1947
+	if (!empty($modSettings['enable_ajax_alerts'])) {
1948
+			echo '
1868 1949
 					<dt>
1869 1950
 						<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label>
1870 1951
 					</dt>
1871 1952
 					<dd>
1872 1953
 						<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '">
1873 1954
 					</dd>';
1955
+	}
1874 1956
 
1875 1957
 	echo '
1876 1958
 				</dl>
@@ -1902,9 +1984,10 @@  discard block
 block discarded – undo
1902 1984
 
1903 1985
 				$label = $txt['alert_opt_' . $opts[1]];
1904 1986
 				$label_pos = isset($opts['label']) ? $opts['label'] : '';
1905
-				if ($label_pos == 'before')
1906
-					echo '
1987
+				if ($label_pos == 'before') {
1988
+									echo '
1907 1989
 						<label for="opt_', $opts[1], '">', $label, '</label>';
1990
+				}
1908 1991
 
1909 1992
 				$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
1910 1993
 				switch ($opts[0])
@@ -1918,17 +2001,19 @@  discard block
 block discarded – undo
1918 2001
 						echo '
1919 2002
 						<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
1920 2003
 
1921
-						foreach ($opts['opts'] as $k => $v)
1922
-							echo '
2004
+						foreach ($opts['opts'] as $k => $v) {
2005
+													echo '
1923 2006
 							<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
2007
+						}
1924 2008
 						echo '
1925 2009
 						</select>';
1926 2010
 						break;
1927 2011
 				}
1928 2012
 
1929
-				if ($label_pos == 'after')
1930
-					echo '
2013
+				if ($label_pos == 'after') {
2014
+									echo '
1931 2015
 						<label for="opt_', $opts[1], '">', $label, '</label>';
2016
+				}
1932 2017
 
1933 2018
 				echo '
1934 2019
 					</td>
@@ -2045,11 +2130,12 @@  discard block
 block discarded – undo
2045 2130
 			<p class="information">', $txt['groupMembership_info'], '</p>';
2046 2131
 
2047 2132
 	// Do we have an update message?
2048
-	if (!empty($context['update_message']))
2049
-		echo '
2133
+	if (!empty($context['update_message'])) {
2134
+			echo '
2050 2135
 			<div class="infobox">
2051 2136
 				', $context['update_message'], '.
2052 2137
 			</div>';
2138
+	}
2053 2139
 
2054 2140
 	echo '
2055 2141
 			<div id="groups">';
@@ -2071,8 +2157,7 @@  discard block
 block discarded – undo
2071 2157
 						</div>
2072 2158
 					</div>
2073 2159
 				</div><!-- .groupmembership -->';
2074
-	}
2075
-	else
2160
+	} else
2076 2161
 	{
2077 2162
 		echo '
2078 2163
 				<div class="title_bar">
@@ -2084,27 +2169,30 @@  discard block
 block discarded – undo
2084 2169
 			echo '
2085 2170
 				<div class="windowbg" id="primdiv_', $group['id'], '">';
2086 2171
 
2087
-				if ($context['can_edit_primary'])
2088
-					echo '
2172
+				if ($context['can_edit_primary']) {
2173
+									echo '
2089 2174
 					<input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>';
2175
+				}
2090 2176
 
2091 2177
 				echo '
2092 2178
 					<label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>';
2093 2179
 
2094 2180
 				// Can they leave their group?
2095
-				if ($group['can_leave'])
2096
-					echo '
2181
+				if ($group['can_leave']) {
2182
+									echo '
2097 2183
 					<a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
2184
+				}
2098 2185
 
2099 2186
 				echo '
2100 2187
 				</div><!-- .windowbg -->';
2101 2188
 		}
2102 2189
 
2103
-		if ($context['can_edit_primary'])
2104
-			echo '
2190
+		if ($context['can_edit_primary']) {
2191
+					echo '
2105 2192
 				<div class="padding righttext">
2106 2193
 					<input type="submit" value="', $txt['make_primary'], '" class="button">
2107 2194
 				</div>';
2195
+		}
2108 2196
 
2109 2197
 		// Any groups they can join?
2110 2198
 		if (!empty($context['groups']['available']))
@@ -2120,17 +2208,16 @@  discard block
 block discarded – undo
2120 2208
 				<div class="windowbg">
2121 2209
 					<strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '';
2122 2210
 
2123
-				if ($group['type'] == 3)
2124
-					echo '
2211
+				if ($group['type'] == 3) {
2212
+									echo '
2125 2213
 					<a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>';
2126
-
2127
-				elseif ($group['type'] == 2 && $group['pending'])
2128
-					echo '
2214
+				} elseif ($group['type'] == 2 && $group['pending']) {
2215
+									echo '
2129 2216
 					<span class="floatright">', $txt['approval_pending'], '</span>';
2130
-
2131
-				elseif ($group['type'] == 2)
2132
-					echo '
2217
+				} elseif ($group['type'] == 2) {
2218
+									echo '
2133 2219
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>';
2220
+				}
2134 2221
 
2135 2222
 				echo '
2136 2223
 				</div><!-- .windowbg -->';
@@ -2153,9 +2240,10 @@  discard block
 block discarded – undo
2153 2240
 
2154 2241
 						prevDiv.className = "windowbg";
2155 2242
 					}';
2156
-		if (isset($context['groups']['member'][$context['primary_group']]))
2157
-			echo '
2243
+		if (isset($context['groups']['member'][$context['primary_group']])) {
2244
+					echo '
2158 2245
 					highlightSelected("primdiv_' . $context['primary_group'] . '");';
2246
+		}
2159 2247
 
2160 2248
 		echo '
2161 2249
 				</script>';
@@ -2164,9 +2252,10 @@  discard block
 block discarded – undo
2164 2252
 	echo '
2165 2253
 			</div><!-- #groups -->';
2166 2254
 
2167
-	if (!empty($context['token_check']))
2168
-		echo '
2255
+	if (!empty($context['token_check'])) {
2256
+			echo '
2169 2257
 			<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2258
+	}
2170 2259
 
2171 2260
 	echo '
2172 2261
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2214,14 +2303,15 @@  discard block
 block discarded – undo
2214 2303
 
2215 2304
 		foreach ($category['boards'] as $board)
2216 2305
 		{
2217
-			if ($i == $limit)
2218
-				echo '
2306
+			if ($i == $limit) {
2307
+							echo '
2219 2308
 						</ul>
2220 2309
 					</li>
2221 2310
 				</ul>
2222 2311
 				<ul class="ignoreboards floatright">
2223 2312
 					<li class="category">
2224 2313
 						<ul>';
2314
+			}
2225 2315
 
2226 2316
 			echo '
2227 2317
 							<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
@@ -2267,10 +2357,11 @@  discard block
 block discarded – undo
2267 2357
 
2268 2358
 	// Work out the starting color.
2269 2359
 	$context['current_color'] = $context['colors'][0];
2270
-	foreach ($context['colors'] as $limit => $color)
2271
-		if ($context['member']['warning'] >= $limit)
2360
+	foreach ($context['colors'] as $limit => $color) {
2361
+			if ($context['member']['warning'] >= $limit)
2272 2362
 			$context['current_color'] = $color;
2273
-}
2363
+	}
2364
+	}
2274 2365
 
2275 2366
 // Show all warnings of a user?
2276 2367
 function template_viewWarning()
@@ -2309,14 +2400,15 @@  discard block
 block discarded – undo
2309 2400
 				</dd>';
2310 2401
 
2311 2402
 	// There's some impact of this?
2312
-	if (!empty($context['level_effects'][$context['current_level']]))
2313
-		echo '
2403
+	if (!empty($context['level_effects'][$context['current_level']])) {
2404
+			echo '
2314 2405
 				<dt>
2315 2406
 					<strong>', $txt['profile_viewwarning_impact'], ':</strong>
2316 2407
 				</dt>
2317 2408
 				<dd>
2318 2409
 					', $context['level_effects'][$context['current_level']], '
2319 2410
 				</dd>';
2411
+	}
2320 2412
 
2321 2413
 	echo '
2322 2414
 			</dl>
@@ -2354,10 +2446,11 @@  discard block
 block discarded – undo
2354 2446
 
2355 2447
 			// Otherwise see what we can do...';
2356 2448
 
2357
-	foreach ($context['notification_templates'] as $k => $type)
2358
-		echo '
2449
+	foreach ($context['notification_templates'] as $k => $type) {
2450
+			echo '
2359 2451
 			if (index == ', $k, ')
2360 2452
 				document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
2453
+	}
2361 2454
 
2362 2455
 	echo '
2363 2456
 		}
@@ -2367,10 +2460,11 @@  discard block
 block discarded – undo
2367 2460
 			// Also set the right effect.
2368 2461
 			effectText = "";';
2369 2462
 
2370
-	foreach ($context['level_effects'] as $limit => $text)
2371
-		echo '
2463
+	foreach ($context['level_effects'] as $limit => $text) {
2464
+			echo '
2372 2465
 			if (slideAmount >= ', $limit, ')
2373 2466
 				effectText = "', $text, '";';
2467
+	}
2374 2468
 
2375 2469
 	echo '
2376 2470
 			setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\');
@@ -2385,32 +2479,35 @@  discard block
 block discarded – undo
2385 2479
 			</h3>
2386 2480
 		</div>';
2387 2481
 
2388
-	if (!$context['user']['is_owner'])
2389
-		echo '
2482
+	if (!$context['user']['is_owner']) {
2483
+			echo '
2390 2484
 		<p class="information">', $txt['profile_warning_desc'], '</p>';
2485
+	}
2391 2486
 
2392 2487
 	echo '
2393 2488
 		<div class="windowbg">
2394 2489
 			<dl class="settings">';
2395 2490
 
2396
-	if (!$context['user']['is_owner'])
2397
-		echo '
2491
+	if (!$context['user']['is_owner']) {
2492
+			echo '
2398 2493
 				<dt>
2399 2494
 					<strong>', $txt['profile_warning_name'], ':</strong>
2400 2495
 				</dt>
2401 2496
 				<dd>
2402 2497
 					<strong>', $context['member']['name'], '</strong>
2403 2498
 				</dd>';
2499
+	}
2404 2500
 
2405 2501
 	echo '
2406 2502
 				<dt>
2407 2503
 					<strong>', $txt['profile_warning_level'], ':</strong>';
2408 2504
 
2409 2505
 	// Is there only so much they can apply?
2410
-	if ($context['warning_limit'])
2411
-		echo '
2506
+	if ($context['warning_limit']) {
2507
+			echo '
2412 2508
 					<br>
2413 2509
 					<span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
2510
+	}
2414 2511
 
2415 2512
 	echo '
2416 2513
 				</dt>
@@ -2465,9 +2562,10 @@  discard block
 block discarded – undo
2465 2562
 						<option value="-1">', $txt['profile_warning_notify_template'], '</option>
2466 2563
 						<option value="-1" disabled>------------------------------</option>';
2467 2564
 
2468
-		foreach ($context['notification_templates'] as $id_template => $template)
2469
-			echo '
2565
+		foreach ($context['notification_templates'] as $id_template => $template) {
2566
+					echo '
2470 2567
 						<option value="', $id_template, '">', $template['title'], '</option>';
2568
+		}
2471 2569
 
2472 2570
 		echo '
2473 2571
 					</select>
@@ -2480,9 +2578,10 @@  discard block
 block discarded – undo
2480 2578
 			</dl>
2481 2579
 			<div class="righttext">';
2482 2580
 
2483
-	if (!empty($context['token_check']))
2484
-		echo '
2581
+	if (!empty($context['token_check'])) {
2582
+			echo '
2485 2583
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2584
+	}
2486 2585
 
2487 2586
 	echo '
2488 2587
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2498,8 +2597,8 @@  discard block
 block discarded – undo
2498 2597
 	echo '
2499 2598
 	<script>';
2500 2599
 
2501
-	if (!$context['user']['is_owner'])
2502
-		echo '
2600
+	if (!$context['user']['is_owner']) {
2601
+			echo '
2503 2602
 		modifyWarnNotify();
2504 2603
 		$(document).ready(function() {
2505 2604
 			$("#preview_button").click(function() {
@@ -2538,6 +2637,7 @@  discard block
 block discarded – undo
2538 2637
 			});
2539 2638
 			return false;
2540 2639
 		}';
2640
+	}
2541 2641
 
2542 2642
 	echo '
2543 2643
 	</script>';
@@ -2560,17 +2660,19 @@  discard block
 block discarded – undo
2560 2660
 			</div>';
2561 2661
 
2562 2662
 	// If deleting another account give them a lovely info box.
2563
-	if (!$context['user']['is_owner'])
2564
-		echo '
2663
+	if (!$context['user']['is_owner']) {
2664
+			echo '
2565 2665
 			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2666
+	}
2566 2667
 
2567 2668
 	echo '
2568 2669
 			<div class="windowbg2">';
2569 2670
 
2570 2671
 	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2571
-	if ($context['needs_approval'])
2572
-		echo '
2672
+	if ($context['needs_approval']) {
2673
+			echo '
2573 2674
 				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2675
+	}
2574 2676
 
2575 2677
 	// If the user is deleting their own account warn them first - and require a password!
2576 2678
 	if ($context['user']['is_owner'])
@@ -2582,9 +2684,10 @@  discard block
 block discarded – undo
2582 2684
 					<input type="password" name="oldpasswrd" size="20">
2583 2685
 					<input type="submit" value="', $txt['yes'], '" class="button">';
2584 2686
 
2585
-		if (!empty($context['token_check']))
2586
-			echo '
2687
+		if (!empty($context['token_check'])) {
2688
+					echo '
2587 2689
 					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2690
+		}
2588 2691
 
2589 2692
 		echo '
2590 2693
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2614,10 +2717,11 @@  discard block
 block discarded – undo
2614 2717
 						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2615 2718
 					</select>';
2616 2719
 
2617
-			if ($context['show_perma_delete'])
2618
-				echo '
2720
+			if ($context['show_perma_delete']) {
2721
+							echo '
2619 2722
 					<br>
2620 2723
 					<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
2724
+			}
2621 2725
 
2622 2726
 			echo '
2623 2727
 				</div>';
@@ -2630,9 +2734,10 @@  discard block
 block discarded – undo
2630 2734
 				<div>
2631 2735
 					<input type="submit" value="', $txt['delete'], '" class="button">';
2632 2736
 
2633
-		if (!empty($context['token_check']))
2634
-			echo '
2737
+		if (!empty($context['token_check'])) {
2738
+					echo '
2635 2739
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2740
+		}
2636 2741
 
2637 2742
 		echo '
2638 2743
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2658,8 +2763,8 @@  discard block
 block discarded – undo
2658 2763
 					<hr>';
2659 2764
 
2660 2765
 	// Only show the password box if it's actually needed.
2661
-	if ($context['require_password'])
2662
-		echo '
2766
+	if ($context['require_password']) {
2767
+			echo '
2663 2768
 					<dl class="settings">
2664 2769
 						<dt>
2665 2770
 							<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
@@ -2669,13 +2774,15 @@  discard block
 block discarded – undo
2669 2774
 							<input type="password" name="oldpasswrd" size="20">
2670 2775
 						</dd>
2671 2776
 					</dl>';
2777
+	}
2672 2778
 
2673 2779
 	echo '
2674 2780
 					<div class="righttext">';
2675 2781
 
2676
-	if (!empty($context['token_check']))
2677
-		echo '
2782
+	if (!empty($context['token_check'])) {
2783
+			echo '
2678 2784
 						<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2785
+	}
2679 2786
 
2680 2787
 	echo '
2681 2788
 						<input type="submit" value="', $txt['change_profile'], '" class="button">
@@ -2702,9 +2809,10 @@  discard block
 block discarded – undo
2702 2809
 			<ul id="list_errors">';
2703 2810
 
2704 2811
 		// Cycle through each error and display an error message.
2705
-		foreach ($context['post_errors'] as $error)
2706
-			echo '
2812
+		foreach ($context['post_errors'] as $error) {
2813
+					echo '
2707 2814
 				<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
2815
+		}
2708 2816
 
2709 2817
 		echo '
2710 2818
 			</ul>';
@@ -2730,12 +2838,13 @@  discard block
 block discarded – undo
2730 2838
 								<select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 &amp;&amp; !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>';
2731 2839
 
2732 2840
 	// Fill the select box with all primary member groups that can be assigned to a member.
2733
-	foreach ($context['member_groups'] as $member_group)
2734
-		if (!empty($member_group['can_be_primary']))
2841
+	foreach ($context['member_groups'] as $member_group) {
2842
+			if (!empty($member_group['can_be_primary']))
2735 2843
 			echo '
2736 2844
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
2737 2845
 										', $member_group['name'], '
2738 2846
 									</option>';
2847
+	}
2739 2848
 
2740 2849
 	echo '
2741 2850
 								</select>
@@ -2748,10 +2857,11 @@  discard block
 block discarded – undo
2748 2857
 									<input type="hidden" name="additional_groups[]" value="0">';
2749 2858
 
2750 2859
 	// For each membergroup show a checkbox so members can be assigned to more than one group.
2751
-	foreach ($context['member_groups'] as $member_group)
2752
-		if ($member_group['can_be_additional'])
2860
+	foreach ($context['member_groups'] as $member_group) {
2861
+			if ($member_group['can_be_additional'])
2753 2862
 			echo '
2754 2863
 									<label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>';
2864
+	}
2755 2865
 
2756 2866
 	echo '
2757 2867
 								</span>
@@ -2811,9 +2921,10 @@  discard block
 block discarded – undo
2811 2921
 								<span class="smalltext">', $txt['sig_info'], '</span><br>
2812 2922
 								<br>';
2813 2923
 
2814
-	if ($context['show_spellchecking'])
2815
-		echo '
2924
+	if ($context['show_spellchecking']) {
2925
+			echo '
2816 2926
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">';
2927
+	}
2817 2928
 
2818 2929
 	echo '
2819 2930
 							</dt>
@@ -2821,17 +2932,20 @@  discard block
 block discarded – undo
2821 2932
 								<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>';
2822 2933
 
2823 2934
 	// If there is a limit at all!
2824
-	if (!empty($context['signature_limits']['max_length']))
2825
-		echo '
2935
+	if (!empty($context['signature_limits']['max_length'])) {
2936
+			echo '
2826 2937
 								<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
2938
+	}
2827 2939
 
2828
-	if (!empty($context['show_preview_button']))
2829
-		echo '
2940
+	if (!empty($context['show_preview_button'])) {
2941
+			echo '
2830 2942
 								<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button floatright">';
2943
+	}
2831 2944
 
2832
-	if ($context['signature_warning'])
2833
-		echo '
2945
+	if ($context['signature_warning']) {
2946
+			echo '
2834 2947
 								<span class="smalltext">', $context['signature_warning'], '</span>';
2948
+	}
2835 2949
 
2836 2950
 	// Some javascript used to count how many characters have been used so far in the signature.
2837 2951
 	echo '
@@ -2876,9 +2990,10 @@  discard block
 block discarded – undo
2876 2990
 										<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
2877 2991
 
2878 2992
 		// This lists all the file categories.
2879
-		foreach ($context['avatars'] as $avatar)
2880
-			echo '
2993
+		foreach ($context['avatars'] as $avatar) {
2994
+					echo '
2881 2995
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
2996
+		}
2882 2997
 
2883 2998
 		echo '
2884 2999
 										</select>
@@ -2910,20 +3025,22 @@  discard block
 block discarded – undo
2910 3025
 	}
2911 3026
 
2912 3027
 	// If the user can link to an off server avatar, show them a box to input the address.
2913
-	if (!empty($context['member']['avatar']['allow_external']))
2914
-		echo '
3028
+	if (!empty($context['member']['avatar']['allow_external'])) {
3029
+			echo '
2915 3030
 								<div id="avatar_external">
2916 3031
 									<div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', '
2917 3032
 									<input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);">
2918 3033
 								</div>';
3034
+	}
2919 3035
 
2920 3036
 	// If the user is able to upload avatars to the server show them an upload box.
2921
-	if (!empty($context['member']['avatar']['allow_upload']))
2922
-		echo '
3037
+	if (!empty($context['member']['avatar']['allow_upload'])) {
3038
+			echo '
2923 3039
 								<div id="avatar_upload">
2924 3040
 									<input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)"  onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), '
2925 3041
 									', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&amp;') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), '
2926 3042
 								</div>';
3043
+	}
2927 3044
 
2928 3045
 	// if the user is able to use Gravatar avatars show then the image preview
2929 3046
 	if (!empty($context['member']['avatar']['allow_gravatar']))
@@ -2932,16 +3049,17 @@  discard block
 block discarded – undo
2932 3049
 								<div id="avatar_gravatar">
2933 3050
 									<img src="' . $context['member']['avatar']['href'] . '" alt="">';
2934 3051
 
2935
-		if (empty($modSettings['gravatarAllowExtraEmail']))
2936
-			echo '
3052
+		if (empty($modSettings['gravatarAllowExtraEmail'])) {
3053
+					echo '
2937 3054
 									<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>';
2938
-		else
3055
+		} else
2939 3056
 		{
2940 3057
 			// Depending on other stuff, the stored value here might have some odd things in it from other areas.
2941
-			if ($context['member']['avatar']['external'] == $context['member']['email'])
2942
-				$textbox_value = '';
2943
-			else
2944
-				$textbox_value = $context['member']['avatar']['external'];
3058
+			if ($context['member']['avatar']['external'] == $context['member']['email']) {
3059
+							$textbox_value = '';
3060
+			} else {
3061
+							$textbox_value = $context['member']['avatar']['external'];
3062
+			}
2945 3063
 
2946 3064
 			echo '
2947 3065
 									<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div>
@@ -3013,8 +3131,9 @@  discard block
 block discarded – undo
3013 3131
 	$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
3014 3132
 
3015 3133
 	$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
3016
-	if (empty($suffix))
3017
-		return;
3134
+	if (empty($suffix)) {
3135
+			return;
3136
+	}
3018 3137
 
3019 3138
 	echo '
3020 3139
 								<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
@@ -3039,9 +3158,10 @@  discard block
 block discarded – undo
3039 3158
 								<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">';
3040 3159
 
3041 3160
 	// Help the user by showing a list of common time formats.
3042
-	foreach ($context['easy_timeformats'] as $time_format)
3043
-		echo '
3161
+	foreach ($context['easy_timeformats'] as $time_format) {
3162
+			echo '
3044 3163
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
3164
+	}
3045 3165
 
3046 3166
 	echo '
3047 3167
 								</select>
@@ -3079,9 +3199,10 @@  discard block
 block discarded – undo
3079 3199
 							<dd>
3080 3200
 								<select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.png\';">';
3081 3201
 
3082
-	foreach ($context['smiley_sets'] as $set)
3083
-		echo '
3202
+	foreach ($context['smiley_sets'] as $set) {
3203
+			echo '
3084 3204
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
3205
+	}
3085 3206
 
3086 3207
 	echo '
3087 3208
 								</select>
@@ -3133,10 +3254,11 @@  discard block
 block discarded – undo
3133 3254
 										<img src="', $context['tfa_qr_url'], '" alt="">
3134 3255
 									</div>';
3135 3256
 
3136
-	if (!empty($context['from_ajax']))
3137
-		echo '
3257
+	if (!empty($context['from_ajax'])) {
3258
+			echo '
3138 3259
 					<br>
3139 3260
 					<a href="javascript:self.close();"></a>';
3261
+	}
3140 3262
 
3141 3263
 	echo '
3142 3264
 				</div>
@@ -3176,17 +3298,16 @@  discard block
 block discarded – undo
3176 3298
 							</dt>
3177 3299
 							<dd>';
3178 3300
 
3179
-	if (!$context['tfa_enabled'] && $context['user']['is_owner'])
3180
-		echo '
3301
+	if (!$context['tfa_enabled'] && $context['user']['is_owner']) {
3302
+			echo '
3181 3303
 								<a href="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>';
3182
-
3183
-	elseif (!$context['tfa_enabled'])
3184
-		echo '
3304
+	} elseif (!$context['tfa_enabled']) {
3305
+			echo '
3185 3306
 								', $txt['tfa_profile_disabled'];
3186
-
3187
-	else
3188
-		echo '
3307
+	} else {
3308
+			echo '
3189 3309
 								', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable');
3310
+	}
3190 3311
 
3191 3312
 	echo '
3192 3313
 							</dd>';
Please login to merge, or discard this patch.