Completed
Pull Request — release-2.1 (#3890)
by Fran
12:33 queued 05:26
created
Sources/tasks/index.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Try to handle it with the upper level index.php. (it should know what to do.)
4
-if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
4
+if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) {
5 5
 	include (dirname(dirname(__FILE__)) . '/index.php');
6
-else
6
+} else {
7 7
 	exit;
8
+}
8 9
 
9 10
 ?>
10 11
\ No newline at end of file
Please login to merge, or discard this patch.
Sources/tasks/Register-Notify.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,9 +43,10 @@  discard block
 block discarded – undo
43 43
 
44 44
 		foreach ($prefs as $member => $pref_option)
45 45
 		{
46
-			foreach ($alert_bits as $type => $bitvalue)
47
-				if ($pref_option['member_register'] & $bitvalue)
46
+			foreach ($alert_bits as $type => $bitvalue) {
47
+							if ($pref_option['member_register'] & $bitvalue)
48 48
 					$notifies[$type][] = $member;
49
+			}
49 50
 		}
50 51
 
51 52
 		// Firstly, anyone who wants alerts.
@@ -101,8 +102,9 @@  discard block
 block discarded – undo
101 102
 			);
102 103
 			while ($row = $smcFunc['db_fetch_assoc']($request))
103 104
 			{
104
-				if (empty($row['lngfile']))
105
-					$row['lngfile'] = $language;
105
+				if (empty($row['lngfile'])) {
106
+									$row['lngfile'] = $language;
107
+				}
106 108
 				$emails[$row['lngfile']][$row['id_member']] = $row['email_address'];
107 109
 			}
108 110
 			$smcFunc['db_free_result']($request);
@@ -126,8 +128,9 @@  discard block
 block discarded – undo
126 128
 				$emaildata = loadEmailTemplate($emailtype, $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang);
127 129
 
128 130
 				// And do the actual sending...
129
-				foreach ($recipients as $id_member => $email_address)
130
-					sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'newmember' . $this->_details['new_member_id'], $emaildata['is_html'], 0);
131
+				foreach ($recipients as $id_member => $email_address) {
132
+									sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'newmember' . $this->_details['new_member_id'], $emaildata['is_html'], 0);
133
+				}
131 134
 			}
132 135
 		}
133 136
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_Notify_Background extends SMF_BackgroundTask
20 20
 {
21 21
 	/**
22
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
22
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
23 23
 	 * @return bool Always returns true
24 24
 	 */
25 25
 	public function execute()
Please login to merge, or discard this patch.
Sources/tasks/MsgReport-Notify.php 2 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
40 40
 				'current_board' => $this->_details['board_id'],
41 41
 			)
42 42
 		);
43
-		while ($row = $smcFunc['db_fetch_assoc']($request))
44
-			$members[] = $row['id_member'];
43
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
44
+					$members[] = $row['id_member'];
45
+		}
45 46
 		$smcFunc['db_free_result']($request);
46 47
 
47 48
 		// Thirdly, anyone assigned to be a moderator of this group as a group->board moderator.
@@ -58,8 +59,9 @@  discard block
 block discarded – undo
58 59
 			)
59 60
 		);
60 61
 
61
-		while ($row = $smcFunc['db_fetch_assoc']($request))
62
-			$members[] = $row['id_member'];
62
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
63
+					$members[] = $row['id_member'];
64
+		}
63 65
 		$smcFunc['db_free_result']($request);
64 66
 
65 67
 		// And now weed out the duplicates.
@@ -81,9 +83,10 @@  discard block
 block discarded – undo
81 83
 
82 84
 		foreach ($prefs as $member => $pref_option)
83 85
 		{
84
-			foreach ($alert_bits as $type => $bitvalue)
85
-				if ($pref_option['msg_report'] & $bitvalue)
86
+			foreach ($alert_bits as $type => $bitvalue) {
87
+							if ($pref_option['msg_report'] & $bitvalue)
86 88
 					$notifies[$type][] = $member;
89
+			}
87 90
 		}
88 91
 
89 92
 		// Firstly, anyone who wants alerts.
@@ -143,8 +146,9 @@  discard block
 block discarded – undo
143 146
 			);
144 147
 			while ($row = $smcFunc['db_fetch_assoc']($request))
145 148
 			{
146
-				if (empty($row['lngfile']))
147
-					$row['lngfile'] = $language;
149
+				if (empty($row['lngfile'])) {
150
+									$row['lngfile'] = $language;
151
+				}
148 152
 				$emails[$row['lngfile']][$row['id_member']] = $row['email_address'];
149 153
 			}
