Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/controllers/XmlPreview.controller.php 1 patch
Braces   +57 added lines, -23 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 		$subAction = $action->initialize($subActions, 'invalid', 'item');
48 48
 
49 49
 		if ($subAction === 'invalid')
50
-			return;
50
+		{
51
+					return;
52
+		}
51 53
 
52 54
 		// Set up the template and default sub-template.
53 55
 		loadTemplate('Xml');
@@ -72,9 +74,12 @@  discard block
 block discarded – undo
72 74
 		$errors = array();
73 75
 		$news = !isset($this->_req->post->news) ? '' : Util::htmlspecialchars($this->_req->post->news, ENT_QUOTES);
74 76
 		if (empty($news))
75
-			$errors[] = array('value' => 'no_news');
76
-		else
77
-			preparsecode($news);
77
+		{
78
+					$errors[] = array('value' => 'no_news');
79
+		}
80
+		else {
81
+					preparsecode($news);
82
+		}
78 83
 
79 84
 		$bbc_parser = \BBC\ParserWrapper::instance();
80 85
 
@@ -114,9 +119,13 @@  discard block
 block discarded – undo
114 119
 
115 120
 		// Let them know about any mistakes
116 121
 		if (empty($this->_req->post->subject))
117
-			$context['post_error']['errors'][] = $txt['error_no_subject'];
122
+		{
123
+					$context['post_error']['errors'][] = $txt['error_no_subject'];
124
+		}
118 125
 		if (empty($this->_req->post->message))
119
-			$context['post_error']['errors'][] = $txt['error_no_message'];
126
+		{
127
+					$context['post_error']['errors'][] = $txt['error_no_message'];
128
+		}
120 129
 
121 130
 		prepareMailingForPreview();
122 131
 
@@ -159,7 +168,9 @@  discard block
 block discarded – undo
159 168
 
160 169
 			// An odd check for errors to be sure
161 170
 			if ($validation !== true && $validation !== false)
162
-				$errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error'));
171
+			{
172
+							$errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error'));
173
+			}
163 174
 
164 175
 			preparsecode($preview_signature);
165 176
 			$preview_signature = censor($preview_signature);
@@ -169,12 +180,16 @@  discard block
 block discarded – undo
169 180
 		elseif (!$can_change)
170 181
 		{
171 182
 			if ($is_owner)
172
-				$errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error'));
173
-			else
174
-				$errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error'));
183
+			{
184
+							$errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error'));
185
+			}
186
+			else {
187
+							$errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error'));
188
+			}
189
+		}
190
+		else {
191
+					$errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error'));
175 192
 		}
176
-		else
177
-			$errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error'));
178 193
 
179 194
 		// Return the response for the template
180 195
 		$context['xml_data']['signatures'] = array(
@@ -183,19 +198,24 @@  discard block
 block discarded – undo
183 198
 		);
184 199
 
185 200
 		if (isset($member['signature']))
