Completed
Pull Request — release-2.1 (#4892)
by Mathias
09:05
created
Sources/Profile-Actions.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1050,15 +1050,15 @@
 block discarded – undo
1050 1050
 }
1051 1051
 
1052 1052
 /**
1053
-  * Formats a line (passed as a fields  array) as CSV and returns the CSV as a string.
1054
-  * from https://stackoverflow.com/questions/3933668/convert-array-into-csv
1053
+ * Formats a line (passed as a fields  array) as CSV and returns the CSV as a string.
1054
+ * from https://stackoverflow.com/questions/3933668/convert-array-into-csv
1055 1055
  * 
1056 1056
  * @param array $fields a line of the array
1057 1057
  * @param string @delimiter the delimiter char
1058 1058
  * @param string @enclosure the enclosure char
1059 1059
  * @param boolean $encloseAll enclose all
1060 1060
  * @param boolean $nullToMysqlNull
1061
-  */
1061
+ */
1062 1062
 function arrayToCsv( array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) {
1063 1063
 	$delimiter_esc = preg_quote($delimiter, '/');
1064 1064
 	$enclosure_esc = preg_quote($enclosure, '/');
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -992,12 +992,12 @@  discard block
 block discarded – undo
992 992
 	{
993 993
 		loadMemberData($memID, false, 'profile');
994 994
 		$profile = $user_profile[$memID];
995
-		$removeFields = array('secret_question','tfa_secret','password_salt');
995
+		$removeFields = array('secret_question', 'tfa_secret', 'password_salt');
996 996
 		foreach ($removeFields as $value)
997 997
 		{
998 998
 			unset($profile[$value]);
999 999
 		}
1000
-		foreach($profile as $key => &$value)
1000
+		foreach ($profile as $key => &$value)
1001 1001
 		{
1002 1002
 			if (is_array($value))
1003 1003
 				$value = $smcFunc['json_encode']($value);
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 	elseif ($mode == 'messages') // messages
1010 1010
 	{
1011 1011
 		
1012
-		$request = $smcFunc['db_query']('','
1012
+		$request = $smcFunc['db_query']('', '
1013 1013
 			SELECT id_msg, id_topic, poster_time, subject, modified_time, modified_name, modified_reason, body, likes, poster_ip
1014 1014
 			FROM {db_prefix}messages 
1015 1015
 			WHERE id_member = {int:memID}',
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 	}
1028 1028
 	elseif ($mode == 'pmessages')
1029 1029
 	{
1030
-		$request = $smcFunc['db_query']('','
1030
+		$request = $smcFunc['db_query']('', '
1031 1031
 			SELECT pm.msgtime, pm.subject, pm.body
1032 1032
 			FROM {db_prefix}personal_messages pm
1033 1033
 			LEFT JOIN {db_prefix}pm_recipients pmr on (pm.id_pm = pmr.id_pm and pmr.id_member = {int:memID})
@@ -1045,14 +1045,14 @@  discard block
 block discarded – undo
1045 1045
 	}
1046 1046
 	$count = count($profileData);
1047 1047
 	$csv_data = '';
1048
-	for($i = 0; $i < $count; $i++)
1048
+	for ($i = 0; $i < $count; $i++)
1049 1049
 	{
1050 1050
 		$csv_data .= arrayToCsv($profileData[$i]) . "\r\n";
1051 1051
 	}
1052 1052
 
1053 1053
 
1054 1054
 	header("Pragma: no-cache");
1055
-	header('Content-Disposition: attachment; filename="privacySMF'.$mode.'.csv";');
1055
+	header('Content-Disposition: attachment; filename="privacySMF' . $mode . '.csv";');
1056 1056
 	header("Content-Length: " . strlen($csv_data));
1057 1057
 	header("Content-Transfer-Encoding: binary");
1058 1058
 	header("Content-Type: application/force-download");
@@ -1071,12 +1071,12 @@  discard block
 block discarded – undo
1071 1071
  * @param boolean $encloseAll enclose all
1072 1072
  * @param boolean $nullToMysqlNull
1073 1073
   */
1074
-function arrayToCsv( array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) {
1074
+function arrayToCsv(array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false) {
1075 1075
 	$delimiter_esc = preg_quote($delimiter, '/');
1076 1076
 	$enclosure_esc = preg_quote($enclosure, '/');
1077 1077
 
1078 1078
 	$output = array();
1079
-	foreach ( $fields as $field )
1079
+	foreach ($fields as $field)
1080 1080
 	{
1081 1081
 		if ($field === null && $nullToMysqlNull)
1082 1082
 		{
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 		}
1086 1086
 
1087 1087
 		// Enclose fields containing $delimiter, $enclosure or whitespace
1088
-		if ( $encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field ) )
1088
+		if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field))
1089 1089
 		{
1090 1090
 			$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
1091 1091
 		}
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 		}
1096 1096
 	}
1097 1097
 
1098
-	return implode( $delimiter, $output );
1098
+	return implode($delimiter, $output);
1099 1099
 }
1100 1100
 
1101 1101
 ?>
1102 1102
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +157 added lines, -114 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Activate an account.
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
 		logAction('approve_member', array('member' => $memID), 'admin');
49 50
 
50 51
 		// If we are doing approval, update the stats for the member just in case.
51
-		if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15)))
52
-			updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0)));
52
+		if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) {
53
+					updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0)));
54
+		}
53 55
 
54 56
 		// Make sure we update the stats too.
55 57
 		updateStats('member', false);
@@ -76,8 +78,9 @@  discard block
 block discarded – undo
76 78
 	$issueErrors = array();
77 79
 
78 80
 	// Doesn't hurt to be overly cautious.
79
-	if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning'))
80
-		fatal_lang_error('no_access', false);
81
+	if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) {
82
+			fatal_lang_error('no_access', false);
83
+	}
81 84
 
82 85
 	// Get the base (errors related) stuff done.
83 86
 	loadLanguage('Errors');
@@ -135,16 +138,18 @@  discard block
 block discarded – undo
135 138
 
136 139
 		// This cannot be empty!
137 140
 		$_POST['warn_reason'] = isset($_POST['warn_reason']) ? trim($_POST['warn_reason']) : '';
138
-		if ($_POST['warn_reason'] == '' && !$context['user']['is_owner'])
139
-			$issueErrors[] = 'warning_no_reason';
141
+		if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) {
142
+					$issueErrors[] = 'warning_no_reason';
143
+		}
140 144
 		$_POST['warn_reason'] = $smcFunc['htmlspecialchars']($_POST['warn_reason']);
141 145
 
142 146
 		$_POST['warning_level'] = (int) $_POST['warning_level'];
143 147
 		$_POST['warning_level'] = max(0, min(100, $_POST['warning_level']));
144
-		if ($_POST['warning_level'] < $context['min_allowed'])
145
-			$_POST['warning_level'] = $context['min_allowed'];
146
-		elseif ($_POST['warning_level'] > $context['max_allowed'])
147
-			$_POST['warning_level'] = $context['max_allowed'];
148
+		if ($_POST['warning_level'] < $context['min_allowed']) {
149
+					$_POST['warning_level'] = $context['min_allowed'];
150
+		} elseif ($_POST['warning_level'] > $context['max_allowed']) {
151
+					$_POST['warning_level'] = $context['max_allowed'];
152
+		}
148 153
 
149 154
 		// Do we actually have to issue them with a PM?
150 155
 		$id_notice = 0;
@@ -152,8 +157,9 @@  discard block
 block discarded – undo
152 157
 		{
153 158
 			$_POST['warn_sub'] = trim($_POST['warn_sub']);
154 159
 			$_POST['warn_body'] = trim($_POST['warn_body']);
155
-			if (empty($_POST['warn_sub']) || empty($_POST['warn_body']))
156
-				$issueErrors[] = 'warning_notify_blank';
160
+			if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) {
161
+							$issueErrors[] = 'warning_notify_blank';
162
+			}
157 163
 			// Send the PM?
158 164
 			else