150 154
 			$smcFunc['db_free_result']($request);
@@ -177,8 +181,9 @@  discard block
 block discarded – undo
177 181
 				$emaildata = loadEmailTemplate('report_to_moderator', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang);
178 182
 
179 183
 				// And do the actual sending...
180
-				foreach ($recipients as $id_member => $email_address)
181
-					sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'report' . $this->_details['report_id'], $emaildata['is_html'], 2);
184
+				foreach ($recipients as $id_member => $email_address) {
185
+									sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'report' . $this->_details['report_id'], $emaildata['is_html'], 2);
186
+				}
182 187
 			}
183 188
 		}
184 189
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_Notify_Background extends SMF_BackgroundTask
20 20
 {
21 21
 	/**
22
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
22
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
23 23
 	 * @return bool Always returns true
24 24
 	 */
25 25
 	public function execute()
Please login to merge, or discard this patch.
Sources/tasks/UpdateTldRegex.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
  */
19 19
 class Update_TLD_Regex extends SMF_BackgroundTask
20 20
 {
21
-    /**
22
-     * This executes the task. It just calls set_tld_regex() in Subs.php
23
-     * @return bool Always returns true
24
-     */
21
+	/**
22
+	 * This executes the task. It just calls set_tld_regex() in Subs.php
23
+	 * @return bool Always returns true
24
+	 */
25 25
 	public function execute()
26 26
  	{
27 27
 		global $sourcedir;
Please login to merge, or discard this patch.
Sources/tasks/MemberReportReply-Notify.php 2 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
40 40
 				'last_comment' => $this->_details['comment_id'],
41 41
 			)
42 42
 		);
43
-		while ($row = $smcFunc['db_fetch_row']($request))
44
-			$possible_members[] = $row[0];
43
+		while ($row = $smcFunc['db_fetch_row']($request)) {
44
+					$possible_members[] = $row[0];
45
+		}
45 46
 		$smcFunc['db_free_result']($request);
46 47
 
47 48
 		// Presumably, there are some people?
@@ -50,8 +51,9 @@  discard block
 block discarded – undo
50 51
 			$possible_members = array_flip(array_flip($possible_members));
51 52
 			$possible_members = array_diff($possible_members, array($this->_details['sender_id']));
52 53
 		}
53
-		if (empty($possible_members))
54
-			return true;
54
+		if (empty($possible_members)) {
55
+					return true;
56
+		}
55 57
 
56 58
 		// We need to know who can moderate this board - and therefore who can see this report.
57 59
 		// First up, people who have moderate_board in the board this topic was in.
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
 		{
74 76
 			foreach ($alert_bits as $type => $bitvalue)
75 77
 			{
76
-				if ($pref_option['member_report_reply'] & $bitvalue)
77
-					$notifies[$type][] = $member;
78
+				if ($pref_option['member_report_reply'] & $bitvalue) {
79
+									$notifies[$type][] = $member;
80
+				}
78 81
 			}
79 82
 		}
80 83
 
@@ -136,8 +139,9 @@  discard block
 block discarded – undo
136 139
 			);
137 140
 			while ($row = $smcFunc['db_fetch_assoc']($request))
138 141
 			{
139
-				if (empty($row['lngfile']))
140
-					$row['lngfile'] = $language;
142
+				if (empty($row['lngfile'])) {
143
+									$row['lngfile'] = $language;
144
+				}
141 145
 				$emails[$row['lngfile']][$row['id_member']] = $row['email_address'];
142 146
 			}
143 147
 			$smcFunc['db_free_result']($request);
@@ -155,8 +159,9 @@  discard block
 block discarded – undo
155 159
 				$emaildata = loadEmailTemplate('reply_to_user_reports', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang);
156 160
 
157 161
 				// And do the actual sending...
158
-				foreach ($recipients as $id_member => $email_address)
159
-					sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'urptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3);
162
+				foreach ($recipients as $id_member => $email_address) {
163
+									sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'urptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3);
164
+				}
160 165
 			}
161 166
 		}