186
-			$context['xml_data']['signatures']['children'][] = array(
201
+		{
202
+					$context['xml_data']['signatures']['children'][] = array(
187 203
 				'value' => $member['signature'],
188 204
 				'attributes' => array('type' => 'current'),
189 205
 			);
206
+		}
190 207
 
191 208
 		if (isset($preview_signature))
192
-			$context['xml_data']['signatures']['children'][] = array(
209
+		{
210
+					$context['xml_data']['signatures']['children'][] = array(
193 211
 				'value' => $preview_signature,
194 212
 				'attributes' => array('type' => 'preview'),
195 213
 			);
214
+		}
196 215
 
197 216
 		if (!empty($errors))
198
-			$context['xml_data']['errors'] = array(
217
+		{
218
+					$context['xml_data']['errors'] = array(
199 219
 				'identifier' => 'error',
200 220
 				'children' => array_merge(
201 221
 						array(
@@ -206,6 +226,7 @@  discard block
 block discarded – undo
206 226
 						), $errors
207 227
 				),
208 228
 			);
229
+		}
209 230
 	}
210 231
 
211 232
 	/**
@@ -229,14 +250,20 @@  discard block
 block discarded – undo
229 250
 			if (isset($this->_req->post->issuing))
230 251
 			{
231 252
 				if (empty($this->_req->post->title) || empty($this->_req->post->body))
232
-					$context['post_error']['errors'][] = $txt['warning_notify_blank'];
253
+				{
254
+									$context['post_error']['errors'][] = $txt['warning_notify_blank'];
255
+				}
233 256
 			}
234 257
 			else
235 258
 			{
236 259
 				if (empty($this->_req->post->title))
237
-					$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_title'];
260
+				{
261
+									$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_title'];
262
+				}
238 263
 				if (empty($this->_req->post->body))
239
-					$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_body'];
264
+				{
265
+									$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_body'];
266
+				}
240 267
 
241 268
 				// Add in few replacements.
242 269
 				/**
@@ -271,8 +298,9 @@  discard block
 block discarded – undo
271 298
 			}
272 299
 			$context['preview_message'] = $warning_body;
273 300
 		}
274
-		else
275
-			$context['post_error']['errors'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error'));
301
+		else {
302
+					$context['post_error']['errors'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error'));
303
+		}
276 304
 
277 305
 		$context['sub_template'] = 'generic_preview';
278 306
 	}
@@ -299,15 +327,21 @@  discard block
 block discarded – undo
299 327
 			if (isset($this->_req->post->issuing))
300 328
 			{
301 329
 				if (empty($this->_req->post->title) || empty($this->_req->post->body))
302
-					$context['post_error']['errors'][] = $txt['warning_notify_blank'];
330
+				{
331
+									$context['post_error']['errors'][] = $txt['warning_notify_blank'];
332
+				}
303 333
 			}
304 334
 			else
305 335
 			{
306 336
 				if (empty($this->_req->post->title))
307
-					$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_title'];
337
+				{
338
+									$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_title'];
339
+				}
308 340
 
309 341
 				if (empty($this->_req->post->body))
310
-					$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_body'];
342
+				{
343
+									$context['post_error']['errors'][] = $txt['mc_warning_template_error_no_body'];
344
+				}
311 345
 
312 346
 				// Add in few replacements.
313 347
 				/**
Please login to merge, or discard this patch.
sources/controllers/ProfileOptions.controller.php 2 patches
Braces   +153 added lines, -56 removed lines patch added patch discarded remove patch
@@ -139,7 +139,9 @@  discard block
 block discarded – undo
139 139
 
140 140
 		// Do a quick check to ensure people aren't getting here illegally!
141 141
 		if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist']))
142
-			throw new Elk_Exception('no_access', false);
142
+		{
143
+					throw new Elk_Exception('no_access', false);
144
+		}
143 145
 
144 146
 		loadTemplate('ProfileOptions');
145 147
 
@@ -193,7 +195,9 @@  discard block
 block discarded – undo
193 195
 		foreach ($buddiesArray as $k => $dummy)
194 196
 		{
195 197
 			if ($dummy === '')
196
-				unset($buddiesArray[$k]);
198
+			{
199
+							unset($buddiesArray[$k]);
200
+			}
197 201
 		}
198 202
 
199 203
 		// Removing a buddy?
@@ -207,7 +211,9 @@  discard block
 block discarded – undo
207 211
 			foreach ($buddiesArray as $key => $buddy)
208 212
 			{
209 213
 				if ($buddy == (int) $this->_req->query->remove)
210
-					unset($buddiesArray[$key]);
214
+				{
215
+									unset($buddiesArray[$key]);
216
+				}
211 217
 			}
212 218
 
213 219
 			// Make the changes.
@@ -233,7 +239,9 @@  discard block
 block discarded – undo
233 239
 				$new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\'' => '''));
234 240
 
235 241
 				if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$this->_memID]['member_name'], $user_profile[$this->_memID]['real_name'])))
236
-					unset($new_buddies[$k]);
242
+				{
243
+									unset($new_buddies[$k]);
244
+				}
237 245
 			}
238 246
 
239 247
 			call_integration_hook('integrate_add_buddies', array($this->_memID, &$new_buddies));
@@ -263,7 +271,9 @@  discard block
 block discarded – undo
263 271
 			require_once(SUBSDIR . '/Members.subs.php');
264 272
 			$result = getBasicMemberData($buddiesArray, array('sort' => 'real_name', 'limit' => substr_count($user_profile[$this->_memID]['buddy_list'], ',') + 1));
265 273
 			foreach ($result as $row)
266
-				$buddies[] = $row['id_member'];
274
+			{
275
+							$buddies[] = $row['id_member'];
276
+			}
267 277
 		}
268 278
 
269 279
 		$context['buddy_count'] = count($buddies);
@@ -302,7 +312,9 @@  discard block
 block discarded – undo
302 312
 		foreach ($ignoreArray as $k => $dummy)
303 313
 		{
304 314
 			if ($dummy === '')
305
-				unset($ignoreArray[$k]);
315
+			{
316
+							unset($ignoreArray[$k]);
317
+			}
306 318
 		}
307 319
 
308 320
 		// Removing a member from the ignore list?
@@ -314,7 +326,9 @@  discard block
 block discarded – undo
314 326
 			foreach ($ignoreArray as $key => $id_remove)
315 327
 			{
316 328
 				if ($id_remove == (int) $this->_req->query->remove)
317
-					unset($ignoreArray[$key]);
329
+				{
330
+									unset($ignoreArray[$key]);
331
+				}
318 332
 			}
319 333
 
320 334
 			// Make the changes.
@@ -339,7 +353,9 @@  discard block
 block discarded – undo
339 353
 				$new_entries[$k] = strtr(trim($new_entries[$k]), array('\'' => '''));
340 354
 
341 355
 				if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$this->_memID]['member_name'], $user_profile[$this->_memID]['real_name'])))
342
-					unset($new_entries[$k]);
356
+				{
357
+									unset($new_entries[$k]);
358
+				}
343 359
 			}
344 360
 
345 361
 			if (!empty($new_entries))
@@ -366,7 +382,9 @@  discard block
 block discarded – undo
366 382
 			require_once(SUBSDIR . '/Members.subs.php');
367 383
 			$result = getBasicMemberData($ignoreArray, array('sort' => 'real_name', 'limit' => substr_count($user_profile[$this->_memID]['pm_ignore_list'], ',') + 1));
368 384
 			foreach ($result as $row)
369
-				$ignored[] = $row['id_member'];
385
+			{
386
+							$ignored[] = $row['id_member'];
387
+			}
370 388
 		}
371 389
 
372 390
 		$context['ignore_count'] = count($ignored);
@@ -394,7 +412,9 @@  discard block
 block discarded – undo
394 412
 		$this->loadThemeOptions();
395 413
 
396 414
 		if (allowedTo(array('profile_identity_own', 'profile_identity_any')))
397
-			loadCustomFields($this->_memID, 'account');
415
+		{
416
+					loadCustomFields($this->_memID, 'account');
417
+		}
398 418
 
399 419
 		$context['sub_template'] = 'edit_options';
400 420
 		$context['page_desc'] = $txt['account_info'];
@@ -464,7 +484,9 @@  discard block
 block discarded – undo
464 484
 		$this->loadThemeOptions();
465 485
 
466 486
 		if (allowedTo(array('profile_extra_own', 'profile_extra_any')))
467
-			loadCustomFields($this->_memID, 'forumprofile');
487
+		{
488
+					loadCustomFields($this->_memID, 'forumprofile');
489
+		}
468 490
 
469 491
 		$context['sub_template'] = 'edit_options';
470 492
 		$context['page_desc'] = replaceBasicActionUrl($txt['forumProfile_info']);
@@ -504,7 +526,9 @@  discard block
 block discarded – undo
504 526
 		$this->loadThemeOptions();
505 527
 
506 528
 		if (allowedTo(array('profile_extra_own', 'profile_extra_any')))
507
-			loadCustomFields($this->_memID, 'theme');
529
+		{
530
+					loadCustomFields($this->_memID, 'theme');
531
+		}
508 532
 
509 533
 		loadTemplate('ProfileOptions');
510 534
 
@@ -537,10 +561,14 @@  discard block
 block discarded – undo
537 561
 			{
538 562
 				// Didn't enter anything?
539 563
 				if ($this->_req->post->passwrd1 === '')
540
-					$post_errors[] = 'no_password';
564
+				{
565
+									$post_errors[] = 'no_password';
566
+				}
541 567
 				// Do the two entries for the password even match?
542 568
 				elseif (!isset($this->_req->post->passwrd2) || $this->_req->post->passwrd1 != $this->_req->post->passwrd2)
543
-					$post_errors[] = 'bad_new_password';
569
+				{
570
+									$post_errors[] = 'bad_new_password';
571
+				}
544 572
 				// Is it valid?
545 573
 				else
546 574
 				{
@@ -549,7 +577,9 @@  discard block
 block discarded – undo
549 577
 
550 578
 					// Were there errors?
551 579
 					if ($passwordErrors !== null)
552
-						$post_errors[] = 'password_' . $passwordErrors;
580
+					{
581
+											$post_errors[] = 'password_' . $passwordErrors;
582
+					}
553 583
 				}
554 584
 
555 585
 				if (empty($post_errors))
@@ -570,8 +600,9 @@  discard block
 block discarded – undo
570 600
 						setLoginCookie(60 * $modSettings['cookieTime'], $this->_memID, hash('sha256', $passwd . $cur_profile['password_salt']));
571 601
 						redirectexit('action=profile;area=authentication;updated');
572 602
 					}
573
-					else
574
-						redirectexit('action=profile;u=' . $this->_memID);
603
+					else {
604
+											redirectexit('action=profile;u=' . $this->_memID);
605
+					}
575 606
 				}
576 607
 
577 608
 				return true;
@@ -586,7 +617,9 @@  discard block
 block discarded – undo
586 617
 				$this->_req->post->openid_identifier = $openID->canonize($this->_req->post->openid_identifier);
587 618
 
588 619
 				if (memberExists($this->_req->post->openid_identifier))
589
-					$post_errors[] = 'openid_in_use';
620
+				{
621
+									$post_errors[] = 'openid_in_use';
622
+				}
590 623
 				elseif (empty($post_errors))
591 624
 				{
592 625
 					// Authenticate using the new OpenID URI first to make sure they didn't make a mistake.
@@ -595,8 +628,9 @@  discard block
 block discarded – undo
595 628
 						$_SESSION['new_openid_uri'] = $this->_req->post->openid_identifier;
596 629
 						$openID->validate($this->_req->post->openid_identifier, false, null, 'change_uri');
597 630
 					}
598
-					else
599
-						updateMemberData($this->_memID, array('openid_uri' => $this->_req->post->openid_identifier));
631
+					else {
632
+											updateMemberData($this->_memID, array('openid_uri' => $this->_req->post->openid_identifier));
633
+					}
600 634
 				}
601 635
 			}
602 636
 		}
@@ -652,7 +686,9 @@  discard block
 block discarded – undo
652 686
 							$link = $board['link'];
653 687
 
654 688
 							if ($board['new'])
655
-								$link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>';
689
+							{
690
+															$link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>';
691
+							}
656 692
 
657 693
 							return $link;
658 694
 						},
@@ -743,7 +779,9 @@  discard block
 block discarded – undo
743 779
 							$link = $topic['link'];
744 780
 
745 781
 							if ($topic['new'])
746
-								$link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>';
782
+							{
783
+															$link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>';
784
+							}
747 785
 
748 786
 							$link .= '<br /><span class="smalltext"><em>' . $txt['in'] . ' ' . $topic['board_link'] . '</em></span>';
749 787
 
@@ -895,7 +933,9 @@  discard block
 block discarded – undo
895 933
 
896 934
 		// Have the admins enabled this option?
897 935
 		if (empty($modSettings['allow_ignore_boards']))
898
-			throw new Elk_Exception('ignoreboards_disallowed', 'user');
936
+		{
937
+					throw new Elk_Exception('ignoreboards_disallowed', 'user');
938
+		}
899 939
 
900 940
 		loadTemplate('ProfileOptions');
901 941
 
@@ -938,7 +978,9 @@  discard block
 block discarded – undo
938 978
 
939 979
 		// Ensure the query doesn't croak!
940 980
 		if (empty($groups))
941
-			$groups = array(0);
981
+		{
982
+					$groups = array(0);
983
+		}
942 984
 
943 985
 		// Just to be sure...
944 986
 		$groups = array_map('intval', $groups);
@@ -960,7 +1002,9 @@  discard block
 block discarded – undo
960 1002
 
961 1003
 		// No changing primary one unless you have enough groups!
962 1004
 		if (count($context['groups']['member']) < 2)
963
-			$context['can_edit_primary'] = false;
1005
+		{
1006
+					$context['can_edit_primary'] = false;
1007
+		}
964 1008
 
965 1009
 		// In the special case that someone is requesting membership of a group, setup some special context vars.
966 1010
 		if (isset($this->_req->query->request)
@@ -983,12 +1027,16 @@  discard block
 block discarded – undo
983 1027
 
984 1028
 		// Let's be extra cautious...
985 1029
 		if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership']))
986
-			isAllowedTo('manage_membergroups');
1030
+		{
1031
+					isAllowedTo('manage_membergroups');
1032
+		}
987 1033
 
988 1034
 		$group_id = $this->_req->getPost('gid', 'intval', $this->_req->getQuery('gid', 'intval', null));
989 1035
 
990 1036
 		if (!isset($group_id) && !isset($this->_req->post->primary))
991
-			throw new Elk_Exception('no_access', false);
1037
+		{
1038
+					throw new Elk_Exception('no_access', false);
1039
+		}
992 1040
 
993 1041
 		// GID may be from a link or a form
994 1042
 		checkSession(isset($this->_req->query->gid) ? 'get' : 'post');
@@ -1011,14 +1059,18 @@  discard block
 block discarded – undo
1011 1059
 
1012 1060
 		// Sanity check!!
1013 1061
 		if ($group_id == 1)
1014
-			isAllowedTo('admin_forum');
1062
+		{
1063
+					isAllowedTo('admin_forum');
1064
+		}
1015 1065
 
1016 1066
 		// What ever we are doing, we need to determine if changing primary is possible!
1017 1067
 		$groups_details = membergroupsById(array($group_id, $old_profile['id_group']), 0, true);
1018 1068
 
1019 1069
 		// Protected groups require proper permissions!
1020 1070
 		if ($group_id != 1 && $groups_details[$group_id]['group_type'] == 1)
1021
-			isAllowedTo('admin_forum');
1071
+		{
1072
+					isAllowedTo('admin_forum');
1073
+		}
1022 1074
 
1023 1075
 		foreach ($groups_details as $key => $row)
1024 1076
 		{
@@ -1030,34 +1082,50 @@  discard block
 block discarded – undo
1030 1082
 
1031 1083
 				// Does the group type match what we're doing - are we trying to request a non-requestable group?
1032 1084
 				if ($changeType === 'request' && $row['group_type'] != 2)
1033
-					throw new Elk_Exception('no_access', false);
1085
+				{
1086
+									throw new Elk_Exception('no_access', false);
1087
+				}
1034 1088
 				// What about leaving a requestable group we are not a member of?
1035 1089
 				elseif ($changeType === 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']]))
1036
-					throw new Elk_Exception('no_access', false);
1090
+				{
1091
+									throw new Elk_Exception('no_access', false);
1092
+				}
1037 1093
 				elseif ($changeType === 'free' && $row['group_type'] != 3 && $row['group_type'] != 2)
1038
-					throw new Elk_Exception('no_access', false);
1094
+				{
1095
+									throw new Elk_Exception('no_access', false);
1096
+				}
1039 1097
 
1040 1098
 				// We can't change the primary group if this is hidden!
1041 1099
 				if ($row['hidden'] == 2)
1042
-					$canChangePrimary = false;
1100
+				{
1101
+									$canChangePrimary = false;
1102
+				}
1043 1103
 			}
1044 1104
 
1045 1105
 			// If this is their old primary, can we change it?
1046 1106
 			if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false)
1047
-				$canChangePrimary = true;
1107
+			{
1108
+							$canChangePrimary = true;
1109
+			}
1048 1110
 
1049 1111
 			// If we are not doing a force primary move, don't do it automatically if current primary is not 0.
1050 1112
 			if ($changeType != 'primary' && $old_profile['id_group'] != 0)
1051
-				$canChangePrimary = false;
1113
+			{
1114
+							$canChangePrimary = false;
1115
+			}
1052 1116
 
1053 1117
 			// If this is the one we are acting on, can we even act?
1054 1118
 			if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0))
1055
-				$canChangePrimary = false;
1119
+			{
1120
+							$canChangePrimary = false;
1121
+			}
1056 1122
 		}
1057 1123
 
1058 1124
 		// Didn't find the target?
1059 1125
 		if (!$foundTarget)
1060
-			throw new Elk_Exception('no_access', false);
1126
+		{
1127
+					throw new Elk_Exception('no_access', false);
1128
+		}
1061 1129
 
1062 1130
 		// Final security check, don't allow users to promote themselves to admin.
1063 1131
 		require_once(SUBSDIR . '/ProfileOptions.subs.php');
@@ -1065,14 +1133,18 @@  discard block
 block discarded – undo
1065 1133
 		{
1066 1134
 			$disallow = checkMembergroupChange($group_id);
1067 1135
 			if ($disallow)
1068
-				isAllowedTo('admin_forum');
1136
+			{
1137
+							isAllowedTo('admin_forum');
1138
+			}
1069 1139
 		}
1070 1140
 
1071 1141
 		// If we're requesting, add the note then return.
1072 1142
 		if ($changeType === 'request')
1073 1143
 		{
1074 1144
 			if (logMembergroupRequest($group_id, $this->_memID))
1075
-				throw new Elk_Exception('profile_error_already_requested_group');
1145
+			{
1146
+							throw new Elk_Exception('profile_error_already_requested_group');
1147
+			}
1076 1148
 
1077 1149
 			// Send an email to all group moderators etc.
1078 1150
 			require_once(SUBSDIR . '/Mail.subs.php');
@@ -1096,14 +1168,18 @@  discard block
 block discarded – undo
1096 1168
 				foreach ($members as $member)
1097 1169
 				{
1098 1170
 					if ($member['notify_types'] != 4)
1099
-						continue;
1171
+					{
1172
+											continue;
1173
+					}
1100 1174
 
1101 1175
 					// Check whether they are interested.
1102 1176
 					if (!empty($member['mod_prefs']))
1103 1177
 					{
1104 1178
 						list (,, $pref_binary) = explode('|', $member['mod_prefs']);
1105 1179
 						if (!($pref_binary & 4))
1106
-							continue;
1180
+						{
1181
+													continue;
1182
+						}
1107 1183
 					}
1108 1184
 
1109 1185
 					$replacements = array(
@@ -1128,9 +1204,12 @@  discard block
 block discarded – undo
1128 1204
 			if ($old_profile['id_group'] == $group_id || isset($addGroups[$group_id]))
1129 1205
 			{
1130 1206
 				if ($old_profile['id_group'] == $group_id)
1131
-					$newPrimary = 0;
1132
-				else
1133
-					unset($addGroups[$group_id]);
1207
+				{
1208
+									$newPrimary = 0;
1209
+				}
1210
+				else {
1211
+									unset($addGroups[$group_id]);
1212
+				}
1134 1213
 			}
1135 1214
 			// ... if not, must be joining.
1136 1215
 			else
@@ -1139,21 +1218,28 @@  discard block
 block discarded – undo
1139 1218
 				if ($canChangePrimary)
1140 1219
 				{
1141 1220
 					if ($old_profile['id_group'] != 0)
1142
-						$addGroups[$old_profile['id_group']] = -1;
1221
+					{
1222
+											$addGroups[$old_profile['id_group']] = -1;
1223
+					}
1143 1224
 					$newPrimary = $group_id;
1144 1225
 				}
1145 1226
 				// Otherwise it's an additional group...
1146
-				else
1147
-					$addGroups[$group_id] = -1;
1227
+				else {
1228
+									$addGroups[$group_id] = -1;
1229
+				}
1148 1230
 			}
1149 1231
 		}
1150 1232
 		// Finally, we must be setting the primary.
1151 1233
 		elseif ($canChangePrimary)
1152 1234
 		{
1153 1235
 			if ($old_profile['id_group'] != 0)
1154
-				$addGroups[$old_profile['id_group']] = -1;
1236
+			{
1237
+							$addGroups[$old_profile['id_group']] = -1;
1238
+			}
1155 1239
 			if (isset($addGroups[$group_id]))
1156
-				unset($addGroups[$group_id]);
1240
+			{
1241
+							unset($addGroups[$group_id]);
1242
+			}
1157 1243
 			$newPrimary = $group_id;
1158 1244
 		}
1159 1245
 
@@ -1161,15 +1247,20 @@  discard block
 block discarded – undo
1161 1247
 		foreach ($addGroups as $id => $dummy)
1162 1248
 		{
1163 1249
 			if (empty($id))
1164
-				unset($addGroups[$id]);
1250
+			{
1251
+							unset($addGroups[$id]);
1252
+			}
1165 1253
 		}
1166 1254
 		$addGroups = implode(',', array_flip($addGroups));
1167 1255
 
1168 1256
 		// Ensure that we don't cache permissions if the group is changing.
1169 1257
 		if ($context['user']['is_owner'])
1170
-			$_SESSION['mc']['time'] = 0;
1171
-		else
1172
-			updateSettings(array('settings_updated' => time()));
1258
+		{
1259
+					$_SESSION['mc']['time'] = 0;
1260
+		}
1261
+		else {
1262
+					updateSettings(array('settings_updated' => time()));
1263
+		}
1173 1264
 
1174 1265
 		require_once(SUBSDIR . '/Members.subs.php');
1175 1266
 		updateMemberData($this->_memID, array('id_group' => $newPrimary, 'additional_groups' => $addGroups));
@@ -1185,7 +1276,9 @@  discard block
 block discarded – undo
1185 1276
 		global $context, $options, $cur_profile;
1186 1277
 
1187 1278
 		if (isset($this->_req->post->default_options))
1188
-			$this->_req->post->options = isset($this->_req->post->options) ? $this->_req->post->options + $this->_req->post->default_options : $this->_req->post->default_options;
1279
+		{
1280
+					$this->_req->post->options = isset($this->_req->post->options) ? $this->_req->post->options + $this->_req->post->default_options : $this->_req->post->default_options;
1281
+		}
1189 1282
 
1190 1283
 		if ($context['user']['is_owner'])
1191 1284
 		{
@@ -1194,7 +1287,9 @@  discard block
 block discarded – undo
1194 1287
 			if (isset($this->_req->post->options) && is_array($this->_req->post->options))
1195 1288
 			{
1196 1289
 				foreach ($this->_req->post->options as $k => $v)
1197
-					$context['member']['options'][$k] = $v;
1290
+				{
1291
+									$context['member']['options'][$k] = $v;
1292
+				}
1198 1293
 			}
1199 1294
 		}
1200 1295
 		else
@@ -1205,7 +1300,9 @@  discard block
 block discarded – undo
1205 1300
 			if (isset($this->_req->post->options))
1206 1301
 			{
1207 1302
 				foreach ($this->_req->post->options as $var => $val)
1208
-					$context['member']['options'][$var] = $val;
1303
+				{
1304
+									$context['member']['options'][$var] = $val;
1305
+				}
1209 1306
 			}
1210 1307
 		}
1211 1308
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			'forumprofile' => array(
62 62
 				'fields' => array(
63 63
 					'avatar_choice', 'hr',
64
-					'bday1', 'usertitle','hr',
64
+					'bday1', 'usertitle', 'hr',
65 65
 					'signature', 'hr',
66 66
 					'karma_good', 'hr',
67 67
 					'website_title', 'website_url',
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 						'class' => 'lefttext',
647 647
 					),
648 648
 					'data' => array(
649
-						'function' => function ($board) {
649
+						'function' => function($board) {
650 650
 							global $txt;
651 651
 
652 652
 							$link = $board['link'];
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 						'class' => 'lefttext',
738 738
 					),
739 739
 					'data' => array(
740
-						'function' => function ($topic) {
740
+						'function' => function($topic) {
741 741
 							global $txt;
742 742
 
743 743
 							$link = $topic['link'];
Please login to merge, or discard this patch.
sources/controllers/BoardIndex.controller.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,7 +67,9 @@  discard block
 block discarded – undo
67 67
 
68 68
 		// Do not let search engines index anything if there is a random thing in $_GET.
69 69
 		if (!empty($this->_req->query))
70
-			$context['robot_no_index'] = true;
70
+		{
71
+					$context['robot_no_index'] = true;
72
+		}
71 73
 
72 74
 		// Retrieve the categories and boards.
73 75
 		$boardIndexOptions = array(
@@ -97,11 +99,15 @@  discard block
 block discarded – undo
97 99
 
98 100
 		// Are we showing all membergroups on the board index?
99 101
 		if (!empty($settings['show_group_key']))
100
-			$context['membergroups'] = cache_quick_get('membergroup_list', 'subs/Membergroups.subs.php', 'cache_getMembergroupList', array());
102
+		{
103
+					$context['membergroups'] = cache_quick_get('membergroup_list', 'subs/Membergroups.subs.php', 'cache_getMembergroupList', array());
104
+		}
101 105
 
102 106
 		// Track most online statistics? (subs/Members.subs.phpOnline.php)
103 107
 		if (!empty($modSettings['trackStats']))
104
-			trackStatsUsersOnline($context['num_guests'] + $context['num_users_online']);
108
+		{
109
+					trackStatsUsersOnline($context['num_guests'] + $context['num_users_online']);
110
+		}
105 111
 
106 112
 		// Retrieve the latest posts if the theme settings require it.
107 113
 		if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1)
@@ -130,10 +136,14 @@  discard block
 block discarded – undo
130 136
 
131 137
 		$context['info_center_callbacks'] = array();
132 138
 		if (!empty($settings['number_recent_posts']) && (!empty($context['latest_posts']) || !empty($context['latest_post'])))
133
-			$context['info_center_callbacks'][] = 'recent_posts';
139
+		{
140
+					$context['info_center_callbacks'][] = 'recent_posts';
141
+		}
134 142
 
135 143
 		if (!empty($settings['show_stats_index']))
136
-			$context['info_center_callbacks'][] = 'show_stats';
144
+		{
145
+					$context['info_center_callbacks'][] = 'show_stats';
146
+		}
137 147
 
138 148
 		$context['info_center_callbacks'][] = 'show_users';
139 149
 
@@ -177,7 +187,9 @@  discard block
 block discarded – undo
177 187
 		checkSession('request');
178 188
 
179 189
 		if (!isset($this->_req->query->sa))
180
-			throw new Elk_Exception('no_access', false);
190
+		{
191
+					throw new Elk_Exception('no_access', false);
192
+		}
181 193
 
182 194
 		// Check if the input values are correct.
183 195
 		if (in_array($this->_req->query->sa, array('expand', 'collapse', 'toggle')) && isset($this->_req->query->c))
Please login to merge, or discard this patch.
sources/controllers/ProfileAccount.controller.php 2 patches
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -132,7 +132,9 @@  discard block
 block discarded – undo
132 132
 			// Fill in the suite of errors.
133 133
 			$context['post_errors'] = array();
134 134
 			foreach ($this->_issueErrors as $error)
135
-				$context['post_errors'][] = $txt[$error];
135
+			{
136
+							$context['post_errors'][] = $txt[$error];
137
+			}
136 138
 		}
137 139
 
138 140
 		$context['page_title'] = $txt['profile_issue_warning'];
@@ -157,7 +159,9 @@  discard block
 block discarded – undo
157 159
 		foreach ($context['level_effects'] as $limit => $dummy)
158 160
 		{
159 161
 			if ($context['member']['warning'] >= $limit)
160
-				$context['current_level'] = $limit;
162
+			{
163
+							$context['current_level'] = $limit;
164
+			}
161 165
 		}
162 166
 
163 167
 		// Build a listing to view the previous warnings for this user
@@ -173,7 +177,9 @@  discard block
 block discarded – undo
173 177
 			$message = basicMessageInfo($warning_for_message);
174 178
 
175 179
 			if (!empty($message))
176
-				$warned_message_subject = $message['subject'];
180
+			{
181
+							$warned_message_subject = $message['subject'];
182
+			}
177 183
 		}
178 184
 
179 185
 		require_once(SUBSDIR . '/Maillist.subs.php');
@@ -186,7 +192,9 @@  discard block
 block discarded – undo
186 192
 		{
187 193
 			// If we're not warning for a message skip any that are.
188 194
 			if ($warning_for_message === false && strpos($row['body'], '{MESSAGE}') !== false)
189
-				continue;
195
+			{
196
+							continue;
197
+			}
190 198
 
191 199
 			$context['notification_templates'][] = array(
192 200
 				'title' => $row['title'],
@@ -205,7 +213,8 @@  discard block
 block discarded – undo
205 213
 
206 214
 		// Replace all the common variables in the templates.
207 215
 		foreach ($context['notification_templates'] as $k => $name)
208
-			$context['notification_templates'][$k]['body'] = strtr($name['body'],
216
+		{
217
+					$context['notification_templates'][$k]['body'] = strtr($name['body'],
209 218
 				array(
210 219
 					'{MEMBER}' => un_htmlspecialchars($context['member']['name']),
211 220
 					'{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $warning_for_message . ']' . un_htmlspecialchars($warned_message_subject) . '[/url]',
@@ -214,6 +223,7 @@  discard block
 block discarded – undo
214 223
 					'{REGARDS}' => replaceBasicActionUrl($txt['regards_team'])
215 224
 				)
216 225
 			);
226
+		}
217 227
 	}
218 228
 
219 229
 	/**
@@ -507,9 +517,13 @@  discard block
 block discarded – undo
507 517
 		global $txt, $context, $modSettings, $cur_profile;
508 518
 
509 519
 		if (!$context['user']['is_owner'])
510
-			isAllowedTo('profile_remove_any');
520
+		{
521
+					isAllowedTo('profile_remove_any');
522
+		}
511 523
 		elseif (!allowedTo('profile_remove_any'))
512
-			isAllowedTo('profile_remove_own');
524
+		{
525
+					isAllowedTo('profile_remove_own');
526
+		}
513 527
 
514 528
 		// Permissions for removing stuff...
515 529
 		$context['can_delete_posts'] = !$context['user']['is_owner'] && allowedTo('moderate_forum');
@@ -565,7 +579,9 @@  discard block
 block discarded – undo
565 579
 			$another = isAnotherAdmin($this->_memID);
566 580
 
567 581
 			if (empty($another))
568
-				throw new Elk_Exception('at_least_one_admin', 'critical');
582
+			{
583
+							throw new Elk_Exception('at_least_one_admin', 'critical');
584
+			}
569 585
 		}
570 586
 
571 587
 		// Do you have permission to delete others profiles, or is that your profile you wanna delete?
@@ -598,7 +614,9 @@  discard block
 block discarded – undo
598 614
 
599 615
 			// Only delete this poor member's account if they are actually being booted out of camp.
600 616
 			if (isset($this->_req->post->deleteAccount))
601
-				deleteMembers($this->_memID);
617
+			{
618
+							deleteMembers($this->_memID);
619
+			}
602 620
 		}
603 621
 		// Do they need approval to delete?
604 622
 		elseif (!empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum'))
@@ -654,7 +672,9 @@  discard block
 block discarded – undo
654 672
 
655 673
 			// If we are doing approval, update the stats for the member just in case.
656 674
 			if (in_array($user_profile[$this->_memID]['is_activated'], array(3, 4, 13, 14)))
657
-				updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0)));
675
+			{
676
+							updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0)));
677
+			}
658 678
 
659 679
 			// Make sure we update the stats too.
660 680
 			require_once(SUBSDIR . '/Members.subs.php');
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 						'class' => 'grid20',
244 244
 					),
245 245
 					'data' => array(
246
-						'function' => function ($warning)
246
+						'function' => function($warning)
247 247
 						{
248 248
 							return $warning['issuer']['link'];
249 249
 						},
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 						'value' => $txt['profile_warning_previous_reason'],
272 272
 					),
273 273
 					'data' => array(
274
-						'function' => function ($warning)
274
+						'function' => function($warning)
275 275
 						{
276 276
 							global $scripturl, $txt;
277 277
 
Please login to merge, or discard this patch.
sources/controllers/Jslocale.controller.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 
53 53
 		// If we don't have any locale better avoid broken js
54 54
 		if (empty($txt['lang_locale']) || empty($editortxt))
55
-			die();
55
+		{
56
+					die();
57
+		}
56 58
 
57 59
 		$this->_file_data = '(function ($) {
58 60
 		\'use strict\';
@@ -60,8 +62,10 @@  discard block
 block discarded – undo
60 62
 		$.sceditor.locale[' . JavaScriptEscape($txt['lang_locale']) . '] = {';
61 63
 
62 64
 		foreach ($editortxt as $key => $val)
63
-			$this->_file_data .= '
65
+		{
66
+					$this->_file_data .= '
64 67
 			' . JavaScriptEscape($key) . ': ' . JavaScriptEscape($val) . ',';
68
+		}
65 69
 
66 70
 		$this->_file_data .= '
67 71
 			dateFormat: "day.month.year"
@@ -121,7 +125,9 @@  discard block
 block discarded – undo
121 125
 		global $modSettings;
122 126
 
123 127
 		if (!empty($language_file))
124
-			loadLanguage($language_file);
128
+		{
129
+					loadLanguage($language_file);
130
+		}
125 131
 
126 132
 		Template_Layers::instance()->removeAll();
127 133
 
Please login to merge, or discard this patch.
sources/controllers/Members.controller.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,7 +61,9 @@  discard block
 block discarded – undo
61 61
 
62 62
 		// You have to give a user
63 63
 		if (empty($user))
64
-			throw new Elk_Exception('no_access', false);
64
+		{
65
+					throw new Elk_Exception('no_access', false);
66
+		}
65 67
 
66 68
 		call_integration_hook('integrate_add_buddies', array($user_info['id'], &$user));
67 69
 
@@ -111,11 +113,15 @@  discard block
 block discarded – undo
111 113
 
112 114
 		// You have to give a user
113 115
 		if (empty($user))
114
-			throw new Elk_Exception('no_access', false);
116
+		{
117
+					throw new Elk_Exception('no_access', false);
118
+		}
115 119
 
116 120
 		// Remove this user, assuming we can find them
117 121
 		if (in_array($user, $user_info['buddies']))
118
-			$user_info['buddies'] = array_diff($user_info['buddies'], array($user));
122
+		{
123
+					$user_info['buddies'] = array_diff($user_info['buddies'], array($user));
124
+		}
119 125
 
120 126
 		// Update the settings.
121 127
 		require_once(SUBSDIR . '/Members.subs.php');
Please login to merge, or discard this patch.
sources/controllers/Poll.controller.php 1 patch
Braces   +165 added lines, -61 removed lines patch added patch discarded remove patch
@@ -62,14 +62,18 @@  discard block
 block discarded – undo
62 62
 		$row = checkVote($topic);
63 63
 
64 64
 		if (empty($row))
65
-			throw new Elk_Exception('poll_error', false);
65
+		{
66
+					throw new Elk_Exception('poll_error', false);
67
+		}
66 68
 
67 69
 		// If this is a guest can they vote?
68 70
 		if ($user_info['is_guest'])
69 71
 		{
70 72
 			// Guest voting disabled?
71 73
 			if (!$row['guest_vote'])
72
-				throw new Elk_Exception('guest_vote_disabled');
74
+			{
75
+							throw new Elk_Exception('guest_vote_disabled');
76
+			}
73 77
 			// Guest already voted?
74 78
 			elseif (!empty($this->_req->cookie->guest_poll_vote) && preg_match('~^[0-9,;]+$~', $this->_req->cookie->guest_poll_vote) && strpos($this->_req->cookie->guest_poll_vote, ';' . $row['id_poll'] . ',') !== false)
75 79
 			{
@@ -81,7 +85,9 @@  discard block
 block discarded – undo
81 85
 				{
82 86
 					$guestvoted = explode(',', $guestvoted);
83 87
 					if ($guestvoted[0] == $row['id_poll'])
84
-						break;
88
+					{
89
+											break;
90
+					}
85 91
 				}
86 92
 
87 93
 				// Has the poll been reset since guest voted?
@@ -90,12 +96,16 @@  discard block
 block discarded – undo
90 96
 					// Remove the poll info from the cookie to allow guest to vote again
91 97
 					unset($guestinfo[$i]);
92 98
 					if (!empty($guestinfo))
93
-						$this->_req->cookie->guest_poll_vote = ';' . implode(';', $guestinfo);
94
-					else
95
-						unset($this->_req->cookie->guest_poll_vote);
99
+					{
100
+											$this->_req->cookie->guest_poll_vote = ';' . implode(';', $guestinfo);
101
+					}
102
+					else {
103
+											unset($this->_req->cookie->guest_poll_vote);
104
+					}
105
+				}
106
+				else {
107
+									throw new Elk_Exception('poll_error', false);
96 108
 				}
97
-				else
98
-					throw new Elk_Exception('poll_error', false);
99 109
 
100 110
 				unset($guestinfo, $guestvoted, $i);
101 111
 			}
@@ -103,11 +113,15 @@  discard block
 block discarded – undo
103 113
 
104 114
 		// Is voting locked or has it expired?
105 115
 		if (!empty($row['voting_locked']) || (!empty($row['expire_time']) && time() > $row['expire_time']))
106
-			throw new Elk_Exception('poll_error', false);
116
+		{
117
+					throw new Elk_Exception('poll_error', false);
118
+		}
107 119
 
108 120
 		// If they have already voted and aren't allowed to change their vote - hence they are outta here!
109 121
 		if (!$user_info['is_guest'] && $row['selected'] != -1 && empty($row['change_vote']))
110
-			throw new Elk_Exception('poll_error', false);
122
+		{
123
+					throw new Elk_Exception('poll_error', false);
124
+		}
111 125
 		// Otherwise if they can change their vote yet they haven't sent any options... remove their vote and redirect.
112 126
 		elseif (!empty($row['change_vote']) && !$user_info['is_guest'] && empty($this->_req->post->options))
113 127
 		{
@@ -128,18 +142,24 @@  discard block
 block discarded – undo
128 142
 
129 143
 			// Redirect back to the topic so the user can vote again!
130 144
 			if (empty($this->_req->post->options))
131
-				redirectexit('topic=' . $topic . '.' . $this->_req->post->start);
145
+			{
146
+							redirectexit('topic=' . $topic . '.' . $this->_req->post->start);
147
+			}
132 148
 		}
133 149
 
134 150
 		checkSession('request');
135 151
 
136 152
 		// Make sure the option(s) are valid.
137 153
 		if (empty($this->_req->post->options))
138
-			throw new Elk_Exception('didnt_select_vote', false);
154
+		{
155
+					throw new Elk_Exception('didnt_select_vote', false);
156
+		}
139 157
 
140 158
 		// Too many options checked!
141 159
 		if (count($this->_req->post->options) > $row['max_votes'])
142
-			throw new Elk_Exception('poll_too_many_votes', false, array($row['max_votes']));
160
+		{
161
+					throw new Elk_Exception('poll_too_many_votes', false, array($row['max_votes']));
162
+		}
143 163
 
144 164
 		$pollOptions = array();
145 165
 		$inserts = array();
@@ -205,23 +225,34 @@  discard block
 block discarded – undo
205 225
 
206 226
 		// If the user _can_ modify the poll....
207 227
 		if (!allowedTo('poll_lock_any'))
208
-			isAllowedTo('poll_lock_' . ($user_info['id'] == $poll['id_member'] ? 'own' : 'any'));
228
+		{
229
+					isAllowedTo('poll_lock_' . ($user_info['id'] == $poll['id_member'] ? 'own' : 'any'));
230
+		}
209 231
 
210 232
 		// It's been locked by a non-moderator.
211 233
 		if ($poll['locked'] == '1')
212
-			$poll['locked'] = '0';
234
+		{
235
+					$poll['locked'] = '0';
236
+		}
213 237
 		// Locked by a moderator, and this is a moderator.
214 238
 		elseif ($poll['locked'] == '2' && allowedTo('moderate_board'))
215
-			$poll['locked'] = '0';
239
+		{
240
+					$poll['locked'] = '0';
241
+		}
216 242
 		// Sorry, a moderator locked it.
217 243
 		elseif ($poll['locked'] == '2' && !allowedTo('moderate_board'))
218
-			throw new Elk_Exception('locked_by_admin', 'user');
244
+		{
245
+					throw new Elk_Exception('locked_by_admin', 'user');
246
+		}
219 247
 		// A moderator *is* locking it.
220 248
 		elseif ($poll['locked'] == '0' && allowedTo('moderate_board'))
221
-			$poll['locked'] = '2';
249
+		{
250
+					$poll['locked'] = '2';
251
+		}
222 252
 		// Well, it's gonna be locked one way or another otherwise...
223
-		else
224
-			$poll['locked'] = '1';
253
+		else {
254
+					$poll['locked'] = '1';
255
+		}
225 256
 
226 257
 		// Lock!  *Poof* - no one can vote.
227 258
 		lockPoll($poll['id_poll'], $poll['locked']);
@@ -251,7 +282,9 @@  discard block
 block discarded – undo
251 282
 
252 283
 		// No topic, means you can't edit the poll
253 284
 		if (empty($topic))
254
-			throw new Elk_Exception('no_access', false);
285
+		{
286
+					throw new Elk_Exception('no_access', false);
287
+		}
255 288
 
256 289
 		// We work hard with polls.
257 290
 		require_once(SUBSDIR . '/Poll.subs.php');
@@ -269,20 +302,30 @@  discard block
 block discarded – undo
269 302
 
270 303
 		// Assume it all exists, right?
271 304
 		if (empty($pollinfo))
272
-			throw new Elk_Exception('no_board');
305
+		{
306
+					throw new Elk_Exception('no_board');
307
+		}
273 308
 
274 309
 		// If we are adding a new poll - make sure that there isn't already a poll there.
275 310
 		if (!$context['is_edit'] && !empty($pollinfo['id_poll']))
276
-			throw new Elk_Exception('poll_already_exists');
311
+		{
312
+					throw new Elk_Exception('poll_already_exists');
313
+		}
277 314
 		// Otherwise, if we're editing it, it does exist I assume?
278 315
 		elseif ($context['is_edit'] && empty($pollinfo['id_poll']))
279
-			throw new Elk_Exception('poll_not_found');
316
+		{
317
+					throw new Elk_Exception('poll_not_found');
318
+		}
280 319
 
281 320
 		// Can you do this?
282 321
 		if ($context['is_edit'] && !allowedTo('poll_edit_any'))
283
-			isAllowedTo('poll_edit_' . ($user_info['id'] == $pollinfo['id_member_started'] || ($pollinfo['poll_starter'] != 0 && $user_info['id'] == $pollinfo['poll_starter']) ? 'own' : 'any'));
322
+		{
323
+					isAllowedTo('poll_edit_' . ($user_info['id'] == $pollinfo['id_member_started'] || ($pollinfo['poll_starter'] != 0 && $user_info['id'] == $pollinfo['poll_starter']) ? 'own' : 'any'));
324
+		}
284 325
 		elseif (!$context['is_edit'] && !allowedTo('poll_add_any'))
285
-			isAllowedTo('poll_add_' . ($user_info['id'] == $pollinfo['id_member_started'] ? 'own' : 'any'));
326
+		{
327
+					isAllowedTo('poll_add_' . ($user_info['id'] == $pollinfo['id_member_started'] ? 'own' : 'any'));
328
+		}
286 329
 
287 330
 		$context['can_moderate_poll'] = isset($this->_req->post->add) ? true : allowedTo('poll_edit_' . ($user_info['id'] == $pollinfo['id_member_started'] || ($pollinfo['poll_starter'] != 0 && $user_info['id'] == $pollinfo['poll_starter']) ? 'own' : 'any'));
288 331
 
@@ -322,11 +365,15 @@  discard block
 block discarded – undo
322 365
 				{
323 366
 					// Get the highest id so we can add more without reusing.
324 367
 					if ($option['id_choice'] >= $last_id)
325
-						$last_id = $option['id_choice'] + 1;
368
+					{
369
+											$last_id = $option['id_choice'] + 1;
370
+					}
326 371
 
327 372
 					// They cleared this by either omitting it or emptying it.
328 373
 					if (!isset($this->_req->post->options[$option['id_choice']]) || $this->_req->post->options[$option['id_choice']] == '')
329
-						continue;
374
+					{
375
+											continue;
376
+					}
330 377
 
331 378
 					// Add the choice!
332 379
 					$context['poll']['choices'][$option['id_choice']] = array(
@@ -344,7 +391,9 @@  discard block
 block discarded – undo
344 391
 			foreach ($this->_req->post->options as $id => $label)
345 392
 			{
346 393
 				if ($label != '')
347
-					$totalPostOptions++;
394
+				{
395
+									$totalPostOptions++;
396
+				}
348 397
 			}
349 398
 
350 399
 			$count = 1;
@@ -400,12 +449,16 @@  discard block
 block discarded – undo
400 449
 			$context['last_choice_id'] = $last_id;
401 450
 
402 451
 			if ($context['can_moderate_poll'])
403
-				$context['poll']['expiration'] = (int) $this->_req->post->poll_expire;
452
+			{
453
+							$context['poll']['expiration'] = (int) $this->_req->post->poll_expire;
454
+			}
404 455
 
405 456
 			// Check the question/option count for errors.
406 457
 			// @todo: why !$poll_errors->hasErrors()?
407 458
 			if (trim($this->_req->post->question) === '' && !$poll_errors->hasErrors())
408
-				$poll_errors->addError('no_question');
459
+			{
460
+							$poll_errors->addError('no_question');
461
+			}
409 462
 
410 463
 			// No check is needed, since nothing is really posted.
411 464
 			checkSubmitOnce('free');
@@ -514,16 +567,22 @@  discard block
 block discarded – undo
514 567
 
515 568
 		// Sneaking off, are we?
516 569
 		if (empty($this->_req->post))
517
-			redirectexit('action=editpoll;topic=' . $topic . '.0');
570
+		{
571
+					redirectexit('action=editpoll;topic=' . $topic . '.0');
572
+		}
518 573
 
519 574
 		$poll_errors = ErrorContext::context('poll');
520 575
 
521 576
 		if (checkSession('post', '', false) != '')
522
-			$poll_errors->addError('session_timeout');
577
+		{
578
+					$poll_errors->addError('session_timeout');
579
+		}
523 580
 
524 581
 		// HACKERS (!!) can't edit :P.
525 582
 		if (empty($topic))
526
-			throw new Elk_Exception('no_access', false);
583
+		{
584
+					throw new Elk_Exception('no_access', false);
585
+		}
527 586
 
528 587
 		// Is this a new poll, or editing an existing?
529 588
 		$isEdit = isset($this->_req->post->add) ? 0 : 1;
@@ -536,16 +595,24 @@  discard block
 block discarded – undo
536 595
 
537 596
 		// Check their adding/editing is valid.
538 597
 		if (!$isEdit && !empty($bcinfo['id_poll']))
539
-			throw new Elk_Exception('poll_already_exists');
598
+		{
599
+					throw new Elk_Exception('poll_already_exists');
600
+		}
540 601
 		// Are we editing a poll which doesn't exist?
541 602
 		elseif ($isEdit && empty($bcinfo['id_poll']))
542
-			throw new Elk_Exception('poll_not_found');
603
+		{
604
+					throw new Elk_Exception('poll_not_found');
605
+		}
543 606
 
544 607
 		// Check if they have the power to add or edit the poll.
545 608
 		if ($isEdit && !allowedTo('poll_edit_any'))
546
-			isAllowedTo('poll_edit_' . ($user_info['id'] == $bcinfo['id_member_started'] || ($bcinfo['poll_starter'] != 0 && $user_info['id'] == $bcinfo['poll_starter']) ? 'own' : 'any'));
609
+		{
610
+					isAllowedTo('poll_edit_' . ($user_info['id'] == $bcinfo['id_member_started'] || ($bcinfo['poll_starter'] != 0 && $user_info['id'] == $bcinfo['poll_starter']) ? 'own' : 'any'));
611
+		}
547 612
 		elseif (!$isEdit && !allowedTo('poll_add_any'))
548
-			isAllowedTo('poll_add_' . ($user_info['id'] == $bcinfo['id_member_started'] ? 'own' : 'any'));
613
+		{
614
+					isAllowedTo('poll_add_' . ($user_info['id'] == $bcinfo['id_member_started'] ? 'own' : 'any'));
615
+		}
549 616
 
550 617
 		$optionCount = 0;
551 618
 		$idCount = 0;
@@ -561,17 +628,25 @@  discard block
 block discarded – undo
561 628
 		}
562 629
 
563 630
 		if ($optionCount < 2)
564
-			$poll_errors->addError('poll_few');
631
+		{
632
+					$poll_errors->addError('poll_few');
633
+		}
565 634
 		elseif ($optionCount > 256 || $idCount > 255)
566
-			$poll_errors->addError('poll_many');
635
+		{
636
+					$poll_errors->addError('poll_many');
637
+		}
567 638
 
568 639
 		// Also - ensure they are not removing the question.
569 640
 		if ($this->_req->getPost('question', 'trim') === '')
570
-			$poll_errors->addError('no_question');
641
+		{
642
+					$poll_errors->addError('no_question');
643
+		}
571 644
 
572 645
 		// Got any errors to report?
573 646
 		if ($poll_errors->hasErrors())
574
-			$this->action_editpoll();
647
+		{
648
+					$this->action_editpoll();
649
+		}
575 650
 
576 651
 		// Prevent double submission of this form.
577 652
 		checkSubmitOnce('check');
@@ -591,7 +666,9 @@  discard block
 block discarded – undo
591 666
 			require_once(SUBSDIR . '/Members.subs.php');
592 667
 			$allowedGroups = groupsAllowedTo('poll_vote', $board);
593 668
 			if (!in_array(-1, $allowedGroups['allowed']))
594
-				$poll_guest_vote = 0;
669
+			{
670
+							$poll_guest_vote = 0;
671
+			}
595 672
 		}
596 673
 
597 674
 		// Ensure that the number options allowed makes sense, and the expiration date is valid.
@@ -600,16 +677,24 @@  discard block
 block discarded – undo
600 677
 			$poll_expire = $poll_expire > 9999 ? 9999 : ($poll_expire < 0 ? 0 : $poll_expire);
601 678
 
602 679
 			if (empty($poll_expire) && $poll_hide == 2)
603
-				$poll_hide = 1;
680
+			{
681
+							$poll_hide = 1;
682
+			}
604 683
 			elseif (!$isEdit || $poll_expire != ceil($bcinfo['expire_time'] <= time() ? -1 : ($bcinfo['expire_time'] - time()) / (3600 * 24)))
605
-				$poll_expire = empty($poll_expire) ? 0 : time() + $_POST['poll_expire'] * 3600 * 24;
606
-			else
607
-				$poll_expire = $bcinfo['expire_time'];
684
+			{
685
+							$poll_expire = empty($poll_expire) ? 0 : time() + $_POST['poll_expire'] * 3600 * 24;
686
+			}
687
+			else {
688
+							$poll_expire = $bcinfo['expire_time'];
689
+			}
608 690
 
609 691
 			if (empty($this->_req->post->poll_max_votes) || $this->_req->post->poll_max_votes <= 0)
610
-				$poll_max_votes = 1;
611
-			else
612
-				$poll_max_votes = $this->_req->getPost('poll_max_votes', 'intval', 0);
692
+			{
693
+							$poll_max_votes = 1;
694
+			}
695
+			else {
696
+							$poll_max_votes = $this->_req->getPost('poll_max_votes', 'intval', 0);
697
+			}
613 698
 		}
614 699
 
615 700
 		// If we're editing, let's commit the changes.
@@ -651,7 +736,9 @@  discard block
 block discarded – undo
651 736
 			{
652 737
 				// They want it deleted.  Bye.
653 738
 				if (in_array($k, $choices))
654
-					$delete_options[] = $k;
739
+				{
740
+									$delete_options[] = $k;
741
+				}
655 742
 
656 743
 				// Skip the rest...
657 744
 				continue;
@@ -662,24 +749,35 @@  discard block
 block discarded – undo
662 749
 
663 750
 			// If it's already there, update it.  If it's not... add it.
664 751
 			if (in_array($k, $choices))
665
-				$update_options[] = array($bcinfo['id_poll'], $k, $option);
666
-			else
667
-				$add_options[] = array($bcinfo['id_poll'], $k, $option, 0);
752
+			{
753
+							$update_options[] = array($bcinfo['id_poll'], $k, $option);
754
+			}
755
+			else {
756
+							$add_options[] = array($bcinfo['id_poll'], $k, $option, 0);
757
+			}
668 758
 		}
669 759
 
670 760
 		if (!empty($update_options))
671
-			modifyPollOption($update_options);
761
+		{
762
+					modifyPollOption($update_options);
763
+		}
672 764
 
673 765
 		if (!empty($add_options))
674
-			insertPollOptions($add_options);
766
+		{
767
+					insertPollOptions($add_options);
768
+		}
675 769
 
676 770
 		// I'm sorry, but... well, no one was choosing you. Poor options, I'll put you out of your misery.
677 771
 		if (!empty($delete_options))
678
-			deletePollOptions($bcinfo['id_poll'], $delete_options);
772
+		{
773
+					deletePollOptions($bcinfo['id_poll'], $delete_options);
774
+		}
679 775
 
680 776
 		// Shall I reset the vote count, sir?
681 777
 		if (isset($this->_req->post->resetVoteCount))
682
-			resetVotes($bcinfo['id_poll']);
778
+		{
779
+					resetVotes($bcinfo['id_poll']);
780
+		}
683 781
 
684 782
 		call_integration_hook('integrate_poll_add_edit', array($bcinfo['id_poll'], $isEdit));
685 783
 
@@ -704,7 +802,9 @@  discard block
 block discarded – undo
704 802
 
705 803
 		// Make sure the topic is not empty.
706 804
 		if (empty($topic))
707
-			throw new Elk_Exception('no_access', false);
805
+		{
806
+					throw new Elk_Exception('no_access', false);
807
+		}
708 808
 
709 809
 		// Verify the session.
710 810
 		checkSession('get');
@@ -717,11 +817,15 @@  discard block
 block discarded – undo
717 817
 		{
718 818
 			$pollStarters = pollStarters($topic);
719 819
 			if (empty($pollStarters))
720
-				throw new Elk_Exception('no_access', false);
820
+			{
821
+							throw new Elk_Exception('no_access', false);
822
+			}
721 823
 
722 824
 			list ($topicStarter, $pollStarter) = $pollStarters;
723 825
 			if ($topicStarter == $user_info['id'] || ($pollStarter != 0 && $pollStarter == $user_info['id']))
724
-				isAllowedTo('poll_remove_own');
826
+			{
827
+							isAllowedTo('poll_remove_own');
828
+			}
725 829
 		}
726 830
 
727 831
 		// Retrieve the poll ID.
Please login to merge, or discard this patch.
sources/controllers/MoveTopic.controller.php 1 patch
Braces   +60 added lines, -23 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 
92 92
 		// No boards?
93 93
 		if (empty($context['categories']) || $context['num_boards'] == 1)
94
-			throw new Elk_Exception('moveto_noboards', false);
94
+		{
95
+					throw new Elk_Exception('moveto_noboards', false);
96
+		}
95 97
 
96 98
 		// Already used the function, let's set the selected board back to the last
97 99
 		$last_moved_to = isset($_SESSION['move_to_topic']['move_to']) && $_SESSION['move_to_topic']['move_to'] != $context['current_board'] ? (int) $_SESSION['move_to_topic']['move_to'] : 0;
@@ -140,7 +142,9 @@  discard block
 block discarded – undo
140 142
 		// Make sure they can see the board they are trying to move to (and get whether posts count in the target board).
141 143
 		$this->_board_info = boardInfo($this->_toboard, $this->_topic);
142 144
 		if (empty($this->_board_info))
143
-			throw new Elk_Exception('no_board');
145
+		{
146
+					throw new Elk_Exception('no_board');
147
+		}
144 148
 
145 149
 		// Remember this for later.
146 150
 		$_SESSION['move_to_topic'] = array(
@@ -161,7 +165,9 @@  discard block
 block discarded – undo
161 165
 
162 166
 		// Log that they moved this topic.
163 167
 		if (!allowedTo('move_own') || $this->_topic_info['id_member_started'] != $user_info['id'])
164
-			logAction('move', array('topic' => $this->_topic, 'board_from' => $board, 'board_to' => $this->_toboard));
168
+		{
169
+					logAction('move', array('topic' => $this->_topic, 'board_from' => $board, 'board_to' => $this->_toboard));
170
+		}
165 171
 
166 172
 		// Notify people that this topic has been moved?
167 173
 		require_once(SUBSDIR . '/Notification.subs.php');
@@ -169,9 +175,12 @@  discard block
 block discarded – undo
169 175
 
170 176
 		// Why not go back to the original board in case they want to keep moving?
171 177
 		if (!isset($this->_req->post->goback))
172
-			redirectexit('board=' . $board . '.0');
173
-		else
174
-			redirectexit('topic=' . $this->_topic . '.0');
178
+		{
179
+					redirectexit('board=' . $board . '.0');
180
+		}
181
+		else {
182
+					redirectexit('topic=' . $this->_topic . '.0');
183
+		}
175 184
 	}
176 185
 
177 186
 	/**
@@ -211,7 +220,9 @@  discard block
 block discarded – undo
211 220
 
212 221
 		// We will need this
213 222
 		if (isset($this->_req->query->current_board))
214
-			moveTopicConcurrence((int) $this->_req->query->current_board);
223
+		{
224
+					moveTopicConcurrence((int) $this->_req->query->current_board);
225
+		}
215 226
 
216 227
 		// Register this form and get a sequence number in $context.
217 228
 		checkSubmitOnce('register');
@@ -232,22 +243,30 @@  discard block
 block discarded – undo
232 243
 		global $modSettings, $user_info;
233 244
 
234 245
 		if (empty($this->_topic))
235
-			throw new Elk_Exception('no_access', false);
246
+		{
247
+					throw new Elk_Exception('no_access', false);
248
+		}
236 249
 
237 250
 		// Retrieve the basic topic information for whats being moved
238 251
 		require_once(SUBSDIR . '/Topic.subs.php');
239 252
 		$this->_topic_info = getTopicInfo($this->_topic, 'message');
240 253
 
241 254
 		if (empty($this->_topic_info))
242
-			throw new Elk_Exception('topic_gone', false);
255
+		{
256
+					throw new Elk_Exception('topic_gone', false);
257
+		}
243 258
 
244 259
 		// Can they see it - if not approved?
245 260
 		if ($modSettings['postmod_active'] && !$this->_topic_info['approved'])
246
-			isAllowedTo('approve_posts');
261
+		{
262
+					isAllowedTo('approve_posts');
263
+		}
247 264
 
248 265
 		// Are they allowed to actually move any topics or even their own?
249 266
 		if (!allowedTo('move_any') && ($this->_topic_info['id_member_started'] == $user_info['id'] && !allowedTo('move_own')))
250
-			throw new Elk_Exception('cannot_move_any', false);
267
+		{
268
+					throw new Elk_Exception('cannot_move_any', false);
269
+		}
251 270
 	}
252 271
 
253 272
 	/**
@@ -268,20 +287,28 @@  discard block
 block discarded – undo
268 287
 		global $user_info;
269 288
 
270 289
 		if (empty($this->_topic))
271
-			throw new Elk_Exception('no_access', false);
290
+		{
291
+					throw new Elk_Exception('no_access', false);
292
+		}
272 293
 
273 294
 		// You can't choose to have a redirection topic and not provide a reason.
274 295
 		if (isset($this->_req->post->postRedirect) && $this->_req->getPost('reason', 'trim', '') === '')
275
-			throw new Elk_Exception('movetopic_no_reason', false);
296
+		{
297
+					throw new Elk_Exception('movetopic_no_reason', false);
298
+		}
276 299
 
277 300
 		// You have to tell us were you are moving to
278 301
 		if (!isset($this->_req->post->toboard))
279
-			throw new Elk_Exception('movetopic_no_board', false);
302
+		{
303
+					throw new Elk_Exception('movetopic_no_board', false);
304
+		}
280 305
 
281 306
 		// We will need this
282 307
 		require_once(SUBSDIR . '/Topic.subs.php');
283 308
 		if (isset($this->_req->query->current_board))
284
-			moveTopicConcurrence((int) $this->_req->query->current_board);
309
+		{
310
+					moveTopicConcurrence((int) $this->_req->query->current_board);
311
+		}
285 312
 
286 313
 		// Make sure this form hasn't been submitted before.
287 314
 		checkSubmitOnce('check');
@@ -291,7 +318,9 @@  discard block
 block discarded – undo
291 318
 
292 319
 		// Not approved then you need approval permissions to move it as well
293 320
 		if (!$this->_topic_info['approved'])
294
-			isAllowedTo('approve_posts');
321
+		{
322
+					isAllowedTo('approve_posts');
323
+		}
295 324
 
296 325
 		// Can they move topics on this board?
297 326
 		if (!allowedTo('move_any'))
@@ -328,7 +357,9 @@  discard block
 block discarded – undo
328 357
 
329 358
 			// Keep checking the length.
330 359
 			if (Util::strlen($custom_subject) > 100)
331
-				$custom_subject = Util::substr($custom_subject, 0, 100);
360
+			{
361
+							$custom_subject = Util::substr($custom_subject, 0, 100);
362
+			}
332 363
 
333 364
 			// If it's still valid move onwards and upwards.
334 365
 			if ($custom_subject != '')
@@ -341,8 +372,9 @@  discard block
 block discarded – undo
341 372
 
342 373
 					topicSubject($this->_topic_info, $custom_subject, $context['response_prefix'], $all_messages);
343 374
 				}
344
-				else
345
-					topicSubject($this->_topic_info, $custom_subject);
375
+				else {
376
+									topicSubject($this->_topic_info, $custom_subject);
377
+				}
346 378
 
347 379
 				// Fix the subject cache.
348 380
 				require_once(SUBSDIR . '/Messages.subs.php');
@@ -368,7 +400,9 @@  discard block
 block discarded – undo
368 400
 		{
369 401
 			// Should be in the boardwide language.
370 402
 			if ($user_info['language'] != $language)
371
-				loadLanguage('index', $language);
403
+			{
404
+							loadLanguage('index', $language);
405
+			}
372 406
 
373 407
 			$reason = Util::htmlspecialchars($this->_req->post->reason, ENT_QUOTES);
374 408
 			preparsecode($reason);
@@ -433,10 +467,13 @@  discard block
 block discarded – undo
433 467
 			{
434 468
 				// The board we're moving from counted posts, but not to.
435 469
 				if (empty($board_from['count_posts']))
436
-					updateMemberData($id_member, array('posts' => 'posts - ' . $posts));
470
+				{
471
+									updateMemberData($id_member, array('posts' => 'posts - ' . $posts));
472
+				}
437 473
 				// The reverse: from didn't, to did.
438
-				else
439
-					updateMemberData($id_member, array('posts' => 'posts + ' . $posts));
474
+				else {
475
+									updateMemberData($id_member, array('posts' => 'posts + ' . $posts));
476
+				}
440 477
 			}
441 478
 		}
442 479
 	}
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.