Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
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/SplitTopics.controller.php 1 patch
Braces   +75 added lines, -27 removed lines patch added patch discarded remove patch
@@ -58,11 +58,15 @@  discard block
 block discarded – undo
58 58
 
59 59
 		// And... which topic were you splitting, again?
60 60
 		if (empty($topic))
61
-			throw new Elk_Exception('numbers_one_to_nine', false);
61
+		{
62
+					throw new Elk_Exception('numbers_one_to_nine', false);
63
+		}
62 64
 
63 65
 		// Load up the "dependencies" - the template, getMsgMemberID().
64 66
 		if (!isset($this->_req->query->xml))
65
-			loadTemplate('SplitTopics');
67
+		{
68
+					loadTemplate('SplitTopics');
69
+		}
66 70
 
67 71
 		// Need some utilities to deal with topics
68 72
 		require_once(SUBSDIR . '/Boards.subs.php');
@@ -104,7 +108,9 @@  discard block
 block discarded – undo
104 108
 
105 109
 		// Validate "at".
106 110
 		if (empty($this->_req->query->at))
107
-			throw new Elk_Exception('numbers_one_to_nine', false);
111
+		{
112
+					throw new Elk_Exception('numbers_one_to_nine', false);
113
+		}
108 114
 
109 115
 		// We deal with topics here.
110 116
 		require_once(SUBSDIR . '/Boards.subs.php');
@@ -116,22 +122,30 @@  discard block
 block discarded – undo
116 122
 		// Retrieve message info for the message at the split point.
117 123
 		$messageInfo = basicMessageInfo($splitAt, false, true);
118 124
 		if ($messageInfo === false)
119
-			throw new Elk_Exception('cant_find_messages');
125
+		{
126
+					throw new Elk_Exception('cant_find_messages');
127
+		}
120 128
 
121 129
 		// If not approved validate they can approve it.
122 130
 		if ($modSettings['postmod_active'] && !$messageInfo['topic_approved'])
123
-			isAllowedTo('approve_posts');
131
+		{
132
+					isAllowedTo('approve_posts');
133
+		}
124 134
 
125 135
 		// If this topic has unapproved posts, we need to count them too...
126 136
 		if ($modSettings['postmod_active'] && allowedTo('approve_posts'))
127
-			$messageInfo['num_replies'] += $messageInfo['unapproved_posts'] - ($messageInfo['topic_approved'] ? 0 : 1);
137
+		{
138
+					$messageInfo['num_replies'] += $messageInfo['unapproved_posts'] - ($messageInfo['topic_approved'] ? 0 : 1);
139
+		}
128 140
 
129 141
 		// If they can more it as well, allow the template to give them a move to board list
130 142
 		$context['can_move'] = allowedTo('move_any') || allowedTo('move_own');
131 143
 
132 144
 		// Check if there is more than one message in the topic.  (there should be.)
133 145
 		if ($messageInfo['num_replies'] < 1)
134
-			throw new Elk_Exception('topic_one_post', false);
146
+		{
147
+					throw new Elk_Exception('topic_one_post', false);
148
+		}
135 149
 
136 150
 		// Check if this is the first message in the topic (if so, the first and second option won't be available)
137 151
 		if ($messageInfo['id_first_msg'] == $splitAt)
@@ -187,7 +201,9 @@  discard block
 block discarded – undo
187 201
 		if ($this->_req->post->step2 === 'selective')
188 202
 		{
189 203
 			if (!empty($this->_req->post->at))
190
-				$_SESSION['split_selection'][$topic][] = (int) $this->_req->post->at;
204
+			{
205
+							$_SESSION['split_selection'][$topic][] = (int) $this->_req->post->at;
206
+			}
191 207
 
192 208
 			$this->action_splitSelectTopics();
193 209
 			return true;
@@ -207,10 +223,14 @@  discard block
 block discarded – undo
207 223
 
208 224
 		// Fetch the message IDs of the topic that are at or after the message.
209 225
 		if ($this->_req->post->step2 === 'afterthis')
210
-			$messagesToBeSplit = messagesSince($topic, $splitAt, true);
226
+		{
227
+					$messagesToBeSplit = messagesSince($topic, $splitAt, true);
228
+		}
211 229
 		// Only the selected message has to be split. That should be easy.
212 230
 		elseif ($this->_req->post->step2 === 'onlythis')
213
-			$messagesToBeSplit[] = $splitAt;
231
+		{
232
+					$messagesToBeSplit[] = $splitAt;
233
+		}
214 234
 		// There's another action?!
215 235
 		else
216 236
 		{
@@ -228,7 +248,9 @@  discard block
 block discarded – undo
228 248
 		// Create a link to this in the old topic.
229 249
 		// @todo Does this make sense if the topic was unapproved before? We are not yet sure if the resulting topic is unapproved.
230 250
 		if ($_SESSION['messageRedirect'])
231
-			postSplitRedirect($_SESSION['reason'], $_SESSION['new_topic_subject'], $boards['destination'], $context['new_topic']);
251
+		{
252
+					postSplitRedirect($_SESSION['reason'], $_SESSION['new_topic_subject'], $boards['destination'], $context['new_topic']);
253
+		}
232 254
 
233 255
 		$this->_unset_session_values();
234 256
 
@@ -275,7 +297,9 @@  discard block
 block discarded – undo
275 297
 		// Create a link to this in the old topic.
276 298
 		// @todo Does this make sense if the topic was unapproved before? We are not yet sure if the resulting topic is unapproved.
277 299
 		if ($_SESSION['messageRedirect'])
278
-			postSplitRedirect($_SESSION['reason'], $_SESSION['new_topic_subject'], $boards['destination'], $context['new_topic']);
300
+		{
301
+					postSplitRedirect($_SESSION['reason'], $_SESSION['new_topic_subject'], $boards['destination'], $context['new_topic']);
302
+		}
279 303
 
280 304
 		$this->_unset_session_values();
281 305
 	}
@@ -341,7 +365,9 @@  discard block
 block discarded – undo
341 365
 
342 366
 		// All of the js for topic split selection is needed
343 367
 		if (!isset($this->_req->query->xml))
344
-			loadJavascriptFile('topic.js');
368
+		{
369
+					loadJavascriptFile('topic.js');
370
+		}
345 371
 
346 372
 		// Are we using a custom messages per page?
347 373
 		$context['messages_per_page'] = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];
@@ -360,7 +386,9 @@  discard block
 block discarded – undo
360 386
 
361 387
 			// You can't split the last message off.
362 388
 			if (empty($context['not_selected']['start']) && count($original_msgs['not_selected']) <= 1 && $this->_req->query->move === 'down')
363
-				$this->_req->query->move = '';
389
+			{
390
+							$this->_req->query->move = '';
391
+			}
364 392
 
365 393
 			if (!empty($_SESSION['split_selection'][$topic]))
366 394
 			{
@@ -378,11 +406,16 @@  discard block
 block discarded – undo
378 406
 			$_id_msg = $this->_req->getQuery('msg', 'intval');
379 407
 
380 408
 			if ($this->_req->query->move === 'reset')
381
-				$_SESSION['split_selection'][$topic] = array();
409
+			{
410
+							$_SESSION['split_selection'][$topic] = array();
411
+			}
382 412
 			elseif ($this->_req->query->move === 'up')
383
-				$_SESSION['split_selection'][$topic] = array_diff($_SESSION['split_selection'][$topic], array($_id_msg));
384
-			else
385
-				$_SESSION['split_selection'][$topic][] = $_id_msg;
413
+			{
414
+							$_SESSION['split_selection'][$topic] = array_diff($_SESSION['split_selection'][$topic], array($_id_msg));
415
+			}
416
+			else {
417
+							$_SESSION['split_selection'][$topic][] = $_id_msg;
418
+			}
386 419
 		}