159 165
 			{
@@ -190,8 +196,8 @@  discard block
 block discarded – undo
190 196
 		if (empty($issueErrors))
191 197
 		{
192 198
 			// Log what we've done!
193
-			if (!$context['user']['is_owner'])
194
-				$smcFunc['db_insert']('',
199
+			if (!$context['user']['is_owner']) {
200
+							$smcFunc['db_insert']('',
195 201
 					'{db_prefix}log_comments',
196 202
 					array(
197 203
 						'id_member' => 'int', 'member_name' => 'string', 'comment_type' => 'string', 'id_recipient' => 'int', 'recipient_name' => 'string-255',
@@ -203,14 +209,14 @@  discard block
 block discarded – undo
203 209
 					),
204 210
 					array('id_comment')
205 211
 				);
212
+			}
206 213
 
207 214
 			// Make the change.
208 215
 			updateMemberData($memID, array('warning' => $_POST['warning_level']));
209 216
 
210 217
 			// Leave a lovely message.
211 218
 			$context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : $txt['profile_warning_success'];
212
-		}
213
-		else
219
+		} else
214 220
 		{
215 221
 			// Try to remember some bits.
216 222
 			$context['warning_data'] = array(
@@ -229,8 +235,9 @@  discard block
 block discarded – undo
229 235
 	{
230 236
 		$warning_body = !empty($_POST['warn_body']) ? trim(censorText($_POST['warn_body'])) : '';
231 237
 		$context['preview_subject'] = !empty($_POST['warn_sub']) ? trim($smcFunc['htmlspecialchars']($_POST['warn_sub'])) : '';
232
-		if (empty($_POST['warn_sub']) || empty($_POST['warn_body']))
233
-			$issueErrors[] = 'warning_notify_blank';
238
+		if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) {
239
+					$issueErrors[] = 'warning_notify_blank';
240
+		}
234 241
 
235 242
 		if (!empty($_POST['warn_body']))
236 243
 		{
@@ -254,8 +261,9 @@  discard block
 block discarded – undo
254 261
 	{
255 262
 		// Fill in the suite of errors.
256 263
 		$context['post_errors'] = array();
257
-		foreach ($issueErrors as $error)
258
-			$context['post_errors'][] = $txt[$error];
264
+		foreach ($issueErrors as $error) {
265
+					$context['post_errors'][] = $txt[$error];
266
+		}
259 267
 	}
260 268
 
261 269
 
@@ -272,9 +280,10 @@  discard block
 block discarded – undo
272 280
 		$modSettings['warning_mute'] => $txt['profile_warning_effect_mute'],
273 281
 	);
274 282
 	$context['current_level'] = 0;
275
-	foreach ($context['level_effects'] as $limit => $dummy)
276
-		if ($context['member']['warning'] >= $limit)
283
+	foreach ($context['level_effects'] as $limit => $dummy) {
284
+			if ($context['member']['warning'] >= $limit)
277 285
 			$context['current_level'] = $limit;
286
+	}
278 287
 
279 288
 	$listOptions = array(
280 289
 		'id' => 'view_warnings',
@@ -337,11 +346,12 @@  discard block
 block discarded – undo
337 346
 							' . $warning['reason'] . '
338 347
 						</div>';
339 348
 
340
-						if (!empty($warning['id_notice']))
341
-							$ret .= '
349
+						if (!empty($warning['id_notice'])) {
350
+													$ret .= '
342 351
 						<div class="floatright">
343 352
 							<a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $warning['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" rel="noopener" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a>
344 353
 						</div>';
354
+						}
345 355
 
346 356
 						return $ret;
347 357
 					},
@@ -412,8 +422,9 @@  discard block
 block discarded – undo
412 422
 	while ($row = $smcFunc['db_fetch_assoc']($request))
413 423
 	{
414 424
 		// If we're not warning for a message skip any that are.
415
-		if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false)
416
-			continue;
425
+		if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) {
426
+					continue;
427
+		}
417 428
 
418 429
 		$context['notification_templates'][] = array(
419 430
 			'title' => $row['template_title'],
@@ -423,16 +434,18 @@  discard block
 block discarded – undo
423 434
 	$smcFunc['db_free_result']($request);
424 435
 
425 436
 	// Setup the "default" templates.
426
-	foreach (array('spamming', 'offence', 'insulting') as $type)
427
-		$context['notification_templates'][] = array(
437
+	foreach (array('spamming', 'offence', 'insulting') as $type) {
438
+			$context['notification_templates'][] = array(
428 439
 			'title' => $txt['profile_warning_notify_title_' . $type],
429 440
 			'body' => sprintf($txt['profile_warning_notify_template_outline' . (!empty($context['warning_for_message']) ? '_post' : '')], $txt['profile_warning_notify_for_' . $type]),
430 441
 		);
442
+	}
431 443
 
432 444
 	// Replace all the common variables in the templates.
433
-	foreach ($context['notification_templates'] as $k => $name)
434
-		$context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team']));
435
-}
445
+	foreach ($context['notification_templates'] as $k => $name) {
446
+			$context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team']));
447
+	}
448
+	}
436 449
 
437 450
 /**
438 451
  * Get the number of warnings a user has. Callback for $listOptions['get_count'] in issueWarning()
@@ -516,10 +529,11 @@  discard block
 block discarded – undo
516 529
 {
517 530
 	global $txt, $context, $modSettings, $cur_profile;
518 531
 
519
-	if (!$context['user']['is_owner'])
520
-		isAllowedTo('profile_remove_any');
521
-	elseif (!allowedTo('profile_remove_any'))
522
-		isAllowedTo('profile_remove_own');
532
+	if (!$context['user']['is_owner']) {
533
+			isAllowedTo('profile_remove_any');
534
+	} elseif (!allowedTo('profile_remove_any')) {
535
+			isAllowedTo('profile_remove_own');
536
+	}
523 537
 
524 538
 	// Permissions for removing stuff...
525 539
 	$context['can_delete_posts'] = !$context['user']['is_owner'] && allowedTo('moderate_forum');
@@ -546,10 +560,11 @@  discard block
 block discarded – undo
546 560
 
547 561
 	// @todo Add a way to delete pms as well?
548 562
 
549
-	if (!$context['user']['is_owner'])
550
-		isAllowedTo('profile_remove_any');
551
-	elseif (!allowedTo('profile_remove_any'))
552
-		isAllowedTo('profile_remove_own');
563
+	if (!$context['user']['is_owner']) {
564
+			isAllowedTo('profile_remove_any');
565
+	} elseif (!allowedTo('profile_remove_any')) {
566
+			isAllowedTo('profile_remove_own');
567
+	}
553 568
 
554 569
 	checkSession();
555 570
 
@@ -575,8 +590,9 @@  discard block
 block discarded – undo
575 590
 		list ($another) = $smcFunc['db_fetch_row']($request);
576 591
 		$smcFunc['db_free_result']($request);
577 592
 
578
-		if (empty($another))
579
-			fatal_lang_error('at_least_one_admin', 'critical');
593
+		if (empty($another)) {
594
+					fatal_lang_error('at_least_one_admin', 'critical');
595
+		}
580 596
 	}
581 597
 
582 598
 	// This file is needed for the deleteMembers function.
@@ -655,8 +671,9 @@  discard block
 block discarded – undo
655 671
 					)
656 672
 				);
657 673
 				$topicIDs = array();
658
-				while ($row = $smcFunc['db_fetch_assoc']($request))
659
-					$topicIDs[] = $row['id_topic'];
674
+				while ($row = $smcFunc['db_fetch_assoc']($request)) {
675
+									$topicIDs[] = $row['id_topic'];
676
+				}
660 677
 				$smcFunc['db_free_result']($request);
661 678
 
662 679
 				// Actually remove the topics. Ignore recycling if we want to perma-delete things...
@@ -679,8 +696,9 @@  discard block
 block discarded – undo
679 696
 			// This could take a while... but ya know it's gonna be worth it in the end.
680 697
 			while ($row = $smcFunc['db_fetch_assoc']($request))
681 698
 			{
682
-				if (function_exists('apache_reset_timeout'))
683
-					@apache_reset_timeout();
699
+				if (function_exists('apache_reset_timeout')) {
700
+									@apache_reset_timeout();
701
+				}
684 702
 
685 703
 				removeMessage($row['id_msg']);
686 704
 			}
@@ -688,8 +706,9 @@  discard block
 block discarded – undo
688 706
 		}
689 707
 
690 708
 		// Only delete this poor members account if they are actually being booted out of camp.
691
-		if (isset($_POST['deleteAccount']))
692
-			deleteMembers($memID);
709
+		if (isset($_POST['deleteAccount'])) {
710
+					deleteMembers($memID);
711
+		}
693 712
 	}
694 713
 	// Do they need approval to delete?
695 714
 	elseif (!empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum'))
@@ -740,18 +759,18 @@  discard block
 block discarded – undo
740 759
 		{
741 760
 			foreach ($costs as $duration => $cost)
742 761
 			{
743
-				if ($cost != 0)
744
-					$cost_array[$duration] = $cost;
762
+				if ($cost != 0) {
763
+									$cost_array[$duration] = $cost;
764
+				}
745 765
 			}
746
-		}
747
-		else
766
+		} else
748 767
 		{
749 768
 			$cost_array['fixed'] = $costs['fixed'];
750 769
 		}
751 770
 
752
-		if (empty($cost_array))
753
-			unset($context['subscriptions'][$id]);
754
-		else
771
+		if (empty($cost_array)) {
772
+					unset($context['subscriptions'][$id]);
773
+		} else
755 774
 		{
756 775
 			$context['subscriptions'][$id]['member'] = 0;
757 776
 			$context['subscriptions'][$id]['subscribed'] = false;
@@ -764,13 +783,15 @@  discard block
 block discarded – undo
764 783
 	foreach ($gateways as $id => $gateway)
765 784
 	{
766 785
 		$gateways[$id] = new $gateway['display_class']();
767
-		if (!$gateways[$id]->gatewayEnabled())
768
-			unset($gateways[$id]);
786
+		if (!$gateways[$id]->gatewayEnabled()) {
787
+					unset($gateways[$id]);
788
+		}
769 789
 	}
770 790
 
771 791
 	// No gateways yet?
772
-	if (empty($gateways))
773
-		fatal_error($txt['paid_admin_not_setup_gateway']);
792
+	if (empty($gateways)) {
793
+			fatal_error($txt['paid_admin_not_setup_gateway']);
794
+	}
774 795
 
775 796
 	// Get the current subscriptions.
776 797
 	$request = $smcFunc['db_query']('', '
@@ -785,8 +806,9 @@  discard block
 block discarded – undo
785 806
 	while ($row = $smcFunc['db_fetch_assoc']($request))
786 807
 	{
787 808
 		// The subscription must exist!
788
-		if (!isset($context['subscriptions'][$row['id_subscribe']]))
789
-			continue;
809
+		if (!isset($context['subscriptions'][$row['id_subscribe']])) {
810
+					continue;
811
+		}
790 812
 
791 813
 		$context['current'][$row['id_subscribe']] = array(
792 814
 			'id' => $row['id_sublog'],
@@ -800,8 +822,9 @@  discard block
 block discarded – undo
800 822
 			'status_text' => $row['status'] == 0 ? ($row['payments_pending'] ? $txt['paid_pending'] : $txt['paid_finished']) : $txt['paid_active'],
801 823
 		);
802 824
 
803
-		if ($row['status'] == 1)
804
-			$context['subscriptions'][$row['id_subscribe']]['subscribed'] = true;
825
+		if ($row['status'] == 1) {
826
+					$context['subscriptions'][$row['id_subscribe']]['subscribed'] = true;
827
+		}
805 828
 	}
806 829
 	$smcFunc['db_free_result']($request);
807 830
 
@@ -852,21 +875,25 @@  discard block
 block discarded – undo
852 875
 	if (isset($_GET['confirm']) && isset($_POST['sub_id']) && is_array($_POST['sub_id']))
853 876
 	{
854 877
 		// Hopefully just one.
855
-		foreach ($_POST['sub_id'] as $k => $v)
856
-			$ID_SUB = (int) $k;
878
+		foreach ($_POST['sub_id'] as $k => $v) {
879
+					$ID_SUB = (int) $k;
880
+		}
857 881
 
858
-		if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0)
859
-			fatal_lang_error('paid_sub_not_active');
882
+		if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) {
883
+					fatal_lang_error('paid_sub_not_active');
884
+		}
860 885
 
861 886
 		// Simplify...
862 887
 		$context['sub'] = $context['subscriptions'][$ID_SUB];
863 888
 		$period = 'xx';
864
-		if ($context['sub']['flexible'])
865
-			$period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx';
889
+		if ($context['sub']['flexible']) {
890
+					$period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx';
891
+		}
866 892
 
867 893
 		// Check we have a valid cost.
868
-		if ($context['sub']['flexible'] && $period == 'xx')
869
-			fatal_lang_error('paid_sub_not_active');
894
+		if ($context['sub']['flexible'] && $period == 'xx') {
895
+					fatal_lang_error('paid_sub_not_active');
896
+		}
870 897
 
871 898
 		// Sort out the cost/currency.
872 899
 		$context['currency'] = $modSettings['paid_currency_code'];
@@ -879,8 +906,7 @@  discard block
 block discarded – undo
879 906
 			$context['cost'] = sprintf($modSettings['paid_currency_symbol'], $context['value']) . '/' . $txt[$_POST['cur'][$ID_SUB]];
880 907
 			// The period value for paypal.
881 908
 			$context['paypal_period'] = strtoupper(substr($_POST['cur'][$ID_SUB], 0, 1));
882
-		}
883
-		else
909
+		} else
884 910
 		{
885 911
 			// Real cost...
886 912
 			$context['value'] = $context['sub']['costs']['fixed'];
@@ -897,13 +923,15 @@  discard block
 block discarded – undo
897 923
 		foreach ($gateways as $id => $gateway)
898 924
 		{
899 925
 			$fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile;u=' . $memID . ';area=subscriptions;sub_id=' . $context['sub']['id'] . ';done');
900
-			if (!empty($fields['form']))
901
-				$context['gateways'][] = $fields;
926
+			if (!empty($fields['form'])) {
927
+							$context['gateways'][] = $fields;
928
+			}
902 929
 		}
903 930
 
904 931
 		// Bugger?!
905
-		if (empty($context['gateways']))
906
-			fatal_error($txt['paid_admin_not_setup_gateway']);
932
+		if (empty($context['gateways'])) {
933
+					fatal_error($txt['paid_admin_not_setup_gateway']);
934
+		}
907 935
 
908 936
 		// Now we are going to assume they want to take this out ;)
909 937
 		$new_data = array($context['sub']['id'], $context['value'], $period, 'prepay');
@@ -911,16 +939,19 @@  discard block
 block discarded – undo
911 939
 		{
912 940
 			// What are the details like?
913 941
 			$current_pending = array();
914
-			if ($context['current'][$context['sub']['id']]['pending_details'] != '')
915
-				$current_pending = $smcFunc['json_decode']($context['current'][$context['sub']['id']]['pending_details'], true);
942
+			if ($context['current'][$context['sub']['id']]['pending_details'] != '') {
943
+							$current_pending = $smcFunc['json_decode']($context['current'][$context['sub']['id']]['pending_details'], true);
944
+			}
916 945
 			// Don't get silly.
917
-			if (count($current_pending) > 9)
918
-				$current_pending = array();
946
+			if (count($current_pending) > 9) {
947
+							$current_pending = array();
948
+			}
919 949
 			$pending_count = 0;
920 950
 			// Only record real pending payments as will otherwise confuse the admin!
921
-			foreach ($current_pending as $pending)
922
-				if ($pending[3] == 'payback')
951
+			foreach ($current_pending as $pending) {
952
+							if ($pending[3] == 'payback')
923 953
 					$pending_count++;
954
+			}
924 955
 
925 956
 			if (!in_array($new_data, $current_pending))
926 957
 			{
@@ -964,10 +995,10 @@  discard block
 block discarded – undo
964 995
 
965 996
 		// Quit.
966 997
 		return;
998
+	} else {
999
+			$context['sub_template'] = 'user_subscription';
1000
+	}
967 1001
 	}
968
-	else
969
-		$context['sub_template'] = 'user_subscription';
970
-}
971 1002
 
972 1003
 /**
973 1004
  * Function to allow the user to todo Privacy stuff
@@ -978,23 +1009,28 @@  discard block
 block discarded – undo
978 1009
 {
979 1010
 	global $txt, $user_profile, $context, $smcFunc, $user_info;
980 1011
 
981
-	if ($memID == $user_info['id'])
982
-		$context['pdc']['own'] = true;
983
-	else
984
-		$context['pdc']['name'] = $context['member']['name'];
1012
+	if ($memID == $user_info['id']) {
1013
+			$context['pdc']['own'] = true;
1014
+	} else {
1015
+			$context['pdc']['name'] = $context['member']['name'];
1016
+	}
985 1017
 	
986
-	if (!empty($_REQUEST['nofound']))
987
-		$context['pdc']['nofound'] = true;
1018
+	if (!empty($_REQUEST['nofound'])) {
1019
+			$context['pdc']['nofound'] = true;
1020
+	}
988 1021
 	
989
-	if (empty($_REQUEST['activity']))
990
-		return;
1022
+	if (empty($_REQUEST['activity'])) {
1023
+			return;
1024
+	}
991 1025
 	
992 1026
 	$mode = $_REQUEST['activity'];
993 1027
 
994 1028
 	$profileData = array();
995
-	if ($mode == 'profile') // profile
1029
+	if ($mode == 'profile') {
1030
+		// profile
996 1031
 	{
997 1032
 		loadMemberData($memID, false, 'profile');
1033
+	}
998 1034
 		$profile = $user_profile[$memID];
999 1035
 		$removeFields = array('secret_question','tfa_secret','password_salt');
1000 1036
 		foreach ($removeFields as $value)
@@ -1003,14 +1039,15 @@  discard block
 block discarded – undo
1003 1039
 		}
1004 1040
 		foreach($profile as $key => &$value)
1005 1041
 		{
1006
-			if (is_array($value))
1007
-				$value = $smcFunc['json_encode']($value);
1042
+			if (is_array($value)) {
1043
+							$value = $smcFunc['json_encode']($value);
1044
+			}
1008 1045
 		}
1009 1046
 		$profileData[0] = array_keys($profile);
1010 1047
 		$profileData[1] = $profile;
1011 1048
 		call_integration_hook('integrate_getProfile_profile', array(&$profileData));
1012
-	}
1013
-	elseif ($mode == 'messages') // messages
1049
+	} elseif ($mode == 'messages') {
1050
+		// messages
1014 1051
 	{
1015 1052
 		
1016 1053
 		$request = $smcFunc['db_query']('','
@@ -1021,15 +1058,16 @@  discard block
 block discarded – undo
1021 1058
 				'memID' => $memID,
1022 1059
 			)
1023 1060
 		);
1061
+	}
1024 1062
 		$profileData = $smcFunc['db_fetch_all']($request);
1025
-		if (!is_array($profileData))
1026
-			redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1');
1063
+		if (!is_array($profileData)) {
1064
+					redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1');
1065
+		}
1027 1066
 		array_unshift($profileData, array_keys($profileData[0]));
1028 1067
 		$smcFunc['db_free_result']($request);
1029 1068
 
1030 1069
 		call_integration_hook('integrate_getProfile_messages', array(&$profileData));
1031
-	}
1032
-	elseif ($mode == 'pmessages')
1070
+	} elseif ($mode == 'pmessages')
1033 1071
 	{
1034 1072
 		$request = $smcFunc['db_query']('','
1035 1073
 			SELECT pm.msgtime, pm.subject, pm.body
@@ -1041,8 +1079,9 @@  discard block
 block discarded – undo
1041 1079
 			)
1042 1080
 		);
1043 1081
 		$profileData = $smcFunc['db_fetch_all']($request);
1044
-		if (!is_array($profileData))
1045
-			redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1');
1082
+		if (!is_array($profileData)) {
1083
+					redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1');
1084
+		}
1046 1085
 		array_unshift($profileData, array_keys($profileData[0]));
1047 1086
 		$smcFunc['db_free_result']($request);
1048 1087
 		call_integration_hook('integrate_getProfile_pmessages', array(&$profileData));
@@ -1076,8 +1115,9 @@  discard block
 block discarded – undo
1076 1115
 
1077 1116
 	$context['poc']['own'] = false;
1078 1117
 
1079
-	if ($memID == $user_info['id'])
1080
-		$context['poc']['own'] = true;
1118
+	if ($memID == $user_info['id']) {
1119
+			$context['poc']['own'] = true;
1120
+	}
1081 1121
 
1082 1122
 	if (!empty($user_profile[$memID]['options']['policy_approved']) &&
1083 1123
 			!empty($modSettings[$user_profile[$memID]['options']['policy_approved']]))
@@ -1095,19 +1135,23 @@  discard block
 block discarded – undo
1095 1135
 		$context['poc']['newVersionText'] = $modSettings[$modSettings['policy_version']];
1096 1136
 	}
1097 1137
 
1098
-	if (!empty($context['poc']['own']) && (!empty($context['poc']['newVersionText']) || empty($user_profile[$memID]['options']['policy_isvalid'])))
1099
-		$context['poc']['showAccept'] = true;
1138
+	if (!empty($context['poc']['own']) && (!empty($context['poc']['newVersionText']) || empty($user_profile[$memID]['options']['policy_isvalid']))) {
1139
+			$context['poc']['showAccept'] = true;
1140
+	}
1100 1141
 
1101
-	if (empty($_REQUEST['activity']))
1102
-		return;
1142
+	if (empty($_REQUEST['activity'])) {
1143
+			return;
1144
+	}
1103 1145
 
1104 1146
 	$mode = $_REQUEST['activity'];
1105 1147
 
1106 1148
 	$profileData = array();
1107
-	if ($mode == 'save') // profile
1149
+	if ($mode == 'save') {
1150
+		// profile
1108 1151
 	{
1109 1152
 		if (!$context['poc']['own']) //only for yourself
1110 1153
 			exit;
1154
+	}
1111 1155
 
1112 1156
 		$data = array(
1113 1157
 			array($memID, 1, 'policy_approved', $modSettings['policy_version']),
@@ -1151,8 +1195,7 @@  discard block
 block discarded – undo
1151 1195
 		if ( $encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field ) )
1152 1196
 		{
1153 1197
 			$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
1154
-		}
1155
-		else
1198
+		} else
1156 1199
 		{
1157 1200
 			$output[] = $field;
1158 1201
 		}
Please login to merge, or discard this patch.
Themes/default/Profile.template.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 		$fields = '';
460 460
 		foreach ($context['print_custom_fields']['below_signature'] as $field)
461 461
 			if (!empty($field['output_html']))
462
-				$fields .=  '
462
+				$fields .= '
463 463
 					<li>' . $field['output_html'] . '</li>';
464 464
 
465 465
 		if (!empty($fields))
@@ -3272,7 +3272,7 @@  discard block
 block discarded – undo
3272 3272
 				', $txt['profileDataCenter'], '
3273 3273
 			</h3>
3274 3274
 		</div>
3275
-		',( !empty($context['pdc']['nofound']) ? '<p class="information">' . $txt['profileDataNotFound'] . '</p>' : ''),'<div class="windowbg">
3275
+		',(!empty($context['pdc']['nofound']) ? '<p class="information">' . $txt['profileDataNotFound'] . '</p>' : ''), '<div class="windowbg">
3276 3276
 		<div>
3277 3277
 			<form action="', $scripturl, '?action=profile;area=getprofiledata;activity=profile" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
3278 3278
 				<p',  '', '>', (!empty($context['pdc']['own']) ? $txt['profileDownloadProfile_own'] : sprintf($txt['profileDownloadProfile_any'], $context['pdc']['name'])), ': </p>
@@ -3331,7 +3331,7 @@  discard block
 block discarded – undo
3331 3331
 				<div class="title_bar">
3332 3332
 					<h3 class="titlebg">', $txt['policy_approved'], '</h3>
3333 3333
 				</div>
3334
-				<p>' ,$context['poc']['approved_text'] , '</p>
3334
+				<p>' ,$context['poc']['approved_text'], '</p>
3335 3335
 			</div>';
3336 3336
 	if (!empty($context['poc']['newVersionText']))
3337 3337
 		echo '
@@ -3339,7 +3339,7 @@  discard block
 block discarded – undo
3339 3339
 				<div class="title_bar">
3340 3340
 					<h3 class="titlebg">', $txt['policy_new'], '</h3>
3341 3341
 				</div>
3342
-				<p>' ,$context['poc']['newVersionText'] , '</p>
3342
+				<p>' ,$context['poc']['newVersionText'], '</p>
3343 3343
 			</div>';
3344 3344
 	
3345 3345
 	if (!empty($context['poc']['showAccept']))
Please login to merge, or discard this patch.
Braces   +573 added lines, -437 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>';
@@ -355,9 +378,10 @@  discard block
 block discarded – undo
355 378
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
356 379
 
357 380
 		// Can we provide information on what this means?
358
-		if (!empty($context['warning_status']))
359
-			echo '
381
+		if (!empty($context['warning_status'])) {
382
+					echo '
360 383
 					<span class="smalltext">(', $context['warning_status'], ')</span>';
384
+		}
361 385
 
362 386
 		echo '
363 387
 				</dd>';
@@ -367,11 +391,12 @@  discard block
 block discarded – undo
367 391
 	if (!empty($context['activate_message']) || !empty($context['member']['bans']))
368 392
 	{
369 393
 		// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
370
-		if (!empty($context['activate_message']))
371
-			echo '
394
+		if (!empty($context['activate_message'])) {
395
+					echo '
372 396
 				<dt class="clear">
373 397
 					<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>)
374 398
 				</dt>';
399
+		}
375 400
 
376 401
 		// If the current member is banned, show a message and possibly a link to the ban.
377 402
 		if (!empty($context['member']['bans']))
@@ -383,10 +408,11 @@  discard block
 block discarded – undo
383 408
 				<dt class="clear" id="ban_info" style="display: none;">
384 409
 					<strong>', $txt['user_banned_by_following'], ':</strong>';
385 410
 
386
-			foreach ($context['member']['bans'] as $ban)
387
-				echo '
411
+			foreach ($context['member']['bans'] as $ban) {
412
+							echo '
388 413
 					<br>
389 414
 					<span class="smalltext">', $ban['explanation'], '</span>';
415
+			}
390 416
 
391 417
 			echo '
392 418
 				</dt>';
@@ -400,30 +426,34 @@  discard block
 block discarded – undo
400 426
 	// If the person looking is allowed, they can check the members IP address and hostname.
401 427
 	if ($context['can_see_ip'])
402 428
 	{
403
-		if (!empty($context['member']['ip']))
404
-		echo '
429
+		if (!empty($context['member']['ip'])) {
430
+				echo '
405 431
 				<dt>', $txt['ip'], ': </dt>
406 432
 				<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
433
+		}
407 434
 
408
-		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
409
-			echo '
435
+		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) {
436
+					echo '
410 437
 				<dt>', $txt['hostname'], ': </dt>
411 438
 				<dd>', $context['member']['hostname'], '</dd>';
439
+		}
412 440
 	}
413 441
 
414 442
 	echo '
415 443
 				<dt>', $txt['local_time'], ':</dt>
416 444
 				<dd>', $context['member']['local_time'], '</dd>';
417 445
 
418
-	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
419
-		echo '
446
+	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) {
447
+			echo '
420 448
 				<dt>', $txt['language'], ':</dt>
421 449
 				<dd>', $context['member']['language'], '</dd>';
450
+	}
422 451
 
423
-	if ($context['member']['show_last_login'])
424
-		echo '
452
+	if ($context['member']['show_last_login']) {
453
+			echo '
425 454
 				<dt>', $txt['lastLoggedIn'], ': </dt>
426 455
 				<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
456
+	}
427 457
 
428 458
 	echo '
429 459
 			</dl>';
@@ -432,42 +462,47 @@  discard block
 block discarded – undo
432 462
 	if (!empty($context['print_custom_fields']['above_signature']))
433 463
 	{
434 464
 		$fields = '';
435
-		foreach ($context['print_custom_fields']['above_signature'] as $field)
436
-			if (!empty($field['output_html']))
465
+		foreach ($context['print_custom_fields']['above_signature'] as $field) {
466
+					if (!empty($field['output_html']))
437 467
 				$fields .= '
438 468
 					<li>' . $field['output_html'] . '</li>';
469
+		}
439 470
 
440
-		if (!empty($fields))
441
-			echo '
471
+		if (!empty($fields)) {
472
+					echo '
442 473
 			<div class="custom_fields_above_signature">
443 474
 				<ul class="nolist">', $fields, '
444 475
 				</ul>
445 476
 			</div>';
477
+		}
446 478
 	}
447 479
 
448 480
 	// Show the users signature.
449
-	if ($context['signature_enabled'] && !empty($context['member']['signature']))
450
-		echo '
481
+	if ($context['signature_enabled'] && !empty($context['member']['signature'])) {
482
+			echo '
451 483
 			<div class="signature">
452 484
 				<h5>', $txt['signature'], ':</h5>
453 485
 				', $context['member']['signature'], '
454 486
 			</div>';
487
+	}
455 488
 
456 489
 	// Are there any custom profile fields for below the signature?
457 490
 	if (!empty($context['print_custom_fields']['below_signature']))
458 491
 	{
459 492
 		$fields = '';
460
-		foreach ($context['print_custom_fields']['below_signature'] as $field)
461
-			if (!empty($field['output_html']))
493
+		foreach ($context['print_custom_fields']['below_signature'] as $field) {
494
+					if (!empty($field['output_html']))
462 495
 				$fields .=  '
463 496
 					<li>' . $field['output_html'] . '</li>';
497
+		}
464 498
 
465
-		if (!empty($fields))
466
-			echo '
499
+		if (!empty($fields)) {
500
+					echo '
467 501
 			<div class="custom_fields_below_signature">
468 502
 				<ul class="nolist">', $fields, '
469 503
 				</ul>
470 504
 			</div>';
505
+		}
471 506
 	}
472 507
 
473 508
 	echo '
@@ -509,62 +544,70 @@  discard block
 block discarded – undo
509 544
 			</div>
510 545
 			<div class="list_posts">';
511 546
 
512
-			if (!$post['approved'])
513
-				echo '
547
+			if (!$post['approved']) {
548
+							echo '
514 549
 				<div class="approve_post">
515 550
 					<em>', $txt['post_awaiting_approval'], '</em>
516 551
 				</div>';
552
+			}
517 553
 
518 554
 			echo '
519 555
 				', $post['body'], '
520 556
 			</div>';
521 557
 
522
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
523
-				echo '
558
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
559
+							echo '
524 560
 			<div class="floatright">
525 561
 				<ul class="quickbuttons">';
562
+			}
526 563
 
527 564
 			// If they *can* reply?
528
-			if ($post['can_reply'])
529
-				echo '
565
+			if ($post['can_reply']) {
566
+							echo '
530 567
 					<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
568
+			}
531 569
 
532 570
 			// If they *can* quote?
533
-			if ($post['can_quote'])
534
-				echo '
571
+			if ($post['can_quote']) {
572
+							echo '
535 573
 					<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>';
574
+			}
536 575
 
537 576
 			// How about... even... remove it entirely?!
538
-			if ($post['can_delete'])
539
-				echo '
577
+			if ($post['can_delete']) {
578
+							echo '
540 579
 					<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>';
580
+			}
541 581
 
542
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
543
-				echo '
582
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
583
+							echo '
544 584
 				</ul>
545 585
 			</div><!-- .floatright -->';
586
+			}
546 587
 
547 588
 			echo '
548 589
 		</div><!-- $post[css_class] -->';
549 590
 		}
591
+	} else {
592
+			template_show_list('attachments');
550 593
 	}
551
-	else
552
-		template_show_list('attachments');
553 594
 
554 595
 	// No posts? Just end with a informative message.
555
-	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
556
-		echo '
596
+	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) {
597
+			echo '
557 598
 		<div class="windowbg">
558 599
 			', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
559 600
 		</div>';
601
+	}
560 602
 
561 603
 	// Show more page numbers.
562
-	if (!empty($context['page_index']))
563
-		echo '
604
+	if (!empty($context['page_index'])) {
605
+			echo '
564 606
 		<div class="pagesection">
565 607
 			<div class="pagelinks">', $context['page_index'], '</div>
566 608
 		</div>';
567
-}
609
+	}
610
+	}
568 611
 
569 612
 /**
570 613
  * Template for showing alerts within the alerts popup
@@ -574,11 +617,12 @@  discard block
 block discarded – undo
574 617
 	global $context, $txt, $scripturl;
575 618
 
576 619
 	// Do we have an update message?
577
-	if (!empty($context['update_message']))
578
-		echo '
620
+	if (!empty($context['update_message'])) {
621
+			echo '
579 622
 		<div class="infobox">
580 623
 			', $context['update_message'], '
581 624
 		</div>';
625
+	}
582 626
 
583 627
 	echo '
584 628
 		<div class="cat_bar">
@@ -587,18 +631,18 @@  discard block
 block discarded – undo
587 631
 			</h3>
588 632
 		</div>';
589 633
 
590
-	if (empty($context['alerts']))
591
-		echo '
634
+	if (empty($context['alerts'])) {
635
+			echo '
592 636
 		<div class="information">
593 637
 			', $txt['alerts_none'], '
594 638
 		</div>';
595
-
596
-	else
639
+	} else
597 640
 	{
598 641
 		// Start the form if checkboxes are in use
599
-		if ($context['showCheckboxes'])
600
-			echo '
642
+		if ($context['showCheckboxes']) {
643
+					echo '
601 644
 		<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;save" method="post" accept-charset="', $context['character_set'], '" id="mark_all">';
645
+		}
602 646
 
603 647
 		echo '
604 648
 			<table id="alerts" class="table_grid">';
@@ -614,9 +658,10 @@  discard block
 block discarded – undo
614 658
 							<li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=remove;aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>
615 659
 							<li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=', ($alert['is_read'] != 0 ? 'unread' : 'read'), ';aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons ', $alert['is_read'] != 0 ? 'unread_button' : 'read_button', '"></span>', ($alert['is_read'] != 0 ? $txt['mark_unread'] : $txt['mark_read_short']), '</a></li>';
616 660
 
617
-					if ($context['showCheckboxes'])
618
-						echo '
661
+					if ($context['showCheckboxes']) {
662
+											echo '
619 663
 							<li><input type="checkbox" name="mark[', $id, ']" value="', $id, '"></li>';
664
+					}
620 665
 
621 666
 			echo '
622 667
 						</ul>
@@ -631,8 +676,8 @@  discard block
 block discarded – undo
631 676
 					', $context['pagination'], '
632 677
 				</div>';
633 678
 
634
-		if ($context['showCheckboxes'])
635
-			echo '
679
+		if ($context['showCheckboxes']) {
680
+					echo '
636 681
 				<div class="floatright">
637 682
 					', $txt['check_all'], ': <input type="checkbox" name="select_all" id="select_all">
638 683
 					<select name="mark_as">
@@ -643,14 +688,16 @@  discard block
 block discarded – undo
643 688
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
644 689
 					<input type="submit" name="req" value="', $txt['quick_mod_go'], '" class="button you_sure">
645 690
 				</div>';
691
+		}
646 692
 
647 693
 	echo '
648 694
 			</div>';
649 695
 
650
-	if ($context['showCheckboxes'])
651
-		echo '
696
+	if ($context['showCheckboxes']) {
697
+			echo '
652 698
 		</form>';
653 699
 	}
700
+	}
654 701
 }
655 702
 
656 703
 /**
@@ -671,12 +718,12 @@  discard block
 block discarded – undo
671 718
 		</div>' : '';
672 719
 
673 720
 	// No drafts? Just show an informative message.
674
-	if (empty($context['drafts']))
675
-		echo '
721
+	if (empty($context['drafts'])) {
722
+			echo '
676 723
 		<div class="windowbg centertext">
677 724
 			', $txt['draft_none'], '
678 725
 		</div>';
679
-	else
726
+	} else
680 727
 	{
681 728
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
682 729
 		foreach ($context['drafts'] as $draft)
@@ -688,13 +735,15 @@  discard block
 block discarded – undo
688 735
 				<h5>
689 736
 					<strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
690 737
 
691
-			if (!empty($draft['sticky']))
692
-				echo '
738
+			if (!empty($draft['sticky'])) {
739
+							echo '
693 740
 					<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
741
+			}
694 742
 
695
-			if (!empty($draft['locked']))
696
-				echo '
743
+			if (!empty($draft['locked'])) {
744
+							echo '
697 745
 					<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
746
+			}
698 747
 
699 748
 			echo '
700 749
 				</h5>
@@ -727,13 +776,13 @@  discard block
 block discarded – undo
727 776
 {
728 777
 	global $context, $scripturl, $txt;
729 778
 
730
-	if (!empty($context['saved_successful']))
731
-		echo '
779
+	if (!empty($context['saved_successful'])) {
780
+			echo '
732 781
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
733
-
734
-	elseif (!empty($context['saved_failed']))
735
-		echo '
782
+	} elseif (!empty($context['saved_failed'])) {
783
+			echo '
736 784
 	<div class="errorbox">', $context['saved_failed'], '</div>';
785
+	}
737 786
 
738 787
 	echo '
739 788
 	<div id="edit_buddies">
@@ -748,14 +797,16 @@  discard block
 block discarded – undo
748 797
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
749 798
 					<th scope="col">', $txt['status'], '</th>';
750 799
 
751
-	if (allowedTo('moderate_forum'))
752
-		echo '
800
+	if (allowedTo('moderate_forum')) {
801
+			echo '
753 802
 					<th scope="col">', $txt['email'], '</th>';
803
+	}
754 804
 
755
-	if (!empty($context['custom_pf']))
756
-		foreach ($context['custom_pf'] as $column)
805
+	if (!empty($context['custom_pf'])) {
806
+			foreach ($context['custom_pf'] as $column)
757 807
 				echo '
758 808
 					<th scope="col">', $column['label'], '</th>';
809
+	}
759 810
 
760 811
 	echo '
761 812
 					<th scope="col">', $txt['remove'], '</th>
@@ -764,13 +815,14 @@  discard block
 block discarded – undo
764 815
 			<tbody>';
765 816
 
766 817
 	// If they don't have any buddies don't list them!
767
-	if (empty($context['buddies']))
768
-		echo '
818
+	if (empty($context['buddies'])) {
819
+			echo '
769 820
 				<tr class="windowbg">
770 821
 					<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '">
771 822
 						<strong>', $txt['no_buddies'], '</strong>
772 823
 					</td>
773 824
 				</tr>';
825
+	}
774 826
 
775 827
 		// Now loop through each buddy showing info on each.
776 828
 	else
@@ -784,17 +836,19 @@  discard block
 block discarded – undo
784 836
 						<a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a>
785 837
 					</td>';
786 838
 
787
-			if ($buddy['show_email'])
788
-				echo '
839
+			if ($buddy['show_email']) {
840
+							echo '
789 841
 					<td>
790 842
 						<a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a>
791 843
 					</td>';
844
+			}
792 845
 
793 846
 			// Show the custom profile fields for this user.
794
-			if (!empty($context['custom_pf']))
795
-				foreach ($context['custom_pf'] as $key => $column)
847
+			if (!empty($context['custom_pf'])) {
848
+							foreach ($context['custom_pf'] as $key => $column)
796 849
 					echo '
797 850
 					<td class="lefttext">', $buddy['options'][$key], '</td>';
851
+			}
798 852
 
799 853
 			echo '
800 854
 					<td>
@@ -827,9 +881,10 @@  discard block
 block discarded – undo
827 881
 			</dl>
828 882
 		</div>';
829 883
 
830
-	if (!empty($context['token_check']))
831
-		echo '
884
+	if (!empty($context['token_check'])) {
885
+			echo '
832 886
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
887
+	}
833 888
 
834 889
 	echo '
835 890
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -855,13 +910,13 @@  discard block
 block discarded – undo
855 910
 {
856 911
 	global $context, $scripturl, $txt;
857 912
 
858
-	if (!empty($context['saved_successful']))
859
-		echo '
913
+	if (!empty($context['saved_successful'])) {
914
+			echo '
860 915
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
861
-
862
-	elseif (!empty($context['saved_failed']))
863
-		echo '
916
+	} elseif (!empty($context['saved_failed'])) {
917
+			echo '
864 918
 	<div class="errorbox">', $context['saved_failed'], '</div>';
919
+	}
865 920
 
866 921
 	echo '
867 922
 	<div id="edit_buddies">
@@ -876,9 +931,10 @@  discard block
 block discarded – undo
876 931
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
877 932
 					<th scope="col">', $txt['status'], '</th>';
878 933
 
879
-	if (allowedTo('moderate_forum'))
880
-		echo '
934
+	if (allowedTo('moderate_forum')) {
935
+			echo '
881 936
 					<th scope="col">', $txt['email'], '</th>';
937
+	}
882 938
 
883 939
 	echo '
884 940
 					<th scope="col">', $txt['ignore_remove'], '</th>
@@ -887,13 +943,14 @@  discard block
 block discarded – undo
887 943
 			<tbody>';
888 944
 
889 945
 	// If they don't have anyone on their ignore list, don't list it!
890
-	if (empty($context['ignore_list']))
891
-		echo '
946
+	if (empty($context['ignore_list'])) {
947
+			echo '
892 948
 				<tr class="windowbg">
893 949
 					<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '">
894 950
 						<strong>', $txt['no_ignore'], '</strong>
895 951
 					</td>
896 952
 				</tr>';
953
+	}
897 954
 
898 955
 	// Now loop through each buddy showing info on each.
899 956
 	foreach ($context['ignore_list'] as $member)
@@ -905,11 +962,12 @@  discard block
 block discarded – undo
905 962
 						<a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a>
906 963
 					</td>';
907 964
 
908
-		if ($member['show_email'])
909
-			echo '
965
+		if ($member['show_email']) {
966
+					echo '
910 967
 					<td>
911 968
 						<a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a>
912 969
 					</td>';
970
+		}
913 971
 		echo '
914 972
 					<td>
915 973
 						<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>
@@ -939,9 +997,10 @@  discard block
 block discarded – undo
939 997
 			</dl>
940 998
 		</div>';
941 999
 
942
-	if (!empty($context['token_check']))
943
-		echo '
1000
+	if (!empty($context['token_check'])) {
1001
+			echo '
944 1002
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1003
+	}
945 1004
 
946 1005
 	echo '
947 1006
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -987,9 +1046,10 @@  discard block
 block discarded – undo
987 1046
 					<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
988 1047
 
989 1048
 	// Second address detected?
990
-	if (!empty($context['last_ip2']))
991
-		echo '
1049
+	if (!empty($context['last_ip2'])) {
1050
+			echo '
992 1051
 					, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
1052
+	}
993 1053
 
994 1054
 	echo '
995 1055
 				</dd>';
@@ -1055,9 +1115,10 @@  discard block
 block discarded – undo
1055 1115
 		</div>
1056 1116
 		<div class="windowbg">';
1057 1117
 
1058
-		foreach ($context['whois_servers'] as $server)
1059
-			echo '
1118
+		foreach ($context['whois_servers'] as $server) {
1119
+					echo '
1060 1120
 			<a href="', $server['url'], '" target="_blank" rel="noopener"', '>', $server['name'], '</a><br>';
1121
+		}
1061 1122
 		echo '
1062 1123
 		</div>
1063 1124
 		<br>';
@@ -1069,13 +1130,12 @@  discard block
 block discarded – undo
1069 1130
 			<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
1070 1131
 		</div>';
1071 1132
 
1072
-	if (empty($context['ips']))
1073
-		echo '
1133
+	if (empty($context['ips'])) {
1134
+			echo '
1074 1135
 		<p class="windowbg description">
1075 1136
 			<em>', $txt['no_members_from_ip'], '</em>
1076 1137
 		</p>';
1077
-
1078
-	else
1138
+	} else
1079 1139
 	{
1080 1140
 		echo '
1081 1141
 		<table class="table_grid">
@@ -1088,12 +1148,13 @@  discard block
 block discarded – undo
1088 1148
 			<tbody>';
1089 1149
 
1090 1150
 		// Loop through each of the members and display them.
1091
-		foreach ($context['ips'] as $ip => $memberlist)
1092
-			echo '
1151
+		foreach ($context['ips'] as $ip => $memberlist) {
1152
+					echo '
1093 1153
 				<tr class="windowbg">
1094 1154
 					<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
1095 1155
 					<td>', implode(', ', $memberlist), '</td>
1096 1156
 				</tr>';
1157
+		}
1097 1158
 
1098 1159
 		echo '
1099 1160
 			</tbody>
@@ -1135,11 +1196,10 @@  discard block
 block discarded – undo
1135 1196
 			</h3>
1136 1197
 		</div>';
1137 1198
 
1138
-	if ($context['member']['has_all_permissions'])
1139
-		echo '
1199
+	if ($context['member']['has_all_permissions']) {
1200
+			echo '
1140 1201
 		<div class="information">', $txt['showPermissions_all'], '</div>';
1141
-
1142
-	else
1202
+	} else
1143 1203
 	{
1144 1204
 		echo '
1145 1205
 		<div class="information">',$txt['showPermissions_help'], '</div>
@@ -1154,9 +1214,10 @@  discard block
 block discarded – undo
1154 1214
 			<div class="windowbg smalltext">
1155 1215
 				', $txt['showPermissions_restricted_boards_desc'], ':<br>';
1156 1216
 
1157
-			foreach ($context['no_access_boards'] as $no_access_board)
1158
-				echo '
1217
+			foreach ($context['no_access_boards'] as $no_access_board) {
1218
+							echo '
1159 1219
 				<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
1220
+			}
1160 1221
 			echo '
1161 1222
 			</div>';
1162 1223
 		}
@@ -1188,12 +1249,13 @@  discard block
 block discarded – undo
1188 1249
 							</td>
1189 1250
 							<td class="smalltext">';
1190 1251
 
1191
-				if ($permission['is_denied'])
1192
-					echo '
1252
+				if ($permission['is_denied']) {
1253
+									echo '
1193 1254
 								<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>';
1194
-				else
1195
-					echo '
1255
+				} else {
1256
+									echo '
1196 1257
 								', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']);
1258
+				}
1197 1259
 
1198 1260
 				echo '
1199 1261
 							</td>
@@ -1204,10 +1266,10 @@  discard block
 block discarded – undo
1204 1266
 				</table>
1205 1267
 			</div><!-- .tborder -->
1206 1268
 			<br>';
1207
-		}
1208
-		else
1209
-			echo '
1269
+		} else {
1270
+					echo '
1210 1271
 			<p class="windowbg">', $txt['showPermissions_none_general'], '</p>';
1272
+		}
1211 1273
 
1212 1274
 		// Board permission section.
1213 1275
 		echo '
@@ -1218,14 +1280,16 @@  discard block
 block discarded – undo
1218 1280
 						<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
1219 1281
 							<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>';
1220 1282
 
1221
-		if (!empty($context['boards']))
1222
-			echo '
1283
+		if (!empty($context['boards'])) {
1284
+					echo '
1223 1285
 							<option value="" disabled>---------------------------</option>';
1286
+		}
1224 1287
 
1225 1288
 		// Fill the box with any local permission boards.
1226
-		foreach ($context['boards'] as $board)
1227
-			echo '
1289
+		foreach ($context['boards'] as $board) {
1290
+					echo '
1228 1291
 							<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
1292
+		}
1229 1293
 
1230 1294
 		echo '
1231 1295
 						</select>
@@ -1254,13 +1318,13 @@  discard block
 block discarded – undo
1254 1318
 						</td>
1255 1319
 						<td class="smalltext">';
1256 1320
 
1257
-				if ($permission['is_denied'])
1258
-					echo '
1321
+				if ($permission['is_denied']) {
1322
+									echo '
1259 1323
 							<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>';
1260
-
1261
-				else
1262
-					echo '
1324
+				} else {
1325
+									echo '
1263 1326
 							', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']);
1327
+				}
1264 1328
 
1265 1329
 				echo '
1266 1330
 						</td>
@@ -1269,10 +1333,10 @@  discard block
 block discarded – undo
1269 1333
 			echo '
1270 1334
 				</tbody>
1271 1335
 			</table>';
1272
-		}
1273
-		else
1274
-			echo '
1336
+		} else {
1337
+					echo '
1275 1338
 			<p class="windowbg">', $txt['showPermissions_none_board'], '</p>';
1339
+		}
1276 1340
 	echo '
1277 1341
 		</div><!-- #permissions -->';
1278 1342
 	}
@@ -1313,9 +1377,10 @@  discard block
 block discarded – undo
1313 1377
 			</div>';
1314 1378
 
1315 1379
 	// If they haven't post at all, don't draw the graph.
1316
-	if (empty($context['posts_by_time']))
1317
-		echo '
1380
+	if (empty($context['posts_by_time'])) {
1381
+			echo '
1318 1382
 			<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1383
+	}
1319 1384
 
1320 1385
 	// Otherwise do!
1321 1386
 	else
@@ -1324,8 +1389,8 @@  discard block
 block discarded – undo
1324 1389
 			<ul class="activity_stats flow_hidden">';
1325 1390
 
1326 1391
 		// The labels.
1327
-		foreach ($context['posts_by_time'] as $time_of_day)
1328
-			echo '
1392
+		foreach ($context['posts_by_time'] as $time_of_day) {
1393
+					echo '
1329 1394
 				<li>
1330 1395
 					<div class="generic_bar vertical">
1331 1396
 						<div class="bar" style="height: ', (int) $time_of_day['relative_percent'], '%;">
@@ -1334,6 +1399,7 @@  discard block
 block discarded – undo
1334 1399
 					</div>
1335 1400
 					<span class="stats_hour">', $time_of_day['hour_format'], '</span>
1336 1401
 				</li>';
1402
+		}
1337 1403
 
1338 1404
 		echo '
1339 1405
 			</ul>';
@@ -1352,11 +1418,10 @@  discard block
 block discarded – undo
1352 1418
 					</h3>
1353 1419
 				</div>';
1354 1420
 
1355
-	if (empty($context['popular_boards']))
1356
-		echo '
1421
+	if (empty($context['popular_boards'])) {
1422
+			echo '
1357 1423
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1358
-
1359
-	else
1424
+	} else
1360 1425
 	{
1361 1426
 		echo '
1362 1427
 				<dl class="stats">';
@@ -1386,10 +1451,10 @@  discard block
 block discarded – undo
1386 1451
 					</h3>
1387 1452
 				</div>';
1388 1453
 
1389
-	if (empty($context['board_activity']))
1390
-		echo '
1454
+	if (empty($context['board_activity'])) {
1455
+			echo '
1391 1456
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1392
-	else
1457
+	} else
1393 1458
 	{
1394 1459
 		echo '
1395 1460
 				<dl class="stats">';
@@ -1440,90 +1505,97 @@  discard block
 block discarded – undo
1440 1505
 				<h3 class="catbg profile_hd">';
1441 1506
 
1442 1507
 		// Don't say "Profile" if this isn't the profile...
1443
-		if (!empty($context['profile_header_text']))
1444
-			echo '
1508
+		if (!empty($context['profile_header_text'])) {
1509
+					echo '
1445 1510
 					', $context['profile_header_text'];
1446
-		else
1447
-			echo '
1511
+		} else {
1512
+					echo '
1448 1513
 					', $txt['profile'];
1514
+		}
1449 1515
 
1450 1516
 		echo '
1451 1517
 				</h3>
1452 1518
 			</div>';
1453 1519
 
1454 1520
 	// Have we some description?
1455
-	if ($context['page_desc'])
1456
-		echo '
1521
+	if ($context['page_desc']) {
1522
+			echo '
1457 1523
 			<p class="information">', $context['page_desc'], '</p>';
1524
+	}
1458 1525
 
1459 1526
 	echo '
1460 1527
 			<div class="roundframe">';
1461 1528
 
1462 1529
 	// Any bits at the start?
1463
-	if (!empty($context['profile_prehtml']))
1464
-		echo '
1530
+	if (!empty($context['profile_prehtml'])) {
1531
+			echo '
1465 1532
 				<div>', $context['profile_prehtml'], '</div>';
1533
+	}
1466 1534
 
1467
-	if (!empty($context['profile_fields']))
1468
-		echo '
1535
+	if (!empty($context['profile_fields'])) {
1536
+			echo '
1469 1537
 				<dl class="settings">';
1538
+	}
1470 1539
 
1471 1540
 	// Start the big old loop 'of love.
1472 1541
 	$lastItem = 'hr';
1473 1542
 	foreach ($context['profile_fields'] as $key => $field)
1474 1543
 	{
1475 1544
 		// We add a little hack to be sure we never get more than one hr in a row!
1476
-		if ($lastItem == 'hr' && $field['type'] == 'hr')
1477
-			continue;
1545
+		if ($lastItem == 'hr' && $field['type'] == 'hr') {
1546
+					continue;
1547
+		}
1478 1548
 
1479 1549
 		$lastItem = $field['type'];
1480
-		if ($field['type'] == 'hr')
1481
-			echo '
1550
+		if ($field['type'] == 'hr') {
1551
+					echo '
1482 1552
 				</dl>
1483 1553
 				<hr>
1484 1554
 				<dl class="settings">';
1485
-
1486
-		elseif ($field['type'] == 'callback')
1555
+		} elseif ($field['type'] == 'callback')
1487 1556
 		{
1488 1557
 			if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
1489 1558
 			{
1490 1559
 				$callback_func = 'template_profile_' . $field['callback_func'];
1491 1560
 				$callback_func();
1492 1561
 			}
1493
-		}
1494
-		else
1562
+		} else
1495 1563
 		{
1496 1564
 			echo '
1497 1565
 					<dt>
1498 1566
 						<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
1499 1567
 
1500 1568
 			// Does it have any subtext to show?
1501
-			if (!empty($field['subtext']))
1502
-				echo '
1569
+			if (!empty($field['subtext'])) {
1570
+							echo '
1503 1571
 						<br>
1504 1572
 						<span class="smalltext">', $field['subtext'], '</span>';
1573
+			}
1505 1574
 
1506 1575
 			echo '
1507 1576
 					</dt>
1508 1577
 					<dd>';
1509 1578
 
1510 1579
 			// Want to put something infront of the box?
1511
-			if (!empty($field['preinput']))
1512
-				echo '
1580
+			if (!empty($field['preinput'])) {
1581
+							echo '
1513 1582
 						', $field['preinput'];
1583
+			}
1514 1584
 
1515 1585
 			// What type of data are we showing?
1516
-			if ($field['type'] == 'label')
1517
-				echo '
1586
+			if ($field['type'] == 'label') {
1587
+							echo '
1518 1588
 						', $field['value'];
1589
+			}
1519 1590
 
1520 1591
 			// Maybe it's a text box - very likely!
1521 1592
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url')))
1522 1593
 			{
1523
-				if ($field['type'] == 'int' || $field['type'] == 'float')
1524
-					$type = 'number';
1525
-				else
1526
-					$type = $field['type'];
1594
+				if ($field['type'] == 'int' || $field['type'] == 'float') {
1595
+									$type = 'number';
1596
+				} else {
1597
+									$type = $field['type'];
1598
+				}
1527 1599
 				$step = $field['type'] == 'float' ? ' step="0.1"' : '';
1528 1600
 
1529 1601
 
@@ -1531,10 +1603,11 @@  discard block
 block discarded – undo
1531 1603
 						<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>';
1532 1604
 			}
1533 1605
 			// You "checking" me out? ;)
1534
-			elseif ($field['type'] == 'check')
1535
-				echo '
1606
+			elseif ($field['type'] == 'check') {
1607
+							echo '
1536 1608
 						<input type="hidden" name="', $key, '" value="0">
1537 1609
 						<input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>';
1610
+			}
1538 1611
 
1539 1612
 			// Always fun - select boxes!
1540 1613
 			elseif ($field['type'] == 'select')
@@ -1545,14 +1618,16 @@  discard block
 block discarded – undo
1545 1618
 				if (isset($field['options']))
1546 1619
 				{
1547 1620
 					// Is this some code to generate the options?
1548
-					if (!is_array($field['options']))
1549
-						$field['options'] = $field['options']();
1621
+					if (!is_array($field['options'])) {
1622
+											$field['options'] = $field['options']();
1623
+					}
1550 1624
 
1551 1625
 					// Assuming we now have some!
1552
-					if (is_array($field['options']))
1553
-						foreach ($field['options'] as $value => $name)
1626
+					if (is_array($field['options'])) {
1627
+											foreach ($field['options'] as $value => $name)
1554 1628
 							echo '
1555 1629
 							<option', is_numeric($value) ? ' value="" disabled' : ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>';
1630
+					}
1556 1631
 				}
1557 1632
 
1558 1633
 				echo '
@@ -1560,31 +1635,34 @@  discard block
 block discarded – undo
1560 1635
 			}
1561 1636
 
1562 1637
 			// Something to end with?
1563
-			if (!empty($field['postinput']))
1564
-				echo '
1638
+			if (!empty($field['postinput'])) {
1639
+							echo '
1565 1640
 						', $field['postinput'];
1641
+			}
1566 1642
 
1567 1643
 			echo '
1568 1644
 					</dd>';
1569 1645
 		}
1570 1646
 	}
1571 1647
 
1572
-	if (!empty($context['profile_fields']))
1573
-		echo '
1648
+	if (!empty($context['profile_fields'])) {
1649
+			echo '
1574 1650
 				</dl>';
1651
+	}
1575 1652
 
1576 1653
 	// Are there any custom profile fields - if so print them!
1577 1654
 	if (!empty($context['custom_fields']))
1578 1655
 	{
1579
-		if ($lastItem != 'hr')
1580
-			echo '
1656
+		if ($lastItem != 'hr') {
1657
+					echo '
1581 1658
 				<hr>';
1659
+		}
1582 1660
 
1583 1661
 		echo '
1584 1662
 				<dl class="settings">';
1585 1663
 
1586
-		foreach ($context['custom_fields'] as $field)
1587
-			echo '
1664
+		foreach ($context['custom_fields'] as $field) {
1665
+					echo '
1588 1666
 					<dt>
1589 1667
 						<strong>', $field['name'], ': </strong><br>
1590 1668
 						<span class="smalltext">', $field['desc'], '</span>
@@ -1592,19 +1670,21 @@  discard block
 block discarded – undo
1592 1670
 					<dd>
1593 1671
 						', $field['input_html'], '
1594 1672
 					</dd>';
1673
+		}
1595 1674
 
1596 1675
 		echo '
1597 1676
 				</dl>';
1598 1677
 	}
1599 1678
 
1600 1679
 	// Any closing HTML?
1601
-	if (!empty($context['profile_posthtml']))
1602
-		echo '
1680
+	if (!empty($context['profile_posthtml'])) {
1681
+			echo '
1603 1682
 				<div>', $context['profile_posthtml'], '</div>';
1683
+	}
1604 1684
 
1605 1685
 	// Only show the password box if it's actually needed.
1606
-	if ($context['require_password'])
1607
-		echo '
1686
+	if ($context['require_password']) {
1687
+			echo '
1608 1688
 				<dl class="settings">
1609 1689
 					<dt>
1610 1690
 						<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br>
@@ -1614,18 +1694,21 @@  discard block
 block discarded – undo
1614 1694
 						<input type="password" name="oldpasswrd" id="oldpasswrd" size="20">
1615 1695
 					</dd>
1616 1696
 				</dl>';
1697
+	}
1617 1698
 
1618 1699
 	// The button shouldn't say "Change profile" unless we're changing the profile...
1619
-	if (!empty($context['submit_button_text']))
1620
-		echo '
1700
+	if (!empty($context['submit_button_text'])) {
1701
+			echo '
1621 1702
 				<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button floatright">';
1622
-	else
1623
-		echo '
1703
+	} else {
1704
+			echo '
1624 1705
 				<input type="submit" name="save" value="', $txt['change_profile'], '" class="button floatright">';
1706
+	}
1625 1707
 
1626
-	if (!empty($context['token_check']))
1627
-		echo '
1708
+	if (!empty($context['token_check'])) {
1709
+			echo '
1628 1710
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1711
+	}
1629 1712
 
1630 1713
 	echo '
1631 1714
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1635,10 +1718,11 @@  discard block
 block discarded – undo
1635 1718
 		</form>';
1636 1719
 
1637 1720
 	// Any final spellchecking stuff?
1638
-	if (!empty($context['show_spellchecking']))
1639
-		echo '
1721
+	if (!empty($context['show_spellchecking'])) {
1722
+			echo '
1640 1723
 		<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>';
1641
-}
1724
+	}
1725
+	}
1642 1726
 
1643 1727
 /**
1644 1728
  * Personal Message settings.
@@ -1675,10 +1759,11 @@  discard block
 block discarded – undo
1675 1759
 						<select name="pm_receive_from" id="pm_receive_from">
1676 1760
 							<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
1677 1761
 
1678
-	if (!empty($modSettings['enable_buddylist']))
1679
-		echo '
1762
+	if (!empty($modSettings['enable_buddylist'])) {
1763
+			echo '
1680 1764
 							<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
1681 1765
 							<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
1766
+	}
1682 1767
 
1683 1768
 	echo '
1684 1769
 							<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
@@ -1721,11 +1806,12 @@  discard block
 block discarded – undo
1721 1806
 		if (empty($setting) || !is_array($setting))
1722 1807
 		{
1723 1808
 			// Insert a separator (unless this is the first item in the list)
1724
-			if ($i !== $first_option_key)
1725
-				echo '
1809
+			if ($i !== $first_option_key) {
1810
+							echo '
1726 1811
 				</dl>
1727 1812
 				<hr>
1728 1813
 				<dl class="settings">';
1814
+			}
1729 1815
 
1730 1816
 			// Should we give a name to this section?
1731 1817
 			if (is_string($setting) && !empty($setting))
@@ -1734,69 +1820,67 @@  discard block
 block discarded – undo
1734 1820
 				echo '
1735 1821
 					<dt><strong>' . $setting . '</strong></dt>
1736 1822
 					<dd></dd>';
1823
+			} else {
1824
+							$titled_section = false;
1737 1825
 			}
1738
-			else
1739
-				$titled_section = false;
1740 1826
 
1741 1827
 			continue;
1742 1828
 		}
1743 1829
 
1744 1830
 		// Is this disabled?
1745
-		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
1746
-			continue;
1747
-
1748
-		elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
1749
-			continue;
1750
-
1751
-		elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
1752
-			continue;
1753
-
1754
-		elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
1755
-			continue;
1756
-
1757
-		elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
1758
-			continue;
1759
-
1760
-		elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1761
-			continue;
1762
-
1763
-		elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1764
-			continue;
1831
+		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) {
1832
+					continue;
1833
+		} elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) {
1834
+					continue;
1835
+		} elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) {
1836
+					continue;
1837
+		} elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) {
1838
+					continue;
1839
+		} elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) {
1840
+					continue;
1841
+		} elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1842
+					continue;
1843
+		} elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1844
+					continue;
1845
+		}
1765 1846
 
1766 1847
 		// Some of these may not be set...  Set to defaults here
1767 1848
 		$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod');
1768
-		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']]))
1769
-			$context['member']['options'][$setting['id']] = 0;
1770
-
1771
-		if (!isset($setting['type']) || $setting['type'] == 'bool')
1772
-			$setting['type'] = 'checkbox';
1773
-
1774
-		elseif ($setting['type'] == 'int' || $setting['type'] == 'integer')
1775
-			$setting['type'] = 'number';
1849
+		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) {
1850
+					$context['member']['options'][$setting['id']] = 0;
1851
+		}
1776 1852
 
1777
-		elseif ($setting['type'] == 'string')
1778
-			$setting['type'] = 'text';
1853
+		if (!isset($setting['type']) || $setting['type'] == 'bool') {
1854
+					$setting['type'] = 'checkbox';
1855
+		} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
1856
+					$setting['type'] = 'number';
1857
+		} elseif ($setting['type'] == 'string') {
1858
+					$setting['type'] = 'text';
1859
+		}
1779 1860
 
1780
-		if (isset($setting['options']))
1781
-			$setting['type'] = 'list';
1861
+		if (isset($setting['options'])) {
1862
+					$setting['type'] = 'list';
1863
+		}
1782 1864
 
1783 1865
 		echo '
1784 1866
 					<dt>
1785 1867
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
1786 1868
 
1787
-		if (isset($setting['description']))
1788
-			echo '
1869
+		if (isset($setting['description'])) {
1870
+					echo '
1789 1871
 						<br>
1790 1872
 						<span class="smalltext">', $setting['description'], '</span>';
1873
+		}
1791 1874
 		echo '
1792 1875
 					</dt>
1793 1876
 					<dd>';
1794 1877
 
1795 1878
 		// Display checkbox options
1796
-		if ($setting['type'] == 'checkbox')
1797
-			echo '
1879
+		if ($setting['type'] == 'checkbox') {
1880
+					echo '
1798 1881
 						<input type="hidden" name="default_options[' . $setting['id'] . ']" value="0">
1799 1882
 						<input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">';
1883
+		}
1800 1884
 
1801 1885
 		// How about selection lists, we all love them
1802 1886
 		elseif ($setting['type'] == 'list')
@@ -1804,9 +1888,10 @@  discard block
 block discarded – undo
1804 1888
 			echo '
1805 1889
 						<select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>';
1806 1890
 
1807
-			foreach ($setting['options'] as $value => $label)
1808
-				echo '
1891
+			foreach ($setting['options'] as $value => $label) {
1892
+							echo '
1809 1893
 							<option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>';
1894
+			}
1810 1895
 
1811 1896
 			echo '
1812 1897
 						</select>';
@@ -1822,14 +1907,13 @@  discard block
 block discarded – undo
1822 1907
 
1823 1908
 				echo '
1824 1909
 						<input type="number"', $min . $max . $step;
1825
-			}
1826
-			elseif (isset($setting['type']) && $setting['type'] == 'url')
1827
-				echo'
1910
+			} elseif (isset($setting['type']) && $setting['type'] == 'url') {
1911
+							echo'
1828 1912
 						<input type="url"';
1829
-
1830
-			else
1831
-				echo '
1913
+			} else {
1914
+							echo '
1832 1915
 						<input type="text"';
1916
+			}
1833 1917
 
1834 1918
 			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"' : '', '>';
1835 1919
 		}
@@ -1866,8 +1950,8 @@  discard block
 block discarded – undo
1866 1950
 				<dl class="settings">';
1867 1951
 
1868 1952
 	// Allow notification on announcements to be disabled?
1869
-	if (!empty($modSettings['allow_disableAnnounce']))
1870
-		echo '
1953
+	if (!empty($modSettings['allow_disableAnnounce'])) {
1954
+			echo '
1871 1955
 					<dt>
1872 1956
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
1873 1957
 					</dt>
@@ -1875,15 +1959,17 @@  discard block
 block discarded – undo
1875 1959
 						<input type="hidden" name="notify_announcements" value="0">
1876 1960
 						<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '>
1877 1961
 					</dd>';
1962
+	}
1878 1963
 
1879
-	if (!empty($modSettings['enable_ajax_alerts']))
1880
-		echo '
1964
+	if (!empty($modSettings['enable_ajax_alerts'])) {
1965
+			echo '
1881 1966
 					<dt>
1882 1967
 						<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label>
1883 1968
 					</dt>
1884 1969
 					<dd>
1885 1970
 						<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '">
1886 1971
 					</dd>';
1972
+	}
1887 1973
 
1888 1974
 	echo '
1889 1975
 				</dl>
@@ -1915,9 +2001,10 @@  discard block
 block discarded – undo
1915 2001
 
1916 2002
 				$label = $txt['alert_opt_' . $opts[1]];
1917 2003
 				$label_pos = isset($opts['label']) ? $opts['label'] : '';
1918
-				if ($label_pos == 'before')
1919
-					echo '
2004
+				if ($label_pos == 'before') {
2005
+									echo '
1920 2006
 						<label for="opt_', $opts[1], '">', $label, '</label>';
2007
+				}
1921 2008
 
1922 2009
 				$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
1923 2010
 				switch ($opts[0])
@@ -1931,17 +2018,19 @@  discard block
 block discarded – undo
1931 2018
 						echo '
1932 2019
 						<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
1933 2020
 
1934
-						foreach ($opts['opts'] as $k => $v)
1935
-							echo '
2021
+						foreach ($opts['opts'] as $k => $v) {
2022
+													echo '
1936 2023
 							<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
2024
+						}
1937 2025
 						echo '
1938 2026
 						</select>';
1939 2027
 						break;
1940 2028
 				}
1941 2029
 
1942
-				if ($label_pos == 'after')
1943
-					echo '
2030
+				if ($label_pos == 'after') {
2031
+									echo '
1944 2032
 						<label for="opt_', $opts[1], '">', $label, '</label>';
2033
+				}
1945 2034
 
1946 2035
 				echo '
1947 2036
 					</td>
@@ -2058,11 +2147,12 @@  discard block
 block discarded – undo
2058 2147
 			<p class="information">', $txt['groupMembership_info'], '</p>';
2059 2148
 
2060 2149
 	// Do we have an update message?
2061
-	if (!empty($context['update_message']))
2062
-		echo '
2150
+	if (!empty($context['update_message'])) {
2151
+			echo '
2063 2152
 			<div class="infobox">
2064 2153
 				', $context['update_message'], '.
2065 2154
 			</div>';
2155
+	}
2066 2156
 
2067 2157
 	echo '
2068 2158
 			<div id="groups">';
@@ -2084,8 +2174,7 @@  discard block
 block discarded – undo
2084 2174
 						</div>
2085 2175
 					</div>
2086 2176
 				</div><!-- .groupmembership -->';
2087
-	}
2088
-	else
2177
+	} else
2089 2178
 	{
2090 2179
 		echo '
2091 2180
 				<div class="title_bar">
@@ -2097,27 +2186,30 @@  discard block
 block discarded – undo
2097 2186
 			echo '
2098 2187
 				<div class="windowbg" id="primdiv_', $group['id'], '">';
2099 2188
 
2100
-				if ($context['can_edit_primary'])
2101
-					echo '
2189
+				if ($context['can_edit_primary']) {
2190
+									echo '
2102 2191
 					<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', '>';
2192
+				}
2103 2193
 
2104 2194
 				echo '
2105 2195
 					<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>';
2106 2196
 
2107 2197
 				// Can they leave their group?
2108
-				if ($group['can_leave'])
2109
-					echo '
2198
+				if ($group['can_leave']) {
2199
+									echo '
2110 2200
 					<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>';
2201
+				}
2111 2202
 
2112 2203
 				echo '
2113 2204
 				</div><!-- .windowbg -->';
2114 2205
 		}
2115 2206
 
2116
-		if ($context['can_edit_primary'])
2117
-			echo '
2207
+		if ($context['can_edit_primary']) {
2208
+					echo '
2118 2209
 				<div class="padding righttext">
2119 2210
 					<input type="submit" value="', $txt['make_primary'], '" class="button">
2120 2211
 				</div>';
2212
+		}
2121 2213
 
2122 2214
 		// Any groups they can join?
2123 2215
 		if (!empty($context['groups']['available']))
@@ -2133,17 +2225,16 @@  discard block
 block discarded – undo
2133 2225
 				<div class="windowbg">
2134 2226
 					<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>' : ''), '';
2135 2227
 
2136
-				if ($group['type'] == 3)
2137
-					echo '
2228
+				if ($group['type'] == 3) {
2229
+									echo '
2138 2230
 					<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>';
2139
-
2140
-				elseif ($group['type'] == 2 && $group['pending'])
2141
-					echo '
2231
+				} elseif ($group['type'] == 2 && $group['pending']) {
2232
+									echo '
2142 2233
 					<span class="floatright">', $txt['approval_pending'], '</span>';
2143
-
2144
-				elseif ($group['type'] == 2)
2145
-					echo '
2234
+				} elseif ($group['type'] == 2) {
2235
+									echo '
2146 2236
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>';
2237
+				}
2147 2238
 
2148 2239
 				echo '
2149 2240
 				</div><!-- .windowbg -->';
@@ -2166,9 +2257,10 @@  discard block
 block discarded – undo
2166 2257
 
2167 2258
 						prevDiv.className = "windowbg";
2168 2259
 					}';
2169
-		if (isset($context['groups']['member'][$context['primary_group']]))
2170
-			echo '
2260
+		if (isset($context['groups']['member'][$context['primary_group']])) {
2261
+					echo '
2171 2262
 					highlightSelected("primdiv_' . $context['primary_group'] . '");';
2263
+		}
2172 2264
 
2173 2265
 		echo '
2174 2266
 				</script>';
@@ -2177,9 +2269,10 @@  discard block
 block discarded – undo
2177 2269
 	echo '
2178 2270
 			</div><!-- #groups -->';
2179 2271
 
2180
-	if (!empty($context['token_check']))
2181
-		echo '
2272
+	if (!empty($context['token_check'])) {
2273
+			echo '
2182 2274
 			<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2275
+	}
2183 2276
 
2184 2277
 	echo '
2185 2278
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2227,14 +2320,15 @@  discard block
 block discarded – undo
2227 2320
 
2228 2321
 		foreach ($category['boards'] as $board)
2229 2322
 		{
2230
-			if ($i == $limit)
2231
-				echo '
2323
+			if ($i == $limit) {
2324
+							echo '
2232 2325
 						</ul>
2233 2326
 					</li>
2234 2327
 				</ul>
2235 2328
 				<ul class="ignoreboards floatright">
2236 2329
 					<li class="category">
2237 2330
 						<ul>';
2331
+			}
2238 2332
 
2239 2333
 			echo '
2240 2334
 							<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
@@ -2279,10 +2373,11 @@  discard block
 block discarded – undo
2279 2373
 
2280 2374
 	// Work out the starting warning.
2281 2375
 	$context['current_warning_mode'] = $context['warning_mode'][0];
2282
-	foreach ($context['warning_mode'] as $limit => $warning)
2283
-		if ($context['member']['warning'] >= $limit)
2376
+	foreach ($context['warning_mode'] as $limit => $warning) {
2377
+			if ($context['member']['warning'] >= $limit)
2284 2378
 			$context['current_warning_mode'] = $warning;
2285
-}
2379
+	}
2380
+	}
2286 2381
 
2287 2382
 // Show all warnings of a user?
2288 2383
 function template_viewWarning()
@@ -2317,14 +2412,15 @@  discard block
 block discarded – undo
2317 2412
 				</dd>';
2318 2413
 
2319 2414
 	// There's some impact of this?
2320
-	if (!empty($context['level_effects'][$context['current_level']]))
2321
-		echo '
2415
+	if (!empty($context['level_effects'][$context['current_level']])) {
2416
+			echo '
2322 2417
 				<dt>
2323 2418
 					<strong>', $txt['profile_viewwarning_impact'], ':</strong>
2324 2419
 				</dt>
2325 2420
 				<dd>
2326 2421
 					', $context['level_effects'][$context['current_level']], '
2327 2422
 				</dd>';
2423
+	}
2328 2424
 
2329 2425
 	echo '
2330 2426
 			</dl>
@@ -2362,10 +2458,11 @@  discard block
 block discarded – undo
2362 2458
 
2363 2459
 			// Otherwise see what we can do...';
2364 2460
 
2365
-	foreach ($context['notification_templates'] as $k => $type)
2366
-		echo '
2461
+	foreach ($context['notification_templates'] as $k => $type) {
2462
+			echo '
2367 2463
 			if (index == ', $k, ')
2368 2464
 				document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
2465
+	}
2369 2466
 
2370 2467
 	echo '
2371 2468
 		}
@@ -2375,10 +2472,11 @@  discard block
 block discarded – undo
2375 2472
 			// Also set the right effect.
2376 2473
 			effectText = "";';
2377 2474
 
2378
-	foreach ($context['level_effects'] as $limit => $text)
2379
-		echo '
2475
+	foreach ($context['level_effects'] as $limit => $text) {
2476
+			echo '
2380 2477
 			if (slideAmount >= ', $limit, ')
2381 2478
 				effectText = "', $text, '";';
2479
+	}
2382 2480
 
2383 2481
 	echo '
2384 2482
 			setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\');
@@ -2393,32 +2491,35 @@  discard block
 block discarded – undo
2393 2491
 			</h3>
2394 2492
 		</div>';
2395 2493
 
2396
-	if (!$context['user']['is_owner'])
2397
-		echo '
2494
+	if (!$context['user']['is_owner']) {
2495
+			echo '
2398 2496
 		<p class="information">', $txt['profile_warning_desc'], '</p>';
2497
+	}
2399 2498
 
2400 2499
 	echo '
2401 2500
 		<div class="windowbg">
2402 2501
 			<dl class="settings">';
2403 2502
 
2404
-	if (!$context['user']['is_owner'])
2405
-		echo '
2503
+	if (!$context['user']['is_owner']) {
2504
+			echo '
2406 2505
 				<dt>
2407 2506
 					<strong>', $txt['profile_warning_name'], ':</strong>
2408 2507
 				</dt>
2409 2508
 				<dd>
2410 2509
 					<strong>', $context['member']['name'], '</strong>
2411 2510
 				</dd>';
2511
+	}
2412 2512
 
2413 2513
 	echo '
2414 2514
 				<dt>
2415 2515
 					<strong>', $txt['profile_warning_level'], ':</strong>';
2416 2516
 
2417 2517
 	// Is there only so much they can apply?
2418
-	if ($context['warning_limit'])
2419
-		echo '
2518
+	if ($context['warning_limit']) {
2519
+			echo '
2420 2520
 					<br>
2421 2521
 					<span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
2522
+	}
2422 2523
 
2423 2524
 	echo '
2424 2525
 				</dt>
@@ -2473,9 +2574,10 @@  discard block
 block discarded – undo
2473 2574
 						<option value="-1">', $txt['profile_warning_notify_template'], '</option>
2474 2575
 						<option value="-1" disabled>------------------------------</option>';
2475 2576
 
2476
-		foreach ($context['notification_templates'] as $id_template => $template)
2477
-			echo '
2577
+		foreach ($context['notification_templates'] as $id_template => $template) {
2578
+					echo '
2478 2579
 						<option value="', $id_template, '">', $template['title'], '</option>';
2580
+		}
2479 2581
 
2480 2582
 		echo '
2481 2583
 					</select>
@@ -2488,9 +2590,10 @@  discard block
 block discarded – undo
2488 2590
 			</dl>
2489 2591
 			<div class="righttext">';
2490 2592
 
2491
-	if (!empty($context['token_check']))
2492
-		echo '
2593
+	if (!empty($context['token_check'])) {
2594
+			echo '
2493 2595
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2596
+	}
2494 2597
 
2495 2598
 	echo '
2496 2599
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2506,8 +2609,8 @@  discard block
 block discarded – undo
2506 2609
 	echo '
2507 2610
 	<script>';
2508 2611
 
2509
-	if (!$context['user']['is_owner'])
2510
-		echo '
2612
+	if (!$context['user']['is_owner']) {
2613
+			echo '
2511 2614
 		modifyWarnNotify();
2512 2615
 		$(document).ready(function() {
2513 2616
 			$("#preview_button").click(function() {
@@ -2546,6 +2649,7 @@  discard block
 block discarded – undo
2546 2649
 			});
2547 2650
 			return false;
2548 2651
 		}';
2652
+	}
2549 2653
 
2550 2654
 	echo '
2551 2655
 	</script>';
@@ -2568,17 +2672,19 @@  discard block
 block discarded – undo
2568 2672
 			</div>';
2569 2673
 
2570 2674
 	// If deleting another account give them a lovely info box.
2571
-	if (!$context['user']['is_owner'])
2572
-		echo '
2675
+	if (!$context['user']['is_owner']) {
2676
+			echo '
2573 2677
 			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2678
+	}
2574 2679
 
2575 2680
 	echo '
2576 2681
 			<div class="windowbg">';
2577 2682
 
2578 2683
 	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2579
-	if ($context['needs_approval'])
2580
-		echo '
2684
+	if ($context['needs_approval']) {
2685
+			echo '
2581 2686
 				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2687
+	}
2582 2688
 
2583 2689
 	// If the user is deleting their own account warn them first - and require a password!
2584 2690
 	if ($context['user']['is_owner'])
@@ -2590,9 +2696,10 @@  discard block
 block discarded – undo
2590 2696
 					<input type="password" name="oldpasswrd" size="20">
2591 2697
 					<input type="submit" value="', $txt['yes'], '" class="button">';
2592 2698
 
2593
-		if (!empty($context['token_check']))
2594
-			echo '
2699
+		if (!empty($context['token_check'])) {
2700
+					echo '
2595 2701
 					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2702
+		}
2596 2703
 
2597 2704
 		echo '
2598 2705
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2622,10 +2729,11 @@  discard block
 block discarded – undo
2622 2729
 						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2623 2730
 					</select>';
2624 2731
 
2625
-			if ($context['show_perma_delete'])
2626
-				echo '
2732
+			if ($context['show_perma_delete']) {
2733
+							echo '
2627 2734
 					<br>
2628 2735
 					<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
2736
+			}
2629 2737
 
2630 2738
 			echo '
2631 2739
 				</div>';
@@ -2638,9 +2746,10 @@  discard block
 block discarded – undo
2638 2746
 				<div>
2639 2747
 					<input type="submit" value="', $txt['delete'], '" class="button">';
2640 2748
 
2641
-		if (!empty($context['token_check']))
2642
-			echo '
2749
+		if (!empty($context['token_check'])) {
2750
+					echo '
2643 2751
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2752
+		}
2644 2753
 
2645 2754
 		echo '
2646 2755
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2666,8 +2775,8 @@  discard block
 block discarded – undo
2666 2775
 					<hr>';
2667 2776
 
2668 2777
 	// Only show the password box if it's actually needed.
2669
-	if ($context['require_password'])
2670
-		echo '
2778
+	if ($context['require_password']) {
2779
+			echo '
2671 2780
 					<dl class="settings">
2672 2781
 						<dt>
2673 2782
 							<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
@@ -2677,13 +2786,15 @@  discard block
 block discarded – undo
2677 2786
 							<input type="password" name="oldpasswrd" size="20">
2678 2787
 						</dd>
2679 2788
 					</dl>';
2789
+	}
2680 2790
 
2681 2791
 	echo '
2682 2792
 					<div class="righttext">';
2683 2793
 
2684
-	if (!empty($context['token_check']))
2685
-		echo '
2794
+	if (!empty($context['token_check'])) {
2795
+			echo '
2686 2796
 						<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2797
+	}
2687 2798
 
2688 2799
 	echo '
2689 2800
 						<input type="submit" value="', $txt['change_profile'], '" class="button">
@@ -2710,9 +2821,10 @@  discard block
 block discarded – undo
2710 2821
 			<ul id="list_errors">';
2711 2822
 
2712 2823
 		// Cycle through each error and display an error message.
2713
-		foreach ($context['post_errors'] as $error)
2714
-			echo '
2824
+		foreach ($context['post_errors'] as $error) {
2825
+					echo '
2715 2826
 				<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
2827
+		}
2716 2828
 
2717 2829
 		echo '
2718 2830
 			</ul>';
@@ -2738,12 +2850,13 @@  discard block
 block discarded – undo
2738 2850
 								<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;"' : ''), '>';
2739 2851
 
2740 2852
 	// Fill the select box with all primary member groups that can be assigned to a member.
2741
-	foreach ($context['member_groups'] as $member_group)
2742
-		if (!empty($member_group['can_be_primary']))
2853
+	foreach ($context['member_groups'] as $member_group) {
2854
+			if (!empty($member_group['can_be_primary']))
2743 2855
 			echo '
2744 2856
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
2745 2857
 										', $member_group['name'], '
2746 2858
 									</option>';
2859
+	}
2747 2860
 
2748 2861
 	echo '
2749 2862
 								</select>
@@ -2756,10 +2869,11 @@  discard block
 block discarded – undo
2756 2869
 									<input type="hidden" name="additional_groups[]" value="0">';
2757 2870
 
2758 2871
 	// For each membergroup show a checkbox so members can be assigned to more than one group.
2759
-	foreach ($context['member_groups'] as $member_group)
2760
-		if ($member_group['can_be_additional'])
2872
+	foreach ($context['member_groups'] as $member_group) {
2873
+			if ($member_group['can_be_additional'])
2761 2874
 			echo '
2762 2875
 									<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>';
2876
+	}
2763 2877
 
2764 2878
 	echo '
2765 2879
 								</span>
@@ -2819,9 +2933,10 @@  discard block
 block discarded – undo
2819 2933
 								<span class="smalltext">', $txt['sig_info'], '</span><br>
2820 2934
 								<br>';
2821 2935
 
2822
-	if ($context['show_spellchecking'])
2823
-		echo '
2936
+	if ($context['show_spellchecking']) {
2937
+			echo '
2824 2938
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">';
2939
+	}
2825 2940
 
2826 2941
 	echo '
2827 2942
 							</dt>
@@ -2829,17 +2944,20 @@  discard block
 block discarded – undo
2829 2944
 								<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>';
2830 2945
 
2831 2946
 	// If there is a limit at all!
2832
-	if (!empty($context['signature_limits']['max_length']))
2833
-		echo '
2947
+	if (!empty($context['signature_limits']['max_length'])) {
2948
+			echo '
2834 2949
 								<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
2950
+	}
2835 2951
 
2836
-	if (!empty($context['show_preview_button']))
2837
-		echo '
2952
+	if (!empty($context['show_preview_button'])) {
2953
+			echo '
2838 2954
 								<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button floatright">';
2955
+	}
2839 2956
 
2840
-	if ($context['signature_warning'])
2841
-		echo '
2957
+	if ($context['signature_warning']) {
2958
+			echo '
2842 2959
 								<span class="smalltext">', $context['signature_warning'], '</span>';
2960
+	}
2843 2961
 
2844 2962
 	// Some javascript used to count how many characters have been used so far in the signature.
2845 2963
 	echo '
@@ -2870,38 +2988,43 @@  discard block
 block discarded – undo
2870 2988
 									<label for="avatar_upload_box">', $txt['personal_picture'], '</label>
2871 2989
 								</strong>';
2872 2990
 
2873
-	if (empty($modSettings['gravatarOverride']))
2874
-		echo '
2991
+	if (empty($modSettings['gravatarOverride'])) {
2992
+			echo '
2875 2993
 								<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_none" value="none"' . ($context['member']['avatar']['choice'] == 'none' ? ' checked="checked"' : '') . '>
2876 2994
 								<label for="avatar_choice_none"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>
2877 2995
 									' . $txt['no_avatar'] . '
2878 2996
 								</label><br>';
2997
+	}
2879 2998
 
2880
-	if (!empty($context['member']['avatar']['allow_server_stored']))
2881
-		echo '
2999
+	if (!empty($context['member']['avatar']['allow_server_stored'])) {
3000
+			echo '
2882 3001
 								<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_server_stored" value="server_stored"' . ($context['member']['avatar']['choice'] == 'server_stored' ? ' checked="checked"' : '') . '>
2883 3002
 								<label for="avatar_choice_server_stored"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>
2884 3003
 									', $txt['choose_avatar_gallery'], '
2885 3004
 								</label><br>';
3005
+	}
2886 3006
 
2887
-	if (!empty($context['member']['avatar']['allow_external']))
2888
-		echo '
3007
+	if (!empty($context['member']['avatar']['allow_external'])) {
3008
+			echo '
2889 3009
 								<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_external" value="external"' . ($context['member']['avatar']['choice'] == 'external' ? ' checked="checked"' : '') . '>
2890 3010
 								<label for="avatar_choice_external"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>
2891 3011
 									', $txt['my_own_pic'], '
2892 3012
 								</label><br>';
3013
+	}
2893 3014
 
2894
-	if (!empty($context['member']['avatar']['allow_upload']))
2895
-		echo '
3015
+	if (!empty($context['member']['avatar']['allow_upload'])) {
3016
+			echo '
2896 3017
 								<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_upload" value="upload"' . ($context['member']['avatar']['choice'] == 'upload' ? ' checked="checked"' : '') . '>
2897 3018
 								<label for="avatar_choice_upload"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>
2898 3019
 									', $txt['avatar_will_upload'], '
2899 3020
 								</label><br>';
3021
+	}
2900 3022
 
2901
-	if (!empty($context['member']['avatar']['allow_gravatar']))
2902
-		echo '
3023
+	if (!empty($context['member']['avatar']['allow_gravatar'])) {
3024
+			echo '
2903 3025
 								<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_gravatar" value="gravatar"' . ($context['member']['avatar']['choice'] == 'gravatar' ? ' checked="checked"' : '') . '>
2904 3026
 								<label for="avatar_choice_gravatar"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['use_gravatar'] . '</label>';
3027
+	}
2905 3028
 
2906 3029
 	echo '
2907 3030
 							</dt>
@@ -2916,9 +3039,10 @@  discard block
 block discarded – undo
2916 3039
 										<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
2917 3040
 
2918 3041
 		// This lists all the file categories.
2919
-		foreach ($context['avatars'] as $avatar)
2920
-			echo '
3042
+		foreach ($context['avatars'] as $avatar) {
3043
+					echo '
2921 3044
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
3045
+		}
2922 3046
 
2923 3047
 		echo '
2924 3048
 										</select>
@@ -2950,20 +3074,22 @@  discard block
 block discarded – undo
2950 3074
 	}
2951 3075
 
2952 3076
 	// If the user can link to an off server avatar, show them a box to input the address.
2953
-	if (!empty($context['member']['avatar']['allow_external']))
2954
-		echo '
3077
+	if (!empty($context['member']['avatar']['allow_external'])) {
3078
+			echo '
2955 3079
 								<div id="avatar_external">
2956 3080
 									<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') : '', '
2957 3081
 									<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);">
2958 3082
 								</div>';
3083
+	}
2959 3084
 
2960 3085
 	// If the user is able to upload avatars to the server show them an upload box.
2961
-	if (!empty($context['member']['avatar']['allow_upload']))
2962
-		echo '
3086
+	if (!empty($context['member']['avatar']['allow_upload'])) {
3087
+			echo '
2963 3088
 								<div id="avatar_upload">
2964 3089
 									<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'), '
2965 3090
 									', (!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'] . '">' : ''), '
2966 3091
 								</div>';
3092
+	}
2967 3093
 
2968 3094
 	// if the user is able to use Gravatar avatars show then the image preview
2969 3095
 	if (!empty($context['member']['avatar']['allow_gravatar']))
@@ -2972,16 +3098,17 @@  discard block
 block discarded – undo
2972 3098
 								<div id="avatar_gravatar">
2973 3099
 									<img src="' . $context['member']['avatar']['href'] . '" alt="">';
2974 3100
 
2975
-		if (empty($modSettings['gravatarAllowExtraEmail']))
2976
-			echo '
3101
+		if (empty($modSettings['gravatarAllowExtraEmail'])) {
3102
+					echo '
2977 3103
 									<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>';
2978
-		else
3104
+		} else
2979 3105
 		{
2980 3106
 			// Depending on other stuff, the stored value here might have some odd things in it from other areas.
2981
-			if ($context['member']['avatar']['external'] == $context['member']['email'])
2982
-				$textbox_value = '';
2983
-			else
2984
-				$textbox_value = $context['member']['avatar']['external'];
3107
+			if ($context['member']['avatar']['external'] == $context['member']['email']) {
3108
+							$textbox_value = '';
3109
+			} else {
3110
+							$textbox_value = $context['member']['avatar']['external'];
3111
+			}
2985 3112
 
2986 3113
 			echo '
2987 3114
 									<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div>
@@ -3053,8 +3180,9 @@  discard block
 block discarded – undo
3053 3180
 	$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
3054 3181
 
3055 3182
 	$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
3056
-	if (empty($suffix))
3057
-		return;
3183
+	if (empty($suffix)) {
3184
+			return;
3185
+	}
3058 3186
 
3059 3187
 	echo '
3060 3188
 								<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
@@ -3079,9 +3207,10 @@  discard block
 block discarded – undo
3079 3207
 								<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">';
3080 3208
 
3081 3209
 	// Help the user by showing a list of common time formats.
3082
-	foreach ($context['easy_timeformats'] as $time_format)
3083
-		echo '
3210
+	foreach ($context['easy_timeformats'] as $time_format) {
3211
+			echo '
3084 3212
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
3213
+	}
3085 3214
 
3086 3215
 	echo '
3087 3216
 								</select>
@@ -3119,9 +3248,10 @@  discard block
 block discarded – undo
3119 3248
 							<dd>
3120 3249
 								<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\';">';
3121 3250
 
3122
-	foreach ($context['smiley_sets'] as $set)
3123
-		echo '
3251
+	foreach ($context['smiley_sets'] as $set) {
3252
+			echo '
3124 3253
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
3254
+	}
3125 3255
 
3126 3256
 	echo '
3127 3257
 								</select>
@@ -3143,17 +3273,17 @@  discard block
 block discarded – undo
3143 3273
 			<div class="roundframe">
3144 3274
 				<div>';
3145 3275
 
3146
-	if (!empty($context['tfa_backup']))
3147
-		echo '
3276
+	if (!empty($context['tfa_backup'])) {
3277
+			echo '
3148 3278
 					<div class="smalltext error">
3149 3279
 						', $txt['tfa_backup_used_desc'], '
3150 3280
 					</div>';
3151
-
3152
-	elseif ($modSettings['tfa_mode'] == 2)
3153
-		echo '
3281
+	} elseif ($modSettings['tfa_mode'] == 2) {
3282
+			echo '
3154 3283
 					<div class="smalltext">
3155 3284
 						<strong>', $txt['tfa_forced_desc'], '</strong>
3156 3285
 					</div>';
3286
+	}
3157 3287
 
3158 3288
 	echo '
3159 3289
 					<div class="smalltext">
@@ -3164,11 +3294,12 @@  discard block
 block discarded – undo
3164 3294
 							<div class="block">
3165 3295
 								<strong>', $txt['tfa_step1'], '</strong><br>';
3166 3296
 
3167
-	if (!empty($context['tfa_pass_error']))
3168
-		echo '
3297
+	if (!empty($context['tfa_pass_error'])) {
3298
+			echo '
3169 3299
 								<div class="error smalltext">
3170 3300
 									', $txt['tfa_pass_invalid'], '
3171 3301
 								</div>';
3302
+	}
3172 3303
 
3173 3304
 	echo '
3174 3305
 								<input type="password" name="passwd" size="25"', !empty($context['tfa_pass_error']) ? ' class="error"' : '', !empty($context['tfa_pass_value']) ? ' value="' . $context['tfa_pass_value'] . '"' : '', '>
@@ -3181,11 +3312,12 @@  discard block
 block discarded – undo
3181 3312
 							<div class="block">
3182 3313
 								<strong>', $txt['tfa_step3'], '</strong><br>';
3183 3314
 
3184
-	if (!empty($context['tfa_error']))
3185
-		echo '
3315
+	if (!empty($context['tfa_error'])) {
3316
+			echo '
3186 3317
 								<div class="error smalltext">
3187 3318
 									', $txt['tfa_code_invalid'], '
3188 3319
 								</div>';
3320
+	}
3189 3321
 
3190 3322
 	echo '
3191 3323
 								<input type="text" name="tfa_code" size="25"', !empty($context['tfa_error']) ? ' class="error"' : '', !empty($context['tfa_value']) ? ' value="' . $context['tfa_value'] . '"' : '', '>
@@ -3199,10 +3331,11 @@  discard block
 block discarded – undo
3199 3331
 						<img src="', $context['tfa_qr_url'], '" alt="">
3200 3332
 					</div>';
3201 3333
 
3202
-	if (!empty($context['from_ajax']))
3203
-		echo '
3334
+	if (!empty($context['from_ajax'])) {
3335
+			echo '
3204 3336
 					<br>
3205 3337
 					<a href="javascript:self.close();"></a>';
3338
+	}
3206 3339
 
3207 3340
 	echo '
3208 3341
 				</div>
@@ -3242,17 +3375,16 @@  discard block
 block discarded – undo
3242 3375
 							</dt>
3243 3376
 							<dd>';
3244 3377
 
3245
-	if (!$context['tfa_enabled'] && $context['user']['is_owner'])
3246
-		echo '
3378
+	if (!$context['tfa_enabled'] && $context['user']['is_owner']) {
3379
+			echo '
3247 3380
 								<a href="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>';
3248
-
3249
-	elseif (!$context['tfa_enabled'])
3250
-		echo '
3381
+	} elseif (!$context['tfa_enabled']) {
3382
+			echo '
3251 3383
 								', $txt['tfa_profile_disabled'];
3252
-
3253
-	else
3254
-		echo '
3384
+	} else {
3385
+			echo '
3255 3386
 								', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable');
3387
+	}
3256 3388
 
3257 3389
 	echo '
3258 3390
 							</dd>';
@@ -3319,31 +3451,34 @@  discard block
 block discarded – undo
3319 3451
 			</h3>
3320 3452
 		</div>
3321 3453
 		<div class="windowbg">';
3322
-	if (empty($context['poc']['approved_text']) && empty($context['poc']['newVersionText']))
3323
-		echo '
3454
+	if (empty($context['poc']['approved_text']) && empty($context['poc']['newVersionText'])) {
3455
+			echo '
3324 3456
 			</div>
3325 3457
 				<p class="information">', $txt['policyNoApprved'], '</p><div class="windowbg">
3326 3458
 			<div>';
3459
+	}
3327 3460
 	
3328
-	if (!empty($context['poc']['approved_text']))
3329
-		echo '
3461
+	if (!empty($context['poc']['approved_text'])) {
3462
+			echo '
3330 3463
 			<div>
3331 3464
 				<div class="title_bar">
3332 3465
 					<h3 class="titlebg">', $txt['policy_approved'], '</h3>
3333 3466
 				</div>
3334 3467
 				<p>' ,$context['poc']['approved_text'] , '</p>
3335 3468
 			</div>';
3336
-	if (!empty($context['poc']['newVersionText']))
3337
-		echo '
3469
+	}
3470
+	if (!empty($context['poc']['newVersionText'])) {
3471
+			echo '
3338 3472
 			<div>
3339 3473
 				<div class="title_bar">
3340 3474
 					<h3 class="titlebg">', $txt['policy_new'], '</h3>
3341 3475
 				</div>
3342 3476
 				<p>' ,$context['poc']['newVersionText'] , '</p>
3343 3477
 			</div>';
3478
+	}
3344 3479
 	
3345
-	if (!empty($context['poc']['showAccept']))
3346
-		echo '
3480
+	if (!empty($context['poc']['showAccept'])) {
3481
+			echo '
3347 3482
 			<div>
3348 3483
 				<form action="', $scripturl, '?action=profile;area=getpolicydata;activity=save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
3349 3484
 					<input type="submit" value="', $txt['policyAccept'], '" class="button">
@@ -3352,6 +3487,7 @@  discard block
 block discarded – undo
3352 3487
 					<input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
3353 3488
 				</form>
3354 3489
 			</div>';
3490
+	}
3355 3491
 
3356 3492
 	echo '
3357 3493
 		</div><!-- .windowbg -->
Please login to merge, or discard this patch.
Themes/default/Admin.template.php 2 patches
Braces   +185 added lines, -132 removed lines patch added patch discarded remove patch
@@ -65,9 +65,10 @@  discard block
 block discarded – undo
65 65
 										', implode(', ', $context['administrators']);
66 66
 
67 67
 	// If we have lots of admins... don't show them all.
68
-	if (!empty($context['more_admins_link']))
69
-		echo '
68
+	if (!empty($context['more_admins_link'])) {
69
+			echo '
70 70
 										(', $context['more_admins_link'], ')';
71
+	}
71 72
 
72 73
 	echo '
73 74
 									</div><!-- #version_details -->
@@ -84,17 +85,19 @@  discard block
 block discarded – undo
84 85
 		foreach ($area['areas'] as $item_id => $item)
85 86
 		{
86 87
 			// No point showing the 'home' page here, we're already on it!
87
-			if ($area_id == 'forum' && $item_id == 'index')
88
-				continue;
88
+			if ($area_id == 'forum' && $item_id == 'index') {
89
+							continue;
90
+			}
89 91
 
90 92
 			$url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : '');
91 93
 
92
-			if (!empty($item['icon_file']))
93
-				echo '
94
+			if (!empty($item['icon_file'])) {
95
+							echo '
94 96
 							<a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>';
95
-			else
96
-				echo '
97
+			} else {
98
+							echo '
97 99
 							<a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>';
100
+			}
98 101
 		}
99 102
 
100 103
 		echo '
@@ -105,10 +108,11 @@  discard block
 block discarded – undo
105 108
 					</div><!-- #admincenter -->';
106 109
 
107 110
 	// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
108
-	if (empty($modSettings['disable_smf_js']))
109
-		echo '
111
+	if (empty($modSettings['disable_smf_js'])) {
112
+			echo '
110 113
 					<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
111 114
 					<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
115
+	}
112 116
 
113 117
 	// This sets the announcements and current versions themselves ;).
114 118
 	echo '
@@ -186,9 +190,10 @@  discard block
 block discarded – undo
186 190
 								<em>', $version['version'], '</em>';
187 191
 
188 192
 		// more details for this item, show them a link
189
-		if ($context['can_admin'] && isset($version['more']))
190
-			echo
193
+		if ($context['can_admin'] && isset($version['more'])) {
194
+					echo
191 195
 								' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>';
196
+		}
192 197
 		echo '
193 198
 								<br>';
194 199
 	}
@@ -219,21 +224,23 @@  discard block
 block discarded – undo
219 224
 
220 225
 	foreach ($context['credits'] as $section)
221 226
 	{
222
-		if (isset($section['pretext']))
223
-			echo '
227
+		if (isset($section['pretext'])) {
228
+					echo '
224 229
 								<p>', $section['pretext'], '</p>
225 230
 								<hr>';
231
+		}
226 232
 
227 233
 		echo '
228 234
 								<dl>';
229 235
 
230 236
 		foreach ($section['groups'] as $group)
231 237
 		{
232
-			if (isset($group['title']))
233
-				echo '
238
+			if (isset($group['title'])) {
239
+							echo '
234 240
 									<dt>
235 241
 										<strong>', $group['title'], ':</strong>
236 242
 									</dt>';
243
+			}
237 244
 
238 245
 			echo '
239 246
 									<dd>', implode(', ', $group['members']), '</dd>';
@@ -242,10 +249,11 @@  discard block
 block discarded – undo
242 249
 		echo '
243 250
 								</dl>';
244 251
 
245
-		if (isset($section['posttext']))
246
-			echo '
252
+		if (isset($section['posttext'])) {
253
+					echo '
247 254
 								<hr>
248 255
 								<p>', $section['posttext'], '</p>';
256
+		}
249 257
 	}
250 258
 
251 259
 	echo '
@@ -261,9 +269,10 @@  discard block
 block discarded – undo
261 269
 						smfSupportVersions.forum = "', $context['forum_version'], '";';
262 270
 
263 271
 	// Don't worry, none of this is logged, it's just used to give information that might be of use.
264
-	foreach ($context['current_versions'] as $variable => $version)
265
-		echo '
272
+	foreach ($context['current_versions'] as $variable => $version) {
273
+			echo '
266 274
 						smfSupportVersions.', $variable, ' = "', $version['version'], '";';
275
+	}
267 276
 
268 277
 	// Now we just have to include the script and wait ;).
269 278
 	echo '
@@ -360,8 +369,8 @@  discard block
 block discarded – undo
360 369
 								<tbody>';
361 370
 
362 371
 	// Loop through every source file displaying its version - using javascript.
363
-	foreach ($context['file_versions'] as $filename => $version)
364
-		echo '
372
+	foreach ($context['file_versions'] as $filename => $version) {
373
+			echo '
365 374
 									<tr class="windowbg">
366 375
 										<td class="half_table">
367 376
 											', $filename, '
@@ -373,6 +382,7 @@  discard block
 block discarded – undo
373 382
 											<em id="currentSources', $filename, '">??</em>
374 383
 										</td>
375 384
 									</tr>';
385
+	}
376 386
 
377 387
 	// Default template files.
378 388
 	echo '
@@ -398,8 +408,8 @@  discard block
 block discarded – undo
398 408
 							<table id="Default" class="table_grid">
399 409
 								<tbody>';
400 410
 
401
-	foreach ($context['default_template_versions'] as $filename => $version)
402
-		echo '
411
+	foreach ($context['default_template_versions'] as $filename => $version) {
412
+			echo '
403 413
 									<tr class="windowbg">
404 414
 										<td class="half_table">
405 415
 											', $filename, '
@@ -411,6 +421,7 @@  discard block
 block discarded – undo
411 421
 											<em id="currentDefault', $filename, '">??</em>
412 422
 										</td>
413 423
 									</tr>';
424
+	}
414 425
 
415 426
 	// Now the language files...
416 427
 	echo '
@@ -438,8 +449,8 @@  discard block
 block discarded – undo
438 449
 
439 450
 	foreach ($context['default_language_versions'] as $language => $files)
440 451
 	{
441
-		foreach ($files as $filename => $version)
442
-			echo '
452
+		foreach ($files as $filename => $version) {
453
+					echo '
443 454
 									<tr class="windowbg">
444 455
 										<td class="half_table">
445 456
 											', $filename, '.<em>', $language, '</em>.php
@@ -451,6 +462,7 @@  discard block
 block discarded – undo
451 462
 											<em id="current', $filename, '.', $language, '">??</em>
452 463
 										</td>
453 464
 									</tr>';
465
+		}
454 466
 	}
455 467
 
456 468
 	echo '
@@ -480,8 +492,8 @@  discard block
 block discarded – undo
480 492
 							<table id="Templates" class="table_grid">
481 493
 								<tbody>';
482 494
 
483
-		foreach ($context['template_versions'] as $filename => $version)
484
-			echo '
495
+		foreach ($context['template_versions'] as $filename => $version) {
496
+					echo '
485 497
 									<tr class="windowbg">
486 498
 										<td class="half_table">
487 499
 											', $filename, '
@@ -493,6 +505,7 @@  discard block
 block discarded – undo
493 505
 											<em id="currentTemplates', $filename, '">??</em>
494 506
 										</td>
495 507
 									</tr>';
508
+		}
496 509
 
497 510
 		echo '
498 511
 								</tbody>
@@ -522,8 +535,8 @@  discard block
 block discarded – undo
522 535
 							<table id="Tasks" class="table_grid">
523 536
 								<tbody>';
524 537
 
525
-		foreach ($context['tasks_versions'] as $filename => $version)
526
-			echo '
538
+		foreach ($context['tasks_versions'] as $filename => $version) {
539
+					echo '
527 540
 									<tr class="windowbg">
528 541
 										<td class="half_table">
529 542
 											', $filename, '
@@ -535,6 +548,7 @@  discard block
 block discarded – undo
535 548
 											<em id="currentTasks', $filename, '">??</em>
536 549
 										</td>
537 550
 									</tr>';
551
+		}
538 552
 
539 553
 		echo '
540 554
 								</tbody>
@@ -576,9 +590,10 @@  discard block
 block discarded – undo
576 590
 {
577 591
 	global $context, $scripturl, $txt, $modSettings;
578 592
 
579
-	if (!empty($context['saved_successful']))
580
-		echo '
593
+	if (!empty($context['saved_successful'])) {
594
+			echo '
581 595
 					<div class="infobox">', $txt['settings_saved'], '</div>';
596
+	}
582 597
 
583 598
 	// First section is for adding/removing words from the censored list.
584 599
 	echo '
@@ -593,11 +608,12 @@  discard block
 block discarded – undo
593 608
 								<p>', $txt['admin_censored_where'], '</p>';
594 609
 
595 610
 	// Show text boxes for censoring [bad   ] => [good  ].
596
-	foreach ($context['censored_words'] as $vulgar => $proper)
597
-		echo '
611
+	foreach ($context['censored_words'] as $vulgar => $proper) {
612
+			echo '
598 613
 								<div class="block">
599 614
 									<input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> =&gt; <input type="text" name="censor_proper[]" value="', $proper, '" size="30">
600 615
 								</div>';
616
+	}
601 617
 
602 618
 	// Now provide a way to censor more words.
603 619
 	echo '
@@ -672,27 +688,30 @@  discard block
 block discarded – undo
672 688
 						<div class="windowbg">
673 689
 							', $txt['not_done_reason'];
674 690
 
675
-	if (!empty($context['continue_percent']))
676
-		echo '
691
+	if (!empty($context['continue_percent'])) {
692
+			echo '
677 693
 							<div class="progress_bar">
678 694
 								<span>', $context['continue_percent'], '%</span>
679 695
 								<div class="bar" style="width: ', $context['continue_percent'], '%;"></div>
680 696
 							</div>';
697
+	}
681 698
 
682
-	if (!empty($context['substep_enabled']))
683
-		echo '
699
+	if (!empty($context['substep_enabled'])) {
700
+			echo '
684 701
 							<div class="progress_bar progress_blue">
685 702
 								<span>', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</span>
686 703
 								<div class="bar" style="width: ', $context['substep_continue_percent'], '%;"></div>
687 704
 							</div>';
705
+	}
688 706
 
689 707
 	echo '
690 708
 							<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">';
691 709
 
692 710
 	// Do we have a token?
693
-	if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var']))
694
-		echo '
711
+	if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) {
712
+			echo '
695 713
 							<input type="hidden" name="', $context[$context['not_done_token'] . '_token_var'], '" value="', $context[$context['not_done_token'] . '_token'], '">';
714
+	}
696 715
 
697 716
 	echo '
698 717
 								<input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button">
@@ -726,35 +745,40 @@  discard block
 block discarded – undo
726 745
 {
727 746
 	global $context, $txt, $scripturl;
728 747
 
729
-	if (!empty($context['saved_successful']))
730
-		echo '
748
+	if (!empty($context['saved_successful'])) {
749
+			echo '
731 750
 					<div class="infobox">', $txt['settings_saved'], '</div>';
732
-	elseif (!empty($context['saved_failed']))
733
-		echo '
751
+	} elseif (!empty($context['saved_failed'])) {
752
+			echo '
734 753
 					<div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>';
754
+	}
735 755
 
736
-	if (!empty($context['settings_pre_javascript']))
737
-		echo '
756
+	if (!empty($context['settings_pre_javascript'])) {
757
+			echo '
738 758
 					<script>', $context['settings_pre_javascript'], '</script>';
759
+	}
739 760
 
740
-	if (!empty($context['settings_insert_above']))
741
-		echo $context['settings_insert_above'];
761
+	if (!empty($context['settings_insert_above'])) {
762
+			echo $context['settings_insert_above'];
763
+	}
742 764
 
743 765
 	echo '
744 766
 					<div id="admincenter">
745 767
 						<form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
746 768
 
747 769
 	// Is there a custom title?
748
-	if (isset($context['settings_title']))
749
-		echo '
770
+	if (isset($context['settings_title'])) {
771
+			echo '
750 772
 							<div class="cat_bar">
751 773
 								<h3 class="catbg">', $context['settings_title'], '</h3>
752 774
 							</div>';
775
+	}
753 776
 
754 777
 	// Have we got a message to display?
755
-	if (!empty($context['settings_message']))
756
-		echo '
778
+	if (!empty($context['settings_message'])) {
779
+			echo '
757 780
 							<div class="information">', $context['settings_message'], '</div>';
781
+	}
758 782
 
759 783
 	// Now actually loop through all the variables.
760 784
 	$is_open = false;
@@ -807,8 +831,9 @@  discard block
 block discarded – undo
807 831
 		// Hang about? Are you pulling my leg - a callback?!
808 832
 		if (is_array($config_var) && $config_var['type'] == 'callback')
809 833
 		{
810
-			if (function_exists('template_callback_' . $config_var['name']))
811
-				call_user_func('template_callback_' . $config_var['name']);
834
+			if (function_exists('template_callback_' . $config_var['name'])) {
835
+							call_user_func('template_callback_' . $config_var['name']);
836
+			}
812 837
 
813 838
 			continue;
814 839
 		}
@@ -838,9 +863,10 @@  discard block
 block discarded – undo
838 863
 				$text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time');
839 864
 
840 865
 				// Show the [?] button.
841
-				if ($config_var['help'])
842
-					echo '
866
+				if ($config_var['help']) {
867
+									echo '
843 868
 										<a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ';
869
+				}
844 870
 
845 871
 				echo '
846 872
 										<a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
@@ -849,23 +875,26 @@  discard block
 block discarded – undo
849 875
 										$config_var['preinput'];
850 876
 
851 877
 				// Show a check box.
852
-				if ($config_var['type'] == 'check')
853
-					echo '
878
+				if ($config_var['type'] == 'check') {
879
+									echo '
854 880
 										<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">';
881
+				}
855 882
 				// Escape (via htmlspecialchars.) the text box.
856
-				elseif ($config_var['type'] == 'password')
857
-					echo '
883
+				elseif ($config_var['type'] == 'password') {
884
+									echo '
858 885
 										<input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;"><br>
859 886
 										<input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>';
887
+				}
860 888
 				// Show a selection box.
861 889
 				elseif ($config_var['type'] == 'select')
862 890
 				{
863 891
 					echo '
864 892
 										<select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>';
865 893
 
866
-					foreach ($config_var['data'] as $option)
867
-						echo '
894
+					foreach ($config_var['data'] as $option) {
895
+											echo '
868 896
 											<option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>';
897
+					}
869 898
 					echo '
870 899
 										</select>';
871 900
 				}
@@ -882,16 +911,18 @@  discard block
 block discarded – undo
882 911
 
883 912
 					foreach ($context['board_list'] as $id_cat => $cat)
884 913
 					{
885
-						if (!$first)
886
-							echo '
914
+						if (!$first) {
915
+													echo '
887 916
 											<hr>';
917
+						}
888 918
 						echo '
889 919
 											<strong>', $cat['name'], '</strong>
890 920
 											<ul>';
891 921
 
892
-						foreach ($cat['boards'] as $id_board => $brd)
893
-							echo '
922
+						foreach ($cat['boards'] as $id_board => $brd) {
923
+													echo '
894 924
 												<li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat('&nbsp; &nbsp;', $brd['child_level']) : '', $brd['name'], '</label></li>';
925
+						}
895 926
 
896 927
 						echo '
897 928
 											</ul>';
@@ -901,12 +932,14 @@  discard block
 block discarded – undo
901 932
 										</fieldset>';
902 933
 				}
903 934
 				// Text area?
904
-				elseif ($config_var['type'] == 'large_text')
905
-					echo '
935
+				elseif ($config_var['type'] == 'large_text') {
936
+									echo '
906 937
 										<textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
938
+				}
907 939
 				// Permission group?
908
-				elseif ($config_var['type'] == 'permissions')
909
-					theme_inline_permissions($config_var['name']);
940
+				elseif ($config_var['type'] == 'permissions') {
941
+									theme_inline_permissions($config_var['name']);
942
+				}
910 943
 
911 944
 				// BBC selection?
912 945
 				elseif ($config_var['type'] == 'bbc')
@@ -918,22 +951,24 @@  discard block
 block discarded – undo
918 951
 
919 952
 					foreach ($context['bbc_columns'] as $bbcColumn)
920 953
 					{
921
-						foreach ($bbcColumn as $bbcTag)
922
-							echo '
954
+						foreach ($bbcColumn as $bbcTag) {
955
+													echo '
923 956
 												<li class="list_bbc floatleft">
924 957
 													<input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', '> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', '
925 958
 												</li>';
959
+						}
926 960
 					}
927 961
 					echo '					</ul>
928 962
 											<input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label>
929 963
 										</fieldset>';
930 964
 				}
931 965
 				// A simple message?
932
-				elseif ($config_var['type'] == 'var_message')
933
-					echo '
966
+				elseif ($config_var['type'] == 'var_message') {
967
+									echo '
934 968
 										<div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>
935 969
 											', $config_var['var_message'], '
936 970
 										</div>';
971
+				}
937 972
 				// Assume it must be a text box
938 973
 				else
939 974
 				{
@@ -958,62 +993,70 @@  discard block
 block discarded – undo
958 993
 											' . $config_var['postinput'] : '','
959 994
 									</dd>';
960 995
 			}
961
-		}
962
-		else
996
+		} else
963 997
 		{
964 998
 			// Just show a separator.
965
-			if ($config_var == '')
966
-				echo '
999
+			if ($config_var == '') {
1000
+							echo '
967 1001
 								</dl>
968 1002
 								<hr>
969 1003
 								<dl class="settings">';
970
-			else
971
-				echo '
1004
+			} else {
1005
+							echo '
972 1006
 									<dd>
973 1007
 										<strong>' . $config_var . '</strong>
974 1008
 									</dd>';
1009
+			}
975 1010
 		}
976 1011
 	}
977 1012
 
978
-	if ($is_open)
979
-		echo '
1013
+	if ($is_open) {
1014
+			echo '
980 1015
 								</dl>';
1016
+	}
981 1017
 
982
-	if (empty($context['settings_save_dont_show']))
983
-		echo '
1018
+	if (empty($context['settings_save_dont_show'])) {
1019
+			echo '
984 1020
 								<input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">';
1021
+	}
985 1022
 
986
-	if ($is_open)
987
-		echo '
1023
+	if ($is_open) {
1024
+			echo '
988 1025
 							</div><!-- .windowbg -->';
1026
+	}
989 1027
 
990 1028
 
991 1029
 	// At least one token has to be used!
992
-	if (isset($context['admin-ssc_token']))
993
-		echo '
1030
+	if (isset($context['admin-ssc_token'])) {
1031
+			echo '
994 1032
 							<input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">';
1033
+	}
995 1034
 
996
-	if (isset($context['admin-dbsc_token']))
997
-		echo '
1035
+	if (isset($context['admin-dbsc_token'])) {
1036
+			echo '
998 1037
 							<input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">';
1038
+	}
999 1039
 
1000
-	if (isset($context['admin-mp_token']))
1001
-		echo '
1040
+	if (isset($context['admin-mp_token'])) {
1041
+			echo '
1002 1042
 							<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">';
1043
+	}
1003 1044
 
1004 1045
 	echo '
1005 1046
 							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1006 1047
 						</form>
1007 1048
 					</div><!-- #admincenter -->';
1008 1049
 
1009
-	if (!empty($context['settings_post_javascript']))
1010
-		echo '
1050
+	if (!empty($context['settings_post_javascript'])) {
1051
+			echo '
1011 1052
 					<script>
1012 1053
 						', $context['settings_post_javascript'], '
1013 1054
 					</script>';
1055
+	}
1014 1056
 
1015
-	if (!empty($context['settings_insert_below']))
1016
-		echo $context['settings_insert_below'];
1057
+	if (!empty($context['settings_insert_below'])) {
1058
+			echo $context['settings_insert_below'];
1059
+	}
1017 1060
 
1018 1061
 	// We may have added a board listing. If we did, we need to make it work.
1019 1062
 	addInlineJavascript('
@@ -1036,9 +1079,10 @@  discard block
 block discarded – undo
1036 1079
 {
1037 1080
 	global $context, $txt;
1038 1081
 
1039
-	if (!empty($context['saved_successful']))
1040
-		echo '
1082
+	if (!empty($context['saved_successful'])) {
1083
+			echo '
1041 1084
 					<div class="infobox">', $txt['settings_saved'], '</div>';
1085
+	}
1042 1086
 
1043 1087
 	// Standard fields.
1044 1088
 	template_show_list('standard_profile_fields');
@@ -1072,11 +1116,12 @@  discard block
 block discarded – undo
1072 1116
 	{
1073 1117
 		loadLanguage('Errors');
1074 1118
 
1075
-		if (isset($txt['custom_option_' . $_GET['msg']]))
1076
-			echo '
1119
+		if (isset($txt['custom_option_' . $_GET['msg']])) {
1120
+					echo '
1077 1121
 					<div class="errorbox">',
1078 1122
 						$txt['custom_option_' . $_GET['msg']], '
1079 1123
 					</div>';
1124
+		}
1080 1125
 	}
1081 1126
 
1082 1127
 	echo '
@@ -1143,9 +1188,10 @@  discard block
 block discarded – undo
1143 1188
 										<dd>
1144 1189
 											<select name="placement" id="placement">';
1145 1190
 
1146
-	foreach ($context['cust_profile_fields_placement'] as $order => $name)
1147
-		echo '
1191
+	foreach ($context['cust_profile_fields_placement'] as $order => $name) {
1192
+			echo '
1148 1193
 												<option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>';
1194
+	}
1149 1195
 
1150 1196
 	echo '
1151 1197
 											</select>
@@ -1169,9 +1215,10 @@  discard block
 block discarded – undo
1169 1215
 										<dd>
1170 1216
 											<select name="field_type" id="field_type" onchange="updateInputBoxes();">';
1171 1217
 
1172
-	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type)
1173
-		echo '
1218
+	foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) {
1219
+			echo '
1174 1220
 												<option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>';
1221
+	}
1175 1222
 
1176 1223
 	echo '
1177 1224
 											</select>
@@ -1203,9 +1250,10 @@  discard block
 block discarded – undo
1203 1250
 										</dt>
1204 1251
 										<dd id="options_dd">';
1205 1252
 
1206
-	foreach ($context['field']['options'] as $k => $option)
1207
-		echo '
1253
+	foreach ($context['field']['options'] as $k => $option) {
1254
+			echo '
1208 1255
 											', $k == 0 ? '' : '<br>', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked' : '', '><input type="text" name="select_option[', $k, ']" value="', $option, '">';
1256
+	}
1209 1257
 
1210 1258
 	echo '
1211 1259
 											<span id="addopt"></span>
@@ -1269,9 +1317,10 @@  discard block
 block discarded – undo
1269 1317
 								</fieldset>
1270 1318
 								<input type="submit" name="save" value="', $txt['save'], '" class="button">';
1271 1319
 
1272
-	if ($context['fid'])
1273
-		echo '
1320
+	if ($context['fid']) {
1321
+			echo '
1274 1322
 								<input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">';
1323
+	}
1275 1324
 
1276 1325
 	echo '
1277 1326
 							</div><!-- .windowbg -->
@@ -1318,8 +1367,7 @@  discard block
 block discarded – undo
1318 1367
 							<p class="centertext">
1319 1368
 								<strong>', $txt['admin_search_results_none'], '</strong>
1320 1369
 							</p>';
1321
-	}
1322
-	else
1370
+	} else
1323 1371
 	{
1324 1372
 		echo '
1325 1373
 							<ol class="search_results">';
@@ -1346,9 +1394,10 @@  discard block
 block discarded – undo
1346 1394
 								<li>
1347 1395
 									<a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']';
1348 1396
 
1349
-				if ($result['help'])
1350
-					echo '
1397
+				if ($result['help']) {
1398
+									echo '
1351 1399
 									<p class="double_height">', $result['help'], '</p>';
1400
+				}
1352 1401
 
1353 1402
 				echo '
1354 1403
 								</li>';
@@ -1388,10 +1437,11 @@  discard block
 block discarded – undo
1388 1437
 									<strong>', $txt['setup_verification_answer'], '</strong>
1389 1438
 								</dd>';
1390 1439
 
1391
-		if (!empty($context['qa_by_lang'][$lang_id]))
1392
-			foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1440
+		if (!empty($context['qa_by_lang'][$lang_id])) {
1441
+					foreach ($context['qa_by_lang'][$lang_id] as $q_id)
1393 1442
 			{
1394 1443
 				$question = $context['question_answers'][$q_id];
1444
+		}
1395 1445
 
1396 1446
 				echo '
1397 1447
 								<dt>
@@ -1399,9 +1449,10 @@  discard block
 block discarded – undo
1399 1449
 								</dt>
1400 1450
 								<dd>';
1401 1451
 
1402
-				foreach ($question['answers'] as $answer)
1403
-					echo '
1452
+				foreach ($question['answers'] as $answer) {
1453
+									echo '
1404 1454
 									<input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">';
1455
+				}
1405 1456
 
1406 1457
 				echo '
1407 1458
 									<div class="qa_add_answer"><a href="javascript:void(0);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div>
@@ -1440,11 +1491,12 @@  discard block
 block discarded – undo
1440 1491
 							', $txt['errors_found'], ':
1441 1492
 							<ul>';
1442 1493
 
1443
-			foreach ($context['repair_errors'] as $error)
1444
-				echo '
1494
+			foreach ($context['repair_errors'] as $error) {
1495
+							echo '
1445 1496
 								<li>
1446 1497
 									', $error, '
1447 1498
 								</li>';
1499
+			}
1448 1500
 
1449 1501
 			echo '
1450 1502
 							</ul>
@@ -1454,15 +1506,14 @@  discard block
 block discarded – undo
1454 1506
 							<p class="padding">
1455 1507
 								<strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong>
1456 1508
 							</p>';
1457
-		}
1458
-		else
1459
-			echo '
1509
+		} else {
1510
+					echo '
1460 1511
 							<p>', $txt['maintain_no_errors'], '</p>
1461 1512
 							<p class="padding">
1462 1513
 								<a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
1463 1514
 							</p>';
1464
-	}
1465
-	else
1515
+		}
1516
+	} else
1466 1517
 	{
1467 1518
 		if (!empty($context['redirect_to_recount']))
1468 1519
 		{
@@ -1474,8 +1525,7 @@  discard block
 block discarded – undo
1474 1525
 								<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1475 1526
 								<input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '">
1476 1527
 							</form>';
1477
-		}
1478
-		else
1528
+		} else
1479 1529
 		{
1480 1530
 			echo '
1481 1531
 							<p>', $txt['errors_fixed'], '</p>
@@ -1566,9 +1616,10 @@  discard block
 block discarded – undo
1566 1616
 								<tr class="windowbg">
1567 1617
 									<td class="equal_table">', $key, '</td>';
1568 1618
 
1569
-				foreach ($setting as $key_lm => $value)
1570
-					echo '
1619
+				foreach ($setting as $key_lm => $value) {
1620
+									echo '
1571 1621
 									<td class="equal_table">', $value, '</td>';
1622
+				}
1572 1623
 
1573 1624
 				echo '
1574 1625
 								</tr>';
@@ -1628,8 +1679,8 @@  discard block
 block discarded – undo
1628 1679
 {
1629 1680
 	global $context, $txt;
1630 1681
 
1631
-	if ($context['user']['is_admin'])
1632
-		echo '
1682
+	if ($context['user']['is_admin']) {
1683
+			echo '
1633 1684
 								<span class="floatright admin_search">
1634 1685
 									<span class="generic_icons filter centericon"></span>
1635 1686
 									<input type="search" name="search_term" placeholder="', $txt['admin_search'], '">
@@ -1640,7 +1691,8 @@  discard block
 block discarded – undo
1640 1691
 									</select>
1641 1692
 									<input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button">
1642 1693
 								</span>';
1643
-}
1694
+	}
1695
+	}
1644 1696
 
1645 1697
 /**
1646 1698
  * This shows the policy settings
@@ -1649,9 +1701,10 @@  discard block
 block discarded – undo
1649 1701
 {
1650 1702
 	global $context, $scripturl, $txt, $modSettings;
1651 1703
 
1652
-	if (!empty($context['saved_successful']))
1653
-		echo '
1704
+	if (!empty($context['saved_successful'])) {
1705
+			echo '
1654 1706
 					<div class="infobox">', $txt['settings_saved'], '</div>';
1707
+	}
1655 1708
 
1656 1709
 	echo '
1657 1710
 					<div id="admincenter">
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 				}
956 956
 
957 957
 				echo isset($config_var['postinput']) ? '
958
-											' . $config_var['postinput'] : '','
958
+											' . $config_var['postinput'] : '', '
959 959
 									</dd>';
960 960
 			}
961 961
 		}
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 								</dl>
1673 1673
 								<input type="submit" name="save_setting" value="', $txt['save'], '" class="button">
1674 1674
 								<div class="block">
1675
-									',template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message') ,'
1675
+									',template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
1676 1676
 								</div>
1677 1677
 								<input type="submit" name="save_new_policy" value="', $txt['policy_save'], '" class="button">
1678 1678
 								<input type="submit" name="update_policy" value="', $txt['policy_update'], '" class="button">								
@@ -1717,11 +1717,11 @@  discard block
 block discarded – undo
1717 1717
 							</div>
1718 1718
 							<div class="windowbg">
1719 1719
 								<dl class="settings">';
1720
-	$count = ( is_array($context['poc']['policy_management']) ? count($context['poc']['policy_management']) : 0);
1720
+	$count = (is_array($context['poc']['policy_management']) ? count($context['poc']['policy_management']) : 0);
1721 1721
 	foreach ($context['poc']['policy_management'] as $row)
1722 1722
 	{
1723 1723
 		echo '
1724
-									<dt>', ($row['new'] ? $txt['policy_current'] : '<input type="submit" name="delete_policy" value="' . $row['name'] . '" class="button">') , '</dt><dd>', $row['amount'], '</dd>';
1724
+									<dt>', ($row['new'] ? $txt['policy_current'] : '<input type="submit" name="delete_policy" value="' . $row['name'] . '" class="button">'), '</dt><dd>', $row['amount'], '</dd>';
1725 1725
 	}
1726 1726
 	echo '
1727 1727
 								</dl>
Please login to merge, or discard this patch.
Sources/ManageSettings.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 					'class' => 'centercol',
1343 1343
 				),
1344 1344
 				'data' => array(
1345
-					'function' => function ($rowData)
1345
+					'function' => function($rowData)
1346 1346
 					{
1347 1347
 						$isChecked = $rowData['disabled'] ? '' : ' checked';
1348 1348
 						$onClickHandler = $rowData['can_show_register'] ? sprintf(' onclick="document.getElementById(\'reg_%1$s\').disabled = !this.checked;"', $rowData['id']) : '';
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
 					'class' => 'centercol',
1359 1359
 				),
1360 1360
 				'data' => array(
1361
-					'function' => function ($rowData)
1361
+					'function' => function($rowData)
1362 1362
 					{
1363 1363
 						$isChecked = $rowData['on_register'] && !$rowData['disabled'] ? ' checked' : '';
1364 1364
 						$isDisabled = $rowData['can_show_register'] ? '' : ' disabled';
@@ -1405,15 +1405,15 @@  discard block
 block discarded – undo
1405 1405
 					'value' => $txt['custom_profile_fieldorder'],
1406 1406
 				),
1407 1407
 				'data' => array(
1408
-					'function' => function ($rowData) use ($context, $txt, $scripturl)
1408
+					'function' => function($rowData) use ($context, $txt, $scripturl)
1409 1409
 					{
1410
-						$return = '<p class="centertext bold_text">'. $rowData['field_order'] .'<br>';
1410
+						$return = '<p class="centertext bold_text">' . $rowData['field_order'] . '<br>';
1411 1411
 
1412 1412
 						if ($rowData['field_order'] > 1)
1413
-							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_up'] .'"></span></a>';
1413
+							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="' . $txt['custom_edit_order_move'] . ' ' . $txt['custom_edit_order_up'] . '"></span></a>';
1414 1414
 
1415 1415
 						if ($rowData['field_order'] < $context['custFieldsMaxOrder'])
1416
-							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_down'] .'"></span></a>';
1416
+							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="' . $txt['custom_edit_order_move'] . ' ' . $txt['custom_edit_order_down'] . '"></span></a>';
1417 1417
 
1418 1418
 						$return .= '</p>';
1419 1419
 
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 					'value' => $txt['custom_profile_fieldname'],
1432 1432
 				),
1433 1433
 				'data' => array(
1434
-					'function' => function ($rowData) use ($scripturl)
1434
+					'function' => function($rowData) use ($scripturl)
1435 1435
 					{
1436 1436
 						return sprintf('<a href="%1$s?action=admin;area=featuresettings;sa=profileedit;fid=%2$d">%3$s</a><div class="smalltext">%4$s</div>', $scripturl, $rowData['id_field'], $rowData['field_name'], $rowData['field_desc']);
1437 1437
 					},
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 					'value' => $txt['custom_profile_fieldtype'],
1448 1448
 				),
1449 1449
 				'data' => array(
1450
-					'function' => function ($rowData) use ($txt)
1450
+					'function' => function($rowData) use ($txt)
1451 1451
 					{
1452 1452
 						$textKey = sprintf('custom_profile_type_%1$s', $rowData['field_type']);
1453 1453
 						return isset($txt[$textKey]) ? $txt[$textKey] : $textKey;
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 					'value' => $txt['custom_profile_active'],
1466 1466
 				),
1467 1467
 				'data' => array(
1468
-					'function' => function ($rowData) use ($txt)
1468
+					'function' => function($rowData) use ($txt)
1469 1469
 					{
1470 1470
 						return $rowData['active'] ? $txt['yes'] : $txt['no'];
1471 1471
 					},
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
 					'value' => $txt['custom_profile_placement'],
1483 1483
 				),
1484 1484
 				'data' => array(
1485
-					'function' => function ($rowData)
1485
+					'function' => function($rowData)
1486 1486
 					{
1487 1487
 						global $txt, $context;
1488 1488
 
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 			redirectexit('action=admin;area=featuresettings;sa=profile'); // @todo implement an error handler
1718 1718
 
1719 1719
 		// All good, proceed.
1720
-		$smcFunc['db_query']('','
1720
+		$smcFunc['db_query']('', '
1721 1721
 			UPDATE {db_prefix}custom_fields
1722 1722
 			SET field_order = {int:old_order}
1723 1723
 			WHERE field_order = {int:new_order}',
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
 				'old_order' => $context['field']['order'],
1727 1727
 			)
1728 1728
 		);
1729
-		$smcFunc['db_query']('','
1729
+		$smcFunc['db_query']('', '
1730 1730
 			UPDATE {db_prefix}custom_fields
1731 1731
 			SET field_order = {int:new_order}
1732 1732
 			WHERE id_field = {int:id_field}',
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 			$smcFunc['db_free_result']($request);
1829 1829
 
1830 1830
 			$unique = false;
1831
-			for ($i = 0; !$unique && $i < 9; $i ++)
1831
+			for ($i = 0; !$unique && $i < 9; $i++)
1832 1832
 			{
1833 1833
 				if (!in_array($col_name, $current_fields))
1834 1834
 					$unique = true;
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
 		);
2002 2002
 
2003 2003
 		// Re-arrange the order.
2004
-		$smcFunc['db_query']('','
2004
+		$smcFunc['db_query']('', '
2005 2005
 			UPDATE {db_prefix}custom_fields
2006 2006
 			SET field_order = field_order - 1
2007 2007
 			WHERE field_order > {int:current_order}',
@@ -2266,7 +2266,7 @@  discard block
 block discarded – undo
2266 2266
 	$context['token_check'] = 'noti-admin';
2267 2267
 
2268 2268
 	// Specify our action since we'll want to post back here instead of the profile
2269
-	$context['action'] = 'action=admin;area=featuresettings;sa=alerts;'. $context['session_var'] .'='. $context['session_id'];
2269
+	$context['action'] = 'action=admin;area=featuresettings;sa=alerts;' . $context['session_var'] . '=' . $context['session_id'];
2270 2270
 
2271 2271
 	loadTemplate('Profile');
2272 2272
 	loadLanguage('Profile');
@@ -2438,10 +2438,10 @@  discard block
 block discarded – undo
2438 2438
 			if (!empty($_REQUEST['save_new_policy']))
2439 2439
 				$currentVersion++;
2440 2440
 			
2441
-			$config_vars[] = array('text', 'policy_text'.$currentVersion);
2442
-			$_POST['policy_text'.$currentVersion] = $_REQUEST['policy_text'];
2441
+			$config_vars[] = array('text', 'policy_text' . $currentVersion);
2442
+			$_POST['policy_text' . $currentVersion] = $_REQUEST['policy_text'];
2443 2443
 			$config_vars[] = array('text', 'policy_version');
2444
-			$_POST['policy_version'] = 'policy_text'.$currentVersion;
2444
+			$_POST['policy_version'] = 'policy_text' . $currentVersion;
2445 2445
 			unset($config_vars[1]);
2446 2446
 			saveDBSettings($config_vars);
2447 2447
 		}
@@ -2499,7 +2499,7 @@  discard block
 block discarded – undo
2499 2499
 			)
2500 2500
 		);
2501 2501
 		
2502
-		$smcFunc['db_query']('','
2502
+		$smcFunc['db_query']('', '
2503 2503
 			DELETE FROM {db_prefix}settings
2504 2504
 			WHERE variable = {string:policy_text}',
2505 2505
 			array(
Please login to merge, or discard this patch.
Braces   +302 added lines, -223 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * This function makes sure the requested subaction does exists, if it doesn't, it sets a default action or.
@@ -212,16 +213,18 @@  discard block
 block discarded – undo
212 213
 	{
213 214
 		$all_zones = timezone_identifiers_list();
214 215
 		// Make sure we set the value to the same as the printed value.
215
-		foreach ($all_zones as $zone)
216
-			$config_vars['default_timezone'][2][$zone] = $zone;
216
+		foreach ($all_zones as $zone) {
217
+					$config_vars['default_timezone'][2][$zone] = $zone;
218
+		}
219
+	} else {
220
+			unset($config_vars['default_timezone']);
217 221
 	}
218
-	else
219
-		unset($config_vars['default_timezone']);
220 222
 
221 223
 	call_integration_hook('integrate_modify_basic_settings', array(&$config_vars));
222 224
 
223
-	if ($return_config)
224
-		return $config_vars;
225
+	if ($return_config) {
226
+			return $config_vars;
227
+	}
225 228
 
226 229
 	// Saving?
227 230
 	if (isset($_GET['save']))
@@ -229,8 +232,9 @@  discard block
 block discarded – undo
229 232
 		checkSession();
230 233
 
231 234
 		// Prevent absurd boundaries here - make it a day tops.
232
-		if (isset($_POST['lastActive']))
233
-			$_POST['lastActive'] = min((int) $_POST['lastActive'], 1440);
235
+		if (isset($_POST['lastActive'])) {
236
+					$_POST['lastActive'] = min((int) $_POST['lastActive'], 1440);
237
+		}
234 238
 
235 239
 		call_integration_hook('integrate_save_basic_settings');
236 240
 
@@ -238,8 +242,9 @@  discard block
 block discarded – undo
238 242
 		$_SESSION['adm-save'] = true;
239 243
 
240 244
 		// Do a bit of housekeeping
241
-		if (empty($_POST['minimize_files']))
242
-			deleteAllMinified();
245
+		if (empty($_POST['minimize_files'])) {
246
+					deleteAllMinified();
247
+		}
243 248
 
244 249
 		writeLog();
245 250
 		redirectexit('action=admin;area=featuresettings;sa=basic');
@@ -279,8 +284,9 @@  discard block
 block discarded – undo
279 284
 
280 285
 	call_integration_hook('integrate_modify_bbc_settings', array(&$config_vars));
281 286
 
282
-	if ($return_config)
283
-		return $config_vars;
287
+	if ($return_config) {
288
+			return $config_vars;
289
+	}
284 290
 
285 291
 	// Setup the template.
286 292
 	require_once($sourcedir . '/ManageServer.php');
@@ -297,13 +303,15 @@  discard block
 block discarded – undo
297 303
 
298 304
 		// Clean up the tags.
299 305
 		$bbcTags = array();
300
-		foreach (parse_bbc(false) as $tag)
301
-			$bbcTags[] = $tag['tag'];
306
+		foreach (parse_bbc(false) as $tag) {
307
+					$bbcTags[] = $tag['tag'];
308
+		}
302 309
 
303
-		if (!isset($_POST['disabledBBC_enabledTags']))
304
-			$_POST['disabledBBC_enabledTags'] = array();
305
-		elseif (!is_array($_POST['disabledBBC_enabledTags']))
306
-			$_POST['disabledBBC_enabledTags'] = array($_POST['disabledBBC_enabledTags']);
310
+		if (!isset($_POST['disabledBBC_enabledTags'])) {
311
+					$_POST['disabledBBC_enabledTags'] = array();
312
+		} elseif (!is_array($_POST['disabledBBC_enabledTags'])) {
313
+					$_POST['disabledBBC_enabledTags'] = array($_POST['disabledBBC_enabledTags']);
314
+		}
307 315
 		// Work out what is actually disabled!
308 316
 		$_POST['disabledBBC'] = implode(',', array_diff($bbcTags, $_POST['disabledBBC_enabledTags']));
309 317
 
@@ -347,8 +355,9 @@  discard block
 block discarded – undo
347 355
 
348 356
 	call_integration_hook('integrate_layout_settings', array(&$config_vars));
349 357
 
350
-	if ($return_config)
351
-		return $config_vars;
358
+	if ($return_config) {
359
+			return $config_vars;
360
+	}
352 361
 
353 362
 	// Saving?
354 363
 	if (isset($_GET['save']))
@@ -388,8 +397,9 @@  discard block
 block discarded – undo
388 397
 
389 398
 	call_integration_hook('integrate_likes_settings', array(&$config_vars));
390 399
 
391
-	if ($return_config)
392
-		return $config_vars;
400
+	if ($return_config) {
401
+			return $config_vars;
402
+	}
393 403
 
394 404
 	// Saving?
395 405
 	if (isset($_GET['save']))
@@ -427,8 +437,9 @@  discard block
 block discarded – undo
427 437
 
428 438
 	call_integration_hook('integrate_mentions_settings', array(&$config_vars));
429 439
 
430
-	if ($return_config)
431
-		return $config_vars;
440
+	if ($return_config) {
441
+			return $config_vars;
442
+	}
432 443
 
433 444
 	// Saving?
434 445
 	if (isset($_GET['save']))
@@ -472,8 +483,8 @@  discard block
 block discarded – undo
472 483
 			'enable' => array('check', 'warning_enable'),
473 484
 	);
474 485
 
475
-	if (!empty($modSettings['warning_settings']) && $currently_enabled)
476
-		$config_vars += array(
486
+	if (!empty($modSettings['warning_settings']) && $currently_enabled) {
487
+			$config_vars += array(
477 488
 			'',
478 489
 				array('int', 'warning_watch', 'subtext' => $txt['setting_warning_watch_note'] . ' ' . $txt['zero_to_disable']),
479 490
 				'moderate' => array('int', 'warning_moderate', 'subtext' => $txt['setting_warning_moderate_note'] . ' ' . $txt['zero_to_disable']),
@@ -482,15 +493,18 @@  discard block
 block discarded – undo
482 493
 				'rem2' => array('int', 'warning_decrement', 'subtext' => $txt['setting_warning_decrement_note'] . ' ' . $txt['zero_to_disable']),
483 494
 				array('permissions', 'view_warning'),
484 495
 		);
496
+	}
485 497
 
486 498
 	call_integration_hook('integrate_warning_settings', array(&$config_vars));
487 499
 
488
-	if ($return_config)
489
-		return $config_vars;
500
+	if ($return_config) {
501
+			return $config_vars;
502
+	}
490 503
 
491 504
 	// Cannot use moderation if post moderation is not enabled.
492
-	if (!$modSettings['postmod_active'])
493
-		unset($config_vars['moderate']);
505
+	if (!$modSettings['postmod_active']) {
506
+			unset($config_vars['moderate']);
507
+	}
494 508
 
495 509
 	// Will need the utility functions from here.
496 510
 	require_once($sourcedir . '/ManageServer.php');
@@ -515,16 +529,16 @@  discard block
 block discarded – undo
515 529
 				'warning_watch' => 10,
516 530
 				'warning_mute' => 60,
517 531
 			);
518
-			if ($modSettings['postmod_active'])
519
-				$vars['warning_moderate'] = 35;
532
+			if ($modSettings['postmod_active']) {
533
+							$vars['warning_moderate'] = 35;
534
+			}
520 535
 
521 536
 			foreach ($vars as $var => $value)
522 537
 			{
523 538
 				$config_vars[] = array('int', $var);
524 539
 				$_POST[$var] = $value;
525 540
 			}
526
-		}
527
-		else
541
+		} else
528 542
 		{
529 543
 			$_POST['warning_watch'] = min($_POST['warning_watch'], 100);
530 544
 			$_POST['warning_moderate'] = $modSettings['postmod_active'] ? min($_POST['warning_moderate'], 100) : 0;
@@ -612,8 +626,9 @@  discard block
 block discarded – undo
612 626
 
613 627
 	call_integration_hook('integrate_spam_settings', array(&$config_vars));
614 628
 
615
-	if ($return_config)
616
-		return $config_vars;
629
+	if ($return_config) {
630
+			return $config_vars;
631
+	}
617 632
 
618 633
 	// You need to be an admin to edit settings!
619 634
 	isAllowedTo('admin_forum');
@@ -647,8 +662,9 @@  discard block
 block discarded – undo
647 662
 
648 663
 	if (empty($context['qa_by_lang'][strtr($language, array('-utf8' => ''))]) && !empty($context['question_answers']))
649 664
 	{
650
-		if (empty($context['settings_insert_above']))
651
-			$context['settings_insert_above'] = '';
665
+		if (empty($context['settings_insert_above'])) {
666
+					$context['settings_insert_above'] = '';
667
+		}
652 668
 
653 669
 		$context['settings_insert_above'] .= '<div class="noticebox">' . sprintf($txt['question_not_defined'], $context['languages'][$language]['name']) . '</div>';
654 670
 	}
@@ -690,8 +706,9 @@  discard block
 block discarded – undo
690 706
 		$_POST['pm_spam_settings'] = (int) $_POST['max_pm_recipients'] . ',' . (int) $_POST['pm_posts_verification'] . ',' . (int) $_POST['pm_posts_per_hour'];
691 707
 
692 708
 		// Hack in guest requiring verification!
693
-		if (empty($_POST['posts_require_captcha']) && !empty($_POST['guests_require_captcha']))
694
-			$_POST['posts_require_captcha'] = -1;
709
+		if (empty($_POST['posts_require_captcha']) && !empty($_POST['guests_require_captcha'])) {
710
+					$_POST['posts_require_captcha'] = -1;
711
+		}
695 712
 
696 713
 		$save_vars = $config_vars;
697 714
 		unset($save_vars['pm1'], $save_vars['pm2'], $save_vars['pm3'], $save_vars['guest_verify']);
@@ -708,14 +725,16 @@  discard block
 block discarded – undo
708 725
 		foreach ($context['qa_languages'] as $lang_id => $dummy)
709 726
 		{
710 727
 			// If we had some questions for this language before, but don't now, delete everything from that language.
711
-			if ((!isset($_POST['question'][$lang_id]) || !is_array($_POST['question'][$lang_id])) && !empty($context['qa_by_lang'][$lang_id]))
712
-				$changes['delete'] = array_merge($questions['delete'], $context['qa_by_lang'][$lang_id]);
728
+			if ((!isset($_POST['question'][$lang_id]) || !is_array($_POST['question'][$lang_id])) && !empty($context['qa_by_lang'][$lang_id])) {
729
+							$changes['delete'] = array_merge($questions['delete'], $context['qa_by_lang'][$lang_id]);
730
+			}
713 731
 
714 732
 			// Now step through and see if any existing questions no longer exist.
715
-			if (!empty($context['qa_by_lang'][$lang_id]))
716
-				foreach ($context['qa_by_lang'][$lang_id] as $q_id)
733
+			if (!empty($context['qa_by_lang'][$lang_id])) {
734
+							foreach ($context['qa_by_lang'][$lang_id] as $q_id)
717 735
 					if (empty($_POST['question'][$lang_id][$q_id]))
718 736
 						$changes['delete'][] = $q_id;
737
+			}
719 738
 
720 739
 			// Now let's see if there are new questions or ones that need updating.
721 740
 			if (isset($_POST['question'][$lang_id]))
@@ -724,14 +743,16 @@  discard block
 block discarded – undo
724 743
 				{
725 744
 					// Ignore junky ids.
726 745
 					$q_id = (int) $q_id;
727
-					if ($q_id <= 0)
728
-						continue;
746
+					if ($q_id <= 0) {
747
+											continue;
748
+					}
729 749
 
730 750
 					// Check the question isn't empty (because they want to delete it?)
731 751
 					if (empty($question) || trim($question) == '')
732 752
 					{
733
-						if (isset($context['question_answers'][$q_id]))
734
-							$changes['delete'][] = $q_id;
753
+						if (isset($context['question_answers'][$q_id])) {
754
+													$changes['delete'][] = $q_id;
755
+						}
735 756
 						continue;
736 757
 					}
737 758
 					$question = $smcFunc['htmlspecialchars'](trim($question));
@@ -739,19 +760,22 @@  discard block
 block discarded – undo
739 760
 					// Get the answers. Firstly check there actually might be some.
740 761
 					if (!isset($_POST['answer'][$lang_id][$q_id]) || !is_array($_POST['answer'][$lang_id][$q_id]))
741 762
 					{
742
-						if (isset($context['question_answers'][$q_id]))
743
-							$changes['delete'][] = $q_id;
763
+						if (isset($context['question_answers'][$q_id])) {
764
+													$changes['delete'][] = $q_id;
765
+						}
744 766
 						continue;
745 767
 					}
746 768
 					// Now get them and check that they might be viable.
747 769
 					$answers = array();
748
-					foreach ($_POST['answer'][$lang_id][$q_id] as $answer)
749
-						if (!empty($answer) && trim($answer) !== '')
770
+					foreach ($_POST['answer'][$lang_id][$q_id] as $answer) {
771
+											if (!empty($answer) && trim($answer) !== '')
750 772
 							$answers[] = $smcFunc['htmlspecialchars'](trim($answer));
773
+					}
751 774
 					if (empty($answers))
752 775
 					{
753
-						if (isset($context['question_answers'][$q_id]))
754
-							$changes['delete'][] = $q_id;
776
+						if (isset($context['question_answers'][$q_id])) {
777
+													$changes['delete'][] = $q_id;
778
+						}
755 779
 						continue;
756 780
 					}
757 781
 					$answers = $smcFunc['json_encode']($answers);
@@ -761,16 +785,17 @@  discard block
 block discarded – undo
761 785
 					{
762 786
 						// New question. Now, we don't want to randomly consume ids, so we'll set those, rather than trusting the browser's supplied ids.
763 787
 						$changes['insert'][] = array($lang_id, $question, $answers);
764
-					}
765
-					else
788
+					} else
766 789
 					{
767 790
 						// It's an existing question. Let's see what's changed, if anything.
768
-						if ($lang_id != $context['question_answers'][$q_id]['lngfile'] || $question != $context['question_answers'][$q_id]['question'] || $answers != $context['question_answers'][$q_id]['answers'])
769
-							$changes['replace'][$q_id] = array('lngfile' => $lang_id, 'question' => $question, 'answers' => $answers);
791
+						if ($lang_id != $context['question_answers'][$q_id]['lngfile'] || $question != $context['question_answers'][$q_id]['question'] || $answers != $context['question_answers'][$q_id]['answers']) {
792
+													$changes['replace'][$q_id] = array('lngfile' => $lang_id, 'question' => $question, 'answers' => $answers);
793
+						}
770 794
 					}
771 795
 
772
-					if (!isset($qs_per_lang[$lang_id]))
773
-						$qs_per_lang[$lang_id] = 0;
796
+					if (!isset($qs_per_lang[$lang_id])) {
797
+											$qs_per_lang[$lang_id] = 0;
798
+					}
774 799
 					$qs_per_lang[$lang_id]++;
775 800
 				}
776 801
 			}
@@ -820,8 +845,9 @@  discard block
 block discarded – undo
820 845
 
821 846
 		// Lastly, the count of messages needs to be no more than the lowest number of questions for any one language.
822 847
 		$count_questions = empty($qs_per_lang) ? 0 : min($qs_per_lang);
823
-		if (empty($count_questions) || $_POST['qa_verification_number'] > $count_questions)
824
-			$_POST['qa_verification_number'] = $count_questions;
848
+		if (empty($count_questions) || $_POST['qa_verification_number'] > $count_questions) {
849
+					$_POST['qa_verification_number'] = $count_questions;
850
+		}
825 851
 
826 852
 		call_integration_hook('integrate_save_spam_settings', array(&$save_vars));
827 853
 
@@ -836,24 +862,27 @@  discard block
 block discarded – undo
836 862
 
837 863
 	$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P', 'R'), range('T', 'Y'));
838 864
 	$_SESSION['visual_verification_code'] = '';
839
-	for ($i = 0; $i < 6; $i++)
840
-		$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
865
+	for ($i = 0; $i < 6; $i++) {
866
+			$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
867
+	}
841 868
 
842 869
 	// Some javascript for CAPTCHA.
843 870
 	$context['settings_post_javascript'] = '';
844
-	if ($context['use_graphic_library'])
845
-		$context['settings_post_javascript'] .= '
871
+	if ($context['use_graphic_library']) {
872
+			$context['settings_post_javascript'] .= '
846 873
 		function refreshImages()
847 874
 		{
848 875
 			var imageType = document.getElementById(\'visual_verification_type\').value;
849 876
 			document.getElementById(\'verification_image\').src = \'' . $context['verification_image_href'] . ';type=\' + imageType;
850 877
 		}';
878
+	}
851 879
 
852 880
 	// Show the image itself, or text saying we can't.
853
-	if ($context['use_graphic_library'])
854
-		$config_vars['vv']['postinput'] = '<br><img src="' . $context['verification_image_href'] . ';type=' . (empty($modSettings['visual_verification_type']) ? 0 : $modSettings['visual_verification_type']) . '" alt="' . $txt['setting_image_verification_sample'] . '" id="verification_image"><br>';
855
-	else
856
-		$config_vars['vv']['postinput'] = '<br><span class="smalltext">' . $txt['setting_image_verification_nogd'] . '</span>';
881
+	if ($context['use_graphic_library']) {
882
+			$config_vars['vv']['postinput'] = '<br><img src="' . $context['verification_image_href'] . ';type=' . (empty($modSettings['visual_verification_type']) ? 0 : $modSettings['visual_verification_type']) . '" alt="' . $txt['setting_image_verification_sample'] . '" id="verification_image"><br>';
883
+	} else {
884
+			$config_vars['vv']['postinput'] = '<br><span class="smalltext">' . $txt['setting_image_verification_nogd'] . '</span>';
885
+	}
857 886
 
858 887
 	// Hack for PM spam settings.
859 888
 	list ($modSettings['max_pm_recipients'], $modSettings['pm_posts_verification'], $modSettings['pm_posts_per_hour']) = explode(',', $modSettings['pm_spam_settings']);
@@ -863,9 +892,10 @@  discard block
 block discarded – undo
863 892
 	$modSettings['posts_require_captcha'] = !isset($modSettings['posts_require_captcha']) || $modSettings['posts_require_captcha'] == -1 ? 0 : $modSettings['posts_require_captcha'];
864 893
 
865 894
 	// Some minor javascript for the guest post setting.
866
-	if ($modSettings['posts_require_captcha'])
867
-		$context['settings_post_javascript'] .= '
895
+	if ($modSettings['posts_require_captcha']) {
896
+			$context['settings_post_javascript'] .= '
868 897
 		document.getElementById(\'guests_require_captcha\').disabled = true;';
898
+	}
869 899
 
870 900
 	// And everything else.
871 901
 	$context['post_url'] = $scripturl . '?action=admin;area=antispam;save';
@@ -912,8 +942,9 @@  discard block
 block discarded – undo
912 942
 
913 943
 	call_integration_hook('integrate_signature_settings', array(&$config_vars));
914 944
 
915
-	if ($return_config)
916
-		return $config_vars;
945
+	if ($return_config) {
946
+			return $config_vars;
947
+	}
917 948
 
918 949
 	// Setup the template.
919 950
 	$context['page_title'] = $txt['signature_settings'];
@@ -968,8 +999,9 @@  discard block
 block discarded – undo
968 999
 				$sig = strtr($row['signature'], array('<br>' => "\n"));
969 1000
 
970 1001
 				// Max characters...
971
-				if (!empty($sig_limits[1]))
972
-					$sig = $smcFunc['substr']($sig, 0, $sig_limits[1]);
1002
+				if (!empty($sig_limits[1])) {
1003
+									$sig = $smcFunc['substr']($sig, 0, $sig_limits[1]);
1004
+				}
973 1005
 				// Max lines...
974 1006
 				if (!empty($sig_limits[2]))
975 1007
 				{
@@ -979,8 +1011,9 @@  discard block
 block discarded – undo
979 1011
 						if ($sig[$i] == "\n")
980 1012
 						{
981 1013
 							$count++;
982
-							if ($count >= $sig_limits[2])
983
-								$sig = substr($sig, 0, $i) . strtr(substr($sig, $i), array("\n" => ' '));
1014
+							if ($count >= $sig_limits[2]) {
1015
+															$sig = substr($sig, 0, $i) . strtr(substr($sig, $i), array("\n" => ' '));
1016
+							}
984 1017
 						}
985 1018
 					}
986 1019
 				}
@@ -991,17 +1024,19 @@  discard block
 block discarded – undo
991 1024
 					{
992 1025
 						$limit_broke = 0;
993 1026
 						// Attempt to allow all sizes of abuse, so to speak.
994
-						if ($matches[2][$ind] == 'px' && $size > $sig_limits[7])
995
-							$limit_broke = $sig_limits[7] . 'px';
996
-						elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75))
997
-							$limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt';
998
-						elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16))
999
-							$limit_broke = ((float) $sig_limits[7] / 16) . 'em';
1000
-						elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18)
1001
-							$limit_broke = 'large';
1002
-
1003
-						if ($limit_broke)
1004
-							$sig = str_replace($matches[0][$ind], '[size=' . $sig_limits[7] . 'px', $sig);
1027
+						if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) {
1028
+													$limit_broke = $sig_limits[7] . 'px';
1029
+						} elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) {
1030
+													$limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt';
1031
+						} elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) {
1032
+													$limit_broke = ((float) $sig_limits[7] / 16) . 'em';
1033
+						} elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) {
1034
+													$limit_broke = 'large';
1035
+						}
1036
+
1037
+						if ($limit_broke) {
1038
+													$sig = str_replace($matches[0][$ind], '[size=' . $sig_limits[7] . 'px', $sig);
1039
+						}
1005 1040
 					}
1006 1041
 				}
1007 1042
 
@@ -1057,32 +1092,34 @@  discard block
 block discarded – undo
1057 1092
 											$img_offset = false;
1058 1093
 										}
1059 1094
 									}
1095
+								} else {
1096
+																	$replaces[$image] = '';
1060 1097
 								}
1061
-								else
1062
-									$replaces[$image] = '';
1063 1098
 
1064 1099
 								continue;
1065 1100
 							}
1066 1101
 
1067 1102
 							// Does it have predefined restraints? Width first.
1068
-							if ($matches[6][$key])
1069
-								$matches[2][$key] = $matches[6][$key];
1103
+							if ($matches[6][$key]) {
1104
+															$matches[2][$key] = $matches[6][$key];
1105
+							}
1070 1106
 							if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5])
1071 1107
 							{
1072 1108
 								$width = $sig_limits[5];
1073 1109
 								$matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]);
1110
+							} elseif ($matches[2][$key]) {
1111
+															$width = $matches[2][$key];
1074 1112
 							}
1075
-							elseif ($matches[2][$key])
1076
-								$width = $matches[2][$key];
1077 1113
 							// ... and height.
1078 1114
 							if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6])
1079 1115
 							{
1080 1116
 								$height = $sig_limits[6];
1081
-								if ($width != -1)
1082
-									$width = $width * ($height / $matches[4][$key]);
1117
+								if ($width != -1) {
1118
+																	$width = $width * ($height / $matches[4][$key]);
1119
+								}
1120
+							} elseif ($matches[4][$key]) {
1121
+															$height = $matches[4][$key];
1083 1122
 							}
1084
-							elseif ($matches[4][$key])
1085
-								$height = $matches[4][$key];
1086 1123
 
1087 1124
 							// If the dimensions are still not fixed - we need to check the actual image.
1088 1125
 							if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6]))
@@ -1100,12 +1137,13 @@  discard block
 block discarded – undo
1100 1137
 									if ($sizes[1] > $sig_limits[6] && $sig_limits[6])
1101 1138
 									{
1102 1139
 										$height = $sig_limits[6];
1103
-										if ($width == -1)
1104
-											$width = $sizes[0];
1140
+										if ($width == -1) {
1141
+																					$width = $sizes[0];
1142
+										}
1105 1143
 										$width = $width * ($height / $sizes[1]);
1144
+									} elseif ($width != -1) {
1145
+																			$height = $sizes[1];
1106 1146
 									}
1107
-									elseif ($width != -1)
1108
-										$height = $sizes[1];
1109 1147
 								}
1110 1148
 							}
1111 1149
 
@@ -1118,8 +1156,9 @@  discard block
 block discarded – undo
1118 1156
 							// Record that we got one.
1119 1157
 							$image_count_holder[$image] = isset($image_count_holder[$image]) ? $image_count_holder[$image] + 1 : 1;
1120 1158
 						}
1121
-						if (!empty($replaces))
1122
-							$sig = str_replace(array_keys($replaces), array_values($replaces), $sig);
1159
+						if (!empty($replaces)) {
1160
+													$sig = str_replace(array_keys($replaces), array_values($replaces), $sig);
1161
+						}
1123 1162
 					}
1124 1163
 				}
1125 1164
 				// Try to fix disabled tags.
@@ -1131,18 +1170,20 @@  discard block
 block discarded – undo
1131 1170
 
1132 1171
 				$sig = strtr($sig, array("\n" => '<br>'));
1133 1172
 				call_integration_hook('integrate_apply_signature_settings', array(&$sig, $sig_limits, $disabledTags));
1134
-				if ($sig != $row['signature'])
1135
-					$changes[$row['id_member']] = $sig;
1173
+				if ($sig != $row['signature']) {
1174
+									$changes[$row['id_member']] = $sig;
1175
+				}
1176
+			}
1177
+			if ($smcFunc['db_num_rows']($request) == 0) {
1178
+							$done = true;
1136 1179
 			}
1137
-			if ($smcFunc['db_num_rows']($request) == 0)
1138
-				$done = true;
1139 1180
 			$smcFunc['db_free_result']($request);
1140 1181
 
1141 1182
 			// Do we need to delete what we have?
1142 1183
 			if (!empty($changes))
1143 1184
 			{
1144
-				foreach ($changes as $id => $sig)
1145
-					$smcFunc['db_query']('', '
1185
+				foreach ($changes as $id => $sig) {
1186
+									$smcFunc['db_query']('', '
1146 1187
 						UPDATE {db_prefix}members
1147 1188
 						SET signature = {string:signature}
1148 1189
 						WHERE id_member = {int:id_member}',
@@ -1151,11 +1192,13 @@  discard block
 block discarded – undo
1151 1192
 							'signature' => $sig,
1152 1193
 						)
1153 1194
 					);
1195
+				}
1154 1196
 			}
1155 1197
 
1156 1198
 			$_GET['step'] += 50;
1157
-			if (!$done)
1158
-				pauseSignatureApplySettings();
1199
+			if (!$done) {
1200
+							pauseSignatureApplySettings();
1201
+			}
1159 1202
 		}
1160 1203
 		$settings_applied = true;
1161 1204
 	}
@@ -1173,8 +1216,9 @@  discard block
 block discarded – undo
1173 1216
 	);
1174 1217
 
1175 1218
 	// Temporarily make each setting a modSetting!
1176
-	foreach ($context['signature_settings'] as $key => $value)
1177
-		$modSettings['signature_' . $key] = $value;
1219
+	foreach ($context['signature_settings'] as $key => $value) {
1220
+			$modSettings['signature_' . $key] = $value;
1221
+	}
1178 1222
 
1179 1223
 	// Make sure we check the right tags!
1180 1224
 	$modSettings['bbc_disabled_signature_bbc'] = $disabledTags;
@@ -1186,23 +1230,26 @@  discard block
 block discarded – undo
1186 1230
 
1187 1231
 		// Clean up the tag stuff!
1188 1232
 		$bbcTags = array();
1189
-		foreach (parse_bbc(false) as $tag)
1190
-			$bbcTags[] = $tag['tag'];
1233
+		foreach (parse_bbc(false) as $tag) {
1234
+					$bbcTags[] = $tag['tag'];
1235
+		}
1191 1236
 
1192
-		if (!isset($_POST['signature_bbc_enabledTags']))
1193
-			$_POST['signature_bbc_enabledTags'] = array();
1194
-		elseif (!is_array($_POST['signature_bbc_enabledTags']))
1195
-			$_POST['signature_bbc_enabledTags'] = array($_POST['signature_bbc_enabledTags']);
1237
+		if (!isset($_POST['signature_bbc_enabledTags'])) {
1238
+					$_POST['signature_bbc_enabledTags'] = array();
1239
+		} elseif (!is_array($_POST['signature_bbc_enabledTags'])) {
1240
+					$_POST['signature_bbc_enabledTags'] = array($_POST['signature_bbc_enabledTags']);
1241
+		}
1196 1242
 
1197 1243
 		$sig_limits = array();
1198 1244
 		foreach ($context['signature_settings'] as $key => $value)
1199 1245
 		{
1200
-			if ($key == 'allow_smileys')
1201
-				continue;
1202
-			elseif ($key == 'max_smileys' && empty($_POST['signature_allow_smileys']))
1203
-				$sig_limits[] = -1;
1204
-			else
1205
-				$sig_limits[] = !empty($_POST['signature_' . $key]) ? max(1, (int) $_POST['signature_' . $key]) : 0;
1246
+			if ($key == 'allow_smileys') {
1247
+							continue;
1248
+			} elseif ($key == 'max_smileys' && empty($_POST['signature_allow_smileys'])) {
1249
+							$sig_limits[] = -1;
1250
+			} else {
1251
+							$sig_limits[] = !empty($_POST['signature_' . $key]) ? max(1, (int) $_POST['signature_' . $key]) : 0;
1252
+			}
1206 1253
 		}
1207 1254
 
1208 1255
 		call_integration_hook('integrate_save_signature_settings', array(&$sig_limits, &$bbcTags));
@@ -1235,12 +1282,14 @@  discard block
 block discarded – undo
1235 1282
 
1236 1283
 	// Try get more time...
1237 1284
 	@set_time_limit(600);
1238
-	if (function_exists('apache_reset_timeout'))
1239
-		@apache_reset_timeout();
1285
+	if (function_exists('apache_reset_timeout')) {
1286
+			@apache_reset_timeout();
1287
+	}
1240 1288
 
1241 1289
 	// Have we exhausted all the time we allowed?
1242
-	if (time() - array_sum(explode(' ', $sig_start)) < 3)
1243
-		return;
1290
+	if (time() - array_sum(explode(' ', $sig_start)) < 3) {
1291
+			return;
1292
+	}
1244 1293
 
1245 1294
 	$context['continue_get_data'] = '?action=admin;area=featuresettings;sa=sig;apply;step=' . $_GET['step'] . ';' . $context['session_var'] . '=' . $context['session_id'];
1246 1295
 	$context['page_title'] = $txt['not_done_title'];
@@ -1286,9 +1335,10 @@  discard block
 block discarded – undo
1286 1335
 		$disable_fields = array_flip($standard_fields);
1287 1336
 		if (!empty($_POST['active']))
1288 1337
 		{
1289
-			foreach ($_POST['active'] as $value)
1290
-				if (isset($disable_fields[$value]))
1338
+			foreach ($_POST['active'] as $value) {
1339
+							if (isset($disable_fields[$value]))
1291 1340
 					unset($disable_fields[$value]);
1341
+			}
1292 1342
 		}
1293 1343
 		// What we have left!
1294 1344
 		$changes['disabled_profile_fields'] = empty($disable_fields) ? '' : implode(',', array_keys($disable_fields));
@@ -1297,16 +1347,18 @@  discard block
 block discarded – undo
1297 1347
 		$reg_fields = array();
1298 1348
 		if (!empty($_POST['reg']))
1299 1349
 		{
1300
-			foreach ($_POST['reg'] as $value)
1301
-				if (in_array($value, $standard_fields) && !isset($disable_fields[$value]))
1350
+			foreach ($_POST['reg'] as $value) {
1351
+							if (in_array($value, $standard_fields) && !isset($disable_fields[$value]))
1302 1352
 					$reg_fields[] = $value;
1353
+			}
1303 1354
 		}
1304 1355
 		// What we have left!
1305 1356
 		$changes['registration_fields'] = empty($reg_fields) ? '' : implode(',', $reg_fields);
1306 1357
 
1307 1358
 		$_SESSION['adm-save'] = true;
1308
-		if (!empty($changes))
1309
-			updateSettings($changes);
1359
+		if (!empty($changes)) {
1360
+					updateSettings($changes);
1361
+		}
1310 1362
 	}
1311 1363
 
1312 1364
 	createToken('admin-scp');
@@ -1409,11 +1461,13 @@  discard block
 block discarded – undo
1409 1461
 					{
1410 1462
 						$return = '<p class="centertext bold_text">'. $rowData['field_order'] .'<br>';
1411 1463
 
1412
-						if ($rowData['field_order'] > 1)
1413
-							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_up'] .'"></span></a>';
1464
+						if ($rowData['field_order'] > 1) {
1465
+													$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_up'] .'"></span></a>';
1466
+						}
1414 1467
 
1415
-						if ($rowData['field_order'] < $context['custFieldsMaxOrder'])
1416
-							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_down'] .'"></span></a>';
1468
+						if ($rowData['field_order'] < $context['custFieldsMaxOrder']) {
1469
+													$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_down'] .'"></span></a>';
1470
+						}
1417 1471
 
1418 1472
 						$return .= '</p>';
1419 1473
 
@@ -1551,16 +1605,16 @@  discard block
 block discarded – undo
1551 1605
 		$disabled_fields = isset($modSettings['disabled_profile_fields']) ? explode(',', $modSettings['disabled_profile_fields']) : array();
1552 1606
 		$registration_fields = isset($modSettings['registration_fields']) ? explode(',', $modSettings['registration_fields']) : array();
1553 1607
 
1554
-		foreach ($standard_fields as $field)
1555
-			$list[] = array(
1608
+		foreach ($standard_fields as $field) {
1609
+					$list[] = array(
1556 1610
 				'id' => $field,
1557 1611
 				'label' => isset($txt['standard_profile_field_' . $field]) ? $txt['standard_profile_field_' . $field] : (isset($txt[$field]) ? $txt[$field] : $field),
1558 1612
 				'disabled' => in_array($field, $disabled_fields),
1559 1613
 				'on_register' => in_array($field, $registration_fields) && !in_array($field, $fields_no_registration),
1560 1614
 				'can_show_register' => !in_array($field, $fields_no_registration),
1561 1615
 			);
1562
-	}
1563
-	else
1616
+		}
1617
+	} else
1564 1618
 	{
1565 1619
 		// Load all the fields.
1566 1620
 		$request = $smcFunc['db_query']('', '
@@ -1574,8 +1628,9 @@  discard block
 block discarded – undo
1574 1628
 				'items_per_page' => $items_per_page,
1575 1629
 			)
1576 1630
 		);
1577
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1578
-			$list[] = $row;
1631
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1632
+					$list[] = $row;
1633
+		}
1579 1634
 		$smcFunc['db_free_result']($request);
1580 1635
 	}
1581 1636
 
@@ -1641,9 +1696,9 @@  discard block
 block discarded – undo
1641 1696
 		$context['field'] = array();
1642 1697
 		while ($row = $smcFunc['db_fetch_assoc']($request))
1643 1698
 		{
1644
-			if ($row['field_type'] == 'textarea')
1645
-				@list ($rows, $cols) = @explode(',', $row['default_value']);
1646
-			else
1699
+			if ($row['field_type'] == 'textarea') {
1700
+							@list ($rows, $cols) = @explode(',', $row['default_value']);
1701
+			} else
1647 1702
 			{
1648 1703
 				$rows = 3;
1649 1704
 				$cols = 30;
@@ -1679,8 +1734,8 @@  discard block
 block discarded – undo
1679 1734
 	}
1680 1735
 
1681 1736
 	// Setup the default values as needed.
1682
-	if (empty($context['field']))
1683
-		$context['field'] = array(
1737
+	if (empty($context['field'])) {
1738
+			$context['field'] = array(
1684 1739
 			'name' => '',
1685 1740
 			'col_name' => '???',
1686 1741
 			'desc' => '',
@@ -1705,6 +1760,7 @@  discard block
 block discarded – undo
1705 1760
 			'enclose' => '',
1706 1761
 			'placement' => 0,
1707 1762
 		);
1763
+	}
1708 1764
 
1709 1765
 	// Are we moving it?
1710 1766
 	if (isset($_GET['move']) && in_array($smcFunc['htmlspecialchars']($_GET['move']), $move_to))
@@ -1713,8 +1769,10 @@  discard block
 block discarded – undo
1713 1769
 		$new_order = ($_GET['move'] == 'up' ? ($context['field']['order'] - 1) : ($context['field']['order'] + 1));
1714 1770
 
1715 1771
 		// Is this a valid position?
1716
-		if ($new_order <= 0 || $new_order > $order_count)
1717
-			redirectexit('action=admin;area=featuresettings;sa=profile'); // @todo implement an error handler
1772
+		if ($new_order <= 0 || $new_order > $order_count) {
1773
+					redirectexit('action=admin;area=featuresettings;sa=profile');
1774
+		}
1775
+		// @todo implement an error handler
1718 1776
 
1719 1777
 		// All good, proceed.
1720 1778
 		$smcFunc['db_query']('','
@@ -1745,12 +1803,14 @@  discard block
 block discarded – undo
1745 1803
 		validateToken('admin-ecp');
1746 1804
 
1747 1805
 		// Everyone needs a name - even the (bracket) unknown...
1748
-		if (trim($_POST['field_name']) == '')
1749
-			redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=need_name');
1806
+		if (trim($_POST['field_name']) == '') {
1807
+					redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=need_name');
1808
+		}
1750 1809
 
1751 1810
 		// Regex you say?  Do a very basic test to see if the pattern is valid
1752
-		if (!empty($_POST['regex']) && @preg_match($_POST['regex'], 'dummy') === false)
1753
-			redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=regex_error');
1811
+		if (!empty($_POST['regex']) && @preg_match($_POST['regex'], 'dummy') === false) {
1812
+					redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=regex_error');
1813
+		}
1754 1814
 
1755 1815
 		$_POST['field_name'] = $smcFunc['htmlspecialchars']($_POST['field_name']);
1756 1816
 		$_POST['field_desc'] = $smcFunc['htmlspecialchars']($_POST['field_desc']);
@@ -1767,8 +1827,9 @@  discard block
 block discarded – undo
1767 1827
 
1768 1828
 		// Some masking stuff...
1769 1829
 		$mask = isset($_POST['mask']) ? $_POST['mask'] : '';
1770
-		if ($mask == 'regex' && isset($_POST['regex']))
1771
-			$mask .= $_POST['regex'];
1830
+		if ($mask == 'regex' && isset($_POST['regex'])) {
1831
+					$mask .= $_POST['regex'];
1832
+		}
1772 1833
 
1773 1834
 		$field_length = isset($_POST['max_length']) ? (int) $_POST['max_length'] : 255;
1774 1835
 		$enclose = isset($_POST['enclose']) ? $_POST['enclose'] : '';
@@ -1787,8 +1848,9 @@  discard block
 block discarded – undo
1787 1848
 				$v = strtr($v, array(',' => ''));
1788 1849
 
1789 1850
 				// Nada, zip, etc...
1790
-				if (trim($v) == '')
1791
-					continue;
1851
+				if (trim($v) == '') {
1852
+									continue;
1853
+				}
1792 1854
 
1793 1855
 				// Otherwise, save it boy.
1794 1856
 				$field_options .= $v . ',';
@@ -1796,15 +1858,17 @@  discard block
 block discarded – undo
1796 1858
 				$newOptions[$k] = $v;
1797 1859
 
1798 1860
 				// Is it default?
1799
-				if (isset($_POST['default_select']) && $_POST['default_select'] == $k)
1800
-					$default = $v;
1861
+				if (isset($_POST['default_select']) && $_POST['default_select'] == $k) {
1862
+									$default = $v;
1863
+				}
1801 1864
 			}
1802 1865
 			$field_options = substr($field_options, 0, -1);
1803 1866
 		}
1804 1867
 
1805 1868
 		// Text area has default has dimensions
1806
-		if ($_POST['field_type'] == 'textarea')
1807
-			$default = (int) $_POST['rows'] . ',' . (int) $_POST['cols'];
1869
+		if ($_POST['field_type'] == 'textarea') {
1870
+					$default = (int) $_POST['rows'] . ',' . (int) $_POST['cols'];
1871
+		}
1808 1872
 
1809 1873
 		// Come up with the unique name?
1810 1874
 		if (empty($context['fid']))
@@ -1813,32 +1877,36 @@  discard block
 block discarded – undo
1813 1877
 			preg_match('~([\w\d_-]+)~', $col_name, $matches);
1814 1878
 
1815 1879
 			// If there is nothing to the name, then let's start out own - for foreign languages etc.
1816
-			if (isset($matches[1]))
1817
-				$col_name = $initial_col_name = 'cust_' . strtolower($matches[1]);
1818
-			else
1819
-				$col_name = $initial_col_name = 'cust_' . mt_rand(1, 9999);
1880
+			if (isset($matches[1])) {
1881
+							$col_name = $initial_col_name = 'cust_' . strtolower($matches[1]);
1882
+			} else {
1883
+							$col_name = $initial_col_name = 'cust_' . mt_rand(1, 9999);
1884
+			}
1820 1885
 
1821 1886
 			// Make sure this is unique.
1822 1887
 			$current_fields = array();
1823 1888
 			$request = $smcFunc['db_query']('', '
1824 1889
 				SELECT id_field, col_name
1825 1890
 				FROM {db_prefix}custom_fields');
1826
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1827
-				$current_fields[$row['id_field']] = $row['col_name'];
1891
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1892
+							$current_fields[$row['id_field']] = $row['col_name'];
1893
+			}
1828 1894
 			$smcFunc['db_free_result']($request);
1829 1895
 
1830 1896
 			$unique = false;
1831 1897
 			for ($i = 0; !$unique && $i < 9; $i ++)
1832 1898
 			{
1833
-				if (!in_array($col_name, $current_fields))
1834
-					$unique = true;
1835
-				else
1836
-					$col_name = $initial_col_name . $i;
1899
+				if (!in_array($col_name, $current_fields)) {
1900
+									$unique = true;
1901
+				} else {
1902
+									$col_name = $initial_col_name . $i;
1903
+				}
1837 1904
 			}
1838 1905
 
1839 1906
 			// Still not a unique column name? Leave it up to the user, then.
1840
-			if (!$unique)
1841
-				fatal_lang_error('custom_option_not_unique');
1907
+			if (!$unique) {
1908
+							fatal_lang_error('custom_option_not_unique');
1909
+			}
1842 1910
 		}
1843 1911
 		// Work out what to do with the user data otherwise...
1844 1912
 		else
@@ -1866,8 +1934,9 @@  discard block
 block discarded – undo
1866 1934
 				// Work out what's changed!
1867 1935
 				foreach ($context['field']['options'] as $k => $option)
1868 1936
 				{
1869
-					if (trim($option) == '')
1870
-						continue;
1937
+					if (trim($option) == '') {
1938
+											continue;
1939
+					}
1871 1940
 
1872 1941
 					// Still exists?
1873 1942
 					if (in_array($option, $newOptions))
@@ -1881,8 +1950,8 @@  discard block
 block discarded – undo
1881 1950
 				foreach ($optionChanges as $k => $option)
1882 1951
 				{
1883 1952
 					// Just been renamed?
1884
-					if (!in_array($k, $takenKeys) && !empty($newOptions[$k]))
1885
-						$smcFunc['db_query']('', '
1953
+					if (!in_array($k, $takenKeys) && !empty($newOptions[$k])) {
1954
+											$smcFunc['db_query']('', '
1886 1955
 							UPDATE {db_prefix}themes
1887 1956
 							SET value = {string:new_value}
1888 1957
 							WHERE variable = {string:current_column}
@@ -1895,6 +1964,7 @@  discard block
 block discarded – undo
1895 1964
 								'old_value' => $option,
1896 1965
 							)
1897 1966
 						);
1967
+					}
1898 1968
 				}
1899 1969
 			}
1900 1970
 			// @todo Maybe we should adjust based on new text length limits?
@@ -1937,8 +2007,8 @@  discard block
 block discarded – undo
1937 2007
 			);
1938 2008
 
1939 2009
 			// Just clean up any old selects - these are a pain!
1940
-			if (($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio') && !empty($newOptions))
1941
-				$smcFunc['db_query']('', '
2010
+			if (($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio') && !empty($newOptions)) {
2011
+							$smcFunc['db_query']('', '
1942 2012
 					DELETE FROM {db_prefix}themes
1943 2013
 					WHERE variable = {string:current_column}
1944 2014
 						AND value NOT IN ({array_string:new_option_values})
@@ -1949,8 +2019,8 @@  discard block
 block discarded – undo
1949 2019
 						'current_column' => $context['field']['col_name'],
1950 2020
 					)
1951 2021
 				);
1952
-		}
1953
-		else
2022
+			}
2023
+		} else
1954 2024
 		{
1955 2025
 			// Gotta figure it out the order.
1956 2026
 			$new_order = $order_count > 1 ? ($order_count + 1) : 1;
@@ -2125,11 +2195,13 @@  discard block
 block discarded – undo
2125 2195
 	call_integration_hook('integrate_prune_settings', array(&$config_vars, &$prune_toggle, false));
2126 2196
 
2127 2197
 	$prune_toggle_dt = array();
2128
-	foreach ($prune_toggle as $item)
2129
-		$prune_toggle_dt[] = 'setting_' . $item;
2198
+	foreach ($prune_toggle as $item) {
2199
+			$prune_toggle_dt[] = 'setting_' . $item;
2200
+	}
2130 2201
 
2131
-	if ($return_config)
2132
-		return $config_vars;
2202
+	if ($return_config) {
2203
+			return $config_vars;
2204
+	}
2133 2205
 
2134 2206
 	addInlineJavaScript('
2135 2207
 	function togglePruned()
@@ -2167,15 +2239,16 @@  discard block
 block discarded – undo
2167 2239
 			$vals = array();
2168 2240
 			foreach ($config_vars as $index => $dummy)
2169 2241
 			{
2170
-				if (!is_array($dummy) || $index == 'pruningOptions' || !in_array($dummy[1], $prune_toggle))
2171
-					continue;
2242
+				if (!is_array($dummy) || $index == 'pruningOptions' || !in_array($dummy[1], $prune_toggle)) {
2243
+									continue;
2244
+				}
2172 2245
 
2173 2246
 				$vals[] = empty($_POST[$dummy[1]]) || $_POST[$dummy[1]] < 0 ? 0 : (int) $_POST[$dummy[1]];
2174 2247
 			}
2175 2248
 			$_POST['pruningOptions'] = implode(',', $vals);
2249
+		} else {
2250
+					$_POST['pruningOptions'] = '';
2176 2251
 		}
2177
-		else
2178
-			$_POST['pruningOptions'] = '';
2179 2252
 
2180 2253
 		saveDBSettings($savevar);
2181 2254
 		$_SESSION['adm-save'] = true;
@@ -2187,10 +2260,11 @@  discard block
 block discarded – undo
2187 2260
 	$context['sub_template'] = 'show_settings';
2188 2261
 
2189 2262
 	// Get the actual values
2190
-	if (!empty($modSettings['pruningOptions']))
2191
-		@list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneSpiderHitLog']) = explode(',', $modSettings['pruningOptions']);
2192
-	else
2193
-		$modSettings['pruneErrorLog'] = $modSettings['pruneModLog'] = $modSettings['pruneBanLog'] = $modSettings['pruneReportLog'] = $modSettings['pruneScheduledTaskLog'] = $modSettings['pruneSpiderHitLog'] = 0;
2263
+	if (!empty($modSettings['pruningOptions'])) {
2264
+			@list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneSpiderHitLog']) = explode(',', $modSettings['pruningOptions']);
2265
+	} else {
2266
+			$modSettings['pruneErrorLog'] = $modSettings['pruneModLog'] = $modSettings['pruneBanLog'] = $modSettings['pruneReportLog'] = $modSettings['pruneScheduledTaskLog'] = $modSettings['pruneSpiderHitLog'] = 0;
2267
+	}
2194 2268
 
2195 2269
 	prepareDBSettingContext($config_vars);
2196 2270
 }
@@ -2212,8 +2286,9 @@  discard block
 block discarded – undo
2212 2286
 	// Make it even easier to add new settings.
2213 2287
 	call_integration_hook('integrate_general_mod_settings', array(&$config_vars));
2214 2288
 
2215
-	if ($return_config)
2216
-		return $config_vars;
2289
+	if ($return_config) {
2290
+			return $config_vars;
2291
+	}
2217 2292
 
2218 2293
 	$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=general';
2219 2294
 	$context['settings_title'] = $txt['mods_cat_modifications_misc'];
@@ -2300,8 +2375,9 @@  discard block
 block discarded – undo
2300 2375
 
2301 2376
 	call_integration_hook('integrate_privacy_settings', array(&$config_vars));
2302 2377
 
2303
-	if ($return_config)
2304
-		return $config_vars;
2378
+	if ($return_config) {
2379
+			return $config_vars;
2380
+	}
2305 2381
 
2306 2382
 	// Saving?
2307 2383
 	if (isset($_GET['save']))
@@ -2400,8 +2476,9 @@  discard block
 block discarded – undo
2400 2476
 		);
2401 2477
 	}
2402 2478
 	$smcFunc['db_free_result']($request);
2403
-	if ($return_config)
2404
-		return $config_vars;
2479
+	if ($return_config) {
2480
+			return $config_vars;
2481
+	}
2405 2482
 
2406 2483
 	// Saving?
2407 2484
 	if (isset($_GET['save']))
@@ -2412,8 +2489,8 @@  discard block
 block discarded – undo
2412 2489
 
2413 2490
 		if (!empty($_REQUEST['enforce_new']))
2414 2491
 		{
2415
-			if ($smcFunc['db_title'] == 'MySQLi')
2416
-				$select = '
2492
+			if ($smcFunc['db_title'] == 'MySQLi') {
2493
+							$select = '
2417 2494
 					UPDATE {db_prefix}themes c
2418 2495
 					JOIN (
2419 2496
 						SELECT a.id_member
@@ -2424,8 +2501,8 @@  discard block
 block discarded – undo
2424 2501
 					) d ON (d.id_member = c.id_member)
2425 2502
 					SET c.value = {string:value}
2426 2503
 					WHERE c.variable = {string:avar}';
2427
-			else
2428
-				$select = '
2504
+			} else {
2505
+							$select = '
2429 2506
 					UPDATE {db_prefix}themes
2430 2507
 					SET value = {string:value}
2431 2508
 					WHERE EXISTS (
@@ -2437,6 +2514,7 @@  discard block
 block discarded – undo
2437 2514
 							AND a.id_member = {db_prefix}themes.id_member
2438 2515
 					)
2439 2516
 					AND variable = {string:avar}';
2517
+			}
2440 2518
 			
2441 2519
 			$smcFunc['db_query']('',
2442 2520
 				$select,
@@ -2448,11 +2526,11 @@  discard block
 block discarded – undo
2448 2526
 					'bval' => 'policy_text' . $currentVersion,
2449 2527
 				)
2450 2528
 			);
2451
-		}
2452
-		elseif (!empty($_REQUEST['save_new_policy']) || !empty($_REQUEST['update_policy']))
2529
+		} elseif (!empty($_REQUEST['save_new_policy']) || !empty($_REQUEST['update_policy']))
2453 2530
 		{
2454
-			if (!empty($_REQUEST['save_new_policy']))
2455
-				$currentVersion++;
2531
+			if (!empty($_REQUEST['save_new_policy'])) {
2532
+							$currentVersion++;
2533
+			}
2456 2534
 			
2457 2535
 			$config_vars[] = array('text', 'policy_text'.$currentVersion);
2458 2536
 			$_POST['policy_text'.$currentVersion] = $_REQUEST['policy_text'];
@@ -2464,16 +2542,15 @@  discard block
 block discarded – undo
2464 2542
 
2465 2543
 		$_SESSION['adm-save'] = true;
2466 2544
 		redirectexit('action=admin;area=featuresettings;sa=policy');
2467
-	}
2468
-	elseif (isset($_GET['manage']))
2545
+	} elseif (isset($_GET['manage']))
2469 2546
 	{
2470 2547
 		checkSession();
2471 2548
 		
2472 2549
 		call_integration_hook('integrate_manage_policy_settings');
2473 2550
 		
2474 2551
 		// set user with the policy unvalid
2475
-			if ($smcFunc['db_title'] == 'MySQLi')
2476
-				$select = '
2552
+			if ($smcFunc['db_title'] == 'MySQLi') {
2553
+							$select = '
2477 2554
 					UPDATE {db_prefix}themes c
2478 2555
 					JOIN (
2479 2556
 						SELECT a.id_member
@@ -2484,8 +2561,8 @@  discard block
 block discarded – undo
2484 2561
 					) d ON (d.id_member = c.id_member)
2485 2562
 					SET value = {string:value}
2486 2563
 					WHERE c.variable = {string:avar}';
2487
-			else
2488
-				$select = '
2564
+			} else {
2565
+							$select = '
2489 2566
 					UPDATE {db_prefix}themes
2490 2567
 					SET value = {string:value}
2491 2568
 					WHERE EXISTS (
@@ -2497,6 +2574,7 @@  discard block
 block discarded – undo
2497 2574
 							AND a.id_member = {db_prefix}themes.id_member
2498 2575
 					)
2499 2576
 					AND variable = {string:avar}';
2577
+			}
2500 2578
 
2501 2579
 		$smcFunc['db_query']('',
2502 2580
 				$select,
@@ -2510,8 +2588,8 @@  discard block
 block discarded – undo
2510 2588
 		);
2511 2589
 		
2512 2590
 		// empty users
2513
-			if ($smcFunc['db_title'] == 'MySQLi')
2514
-				$select = '
2591
+			if ($smcFunc['db_title'] == 'MySQLi') {
2592
+							$select = '
2515 2593
 					UPDATE {db_prefix}themes c
2516 2594
 					JOIN (
2517 2595
 						SELECT a.id_member
@@ -2522,8 +2600,8 @@  discard block
 block discarded – undo
2522 2600
 					) d ON (d.id_member = c.id_member)
2523 2601
 					SET c.value = {string:value}
2524 2602
 					WHERE c.variable = {string:avar}';
2525
-			else
2526
-				$select = '
2603
+			} else {
2604
+							$select = '
2527 2605
 					UPDATE {db_prefix}themes
2528 2606
 					SET value = {string:value}
2529 2607
 					WHERE EXISTS (
@@ -2535,6 +2613,7 @@  discard block
 block discarded – undo
2535 2613
 							AND a.id_member = {db_prefix}themes.id_member
2536 2614
 					)
2537 2615
 					and variable = {string:bvar}';
2616
+			}
2538 2617
 		$smcFunc['db_query']('',
2539 2618
 			$select,
2540 2619
 			array(
Please login to merge, or discard this patch.
Sources/Register.php 1 patch
Braces   +195 added lines, -144 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
  * @version 2.1 Beta 4
16 16
  */
17 17
 
18
-if (!defined('SMF'))
18
+if (!defined('SMF')) {
19 19
 	die('No direct access...');
20
+}
20 21
 
21 22
 /**
22 23
  * Begin the registration process.
@@ -29,19 +30,23 @@  discard block
 block discarded – undo
29 30
 	global $language, $scripturl, $smcFunc, $sourcedir, $cur_profile;
30 31
 
31 32
 	// Is this an incoming AJAX check?
32
-	if (isset($_GET['sa']) && $_GET['sa'] == 'usernamecheck')
33
-		return RegisterCheckUsername();
33
+	if (isset($_GET['sa']) && $_GET['sa'] == 'usernamecheck') {
34
+			return RegisterCheckUsername();
35
+	}
34 36
 
35 37
 	// Check if the administrator has it disabled.
36
-	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == '3')
37
-		fatal_lang_error('registration_disabled', false);
38
+	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == '3') {
39
+			fatal_lang_error('registration_disabled', false);
40
+	}
38 41
 
39 42
 	// If this user is an admin - redirect them to the admin registration page.
40
-	if (allowedTo('moderate_forum') && !$user_info['is_guest'])
41
-		redirectexit('action=admin;area=regcenter;sa=register');
43
+	if (allowedTo('moderate_forum') && !$user_info['is_guest']) {
44
+			redirectexit('action=admin;area=regcenter;sa=register');
45
+	}
42 46
 	// You are not a guest, so you are a member - and members don't get to register twice!
43
-	elseif (empty($user_info['is_guest']))
44
-		redirectexit();
47
+	elseif (empty($user_info['is_guest'])) {
48
+			redirectexit();
49
+	}
45 50
 
46 51
 	loadLanguage('Login');
47 52
 	loadTemplate('Register');
@@ -94,32 +99,33 @@  discard block
 block discarded – undo
94 99
 	}
95 100
 
96 101
 	// Make sure they don't squeeze through without agreeing.
97
-	elseif ($current_step > 1 && $context['require_agreement'] && !$context['registration_passed_agreement'])
98
-		$current_step = 1;
102
+	elseif ($current_step > 1 && $context['require_agreement'] && !$context['registration_passed_agreement']) {
103
+			$current_step = 1;
104
+	}
99 105
 	// Make sure they don't squeeze through without agreeing.
100
-	elseif ($current_step > 2 && $context['require_policy'] && !$context['registration_passed_policy'])
101
-		$current_step = 2;
106
+	elseif ($current_step > 2 && $context['require_policy'] && !$context['registration_passed_policy']) {
107
+			$current_step = 2;
108
+	}
102 109
 
103 110
 	// Show the user the right form.
104 111
 	if ($current_step == 1)
105 112
 	{
106 113
 		$context['sub_template'] = 'registration_agreement';
107 114
 		$context['page_title'] = $txt['registration_agreement'];
108
-	}
109
-	elseif ($current_step == 2)
115
+	} elseif ($current_step == 2)
110 116
 	{
111 117
 		$context['sub_template'] = 'registration_policy';
112 118
 		$context['page_title'] = $txt['registration_policy'];
113
-	}
114
-	else
119
+	} else
115 120
 	{
116 121
 		$context['sub_template'] = 'registration_form';
117 122
 		$context['page_title'] = $txt['registration_form'];
118 123
 	}
119 124
 
120 125
 	// Kinda need this.
121
-	if ($context['sub_template'] == 'registration_form')
122
-		loadJavaScriptFile('register.js', array('defer' => false, 'minimize' => true), 'smf_register');
126
+	if ($context['sub_template'] == 'registration_form') {
127
+			loadJavaScriptFile('register.js', array('defer' => false, 'minimize' => true), 'smf_register');
128
+	}
123 129
 
124 130
 	// Add the register chain to the link tree.
125 131
 	$context['linktree'][] = array(
@@ -128,24 +134,26 @@  discard block
 block discarded – undo
128 134
 	);
129 135
 
130 136
 	// Prepare the time gate! Do it like so, in case later steps want to reset the limit for any reason, but make sure the time is the current one.
131
-	if (!isset($_SESSION['register']))
132
-		$_SESSION['register'] = array(
137
+	if (!isset($_SESSION['register'])) {
138
+			$_SESSION['register'] = array(
133 139
 			'timenow' => time(),
134 140
 			'limit' => 10, // minimum number of seconds required on this page for registration
135 141
 		);
136
-	else
137
-		$_SESSION['register']['timenow'] = time();
142
+	} else {
143
+			$_SESSION['register']['timenow'] = time();
144
+	}
138 145
 
139 146
 	// If you have to agree to the agreement, it needs to be fetched from the file.
140 147
 	if ($context['require_agreement'])
141 148
 	{
142 149
 		// Have we got a localized one?
143
-		if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt'))
144
-			$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.' . $user_info['language'] . '.txt'), true, 'agreement_' . $user_info['language']);
145
-		elseif (file_exists($boarddir . '/agreement.txt'))
146
-			$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement');
147
-		else
148
-			$context['agreement'] = '';
150
+		if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt')) {
151
+					$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.' . $user_info['language'] . '.txt'), true, 'agreement_' . $user_info['language']);
152
+		} elseif (file_exists($boarddir . '/agreement.txt')) {
153
+					$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement');
154
+		} else {
155
+					$context['agreement'] = '';
156
+		}
149 157
 
150 158
 		// Nothing to show, lets disable registration and inform the admin of this error
151 159
 		if (empty($context['agreement']))
@@ -160,10 +168,11 @@  discard block
 block discarded – undo
160 168
 	if ($context['require_policy'])
161 169
 	{
162 170
 		// Have we got a localized one?
163
-		if (!empty($modSettings[$modSettings['policy_version']]))
164
-			$context['policy'] = $modSettings[$modSettings['policy_version']];
165
-		else
166
-			$context['policy'] = '';
171
+		if (!empty($modSettings[$modSettings['policy_version']])) {
172
+					$context['policy'] = $modSettings[$modSettings['policy_version']];
173
+		} else {
174
+					$context['policy'] = '';
175
+		}
167 176
 
168 177
 		// Nothing to show, lets disable registration and inform the admin of this error
169 178
 		if (empty($context['policy']))
@@ -179,8 +188,9 @@  discard block
 block discarded – undo
179 188
 		$selectedLanguage = empty($_SESSION['language']) ? $language : $_SESSION['language'];
180 189
 
181 190
 		// Do we have any languages?
182
-		if (empty($context['languages']))
183
-			getLanguages();
191
+		if (empty($context['languages'])) {
192
+					getLanguages();
193
+		}
184 194
 
185 195
 		// Try to find our selected language.
186 196
 		foreach ($context['languages'] as $key => $lang)
@@ -188,8 +198,9 @@  discard block
 block discarded – undo
188 198
 			$context['languages'][$key]['name'] = strtr($lang['name'], array('-utf8' => ''));
189 199
 
190 200
 			// Found it!
191
-			if ($selectedLanguage == $lang['filename'])
192
-				$context['languages'][$key]['selected'] = true;
201
+			if ($selectedLanguage == $lang['filename']) {
202
+							$context['languages'][$key]['selected'] = true;
203
+			}
193 204
 		}
194 205
 	}
195 206
 
@@ -216,16 +227,19 @@  discard block
 block discarded – undo
216 227
 		if (in_array('website', $reg_fields))
217 228
 		{
218 229
 			unset($reg_fields['website']);
219
-			if (isset($_POST['website_title']))
220
-				$cur_profile['website_title'] = $smcFunc['htmlspecialchars']($_POST['website_title']);
221
-			if (isset($_POST['website_url']))
222
-				$cur_profile['website_url'] = $smcFunc['htmlspecialchars']($_POST['website_url']);
230
+			if (isset($_POST['website_title'])) {
231
+							$cur_profile['website_title'] = $smcFunc['htmlspecialchars']($_POST['website_title']);
232
+			}
233
+			if (isset($_POST['website_url'])) {
234
+							$cur_profile['website_url'] = $smcFunc['htmlspecialchars']($_POST['website_url']);
235
+			}
223 236
 		}
224 237
 
225 238
 		// We might have had some submissions on this front - go check.
226
-		foreach ($reg_fields as $field)
227
-			if (isset($_POST[$field]))
239
+		foreach ($reg_fields as $field) {
240
+					if (isset($_POST[$field]))
228 241
 				$cur_profile[$field] = $smcFunc['htmlspecialchars']($_POST[$field]);
242
+		}
229 243
 
230 244
 		// Load all the fields in question.
231 245
 		setupProfileContext($reg_fields);
@@ -242,8 +256,9 @@  discard block
 block discarded – undo
242 256
 		$context['visual_verification_id'] = $verificationOptions['id'];
243 257
 	}
244 258
 	// Otherwise we have nothing to show.
245
-	else
246
-		$context['visual_verification'] = false;
259
+	else {
260
+			$context['visual_verification'] = false;
261
+	}
247 262
 
248 263
 
249 264
 	$context += array(
@@ -254,8 +269,9 @@  discard block
 block discarded – undo
254 269
 
255 270
 	// Were there any errors?
256 271
 	$context['registration_errors'] = array();
257
-	if (!empty($reg_errors))
258
-		$context['registration_errors'] = $reg_errors;
272
+	if (!empty($reg_errors)) {
273
+			$context['registration_errors'] = $reg_errors;
274
+	}
259 275
 
260 276
 	createToken('register');
261 277
 }
@@ -272,31 +288,37 @@  discard block
 block discarded – undo
272 288
 	validateToken('register');
273 289
 
274 290
 	// Check to ensure we're forcing SSL for authentication
275
-	if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn())
276
-		fatal_lang_error('register_ssl_required');
291
+	if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) {
292
+			fatal_lang_error('register_ssl_required');
293
+	}
277 294
 
278 295
 	// Start collecting together any errors.
279 296
 	$reg_errors = array();
280 297
 
281 298
 	// You can't register if it's disabled.
282
-	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
283
-		fatal_lang_error('registration_disabled', false);
299
+	if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3) {
300
+			fatal_lang_error('registration_disabled', false);
301
+	}
284 302
 
285 303
 	// Well, if you don't agree, you can't register.
286
-	if (!empty($modSettings['requireAgreement']) && empty($_SESSION['registration_agreed']))
287
-		redirectexit();
304
+	if (!empty($modSettings['requireAgreement']) && empty($_SESSION['registration_agreed'])) {
305
+			redirectexit();
306
+	}
288 307
 	
289 308
 	// Well, if you don't agree to policy, you can't register.
290
-	if (!empty($modSettings['enable_policy_function']) && empty($_SESSION['policy_agreed']))
291
-		redirectexit();
309
+	if (!empty($modSettings['enable_policy_function']) && empty($_SESSION['policy_agreed'])) {
310
+			redirectexit();
311
+	}
292 312
 
293 313
 	// Make sure they came from *somewhere*, have a session.
294
-	if (!isset($_SESSION['old_url']))
295
-		redirectexit('action=signup');
314
+	if (!isset($_SESSION['old_url'])) {
315
+			redirectexit('action=signup');
316
+	}
296 317
 
297 318
 	// If we don't require an agreement, we need a extra check for coppa.
298
-	if (empty($modSettings['requireAgreement']) && !empty($modSettings['coppaAge']))
299
-		$_SESSION['skip_coppa'] = !empty($_POST['accept_agreement']);
319
+	if (empty($modSettings['requireAgreement']) && !empty($modSettings['coppaAge'])) {
320
+			$_SESSION['skip_coppa'] = !empty($_POST['accept_agreement']);
321
+	}
300 322
 	// Are they under age, and under age users are banned?
301 323
 	if (!empty($modSettings['coppaAge']) && empty($modSettings['coppaType']) && empty($_SESSION['skip_coppa']))
302 324
 	{
@@ -305,8 +327,9 @@  discard block
 block discarded – undo
305 327
 	}
306 328
 
307 329
 	// Check the time gate for miscreants. First make sure they came from somewhere that actually set it up.
308
-	if (empty($_SESSION['register']['timenow']) || empty($_SESSION['register']['limit']))
309
-		redirectexit('action=signup');
330
+	if (empty($_SESSION['register']['timenow']) || empty($_SESSION['register']['limit'])) {
331
+			redirectexit('action=signup');
332
+	}
310 333
 	// Failing that, check the time on it.
311 334
 	if (time() - $_SESSION['register']['timenow'] < $_SESSION['register']['limit'])
312 335
 	{
@@ -326,8 +349,9 @@  discard block
 block discarded – undo
326 349
 		if (is_array($context['visual_verification']))
327 350
 		{
328 351
 			loadLanguage('Errors');
329
-			foreach ($context['visual_verification'] as $error)
330
-				$reg_errors[] = $txt['error_' . $error];
352
+			foreach ($context['visual_verification'] as $error) {
353
+							$reg_errors[] = $txt['error_' . $error];
354
+			}
331 355
 		}
332 356
 	}
333 357
 
@@ -336,14 +360,16 @@  discard block
 block discarded – undo
336 360
 		if (!is_array($_POST[$key]))
337 361
 		{
338 362
 			// For UTF-8, replace any kind of space with a normal space, and remove any kind of control character (incl. "\n" and "\r"), then trim.
339
-			if ($context['utf8'])
340
-				$_POST[$key] = $smcFunc['htmltrim'](preg_replace(array('~\p{Z}+~u', '~\p{C}+~u'), array(' ', ''), $_POST[$key]));
363
+			if ($context['utf8']) {
364
+							$_POST[$key] = $smcFunc['htmltrim'](preg_replace(array('~\p{Z}+~u', '~\p{C}+~u'), array(' ', ''), $_POST[$key]));
365
+			}
341 366
 			// Otherwise, just remove "\n" and "\r", then trim.
342
-			else
343
-				$_POST[$key] = $smcFunc['htmltrim'](str_replace(array("\n", "\r"), '', $_POST[$key]));
367
+			else {
368
+							$_POST[$key] = $smcFunc['htmltrim'](str_replace(array("\n", "\r"), '', $_POST[$key]));
369
+			}
370
+		} else {
371
+					$_POST[$key] = htmltrim__recursive($_POST[$key]);
344 372
 		}
345
-		else
346
-			$_POST[$key] = htmltrim__recursive($_POST[$key]);
347 373
 	}
348 374
 
349 375
 	// Collect all extra registration fields someone might have filled in.
@@ -378,13 +404,15 @@  discard block
 block discarded – undo
378 404
 			$possible_strings = array_merge(array('website_url', 'website_title'), $possible_strings);
379 405
 
380 406
 			// Make sure their website URL is squeaky clean
381
-			if (isset($_POST['website_url']))
382
-				$_POST['website_url'] = (string) validate_iri(sanitize_iri($_POST['website_url']));
407
+			if (isset($_POST['website_url'])) {
408
+							$_POST['website_url'] = (string) validate_iri(sanitize_iri($_POST['website_url']));
409
+			}
383 410
 		}
384 411
 	}
385 412
 
386
-	if (isset($_POST['secret_answer']) && $_POST['secret_answer'] != '')
387
-		$_POST['secret_answer'] = md5($_POST['secret_answer']);
413
+	if (isset($_POST['secret_answer']) && $_POST['secret_answer'] != '') {
414
+			$_POST['secret_answer'] = md5($_POST['secret_answer']);
415
+	}
388 416
 
389 417
 	// Needed for isReservedName() and registerMember().
390 418
 	require_once($sourcedir . '/Subs-Members.php');
@@ -393,8 +421,9 @@  discard block
 block discarded – undo
393 421
 	if (isset($_POST['real_name']))
394 422
 	{
395 423
 		// Are you already allowed to edit the displayed name?
396
-		if (allowedTo('profile_displayed_name') || allowedTo('moderate_forum'))
397
-			$canEditDisplayName = true;
424
+		if (allowedTo('profile_displayed_name') || allowedTo('moderate_forum')) {
425
+					$canEditDisplayName = true;
426
+		}
398 427
 
399 428
 		// If you are a guest, will you be allowed to once you register?
400 429
 		else
@@ -413,32 +442,37 @@  discard block
 block discarded – undo
413 442
 		}
414 443
 
415 444
 		// Only set it if you can and if we are sure it is good
416
-		if ($canEditDisplayName && $smcFunc['htmltrim']($_POST['real_name']) != '' && !isReservedName($_POST['real_name']) && $smcFunc['strlen']($_POST['real_name']) < 60)
417
-				$possible_strings[] = 'real_name';
445
+		if ($canEditDisplayName && $smcFunc['htmltrim']($_POST['real_name']) != '' && !isReservedName($_POST['real_name']) && $smcFunc['strlen']($_POST['real_name']) < 60) {
446
+						$possible_strings[] = 'real_name';
447
+		}
418 448
 	}
419 449
 
420 450
 	// Handle a string as a birthdate...
421
-	if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
422
-		$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
451
+	if (isset($_POST['birthdate']) && $_POST['birthdate'] != '') {
452
+			$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
453
+	}
423 454
 	// Or birthdate parts...
424
-	elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']))
425
-		$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
455
+	elseif (!empty($_POST['bday1']) && !empty($_POST['bday2'])) {
456
+			$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
457
+	}
426 458
 
427 459
 	// Validate the passed language file.
428 460
 	if (isset($_POST['lngfile']) && !empty($modSettings['userLanguage']))
429 461
 	{
430 462
 		// Do we have any languages?
431
-		if (empty($context['languages']))
432
-			getLanguages();
463
+		if (empty($context['languages'])) {
464
+					getLanguages();
465
+		}
433 466
 
434 467
 		// Did we find it?
435
-		if (isset($context['languages'][$_POST['lngfile']]))
436
-			$_SESSION['language'] = $_POST['lngfile'];
437
-		else
468
+		if (isset($context['languages'][$_POST['lngfile']])) {
469
+					$_SESSION['language'] = $_POST['lngfile'];
470
+		} else {
471
+					unset($_POST['lngfile']);
472
+		}
473
+	} else {
438 474
 			unset($_POST['lngfile']);
439 475
 	}
440
-	else
441
-		unset($_POST['lngfile']);
442 476
 
443 477
 	// Set the options needed for registration.
444 478
 	$regOptions = array(
@@ -458,22 +492,27 @@  discard block
 block discarded – undo
458 492
 	);
459 493
 
460 494
 	// Include the additional options that might have been filled in.
461
-	foreach ($possible_strings as $var)
462
-		if (isset($_POST[$var]))
495
+	foreach ($possible_strings as $var) {
496
+			if (isset($_POST[$var]))
463 497
 			$regOptions['extra_register_vars'][$var] = $smcFunc['htmlspecialchars']($_POST[$var], ENT_QUOTES);
464
-	foreach ($possible_ints as $var)
465
-		if (isset($_POST[$var]))
498
+	}
499
+	foreach ($possible_ints as $var) {
500
+			if (isset($_POST[$var]))
466 501
 			$regOptions['extra_register_vars'][$var] = (int) $_POST[$var];
467
-	foreach ($possible_floats as $var)
468
-		if (isset($_POST[$var]))
502
+	}
503
+	foreach ($possible_floats as $var) {
504
+			if (isset($_POST[$var]))
469 505
 			$regOptions['extra_register_vars'][$var] = (float) $_POST[$var];
470
-	foreach ($possible_bools as $var)
471
-		if (isset($_POST[$var]))
506
+	}
507
+	foreach ($possible_bools as $var) {
508
+			if (isset($_POST[$var]))
472 509
 			$regOptions['extra_register_vars'][$var] = empty($_POST[$var]) ? 0 : 1;
510
+	}
473 511
 
474 512
 	// Registration options are always default options...
475
-	if (isset($_POST['default_options']))
476
-		$_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options'];
513
+	if (isset($_POST['default_options'])) {
514
+			$_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options'];
515
+	}
477 516
 	$regOptions['theme_vars'] = isset($_POST['options']) && is_array($_POST['options']) ? $_POST['options'] : array();
478 517
 
479 518
 	// Make sure they are clean, dammit!
@@ -493,12 +532,14 @@  discard block
 block discarded – undo
493 532
 	while ($row = $smcFunc['db_fetch_assoc']($request))
494 533
 	{
495 534
 		// Don't allow overriding of the theme variables.
496
-		if (isset($regOptions['theme_vars'][$row['col_name']]))
497
-			unset($regOptions['theme_vars'][$row['col_name']]);
535
+		if (isset($regOptions['theme_vars'][$row['col_name']])) {
536
+					unset($regOptions['theme_vars'][$row['col_name']]);
537
+		}
498 538
 
499 539
 		// Not actually showing it then?
500
-		if (!$row['show_reg'])
501
-			continue;
540
+		if (!$row['show_reg']) {
541
+					continue;
542
+		}
502 543
 
503 544
 		// Prepare the value!
504 545
 		$value = isset($_POST['customfield'][$row['col_name']]) ? trim($_POST['customfield'][$row['col_name']]) : '';
@@ -507,24 +548,27 @@  discard block
 block discarded – undo
507 548
 		if (!in_array($row['field_type'], array('check', 'select', 'radio')))
508 549
 		{
509 550
 			// Is it too long?
510
-			if ($row['field_length'] && $row['field_length'] < $smcFunc['strlen']($value))
511
-				$custom_field_errors[] = array('custom_field_too_long', array($row['field_name'], $row['field_length']));
551
+			if ($row['field_length'] && $row['field_length'] < $smcFunc['strlen']($value)) {
552
+							$custom_field_errors[] = array('custom_field_too_long', array($row['field_name'], $row['field_length']));
553
+			}
512 554
 
513 555
 			// Any masks to apply?
514 556
 			if ($row['field_type'] == 'text' && !empty($row['mask']) && $row['mask'] != 'none')
515 557
 			{
516
-				if ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255))
517
-					$custom_field_errors[] = array('custom_field_invalid_email', array($row['field_name']));
518
-				elseif ($row['mask'] == 'number' && preg_match('~[^\d]~', $value))
519
-					$custom_field_errors[] = array('custom_field_not_number', array($row['field_name']));
520
-				elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0)
521
-					$custom_field_errors[] = array('custom_field_inproper_format', array($row['field_name']));
558
+				if ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) {
559
+									$custom_field_errors[] = array('custom_field_invalid_email', array($row['field_name']));
560
+				} elseif ($row['mask'] == 'number' && preg_match('~[^\d]~', $value)) {
561
+									$custom_field_errors[] = array('custom_field_not_number', array($row['field_name']));
562
+				} elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) {
563
+									$custom_field_errors[] = array('custom_field_inproper_format', array($row['field_name']));
564
+				}
522 565
 			}
523 566
 		}
524 567
 
525 568
 		// Is this required but not there?
526
-		if (trim($value) == '' && $row['show_reg'] > 1)
527
-			$custom_field_errors[] = array('custom_field_empty', array($row['field_name']));
569
+		if (trim($value) == '' && $row['show_reg'] > 1) {
570
+					$custom_field_errors[] = array('custom_field_empty', array($row['field_name']));
571
+		}
528 572
 	}
529 573
 	$smcFunc['db_free_result']($request);
530 574
 
@@ -532,8 +576,9 @@  discard block
 block discarded – undo
532 576
 	if (!empty($custom_field_errors))
533 577
 	{
534 578
 		loadLanguage('Errors');
535
-		foreach ($custom_field_errors as $error)
536
-			$reg_errors[] = vsprintf($txt['error_' . $error[0]], $error[1]);
579
+		foreach ($custom_field_errors as $error) {
580
+					$reg_errors[] = vsprintf($txt['error_' . $error[0]], $error[1]);
581
+		}
537 582
 	}
538 583
 
539 584
 	// Lets check for other errors before trying to register the member.
@@ -578,8 +623,9 @@  discard block
 block discarded – undo
578 623
 	}
579 624
 
580 625
 	// If COPPA has been selected then things get complicated, setup the template.
581
-	if (!empty($modSettings['coppaAge']) && empty($_SESSION['skip_coppa']))
582
-		redirectexit('action=coppa;member=' . $memberID);
626
+	if (!empty($modSettings['coppaAge']) && empty($_SESSION['skip_coppa'])) {
627
+			redirectexit('action=coppa;member=' . $memberID);
628
+	}
583 629
 	// Basic template variable setup.
584 630
 	elseif (!empty($modSettings['registration_method']))
585 631
 	{
@@ -591,8 +637,7 @@  discard block
 block discarded – undo
591 637
 			'sub_template' => 'after',
592 638
 			'description' => $modSettings['registration_method'] == 2 ? $txt['approval_after_registration'] : $txt['activate_after_registration']
593 639
 		);
594
-	}
595
-	else
640
+	} else
596 641
 	{
597 642
 		call_integration_hook('integrate_activate', array($regOptions['username']));
598 643
 
@@ -612,16 +657,18 @@  discard block
 block discarded – undo
612 657
 	global $context, $txt, $modSettings, $scripturl, $sourcedir, $smcFunc, $language, $user_info;
613 658
 
614 659
 	// Logged in users should not bother to activate their accounts
615
-	if (!empty($user_info['id']))
616
-		redirectexit();
660
+	if (!empty($user_info['id'])) {
661
+			redirectexit();
662
+	}
617 663
 
618 664
 	loadLanguage('Login');
619 665
 	loadTemplate('Login');
620 666
 
621 667
 	if (empty($_REQUEST['u']) && empty($_POST['user']))
622 668
 	{
623
-		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == '3')
624
-			fatal_lang_error('no_access', false);
669
+		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == '3') {
670
+					fatal_lang_error('no_access', false);
671
+		}
625 672
 
626 673
 		$context['member_id'] = 0;
627 674
 		$context['sub_template'] = 'resend';
@@ -661,11 +708,13 @@  discard block
 block discarded – undo
661 708
 	// Change their email address? (they probably tried a fake one first :P.)
662 709
 	if (isset($_POST['new_email'], $_REQUEST['passwd']) && hash_password($row['member_name'], $_REQUEST['passwd']) == $row['passwd'] && ($row['is_activated'] == 0 || $row['is_activated'] == 2))
663 710
 	{
664
-		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == 3)
665
-			fatal_lang_error('no_access', false);
711
+		if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == 3) {
712
+					fatal_lang_error('no_access', false);
713
+		}
666 714
 
667
-		if (!filter_var($_POST['new_email'], FILTER_VALIDATE_EMAIL))
668
-			fatal_error(sprintf($txt['valid_email_needed'], $smcFunc['htmlspecialchars']($_POST['new_email'])), false);
715
+		if (!filter_var($_POST['new_email'], FILTER_VALIDATE_EMAIL)) {
716
+					fatal_error(sprintf($txt['valid_email_needed'], $smcFunc['htmlspecialchars']($_POST['new_email'])), false);
717
+		}
669 718
 
670 719
 		// Make sure their email isn't banned.
671 720
 		isBannedEmail($_POST['new_email'], 'cannot_register', $txt['ban_register_prohibited']);
@@ -681,8 +730,9 @@  discard block
 block discarded – undo
681 730
 			)
682 731
 		);
683 732
 
684
-		if ($smcFunc['db_num_rows']($request) != 0)
685
-			fatal_lang_error('email_in_use', false, array($smcFunc['htmlspecialchars']($_POST['new_email'])));
733
+		if ($smcFunc['db_num_rows']($request) != 0) {
734
+					fatal_lang_error('email_in_use', false, array($smcFunc['htmlspecialchars']($_POST['new_email'])));
735
+		}
686 736
 		$smcFunc['db_free_result']($request);
687 737
 
688 738
 		updateMemberData($row['id_member'], array('email_address' => $_POST['new_email']));
@@ -720,9 +770,9 @@  discard block
 block discarded – undo
720 770
 	// Quit if this code is not right.
721 771
 	if (empty($_REQUEST['code']) || $row['validation_code'] != $_REQUEST['code'])
722 772
 	{
723
-		if (!empty($row['is_activated']))
724
-			fatal_lang_error('already_activated', false);
725
-		elseif ($row['validation_code'] == '')
773
+		if (!empty($row['is_activated'])) {
774
+					fatal_lang_error('already_activated', false);
775
+		} elseif ($row['validation_code'] == '')
726 776
 		{
727 777
 			loadLanguage('Profile');
728 778
 			fatal_error(sprintf($txt['registration_not_approved'], $scripturl . '?action=activate;user=' . $row['member_name']), false);
@@ -772,8 +822,9 @@  discard block
 block discarded – undo
772 822
 	loadTemplate('Register');
773 823
 
774 824
 	// No User ID??
775
-	if (!isset($_GET['member']))
776
-		fatal_lang_error('no_access', false);
825
+	if (!isset($_GET['member'])) {
826
+			fatal_lang_error('no_access', false);
827
+	}
777 828
 
778 829
 	// Get the user details...
779 830
 	$request = $smcFunc['db_query']('', '
@@ -786,8 +837,9 @@  discard block
 block discarded – undo
786 837
 			'is_coppa' => 5,
787 838
 		)
788 839
 	);
789
-	if ($smcFunc['db_num_rows']($request) == 0)
790
-		fatal_lang_error('no_access', false);
840
+	if ($smcFunc['db_num_rows']($request) == 0) {
841
+			fatal_lang_error('no_access', false);
842
+	}
791 843
 	list ($username) = $smcFunc['db_fetch_row']($request);
792 844
 	$smcFunc['db_free_result']($request);
793 845
 
@@ -825,8 +877,7 @@  discard block
 block discarded – undo
825 877
 			echo $data;
826 878
 			obExit(false);
827 879
 		}
828
-	}
829
-	else
880
+	} else
830 881
 	{
831 882
 		$context += array(
832 883
 			'page_title' => $txt['coppa_title'],
@@ -879,8 +930,9 @@  discard block
 block discarded – undo
879 930
 	{
880 931
 		require_once($sourcedir . '/Subs-Graphics.php');
881 932
 
882
-		if (in_array('gd', get_loaded_extensions()) && !showCodeImage($code))
883
-			header('HTTP/1.1 400 Bad Request');
933
+		if (in_array('gd', get_loaded_extensions()) && !showCodeImage($code)) {
934
+					header('HTTP/1.1 400 Bad Request');
935
+		}
884 936
 
885 937
 		// Otherwise just show a pre-defined letter.
886 938
 		elseif (isset($_REQUEST['letter']))
@@ -898,14 +950,13 @@  discard block
 block discarded – undo
898 950
 			header('content-type: image/gif');
899 951
 			die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B");
900 952
 		}
901
-	}
902
-
903
-	elseif ($_REQUEST['format'] === '.wav')
953
+	} elseif ($_REQUEST['format'] === '.wav')
904 954
 	{
905 955
 		require_once($sourcedir . '/Subs-Sound.php');
906 956
 
907
-		if (!createWaveFile($code))
908
-			header('HTTP/1.1 400 Bad Request');
957
+		if (!createWaveFile($code)) {
958
+					header('HTTP/1.1 400 Bad Request');
959
+		}
909 960
 	}
910 961
 
911 962
 	// We all die one day...
Please login to merge, or discard this patch.
Sources/Subs-Members.php 1 patch
Braces   +208 added lines, -151 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Delete one or more members.
@@ -43,30 +44,32 @@  discard block
 block discarded – undo
43 44
 	setMemoryLimit('128M');
44 45
 
45 46
 	// If it's not an array, make it so!
46
-	if (!is_array($users))
47
-		$users = array($users);
48
-	else
49
-		$users = array_unique($users);
47
+	if (!is_array($users)) {
48
+			$users = array($users);
49
+	} else {
50
+			$users = array_unique($users);
51
+	}
50 52
 
51 53
 	// Make sure there's no void user in here.
52 54
 	$users = array_diff($users, array(0));
53 55
 
54 56
 	// How many are they deleting?
55
-	if (empty($users))
56
-		return;
57
-	elseif (count($users) == 1)
57
+	if (empty($users)) {
58
+			return;
59
+	} elseif (count($users) == 1)
58 60
 	{
59 61
 		list ($user) = $users;
60 62
 
61
-		if ($user == $user_info['id'])
62
-			isAllowedTo('profile_remove_own');
63
-		else
64
-			isAllowedTo('profile_remove_any');
65
-	}
66
-	else
63
+		if ($user == $user_info['id']) {
64
+					isAllowedTo('profile_remove_own');
65
+		} else {
66
+					isAllowedTo('profile_remove_any');
67
+		}
68
+	} else
67 69
 	{
68
-		foreach ($users as $k => $v)
69
-			$users[$k] = (int) $v;
70
+		foreach ($users as $k => $v) {
71
+					$users[$k] = (int) $v;
72
+		}
70 73
 
71 74
 		// Deleting more than one?  You can't have more than one account...
72 75
 		isAllowedTo('profile_remove_any');
@@ -88,26 +91,30 @@  discard block
 block discarded – undo
88 91
 	$user_log_details = array();
89 92
 	while ($row = $smcFunc['db_fetch_assoc']($request))
90 93
 	{
91
-		if ($row['is_admin'])
92
-			$admins[] = $row['id_member'];
94
+		if ($row['is_admin']) {
95
+					$admins[] = $row['id_member'];
96
+		}
93 97
 		$user_log_details[$row['id_member']] = array($row['id_member'], $row['member_name']);
94 98
 	}
95 99
 	$smcFunc['db_free_result']($request);
96 100
 
97
-	if (empty($user_log_details))
98
-		return;
101
+	if (empty($user_log_details)) {
102
+			return;
103
+	}
99 104
 
100 105
 	// Make sure they aren't trying to delete administrators if they aren't one.  But don't bother checking if it's just themself.
101 106
 	if (!empty($admins) && ($check_not_admin || (!allowedTo('admin_forum') && (count($users) != 1 || $users[0] != $user_info['id']))))
102 107
 	{
103 108
 		$users = array_diff($users, $admins);
104
-		foreach ($admins as $id)
105
-			unset($user_log_details[$id]);
109
+		foreach ($admins as $id) {
110
+					unset($user_log_details[$id]);
111
+		}
106 112
 	}
107 113
 
108 114
 	// No one left?
109
-	if (empty($users))
110
-		return;
115
+	if (empty($users)) {
116
+			return;
117
+	}
111 118
 
112 119
 	// Log the action - regardless of who is deleting it.
113 120
 	$log_changes = array();
@@ -124,8 +131,9 @@  discard block
 block discarded – undo
124 131
 		);
125 132
 
126 133
 		// Remove any cached data if enabled.
127
-		if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
128
-			cache_put_data('user_settings-' . $user[0], null, 60);
134
+		if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) {
135
+					cache_put_data('user_settings-' . $user[0], null, 60);
136
+		}
129 137
 	}
130 138
 
131 139
 	// Make these peoples' posts guest posts.
@@ -388,8 +396,8 @@  discard block
 block discarded – undo
388 396
 			'buddy_list' => implode(', buddy_list) != 0 OR FIND_IN_SET(', $users),
389 397
 		)
390 398
 	);
391
-	while ($row = $smcFunc['db_fetch_assoc']($request))
392
-		$smcFunc['db_query']('', '
399
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
400
+			$smcFunc['db_query']('', '
393 401
 			UPDATE {db_prefix}members
394 402
 			SET
395 403
 				pm_ignore_list = {string:pm_ignore_list},
@@ -401,6 +409,7 @@  discard block
 block discarded – undo
401 409
 				'buddy_list' => implode(',', array_diff(explode(',', $row['buddy_list']), $users)),
402 410
 			)
403 411
 		);
412
+	}
404 413
 	$smcFunc['db_free_result']($request);
405 414
 
406 415
 	// Make sure no member's birthday is still sticking in the calendar...
@@ -455,29 +464,34 @@  discard block
 block discarded – undo
455 464
 	elseif ($regOptions['interface'] == 'guest')
456 465
 	{
457 466
 		// You cannot register twice...
458
-		if (empty($user_info['is_guest']))
459
-			redirectexit();
467
+		if (empty($user_info['is_guest'])) {
468
+					redirectexit();
469
+		}
460 470
 
461 471
 		// Make sure they didn't just register with this session.
462
-		if (!empty($_SESSION['just_registered']) && empty($modSettings['disableRegisterCheck']))
463
-			fatal_lang_error('register_only_once', false);
472
+		if (!empty($_SESSION['just_registered']) && empty($modSettings['disableRegisterCheck'])) {
473
+					fatal_lang_error('register_only_once', false);
474
+		}
464 475
 	}
465 476
 
466 477
 	// Spaces and other odd characters are evil...
467 478
 	$regOptions['username'] = trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $regOptions['username']));
468 479
 
469 480
 	// @todo Separate the sprintf?
470
-	if (empty($regOptions['email']) || !filter_var($regOptions['email'], FILTER_VALIDATE_EMAIL) || strlen($regOptions['email']) > 255)
471
-		$reg_errors[] = array('lang', 'profile_error_bad_email');
481
+	if (empty($regOptions['email']) || !filter_var($regOptions['email'], FILTER_VALIDATE_EMAIL) || strlen($regOptions['email']) > 255) {
482
+			$reg_errors[] = array('lang', 'profile_error_bad_email');
483
+	}
472 484
 
473 485
 	$username_validation_errors = validateUsername(0, $regOptions['username'], true, !empty($regOptions['check_reserved_name']));
474
-	if (!empty($username_validation_errors))
475
-		$reg_errors = array_merge($reg_errors, $username_validation_errors);
486
+	if (!empty($username_validation_errors)) {
487
+			$reg_errors = array_merge($reg_errors, $username_validation_errors);
488
+	}
476 489
 
477 490
 	// Generate a validation code if it's supposed to be emailed.
478 491
 	$validation_code = '';
479
-	if ($regOptions['require'] == 'activation')
480
-		$validation_code = generateValidationCode();
492
+	if ($regOptions['require'] == 'activation') {
493
+			$validation_code = generateValidationCode();
494
+	}
481 495
 
482 496
 	// If you haven't put in a password generate one.
483 497
 	if ($regOptions['interface'] == 'admin' && $regOptions['password'] == '')
@@ -487,8 +501,9 @@  discard block
 block discarded – undo
487 501
 		$regOptions['password_check'] = $regOptions['password'];
488 502
 	}
489 503
 	// Does the first password match the second?
490
-	elseif ($regOptions['password'] != $regOptions['password_check'])
491
-		$reg_errors[] = array('lang', 'passwords_dont_match');
504
+	elseif ($regOptions['password'] != $regOptions['password_check']) {
505
+			$reg_errors[] = array('lang', 'passwords_dont_match');
506
+	}
492 507
 
493 508
 	// That's kind of easy to guess...
494 509
 	if ($regOptions['password'] == '')
@@ -502,13 +517,15 @@  discard block
 block discarded – undo
502 517
 		$passwordError = validatePassword($regOptions['password'], $regOptions['username'], array($regOptions['email']));
503 518
 
504 519
 		// Password isn't legal?
505
-		if ($passwordError != null)
506
-			$reg_errors[] = array('lang', 'profile_error_password_' . $passwordError);
520
+		if ($passwordError != null) {
521
+					$reg_errors[] = array('lang', 'profile_error_password_' . $passwordError);
522
+		}
507 523
 	}
508 524
 
509 525
 	// You may not be allowed to register this email.
510
-	if (!empty($regOptions['check_email_ban']))
511
-		isBannedEmail($regOptions['email'], 'cannot_register', $txt['ban_register_prohibited']);
526
+	if (!empty($regOptions['check_email_ban'])) {
527
+			isBannedEmail($regOptions['email'], 'cannot_register', $txt['ban_register_prohibited']);
528
+	}
512 529
 
513 530
 	// Check if the email address is in use.
514 531
 	$request = $smcFunc['db_query']('', '
@@ -523,8 +540,9 @@  discard block
 block discarded – undo
523 540
 		)
524 541
 	);
525 542
 	// @todo Separate the sprintf?
526
-	if ($smcFunc['db_num_rows']($request) != 0)
527
-		$reg_errors[] = array('lang', 'email_in_use', false, array($smcFunc['htmlspecialchars']($regOptions['email'])));
543
+	if ($smcFunc['db_num_rows']($request) != 0) {
544
+			$reg_errors[] = array('lang', 'email_in_use', false, array($smcFunc['htmlspecialchars']($regOptions['email'])));
545
+	}
528 546
 
529 547
 	$smcFunc['db_free_result']($request);
530 548
 
@@ -539,24 +557,27 @@  discard block
 block discarded – undo
539 557
 			1 = The text/index.
540 558
 			2 = Whether to log.
541 559
 			3 = sprintf data if necessary. */
542
-		if ($error[0] == 'lang')
543
-			loadLanguage('Errors');
560
+		if ($error[0] == 'lang') {
561
+					loadLanguage('Errors');
562
+		}
544 563
 		$message = $error[0] == 'lang' ? (empty($error[3]) ? $txt[$error[1]] : vsprintf($txt[$error[1]], $error[3])) : $error[1];
545 564
 
546 565
 		// What to do, what to do, what to do.
547 566
 		if ($return_errors)
548 567
 		{
549
-			if (!empty($error[2]))
550
-				log_error($message, $error[2]);
568
+			if (!empty($error[2])) {
569
+							log_error($message, $error[2]);
570
+			}
551 571
 			$reg_errors[$key] = $message;
572
+		} else {
573
+					fatal_error($message, empty($error[2]) ? false : $error[2]);
552 574
 		}
553
-		else
554
-			fatal_error($message, empty($error[2]) ? false : $error[2]);
555 575
 	}
556 576
 
557 577
 	// If there's any errors left return them at once!
558
-	if (!empty($reg_errors))
559
-		return $reg_errors;
578
+	if (!empty($reg_errors)) {
579
+			return $reg_errors;
580
+	}
560 581
 
561 582
 	$reservedVars = array(
562 583
 		'actual_theme_url',
@@ -578,8 +599,9 @@  discard block
 block discarded – undo
578 599
 	);
579 600
 
580 601
 	// Can't change reserved vars.
581
-	if (isset($regOptions['theme_vars']) && count(array_intersect(array_keys($regOptions['theme_vars']), $reservedVars)) != 0)
582
-		fatal_lang_error('no_theme');
602
+	if (isset($regOptions['theme_vars']) && count(array_intersect(array_keys($regOptions['theme_vars']), $reservedVars)) != 0) {
603
+			fatal_lang_error('no_theme');
604
+	}
583 605
 
584 606
 	// Some of these might be overwritten. (the lower ones that are in the arrays below.)
585 607
 	$regOptions['register_vars'] = array(
@@ -621,14 +643,17 @@  discard block
 block discarded – undo
621 643
 		$regOptions['register_vars']['validation_code'] = '';
622 644
 	}
623 645
 	// Maybe it can be activated right away?
624
-	elseif ($regOptions['require'] == 'nothing')
625
-		$regOptions['register_vars']['is_activated'] = 1;
646
+	elseif ($regOptions['require'] == 'nothing') {
647
+			$regOptions['register_vars']['is_activated'] = 1;
648
+	}
626 649
 	// Maybe it must be activated by email?
627
-	elseif ($regOptions['require'] == 'activation')
628
-		$regOptions['register_vars']['is_activated'] = 0;
650
+	elseif ($regOptions['require'] == 'activation') {
651
+			$regOptions['register_vars']['is_activated'] = 0;
652
+	}
629 653
 	// Otherwise it must be awaiting approval!
630
-	else
631
-		$regOptions['register_vars']['is_activated'] = 3;
654
+	else {
655
+			$regOptions['register_vars']['is_activated'] = 3;
656
+	}
632 657
 
633 658
 	if (isset($regOptions['memberGroup']))
634 659
 	{
@@ -647,24 +672,28 @@  discard block
 block discarded – undo
647 672
 				'is_protected' => 1,
648 673
 			)
649 674
 		);
650
-		while ($row = $smcFunc['db_fetch_assoc']($request))
651
-			$unassignableGroups[] = $row['id_group'];
675
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
676
+					$unassignableGroups[] = $row['id_group'];
677
+		}
652 678
 		$smcFunc['db_free_result']($request);
