Passed
Push — master ( d9e5dd...36764d )
by Spuds
01:07 queued 26s
created
sources/admin/ManageSmileys.controller.php 2 patches
Braces   +282 added lines, -97 removed lines patch added patch discarded remove patch
@@ -97,7 +97,9 @@  discard block
 block discarded – undo
97 97
 
98 98
 		// Some settings may not be enabled, disallow these from the tabs as appropriate.
99 99
 		if (empty($modSettings['messageIcons_enable']))
100
-			$context[$context['admin_menu_name']]['tab_data']['tabs']['editicons']['disabled'] = true;
100
+		{
101
+					$context[$context['admin_menu_name']]['tab_data']['tabs']['editicons']['disabled'] = true;
102
+		}
101 103
 
102 104
 		if (empty($modSettings['smiley_enable']))
103 105
 		{
@@ -141,7 +143,9 @@  discard block
 block discarded – undo
141 143
 
142 144
 			// Make sure that the smileys are in the right order after enabling them.
143 145
 			if (isset($this->_req->post->smiley_enable))
144
-				sortSmileyTable();
146
+			{
147
+							sortSmileyTable();
148
+			}
145 149
 
146 150
 			call_integration_hook('integrate_save_smiley_settings');
147 151
 
@@ -220,12 +224,14 @@  discard block
 block discarded – undo
220 224
 		$context['smiley_sets'] = explode(',', $modSettings['smiley_sets_known']);
221 225
 		$set_names = explode("\n", $modSettings['smiley_sets_names']);
222 226
 		foreach ($context['smiley_sets'] as $i => $set)
223
-			$context['smiley_sets'][$i] = array(
227
+		{
228
+					$context['smiley_sets'][$i] = array(
224 229
 				'id' => $i,
225 230
 				'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'),
226 231
 				'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'),
227 232
 				'selected' => $set == $modSettings['smiley_sets_default']
228 233
 			);
234
+		}
229 235
 
230 236
 		// Importing any smileys from an existing set?
231 237
 		$this->_subActionImport();
@@ -362,7 +368,9 @@  discard block
 block discarded – undo
362 368
 				foreach ($this->_req->post->smiley_set as $id => $val)
363 369
 				{
364 370
 					if (isset($set_paths[$id], $set_names[$id]) && !empty($id))
365
-						unset($set_paths[$id], $set_names[$id]);
371
+					{
372
+											unset($set_paths[$id], $set_names[$id]);
373
+					}
366 374
 				}
367 375
 
368 376
 				// Update the modsettings with the new values
@@ -374,7 +382,9 @@  discard block
 block discarded – undo
374 382
 			}
375 383
 			// Add a new smiley set.
376 384
 			elseif (!empty($this->_req->post->add))
377
-				$context['sub_action'] = 'modifyset';
385
+			{
386
+							$context['sub_action'] = 'modifyset';
387
+			}
378 388
 			// Create or modify a smiley set.
379 389
 			elseif (isset($this->_req->post->set))
380 390
 			{
@@ -387,7 +397,9 @@  discard block
 block discarded – undo
387 397
 				if ($set == -1 && isset($this->_req->post->smiley_sets_path))
388 398
 				{
389 399
 					if (in_array($this->_req->post->smiley_sets_path, $set_paths))
390
-						throw new Elk_Exception('smiley_set_already_exists');
400
+					{
401
+											throw new Elk_Exception('smiley_set_already_exists');
402
+					}
391 403
 
392 404
 					updateSettings(array(
393 405
 						'smiley_sets_known' => $modSettings['smiley_sets_known'] . ',' . $this->_req->post->smiley_sets_path,
@@ -400,11 +412,15 @@  discard block
 block discarded – undo
400 412
 				{
401 413
 					// Make sure the smiley set exists.
402 414
 					if (!isset($set_paths[$set]) || !isset($set_names[$set]))
403
-						throw new Elk_Exception('smiley_set_not_found');
415
+					{
416
+											throw new Elk_Exception('smiley_set_not_found');
417
+					}
404 418
 
405 419
 					// Make sure the path is not yet used by another smileyset.
406 420
 					if (in_array($this->_req->post->smiley_sets_path, $set_paths) && $this->_req->post->smiley_sets_path != $set_paths[$set])
407
-						throw new Elk_Exception('smiley_set_path_already_used');
421
+					{
422
+											throw new Elk_Exception('smiley_set_path_already_used');
423
+					}
408 424
 
409 425
 					$set_paths[$set] = $this->_req->post->smiley_sets_path;
410 426
 					$set_names[$set] = $this->_req->post->smiley_sets_name;
@@ -417,7 +433,9 @@  discard block
 block discarded – undo
417 433
 
418 434
 				// The user might have checked to also import smileys.
419 435
 				if (!empty($this->_req->post->smiley_sets_import))
420
-					$this->importSmileys($this->_req->post->smiley_sets_path);
436
+				{
437
+									$this->importSmileys($this->_req->post->smiley_sets_path);
438
+				}
421 439
 			}
422 440
 
423 441
 			// No matter what, reset the cache
@@ -437,13 +455,15 @@  discard block
 block discarded – undo
437 455
 		{
438 456
 			$set = $this->_req->getQuery('set', 'intval', -1);
439 457
 			if ($set == -1 || !isset($context['smiley_sets'][$set]))
440
-				$context['current_set'] = array(
458
+			{
459
+							$context['current_set'] = array(
441 460
 					'id' => '-1',
442 461
 					'path' => '',
443 462
 					'name' => '',
444 463
 					'selected' => false,
445 464
 					'is_new' => true,
446 465
 				);
466
+			}
447 467
 			else
448 468
 			{
449 469
 				$context['current_set'] = &$context['smiley_sets'][$set];
@@ -457,19 +477,25 @@  discard block
 block discarded – undo
457 477
 					while ($entry = $dir->read())
458 478
 					{
459 479
 						if (in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp')))
460
-							$smileys[strtolower($entry)] = $entry;
480
+						{
481
+													$smileys[strtolower($entry)] = $entry;
482
+						}
461 483
 					}
462 484
 					$dir->close();
463 485
 
464 486
 					if (empty($smileys))
465
-						throw new Elk_Exception('smiley_set_dir_not_found', false, array($context['current_set']['name']));
487
+					{
488
+											throw new Elk_Exception('smiley_set_dir_not_found', false, array($context['current_set']['name']));
489
+					}
466 490
 
467 491
 					// Exclude the smileys that are already in the database.
468 492
 					$found = smileyExists($smileys);
469 493
 					foreach ($found as $smiley)
470 494
 					{
471 495
 						if (isset($smileys[$smiley]))
472
-							unset($smileys[$smiley]);
496
+						{
497
+													unset($smileys[$smiley]);
498
+						}
473 499
 					}
474 500
 
475 501
 					$context['current_set']['can_import'] = count($smileys);
@@ -487,12 +513,14 @@  discard block
 block discarded – undo
487 513
 				while ($entry = $dir->read())
488 514
 				{
489 515
 					if (!in_array($entry, array('.', '..')) && is_dir($modSettings['smileys_dir'] . '/' . $entry))
490
-						$context['smiley_set_dirs'][] = array(
516
+					{
517
+											$context['smiley_set_dirs'][] = array(
491 518
 							'id' => $entry,
492 519
 							'path' => $modSettings['smileys_dir'] . '/' . $entry,
493 520
 							'selectable' => $entry == $context['current_set']['path'] || !in_array($entry, explode(',', $modSettings['smiley_sets_known'])),
494 521
 							'current' => $entry == $context['current_set']['path'],
495 522
 						);
523
+					}
496 524
 				}
497 525
 				$dir->close();
498 526
 			}
@@ -516,7 +544,9 @@  discard block
 block discarded – undo
516 544
 
517 545
 			// Sanity check - then import.
518 546
 			if (isset($context['smiley_sets'][$set]))
519
-				$this->importSmileys(un_htmlspecialchars($context['smiley_sets'][$set]['path']));
547
+			{
548
+							$this->importSmileys(un_htmlspecialchars($context['smiley_sets'][$set]['path']));
549
+			}
520 550
 
521 551
 			// Force the process to continue.
522 552
 			$context['sub_action'] = 'modifyset';
@@ -541,12 +571,14 @@  discard block
 block discarded – undo
541 571
 
542 572
 		$set_names = explode("\n", $modSettings['smiley_sets_names']);
543 573
 		foreach ($context['smiley_sets'] as $i => $set)
544
-			$context['smiley_sets'][$i] = array(
574
+		{
575
+					$context['smiley_sets'][$i] = array(
545 576
 				'id' => $i,
546 577
 				'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'),
547 578
 				'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'),
548 579
 				'selected' => $set == $modSettings['smiley_sets_default']
549 580
 			);
581
+		}
550 582
 
551 583
 		// Submitting a form?
552 584
 		if (isset($this->_req->post->{$context['session_var']}, $this->_req->post->smiley_code))
@@ -563,11 +595,15 @@  discard block
 block discarded – undo
563 595
 
564 596
 			// Make sure some code was entered.
565 597
 			if (empty($this->_req->post->smiley_code))
566
-				throw new Elk_Exception('smiley_has_no_code');
598
+			{
599
+							throw new Elk_Exception('smiley_has_no_code');
600
+			}
567 601
 
568 602
 			// Check whether the new code has duplicates. It should be unique.
569 603
 			if (validateDuplicateSmiley($this->_req->post->smiley_code))
570
-				throw new Elk_Exception('smiley_not_unique');
604
+			{
605
+							throw new Elk_Exception('smiley_not_unique');
606
+			}
571 607
 
572 608
 			// If we are uploading - check all the smiley sets are writable!
573 609
 			if ($this->_req->post->method !== 'existing')
@@ -576,39 +612,51 @@  discard block
 block discarded – undo
576 612
 				foreach ($context['smiley_sets'] as $set)
577 613
 				{
578 614
 					if (!is_writable($context['smileys_dir'] . '/' . un_htmlspecialchars($set['path'])))
579
-						$writeErrors[] = $set['path'];
615
+					{
616
+											$writeErrors[] = $set['path'];
617
+					}
580 618
 				}
581 619
 
582 620
 				if (!empty($writeErrors))
583
-					throw new Elk_Exception('smileys_upload_error_notwritable', true, array(implode(', ', $writeErrors)));
621
+				{
622
+									throw new Elk_Exception('smileys_upload_error_notwritable', true, array(implode(', ', $writeErrors)));
623
+				}
584 624
 			}
585 625
 
586 626
 			// Uploading just one smiley for all of them?
587 627
 			if (isset($this->_req->post->sameall) && isset($_FILES['uploadSmiley']['name']) && $_FILES['uploadSmiley']['name'] != '')
588 628
 			{
589 629
 				if (!is_uploaded_file($_FILES['uploadSmiley']['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['uploadSmiley']['tmp_name'])))
590
-					throw new Elk_Exception('smileys_upload_error');
630
+				{
631
+									throw new Elk_Exception('smileys_upload_error');
632
+				}
591 633
 
592 634
 				// Sorry, no spaces, dots, or anything else but letters allowed.
593 635
 				$_FILES['uploadSmiley']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['uploadSmiley']['name']);
594 636
 
595 637
 				// We only allow image files - it's THAT simple - no messing around here...
596 638
 				if (!in_array(strtolower(substr(strrchr($_FILES['uploadSmiley']['name'], '.'), 1)), $allowedTypes))
597
-					throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes)));
639
+				{
640
+									throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes)));
641
+				}
598 642
 
599 643
 				// We only need the filename...
600 644
 				$destName = basename($_FILES['uploadSmiley']['name']);
601 645
 
602 646
 				// Make sure they aren't trying to upload a nasty file - for their own good here!
603 647
 				if (in_array(strtolower($destName), $disabledFiles))
604
-					throw new Elk_Exception('smileys_upload_error_illegal');
648
+				{
649
+									throw new Elk_Exception('smileys_upload_error_illegal');
650
+				}
605 651
 
606 652
 				// Check if the file already exists... and if not move it to EVERY smiley set directory.
607 653
 				$i = 0;
608 654
 
609 655
 				// Keep going until we find a set the file doesn't exist in. (or maybe it exists in all of them?)
610 656
 				while (isset($context['smiley_sets'][$i]) && file_exists($context['smileys_dir'] . '/' . un_htmlspecialchars($context['smiley_sets'][$i]['path']) . '/' . $destName))
611
-					$i++;
657
+				{
658
+									$i++;
659
+				}
612 660
 
613 661
 				// Okay, we're going to put the smiley right here, since it's not there yet!
614 662
 				if (isset($context['smiley_sets'][$i]['path']))
@@ -624,7 +672,9 @@  discard block
 block discarded – undo
624 672
 
625 673
 						// The file is already there!  Don't overwrite it!
626 674
 						if (file_exists($currentPath))
627
-							continue;
675
+						{
676
+													continue;
677
+						}
628 678
 
629 679
 						// Okay, so copy the first one we made to here.
630 680
 						copy($smileyLocation, $currentPath);
@@ -642,12 +692,18 @@  discard block
 block discarded – undo
642 692
 				foreach ($_FILES as $name => $dummy)
643 693
 				{
644 694
 					if ($_FILES[$name]['name'] == '')
645
-						throw new Elk_Exception('smileys_upload_error_blank');
695
+					{
696
+											throw new Elk_Exception('smileys_upload_error_blank');
697
+					}
646 698
 
647 699
 					if (empty($newName))
648
-						$newName = basename($_FILES[$name]['name']);
700
+					{
701
+											$newName = basename($_FILES[$name]['name']);
702
+					}
649 703
 					elseif (basename($_FILES[$name]['name']) != $newName)
650
-						throw new Elk_Exception('smileys_upload_error_name');
704
+					{
705
+											throw new Elk_Exception('smileys_upload_error_name');
706
+					}
651 707
 				}
652 708
 
653 709
 				foreach ($context['smiley_sets'] as $i => $set)
@@ -656,30 +712,40 @@  discard block
 block discarded – undo
656 712
 					$set['path'] = un_htmlspecialchars($set['path']);
657 713
 
658 714
 					if (!isset($_FILES['individual_' . $set['name']]['name']) || $_FILES['individual_' . $set['name']]['name'] == '')
659
-						continue;
715
+					{
716
+											continue;
717
+					}
660 718
 
661 719
 					// Got one...
662 720
 					if (!is_uploaded_file($_FILES['individual_' . $set['name']]['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['individual_' . $set['name']]['tmp_name'])))
663
-						throw new Elk_Exception('smileys_upload_error');
721
+					{
722
+											throw new Elk_Exception('smileys_upload_error');
723
+					}
664 724
 
665 725
 					// Sorry, no spaces, dots, or anything else but letters allowed.
666 726
 					$_FILES['individual_' . $set['name']]['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['individual_' . $set['name']]['name']);
667 727
 
668 728
 					// We only allow image files - it's THAT simple - no messing around here...
669 729
 					if (!in_array(strtolower(substr(strrchr($_FILES['individual_' . $set['name']]['name'], '.'), 1)), $allowedTypes))
670
-						throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes)));
730
+					{
731
+											throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes)));
732
+					}
671 733
 
672 734
 					// We only need the filename...
673 735
 					$destName = basename($_FILES['individual_' . $set['name']]['name']);
674 736
 
675 737
 					// Make sure they aren't trying to upload a nasty file - for their own good here!
676 738
 					if (in_array(strtolower($destName), $disabledFiles))
677
-						throw new Elk_Exception('smileys_upload_error_illegal');
739
+					{
740
+											throw new Elk_Exception('smileys_upload_error_illegal');
741
+					}
678 742
 
679 743
 					// If the file exists - ignore it.
680 744
 					$smileyLocation = $context['smileys_dir'] . '/' . $set['path'] . '/' . $destName;
681 745
 					if (file_exists($smileyLocation))
682
-						continue;
746
+					{
747
+											continue;
748
+					}
683 749
 
684 750
 					// Finally - move the image!
685 751
 					move_uploaded_file($_FILES['individual_' . $set['name']]['tmp_name'], $smileyLocation);
@@ -692,7 +758,9 @@  discard block
 block discarded – undo
692 758
 
693 759
 			// Also make sure a filename was given.
694 760
 			if (empty($this->_req->post->smiley_filename))
695
-				throw new Elk_Exception('smiley_has_no_filename');
761
+			{
762
+							throw new Elk_Exception('smiley_has_no_filename');
763
+			}
696 764
 
697 765
 			// Find the position on the right.
698 766
 			$smiley_order = '0';
@@ -702,7 +770,9 @@  discard block
 block discarded – undo
702 770
 				$smiley_order = nextSmileyLocation($this->_req->post->smiley_location);
703 771
 
704 772
 				if (empty($smiley_order))
705
-					$smiley_order = '0';
773
+				{
774
+									$smiley_order = '0';
775
+				}
706 776
 			}