162 167
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_Notify_Background extends SMF_BackgroundTask
20 20
 {
21 21
 	/**
22
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
22
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
23 23
 	 * @return bool Always returns true
24 24
 	 */
25 25
 	public function execute()
Please login to merge, or discard this patch.
Sources/tasks/ApproveReply-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 class ApproveReply_Notify_Background extends SMF_BackgroundTask
19 19
 {
20 20
 	/**
21
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts.
21
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts.
22 22
 	 * @return bool Always returns true.
23 23
 	 */
24 24
 	public function execute()
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,14 +96,15 @@
 block discarded – undo
96 96
 		}
97 97
 
98 98
 		// Insert the alerts if any
99
-		if (!empty($alert_rows))
100
-			$smcFunc['db_insert']('',
99
+		if (!empty($alert_rows)) {
100
+					$smcFunc['db_insert']('',
101 101
 				'{db_prefix}user_alerts',
102 102
 				array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string',
103 103
 					'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'),
104 104
 				$alert_rows,
105 105
 				array()
106 106
 			);
107
+		}
107 108
 
108 109
 		return true;
109 110
 	}
Please login to merge, or discard this patch.
Sources/tasks/Likes-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 class Likes_Notify_Background extends SMF_BackgroundTask
20 20
 {
21 21
 	/**
22
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
22
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
23 23
 	 * @return bool Always returns true
24 24
 	 */
25 25
 	public function execute()
Please login to merge, or discard this patch.
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -49,30 +49,33 @@  discard block
 block discarded – undo
49 49
 				$allowed = explode(',', $row['member_groups']);
50 50
 
51 51
 				// If the user is in group 1 anywhere, they can see everything anyway.
52
-				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0)
53
-					$author = $row['id_member'];
52
+				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) {
53
+									$author = $row['id_member'];
54
+				}
54 55
 			}
55 56
 			$smcFunc['db_free_result']($request);
56
-		}
57
-		else
57
+		} else
58 58
 		{
59 59
 			// This isn't something we know natively how to support. Call the hooks, if they're dealing with it, return false, otherwise return the user id.
60 60
 			$hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id']));
61
-			foreach ($hook_results as $result)
62
-				if (!empty($result))
61
+			foreach ($hook_results as $result) {
62
+							if (!empty($result))
63 63
 				{
64 64
 					$author = $result;
65
+			}
65 66
 					break;
66 67
 				}
67 68
 		}
68 69
 
69 70
 		// If we didn't have a member... leave.
70
-		if (empty($author))
71
-			return true;
71
+		if (empty($author)) {
72
+					return true;
73
+		}
72 74
 
73 75
 		// If the person who sent the notification is the person whose content it is, do nothing.
74
-		if ($author == $this->_details['sender_id'])
75
-			return true;
76
+		if ($author == $this->_details['sender_id']) {
77
+					return true;
78
+		}
76 79
 
77 80
 		require_once($sourcedir . '/Subs-Notify.php');
78 81
 		$prefs = getNotifyPrefs($author, $this->_details['content_type'] . '_like', true);
@@ -81,8 +84,9 @@  discard block
 block discarded – undo
81 84
 		// As a result, the value should really just be non empty.
82 85
 
83 86
 		// Check the value. If no value or it's empty, they didn't want alerts, oh well.
84
-		if (empty($prefs[$author][$this->_details['content_type'] . '_like']))
85
-			return true;
87
+		if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) {
88
+					return true;
89
+		}
86 90
 
87 91
 		// Don't spam the alerts: if there is an existing unread alert of the
88 92
 		// requested type for the target user from the sender, don't make a new one.
@@ -102,8 +106,9 @@  discard block
 block discarded – undo
102 106
 			)
103 107
 		);
104 108
 
105
-		if ($smcFunc['db_num_rows']($request) > 0)
106
-			return true;
109
+		if ($smcFunc['db_num_rows']($request) > 0) {
110
+					return true;
111
+		}
107 112
 		$smcFunc['db_free_result']($request);
108 113
 
109 114
 		// Issue, update, move on.
Please login to merge, or discard this patch.
Sources/tasks/GroupReq-Notify.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 class GroupReq_Notify_Background extends SMF_BackgroundTask
21 21
 {
22 22
 	/**
23
-     * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed.
23
+	 * This executes the task - loads up the information, puts the email in the queue and inserts any alerts as needed.
24 24
 	 * @return bool Always returns true.
25 25
 	 */
26 26
 	public function execute()
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 			)
38 38
 		);
39 39
 		$moderators = array();
40
-		while ($row = $smcFunc['db_fetch_assoc']($request))
41
-			$moderators[] = $row['id_member'];
40
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
41
+					$moderators[] = $row['id_member'];
42
+		}
42 43
 		$smcFunc['db_free_result']($request);
43 44
 
44 45
 		require_once($sourcedir . '/Subs-Members.php');
@@ -59,11 +60,13 @@  discard block
 block discarded – undo