387 420
 
388 421
 		// Make sure the selection is still accurate.
@@ -395,17 +428,22 @@  discard block
 block discarded – undo
395 428
 			));
396 429
 			$selection = $_SESSION['split_selection'][$topic];
397 430
 		}
398
-		else
399
-			$selection = array();
431
+		else {
432
+					$selection = array();
433
+		}
400 434
 
401 435
 		// Get the number of messages (not) selected to be split.
402 436
 		$split_counts = countSplitMessages($topic, !$modSettings['postmod_active'] || allowedTo('approve_posts'), $selection);
403 437
 		foreach ($split_counts as $key => $num_messages)
404
-			$context[$key]['num_messages'] = $num_messages;
438
+		{
439
+					$context[$key]['num_messages'] = $num_messages;
440
+		}
405 441
 
406 442
 		// Fix an oversize starting page (to make sure both pageindexes are properly set).
407 443
 		if ($context['selected']['start'] >= $context['selected']['num_messages'])
408
-			$context['selected']['start'] = $context['selected']['num_messages'] <= $context['messages_per_page'] ? 0 : ($context['selected']['num_messages'] - (($context['selected']['num_messages'] % $context['messages_per_page']) == 0 ? $context['messages_per_page'] : ($context['selected']['num_messages'] % $context['messages_per_page'])));
444
+		{
445
+					$context['selected']['start'] = $context['selected']['num_messages'] <= $context['messages_per_page'] ? 0 : ($context['selected']['num_messages'] - (($context['selected']['num_messages'] % $context['messages_per_page']) == 0 ? $context['messages_per_page'] : ($context['selected']['num_messages'] % $context['messages_per_page'])));
446
+		}
409 447
 
410 448
 		$page_index_url = $scripturl . '?action=splittopics;sa=selectTopics;subname=' . strtr(urlencode($_SESSION['new_topic_subject']), array('%' => '%%')) . ';topic=' . $topic;
411 449
 
@@ -420,7 +458,9 @@  discard block
 block discarded – undo
420 458
 
421 459
 		// Now retrieve the selected messages.
422 460
 		if (!empty($_SESSION['split_selection'][$topic]))
423
-			$context['selected']['messages'] = selectMessages($topic, $context['selected']['start'], $context['messages_per_page'], array('included' => $_SESSION['split_selection'][$topic]), $modSettings['postmod_active'] && !allowedTo('approve_posts'));
461
+		{
462
+					$context['selected']['messages'] = selectMessages($topic, $context['selected']['start'], $context['messages_per_page'], array('included' => $_SESSION['split_selection'][$topic]), $modSettings['postmod_active'] && !allowedTo('approve_posts'));
463
+		}
424 464
 
425 465
 		// The XMLhttp method only needs the stuff that changed, so let's compare.
426 466
 		if (isset($this->_req->query->xml))
@@ -442,7 +482,9 @@  discard block
 block discarded – undo
442 482
 				foreach ($change_array as $section => $msg_array)
443 483
 				{
444 484
 					if (empty($msg_array))
445
-						continue;
485
+					{
486
+											continue;
487
+					}
446 488
 
447 489
 					foreach ($msg_array as $id_msg)
448 490
 					{
@@ -453,7 +495,9 @@  discard block
 block discarded – undo
453 495
 						);
454 496
 
455 497
 						if ($change_type === 'insert')
456
-							$context['changes']['insert' . $id_msg]['insert_value'] = $context[$section]['messages'][$id_msg];
498
+						{
499
+													$context['changes']['insert' . $id_msg]['insert_value'] = $context[$section]['messages'][$id_msg];
500
+						}
457 501
 					}
458 502
 				}
459 503
 			}
@@ -470,10 +514,14 @@  discard block
 block discarded – undo
470 514
 		// Clean up the subject.
471 515
 		$subname = $this->_req->getPost('subname', 'trim', $this->_req->getQuery('subname', 'trim', null));
472 516
 		if (isset($subname) && empty($this->_new_topic_subject))
473
-			$this->_new_topic_subject = Util::htmlspecialchars($subname);
517
+		{
518
+					$this->_new_topic_subject = Util::htmlspecialchars($subname);
519
+		}
474 520
 
475 521
 		if (empty($this->_new_topic_subject))
476
-			$this->_new_topic_subject = $txt['new_topic'];
522
+		{
523
+					$this->_new_topic_subject = $txt['new_topic'];
524
+		}
477 525
 
478 526
 		// Save in session so its available across all the form pages
479 527
 		if (empty($_SESSION['move_to_board']))
Please login to merge, or discard this patch.
sources/controllers/Who.controller.php 1 patch
Braces   +27 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,7 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
 		// You can't do anything if this is off.
58 58
 		if (empty($modSettings['who_enabled']))
59
-			throw new Elk_Exception('who_off', false);
59
+		{
60
+					throw new Elk_Exception('who_off', false);
61
+		}
60 62
 
61 63
 		// Load the 'Who' template.
62 64
 		loadTemplate('Who');
@@ -94,7 +96,9 @@  discard block
 block discarded – undo
94 96
 			$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
95 97
 		}
96 98
 		elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] === 'spiders')
97
-			unset($_SESSION['who_online_filter']);
99
+		{
100
+					unset($_SESSION['who_online_filter']);
101
+		}
98 102
 
99 103
 		// Does the user prefer a different sort direction?
100 104
 		if (isset($this->_req->query->sort) && isset($sort_methods[$this->_req->query->sort]))
@@ -119,11 +123,15 @@  discard block
 block discarded – undo
119 123
 
120 124
 		$conditions = array();
121 125
 		if (!allowedTo('moderate_forum'))
122
-			$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
126
+		{
127
+					$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
128
+		}
123 129
 
124 130
 		// Fallback to top filter?
125 131
 		if (isset($this->_req->post->submit_top, $this->_req->post->show_top))
126
-			$this->_req->post->show = $this->_req->post->show_top;
132
+		{
133
+					$this->_req->post->show = $this->_req->post->show_top;
134
+		}
127 135
 
128 136
 		// Does the user wish to apply a filter?
129 137
 		if (isset($this->_req->post->show) && isset($show_methods[$this->_req->post->show]))
@@ -137,8 +145,9 @@  discard block
 block discarded – undo
137 145
 			$context['show_by'] = $_SESSION['who_online_filter'];
138 146
 			$conditions[] = $show_methods[$_SESSION['who_online_filter']];
139 147
 		}
140
-		else
141
-			$context['show_by'] = $_SESSION['who_online_filter'] = 'all';
148
+		else {
149
+					$context['show_by'] = $_SESSION['who_online_filter'] = 'all';
150
+		}
142 151
 
143 152
 		require_once(SUBSDIR . '/Members.subs.php');
144 153
 		$totalMembers = countMembersOnline($conditions);
@@ -161,7 +170,9 @@  discard block
 block discarded – undo
