Passed
Push — master ( d9e5dd...36764d )
by Spuds
01:07 queued 26s
created
sources/controllers/Recent.controller.php 2 patches
Braces   +27 added lines, -10 removed lines patch added patch discarded remove patch
@@ -187,19 +187,28 @@  discard block
 block discarded – undo
187 187
 
188 188
 		// Recent posts by category id's
189 189
 		if (!empty($this->_req->query->c) && empty($board))
190
-			$categories = $this->_recentPostsCategory();
190
+		{
191
+					$categories = $this->_recentPostsCategory();
192
+		}
191 193
 		// Or recent posts by board id's?
192 194
 		elseif (!empty($this->_req->query->boards))
193
-			$this->_recentPostsBoards();
195
+		{
196
+					$this->_recentPostsBoards();
197
+		}
194 198
 		// Or just the recent posts for a specific board
195 199
 		elseif (!empty($board))
196
-			$this->_recentPostsBoard();
200
+		{
201
+					$this->_recentPostsBoard();
202
+		}
197 203
 		// All the recent posts across boards and categories it is then
198
-		else
199
-			$this->_recentPostsAll();
204
+		else {
205
+					$this->_recentPostsAll();
206
+		}
200 207
 
201 208
 		if (!empty($this->_maxMsgID))
202
-			$this->_grabber->setEarliestMsg(max(0, $modSettings['maxMsgID'] - $this->_maxMsgID[0] - $this->_start * $this->_maxMsgID[1]));
209
+		{
210
+					$this->_grabber->setEarliestMsg(max(0, $modSettings['maxMsgID'] - $this->_maxMsgID[0] - $this->_start * $this->_maxMsgID[1]));
211
+		}
203 212
 
204 213
 		// Set up the pageindex
205 214
 		$context['page_index'] = constructPageIndex($this->_base_url, $this->_start, min(100, $this->_total_posts), $this->_num_per_page, !empty($this->_flex_start));
@@ -335,7 +344,9 @@  discard block
 block discarded – undo
335 344
 			$name = categoryName($categories[0]);
336 345
 
337 346
 			if (empty($name))
338
-				throw new Elk_Exception('no_access', false);
347
+			{
348
+							throw new Elk_Exception('no_access', false);
349
+			}
339 350
 
340 351
 			$context['linktree'][] = array(
341 352
 				'url' => $scripturl . $modSettings['default_forum_action'] . '#c' . $categories[0],
@@ -349,14 +360,18 @@  discard block
 block discarded – undo
349 360
 		$boards = array_keys($boards_posts);
350 361
 
351 362
 		if (empty($boards))
352
-			throw new Elk_Exception('error_no_boards_selected');
363
+		{
364
+					throw new Elk_Exception('error_no_boards_selected');
365
+		}
353 366
 
354 367
 		// The query for getting the messages
355 368
 		$this->_grabber->setBoards($boards);
356 369
 
357 370
 		// If this category has a significant number of posts in it...
358 371
 		if ($this->_total_posts > 100 && $this->_total_posts > $modSettings['totalMessages'] / 15)
359
-			$this->_maxMsgID = array(400, 7);
372
+		{
373
+					$this->_maxMsgID = array(400, 7);
374
+		}
360 375
 
361 376
 		$this->_base_url = $scripturl . '?action=recent;c=' . implode(',', $categories);
362 377
 
@@ -409,7 +424,9 @@  discard block
 block discarded – undo
409 424
 
410 425
 		// If this board has a significant number of posts in it...
411 426
 		if ($this->_total_posts > 80 && $this->_total_posts > $modSettings['totalMessages'] / $this->_num_per_page)
412
-			$this->_maxMsgID = array(600, 10);
427
+		{
428
+					$this->_maxMsgID = array(600, 10);
429
+		}
413 430
 
414 431
 		$this->_base_url = $scripturl . '?action=recent;board=' . $board . '.%1$d';
415 432
 		$this->_flex_start = true;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -445,7 +445,7 @@
 block discarded – undo
445 445
 		if (!empty($modSettings['likes_enabled']))
446 446
 		{
447 447
 			// Just the message id please
448
-			$messages = array_map(function ($element) {
448
+			$messages = array_map(function($element) {
449 449
 				return (int) $element['id'];
450 450
 			}, $messages);
451 451
 
Please login to merge, or discard this patch.
sources/controllers/PersonalMessage.controller.php 1 patch
Braces   +58 added lines, -21 removed lines patch added patch discarded remove patch
@@ -633,7 +633,9 @@  discard block
 block discarded – undo
633 633
 				// Get the order right.
634 634
 				$orderBy = array();
635 635
 				foreach (array_reverse($pms) as $pm)
636
-					$orderBy[] = 'pm.id_pm = ' . $pm;
636
+				{
637
+									$orderBy[] = 'pm.id_pm = ' . $pm;
638
+				}
637 639
 
638 640
 				// Separate query for these bits, preparePMContext_callback will use it as required
639 641
 				$subjects_request = loadPMSubjectRequest($pms, $orderBy);
@@ -894,7 +896,9 @@  discard block
 block discarded – undo
894 896
 			// Get a literal name list in case the user has JavaScript disabled.
895 897
 			$names = array();
896 898
 			foreach ($context['recipients']['to'] as $to)
897
-				$names[] = $to['name'];
899
+			{
900
+							$names[] = $to['name'];
901
+			}
898 902
 			$context['to_value'] = empty($names) ? '' : '"' . implode('", "', $names) . '"';
899 903
 		}
900 904
 		else
@@ -963,8 +967,7 @@  discard block
 block discarded – undo
963 967
 			&& !allowedTo(array('admin_forum', 'moderate_forum', 'send_mail'))
964 968
 			&& $user_info['mod_cache']['bq'] === '0=1'
965 969
 			&& $user_info['mod_cache']['gq'] === '0=1'
966
-		)
967
-		{
970
+		) {
968 971
 			// How many have they sent this last hour?
969 972
 			$pmCount = pmCount($user_info['id'], 3600);
970 973
 
@@ -1095,7 +1098,9 @@  discard block
 block discarded – undo
1095 1098
 					$post_errors->removeError('no_to');
1096 1099
 
1097 1100
 					foreach ($namesNotFound[$recipientType] as $name)
1098
-						$context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name);
1101
+					{
1102
+											$context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name);
1103
+					}
1099 1104
 				}
1100 1105
 			}
1101 1106
 		}
@@ -1166,7 +1171,9 @@  discard block
 block discarded – undo
1166 1171
 			{
1167 1172
 				$post_errors->addError('bad_' . $recipientType);
1168 1173
 				foreach ($names as $name)
1169
-					$context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name);
1174
+				{
1175
+									$context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name);
1176
+				}
1170 1177
 			}
1171 1178
 
1172 1179
 			$this->messagePostError($namedRecipientList, $recipientList);
@@ -1440,12 +1447,16 @@  discard block
 block discarded – undo
1440 1447
 		{
1441 1448
 			$pm_actions = array();
1442 1449
 			foreach ($this->_req->post->pms as $pm)
1443
-				$pm_actions[(int) $pm] = $pm_action;
1450
+			{
1451
+							$pm_actions[(int) $pm] = $pm_action;
1452
+			}
1444 1453
 		}
1445 1454
 
1446 1455
 		// No messages to action then bug out
1447 1456
 		if (empty($pm_actions))
1448
-			redirectexit($context['current_label_redirect']);
1457
+		{
1458
+					redirectexit($context['current_label_redirect']);
1459
+		}
1449 1460
 
1450 1461
 		// If we are in conversation, we may need to apply this to every message in that conversation.
1451 1462
 		if ($context['display_mode'] == 2 && isset($this->_req->query->conversation))
@@ -1716,7 +1727,9 @@  discard block
 block discarded – undo
1716 1727
 				if (!empty($new_labels))
1717 1728
 				{
1718 1729
 					for ($i = max($searchArray) + 1, $n = max(array_keys($new_labels)); $i <= $n; $i++)
1719
-						$searchArray[] = $i;
1730
+					{
1731
+											$searchArray[] = $i;
1732
+					}
1720 1733
 				}
1721 1734
 
1722 1735
 				updateLabelsToPM($searchArray, $new_labels, $user_info['id']);
@@ -1754,9 +1767,11 @@  discard block
 block discarded – undo
1754 1767
 
1755 1768
 				// Update/delete as appropriate.
1756 1769
 				foreach ($rule_changes as $k => $id)
1757
-					if (!empty($context['rules'][$id]['actions']))
1770
+				{
1771
+									if (!empty($context['rules'][$id]['actions']))
1758 1772
 					{
1759 1773
 						updatePMRuleAction($id, $user_info['id'], $context['rules'][$id]['actions']);
1774
+				}
1760 1775
 						unset($rule_changes[$k]);
1761 1776
 					}
1762 1777
 
@@ -1918,7 +1933,9 @@  discard block
 block discarded – undo
1918 1933
 			$recipients = array();
1919 1934
 			$temp = loadPMRecipientsAll($context['pm_id'], true);
1920 1935
 			foreach ($temp as $recipient)
1921
-				$recipients[] = $recipient['link'];
1936
+			{
1937
+							$recipients[] = $recipient['link'];
1938
+			}
1922 1939
 
1923 1940
 			// Now let's get out and loop through the admins.
1924 1941
 			$admins = admins(isset($this->_req->post->id_admin) ? (int) $this->_req->post->id_admin : 0);
@@ -1970,7 +1987,9 @@  discard block
 block discarded – undo
1970 1987
 
1971 1988
 			// Send a different email for each language.
1972 1989
 			foreach ($messagesToSend as $lang => $message)
1973
-				sendpm($message['recipients'], $message['subject'], $message['body']);
1990
+			{
1991
+							sendpm($message['recipients'], $message['subject'], $message['body']);
1992
+			}
1974 1993
 
1975 1994
 			// Give the user their own language back!
1976 1995
 			if (!empty($modSettings['userLanguage']))
@@ -2089,9 +2108,11 @@  discard block
 block discarded – undo
2089 2108
 
2090 2109
 				// Need to get member names!
2091 2110
 				foreach ($context['rule']['criteria'] as $k => $criteria)
2092
-					if ($criteria['t'] === 'mid' && !empty($criteria['v']))
2111
+				{
2112
+									if ($criteria['t'] === 'mid' && !empty($criteria['v']))
2093 2113
 					{
2094 2114
 						$members[(int) $criteria['v']] = $k;
2115
+				}
2095 2116
 					}
2096 2117
 
2097 2118
 				if (!empty($members))
@@ -2099,7 +2120,9 @@  discard block
 block discarded – undo
2099 2120
 					require_once(SUBSDIR . '/Members.subs.php');
2100 2121
 					$result = getBasicMemberData(array_keys($members));
2101 2122
 					foreach ($result as $row)
2102
-						$context['rule']['criteria'][$members[$row['id_member']]]['v'] = $row['member_name'];
2123
+					{
2124
+											$context['rule']['criteria'][$members[$row['id_member']]]['v'] = $row['member_name'];
2125
+					}
2103 2126
 				}