59 60
 			{
60 61
 				if (!empty($prefs[$mod]['request_group']))
61 62
 				{
62
-					if ($prefs[$mod]['request_group'] & 0x01)
63
-						$data['alert'][] = $mod;
63
+					if ($prefs[$mod]['request_group'] & 0x01) {
64
+											$data['alert'][] = $mod;
65
+					}
64 66
 
65
-					if ($prefs[$mod]['request_group'] & 0x02)
66
-						$data['email'][] = $mod;
67
+					if ($prefs[$mod]['request_group'] & 0x02) {
68
+											$data['email'][] = $mod;
69
+					}
67 70
 				}
68 71
 			}
69 72
 
Please login to merge, or discard this patch.
Sources/Profile.php 1 patch
Braces   +155 added lines, -118 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
  * @version 2.1 Beta 3
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.
@@ -30,18 +31,21 @@  discard block
 block discarded – undo
30 31
 	global $db_show_debug, $smcFunc;
31 32
 
32 33
 	// Don't reload this as we may have processed error strings.
33
-	if (empty($post_errors))
34
-		loadLanguage('Profile+Drafts');
34
+	if (empty($post_errors)) {
35
+			loadLanguage('Profile+Drafts');
36
+	}
35 37
 	loadTemplate('Profile');
36 38
 
37 39
 	require_once($sourcedir . '/Subs-Menu.php');
38 40
 
39 41
 	// Did we get the user by name...
40
-	if (isset($_REQUEST['user']))
41
-		$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
42
+	if (isset($_REQUEST['user'])) {
43
+			$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
44
+	}
42 45
 	// ... or by id_member?
43
-	elseif (!empty($_REQUEST['u']))
44
-		$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
46
+	elseif (!empty($_REQUEST['u'])) {
47
+			$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
48
+	}
45 49
 	// If it was just ?action=profile, edit your own profile, but only if you're not a guest.
46 50
 	else
47 51
 	{
@@ -51,8 +55,9 @@  discard block
 block discarded – undo
51 55
 	}
52 56
 
53 57
 	// Check if loadMemberData() has returned a valid result.
54
-	if (!$memberResult)
55
-		fatal_lang_error('not_a_user', false, 404);
58
+	if (!$memberResult) {
59
+			fatal_lang_error('not_a_user', false, 404);
60
+	}
56 61
 
57 62
 	// If all went well, we have a valid member ID!
58 63
 	list ($memID) = $memberResult;
@@ -68,8 +73,9 @@  discard block
 block discarded – undo
68 73
 
69 74
 	// Group management isn't actually a permission. But we need it to be for this, so we need a phantom permission.
70 75
 	// And we care about what the current user can do, not what the user whose profile it is.
71
-	if ($user_info['mod_cache']['gq'] != '0=1')
72
-		$user_info['permissions'][] = 'approve_group_requests';
76
+	if ($user_info['mod_cache']['gq'] != '0=1') {
77
+			$user_info['permissions'][] = 'approve_group_requests';
78
+	}
73 79
 
74 80
 	// If paid subscriptions are enabled, make sure we actually have at least one subscription available...
75 81
 	$context['subs_available'] = false;
@@ -437,21 +443,25 @@  discard block
 block discarded – undo
437 443
 		foreach ($section['areas'] as $area_id => $area)
438 444
 		{
439 445
 			// If it said no permissions that meant it wasn't valid!
440
-			if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any']))
441
-				$profile_areas[$section_id]['areas'][$area_id]['enabled'] = false;
446
+			if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) {
447
+							$profile_areas[$section_id]['areas'][$area_id]['enabled'] = false;
448
+			}
442 449
 			// Otherwise pick the right set.
443
-			else
444
-				$profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any'];
450
+			else {
451
+							$profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any'];
452
+			}
445 453
 
446 454
 			// Password required in most cases
447
-			if (!empty($area['password']))
448
-				$context['password_areas'][] = $area_id;
455
+			if (!empty($area['password'])) {
456
+							$context['password_areas'][] = $area_id;
457
+			}
449 458
 		}
450 459
 	}
451 460
 
452 461
 	// Is there an updated message to show?
453
-	if (isset($_GET['updated']))
454
-		$context['profile_updated'] = $txt['profile_updated_own'];
462
+	if (isset($_GET['updated'])) {
463
+			$context['profile_updated'] = $txt['profile_updated_own'];
464
+	}
455 465
 
456 466
 	// Set a few options for the menu.
