Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/subs/PersonalMessage.subs.php 1 patch
Braces   +248 added lines, -91 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 	$message_limit = 0;
34 34
 	if ($user_info['is_admin'])
35
-		$message_limit = 0;
35
+	{
36
+			$message_limit = 0;
37
+	}
36 38
 	elseif (!Cache::instance()->getVar($message_limit, 'msgLimit:' . $user_info['id'], 360))
37 39
 	{
38 40
 		$request = $db->query('', '
@@ -173,25 +175,36 @@  discard block
 block discarded – undo
173 175
 	$db = database();
174 176
 
175 177
 	if ($owner === null)
176
-		$owner = array($user_info['id']);
178
+	{
179
+			$owner = array($user_info['id']);
180
+	}
177 181
 	elseif (empty($owner))
178
-		return;
182
+	{
183
+			return;
184
+	}
179 185
 	elseif (!is_array($owner))
180
-		$owner = array($owner);
186
+	{
187
+			$owner = array($owner);
188
+	}
181 189
 
182 190
 	if ($personal_messages !== null)
183 191
 	{
184 192
 		if (empty($personal_messages) || !is_array($personal_messages))
185
-			return;
193
+		{
194
+					return;
195
+		}
186 196
 
187 197
 		foreach ($personal_messages as $index => $delete_id)
188
-			$personal_messages[$index] = (int) $delete_id;
198
+		{
199
+					$personal_messages[$index] = (int) $delete_id;
200
+		}
189 201
 
190 202
 		$where = '
191 203
 				AND id_pm IN ({array_int:pm_list})';
192 204
 	}
193
-	else
194
-		$where = '';
205
+	else {
206
+			$where = '';
207
+	}
195 208
 
196 209
 	if ($folder == 'sent' || $folder === null)
197 210
 	{
@@ -229,16 +242,21 @@  discard block
 block discarded – undo
229 242
 		while ($row = $db->fetch_assoc($request))
230 243
 		{
231 244
 			if ($row['is_read'])
232
-				updateMemberData($row['id_member'], array('personal_messages' => $where == '' ? 0 : 'personal_messages - ' . $row['num_deleted_messages']));
233
-			else
234
-				updateMemberData($row['id_member'], array('personal_messages' => $where == '' ? 0 : 'personal_messages - ' . $row['num_deleted_messages'], 'unread_messages' => $where == '' ? 0 : 'unread_messages - ' . $row['num_deleted_messages']));
245
+			{
246
+							updateMemberData($row['id_member'], array('personal_messages' => $where == '' ? 0 : 'personal_messages - ' . $row['num_deleted_messages']));
247
+			}
248
+			else {
249
+							updateMemberData($row['id_member'], array('personal_messages' => $where == '' ? 0 : 'personal_messages - ' . $row['num_deleted_messages'], 'unread_messages' => $where == '' ? 0 : 'unread_messages - ' . $row['num_deleted_messages']));
250
+			}
235 251
 
236 252
 			// If this is the current member we need to make their message count correct.
237 253
 			if ($user_info['id'] == $row['id_member'])
238 254
 			{
239 255
 				$user_info['messages'] -= $row['num_deleted_messages'];
240 256
 				if (!($row['is_read']))
241
-					$user_info['unread_messages'] -= $row['num_deleted_messages'];
257
+				{
258
+									$user_info['unread_messages'] -= $row['num_deleted_messages'];
259
+				}
242 260
 			}
243 261
 		}
244 262
 		$db->free_result($request);
@@ -276,7 +294,9 @@  discard block
 block discarded – undo
276 294
 	);
277 295
 	$remove_pms = array();
278 296
 	while ($row = $db->fetch_assoc($request))
279
-		$remove_pms[] = $row['sender'];
297
+	{
298
+			$remove_pms[] = $row['sender'];
299
+	}
280 300
 	$db->free_result($request);
281 301
 
282 302
 	if (!empty($remove_pms))
@@ -317,10 +337,14 @@  discard block
 block discarded – undo
317 337
 	$db = database();
318 338
 
319 339
 	if ($owner === null)
320
-		$owner = $user_info['id'];
340
+	{
341
+			$owner = $user_info['id'];
342
+	}
321 343
 
322 344
 	if (!is_null($personal_messages) && !is_array($personal_messages))
323
-		$personal_messages = array($personal_messages);
345
+	{
346
+			$personal_messages = array($personal_messages);
347
+	}
324 348
 
325 349
 	$db->query('', '
326 350
 		UPDATE {db_prefix}pm_recipients
@@ -338,8 +362,10 @@  discard block
 block discarded – undo
338 362
 
339 363
 	// If something wasn't marked as read, get the number of unread messages remaining.
340 364
 	if ($db->affected_rows() > 0)
341
-		updatePMMenuCounts($owner);
342
-}
365
+	{
366
+			updatePMMenuCounts($owner);
367
+	}
368
+	}
343 369
 
344 370
 /**
345 371
  * Mark the specified personal messages as unread.
@@ -354,10 +380,14 @@  discard block
 block discarded – undo
354 380
 	$db = database();
355 381
 
356 382
 	if (empty($personal_messages))
357
-		return;
383
+	{
384
+			return;
385
+	}
358 386
 
359 387
 	if (!is_array($personal_messages))
360
-		$personal_messages = array($personal_messages);
388
+	{
389
+			$personal_messages = array($personal_messages);
390
+	}
361 391
 
362 392
 	$owner = $user_info['id'];
363 393
 
@@ -376,8 +406,10 @@  discard block
 block discarded – undo
376 406
 
377 407
 	// If something was marked unread, update the number of unread messages remaining.
378 408
 	if ($db->affected_rows() > 0)
379
-		updatePMMenuCounts($owner);
380
-}
409
+	{
410
+			updatePMMenuCounts($owner);
411
+	}
412
+	}
381 413
 
382 414
 /**
383 415
  * Updates the number of unread messages for a user
@@ -396,7 +428,9 @@  discard block
 block discarded – undo
396 428
 	if ($owner == $user_info['id'])
397 429
 	{
398 430
 		foreach ($context['labels'] as $label)
399
-			$context['labels'][(int) $label['id']]['unread_messages'] = 0;
431
+		{
432
+					$context['labels'][(int) $label['id']]['unread_messages'] = 0;
433
+		}
400 434
 	}
401 435
 
402 436
 	$result = $db->query('', '
@@ -418,11 +452,15 @@  discard block
 block discarded – undo
418 452
 		$total_unread += $row['num'];
419 453
 
420 454
 		if ($owner != $user_info['id'])
421
-			continue;
455
+		{
456
+					continue;
457
+		}
422 458
 
423 459
 		$this_labels = explode(',', $row['labels']);
424 460
 		foreach ($this_labels as $this_label)
425
-			$context['labels'][(int) $this_label]['unread_messages'] += $row['num'];
461
+		{
462
+					$context['labels'][(int) $this_label]['unread_messages'] += $row['num'];
463
+		}
426 464
 	}
427 465
 	$db->free_result($result);
428 466
 
@@ -433,8 +471,10 @@  discard block
 block discarded – undo
433 471
 
434 472
 	// If it was for the current member, reflect this in the $user_info array too.
435 473
 	if ($owner == $user_info['id'])
436
-		$user_info['unread_messages'] = $total_unread;
437
-}
474
+	{
475
+			$user_info['unread_messages'] = $total_unread;
476
+	}
477
+	}
438 478
 
439 479
 /**
440 480
  * Check if the PM is available to the current user.
@@ -522,14 +562,17 @@  discard block
 block discarded – undo
522 562
 	);
523 563
 
524 564
 	if ($from === null)
525
-		$from = array(
565
+	{
566
+			$from = array(
526 567
 			'id' => $user_info['id'],
527 568
 			'name' => $user_info['name'],
528 569
 			'username' => $user_info['username']
529 570
 		);
571
+	}
530 572
 	// Probably not needed.  /me something should be of the typer.
531
-	else
532
-		$user_info['name'] = $from['name'];
573
+	else {
574
+			$user_info['name'] = $from['name'];
575
+	}
533 576
 
534 577
 	// Integrated PMs
535 578
 	call_integration_hook('integrate_personal_message', array(&$recipients, &$from, &$subject, &$message));
@@ -539,11 +582,15 @@  discard block
 block discarded – undo
539 582
 	preparsecode($htmlmessage);
540 583
 	$htmlsubject = strtr(Util::htmlspecialchars($subject), array("\r" => '', "\n" => '', "\t" => ''));
541 584
 	if (Util::strlen($htmlsubject) > 100)
542
-		$htmlsubject = Util::substr($htmlsubject, 0, 100);
585
+	{
586
+			$htmlsubject = Util::substr($htmlsubject, 0, 100);
587
+	}
543 588
 
544 589
 	// Make sure is an array
545 590
 	if (!is_array($recipients))
546
-		$recipients = array($recipients);
591
+	{
592
+			$recipients = array($recipients);
593
+	}
547 594
 
548 595
 	// Get a list of usernames and convert them to IDs.
549 596
 	$usernames = array();
@@ -571,8 +618,10 @@  discard block
 block discarded – undo
571 618
 			)
572 619
 		);
573 620
 		while ($row = $db->fetch_assoc($request))
574
-			if (isset($usernames[Util::strtolower($row['member_name'])]))
621
+		{
622
+					if (isset($usernames[Util::strtolower($row['member_name'])]))
575 623
 				$usernames[Util::strtolower($row['member_name'])] = $row['id_member'];
624
+		}
576 625
 		$db->free_result($request);
577 626
 
578 627
 		// Replace the usernames with IDs. Drop usernames that couldn't be found.
@@ -581,10 +630,14 @@  discard block
 block discarded – undo
581 630
 			foreach ($rec as $id => $member)
582 631
 			{
583 632
 				if (is_numeric($recipients[$rec_type][$id]))
584
-					continue;
633
+				{
634
+									continue;
635
+				}
585 636
 
586 637
 				if (!empty($usernames[$member]))
587
-					$recipients[$rec_type][$id] = $usernames[$member];
638
+				{
639
+									$recipients[$rec_type][$id] = $usernames[$member];
640
+				}
588 641
 				else
589 642
 				{
590 643
 					$log['failed'][$id] = sprintf($txt['pm_error_user_not_found'], $recipients[$rec_type][$id]);
@@ -626,7 +679,9 @@  discard block
 block discarded – undo
626 679
 		foreach ($criteria as $criterium)
627 680
 		{
628 681
 			if (($criterium['t'] == 'mid' && $criterium['v'] == $from['id']) || ($criterium['t'] == 'gid' && in_array($criterium['v'], $user_info['groups'])) || ($criterium['t'] == 'sub' && strpos($subject, $criterium['v']) !== false) || ($criterium['t'] == 'msg' && strpos($message, $criterium['v']) !== false))
629
-				$delete = true;
682
+			{
683
+							$delete = true;
684
+			}
630 685
 			// If we're adding and one criteria don't match then we stop!
631 686
 			elseif (!$row['is_or'])
632 687
 			{
@@ -635,7 +690,9 @@  discard block
 block discarded – undo
635 690
 			}
636 691
 		}
637 692
 		if ($delete)
638
-			$deletes[$row['id_member']] = 1;
693
+		{
694
+					$deletes[$row['id_member']] = 1;
695
+		}
639 696
 	}
640 697
 	$db->free_result($request);
641 698
 
@@ -651,7 +708,9 @@  discard block
 block discarded – undo
651 708
 			)
652 709
 		);
653 710
 		while ($row = $db->fetch_assoc($request))
654
-			$message_limit_cache[$row['id_group']] = $row['max_messages'];
711
+		{
712
+					$message_limit_cache[$row['id_group']] = $row['max_messages'];
713
+		}
655 714
 		$db->free_result($request);
656 715
 	}
657 716
 
@@ -672,15 +731,20 @@  discard block
 block discarded – undo
672 731
 	while ($row = $db->fetch_assoc($request))
673 732
 	{
674 733
 		if (empty($row['add_deny']))
675
-			$disallowed_groups[] = $row['id_group'];
676
-		else
677
-			$allowed_groups[] = $row['id_group'];
734
+		{
735
+					$disallowed_groups[] = $row['id_group'];
736
+		}
737
+		else {
738
+					$allowed_groups[] = $row['id_group'];
739
+		}
678 740
 	}
679 741
 
680 742
 	$db->free_result($request);
681 743
 
682 744
 	if (empty($modSettings['permission_enable_deny']))
683
-		$disallowed_groups = array();
745
+	{
746
+			$disallowed_groups = array();
747
+	}
684 748
 
685 749
 	$request = $db->query('', '
686 750
 		SELECT
@@ -709,7 +773,9 @@  discard block
 block discarded – undo
709 773
 	{
710 774
 		// Don't do anything for members to be deleted!
711 775
 		if (isset($deletes[$row['id_member']]))
712
-			continue;
776
+		{
777
+					continue;
778
+		}
713 779
 
714 780
 		// We need to know this members groups.
715 781
 		$groups = explode(',', $row['additional_groups']);
@@ -724,7 +790,9 @@  discard block
 block discarded – undo
724 790
 			foreach ($groups as $id)
725 791
 			{
726 792
 				if (isset($message_limit_cache[$id]) && $message_limit != 0 && $message_limit < $message_limit_cache[$id])
727
-					$message_limit = $message_limit_cache[$id];
793
+				{
794
+									$message_limit = $message_limit_cache[$id];
795
+				}
728 796
 			}
729 797
 
730 798
 			if ($message_limit > 0 && $message_limit <= $row['personal_messages'])
@@ -761,7 +829,9 @@  discard block
 block discarded – undo
761 829
 
762 830
 		// Send a notification, if enabled - taking the buddy list into account.
763 831
 		if (!empty($row['email_address']) && ($row['pm_email_notify'] == 1 || ($row['pm_email_notify'] > 1 && (!empty($modSettings['enable_buddylist']) && $row['is_buddy']))) && $row['is_activated'] == 1)
764
-			$notifications[empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile']][] = $row['email_address'];
832
+		{
833
+					$notifications[empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile']][] = $row['email_address'];
834
+		}
765 835
 
766 836
 		$log['sent'][$row['id_member']] = sprintf(isset($txt['pm_successfully_sent']) ? $txt['pm_successfully_sent'] : '', $row['real_name']);
767 837
 	}
@@ -769,11 +839,15 @@  discard block
 block discarded – undo
769 839
 
770 840
 	// Only 'send' the message if there are any recipients left.
771 841
 	if (empty($all_to))
772
-		return $log;
842
+	{
843
+			return $log;
844
+	}
773 845
 
774 846
 	// Track the pm count for our stats
775 847
 	if (!empty($modSettings['trackStats']))
776
-		trackStats(array('pm' => '+'));
848
+	{
849
+			trackStats(array('pm' => '+'));
850
+	}
777 851
 
778 852
 	// Insert the message itself and then grab the last insert id.
779 853
 	$db->insert('',
@@ -796,7 +870,8 @@  discard block
 block discarded – undo
796 870
 	{
797 871
 		// If this is new we need to set it part of it's own conversation.
798 872
 		if (empty($pm_head))
799
-			$db->query('', '
873
+		{
874
+					$db->query('', '
800 875
 				UPDATE {db_prefix}personal_messages
801 876
 				SET id_pm_head = {int:id_pm_head}
802 877
 				WHERE id_pm = {int:id_pm_head}',
@@ -804,6 +879,7 @@  discard block
 block discarded – undo
804 879
 					'id_pm_head' => $id_pm,
805 880
 				)
806 881
 			);
882
+		}
807 883
 
808 884
 		// Some people think manually deleting personal_messages is fun... it's not. We protect against it though :)
809 885
 		$db->query('', '
@@ -819,7 +895,9 @@  discard block
 block discarded – undo
819 895
 		{
820 896
 			$insertRows[] = array($id_pm, $to, in_array($to, $recipients['bcc']) ? 1 : 0, isset($deletes[$to]) ? 1 : 0, 1);
821 897
 			if (!in_array($to, $recipients['bcc']))
822
-				$to_list[] = $to;
898
+			{
899
+							$to_list[] = $to;
900
+			}
823 901
 		}
824 902
 
825 903
 		$db->insert('insert',
@@ -852,7 +930,9 @@  discard block
 block discarded – undo
852 930
 		require_once(SUBSDIR . '/Members.subs.php');
853 931
 		$result = getBasicMemberData($to_list);
854 932
 		foreach ($result as $row)
855
-			$to_names[] = un_htmlspecialchars($row['real_name']);
933
+		{
934
+					$to_names[] = un_htmlspecialchars($row['real_name']);
935
+		}
856 936
 	}
857 937
 
858 938
 	$replacements = array(
@@ -901,7 +981,9 @@  discard block
 block discarded – undo
901 981
 	foreach ($all_to as $k => $id)
902 982
 	{
903 983
 		if (isset($deletes[$id]))
904
-			unset($all_to[$k]);
984
+		{
985
+					unset($all_to[$k]);
986
+		}
905 987
 	}
906 988
 
907 989
 	if (!empty($all_to))
@@ -969,7 +1051,9 @@  discard block
 block discarded – undo
969 1051
 			);
970 1052
 			$sub_pms = array();
971 1053
 			while ($row = $db->fetch_assoc($sub_request))
972
-				$sub_pms[$row['id_pm_head']] = $row['sort_param'];
1054
+			{
1055
+							$sub_pms[$row['id_pm_head']] = $row['sort_param'];
1056
+			}
973 1057
 			$db->free_result($sub_request);
974 1058
 
975 1059
 			// Now we use those results in the next query
@@ -1062,7 +1146,9 @@  discard block
 block discarded – undo
1062 1146
 		if (!isset($recipients[$row['id_pm']]))
1063 1147
 		{
1064 1148
 			if (isset($row['id_member_from']))
1065
-				$posters[$row['id_pm']] = $row['id_member_from'];
1149
+			{
1150
+							$posters[$row['id_pm']] = $row['id_member_from'];
1151
+			}
1066 1152
 
1067 1153
 			$pms[$row['id_pm']] = $row['id_pm'];
1068 1154
 
@@ -1074,10 +1160,12 @@  discard block
 block discarded – undo
1074 1160
 
1075 1161
 		// Keep track of the last message so we know what the head is without another query!
1076 1162
 		if ((empty($pm_options['pmid']) && (empty($options['view_newest_pm_first']) || !isset($lastData))) || empty($lastData) || (!empty($pm_options['pmid']) && $pm_options['pmid'] == $row['id_pm']))
1077
-			$lastData = array(
1163
+		{
1164
+					$lastData = array(
1078 1165
 				'id' => $row['id_pm'],
1079 1166
 				'head' => $row['id_pm_head'],
1080 1167
 			);
1168
+		}
1081 1169
 	}
1082 1170
 	$db->free_result($request);
1083 1171
 
@@ -1132,7 +1220,9 @@  discard block
 block discarded – undo
1132 1220
 
1133 1221
 	// No rules?
1134 1222
 	if (empty($context['rules']))
1135
-		return;
1223
+	{
1224
+			return;
1225
+	}
1136 1226
 
1137 1227
 	// Just unread ones?
1138 1228
 	$ruleQuery = $all_messages ? '' : ' AND pmr.is_new = 1';
@@ -1164,7 +1254,9 @@  discard block
 block discarded – undo
1164 1254
 			foreach ($rule['criteria'] as $criterium)
1165 1255
 			{
1166 1256
 				if (($criterium['t'] == 'mid' && $criterium['v'] == $row['id_member_from']) || ($criterium['t'] == 'gid' && $criterium['v'] == $row['id_group']) || ($criterium['t'] == 'sub' && strpos($row['subject'], $criterium['v']) !== false) || ($criterium['t'] == 'msg' && strpos($row['body'], $criterium['v']) !== false))
1167
-					$match = true;
1257
+				{
1258
+									$match = true;
1259
+				}
1168 1260
 				// If we're adding and one criteria don't match then we stop!
1169 1261
 				elseif ($rule['logic'] == 'and')
1170 1262
 				{
@@ -1177,7 +1269,9 @@  discard block
 block discarded – undo
1177 1269
 			if ($match)
1178 1270
 			{
1179 1271
 				if ($rule['delete'])
1180
-					$actions['deletes'][] = $row['id_pm'];
1272
+				{
1273
+									$actions['deletes'][] = $row['id_pm'];
1274
+				}
1181 1275
 				else
1182 1276
 				{
1183 1277
 					foreach ($rule['actions'] as $ruleAction)
@@ -1186,7 +1280,9 @@  discard block
 block discarded – undo
1186 1280
 						{
1187 1281
 							// Get a basic pot started!
1188 1282
 							if (!isset($actions['labels'][$row['id_pm']]))
1189
-								$actions['labels'][$row['id_pm']] = empty($row['labels']) ? array() : explode(',', $row['labels']);
1283
+							{
1284
+															$actions['labels'][$row['id_pm']] = empty($row['labels']) ? array() : explode(',', $row['labels']);
1285
+							}
1190 1286
 
1191 1287
 							$actions['labels'][$row['id_pm']][] = $ruleAction['v'];
1192 1288
 						}
@@ -1199,7 +1295,9 @@  discard block
 block discarded – undo
1199 1295
 
1200 1296
 	// Deletes are easy!
1201 1297
 	if (!empty($actions['deletes']))
1202
-		deleteMessages($actions['deletes']);
1298
+	{
1299
+			deleteMessages($actions['deletes']);
1300
+	}
1203 1301
 
1204 1302
 	// Re-label?
1205 1303
 	if (!empty($actions['labels']))
@@ -1209,8 +1307,10 @@  discard block
 block discarded – undo
1209 1307
 			// Quickly check each label is valid!
1210 1308
 			$realLabels = array();
1211 1309
 			foreach ($context['labels'] as $label)
1212
-				if (in_array($label['id'], $labels) && ($label['id'] != -1 || empty($options['pm_remove_inbox_label'])))
1310
+			{
1311
+							if (in_array($label['id'], $labels) && ($label['id'] != -1 || empty($options['pm_remove_inbox_label'])))
1213 1312
 					$realLabels[] = $label['id'];
1313
+			}
1214 1314
 
1215 1315
 			$db->query('', '
1216 1316
 				UPDATE {db_prefix}pm_recipients
@@ -1240,7 +1340,9 @@  discard block
 block discarded – undo
1240 1340
 	$db = database();
1241 1341
 
1242 1342
 	if (isset($context['rules']) && !$reload)
1243
-		return;
1343
+	{
1344
+			return;
1345
+	}
1244 1346
 
1245 1347
 	// This is just a simple list of "all" known rules
1246 1348
 	$context['known_rules'] = array(
@@ -1279,7 +1381,9 @@  discard block
 block discarded – undo
1279 1381
 		);
1280 1382
 
1281 1383
 		if ($row['delete_pm'])
1282
-			$context['rules'][$row['id_rule']]['actions'][] = array('t' => 'del', 'v' => 1);
1384
+		{
1385
+					$context['rules'][$row['id_rule']]['actions'][] = array('t' => 'del', 'v' => 1);
1386
+		}
1283 1387
 	}
1284 1388
 	$db->free_result($request);
1285 1389
 }
@@ -1332,7 +1436,9 @@  discard block
 block discarded – undo
1332 1436
 	while ($row = $db->fetch_assoc($request))
1333 1437
 	{
1334 1438
 		if ($row['id_group'] != 1)
1335
-			$groups[$row['id_group']] = $row;
1439
+		{
1440
+					$groups[$row['id_group']] = $row;
1441
+		}
1336 1442
 	}
1337 1443
 	$db->free_result($request);
1338 1444
 
@@ -1360,7 +1466,9 @@  discard block
 block discarded – undo
1360 1466
 	);
1361 1467
 	$pm_heads = array();
1362 1468
 	while ($row = $db->fetch_assoc($request))
1363
-		$pm_heads[$row['id_pm_head']] = $row['id_pm'];
1469
+	{
1470
+			$pm_heads[$row['id_pm_head']] = $row['id_pm'];
1471
+	}
1364 1472
 	$db->free_result($request);
1365 1473
 
1366 1474
 	return $pm_heads;
@@ -1388,7 +1496,9 @@  discard block
 block discarded – undo
1388 1496
 	);
1389 1497
 	// Copy the action from the single to PM to the others.
1390 1498
 	while ($row = $db->fetch_assoc($request))
1391
-		$pms[$row['id_pm']] = $row['id_pm_head'];
1499
+	{
1500
+			$pms[$row['id_pm']] = $row['id_pm_head'];
1501
+	}
1392 1502
 	$db->free_result($request);
1393 1503
 
1394 1504
 	return $pms;
@@ -1432,24 +1542,34 @@  discard block
 block discarded – undo
1432 1542
 		$id_label = array_search($to_label[$row['id_pm']], $labels);
1433 1543
 
1434 1544
 		if ($id_label !== false && $label_type[$row['id_pm']] !== 'add')
1435
-			unset($labels[$id_label]);
1545
+		{
1546
+					unset($labels[$id_label]);
1547
+		}
1436 1548
 		elseif ($label_type[$row['id_pm']] !== 'rem')
1437
-			$labels[] = $to_label[$row['id_pm']];
1549
+		{
1550
+					$labels[] = $to_label[$row['id_pm']];
1551
+		}
1438 1552
 
1439 1553
 		if (!empty($options['pm_remove_inbox_label']) && $to_label[$row['id_pm']] != '-1' && ($key = array_search('-1', $labels)) !== false)
1440
-			unset($labels[$key]);
1554
+		{
1555
+					unset($labels[$key]);
1556
+		}
1441 1557
 
1442 1558
 		$set = implode(',', array_unique($labels));
1443 1559
 		if ($set == '')
1444
-			$set = '-1';
1560
+		{
1561
+					$set = '-1';
1562
+		}
1445 1563
 
1446 1564
 		$to_update[$row['id_pm']] = $set;
1447 1565
 	}
1448 1566
 	$db->free_result($request);
1449 1567
 
1450 1568
 	if (!empty($to_update))
1451
-		return updatePMLabels($to_update, $user_id);
1452
-}
1569
+	{
1570
+			return updatePMLabels($to_update, $user_id);
1571
+	}
1572
+	}
1453 1573
 
1454 1574
 /**
1455 1575
  * Detects personal messages which need a new label.
@@ -1487,22 +1607,29 @@  discard block
 block discarded – undo
1487 1607
 			if (in_array($value, $searchArray))
1488 1608
 			{
1489 1609
 				if (isset($new_labels[$value]))
1490
-					$toChange[$key] = $new_labels[$value];
1491
-				else
1492
-					unset($toChange[$key]);
1610
+				{
1611
+									$toChange[$key] = $new_labels[$value];
1612
+				}
1613
+				else {
1614
+									unset($toChange[$key]);
1615
+				}
1493 1616
 			}
1494 1617
 		}
1495 1618
 
1496 1619
 		if (empty($toChange))
1497
-			$toChange[] = '-1';
1620
+		{
1621
+					$toChange[] = '-1';
1622
+		}
1498 1623
 
1499 1624
 		$to_update[$row['id_pm']] = implode(',', array_unique($toChange));
1500 1625
 	}
1501 1626
 	$db->free_result($request);
1502 1627
 
1503 1628
 	if (!empty($to_update))
1504
-		return updatePMLabels($to_update, $user_id);
1505
-}
1629
+	{
1630
+			return updatePMLabels($to_update, $user_id);
1631
+	}
1632
+	}
1506 1633
 
1507 1634
 /**
1508 1635
  * Updates PMs with their new label.
@@ -1576,7 +1703,9 @@  discard block
 block discarded – undo
1576 1703
 		)
1577 1704
 	);
1578 1705
 	while ($row = $db->fetch_row($request))
1579
-		$pm_ids[] = $row[0];
1706
+	{
1707
+			$pm_ids[] = $row[0];
1708
+	}
1580 1709
 	$db->free_result($request);
1581 1710
 
1582 1711
 	// This is the inbox
@@ -1595,7 +1724,9 @@  discard block
 block discarded – undo
1595 1724
 		)
1596 1725
 	);
1597 1726
 	while ($row = $db->fetch_row($request))
1598
-		$pm_ids[] = $row[0];
1727
+	{
1728
+			$pm_ids[] = $row[0];
1729
+	}
1599 1730
 	$db->free_result($request);
1600 1731
 
1601 1732
 	return $pm_ids;
@@ -1770,15 +1901,21 @@  discard block
 block discarded – undo
1770 1901
 	{
1771 1902
 		// This is, frankly, a joke. We will put in a workaround for people sending to themselves - yawn!
1772 1903
 		if ($folder == 'sent' && $row['id_member_from'] == $user_info['id'] && $row['deleted_by_sender'] == 1)
1773
-			continue;
1904
+		{
1905
+					continue;
1906
+		}
1774 1907
 		elseif (($row['id_member'] == $user_info['id']) && $row['deleted'] == 1)
1775
-			continue;
1908
+		{
1909
+					continue;
1910
+		}
1776 1911
 
1777 1912
 		if (!isset($recipients[$row['id_pm']]))
1778
-			$recipients[$row['id_pm']] = array(
1913
+		{
1914
+					$recipients[$row['id_pm']] = array(
1779 1915
 				'to' => array(),
1780 1916
 				'bcc' => array()
1781 1917
 			);
1918
+		}
1782 1919
 
1783 1920
 		$display_pms[] = $row['id_pm'];
1784 1921
 		$posters[$row['id_pm']] = $row['id_member_from'];
@@ -1805,7 +1942,9 @@  discard block
 block discarded – undo
1805 1942
 
1806 1943
 	// Make it an array if its not
1807 1944
 	if (!is_array($pms))
1808
-		$pms = array($pms);
1945
+	{
1946
+			$pms = array($pms);
1947
+	}
1809 1948
 
1810 1949
 	// Find the heads for this group of PM's
1811 1950
 	$request = $db->query('', '
@@ -1819,7 +1958,9 @@  discard block
 block discarded – undo
1819 1958
 	);
1820 1959
 	$head_pms = array();
1821 1960
 	while ($row = $db->fetch_assoc($request))
1822
-		$head_pms[$row['id_pm_head']] = $row['id_pm'];
1961
+	{
1962
+			$head_pms[$row['id_pm_head']] = $row['id_pm'];
1963
+	}
1823 1964
 	$db->free_result($request);
1824 1965
 
1825 1966
 	// Find any unread PM's this member has under these head pm id's
@@ -1896,7 +2037,9 @@  discard block
 block discarded – undo
1896 2037
 	{
1897 2038
 		// Sent folder recipients
1898 2039
 		if ($folder === 'sent' || empty($row['bcc']))
1899
-			$recipients[$row['id_pm']][empty($row['bcc']) ? 'to' : 'bcc'][] = empty($row['id_member_to']) ? $txt['guest_title'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member_to'] . '">' . $row['to_name'] . '</a>';
2040
+		{
2041
+					$recipients[$row['id_pm']][empty($row['bcc']) ? 'to' : 'bcc'][] = empty($row['id_member_to']) ? $txt['guest_title'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member_to'] . '">' . $row['to_name'] . '</a>';
2042
+		}
1900 2043
 
1901 2044
 		// Don't include bcc-recipients if its your inbox, you're not supposed to know :P
1902 2045
 		if ($row['id_member_to'] == $user_info['id'] && $folder !== 'sent')
@@ -1910,11 +2053,15 @@  discard block
 block discarded – undo
1910 2053
 			foreach ($row['labels'] as $v)
1911 2054
 			{
1912 2055
 				if (isset($context['labels'][(int) $v]))
1913
-					$message_labels[$row['id_pm']][(int) $v] = array('id' => $v, 'name' => $context['labels'][(int) $v]['name']);
2056
+				{
2057
+									$message_labels[$row['id_pm']][(int) $v] = array('id' => $v, 'name' => $context['labels'][(int) $v]['name']);
2058
+				}
1914 2059
 
1915 2060
 				// Here we find the first label on a message - used for linking to posts
1916 2061
 				if ($search && (!isset($message_first_label[$row['id_pm']]) && !in_array('-1', $row['labels'])))
1917
-					$message_first_label[$row['id_pm']] = (int) $v;
2062
+				{
2063
+									$message_first_label[$row['id_pm']] = (int) $v;
2064
+				}
1918 2065
 			}
1919 2066
 		}
1920 2067
 	}
@@ -2093,7 +2240,9 @@  discard block
 block discarded – undo
2093 2240
 	{
2094 2241
 		// If it's hidden we still don't reveal their names
2095 2242
 		if ($bcc_count && $row['bcc'])
2096
-			$hidden_recipients++;
2243
+		{
2244
+					$hidden_recipients++;
2245
+		}
2097 2246
 
2098 2247
 		$recipients[] = array(
2099 2248
 			'id' => $row['id_member'],
@@ -2104,11 +2253,13 @@  discard block
 block discarded – undo
2104 2253
 
2105 2254
 	// If bcc count was requested, we return the number of bcc members, but not the names
2106 2255
 	if ($bcc_count)
2107
-		$recipients[] = array(
2256
+	{
2257
+			$recipients[] = array(
2108 2258
 			'id' => 'bcc',
2109 2259
 			'name' => sprintf($txt['pm_report_pm_hidden'], $hidden_recipients),
2110 2260
 			'link' => sprintf($txt['pm_report_pm_hidden'], $hidden_recipients)
2111 2261
 		);
2262
+	}
2112 2263
 
2113 2264
 	$db->free_result($request);
2114 2265
 
@@ -2154,7 +2305,9 @@  discard block
 block discarded – undo
2154 2305
 	);
2155 2306
 	// Can only be a hacker here!
2156 2307
 	if ($db->num_rows($request) == 0)
2157
-		throw new Elk_Exception('no_access', false);
2308
+	{
2309
+			throw new Elk_Exception('no_access', false);
2310
+	}
2158 2311
 	$pm_details = $db->fetch_row($request);
2159 2312
 	$db->free_result($request);
2160 2313
 
@@ -2285,7 +2438,9 @@  discard block
 block discarded – undo
2285 2438
 	);
2286 2439
 	$real_pm_ids = array();
2287 2440
 	while ($row = $db->fetch_assoc($request))
2288
-		$real_pm_ids[$row['id_pm_head']] = $row['id_pm'];
2441
+	{
2442
+			$real_pm_ids[$row['id_pm_head']] = $row['id_pm'];
2443
+	}
2289 2444
 	$db->free_result($request);
2290 2445
 
2291 2446
 	return $real_pm_ids;
@@ -2316,7 +2471,9 @@  discard block
 block discarded – undo
2316 2471
 	);
2317 2472
 	$search_results = array();
2318 2473
 	while ($row = $db->fetch_assoc($request))
2319
-		$search_results[] = $row;
2474
+	{
2475
+			$search_results[] = $row;
2476
+	}
2320 2477
 	$db->free_result($request);
2321 2478
 
2322 2479
 	return $search_results;
Please login to merge, or discard this patch.
sources/subs/Html2Md.class.php 2 patches
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -444,9 +444,12 @@  discard block
 block discarded – undo
444 444
 			case 'ol':
445 445
 			case 'ul':
446 446
 				if ($this->_has_parent_list($node, $this->_parser))
447
-					$markdown = trim($this->_get_value($node));
448
-				else
449
-					$markdown = $this->line_end . $this->_get_value($node) . $this->line_end;
447
+				{
448
+									$markdown = trim($this->_get_value($node));
449
+				}
450
+				else {
451
+									$markdown = $this->line_end . $this->_get_value($node) . $this->line_end;
452
+				}
450 453
 				break;
451 454
 			case 'li':
452 455
 				$markdown = $this->_convert_list($node);
@@ -541,7 +544,9 @@  discard block
 block discarded – undo
541 544
 		global $txt;
542 545
 
543 546
 		if ($node->getAttribute('data-lightboximage') || $node->getAttribute('data-lightboxmessage'))
544
-			return '~`skip`~';
547
+		{
548
+					return '~`skip`~';
549
+		}
545 550
 
546 551
 		$href = str_replace('\_', '_', htmlspecialchars_decode($node->getAttribute('href')));
547 552
 		$title = $node->getAttribute('title');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
 		// Strip the chaff and any excess blank lines we may have produced
273 273
 		$this->markdown = trim($this->markdown);
274
-		$this->markdown = preg_replace("~(?:\s?\n\s?){3,6}~", "\n\n", $this->markdown);	}
274
+		$this->markdown = preg_replace("~(?:\s?\n\s?){3,6}~", "\n\n", $this->markdown); }
275 275
 
276 276
 	/**
277 277
 	 * Looks for the text inside <body> and then <html>, returning just the inner
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 		}
578 578
 		else
579 579
 		{
580
-			$markdown = '[' . ($value === $txt['link'] ? 'X' : $value) . ']('  . $href . ' "' . $txt['link'] . '")';
580
+			$markdown = '[' . ($value === $txt['link'] ? 'X' : $value) . '](' . $href . ' "' . $txt['link'] . '")';
581 581
 		}
582 582
 
583 583
 		$this->_check_line_length($markdown, $this->get_buffer($node));
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		$re = '/((?<!\\\\\( |]\()https?:\/\/|(?<!\\\\\( |]\(|:\/\/)www)[-\p{L}0-9+&@#\/%?=~_|!:,.;]*[\p{L}0-9+&@#\/%=~_|]/ui';
1232 1232
 		$count = 0;
1233 1233
 		$text = preg_replace_callback($re,
1234
-			function ($matches) {
1234
+			function($matches) {
1235 1235
 				return $this->_plaintxt_callback($matches);
1236 1236
 			}, $text, -1, $count);
1237 1237
 
Please login to merge, or discard this patch.
sources/subs/UnTgz.class.php 1 patch
Braces   +93 added lines, -34 removed lines patch added patch discarded remove patch
@@ -140,7 +140,9 @@  discard block
 block discarded – undo
140 140
 
141 141
 		// This class sorta needs gzinflate!
142 142
 		if (!function_exists('gzinflate'))
143
-			throw new Elk_Exception('package_no_zlib', 'critical');
143
+		{
144
+					throw new Elk_Exception('package_no_zlib', 'critical');
145
+		}
144 146
 
145 147
 		// Make sure we have this loaded.
146 148
 		loadLanguage('Packages');
@@ -151,7 +153,9 @@  discard block
 block discarded – undo
151 153
 		// The destination needs exist and be writable or we are doomed
152 154
 		umask(0);
153 155
 		if ($this->destination !== null && !file_exists($this->destination) && !$this->single_file)
154
-			mktree($this->destination, 0777);
156
+		{
157
+					mktree($this->destination, 0777);
158
+		}
155 159
 	}
156 160
 
157 161
 	/**
@@ -163,31 +167,44 @@  discard block
 block discarded – undo
163 167
 	{
164 168
 		// Snif test that this is a .tgz tar.gz file
165 169
 		if (empty($this->_header) && $this->check_valid_tgz() === false)
166
-			return false;
170
+		{
171
+					return false;
172
+		}
167 173
 
168 174
 		// The tgz information for this archive
169 175
 		if ($this->_read_header_tgz() === false)
170
-			return false;
176
+		{
177
+					return false;
178
+		}
171 179
 
172 180
 		// With the offset found, read and deflate the archive data
173 181
 		if ($this->_ungzip_data() === false)
174
-			return false;
182
+		{
183
+					return false;
184
+		}
175 185
 
176 186
 		// With the archive data in hand, we need to un tarball it
177 187
 		$this->_process_files();
178 188
 
179 189
 		// Looking for a single file and this is it
180 190
 		if ($this->_found && $this->single_file)
181
-			return $this->_crc_check ? $this->_found : false;
191
+		{
192
+					return $this->_crc_check ? $this->_found : false;
193
+		}
182 194
 
183 195
 		// Wanted many files then we need to clean up
184 196
 		if ($this->destination !== null && !$this->single_file)
185
-			package_flush_cache();
197
+		{
198
+					package_flush_cache();
199
+		}
186 200
 
187 201
 		if ($this->single_file)
188
-			return false;
189
-		else
190
-			return $this->return;
202
+		{
203
+					return false;
204
+		}
205
+		else {
206
+					return $this->return;
207
+		}
191 208
 	}
192 209
 
193 210
 	/**
@@ -199,7 +216,9 @@  discard block
 block discarded – undo
199 216
 	{
200 217
 		// No signature?
201 218
 		if (strlen($this->data) < 10)
202
-			return false;
219
+		{
220
+					return false;
221
+		}
203 222
 
204 223
 		// Unpack the 10 byte signature so we can see what we have
205 224
 		$this->_header = unpack('H2a/H2b/Ct/Cf/Vmtime/Cxtra/Cos', substr($this->data, 0, 10));
@@ -232,7 +251,9 @@  discard block
 block discarded – undo
232 251
 	{
233 252
 		// Compression method needs to be 8 = deflate!
234 253
 		if ($this->_header['t'] !== 8)
235
-			return false;
254
+		{
255
+					return false;
256
+		}
236 257
 
237 258
 		// Each bit of this byte represents a processing flag as follows
238 259
 		// 0 fTEXT, 1 fHCRC, 2 fEXTRA, 3 fNAME, 4 fCOMMENT, 5 fENCRYPT, 6-7 reserved
@@ -253,7 +274,9 @@  discard block
 block discarded – undo
253 274
 		{
254 275
 			$this->_header['filename'] = '';
255 276
 			while ($this->data[$this->_offset] !== "\0")
256
-				$this->_header['filename'] .= $this->data[$this->_offset++];
277
+			{
278
+							$this->_header['filename'] .= $this->data[$this->_offset++];
279
+			}
257 280
 			$this->_offset++;
258 281
 		}
259 282
 
@@ -262,13 +285,17 @@  discard block
 block discarded – undo
262 285
 		{
263 286
 			$this->_header['comment'] = '';
264 287
 			while ($this->data[$this->_offset] !== "\0")
265
-				$this->_header['comment'] .= $this->data[$this->_offset++];
288
+			{
289
+							$this->_header['comment'] .= $this->data[$this->_offset++];
290
+			}
266 291
 			$this->_offset++;
267 292
 		}
268 293
 
269 294
 		// "Read" the header CRC $crc16 = unpack('vcrc16', substr($data, $this->_offset, 2));
270 295
 		if ($flags & 2)
271
-			$this->_offset += 2;
296
+		{
297
+					$this->_offset += 2;
298
+		}
272 299
 	}
273 300
 
274 301
 	/**
@@ -287,7 +314,9 @@  discard block
 block discarded – undo
287 314
 
288 315
 		// Check the crc and the data size
289 316
 		if (!$this->_check_crc() || (strlen($this->data) !== $check['isize']))
290
-			return false;
317
+		{
318
+					return false;
319
+		}
291 320
 	}
292 321
 
293 322
 	/**
@@ -316,7 +345,9 @@  discard block
 block discarded – undo
316 345
 
317 346
 			// If its a directory, lets make sure it ends in a /
318 347
 			if ($this->_current['type'] == 5 && substr($this->_current['filename'], -1) !== '/')
319
-				$this->_current['filename'] .= '/';
348
+			{
349
+							$this->_current['filename'] .= '/';
350
+			}
320 351
 
321 352
 			// Figure out what we will do with the data once we have it
322 353
 			$this->_determine_write_this();
@@ -332,10 +363,14 @@  discard block
 block discarded – undo
332 363
 				$this->_write_this_file();
333 364
 
334 365
 				if ($this->_skip)
335
-					continue;
366
+				{
367
+									continue;
368
+				}
336 369
 
337 370
 				if ($this->_found)
338
-					return;
371
+				{
372
+									return;
373
+				}
339 374
 			}
340 375
 
341 376
 			if (substr($this->_current['filename'], -1) !== '/')
@@ -392,13 +427,16 @@  discard block
 block discarded – undo
392 427
 				if (!empty($value) && is_numeric($value))
393 428
 				{
394 429
 					if (($value % 10) >= 8)
395
-						$value = decoct($value);
430
+					{
431
+											$value = decoct($value);
432
+					}
396 433
 					$value = octdec($value);
397 434
 				}
398 435
 				$this->_current[$key] = $value;
399 436
 			}
400
-			else
401
-				$this->_current[$key] = trim($value);
437
+			else {
438
+							$this->_current[$key] = trim($value);
439
+			}
402 440
 		}
403 441
 	}
404 442
 
@@ -409,10 +447,14 @@  discard block
 block discarded – undo
409 447
 	{
410 448
 		// Not a directory and doesn't exist already...
411 449
 		if (substr($this->_current['filename'], -1) !== '/' && !file_exists($this->destination . '/' . $this->_current['filename']))
412
-			$this->_write_this = true;
450
+		{
451
+					$this->_write_this = true;
452
+		}
413 453
 		// File exists... check if it is newer.
414 454
 		elseif (substr($this->_current['filename'], -1) !== '/')
415
-			$this->_write_this = $this->overwrite || filemtime($this->destination . '/' . $this->_current['filename']) < $this->_current['mtime'];
455
+		{
456
+					$this->_write_this = $this->overwrite || filemtime($this->destination . '/' . $this->_current['filename']) < $this->_current['mtime'];
457
+		}
416 458
 		// Folder... create.
417 459
 		elseif ($this->destination !== null && !$this->single_file)
418 460
 		{
@@ -420,11 +462,14 @@  discard block
 block discarded – undo
420 462
 			$this->_current['filename'] = strtr($this->_current['filename'], array('../' => '', '/..' => ''));
421 463
 
422 464
 			if (!file_exists($this->destination . '/' . $this->_current['filename']))
423
-				mktree($this->destination . '/' . $this->_current['filename'], 0777);
465
+			{
466
+							mktree($this->destination . '/' . $this->_current['filename'], 0777);
467
+			}
424 468
 			$this->_write_this = false;
425 469
 		}
426
-		else
427
-			$this->_write_this = false;
470
+		else {
471
+					$this->_write_this = false;
472
+		}
428 473
 	}
429 474
 
430 475
 	/**
@@ -440,21 +485,31 @@  discard block
 block discarded – undo
440 485
 
441 486
 		// A directory may need to be created
442 487
 		if (strpos($this->_current['filename'], '/') !== false && !$this->single_file)
443
-			mktree($this->destination . '/' . dirname($this->_current['filename']), 0777);
488
+		{
489
+					mktree($this->destination . '/' . dirname($this->_current['filename']), 0777);
490
+		}
444 491
 
445 492
 		// Is this the file we're looking for?
446 493
 		if ($this->single_file && ($this->destination === $this->_current['filename'] || $this->destination === '*/' . basename($this->_current['filename'])))
447
-			$this->_found = $this->_current['data'];
494
+		{
495
+					$this->_found = $this->_current['data'];
496
+		}
448 497
 		// If we're looking for another file, keep going.
449 498
 		elseif ($this->single_file)
450
-			$this->_skip = true;
499
+		{
500
+					$this->_skip = true;
501
+		}
451 502
 		// Looking for restricted files?
452 503
 		elseif ($this->files_to_extract !== null && !in_array($this->_current['filename'], $this->files_to_extract))
453
-			$this->_skip = true;
504
+		{
505
+					$this->_skip = true;
506
+		}
454 507
 
455 508
 		// Write it out then
456 509
 		if ($this->_check_header_crc() && $this->_skip === false && $this->_found === false)
457
-			package_put_contents($this->destination . '/' . $this->_current['filename'], $this->_current['data']);
510
+		{
511
+					package_put_contents($this->destination . '/' . $this->_current['filename'], $this->_current['data']);
512
+		}
458 513
 	}