161 170
 		{
162 171
 			$actions = Util::unserialize($row['url']);
163 172
 			if ($actions === false)
164
-				continue;
173
+			{
174
+							continue;
175
+			}
165 176
 
166 177
 			// Send the information to the template.
167 178
 			$context['members'][$row['session']] = array(
@@ -227,16 +238,21 @@  discard block
 block discarded – undo
227 238
 		foreach ($context['members'] as $i => $member)
228 239
 		{
229 240
 			if ($member['id'] != 0)
230
-				$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
241
+			{
242
+							$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
243
+			}
231 244
 
232 245
 			// Keep the IP that came from the database.
233 246
 			$memberContext[$member['id']]['ip'] = $member['ip'];
234 247
 			$context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
235 248
 
236 249
 			if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']]))
237
-				$context['members'][$i] += $spiderContext[$member['id_spider']];
238
-			else
239
-				$context['members'][$i] += $memberContext[$member['id']];
250
+			{
251
+							$context['members'][$i] += $spiderContext[$member['id_spider']];
252
+			}
253
+			else {
254
+							$context['members'][$i] += $memberContext[$member['id']];
255
+			}
240 256
 		}
241 257
 
242 258
 		// Some people can't send personal messages...
Please login to merge, or discard this patch.
sources/controllers/Draft.controller.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 
92 92
 		// Safe is safe.
93 93
 		if ($this->_memID != $user_info['id'])
94
-			throw new Elk_Exception('no_access', false);
94
+		{
95
+					throw new Elk_Exception('no_access', false);
96
+		}
95 97
 
96 98
 		require_once(SUBSDIR . '/Drafts.subs.php');
97 99
 
@@ -101,7 +103,9 @@  discard block
 block discarded – undo
101 103
 
102 104
 		// If just deleting a draft, do it and then redirect back.
103 105
 		if (!empty($this->_req->query->delete) || !empty($this->_req->post->delete))
104
-			$this->_action_delete('action=profile;u=' . $this->_memID . ';area=showdrafts;start=' . $context['start']);
106
+		{
107
+					$this->_action_delete('action=profile;u=' . $this->_memID . ';area=showdrafts;start=' . $context['start']);
108
+		}
105 109
 
106 110
 		// Get things started
107 111
 		$msgCount = draftsCount($this->_memID, 0);
@@ -166,7 +170,9 @@  discard block
 block discarded – undo
166 170
 
167 171
 		// If the drafts were retrieved in reverse order, get them right again.
168 172
 		if ($reverse)
169
-			$context['drafts'] = array_reverse($context['drafts'], true);
173
+		{
174
+					$context['drafts'] = array_reverse($context['drafts'], true);
175
+		}
170 176
 
171 177
 		// Menu tab
172 178
 		$context[$context['profile_menu_name']]['tab_data'] = array(
@@ -195,15 +201,19 @@  discard block
 block discarded – undo
195 201
 
196 202
 		// Quick check how we got here.
197 203
 		if ($this->_memID != $user_info['id'])
198
-			// empty($modSettings['drafts_enabled']) || empty($modSettings['drafts_pm_enabled']))
204
+		{
205
+					// empty($modSettings['drafts_enabled']) || empty($modSettings['drafts_pm_enabled']))
199 206
 			throw new Elk_Exception('no_access', false);
207
+		}
200 208
 
201 209
 		// Set up what we will need
202 210
 		$context['start'] = $this->_req->getQuery('start', 'intval', 0);
203 211
 
204 212
 		// If just deleting a draft, do it and then redirect back.
205 213
 		if (!empty($this->_req->query->delete) || !empty($this->_req->post->delete))
206
-			return $this->_action_delete('action=pm;sa=showpmdrafts;start=' . $context['start']);
214
+		{
215
+					return $this->_action_delete('action=pm;sa=showpmdrafts;start=' . $context['start']);
216
+		}
207 217
 
208 218
 		// Perhaps a draft was selected for editing? if so pass this off
209 219
 		if (!empty($this->_req->query->id_draft) && !empty($context['drafts_pm_save']))
@@ -264,7 +274,9 @@  discard block
 block discarded – undo
264 274
 
265 275
 		// If the drafts were retrieved in reverse order, then put them in the right order again.
266 276
 		if ($reverse)
267
-			$context['drafts'] = array_reverse($context['drafts'], true);
277
+		{
278
+					$context['drafts'] = array_reverse($context['drafts'], true);
279
+		}
268 280
 
269 281
 		// Off to the template we go
270 282
 		$context['page_title'] = $txt['drafts'];
@@ -300,7 +312,9 @@  discard block
 block discarded – undo
300 312
 		}
301 313
 
302 314
 		if (!empty($toDelete))
303
-			deleteDrafts($toDelete, $this->_memID);
315
+		{
316
+					deleteDrafts($toDelete, $this->_memID);
317
+		}
304 318
 
305 319
 		redirectexit($redirect);
306 320
 	}
Please login to merge, or discard this patch.
sources/controllers/Announce.controller.php 1 patch
Braces   +39 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
 		// You need to announce something
44 44
 		if (empty($topic))
45
-			throw new Elk_Exception('topic_gone', false);
45
+		{
46
+					throw new Elk_Exception('topic_gone', false);
47
+		}
46 48
 
47 49
 		// Language files
48 50
 		loadLanguage('Post');
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 		// Build a list of groups that can see this board
83 85
 		$groups = array_merge($board_info['groups'], array(1));
84 86
 		foreach ($groups as $id => $group)
85
-			$groups[$id] = (int) $group;
87
+		{
88
+					$groups[$id] = (int) $group;
89
+		}
86 90
 
87 91
 		// Prepare for a group selection list in the template
88 92
 		$context['groups'] = getGroups($groups);
@@ -123,17 +127,24 @@  discard block
 block discarded – undo
123 127
 
124 128
 		// Load any supplied membergroups (from announcement_send template pause loop)
125 129
 		if (isset($this->_req->post->membergroups))
126
-			$_who = explode(',', $this->_req->post->membergroups);
127
-		else
128
-			$_who = $this->_req->post->who;
130
+		{
131
+					$_who = explode(',', $this->_req->post->membergroups);
132
+		}
133
+		else {
134
+					$_who = $this->_req->post->who;
135
+		}
129 136
 
130 137
 		// Check that at least one membergroup was selected (set from announce sub template)
131 138
 		if (empty($_who))
132
-			throw new Elk_Exception('no_membergroup_selected');
139
+		{
140
+					throw new Elk_Exception('no_membergroup_selected');
141
+		}
133 142
 
134 143
 		// Make sure all membergroups are integers and can access the board of the announcement.
135 144
 		foreach ($_who as $id => $mg)
136
-			$who[$id] = in_array((int) $mg, $groups) ? (int) $mg : 0;
145
+		{
146
+					$who[$id] = in_array((int) $mg, $groups) ? (int) $mg : 0;
147
+		}
137 148
 
138 149
 		// Get the topic details that we are going to send
139 150
 		require_once(SUBSDIR . '/Topic.subs.php');
@@ -159,7 +170,9 @@  discard block
 block discarded – undo
159 170
 
160 171
 		// Have we allowed members to opt out of announcements?
161 172
 		if (!empty($modSettings['allow_disableAnnounce']))
162
-			$conditions['notify_announcements'] = 1;
173
+		{
174
+					$conditions['notify_announcements'] = 1;
175
+		}
163 176
 
164 177
 		$data = retrieveMemberData($conditions);
165 178
 
@@ -169,20 +182,28 @@  discard block
 block discarded – undo
169 182
 			logAction('announce_topic', array('topic' => $topic), 'user');
170 183
 
171 184
 			if (!empty($this->_req->post->move) && allowedTo('move_any'))
172
-				redirectexit('action=movetopic;topic=' . $topic . '.0' . (empty($this->_req->post->goback) ? '' : ';goback'));
185
+			{
186
+							redirectexit('action=movetopic;topic=' . $topic . '.0' . (empty($this->_req->post->goback) ? '' : ';goback'));
187
+			}
173 188
 			elseif (!empty($this->_req->post->goback))
174
-				redirectexit('topic=' . $topic . '.new;boardseen#new', isBrowser('ie'));
175
-			else
176
-				redirectexit('board=' . $board . '.0');
189
+			{
190
+							redirectexit('topic=' . $topic . '.new;boardseen#new', isBrowser('ie'));
191
+			}
192
+			else {
193
+							redirectexit('board=' . $board . '.0');
194
+			}
177 195
 		}