457 467
 	$menuOptions = array(
@@ -466,8 +476,9 @@  discard block
 block discarded – undo
466 476
 	$profile_include_data = createMenu($profile_areas, $menuOptions);
467 477
 
468 478
 	// No menu means no access.
469
-	if (!$profile_include_data && (!$user_info['is_guest'] || validateSession()))
470
-		fatal_lang_error('no_access', false);
479
+	if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) {
480
+			fatal_lang_error('no_access', false);
481
+	}
471 482
 
472 483
 	// Make a note of the Unique ID for this menu.
473 484
 	$context['profile_menu_id'] = $context['max_menu_id'];
@@ -493,8 +504,9 @@  discard block
 block discarded – undo
493 504
 			if ($current_area == $area_id)
494 505
 			{
495 506
 				// This can't happen - but is a security check.
496
-				if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false))
497
-					fatal_lang_error('no_access', false);
507
+				if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) {
508
+									fatal_lang_error('no_access', false);
509
+				}
498 510
 
499 511
 				// Are we saving data in a valid area?
500 512
 				if (isset($area['sc']) && (isset($_REQUEST['save']) || $context['do_preview']))
@@ -513,12 +525,14 @@  discard block
 block discarded – undo
513 525
 				}
514 526
 
515 527
 				// Does this require session validating?
516
-				if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner']))
517
-					$security_checks['validate'] = true;
528
+				if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) {
529
+									$security_checks['validate'] = true;
530
+				}
518 531
 
519 532
 				// Permissions for good measure.
520
-				if (!empty($profile_include_data['permission']))
521
-					$security_checks['permission'] = $profile_include_data['permission'];
533
+				if (!empty($profile_include_data['permission'])) {
534
+									$security_checks['permission'] = $profile_include_data['permission'];
535
+				}
522 536
 
523 537
 				// Either way got something.
524 538
 				$found_area = true;
@@ -527,21 +541,26 @@  discard block
 block discarded – undo
527 541
 	}
528 542
 
529 543
 	// Oh dear, some serious security lapse is going on here... we'll put a stop to that!
530
-	if (!$found_area)
531
-		fatal_lang_error('no_access', false);
544
+	if (!$found_area) {
545
+			fatal_lang_error('no_access', false);
546
+	}
532 547
 
533 548
 	// Release this now.
534 549
 	unset($profile_areas);
535 550
 
536 551
 	// Now the context is setup have we got any security checks to carry out additional to that above?
537
-	if (isset($security_checks['session']))
538
-		checkSession($security_checks['session']);
539
-	if (isset($security_checks['validate']))
540
-		validateSession();
541
-	if (isset($security_checks['validateToken']))
542
-		validateToken($token_name, $token_type);
543
-	if (isset($security_checks['permission']))
544
-		isAllowedTo($security_checks['permission']);
552
+	if (isset($security_checks['session'])) {
553
+			checkSession($security_checks['session']);
554
+	}
555
+	if (isset($security_checks['validate'])) {
556
+			validateSession();
557
+	}
558
+	if (isset($security_checks['validateToken'])) {
559
+			validateToken($token_name, $token_type);
560
+	}
561
+	if (isset($security_checks['permission'])) {
562
+			isAllowedTo($security_checks['permission']);
563
+	}
545 564
 
546 565
 	// Create a token if needed.
547 566
 	if (isset($security_checks['needsToken']) || isset($security_checks['validateToken']))
@@ -551,8 +570,9 @@  discard block
 block discarded – undo
551 570
 	}
552 571
 
553 572
 	// File to include?
554
-	if (isset($profile_include_data['file']))
555
-		require_once($sourcedir . '/' . $profile_include_data['file']);
573
+	if (isset($profile_include_data['file'])) {
574
+			require_once($sourcedir . '/' . $profile_include_data['file']);
575
+	}
556 576
 
557 577
 	// Build the link tree.
558 578
 	$context['linktree'][] = array(
@@ -560,17 +580,19 @@  discard block
 block discarded – undo
560 580
 		'name' => sprintf($txt['profile_of_username'], $context['member']['name']),
561 581
 	);
562 582
 
563
-	if (!empty($profile_include_data['label']))
564
-		$context['linktree'][] = array(
583
+	if (!empty($profile_include_data['label'])) {
584
+			$context['linktree'][] = array(
565 585
 			'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'],
566 586
 			'name' => $profile_include_data['label'],
567 587
 		);
588
+	}
568 589
 