653 679
 
654
-		if (in_array($regOptions['register_vars']['id_group'], $unassignableGroups))
655
-			$regOptions['register_vars']['id_group'] = 0;
680
+		if (in_array($regOptions['register_vars']['id_group'], $unassignableGroups)) {
681
+					$regOptions['register_vars']['id_group'] = 0;
682
+		}
656 683
 	}
657 684
 
658 685
 	// Integrate optional member settings to be set.
659
-	if (!empty($regOptions['extra_register_vars']))
660
-		foreach ($regOptions['extra_register_vars'] as $var => $value)
686
+	if (!empty($regOptions['extra_register_vars'])) {
687
+			foreach ($regOptions['extra_register_vars'] as $var => $value)
661 688
 			$regOptions['register_vars'][$var] = $value;
689
+	}
662 690
 
663 691
 	// Integrate optional user theme options to be set.
664 692
 	$theme_vars = array();
665
-	if (!empty($regOptions['theme_vars']))
666
-		foreach ($regOptions['theme_vars'] as $var => $value)
693
+	if (!empty($regOptions['theme_vars'])) {
694
+			foreach ($regOptions['theme_vars'] as $var => $value)
667 695
 			$theme_vars[$var] = $value;
696
+	}
668 697
 
669 698
 	// Right, now let's prepare for insertion.
