Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/subs/Bans.subs.php 2 patches
Braces   +218 added lines, -86 removed lines patch added patch discarded remove patch
@@ -59,15 +59,20 @@  discard block
 block discarded – undo
59 59
 	$ban_errors = ElkArte\Errors\ErrorContext::context('ban', 1);
60 60
 
61 61
 	if (!is_array($suggestions))
62
-		return false;
62
+	{
63
+			return false;
64
+	}
63 65
 
64 66
 	// What triggers are we adding (like ip, host, email, etc)
65 67
 	foreach ($suggestions['ban_suggestions'] as $key => $value)
66 68
 	{
67 69
 		if (is_array($value))
68
-			$triggers[$key] = $value;
69
-		else
70
-			$triggers[$value] = !empty($suggestions[$value]) ? $suggestions[$value] : '';
70
+		{
71
+					$triggers[$key] = $value;
72
+		}
73
+		else {
74
+					$triggers[$value] = !empty($suggestions[$value]) ? $suggestions[$value] : '';
75
+		}
71 76
 	}
72 77
 
73 78
 	// Make sure the triggers for this ban are valid
@@ -77,17 +82,23 @@  discard block
 block discarded – undo
77 82
 	if (!empty($ban_triggers['ban_triggers']) && !$ban_errors->hasErrors())
78 83
 	{
79 84
 		if (empty($trigger_id))
80
-			addTriggers($ban_group, $ban_triggers['ban_triggers'], $ban_triggers['log_info']);
81
-		else
82
-			updateTriggers($trigger_id, $ban_group, array_shift($ban_triggers['ban_triggers']), $ban_triggers['log_info']);
85
+		{
86
+					addTriggers($ban_group, $ban_triggers['ban_triggers'], $ban_triggers['log_info']);
87
+		}
88
+		else {
89
+					updateTriggers($trigger_id, $ban_group, array_shift($ban_triggers['ban_triggers']), $ban_triggers['log_info']);
90
+		}
83 91
 	}
84 92
 
85 93
 	// No errors, then return the ban triggers
86 94
 	if ($ban_errors->hasErrors())
87
-		return $triggers;
88
-	else
89
-		return false;
90
-}
95
+	{
96
+			return $triggers;
97
+	}
98
+	else {
99
+			return false;
100
+	}
101
+	}
91 102
 