569
-	if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label'])
570
-		$context['linktree'][] = array(
590
+	if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) {
591
+			$context['linktree'][] = array(
571 592
 			'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'],
572 593
 			'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0],
573 594
 		);
595
+	}
574 596
 
575 597
 	// Set the template for this area and add the profile layer.
576 598
 	$context['sub_template'] = $profile_include_data['function'];
@@ -596,12 +618,14 @@  discard block
 block discarded – undo
596 618
 		if ($check_password)
597 619
 		{
598 620
 			// Check to ensure we're forcing SSL for authentication
599
-			if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on'))
600
-				fatal_lang_error('login_ssl_required');
621
+			if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) {
622
+							fatal_lang_error('login_ssl_required');
623
+			}
601 624
 
602 625
 			// You didn't even enter a password!
603
-			if (trim($_POST['oldpasswrd']) == '')
604
-				$post_errors[] = 'no_password';
626
+			if (trim($_POST['oldpasswrd']) == '') {
627
+							$post_errors[] = 'no_password';
628
+			}
605 629
 
606 630
 			// Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password
607 631
 			$_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']);
@@ -610,33 +634,35 @@  discard block
 block discarded – undo
610 634
 			$good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true);
611 635
 
612 636
 			// Bad password!!!
613
-			if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd']))
614
-				$post_errors[] = 'bad_password';
637
+			if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) {
638
+							$post_errors[] = 'bad_password';
639
+			}
615 640
 
616 641
 			// Warn other elements not to jump the gun and do custom changes!
617
-			if (in_array('bad_password', $post_errors))
618
-				$context['password_auth_failed'] = true;
642
+			if (in_array('bad_password', $post_errors)) {
643
+							$context['password_auth_failed'] = true;
644
+			}
619 645
 		}
620 646
 
621 647
 		// Change the IP address in the database.
622
-		if ($context['user']['is_owner'])
623
-			$profile_vars['member_ip'] = $user_info['ip'];
648
+		if ($context['user']['is_owner']) {
649
+					$profile_vars['member_ip'] = $user_info['ip'];
650
+		}
624 651
 
625 652
 		// Now call the sub-action function...
626 653
 		if ($current_area == 'activateaccount')