178 196
 
179 197
 		$this->_send_announcement($data['member_info'], $topic_info);
180 198
 
181 199
 		// Provide an overall indication of progress, this is not strictly correct
182 200
 		if ($data['member_count'] < $conditions['limit'])
183
-			$context['percentage_done'] = 100;
184
-		else
185
-			$context['percentage_done'] = round(100 * $context['start'] / $modSettings['latestMember'], 1);
201
+		{
202
+					$context['percentage_done'] = 100;
203
+		}
204
+		else {
205
+					$context['percentage_done'] = round(100 * $context['start'] / $modSettings['latestMember'], 1);
206
+		}
186 207
 
187 208
 		// Prepare for the template
188 209
 		$context['move'] = empty($this->_req->post->move) ? 0 : 1;
@@ -193,7 +214,9 @@  discard block
 block discarded – undo
193 214
 
194 215
 		// Go back to the correct language for the user ;)
195 216
 		if (!empty($modSettings['userLanguage']))
196
-			loadLanguage('Post');
217
+		{
218
+					loadLanguage('Post');
219
+		}
197 220
 	}
198 221
 
199 222
 	/**
Please login to merge, or discard this patch.
sources/controllers/Display.controller.php 1 patch
Braces   +111 added lines, -39 removed lines patch added patch discarded remove patch
@@ -106,7 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
 		// What are you gonna display if these are empty?!
108 108
 		if (empty($topic))
109
-			throw new Elk_Exception('no_board', false);
109
+		{
110
+					throw new Elk_Exception('no_board', false);
111
+		}
110 112
 
111 113
 		// Load the template
112 114
 		loadTemplate('Display');
@@ -131,13 +133,17 @@  discard block
 block discarded – undo
131 133
 			foreach ($this->_req->query as $k => $v)
132 134
 			{
133 135
 				if (!in_array($k, array('topic', 'board', 'start', session_name())))
134
-					$context['robot_no_index'] = true;
136
+				{
137
+									$context['robot_no_index'] = true;
138
+				}
135 139
 			}
136 140
 		}
137 141
 
138 142
 		$this->_start = $this->_req->getQuery('start');
139 143
 		if (!empty($this->_start) && (!is_numeric($this->_start) || $this->_start % $context['messages_per_page'] !== 0))
140
-			$context['robot_no_index'] = true;
144
+		{
145
+					$context['robot_no_index'] = true;
146
+		}
141 147
 
142 148
 		// Find the previous or next topic.  Make a fuss if there are no more.
143 149
 		if ($this->_req->getQuery('prev_next') === 'prev' || $this->_req->getQuery('prev_next') === 'next')
@@ -176,7 +182,9 @@  discard block
 block discarded – undo
176 182
 		// Load the topic details
177 183
 		$topicinfo = getTopicInfo($topic_parameters, 'all', $topic_selects, $topic_tables);
178 184
 		if (empty($topicinfo))
179
-			throw new Elk_Exception('not_a_topic', false);
185
+		{
186
+					throw new Elk_Exception('not_a_topic', false);
187
+		}
180 188
 
181 189
 		// Is this a moved topic that we are redirecting to?
182 190
 		if (!empty($topicinfo['id_redirect_topic']) && !isset($this->_req->query->noredir))
@@ -208,7 +216,9 @@  discard block
 block discarded – undo
208 216
 
209 217
 		// Add up unapproved replies to get real number of replies...
210 218
 		if ($modSettings['postmod_active'] && allowedTo('approve_posts'))
211
-			$context['real_num_replies'] += $topicinfo['unapproved_posts'] - ($topicinfo['approved'] ? 0 : 1);
219
+		{
220
+					$context['real_num_replies'] += $topicinfo['unapproved_posts'] - ($topicinfo['approved'] ? 0 : 1);
221
+		}
212 222
 
213 223
 		// If this topic has unapproved posts, we need to work out how many posts the user can see, for page indexing.
214 224
 		if (!$includeUnapproved && $topicinfo['unapproved_posts'] && !$user_info['is_guest'])
@@ -218,9 +228,12 @@  discard block
 block discarded – undo
218 228
 			$total_visible_posts = $context['num_replies'] + $myUnapprovedPosts + ($topicinfo['approved'] ? 1 : 0);
219 229
 		}
220 230
 		elseif ($user_info['is_guest'])
221
-			$total_visible_posts = $context['num_replies'] + ($topicinfo['approved'] ? 1 : 0);
222
-		else
223
-			$total_visible_posts = $context['num_replies'] + $topicinfo['unapproved_posts'] + ($topicinfo['approved'] ? 1 : 0);
231
+		{
232
+					$total_visible_posts = $context['num_replies'] + ($topicinfo['approved'] ? 1 : 0);
233
+		}
234
+		else {
235
+					$total_visible_posts = $context['num_replies'] + $topicinfo['unapproved_posts'] + ($topicinfo['approved'] ? 1 : 0);
236
+		}
224 237
 
225 238
 		// When was the last time this topic was replied to?  Should we warn them about it?
226 239
 		$context['oldTopicError'] = false;
@@ -228,7 +241,9 @@  discard block
 block discarded – undo
228 241
 		{
229 242
 			$mgsOptions = basicMessageInfo($topicinfo['id_last_msg'], true);
230 243
 			if ($mgsOptions !== false)
231
-				$context['oldTopicError'] = $mgsOptions['poster_time'] + $modSettings['oldTopicDays'] * 86400 < time() && empty($topicinfo['is_sticky']);
244
+			{
245
+							$context['oldTopicError'] = $mgsOptions['poster_time'] + $modSettings['oldTopicDays'] * 86400 < time() && empty($topicinfo['is_sticky']);
246
+			}
232 247
 		}
233 248
 
234 249
 		// The start isn't a number; it's information about what to do, where to go.
@@ -255,7 +270,9 @@  discard block
 block discarded – undo
255 270
 			{
256 271
 				$timestamp = (int) substr($this->_start, 4);
257 272
 				if ($timestamp === 0)
258
-					$this->_start = 0;
273
+				{
274
+									$this->_start = 0;
275
+				}
259 276
 				else
260 277
 				{
261 278
 					// Find the number of messages posted before said time...
@@ -268,9 +285,13 @@  discard block
 block discarded – undo
268 285
 			{
269 286
 				$this->_virtual_msg = (int) substr($this->_start, 3);
270 287
 				if (!$topicinfo['unapproved_posts'] && $this->_virtual_msg >= $topicinfo['id_last_msg'])
271
-					$context['start_from'] = $total_visible_posts - 1;
288
+				{
289
+									$context['start_from'] = $total_visible_posts - 1;
290
+				}
272 291
 				elseif (!$topicinfo['unapproved_posts'] && $this->_virtual_msg <= $topicinfo['id_first_msg'])
273
-					$context['start_from'] = 0;
292
+				{
293
+									$context['start_from'] = 0;
294
+				}
274 295
 				else
275 296
 				{
276 297
 					$only_approved = $modSettings['postmod_active'] && $topicinfo['unapproved_posts'] && !allowedTo('approve_posts');
@@ -284,15 +305,19 @@  discard block
 block discarded – undo
284 305
 
285 306
 		// Create a previous next string if the selected theme has it as a selected option.
286 307
 		if ($modSettings['enablePreviousNext'])
287
-			$context['links'] += array(
308
+		{
309
+					$context['links'] += array(
288 310
 				'go_prev' => $scripturl . '?topic=' . $topic . '.0;prev_next=prev#new',
289 311
 				'go_next' => $scripturl . '?topic=' . $topic . '.0;prev_next=next#new'
290 312
 			);
313
+		}
291 314
 
292 315
 		// Check if spellchecking is both enabled and actually working. (for quick reply.)
293 316
 		$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
294 317
 		if ($context['show_spellchecking'])
295
-			loadJavascriptFile('spellcheck.js', array('defer' => true));
318
+		{
319
+					loadJavascriptFile('spellcheck.js', array('defer' => true));
320
+		}
296 321
 
297 322
 		// Are we showing signatures - or disabled fields?
298 323
 		$context['signature_enabled'] = substr($modSettings['signature_settings'], 0, 1) == 1;
@@ -311,7 +336,9 @@  discard block
 block discarded – undo
311 336
 		// Did we report a post to a moderator just now?
312 337
 		$context['report_sent'] = isset($this->_req->query->reportsent);
313 338
 		if ($context['report_sent'])
314
-			$this->_template_layers->add('report_sent');
339
+		{
340
+					$this->_template_layers->add('report_sent');
341
+		}
315 342
 
316 343
 		// Let's get nosey, who is viewing this topic?
317 344
 		if (!empty($settings['display_who_viewing']))
@@ -323,10 +350,14 @@  discard block
 block discarded – undo
323 350
 		// If all is set, but not allowed... just unset it.
324 351
 		$can_show_all = !empty($modSettings['enableAllMessages']) && $total_visible_posts > $context['messages_per_page'] && $total_visible_posts < $modSettings['enableAllMessages'];
325 352
 		if (isset($this->_req->query->all) && !$can_show_all)
326
-			unset($this->_req->query->all);
353
+		{
354
+					unset($this->_req->query->all);
355
+		}
327 356
 		// Otherwise, it must be allowed... so pretend start was -1.
328 357
 		elseif (isset($this->_req->query->all))
329
-			$this->_start = -1;
358
+		{
359
+					$this->_start = -1;
360
+		}
330 361
 
331 362
 		// Construct the page index, allowing for the .START method...
332 363
 		$context['page_index'] = constructPageIndex($scripturl . '?topic=' . $topic . '.%1$d', $this->_start, $total_visible_posts, $context['messages_per_page'], true, array('all' => $can_show_all, 'all_selected' => isset($this->_req->query->all)));
@@ -422,14 +453,18 @@  discard block
 block discarded – undo
422 453
 
423 454
 			$mark_at_msg = max($messages);
424 455
 			if ($mark_at_msg >= $topicinfo['id_last_msg'])
425
-				$mark_at_msg = $modSettings['maxMsgID'];
456
+			{
457
+							$mark_at_msg = $modSettings['maxMsgID'];
458
+			}
426 459
 			if ($mark_at_msg >= $topicinfo['new_from'])
427 460
 			{
428 461
 				markTopicsRead(array($user_info['id'], $topic, $mark_at_msg, $topicinfo['unwatched']), $topicinfo['new_from'] !== 0);
429 462
 				$numNewTopics = getUnreadCountSince($board, empty($_SESSION['id_msg_last_visit']) ? 0 : $_SESSION['id_msg_last_visit']);
430 463
 
431 464
 				if (empty($numNewTopics))
432
-					$boardseen = true;
465
+				{
466
+									$boardseen = true;
467
+				}
433 468
 			}
434 469
 
435 470
 			updateReadNotificationsFor($topic, $board);
@@ -451,7 +486,9 @@  discard block
 block discarded – undo
451 486
 
452 487
 			// Fetch attachments.
453 488
 			if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments'))
454
-				$attachments = getAttachments($messages, $includeUnapproved, 'filter_accessible_attachment', $all_posters);
489
+			{
490
+							$attachments = getAttachments($messages, $includeUnapproved, 'filter_accessible_attachment', $all_posters);
491
+			}
455 492
 
456 493
 			$msg_parameters = array(
457 494
 				'message_list' => $messages,
@@ -463,7 +500,9 @@  discard block
 block discarded – undo
463 500
 
464 501
 			// What?  It's not like it *couldn't* be only guests in this topic...
465 502
 			if (!empty($posters))
466
-				loadMemberData($posters);
503
+			{
504
+							loadMemberData($posters);
505
+			}
467 506
 
468 507
 			// Load in the likes for this group of messages
469 508
 			if (!empty($modSettings['likes_enabled']))
@@ -503,7 +542,9 @@  discard block
 block discarded – undo
503 542
 
504 543
 			// Go to the last message if the given time is beyond the time of the last message.
505 544
 			if (isset($context['start_from']) && $context['start_from'] >= $topicinfo['num_replies'])
506
-				$context['start_from'] = $topicinfo['num_replies'];
545
+			{
546
+							$context['start_from'] = $topicinfo['num_replies'];
547
+			}
507 548
 
508 549
 			// Since the anchor information is needed on the top of the page we load these variables beforehand.
509 550
 			$context['first_message'] = isset($messages[$firstIndex]) ? $messages[$firstIndex] : $messages[0];
@@ -556,7 +597,9 @@  discard block
 block discarded – undo
556 597
 			'can_restore_msg' => 'move_any',
557 598
 		);
558 599
 		foreach ($common_permissions as $contextual => $perm)
559
-			$context[$contextual] = allowedTo($perm);
600
+		{
601
+					$context[$contextual] = allowedTo($perm);
602
+		}
560 603
 
561 604
 		// Permissions with _any/_own versions.  $context[YYY] => ZZZ_any/_own.
562 605
 		$anyown_permissions = array(
@@ -567,7 +610,9 @@  discard block
 block discarded – undo
567 610
 			'can_reply_unapproved' => 'post_unapproved_replies',
568 611
 		);
569 612
 		foreach ($anyown_permissions as $contextual => $perm)
570
-			$context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));
613
+		{
614
+					$context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));
615
+		}
571 616
 
572 617
 		// Cleanup all the permissions with extra stuff...
573 618
 		$context['can_mark_notify'] &= !$context['user']['is_guest'];
@@ -675,7 +720,9 @@  discard block
 block discarded – undo
675 720
 
676 721
 		// Restore topic. eh?  No monkey business.
677 722
 		if ($context['can_restore_topic'])
678
-			$context['mod_buttons'][] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
723
+		{
724
+					$context['mod_buttons'][] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
725
+		}
679 726
 
680 727
 		// Quick reply & modify enabled?
681 728
 		if ($context['can_reply'] && !empty($options['display_quick_reply']))
@@ -709,13 +756,17 @@  discard block
 block discarded – undo
709 756
 		require_once(SUBSDIR . '/Messages.subs.php');
710 757
 
711 758
 		if (empty($this->_req->post->msgs))
712
-			redirectexit('topic=' . $topic . '.' . $this->_req->getQuery('start', 'intval'));
759
+		{
760
+					redirectexit('topic=' . $topic . '.' . $this->_req->getQuery('start', 'intval'));
761
+		}
713 762
 
714 763
 		$messages = array_map('intval', $this->_req->post->msgs);
715 764
 
716 765
 		// We are restoring messages. We handle this in another place.
717 766
 		if (isset($this->_req->query->restore_selected))
718
-			redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']);
767
+		{
768
+					redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']);
769
+		}
719 770
 
720 771
 		if (isset($this->_req->query->split_selection))
721 772
 		{
@@ -730,16 +781,23 @@  discard block
 block discarded – undo
730 781
 
731 782
 		// Allowed to delete any message?
732 783
 		if (allowedTo('delete_any'))
733
-			$allowed_all = true;
784
+		{
785
+					$allowed_all = true;
786
+		}
734 787
 		// Allowed to delete replies to their messages?
735 788
 		elseif (allowedTo('delete_replies'))
736
-			$allowed_all = $topic_info['id_member_started'] == $user_info['id'];
737
-		else
738
-			$allowed_all = false;
789
+		{
790
+					$allowed_all = $topic_info['id_member_started'] == $user_info['id'];
791
+		}
792
+		else {
793
+					$allowed_all = false;
794
+		}
739 795
 
740 796
 		// Make sure they're allowed to delete their own messages, if not any.
741 797
 		if (!$allowed_all)
742
-			isAllowedTo('delete_own');
798
+		{
799
+					isAllowedTo('delete_own');
800
+		}
743 801
 
744 802
 		// Allowed to remove which messages?
745 803
 		$messages = determineRemovableMessages($topic, $messages, $allowed_all);
@@ -754,10 +812,14 @@  discard block
 block discarded – undo
754 812
 		{
755 813
 			// Just skip the first message - if it's not the last.
756 814
 			if ($message == $first_message && $message != $last_message)
757
-				continue;
815
+			{
816
+							continue;
817
+			}
758 818
 			// If the first message is going then don't bother going back to the topic as we're effectively deleting it.
759 819
 			elseif ($message == $first_message)
760
-				$topicGone = true;
820
+			{
821
+							$topicGone = true;
822
+			}
761 823
 
762 824
 			$remover->removeMessage($message);
763 825
 		}
@@ -782,20 +844,28 @@  discard block
 block discarded – undo
782 844
 
783 845
 		// If the query returned false, bail.
784 846
 		if ($messages_request === false)
785
-			return false;
847
+		{
848
+					return false;
849
+		}
786 850
 
787 851
 		// Remember which message this is.  (ie. reply #83)
788 852
 		if ($counter === null || $reset)
789
-			$counter = $context['start'];
853
+		{
854
+					$counter = $context['start'];
855
+		}
790 856
 
791 857
 		// Start from the beginning...
792 858
 		if ($reset)
793
-			return currentContext($messages_request, $reset);
859
+		{
860
+					return currentContext($messages_request, $reset);
861
+		}
794 862
 
795 863
 		// Attempt to get the next message.
796 864
 		$message = currentContext($messages_request);
797 865
 		if (!$message)
798
-			return false;
866
+		{
867
+					return false;
868
+		}
799 869
 
800 870
 		// If you're a lazy bum, you probably didn't give a subject...
801 871
 		$message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
@@ -901,7 +971,9 @@  discard block
 block discarded – undo
901 971
 		);
902 972
 
903 973
 		if (!empty($output['modified']['name']))
904
-			$output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name'], standardTime($output['modified']['timestamp']));
974
+		{
975
+					$output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name'], standardTime($output['modified']['timestamp']));
976
+		}
905 977
 
906 978
 		if (!empty($output['member']['karma']['allow']))
907 979
 		{
Please login to merge, or discard this patch.
sources/controllers/Likes.controller.php 2 patches
Braces   +54 added lines, -25 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
 		// If likes are disabled, we don't go any further
41 41
 		if (empty($modSettings['likes_enabled']))
42
-			throw new Elk_Exception('feature_disabled', true);
42
+		{
43
+					throw new Elk_Exception('feature_disabled', true);
44
+		}
43 45
 	}
44 46
 
45 47
 	/**
@@ -182,9 +184,12 @@  discard block
 block discarded – undo
182 184
 
183 185
 		// No longer liked, return to whence you came
184 186
 		if (!isset($this->_req->query->profile))
185
-			redirectexit('topic=' . $topic . '.msg' . $this->_id_liked . '#msg' . $this->_id_liked);
186
-		else
187
-			redirectexit('action=profile;area=showlikes;sa=given;u=' . $user_info['id']);
187
+		{
188
+					redirectexit('topic=' . $topic . '.msg' . $this->_id_liked . '#msg' . $this->_id_liked);
189
+		}
190
+		else {
191
+					redirectexit('action=profile;area=showlikes;sa=given;u=' . $user_info['id']);
192
+		}
188 193
 	}
189 194
 
190 195
 	/**
@@ -249,7 +254,9 @@  discard block
 block discarded – undo
249 254
 
250 255
 		// Past the post threshold?
251 256
 		if (!$user_info['is_admin'] && !empty($modSettings['likeMinPosts']) && $user_info['posts'] < $modSettings['likeMinPosts'])
252
-			$check = false;
257
+		{
258
+					$check = false;
259
+		}
253 260
 
254 261
 		// If they have exceeded their limits, provide a message for the ajax response
255 262
 		if ($check === false)
@@ -272,9 +279,12 @@  discard block
 block discarded – undo
272 279
 		require_once(SUBSDIR . '/Likes.subs.php');
273 280
 
274 281
 		if ($this->_req->getQuery('sa') === 'received')
275
-			$this->_action_showReceived();
276
-		else
277
-			$this->_action_showGiven();
282
+		{
283
+					$this->_action_showReceived();
284
+		}
285
+		else {
286
+					$this->_action_showGiven();
287
+		}
278 288
 	}
279 289
 
280 290
 	/**
@@ -636,7 +646,9 @@  discard block
 block discarded – undo
636 646
 
637 647
 		// Likes are not on, your quest for statistics ends here
638 648
 		if (empty($modSettings['likes_enabled']))
639
-			throw new Elk_Exception('feature_disabled', true);
649
+		{
650
+					throw new Elk_Exception('feature_disabled', true);
651
+		}
640 652
 
641 653
 		// And you can see the stats
642 654
 		isAllowedTo('like_posts_stats');
@@ -679,7 +691,9 @@  discard block
 block discarded – undo
679 691
 
680 692
 		// Likes are not on, your quest for statistics ends here
681 693
 		if (empty($modSettings['likes_enabled']))
682
-			throw new Elk_Exception('feature_disabled', true);
694
+		{
695
+					throw new Elk_Exception('feature_disabled', true);
696
+		}
683 697
 
684 698
 		// Worthy to view like statistics?
685 699
 		isAllowedTo('like_posts_stats');
@@ -734,9 +748,12 @@  discard block
 block discarded – undo
734 748
 
735 749
 		// Set the response
736 750
 		if (!empty($data))
737
-			$this->_likes_response = array('result' => true, 'data' => $data);
738
-		else
739
-			$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
751
+		{
752
+					$this->_likes_response = array('result' => true, 'data' => $data);
753
+		}
754
+		else {
755
+					$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
756
+		}
740 757
 
741 758
 		// Off we go
742 759
 		$this->likeResponse();
@@ -757,9 +774,12 @@  discard block
 block discarded – undo
757 774
 		$data = dbMostLikedTopic();
758 775
 
759 776
 		if (!empty($data))
760
-			$this->_likes_response = array('result' => true, 'data' => $data);
761
-		else
762
-			$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
777
+		{
778
+					$this->_likes_response = array('result' => true, 'data' => $data);
779
+		}
780
+		else {
781
+					$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
782
+		}
763 783
 
764 784
 		$this->likeResponse();
765 785
 	}
@@ -775,9 +795,12 @@  discard block
 block discarded – undo
775 795
 		$data = dbMostLikedBoard();
776 796
 
777 797
 		if (!empty($data))
778
-			$this->_likes_response = array('result' => true, 'data' => $data);
779
-		else
780
-			$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
798
+		{
799
+					$this->_likes_response = array('result' => true, 'data' => $data);
800
+		}
801
+		else {
802
+					$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
803
+		}
781 804
 
782 805
 		$this->likeResponse();
783 806
 	}
@@ -793,9 +816,12 @@  discard block
 block discarded – undo
793 816
 		$data = dbMostLikesReceivedUser();
794 817
 
795 818
 		if (!empty($data))
796
-			$this->_likes_response = array('result' => true, 'data' => $data);
797
-		else
798
-			$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
819
+		{
820
+					$this->_likes_response = array('result' => true, 'data' => $data);
821
+		}
822
+		else {
823
+					$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
824
+		}
799 825
 
800 826
 		$this->likeResponse();
801 827
 	}
@@ -812,9 +838,12 @@  discard block
 block discarded – undo
812 838
 		$data = dbMostLikesGivenUser();
813 839
 
814 840
 		if (!empty($data))
815
-			$this->_likes_response = array('result' => true, 'data' => $data);
816
-		else
817
-			$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
841
+		{
842
+					$this->_likes_response = array('result' => true, 'data' => $data);
843
+		}
844
+		else {
845
+					$this->_likes_response = array('result' => false, 'error' => $txt['like_post_error_something_wrong']);
846
+		}
818 847
 		$this->likeResponse();
819 848
 	}
820 849
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 						'class' => 'centertext',
351 351
 					),
352 352
 					'data' => array(
353
-						'function' => function ($row) {
353
+						'function' => function($row) {
354 354
 							global $txt;
355 355
 
356 356
 							$result = '<a href="' . $row['delete'] . '" onclick="return confirm(\'' . $txt['likes_confirm_delete'] . '\');" title="' . $txt['likes_delete'] . '"><i class="icon i-delete"></i></a>';
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 						'class' => 'centertext',
453 453
 					),
454 454
 					'data' => array(
455
-						'function' => function ($row) {
455
+						'function' => function($row) {
456 456
 							global $txt;
457 457
 
458 458
 							$result = '<a href="' . $row['who'] . '" title="' . $txt['likes_show_who'] . '"><i class="icon i-users"></i></a>';
Please login to merge, or discard this patch.
sources/controllers/Attachment.controller.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -164,8 +164,9 @@  discard block
 block discarded – undo
164 164
 			}
165 165
 		}
166 166
 		// Could not find the files you claimed to have sent
167
-		else
168
-			$context['json_data'] = array('result' => false, 'data' => $txt['no_files_uploaded']);
167
+		else {
168
+					$context['json_data'] = array('result' => false, 'data' => $txt['no_files_uploaded']);
169
+		}
169 170
 	}
170 171
 
171 172
 	/**
@@ -298,7 +299,9 @@  discard block
 block discarded – undo
298 299
 		if (!isset($this->_req->query->attach))
299 300
 		{
300 301
 			if (!isset($this->_req->query->id))
301
-				$this->action_no_attach();
302
+			{
303
+							$this->action_no_attach();
304
+			}
302 305
 
303 306
 			if ($this->_req->query->id === 'ila')
304 307
 			{
@@ -413,7 +416,9 @@  discard block
 block discarded – undo
413 416
 
414 417
 		// If it isn't yet approved, do they have permission to view it?
415 418
 		if (!$is_approved && ($id_member == 0 || $user_info['id'] != $id_member) && ($attachment_type == 0 || $attachment_type == 3))
416
-			isAllowedTo('approve_posts', $id_board);
419
+		{
420
+					isAllowedTo('approve_posts', $id_board);
421
+		}
417 422
 
418 423
 		// Update the download counter (unless it's a thumbnail or an avatar).
419 424
 		if (!empty($id_attach) && empty($is_avatar) || $attachment_type != 3)
@@ -442,7 +447,9 @@  discard block
 block discarded – undo
442 447
 		{
443 448
 			$mime_type = '';
444 449
 			if (isset($this->_req->query->image))
445
-				unset($this->_req->query->image);
450
+			{
451
+							unset($this->_req->query->image);
452
+			}
446 453
 		}
447 454
 
448 455
 		$this->_send_headers($filename, $eTag, $mime_type, $use_compression, $disposition, $real_filename, $do_cache);
@@ -548,7 +555,9 @@  discard block
 block discarded – undo
548 555
 
549 556
 				// If it isn't yet approved, do they have permission to view it?
550 557
 				if (!$is_approved && ($id_member == 0 || $user_info['id'] != $id_member) && ($attachment_type == 0 || $attachment_type == 3))
551
-					isAllowedTo('approve_posts');
558
+				{
559
+									isAllowedTo('approve_posts');
560
+				}
552 561
 
553 562
 				$filename = getAttachmentFilename($real_filename, $id_attach, $id_folder, false, $file_hash);
554 563
 			}
@@ -663,7 +672,9 @@  discard block
 block discarded – undo
663 672
 		// Send as UTF-8 if the name requires that
664 673
 		$altName = '';
665 674
 		if (preg_match('~[\x80-\xFF]~', $filename))
666
-			$altName = "; filename*=UTF-8''" . rawurlencode($filename);
675
+		{
676
+					$altName = "; filename*=UTF-8''" . rawurlencode($filename);
677
+		}
667 678
 
668 679
 		header('Content-Disposition: ' . $disposition . '; filename="' . $filename . '"' . $altName);
669 680
 
Please login to merge, or discard this patch.
sources/controllers/Mentions.controller.php 2 patches
Braces   +57 added lines, -21 removed lines patch added patch discarded remove patch
@@ -135,7 +135,9 @@  discard block
 block discarded – undo
135 135
 		global $modSettings;
136 136
 
137 137
 		if (empty($modSettings['enabled_mentions']))
138
-			return array();
138
+		{
139
+					return array();
140
+		}
139 141
 
140 142
 		return array_filter(array_unique(explode(',', $modSettings['enabled_mentions'])));
141 143
 	}
@@ -150,7 +152,9 @@  discard block
 block discarded – undo
150 152
 
151 153
 		// I'm not sure this is needed, though better have it. :P
152 154
 		if (empty($modSettings['mentions_enabled']))
153
-			throw new Elk_Exception('no_access', false);
155
+		{
156
+					throw new Elk_Exception('no_access', false);
157
+		}
154 158
 
155 159
 		Elk_Autoloader::instance()->register(SUBSDIR . '/MentionType', '\\ElkArte\\sources\\subs\\MentionType');
156 160
 
@@ -343,10 +347,12 @@  discard block
 block discarded – undo
343 347
 		);
344 348
 
345 349
 		if (!empty($this->_type))
346
-			$context['linktree'][] = array(
350
+		{
351
+					$context['linktree'][] = array(
347 352
 				'url' => $scripturl . '?action=mentions;type=' . $this->_type,
348 353
 				'name' => $txt['mentions_type_' . $this->_type],
349 354
 			);
355
+		}
350 356
 	}
351 357
 
352 358
 	/**
@@ -360,7 +366,9 @@  discard block
 block discarded – undo
360 366
 		global $user_info, $context, $txt, $modSettings, $scripturl;
361 367
 
362 368
 		if (empty($modSettings['usernotif_favicon_enable']) && empty($modSettings['usernotif_desktop_enable']))
363
-			die();
369
+		{
370
+					die();
371
+		}
364 372
 
365 373
 		loadTemplate('Json');
366 374
 		$context['sub_template'] = 'send_json';
@@ -438,22 +446,29 @@  discard block
 block discarded – undo
438 446
 			foreach ($possible_mentions as $mention)
439 447
 			{
440 448
 				if (count($mentions) < $limit)
441
-					$mentions[] = $mention;
442
-				else
443
-					break;
449
+				{
450
+									$mentions[] = $mention;
451
+				}
452
+				else {
453
+									break;
454
+				}
444 455
 			}
445 456
 			$round++;
446 457
 
447 458
 			// If nothing has been removed OR there are not enough
448 459
 			if (count($mentions) != $count_possible || count($mentions) == $limit || ($totalMentions - $start < $limit))
449
-				break;
460
+			{
461
+							break;
462
+			}
450 463
 
451 464
 			// Let's start a bit further into the list
452 465
 			$start += $limit;
453 466
 		}
454 467
 
455 468
 		if ($round !== 0)
456
-			countUserMentions();
469
+		{
470
+					countUserMentions();
471
+		}
457 472
 
458 473
 		return $mentions;
459 474
 	}
@@ -489,13 +504,17 @@  discard block
 block discarded – undo
489 504
 
490 505
 		// Common checks to determine if we can go on
491 506
 		if (!$this->_isValid())
492
-			return;
507
+		{
508
+					return;
509
+		}
493 510
 
494 511
 		// Cleanup, validate and remove the invalid values (0 and $user_info['id'])
495 512
 		$id_target = array_diff(array_map('intval', array_unique($this->_validator->uid)), array(0, $user_info['id']));
496 513
 
497 514
 		if (empty($id_target))
498
-			return false;
515
+		{
516
+					return false;
517
+		}
499 518
 
500 519
 		addMentions($user_info['id'], $id_target, $this->_validator->msg, $this->_validator->type, $this->_validator->log_time, $this->_data['status']);
501 520
 	}
@@ -510,13 +529,17 @@  discard block
 block discarded – undo
510 529
 
511 530
 		// Common checks to determine if we can go on
512 531
 		if (!$this->_isValid())
513
-			return;
532
+		{
533
+					return;
534
+		}
514 535
 
515 536
 		// Cleanup, validate and remove the invalid values (0 and $user_info['id'])
516 537
 		$id_target = array_diff(array_map('intval', array_unique($this->_validator->uid)), array(0, $user_info['id']));
517 538
 
518 539
 		if (empty($id_target))
519
-			return false;
540
+		{
541
+					return false;
542
+		}
520 543
 
521 544
 		rlikeMentions($user_info['id'], $id_target, $this->_validator->msg);
522 545
 	}
@@ -539,13 +562,18 @@  discard block
 block discarded – undo
539 562
 			);
540 563
 
541 564
 			if (isset($data['id_member_from']))
542
-				$this->_data['id_member_from'] = $data['id_member_from'];
565
+			{
566
+							$this->_data['id_member_from'] = $data['id_member_from'];
567
+			}
543 568
 
544 569
 			if (isset($data['log_time']))
545
-				$this->_data['log_time'] = $data['log_time'];
570
+			{
571
+							$this->_data['log_time'] = $data['log_time'];
572
+			}
573
+		}
574
+		else {
575
+					$this->_data = $data;
546 576
 		}
547
-		else
548
-			$this->_data = $data;
549 577
 	}
550 578
 
551 579
 	/**
@@ -560,7 +588,9 @@  discard block
 block discarded – undo
560 588
 
561 589
 		// Common checks to determine if we can go on
562 590
 		if (!$this->_isAccessible())
563
-			return;
591
+		{
592
+					return;
593
+		}
564 594
 
565 595
 		$this->_buildUrl();
566 596
 
@@ -617,7 +647,9 @@  discard block
 block discarded – undo
617 647
 	protected function _markMentionsRead($mention_ids)
618 648
 	{
619 649
 		if (empty($mention_ids))
620
-			return;
650
+		{
651
+					return;
652
+		}
621 653
 
622 654
 		foreach ($mention_ids as $mention)
623 655
 		{
@@ -627,7 +659,9 @@  discard block
 block discarded – undo
627 659
 			));
628 660
 
629 661
 			if ($this->_isAccessible())
630
-				changeMentionStatus($this->_validator->id_mention, $this->_known_status['read']);
662
+			{
663
+							changeMentionStatus($this->_validator->id_mention, $this->_known_status['read']);
664
+			}
631 665
 		}
632 666
 	}
633 667
 
@@ -700,7 +734,9 @@  discard block
 block discarded – undo
700 734
 		$this->_validator->validation_rules($validation);
701 735
 
702 736
 		if (!$this->_validator->validate($this->_data))
703
-			return false;
737
+		{
738
+					return false;
739
+		}
704 740
 
705 741
 		// If everything is fine, let's include our helper functions and prepare for the fun!
706 742
 		require_once(SUBSDIR . '/Mentions.subs.php');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 						'value' => $txt['mentions_from'],
231 231
 					),
232 232
 					'data' => array(
233
-						'function' => function ($row) {
233
+						'function' => function($row) {
234 234
 							global $settings, $scripturl;
235 235
 
236 236
 							if (isset($settings['mentions']['mentioner_template']))
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 						'class' => 'listaction grid8',
291 291
 					),
292 292
 					'data' => array(
293
-						'function' => function ($row) {
293
+						'function' => function($row) {
294 294
 							global $txt, $settings, $context, $scripturl;
295 295
 
296 296
 							$mark = empty($row['status']) ? 'read' : 'unread';
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 		else
473 473
 		{
474
-			$to_register = array_map(function ($name) {
474
+			$to_register = array_map(function($name) {
475 475
 				return '\\ElkArte\\sources\\subs\\MentionType\\' . ucfirst($name) . '_Mention';
476 476
 			}, $this->_known_mentions);
477 477
 		}
Please login to merge, or discard this patch.