670 699
 	$knownInts = array(
@@ -687,14 +716,15 @@  discard block
 block discarded – undo
687 716
 	foreach ($regOptions['register_vars'] as $var => $val)
688 717
 	{
689 718
 		$type = 'string';
690
-		if (in_array($var, $knownInts))
691
-			$type = 'int';
692
-		elseif (in_array($var, $knownFloats))
693
-			$type = 'float';
694
-		elseif (in_array($var, $knownInets))
695
-			$type = 'inet';
696
-		elseif ($var == 'birthdate')
697
-			$type = 'date';
719
+		if (in_array($var, $knownInts)) {
720
+					$type = 'int';
721
+		} elseif (in_array($var, $knownFloats)) {
722
+					$type = 'float';
723
+		} elseif (in_array($var, $knownInets)) {
724
+					$type = 'inet';
725
+		} elseif ($var == 'birthdate') {
726
+					$type = 'date';
727
+		}
698 728
 
699 729
 		$column_names[$var] = $type;
700 730
 		$values[$var] = $val;
@@ -713,10 +743,11 @@  discard block
 block discarded – undo
713 743
 	call_integration_hook('integrate_post_register', array(&$regOptions, &$theme_vars, &$memberID));
714 744
 
715 745
 	// Update the number of members and latest member's info - and pass the name, but remove the 's.
716
-	if ($regOptions['register_vars']['is_activated'] == 1)
717
-		updateStats('member', $memberID, $regOptions['register_vars']['real_name']);
718
-	else
719
-		updateStats('member');
746
+	if ($regOptions['register_vars']['is_activated'] == 1) {
747
+			updateStats('member', $memberID, $regOptions['register_vars']['real_name']);
748
+	} else {
749
+			updateStats('member');
750
+	}
720 751
 
721 752
 	// If policy require and the user came so far he agreed to this
722 753
 	if (!empty($modSettings['enable_policy_function']))
@@ -729,8 +760,9 @@  discard block
 block discarded – undo
729 760
 	if (!empty($theme_vars))
730 761
 	{
731 762
 		$inserts = array();
732
-		foreach ($theme_vars as $var => $val)
733
-			$inserts[] = array($memberID, $var, $val);
763
+		foreach ($theme_vars as $var => $val) {
764
+					$inserts[] = array($memberID, $var, $val);
765
+		}
734 766
 		$smcFunc['db_insert']('insert',
735 767
 			'{db_prefix}themes',
736 768
 			array('id_member' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
@@ -745,10 +777,11 @@  discard block
 block discarded – undo
745 777
 	// Administrative registrations are a bit different...
746 778
 	if ($regOptions['interface'] == 'admin')
747 779
 	{
748
-		if ($regOptions['require'] == 'activation')
749
-			$email_message = 'admin_register_activate';
750
-		elseif (!empty($regOptions['send_welcome_email']))
751
-			$email_message = 'admin_register_immediate';
780
+		if ($regOptions['require'] == 'activation') {
781
+					$email_message = 'admin_register_activate';
782
+		} elseif (!empty($regOptions['send_welcome_email'])) {
783
+					$email_message = 'admin_register_immediate';
784
+		}
752 785
 
753 786
 		if (isset($email_message))
754 787
 		{
@@ -799,16 +832,17 @@  discard block
 block discarded – undo
799 832
 			'FORGOTPASSWORDLINK' => $scripturl . '?action=reminder',
800 833
 		);
801 834
 
802
-		if ($regOptions['require'] == 'activation')
803
-			$replacements += array(
835
+		if ($regOptions['require'] == 'activation') {
836
+					$replacements += array(
804 837
 				'ACTIVATIONLINK' => $scripturl . '?action=activate;u=' . $memberID . ';code=' . $validation_code,
805 838
 				'ACTIVATIONLINKWITHOUTCODE' => $scripturl . '?action=activate;u=' . $memberID,
806 839
 				'ACTIVATIONCODE' => $validation_code,
807 840
 			);
808
-		else
809
-			$replacements += array(
841
+		} else {
842
+					$replacements += array(
810 843
 				'COPPALINK' => $scripturl . '?action=coppa;u=' . $memberID,
811 844
 			);
845
+		}
812 846
 
813 847
 		$emaildata = loadEmailTemplate('register_' . ($regOptions['require'] == 'activation' ? 'activate' : 'coppa'), $replacements);
814 848
 
@@ -873,39 +907,45 @@  discard block
 block discarded – undo
873 907
 		// Check each name in the list...
874 908
 		foreach ($reservedNames as $reserved)
875 909
 		{
876
-			if ($reserved == '')
877
-				continue;
910
+			if ($reserved == '') {
911
+							continue;
912
+			}
878 913
 
879 914
 			// The admin might've used entities too, level the playing field.
880 915
 			$reservedCheck = preg_replace('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'replaceEntities__callback', $reserved);
881 916
 
882 917
 			// Case sensitive name?
883
-			if (empty($modSettings['reserveCase']))
884
-				$reservedCheck = $smcFunc['strtolower']($reservedCheck);
918
+			if (empty($modSettings['reserveCase'])) {
919
+							$reservedCheck = $smcFunc['strtolower']($reservedCheck);
920
+			}
885 921
 
886 922
 			// If it's not just entire word, check for it in there somewhere...
887
-			if ($checkMe == $reservedCheck || ($smcFunc['strpos']($checkMe, $reservedCheck) !== false && empty($modSettings['reserveWord'])))
888
-				if ($fatal)
923
+			if ($checkMe == $reservedCheck || ($smcFunc['strpos']($checkMe, $reservedCheck) !== false && empty($modSettings['reserveWord']))) {
924
+							if ($fatal)
889 925
 					fatal_lang_error('username_reserved', 'password', array($reserved));
890
-				else
891
-					return true;
926
+			} else {
927
+									return true;
928
+				}
892 929
 		}
893 930
 
894 931
 		$censor_name = $name;
895
-		if (censorText($censor_name) != $name)
896
-			if ($fatal)
932
+		if (censorText($censor_name) != $name) {
933
+					if ($fatal)
897 934
 				fatal_lang_error('name_censored', 'password', array($name));
898
-			else
899
-				return true;
935
+		} else {
936
+							return true;
937
+			}
900 938
 	}
901 939
 
902 940
 	// Characters we just shouldn't allow, regardless.
903
-	foreach (array('*') as $char)
904
-		if (strpos($checkName, $char) !== false)
941
+	foreach (array('*') as $char) {
942
+			if (strpos($checkName, $char) !== false)
905 943
 			if ($fatal)
906 944
 				fatal_lang_error('username_reserved', 'password', array($char));
907
-			else
908
-				return true;
945
+	}
946
+			else {
947
+							return true;
948
+			}
909 949
 
910 950
 	// Get rid of any SQL parts of the reserved name...
911 951
 	$checkName = strtr($name, array('_' => '\\_', '%' => '\\%'));
@@ -987,8 +1027,9 @@  discard block
 block discarded – undo
987 1027
 				'permission' => $permission,
988 1028
 			)
989 1029
 		);
990
-		while ($row = $smcFunc['db_fetch_assoc']($request))
991
-			$member_groups[$row['add_deny'] === '1' ? 'allowed' : 'denied'][] = $row['id_group'];
1030
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1031
+					$member_groups[$row['add_deny'] === '1' ? 'allowed' : 'denied'][] = $row['id_group'];
1032
+		}
992 1033
 		$smcFunc['db_free_result']($request);
993 1034
 	}
994 1035
 
@@ -996,9 +1037,9 @@  discard block
 block discarded – undo
996 1037
 	else
997 1038
 	{
998 1039
 		// First get the profile of the given board.
999
-		if (isset($board_info['id']) && $board_info['id'] == $board_id)
1000
-			$profile_id = $board_info['profile'];
1001
-		elseif ($board_id !== 0)
1040
+		if (isset($board_info['id']) && $board_info['id'] == $board_id) {
1041
+					$profile_id = $board_info['profile'];
1042
+		} elseif ($board_id !== 0)
1002 1043
 		{
1003 1044
 			$request = $smcFunc['db_query']('', '
1004 1045
 				SELECT id_profile
@@ -1009,13 +1050,14 @@  discard block
 block discarded – undo
1009 1050
 					'id_board' => $board_id,
1010 1051
 				)
1011 1052
 			);
1012
-			if ($smcFunc['db_num_rows']($request) == 0)
1013
-				fatal_lang_error('no_board');
1053
+			if ($smcFunc['db_num_rows']($request) == 0) {
1054
+							fatal_lang_error('no_board');
1055
+			}
1014 1056
 			list ($profile_id) = $smcFunc['db_fetch_row']($request);
1015 1057
 			$smcFunc['db_free_result']($request);
1058
+		} else {
1059
+					$profile_id = 1;
1016 1060
 		}
1017
-		else
1018
-			$profile_id = 1;
1019 1061
 
1020 1062
 		$request = $smcFunc['db_query']('', '
1021 1063
 			SELECT bp.id_group, bp.add_deny
@@ -1027,8 +1069,9 @@  discard block
 block discarded – undo
1027 1069
 				'permission' => $permission,
1028 1070
 			)
1029 1071
 		);
1030
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1031
-			$member_groups[$row['add_deny'] === '1' ? 'allowed' : 'denied'][] = $row['id_group'];
1072
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1073
+					$member_groups[$row['add_deny'] === '1' ? 'allowed' : 'denied'][] = $row['id_group'];
1074
+		}
1032 1075
 		$smcFunc['db_free_result']($request);
1033 1076
 
1034 1077
 		$moderator_groups = array();
@@ -1037,8 +1080,7 @@  discard block
 block discarded – undo
1037 1080
 		if (isset($board_info['moderator_groups']))
1038 1081
 		{
1039 1082
 			$moderator_groups = array_keys($board_info['moderator_groups']);
1040
-		}
1041
-		elseif ($board_id !== 0)
1083
+		} elseif ($board_id !== 0)
1042 1084
 		{
1043 1085
 			// Get the groups that can moderate this board
1044 1086
 			$request = $smcFunc['db_query']('', '
@@ -1123,8 +1165,9 @@  discard block
 block discarded – undo
1123 1165
 		)
1124 1166
 	);
1125 1167
 	$members = array();
1126
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1127
-		$members[] = $row['id_member'];
1168
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1169
+			$members[] = $row['id_member'];
1170
+	}
1128 1171
 	$smcFunc['db_free_result']($request);