627 654
 		{
628
-			if (empty($post_errors))
629
-				activateAccount($memID);
630
-		}
631
-		elseif ($current_area == 'deleteaccount')
655
+			if (empty($post_errors)) {
656
+							activateAccount($memID);
657
+			}
658
+		} elseif ($current_area == 'deleteaccount')
632 659
 		{
633 660
 			if (empty($post_errors))
634 661
 			{
635 662
 				deleteAccount2($memID);
636 663
 				redirectexit();
637 664
 			}
638
-		}
639
-		elseif ($current_area == 'groupmembership' && empty($post_errors))
665
+		} elseif ($current_area == 'groupmembership' && empty($post_errors))
640 666
 		{
641 667
 			$msg = groupMembership2($profile_vars, $post_errors, $memID);
642 668
 
@@ -647,10 +673,9 @@  discard block
 block discarded – undo
647 673
 		elseif ($current_area == 'authentication')
648 674
 		{
649 675
 			authentication($memID, true);
650
-		}
651
-		elseif (in_array($current_area, array('account', 'forumprofile', 'theme')))
652
-			saveProfileFields();
653
-		else
676
+		} elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) {
677
+					saveProfileFields();
678
+		} else
654 679
 		{
655 680
 			$force_redirect = true;
656 681
 			// Ensure we include this.
@@ -666,34 +691,36 @@  discard block
 block discarded – undo
666 691
 			// Load the language file so we can give a nice explanation of the errors.
667 692
 			loadLanguage('Errors');
668 693
 			$context['post_errors'] = $post_errors;
669
-		}
670
-		elseif (!empty($profile_vars))
694
+		} elseif (!empty($profile_vars))
671 695
 		{
672 696
 			// If we've changed the password, notify any integration that may be listening in.
673
-			if (isset($profile_vars['passwd']))
674
-				call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2']));
697
+			if (isset($profile_vars['passwd'])) {
698
+							call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2']));
699
+			}
675 700
 
676 701
 			updateMemberData($memID, $profile_vars);
677 702
 
678 703
 			// What if this is the newest member?
679
-			if ($modSettings['latestMember'] == $memID)
680
-				updateStats('member');
681
-			elseif (isset($profile_vars['real_name']))
682
-				updateSettings(array('memberlist_updated' => time()));
704
+			if ($modSettings['latestMember'] == $memID) {
705
+							updateStats('member');
706
+			} elseif (isset($profile_vars['real_name'])) {
707
+							updateSettings(array('memberlist_updated' => time()));
708
+			}
683 709
 
684 710
 			// If the member changed his/her birthdate, update calendar statistics.
685
-			if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name']))
686
-				updateSettings(array(
711
+			if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) {
712
+							updateSettings(array(
687 713
 					'calendar_updated' => time(),
688 714
 				));
715
+			}
689 716
 
690 717
 			// Anything worth logging?
691 718
 			if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled']))
692 719
 			{
693 720
 				$log_changes = array();
694 721
 				require_once($sourcedir . '/Logging.php');
695
-				foreach ($context['log_changes'] as $k => $v)
696
-					$log_changes[] = array(
722
+				foreach ($context['log_changes'] as $k => $v) {
723
+									$log_changes[] = array(
697 724
 						'action' => $k,
698 725
 						'log_type' => 'user',
699 726
 						'extra' => array_merge($v, array(
@@ -701,14 +728,16 @@  discard block
 block discarded – undo
701 728
 							'member_affected' => $memID,
702 729
 						)),
703 730
 					);
731
+				}
704 732
 
705 733
 				logActions($log_changes);
706 734
 			}
707 735
 
708 736
 			// Have we got any post save functions to execute?
709
-			if (!empty($context['profile_execute_on_save']))
710
-				foreach ($context['profile_execute_on_save'] as $saveFunc)
737
+			if (!empty($context['profile_execute_on_save'])) {
738
+							foreach ($context['profile_execute_on_save'] as $saveFunc)
711 739
 					$saveFunc();
740
+			}
712 741
 
713 742
 			// Let them know it worked!
714 743
 			$context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']);
@@ -722,27 +751,31 @@  discard block
 block discarded – undo
722 751
 	if (!empty($post_errors))
723 752
 	{
724 753
 		// Set all the errors so the template knows what went wrong.
725
-		foreach ($post_errors as $error_type)
726
-			$context['modify_error'][$error_type] = true;
754
+		foreach ($post_errors as $error_type) {
755
+					$context['modify_error'][$error_type] = true;
756
+		}
727 757
 	}
728 758
 	// If it's you then we should redirect upon save.
729
-	elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview'])
730
-		redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated');
731
-	elseif (!empty($force_redirect))
732
-		redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area);
759
+	elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) {
760
+			redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated');
761
+	} elseif (!empty($force_redirect)) {
762
+			redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area);
763
+	}
733 764
 
734 765
 
735 766
 	// Get the right callable.
736 767
 	$call = call_helper($profile_include_data['function'], true);
737 768
 
738 769
 	// Is it valid?
739
-	if (!empty($call))
740
-		call_user_func($call, $memID);
770
+	if (!empty($call)) {
771
+			call_user_func($call, $memID);
772
+	}
741 773
 
742 774
 	// Set the page title if it's not already set...
743
-	if (!isset($context['page_title']))
744
-		$context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : '');
745
-}
775
+	if (!isset($context['page_title'])) {
776
+			$context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : '');
777
+	}
778
+	}
746 779
 