707 777
 			$param = array(
708 778
 				$this->_req->post->smiley_code,
@@ -728,16 +798,20 @@  discard block
 block discarded – undo
728 798
 			foreach ($context['smiley_sets'] as $smiley_set)
729 799
 			{
730 800
 				if (!file_exists($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path'])))
731
-					continue;
801
+				{
802
+									continue;
803
+				}
732 804
 
733 805
 				$dir = dir($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path']));
734 806
 				while ($entry = $dir->read())
735 807
 				{
736 808
 					if (!in_array($entry, $context['filenames']) && in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp')))
737
-						$context['filenames'][strtolower($entry)] = array(
809
+					{
810
+											$context['filenames'][strtolower($entry)] = array(
738 811
 							'id' => htmlspecialchars($entry, ENT_COMPAT, 'UTF-8'),
739 812
 							'selected' => false,
740 813
 						);
814
+					}
741 815
 				}
742 816
 				$dir->close();
743 817
 			}
@@ -780,10 +854,14 @@  discard block
 block discarded – undo
780 854
 			if (isset($this->_req->post->smiley_action) && !empty($this->_req->post->checked_smileys))
781 855
 			{
782 856
 				foreach ($this->_req->post->checked_smileys as $id => $smiley_id)
783
-					$this->_req->post->checked_smileys[$id] = (int) $smiley_id;
857
+				{
858
+									$this->_req->post->checked_smileys[$id] = (int) $smiley_id;
859
+				}
784 860
 
785 861
 				if ($this->_req->post->smiley_action == 'delete')
786
-					deleteSmileys($this->_req->post->checked_smileys);
862
+				{
863
+									deleteSmileys($this->_req->post->checked_smileys);
864
+				}
787 865
 				// Changing the status of the smiley?
788 866
 				else
789 867
 				{
@@ -794,7 +872,9 @@  discard block
 block discarded – undo
794 872
 						'popup' => 2
795 873
 					);
796 874
 					if (isset($displayTypes[$this->_req->post->smiley_action]))
797
-						updateSmileyDisplayType($this->_req->post->checked_smileys, $displayTypes[$this->_req->post->smiley_action]);
875
+					{
876
+											updateSmileyDisplayType($this->_req->post->checked_smileys, $displayTypes[$this->_req->post->smiley_action]);
877
+					}
798 878
 				}
799 879
 			}
800 880
 			// Create/modify a smiley.
@@ -804,7 +884,9 @@  discard block
 block discarded – undo
804 884
 
805 885
 				// Is it a delete?
806 886
 				if (!empty($this->_req->post->deletesmiley))
807
-					deleteSmileys(array($this->_req->post->smiley));
887
+				{
888
+									deleteSmileys(array($this->_req->post->smiley));
889
+				}
808 890
 				// Otherwise an edit.
809 891
 				else
810 892
 				{
@@ -814,15 +896,21 @@  discard block
 block discarded – undo
814 896
 
815 897
 					// Make sure some code was entered.
816 898
 					if (empty($this->_req->post->smiley_code))
817
-						throw new Elk_Exception('smiley_has_no_code');
899
+					{
900
+											throw new Elk_Exception('smiley_has_no_code');
901
+					}
818 902
 
819 903
 					// Also make sure a filename was given.
820 904
 					if (empty($this->_req->post->smiley_filename))
821
-						throw new Elk_Exception('smiley_has_no_filename');
905
+					{
906
+											throw new Elk_Exception('smiley_has_no_filename');
907
+					}
822 908
 
823 909
 					// Check whether the new code has duplicates. It should be unique.
824 910
 					if (validateDuplicateSmiley($this->_req->post->smiley_code, $this->_req->post->smiley))
825
-						throw new Elk_Exception('smiley_not_unique');
911
+					{
912
+											throw new Elk_Exception('smiley_not_unique');
913
+					}
826 914
 
827 915
 					$param = array(
828 916
 						'smiley_location' => $this->_req->post->smiley_location,
@@ -845,12 +933,14 @@  discard block
 block discarded – undo
845 933
 		$context['smiley_sets'] = explode(',', $modSettings['smiley_sets_known']);
846 934
 		$set_names = explode("\n", $modSettings['smiley_sets_names']);
847 935
 		foreach ($context['smiley_sets'] as $i => $set)
848
-			$context['smiley_sets'][$i] = array(
936
+		{
937
+					$context['smiley_sets'][$i] = array(
849 938
 				'id' => $i,
850 939
 				'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'),
851 940
 				'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'),
852 941
 				'selected' => $set == $modSettings['smiley_sets_default']
853 942
 			);
943
+		}
854 944
 
855 945
 		// Prepare overview of all (custom) smileys.
856 946
 		if ($context['sub_action'] == 'editsmileys')
@@ -867,8 +957,10 @@  discard block
 block discarded – undo
867 957
 			$smileyset_option_list = '
868 958
 				<select name="set" onchange="changeSet(this.options[this.selectedIndex].value);">';
869 959
 			foreach ($context['smiley_sets'] as $smiley_set)
870
-				$smileyset_option_list .= '
960
+			{
961
+							$smileyset_option_list .= '
871 962
 					<option value="' . $smiley_set['path'] . '"' . ($modSettings['smiley_sets_default'] == $smiley_set['path'] ? ' selected="selected"' : '') . '>' . $smiley_set['name'] . '</option>';
963
+			}
872 964
 			$smileyset_option_list .= '
873 965
 				</select>';
874 966
 
@@ -932,11 +1024,16 @@  discard block
 block discarded – undo
932 1024
 								global $txt;
933 1025
 
934 1026
 								if (empty($rowData['hidden']))
935
-									return $txt['smileys_location_form'];
1027
+								{
1028
+																	return $txt['smileys_location_form'];
1029
+								}
936 1030
 								elseif ($rowData['hidden'] == 1)
937
-									return $txt['smileys_location_hidden'];
938
-								else
939
-									return $txt['smileys_location_popup'];
1031
+								{
1032
+																	return $txt['smileys_location_hidden'];
1033
+								}
1034
+								else {
1035
+																	return $txt['smileys_location_popup'];
1036
+								}
940 1037
 							},
941 1038
 						),
942 1039
 						'sort' => array(
@@ -953,18 +1050,24 @@  discard block
 block discarded – undo
953 1050
 								global $context, $txt, $modSettings;
954 1051
 
955 1052
 								if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir']))
956
-									return htmlspecialchars($rowData['description'], ENT_COMPAT, 'UTF-8');
1053
+								{
1054
+																	return htmlspecialchars($rowData['description'], ENT_COMPAT, 'UTF-8');
1055
+								}
957 1056
 
958 1057
 								// Check if there are smileys missing in some sets.
959 1058
 								$missing_sets = array();
960 1059
 								foreach ($context['smiley_sets'] as $smiley_set)
961
-									if (!file_exists(sprintf('%1$s/%2$s/%3$s', $modSettings['smileys_dir'], $smiley_set['path'], $rowData['filename'])))
1060
+								{
1061
+																	if (!file_exists(sprintf('%1$s/%2$s/%3$s', $modSettings['smileys_dir'], $smiley_set['path'], $rowData['filename'])))
962 1062
 										$missing_sets[] = $smiley_set['path'];
1063
+								}
963 1064
 
964 1065
 								$description = htmlspecialchars($rowData['description'], ENT_COMPAT, 'UTF-8');
965 1066
 
966 1067
 								if (!empty($missing_sets))
967
-									$description .= sprintf('<br /><span class="smalltext"><strong>%1$s:</strong> %2$s</span>', $txt['smileys_not_found_in_set'], implode(', ', $missing_sets));
1068
+								{
1069
+																	$description .= sprintf('<br /><span class="smalltext"><strong>%1$s:</strong> %2$s</span>', $txt['smileys_not_found_in_set'], implode(', ', $missing_sets));
1070
+								}
968 1071
 
969 1072
 								return $description;
970 1073
 							},
@@ -1080,12 +1183,14 @@  discard block
 block discarded – undo
1080 1183
 			$context['smiley_sets'] = explode(',', $modSettings['smiley_sets_known']);
1081 1184
 			$set_names = explode("\n", $modSettings['smiley_sets_names']);
1082 1185
 			foreach ($context['smiley_sets'] as $i => $set)
1083
-				$context['smiley_sets'][$i] = array(
1186
+			{
1187
+							$context['smiley_sets'][$i] = array(
1084 1188
 					'id' => $i,
1085 1189
 					'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'),
1086 1190
 					'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'),
1087 1191
 					'selected' => $set == $modSettings['smiley_sets_default']
1088 1192
 				);
1193
+			}
1089 1194
 
1090 1195
 			$context['selected_set'] = $modSettings['smiley_sets_default'];
1091 1196
 
@@ -1096,16 +1201,20 @@  discard block
 block discarded – undo
1096 1201
 				foreach ($context['smiley_sets'] as $smiley_set)
1097 1202
 				{
1098 1203
 					if (!file_exists($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path'])))
1099
-						continue;
1204
+					{
1205
+											continue;
1206
+					}
1100 1207
 
1101 1208
 					$dir = dir($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path']));
1102 1209
 					while ($entry = $dir->read())
1103 1210
 					{
1104 1211
 						if (!in_array($entry, $context['filenames']) && in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp')))
1105
-							$context['filenames'][strtolower($entry)] = array(
1212
+						{
1213
+													$context['filenames'][strtolower($entry)] = array(
1106 1214
 								'id' => htmlspecialchars($entry, ENT_COMPAT, 'UTF-8'),
1107 1215
 								'selected' => false,
1108 1216
 							);
1217
+						}
1109 1218
 					}
1110 1219
 					$dir->close();
1111 1220
 				}
@@ -1119,7 +1228,9 @@  discard block
 block discarded – undo
1119 1228
 			$context['current_smiley']['description'] = htmlspecialchars($context['current_smiley']['description'], ENT_COMPAT, 'UTF-8');
1120 1229
 
1121 1230
 			if (isset($context['filenames'][strtolower($context['current_smiley']['filename'])]))
1122
-				$context['filenames'][strtolower($context['current_smiley']['filename'])]['selected'] = true;
1231
+			{
1232
+							$context['filenames'][strtolower($context['current_smiley']['filename'])]['selected'] = true;
1233
+			}
1123 1234
 		}
1124 1235
 	}
1125 1236
 
@@ -1147,7 +1258,9 @@  discard block
 block discarded – undo
1147 1258
 			{
1148 1259
 				$deleteIcons = array();
1149 1260
 				foreach ($this->_req->post->checked_icons as $icon)
1150
-					$deleteIcons[] = (int) $icon;
1261
+				{
1262
+									$deleteIcons[] = (int) $icon;
1263
+				}
1151 1264
 
1152 1265
 				// Do the actual delete!
1153 1266
 				deleteMessageIcons($deleteIcons);
@@ -1159,36 +1272,50 @@  discard block
 block discarded – undo
1159 1272
 
1160 1273
 				// Do some preparation with the data... like check the icon exists *somewhere*
1161 1274
 				if (strpos($this->_req->post->icon_filename, '.png') !== false)
1162
-					$this->_req->post->icon_filename = substr($this->_req->post->icon_filename, 0, -4);
1275
+				{
1276
+									$this->_req->post->icon_filename = substr($this->_req->post->icon_filename, 0, -4);
1277
+				}
1163 1278
 
1164 1279
 				if (!file_exists($settings['default_theme_dir'] . '/images/post/' . $this->_req->post->icon_filename . '.png'))
1165
-					throw new Elk_Exception('icon_not_found');
1280
+				{
1281
+									throw new Elk_Exception('icon_not_found');
1282
+				}
1166 1283
 				// There is a 16 character limit on message icons...
1167 1284
 				elseif (strlen($this->_req->post->icon_filename) > 16)
1168
-					throw new Elk_Exception('icon_name_too_long');
1285
+				{
1286
+									throw new Elk_Exception('icon_name_too_long');
1287
+				}
1169 1288
 				elseif ($this->_req->post->icon_location == $this->_req->query->icon && !empty($this->_req->query->icon))
1170
-					throw new Elk_Exception('icon_after_itself');
1289
+				{
1290
+									throw new Elk_Exception('icon_after_itself');
1291
+				}
1171 1292
 
1172 1293
 				// First do the sorting... if this is an edit reduce the order of everything after it by one ;)
1173 1294
 				if ($this->_req->query->icon != 0)
1174 1295
 				{
1175 1296
 					$oldOrder = $context['icons'][$this->_req->query->icon]['true_order'];
1176 1297
 					foreach ($context['icons'] as $id => $data)
1177
-						if ($data['true_order'] > $oldOrder)
1298
+					{
1299
+											if ($data['true_order'] > $oldOrder)
1178 1300
 							$context['icons'][$id]['true_order']--;
1301
+					}
1179 1302
 				}
1180 1303
 
1181 1304
 				// If there are no existing icons and this is a new one, set the id to 1 (mainly for non-mysql)
1182 1305
 				if (empty($this->_req->query->icon) && empty($context['icons']))
1183
-					$this->_req->query->icon = 1;
1306
+				{
1307
+									$this->_req->query->icon = 1;
1308
+				}
1184 1309
 
1185 1310
 				// Get the new order.
1186 1311
 				$newOrder = $this->_req->post->icon_location == 0 ? 0 : $context['icons'][$this->_req->post->icon_location]['true_order'] + 1;
1187 1312
 
1188 1313
 				// Do the same, but with the one that used to be after this icon, done to avoid conflict.
1189 1314
 				foreach ($context['icons'] as $id => $data)
1190
-					if ($data['true_order'] >= $newOrder)
1315
+				{
1316
+									if ($data['true_order'] >= $newOrder)
1191 1317
 						$context['icons'][$id]['true_order']++;
1318
+				}
1192 1319
 
1193 1320
 				// Finally set the current icon's position!
1194 1321
 				$context['icons'][$this->_req->query->icon]['true_order'] = $newOrder;
@@ -1204,15 +1331,20 @@  discard block
 block discarded – undo
1204 1331
 				foreach ($context['icons'] as $id => $icon)
1205 1332
 				{
1206 1333
 					if ($id != 0)
1207
-						$iconInsert[] = array($id, $icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']);
1208
-					else
1209
-						$iconInsert_new[] = array($icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']);
1334
+					{
1335
+											$iconInsert[] = array($id, $icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']);
1336
+					}
1337
+					else {
1338
+											$iconInsert_new[] = array($icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']);
1339
+					}
1210 1340
 				}
1211 1341
 
1212 1342
 				updateMessageIcon($iconInsert);
1213 1343
 
1214 1344
 				if (!empty($iconInsert_new))
1215
-					addMessageIcon($iconInsert_new);
1345
+				{
1346
+									addMessageIcon($iconInsert_new);
1347
+				}
1216 1348
 
1217 1349
 				// Flush the cache so the changes are reflected
1218 1350
 				Cache::instance()->remove('posting_icons-' . (int) $this->_req->post->icon_board);
@@ -1223,7 +1355,9 @@  discard block
 block discarded – undo
1223 1355
 
1224 1356
 			// Unless we're adding a new thing, we'll escape
1225 1357
 			if (!isset($this->_req->post->add))
1226
-				redirectexit('action=admin;area=smileys;sa=editicons');
1358
+			{
1359
+							redirectexit('action=admin;area=smileys;sa=editicons');
1360
+			}
1227 1361
 		}
1228 1362
 
1229 1363
 		$context[$context['admin_menu_name']]['current_subsection'] = 'editicons';
@@ -1350,7 +1484,9 @@  discard block
 block discarded – undo
1350 1484
 
1351 1485
 			// Get the properties of the current icon from the icon list.
1352 1486
 			if (!$context['new_icon'])
1353
-				$context['icon'] = $context['icons'][$this->_req->query->icon];
1487
+			{
1488
+							$context['icon'] = $context['icons'][$this->_req->query->icon];
1489
+			}
1354 1490
 
1355 1491
 			// Get a list of boards needed for assigning this icon to a specific board.
1356 1492
 			$boardListOptions = array(
@@ -1380,7 +1516,9 @@  discard block
 block discarded – undo
1380 1516
 			$this->_req->query->source = empty($this->_req->query->source) ? 0 : (int) $this->_req->query->source;
1381 1517
 
1382 1518
 			if (empty($this->_req->query->source))
1383
-				throw new Elk_Exception('smiley_not_found');
1519
+			{
1520
+							throw new Elk_Exception('smiley_not_found');
1521
+			}
1384 1522
 
1385 1523
 			$smiley = array();
1386 1524
 
@@ -1390,7 +1528,9 @@  discard block
 block discarded – undo
1390 1528
 
1391 1529
 				$smiley = getSmileyPosition($this->_req->query->location, $this->_req->query->after);
1392 1530
 				if (empty($smiley))
1393
-					throw new Elk_Exception('smiley_not_found');
1531
+				{
1532
+									throw new Elk_Exception('smiley_not_found');
1533
+				}
1394 1534
 			}
1395 1535
 			else
1396 1536
 			{
@@ -1407,13 +1547,15 @@  discard block
 block discarded – undo
1407 1547
 
1408 1548
 		// Make sure all rows are sequential.
1409 1549
 		foreach (array_keys($context['smileys']) as $location)
1410
-			$context['smileys'][$location] = array(
1550
+		{
1551
+					$context['smileys'][$location] = array(
1411 1552
 				'id' => $location,
1412 1553
 				'title' => $location === 'postform' ? $txt['smileys_location_form'] : $txt['smileys_location_popup'],
1413 1554
 				'description' => $location === 'postform' ? $txt['smileys_location_form_description'] : $txt['smileys_location_popup_description'],
1414 1555
 				'last_row' => count($context['smileys'][$location]['rows']),
1415 1556
 				'rows' => array_values($context['smileys'][$location]['rows']),
1416 1557
 			);
1558
+		}
1417 1559
 
1418 1560
 		// Check & fix smileys that are not ordered properly in the database.
1419 1561
 		foreach (array_keys($context['smileys']) as $location)
@@ -1430,8 +1572,10 @@  discard block
 block discarded – undo
1430 1572
 
1431 1573
 				// Make sure the smiley order is always sequential.
1432 1574
 				foreach ($smiley_row as $order_id => $smiley)
1433
-					if ($order_id != $smiley['order'])
1575
+				{
1576
+									if ($order_id != $smiley['order'])
1434 1577
 						updateSmileyOrder($smiley['id'], $order_id);
1578
+				}
1435 1579
 			}
1436 1580
 		}
1437 1581
 
@@ -1471,12 +1615,16 @@  discard block
 block discarded – undo
1471 1615
 
1472 1616
 			// Check that the smiley is from simplemachines.org, for now... maybe add mirroring later.
1473 1617
 			if (!isAuthorizedServer($this->_req->query->set_gz) == 0)
1474
-				throw new Elk_Exception('not_valid_server');
1618
+			{
1619
+							throw new Elk_Exception('not_valid_server');
1620
+			}
1475 1621
 
1476 1622
 			$destination = BOARDDIR . '/packages/' . $base_name;
1477 1623
 
1478 1624
 			if (file_exists($destination))
1479
-				throw new Elk_Exception('package_upload_error_exists');
1625
+			{
1626
+							throw new Elk_Exception('package_upload_error_exists');
1627
+			}
1480 1628
 
1481 1629
 			// Let's copy it to the packages directory
1482 1630
 			file_put_contents($destination, fetch_web_data($this->_req->query->set_gz));
@@ -1492,11 +1640,15 @@  discard block
 block discarded – undo
1492 1640
 		}
1493 1641
 
1494 1642
 		if (!file_exists($destination))
1495
-			throw new Elk_Exception('package_no_file', false);
1643
+		{
1644
+					throw new Elk_Exception('package_no_file', false);
1645
+		}
1496 1646
 
1497 1647
 		// Make sure temp directory exists and is empty.
1498 1648
 		if (file_exists(BOARDDIR . '/packages/temp'))
1499
-			deltree(BOARDDIR . '/packages/temp', false);
1649
+		{
1650
+					deltree(BOARDDIR . '/packages/temp', false);
1651
+		}
1500 1652
 
1501 1653
 		if (!mktree(BOARDDIR . '/packages/temp', 0755))
1502 1654
 		{
@@ -1509,7 +1661,9 @@  discard block
 block discarded – undo
1509 1661
 
1510 1662
 				deltree(BOARDDIR . '/packages/temp', false);
1511 1663
 				if (!mktree(BOARDDIR . '/packages/temp', 0777))
1512
-					throw new Elk_Exception('package_cant_download', false);
1664
+				{
1665
+									throw new Elk_Exception('package_cant_download', false);
1666
+				}
1513 1667
 			}
1514 1668
 		}
1515 1669
 
@@ -1517,7 +1671,9 @@  discard block
 block discarded – undo
1517 1671
 
1518 1672
 		// @todo needs to change the URL in the next line ;)
1519 1673
 		if (!$extracted)
1520
-			throw new Elk_Exception('packageget_unable', false, array('http://custom.elkarte.net/index.php?action=search;type=12;basic_search=' . $name));
1674
+		{
1675
+					throw new Elk_Exception('packageget_unable', false, array('http://custom.elkarte.net/index.php?action=search;type=12;basic_search=' . $name));
1676
+		}
1521 1677
 
1522 1678
 		if ($extracted && !file_exists(BOARDDIR . '/packages/temp/package-info.xml'))
1523 1679
 		{
@@ -1532,18 +1688,26 @@  discard block
 block discarded – undo
1532 1688
 		}
1533 1689
 
1534 1690
 		if (!isset($base_path))
1535
-			$base_path = '';
1691
+		{
1692
+					$base_path = '';
1693
+		}
1536 1694
 
1537 1695
 		if (!file_exists(BOARDDIR . '/packages/temp/' . $base_path . 'package-info.xml'))
1538
-			throw new Elk_Exception('package_get_error_missing_xml', false);
1696
+		{
1697
+					throw new Elk_Exception('package_get_error_missing_xml', false);
1698
+		}
1539 1699
 
1540 1700
 		$smileyInfo = getPackageInfo($context['filename']);
1541 1701
 		if (!is_array($smileyInfo))
1542
-			throw new Elk_Exception($smileyInfo);
1702
+		{
1703
+					throw new Elk_Exception($smileyInfo);
1704
+		}
1543 1705
 
1544 1706
 		// See if it is installed?
1545 1707
 		if (isSmileySetInstalled($smileyInfo['id']))
1546
-			\Errors::instance()->fatal_lang_error('package_installed_warning1');
1708
+		{
1709
+					\Errors::instance()->fatal_lang_error('package_installed_warning1');
1710
+		}
1547 1711
 
1548 1712
 		// Everything is fine, now it's time to do something, first we test
1549 1713
 		$actions = parsePackageInfo($smileyInfo['xml'], true, 'install');
@@ -1561,9 +1725,13 @@  discard block
 block discarded – undo
1561 1725
 			{
1562 1726
 				$type = 'package_' . $action['type'];
1563 1727
 				if (file_exists(BOARDDIR . '/packages/temp/' . $base_path . $action['filename']))
1564
-					$context[$type] = htmlspecialchars(trim(file_get_contents(BOARDDIR . '/packages/temp/' . $base_path . $action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8');
1728
+				{
1729
+									$context[$type] = htmlspecialchars(trim(file_get_contents(BOARDDIR . '/packages/temp/' . $base_path . $action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8');
1730
+				}
1565 1731
 				elseif (file_exists($action['filename']))
1566
-					$context[$type] = htmlspecialchars(trim(file_get_contents($action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8');
1732
+				{
1733
+									$context[$type] = htmlspecialchars(trim(file_get_contents($action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8');
1734
+				}
1567 1735
 
1568 1736
 				if (!empty($action['parse_bbc']))
1569 1737
 				{
@@ -1571,8 +1739,9 @@  discard block
 block discarded – undo
1571 1739
 					preparsecode($context[$type]);
1572 1740
 					$context[$type] = $bbc_parser->parsePackage($context[$type]);
1573 1741
 				}
1574
-				else
1575
-					$context[$type] = nl2br($context[$type]);
1742
+				else {
1743
+									$context[$type] = nl2br($context[$type]);
1744
+				}
1576 1745
 
1577 1746
 				continue;
1578 1747
 			}
@@ -1597,7 +1766,9 @@  discard block
 block discarded – undo
1597 1766
 
1598 1767
 				// Show a description for the action if one is provided
1599 1768
 				if (empty($thisAction['description']))
1600
-					$thisAction['description'] = isset($action['description']) ? $action['description'] : '';
1769
+				{
1770
+									$thisAction['description'] = isset($action['description']) ? $action['description'] : '';
1771
+				}
1601 1772
 
1602 1773
 				$context['actions'][] = $thisAction;
1603 1774
 			}
@@ -1656,10 +1827,14 @@  discard block
 block discarded – undo
1656 1827
 		}
1657 1828
 
1658 1829
 		if (file_exists(BOARDDIR . '/packages/temp'))
1659
-			deltree(BOARDDIR . '/packages/temp');
1830
+		{
1831
+					deltree(BOARDDIR . '/packages/temp');
1832
+		}
1660 1833
 
1661 1834
 		if (!$testing)
1662
-			redirectexit('action=admin;area=smileys');
1835
+		{
1836
+					redirectexit('action=admin;area=smileys');
1837
+		}
1663 1838
 	}
1664 1839
 
1665 1840
 	/**
@@ -1675,7 +1850,9 @@  discard block
 block discarded – undo
1675 1850
 		$smiley_context = array();
1676 1851
 
1677 1852
 		foreach ($smiley_sets as $i => $set)
1678
-			$smiley_context[$set] = stripslashes($set_names[$i]);
1853
+		{
1854
+					$smiley_context[$set] = stripslashes($set_names[$i]);
1855
+		}
1679 1856
 
1680 1857
 		$this->_smiley_context = $smiley_context;
1681 1858
 	}
@@ -1694,14 +1871,18 @@  discard block
 block discarded – undo
1694 1871
 		require_once(SUBSDIR . '/Smileys.subs.php');
1695 1872
 
1696 1873
 		if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir'] . '/' . $smileyPath))
1697
-			throw new Elk_Exception('smiley_set_unable_to_import');
1874
+		{
1875
+					throw new Elk_Exception('smiley_set_unable_to_import');
1876
+		}
1698 1877
 
1699 1878
 		$smileys = array();
1700 1879
 		$dir = dir($modSettings['smileys_dir'] . '/' . $smileyPath);
1701 1880
 		while ($entry = $dir->read())
1702 1881
 		{
1703 1882
 			if (in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp')))
1704
-				$smileys[strtolower($entry)] = $entry;
1883
+			{
1884
+							$smileys[strtolower($entry)] = $entry;
1885
+			}
1705 1886
 		}
1706 1887
 		$dir->close();
1707 1888
 
@@ -1711,15 +1892,19 @@  discard block
 block discarded – undo
1711 1892
 		foreach ($duplicates as $duplicate)
1712 1893
 		{
1713 1894
 			if (isset($smileys[strtolower($duplicate)]))
1714
-				unset($smileys[strtolower($duplicate)]);
1895
+			{
1896
+							unset($smileys[strtolower($duplicate)]);
1897
+			}
1715 1898
 		}
1716 1899
 
1717 1900
 		$smiley_order = getMaxSmileyOrder();
1718 1901
 
1719 1902
 		$new_smileys = array();
1720 1903
 		foreach ($smileys as $smiley)
1721
-			if (strlen($smiley) <= 48)
1904
+		{
1905
+					if (strlen($smiley) <= 48)
1722 1906
 				$new_smileys[] = array(':' . strtok($smiley, '.') . ':', $smiley, strtok($smiley, '.'), 0, ++$smiley_order);
1907
+		}
1723 1908
 
1724 1909
 		if (!empty($new_smileys))
1725 1910
 		{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 						'class' => 'centertext',
256 256
 					),
257 257
 					'data' => array(
258
-						'function' => function ($rowData) {
258
+						'function' => function($rowData) {
259 259
 							return $rowData['selected'] ? '<i class="icon i-check"></i>' : '';
260 260
 						},
261 261
 						'class' => 'centertext',
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 						'class' => 'centertext',
313 313
 					),
314 314
 					'data' => array(
315
-						'function' => function ($rowData) {
315
+						'function' => function($rowData) {
316 316
 							return $rowData['id'] == 0 ? '' : sprintf('<input type="checkbox" name="smiley_set[%1$d]" class="input_check" />', $rowData['id']);
317 317
 						},
318 318
 						'class' => 'centertext',
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 							'value' => $txt['smileys_location'],
929 929
 						),
930 930
 						'data' => array(
931
-							'function' => function ($rowData) {
931
+							'function' => function($rowData) {
932 932
 								global $txt;
933 933
 
934 934
 								if (empty($rowData['hidden']))
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 							'value' => $txt['smileys_description'],
950 950
 						),
951 951
 						'data' => array(
952
-							'function' => function ($rowData) {
952
+							'function' => function($rowData) {
953 953
 								global $context, $txt, $modSettings;
954 954
 
955 955
 								if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir']))
Please login to merge, or discard this patch.
sources/admin/ManageErrors.controller.php 1 patch
Braces   +33 added lines, -13 removed lines patch added patch discarded remove patch
@@ -42,11 +42,14 @@  discard block
 block discarded – undo
42 42
 
43 43
 		// Some code redundancy... and we only take this!
44 44
 		if (isset($activity) && $activity == 'file')
45
-			// View the file with the error
45
+		{
46
+					// View the file with the error
46 47
 			$this->action_viewfile();
47
-		else
48
-			// View error log
48
+		}
49
+		else {
50
+					// View error log
49 51
 			$this->action_log();
52
+		}
50 53
 	}
51 54
 
52 55
 	/**
@@ -84,7 +87,9 @@  discard block
 block discarded – undo
84 87
 
85 88
 			// Go back to where we were.
86 89
 			if ($type == 'delete')
87
-				redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : '') . ';start=' . $this->_req->query->start . (!empty($filter) ? ';filter=' . $this->_req->query->filter . ';value=' . $this->_req->query->value : ''));
90
+			{
91
+							redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : '') . ';start=' . $this->_req->query->start . (!empty($filter) ? ';filter=' . $this->_req->query->filter . ';value=' . $this->_req->query->value : ''));
92
+			}
88 93
 
89 94
 			redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : ''));
90 95
 		}
@@ -94,11 +99,15 @@  discard block
 block discarded – undo
94 99
 
95 100
 		// If this filter is empty...
96 101
 		if ($num_errors == 0 && !empty($filter))
97
-			redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : ''));
102
+		{
103
+					redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : ''));
104
+		}
98 105
 
99 106
 		// Clean up start.
100 107
 		if (!isset($this->_req->query->start) || $this->_req->query->start < 0)
101
-			$this->_req->query->start = 0;
108
+		{
109
+					$this->_req->query->start = 0;
110
+		}
102 111
 
103 112
 		// Do we want to reverse error listing?
104 113
 		$context['sort_direction'] = isset($this->_req->query->desc) ? 'down' : 'up';
@@ -139,9 +148,12 @@  discard block
 block discarded – undo
139 148
 
140 149
 		// Finally, work out what is the last tab!
141 150
 		if (isset($context['error_types'][$sum]))
142
-			$context['error_types'][$sum]['is_last'] = true;
143
-		else
144
-			$context['error_types']['all']['is_last'] = true;
151
+		{
152
+					$context['error_types'][$sum]['is_last'] = true;
153
+		}
154
+		else {
155
+					$context['error_types']['all']['is_last'] = true;
156
+		}
145 157
 
146 158
 		// And this is pretty basic ;).
147 159
 		$context['page_title'] = $txt['errlog'];
@@ -255,7 +267,9 @@  discard block
 block discarded – undo
255 267
 			);
256 268
 		}
257 269
 		elseif (isset($this->_req->query->filter) || isset($this->_req->query->value))
258
-			unset($this->_req->query->filter, $this->_req->query->value);
270
+		{
271
+					unset($this->_req->query->filter, $this->_req->query->value);
272
+		}
259 273
 
260 274
 		return $filter;
261 275
 	}
@@ -276,7 +290,9 @@  discard block
 block discarded – undo
276 290
 
277 291
 		// We can't help you if you don't spell it out loud :P
278 292
 		if (!isset($this->_req->query->file))
279
-			redirectexit();
293
+		{
294
+					redirectexit();
295
+		}
280 296
 
281 297
 		// Decode the file and get the line
282 298
 		$filename = base64_decode($this->_req->query->file);
@@ -295,14 +311,18 @@  discard block
 block discarded – undo
295 311
 
296 312
 		// Not like we can look at just any old file
297 313
 		if ($ext !== '.php' || (strpos($file, $real_board) === false && strpos($file, $real_source) === false) || strpos($file, $real_cache) !== false || in_array($basename, $excluded) || !is_readable($file))
298
-			throw new Elk_Exception('error_bad_file', true, array(htmlspecialchars($filename, ENT_COMPAT, 'UTF-8')));
314
+		{
315
+					throw new Elk_Exception('error_bad_file', true, array(htmlspecialchars($filename, ENT_COMPAT, 'UTF-8')));
316
+		}
299 317
 
300 318
 		// Get the min and max lines
301 319
 		$min = $line - 16 <= 0 ? 1 : $line - 16;
302 320
 		$max = $line + 21; // One additional line to make everything work out correctly
303 321
 
304 322
 		if ($max <= 0 || $min >= $max)
305
-			throw new Elk_Exception('error_bad_line');
323
+		{
324
+					throw new Elk_Exception('error_bad_line');
325
+		}
306 326
 
307 327
 		$file_data = explode('<br />', highlight_php_code(htmlspecialchars(implode('', file($file)), ENT_COMPAT, 'UTF-8')));
308 328
 
Please login to merge, or discard this patch.
sources/subs/Emailpost.subs.php 1 patch
Braces   +157 added lines, -66 removed lines patch added patch discarded remove patch
@@ -105,7 +105,9 @@  discard block
 block discarded – undo
105 105
 	// below and/or inside the original message. People like this should not be allowed
106 106
 	// to use the net, or be forced to read their own messed up emails
107 107
 	if (empty($result) || (trim(strip_tags(pbe_filter_email_message($text))) === ''))
108
-		$text = $text_save;
108
+	{
109
+			$text = $text_save;
110
+	}
109 111
 
110 112
 	return $text;
111 113
 }
@@ -224,7 +226,9 @@  discard block
 block discarded – undo
224 226
 
225 227
 		// No quote or in the same quote just continue
226 228
 		if ($level == $current_quote)
227
-			continue;
229
+		{
230
+					continue;
231
+		}
228 232
 
229 233
 		// Deeper than we were so add a quote
230 234
 		if ($level > $current_quote)
@@ -309,12 +313,15 @@  discard block
 block discarded – undo
309 313
 			$string = substr($string, 1);
310 314
 		}
311 315
 		// All done getting the depth
312
-		else
313
-			$check = false;
316
+		else {
317
+					$check = false;
318
+		}
314 319
 	}
315 320
 
316 321
 	if (!$update)
317
-		$string = $string_save;
322
+	{
323
+			$string = $string_save;
324
+	}
318 325
 
319 326
 	return $level;
320 327
 }
@@ -356,10 +363,13 @@  discard block
 block discarded – undo
356 363
 			// @todo these are tested at insertion now, so this test is really not necessary
357 364
 			$temp = preg_replace($row['filter_from'], '', '$5#6#8%9456@^)098');
358 365
 			if ($temp !== null)
359
-				$expressions[] = array('type' => 'regex', 'parser' => $row['filter_from']);
366
+			{
367
+							$expressions[] = array('type' => 'regex', 'parser' => $row['filter_from']);
368
+			}
369
+		}
370
+		else {
371
+					$expressions[] = array('type' => 'string', 'parser' => $row['filter_from']);
360 372
 		}
361
-		else
362
-			$expressions[] = array('type' => 'string', 'parser' => $row['filter_from']);
363 373
 	}
364 374
 	$db->free_result($request);
365 375
 
@@ -368,9 +378,12 @@  discard block
 block discarded – undo
368 378
 	foreach ($expressions as $expression)
369 379
 	{
370 380
 		if ($expression['type'] === 'regex')
371
-			$split = preg_split($expression['parser'], $body);
372
-		else
373
-			$split = explode($expression['parser'], $body, 2);
381
+		{
382
+					$split = preg_split($expression['parser'], $body);
383
+		}
384
+		else {
385
+					$split = explode($expression['parser'], $body, 2);
386
+		}
374 387
 
375 388
 		// If an expression was matched our fine work is done
376 389
 		if (!empty($split[1]))
@@ -418,15 +431,20 @@  discard block
 block discarded – undo
418 431
 		{
419 432
 			// Newline madness
420 433
 			if (!empty($row['filter_to']))
421
-				$row['filter_to'] = str_replace('\n', "\n", $row['filter_to']);
434
+			{
435
+							$row['filter_to'] = str_replace('\n', "\n", $row['filter_to']);
436
+			}
422 437
 
423 438
 			// Test the regex and if good use, else skip, don't want a bad regex to empty the message!
424 439
 			$temp = preg_replace($row['filter_from'], $row['filter_to'], $text);
425 440
 			if ($temp !== null)
426
-				$text = $temp;
441
+			{
442
+							$text = $temp;
443
+			}
444
+		}
445
+		else {
446
+					$text = str_replace($row['filter_from'], $row['filter_to'], $text);
427 447
 		}
428
-		else
429
-			$text = str_replace($row['filter_from'], $row['filter_to'], $text);
430 448
 	}
431 449
 	$db->free_result($request);
432 450
 
@@ -451,34 +469,49 @@  discard block
 block discarded – undo
451 469
 	// Find Re: Subject: FW: FWD or [$sitename] in the subject and strip it
452 470
 	$re = strpos(strtoupper($text), $txt['RE:']);
453 471
 	if ($re !== false)
454
-		$text = substr($text, 0, $re) . substr($text, $re + strlen($txt['RE:']), strlen($text));
472
+	{
473
+			$text = substr($text, 0, $re) . substr($text, $re + strlen($txt['RE:']), strlen($text));
474
+	}
455 475
 
456 476
 	$su = strpos(strtoupper($text), $txt['SUBJECT:']);
457 477
 	if ($su !== false)
458
-		$text = substr($text, 0, $su) . substr($text, $su + strlen($txt['SUBJECT:']), strlen($text));
478
+	{
479
+			$text = substr($text, 0, $su) . substr($text, $su + strlen($txt['SUBJECT:']), strlen($text));
480
+	}
459 481
 
460 482
 	$fw = strpos(strtoupper($text), $txt['FW:']);
461 483
 	if ($fw !== false)
462
-		$text = substr($text, 0, $fw) . substr($text, $fw + strlen($txt['FW:']), strlen($text));
484
+	{
485
+			$text = substr($text, 0, $fw) . substr($text, $fw + strlen($txt['FW:']), strlen($text));
486
+	}
463 487
 
464 488
 	$gr = strpos($text, '[' . $sitename . ']');
465 489
 	if ($gr !== false)
466
-		$text = substr($text, 0, $gr) . substr($text, $gr + strlen($sitename) + 2, strlen($text));
490
+	{
491
+			$text = substr($text, 0, $gr) . substr($text, $gr + strlen($sitename) + 2, strlen($text));
492
+	}
467 493
 
468 494
 	$fwd = strpos(strtoupper($text), $txt['FWD:']);
469 495
 	if ($fwd !== false)
470
-		$text = substr($text, 0, $fwd) . substr($text, $fwd + strlen($txt['FWD:']), strlen($text));
496
+	{
497
+			$text = substr($text, 0, $fwd) . substr($text, $fwd + strlen($txt['FWD:']), strlen($text));
498
+	}
471 499
 
472 500
 	// if not done then call ourselves again, we like the sound of our name
473 501
 	if (strpos(strtoupper($text), $txt['RE:']) || strpos(strtoupper($text), $txt['FW:']) || strpos(strtoupper($text), $txt['FWD:']) || strpos($text, '[' . $sitename . ']'))
474
-		$text = pbe_clean_email_subject($text);
502
+	{
503
+			$text = pbe_clean_email_subject($text);
504
+	}
475 505
 
476 506
 	// clean or not?
477 507
 	if ($check)
478
-		return ($re === false && $su === false && $gr === false && $fw === false && $fwd === false);
479
-	else
480
-		return trim($text);
481
-}
508
+	{
509
+			return ($re === false && $su === false && $gr === false && $fw === false && $fwd === false);
510
+	}
511
+	else {
512
+			return trim($text);
513
+	}
514
+	}
482 515
 
483 516
 /**
484 517
  * Used if the original email could not be removed from the message (top of post)
@@ -556,7 +589,9 @@  discard block
 block discarded – undo
556 589
 	// Looks for the first occurrence of $needle in $haystack and replaces it with $replace
557 590
 	$pos = strpos($haystack, $needle);
558 591
 	if ($pos === false)
559
-		return $haystack;
592
+	{
593
+			return $haystack;
594
+	}
560 595
 
561 596
 	return substr_replace($haystack, $replace, $pos, strlen($needle));
562 597
 }
@@ -574,7 +609,9 @@  discard block
 block discarded – undo
574 609
 	global $modSettings;
575 610
 
576 611
 	if (empty($modSettings['postmod_active']))
577
-		return;
612
+	{
613
+			return;
614
+	}
578 615
 
579 616
 	// Have they been muted for being naughty?
580 617
 	if (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $pbe['user_info']['warning'])
@@ -602,9 +639,12 @@  discard block
 block discarded – undo
602 639
 		foreach ($permission_change as $old => $new)
603 640
 		{
604 641
 			if (!in_array($old, $pbe['user_info']['permissions']))
605
-				unset($permission_change[$old]);
606
-			else
607
-				$pbe['user_info']['permissions'][] = $new;
642
+			{
643
+							unset($permission_change[$old]);
644
+			}
645
+			else {
646
+							$pbe['user_info']['permissions'][] = $new;
647
+			}
608 648
 		}
609 649
 
610 650
 		$pbe['user_info']['permissions'] = array_diff($pbe['user_info']['permissions'], array_keys($permission_change));
@@ -684,7 +724,9 @@  discard block
 block discarded – undo
684 724
 		// We don't have the message type (since we don't have a key)
685 725
 		// Attempt to see if it might be a PM so we handle it correctly
686 726
 		if (empty($message_type) && (strpos($email_message->subject, $pm_subject_leader) !== false))
687
-			$message_type = 'p';
727
+		{
728
+					$message_type = 'p';
729
+		}
688 730
 
689 731
 		// Find all keys sent to this user, sorted by date
690 732
 		$user_keys = query_user_keys($email_message->email['from']);
@@ -714,7 +756,9 @@  discard block
 block discarded – undo
714 756
 
715 757
 	// Maybe we have enough to find the board id where this was going
716 758
 	if (!empty($message_id) && $message_type !== 'p')
717
-		$board_id = query_load_board($message_id);
759
+	{
760
+			$board_id = query_load_board($message_id);
761
+	}
718 762
 
719 763
 	// Log the error so the moderators can take a look, helps keep them sharp
720 764
 	$id = isset($_REQUEST['item']) ? (int) $_REQUEST['item'] : 0;
@@ -774,13 +818,16 @@  discard block
 block discarded – undo
774 818
 	if (!empty($modSettings['currentAttachmentUploadDir']))
775 819
 	{
776 820
 		if (!is_array($modSettings['attachmentUploadDir']))
777
-			$modSettings['attachmentUploadDir'] = Util::unserialize($modSettings['attachmentUploadDir']);
821
+		{
822
+					$modSettings['attachmentUploadDir'] = Util::unserialize($modSettings['attachmentUploadDir']);
823
+		}
778 824
 
779 825
 		// The current directory, of course!
780 826
 		$current_attach_dir = $modSettings['attachmentUploadDir'][$modSettings['currentAttachmentUploadDir']];
781 827
 	}
782
-	else
783
-		$current_attach_dir = $modSettings['attachmentUploadDir'];
828
+	else {
829
+			$current_attach_dir = $modSettings['attachmentUploadDir'];
830
+	}
784 831
 
785 832
 	// For attachmentChecks function
786 833
 	require_once(SUBSDIR . '/Attachments.subs.php');
@@ -844,11 +891,15 @@  discard block
 block discarded – undo
844 891
 		{
845 892
 			$attachIDs[] = $attachmentOptions['id'];
846 893
 			if (!empty($attachmentOptions['thumb']))
847
-				$attachIDs[] = $attachmentOptions['thumb'];
894
+			{
895
+							$attachIDs[] = $attachmentOptions['thumb'];
896
+			}
848 897
 		}
849 898
 		// We had a problem so simply remove it
850 899
 		elseif (file_exists($attachment['tmp_name']))
851
-			@unlink($attachment['tmp_name']);
900
+		{
901
+					@unlink($attachment['tmp_name']);
902
+		}
852 903
 	}
853 904
 
854 905
 	return $attachIDs;
@@ -873,7 +924,9 @@  discard block
 block discarded – undo
873 924
 	// Load our valid email ids and the corresponding board ids
874 925
 	$data = (!empty($modSettings['maillist_receiving_address'])) ? Util::unserialize($modSettings['maillist_receiving_address']) : array();
875 926
 	foreach ($data as $key => $addr)
876
-		$valid_address[$addr[0]] = $addr[1];
927
+	{
928
+			$valid_address[$addr[0]] = $addr[1];
929
+	}
877 930
 
878 931
 	// Who was this message sent to, may have been sent to multiple addresses
879 932
 	// so we must check each one to see if we have a valid entry
@@ -911,7 +964,9 @@  discard block
 block discarded – undo
911 964
 
912 965
 	// Check on some things needed by parse_bbc as an autotask does not load them
913 966
 	if (!isset($context['browser']))
914
-		detectBrowser();
967
+	{
968
+			detectBrowser();
969
+	}
915 970
 
916 971
 	// Server?
917 972
 	detectServer();
@@ -955,7 +1010,9 @@  discard block
 block discarded – undo
955 1010
 
956 1011
 			// Build the th line for this table
957 1012
 			for ($i = 1; $i <= $cols; $i++)
958
-				$table_header .= '<th>- ' . $i . ' -</th>';
1013
+			{
1014
+							$table_header .= '<th>- ' . $i . ' -</th>';
1015
+			}
959 1016
 
960 1017
 			// Insert it in to the table tag
961 1018
 			$table_header = '<tr>' . $table_header . '</tr>';
@@ -1122,7 +1179,9 @@  discard block
 block discarded – undo
1122 1179
 	$db = database();
1123 1180
 
1124 1181
 	if (empty($email))
1125
-		return false;
1182
+	{
1183
+			return false;
1184
+	}
1126 1185
 
1127 1186
 	// Find the user who owns this email address
1128 1187
 	$request = $db->query('', '
@@ -1142,7 +1201,9 @@  discard block
 block discarded – undo
1142 1201
 
1143 1202
 	// No user found ... back we go
1144 1203
 	if (empty($id_member))
1145
-		return false;
1204
+	{
1205
+			return false;
1206
+	}
1146 1207
 
1147 1208
 	// Load the users profile information
1148 1209
 	$pbe = array();
@@ -1152,17 +1213,22 @@  discard block
 block discarded – undo
1152 1213
 
1153 1214
 		// Load in *some* user_info data just like loadUserSettings would do
1154 1215
 		if (empty($pbe['profile']['additional_groups']))
1155
-			$pbe['user_info']['groups'] = array(
1216
+		{
1217
+					$pbe['user_info']['groups'] = array(
1156 1218
 				$pbe['profile']['id_group'], $pbe['profile']['id_post_group']);
1157
-		else
1158
-			$pbe['user_info']['groups'] = array_merge(
1219
+		}
1220
+		else {
1221
+					$pbe['user_info']['groups'] = array_merge(
1159 1222
 				array($pbe['profile']['id_group'], $pbe['profile']['id_post_group']),
1160 1223
 				explode(',', $pbe['profile']['additional_groups'])
1161 1224
 			);
1225
+		}
1162 1226
 
1163 1227
 		// Clean up the groups
1164 1228
 		foreach ($pbe['user_info']['groups'] as $k => $v)
1165
-			$pbe['user_info']['groups'][$k] = (int) $v;
1229
+		{
1230
+					$pbe['user_info']['groups'][$k] = (int) $v;
1231
+		}
1166 1232
 		$pbe['user_info']['groups'] = array_unique($pbe['user_info']['groups']);
1167 1233
 
1168 1234
 		// Load the user's general permissions....
@@ -1173,9 +1239,12 @@  discard block
 block discarded – undo
1173 1239
 
1174 1240
 		// Work out our query_see_board string for security
1175 1241
 		if (in_array(1, $pbe['user_info']['groups']))
1176
-			$pbe['user_info']['query_see_board'] = '1=1';
1177
-		else
1178
-			$pbe['user_info']['query_see_board'] = '((FIND_IN_SET(' . implode(', b.member_groups) != 0 OR FIND_IN_SET(', $pbe['user_info']['groups']) . ', b.member_groups) != 0)' . (!empty($modSettings['deny_boards_access']) ? ' AND (FIND_IN_SET(' . implode(', b.deny_member_groups) = 0 AND FIND_IN_SET(', $pbe['user_info']['groups']) . ', b.deny_member_groups) = 0)' : '') . ')';
1242
+		{
1243
+					$pbe['user_info']['query_see_board'] = '1=1';
1244
+		}
1245
+		else {
1246
+					$pbe['user_info']['query_see_board'] = '((FIND_IN_SET(' . implode(', b.member_groups) != 0 OR FIND_IN_SET(', $pbe['user_info']['groups']) . ', b.member_groups) != 0)' . (!empty($modSettings['deny_boards_access']) ? ' AND (FIND_IN_SET(' . implode(', b.deny_member_groups) = 0 AND FIND_IN_SET(', $pbe['user_info']['groups']) . ', b.deny_member_groups) = 0)' : '') . ')';
1247
+		}
1179 1248
 
1180 1249
 		// Set some convenience items
1181 1250
 		$pbe['user_info']['is_admin'] = in_array(1, $pbe['user_info']['groups']) ? 1 : 0;
@@ -1224,16 +1293,21 @@  discard block
 block discarded – undo
1224 1293
 	while ($row = $db->fetch_assoc($request))
1225 1294
 	{
1226 1295
 		if (empty($row['add_deny']))
1227
-			$removals[] = $row['permission'];
1228
-		else
1229
-			$pbe['user_info']['permissions'][] = $row['permission'];
1296
+		{
1297
+					$removals[] = $row['permission'];
1298
+		}
1299
+		else {
1300
+					$pbe['user_info']['permissions'][] = $row['permission'];
1301
+		}
1230 1302
 	}
1231 1303
 	$db->free_result($request);
1232 1304
 
1233 1305
 	// Remove all the permissions they shouldn't have ;)
1234 1306
 	if (!empty($modSettings['permission_enable_deny']))
1235
-		$pbe['user_info']['permissions'] = array_diff($pbe['user_info']['permissions'], $removals);
1236
-}
1307
+	{
1308
+			$pbe['user_info']['permissions'] = array_diff($pbe['user_info']['permissions'], $removals);
1309
+	}
1310
+	}
1237 1311
 
1238 1312
 /**
1239 1313
  * Fetches the senders email wrapper details
@@ -1589,18 +1663,24 @@  discard block
 block discarded – undo
1589 1663
 	// Verify the id_theme...
1590 1664
 	// Allow the board specific theme, if they are overriding.
1591 1665
 	if (!empty($board_info['id_theme']) && $board_info['override_theme'])
1592
-		$id_theme = (int) $board_info['id_theme'];
1666
+	{
1667
+			$id_theme = (int) $board_info['id_theme'];
1668
+	}
1593 1669
 	elseif (!empty($modSettings['knownThemes']))
1594 1670
 	{
1595 1671
 		$themes = explode(',', $modSettings['knownThemes']);
1596 1672
 
1597 1673
 		if (!in_array($id_theme, $themes))
1598
-			$id_theme = $modSettings['theme_guests'];
1599
-		else
1674
+		{
1675
+					$id_theme = $modSettings['theme_guests'];
1676
+		}
1677
+		else {
1678
+					$id_theme = (int) $id_theme;
1679
+		}
1680
+	}
1681
+	else {
1600 1682
 			$id_theme = (int) $id_theme;
1601 1683
 	}
1602
-	else
1603
-		$id_theme = (int) $id_theme;
1604 1684
 
1605 1685
 	// With the theme and member, load the auto_notify variables
1606 1686
 	$result = $db->query('', '
@@ -1618,7 +1698,9 @@  discard block
 block discarded – undo
1618 1698
 	// Put everything about this member/theme into a theme setting array
1619 1699
 	$theme_settings = array();
1620 1700
 	while ($row = $db->fetch_assoc($result))
1621
-		$theme_settings[$row['variable']] = $row['value'];
1701
+	{
1702
+			$theme_settings[$row['variable']] = $row['value'];
1703
+	}
1622 1704
 
1623 1705
 	$db->free_result($result);
1624 1706
 
@@ -1654,7 +1736,9 @@  discard block
 block discarded – undo
1654 1736
 		)
1655 1737
 	);
1656 1738
 	if ($db->fetch_row($request))
1657
-		$board_notify = true;
1739
+	{
1740
+			$board_notify = true;
1741
+	}
1658 1742
 	$db->free_result($request);
1659 1743
 
1660 1744
 	// If they have topic notification on and not board notification then
@@ -1728,7 +1812,9 @@  discard block
 block discarded – undo
1728 1812
 		);
1729 1813
 		$total_unread = 0;
1730 1814
 		while ($row = $db->fetch_assoc($result))
1731
-			$total_unread += $row['num'];
1815
+		{
1816
+					$total_unread += $row['num'];
1817
+		}
1732 1818
 		$db->free_result($result);
1733 1819
 
1734 1820
 		// Update things for when they do come to the site
@@ -1830,23 +1916,28 @@  discard block
 block discarded – undo
1830 1916
 
1831 1917
 	// Show they are active in the who's online list and what they have done
1832 1918
 	if ($email_message->message_type === 'm' || $email_message->message_type === 't')
1833
-		$get_temp = array(
1919
+	{
1920
+			$get_temp = array(
1834 1921
 			'action' => 'postbyemail',
1835 1922
 			'topic' => $topic_info['id_topic'],
1836 1923
 			'last_msg' => $topic_info['id_last_msg'],
1837 1924
 			'board' => $topic_info['id_board']
1838 1925
 		);
1926
+	}
1839 1927
 	elseif ($email_message->message_type === 'x')
1840
-		$get_temp = array(
1928
+	{
1929
+			$get_temp = array(
1841 1930
 			'action' => 'topicbyemail',
1842 1931
 			'topic' => $topic_info['id'],
1843 1932
 			'board' => $topic_info['board'],
1844 1933
 		);
1845
-	else
1846
-		$get_temp = array(
1934
+	}
1935
+	else {
1936
+			$get_temp = array(
1847 1937
 			'action' => 'pm',
1848 1938
 			'sa' => 'byemail'
1849 1939
 		);
1940
+	}
1850 1941
 
1851 1942
 	// Place the entry in to the online log so the who's online can use it
1852 1943
 	$serialized = serialize($get_temp);
Please login to merge, or discard this patch.
sources/subs/Html2Md.class.php 2 patches
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -444,9 +444,12 @@  discard block
 block discarded – undo
444 444
 			case 'ol':
445 445
 			case 'ul':
446 446
 				if ($this->_has_parent_list($node, $this->_parser))
447
-					$markdown = trim($this->_get_value($node));
448
-				else
449
-					$markdown = $this->line_end . $this->_get_value($node) . $this->line_end;
447
+				{
448
+									$markdown = trim($this->_get_value($node));
449
+				}
450
+				else {
451
+									$markdown = $this->line_end . $this->_get_value($node) . $this->line_end;
452
+				}
450 453
 				break;
451 454
 			case 'li':
452 455
 				$markdown = $this->_convert_list($node);
@@ -541,7 +544,9 @@  discard block
 block discarded – undo
541 544
 		global $txt;
542 545
 
543 546
 		if ($node->getAttribute('data-lightboximage') || $node->getAttribute('data-lightboxmessage'))
544
-			return '~`skip`~';
547
+		{
548
+					return '~`skip`~';
549
+		}
545 550
 
546 551
 		$href = str_replace('\_', '_', htmlspecialchars_decode($node->getAttribute('href')));
547 552
 		$title = $node->getAttribute('title');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
 		// Strip the chaff and any excess blank lines we may have produced
273 273
 		$this->markdown = trim($this->markdown);
274
-		$this->markdown = preg_replace("~(?:\s?\n\s?){3,6}~", "\n\n", $this->markdown);	}
274
+		$this->markdown = preg_replace("~(?:\s?\n\s?){3,6}~", "\n\n", $this->markdown); }
275 275
 
276 276
 	/**
277 277
 	 * Looks for the text inside <body> and then <html>, returning just the inner
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 		}
578 578
 		else
579 579
 		{
580
-			$markdown = '[' . ($value === $txt['link'] ? 'X' : $value) . ']('  . $href . ' "' . $txt['link'] . '")';
580
+			$markdown = '[' . ($value === $txt['link'] ? 'X' : $value) . '](' . $href . ' "' . $txt['link'] . '")';
581 581
 		}
582 582
 
583 583
 		$this->_check_line_length($markdown, $this->get_buffer($node));
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		$re = '/((?<!\\\\\( |]\()https?:\/\/|(?<!\\\\\( |]\(|:\/\/)www)[-\p{L}0-9+&@#\/%?=~_|!:,.;]*[\p{L}0-9+&@#\/%=~_|]/ui';
1232 1232
 		$count = 0;
1233 1233
 		$text = preg_replace_callback($re,
1234
-			function ($matches) {
1234
+			function($matches) {
1235 1235
 				return $this->_plaintxt_callback($matches);
1236 1236
 			}, $text, -1, $count);
1237 1237
 
Please login to merge, or discard this patch.
sources/subs/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/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/Mentions.subs.php 2 patches
Braces   +33 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 	$id_member = $id_member === null ? $user_info['id'] : (int) $id_member;
30 30
 
31 31
 	if (isset($counts[$id_member]))
32
-		return $counts[$id_member];
32
+	{
33
+			return $counts[$id_member];
34
+	}
33 35
 
34 36
 	$request = $db->query('', '
35 37
 		SELECT COUNT(*)
@@ -172,7 +174,9 @@  discard block
 block discarded – undo
172 174
 	}
173 175
 
174 176
 	if (empty($inserts))
175
-		return;
177
+	{
178
+			return;
179
+	}
176 180
 
177 181
 	// Insert the new mentions
178 182
 	$db->insert('',
@@ -192,8 +196,10 @@  discard block
 block discarded – undo
192 196
 
193 197
 	// Update the member mention count
194 198
 	foreach ($inserts as $insert)
195
-		updateMentionMenuCount($insert[2], $insert[0]);
196
-}
199
+	{
200
+			updateMentionMenuCount($insert[2], $insert[0]);
201
+	}
202
+	}
197 203
 
198 204
 /**
199 205
  * Softly and gently removes a 'likemsg' mention when the post is unliked
@@ -231,8 +237,10 @@  discard block
 block discarded – undo
231 237
 
232 238
 	// Update the member mention count
233 239
 	foreach ($members_to as $member)
234
-		updateMentionMenuCount($newstatus, $member);
235
-}
240
+	{
241
+			updateMentionMenuCount($newstatus, $member);
242
+	}
243
+	}
236 244
 
237 245
 /**
238 246
  * Changes a specific mention status for a member
@@ -266,7 +274,9 @@  discard block
 block discarded – undo
266 274
 
267 275
 	// Update the top level mentions count
268 276
 	if ($success)
269
-		updateMentionMenuCount($status, $user_info['id']);
277
+	{
278
+			updateMentionMenuCount($status, $user_info['id']);
279
+	}
270 280
 
271 281
 	return $success;
272 282
 }
@@ -296,7 +306,9 @@  discard block
 block discarded – undo
296 306
 
297 307
 	// Update the top level mentions count
298 308
 	if ($success)
299
-		updateMentionMenuCount(null, $user_info['id']);
309
+	{
310
+			updateMentionMenuCount(null, $user_info['id']);
311
+	}
300 312
 
301 313
 	return $success;
302 314
 }
@@ -419,7 +431,9 @@  discard block
 block discarded – undo
419 431
 	global $user_info;
420 432
 
421 433
 	if (!isset($input[$field]))
422
-		return;
434
+	{
435
+			return;
436
+	}
423 437
 
424 438
 	if (!findMemberMention($input[$field], $user_info['id']))
425 439
 	{
@@ -474,14 +488,19 @@  discard block
 block discarded – undo
474 488
 
475 489
 	// If its new add to our menu count
476 490
 	if ($status === 0)
477
-		updateMemberData($member_id, array('mentions' => '+'));
491
+	{
492
+			updateMemberData($member_id, array('mentions' => '+'));
493
+	}
478 494
 	// Mark as read we decrease the count
479 495
 	elseif ($status === 1)
480
-		updateMemberData($member_id, array('mentions' => '-'));
496
+	{
497
+			updateMemberData($member_id, array('mentions' => '-'));
498
+	}
481 499
 	// Deleting or un-approving may have been read or not, so a count is required
482
-	else
483
-		countUserMentions(false, '', $member_id);
484
-}
500
+	else {
501
+			countUserMentions(false, '', $member_id);
502
+	}
503
+	}
485 504
 
486 505
 /**
487 506
  * Retrieves the time the last notification of a certain member was added.
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			'limit' => $limit,
104 104
 			'sort' => $sort,
105 105
 		),
106
-		function ($row)
106
+		function($row)
107 107
 		{
108 108
 			$row['avatar'] = determineAvatar($row);
109 109
 			return $row;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			'target' => $target,
149 149
 			'log_time' => $time === null ? time() : $time,
150 150
 		),
151
-		function ($row)
151
+		function($row)
152 152
 		{
153 153
 			return $row['id_member'];
154 154
 		}
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		array(
334 334
 			'messages' => $msgs,
335 335
 		),
336
-		function ($row) use ($status)
336
+		function($row) use ($status)
337 337
 		{
338 338
 			updateMentionMenuCount($status, $row['id_member']);
339 339
 		}
Please login to merge, or discard this patch.
sources/subs/MembersOnline.subs.php 1 patch
Braces   +28 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,13 +51,17 @@  discard block
 block discarded – undo
51 51
 
52 52
 	// Not allowed sort method? Bang! Error!
53 53
 	elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options))
54
-		trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE);
54
+	{
55
+			trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE);
56
+	}
55 57
 
56 58
 	// Get it from the cache and send it back.
57 59
 	$temp = array();
58 60
 	$cache = Cache::instance();
59 61
 	if ($cache->levelHigherThan(1) && $cache->getVar($temp, 'membersOnlineStats-' . $membersOnlineOptions['sort'], 240))
60
-		return filter_members_online($temp, empty($membersOnlineOptions['reverse_sort']) ? 'ksort' : 'krsort');
62
+	{
63
+			return filter_members_online($temp, empty($membersOnlineOptions['reverse_sort']) ? 'ksort' : 'krsort');
64
+	}
61 65
 
62 66
 	// Initialize the array that'll be returned later on.
63 67
 	$membersOnlineStats = array(
@@ -75,7 +79,9 @@  discard block
 block discarded – undo
75 79
 	$spiders = array();
76 80
 	$spider_finds = array();
77 81
 	if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
78
-		$spiders = Util::unserialize($modSettings['spider_name_cache']);
82
+	{
83
+			$spiders = Util::unserialize($modSettings['spider_name_cache']);
84
+	}
79 85
 
80 86
 	// Load the users online right now.
81 87
 	$request = $db->query('', '
@@ -113,9 +119,12 @@  discard block
 block discarded – undo
113 119
 
114 120
 		// Some basic color coding...
115 121
 		if (!empty($row['online_color']))
116
-			$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
117
-		else
118
-			$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
122
+		{
123
+					$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
124
+		}
125
+		else {
126
+					$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
127
+		}
119 128
 
120 129
 		// Buddies get counted and highlighted.
121 130
 		$is_buddy = in_array($row['id_member'], $user_info['buddies']);
@@ -140,11 +149,13 @@  discard block
 block discarded – undo
140 149
 
141 150
 		// Store all distinct (primary) membergroups that are shown.
142 151
 		if (!isset($membersOnlineStats['online_groups'][$row['id_group']]))
143
-			$membersOnlineStats['online_groups'][$row['id_group']] = array(
152
+		{
153
+					$membersOnlineStats['online_groups'][$row['id_group']] = array(
144 154
 				'id' => $row['id_group'],
145 155
 				'name' => $row['group_name'],
146 156
 				'color' => $row['online_color']
147 157
 			);
158
+		}
148 159
 	}
149 160
 	$db->free_result($request);
150 161
 
@@ -234,10 +245,12 @@  discard block
 block discarded – undo
234 245
 
235 246
 	// More members on now than ever were?  Update it!
236 247
 	if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline'])
237
-		$settingsToUpdate = array(
248
+	{
249
+			$settingsToUpdate = array(
238 250
 			'mostOnline' => $total_users_online,
239 251
 			'mostDate' => time()
240 252
 		);
253
+	}
241 254
 
242 255
 	$date = Util::strftime('%Y-%m-%d', forum_time(false));
243 256
 
@@ -270,7 +283,9 @@  discard block
 block discarded – undo
270 283
 			list ($modSettings['mostOnlineToday']) = $db->fetch_row($request);
271 284
 
272 285
 			if ($total_users_online > $modSettings['mostOnlineToday'])
273
-				trackStats(array('most_on' => $total_users_online));
286
+			{
287
+							trackStats(array('most_on' => $total_users_online));
288
+			}
274 289
 
275 290
 			$total_users_online = max($total_users_online, $modSettings['mostOnlineToday']);
276 291
 		}
@@ -288,5 +303,7 @@  discard block
 block discarded – undo
288 303
 	}
289 304
 
290 305
 	if (!empty($settingsToUpdate))
291
-		updateSettings($settingsToUpdate);
292
-}
306
+	{
307
+			updateSettings($settingsToUpdate);
308
+	}
309
+	}
Please login to merge, or discard this patch.
sources/subs/BBC/BBCParser.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -750,7 +750,9 @@  discard block
 block discarded – undo
750 750
 	protected function handleItemCode()
751 751
 	{
752 752
 		if (!isset($this->item_codes[$this->message[$this->pos + 1]]))
753
-			return;
753
+		{
754
+					return;
755
+		}
754 756
 
755 757
 		$tag = $this->item_codes[$this->message[$this->pos + 1]];
756 758
 
@@ -1351,7 +1353,9 @@  discard block
 block discarded – undo
1351 1353
 			$control_order[$index] = $index;
1352 1354
 
1353 1355
 			if ($this->tag_possible['optionals'][$index])
1354
-				$control_order[$index] = $index + $this->tag_possible['regex_size'];
1356
+			{
1357
+							$control_order[$index] = $index + $this->tag_possible['regex_size'];
1358
+			}
1355 1359
 		}
1356 1360
 
1357 1361
 		array_multisort($control_order, SORT_ASC, $this->tag_possible['regex_cache']);
@@ -1382,9 +1386,12 @@  discard block
 block discarded – undo
1382 1386
 			if ($optional)
1383 1387
 			{
1384 1388
 				if ($param_exists)
1385
-					$this->tag_possible['optionals'][$index] = false;
1386
-				else
1387
-					$this->tag_possible['regex_cache'][$index] .= '?';
1389
+				{
1390
+									$this->tag_possible['optionals'][$index] = false;
1391
+				}
1392
+				else {
1393
+									$this->tag_possible['regex_cache'][$index] .= '?';
1394
+				}
1388 1395
 			}
1389 1396
 		}
1390 1397
 	}
Please login to merge, or discard this patch.