1129 1172
 
1130 1173
 	return $members;
@@ -1197,10 +1240,12 @@  discard block
 block discarded – undo
1197 1240
 	}
1198 1241
 
1199 1242
 	$query_parts = array();
1200
-	if (!empty($email))
1201
-		$query_parts[] = 'poster_email = {string:email_address}';
1202
-	if (!empty($membername))
1203
-		$query_parts[] = 'poster_name = {string:member_name}';
1243
+	if (!empty($email)) {
1244
+			$query_parts[] = 'poster_email = {string:email_address}';
1245
+	}
1246
+	if (!empty($membername)) {
1247
+			$query_parts[] = 'poster_name = {string:member_name}';
1248
+	}
1204 1249
 	$query = implode(' AND ', $query_parts);
1205 1250
 
1206 1251
 	// Finally, update the posts themselves!
@@ -1267,12 +1312,14 @@  discard block
 block discarded – undo
1267 1312
 
1268 1313
 	$userReceiver = (int) !empty($_REQUEST['u']) ? $_REQUEST['u'] : 0;
1269 1314
 
1270
-	if (empty($userReceiver))
1271
-		fatal_lang_error('no_access', false);
1315
+	if (empty($userReceiver)) {
1316
+			fatal_lang_error('no_access', false);
1317
+	}
1272 1318
 