2104 2127
 			}
2105 2128
 			else
@@ -2226,7 +2249,9 @@  discard block
 block discarded – undo
2226 2249
 			checkSession('post');
2227 2250
 			$toDelete = array();
2228 2251
 			foreach ($this->_req->post->delrule as $k => $v)
2229
-				$toDelete[] = (int) $k;
2252
+			{
2253
+							$toDelete[] = (int) $k;
2254
+			}
2230 2255
 
2231 2256
 			if (!empty($toDelete))
2232 2257
 			{
@@ -2621,7 +2646,9 @@  discard block
 block discarded – undo
2621 2646
 
2622 2647
 				$labelStatements = array();
2623 2648
 				foreach ($this->_req->post->searchlabel as $label)
2624
-					$labelStatements[] = $db->quote('FIND_IN_SET({string:label}, pmr.labels) != 0', array('label' => $label,));
2649
+				{
2650
+									$labelStatements[] = $db->quote('FIND_IN_SET({string:label}, pmr.labels) != 0', array('label' => $label,));
2651
+				}
2625 2652
 
2626 2653
 				$this->_searchq_parameters ['label_implode'] = '(' . implode(' OR ', $labelStatements) . ')';
2627 2654
 			}
@@ -2665,7 +2692,9 @@  discard block
 block discarded – undo
2665 2692
 			$members = membersBy('member_names', array('member_names' => $possible_users));
2666 2693
 
2667 2694
 			foreach ($possible_users as $key => $possible_user)
2668
-				$this->_searchq_parameters ['guest_user_name_implode_' . $key] = defined('DB_CASE_SENSITIVE') ? strtolower($possible_user) : $possible_user;
2695
+			{
2696
+							$this->_searchq_parameters ['guest_user_name_implode_' . $key] = defined('DB_CASE_SENSITIVE') ? strtolower($possible_user) : $possible_user;
2697
+			}
2669 2698
 
2670 2699
 			// Simply do nothing if there are too many members matching the criteria.
2671 2700
 			if (count($members) > $maxMembersToSearch)
@@ -2679,7 +2708,9 @@  discard block
 block discarded – undo
2679 2708
 					$uq = array();
2680 2709
 					$name = defined('DB_CASE_SENSITIVE') ? 'LOWER(pm.from_name)' : 'pm.from_name';
2681 2710
 					foreach (array_keys($possible_users) as $key)
2682
-						$uq[] = 'AND pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})';
2711
+					{
2712
+											$uq[] = 'AND pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})';
2713
+					}
2683 2714
 					$userQuery = implode(' ', $uq);
2684 2715
 					$this->_searchq_parameters ['pm_from_name'] = defined('DB_CASE_SENSITIVE') ? 'LOWER(pm.from_name)' : 'pm.from_name';
2685 2716
 				}
@@ -2692,7 +2723,9 @@  discard block
 block discarded – undo
2692 2723
 			{
2693 2724
 				$memberlist = array();
2694 2725
 				foreach ($members as $id)
2695
-					$memberlist[] = $id;
2726
+				{
2727
+									$memberlist[] = $id;
2728
+				}
2696 2729
 
2697 2730
 				// Use the name as as sent from or sent to
2698 2731
 				if ($context['folder'] === 'inbox')
@@ -2701,7 +2734,9 @@  discard block
 block discarded – undo
2701 2734
 					$name = defined('DB_CASE_SENSITIVE') ? 'LOWER(pm.from_name)' : 'pm.from_name';
2702 2735
 
2703 2736
 					foreach (array_keys($possible_users) as $key)
2704
-						$uq[] = 'AND (pm.id_member_from IN ({array_int:member_list}) OR (pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})))';
2737
+					{
2738
+											$uq[] = 'AND (pm.id_member_from IN ({array_int:member_list}) OR (pm.id_member_from = 0 AND (' . $name . ' LIKE {string:guest_user_name_implode_' . $key . '})))';
2739
+					}
2705 2740
 
2706 2741
 					$userQuery = implode(' ', $uq);
2707 2742
 				}
@@ -2806,7 +2841,9 @@  discard block
 block discarded – undo
2806 2841
 
2807 2842
 		// Now we have all the parameters, combine them together for pagination and the like...
2808 2843
 		foreach ($this->_search_params as $k => $v)
2809
-			$encoded[] = $k . '|\'|' . $v;
2844
+		{
2845
+					$encoded[] = $k . '|\'|' . $v;
2846
+		}
2810 2847
 
2811 2848
 		// Base64 encode, then replace +/= with uri safe ones that can be reverted
2812 2849
 		$encoded = str_replace(array('+', '/', '='), array('-', '_', '.'), base64_encode(implode('|"|', $encoded)));
Please login to merge, or discard this patch.
sources/controllers/Help.controller.php 1 patch
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -101,10 +101,14 @@  discard block
 block discarded – undo
101 101
 		global $txt, $helptxt, $context, $scripturl;
102 102
 
103 103
 		if (!isset($this->_req->query->help) || !is_string($this->_req->query->help))
104
-			throw new Elk_Exception('no_access', false);
104
+		{
105
+					throw new Elk_Exception('no_access', false);
106
+		}
105 107
 
106 108
 		if (!isset($helptxt))
107
-			$helptxt = array();
109
+		{
110
+					$helptxt = array();
111
+		}
108 112
 
109 113
 		$help_str = Util::htmlspecialchars($this->_req->query->help);
110 114
 
@@ -113,7 +117,9 @@  discard block
 block discarded – undo
113 117
 
114 118
 		// Load permission specific help
115 119
 		if (substr($help_str, 0, 14) == 'permissionhelp')
116
-			loadLanguage('ManagePermissions');
120
+		{
121
+					loadLanguage('ManagePermissions');
122
+		}
117 123
 
118 124
 		// Load our template
119 125
 		loadTemplate('Help');
@@ -135,16 +141,23 @@  discard block
 block discarded – undo
135 141
 		foreach ($helps as $help)
136 142
 		{
137 143
 			if (isset($helptxt[$help]))
138
-				$context['help_text'] .= $helptxt[$help];
144
+			{
145
+							$context['help_text'] .= $helptxt[$help];
146
+			}
139 147
 			elseif (isset($txt[$help]))
140
-				$context['help_text'] .= $txt[$help];
141
-			else
142
-				// nothing :(
148
+			{
149
+							$context['help_text'] .= $txt[$help];
150
+			}
151
+			else {
152
+							// nothing :(
143 153
 				$context['help_text'] .= $help;
154
+			}
144 155
 		}
145 156
 
146 157
 		// Link to the forum URL, and include session id.
147 158
 		if (preg_match('~%([0-9]+\$)?s\?~', $context['help_text'], $match))
148
-			$context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']);
159
+		{
160
+					$context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']);
161
+		}
149 162
 	}
150 163
 }
Please login to merge, or discard this patch.
sources/controllers/Memberlist.controller.php 1 patch
Braces   +84 added lines, -34 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@  discard block
 block discarded – undo
51 51
 		$context['in_search'] = !empty($this->_req->post->search);
52 52
 
53 53
 		foreach ($context['custom_search_fields'] as $field)
54
-			$this->_search_fields['cust_' . $field['colname']] = sprintf($txt['mlist_search_by'], $field['name']);
54
+		{
55
+					$this->_search_fields['cust_' . $field['colname']] = sprintf($txt['mlist_search_by'], $field['name']);
56
+		}
55 57
 	}
56 58
 