459 514
 
460 515
 	/**
@@ -478,9 +533,13 @@  discard block
 block discarded – undo
478 533
 
479 534
 		// Build the checksum for this header and make sure it matches what it claims
480 535
 		for ($i = 0; $i < 148; $i++)
481
-			$this->_crc += ord($this->_header[$i]);
536
+		{
537
+					$this->_crc += ord($this->_header[$i]);
538
+		}
482 539
 		for ($i = 156; $i < 512; $i++)
483
-			$this->_crc += ord($this->_header[$i]);
540
+		{
541
+					$this->_crc += ord($this->_header[$i]);
542
+		}
484 543
 
485 544
 		$this->_crc_check = $this->_current['checksum'] === $this->_crc;
486 545
 
Please login to merge, or discard this patch.
sources/subs/MessageIcons.subs.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
 	static $icons;
25 25
 
26 26
 	if (isset($icons))
27
-		return $icons;
27
+	{
28
+			return $icons;
29
+	}
28 30
 
29 31
 	$db = database();
30 32
 
Please login to merge, or discard this patch.
sources/subs/Subscriptions-Authorize.class.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,15 +137,21 @@  discard block
 block discarded – undo
137 137
 
138 138
 		// Is it even on?
139 139
 		if (empty($modSettings['authorize_id']) || empty($modSettings['authorize_transid']))
140
-			return false;
140
+		{
141
+					return false;
142
+		}
141 143
 
142 144
 		// We got a hash?
143 145
 		if (empty($_POST['x_MD5_Hash']))
144
-			return false;
146
+		{
147
+					return false;
148
+		}
145 149
 
146 150
 		// Do we have an invoice number?
147 151
 		if (empty($_POST['x_invoice_num']))
148
-			return false;
152
+		{
153
+					return false;
154
+		}
149 155
 
150 156
 		// And a response?
151 157
 		return !empty($_POST['x_response_code']);
@@ -162,18 +168,24 @@  discard block
 block discarded – undo
162 168
 
163 169
 		// Is this the right hash?
164 170
 		if ($_POST['x_MD5_Hash'] != strtoupper(md5($modSettings['authorize_id'] . $_POST['x_trans_id'] . $_POST['x_amount'])))
165
-			exit;
171
+		{
172
+					exit;
173
+		}
166 174
 
167 175
 		// Can't exist if it doesn't contain anything.
168 176
 		if (empty($_POST['x_invoice_num']))
169
-			exit;
177
+		{
178
+					exit;
179
+		}
170 180
 
171 181
 		// Verify the currency
172 182
 		$currency = $_POST['x_currency_code'];
173 183
 
174 184
 		// Verify the currency!
175 185
 		if (strtolower($currency) != $modSettings['currency_code'])
176
-			exit;
186
+		{
187
+					exit;
188
+		}
177 189
 
178 190
 		// Return the ID_SUB/ID_MEMBER
179 191
 		return explode('+', $_POST['x_invoice_num']);
Please login to merge, or discard this patch.
sources/subs/TopicsMerge.class.php 1 patch
Braces   +42 added lines, -17 removed lines patch added patch discarded remove patch
@@ -227,18 +227,25 @@  discard block
 block discarded – undo
227 227
 
228 228
 			// Keep checking the length.
229 229
 			if (Util::strlen($target_subject) > 100)
230
-				$target_subject = Util::substr($target_subject, 0, 100);
230
+			{
231
+							$target_subject = Util::substr($target_subject, 0, 100);
232
+			}
231 233
 
232 234
 			// Nothing left - odd but pick the first topics subject.
233 235
 			if ($target_subject == '')
234
-				$target_subject = $this->topic_data[$this->firstTopic]['subject'];
236
+			{
237
+							$target_subject = $this->topic_data[$this->firstTopic]['subject'];
238
+			}
235 239
 		}
236 240
 		// A subject was selected from the list.
237 241
 		elseif (!empty($this->topic_data[(int) $details['subject']]['subject']))
238
-			$target_subject = $this->topic_data[(int) $details['subject']]['subject'];
242
+		{
243
+					$target_subject = $this->topic_data[(int) $details['subject']]['subject'];
244
+		}
239 245
 		// Nothing worked? Just take the subject of the first message.
240
-		else
241
-			$target_subject = $this->topic_data[$this->firstTopic]['subject'];
246
+		else {
247
+					$target_subject = $this->topic_data[$this->firstTopic]['subject'];
248
+		}
242 249
 
243 250
 		// Get the first and last message and the number of messages....
244 251
 		$request = $this->_db->query('', '
@@ -301,9 +308,12 @@  discard block
 block discarded – undo
301 308
 
302 309
 		// Fix the topic count stuff depending on what the new one counts as.
303 310
 		if ($topic_approved)
304
-			$this->_boardTotals[$target_board]['num_topics']--;
305
-		else
306
-			$this->_boardTotals[$target_board]['unapproved_topics']--;
311
+		{
312
+					$this->_boardTotals[$target_board]['num_topics']--;
313
+		}
314
+		else {
315
+					$this->_boardTotals[$target_board]['unapproved_topics']--;
316
+		}
307 317
 
308 318
 		$this->_boardTotals[$target_board]['unapproved_posts'] -= $num_unapproved;
309 319
 		$this->_boardTotals[$target_board]['num_posts'] -= $topic_approved ? $num_replies + 1 : $num_replies;
@@ -326,7 +336,9 @@  discard block
 block discarded – undo
326 336
 
327 337
 		// First and last message are the same, so only row was returned.
328 338
 		if ($member_updated === null)
329
-			$member_updated = $member_started;
339
+		{
340
+					$member_updated = $member_started;
341
+		}
330 342
 
331 343
 		$this->_db->free_result($request);
332 344
 
@@ -382,7 +394,9 @@  discard block
 block discarded – undo
382 394
 	{
383 395
 		// Cycle through each board...
384 396
 		foreach ($this->_boardTotals as $id_board => $stats)
385
-			decrementBoard($id_board, $stats);
397
+		{
398
+					decrementBoard($id_board, $stats);
399
+		}
386 400
 
387 401
 		// Determine the board the final topic resides in
388 402
 		$topic_info = getTopicInfo($id_topic);
@@ -409,7 +423,9 @@  discard block
 block discarded – undo
409 423
 		$search = new \ElkArte\Search\Search;
410 424
 		$searchAPI = $search->findSearchAPI();
411 425
 		if (is_callable(array($searchAPI, 'topicMerge')))
412
-			$searchAPI->topicMerge($id_topic, $this->_topics, $affected_msgs, empty($enforce_subject) ? null : array($response_prefix, $target_subject));
426
+		{
427
+					$searchAPI->topicMerge($id_topic, $this->_topics, $affected_msgs, empty($enforce_subject) ? null : array($response_prefix, $target_subject));
428
+		}
413 429
 	}
414 430
 
415 431
 	/**
@@ -422,7 +438,9 @@  discard block
 block discarded – undo
422 438
 
423 439
 		// Joy of all joys, make sure they're not pi**ing about with unapproved topics they can't see :P
424 440
 		if ($modSettings['postmod_active'])
425
-			$can_approve_boards = !empty($user_info['mod_cache']['ap']) ? $user_info['mod_cache']['ap'] : boardsAllowedTo('approve_posts');
441
+		{
442
+					$can_approve_boards = !empty($user_info['mod_cache']['ap']) ? $user_info['mod_cache']['ap'] : boardsAllowedTo('approve_posts');
443
+		}
426 444
 
427 445
 		// Get info about the topics and polls that will be merged.
428 446
 		$request = $this->_db->query('', '
@@ -467,11 +485,16 @@  discard block
 block discarded – undo
467 485
 
468 486
 			// We can't see unapproved topics here?
469 487
 			if ($modSettings['postmod_active'] && !$row['approved'] && $can_approve_boards != array(0) && in_array($row['id_board'], $can_approve_boards))
470
-				continue;
488
+			{
489
+							continue;
490
+			}
471 491
 			elseif (!$row['approved'])
472
-				$this->_boardTotals[$row['id_board']]['unapproved_topics']++;
473
-			else
474
-				$this->_boardTotals[$row['id_board']]['num_topics']++;
492
+			{
493
+							$this->_boardTotals[$row['id_board']]['unapproved_topics']++;
494
+			}
495
+			else {
496
+							$this->_boardTotals[$row['id_board']]['num_topics']++;
497
+			}
475 498
 
476 499
 			$this->_boardTotals[$row['id_board']]['unapproved_posts'] += $row['unapproved_posts'];
477 500
 			$this->_boardTotals[$row['id_board']]['num_posts'] += $row['num_replies'] + ($row['approved'] ? 1 : 0);
@@ -502,7 +525,9 @@  discard block
 block discarded – undo
502 525
 
503 526
 			// If there's no poll, id_poll == 0...
504 527
 			if ($row['id_poll'] > 0)
505
-				$this->_polls[] = $row['id_poll'];
528
+			{
529
+							$this->_polls[] = $row['id_poll'];
530
+			}
506 531
 
507 532
 			// Store the id_topic with the lowest id_first_msg.
508 533
 			if (empty($this->firstTopic))
Please login to merge, or discard this patch.
sources/subs/Priority.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,12 +251,14 @@
 block discarded – undo
251 251
 					{
252 252
 						$priority_threshold = $all_entities[$reference];
253 253
 						foreach ($all_entities as $key => $val)
254
-							switch ($where)
254
+						{
255
+													switch ($where)
255 256
 							{
256 257
 								case 'after':
257 258
 									if ($val <= $priority_threshold)
258 259
 									{
259 260
 										$all_entities[$key] -= $inc;
261
+						}
260 262
 									}
261 263
 									break;
262 264
 								case 'before':
Please login to merge, or discard this patch.
sources/subs/News.subs.php 1 patch
Braces   +45 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,11 +31,13 @@  discard block
 block discarded – undo
31 31
 
32 32
 	// Ready the current news.
33 33
 	foreach (explode("\n", $modSettings['news']) as $id => $line)
34
-		$admin_current_news[$id] = array(
34
+	{
35
+			$admin_current_news[$id] = array(
35 36
 			'id' => $id,
36 37
 			'unparsed' => un_preparsecode($line),
37 38
 			'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext">&lt;$1form&gt;</em>', $bbc_parser->parseNews($line)),
38 39
 		);
40
+	}
39 41
 
40 42
 	$admin_current_news['last'] = array(
41 43
 		'id' => 'last',
@@ -75,7 +77,9 @@  discard block
 block discarded – undo
75 77
 		)
76 78
 	);
77 79
 	while ($row = $db->fetch_assoc($request))
78
-		$excludes[] = $row['id_member'];
80
+	{
81
+			$excludes[] = $row['id_member'];
82
+	}
79 83
 	$db->free_result($request);
80 84
 
81 85
 	$request = $db->query('', '
@@ -111,7 +115,9 @@  discard block
 block discarded – undo
111 115
 			$condition_array_params
112 116
 		);
113 117
 		while ($row = $db->fetch_assoc($request))
114
-			$excludes[] = $row['id_member'];
118
+		{
119
+					$excludes[] = $row['id_member'];
120
+		}
115 121
 		$db->free_result($request);
116 122
 	}
117 123
 
@@ -140,7 +146,9 @@  discard block
 block discarded – undo
140 146
 		)
141 147
 	);
142 148
 	while ($row = $db->fetch_assoc($request))
143
-		$mods[] = $row['identifier'];
149
+	{
150
+			$mods[] = $row['identifier'];
151
+	}
144 152
 	$db->free_result($request);
145 153
 
146 154
 	return $mods;
@@ -182,7 +190,9 @@  discard block
 block discarded – undo
182 190
 		))
183 191
 	);
184 192
 	while ($row = $db->fetch_assoc($result))
185
-		$recipients[] = $row;
193
+	{
194
+			$recipients[] = $row;
195
+	}
186 196
 	$db->free_result($result);
187 197
 
188 198
 	return $recipients;
@@ -242,19 +252,25 @@  discard block
 block discarded – undo
242 252
 			$db->free_result($request);
243 253
 
244 254
 			if (empty($_REQUEST['boards']) && empty($board))
245
-				unset($context['optimize_msg']['lowest']);
246
-			else
247
-				$context['optimize_msg']['lowest'] = 'm.id_msg >= t.id_first_msg';
255
+			{
256
+							unset($context['optimize_msg']['lowest']);
257
+			}
258
+			else {
259
+							$context['optimize_msg']['lowest'] = 'm.id_msg >= t.id_first_msg';
260
+			}
248 261
 
249 262
 			$context['optimize_msg']['highest'] = 'm.id_msg <= t.id_last_msg';
250 263
 			$loops++;
251 264
 		}
252
-		else
253
-			$done = true;
265
+		else {
266
+					$done = true;
267
+		}
254 268
 	}
255 269
 	$data = array();
256 270
 	while ($row = $db->fetch_assoc($request))
257
-		$data[] = $row;
271
+	{
272
+			$data[] = $row;
273
+	}
258 274
 
259 275
 	$db->free_result($request);
260 276
 
@@ -304,23 +320,31 @@  discard block
 block discarded – undo
304 320
 			$db->free_result($request);
305 321
 
306 322
 			if (empty($_REQUEST['boards']) && empty($board))
307
-				unset($context['optimize_msg']['lowest']);
308
-			else
309
-				$context['optimize_msg']['lowest'] = $loops ? 'm.id_msg >= t.id_first_msg' : 'm.id_msg >= (t.id_last_msg - t.id_first_msg) / 2';
323
+			{
324
+							unset($context['optimize_msg']['lowest']);
325
+			}
326
+			else {
327
+							$context['optimize_msg']['lowest'] = $loops ? 'm.id_msg >= t.id_first_msg' : 'm.id_msg >= (t.id_last_msg - t.id_first_msg) / 2';
328
+			}
310 329
 
311 330
 			$loops++;
312 331
 		}
313
-		else
314
-			$done = true;
332
+		else {
333
+					$done = true;
334
+		}
315 335
 	}
316 336
 	$messages = array();
317 337
 	while ($row = $db->fetch_assoc($request))
318
-		$messages[] = $row['id_msg'];
338
+	{
339
+			$messages[] = $row['id_msg'];
340
+	}
319 341
 	$db->free_result($request);
320 342
 
321 343
 	// No messages found, then return nothing
322 344
 	if (empty($messages))
323
-		return array();
345
+	{
346
+			return array();
347
+	}
324 348
 
325 349
 	// Find the most recent posts from our message list that this user can see.
326 350
 	$request = $db->query('', '
@@ -348,7 +372,9 @@  discard block
 block discarded – undo
348 372
 	);
349 373
 	$data = array();
350 374
 	while ($row = $db->fetch_assoc($request))
351
-		$data[] = $row;
375
+	{
376
+			$data[] = $row;
377
+	}
352 378
 
353 379
 	$db->free_result($request);
354 380
 
Please login to merge, or discard this patch.
sources/subs/Recent.class.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
 			AND m.id_msg >= {int:max_id_msg}';
126 126
 
127 127
 		if (!empty($recycle))
128
-			$this->_query_parameters['recycle_board'] = $msg_id;
128
+		{
129
+					$this->_query_parameters['recycle_board'] = $msg_id;
130
+		}
129 131
 
130 132
 		$this->_query_parameters['max_id_msg'] = $msg_id;
131 133
 	}
@@ -190,14 +192,18 @@  discard block
 block discarded – undo
190 192
 
191 193
 				// If 0 is the only thing in the array, they can do it everywhere!
192 194
 				if (!empty($boards) && $boards[0] == 0)
193
-					$boards = array_keys($this->_board_ids[$type]);
195
+				{
196
+									$boards = array_keys($this->_board_ids[$type]);
197
+				}
194 198
 
195 199
 				// Go through the boards, and look for posts they can do this on.
196 200
 				foreach ($boards as $board_id)
197 201
 				{
198 202
 					// Hmm, they have permission, but there are no topics from that board on this page.
199 203
 					if (!isset($this->_board_ids[$type][$board_id]))
200
-						continue;
204
+					{
205
+											continue;
206
+					}
201 207
 
202 208
 					// Okay, looks like they can do it for these posts.
203 209
 					foreach ($this->_board_ids[$type][$board_id] as $counter)
@@ -252,8 +258,9 @@  discard block
 block discarded – undo
252 258
 				$this->_cache_results = true;
253 259
 				unset($this->_query_parameters['max_id_msg']);
254 260
 			}
255
-			else
256
-				$done = true;
261
+			else {
262
+							$done = true;
263
+			}
257 264
 		}
258 265
 		$this->_messages = array();
259 266
 		while ($row = $this->_db->fetch_assoc($request))
Please login to merge, or discard this patch.