1273 1319
 	// Remove if it's already there...
1274
-	if (in_array($userReceiver, $user_info['buddies']))
1275
-		$user_info['buddies'] = array_diff($user_info['buddies'], array($userReceiver));
1320
+	if (in_array($userReceiver, $user_info['buddies'])) {
1321
+			$user_info['buddies'] = array_diff($user_info['buddies'], array($userReceiver));
1322
+	}
1276 1323
 
1277 1324
 	// ...or add if it's not and if it's not you.
1278 1325
 	elseif ($user_info['id'] != $userReceiver)
@@ -1347,8 +1394,9 @@  discard block
 block discarded – undo
1347 1394
 	$smcFunc['db_free_result']($request);
1348 1395
 
1349 1396
 	// If we want duplicates pass the members array off.
1350
-	if ($get_duplicates)
1351
-		populateDuplicateMembers($members);
1397
+	if ($get_duplicates) {
1398
+			populateDuplicateMembers($members);
1399
+	}
1352 1400
 
1353 1401
 	return $members;
1354 1402
 }
@@ -1365,8 +1413,9 @@  discard block
 block discarded – undo
1365 1413
 	global $smcFunc, $modSettings;
1366 1414
 
1367 1415
 	// We know how many members there are in total.
1368
-	if (empty($where) || $where == '1=1')
1369
-		$num_members = $modSettings['totalMembers'];
1416
+	if (empty($where) || $where == '1=1') {
1417
+			$num_members = $modSettings['totalMembers'];
1418
+	}
1370 1419
 