92 103
 /**
93 104
  * This function removes a batch of triggers based on ids
@@ -107,13 +118,19 @@  discard block
 block discarded – undo
107 118
 	$db = database();
108 119
 
109 120
 	if ($group_id !== false)
110
-		$group_id = (int) $group_id;
121
+	{
122
+			$group_id = (int) $group_id;
123
+	}
111 124
 
112 125
 	if (empty($group_id) && empty($items_ids))
113
-		return false;
126
+	{
127
+			return false;
128
+	}
114 129
 
115 130
 	if (!is_array($items_ids))
116
-		$items_ids = array($items_ids);
131
+	{
132
+			$items_ids = array($items_ids);
133
+	}
117 134
 
118 135
 	// Log the ban removals so others know
119 136
 	$log_info = banLogItems(banDetails($items_ids, $group_id));
@@ -163,12 +180,16 @@  discard block
 block discarded – undo
163 180
 	$db = database();
164 181
 
165 182
 	if (!is_array($group_ids))
166
-		$group_ids = array($group_ids);
183
+	{
184
+			$group_ids = array($group_ids);
185
+	}
167 186
 
168 187
 	$group_ids = array_unique($group_ids);
169 188
 
170 189
 	if (empty($group_ids))
171
-		return false;
190
+	{
191
+			return false;
192
+	}
172 193
 
173 194
 	$db->query('', '
174 195
 		DELETE FROM {db_prefix}ban_groups
@@ -199,21 +220,27 @@  discard block
 block discarded – undo
199 220
 
200 221
 	// No specific id's passed, we truncate the entire table
201 222
 	if (empty($ids))
202
-		$db->query('truncate_table', '
223
+	{
224
+			$db->query('truncate_table', '
203 225
 			TRUNCATE {db_prefix}log_banned',
204 226
 			array(
205 227
 			)
206 228
 		);
229
+	}
207 230
 	else
208 231
 	{
209 232
 		if (!is_array($ids))
210
-			$ids = array($ids);
233
+		{
234
+					$ids = array($ids);
235
+		}
211 236
 
212 237
 		// Can only remove it once
213 238
 		$ids = array_unique($ids);
214 239
 
215 240
 		if (empty($ids))
216
-			return false;
241
+		{
242
+					return false;
243
+		}
217 244
 
218 245
 		// Remove this grouping
219 246
 		$db->query('', '
@@ -240,7 +267,9 @@  discard block
 block discarded – undo
240 267
 
241 268
 	$ban_errors = ElkArte\Errors\ErrorContext::context('ban', 1);
242 269
 	if (empty($triggers))
243
-		$ban_errors->addError('ban_empty_triggers');
270
+	{
271
+			$ban_errors->addError('ban_empty_triggers');
272
+	}
244 273
 
245 274
 	$ban_triggers = array();
246 275
 	$log_info = array();
@@ -251,7 +280,9 @@  discard block
 block discarded – undo
251 280
 		if (!empty($value))
252 281
 		{
253 282
 			if ($key == 'member')
254
-				continue;
283
+			{
284
+							continue;
285
+			}
255 286
 
256 287
 			if ($key == 'main_ip')
257 288
 			{
@@ -262,13 +293,16 @@  discard block
 block discarded – undo
262 293
 				{
263 294
 					$ban_triggers['main_ip'] = $ban_trigger;
264 295
 				}
265
-				else
266
-					$ban_errors->addError($ban_trigger['error']);
296
+				else {
297
+									$ban_errors->addError($ban_trigger['error']);
298
+				}
267 299
 			}
268 300
 			elseif ($key == 'hostname')
269 301
 			{
270 302
 				if (preg_match('/[^\w.\-*]/', $value) == 1)
271
-					$ban_errors->addError('invalid_hostname');
303
+				{
304
+									$ban_errors->addError('invalid_hostname');
305
+				}
272 306
 				else
273 307
 				{
274 308
 					// Replace the * wildcard by a MySQL wildcard %.
@@ -280,7 +314,9 @@  discard block
 block discarded – undo
280 314
 			elseif ($key == 'email')
281 315
 			{
282 316
 				if (preg_match('/[^\w.\-\+*@]/', $value) == 1)
283
-					$ban_errors->addError('invalid_email');
317
+				{
318
+									$ban_errors->addError('invalid_email');
319
+				}
284 320
 
285 321
 				// Check the user is not banning an admin.
286 322
 				$request = $db->query('', '
@@ -295,7 +331,9 @@  discard block
 block discarded – undo
295 331
 					)
296 332
 				);
297 333
 				if ($db->num_rows($request) != 0)
298
-					$ban_errors->addError('no_ban_admin');
334
+				{
335
+									$ban_errors->addError('no_ban_admin');
336
+				}
299 337
 				$db->free_result($request);
300 338
 
301 339
 				$value = substr(strtolower(str_replace('*', '%', $value)), 0, 255);
@@ -317,7 +355,9 @@  discard block
 block discarded – undo
317 355
 					)
318 356
 				);
319 357
 				if ($db->num_rows($request) == 0)
320
-					$ban_errors->addError('invalid_username');
358
+				{
359
+									$ban_errors->addError('invalid_username');
360
+				}
321 361
 				list ($value, $isAdmin) = $db->fetch_row($request);
322 362
 				$db->free_result($request);
323 363
 
@@ -326,8 +366,9 @@  discard block
 block discarded – undo
326 366
 					unset($value);
327 367
 					$ban_errors->addError('no_ban_admin');
328 368
 				}
329
-				else
330
-					$ban_triggers['user']['id_member'] = $value;
369
+				else {
370
+									$ban_triggers['user']['id_member'] = $value;
371
+				}
331 372
 			}
332 373
 			elseif (in_array($key, array('ips_in_messages', 'ips_in_errors')))
333 374
 			{
@@ -336,7 +377,9 @@  discard block
 block discarded – undo
336 377
 
337 378
 				// Don't add the main IP again.
338 379
 				if (isset($triggers['main_ip']))
339
-					$values = array_diff($values, array($triggers['main_ip']));
380
+				{
381
+									$values = array_diff($values, array($triggers['main_ip']));
382
+				}
340 383
 
341 384
 				unset($value);
342 385
 				foreach ($values as $val)
@@ -354,18 +397,22 @@  discard block
 block discarded – undo
354 397
 							'bantype' => 'ip_range',
355 398
 						);
356 399
 					}
357
-					else
358
-						$ban_errors->addError($ban_trigger['error']);
400
+					else {
401
+											$ban_errors->addError($ban_trigger['error']);
402
+					}
359 403
 				}
360 404
 			}
361
-			else
362
-				$ban_errors->addError('no_bantype_selected');
405
+			else {
406
+							$ban_errors->addError('no_bantype_selected');
407
+			}
363 408
 
364 409
 			if (isset($value) && !is_array($value))
365
-				$log_info[] = array(
410
+			{
411
+							$log_info[] = array(
366 412
 					'value' => $value,
367 413
 					'bantype' => $key,
368 414
 				);
415
+			}
369 416
 		}
370 417
 	}
371 418
 
@@ -388,7 +435,9 @@  discard block
 block discarded – undo
388 435
 	$ban_errors = ElkArte\Errors\ErrorContext::context('ban', 1);
389 436
 
390 437
 	if (empty($group_id))
391
-		$ban_errors->addError('ban_not_found');
438
+	{
439
+			$ban_errors->addError('ban_not_found');
440
+	}
392 441
 
393 442
 	// Preset all values that are required.
394 443
 	$values = array(
@@ -442,17 +491,24 @@  discard block
 block discarded – undo
442 491
 	{
443 492
 		// Exceptions, exceptions, exceptions...always exceptions... :P
444 493
 		if (in_array($key, array('ips_in_messages', 'ips_in_errors')))
445
-			foreach ($trigger as $real_trigger)
494
+		{
495
+					foreach ($trigger as $real_trigger)
446 496
 				$insertTriggers[] = array_merge($values, $real_trigger);
447
-		else
448
-			$insertTriggers[] = array_merge($values, $trigger);
497
+		}
498
+		else {
499
+					$insertTriggers[] = array_merge($values, $trigger);
500
+		}
449 501
 	}
450 502
 
451 503
 	if (empty($insertTriggers))
452
-		$ban_errors->addError('ban_no_triggers');
504
+	{
505
+			$ban_errors->addError('ban_no_triggers');
506
+	}
453 507
 
454 508
 	if ($ban_errors->hasErrors())
455
-		return false;
509
+	{
510
+			return false;
511
+	}
456 512
 
457 513
 	$db->insert('ignore',
458 514
 		'{db_prefix}ban_items',
@@ -482,15 +538,23 @@  discard block
 block discarded – undo
482 538
 	$ban_errors = ElkArte\Errors\ErrorContext::context('ban', 1);
483 539
 
484 540
 	if (empty($ban_item))
485
-		$ban_errors->addError('ban_ban_item_empty');
541
+	{
542
+			$ban_errors->addError('ban_ban_item_empty');
543
+	}
486 544
 	if (empty($group_id))
487
-		$ban_errors->addError('ban_not_found');
545
+	{
546
+			$ban_errors->addError('ban_not_found');
547
+	}
488 548
 	if (empty($trigger))
489
-		$ban_errors->addError('ban_no_triggers');
549
+	{
550
+			$ban_errors->addError('ban_no_triggers');
551
+	}
490 552
 
491 553
 	// Any errors then we are not updating it
492 554
 	if ($ban_errors->hasErrors())
493
-		return;
555
+	{
556
+			return;
557
+	}
494 558
 
495 559
 	// Preset all values that are required.
496 560
 	$values = array(
@@ -554,7 +618,9 @@  discard block
 block discarded – undo
554 618
 function logTriggersUpdates($logs, $new = true)
555 619
 {
556 620
 	if (empty($logs))
557
-		return;
621
+	{
622
+			return;
623
+	}
558 624
 
559 625
 	$log_name_map = array(
560 626
 		'main_ip' => 'ip_range',
@@ -566,12 +632,14 @@  discard block
 block discarded – undo
566 632
 
567 633
 	// Log the addition of the ban entries into the moderation log.
568 634
 	foreach ($logs as $log)
569
-		logAction('ban', array(
635
+	{
636
+			logAction('ban', array(
570 637
 			$log_name_map[$log['bantype']] => $log['value'],
571 638
 			'new' => empty($new) ? 0 : ($new === true ? 1 : -1),
572 639
 			'type' => $log['bantype'],
573 640
 		));
574
-}
641
+	}
642
+	}
575 643
 
576 644
 /**
577 645
  * Updates an existing ban group
@@ -590,13 +658,19 @@  discard block
 block discarded – undo
590 658
 	$ban_errors = ElkArte\Errors\ErrorContext::context('ban', 1);
591 659
 
592 660
 	if (empty($ban_info['name']))
593
-		$ban_errors->addError('ban_name_empty');
661
+	{
662
+			$ban_errors->addError('ban_name_empty');
663
+	}
594 664
 
595 665
 	if (empty($ban_info['id']))
596
-		$ban_errors->addError('ban_id_empty');
666
+	{
667
+			$ban_errors->addError('ban_id_empty');
668
+	}
597 669
 
598 670
 	if ($ban_errors->hasErrors())
599
-		return false;
671
+	{
672
+			return false;
673
+	}
600 674
 
601 675
 	// No problems found, so lets add this to the ban list
602 676
 	$request = $db->query('', '
@@ -611,7 +685,9 @@  discard block
 block discarded – undo
611 685
 		)
612 686
 	);
613 687
 	if ($db->num_rows($request) == 0)
614
-		return insertBanGroup($ban_info);
688
+	{
689
+			return insertBanGroup($ban_info);
690
+	}
615 691
 	$db->free_result($request);
616 692
 
617 693
 	$db->query('', '
@@ -661,13 +737,19 @@  discard block
 block discarded – undo
661 737
 	$ban_errors = ElkArte\Errors\ErrorContext::context('ban', 1);
662 738
 
663 739
 	if (empty($ban_info['name']))
664
-		$ban_errors->addError('ban_name_empty');
740
+	{
741
+			$ban_errors->addError('ban_name_empty');
742
+	}
665 743
 
666 744
 	if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login']))
667
-		$ban_errors->addError('ban_unknown_restriction_type');
745
+	{
746
+			$ban_errors->addError('ban_unknown_restriction_type');
747
+	}
668 748
 
669 749
 	if ($ban_errors->hasErrors())
670
-		return false;
750
+	{
751
+			return false;
752
+	}
671 753
 
672 754
 	// Check whether a ban with this name already exists.
673 755
 	$request = $db->query('', '
@@ -705,7 +787,9 @@  discard block
 block discarded – undo
705 787
 	$ban_info['id'] = $db->insert_id('{db_prefix}ban_groups', 'id_ban_group');
706 788
 
707 789
 	if (empty($ban_info['id']))
708
-		$ban_errors->addError('impossible_insert_new_bangroup');
790
+	{
791
+			$ban_errors->addError('impossible_insert_new_bangroup');
792
+	}
709 793
 
710 794
 	return $ban_info['id'];
711 795
 }
@@ -730,16 +814,23 @@  discard block
 block discarded – undo
730 814
 	if (!empty($high[4]) || !empty($high[5]) || !empty($high[6]) || !empty($high[7]))
731 815
 	{
732 816
 		if (count($low) != 8 || count($high) != 8)
733
-			return '';
817
+		{
818
+					return '';
819
+		}
734 820
 
735 821
 		for ($i = 0; $i < 8; $i++)
736 822
 		{
737 823
 			if ($low[$i] == $high[$i])
738
-				$ip[$i] = dechex($low[$i]);
824
+			{
825
+							$ip[$i] = dechex($low[$i]);
826
+			}
739 827
 			elseif ($low[$i] == '0' && $high[$i] == '255')
740
-				$ip[$i] = '*';
741
-			else
742
-				$ip[$i] = dechex($low[$i]) . '-' . dechex($high[$i]);
828
+			{
829
+							$ip[$i] = '*';
830
+			}
831
+			else {
832
+							$ip[$i] = dechex($low[$i]) . '-' . dechex($high[$i]);
833
+			}
743 834
 		}
744 835
 
745 836
 		return implode(':', $ip);
@@ -748,21 +839,30 @@  discard block
 block discarded – undo
748 839
 	// Legacy IPv4 stuff.
749 840
 	// (count($low) != 4 || count($high) != 4) would not work because $low and $high always contain 8 elements!
750 841
 	if ((count($low) != 4 || count($high) != 4) && (count($low) != 8 || count($high) != 8))
751
-			return '';
842
+	{
843
+				return '';
844
+	}
752 845
 
753 846
 	for ($i = 0; $i < 4; $i++)
754 847
 	{
755 848
 		if ($low[$i] == $high[$i])
756
-			$ip[$i] = $low[$i];
849
+		{
850
+					$ip[$i] = $low[$i];
851
+		}
757 852
 		elseif ($low[$i] == '0' && $high[$i] == '255')
758
-			$ip[$i] = '*';
759
-		else
760
-			$ip[$i] = $low[$i] . '-' . $high[$i];
853
+		{
854
+					$ip[$i] = '*';
855
+		}
856
+		else {
857
+					$ip[$i] = $low[$i] . '-' . $high[$i];
858
+		}
761 859
 	}
762 860
 
763 861
 	// Pretending is fun... the IP can't be this, so use it for 'unknown'.
764 862
 	if ($ip == array(255, 255, 255, 255))
765
-		return 'unknown';
863
+	{
864
+			return 'unknown';
865
+	}
766 866
 
767 867
 	return implode('.', $ip);
768 868
 }
@@ -788,7 +888,8 @@  discard block
 block discarded – undo
788 888
 	$db = database();
789 889
 
790 890
 	if (count($ip_array) == 4 || count($ip_array) == 8)
791
-		$values = array(
891
+	{
892
+			$values = array(
792 893
 			'ip_low1' => $ip_array[0]['low'],
793 894
 			'ip_high1' => $ip_array[0]['high'],
794 895
 			'ip_low2' => $ip_array[1]['low'],
@@ -806,8 +907,10 @@  discard block
 block discarded – undo
806 907
 			'ip_low8' => $ip_array[7]['low'],
807 908
 			'ip_high8' => $ip_array[7]['high'],
808 909
 		);
809
-	else
810
-		$values = array('error' => 'invalid_ip');
910
+	}
911
+	else {
912
+			$values = array('error' => 'invalid_ip');
913
+	}
811 914
 
812 915
 	$request = $db->query('', '
813 916
 		SELECT bg.id_ban_group, bg.name
@@ -861,10 +964,14 @@  discard block
 block discarded – undo
861 964
 	$return = validateIPBan($ip_array, $fullip);
862 965
 
863 966
 	if (empty($return['error']))
864
-		return $return;
967
+	{
968
+			return $return;
969
+	}
865 970
 
866 971
 	if ($return['error'] === 'ban_trigger_already_exists')
867
-		throw new Elk_Exception($return['error'][0], false, $return['error'][1]);
972
+	{
973
+			throw new Elk_Exception($return['error'][0], false, $return['error'][1]);
974
+	}
868 975
 
869 976
 	return false;
870 977
 }
@@ -904,14 +1011,19 @@  discard block
 block discarded – undo
904 1011
 		function ($row) use (&$memberIDs, &$memberEmails, &$memberEmailWild)
905 1012
 		{
906 1013
 			if ($row['id_member'])
907
-				$memberIDs[$row['id_member']] = $row['id_member'];
1014
+			{
1015
+							$memberIDs[$row['id_member']] = $row['id_member'];
1016
+			}
908 1017
 			if ($row['email_address'])
909 1018
 			{
910 1019
 				// Does it have a wildcard - if so we can't do a IN on it.
911 1020
 				if (strpos($row['email_address'], '%') !== false)
912
-					$memberEmailWild[$row['email_address']] = $row['email_address'];
913
-				else
914
-					$memberEmails[$row['email_address']] = $row['email_address'];
1021
+				{
1022
+									$memberEmailWild[$row['email_address']] = $row['email_address'];
1023
+				}
1024
+				else {
1025
+									$memberEmails[$row['email_address']] = $row['email_address'];
1026
+				}
915 1027
 			}
916 1028
 		}
917 1029
 	);
@@ -997,7 +1109,9 @@  discard block
 block discarded – undo
997 1109
 	{
998 1110
 		require_once(SUBSDIR . '/Members.subs.php');
999 1111
 		foreach ($updates as $newStatus => $members)
1000
-			updateMemberData($members, array('is_activated' => $newStatus));
1112
+		{
1113
+					updateMemberData($members, array('is_activated' => $newStatus));
1114
+		}
1001 1115
 	}
1002 1116
 
1003 1117
 	// Update the latest member and our total members as banning may change them.
@@ -1020,7 +1134,8 @@  discard block
 block discarded – undo
1020 1134
 
1021 1135
 	$result = getBasicMemberData($id, array('moderation' => true));
1022 1136
 	if (!empty($result))
1023
-		$suggestions = array(
1137
+	{
1138
+			$suggestions = array(
1024 1139
 			'member' => array(
1025 1140
 				'id' => $result['id_member'],
1026 1141
 				'name' => $result['real_name'],
@@ -1028,6 +1143,7 @@  discard block
 block discarded – undo
1028 1143
 			'main_ip' => $result['member_ip'],
1029 1144
 			'email' => $result['email_address'],
1030 1145
 		);
1146
+	}
1031 1147
 
1032 1148
 	return $suggestions;
1033 1149
 }
@@ -1128,12 +1244,16 @@  discard block
 block discarded – undo
1128 1244
 			// Work out what restrictions we actually have.
1129 1245
 			$ban_restrictions = array();
1130 1246
 			foreach (array('access', 'register', 'login', 'post') as $type)
1131
-				if ($row['cannot_' . $type])
1247
+			{
1248
+							if ($row['cannot_' . $type])
1132 1249
 					$ban_restrictions[] = $txt['ban_type_' . $type];
1250
+			}
1133 1251
 
1134 1252
 			// No actual ban in place?
1135 1253
 			if (empty($ban_restrictions))
1136
-				continue;
1254
+			{
1255
+							continue;
1256
+			}
1137 1257
 
1138 1258
 			// Prepare the link for context.
1139 1259
 			$ban_explanation = sprintf($txt['user_cannot_due_to'], implode(', ', $ban_restrictions), '<a href="' . $scripturl . '?action=admin;area=ban;sa=edit;bg=' . $row['id_ban_group'] . '">' . $row['name'] . '</a>');
@@ -1296,7 +1416,9 @@  discard block
 block discarded – undo
1296 1416
 		)
1297 1417
 	);
1298 1418
 	if ($db->num_rows($request) == 0)
1299
-		throw new Elk_Exception('ban_not_found', false);
1419
+	{
1420
+			throw new Elk_Exception('ban_not_found', false);
1421
+	}
1300 1422
 	while ($row = $db->fetch_assoc($request))
1301 1423
 	{
1302 1424
 		if (!isset($context['ban']))
@@ -1446,7 +1568,9 @@  discard block
 block discarded – undo
1446 1568
 		)
1447 1569
 	);
1448 1570
 	while ($row = $db->fetch_assoc($request))
1449
-		$message_ips[] = $row['poster_ip'];
1571
+	{
1572
+			$message_ips[] = $row['poster_ip'];
1573
+	}
1450 1574
 	$db->free_result($request);
1451 1575
 
1452 1576
 	return $message_ips;
@@ -1475,7 +1599,9 @@  discard block
 block discarded – undo
1475 1599
 		)
1476 1600
 	);
1477 1601
 	while ($row = $db->fetch_assoc($request))
1478
-		$error_ips[] = $row['ip'];
1602
+	{
1603
+			$error_ips[] = $row['ip'];
1604
+	}
1479 1605
 	$db->free_result($request);
1480 1606
 
1481 1607
 	return $error_ips;
@@ -1499,8 +1625,10 @@  discard block
 block discarded – undo
1499 1625
 
1500 1626
 	$return = array();
1501 1627
 	foreach ($search_list as $key => $callable)
1502
-		if (is_callable($callable))
1628
+	{
1629
+			if (is_callable($callable))
1503 1630
 			$return[$key] = call_user_func($callable, $member_id);
1631
+	}
1504 1632
 
1505 1633
 	return $return;
1506 1634
 }
@@ -1517,7 +1645,9 @@  discard block
 block discarded – undo
1517 1645
 	$db = database();
1518 1646
 
1519 1647
 	if (!is_array($ban_ids))
1520
-		$ban_ids = array($ban_ids);
1648
+	{
1649
+			$ban_ids = array($ban_ids);
1650
+	}
1521 1651
 
1522 1652
 	$request = $db->query('', '
1523 1653
 		SELECT
@@ -1536,7 +1666,9 @@  discard block
 block discarded – undo
1536 1666
 	);
1537 1667
 	$details = array();
1538 1668
 	while ($row = $db->fetch_assoc($request))
1539
-		$details[$row['id_ban']] = $row;
1669
+	{
1670
+			$details[$row['id_ban']] = $row;
1671
+	}
1540 1672
 	$db->free_result($request);
1541 1673
 
1542 1674
 	return $details;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 			'current_time' => time(),
902 902
 			'blank_string' => '',
903 903
 		),
904
-		function ($row) use (&$memberIDs, &$memberEmails, &$memberEmailWild)
904
+		function($row) use (&$memberIDs, &$memberEmails, &$memberEmailWild)
905 905
 		{
906 906
 			if ($row['id_member'])
907 907
 				$memberIDs[$row['id_member']] = $row['id_member'];
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 			FROM {db_prefix}members AS mem
947 947
 			WHERE ' . implode(' OR ', $queryPart),
948 948
 			$queryValues,
949
-			function ($row) use (&$allMembers, &$updates, &$newMembers)
949
+			function($row) use (&$allMembers, &$updates, &$newMembers)
950 950
 			{
951 951
 				if (!in_array($row['id_member'], $allMembers))
952 952
 				{
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 			'current_time' => time(),
983 983
 			'ban_flag' => 10,
984 984
 		),
985
-		function ($row) use (&$allMembers, &$updates)
985
+		function($row) use (&$allMembers, &$updates)
986 986
 		{
987 987
 			// Don't do this twice!
988 988
 			if (!in_array($row['id_member'], $allMembers))
Please login to merge, or discard this patch.
sources/subs/Menu.subs.php 1 patch
Braces   +93 added lines, -34 removed lines patch added patch discarded remove patch
@@ -80,24 +80,32 @@  discard block
 block discarded – undo
80 80
 
81 81
 	// Allow extend *any* menu with a single hook
82 82
 	if (!empty($menuOptions['hook']))
83
-		call_integration_hook('integrate_' . $menuOptions['hook'] . '_areas', array(&$menuData, &$menuOptions));
83
+	{
84
+			call_integration_hook('integrate_' . $menuOptions['hook'] . '_areas', array(&$menuData, &$menuOptions));
85
+	}
84 86
 
85 87
 	// What is the general action of this menu (i.e. $scripturl?action=XXXX.
86 88
 	$menu_context['current_action'] = isset($menuOptions['action']) ? $menuOptions['action'] : $context['current_action'];
87 89
 
88 90
 	// What is the current area selected?
89 91
 	if (isset($menuOptions['current_area']) || isset($_req->query->area))
90
-		$menu_context['current_area'] = isset($menuOptions['current_area']) ? $menuOptions['current_area'] : $_req->query->area;
92
+	{
93
+			$menu_context['current_area'] = isset($menuOptions['current_area']) ? $menuOptions['current_area'] : $_req->query->area;
94
+	}
91 95
 
92 96
 	// Build a list of additional parameters that should go in the URL.
93 97
 	$menu_context['extra_parameters'] = '';
94 98
 	if (!empty($menuOptions['extra_url_parameters']))
95
-		foreach ($menuOptions['extra_url_parameters'] as $key => $value)
99
+	{
100
+			foreach ($menuOptions['extra_url_parameters'] as $key => $value)
96 101
 			$menu_context['extra_parameters'] .= ';' . $key . '=' . $value;
102
+	}
97 103
 
98 104
 	// Only include the session ID in the URL if it's strictly necessary.
99 105
 	if (empty($menuOptions['disable_url_session_check']))
100
-		$menu_context['extra_parameters'] .= ';' . $context['session_var'] . '=' . $context['session_id'];
106
+	{
107
+			$menu_context['extra_parameters'] .= ';' . $context['session_var'] . '=' . $context['session_id'];
108
+	}
101 109
 
102 110
 	$include_data = array();
103 111
 	// This is necessary only in profile (at least for the core), but we do it always because it's easier
@@ -108,7 +116,9 @@  discard block
 block discarded – undo
108 116
 	{
109 117
 		// Is this enabled?
110 118
 		if ((isset($section['enabled']) && $section['enabled'] == false))
111
-			continue;
119
+		{
120
+					continue;
121
+		}
112 122
 		// Has permission check?
113 123
 		if (isset($section['permission']))
114 124
 		{
@@ -116,10 +126,14 @@  discard block
 block discarded – undo
116 126
 			if (is_array($section['permission']) && isset($section['permission']['own'], $section['permission']['any']))
117 127
 			{
118 128
 				if (empty($section['permission'][$permission_set]) || !allowedTo($section['permission'][$permission_set]))
119
-					continue;
129
+				{
130
+									continue;
131
+				}
120 132
 			}
121 133
 			elseif (!allowedTo($section['permission']))
122
-				continue;
134
+			{
135
+							continue;
136
+			}
123 137
 		}
124 138
 
125 139
 		// Now we cycle through the sections to pick the right area.
@@ -135,10 +149,14 @@  discard block
 block discarded – undo
135 149
 					if (is_array($area['permission']) && isset($area['permission']['own'], $area['permission']['any']))
136 150
 					{
137 151
 						if (empty($area['permission'][$permission_set]) || !allowedTo($area['permission'][$permission_set]))
138
-							continue;
152
+						{
153
+													continue;
154
+						}
139 155
 					}
140 156
 					elseif (!allowedTo($area['permission']))
141
-						continue;
157
+					{
158
+											continue;
159
+					}
142 160
 				}
143 161
 
144 162
 				// Add it to the context... if it has some form of name!
@@ -146,7 +164,9 @@  discard block
 block discarded – undo
146 164
 				{
147 165
 					// We may want to include a file, let's find out the path
148 166
 					if (!empty($area['file']))
149
-							$area['file'] = (!empty($area['dir']) ? $area['dir'] : (!empty($menuOptions['default_include_dir']) ? $menuOptions['default_include_dir'] : CONTROLLERDIR)) . '/' . $area['file'];
167
+					{
168
+												$area['file'] = (!empty($area['dir']) ? $area['dir'] : (!empty($menuOptions['default_include_dir']) ? $menuOptions['default_include_dir'] : CONTROLLERDIR)) . '/' . $area['file'];
169
+					}
150 170
 
151 171
 					// If we haven't got an area then the first valid one is our choice.
152 172
 					if (!isset($menu_context['current_area']))
@@ -162,27 +182,36 @@  discard block
 block discarded – undo
162 182
 						if (!isset($menu_context['sections'][$section_id]))
163 183
 						{
164 184
 							if (isset($menuOptions['counters'], $section['counter']) && !empty($menuOptions['counters'][$section['counter']]))
165
-								$section['title'] .= sprintf($settings['menu_numeric_notice'][0], $menuOptions['counters'][$section['counter']]);
185
+							{
186
+															$section['title'] .= sprintf($settings['menu_numeric_notice'][0], $menuOptions['counters'][$section['counter']]);
187
+							}
166 188
 
167 189
 							$menu_context['sections'][$section_id]['title'] = $section['title'];
168 190
 						}
169 191
 
170 192
 						$menu_context['sections'][$section_id]['areas'][$area_id] = array('label' => isset($area['label']) ? $area['label'] : $txt[$area_id]);
171 193
 						if (isset($menuOptions['counters'], $area['counter']) && !empty($menuOptions['counters'][$area['counter']]))
172
-							$menu_context['sections'][$section_id]['areas'][$area_id]['label'] .= sprintf($settings['menu_numeric_notice'][1], $menuOptions['counters'][$area['counter']]);
194
+						{
195
+													$menu_context['sections'][$section_id]['areas'][$area_id]['label'] .= sprintf($settings['menu_numeric_notice'][1], $menuOptions['counters'][$area['counter']]);
196
+						}
173 197
 
174 198
 						// We'll need the ID as well...
175 199
 						$menu_context['sections'][$section_id]['id'] = $section_id;
176 200
 
177 201
 						// Does it have a custom URL?
178 202
 						if (isset($area['custom_url']))
179
-							$menu_context['sections'][$section_id]['areas'][$area_id]['url'] = $area['custom_url'];
203
+						{
204
+													$menu_context['sections'][$section_id]['areas'][$area_id]['url'] = $area['custom_url'];
205
+						}
180 206
 
181 207
 						// Does this area have its own icon?
182 208
 						if (isset($area['icon']))
183
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img ' . (isset($area['class']) ? 'class="' . $area['class'] . '" ' : 'style="background: none"') . ' src="' . $context['menu_image_path'] . '/' . $area['icon'] . '" alt="" />&nbsp;&nbsp;';
184
-						else
185
-							$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '';
209
+						{
210
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '<img ' . (isset($area['class']) ? 'class="' . $area['class'] . '" ' : 'style="background: none"') . ' src="' . $context['menu_image_path'] . '/' . $area['icon'] . '" alt="" />&nbsp;&nbsp;';
211
+						}
212
+						else {
213
+													$menu_context['sections'][$section_id]['areas'][$area_id]['icon'] = '';
214
+						}
186 215
 
187 216
 						// Did it have subsections?
188 217
 						if (!empty($area['subsections']))
@@ -194,41 +223,56 @@  discard block
 block discarded – undo
194 223
 								if ((empty($sub[1]) || allowedTo($sub[1])) && (!isset($sub['enabled']) || !empty($sub['enabled'])))
195 224
 								{
196 225
 									if ($first_sa === null)
197
-										$first_sa = $sa;
226
+									{
227
+																			$first_sa = $sa;
228
+									}
198 229
 
199 230
 									$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa] = array('label' => $sub[0]);
200 231
 									if (isset($menuOptions['counters'], $sub['counter']) && !empty($menuOptions['counters'][$sub['counter']]))
201
-										$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['label'] .= sprintf($settings['menu_numeric_notice'][2], $menuOptions['counters'][$sub['counter']]);
232
+									{
233
+																			$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['label'] .= sprintf($settings['menu_numeric_notice'][2], $menuOptions['counters'][$sub['counter']]);
234
+									}
202 235
 
203 236
 									// Custom URL?
204 237
 									if (isset($sub['url']))
205
-										$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['url'] = $sub['url'];
238
+									{
239
+																			$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['url'] = $sub['url'];
240
+									}
206 241
 
207 242
 									// A bit complicated - but is this set?
208 243
 									if ($menu_context['current_area'] == $area_id)
209 244
 									{
210 245
 										// Save which is the first...
211 246
 										if (empty($first_sa))
212
-											$first_sa = $sa;
247
+										{
248
+																					$first_sa = $sa;
249
+										}
213 250
 
214 251
 										// Is this the current subsection?
215 252
 										if (isset($_req->query->sa) && $_req->query->sa == $sa)
216
-											$menu_context['current_subsection'] = $sa;
253
+										{
254
+																					$menu_context['current_subsection'] = $sa;
255
+										}
217 256
 
218 257
 										elseif (isset($sub['active']) && isset($_req->query->sa) && in_array($_req->query->sa, $sub['active']))
219
-											$menu_context['current_subsection'] = $sa;
258
+										{
259
+																					$menu_context['current_subsection'] = $sa;
260
+										}
220 261
 
221 262
 										// Otherwise is it the default?
222 263
 										elseif (!isset($menu_context['current_subsection']) && !empty($sub[2]))
223
-											$menu_context['current_subsection'] = $sa;
264
+										{
265
+																					$menu_context['current_subsection'] = $sa;
266
+										}
224 267
 									}
225 268
 
226 269
 									// Let's assume this is the last, for now.
227 270
 									$last_sa = $sa;
228 271
 								}
229 272
 								// Mark it as disabled...
230
-								else
231
-									$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true;
273
+								else {
274
+																	$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true;
275
+								}
232 276
 							}
233 277
 
234 278
 							// Set which one is first, last and selected in the group.
@@ -238,7 +282,9 @@  discard block
 block discarded – undo
238 282
 								$menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$context['right_to_left'] ? $first_sa : $last_sa]['is_last'] = true;
239 283
 
240 284
 								if ($menu_context['current_area'] == $area_id && !isset($menu_context['current_subsection']))
241
-									$menu_context['current_subsection'] = $first_sa;
285
+								{
286
+																	$menu_context['current_subsection'] = $first_sa;
287
+								}
242 288
 							}
243 289
 						}
244 290
 					}
@@ -284,14 +330,18 @@  discard block
 block discarded – undo
284 330
 		$menu_context['sections'][$menu_context['current_section']]['selected'] = true;
285 331
 		$menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['selected'] = true;
286 332
 		if (!empty($menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]))
287
-			$menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]['selected'] = true;
333
+		{
334
+					$menu_context['sections'][$menu_context['current_section']]['areas'][$menu_context['current_area']]['subsections'][$context['current_subaction']]['selected'] = true;
335
+		}
288 336
 
289 337
 		foreach ($menu_context['sections'] as $section_id => $section)
290
-			foreach ($section['areas'] as $area_id => $area)
338
+		{
339
+					foreach ($section['areas'] as $area_id => $area)
291 340
 			{
292 341
 				if (!isset($menu_context['sections'][$section_id]['url']))
293 342
 				{
294 343
 					$menu_context['sections'][$section_id]['url'] = isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $area_id;
344
+		}
295 345
 					break;
296 346
 				}
297 347
 			}
@@ -299,7 +349,9 @@  discard block
 block discarded – undo
299 349
 
300 350
 	// If we didn't find the area we were looking for go to a default one.
301 351
 	if (isset($backup_area) && empty($found_section))
302
-		$menu_context['current_area'] = $backup_area;
352
+	{
353
+			$menu_context['current_area'] = $backup_area;
354
+	}
303 355
 
304 356
 	// If still no data then return - nothing to show!
305 357
 	if (empty($menu_context['sections']))
@@ -307,7 +359,9 @@  discard block
 block discarded – undo
307 359
 		// Never happened!
308 360
 		$context['max_menu_id']--;
309 361
 		if ($context['max_menu_id'] == 0)
310
-			unset($context['max_menu_id']);
362
+		{
363
+					unset($context['max_menu_id']);
364
+		}
311 365
 
312 366
 		return false;
313 367
 	}
@@ -318,8 +372,9 @@  discard block
 block discarded – undo
318 372
 		$menuOptions['menu_type'] = '_' . (empty($options['use_sidebar_menu']) ? 'dropdown' : 'sidebar');
319 373
 		$menu_context['can_toggle_drop_down'] = !$user_info['is_guest'] && isset($settings['theme_version']) && $settings['theme_version'] >= 2.0;
320 374
 	}
321
-	else
322
-		$menu_context['can_toggle_drop_down'] = !empty($menuOptions['can_toggle_drop_down']);
375
+	else {
376
+			$menu_context['can_toggle_drop_down'] = !empty($menuOptions['can_toggle_drop_down']);
377
+	}
323 378
 
324 379
 	// Almost there - load the template and add to the template layers.
325 380
 	loadTemplate(isset($menuOptions['template_name']) ? $menuOptions['template_name'] : 'GenericMenu');
@@ -328,7 +383,9 @@  discard block
 block discarded – undo
328 383
 
329 384
 	// Check we had something - for sanity sake.
330 385
 	if (empty($include_data))
331
-		return false;
386
+	{
387
+			return false;
388
+	}
332 389
 
333 390
 	// Finally - return information on the selected item.
334 391
 	$include_data += array(
@@ -353,7 +410,9 @@  discard block
 block discarded – undo
353 410
 
354 411
 	$menu_name = $menu_id == 'last' && isset($context['max_menu_id']) && isset($context['menu_data_' . $context['max_menu_id']]) ? 'menu_data_' . $context['max_menu_id'] : 'menu_data_' . $menu_id;
355 412
 	if (!isset($context[$menu_name]))
356
-		return false;
413
+	{
414
+			return false;
415
+	}
357 416
 
358 417
 	Template_Layers::instance()->remove($context[$menu_name]['layer_name']);
359 418
 
Please login to merge, or discard this patch.
sources/subs/Memberlist.subs.php 1 patch
Braces   +24 added lines, -9 removed lines patch added patch discarded remove patch
@@ -65,15 +65,18 @@  discard block
 block discarded – undo
65 65
 		{
66 66
 			// Build the sort queries.
67 67
 			if ($row['field_type'] != 'check')
68
-				$context['custom_profile_fields']['columns'][$curField]['sort'] = array(
68
+			{
69
+							$context['custom_profile_fields']['columns'][$curField]['sort'] = array(
69 70
 					'down' => 'LENGTH(cfd' . $curField . '.value) > 0 ASC, COALESCE(cfd' . $curField . '.value, 1=1) DESC, cfd' . $curField . '.value DESC',
70 71
 					'up' => 'LENGTH(cfd' . $curField . '.value) > 0 DESC, COALESCE(cfd' . $curField . '.value, 1=1) ASC, cfd' . $curField . '.value ASC'
71 72
 				);
72
-			else
73
-				$context['custom_profile_fields']['columns'][$curField]['sort'] = array(
73
+			}
74
+			else {
75
+							$context['custom_profile_fields']['columns'][$curField]['sort'] = array(
74 76
 					'down' => 'cfd' . $curField . '.value DESC',
75 77
 					'up' => 'cfd' . $curField . '.value ASC'
76 78
 				);
79
+			}
77 80
 
78 81
 			// Build the join and parameters for the sort query
79 82
 			$context['custom_profile_fields']['join'] = 'LEFT JOIN {db_prefix}custom_fields_data AS cfd' . $curField . ' ON (cfd' . $curField . '.variable = {string:cfd' . $curField . '} AND cfd' . $curField . '.id_member = mem.id_member)';
@@ -291,11 +294,13 @@  discard block
 block discarded – undo
291 294
 	);
292 295
 	$context['custom_search_fields'] = array();
293 296
 	while ($row = $db->fetch_assoc($request))
294
-		$context['custom_search_fields'][$row['col_name']] = array(
297
+	{
298
+			$context['custom_search_fields'][$row['col_name']] = array(
295 299
 			'colname' => $row['col_name'],
296 300
 			'name' => $row['field_name'],
297 301
 			'desc' => $row['field_desc'],
298 302
 		);
303
+	}
299 304
 	$db->free_result($request);
300 305
 }
301 306
 
@@ -323,11 +328,15 @@  discard block
 block discarded – undo
323 328
 
324 329
 	// Avoid division by zero...
325 330
 	if ($most_posts == 0)
326
-		$most_posts = 1;
331
+	{
332
+			$most_posts = 1;
333
+	}
327 334
 
328 335
 	$members = array();
329 336
 	while ($row = $db->fetch_assoc($request))
330
-		$members[] = $row['id_member'];
337
+	{
338
+			$members[] = $row['id_member'];
339
+	}
331 340
 
332 341
 	// Load all the members for display.
333 342
 	loadMemberData($members);
@@ -338,7 +347,9 @@  discard block
 block discarded – undo
338 347
 	foreach ($members as $member)
339 348
 	{
340 349
 		if (!loadMemberContext($member, true))
341
-			continue;
350
+		{
351
+					continue;
352
+		}
342 353
 
343 354
 		$context['members'][$member] = $memberContext[$member];
344 355
 		$context['members'][$member]['post_percent'] = round(($context['members'][$member]['real_posts'] * 100) / $most_posts);
@@ -388,9 +399,13 @@  discard block
 block discarded – undo
388 399
 
389 400
 				// Anything else to make it look "nice"
390 401
 				if ($column['bbc'])
391
-					$context['members'][$member]['options'][$curField] = strip_tags($bbc_parser->parseCustomFields($context['members'][$member]['options'][$curField]));
402
+				{
403
+									$context['members'][$member]['options'][$curField] = strip_tags($bbc_parser->parseCustomFields($context['members'][$member]['options'][$curField]));
404
+				}
392 405
 				elseif ($column['type'] === 'check')
393
-					$context['members'][$member]['options'][$curField] = $context['members'][$member]['options'][$curField] == 0 ? $txt['no'] : $txt['yes'];
406
+				{
407
+									$context['members'][$member]['options'][$curField] = $context['members'][$member]['options'][$curField] == 0 ? $txt['no'] : $txt['yes'];
408
+				}
394 409
 			}
395 410
 		}
396 411
 	}
Please login to merge, or discard this patch.
sources/subs/Language.subs.php 1 patch
Braces   +76 added lines, -31 removed lines patch added patch discarded remove patch
@@ -74,9 +74,12 @@  discard block
 block discarded – undo
74 74
 	// Put them back.
75 75
 	$settings['actual_theme_dir'] = $backup_actual_theme_dir;
76 76
 	if (!empty($backup_base_theme_dir))
77
-		$settings['base_theme_dir'] = $backup_base_theme_dir;
78
-	else
79
-		unset($settings['base_theme_dir']);
77
+	{
78
+			$settings['base_theme_dir'] = $backup_base_theme_dir;
79
+	}
80
+	else {
81
+			unset($settings['base_theme_dir']);
82
+	}
80 83
 
81 84
 	// Get the language files and data...
82 85
 	foreach ($all_languages as $lang)
@@ -106,12 +109,18 @@  discard block
 block discarded – undo
106 109
 	{
107 110
 		// Default?
108 111
 		if (empty($row['lngfile']) || !isset($languages[$row['lngfile']]))
109
-			$row['lngfile'] = $language;
112
+		{
113
+					$row['lngfile'] = $language;
114
+		}
110 115
 
111 116
 		if (!isset($languages[$row['lngfile']]) && isset($languages['english']))
112
-			$languages['english']['count'] += $row['num_users'];
117
+		{
118
+					$languages['english']['count'] += $row['num_users'];
119
+		}
113 120
 		elseif (isset($languages[$row['lngfile']]))
114
-			$languages[$row['lngfile']]['count'] += $row['num_users'];
121
+		{
122
+					$languages[$row['lngfile']]['count'] += $row['num_users'];
123
+		}
115 124
 	}
116 125
 	$db->free_result($request);
117 126
 
@@ -149,7 +158,9 @@  discard block
 block discarded – undo
149 158
 
150 159
 				// If we're now escaped don't add this string.
151 160
 				if ($is_escape)
152
-					continue;
161
+				{
162
+									continue;
163
+				}
153 164
 			}
154 165
 			// Special case - parsed string with line break etc?
155 166
 			elseif (($string[$i] == 'n' || $string[$i] == 't') && $in_string == 2 && $is_escape)
@@ -167,10 +178,13 @@  discard block
 block discarded – undo
167 178
 				{
168 179
 					// Is it the end of a single quote string?
169 180
 					if ($in_string == 1)
170
-						$in_string = 0;
181
+					{
182
+											$in_string = 0;
183
+					}
171 184
 					// Otherwise it's the start!
172
-					else
173
-						$in_string = 1;
185
+					else {
186
+											$in_string = 1;
187
+					}
174 188
 
175 189
 					// Don't actually include this character!
176 190
 					continue;
@@ -184,10 +198,13 @@  discard block
 block discarded – undo
184 198
 				{
185 199
 					// Is it the end of a double quote string?
186 200
 					if ($in_string == 2)
187
-						$in_string = 0;
201
+					{
202
+											$in_string = 0;
203
+					}
188 204
 					// Otherwise it's the start!
189
-					else
190
-						$in_string = 2;
205
+					else {
206
+											$in_string = 2;
207
+					}
191 208
 
192 209
 					// Don't actually include this character!
193 210
 					continue;
@@ -195,7 +212,9 @@  discard block
 block discarded – undo
195 212
 			}
196 213
 			// A join/space outside of a string is simply removed.
197 214
 			elseif ($in_string == 0 && (empty($string[$i]) || $string[$i] == '.'))
198
-				continue;
215
+			{
216
+							continue;
217
+			}
199 218
 			// Start of a variable?
200 219
 			elseif ($in_string == 0 && $string[$i] == '$')
201 220
 			{
@@ -261,9 +280,13 @@  discard block
 block discarded – undo
261 280
 				if (!empty($matches[1]))
262 281
 				{
263 282
 					if ($in_string == 1)
264
-						$new_string .= '\' . ';
283
+					{
284
+											$new_string .= '\' . ';
285
+					}
265 286
 					elseif ($new_string)
266
-						$new_string .= ' . ';
287
+					{
288
+											$new_string .= ' . ';
289
+					}
267 290
 
268 291
 					$new_string .= $matches[1];
269 292
 					$i += strlen($matches[1]) + 3;
@@ -277,7 +300,9 @@  discard block
 block discarded – undo
277 300
 			{
278 301
 				// Probably HTML?
279 302
 				if ($string[$i + 1] != ' ')
280
-					$in_html = true;
303
+				{
304
+									$in_html = true;
305
+				}
281 306
 				// Assume we need an entity...
282 307
 				else
283 308
 				{
@@ -290,7 +315,9 @@  discard block
 block discarded – undo
290 315
 			{
291 316
 				// Will it be HTML?
292 317
 				if ($in_html)
293
-					$in_html = false;
318
+				{
319
+									$in_html = false;
320
+				}
294 321
 				// Otherwise we need an entity...
295 322
 				else
296 323
 				{
@@ -300,7 +327,9 @@  discard block
 block discarded – undo
300 327
 			}
301 328
 			// Is it a slash? If so escape it...
302 329
 			if ($string[$i] == '\\')
303
-				$new_string .= '\\';
330
+			{
331
+							$new_string .= '\\';
332
+			}
304 333
 			// The infamous double quote?
305 334
 			elseif ($string[$i] == '"')
306 335
 			{
@@ -324,9 +353,13 @@  discard block
 block discarded – undo
324 353
 
325 354
 		// If we ended as a string then close it off.
326 355
 		if ($in_string == 1)
327
-			$new_string .= '\'';
356
+		{
357
+					$new_string .= '\'';
358
+		}
328 359
 		elseif ($in_string == 2)
329
-			$new_string .= '"';
360
+		{
361
+					$new_string .= '"';
362
+		}
330 363
 	}
331 364
 
332 365
 	return $new_string;
@@ -353,9 +386,13 @@  discard block
 block discarded – undo
353 386
 
354 387
 	// Check that the site responded and that the language exists.
355 388
 	if (!$language_list->exists('languages'))
356
-		$context['langfile_error'] = 'no_response';
389
+	{
390
+			$context['langfile_error'] = 'no_response';
391
+	}
357 392
 	elseif (!$language_list->exists('languages/language'))
358
-		$context['langfile_error'] = 'no_files';
393
+	{
394
+			$context['langfile_error'] = 'no_files';
395
+	}
359 396
 	else
360 397
 	{
361 398
 		$language_list = $language_list->path('languages[0]');
@@ -365,7 +402,9 @@  discard block
 block discarded – undo
365 402
 		{
366 403
 			// Were we searching?
367 404
 			if (!empty($context['elk_search_term']) && strpos($file->fetch('name'), Util::strtolower($context['elk_search_term'])) === false)
368
-				continue;
405
+			{
406
+							continue;
407
+			}
369 408
 
370 409
 			$languages[] = array(
371 410
 				'id' => $file->fetch('id'),
@@ -377,9 +416,12 @@  discard block
 block discarded – undo
377 416
 			);
378 417
 		}
379 418
 		if (empty($languages))
380
-			$context['langfile_error'] = 'no_files';
381
-		else
382
-			return $languages;
419
+		{
420
+					$context['langfile_error'] = 'no_files';
421
+		}
422
+		else {
423
+					return $languages;
424
+		}
383 425
 	}
384 426
 }
385 427
 
@@ -413,7 +455,10 @@  discard block
 block discarded – undo
413 455
 	$db->free_result($request);
414 456
 
415 457
 	if (!empty($pid))
416
-		return array($pid, $file_name);
417
-	else
418
-		return false;
419
-}
458
+	{
459
+			return array($pid, $file_name);
460
+	}
461
+	else {
462
+			return false;
463
+	}
464
+	}
Please login to merge, or discard this patch.
sources/subs/DataValidator.class.php 1 patch
Braces   +219 added lines, -82 removed lines patch added patch discarded remove patch
@@ -174,13 +174,18 @@  discard block
 block discarded – undo
174 174
 	{
175 175
 		// If its not an array, make it one
176 176
 		if (!is_array($rules))
177
-			$rules = array($rules);
177
+		{
178
+					$rules = array($rules);
179
+		}
178 180
 
179 181
 		// Set the validation rules
180 182
 		if (!empty($rules))
181
-			$this->_validation_rules = $rules;
182
-		else
183
-			return $this->_validation_rules;
183
+		{
184
+					$this->_validation_rules = $rules;
185
+		}
186
+		else {
187
+					return $this->_validation_rules;
188
+		}
184 189
 	}
185 190
 
186 191
 	/**
@@ -193,15 +198,20 @@  discard block
 block discarded – undo
193 198
 	{
194 199
 		// If its not an array, make it one
195 200
 		if (!is_array($rules))
196
-			$rules = array($rules);
201
+		{
202
+					$rules = array($rules);
203
+		}
197 204
 
198 205
 		// Set the sanitation rules
199 206
 		$this->_strict = $strict;
200 207
 
201 208
 		if (!empty($rules))
202
-			$this->_sanitation_rules = $rules;
203
-		else
204
-			return $this->_sanitation_rules;
209
+		{
210
+					$this->_sanitation_rules = $rules;
211
+		}
212
+		else {
213
+					return $this->_sanitation_rules;
214
+		}
205 215
 	}
206 216
 
207 217
 	/**
@@ -211,9 +221,12 @@  discard block
 block discarded – undo
211 221
 	public function text_replacements($replacements = array())
212 222
 	{
213 223
 		if (!empty($replacements))
214
-			$this->_replacements = $replacements;
215
-		else
216
-			return $this->_replacements;
224
+		{
225
+					$this->_replacements = $replacements;
226
+		}
227
+		else {
228
+					return $this->_replacements;
229
+		}
217 230
 	}
218 231
 
219 232
 	/**
@@ -225,9 +238,12 @@  discard block
 block discarded – undo
225 238
 	public function input_processing($datatype = array())
226 239
 	{
227 240
 		if (!empty($datatype))
228
-			$this->_datatype = $datatype;
229
-		else
230
-			return $this->_datatype;
241
+		{
242
+					$this->_datatype = $datatype;
243
+		}
244
+		else {
245
+					return $this->_datatype;
246
+		}
231 247
 	}
232 248
 
233 249
 	/**
@@ -239,11 +255,15 @@  discard block
 block discarded – undo
239 255
 	{
240 256
 		// If its an object, convert it to an array
241 257
 		if (is_object($input))
242
-			$input = (array) $input;
258
+		{
259
+					$input = (array) $input;
260
+		}
243 261
 
244 262
 		// @todo this won't work, $input[$field] will be undefined
245 263
 		if (!is_array($input))
246
-			$input[$input] = array($input);
264
+		{
265
+					$input[$input] = array($input);
266
+		}
247 267
 
248 268
 		// Clean em
249 269
 		$this->_data = $this->_sanitize($input, $this->_sanitation_rules);
@@ -265,10 +285,13 @@  discard block
 block discarded – undo
265 285
 	{
266 286
 		// Return the array
267 287
 		if ($raw === true)
268
-			return $this->_validation_errors;
288
+		{
289
+					return $this->_validation_errors;
290
+		}
269 291
 		// Otherwise return the formatted text string(s)
270
-		else
271
-			return $this->_get_error_messages($raw);
292
+		else {
293
+					return $this->_get_error_messages($raw);
294
+		}
272 295
 	}
273 296
 
274 297
 	/**
@@ -278,7 +301,9 @@  discard block
 block discarded – undo
278 301
 	public function validation_data($key = null)
279 302
 	{
280 303
 		if ($key === null)
281
-			return $this->_data;
304
+		{
305
+					return $this->_data;
306
+		}
282 307
 
283 308
 		return isset($this->_data[$key]) ? $this->_data[$key] : null;
284 309
 	}
@@ -299,7 +324,9 @@  discard block
 block discarded – undo
299 324
 		{
300 325
 			// Special processing required on this field like csv or array?
301 326
 			if (isset($this->_datatype[$field]) && in_array($this->_datatype[$field], array('csv', 'array')))
302
-				$this->_validate_recursive($input, $field, $rules);
327
+			{
328
+							$this->_validate_recursive($input, $field, $rules);
329
+			}
303 330
 			else
304 331
 			{
305 332
 				// Get rules for this field
@@ -326,20 +353,27 @@  discard block
 block discarded – undo
326 353
 
327 354
 					// Defined method to use?
328 355
 					if (is_callable(array($this, $validation_method)))
329
-						$result = $this->{$validation_method}($field, $input, $validation_parameters);
356
+					{
357
+											$result = $this->{$validation_method}($field, $input, $validation_parameters);
358
+					}
330 359
 					// Maybe even a custom function set up like a defined one, addons can do this.
331 360
 					elseif (is_callable($validation_function) && strpos($validation_function, 'validate_') === 0 && isset($input[$field]))
332
-						$result = call_user_func_array($validation_function, array_merge((array) $field, (array) $input[$field], $validation_parameters_function));
333
-					else
334
-						$result = array(
361
+					{
362
+											$result = call_user_func_array($validation_function, array_merge((array) $field, (array) $input[$field], $validation_parameters_function));
363
+					}
364
+					else {
365
+											$result = array(
335 366
 							'field' => $validation_method,
336 367
 							'input' => isset($input[$field]) ? $input[$field] : null,
337 368
 							'function' => '_validate_invalid_function',
338 369
 							'param' => $validation_parameters
339 370
 						);
371
+					}
340 372
 
341 373
 					if (is_array($result))
342
-						$this->_validation_errors[] = $result;
374
+					{
375
+											$this->_validation_errors[] = $result;
376
+					}
343 377
 				}
344 378
 			}
345 379
 		}
@@ -360,7 +394,9 @@  discard block
 block discarded – undo
360 394
 	private function _validate_recursive($input, $field, $rules)
361 395
 	{
362 396
 		if (!isset($input[$field]))
363
-			return;
397
+		{
398
+					return;
399
+		}
364 400
 
365 401
 		// Start a new instance of the validator to work on this sub data (csv/array)
366 402
 		$sub_validator = new Data_Validator();
@@ -427,14 +463,18 @@  discard block
 block discarded – undo
427 463
 			if (!array_key_exists($field, $input))
428 464
 			{
429 465
 				if ($this->_strict)
430
-					unset($input[$field]);
466
+				{
467
+									unset($input[$field]);
468
+				}
431 469
 
432 470
 				continue;
433 471
 			}
434 472
 
435 473
 			// Is this a special processing field like csv or array?
436 474
 			if (isset($this->_datatype[$field]) && in_array($this->_datatype[$field], array('csv', 'array')))
437
-				$input[$field] = $this->_sanitize_recursive($input, $field, $rules);
475
+			{
476
+							$input[$field] = $this->_sanitize_recursive($input, $field, $rules);
477
+			}
438 478
 			else
439 479
 			{
440 480
 				// Rules for which we do have data
@@ -461,10 +501,14 @@  discard block
 block discarded – undo
461 501
 
462 502
 					// Defined method to use?
463 503
 					if (is_callable(array($this, $sanitation_method)))
464
-						$input[$field] = $this->{$sanitation_method}($input[$field], $sanitation_parameters);
504
+					{
505
+											$input[$field] = $this->{$sanitation_method}($input[$field], $sanitation_parameters);
506
+					}
465 507
 					// One of our static methods or even a built in php function like strtoupper, intval, etc?
466 508
 					elseif (is_callable($sanitation_function))
467
-						$input[$field] = call_user_func_array($sanitation_function, array_merge((array) $input[$field], $sanitation_parameters_function));
509
+					{
510
+											$input[$field] = call_user_func_array($sanitation_function, array_merge((array) $input[$field], $sanitation_parameters_function));
511
+					}
468 512
 					// Or even a language construct?
469 513
 					elseif (in_array($sanitation_function, array('empty', 'array', 'isset')))
470 514
 					{
@@ -557,14 +601,18 @@  discard block
 block discarded – undo
557 601
 		global $txt;
558 602
 
559 603
 		if (empty($this->_validation_errors))
560
-			return false;
604
+		{
605
+					return false;
606
+		}
561 607
 
562 608
 		loadLanguage('Validation');
563 609
 		$result = array();
564 610
 
565 611
 		// Just want specific errors then it must be an array
566 612
 		if (!empty($keys) && !is_array($keys))
567
-			$keys = array($keys);
613
+		{
614
+					$keys = array($keys);
615
+		}
568 616
 
569 617
 		foreach ($this->_validation_errors as $error)
570 618
 		{
@@ -573,22 +621,30 @@  discard block
 block discarded – undo
573 621
 
574 622
 			// Just want specific field errors returned?
575 623
 			if (!empty($keys) && is_array($keys) && !in_array($error['field'], $keys))
576
-				continue;
624
+			{
625
+							continue;
626
+			}
577 627
 
578 628
 			// Set the error message for this validation failure
579 629
 			if (isset($error['error']))
580
-				$result[] = sprintf($txt[$error['error']], $field, $error['error_msg']);
630
+			{
631
+							$result[] = sprintf($txt[$error['error']], $field, $error['error_msg']);
632
+			}
581 633
 			// Use our error text based on the function name itself
582 634
 			elseif (isset($txt[$error['function']]))
583 635
 			{
584 636
 				if (!empty($error['param']))
585
-					$result[] = sprintf($txt[$error['function']], $field, $error['param']);
586
-				else
587
-					$result[] = sprintf($txt[$error['function']], $field, $error['input']);
637
+				{
638
+									$result[] = sprintf($txt[$error['function']], $field, $error['param']);
639
+				}
640
+				else {
641
+									$result[] = sprintf($txt[$error['function']], $field, $error['input']);
642
+				}
588 643
 			}
589 644
 			// can't find the function text, so set a generic one
590
-			else
591
-				$result[] = sprintf($txt['_validate_generic'], $field);
645
+			else {
646
+							$result[] = sprintf($txt['_validate_generic'], $field);
647
+			}
592 648
 		}
593 649
 
594 650
 		return empty($result) ? false : $result;
@@ -610,7 +666,9 @@  discard block
 block discarded – undo
610 666
 		$value = trim(strtolower($input[$field]));
611 667
 
612 668
 		if (in_array($value, $validation_parameters))
613
-			return;
669
+		{
670
+					return;
671
+		}
614 672
 
615 673
 		return array(
616 674
 			'field' => $field,
@@ -636,7 +694,9 @@  discard block
 block discarded – undo
636 694
 		$value = trim(strtolower($input[$field]));
637 695
 
638 696
 		if (!in_array($value, $validation_parameters))
639
-			return;
697
+		{
698
+					return;
699
+		}
640 700
 
641 701
 		return array(
642 702
 			'field' => $field,
@@ -669,15 +729,21 @@  discard block
 block discarded – undo
669 729
 		// Lower bound ?
670 730
 		$passmin = true;
671 731
 		if (isset($validation_parameters[0]))
672
-			$passmin = $value >= $validation_parameters[0];
732
+		{
733
+					$passmin = $value >= $validation_parameters[0];
734
+		}
673 735
 
674 736
 		// Upper bound ?
675 737
 		$passmax = true;
676 738
 		if (isset($validation_parameters[1]))
677
-			$passmax = $value <= $validation_parameters[1];
739
+		{
740
+					$passmax = $value <= $validation_parameters[1];
741
+		}
678 742
 
679 743
 		if ($passmax && $passmin)
680
-			return;
744
+		{
745
+					return;
746
+		}
681 747
 
682 748
 		return array(
683 749
 			'field' => $field,
@@ -705,12 +771,14 @@  discard block
 block discarded – undo
705 771
 		foreach ($validation_parameters as $dummy => $check)
706 772
 		{
707 773
 			if (strpos($value, $check) !== false)
708
-				return array(
774
+			{
775
+							return array(
709 776
 					'field' => $field,
710 777
 					'input' => $input[$field],
711 778
 					'function' => __FUNCTION__,
712 779
 					'param' => implode(',', $validation_parameters)
713 780
 				);
781
+			}
714 782
 		}
715 783
 
716 784
 		return;
@@ -728,7 +796,9 @@  discard block
 block discarded – undo
728 796
 	protected function _validate_required($field, $input, $validation_parameters = null)
729 797
 	{
730 798
 		if (isset($input[$field]) && trim($input[$field]) !== '')
731
-			return;
799
+		{
800
+					return;
801
+		}
732 802
 
733 803
 		return array(
734 804
 			'field' => $field,
@@ -750,16 +820,23 @@  discard block
 block discarded – undo
750 820
 	protected function _validate_valid_email($field, $input, $validation_parameters = null)
751 821
 	{
752 822
 		if (!isset($input[$field]))
753
-			return;
823
+		{
824
+					return;
825
+		}
754 826
 
755 827
 		// Quick check, no @ in the email
756 828
 		if (strrpos($input[$field], '@') === false)
757
-			$valid = false;
758
-		else
759
-			$valid = filter_var($input[$field], FILTER_VALIDATE_EMAIL) !== false;
829
+		{
830
+					$valid = false;
831
+		}
832
+		else {
833
+					$valid = filter_var($input[$field], FILTER_VALIDATE_EMAIL) !== false;
834
+		}
760 835
 
761 836
 		if ($valid)
762
-			return;
837
+		{
838
+					return;
839
+		}
763 840
 
764 841
 		return array(
765 842
 			'field' => $field,
@@ -781,10 +858,14 @@  discard block
 block discarded – undo
781 858
 	protected function _validate_max_length($field, $input, $validation_parameters = null)
782 859
 	{
783 860
 		if (!isset($input[$field]))
784
-			return;
861
+		{
862
+					return;
863
+		}
785 864
 
786 865
 		if (Util::strlen($input[$field]) <= (int) $validation_parameters)
787
-			return;
866
+		{
867
+					return;
868
+		}
788 869
 
789 870
 		return array(
790 871
 			'field' => $field,
@@ -806,10 +887,14 @@  discard block
 block discarded – undo
806 887
 	protected function _validate_min_length($field, $input, $validation_parameters = null)
807 888
 	{
808 889
 		if (!isset($input[$field]))
809
-			return;
890
+		{
891
+					return;
892
+		}
810 893
 
811 894
 		if (Util::strlen($input[$field]) >= (int) $validation_parameters)
812
-			return;
895
+		{
896
+					return;
897
+		}
813 898
 
814 899
 		return array(
815 900
 			'field' => $field,
@@ -831,10 +916,14 @@  discard block
 block discarded – undo
831 916
 	protected function _validate_length($field, $input, $validation_parameters = null)
832 917
 	{
833 918
 		if (!isset($input[$field]))
834
-			return;
919
+		{
920
+					return;
921
+		}
835 922
 
836 923
 		if (Util::strlen($input[$field]) == (int) $validation_parameters)
837
-			return;
924
+		{
925
+					return;
926
+		}
838 927
 
839 928
 		return array(
840 929
 			'field' => $field,
@@ -856,7 +945,9 @@  discard block
 block discarded – undo
856 945
 	protected function _validate_alpha($field, $input, $validation_parameters = null)
857 946
 	{
858 947
 		if (!isset($input[$field]))
859
-			return;
948
+		{
949
+					return;
950
+		}
860 951
 
861 952
 		// A character with the Unicode property of letter (any kind of letter from any language)
862 953
 		if (!preg_match('~^(\p{L})+$~iu', $input[$field]))
@@ -883,7 +974,9 @@  discard block
 block discarded – undo
883 974
 	protected function _validate_alpha_numeric($field, $input, $validation_parameters = null)
884 975
 	{
885 976
 		if (!isset($input[$field]))
886
-			return;
977
+		{
978
+					return;
979
+		}
887 980
 
888 981
 		// A character with the Unicode property of letter or number (any kind of letter or numeric 0-9 from any language)
889 982
 		if (!preg_match('~^([-_\p{L}\p{Nd}])+$~iu', $input[$field]))
@@ -909,7 +1002,9 @@  discard block
 block discarded – undo
909 1002
 	protected function _validate_alpha_dash($field, $input, $validation_parameters = null)
910 1003
 	{
911 1004
 		if (!isset($input[$field]))
912
-			return;
1005
+		{
1006
+					return;
1007
+		}
913 1008
 
914 1009
 		if (!preg_match('~^([-_\p{L}])+$~iu', $input[$field]))
915 1010
 		{
@@ -934,7 +1029,9 @@  discard block
 block discarded – undo
934 1029
 	protected function _validate_isarray($field, $input, $validation_parameters = null)
935 1030
 	{
936 1031
 		if (!isset($input[$field]))
937
-			return;
1032
+		{
1033
+					return;
1034
+		}
938 1035
 
939 1036
 		if (!is_array($input[$field]))
940 1037
 		{
@@ -959,7 +1056,9 @@  discard block
 block discarded – undo
959 1056
 	protected function _validate_numeric($field, $input, $validation_parameters = null)
960 1057
 	{
961 1058
 		if (!isset($input[$field]))
962
-			return;
1059
+		{
1060
+					return;
1061
+		}
963 1062
 
964 1063
 		if (!is_numeric($input[$field]))
965 1064
 		{
@@ -984,7 +1083,9 @@  discard block
 block discarded – undo
984 1083
 	protected function _validate_integer($field, $input, $validation_parameters = null)
985 1084
 	{
986 1085
 		if (!isset($input[$field]))
987
-			return;
1086
+		{
1087
+					return;
1088
+		}
988 1089
 
989 1090
 		$filter = filter_var($input[$field], FILTER_VALIDATE_INT);
990 1091
 
@@ -1016,7 +1117,9 @@  discard block
 block discarded – undo
1016 1117
 	protected function _validate_boolean($field, $input, $validation_parameters = null)
1017 1118
 	{
1018 1119
 		if (!isset($input[$field]))
1019
-			return;
1120
+		{
1121
+					return;
1122
+		}
1020 1123
 
1021 1124
 		$filter = filter_var($input[$field], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
1022 1125
 
@@ -1057,7 +1160,9 @@  discard block
 block discarded – undo
1057 1160
 	protected function _validate_float($field, $input, $validation_parameters = null)
1058 1161
 	{
1059 1162
 		if (!isset($input[$field]))
1060
-			return;
1163
+		{
1164
+					return;
1165
+		}
1061 1166
 
1062 1167
 		if (filter_var($input[$field], FILTER_VALIDATE_FLOAT) === false)
1063 1168
 		{
@@ -1082,7 +1187,9 @@  discard block
 block discarded – undo
1082 1187
 	protected function _validate_valid_url($field, $input, $validation_parameters = null)
1083 1188
 	{
1084 1189
 		if (!isset($input[$field]))
1085
-			return;
1190
+		{
1191
+					return;
1192
+		}
1086 1193
 
1087 1194
 		if (!preg_match('`^(https{0,1}?:(//([a-z0-9\-._~%]+)(:[0-9]+)?(/[a-z0-9\-._~%!$&\'()*+,;=:@]+)*/?))(\?[a-z0-9\-._~%!$&\'()*+,;=:@/?]*)?(\#[a-z0-9\-._~%!$&\'()*+,;=:@/?]*)?$`', $input[$field], $matches))