57 59
 	/**
@@ -165,7 +167,9 @@  discard block
 block discarded – undo
165 167
 
166 168
 		// Add in any custom profile columns
167 169
 		if (ml_CustomProfile())
168
-			$context['columns'] += $context['custom_profile_fields']['columns'];
170
+		{
171
+					$context['columns'] += $context['custom_profile_fields']['columns'];
172
+		}
169 173
 
170 174
 		// The template may appreciate how many columns it needs to display
171 175
 		$context['colspan'] = 0;
@@ -196,8 +200,9 @@  discard block
 block discarded – undo
196 200
 				'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=memberlist;sa=all', 'active' => true),
197 201
 			);
198 202
 		}
199
-		else
200
-			$context['memberlist_buttons'] = array();
203
+		else {
204
+					$context['memberlist_buttons'] = array();
205
+		}
201 206
 
202 207
 		// Make fields available to the template
203 208
 		$context['search_fields'] = $this->_search_fields;
@@ -209,17 +214,26 @@  discard block
 block discarded – undo
209 214
 		call_integration_hook('integrate_memberlist_buttons');
210 215
 
211 216
 		if (!allowedTo('send_email_to_members'))
212
-			unset($context['columns']['email_address']);
217
+		{
218
+					unset($context['columns']['email_address']);
219
+		}
213 220
 		if (isset($context['disabled_fields']['website']))
214
-			unset($context['columns']['website']);
221
+		{
222
+					unset($context['columns']['website']);
223
+		}
215 224
 		if (isset($context['disabled_fields']['posts']))
216
-			unset($context['columns']['posts']);
225
+		{
226
+					unset($context['columns']['posts']);
227
+		}
217 228
 
218 229
 		// Jump to the sub action.
219 230
 		if (isset($subActions[$context['listing_by']]))
220
-			$this->{$subActions[$context['listing_by']][1]}();
221
-		else
222
-			$this->{$subActions['all'][1]}();
231
+		{
232
+					$this->{$subActions[$context['listing_by']][1]}();
233
+		}
234
+		else {
235
+					$this->{$subActions['all'][1]}();
236
+		}
223 237
 	}
224 238
 
225 239
 	/**
@@ -257,30 +271,39 @@  discard block
 block discarded – undo
257 271
 		{
258 272
 			// Maybe there's something cached already.
259 273
 			if (!empty($modSettings['memberlist_cache']))
260
-				$memberlist_cache = Util::unserialize($modSettings['memberlist_cache']);
274
+			{
275
+							$memberlist_cache = Util::unserialize($modSettings['memberlist_cache']);
276
+			}
261 277
 
262 278
 			// The chunk size for the cached index.
263 279
 			$cache_step_size = 500;
264 280
 
265 281
 			// Only update the cache if something changed or no cache existed yet.
266 282
 			if (empty($memberlist_cache) || empty($modSettings['memberlist_updated']) || $memberlist_cache['last_update'] < $modSettings['memberlist_updated'])
267
-				$memberlist_cache = ml_memberCache($cache_step_size);
283
+			{
284
+							$memberlist_cache = ml_memberCache($cache_step_size);
285
+			}
268 286
 
269 287
 			$context['num_members'] = $memberlist_cache['num_members'];
270 288
 		}
271 289
 		// Without cache we need an extra query to get the amount of members.
272
-		else
273
-			$context['num_members'] = ml_memberCount();
290
+		else {
291
+					$context['num_members'] = ml_memberCount();
292
+		}
274 293
 
275 294
 		// Set defaults for sort (real_name)
276 295
 		if (!isset($sort) || !isset($context['columns'][$sort]['sort']))
277
-			$sort = 'real_name';
296
+		{
297
+					$sort = 'real_name';
298
+		}
278 299
 
279 300
 		// Looking at a specific rolodex letter?
280 301
 		if (!is_numeric($start))
281 302
 		{
282 303
 			if (preg_match('~^[^\'\\\\/]~u', Util::strtolower($start), $match) === 0)
283
-				throw new Elk_Exception('Hacker?', false);
304
+			{
305
+							throw new Elk_Exception('Hacker?', false);
306
+			}
284 307
 
285 308
 			$start = ml_alphaStart($match[0]);
286 309
 		}
@@ -288,7 +311,9 @@  discard block
 block discarded – undo
288 311
 		// Build out the letter selection link bar
289 312
 		$context['letter_links'] = '';
290 313
 		for ($i = 97; $i < 123; $i++)
291
-			$context['letter_links'] .= '<a href="' . $scripturl . '?action=memberlist;sa=all;start=' . chr($i) . '#letter' . chr($i) . '">' . chr($i - 32) . '</a> ';
314
+		{
315
+					$context['letter_links'] .= '<a href="' . $scripturl . '?action=memberlist;sa=all;start=' . chr($i) . '#letter' . chr($i) . '">' . chr($i - 32) . '</a> ';
316
+		}
292 317
 
293 318
 		// Sort out the column information.
294 319
 		foreach ($context['columns'] as $col => $column_details)
@@ -304,7 +329,9 @@  discard block
 block discarded – undo
304 329
 			$context['columns'][$col]['link'] = '<a href="' . $context['columns'][$col]['href'] . '" rel="nofollow">' . $context['columns'][$col]['label'] . '</a>';
305 330
 			$context['columns'][$col]['selected'] = $sort == $col;
306 331
 			if ($context['columns'][$col]['selected'])
307
-				$context['columns'][$col]['class'] .= ' selected';
332
+			{
333
+							$context['columns'][$col]['class'] .= ' selected';
334
+			}
308 335
 		}
309 336
 
310 337
 		// Are we sorting the results
@@ -350,7 +377,9 @@  discard block
 block discarded – undo
350 377
 		{
351 378
 			$first_offset = floor(($memberlist_cache['num_members'] - $modSettings['defaultMaxMembers'] - $start) / $cache_step_size) * $cache_step_size;
352 379
 			if ($first_offset < 0)
353
-				$first_offset = 0;
380
+			{
381
+							$first_offset = 0;
382
+			}
354 383
 			$second_offset = ceil(($memberlist_cache['num_members'] - $start) / $cache_step_size) * $cache_step_size;
355 384
 
356 385
 			$where = 'mem.real_name BETWEEN {string:real_name_low} AND {string:real_name_high}';
@@ -361,7 +390,9 @@  discard block
 block discarded – undo
361 390
 
362 391
 		// Add custom fields parameters too.
363 392
 		if (!empty($context['custom_profile_fields']['parameters']))
364
-			$query_parameters += $context['custom_profile_fields']['parameters'];
393
+		{
394
+					$query_parameters += $context['custom_profile_fields']['parameters'];
395
+		}
365 396
 
366 397
 		// Select the members from the database.
367 398
 		ml_selectMembers($query_parameters, $where, $limit, $sort);
@@ -413,17 +444,23 @@  discard block
 block discarded – undo
413 444
 			foreach ($input_fields as $val)
414 445
 			{
415 446
 				if (in_array($val, $fields_key))
416
-					$context['search_defaults'] = $input_fields;
447
+				{
448
+									$context['search_defaults'] = $input_fields;
449
+				}
417 450
 			}
418 451
 			$context['old_search_value'] = $search;
419 452
 
420 453
 			// No fields?  Use default...
421 454
 			if (empty($input_fields))
422
-				$input_fields = array('name');
455
+			{
456
+							$input_fields = array('name');
457
+			}
423 458
 
424 459
 			// Set defaults for how the results are sorted
425 460
 			if (!isset($sort) || !isset($context['columns'][$sort]))
426
-				$sort = 'real_name';
461
+			{
462
+							$sort = 'real_name';
463
+			}
427 464
 
428 465
 			// Build the column link / sort information.
429 466
 			foreach ($context['columns'] as $col => $column_details)
@@ -431,7 +468,9 @@  discard block
 block discarded – undo
431 468
 				$context['columns'][$col]['href'] = $scripturl . '?action=memberlist;sa=search;start=0;sort=' . $col;
432 469
 
433 470
 				if ((!isset($desc) && $col == $sort) || ($col != $sort && !empty($column_details['default_sort_rev'])))
434
-					$context['columns'][$col]['href'] .= ';desc';
471
+				{
472
+									$context['columns'][$col]['href'] .= ';desc';
473
+				}
435 474
 
436 475
 				$context['columns'][$col]['href'] .= ';search=' . $search . ';fields=' . implode(',', $input_fields);
437 476
 				$context['columns'][$col]['link'] = '<a href="' . $context['columns'][$col]['href'] . '" rel="nofollow">' . $context['columns'][$col]['label'] . '</a>';
@@ -455,17 +494,24 @@  discard block
 block discarded – undo
455 494
 
456 495
 			// Search for a name
457 496
 			if (in_array('name', $input_fields))
458
-				$fields = allowedTo('moderate_forum') ? array('member_name', 'real_name') : array('real_name');
459
-			else
460
-				$fields = array();
497
+			{
498
+							$fields = allowedTo('moderate_forum') ? array('member_name', 'real_name') : array('real_name');
499
+			}
500
+			else {
501
+							$fields = array();
502
+			}
461 503
 
462 504
 			// Search for websites.
463 505
 			if (in_array('website', $input_fields))
464
-				$fields += array(7 => 'website_title', 'website_url');
506
+			{
507
+							$fields += array(7 => 'website_title', 'website_url');
508
+			}
465 509
 
466 510
 			// Search for groups.
467 511
 			if (in_array('group', $input_fields))
468
-				$fields += array(9 => 'COALESCE(group_name, {string:blank_string})');
512
+			{
513
+							$fields += array(9 => 'COALESCE(group_name, {string:blank_string})');
514
+			}
469 515
 
470 516
 			// Search for an email address?
471 517
 			if (in_array('email', $input_fields))
@@ -473,8 +519,9 @@  discard block
 block discarded – undo
473 519
 				$fields += array(2 => allowedTo('moderate_forum') ? 'email_address' : '(hide_email = 0 AND email_address');
474 520
 				$condition = allowedTo('moderate_forum') ? '' : ')';
475 521
 			}
476
-			else
477
-				$condition = '';
522
+			else {
523
+							$condition = '';
524
+			}
478 525
 
479 526
 			if (defined('DB_CASE_SENSITIVE'))
480 527
 			{
@@ -517,7 +564,9 @@  discard block
 block discarded – undo
517 564
 			}
518 565
 
519 566
 			if (empty($fields))
520
-				redirectexit('action=memberlist');
567
+			{
568
+							redirectexit('action=memberlist');
569
+			}
521 570
 
522 571
 			$validFields = array_unique($validFields);
523 572
 			$query = $search == '' ? '= {string:blank_string}' : (defined('DB_CASE_SENSITIVE') ? 'LIKE LOWER({string:search})' : 'LIKE {string:search}');
@@ -528,8 +577,9 @@  discard block
 block discarded – undo
528 577
 			$context['letter_links'] = '';
529 578
 			$context['page_index'] = constructPageIndex($scripturl . '?action=memberlist;sa=search;search=' . $search . ';fields=' . implode(',', $validFields), $start, $numResults, $modSettings['defaultMaxMembers']);
530 579
 		}
531
-		else
532
-			redirectexit('action=memberlist');
580
+		else {
581
+					redirectexit('action=memberlist');
582
+		}
533 583
 
534 584
 		$context['linktree'][] = array(
535 585
 			'url' => $scripturl . '?action=memberlist;sa=search',
Please login to merge, or discard this patch.
sources/controllers/MessageIndex.controller.php 1 patch
Braces   +102 added lines, -39 removed lines patch added patch discarded remove patch
@@ -171,7 +171,9 @@  discard block
 block discarded – undo
171 171
 		{
172 172
 			// Don't index a sort result etc.
173 173
 			if (!in_array($k, array('board', 'start', $session_name)))
174
-				$context['robot_no_index'] = true;
174
+			{
175
+							$context['robot_no_index'] = true;
176
+			}
175 177
 		}
176 178
 
177 179
 		if (!empty($this->_req->query->start) && (!is_numeric($this->_req->query->start) || $this->_req->query->start % $context['messages_per_page'] != 0))
@@ -202,9 +204,12 @@  discard block
 block discarded – undo
202 204
 
203 205
 		// Make sure the starting place makes sense and construct the page index.
204 206
 		if (isset($this->_req->query->sort))
205
-			$sort_string = ';sort=' . $this->_req->query->sort . (isset($this->_req->query->desc) ? ';desc' : '');
206
-		else
207
-			$sort_string = '';
207
+		{
208
+					$sort_string = ';sort=' . $this->_req->query->sort . (isset($this->_req->query->desc) ? ';desc' : '');
209
+		}
210
+		else {
211
+					$sort_string = '';
212
+		}
208 213
 
209 214
 		$context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%1$d' . $sort_string, $this->_req->query->start, $board_info['total_topics'], $maxindex, true);
210 215
 		$context['start'] = &$this->_req->query->start;
@@ -234,7 +239,9 @@  discard block
 block discarded – undo
234 239
 		if (!empty($board_info['moderators']))
235 240
 		{
236 241
 			foreach ($board_info['moderators'] as $mod)
237
-				$context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>';
242
+			{
243
+							$context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>';
244
+			}
238 245
 		}
239 246
 
240 247
 		// Mark current and parent boards as seen.
@@ -249,8 +256,9 @@  discard block
 block discarded – undo
249 256
 				$board_list = array_keys($board_info['parent_boards']);
250 257
 				$board_list[] = $board;
251 258
 			}
252
-			else
253
-				$board_list = array($board);
259
+			else {
260
+							$board_list = array($board);
261
+			}
254 262
 
255 263
 			// Mark boards as read. Boards alone, no need for topics.
256 264
 			markBoardsRead($board_list, false, false);
@@ -276,8 +284,9 @@  discard block
 block discarded – undo
276 284
 			// From now on, they've seen it. So we reset notifications.
277 285
 			$context['is_marked_notify'] = resetSentBoardNotification($user_info['id'], $board);
278 286
 		}
279
-		else
280
-			$context['is_marked_notify'] = false;
287
+		else {
288
+					$context['is_marked_notify'] = false;
289
+		}
281 290
 
282 291
 		// 'Print' the header and board info.
283 292
 		$context['page_title'] = strip_tags($board_info['name']);
@@ -357,8 +366,9 @@  discard block
 block discarded – undo
357 366
 			$maxindex = $board_info['total_topics'] < $start + $maxindex + 1 ? $board_info['total_topics'] - $start : $maxindex;
358 367
 			$start = $board_info['total_topics'] < $start + $maxindex + 1 ? 0 : $board_info['total_topics'] - $start - $maxindex;
359 368
 		}
360
-		else
361
-			$fake_ascending = false;
369
+		else {
370
+					$fake_ascending = false;
371
+		}
362 372
 
363 373
 		$context['topics'] = array();
364 374
 
@@ -383,7 +393,9 @@  discard block
 block discarded – undo
383 393
 
384 394
 		// Fix the sequence of topics if they were retrieved in the wrong order. (for speed reasons...)
385 395
 		if ($fake_ascending)
386
-			$context['topics'] = array_reverse($context['topics'], true);
396
+		{
397
+					$context['topics'] = array_reverse($context['topics'], true);
398
+		}
387 399
 
388 400
 		$topic_ids = array_keys($context['topics']);
389 401
 
@@ -438,10 +450,13 @@  discard block
 block discarded – undo
438 450
 
439 451
 			// Can we use quick moderation checkboxes?
440 452
 			if ($options['display_quick_mod'] == 1)
441
-				$context['can_quick_mod'] = $context['user']['is_logged'] || $context['can_approve'] || $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move'] || $context['can_merge'] || $context['can_restore'];
453
+			{
454
+							$context['can_quick_mod'] = $context['user']['is_logged'] || $context['can_approve'] || $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move'] || $context['can_merge'] || $context['can_restore'];
455
+			}
442 456
 			// Or the icons?
443
-			else
444
-				$context['can_quick_mod'] = $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move'];
457
+			else {
458
+							$context['can_quick_mod'] = $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move'];
459
+			}
445 460
 		}
446 461
 
447 462
 		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1)
@@ -451,7 +466,9 @@  discard block
 block discarded – undo
451 466
 		}
452 467
 
453 468
 		if (!empty($context['boards']) && $context['start'] == 0)
454
-			$template_layers->add('display_child_boards');
469
+		{
470
+					$template_layers->add('display_child_boards');
471
+		}
455 472
 
456 473
 		// If there are children, but no topics and no ability to post topics...
457 474
 		$context['no_topic_listing'] = !empty($context['boards']) && empty($context['topics']) && !$context['can_post_new'];
@@ -471,13 +488,15 @@  discard block
 block discarded – undo
471 488
 
472 489
 		// They can only mark read if they are logged in and it's enabled!
473 490
 		if (!$user_info['is_guest'] && $settings['show_mark_read'])
474
-			$context['normal_buttons']['markread'] = array(
491
+		{
492
+					$context['normal_buttons']['markread'] = array(
475 493
 				'text' => 'mark_read_short',
476 494
 				'image' => 'markread.png',
477 495
 				'lang' => true,
478 496
 				'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id'],
479 497
 				'custom' => 'onclick="return markboardreadButton(this);"'
480 498
 			);
499
+		}
481 500
 
482 501
 		// Allow adding new buttons easily.
483 502
 		call_integration_hook('integrate_messageindex_buttons');
@@ -497,10 +516,14 @@  discard block
 block discarded – undo
497 516
 
498 517
 		// Lets go straight to the restore area.
499 518
 		if ($this->_req->getPost('qaction') === 'restore' && !empty($this->_req->post->topics))
500
-			redirectexit('action=restoretopic;topics=' . implode(',', $this->_req->post->topics) . ';' . $context['session_var'] . '=' . $context['session_id']);
519
+		{
520
+					redirectexit('action=restoretopic;topics=' . implode(',', $this->_req->post->topics) . ';' . $context['session_var'] . '=' . $context['session_id']);
521
+		}
501 522
 
502 523
 		if (isset($_SESSION['topicseen_cache']))
503
-			$_SESSION['topicseen_cache'] = array();
524
+		{
525
+					$_SESSION['topicseen_cache'] = array();
526
+		}
504 527
 
505 528
 		// This is going to be needed to send off the notifications and for updateLastMessages().
506 529
 		require_once(SUBSDIR . '/Post.subs.php');
@@ -547,19 +570,33 @@  discard block
 block discarded – undo
547 570
 		}
548 571
 
549 572
 		if (!$user_info['is_guest'])
550
-			$possibleActions[] = 'markread';
573
+		{
574
+					$possibleActions[] = 'markread';
575
+		}
551 576
 		if (!empty($boards_can['make_sticky']))
552
-			$possibleActions[] = 'sticky';
577
+		{
578
+					$possibleActions[] = 'sticky';
579
+		}
553 580
 		if (!empty($boards_can['move_any']) || !empty($boards_can['move_own']))
554
-			$possibleActions[] = 'move';
581
+		{
582
+					$possibleActions[] = 'move';
583
+		}
555 584
 		if (!empty($boards_can['remove_any']) || !empty($boards_can['remove_own']))
556
-			$possibleActions[] = 'remove';
585
+		{
586
+					$possibleActions[] = 'remove';
587
+		}
557 588
 		if (!empty($boards_can['lock_any']) || !empty($boards_can['lock_own']))
558
-			$possibleActions[] = 'lock';
589
+		{
590
+					$possibleActions[] = 'lock';
591
+		}
559 592
 		if (!empty($boards_can['merge_any']))
560
-			$possibleActions[] = 'merge';
593
+		{
594
+					$possibleActions[] = 'merge';
595
+		}
561 596
 		if (!empty($boards_can['approve_posts']))
562
-			$possibleActions[] = 'approve';
597
+		{
598
+					$possibleActions[] = 'approve';
599
+		}
563 600
 
564 601
 		// Two methods: $_REQUEST['actions'] (id_topic => action), and $_REQUEST['topics'] and $this->_req->post->qaction.
565 602
 		// (if action is 'move', $_REQUEST['move_to'] or $_REQUEST['move_tos'][$topic] is used.)
@@ -567,14 +604,18 @@  discard block
 block discarded – undo
567 604
 		{
568 605
 			// If the action isn't valid, just quit now.
569 606
 			if (empty($this->_req->post->qaction) || !in_array($this->_req->post->qaction, $possibleActions))
570
-				redirectexit($redirect_url);
607
+			{
608
+							redirectexit($redirect_url);
609
+			}
571 610
 
572 611
 			// Merge requires all topics as one parameter and can be done at once.
573 612
 			if ($this->_req->post->qaction === 'merge')
574 613
 			{
575 614
 				// Merge requires at least two topics.
576 615
 				if (empty($this->_req->post->topics) || count($this->_req->post->topics) < 2)
577
-					redirectexit($redirect_url);
616
+				{
617
+									redirectexit($redirect_url);
618
+				}
578 619
 
579 620
 				$controller = new MergeTopics_Controller(new Event_Manager());
580 621
 				$controller->pre_dispatch();
@@ -583,7 +624,9 @@  discard block
 block discarded – undo
583 624
 
584 625
 			// Just convert to the other method, to make it easier.
585 626
 			foreach ($this->_req->post->topics as $topic)
586
-				$actions[(int) $topic] = $this->_req->post->qaction;
627
+			{
628
+							$actions[(int) $topic] = $this->_req->post->qaction;
629
+			}
587 630
 		}
588 631
 		else
589 632
 		{
@@ -592,7 +635,9 @@  discard block
 block discarded – undo
592 635
 
593 636
 		// Weird... how'd you get here?
594 637
 		if (empty($actions))
595
-			redirectexit($redirect_url);
638
+		{
639
+					redirectexit($redirect_url);
640
+		}
596 641
 
597 642
 		// Validate each action.
598 643
 		$all_actions = array();
@@ -600,7 +645,9 @@  discard block
 block discarded – undo
600 645
 		foreach ($actions as $topic => $action)
601 646
 		{
602 647
 			if (in_array($action, $possibleActions))
603
-				$all_actions[(int) $topic] = $action;
648
+			{
649
+							$all_actions[(int) $topic] = $action;
650
+			}
604 651
 		}
605 652
 
606 653
 		$stickyCache = array();
@@ -620,7 +667,9 @@  discard block
 block discarded – undo
620 667
 				if (!empty($board))
621 668
 				{
622 669
 					if ($row['id_board'] != $board || ($modSettings['postmod_active'] && !$row['approved'] && !allowedTo('approve_posts')))
623
-						continue;
670
+					{
671
+											continue;
672
+					}
624 673
 				}
625 674
 				else
626 675
 				{
@@ -703,23 +752,33 @@  discard block
 block discarded – undo
703 752
 
704 753
 		// Do all the stickies...
705 754
 		if (!empty($stickyCache))
706
-			toggleTopicSticky($stickyCache, true);
755
+		{
756
+					toggleTopicSticky($stickyCache, true);
757
+		}
707 758
 
708 759
 		// Move sucka! (this is, by the by, probably the most complicated part....)
709 760
 		if (!empty($moveCache[0]))
710
-			moveTopicsPermissions($moveCache);
761
+		{
762
+					moveTopicsPermissions($moveCache);
763
+		}
711 764
 
712 765
 		// Now delete the topics...
713 766
 		if (!empty($removeCache))
714
-			removeTopicsPermissions($removeCache);
767
+		{
768
+					removeTopicsPermissions($removeCache);
769
+		}
715 770
 
716 771
 		// Approve the topics...
717 772
 		if (!empty($approveCache))
718
-			approveTopics($approveCache, true, true);
773
+		{
774
+					approveTopics($approveCache, true, true);
775
+		}
719 776
 
720 777
 		// And (almost) lastly, lock the topics...
721 778
 		if (!empty($lockCache))
722
-			toggleTopicsLock($lockCache, true);
779
+		{
780
+					toggleTopicsLock($lockCache, true);
781
+		}
723 782
 
724 783
 		if (!empty($markCache))
725 784
 		{
@@ -727,7 +786,9 @@  discard block
 block discarded – undo
727 786
 
728 787
 			$markArray = array();
729 788
 			foreach ($markCache as $topic)
730
-				$markArray[] = array($user_info['id'], $topic, $modSettings['maxMsgID'], (int) !empty($logged_topics[$topic]));
789
+			{
790
+							$markArray[] = array($user_info['id'], $topic, $modSettings['maxMsgID'], (int) !empty($logged_topics[$topic]));
791
+			}
731 792
 
732 793
 			markTopicsRead($markArray, true);
733 794
 		}
@@ -740,7 +801,9 @@  discard block
 block discarded – undo
740 801
 		));
741 802
 
742 803
 		if (!empty($affectedBoards))
743
-			updateLastMessages(array_keys($affectedBoards));
804
+		{
805
+					updateLastMessages(array_keys($affectedBoards));
806
+		}
744 807
 
745 808
 		redirectexit($redirect_url);
746 809
 	}
Please login to merge, or discard this patch.
sources/controllers/Profile.controller.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
85 85
 
86 86
 		// Don't reload this as we may have processed error strings.
87 87
 		if (empty($post_errors))
88
-			loadLanguage('Profile');
88
+		{
89
+					loadLanguage('Profile');
90
+		}
89 91
 		loadTemplate('Profile');
90 92
 
91 93
 		// Trigger profile pre-load event
@@ -107,19 +109,27 @@  discard block
 block discarded – undo
107 109
 
108 110
 		// Is there an updated message to show?
109 111
 		if (isset($this->_req->query->updated))
110
-			$context['profile_updated'] = $txt['profile_updated_own'];
112
+		{
113
+					$context['profile_updated'] = $txt['profile_updated_own'];
114
+		}
111 115
 
112 116
 		// If it said no permissions that meant it wasn't valid!
113 117
 		if ($this->_profile_include_data && empty($this->_profile_include_data['permission']))
114
-			$this->_profile_include_data['enabled'] = false;
118
+		{
119
+					$this->_profile_include_data['enabled'] = false;
120
+		}
115 121
 
116 122
 		// No menu and guest? A warm welcome to register
117 123
 		if (!$this->_profile_include_data && $user_info['is_guest'])
118
-			is_not_guest();
124
+		{
125
+					is_not_guest();
126
+		}
119 127
 
120 128
 		// No menu means no access at all.
121 129
 		if (!$this->_profile_include_data || (isset($this->_profile_include_data['enabled']) && $this->_profile_include_data['enabled'] === false))
122
-			throw new Elk_Exception('no_access', false);
130
+		{
131
+					throw new Elk_Exception('no_access', false);
132
+		}
123 133
 
124 134
 		// Make a note of the Unique ID for this menu.
125 135
 		$context['profile_menu_id'] = $context['max_menu_id'];
@@ -144,7 +154,9 @@  discard block
 block discarded – undo
144 154
 
145 155
 		// Permissions for good measure.
146 156
 		if (!empty($this->_profile_include_data['permission']))
147
-			isAllowedTo($this->_profile_include_data['permission'][$context['user']['is_owner'] ? 'own' : 'any']);
157
+		{
158
+					isAllowedTo($this->_profile_include_data['permission'][$context['user']['is_owner'] ? 'own' : 'any']);
159
+		}
148 160
 
149 161
 		// Session validation and/or Token Checks
150 162
 		$this->_check_access();
@@ -169,23 +181,33 @@  discard block
 block discarded – undo
169 181
 		{
170 182
 			// Set all the errors so the template knows what went wrong.
171 183
 			foreach ($post_errors as $error_type)
172
-				$context['modify_error'][$error_type] = true;
184
+			{
185
+							$context['modify_error'][$error_type] = true;
186
+			}
173 187
 		}
174 188
 		// If it's you then we should redirect upon save.
175 189
 		elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview'])
176
-			redirectexit('action=profile;area=' . $this->_current_area . ';updated');
190
+		{
191
+					redirectexit('action=profile;area=' . $this->_current_area . ';updated');
192
+		}
177 193
 		elseif (!empty($this->_force_redirect))
178
-			redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $this->_memID) . ';area=' . $this->_current_area);
194
+		{
195
+					redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $this->_memID) . ';area=' . $this->_current_area);
196
+		}
179 197
 
180 198
 		// Let go to the right place
181 199
 		if (isset($this->_profile_include_data['file']))
182
-			require_once($this->_profile_include_data['file']);
200
+		{
201
+					require_once($this->_profile_include_data['file']);
202
+		}
183 203
 
184 204
 		callMenu($this->_profile_include_data);
185 205
 
186 206
 		// Set the page title if it's not already set...
187 207
 		if (!isset($context['page_title']))
188
-			$context['page_title'] = $txt['profile'] . (isset($txt[$this->_current_area]) ? ' - ' . $txt[$this->_current_area] : '');
208
+		{
209
+					$context['page_title'] = $txt['profile'] . (isset($txt[$this->_current_area]) ? ' - ' . $txt[$this->_current_area] : '');
210
+		}
189 211
 	}
190 212
 
191 213
 	/**
@@ -734,7 +756,9 @@  discard block
 block discarded – undo
734 756
 				if (!empty($context['profile_execute_on_save']))
735 757
 				{
736 758
 					foreach ($context['profile_execute_on_save'] as $saveFunc)
737
-						$saveFunc();
759
+					{
760
+											$saveFunc();
761
+					}
738 762
 				}
739 763
 
740 764
 				// Let them know it worked!
Please login to merge, or discard this patch.
sources/controllers/Register.controller.php 1 patch
Braces   +153 added lines, -55 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// Check if the administrator has it disabled.
64 64
 		if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == '3')
65
-			throw new Elk_Exception('registration_disabled', false);
65
+		{
66
+					throw new Elk_Exception('registration_disabled', false);
67
+		}
66 68
 	}
67 69
 
68 70
 	/**
@@ -112,14 +114,20 @@  discard block
 block discarded – undo
112 114
 
113 115
 		// If this user is an admin - redirect them to the admin registration page.
114 116
 		if (allowedTo('moderate_forum') && !$user_info['is_guest'])
115
-			redirectexit('action=admin;area=regcenter;sa=register');
117
+		{
118
+					redirectexit('action=admin;area=regcenter;sa=register');
119
+		}
116 120
 		// You are not a guest, so you are a member - and members don't get to register twice!
117 121
 		elseif (empty($user_info['is_guest']))
118
-			redirectexit();
122
+		{
123
+					redirectexit();
124
+		}
119 125
 
120 126
 		// Confused and want to contact the admins instead
121 127
 		if (isset($this->_req->post->show_contact))
122
-			redirectexit('action=register;sa=contact');
128
+		{
129
+					redirectexit('action=register;sa=contact');
130
+		}
123 131
 
124 132
 		// If we have language support enabled then they need to be loaded
125 133
 		if ($this->_load_language_support())
@@ -181,7 +189,9 @@  discard block
 block discarded – undo
181 189
 		}
182 190
 		// Make sure they don't squeeze through without agreeing.
183 191
 		elseif ($current_step > 1 && $context['require_agreement'] && !$context['checkbox_agreement'] && !$context['registration_passed_agreement'])
184
-			$current_step = 1;
192
+		{
193
+					$current_step = 1;
194
+		}
185 195
 
186 196
 		// Show the user the right form.
187 197
 		$context['sub_template'] = $current_step == 1 ? 'registration_agreement' : 'registration_form';
@@ -207,13 +217,16 @@  discard block
 block discarded – undo
207 217
 
208 218
 		// Prepare the time gate! Done like this to allow later steps to reset the limit for any reason
209 219
 		if (!isset($_SESSION['register']))
210
-			$_SESSION['register'] = array(
220
+		{
221
+					$_SESSION['register'] = array(
211 222
 				'timenow' => time(),
212 223
 				// minimum number of seconds required on this page for registration
213 224
 				'limit' => 8,
214 225
 			);
215
-		else
216
-			$_SESSION['register']['timenow'] = time();
226
+		}
227
+		else {
228
+					$_SESSION['register']['timenow'] = time();
229
+		}
217 230
 
218 231
 		// If you have to agree to the agreement, it needs to be fetched from the file.
219 232
 		$agreement = new \Agreement($user_info['language']);
@@ -270,7 +283,9 @@  discard block
 block discarded – undo
270 283
 		$context['registration_errors'] = array();
271 284
 		$reg_errors = ErrorContext::context('register', 0);
272 285
 		if ($reg_errors->hasErrors())
273
-			$context['registration_errors'] = $reg_errors->prepareErrors();
286
+		{
287
+					$context['registration_errors'] = $reg_errors->prepareErrors();
288
+		}
274 289
 
275 290
 		createToken('register');
276 291
 	}
@@ -299,34 +314,50 @@  discard block
 block discarded – undo
299 314
 
300 315
 		checkSession();
301 316
 		if (!validateToken('register', 'post', true, false))
302
-			$reg_errors->addError('token_verification');
317
+		{
318
+					$reg_errors->addError('token_verification');
319
+		}
303 320
 
304 321
 		// If we're using an agreement checkbox, did they check it?
305 322
 		if (!empty($modSettings['checkboxAgreement']) && !empty($this->_req->post->checkbox_agreement))
306
-			$_SESSION['registration_agreed'] = true;
323
+		{
324
+					$_SESSION['registration_agreed'] = true;
325
+		}
307 326
 
308 327
 		// Using coppa and the registration checkbox?
309 328
 		if (!empty($modSettings['coppaAge']) && !empty($modSettings['checkboxAgreement']) && !empty($this->_req->post->accept_agreement))
310
-			$_SESSION['skip_coppa'] = true;
329
+		{
330
+					$_SESSION['skip_coppa'] = true;
331
+		}
311 332
 
312 333
 		// Well, if you don't agree, you can't register.
313 334
 		if (!empty($modSettings['requireAgreement']) && empty($_SESSION['registration_agreed']))
314
-			redirectexit();
335
+		{
336
+					redirectexit();
337
+		}
315 338
 
316 339
 		if (!empty($modSettings['requireAgreement']) && !empty($modSettings['requirePrivacypolicy']) && !empty($this->_req->post->checkbox_privacypol))
317
-			$_SESSION['registration_privacypolicy'] = true;
340
+		{
341
+					$_SESSION['registration_privacypolicy'] = true;
342
+		}
318 343
 
319 344
 		// Well, if you don't agree, you can't register.
320 345
 		if (!empty($modSettings['requireAgreement']) && !empty($modSettings['requirePrivacypolicy']) && empty($_SESSION['registration_privacypolicy']))
321
-			redirectexit();
346
+		{
347
+					redirectexit();
348
+		}
322 349
 
323 350
 		// Make sure they came from *somewhere*, have a session.
324 351
 		if (!isset($_SESSION['old_url']))
325
-			redirectexit('action=register');
352
+		{
353
+					redirectexit('action=register');
354
+		}
326 355
 
327 356
 		// If we don't require an agreement, we need a extra check for coppa.
328 357
 		if (empty($modSettings['requireAgreement']) && !empty($modSettings['coppaAge']))
329
-			$_SESSION['skip_coppa'] = !empty($this->_req->post->accept_agreement);
358
+		{
359
+					$_SESSION['skip_coppa'] = !empty($this->_req->post->accept_agreement);
360
+		}
330 361
 
331 362
 		// Are they under age, and under age users are banned?
332 363
 		if (!empty($modSettings['coppaAge']) && empty($modSettings['coppaType']) && empty($_SESSION['skip_coppa']))
@@ -337,7 +368,9 @@  discard block
 block discarded – undo
337 368
 
338 369
 		// Check the time gate for miscreants. First make sure they came from somewhere that actually set it up.
339 370
 		if (empty($_SESSION['register']['timenow']) || empty($_SESSION['register']['limit']))
340
-			redirectexit('action=register');
371
+		{
372
+					redirectexit('action=register');
373
+		}
341 374
 
342 375
 		// Failing that, check the time limit for excessive speed.
343 376
 		if (time() - $_SESSION['register']['timenow'] < $_SESSION['register']['limit'])
@@ -371,7 +404,9 @@  discard block
 block discarded – undo
371 404
 
372 405
 		// Checks already done if coming from the action
373 406
 		if ($verifiedOpenID)
374
-			$this->_can_register();
407
+		{
408
+					$this->_can_register();
409
+		}
375 410
 
376 411
 		// Clean the form values
377 412
 		foreach ($this->_req->post as $key => $value)
@@ -384,7 +419,9 @@  discard block
 block discarded – undo
384 419
 
385 420
 		// A little security to any secret answer ... @todo increase?
386 421
 		if ($this->_req->getPost('secret_answer', 'trim', '') !== '')
387
-			$this->_req->post->secret_answer = md5($this->_req->post->secret_answer);
422
+		{
423
+					$this->_req->post->secret_answer = md5($this->_req->post->secret_answer);
424
+		}
388 425
 
389 426
 		// Needed for isReservedName() and registerMember().
390 427
 		require_once(SUBSDIR . '/Members.subs.php');
@@ -395,15 +432,20 @@  discard block
 block discarded – undo
395 432
 			$this->_req->post->real_name = trim(preg_replace('~[\t\n\r \x0B\0\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}]+~u', ' ', $this->_req->post->real_name));
396 433
 			$has_real_name = true;
397 434
 		}
398
-		else
399
-			$has_real_name = false;
435
+		else {
436
+					$has_real_name = false;
437
+		}
400 438
 
401 439
 		// Handle a string as a birth date...
402 440
 		if ($this->_req->getPost('birthdate', 'trim', '') !== '')
403
-			$this->_req->post->birthdate = Util::strftime('%Y-%m-%d', strtotime($this->_req->post->birthdate));
441
+		{
442
+					$this->_req->post->birthdate = Util::strftime('%Y-%m-%d', strtotime($this->_req->post->birthdate));
443
+		}
404 444
 		// Or birthdate parts...
405 445
 		elseif (!empty($this->_req->post->bday1) && !empty($this->_req->post->bday2))
406
-			$this->_req->post->birthdate = sprintf('%04d-%02d-%02d', empty($this->_req->post->bday3) ? 0 : (int) $this->_req->post->bday3, (int) $this->_req->post->bday1, (int) $this->_req->post->bday2);
446
+		{
447
+					$this->_req->post->birthdate = sprintf('%04d-%02d-%02d', empty($this->_req->post->bday3) ? 0 : (int) $this->_req->post->bday3, (int) $this->_req->post->bday1, (int) $this->_req->post->bday2);
448
+		}
407 449
 
408 450
 		// By default assume email is hidden, only show it if we tell it to.
409 451
 		$this->_req->post->hide_email = !empty($this->_req->post->allow_email) ? 0 : 1;
@@ -416,12 +458,17 @@  discard block
 block discarded – undo
416 458
 
417 459
 			// Did we find it?
418 460
 			if (isset($context['languages'][$this->_req->post->lngfile]))
419
-				$_SESSION['language'] = $this->_req->post->lngfile;
420
-			else
421
-				unset($this->_req->post->lngfile);
461
+			{
462
+							$_SESSION['language'] = $this->_req->post->lngfile;
463
+			}
464
+			else {
465
+							unset($this->_req->post->lngfile);
466
+			}
422 467
 		}
423 468
 		elseif (isset($this->_req->post->lngfile))
424
-			unset($this->_req->post->lngfile);
469
+		{
470
+					unset($this->_req->post->lngfile);
471
+		}
425 472
 
426 473
 		// Set the options needed for registration.
427 474
 		$regOptions = array(
@@ -443,7 +490,9 @@  discard block
 block discarded – undo
443 490
 
444 491
 		// Registration options are always default options...
445 492
 		if (isset($this->_req->post->default_options))
446
-			$this->_req->post->options = isset($this->_req->post->options) ? $this->_req->post->options + $this->_req->post->default_options : $this->_req->post->default_options;
493
+		{
494
+					$this->_req->post->options = isset($this->_req->post->options) ? $this->_req->post->options + $this->_req->post->default_options : $this->_req->post->default_options;
495
+		}
447 496
 
448 497
 		$regOptions['theme_vars'] = isset($this->_req->post->options) && is_array($this->_req->post->options) ? $this->_req->post->options : array();
449 498
 
@@ -458,7 +507,9 @@  discard block
 block discarded – undo
458 507
 		{
459 508
 			// Don't allow overriding of the theme variables.
460 509
 			if (isset($regOptions['theme_vars'][$row['colname']]))
461
-				unset($regOptions['theme_vars'][$row['colname']]);
510
+			{
511
+							unset($regOptions['theme_vars'][$row['colname']]);
512
+			}
462 513
 
463 514
 			// Prepare the value!
464 515
 			$value = isset($this->_req->post->customfield[$row['colname']]) ? trim($this->_req->post->customfield[$row['colname']]) : '';
@@ -471,7 +522,9 @@  discard block
 block discarded – undo
471 522
 				{
472 523
 					$err_params = array($row['name']);
473 524
 					if ($is_valid === 'custom_field_not_number')
474
-						$err_params[] = $row['field_length'];
525
+					{
526
+											$err_params[] = $row['field_length'];
527
+					}
475 528
 
476 529
 					$reg_errors->addError(array($is_valid, $err_params));
477 530
 				}
@@ -479,7 +532,9 @@  discard block
 block discarded – undo
479 532
 
480 533
 			// Is this required but not there?
481 534
 			if (trim($value) === '' && $row['show_reg'] > 1)
482
-				$reg_errors->addError(array('custom_field_empty', array($row['name'])));
535
+			{
536
+							$reg_errors->addError(array('custom_field_empty', array($row['name'])));
537
+			}
483 538
 		}
484 539
 
485 540
 		// Lets check for other errors before trying to register the member.
@@ -500,8 +555,10 @@  discard block
 block discarded – undo
500 555
 			// What do we need to save?
501 556
 			$save_variables = array();
502 557
 			foreach ($this->_req->post as $k => $v)
503
-				if (!in_array($k, array('sc', 'sesc', $context['session_var'], 'passwrd1', 'passwrd2', 'regSubmit')))
558
+			{
559
+							if (!in_array($k, array('sc', 'sesc', $context['session_var'], 'passwrd1', 'passwrd2', 'regSubmit')))
504 560
 					$save_variables[$k] = $v;
561
+			}
505 562
 
506 563
 			require_once(SUBSDIR . '/OpenID.subs.php');
507 564
 			$openID = new OpenID();
@@ -528,7 +585,9 @@  discard block
 block discarded – undo
528 585
 		if ($reg_errors->hasErrors(1) && !$user_info['is_admin'])
529 586
 		{
530 587
 			foreach ($reg_errors->prepareErrors(1) as $error)
531
-				throw new Elk_Exception($error, 'general');
588
+			{
589
+							throw new Elk_Exception($error, 'general');
590
+			}
532 591
 		}
533 592
 
534 593
 		// Was there actually an error of some kind dear boy?
@@ -561,7 +620,9 @@  discard block
 block discarded – undo
561 620
 
562 621
 		// If COPPA has been selected then things get complicated, setup the template.
563 622
 		if (!empty($modSettings['coppaAge']) && empty($_SESSION['skip_coppa']))
564
-			redirectexit('action=register;sa=coppa;member=' . $memberID);
623
+		{
624
+					redirectexit('action=register;sa=coppa;member=' . $memberID);
625
+		}
565 626
 		// Basic template variable setup.
566 627
 		elseif (!empty($modSettings['registration_method']))
567 628
 		{
@@ -593,11 +654,15 @@  discard block
 block discarded – undo
593 654
 
594 655
 		// You can't register if it's disabled.
595 656
 		if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
596
-			throw new Elk_Exception('registration_disabled', false);
657
+		{
658
+					throw new Elk_Exception('registration_disabled', false);
659
+		}
597 660
 
598 661
 		// Make sure they didn't just register with this session.
599 662
 		if (!empty($_SESSION['just_registered']) && empty($modSettings['disableRegisterCheck']))
600
-			throw new Elk_Exception('register_only_once', false);
663
+		{
664
+					throw new Elk_Exception('register_only_once', false);
665
+		}
601 666
 	}
602 667
 
603 668
 	/**
@@ -645,7 +710,9 @@  discard block
 block discarded – undo
645 710
 		);
646 711
 
647 712
 		if ($has_real_name && trim($this->_req->post->real_name) != '' && !isReservedName($this->_req->post->real_name) && Util::strlen($this->_req->post->real_name) < 60)
648
-			$possible_strings[] = 'real_name';
713
+		{
714
+					$possible_strings[] = 'real_name';
715
+		}
649 716
 
650 717
 		// Some of these fields we may not want.
651 718
 		if (!empty($modSettings['registration_fields']))
@@ -657,13 +724,16 @@  discard block
 block discarded – undo
657 724
 
658 725
 			// Website is a little different
659 726
 			if (!in_array('website', $reg_fields))
660
-				$exclude_fields = array_merge($exclude_fields, array('website_url', 'website_title'));
727
+			{
728
+							$exclude_fields = array_merge($exclude_fields, array('website_url', 'website_title'));
729
+			}
661 730
 
662 731
 			// We used to accept signature on registration but it's being abused by spammers these days, so no more.
663 732
 			$exclude_fields[] = 'signature';
664 733
 		}
665
-		else
666
-			$exclude_fields = array('signature', 'website_url', 'website_title');
734
+		else {
735
+					$exclude_fields = array('signature', 'website_url', 'website_title');
736
+		}
667 737
 
668 738
 		$possible_strings = array_diff($possible_strings, $exclude_fields);
669 739
 		$possible_ints = array_diff($possible_ints, $exclude_fields);
@@ -674,20 +744,28 @@  discard block
 block discarded – undo
674 744
 
675 745
 		// Include the additional options that might have been filled in.
676 746
 		foreach ($possible_strings as $var)
677
-			if (isset($this->_req->post->{$var}))
747
+		{
748
+					if (isset($this->_req->post->{$var}))
678 749
 				$extra_register_vars[$var] = Util::htmlspecialchars($this->_req->post->{$var}, ENT_QUOTES);
750
+		}
679 751
 
680 752
 		foreach ($possible_ints as $var)
681
-			if (isset($this->_req->post->{$var}))
753
+		{
754
+					if (isset($this->_req->post->{$var}))
682 755
 				$extra_register_vars[$var] = (int) $this->_req->post->{$var};
756
+		}
683 757
 
684 758
 		foreach ($possible_floats as $var)
685
-			if (isset($this->_req->post->{$var}))
759
+		{
760
+					if (isset($this->_req->post->{$var}))
686 761
 				$extra_register_vars[$var] = (float) $this->_req->post->{$var};
762
+		}
687 763
 
688 764
 		foreach ($possible_bools as $var)
689
-			if (isset($this->_req->post->{$var}))
765
+		{
766
+					if (isset($this->_req->post->{$var}))
690 767
 				$extra_register_vars[$var] = empty($this->_req->post->{$var}) ? 0 : 1;
768
+		}
691 769
 
692 770
 		return $extra_register_vars;
693 771
 	}
@@ -799,7 +877,9 @@  discard block
 block discarded – undo
799 877
 
800 878
 		// Logged in users should not bother to activate their accounts
801 879
 		if (!empty($user_info['id']))
802
-			redirectexit();
880
+		{
881
+					redirectexit();
882
+		}
803 883
 
804 884
 		loadLanguage('Login');
805 885
 		loadTemplate('Login');
@@ -810,7 +890,9 @@  discard block
 block discarded – undo
810 890
 		{
811 891
 			// Immediate 0 or disabled 3 means no need to try and activate
812 892
 			if (empty($modSettings['registration_method']) || $modSettings['registration_method'] == '3')
813
-				throw new Elk_Exception('no_access', false);
893
+			{
894
+							throw new Elk_Exception('no_access', false);
895
+			}
814 896
 
815 897
 			// Otherwise its simply invalid
816 898
 			$context['member_id'] = 0;
@@ -849,7 +931,9 @@  discard block
 block discarded – undo
849 931
 
850 932
 		// Quit if this code is not right.
851 933
 		if ($this->_activate_validate_code() === false)
852
-			return;
934
+		{
935
+					return;
936
+		}
853 937
 
854 938
 		// Validation complete - update the database!
855 939
 		require_once(SUBSDIR . '/Members.subs.php');
@@ -1024,7 +1108,9 @@  discard block
 block discarded – undo
1024 1108
 
1025 1109
 		// No User ID??
1026 1110
 		if (!isset($this->_req->query->member))
1027
-			throw new Elk_Exception('no_access', false);
1111
+		{
1112
+					throw new Elk_Exception('no_access', false);
1113
+		}
1028 1114
 
1029 1115
 		// Get the user details...
1030 1116
 		require_once(SUBSDIR . '/Members.subs.php');
@@ -1032,7 +1118,9 @@  discard block
 block discarded – undo
1032 1118
 
1033 1119
 		// If doesn't exist or not pending coppa
1034 1120
 		if (empty($member) || $member['is_activated'] != 5)
1035
-			throw new Elk_Exception('no_access', false);
1121
+		{
1122
+					throw new Elk_Exception('no_access', false);
1123
+		}
1036 1124
 
1037 1125
 		if (isset($this->_req->query->form))
1038 1126
 		{
@@ -1122,7 +1210,9 @@  discard block
 block discarded – undo
1122 1210
 			require_once(SUBSDIR . '/Graphics.subs.php');
1123 1211
 
1124 1212
 			if (!showCodeImage($code))
1125
-				header('HTTP/1.1 400 Bad Request');
1213
+			{
1214
+							header('HTTP/1.1 400 Bad Request');
1215
+			}
1126 1216
 		}
1127 1217
 		// Or direct link to the sound
1128 1218
 		elseif ($this->_req->query->format === '.wav')
@@ -1130,7 +1220,9 @@  discard block
 block discarded – undo
1130 1220
 			require_once(SUBSDIR . '/Sound.subs.php');
1131 1221
 
1132 1222
 			if (!createWaveFile($code))
1133
-				header('HTTP/1.1 400 Bad Request');
1223
+			{
1224
+							header('HTTP/1.1 400 Bad Request');
1225
+			}
1134 1226
 		}
1135 1227
 
1136 1228
 		// Why die when we can exit to live another day...
@@ -1150,7 +1242,9 @@  discard block
 block discarded – undo
1150 1242
 		// Users have no need to use this, just send a PM
1151 1243
 		// Disabled, you cannot enter.
1152 1244
 		if (!$user_info['is_guest'] || empty($modSettings['enable_contactform']) || $modSettings['enable_contactform'] === 'disabled')
1153
-			redirectexit();
1245
+		{
1246
+					redirectexit();
1247
+		}
1154 1248
 
1155 1249
 		loadLanguage('Login');
1156 1250
 		loadTemplate('Register');
@@ -1189,7 +1283,9 @@  discard block
 block discarded – undo
1189 1283
 
1190 1284
 			// Any form errors
1191 1285
 			if (!$validator->validate($this->_req->post))
1192
-				$context['errors'] = $validator->validation_errors();
1286
+			{
1287
+							$context['errors'] = $validator->validation_errors();
1288
+			}
1193 1289
 
1194 1290
 			// Get the clean data
1195 1291
 			$this->_req->post = new ArrayObject($validator->validation_data(), ArrayObject::ARRAY_AS_PROPS);
@@ -1219,7 +1315,9 @@  discard block
 block discarded – undo
1219 1315
 
1220 1316
 		// Show the contact done form or the form itself
1221 1317
 		if (isset($this->_req->query->done))
1222
-			$context['sub_template'] = 'contact_form_done';
1318
+		{
1319
+					$context['sub_template'] = 'contact_form_done';
1320
+		}
1223 1321
 		else
1224 1322
 		{
1225 1323
 			loadJavascriptFile('mailcheck.min.js');
Please login to merge, or discard this patch.
sources/controllers/Auth.controller.php 2 patches
Braces   +112 added lines, -41 removed lines patch added patch discarded remove patch
@@ -61,7 +61,9 @@  discard block
 block discarded – undo
61 61
 
62 62
 		// You are already logged in, go take a tour of the boards
63 63
 		if (!empty($user_info['id']))
64
-			redirectexit();
64
+		{
65
+					redirectexit();
66
+		}
65 67
 
66 68
 		// Load the Login template/language file.
67 69
 		loadLanguage('Login');
@@ -85,9 +87,12 @@  discard block
 block discarded – undo
85 87
 
86 88
 		// Set the login URL - will be used when the login process is done (but careful not to send us to an attachment).
87 89
 		if (isset($_SESSION['old_url']) && validLoginUrl($_SESSION['old_url'], true))
88
-			$_SESSION['login_url'] = $_SESSION['old_url'];
89
-		else
90
-			unset($_SESSION['login_url']);
90
+		{
91
+					$_SESSION['login_url'] = $_SESSION['old_url'];
92
+		}
93
+		else {
94
+					unset($_SESSION['login_url']);
95
+		}
91 96
 
92 97
 		// Create a one time token.
93 98
 		createToken('login');
@@ -116,7 +121,9 @@  discard block
 block discarded – undo
116 121
 
117 122
 		// Beyond this point you are assumed to be a guest trying to login.
118 123
 		if (!$user_info['is_guest'])
119
-			redirectexit();
124
+		{
125
+					redirectexit();
126
+		}
120 127
 
121 128
 		// Are you guessing with a script?
122 129
 		checkSession('post');
@@ -125,17 +132,25 @@  discard block
 block discarded – undo
125 132
 
126 133
 		// Set the login_url if it's not already set (but careful not to send us to an attachment).
127 134
 		if (empty($_SESSION['login_url']) && isset($_SESSION['old_url']) && validLoginUrl($_SESSION['old_url'], true))
128
-			$_SESSION['login_url'] = $_SESSION['old_url'];
135
+		{
136
+					$_SESSION['login_url'] = $_SESSION['old_url'];
137
+		}
129 138
 
130 139
 		// Been guessing a lot, haven't we?
131 140
 		if (isset($_SESSION['failed_login']) && $_SESSION['failed_login'] >= $modSettings['failed_login_threshold'] * 3)
132
-			throw new Elk_Exception('login_threshold_fail', 'critical');
141
+		{
142
+					throw new Elk_Exception('login_threshold_fail', 'critical');
143
+		}
133 144
 
134 145
 		// Set up the cookie length.  (if it's invalid, just fall through and use the default.)
135 146
 		if (isset($_POST['cookieneverexp']) || (!empty($_POST['cookielength']) && $_POST['cookielength'] == -1))
136
-			$modSettings['cookieTime'] = 3153600;
147
+		{
148
+					$modSettings['cookieTime'] = 3153600;
149
+		}
137 150
 		elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= 1 && $_POST['cookielength'] <= 525600))
138
-			$modSettings['cookieTime'] = (int) $_POST['cookielength'];
151
+		{
152
+					$modSettings['cookieTime'] = (int) $_POST['cookielength'];
153
+		}
139 154
 
140 155
 		loadLanguage('Login');
141 156
 
@@ -164,7 +179,9 @@  discard block
 block discarded – undo
164 179
 			$open_id = new OpenID();
165 180
 
166 181
 			if (($open_id->validate($_POST['openid_identifier'])) !== 'no_data')
167
-				return $open_id;
182
+			{
183
+							return $open_id;
184
+			}
168 185
 			else
169 186
 			{
170 187
 				$context['login_errors'] = array($txt['openid_not_found']);
@@ -181,7 +198,9 @@  discard block
 block discarded – undo
181 198
 
182 199
 		// No one needs a username that long, plus we only support 80 chars in the db
183 200
 		if (Util::strlen($_POST['user']) > 80)
184
-			$_POST['user'] = Util::substr($_POST['user'], 0, 80);
201
+		{
202
+					$_POST['user'] = Util::substr($_POST['user'], 0, 80);
203
+		}
185 204
 
186 205
 		// Can't use a password > 64 characters sorry, to long and only good for a DoS attack
187 206
 		// Plus we expect a 64 character one from SHA-256
@@ -282,7 +301,9 @@  discard block
 block discarded – undo
282 301
 
283 302
 				// To many tries, maybe they need a reminder
284 303
 				if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold'])
285
-					redirectexit('action=reminder');
304
+				{
305
+									redirectexit('action=reminder');
306
+				}
286 307
 				else
287 308
 				{
288 309
 					Errors::instance()->log_error($txt['incorrect_password'] . ' - <span class="remove">' . $user_settings['member_name'] . '</span>', 'user');
@@ -332,7 +353,9 @@  discard block
 block discarded – undo
332 353
 
333 354
 				// Hmm... don't remember it, do you?  Here, try the password reminder ;).
334 355
 				if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold'])
335
-					redirectexit('action=reminder');
356
+				{
357
+									redirectexit('action=reminder');
358
+				}
336 359
 				// We'll give you another chance...
337 360
 				else
338 361
 				{
@@ -366,7 +389,9 @@  discard block
 block discarded – undo
366 389
 		}
367 390
 		// Check their activation status.
368 391
 		if (!checkActivation())
369
-			return false;
392
+		{
393
+					return false;
394
+		}
370 395
 
371 396
 		doLogin();
372 397
 	}
@@ -390,16 +415,22 @@  discard block
 block discarded – undo
390 415
 
391 416
 		// Make sure they aren't being auto-logged out.
392 417
 		if (!$internal)
393
-			checkSession('get');
418
+		{
419
+					checkSession('get');
420
+		}
394 421
 
395 422
 		require_once(SUBSDIR . '/Auth.subs.php');
396 423
 
397 424
 		if (isset($_SESSION['pack_ftp']))
398
-			$_SESSION['pack_ftp'] = null;
425
+		{
426
+					$_SESSION['pack_ftp'] = null;
427
+		}
399 428
 
400 429
 		// They cannot be open ID verified any longer.
401 430
 		if (isset($_SESSION['openid']))
402
-			unset($_SESSION['openid']);
431
+		{
432
+					unset($_SESSION['openid']);
433
+		}
403 434
 
404 435
 		// It won't be first login anymore.
405 436
 		unset($_SESSION['first_login']);
@@ -419,7 +450,9 @@  discard block
 block discarded – undo
419 450
 		$types = array('admin', 'moderate');
420 451
 		call_integration_hook('integrate_validateSession', array(&$types));
421 452
 		foreach ($types as $type)
422
-			unset($_SESSION[$type . '_time']);
453
+		{
454
+					unset($_SESSION[$type . '_time']);
455
+		}
423 456
 
424 457
 		$_SESSION['log_time'] = 0;
425 458
 
@@ -438,7 +471,9 @@  discard block
 block discarded – undo
438 471
 		if ($redirect)
439 472
 		{
440 473
 			if (empty($_SESSION['logout_url']))
441
-				redirectexit('', detectServer()->is('needs_login_fix'));
474
+			{
475
+							redirectexit('', detectServer()->is('needs_login_fix'));
476
+			}
442 477
 			elseif (!empty($_SESSION['logout_url']) && (substr($_SESSION['logout_url'], 0, 7) !== 'http://' && substr($_SESSION['logout_url'], 0, 8) !== 'https://'))
443 478
 			{
444 479
 				unset($_SESSION['logout_url']);
@@ -474,7 +509,9 @@  discard block
 block discarded – undo
474 509
 
475 510
 		// Never redirect to an attachment
476 511
 		if (validLoginUrl($_SERVER['REQUEST_URL']))
477
-			$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];
512
+		{
513
+					$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];
514
+		}
478 515
 
479 516
 		$context['sub_template'] = 'kick_guest';
480 517
 		$context['page_title'] = $txt['login'];
@@ -520,7 +557,9 @@  discard block
 block discarded – undo
520 557
 		{
521 558
 			// Strike!  You're outta there!
522 559
 			if ($_GET['member'] != $user_info['id'])
523
-				throw new Elk_Exception('login_cookie_error', false);
560
+			{
561
+							throw new Elk_Exception('login_cookie_error', false);
562
+			}
524 563
 
525 564
 			$user_info['can_mod'] = allowedTo('access_mod_center') || (!$user_info['is_guest'] && ($user_info['mod_cache']['gq'] != '0=1' || $user_info['mod_cache']['bq'] != '0=1' || ($modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']))));
526 565
 			if ($user_info['can_mod'] && isset($user_settings['openid_uri']) && empty($user_settings['openid_uri']))
@@ -644,11 +683,15 @@  discard block
 block discarded – undo
644 683
 			{
645 684
 				// Try iconv first, for no particular reason.
646 685
 				if (function_exists('iconv'))
647
-					$other_passwords['iconv'] = sha1(strtolower(iconv('UTF-8', $modSettings['previousCharacterSet'], $user_settings['member_name'])) . un_htmlspecialchars(iconv('UTF-8', $modSettings['previousCharacterSet'], $_POST['passwrd'])));
686
+				{
687
+									$other_passwords['iconv'] = sha1(strtolower(iconv('UTF-8', $modSettings['previousCharacterSet'], $user_settings['member_name'])) . un_htmlspecialchars(iconv('UTF-8', $modSettings['previousCharacterSet'], $_POST['passwrd'])));
688
+				}
648 689
 
649 690
 				// Say it aint so, iconv failed!
650 691
 				if (empty($other_passwords['iconv']) && function_exists('mb_convert_encoding'))
651
-					$other_passwords[] = sha1(strtolower(mb_convert_encoding($user_settings['member_name'], 'UTF-8', $modSettings['previousCharacterSet'])) . un_htmlspecialchars(mb_convert_encoding($_POST['passwrd'], 'UTF-8', $modSettings['previousCharacterSet'])));
692
+				{
693
+									$other_passwords[] = sha1(strtolower(mb_convert_encoding($user_settings['member_name'], 'UTF-8', $modSettings['previousCharacterSet'])) . un_htmlspecialchars(mb_convert_encoding($_POST['passwrd'], 'UTF-8', $modSettings['previousCharacterSet'])));
694
+				}
652 695
 			}
653 696
 		}
654 697
 		// SHA-256 will be 64 characters long, lets check some of these possibilities
@@ -698,7 +741,9 @@  discard block
 block discarded – undo
698 741
 	global $context, $txt, $scripturl, $user_settings, $modSettings;
699 742
 
700 743
 	if (!isset($context['login_errors']))
701
-		$context['login_errors'] = array();
744
+	{
745
+			$context['login_errors'] = array();
746
+	}
702 747
 
703 748
 	// What is the true activation status of this account?
704 749
 	$activation_status = $user_settings['is_activated'] > 10 ? $user_settings['is_activated'] - 10 : $user_settings['is_activated'];
@@ -711,7 +756,9 @@  discard block
 block discarded – undo
711 756
 	}
712 757
 	// Awaiting approval still?
713 758
 	elseif ($activation_status == 3)
714
-		throw new Elk_Exception('still_awaiting_approval', 'user');
759
+	{
760
+			throw new Elk_Exception('still_awaiting_approval', 'user');
761
+	}
715 762
 	// Awaiting deletion, changed their mind?
716 763
 	elseif ($activation_status == 4)
717 764
 	{
@@ -766,7 +813,9 @@  discard block
 block discarded – undo
766 813
 
767 814
 	// Reset the login threshold.
768 815
 	if (isset($_SESSION['failed_login']))
769
-		unset($_SESSION['failed_login']);
816
+	{
817
+			unset($_SESSION['failed_login']);
818
+	}
770 819
 
771 820
 	$user_info['is_guest'] = false;
772 821
 	$user_settings['additional_groups'] = explode(',', $user_settings['additional_groups']);
@@ -780,7 +829,9 @@  discard block
 block discarded – undo
780 829
 	{
781 830
 		// Let's validate if they really want..
782 831
 		if (!empty($modSettings['auto_admin_session']) && $modSettings['auto_admin_session'] == 1)
783
-			$_SESSION['admin_time'] = time();
832
+		{
833
+					$_SESSION['admin_time'] = time();
834
+		}
784 835
 
785 836
 		unset($_SESSION['just_registered']);
786 837
 	}
@@ -790,9 +841,12 @@  discard block
 block discarded – undo
790 841
 
791 842
 	// We want to know if this is first login
792 843
 	if (isFirstLogin($user_info['id']))
793
-		$_SESSION['first_login'] = true;
794
-	else
795
-		unset($_SESSION['first_login']);
844
+	{
845
+			$_SESSION['first_login'] = true;
846
+	}
847
+	else {
848
+			unset($_SESSION['first_login']);
849
+	}
796 850
 
797 851
 	// You're one of us: need to know all about you now, IP, stuff.
798 852
 	$req = request();
@@ -808,14 +862,19 @@  discard block
 block discarded – undo
808 862
 
809 863
 	// Log this entry, only if we have it enabled.
810 864
 	if (!empty($modSettings['loginHistoryDays']))
811
-		logLoginHistory($user_info['id'], $user_info['ip'], $user_info['ip2']);
865
+	{
866
+			logLoginHistory($user_info['id'], $user_info['ip'], $user_info['ip2']);
867
+	}
812 868
 
813 869
 	// Just log you back out if it's in maintenance mode and you AREN'T an admin.
814 870
 	if (empty($maintenance) || allowedTo('admin_forum'))
815
-		redirectexit('action=auth;sa=check;member=' . $user_info['id'], detectServer()->is('needs_login_fix'));
816
-	else
817
-		redirectexit('action=logout;' . $context['session_var'] . '=' . $context['session_id'], detectServer()->is('needs_login_fix'));
818
-}
871
+	{
872
+			redirectexit('action=auth;sa=check;member=' . $user_info['id'], detectServer()->is('needs_login_fix'));
873
+	}
874
+	else {
875
+			redirectexit('action=logout;' . $context['session_var'] . '=' . $context['session_id'], detectServer()->is('needs_login_fix'));
876
+	}
877
+	}
819 878
 
820 879
 /**
821 880
  * MD5 Encryption used for older passwords. (SMF 1.0.x/YaBB SE 1.5.x hashing)
@@ -843,7 +902,9 @@  discard block
 block discarded – undo
843 902
 {
844 903
 	// Too long or too short?
845 904
 	if (strlen($passwd_hash) != 34)
846
-		return false;
905
+	{
906
+			return false;
907
+	}
847 908
 
848 909
 	// Range of characters allowed.
849 910
 	$range = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
@@ -855,7 +916,9 @@  discard block
 block discarded – undo
855 916
 
856 917
 	$hash = md5($salt . $passwd, true);
857 918
 	for (; $count != 0; --$count)
858
-		$hash = md5($hash . $passwd, true);
919
+	{
920
+			$hash = md5($hash . $passwd, true);
921
+	}
859 922
 
860 923
 	$output = substr($passwd_hash, 0, 12);
861 924
 	$i = 0;
@@ -865,20 +928,28 @@  discard block
 block discarded – undo
865 928
 		$output .= $range[$value & 0x3f];
866 929
 
867 930
 		if ($i < 16)
868
-			$value |= ord($hash[$i]) << 8;
931
+		{
932
+					$value |= ord($hash[$i]) << 8;
933
+		}
869 934
 
870 935
 		$output .= $range[($value >> 6) & 0x3f];
871 936
 
872 937
 		if ($i++ >= 16)
873
-			break;
938
+		{
939
+					break;
940
+		}
874 941
 
875 942
 		if ($i < 16)
876
-			$value |= ord($hash[$i]) << 16;
943
+		{
944
+					$value |= ord($hash[$i]) << 16;
945
+		}
877 946
 
878 947
 		$output .= $range[($value >> 12) & 0x3f];
879 948
 
880 949
 		if ($i++ >= 16)
881
-			break;
950
+		{
951
+					break;
952
+		}
882 953
 
883 954
 		$output .= $range[($value >> 18) & 0x3f];
884 955
 	}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@
 block discarded – undo
226 226
 		if (!empty($_POST['otp_token']))
227 227
 		{
228 228
 			require_once(EXTDIR . '/GoogleAuthenticator.php');
229
-			$ga = New GoogleAuthenticator();
229
+			$ga = new GoogleAuthenticator();
230 230
 
231 231
 			$ga->getCode($user_settings['otp_secret']);
232 232
 			$checkResult = $ga->verifyCode($user_settings['otp_secret'], $_POST['otp_token'], 2);
Please login to merge, or discard this patch.
sources/controllers/Notify.controller.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
85 85
 
86 86
 		// Make sure the topic has been specified.
87 87
 		if (empty($topic))
88
-			throw new Elk_Exception('not_a_topic', false);
88
+		{
89
+					throw new Elk_Exception('not_a_topic', false);
90
+		}
89 91
 
90 92
 		// What do we do?  Better ask if they didn't say..
91 93
 		if (empty($this->_req->query->sa))
@@ -210,7 +212,9 @@  discard block
 block discarded – undo
210 212
 
211 213
 		// You have to specify a board to turn notifications on!
212 214
 		if (empty($board))
213
-			throw new Elk_Exception('no_board', false);
215
+		{
216
+					throw new Elk_Exception('no_board', false);
217
+		}
214 218
 
215 219
 		// No subaction: find out what to do.
216 220
 		if (empty($this->_req->query->sa))
Please login to merge, or discard this patch.