1371 1420
 	// The database knows the amount when there are extra conditions.
1372 1421
 	else
@@ -1402,16 +1451,19 @@  discard block
 block discarded – undo
1402 1451
 		$members[$key]['duplicate_members'] = array();
1403 1452
 
1404 1453
 		// Store the IPs.
1405
-		if (!empty($member['member_ip']))
1406
-			$ips[] = $member['member_ip'];
1407
-		if (!empty($member['member_ip2']))
1408
-			$ips[] = $member['member_ip2'];
1454
+		if (!empty($member['member_ip'])) {
1455
+					$ips[] = $member['member_ip'];
1456
+		}
1457
+		if (!empty($member['member_ip2'])) {
1458
+					$ips[] = $member['member_ip2'];
1459
+		}
1409 1460
 	}
1410 1461
 
1411 1462
 	$ips = array_unique($ips);
1412 1463
 
1413
-	if (empty($ips))
1414
-		return false;
1464
+	if (empty($ips)) {
1465
+			return false;
1466
+	}
1415 1467
 
1416 1468
 	// Fetch all members with this IP address, we'll filter out the current ones in a sec.
1417 1469
 	$request = $smcFunc['db_query']('', '
@@ -1441,10 +1493,12 @@  discard block
 block discarded – undo
1441 1493
 			'ip2' => $row['member_ip2'],
1442 1494
 		);
1443 1495
 
1444
-		if (in_array($row['member_ip'], $ips))
1445
-			$duplicate_members[$row['member_ip']][] = $member_context;
1446
-		if ($row['member_ip'] != $row['member_ip2'] && in_array($row['member_ip2'], $ips))
1447
-			$duplicate_members[$row['member_ip2']][] = $member_context;
1496
+		if (in_array($row['member_ip'], $ips)) {
1497
+					$duplicate_members[$row['member_ip']][] = $member_context;
1498
+		}
1499
+		if ($row['member_ip'] != $row['member_ip2'] && in_array($row['member_ip2'], $ips)) {
1500
+					$duplicate_members[$row['member_ip2']][] = $member_context;
1501
+		}
1448 1502
 	}
1449 1503
 	$smcFunc['db_free_result']($request);
1450 1504
 
@@ -1469,8 +1523,9 @@  discard block
 block discarded – undo
1469 1523
 		$row['poster_ip'] = inet_dtop($row['poster_ip']);
1470 1524
 
1471 1525
 		// Don't collect lots of the same.
1472
-		if (isset($had_ips[$row['poster_ip']]) && in_array($row['id_member'], $had_ips[$row['poster_ip']]))
1473
-			continue;
1526
+		if (isset($had_ips[$row['poster_ip']]) && in_array($row['id_member'], $had_ips[$row['poster_ip']])) {
1527
+					continue;
1528
+		}
1474 1529
 		$had_ips[$row['poster_ip']][] = $row['id_member'];
1475 1530
 
1476 1531
 		$duplicate_members[$row['poster_ip']][] = array(
@@ -1485,13 +1540,15 @@  discard block
 block discarded – undo
1485 1540
 	$smcFunc['db_free_result']($request);
1486 1541
 
1487 1542
 	// Now we have all the duplicate members, stick them with their respective member in the list.
1488
-	if (!empty($duplicate_members))
1489
-		foreach ($members as $key => $member)
1543
+	if (!empty($duplicate_members)) {
1544
+			foreach ($members as $key => $member)
1490 1545
 		{
1491 1546
 			if (isset($duplicate_members[$member['member_ip']]))
1492 1547
 				$members[$key]['duplicate_members'] = $duplicate_members[$member['member_ip']];
1493
-			if ($member['member_ip'] != $member['member_ip2'] && isset($duplicate_members[$member['member_ip2']]))
1494
-				$members[$key]['duplicate_members'] = array_merge($member['duplicate_members'], $duplicate_members[$member['member_ip2']]);
1548
+	}
1549
+			if ($member['member_ip'] != $member['member_ip2'] && isset($duplicate_members[$member['member_ip2']])) {
1550
+							$members[$key]['duplicate_members'] = array_merge($member['duplicate_members'], $duplicate_members[$member['member_ip2']]);
1551
+			}
1495 1552
 
1496 1553
 			// Check we don't have lots of the same member.
1497 1554
 			$member_track = array($member['id_member']);
Please login to merge, or discard this patch.
Themes/default/Register.template.php 1 patch
Braces   +90 added lines, -65 removed lines patch added patch discarded remove patch
@@ -28,14 +28,15 @@  discard block
 block discarded – undo
28 28
 			<div id="confirm_buttons">';
29 29
 
30 30
 	// Age restriction in effect?
31
-	if ($context['show_coppa'])
32
-		echo '
31
+	if ($context['show_coppa']) {
32
+			echo '
33 33
 				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
34 34
 				<br>
35 35
 				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
36
-	else
37
-		echo '
36
+	} else {
37
+			echo '
38 38
 				<input type="submit" name="accept_agreement" value="', $txt['policy_agree'], '" class="button">';
39
+	}
39 40
 
40 41
 	echo '
41 42
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -108,9 +109,10 @@  discard block
 block discarded – undo
108 109
 			<ul>';
109 110
 
110 111
 		// Cycle through each error and display an error message.
111
-		foreach ($context['registration_errors'] as $error)
112
-			echo '
112
+		foreach ($context['registration_errors'] as $error) {
113
+					echo '
113 114
 				<li>', $error, '</li>';
115
+		}
114 116
 
115 117
 		echo '
116 118
 			</ul>
@@ -179,14 +181,15 @@  discard block
 block discarded – undo
179 181
 		echo '
180 182
 					<dl class="register_form">';
181 183
 
182
-		foreach ($context['custom_fields'] as $field)
183
-			if ($field['show_reg'] > 1)
184
+		foreach ($context['custom_fields'] as $field) {
185
+					if ($field['show_reg'] > 1)
184 186
 				echo '
185 187
 						<dt>
186 188
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
187 189
 							<span class="smalltext">', $field['desc'], '</span>
188 190
 						</dt>
189 191
 						<dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>';
192
+		}
190 193
 
191 194
 		echo '
192 195
 					</dl>';
@@ -197,14 +200,15 @@  discard block
 block discarded – undo
197 200
 			</div><!-- .roundframe -->';
198 201
 
199 202
 	// If we have either of these, show the extra group.
200
-	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
201
-		echo '
203
+	if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
204
+			echo '
202 205
 			<div class="title_bar">
203 206
 				<h3 class="titlebg">', $txt['additional_information'], '</h3>
204 207
 			</div>
205 208
 			<div class="roundframe noup">
206 209
 				<fieldset>
207 210
 					<dl class="register_form" id="custom_group">';
211
+	}
208 212
 
209 213
 	if (!empty($context['profile_fields']))
210 214
 	{
@@ -218,41 +222,45 @@  discard block
 block discarded – undo
218 222
 					$callback_func = 'template_profile_' . $field['callback_func'];
219 223
 					$callback_func();
220 224
 				}
221
-			}
222
-			else
225
+			} else
223 226
 			{
224 227
 				echo '
225 228
 						<dt>
226 229
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>';
227 230
 
228 231
 				// Does it have any subtext to show?
229
-				if (!empty($field['subtext']))
230
-					echo '
232
+				if (!empty($field['subtext'])) {
233
+									echo '
231 234
 							<span class="smalltext">', $field['subtext'], '</span>';
235
+				}
232 236
 
233 237
 				echo '
234 238
 						</dt>
235 239
 						<dd>';
236 240
 
237 241
 				// Want to put something infront of the box?
238
-				if (!empty($field['preinput']))
239
-					echo '
242
+				if (!empty($field['preinput'])) {
243
+									echo '
240 244
 							', $field['preinput'];
245
+				}
241 246
 
242 247
 				// What type of data are we showing?
243
-				if ($field['type'] == 'label')
244
-					echo '
248
+				if ($field['type'] == 'label') {
249
+									echo '
245 250
 							', $field['value'];
251
+				}
246 252
 
247 253
 				// Maybe it's a text box - very likely!
248
-				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url')))
249
-					echo '
254
+				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url'))) {
255
+									echo '
250 256
 							<input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>';
257
+				}
251 258
 
252 259
 				// You "checking" me out? ;)
253
-				elseif ($field['type'] == 'check')
254
-					echo '
260
+				elseif ($field['type'] == 'check') {
261
+									echo '
255 262
 							<input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>';
263
+				}
256 264
 
257 265
 				// Always fun - select boxes!
258 266
 				elseif ($field['type'] == 'select')
@@ -263,14 +271,16 @@  discard block
 block discarded – undo
263 271
 					if (isset($field['options']))
264 272
 					{
265 273
 						// Is this some code to generate the options?
266
-						if (!is_array($field['options']))
267
-							$field['options'] = eval($field['options']);
274
+						if (!is_array($field['options'])) {
275
+													$field['options'] = eval($field['options']);
276
+						}
268 277
 
269 278
 						// Assuming we now have some!
270
-						if (is_array($field['options']))
271
-							foreach ($field['options'] as $value => $name)
279
+						if (is_array($field['options'])) {
280
+													foreach ($field['options'] as $value => $name)
272 281
 								echo '
273 282
 								<option', is_numeric($value) ? ' value="" disabled' : ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>';
283
+						}
274 284
 					}
275 285
 
276 286
 					echo '
@@ -278,9 +288,10 @@  discard block
 block discarded – undo
278 288
 				}
279 289
 
280 290
 				// Something to end with?
281
-				if (!empty($field['postinput']))
282
-					echo '
291
+				if (!empty($field['postinput'])) {
292
+									echo '
283 293
 							', $field['postinput'];
294
+				}
284 295
 
285 296
 				echo '
286 297
 						</dd>';
@@ -291,25 +302,27 @@  discard block
 block discarded – undo
291 302
 	// Are there any custom fields?
292 303
 	if (!empty($context['custom_fields']))
293 304
 	{
294
-		foreach ($context['custom_fields'] as $field)
295
-			if ($field['show_reg'] < 2)
305
+		foreach ($context['custom_fields'] as $field) {
306
+					if ($field['show_reg'] < 2)
296 307
 				echo '
297 308
 						<dt>
298 309
 							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
299 310
 							<span class="smalltext">', $field['desc'], '</span>
300 311
 						</dt>
301 312
 						<dd>', $field['input_html'], '</dd>';
313
+		}
302 314
 	}
303 315
 
304 316
 	// If we have either of these, close the list like a proper gent.
305
-	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
306
-		echo '
317
+	if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
318
+			echo '
307 319
 					</dl>
308 320
 				</fieldset>
309 321
 			</div><!-- .roundframe -->';
322
+	}
310 323
 