1088 1195
 		{
@@ -1107,7 +1214,9 @@  discard block
 block discarded – undo
1107 1214
 	protected function _validate_valid_ipv6($field, $input, $validation_parameters = null)
1108 1215
 	{
1109 1216
 		if (!isset($input[$field]))
1110
-			return;
1217
+		{
1218
+					return;
1219
+		}
1111 1220
 
1112 1221
 		if (filter_var($input[$field], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false)
1113 1222
 		{
@@ -1132,7 +1241,9 @@  discard block
 block discarded – undo
1132 1241
 	protected function _validate_valid_ip($field, $input, $validation_parameters = null)
1133 1242
 	{
1134 1243
 		if (!isset($input[$field]))
1135
-			return;
1244
+		{
1245
+					return;
1246
+		}
1136 1247
 
1137 1248
 		if (filter_var($input[$field], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false)
1138 1249
 		{
@@ -1160,7 +1271,9 @@  discard block
 block discarded – undo
1160 1271
 	protected function _validate_php_syntax($field, $input, $validation_parameters = null)
1161 1272
 	{
1162 1273
 		if (!isset($input[$field]))
1163
-			return;
1274
+		{
1275
+					return;
1276
+		}
1164 1277
 
1165 1278
 		// Check the depth.
1166 1279
 		$level = 0;
@@ -1168,13 +1281,19 @@  discard block
 block discarded – undo
1168 1281
 		foreach ($tokens as $token)
1169 1282
 		{
1170 1283
 			if ($token === '{' || (isset($token[1]) && $token[1] === '${'))
1171
-				$level++;
1284
+			{
1285
+							$level++;
1286
+			}
1172 1287
 			elseif ($token === '}')
1173
-				$level--;
1288
+			{
1289
+							$level--;
1290
+			}
1174 1291
 		}
1175 1292
 
1176 1293
 		if (!empty($level))
1177
-			$result = false;
1294
+		{
1295
+					$result = false;
1296
+		}
1178 1297
 		else
1179 1298
 		{
1180 1299
 			// Check the validity of the syntax.
@@ -1223,31 +1342,45 @@  discard block
 block discarded – undo
1223 1342
 	protected function _validate_valid_color($field, $input, $validation_parameters = null)
1224 1343
 	{
1225 1344
 		if (!isset($input[$field]))
1226
-			return;
1345
+		{
1346
+					return;
1347
+		}
1227 1348
 
1228 1349
 		// A color can be a name: there are 140 valid, but a similar list is too long, so let's just use the basic 17
1229 1350
 		if (in_array(strtolower($input[$field]), array('aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple', 'red', 'silver', 'teal', 'white', 'yellow')))
1230
-			return true;
1351
+		{
1352
+					return true;
1353
+		}
1231 1354
 
1232 1355
 		// An hex code
1233 1356
 		if (preg_match('~^#([a-f0-9]{3}|[a-f0-9]{6})$~i', $input[$field]) === 1)
1234
-			return true;
1357
+		{
1358
+					return true;
1359
+		}
1235 1360
 
1236 1361
 		// RGB
1237 1362
 		if (preg_match('~^rgb\(\d{1,3},\d{1,3},\d{1,3}\)$~i', str_replace(' ', '', $input[$field])) === 1)
1238
-			return true;
1363
+		{
1364
+					return true;
1365
+		}
1239 1366
 
1240 1367
 		// RGBA
1241 1368
 		if (preg_match('~^rgba\(\d{1,3},\d{1,3},\d{1,3},(0|0\.\d+|1(\.0*)|\.\d+)\)$~i', str_replace(' ', '', $input[$field])) === 1)
1242
-			return true;
1369
+		{
1370
+					return true;
1371
+		}
1243 1372
 
1244 1373
 		// HSL
1245 1374
 		if (preg_match('~^hsl\(\d{1,3},\d{1,3}%,\d{1,3}%\)$~i', str_replace(' ', '', $input[$field])) === 1)
1246
-			return true;
1375
+		{
1376
+					return true;
1377
+		}
1247 1378
 
1248 1379
 		// HSLA
1249 1380
 		if (preg_match('~^hsla\(\d{1,3},\d{1,3}%,\d{1,3}%,(0|0\.\d+|1(\.0*)|\.\d+)\)$~i', str_replace(' ', '', $input[$field])) === 1)
1250
-			return true;
1381
+		{
1382
+					return true;
1383
+		}
1251 1384
 
1252 1385
 		return array(
1253 1386
 			'field' => $field,
@@ -1270,7 +1403,9 @@  discard block
 block discarded – undo
1270 1403
 	protected function _sanitation_gmail_normalize($input)
1271 1404
 	{
1272 1405
 		if (!isset($input))
1273
-			return;
1406
+		{
1407
+					return;
1408
+		}
1274 1409
 
1275 1410
 		$at_index = strrpos($input, '@');
1276 1411
 
@@ -1302,7 +1437,9 @@  discard block
 block discarded – undo
1302 1437
 	protected function _sanitation_cleanhtml($input)
1303 1438
 	{
1304 1439
 		if (!isset($input))
1305
-			return;
1440
+		{
1441
+					return;
1442
+		}
1306 1443
 
1307 1444
 		return Util::htmlspecialchars($input);
1308 1445
 	}
Please login to merge, or discard this patch.
sources/subs/Messages.subs.php 1 patch
Braces   +89 added lines, -36 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 	$db = database();
36 36
 
37 37
 	if (empty($id_msg))
38
-		return false;
38
+	{
39
+			return false;
40
+	}
39 41
 
40 42
 	$request = $db->query('', '
41 43
 		SELECT
@@ -59,19 +61,25 @@  discard block
 block discarded – undo
59 61
 	);
60 62
 	// The message they were trying to edit was most likely deleted.
61 63
 	if ($db->num_rows($request) == 0)
62
-		return false;
64
+	{
65
+			return false;
66
+	}
63 67
 	$row = $db->fetch_assoc($request);
64 68
 
65 69
 	$attachment_stuff = array($row);
66 70
 	while ($row2 = $db->fetch_assoc($request))
67
-		$attachment_stuff[] = $row2;
71
+	{
72
+			$attachment_stuff[] = $row2;
73
+	}
68 74
 	$db->free_result($request);
69 75
 
70 76
 	$temp = array();
71 77
 	foreach ($attachment_stuff as $attachment)
72 78
 	{
73 79
 		if ($attachment['filesize'] >= 0 && !empty($modSettings['attachmentEnable']))
74
-			$temp[$attachment['id_attach']] = $attachment;
80
+		{
81
+					$temp[$attachment['id_attach']] = $attachment;
82
+		}
75 83
 
76 84
 	}
77 85
 	ksort($temp);
@@ -98,7 +106,9 @@  discard block
 block discarded – undo
98 106
 	$db = database();
99 107
 
100 108
 	if (empty($id_msg))
101
-		return false;
109
+	{
110
+			return false;
111
+	}
102 112
 
103 113
 	$request = $db->query('', '
104 114
 		SELECT
@@ -136,7 +146,9 @@  discard block
 block discarded – undo
136 146
 	global $user_info;
137 147
 
138 148
 	if (empty($id_msg))
139
-		return false;
149
+	{
150
+			return false;
151
+	}
140 152
 
141 153
 	$db = database();
142 154
 
@@ -186,19 +198,29 @@  discard block
 block discarded – undo
186 198
 	{
187 199
 		// Give an extra five minutes over the disable time threshold, so they can type - assuming the post is public.
188 200
 		if ($message['approved'] && !empty($modSettings['edit_disable_time']) && $message['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
189
-			throw new Elk_Exception('modify_post_time_passed', false);
201
+		{
202
+					throw new Elk_Exception('modify_post_time_passed', false);
203
+		}
190 204
 		elseif ($message['id_member_poster'] == $user_info['id'] && !allowedTo('modify_own'))
191
-			isAllowedTo('modify_replies');
192
-		else
193
-			isAllowedTo('modify_own');
205
+		{
206
+					isAllowedTo('modify_replies');
207
+		}
208
+		else {
209
+					isAllowedTo('modify_own');
210
+		}
194 211
 	}
195 212
 	elseif ($message['id_member_poster'] == $user_info['id'] && !allowedTo('modify_any'))
196
-		isAllowedTo('modify_replies');
197
-	else
198
-		isAllowedTo('modify_any');
213
+	{
214
+			isAllowedTo('modify_replies');
215
+	}
216
+	else {
217
+			isAllowedTo('modify_any');
218
+	}
199 219
 
200 220
 	if ($context['can_announce'] && !empty($message['id_action']))
201
-		return array('topic_already_announced');
221
+	{
222
+			return array('topic_already_announced');
223
+	}
202 224
 
203 225
 	return false;
204 226
 }
@@ -239,8 +261,10 @@  discard block
 block discarded – undo
239 261
 
240 262
 	// Show an "approve" box if the user can approve it, and the message isn't approved.
241 263
 	if (!$message['message']['approved'] && !$context['show_approval'])
242
-		$context['show_approval'] = allowedTo('approve_posts');
243
-}
264
+	{
265
+			$context['show_approval'] = allowedTo('approve_posts');
266
+	}
267
+	}
244 268
 
245 269
 /**
246 270
  * This function removes all the messages of a certain user that are *not*
@@ -316,9 +340,12 @@  discard block
 block discarded – undo
316 340
 				'msg' => $msg_id,
317 341
 		));
318 342
 		if ($db->num_rows($request) != 1)
319
-			$topic = false;
320
-		else
321
-			list ($topic) = $db->fetch_row($request);
343
+		{
344
+					$topic = false;
345
+		}
346
+		else {
347
+					list ($topic) = $db->fetch_row($request);
348
+		}
322 349
 		$db->free_result($request);
323 350
 
324 351
 		return $topic;
@@ -353,7 +380,9 @@  discard block
 block discarded – undo
353 380
 
354 381
 	// Do we even have a message to speak of?
355 382
 	if (empty($message_info))
356
-		return false;
383
+	{
384
+			return false;
385
+	}
357 386
 
358 387
 	// Check for approval status?
359 388
 	if ($check_approval)
@@ -467,7 +496,9 @@  discard block
 block discarded – undo
467 496
 	);
468 497
 	$msg = array();
469 498
 	while ($row = $db->fetch_assoc($result))
470
-		$msg[] = $row['id_msg'];
499
+	{
500
+			$msg[] = $row['id_msg'];
501
+	}
471 502
 	$db->free_result($result);
472 503
 
473 504
 	return $msg;
@@ -503,11 +534,15 @@  discard block
 block discarded – undo
503 534
 	);
504 535
 
505 536
 	if ($db->num_rows($request) != 0)
506
-		list ($id_report, $ignore_all) = $db->fetch_row($request);
537
+	{
538
+			list ($id_report, $ignore_all) = $db->fetch_row($request);
539
+	}
507 540
 	$db->free_result($request);
508 541
 
509 542
 	if (!empty($ignore_all))
510
-		return false;
543
+	{
544
+			return false;
545
+	}
511 546
 
512 547
 	// Already reported? My god, we could be dealing with a real rogue here...
513 548
 	if (!empty($id_report))
@@ -526,7 +561,9 @@  discard block
 block discarded – undo
526 561
 	else
527 562
 	{
528 563
 		if (empty($message['real_name']))
529
-			$message['real_name'] = $message['poster_name'];
564
+		{
565
+					$message['real_name'] = $message['poster_name'];
566
+		}
530 567
 
531 568
 		$db->insert('',
532 569
 			'{db_prefix}log_reported',
@@ -650,21 +687,27 @@  discard block
 block discarded – undo
650 687
 		$single = true;
651 688
 		$msg_parameters['message_list'] = array($msg_parameters['message_list']);
652 689
 	}
653
-	else
654
-		$single = false;
690
+	else {
691
+			$single = false;
692
+	}
655 693
 
656 694
 	$request = loadMessageRequest($msg_selects, $msg_tables, $msg_parameters, $optional);
657 695
 
658 696
 	$return = array();
659 697
 	while ($row = $db->fetch_assoc($request))
660
-		$return[] = $row;
698
+	{
699
+			$return[] = $row;
700
+	}
661 701
 	$db->free_result($request);
662 702
 
663 703
 	if ($single)
664
-		return $return[0];
665
-	else
666
-		return $return;
667
-}
704
+	{
705
+			return $return[0];
706
+	}
707
+	else {
708
+			return $return;
709
+	}
710
+	}
668 711
 
669 712
 /**
670 713
  * Checks, which messages can be removed from a certain member.
@@ -698,7 +741,9 @@  discard block
 block discarded – undo
698 741
 	while ($row = $db->fetch_assoc($request))
699 742
 	{
700 743
 		if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time())
701
-			continue;
744
+		{
745
+					continue;
746
+		}
702 747
 		$messages_list[$row['id_msg']] = array($row['subject'], $row['id_member']);
703 748
 	}
704 749
 
@@ -732,7 +777,9 @@  discard block
 block discarded – undo
732 777
 		)
733 778
 	);
734 779
 	while ($row = $db->fetch_assoc($request))
735
-		$return[empty($row['is_selected']) || $row['is_selected'] == 'f' ? 'not_selected' : 'selected'] = $row['num_messages'];
780
+	{
781
+			$return[empty($row['is_selected']) || $row['is_selected'] == 'f' ? 'not_selected' : 'selected'] = $row['num_messages'];
782
+	}
736 783
 	$db->free_result($request);
737 784
 
738 785
 	return $return;
@@ -781,7 +828,9 @@  discard block
 block discarded – undo
781 828
 	$db = database();
782 829
 
783 830
 	if ($increment === true && $max_msg_id !== null)
784
-		updateSettings(array('totalMessages' => true, 'maxMsgID' => $max_msg_id), true);
831
+	{
832
+			updateSettings(array('totalMessages' => true, 'maxMsgID' => $max_msg_id), true);
833
+	}
785 834
 	else
786 835
 	{
787 836
 		// SUM and MAX on a smaller table is better for InnoDB tables.
@@ -834,14 +883,18 @@  discard block
 block discarded – undo
834 883
 
835 884
 		$inserts = array();
836 885
 		foreach ($subject_words as $word)
837
-			$inserts[] = array($word, $id_topic);
886
+		{
887
+					$inserts[] = array($word, $id_topic);
888
+		}
838 889
 
839 890
 		if (!empty($inserts))
840
-			$db->insert('ignore',
891
+		{
892
+					$db->insert('ignore',
841 893
 				'{db_prefix}log_search_subjects',
842 894
 				array('word' => 'string', 'id_topic' => 'int'),
843 895
 				$inserts,
844 896
 				array('word', 'id_topic')
845 897
 			);
898
+		}
846 899
 	}
847 900
 }
Please login to merge, or discard this patch.
sources/subs/Moderation.subs.php 1 patch
Braces   +87 added lines, -33 removed lines patch added patch discarded remove patch
@@ -95,7 +95,9 @@  discard block
 block discarded – undo
95 95
 	$db = database();
96 96
 
97 97
 	if ($approve_query === null)
98
-		return array('posts' => 0, 'topics' => 0);
98
+	{
99
+			return array('posts' => 0, 'topics' => 0);
100
+	}
99 101
 
100 102
 	// Any unapproved posts?
101 103
 	$request = $db->query('', '
@@ -145,7 +147,9 @@  discard block
 block discarded – undo
145 147
 	$db = database();
146 148
 
147 149
 	if ($approve_query === null)
148
-		return 0;
150
+	{
151
+			return 0;
152
+	}
149 153
 
150 154
 	$request = $db->query('', '
151 155
 		SELECT COUNT(*)
@@ -207,7 +211,9 @@  discard block
 block discarded – undo
207 211
 	global $user_info;
208 212
 
209 213
 	if (empty($reports_id))
210
-		return 0;
214
+	{
215
+			return 0;
216
+	}
211 217
 
212 218
 	$db = database();
213 219
 
@@ -258,17 +264,24 @@  discard block
 block discarded – undo
258 264
 
259 265
 	// Work out the query
260 266
 	if ($approve_boards == array(0))
261
-		$approve_query = '';
267
+	{
268
+			$approve_query = '';
269
+	}
262 270
 	elseif (!empty($approve_boards))
263
-		$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
264
-	else
265
-		$approve_query = ' AND 1=0';
271
+	{
272
+			$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
273
+	}
274
+	else {
275
+			$approve_query = ' AND 1=0';
276
+	}
266 277
 
267 278
 	// Set up the cache key for this permissions level
268 279
 	$cache_key = md5($user_info['query_see_board'] . $approve_query . $user_info['mod_cache']['bq'] . $user_info['mod_cache']['gq'] . $user_info['mod_cache']['mq'] . (int) allowedTo('approve_emails') . '_' . (int) allowedTo('moderate_forum'));
269 280
 
270 281
 	if (isset($menu_errors[$cache_key]))
271
-		return $menu_errors[$cache_key];
282
+	{
283
+			return $menu_errors[$cache_key];
284
+	}
272 285
 
273 286
 	// If its been cached, guess what, that's right use it!
274 287
 	$temp = Cache::instance()->get('num_menu_errors', 900);
@@ -320,11 +333,15 @@  discard block
 block discarded – undo
320 333
 
321 334
 		// Email failures that require attention
322 335
 		if (!empty($modSettings['maillist_enabled']) && allowedTo('approve_emails'))
323
-			$menu_errors[$cache_key]['emailmod'] = recountFailedEmails($approve_query);
336
+		{
337
+					$menu_errors[$cache_key]['emailmod'] = recountFailedEmails($approve_query);
338
+		}
324 339
 
325 340
 		// Group requests
326 341
 		if (!empty($user_info['mod_cache']) && $user_info['mod_cache']['gq'] != '0=1')
327
-			$menu_errors[$cache_key]['groupreq'] = count(groupRequests());
342
+		{
343
+					$menu_errors[$cache_key]['groupreq'] = count(groupRequests());
344
+		}
328 345
 
329 346
 		// Member requests
330 347
 		if (allowedTo('moderate_forum') && ((!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($modSettings['approveAccountDeletion'])))
@@ -337,7 +354,9 @@  discard block
 block discarded – undo
337 354
 			foreach ($activation_numbers as $activation_type => $total_members)
338 355
 			{
339 356
 				if (in_array($activation_type, array(3, 4, 5)))
340
-					$awaiting_activation += $total_members;
357
+				{
358
+									$awaiting_activation += $total_members;
359
+				}
341 360
 			}
342 361
 			$menu_errors[$cache_key]['memberreq'] = $awaiting_activation;
343 362
 		}
@@ -354,8 +373,9 @@  discard block
 block discarded – undo
354 373
 		// Store it away for a while, not like this should change that often
355 374
 		Cache::instance()->put('num_menu_errors', $menu_errors, 900);
356 375
 	}
357
-	else
358
-		$menu_errors = $temp === null ? array() : $temp;
376
+	else {
377
+			$menu_errors = $temp === null ? array() : $temp;
378
+	}
359 379
 
360 380
 	return $menu_errors[$cache_key];
361 381
 }
@@ -445,7 +465,9 @@  discard block
 block discarded – undo
445 465
 		)
446 466
 	);
447 467
 	while ($row = $db->fetch_assoc($request))
448
-		logAction('delete_warn_template', array('template' => $row['recipient_name']));
468
+	{
469
+			logAction('delete_warn_template', array('template' => $row['recipient_name']));
470
+	}
449 471
 	$db->free_result($request);
450 472
 
451 473
 	// Do the deletes.
@@ -748,9 +770,12 @@  discard block
 block discarded – undo
748 770
 
749 771
 	// So did we find anything?
750 772
 	if (!$db->num_rows($request))
751
-		$row = false;
752
-	else
753
-		$row = $db->fetch_assoc($request);
773
+	{
774
+			$row = false;
775
+	}
776
+	else {
777
+			$row = $db->fetch_assoc($request);
778
+	}
754 779
 
755 780
 	$db->free_result($request);
756 781
 
@@ -794,7 +819,9 @@  discard block
 block discarded – undo
794 819
 
795 820
 	$reports = array();
796 821
 	while ($row = $db->fetch_assoc($request))
797
-		$reports[$row['id_report']] = $row;
822
+	{
823
+			$reports[$row['id_report']] = $row;
824
+	}
798 825
 	$db->free_result($request);
799 826
 
800 827
 	return $reports;
@@ -824,7 +851,9 @@  discard block
 block discarded – undo
824 851
 
825 852
 	$comments = array();
826 853
 	while ($row = $db->fetch_assoc($request))
827
-		$comments[$row['id_report']][] = $row;
854
+	{
855
+			$comments[$row['id_report']][] = $row;
856
+	}
828 857
 
829 858
 	$db->free_result($request);
830 859
 
@@ -855,7 +884,9 @@  discard block
 block discarded – undo
855 884
 
856 885
 	$comments = array();
857 886
 	while ($row = $db->fetch_assoc($request))
858
-		$comments[] = $row;
887
+	{
888
+			$comments[] = $row;
889
+	}
859 890
 
860 891
 	$db->free_result($request);
861 892
 
@@ -881,7 +912,9 @@  discard block
 block discarded – undo
881 912
 	);
882 913
 	$msgs = array();
883 914
 	while ($row = $db->fetch_row($request))
884
-		$msgs[] = $row[0];
915
+	{
916
+			$msgs[] = $row[0];
917
+	}
885 918
 	$db->free_result($request);
886 919
 
887 920
 	if (!empty($msgs))
@@ -902,7 +935,9 @@  discard block
 block discarded – undo
902 935
 	);
903 936
 	$attaches = array();
904 937
 	while ($row = $db->fetch_row($request))
905
-		$attaches[] = $row[0];
938
+	{
939
+			$attaches[] = $row[0];
940
+	}
906 941
 	$db->free_result($request);
907 942
 
908 943
 	if (!empty($attaches))
@@ -998,7 +1033,9 @@  discard block
 block discarded – undo
998 1033
 		);
999 1034
 		$latest_posts = array();
1000 1035
 		while ($row = $db->fetch_assoc($request))
1001
-			$latest_posts[$row['id_member']] = $row['last_post_id'];
1036
+		{
1037
+					$latest_posts[$row['id_member']] = $row['last_post_id'];
1038
+		}
1002 1039
 
1003 1040
 		if (!empty($latest_posts))
1004 1041
 		{
@@ -1152,7 +1189,9 @@  discard block
 block discarded – undo
1152 1189
 
1153 1190
 	// Make sure they can even moderate someone!
1154 1191
 	if ($user_info['mod_cache']['gq'] == '0=1')
1155
-		return array();
1192
+	{
1193
+			return array();
1194
+	}
1156 1195
 
1157 1196
 	// What requests are outstanding?
1158 1197
 	$request = $db->query('', '
@@ -1215,7 +1254,9 @@  discard block
 block discarded – undo
1215 1254
 			)
1216 1255
 		);
1217 1256
 		while ($row = $db->fetch_assoc($request))
1218
-			$watched_users[] = $row;
1257
+		{
1258
+					$watched_users[] = $row;
1259
+		}
1219 1260
 		$db->free_result($request);
1220 1261
 
1221 1262
 		Cache::instance()->put('recent_user_watches', $watched_users, 240);
@@ -1410,11 +1451,15 @@  discard block
 block discarded – undo
1410 1451
 		);
1411 1452
 		$moderator_notes = array();
1412 1453
 		while ($row = $db->fetch_assoc($request))
1413
-			$moderator_notes[] = $row;
1454
+		{
1455
+					$moderator_notes[] = $row;
1456
+		}
1414 1457
 		$db->free_result($request);
1415 1458
 
1416 1459
 		if ($offset == 0)
1417
-			Cache::instance()->put('moderator_notes', $moderator_notes, 240);
1460
+		{
1461
+					Cache::instance()->put('moderator_notes', $moderator_notes, 240);
1462
+		}
1418 1463
 	}
1419 1464
 
1420 1465
 	return $moderator_notes;
@@ -1439,7 +1484,9 @@  discard block
 block discarded – undo
1439 1484
 		)
1440 1485
 	);
1441 1486
 	if ($db->num_rows($request) == 0)
1442
-		return array();
1487
+	{
1488
+			return array();
1489
+	}
1443 1490
 	list ($notice_body, $notice_subject) = $db->fetch_row($request);
1444 1491
 	$db->free_result($request);
1445 1492
 
@@ -1532,15 +1579,22 @@  discard block
 block discarded – undo
1532 1579
 	{
1533 1580
 		// Can delete is complicated, let's solve it first... is it their own post?
1534 1581
 		if ($row['id_member'] == $user_info['id'] && ($boards_allowed['delete_own_boards'] == array(0) || in_array($row['id_board'], $boards_allowed['delete_own_boards'])))
1535
-			$can_delete = true;
1582
+		{
1583
+					$can_delete = true;
1584
+		}
1536 1585
 		// Is it a reply to their own topic?
1537 1586
 		elseif ($row['id_member'] == $row['id_member_started'] && $row['id_msg'] != $row['id_first_msg'] && ($boards_allowed['delete_own_replies'] == array(0) || in_array($row['id_board'], $boards_allowed['delete_own_replies'])))
1538
-			$can_delete = true;
1587
+		{
1588
+					$can_delete = true;
1589
+		}
1539 1590
 		// Someone else's?
1540 1591
 		elseif ($row['id_member'] != $user_info['id'] && ($boards_allowed['delete_any_boards'] == array(0) || in_array($row['id_board'], $boards_allowed['delete_any_boards'])))
1541
-			$can_delete = true;
1542
-		else
1543
-			$can_delete = false;
1592
+		{
1593
+					$can_delete = true;
1594
+		}
1595
+		else {
1596
+					$can_delete = false;
1597
+		}
1544 1598
 
1545 1599
 		$unapproved_items[] = array(
1546 1600
 			'id' => $row['id_msg'],
Please login to merge, or discard this patch.
sources/subs/Charset.subs.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -570,7 +570,8 @@  discard block
 block discarded – undo
570 570
 	while ($row = $db->fetch_assoc($request))
571 571
 	{
572 572
 		if (@unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1)
573
-			$db->query('', '
573
+		{
574
+					$db->query('', '
574 575
 				UPDATE {db_prefix}log_actions
575 576
 				SET extra = {string:extra}
576 577
 				WHERE id_action = {int:current_action}',
@@ -579,6 +580,7 @@  discard block
 block discarded – undo
579 580
 					'extra' => $matches[1] . strlen($matches[3]) . ':"' . $matches[3] . '"' . $matches[4],
580 581
 				)
581 582
 			);
583
+		}
582 584
 	}
583 585
 	$db->free_result($request);
584 586
 
Please login to merge, or discard this patch.
Spacing   +506 added lines, -506 removed lines patch added patch discarded remove patch
@@ -25,259 +25,259 @@
 block discarded – undo
25 25
 function utf8_strtolower($string)
26 26
 {
27 27
 	static $case_folding = array(
28
-		'A' => 'a',		'B' => 'b',		'C' => 'c',		'D' => 'd',
29
-		'E' => 'e',		'F' => 'f',		'G' => 'g',		'H' => 'h',
30
-		'I' => 'i',		'J' => 'j',		'K' => 'k',		'L' => 'l',
31
-		'M' => 'm',		'N' => 'n',		'O' => 'o',		'P' => 'p',
32
-		'Q' => 'q',		'R' => 'r',		'S' => 's',		'T' => 't',
33
-		'U' => 'u',		'V' => 'v',		'W' => 'w',		'X' => 'x',
34
-		'Y' => 'y',		'Z' => 'z',		'µ' => 'μ',		'À' => 'à',
35
-		'Á' => 'á',		'Â' => 'â',		'Ã' => 'ã',		'Ä' => 'ä',
36
-		'Å' => 'å',		'Æ' => 'æ',		'Ç' => 'ç',		'È' => 'è',
37
-		'É' => 'é',		'Ê' => 'ê',		'Ë' => 'ë',		'Ì' => 'ì',
38
-		'Í' => 'í',		'Î' => 'î',		'Ï' => 'ï',		'Ð' => 'ð',
39
-		'Ñ' => 'ñ',		'Ò' => 'ò',		'Ó' => 'ó',		'Ô' => 'ô',
40
-		'Õ' => 'õ',		'Ö' => 'ö',		'Ø' => 'ø',		'Ù' => 'ù',
41
-		'Ú' => 'ú',		'Û' => 'û',		'Ü' => 'ü',		'Ý' => 'ý',
42
-		'Þ' => 'þ',		'ß' => 'ss',	'Ā' => 'ā',		'Ă' => 'ă',
43
-		'Ą' => 'ą',		'Ć' => 'ć',		'Ĉ' => 'ĉ',		'Ċ' => 'ċ',
44
-		'Č' => 'č',		'Ď' => 'ď',		'Đ' => 'đ',		'Ē' => 'ē',
45
-		'Ĕ' => 'ĕ',		'Ė' => 'ė',		'Ę' => 'ę',		'Ě' => 'ě',
46
-		'Ĝ' => 'ĝ',		'Ğ' => 'ğ',		'Ġ' => 'ġ',		'Ģ' => 'ģ',
47
-		'Ĥ' => 'ĥ',		'Ħ' => 'ħ',		'Ĩ' => 'ĩ',		'Ī' => 'ī',
48
-		'Ĭ' => 'ĭ',		'Į' => 'į',		'İ' => 'i̇',		'IJ' => 'ij',
49
-		'Ĵ' => 'ĵ',		'Ķ' => 'ķ',		'Ĺ' => 'ĺ',		'Ļ' => 'ļ',
50
-		'Ľ' => 'ľ',		'Ŀ' => 'ŀ',		'Ł' => 'ł',		'Ń' => 'ń',
51
-		'Ņ' => 'ņ',		'Ň' => 'ň',		'ʼn' => 'ʼn',	'Ŋ' => 'ŋ',
52
-		'Ō' => 'ō',		'Ŏ' => 'ŏ',		'Ő' => 'ő',		'Œ' => 'œ',
53
-		'Ŕ' => 'ŕ',		'Ŗ' => 'ŗ',		'Ř' => 'ř',		'Ś' => 'ś',
54
-		'Ŝ' => 'ŝ',		'Ş' => 'ş',		'Š' => 'š',		'Ţ' => 'ţ',
55
-		'Ť' => 'ť',		'Ŧ' => 'ŧ',		'Ũ' => 'ũ',		'Ū' => 'ū',
56
-		'Ŭ' => 'ŭ',		'Ů' => 'ů',		'Ű' => 'ű',		'Ų' => 'ų',
57
-		'Ŵ' => 'ŵ',		'Ŷ' => 'ŷ',		'Ÿ' => 'ÿ',		'Ź' => 'ź',
58
-		'Ż' => 'ż',		'Ž' => 'ž',		'ſ' => 's',		'Ɓ' => 'ɓ',
59
-		'Ƃ' => 'ƃ',		'Ƅ' => 'ƅ',		'Ɔ' => 'ɔ',		'Ƈ' => 'ƈ',
60
-		'Ɖ' => 'ɖ',		'Ɗ' => 'ɗ',		'Ƌ' => 'ƌ',		'Ǝ' => 'ǝ',
61
-		'Ə' => 'ə',		'Ɛ' => 'ɛ',		'Ƒ' => 'ƒ',		'Ɠ' => 'ɠ',
62
-		'Ɣ' => 'ɣ',		'Ɩ' => 'ɩ',		'Ɨ' => 'ɨ',		'Ƙ' => 'ƙ',
63
-		'Ɯ' => 'ɯ',		'Ɲ' => 'ɲ',		'Ɵ' => 'ɵ',		'Ơ' => 'ơ',
64
-		'Ƣ' => 'ƣ',		'Ƥ' => 'ƥ',		'Ʀ' => 'ʀ',		'Ƨ' => 'ƨ',
65
-		'Ʃ' => 'ʃ',		'Ƭ' => 'ƭ',		'Ʈ' => 'ʈ',		'Ư' => 'ư',
66
-		'Ʊ' => 'ʊ',		'Ʋ' => 'ʋ',		'Ƴ' => 'ƴ',		'Ƶ' => 'ƶ',
67
-		'Ʒ' => 'ʒ',		'Ƹ' => 'ƹ',		'Ƽ' => 'ƽ',		'DŽ' => 'dž',
68
-		'Dž' => 'dž',		'LJ' => 'lj',		'Lj' => 'lj',		'NJ' => 'nj',
69
-		'Nj' => 'nj',		'Ǎ' => 'ǎ',		'Ǐ' => 'ǐ',		'Ǒ' => 'ǒ',
70
-		'Ǔ' => 'ǔ',		'Ǖ' => 'ǖ',		'Ǘ' => 'ǘ',		'Ǚ' => 'ǚ',
71
-		'Ǜ' => 'ǜ',		'Ǟ' => 'ǟ',		'Ǡ' => 'ǡ',		'Ǣ' => 'ǣ',
72
-		'Ǥ' => 'ǥ',		'Ǧ' => 'ǧ',		'Ǩ' => 'ǩ',		'Ǫ' => 'ǫ',
73
-		'Ǭ' => 'ǭ',		'Ǯ' => 'ǯ',		'ǰ' => 'ǰ',		'DZ' => 'dz',
74
-		'Dz' => 'dz',		'Ǵ' => 'ǵ',		'Ƕ' => 'ƕ',		'Ƿ' => 'ƿ',
75
-		'Ǹ' => 'ǹ',		'Ǻ' => 'ǻ',		'Ǽ' => 'ǽ',		'Ǿ' => 'ǿ',
76
-		'Ȁ' => 'ȁ',		'Ȃ' => 'ȃ',		'Ȅ' => 'ȅ',		'Ȇ' => 'ȇ',
77
-		'Ȉ' => 'ȉ',		'Ȋ' => 'ȋ',		'Ȍ' => 'ȍ',		'Ȏ' => 'ȏ',
78
-		'Ȑ' => 'ȑ',		'Ȓ' => 'ȓ',		'Ȕ' => 'ȕ',		'Ȗ' => 'ȗ',
79
-		'Ș' => 'ș',		'Ț' => 'ț',		'Ȝ' => 'ȝ',		'Ȟ' => 'ȟ',
80
-		'Ƞ' => 'ƞ',		'Ȣ' => 'ȣ',		'Ȥ' => 'ȥ',		'Ȧ' => 'ȧ',
81
-		'Ȩ' => 'ȩ',		'Ȫ' => 'ȫ',		'Ȭ' => 'ȭ',		'Ȯ' => 'ȯ',
82
-		'Ȱ' => 'ȱ',		'Ȳ' => 'ȳ',		'Ⱥ' => 'ⱥ',		'Ȼ' => 'ȼ',
83
-		'Ƚ' => 'ƚ',		'Ⱦ' => 'ⱦ',		'Ɂ' => 'ɂ',		'Ƀ' => 'ƀ',
84
-		'Ʉ' => 'ʉ',		'Ʌ' => 'ʌ',		'Ɇ' => 'ɇ',		'Ɉ' => 'ɉ',
85
-		'Ɋ' => 'ɋ',		'Ɍ' => 'ɍ',		'Ɏ' => 'ɏ',		'ͅ' => 'ι',
86
-		'Ά' => 'ά',		'Έ' => 'έ',		'Ή' => 'ή',		'Ί' => 'ί',
87
-		'Ό' => 'ό',		'Ύ' => 'ύ',		'Ώ' => 'ώ',		'ΐ' => 'ΐ',
88
-		'Α' => 'α',		'Β' => 'β',		'Γ' => 'γ',		'Δ' => 'δ',
89
-		'Ε' => 'ε',		'Ζ' => 'ζ',		'Η' => 'η',		'Θ' => 'θ',
90
-		'Ι' => 'ι',		'Κ' => 'κ',		'Λ' => 'λ',		'Μ' => 'μ',
91
-		'Ν' => 'ν',		'Ξ' => 'ξ',		'Ο' => 'ο',		'Π' => 'π',
92
-		'Ρ' => 'ρ',		'Σ' => 'σ',		'Τ' => 'τ',		'Υ' => 'υ',
93
-		'Φ' => 'φ',		'Χ' => 'χ',		'Ψ' => 'ψ',		'Ω' => 'ω',
94
-		'Ϊ' => 'ϊ',		'Ϋ' => 'ϋ',		'ΰ' => 'ΰ',		'ς' => 'σ',
95
-		'ϐ' => 'β',		'ϑ' => 'θ',		'ϕ' => 'φ',		'ϖ' => 'π',
96
-		'Ϙ' => 'ϙ',		'Ϛ' => 'ϛ',		'Ϝ' => 'ϝ',		'Ϟ' => 'ϟ',
97
-		'Ϡ' => 'ϡ',		'Ϣ' => 'ϣ',		'Ϥ' => 'ϥ',		'Ϧ' => 'ϧ',
98
-		'Ϩ' => 'ϩ',		'Ϫ' => 'ϫ',		'Ϭ' => 'ϭ',		'Ϯ' => 'ϯ',
99
-		'ϰ' => 'κ',		'ϱ' => 'ρ',		'ϴ' => 'θ',		'ϵ' => 'ε',
100
-		'Ϸ' => 'ϸ',		'Ϲ' => 'ϲ',		'Ϻ' => 'ϻ',		'Ͻ' => 'ͻ',
101
-		'Ͼ' => 'ͼ',		'Ͽ' => 'ͽ',		'Ѐ' => 'ѐ',		'Ё' => 'ё',
102
-		'Ђ' => 'ђ',		'Ѓ' => 'ѓ',		'Є' => 'є',		'Ѕ' => 'ѕ',
103
-		'І' => 'і',		'Ї' => 'ї',		'Ј' => 'ј',		'Љ' => 'љ',
104
-		'Њ' => 'њ',		'Ћ' => 'ћ',		'Ќ' => 'ќ',		'Ѝ' => 'ѝ',
105
-		'Ў' => 'ў',		'Џ' => 'џ',		'А' => 'а',		'Б' => 'б',
106
-		'В' => 'в',		'Г' => 'г',		'Д' => 'д',		'Е' => 'е',
107
-		'Ж' => 'ж',		'З' => 'з',		'И' => 'и',		'Й' => 'й',
108
-		'К' => 'к',		'Л' => 'л',		'М' => 'м',		'Н' => 'н',
109
-		'О' => 'о',		'П' => 'п',		'Р' => 'р',		'С' => 'с',
110
-		'Т' => 'т',		'У' => 'у',		'Ф' => 'ф',		'Х' => 'х',
111
-		'Ц' => 'ц',		'Ч' => 'ч',		'Ш' => 'ш',		'Щ' => 'щ',
112
-		'Ъ' => 'ъ',		'Ы' => 'ы',		'Ь' => 'ь',		'Э' => 'э',
113
-		'Ю' => 'ю',		'Я' => 'я',		'Ѡ' => 'ѡ',		'Ѣ' => 'ѣ',
114
-		'Ѥ' => 'ѥ',		'Ѧ' => 'ѧ',		'Ѩ' => 'ѩ',		'Ѫ' => 'ѫ',
115
-		'Ѭ' => 'ѭ',		'Ѯ' => 'ѯ',		'Ѱ' => 'ѱ',		'Ѳ' => 'ѳ',
116
-		'Ѵ' => 'ѵ',		'Ѷ' => 'ѷ',		'Ѹ' => 'ѹ',		'Ѻ' => 'ѻ',
117
-		'Ѽ' => 'ѽ',		'Ѿ' => 'ѿ',		'Ҁ' => 'ҁ',		'Ҋ' => 'ҋ',
118
-		'Ҍ' => 'ҍ',		'Ҏ' => 'ҏ',		'Ґ' => 'ґ',		'Ғ' => 'ғ',
119
-		'Ҕ' => 'ҕ',		'Җ' => 'җ',		'Ҙ' => 'ҙ',		'Қ' => 'қ',
120
-		'Ҝ' => 'ҝ',		'Ҟ' => 'ҟ',		'Ҡ' => 'ҡ',		'Ң' => 'ң',
121
-		'Ҥ' => 'ҥ',		'Ҧ' => 'ҧ',		'Ҩ' => 'ҩ',		'Ҫ' => 'ҫ',
122
-		'Ҭ' => 'ҭ',		'Ү' => 'ү',		'Ұ' => 'ұ',		'Ҳ' => 'ҳ',
123
-		'Ҵ' => 'ҵ',		'Ҷ' => 'ҷ',		'Ҹ' => 'ҹ',		'Һ' => 'һ',
124
-		'Ҽ' => 'ҽ',		'Ҿ' => 'ҿ',		'Ӏ' => 'ӏ',		'Ӂ' => 'ӂ',
125
-		'Ӄ' => 'ӄ',		'Ӆ' => 'ӆ',		'Ӈ' => 'ӈ',		'Ӊ' => 'ӊ',
126
-		'Ӌ' => 'ӌ',		'Ӎ' => 'ӎ',		'Ӑ' => 'ӑ',		'Ӓ' => 'ӓ',
127
-		'Ӕ' => 'ӕ',		'Ӗ' => 'ӗ',		'Ә' => 'ә',		'Ӛ' => 'ӛ',
128
-		'Ӝ' => 'ӝ',		'Ӟ' => 'ӟ',		'Ӡ' => 'ӡ',		'Ӣ' => 'ӣ',
129
-		'Ӥ' => 'ӥ',		'Ӧ' => 'ӧ',		'Ө' => 'ө',		'Ӫ' => 'ӫ',
130
-		'Ӭ' => 'ӭ',		'Ӯ' => 'ӯ',		'Ӱ' => 'ӱ',		'Ӳ' => 'ӳ',
131
-		'Ӵ' => 'ӵ',		'Ӷ' => 'ӷ',		'Ӹ' => 'ӹ',		'Ӻ' => 'ӻ',
132
-		'Ӽ' => 'ӽ',		'Ӿ' => 'ӿ',		'Ԁ' => 'ԁ',		'Ԃ' => 'ԃ',
133
-		'Ԅ' => 'ԅ',		'Ԇ' => 'ԇ',		'Ԉ' => 'ԉ',		'Ԋ' => 'ԋ',
134
-		'Ԍ' => 'ԍ',		'Ԏ' => 'ԏ',		'Ԑ' => 'ԑ',		'Ԓ' => 'ԓ',
135
-		'Ա' => 'ա',		'Բ' => 'բ',		'Գ' => 'գ',		'Դ' => 'դ',
136
-		'Ե' => 'ե',		'Զ' => 'զ',		'Է' => 'է',		'Ը' => 'ը',
137
-		'Թ' => 'թ',		'Ժ' => 'ժ',		'Ի' => 'ի',		'Լ' => 'լ',
138
-		'Խ' => 'խ',		'Ծ' => 'ծ',		'Կ' => 'կ',		'Հ' => 'հ',
139
-		'Ձ' => 'ձ',		'Ղ' => 'ղ',		'Ճ' => 'ճ',		'Մ' => 'մ',
140
-		'Յ' => 'յ',		'Ն' => 'ն',		'Շ' => 'շ',		'Ո' => 'ո',
141
-		'Չ' => 'չ',		'Պ' => 'պ',		'Ջ' => 'ջ',		'Ռ' => 'ռ',
142
-		'Ս' => 'ս',		'Վ' => 'վ',		'Տ' => 'տ',		'Ր' => 'ր',
143
-		'Ց' => 'ց',		'Ւ' => 'ւ',		'Փ' => 'փ',		'Ք' => 'ք',
144
-		'Օ' => 'օ',		'Ֆ' => 'ֆ',		'և' => 'եւ',	'Ⴀ' => 'ⴀ',
145
-		'Ⴁ' => 'ⴁ',		'Ⴂ' => 'ⴂ',		'Ⴃ' => 'ⴃ',		'Ⴄ' => 'ⴄ',
146
-		'Ⴅ' => 'ⴅ',		'Ⴆ' => 'ⴆ',		'Ⴇ' => 'ⴇ',		'Ⴈ' => 'ⴈ',
147
-		'Ⴉ' => 'ⴉ',		'Ⴊ' => 'ⴊ',		'Ⴋ' => 'ⴋ',		'Ⴌ' => 'ⴌ',
148
-		'Ⴍ' => 'ⴍ',		'Ⴎ' => 'ⴎ',		'Ⴏ' => 'ⴏ',		'Ⴐ' => 'ⴐ',
149
-		'Ⴑ' => 'ⴑ',		'Ⴒ' => 'ⴒ',		'Ⴓ' => 'ⴓ',		'Ⴔ' => 'ⴔ',
150
-		'Ⴕ' => 'ⴕ',		'Ⴖ' => 'ⴖ',		'Ⴗ' => 'ⴗ',		'Ⴘ' => 'ⴘ',
151
-		'Ⴙ' => 'ⴙ',		'Ⴚ' => 'ⴚ',		'Ⴛ' => 'ⴛ',		'Ⴜ' => 'ⴜ',
152
-		'Ⴝ' => 'ⴝ',		'Ⴞ' => 'ⴞ',		'Ⴟ' => 'ⴟ',		'Ⴠ' => 'ⴠ',
153
-		'Ⴡ' => 'ⴡ',		'Ⴢ' => 'ⴢ',		'Ⴣ' => 'ⴣ',		'Ⴤ' => 'ⴤ',
154
-		'Ⴥ' => 'ⴥ',		'Ḁ' => 'ḁ',		'Ḃ' => 'ḃ',		'Ḅ' => 'ḅ',
155
-		'Ḇ' => 'ḇ',		'Ḉ' => 'ḉ',		'Ḋ' => 'ḋ',		'Ḍ' => 'ḍ',
156
-		'Ḏ' => 'ḏ',		'Ḑ' => 'ḑ',		'Ḓ' => 'ḓ',		'Ḕ' => 'ḕ',
157
-		'Ḗ' => 'ḗ',		'Ḙ' => 'ḙ',		'Ḛ' => 'ḛ',		'Ḝ' => 'ḝ',
158
-		'Ḟ' => 'ḟ',		'Ḡ' => 'ḡ',		'Ḣ' => 'ḣ',		'Ḥ' => 'ḥ',
159
-		'Ḧ' => 'ḧ',		'Ḩ' => 'ḩ',		'Ḫ' => 'ḫ',		'Ḭ' => 'ḭ',
160
-		'Ḯ' => 'ḯ',		'Ḱ' => 'ḱ',		'Ḳ' => 'ḳ',		'Ḵ' => 'ḵ',
161
-		'Ḷ' => 'ḷ',		'Ḹ' => 'ḹ',		'Ḻ' => 'ḻ',		'Ḽ' => 'ḽ',
162
-		'Ḿ' => 'ḿ',		'Ṁ' => 'ṁ',		'Ṃ' => 'ṃ',		'Ṅ' => 'ṅ',
163
-		'Ṇ' => 'ṇ',		'Ṉ' => 'ṉ',		'Ṋ' => 'ṋ',		'Ṍ' => 'ṍ',
164
-		'Ṏ' => 'ṏ',		'Ṑ' => 'ṑ',		'Ṓ' => 'ṓ',		'Ṕ' => 'ṕ',
165
-		'Ṗ' => 'ṗ',		'Ṙ' => 'ṙ',		'Ṛ' => 'ṛ',		'Ṝ' => 'ṝ',
166
-		'Ṟ' => 'ṟ',		'Ṡ' => 'ṡ',		'Ṣ' => 'ṣ',		'Ṥ' => 'ṥ',
167
-		'Ṧ' => 'ṧ',		'Ṩ' => 'ṩ',		'Ṫ' => 'ṫ',		'Ṭ' => 'ṭ',
168
-		'Ṯ' => 'ṯ',		'Ṱ' => 'ṱ',		'Ṳ' => 'ṳ',		'Ṵ' => 'ṵ',
169
-		'Ṷ' => 'ṷ',		'Ṹ' => 'ṹ',		'Ṻ' => 'ṻ',		'Ṽ' => 'ṽ',
170
-		'Ṿ' => 'ṿ',		'Ẁ' => 'ẁ',		'Ẃ' => 'ẃ',		'Ẅ' => 'ẅ',
171
-		'Ẇ' => 'ẇ',		'Ẉ' => 'ẉ',		'Ẋ' => 'ẋ',		'Ẍ' => 'ẍ',
172
-		'Ẏ' => 'ẏ',		'Ẑ' => 'ẑ',		'Ẓ' => 'ẓ',		'Ẕ' => 'ẕ',
173
-		'ẖ' => 'ẖ',		'ẗ' => 'ẗ',		'ẘ' => 'ẘ',		'ẙ' => 'ẙ',
174
-		'ẚ' => 'aʾ',	'ẛ' => 'ṡ',		'Ạ' => 'ạ',		'Ả' => 'ả',
175
-		'Ấ' => 'ấ',		'Ầ' => 'ầ',		'Ẩ' => 'ẩ',		'Ẫ' => 'ẫ',
176
-		'Ậ' => 'ậ',		'Ắ' => 'ắ',		'Ằ' => 'ằ',		'Ẳ' => 'ẳ',
177
-		'Ẵ' => 'ẵ',		'Ặ' => 'ặ',		'Ẹ' => 'ẹ',		'Ẻ' => 'ẻ',
178
-		'Ẽ' => 'ẽ',		'Ế' => 'ế',		'Ề' => 'ề',		'Ể' => 'ể',
179
-		'Ễ' => 'ễ',		'Ệ' => 'ệ',		'Ỉ' => 'ỉ',		'Ị' => 'ị',
180
-		'Ọ' => 'ọ',		'Ỏ' => 'ỏ',		'Ố' => 'ố',		'Ồ' => 'ồ',
181
-		'Ổ' => 'ổ',		'Ỗ' => 'ỗ',		'Ộ' => 'ộ',		'Ớ' => 'ớ',
182
-		'Ờ' => 'ờ',		'Ở' => 'ở',		'Ỡ' => 'ỡ',		'Ợ' => 'ợ',
183
-		'Ụ' => 'ụ',		'Ủ' => 'ủ',		'Ứ' => 'ứ',		'Ừ' => 'ừ',
184
-		'Ử' => 'ử',		'Ữ' => 'ữ',		'Ự' => 'ự',		'Ỳ' => 'ỳ',
185
-		'Ỵ' => 'ỵ',		'Ỷ' => 'ỷ',		'Ỹ' => 'ỹ',		'Ἀ' => 'ἀ',
186
-		'Ἁ' => 'ἁ',		'Ἂ' => 'ἂ',		'Ἃ' => 'ἃ',		'Ἄ' => 'ἄ',
187
-		'Ἅ' => 'ἅ',		'Ἆ' => 'ἆ',		'Ἇ' => 'ἇ',		'Ἐ' => 'ἐ',
188
-		'Ἑ' => 'ἑ',		'Ἒ' => 'ἒ',		'Ἓ' => 'ἓ',		'Ἔ' => 'ἔ',
189
-		'Ἕ' => 'ἕ',		'Ἠ' => 'ἠ',		'Ἡ' => 'ἡ',		'Ἢ' => 'ἢ',
190
-		'Ἣ' => 'ἣ',		'Ἤ' => 'ἤ',		'Ἥ' => 'ἥ',		'Ἦ' => 'ἦ',
191
-		'Ἧ' => 'ἧ',		'Ἰ' => 'ἰ',		'Ἱ' => 'ἱ',		'Ἲ' => 'ἲ',
192
-		'Ἳ' => 'ἳ',		'Ἴ' => 'ἴ',		'Ἵ' => 'ἵ',		'Ἶ' => 'ἶ',
193
-		'Ἷ' => 'ἷ',		'Ὀ' => 'ὀ',		'Ὁ' => 'ὁ',		'Ὂ' => 'ὂ',
194
-		'Ὃ' => 'ὃ',		'Ὄ' => 'ὄ',		'Ὅ' => 'ὅ',		'ὐ' => 'ὐ',
195
-		'ὒ' => 'ὒ',		'ὔ' => 'ὔ',		'ὖ' => 'ὖ',	'Ὑ' => 'ὑ',
196
-		'Ὓ' => 'ὓ',		'Ὕ' => 'ὕ',		'Ὗ' => 'ὗ',		'Ὠ' => 'ὠ',
197
-		'Ὡ' => 'ὡ',		'Ὢ' => 'ὢ',		'Ὣ' => 'ὣ',		'Ὤ' => 'ὤ',
198
-		'Ὥ' => 'ὥ',		'Ὦ' => 'ὦ',		'Ὧ' => 'ὧ',		'ᾀ' => 'ἀι',
199
-		'ᾁ' => 'ἁι',	'ᾂ' => 'ἂι',	'ᾃ' => 'ἃι',	'ᾄ' => 'ἄι',
200
-		'ᾅ' => 'ἅι',	'ᾆ' => 'ἆι',	'ᾇ' => 'ἇι',	'ᾈ' => 'ᾀ',
201
-		'ᾉ' => 'ᾁ',		'ᾊ' => 'ᾂ',		'ᾋ' => 'ᾃ',		'ᾌ' => 'ᾄ',
202
-		'ᾍ' => 'ᾅ',		'ᾎ' => 'ᾆ',		'ᾏ' => 'ᾇ',		'ᾐ' => 'ἠι',
203
-		'ᾑ' => 'ἡι',	'ᾒ' => 'ἢι',	'ᾓ' => 'ἣι',	'ᾔ' => 'ἤι',
204
-		'ᾕ' => 'ἥι',	'ᾖ' => 'ἦι',	'ᾗ' => 'ἧι',	'ᾘ' => 'ᾐ',
205
-		'ᾙ' => 'ᾑ',		'ᾚ' => 'ᾒ',		'ᾛ' => 'ᾓ',		'ᾜ' => 'ᾔ',
206
-		'ᾝ' => 'ᾕ',		'ᾞ' => 'ᾖ',		'ᾟ' => 'ᾗ',		'ᾠ' => 'ὠι',
207
-		'ᾡ' => 'ὡι',	'ᾢ' => 'ὢι',	'ᾣ' => 'ὣι',	'ᾤ' => 'ὤι',
208
-		'ᾥ' => 'ὥι',	'ᾦ' => 'ὦι',	'ᾧ' => 'ὧι',	'ᾨ' => 'ᾠ',
209
-		'ᾩ' => 'ᾡ',		'ᾪ' => 'ᾢ',		'ᾫ' => 'ᾣ',		'ᾬ' => 'ᾤ',
210
-		'ᾭ' => 'ᾥ',		'ᾮ' => 'ᾦ',		'ᾯ' => 'ᾧ',		'ᾲ' => 'ὰι',
211
-		'ᾳ' => 'αι',	'ᾴ' => 'άι',	'ᾶ' => 'ᾶ',	'ᾷ' => 'ᾶι',
212
-		'Ᾰ' => 'ᾰ',		'Ᾱ' => 'ᾱ',		'Ὰ' => 'ὰ',		'Ά' => 'ά',
213
-		'ᾼ' => 'ᾳ',		'ι' => 'ι',		'ῂ' => 'ὴι',	'ῃ' => 'ηι',
214
-		'ῄ' => 'ήι',	'ῆ' => 'ῆ',	'ῇ' => 'ῆι',	'Ὲ' => 'ὲ',
215
-		'Έ' => 'έ',		'Ὴ' => 'ὴ',		'Ή' => 'ή',		'ῌ' => 'ῃ',
216
-		'ῒ' => 'ῒ',		'ΐ' => 'ΐ',		'ῖ' => 'ῖ',	'ῗ' => 'ῗ',
217
-		'Ῐ' => 'ῐ',		'Ῑ' => 'ῑ',		'Ὶ' => 'ὶ',		'Ί' => 'ί',
218
-		'ῢ' => 'ῢ',		'ΰ' => 'ΰ',		'ῤ' => 'ῤ',		'ῦ' => 'ῦ',
219
-		'ῧ' => 'ῧ',	'Ῠ' => 'ῠ',		'Ῡ' => 'ῡ',		'Ὺ' => 'ὺ',
220
-		'Ύ' => 'ύ',		'Ῥ' => 'ῥ',		'ῲ' => 'ὼι',	'ῳ' => 'ωι',
221
-		'ῴ' => 'ώι',	'ῶ' => 'ῶ',	'ῷ' => 'ῶι',	'Ὸ' => 'ὸ',
222
-		'Ό' => 'ό',		'Ὼ' => 'ὼ',		'Ώ' => 'ώ',		'ῼ' => 'ῳ',
223
-		'Ω' => 'ω',		'K' => 'k',		'Å' => 'å',		'Ⅎ' => 'ⅎ',
224
-		'Ⅰ' => 'ⅰ',		'Ⅱ' => 'ⅱ',		'Ⅲ' => 'ⅲ',		'Ⅳ' => 'ⅳ',
225
-		'Ⅴ' => 'ⅴ',		'Ⅵ' => 'ⅵ',		'Ⅶ' => 'ⅶ',		'Ⅷ' => 'ⅷ',
226
-		'Ⅸ' => 'ⅸ',		'Ⅹ' => 'ⅹ',		'Ⅺ' => 'ⅺ',		'Ⅻ' => 'ⅻ',
227
-		'Ⅼ' => 'ⅼ',		'Ⅽ' => 'ⅽ',		'Ⅾ' => 'ⅾ',		'Ⅿ' => 'ⅿ',
228
-		'Ↄ' => 'ↄ',		'Ⓐ' => 'ⓐ',		'Ⓑ' => 'ⓑ',		'Ⓒ' => 'ⓒ',
229
-		'Ⓓ' => 'ⓓ',		'Ⓔ' => 'ⓔ',		'Ⓕ' => 'ⓕ',		'Ⓖ' => 'ⓖ',
230
-		'Ⓗ' => 'ⓗ',		'Ⓘ' => 'ⓘ',		'Ⓙ' => 'ⓙ',		'Ⓚ' => 'ⓚ',
231
-		'Ⓛ' => 'ⓛ',		'Ⓜ' => 'ⓜ',		'Ⓝ' => 'ⓝ',		'Ⓞ' => 'ⓞ',
232
-		'Ⓟ' => 'ⓟ',		'Ⓠ' => 'ⓠ',		'Ⓡ' => 'ⓡ',		'Ⓢ' => 'ⓢ',
233
-		'Ⓣ' => 'ⓣ',		'Ⓤ' => 'ⓤ',		'Ⓥ' => 'ⓥ',		'Ⓦ' => 'ⓦ',
234
-		'Ⓧ' => 'ⓧ',		'Ⓨ' => 'ⓨ',		'Ⓩ' => 'ⓩ',		'Ⰰ' => 'ⰰ',
235
-		'Ⰱ' => 'ⰱ',		'Ⰲ' => 'ⰲ',		'Ⰳ' => 'ⰳ',		'Ⰴ' => 'ⰴ',
236
-		'Ⰵ' => 'ⰵ',		'Ⰶ' => 'ⰶ',		'Ⰷ' => 'ⰷ',		'Ⰸ' => 'ⰸ',
237
-		'Ⰹ' => 'ⰹ',		'Ⰺ' => 'ⰺ',		'Ⰻ' => 'ⰻ',		'Ⰼ' => 'ⰼ',
238
-		'Ⰽ' => 'ⰽ',		'Ⰾ' => 'ⰾ',		'Ⰿ' => 'ⰿ',		'Ⱀ' => 'ⱀ',
239
-		'Ⱁ' => 'ⱁ',		'Ⱂ' => 'ⱂ',		'Ⱃ' => 'ⱃ',		'Ⱄ' => 'ⱄ',
240
-		'Ⱅ' => 'ⱅ',		'Ⱆ' => 'ⱆ',		'Ⱇ' => 'ⱇ',		'Ⱈ' => 'ⱈ',
241
-		'Ⱉ' => 'ⱉ',		'Ⱊ' => 'ⱊ',		'Ⱋ' => 'ⱋ',		'Ⱌ' => 'ⱌ',
242
-		'Ⱍ' => 'ⱍ',		'Ⱎ' => 'ⱎ',		'Ⱏ' => 'ⱏ',		'Ⱐ' => 'ⱐ',
243
-		'Ⱑ' => 'ⱑ',		'Ⱒ' => 'ⱒ',		'Ⱓ' => 'ⱓ',		'Ⱔ' => 'ⱔ',
244
-		'Ⱕ' => 'ⱕ',		'Ⱖ' => 'ⱖ',		'Ⱗ' => 'ⱗ',		'Ⱘ' => 'ⱘ',
245
-		'Ⱙ' => 'ⱙ',		'Ⱚ' => 'ⱚ',		'Ⱛ' => 'ⱛ',		'Ⱜ' => 'ⱜ',
246
-		'Ⱝ' => 'ⱝ',		'Ⱞ' => 'ⱞ',		'Ⱡ' => 'ⱡ',		'Ɫ' => 'ɫ',
247
-		'Ᵽ' => 'ᵽ',		'Ɽ' => 'ɽ',		'Ⱨ' => 'ⱨ',		'Ⱪ' => 'ⱪ',
248
-		'Ⱬ' => 'ⱬ',		'Ⱶ' => 'ⱶ',		'Ⲁ' => 'ⲁ',		'Ⲃ' => 'ⲃ',
249
-		'Ⲅ' => 'ⲅ',		'Ⲇ' => 'ⲇ',		'Ⲉ' => 'ⲉ',		'Ⲋ' => 'ⲋ',
250
-		'Ⲍ' => 'ⲍ',		'Ⲏ' => 'ⲏ',		'Ⲑ' => 'ⲑ',		'Ⲓ' => 'ⲓ',
251
-		'Ⲕ' => 'ⲕ',		'Ⲗ' => 'ⲗ',		'Ⲙ' => 'ⲙ',		'Ⲛ' => 'ⲛ',
252
-		'Ⲝ' => 'ⲝ',		'Ⲟ' => 'ⲟ',		'Ⲡ' => 'ⲡ',		'Ⲣ' => 'ⲣ',
253
-		'Ⲥ' => 'ⲥ',		'Ⲧ' => 'ⲧ',		'Ⲩ' => 'ⲩ',		'Ⲫ' => 'ⲫ',
254
-		'Ⲭ' => 'ⲭ',		'Ⲯ' => 'ⲯ',		'Ⲱ' => 'ⲱ',		'Ⲳ' => 'ⲳ',
255
-		'Ⲵ' => 'ⲵ',		'Ⲷ' => 'ⲷ',		'Ⲹ' => 'ⲹ',		'Ⲻ' => 'ⲻ',
256
-		'Ⲽ' => 'ⲽ',		'Ⲿ' => 'ⲿ',		'Ⳁ' => 'ⳁ',		'Ⳃ' => 'ⳃ',
257
-		'Ⳅ' => 'ⳅ',		'Ⳇ' => 'ⳇ',		'Ⳉ' => 'ⳉ',		'Ⳋ' => 'ⳋ',
258
-		'Ⳍ' => 'ⳍ',		'Ⳏ' => 'ⳏ',		'Ⳑ' => 'ⳑ',		'Ⳓ' => 'ⳓ',
259
-		'Ⳕ' => 'ⳕ',		'Ⳗ' => 'ⳗ',		'Ⳙ' => 'ⳙ',		'Ⳛ' => 'ⳛ',
260
-		'Ⳝ' => 'ⳝ',		'Ⳟ' => 'ⳟ',		'Ⳡ' => 'ⳡ',		'Ⳣ' => 'ⳣ',
261
-		'ff' => 'ff',	'fi' => 'fi',	'fl' => 'fl',	'ffi' => 'ffi',
262
-		'ffl' => 'ffl',	'ſt' => 'st',	'st' => 'st',	'ﬓ' => 'մն',
263
-		'ﬔ' => 'մե',	'ﬕ' => 'մի',	'ﬖ' => 'վն',	'ﬗ' => 'մխ',
264
-		'A' => 'a',		'B' => 'b',		'C' => 'c',		'D' => 'd',
265
-		'E' => 'e',		'F' => 'f',		'G' => 'g',		'H' => 'h',
266
-		'I' => 'i',		'J' => 'j',		'K' => 'k',		'L' => 'l',
267
-		'M' => 'm',		'N' => 'n',		'O' => 'o',		'P' => 'p',
268
-		'Q' => 'q',		'R' => 'r',		'S' => 's',		'T' => 't',
269
-		'U' => 'u',		'V' => 'v',		'W' => 'w',		'X' => 'x',
270
-		'Y' => 'y',		'Z' => 'z',		'
Please login to merge, or discard this patch.
sources/subs/Editor.subs.php 2 patches
Braces   +45 added lines, -16 removed lines patch added patch discarded remove patch
@@ -62,13 +62,17 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// @deprecated since 1.1
64 64
 		if (!isset($context['drafts_autosave_frequency']) && !empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']))
65
-			$context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 30000 : $modSettings['drafts_autosave_frequency'] * 1000;
65
+		{
66
+					$context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 30000 : $modSettings['drafts_autosave_frequency'] * 1000;
67
+		}
66 68
 
67 69
 		// This really has some WYSIWYG stuff.
68 70
 		loadTemplate('GenericControls');
69 71
 		loadCSSFile('jquery.sceditor.css');
70 72
 		if (!empty($context['theme_variant']) && file_exists($settings['theme_dir'] . '/css/' . $context['theme_variant'] . '/jquery.sceditor.elk' . $context['theme_variant'] . '.css'))
71
-			loadCSSFile($context['theme_variant'] . '/jquery.sceditor.elk' . $context['theme_variant'] . '.css');
73
+		{
74
+					loadCSSFile($context['theme_variant'] . '/jquery.sceditor.elk' . $context['theme_variant'] . '.css');
75
+		}
72 76
 
73 77
 		// JS makes the editor go round
74 78
 		loadJavascriptFile(array('jquery.sceditor.bbcode.min.js', 'jquery.sceditor.elkarte.js', 'post.js', 'splittag.plugin.js', 'undo.plugin.min.js', 'dropAttachments.js'));
@@ -82,15 +86,21 @@  discard block
 block discarded – undo
82 86
 		);
83 87
 		// Editor language file
84 88
 		if (!empty($txt['lang_locale']))
85
-			loadJavascriptFile($scripturl . '?action=jslocale;sa=sceditor', array('defer' => true), 'sceditor_language');
89
+		{
90
+					loadJavascriptFile($scripturl . '?action=jslocale;sa=sceditor', array('defer' => true), 'sceditor_language');
91
+		}
86 92
 
87 93
 		// Mentions?
88 94
 		if (!empty($context['mentions_enabled']))
89
-			loadJavascriptFile(array('jquery.atwho.min.js', 'jquery.caret.min.js', 'mentioning.plugin.js'));
95
+		{
96
+					loadJavascriptFile(array('jquery.atwho.min.js', 'jquery.caret.min.js', 'mentioning.plugin.js'));
97
+		}
90 98
 
91 99
 		// Our not so concise shortcut line
92 100
 		if (!isset($context['shortcuts_text']))
93
-			$context['shortcuts_text'] = $txt['shortcuts'];
101
+		{
102
+					$context['shortcuts_text'] = $txt['shortcuts'];
103
+		}
94 104
 
95 105
 		// Spellcheck?
96 106
 		$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
@@ -98,11 +108,13 @@  discard block
 block discarded – undo
98 108
 		{
99 109
 			// Some hidden information is needed in order to make spell check work.
100 110
 			if (!isset($_REQUEST['xml']))
101
-				$context['insert_after_template'] .= '
111
+			{
112
+							$context['insert_after_template'] .= '
102 113
 		<form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="' . $scripturl . '?action=spellcheck">
103 114
 			<input type="hidden" id="spellstring" name="spellstring" value="" />
104 115
 			<input type="hidden" id="fulleditor" name="fulleditor" value="" />
105 116
 		</form>';
117
+			}
106 118
 			loadJavascriptFile('spellcheck.js', array('defer' => true));
107 119
 		}
108 120
 	}
@@ -173,7 +185,9 @@  discard block
 block discarded – undo
173 185
 		// Generate a list of buttons that shouldn't be shown
174 186
 		$disabled_tags = array();
175 187
 		if (!empty($modSettings['disabledBBC']))
176
-			$disabled_tags = explode(',', $modSettings['disabledBBC']);
188
+		{
189
+					$disabled_tags = explode(',', $modSettings['disabledBBC']);
190
+		}
177 191
 
178 192
 		// Map codes to tags
179 193
 		$translate_tags_to_code = array('b' => 'bold', 'i' => 'italic', 'u' => 'underline', 's' => 'strike', 'img' => 'image', 'url' => 'link', 'sup' => 'superscript', 'sub' => 'subscript', 'hr' => 'horizontalrule');
@@ -188,7 +202,9 @@  discard block
 block discarded – undo
188 202
 				$context['disabled_tags']['orderedlist'] = true;
189 203
 			}
190 204
 			elseif (isset($translate_tags_to_code[$tag]))
191
-				$context['disabled_tags'][$translate_tags_to_code[$tag]] = true;
205
+			{
206
+							$context['disabled_tags'][$translate_tags_to_code[$tag]] = true;
207
+			}
192 208
 
193 209
 			// Tag is the same as the code, like font, color, size etc
194 210
 			$context['disabled_tags'][trim($tag)] = true;
@@ -199,7 +215,9 @@  discard block
 block discarded – undo
199 215
 		foreach ($bbc_tags as $row => $tagRow)
200 216
 		{
201 217
 			if (!isset($context['bbc_toolbar'][$row]))
202
-				$context['bbc_toolbar'][$row] = array();
218
+			{
219
+							$context['bbc_toolbar'][$row] = array();
220
+			}
203 221
 
204 222
 			$tagsRow = array();
205 223
 
@@ -210,17 +228,23 @@  discard block
 block discarded – undo
210 228
 				{
211 229
 					// Just add this code in the existing grouping
212 230
 					if (!isset($context['disabled_tags'][$tag]))
213
-						$tagsRow[] = $tag;
231
+					{
232
+											$tagsRow[] = $tag;
233
+					}
214 234
 				}
215 235
 
216 236
 				// If the row is not empty, and the last added tag is not a space, add a space.
217 237
 				if (!empty($tagsRow) && $tagsRow[count($tagsRow) - 1] !== 'space')
218
-					$tagsRow[] = 'space';
238
+				{
239
+									$tagsRow[] = 'space';
240
+				}
219 241
 			}
220 242
 
221 243
 			// Build that beautiful button row
222 244
 			if (!empty($tagsRow))
223
-				$context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
245
+			{
246
+							$context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
247
+			}
224 248
 		}
225 249
 	}
226 250
 
@@ -365,17 +389,22 @@  discard block
 block discarded – undo
365 389
 					}
366 390
 
367 391
 					if ($last_row !== null)
368
-						$context['smileys'][$section][$last_row]['isLast'] = true;
392
+					{
393
+											$context['smileys'][$section][$last_row]['isLast'] = true;
394
+					}
369 395
 				}
370 396
 
371 397
 				Cache::instance()->put('posting_smileys', $context['smileys'], 480);
372 398
 			}
373
-			else
374
-				$context['smileys'] = $temp;
399
+			else {
400
+							$context['smileys'] = $temp;
401
+			}
375 402
 
376 403
 			// The smiley popup may take advantage of Jquery UI ....
377 404
 			if (!empty($context['smileys']['popup']))
378
-				$modSettings['jquery_include_ui'] = true;
405
+			{
406
+							$modSettings['jquery_include_ui'] = true;
407
+			}
379 408
 		}
380 409
 	}
381 410
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@
 block discarded – undo
344 344
 					ORDER BY smiley_row, smiley_order',
345 345
 					array(
346 346
 					),
347
-					function ($row)
347
+					function($row)
348 348
 					{
349 349
 						global $context;
350 350
 
Please login to merge, or discard this patch.