747 780
 /**
748 781
  * Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user.
@@ -865,16 +898,18 @@  discard block
 block discarded – undo
865 898
 	if (!allowedTo('admin_forum') && $area != 'register')
866 899
 	{
867 900
 		// If it's the owner they can see two types of private fields, regardless.
868
-		if ($memID == $user_info['id'])
869
-			$where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
870
-		else
871
-			$where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0';
901
+		if ($memID == $user_info['id']) {
902
+					$where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
903
+		} else {
904
+					$where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0';
905
+		}
872 906
 	}
873 907
 
874
-	if ($area == 'register')
875
-		$where .= ' AND show_reg != 0';
876
-	elseif ($area != 'summary')
877
-		$where .= ' AND show_profile = {string:area}';
908
+	if ($area == 'register') {
909
+			$where .= ' AND show_reg != 0';
910
+	} elseif ($area != 'summary') {
911
+			$where .= ' AND show_profile = {string:area}';
912
+	}
878 913
 
879 914
 	// Load all the relevant fields - and data.
880 915
 	$request = $smcFunc['db_query']('', '
@@ -900,13 +935,15 @@  discard block
 block discarded – undo
900 935
 		if (isset($_POST['customfield']) && isset($_POST['customfield'][$row['col_name']]))
901 936
 		{
902 937
 			$value = $smcFunc['htmlspecialchars']($_POST['customfield'][$row['col_name']]);
903
-			if (in_array($row['field_type'], array('select', 'radio')))
904
-					$value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : '';
938
+			if (in_array($row['field_type'], array('select', 'radio'))) {
939
+								$value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : '';
940
+			}
905 941
 		}
906 942
 
907 943
 		// Don't show the "disabled" option for the "gender" field if we are on the "summary" area.
908
-		if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'Disabled')
909
-			continue;
944
+		if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'Disabled') {
945
+					continue;
946
+		}
910 947
 
911 948
 		// HTML for the input form.
912 949
 		$output_html = $value;
@@ -915,8 +952,7 @@  discard block
 block discarded – undo
915 952
 			$true = (!$exists && $row['default_value']) || $value;
916 953
 			$input_html = '<input type="checkbox" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($true ? ' checked' : '') . ' class="input_check">';
917 954
 			$output_html = $true ? $txt['yes'] : $txt['no'];
918
-		}
919
-		elseif ($row['field_type'] == 'select')
955
+		} elseif ($row['field_type'] == 'select')
920 956
 		{
921 957
 			$input_html = '<select name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"><option value="-1"></option>';
922 958
 			$options = explode(',', $row['field_options']);
@@ -924,13 +960,13 @@  discard block
 block discarded – undo
924 960
 			{
925 961
 				$true = (!$exists && $row['default_value'] == $v) || $value == $v;
926 962
 				$input_html .= '<option value="' . $k . '"' . ($true ? ' selected' : '') . '>' . $v . '</option>';
927
-				if ($true)
928
-					$output_html = $v;
963
+				if ($true) {
964
+									$output_html = $v;
965
+				}
929 966
 			}
930 967
 
931 968
 			$input_html .= '</select>';
932
-		}
933
-		elseif ($row['field_type'] == 'radio')
969
+		} elseif ($row['field_type'] == 'radio')
934 970
 		{
935 971
 			$input_html = '<fieldset>';
936 972
 			$options = explode(',', $row['field_options']);
@@ -938,36 +974,37 @@  discard block
 block discarded – undo
938 974
 			{
939 975
 				$true = (!$exists && $row['default_value'] == $v) || $value == $v;
940 976
 				$input_html .= '<label for="customfield_' . $row['col_name'] . '_' . $k . '"><input type="radio" name="customfield[' . $row['col_name'] . ']" class="input_radio" id="customfield_' . $row['col_name'] . '_' . $k . '" value="' . $k . '"' . ($true ? ' checked' : '') . '>' . $v . '</label><br>';
941
-				if ($true)
942
-					$output_html = $v;
977
+				if ($true) {
978
+									$output_html = $v;
979
+				}
943 980
 			}
944 981
 			$input_html .= '</fieldset>';
945
-		}
946
-		elseif ($row['field_type'] == 'text')
982
+		} elseif ($row['field_type'] == 'text')
947 983
 		{
948 984
 			$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) . '" class="input_text"' . ($row['show_reg'] == 2 ? ' required' : '') . '>';
949
-		}
950
-		else
985
+		} else
951 986
 		{
952 987
 			@list ($rows, $cols) = @explode(',', $row['default_value']);
953 988
 			$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>';
954 989
 		}
955 990
 
956 991
 		// Parse BBCode
957
-		if ($row['bbc'])
958
-			$output_html = parse_bbc($output_html);
959
-		elseif ($row['field_type'] == 'textarea')
960
-			// Allow for newlines at least
992
+		if ($row['bbc']) {
993
+					$output_html = parse_bbc($output_html);
994
+		} elseif ($row['field_type'] == 'textarea') {
995
+					// Allow for newlines at least
961 996
 			$output_html = strtr($output_html, array("\n" => '<br>'));
997
+		}
962 998
 
963 999
 		// Enclosing the user input within some other text?
964
-		if (!empty($row['enclose']) && !empty($output_html))
965
-			$output_html = strtr($row['enclose'], array(
1000
+		if (!empty($row['enclose']) && !empty($output_html)) {
1001
+					$output_html = strtr($row['enclose'], array(
966 1002
 				'{SCRIPTURL}' => $scripturl,
967 1003
 				'{IMAGES_URL}' => $settings['images_url'],
968 1004
 				'{DEFAULT_IMAGES_URL}' => $settings['default_images_url'],
969 1005
 				'{INPUT}' => un_htmlspecialchars($output_html),
970 1006
 			));
1007
+		}
971 1008
 
972 1009
 		$context['custom_fields'][] = array(
973 1010
 			'name' => $row['field_name'],
Please login to merge, or discard this patch.