311
-	if ($context['visual_verification'])
312
-		echo '
324
+	if ($context['visual_verification']) {
325
+			echo '
313 326
 			<div class="title_bar">
314 327
 				<h3 class="titlebg">', $txt['verification'], '</h3>
315 328
 			</div>
@@ -318,19 +331,21 @@  discard block
 block discarded – undo
318 331
 					', template_control_verification($context['visual_verification_id'], 'all'), '
319 332
 				</fieldset>
320 333
 			</div>';
334
+	}
321 335
 
322 336
 	echo '
323 337
 			<div id="confirm_buttons" class="flow_auto">';
324 338
 
325 339
 	// Age restriction in effect?
326
-	if (!$context['require_agreement'] && $context['show_coppa'])
327
-		echo '
340
+	if (!$context['require_agreement'] && $context['show_coppa']) {
341
+			echo '
328 342
 				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
329 343
 				<br>
330 344
 				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
331
-	else
332
-		echo '
345
+	} else {
346
+			echo '
333 347
 				<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">';
348
+	}
334 349
 
335 350
 	echo '
336 351
 			</div>
@@ -392,25 +407,28 @@  discard block
 block discarded – undo
392 407
 				<p>', $context['coppa']['many_options'] ? $txt['coppa_send_to_two_options'] : $txt['coppa_send_to_one_option'], '</p>';
393 408
 
394 409
 	// Can they send by post?
395
-	if (!empty($context['coppa']['post']))
396
-		echo '
410
+	if (!empty($context['coppa']['post'])) {
411
+			echo '
397 412
 				<h4>1) ', $txt['coppa_send_by_post'], '</h4>
398 413
 				<div class="coppa_contact">
399 414
 					', $context['coppa']['post'], '
400 415
 				</div>';
416
+	}
401 417
 
402 418
 	// Can they send by fax??
403
-	if (!empty($context['coppa']['fax']))
404
-		echo '
419
+	if (!empty($context['coppa']['fax'])) {
420
+			echo '
405 421
 				<h4>', !empty($context['coppa']['post']) ? '2' : '1', ') ', $txt['coppa_send_by_fax'], '</h4>
406 422
 				<div class="coppa_contact">
407 423
 					', $context['coppa']['fax'], '
408 424
 				</div>';
425
+	}
409 426
 
410 427
 	// Offer an alternative Phone Number?
411
-	if ($context['coppa']['phone'])
412
-		echo '
428
+	if ($context['coppa']['phone']) {
429
+			echo '
413 430
 				<p>', $context['coppa']['phone'], '</p>';
431
+	}
414 432
 
415 433
 	echo '
416 434
 			</div><!-- #coppa -->';
@@ -475,19 +493,20 @@  discard block
 block discarded – undo
475 493
 	<body style="margin: 1ex;">
476 494
 		<div class="windowbg description" style="text-align: center;">';
477 495
 
478
-	if (isBrowser('is_ie') || isBrowser('is_ie11'))
479
-		echo '
496
+	if (isBrowser('is_ie') || isBrowser('is_ie11')) {
497
+			echo '
480 498
 			<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav">
481 499
 				<param name="AutoStart" value="1">
482 500
 				<param name="FileName" value="', $context['verification_sound_href'], '">
483 501
 			</object>';
484
-	else
485
-		echo '
502
+	} else {
503
+			echo '
486 504
 			<audio src="', $context['verification_sound_href'], '" controls>
487 505
 				<object type="audio/x-wav" data="', $context['verification_sound_href'], '">
488 506
 					<a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a>
489 507
 				</object>
490 508
 			</audio>';
509
+	}
491 510
 
492 511
 	echo '
493 512
 			<br>
@@ -515,11 +534,12 @@  discard block
 block discarded – undo
515 534
 				</div>
516 535
 				<div id="register_screen" class="windowbg">';
517 536
 
518
-	if (!empty($context['registration_done']))
519
-		echo '
537
+	if (!empty($context['registration_done'])) {
538
+			echo '
520 539
 					<div class="infobox">
521 540
 						', $context['registration_done'], '
522 541
 					</div>';
542
+	}
523 543
 
524 544
 	echo '
525 545
 					<dl class="register_form" id="admin_register_form">
@@ -555,9 +575,10 @@  discard block
 block discarded – undo
555 575
 						<dd>
556 576
 							<select name="group" id="group_select" tabindex="', $context['tabindex']++, '">';
557 577
 
558
-		foreach ($context['member_groups'] as $id => $name)
559
-			echo '
578
+		foreach ($context['member_groups'] as $id => $name) {
579
+					echo '
560 580
 								<option value="', $id, '">', $name, '</option>';
581
+		}
561 582
 
562 583
 		echo '
563 584
 							</select>
@@ -565,8 +586,8 @@  discard block
 block discarded – undo
565 586
 	}
566 587
 
567 588
 	// If there is any field marked as required, show it here!
568
-	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
569
-		foreach ($context['custom_fields'] as $field)
589
+	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) {
590
+			foreach ($context['custom_fields'] as $field)
570 591
 			if ($field['show_reg'] > 1)
571 592
 				echo '
572 593
 						<dt>
@@ -576,6 +597,7 @@  discard block
 block discarded – undo
576 597
 						<dd>
577 598
 							', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '
578 599
 						</dd>';
600
+	}
579 601
 
580 602
 	echo '
581 603
 						<dt>
@@ -612,18 +634,19 @@  discard block
 block discarded – undo
612 634
 {
613 635
 	global $context, $scripturl, $txt;
614 636
 
615
-	if (!empty($context['saved_successful']))
616
-		echo '
637
+	if (!empty($context['saved_successful'])) {
638
+			echo '
617 639
 		<div class="infobox">', $txt['settings_saved'], '</div>';
618
-
619
-	elseif (!empty($context['could_not_save']))
620
-		echo '
640
+	} elseif (!empty($context['could_not_save'])) {
641
+			echo '
621 642
 		<div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>';
643
+	}
622 644
 
623 645
 	// Warning for if the file isn't writable.
624
-	if (!empty($context['warning']))
625
-		echo '
646
+	if (!empty($context['warning'])) {
647
+			echo '
626 648
 		<div class="errorbox">', $context['warning'], '</div>';
649
+	}
627 650
 
628 651
 	// Just a big box to edit the text file ;)
629 652
 	echo '
@@ -645,9 +668,10 @@  discard block
 block discarded – undo
645 668
 						<strong>', $txt['admin_agreement_select_language'], ':</strong>
646 669
 						<select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">';
647 670
 
648
-		foreach ($context['editable_agreements'] as $file => $name)
649
-			echo '
671
+		foreach ($context['editable_agreements'] as $file => $name) {
672
+					echo '
650 673
 							<option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>';
674
+		}
651 675
 
652 676
 		echo '
653 677
 						</select>
@@ -687,9 +711,10 @@  discard block
 block discarded – undo
687 711
 {
688 712
 	global $context, $scripturl, $txt;
689 713
 
690
-	if (!empty($context['saved_successful']))
691
-		echo '
714
+	if (!empty($context['saved_successful'])) {
715
+			echo '
692 716
 	<div class="infobox">', $txt['settings_saved'], '</div>';
717
+	}
693 718
 
694 719
 	echo '
695 720
 	<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
  *
103 103
  * @param string $class The fully-qualified class name.
104 104
  */
105
-spl_autoload_register(function ($class) use ($sourcedir)
105
+spl_autoload_register(function($class) use ($sourcedir)
106 106
 {
107 107
 	$classMap = array(
108 108
 		'ReCaptcha\\' => 'ReCaptcha/',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	{
218 218
 		global $options;
219 219
 		if (empty($options['policy_isvalid']) && 
220
-				(empty($_REQUEST['area']) || (!empty($_REQUEST['area']) && $_REQUEST['area'] != 'getpolicydata')) )
220
+				(empty($_REQUEST['area']) || (!empty($_REQUEST['area']) && $_REQUEST['area'] != 'getpolicydata')))
221 221
 			$show_privacy = true;
222 222
 	}
223 223
 
Please login to merge, or discard this patch.
Braces   +43 added lines, -30 removed lines patch added patch discarded remove patch
@@ -32,16 +32,18 @@  discard block
 block discarded – undo
32 32
 ob_start();
33 33
 
34 34
 // Do some cleaning, just in case.
35
-foreach (array('db_character_set', 'cachedir') as $variable)
35
+foreach (array('db_character_set', 'cachedir') as $variable) {
36 36
 	if (isset($GLOBALS[$variable]))
37 37
 		unset($GLOBALS[$variable], $GLOBALS[$variable]);
38
+}
38 39
 
39 40
 // Load the settings...
40 41
 require_once(dirname(__FILE__) . '/Settings.php');
41 42
 
42 43
 // Make absolutely sure the cache directory is defined.
43
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
44
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
44 45
 	$cachedir = $boarddir . '/cache';
46
+}
45 47
 
46 48
 // Without those we can't go anywhere
47 49
 require_once($sourcedir . '/QueryString.php');
@@ -51,8 +53,9 @@  discard block
 block discarded – undo
51 53
 require_once($sourcedir . '/Load.php');
52 54
 
53 55
 // If $maintenance is set specifically to 2, then we're upgrading or something.
54
-if (!empty($maintenance) && $maintenance == 2)
56
+if (!empty($maintenance) && $maintenance == 2) {
55 57
 	display_maintenance_message();
58
+}
56 59
 
57 60
 // Create a variable to store some SMF specific functions in.
58 61
 $smcFunc = array();
@@ -67,8 +70,9 @@  discard block
 block discarded – undo
67 70
 cleanRequest();
68 71
 
69 72
 // Seed the random generator.
70
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
73
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
71 74
 	smf_seed_generator();
75
+}
72 76
 
73 77
 // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out!
74 78
 if (isset($_GET['scheduled']))
@@ -88,9 +92,9 @@  discard block
 block discarded – undo
88 92
 if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
89 93
 {
90 94
 	// If zlib is being used, turn off output compression.
91
-	if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler')
92
-		$modSettings['enableCompressedOutput'] = '0';
93
-	else
95
+	if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') {
96
+			$modSettings['enableCompressedOutput'] = '0';
97
+	} else
94 98
 	{
95 99
 		ob_end_clean();
96 100
 		ob_start('ob_gzhandler');
@@ -182,18 +186,21 @@  discard block
 block discarded – undo
182 186
 	loadPermissions();
183 187
 
184 188
 	// Attachments don't require the entire theme to be loaded.
185
-	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach')
186
-		detectBrowser();
189
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') {
190
+			detectBrowser();
191
+	}
187 192
 	// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
188
-	else
189
-		loadTheme();
193
+	else {
194
+			loadTheme();
195
+	}
190 196
 
191 197
 	// Check if the user should be disallowed access.
192 198
 	is_not_banned();
193 199
 
194 200
 	// If we are in a topic and don't have permission to approve it then duck out now.
195
-	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
196
-		fatal_lang_error('not_a_topic', false);
201
+	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
202
+			fatal_lang_error('not_a_topic', false);
203
+	}
197 204
 
198 205
 	$no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile');
199 206
 	call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
@@ -204,8 +211,9 @@  discard block
 block discarded – undo
204 211
 		writeLog();
205 212
 
206 213
 		// Track forum statistics and hits...?
207
-		if (!empty($modSettings['hitStats']))
208
-			trackStats(array('hits' => '+'));
214
+		if (!empty($modSettings['hitStats'])) {
215
+					trackStats(array('hits' => '+'));
216
+		}
209 217
 	}
210 218
 	unset($no_stat_actions);
211 219
 
@@ -217,8 +225,9 @@  discard block
 block discarded – undo
217 225
 	{
218 226
 		global $options;
219 227
 		if (empty($options['policy_isvalid']) && 
220
-				(empty($_REQUEST['area']) || (!empty($_REQUEST['area']) && $_REQUEST['area'] != 'getpolicydata')) )
221
-			$show_privacy = true;
228
+				(empty($_REQUEST['area']) || (!empty($_REQUEST['area']) && $_REQUEST['area'] != 'getpolicydata')) ) {
229
+					$show_privacy = true;
230
+		}
222 231
 	}
223 232
 
224 233
 	// Is the forum in maintenance mode? (doesn't apply to administrators.)
@@ -231,15 +240,16 @@  discard block
 block discarded – undo
231 240
 			return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout'));
232 241
 		}
233 242
 		// Don't even try it, sonny.
234
-		else
235
-			return 'InMaintenance';
243
+		else {
244
+					return 'InMaintenance';
245
+		}
236 246
 	}
237 247
 	// If guest access is off, a guest can only do one of the very few following actions.
238
-	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2'))))
239
-		return 'KickGuest';
240
-	elseif (!empty($show_privacy))
241
-		redirectexit('action=profile;area=getpolicydata;u=' . $user_info['id']);
242
-	elseif (empty($_REQUEST['action']))
248
+	elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) {
249
+			return 'KickGuest';
250
+	} elseif (!empty($show_privacy)) {
251
+			redirectexit('action=profile;area=getpolicydata;u=' . $user_info['id']);
252
+	} elseif (empty($_REQUEST['action']))
243 253
 	{
244 254
 		// Action and board are both empty... BoardIndex! Unless someone else wants to do something different.
245 255
 		if (empty($board) && empty($topic))
@@ -253,8 +263,9 @@  discard block
 block discarded – undo
253 263
 
254 264
 				$call = call_helper($defaultAction, true);
255 265
 
256
-				if (!empty($call))
257
-					return $call;
266
+				if (!empty($call)) {
267
+									return $call;
268
+				}
258 269
 			}
259 270
 
260 271
 			// No default action huh? then go to our good old BoardIndex.
@@ -384,8 +395,9 @@  discard block
 block discarded – undo
384 395
 
385 396
 			$call = call_helper($fallbackAction, true);
386 397
 
387
-			if (!empty($call))
388
-				return $call;
398
+			if (!empty($call)) {
399
+							return $call;
400
+			}
389 401
 		}
390 402
 
391 403
 		// No fallback action, huh?
@@ -396,8 +408,9 @@  discard block
 block discarded – undo
396 408
 	}
397 409
 
398 410
 	// Otherwise, it was set - so let's go to that action.
399
-	if (!empty($actionArray[$_REQUEST['action']][0]))
400
-		require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]);
411
+	if (!empty($actionArray[$_REQUEST['action']][0])) {
412
+			require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]);
413
+	}
401 414
 
402 415
 	// Do the right thing.
403 416
 	return call_helper($actionArray[$_REQUEST['action']][1], true);
Please login to merge, or discard this patch.
Sources/Profile.php 1 patch
Braces   +164 added lines, -124 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
  * @version 2.1 Beta 4
16 16
  */
17 17
 
18
-if (!defined('SMF'))
18
+if (!defined('SMF')) {
19 19
 	die('No direct access...');
20
+}
20 21
 
21 22
 /**
22 23
  * The main designating function for modifying profiles. Loads up info, determins what to do, etc.
@@ -29,18 +30,21 @@  discard block
 block discarded – undo
29 30
 	global $modSettings, $memberContext, $profile_vars, $post_errors, $smcFunc;
30 31
 
31 32
 	// Don't reload this as we may have processed error strings.
32
-	if (empty($post_errors))
33
-		loadLanguage('Profile+Drafts');
33
+	if (empty($post_errors)) {
34
+			loadLanguage('Profile+Drafts');
35
+	}
34 36
 	loadTemplate('Profile');
35 37
 
36 38
 	require_once($sourcedir . '/Subs-Menu.php');
37 39
 
38 40
 	// Did we get the user by name...
39
-	if (isset($_REQUEST['user']))
40
-		$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
41
+	if (isset($_REQUEST['user'])) {
42
+			$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
43
+	}
41 44
 	// ... or by id_member?
42
-	elseif (!empty($_REQUEST['u']))
43
-		$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
45
+	elseif (!empty($_REQUEST['u'])) {
46
+			$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
47
+	}
44 48
 	// If it was just ?action=profile, edit your own profile, but only if you're not a guest.
45 49
 	else
46 50
 	{
@@ -50,8 +54,9 @@  discard block
 block discarded – undo
50 54
 	}
51 55
 
52 56
 	// Check if loadMemberData() has returned a valid result.
53
-	if (!$memberResult)
54
-		fatal_lang_error('not_a_user', false, 404);
57
+	if (!$memberResult) {
58
+			fatal_lang_error('not_a_user', false, 404);
59
+	}
55 60
 
56 61
 	// If all went well, we have a valid member ID!
57 62
 	list ($memID) = $memberResult;
@@ -67,8 +72,9 @@  discard block
 block discarded – undo
67 72
 
68 73
 	// Group management isn't actually a permission. But we need it to be for this, so we need a phantom permission.
69 74
 	// And we care about what the current user can do, not what the user whose profile it is.
70
-	if ($user_info['mod_cache']['gq'] != '0=1')
71
-		$user_info['permissions'][] = 'approve_group_requests';
75
+	if ($user_info['mod_cache']['gq'] != '0=1') {
76
+			$user_info['permissions'][] = 'approve_group_requests';
77
+	}
72 78
 
73 79
 	// If paid subscriptions are enabled, make sure we actually have at least one subscription available...
74 80
 	$context['subs_available'] = false;
@@ -423,8 +429,8 @@  discard block
 block discarded – undo
423 429
 		),
424 430
 	);
425 431
 	
426
-	if (!empty($modSettings['enable_privacy_userexport']))
427
-		$profile_areas['profile_action']['areas']['getprofiledata'] = array(
432
+	if (!empty($modSettings['enable_privacy_userexport'])) {
433
+			$profile_areas['profile_action']['areas']['getprofiledata'] = array(
428 434
 					'label' => $txt['getProfileData'],
429 435
 					'file' => 'Profile-Actions.php',
430 436
 					'function' => 'getProfileData',
@@ -437,9 +443,10 @@  discard block
 block discarded – undo
437 443
 						'any' => array('privacy_userexport_any'),
438 444
 					),
439 445
 				);
446
+	}
440 447
 
441
-	if (!empty($modSettings['enable_policy_function']))
442
-		$profile_areas['profile_action']['areas']['getpolicydata'] = array(
448
+	if (!empty($modSettings['enable_policy_function'])) {
449
+			$profile_areas['profile_action']['areas']['getpolicydata'] = array(
443 450
 					'label' => $txt['getPolicyData'],
444 451
 					'file' => 'Profile-Actions.php',
445 452
 					'function' => 'getPolicyData',
@@ -452,6 +459,7 @@  discard block
 block discarded – undo
452 459
 						'any' => array('moderate_forum'),
453 460
 					),
454 461
 				);
462
+	}
455 463
 
456 464
 	// Let them modify profile areas easily.
457 465
 	call_integration_hook('integrate_pre_profile_areas', array(&$profile_areas));
@@ -466,21 +474,25 @@  discard block
 block discarded – undo
466 474
 		foreach ($section['areas'] as $area_id => $area)
467 475
 		{
468 476
 			// If it said no permissions that meant it wasn't valid!
469
-			if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any']))
470
-				$profile_areas[$section_id]['areas'][$area_id]['enabled'] = false;
477
+			if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) {
478
+							$profile_areas[$section_id]['areas'][$area_id]['enabled'] = false;
479
+			}
471 480
 			// Otherwise pick the right set.
472
-			else
473
-				$profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any'];
481
+			else {
482
+							$profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any'];
483
+			}
474 484
 
475 485
 			// Password required in most cases
476
-			if (!empty($area['password']))
477
-				$context['password_areas'][] = $area_id;
486
+			if (!empty($area['password'])) {
487
+							$context['password_areas'][] = $area_id;
488
+			}
478 489
 		}
479 490
 	}
480 491
 
481 492
 	// Is there an updated message to show?
482
-	if (isset($_GET['updated']))
483
-		$context['profile_updated'] = $txt['profile_updated_own'];
493
+	if (isset($_GET['updated'])) {
494
+			$context['profile_updated'] = $txt['profile_updated_own'];
495
+	}
484 496
 
485 497
 	// Set a few options for the menu.
486 498
 	$menuOptions = array(
@@ -495,8 +507,9 @@  discard block
 block discarded – undo
495 507
 	$profile_include_data = createMenu($profile_areas, $menuOptions);
496 508
 
497 509
 	// No menu means no access.
498
-	if (!$profile_include_data && (!$user_info['is_guest'] || validateSession()))
499
-		fatal_lang_error('no_access', false);
510
+	if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) {
511
+			fatal_lang_error('no_access', false);
512
+	}
500 513
 
501 514
 	// Make a note of the Unique ID for this menu.
502 515
 	$context['profile_menu_id'] = $context['max_menu_id'];
@@ -522,8 +535,9 @@  discard block
 block discarded – undo
522 535
 			if ($current_area == $area_id)
523 536
 			{
524 537
 				// This can't happen - but is a security check.
525
-				if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false))
526
-					fatal_lang_error('no_access', false);
538
+				if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) {
539
+									fatal_lang_error('no_access', false);
540
+				}
527 541
 
528 542
 				// Are we saving data in a valid area?
529 543
 				if (isset($area['sc']) && (isset($_REQUEST['save']) || $context['do_preview']))
@@ -542,12 +556,14 @@  discard block
 block discarded – undo
542 556
 				}
543 557
 
544 558
 				// Does this require session validating?
545
-				if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner']))
546
-					$security_checks['validate'] = true;
559
+				if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) {
560
+									$security_checks['validate'] = true;
561
+				}
547 562
 
548 563
 				// Permissions for good measure.
549
-				if (!empty($profile_include_data['permission']))
550
-					$security_checks['permission'] = $profile_include_data['permission'];
564
+				if (!empty($profile_include_data['permission'])) {
565
+									$security_checks['permission'] = $profile_include_data['permission'];
566
+				}
551 567
 
552 568
 				// Either way got something.
553 569
 				$found_area = true;
@@ -556,21 +572,26 @@  discard block
 block discarded – undo
556 572
 	}
557 573
 
558 574
 	// Oh dear, some serious security lapse is going on here... we'll put a stop to that!
559
-	if (!$found_area)
560
-		fatal_lang_error('no_access', false);
575
+	if (!$found_area) {
576
+			fatal_lang_error('no_access', false);
577
+	}
561 578
 
562 579
 	// Release this now.
563 580
 	unset($profile_areas);
564 581
 
565 582
 	// Now the context is setup have we got any security checks to carry out additional to that above?
566
-	if (isset($security_checks['session']))
567
-		checkSession($security_checks['session']);
568
-	if (isset($security_checks['validate']))
569
-		validateSession();
570
-	if (isset($security_checks['validateToken']))
571
-		validateToken($token_name, $token_type);
572
-	if (isset($security_checks['permission']))
573
-		isAllowedTo($security_checks['permission']);
583
+	if (isset($security_checks['session'])) {
584
+			checkSession($security_checks['session']);
585
+	}
586
+	if (isset($security_checks['validate'])) {
587
+			validateSession();
588
+	}
589
+	if (isset($security_checks['validateToken'])) {
590
+			validateToken($token_name, $token_type);
591
+	}
592
+	if (isset($security_checks['permission'])) {
593
+			isAllowedTo($security_checks['permission']);
594
+	}
574 595
 
575 596
 	// Create a token if needed.
576 597
 	if (isset($security_checks['needsToken']) || isset($security_checks['validateToken']))
@@ -580,8 +601,9 @@  discard block
 block discarded – undo
580 601
 	}
581 602
 
582 603
 	// File to include?
583
-	if (isset($profile_include_data['file']))
584
-		require_once($sourcedir . '/' . $profile_include_data['file']);
604
+	if (isset($profile_include_data['file'])) {
605
+			require_once($sourcedir . '/' . $profile_include_data['file']);
606
+	}
585 607
 
586 608
 	// Build the link tree.
587 609
 	$context['linktree'][] = array(
@@ -589,17 +611,19 @@  discard block
 block discarded – undo
589 611
 		'name' => sprintf($txt['profile_of_username'], $context['member']['name']),
590 612
 	);
591 613
 
592
-	if (!empty($profile_include_data['label']))
593
-		$context['linktree'][] = array(
614
+	if (!empty($profile_include_data['label'])) {
615
+			$context['linktree'][] = array(
594 616
 			'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'],
595 617
 			'name' => $profile_include_data['label'],
596 618
 		);
619
+	}
597 620
 
598
-	if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label'])
599
-		$context['linktree'][] = array(
621
+	if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) {
622
+			$context['linktree'][] = array(
600 623
 			'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'],
601 624
 			'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0],
602 625
 		);
626
+	}
603 627
 
604 628
 	// Set the template for this area and add the profile layer.
605 629
 	$context['sub_template'] = $profile_include_data['function'];
@@ -625,12 +649,14 @@  discard block
 block discarded – undo
625 649
 		if ($check_password)
626 650
 		{
627 651
 			// Check to ensure we're forcing SSL for authentication
628
-			if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn())
629
-				fatal_lang_error('login_ssl_required');
652
+			if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) {
653
+							fatal_lang_error('login_ssl_required');
654
+			}
630 655
 
631 656
 			// You didn't even enter a password!
632
-			if (trim($_POST['oldpasswrd']) == '')
633
-				$post_errors[] = 'no_password';
657
+			if (trim($_POST['oldpasswrd']) == '') {
658
+							$post_errors[] = 'no_password';
659
+			}
634 660
 
635 661
 			// Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password
636 662
 			$_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']);
@@ -639,42 +665,43 @@  discard block
 block discarded – undo
639 665
 			$good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true);
640 666
 
641 667
 			// Bad password!!!
642
-			if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd']))
643
-				$post_errors[] = 'bad_password';
668
+			if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) {
669
+							$post_errors[] = 'bad_password';
670
+			}
644 671
 
645 672
 			// Warn other elements not to jump the gun and do custom changes!
646
-			if (in_array('bad_password', $post_errors))
647
-				$context['password_auth_failed'] = true;
673
+			if (in_array('bad_password', $post_errors)) {
674
+							$context['password_auth_failed'] = true;
675
+			}
648 676
 		}
649 677
 
650 678
 		// Change the IP address in the database.
651
-		if ($context['user']['is_owner'])
652
-			$profile_vars['member_ip'] = $user_info['ip'];
679
+		if ($context['user']['is_owner']) {
680
+					$profile_vars['member_ip'] = $user_info['ip'];
681
+		}
653 682
 
654 683
 		// Now call the sub-action function...
655 684
 		if ($current_area == 'activateaccount')
656 685
 		{
657
-			if (empty($post_errors))
658
-				activateAccount($memID);
659
-		}
660
-		elseif ($current_area == 'deleteaccount')
686
+			if (empty($post_errors)) {
687
+							activateAccount($memID);
688
+			}
689
+		} elseif ($current_area == 'deleteaccount')
661 690
 		{
662 691
 			if (empty($post_errors))
663 692
 			{
664 693
 				deleteAccount2($memID);
665 694
 				redirectexit();
666 695
 			}
667
-		}
668
-		elseif ($current_area == 'groupmembership' && empty($post_errors))
696
+		} elseif ($current_area == 'groupmembership' && empty($post_errors))
669 697
 		{
670 698
 			$msg = groupMembership2($profile_vars, $post_errors, $memID);
671 699
 
672 700
 			// Whatever we've done, we have nothing else to do here...
673 701
 			redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=groupmembership' . (!empty($msg) ? ';msg=' . $msg : ''));
674
-		}
675
-		elseif (in_array($current_area, array('account', 'forumprofile', 'theme')))
676
-			saveProfileFields();
677
-		else
702
+		} elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) {
703
+					saveProfileFields();
704
+		} else
678 705
 		{
679 706
 			$force_redirect = true;
680 707
 			// Ensure we include this.
@@ -690,34 +717,36 @@  discard block
 block discarded – undo
690 717
 			// Load the language file so we can give a nice explanation of the errors.
691 718
 			loadLanguage('Errors');
692 719
 			$context['post_errors'] = $post_errors;
693
-		}
694
-		elseif (!empty($profile_vars))
720
+		} elseif (!empty($profile_vars))
695 721
 		{
696 722
 			// If we've changed the password, notify any integration that may be listening in.
697
-			if (isset($profile_vars['passwd']))
698
-				call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2']));
723
+			if (isset($profile_vars['passwd'])) {
724
+							call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2']));
725
+			}
699 726
 
700 727
 			updateMemberData($memID, $profile_vars);
701 728
 
702 729
 			// What if this is the newest member?
703
-			if ($modSettings['latestMember'] == $memID)
704
-				updateStats('member');
705
-			elseif (isset($profile_vars['real_name']))
706
-				updateSettings(array('memberlist_updated' => time()));
730
+			if ($modSettings['latestMember'] == $memID) {
731
+							updateStats('member');
732
+			} elseif (isset($profile_vars['real_name'])) {
733
+							updateSettings(array('memberlist_updated' => time()));
734
+			}
707 735
 
708 736
 			// If the member changed his/her birthdate, update calendar statistics.
709
-			if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name']))
710
-				updateSettings(array(
737
+			if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) {
738
+							updateSettings(array(
711 739
 					'calendar_updated' => time(),
712 740
 				));
741
+			}
713 742
 
714 743
 			// Anything worth logging?
715 744
 			if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled']))
716 745
 			{
717 746
 				$log_changes = array();
718 747
 				require_once($sourcedir . '/Logging.php');
719
-				foreach ($context['log_changes'] as $k => $v)
720
-					$log_changes[] = array(
748
+				foreach ($context['log_changes'] as $k => $v) {
749
+									$log_changes[] = array(
721 750
 						'action' => $k,
722 751
 						'log_type' => 'user',
723 752
 						'extra' => array_merge($v, array(
@@ -725,14 +754,16 @@  discard block
 block discarded – undo
725 754
 							'member_affected' => $memID,
726 755
 						)),
727 756
 					);
757
+				}
728 758
 
729 759
 				logActions($log_changes);
730 760
 			}
731 761
 
732 762
 			// Have we got any post save functions to execute?
733
-			if (!empty($context['profile_execute_on_save']))
734
-				foreach ($context['profile_execute_on_save'] as $saveFunc)
763
+			if (!empty($context['profile_execute_on_save'])) {
764
+							foreach ($context['profile_execute_on_save'] as $saveFunc)
735 765
 					$saveFunc();
766
+			}
736 767
 
737 768
 			// Let them know it worked!
738 769
 			$context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']);
@@ -746,27 +777,31 @@  discard block
 block discarded – undo
746 777
 	if (!empty($post_errors))
747 778
 	{
748 779
 		// Set all the errors so the template knows what went wrong.
749
-		foreach ($post_errors as $error_type)
750
-			$context['modify_error'][$error_type] = true;
780
+		foreach ($post_errors as $error_type) {
781
+					$context['modify_error'][$error_type] = true;
782
+		}
751 783
 	}
752 784
 	// If it's you then we should redirect upon save.
753
-	elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview'])
754
-		redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated');
755
-	elseif (!empty($force_redirect))
756
-		redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area);
785
+	elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) {
786
+			redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated');
787
+	} elseif (!empty($force_redirect)) {
788
+			redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area);
789
+	}
757 790
 
758 791
 
759 792
 	// Get the right callable.
760 793
 	$call = call_helper($profile_include_data['function'], true);
761 794
 
762 795
 	// Is it valid?
763
-	if (!empty($call))
764
-		call_user_func($call, $memID);
796
+	if (!empty($call)) {
797
+			call_user_func($call, $memID);
798
+	}
765 799
 
766 800
 	// Set the page title if it's not already set...
767
-	if (!isset($context['page_title']))
768
-		$context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : '');
769
-}
801
+	if (!isset($context['page_title'])) {
802
+			$context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : '');
803
+	}
804
+	}
770 805
 
771 806
 /**
772 807
  * Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user.
@@ -889,16 +924,18 @@  discard block
 block discarded – undo
889 924
 	if (!allowedTo('admin_forum') && $area != 'register')
890 925
 	{
891 926
 		// If it's the owner they can see two types of private fields, regardless.
892
-		if ($memID == $user_info['id'])
893
-			$where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
894
-		else
895
-			$where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0';
927
+		if ($memID == $user_info['id']) {
928
+					$where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
929
+		} else {
930
+					$where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0';
931
+		}
896 932
 	}
897 933
 
898
-	if ($area == 'register')
899
-		$where .= ' AND show_reg != 0';
900
-	elseif ($area != 'summary')
901
-		$where .= ' AND show_profile = {string:area}';
934
+	if ($area == 'register') {
935
+			$where .= ' AND show_reg != 0';
936
+	} elseif ($area != 'summary') {
937
+			$where .= ' AND show_profile = {string:area}';
938
+	}
902 939
 
903 940
 	// Load all the relevant fields - and data.
904 941
 	$request = $smcFunc['db_query']('', '
@@ -926,8 +963,9 @@  discard block
 block discarded – undo
926 963
 			$fieldOptions = explode(',', $row['field_options']);
927 964
 			foreach ($fieldOptions as $k => $v)
928 965
 			{
929
-				if (empty($currentKey))
930
-					$currentKey = $v === $value ? $k : 0;
966
+				if (empty($currentKey)) {
967
+									$currentKey = $v === $value ? $k : 0;
968
+				}
931 969
 			}
932 970
 		}
933 971
 
@@ -935,13 +973,15 @@  discard block
 block discarded – undo
935 973
 		if (isset($_POST['customfield']) && isset($_POST['customfield'][$row['col_name']]))
936 974
 		{
937 975
 			$value = $smcFunc['htmlspecialchars']($_POST['customfield'][$row['col_name']]);
938
-			if (in_array($row['field_type'], array('select', 'radio')))
939
-					$value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : '';
976
+			if (in_array($row['field_type'], array('select', 'radio'))) {
977
+								$value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : '';
978
+			}
940 979
 		}
941 980
 
942 981
 		// Don't show the "disabled" option for the "gender" field if we are on the "summary" area.
943
-		if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None')
944
-			continue;
982
+		if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None') {
983
+					continue;
984
+		}
945 985
 
946 986
 		// HTML for the input form.
947 987
 		$output_html = $value;
@@ -950,8 +990,7 @@  discard block
 block discarded – undo
950 990
 			$true = (!$exists && $row['default_value']) || $value;
951 991
 			$input_html = '<input type="checkbox" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($true ? ' checked' : '') . '>';
952 992
 			$output_html = $true ? $txt['yes'] : $txt['no'];
953
-		}
954
-		elseif ($row['field_type'] == 'select')
993
+		} elseif ($row['field_type'] == 'select')
955 994
 		{
956 995
 			$input_html = '<select name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"><option value="-1"></option>';
957 996
 			$options = explode(',', $row['field_options']);
@@ -959,13 +998,13 @@  discard block
 block discarded – undo
959 998
 			{
960 999
 				$true = (!$exists && $row['default_value'] == $v) || $value == $v;
961 1000
 				$input_html .= '<option value="' . $k . '"' . ($true ? ' selected' : '') . '>' . $v . '</option>';
962
-				if ($true)
963
-					$output_html = $v;
1001
+				if ($true) {
1002
+									$output_html = $v;
1003
+				}
964 1004
 			}
965 1005
 
966 1006
 			$input_html .= '</select>';
967
-		}
968
-		elseif ($row['field_type'] == 'radio')
1007
+		} elseif ($row['field_type'] == 'radio')
969 1008
 		{
970 1009
 			$input_html = '<fieldset>';
971 1010
 			$options = explode(',', $row['field_options']);
@@ -973,37 +1012,38 @@  discard block
 block discarded – undo
973 1012
 			{
974 1013
 				$true = (!$exists && $row['default_value'] == $v) || $value == $v;
975 1014
 				$input_html .= '<label for="customfield_' . $row['col_name'] . '_' . $k . '"><input type="radio" name="customfield[' . $row['col_name'] . ']" id="customfield_' . $row['col_name'] . '_' . $k . '" value="' . $k . '"' . ($true ? ' checked' : '') . '>' . $v . '</label><br>';
976
-				if ($true)
977
-					$output_html = $v;
1015
+				if ($true) {
1016
+									$output_html = $v;
1017
+				}
978 1018
 			}
979 1019
 			$input_html .= '</fieldset>';
980
-		}
981
-		elseif ($row['field_type'] == 'text')
1020
+		} elseif ($row['field_type'] == 'text')
982 1021
 		{
983 1022
 			$input_html = '<input type="text" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($row['field_length'] != 0 ? ' maxlength="' . $row['field_length'] . '"' : '') . ' size="' . ($row['field_length'] == 0 || $row['field_length'] >= 50 ? 50 : ($row['field_length'] > 30 ? 30 : ($row['field_length'] > 10 ? 20 : 10))) . '" value="' . un_htmlspecialchars($value) . '"' . ($row['show_reg'] == 2 ? ' required' : '') . '>';
984
-		}
985
-		else
1023
+		} else
986 1024
 		{
987 1025
 			@list ($rows, $cols) = @explode(',', $row['default_value']);
988 1026
 			$input_html = '<textarea name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . (!empty($rows) ? ' rows="' . $rows . '"' : '') . (!empty($cols) ? ' cols="' . $cols . '"' : '') . ($row['show_reg'] == 2 ? ' required' : '') . '>' . un_htmlspecialchars($value) . '</textarea>';
989 1027
 		}
990 1028
 
991 1029
 		// Parse BBCode
992
-		if ($row['bbc'])
993
-			$output_html = parse_bbc($output_html);
994
-		elseif ($row['field_type'] == 'textarea')
995
-			// Allow for newlines at least
1030
+		if ($row['bbc']) {
1031
+					$output_html = parse_bbc($output_html);
1032
+		} elseif ($row['field_type'] == 'textarea') {
1033
+					// Allow for newlines at least
996 1034
 			$output_html = strtr($output_html, array("\n" => '<br>'));
1035
+		}
997 1036
 
998 1037
 		// Enclosing the user input within some other text?
999
-		if (!empty($row['enclose']) && !empty($output_html))
1000
-			$output_html = strtr($row['enclose'], array(
1038
+		if (!empty($row['enclose']) && !empty($output_html)) {
1039
+					$output_html = strtr($row['enclose'], array(
1001 1040
 				'{SCRIPTURL}' => $scripturl,
1002 1041
 				'{IMAGES_URL}' => $settings['images_url'],
1003 1042
 				'{DEFAULT_IMAGES_URL}' => $settings['default_images_url'],
1004 1043
 				'{INPUT}' => un_htmlspecialchars($output_html),
1005 1044
 				'{KEY}' => $currentKey
1006 1045
 			));
1046
+		}
1007 1047
 
1008 1048
 		$context['custom_fields'][] = array(
1009 1049
 			'name' => $row['field_name'],
Please login to merge, or discard this patch.