Passed
Push — master ( d9e5dd...36764d )
by Spuds
01:07 queued 26s
created
sources/subs/Package.subs.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 						'value' => $txt['package_restore_permissions_cur_status'],
326 326
 					),
327 327
 					'data' => array(
328
-						'function' => function ($rowData) {
328
+						'function' => function($rowData) {
329 329
 							global $txt;
330 330
 
331 331
 							$formatTxt = $rowData['result'] == '' || $rowData['result'] == 'skipped' ? $txt['package_restore_permissions_pre_change'] : $txt['package_restore_permissions_post_change'];
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 						'value' => $txt['package_restore_permissions_result'],
355 355
 					),
356 356
 					'data' => array(
357
-						'function' => function ($rowData) {
357
+						'function' => function($rowData) {
358 358
 							global $txt;
359 359
 
360 360
 							return $txt['package_restore_permissions_action_' . $rowData['result']];
Please login to merge, or discard this patch.
Braces   +665 added lines, -253 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 		$data = fetch_web_data($gzfilename);
36 36
 
37 37
 		if ($data === false)
38
-			return false;
38
+		{
39
+					return false;
40
+		}
39 41
 	}
40 42
 	// Or a file on the system
41 43
 	else
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
 		$data = @file_get_contents($gzfilename);
44 46
 
45 47
 		if ($data === false)
46
-			return false;
48
+		{
49
+					return false;
50
+		}
47 51
 	}
48 52
 
49 53
 	return read_tgz_data($data, $destination, $single_file, $overwrite, $files_to_extract);
@@ -83,7 +87,9 @@  discard block
 block discarded – undo
83 87
 
84 88
 	// Choose the right method for the file
85 89
 	if ($untgz->check_valid_tgz())
86
-		return $untgz->read_tgz_data();
90
+	{
91
+			return $untgz->read_tgz_data();
92
+	}
87 93
 	else
88 94
 	{
89 95
 		unset($untgz);
@@ -125,7 +131,9 @@  discard block
 block discarded – undo
125 131
 	$a_url = parse_url($url);
126 132
 
127 133
 	if (!isset($a_url['scheme']))
128
-		return false;
134
+	{
135
+			return false;
136
+	}
129 137
 
130 138
 	// Attempt to connect...
131 139
 	$temp = '';
@@ -133,7 +141,9 @@  discard block
 block discarded – undo
133 141
 
134 142
 	// Can't make a connection
135 143
 	if (!$fid)
136
-		return false;
144
+	{
145
+			return false;
146
+	}
137 147
 
138 148
 	// See if the file is where its supposed to be
139 149
 	fputs($fid, 'HEAD ' . $a_url['path'] . ' HTTP/1.0' . "\r\n" . 'Host: ' . $a_url['host'] . "\r\n\r\n");
@@ -190,7 +200,9 @@  discard block
 block discarded – undo
190 200
 	{
191 201
 		// Already found this? If so don't add it twice!
192 202
 		if (in_array($row['package_id'], $found))
193
-			continue;
203
+		{
204
+					continue;
205
+		}
194 206
 
195 207
 		$found[] = $row['package_id'];
196 208
 
@@ -226,20 +238,29 @@  discard block
 block discarded – undo
226 238
 
227 239
 	// Extract package-info.xml from downloaded file. (*/ is used because it could be in any directory.)
228 240
 	if (preg_match('~^https?://~i', $gzfilename) === 1)
229
-		$packageInfo = read_tgz_data(fetch_web_data($gzfilename, '', true), '*/package-info.xml', true);
241
+	{
242
+			$packageInfo = read_tgz_data(fetch_web_data($gzfilename, '', true), '*/package-info.xml', true);
243
+	}
230 244
 	else
231 245
 	{
232 246
 		// It must be in the package directory then
233 247
 		if (!file_exists(BOARDDIR . '/packages/' . $gzfilename))
234
-			return 'package_get_error_not_found';
248
+		{
249
+					return 'package_get_error_not_found';
250
+		}
235 251
 
236 252
 		// Make sure an package.xml file is available
237 253
 		if (is_file(BOARDDIR . '/packages/' . $gzfilename))
238
-			$packageInfo = read_tgz_file(BOARDDIR . '/packages/' . $gzfilename, '*/package-info.xml', true);
254
+		{
255
+					$packageInfo = read_tgz_file(BOARDDIR . '/packages/' . $gzfilename, '*/package-info.xml', true);
256
+		}
239 257
 		elseif (file_exists(BOARDDIR . '/packages/' . $gzfilename . '/package-info.xml'))
240
-			$packageInfo = file_get_contents(BOARDDIR . '/packages/' . $gzfilename . '/package-info.xml');
241
-		else
242
-			return 'package_get_error_missing_xml';
258
+		{
259
+					$packageInfo = file_get_contents(BOARDDIR . '/packages/' . $gzfilename . '/package-info.xml');
260
+		}
261
+		else {
262
+					return 'package_get_error_missing_xml';
263
+		}
243 264
 	}
244 265
 
245 266
 	// Nothing?
@@ -248,9 +269,12 @@  discard block
 block discarded – undo
248 269
 		// Perhaps they are trying to install a theme, lets tell them nicely this is the wrong function
249 270
 		$packageInfo = read_tgz_file(BOARDDIR . '/packages/' . $gzfilename, '*/theme_info.xml', true);
250 271
 		if (!empty($packageInfo))
251
-			return 'package_get_error_is_theme';
252
-		else
253
-			return 'package_get_error_is_zero';
272
+		{
273
+					return 'package_get_error_is_theme';
274
+		}
275
+		else {
276
+					return 'package_get_error_is_zero';
277
+		}
254 278
 	}
255 279
 
256 280
 	// Parse package-info.xml into an Xml_Array.
@@ -258,7 +282,9 @@  discard block
 block discarded – undo
258 282
 
259 283
 	// @todo Error message of some sort?
260 284
 	if (!$packageInfo->exists('package-info[0]'))
261
-		return 'package_get_error_packageinfo_corrupt';
285
+	{
286
+			return 'package_get_error_packageinfo_corrupt';
287
+	}
262 288
 
263 289
 	$packageInfo = $packageInfo->path('package-info[0]');
264 290
 
@@ -269,7 +295,9 @@  discard block
 block discarded – undo
269 295
 
270 296
 	// Set a default type if none was supplied in the package
271 297
 	if (!isset($package['type']))
272
-		$package['type'] = 'modification';
298
+	{
299
+			$package['type'] = 'modification';
300
+	}
273 301
 
274 302
 	return $package;
275 303
 }
@@ -397,11 +425,15 @@  discard block
 block discarded – undo
397 425
 
398 426
 		// If we just restored permissions then wherever we are, we are now done and dusted.
399 427
 		if (!empty($_POST['restore_perms']))
400
-			obExit();
428
+		{
429
+					obExit();
430
+		}
401 431
 	}
402 432
 	// Otherwise, it's entirely irrelevant?
403 433
 	elseif ($restore_write_status)
404
-		return true;
434
+	{
435
+			return true;
436
+	}
405 437
 
406 438
 	// This is where we report what we got up to.
407 439
 	$return_data = array(
@@ -418,7 +450,9 @@  discard block
 block discarded – undo
418 450
 
419 451
 		// Check for a valid connection
420 452
 		if ($package_ftp->error !== false)
421
-			unset($package_ftp, $_SESSION['pack_ftp']);
453
+		{
454
+					unset($package_ftp, $_SESSION['pack_ftp']);
455
+		}
422 456
 	}
423 457
 
424 458
 	// Just got a submission did we?
@@ -440,10 +474,13 @@  discard block
 block discarded – undo
440 474
 			{
441 475
 				$ftp_root = strtr(BOARDDIR, array($_POST['ftp_path'] => ''));
442 476
 				if (substr($ftp_root, -1) == '/' && ($_POST['ftp_path'] == '' || substr($_POST['ftp_path'], 0, 1) == '/'))
443
-					$ftp_root = substr($ftp_root, 0, -1);
477
+				{
478
+									$ftp_root = substr($ftp_root, 0, -1);
479
+				}
480
+			}
481
+			else {
482
+							$ftp_root = BOARDDIR;
444 483
 			}
445
-			else
446
-				$ftp_root = BOARDDIR;
447 484
 
448 485
 			$_SESSION['pack_ftp'] = array(
449 486
 				'server' => $_POST['ftp_server'],
@@ -456,7 +493,9 @@  discard block
 block discarded – undo
456 493
 			);
457 494
 
458 495
 			if (!isset($modSettings['package_path']) || $modSettings['package_path'] != $_POST['ftp_path'])
459
-				updateSettings(array('package_path' => $_POST['ftp_path']));
496
+			{
497
+							updateSettings(array('package_path' => $_POST['ftp_path']));
498
+			}
460 499
 
461 500
 			// This is now the primary connection.
462 501
 			$package_ftp = $ftp;
@@ -470,10 +509,14 @@  discard block
 block discarded – undo
470 509
 		{
471 510
 			// Sometimes this can somehow happen maybe?
472 511
 			if (empty($file))
473
-				unset($chmodFiles[$k]);
512
+			{
513
+							unset($chmodFiles[$k]);
514
+			}
474 515
 			// Already writable?
475 516
 			elseif (@is_writable($file))
476
-				$return_data['files']['writable'][] = $file;
517
+			{
518
+							$return_data['files']['writable'][] = $file;
519
+			}
477 520
 			else
478 521
 			{
479 522
 				// Now try to change that.
@@ -492,17 +535,25 @@  discard block
 block discarded – undo
492 535
 				$ftp = new Ftp_Connection(null);
493 536
 			}
494 537
 			elseif ($ftp->error !== false && !isset($ftp_error))
495
-				$ftp_error = $ftp->last_message === null ? '' : $ftp->last_message;
538
+			{
539
+							$ftp_error = $ftp->last_message === null ? '' : $ftp->last_message;
540
+			}
496 541
 
497 542
 			list ($username, $detect_path, $found_path) = $ftp->detect_path(BOARDDIR);
498 543
 
499 544
 			if ($found_path)
500
-				$_POST['ftp_path'] = $detect_path;
545
+			{
546
+							$_POST['ftp_path'] = $detect_path;
547
+			}
501 548
 			elseif (!isset($_POST['ftp_path']))
502
-				$_POST['ftp_path'] = isset($modSettings['package_path']) ? $modSettings['package_path'] : $detect_path;
549
+			{
550
+							$_POST['ftp_path'] = isset($modSettings['package_path']) ? $modSettings['package_path'] : $detect_path;
551
+			}
503 552
 
504 553
 			if (!isset($_POST['ftp_username']))
505
-				$_POST['ftp_username'] = $username;
554
+			{
555
+							$_POST['ftp_username'] = $username;
556
+			}
506 557
 		}
507 558
 
508 559
 		$context['package_ftp'] = array(
@@ -516,7 +567,9 @@  discard block
 block discarded – undo
516 567
 
517 568
 		// Which files failed?
518 569
 		if (!isset($context['notwritable_files']))
519
-			$context['notwritable_files'] = array();
570
+		{
571
+					$context['notwritable_files'] = array();
572
+		}
520 573
 		$context['notwritable_files'] = array_merge($context['notwritable_files'], $return_data['files']['notwritable']);
521 574
 
522 575
 		// Sent here to die?
@@ -564,8 +617,9 @@  discard block
 block discarded – undo
564 617
 				$ftp_file = strtr($file, array($_SESSION['pack_ftp']['root'] => ''));
565 618
 				$package_ftp->chmod($ftp_file, $perms);
566 619
 			}
567
-			else
568
-				elk_chmod($file, $perms);
620
+			else {
621
+							elk_chmod($file, $perms);
622
+			}
569 623
 
570 624
 			$new_permissions = @fileperms($file);
571 625
 			$result = $new_permissions == $perms ? 'success' : 'failure';
@@ -613,39 +667,56 @@  discard block
 block discarded – undo
613 667
 		{
614 668
 			// If this file doesn't exist, then we actually want to look at the directory, no?
615 669
 			if (!file_exists($file))
616
-				$file = dirname($file);
670
+			{
671
+							$file = dirname($file);
672
+			}
617 673
 
618 674
 			// This looks odd, but it's an attempt to work around PHP suExec.
619 675
 			if (!@is_writable($file))
620
-				elk_chmod($file, 0755);
676
+			{
677
+							elk_chmod($file, 0755);
678
+			}
621 679
 			if (!@is_writable($file))
622
-				elk_chmod($file, 0777);
680
+			{
681
+							elk_chmod($file, 0777);
682
+			}
623 683
 			if (!@is_writable(dirname($file)))
624
-				elk_chmod($file, 0755);
684
+			{
685
+							elk_chmod($file, 0755);
686
+			}
625 687
 			if (!@is_writable(dirname($file)))
626
-				elk_chmod($file, 0777);
688
+			{
689
+							elk_chmod($file, 0777);
690
+			}
627 691
 
628 692
 			$fp = is_dir($file) ? @opendir($file) : @fopen($file, 'rb');
629 693
 			if (@is_writable($file) && $fp)
630 694
 			{
631 695
 				unset($files[$k]);
632 696
 				if (!is_dir($file))
633
-					fclose($fp);
634
-				else
635
-					closedir($fp);
697
+				{
698
+									fclose($fp);
699
+				}
700
+				else {
701
+									closedir($fp);
702
+				}
636 703
 			}
637 704
 		}
638 705
 
639 706
 		// No FTP required!
640 707
 		if (empty($files))
641
-			return array();
708
+		{
709
+					return array();
710
+		}
642 711
 	}
643 712
 
644 713
 	// They've opted to not use FTP, and try anyway.
645 714
 	if (isset($_SESSION['pack_ftp']) && $_SESSION['pack_ftp'] === false)
646 715
 	{
647 716
 		if ($files === null)
648
-			return array();
717
+		{
718
+					return array();
719
+		}
649 720
 
650 721
 		foreach ($files as $k => $file)
651 722
 		{
@@ -657,12 +728,18 @@  discard block
 block discarded – undo
657 728
 				elk_chmod($file, 0755);
658 729
 			}
659 730
 			if (!@is_writable($file))
660
-				elk_chmod($file, 0777);
731
+			{
732
+							elk_chmod($file, 0777);
733
+			}
661 734
 			if (!@is_writable(dirname($file)))
662
-				elk_chmod(dirname($file), 0777);
735
+			{
736
+							elk_chmod(dirname($file), 0777);
737
+			}
663 738
 
664 739
 			if (@is_writable($file))
665
-				unset($files[$k]);
740
+			{
741
+							unset($files[$k]);
742
+			}
666 743
 		}
667 744
 
668 745
 		return $files;
@@ -672,7 +749,9 @@  discard block
 block discarded – undo
672 749
 		$package_ftp = new Ftp_Connection($_SESSION['pack_ftp']['server'], $_SESSION['pack_ftp']['port'], $_SESSION['pack_ftp']['username'], package_crypt($_SESSION['pack_ftp']['password']));
673 750
 
674 751
 		if ($files === null)
675
-			return array();
752
+		{
753
+					return array();
754
+		}
676 755
 
677 756
 		foreach ($files as $k => $file)
678 757
 		{
@@ -688,14 +767,20 @@  discard block
 block discarded – undo
688 767
 
689 768
 			// Still not writable, true full permissions
690 769
 			if (!@is_writable($file))
691
-				$package_ftp->chmod($ftp_file, 0777);
770
+			{
771
+							$package_ftp->chmod($ftp_file, 0777);
772
+			}
692 773
 
693 774
 			// Directory not writable, try to chmod to 777 then
694 775
 			if (!@is_writable(dirname($file)))
695
-				$package_ftp->chmod(dirname($ftp_file), 0777);
776
+			{
777
+							$package_ftp->chmod(dirname($ftp_file), 0777);
778
+			}
696 779
 
697 780
 			if (@is_writable($file))
698
-				unset($files[$k]);
781
+			{
782
+							unset($files[$k]);
783
+			}
699 784
 		}
700 785
 
701 786
 		return $files;
@@ -731,17 +816,25 @@  discard block
 block discarded – undo
731 816
 			$ftp = new Ftp_Connection(null);
732 817
 		}
733 818
 		elseif ($ftp->error !== false && !isset($ftp_error))
734
-			$ftp_error = $ftp->last_message === null ? '' : $ftp->last_message;
819
+		{
820
+					$ftp_error = $ftp->last_message === null ? '' : $ftp->last_message;
821
+		}
735 822
 
736 823
 		list ($username, $detect_path, $found_path) = $ftp->detect_path(BOARDDIR);
737 824
 
738 825
 		if ($found_path)
739
-			$_POST['ftp_path'] = $detect_path;
826
+		{
827
+					$_POST['ftp_path'] = $detect_path;
828
+		}
740 829
 		elseif (!isset($_POST['ftp_path']))
741
-			$_POST['ftp_path'] = isset($modSettings['package_path']) ? $modSettings['package_path'] : $detect_path;
830
+		{
831
+					$_POST['ftp_path'] = isset($modSettings['package_path']) ? $modSettings['package_path'] : $detect_path;
832
+		}
742 833
 
743 834
 		if (!isset($_POST['ftp_username']))
744
-			$_POST['ftp_username'] = $username;
835
+		{
836
+					$_POST['ftp_username'] = $username;
837
+		}
745 838
 
746 839
 		$context['package_ftp'] = array(
747 840
 			'server' => isset($_POST['ftp_server']) ? $_POST['ftp_server'] : (isset($modSettings['package_server']) ? $modSettings['package_server'] : 'localhost'),
@@ -754,7 +847,9 @@  discard block
 block discarded – undo
754 847
 
755 848
 		// If we're returning dump out here.
756 849
 		if ($return)
757
-			return $files;
850
+		{
851
+					return $files;
852
+		}
758 853
 
759 854
 		$context['page_title'] = $txt['package_ftp_necessary'];
760 855
 		$context['sub_template'] = 'ftp_required';
@@ -766,10 +861,13 @@  discard block
 block discarded – undo
766 861
 		{
767 862
 			$ftp_root = strtr(BOARDDIR, array($_POST['ftp_path'] => ''));
768 863
 			if (substr($ftp_root, -1) == '/' && ($_POST['ftp_path'] == '' || $_POST['ftp_path'][0] == '/'))
769
-				$ftp_root = substr($ftp_root, 0, -1);
864
+			{
865
+							$ftp_root = substr($ftp_root, 0, -1);
866
+			}
867
+		}
868
+		else {
869
+					$ftp_root = BOARDDIR;
770 870
 		}
771
-		else
772
-			$ftp_root = BOARDDIR;
773 871
 
774 872
 		$_SESSION['pack_ftp'] = array(
775 873
 			'server' => $_POST['ftp_server'],
@@ -781,7 +879,9 @@  discard block
 block discarded – undo
781 879
 		);
782 880
 
783 881
 		if (!isset($modSettings['package_path']) || $modSettings['package_path'] != $_POST['ftp_path'])
784
-			updateSettings(array('package_path' => $_POST['ftp_path']));
882
+		{
883
+					updateSettings(array('package_path' => $_POST['ftp_path']));
884
+		}
785 885
 
786 886
 		$files = packageRequireFTP($destination_url, $files, $return);
787 887
 	}
@@ -813,7 +913,9 @@  discard block
 block discarded – undo
813 913
 
814 914
 	// Mayday!  That action doesn't exist!!
815 915
 	if (empty($packageXML) || !$packageXML->exists($method))
816
-		return array();
916
+	{
917
+			return array();
918
+	}
817 919
 
818 920
 	// We haven't found the package script yet...
819 921
 	$script = false;
@@ -821,7 +923,9 @@  discard block
 block discarded – undo
821 923
 
822 924
 	// Emulation support...
823 925
 	if (!empty($_SESSION['version_emulate']))
824
-		$the_version = $_SESSION['version_emulate'];
926
+	{
927
+			$the_version = $_SESSION['version_emulate'];
928
+	}
825 929
 
826 930
 	// Single package emulation
827 931
 	if (!empty($_REQUEST['ve']) && !empty($_REQUEST['package']))
@@ -830,7 +934,9 @@  discard block
 block discarded – undo
830 934
 		$_SESSION['single_version_emulate'][$_REQUEST['package']] = $the_version;
831 935
 	}
832 936
 	if (!empty($_REQUEST['package']) && (!empty($_SESSION['single_version_emulate'][$_REQUEST['package']])))
833
-		$the_version = $_SESSION['single_version_emulate'][$_REQUEST['package']];
937
+	{
938
+			$the_version = $_SESSION['single_version_emulate'][$_REQUEST['package']];
939
+	}
834 940
 
835 941
 	// Get all the versions of this method and find the right one.
836 942
 	$these_methods = $packageXML->set($method);
@@ -841,7 +947,9 @@  discard block
 block discarded – undo
841 947
 		{
842 948
 			// Don't keep going if this won't work for this version.
843 949
 			if (!matchPackageVersion($the_version, $this_method->fetch('@for')))
844
-				continue;
950
+			{
951
+							continue;
952
+			}
845 953
 		}
846 954
 
847 955
 		// Upgrades may go from a certain old version of the mod.
@@ -849,7 +957,9 @@  discard block
 block discarded – undo
849 957
 		{
850 958
 			// Well, this is for the wrong old version...
851 959
 			if (!matchPackageVersion($previous_version, $this_method->fetch('@from')))
852
-				continue;
960
+			{
961
+							continue;
962
+			}
853 963
 		}
854 964
 
855 965
 		// We've found it!
@@ -859,7 +969,9 @@  discard block
 block discarded – undo
859 969
 
860 970
 	// Bad news, a matching script wasn't found!
861 971
 	if ($script === false)
862
-		return array();
972
+	{
973
+			return array();
974
+	}
863 975
 
864 976
 	// Find all the actions in this method - in theory, these should only be allowed actions. (* means all.)
865 977
 	$actions = $script->set('*');
@@ -895,7 +1007,9 @@  discard block
 block discarded – undo
895 1007
 					{
896 1008
 						// In case the user put the blocks in the wrong order.
897 1009
 						if (isset($context[$type]['selected']) && $context[$type]['selected'] == 'default')
898
-							$context[$type][] = 'default';
1010
+						{
1011
+													$context[$type][] = 'default';
1012
+						}
899 1013
 
900 1014
 						$context[$type]['selected'] = htmlspecialchars($action->fetch('@lang'), ENT_COMPAT, 'UTF-8');
901 1015
 					}
@@ -915,8 +1029,9 @@  discard block
 block discarded – undo
915 1029
 						$context[$type][] = 'default';
916 1030
 						continue;
917 1031
 					}
918
-					else
919
-						$context[$type]['selected'] = 'default';
1032
+					else {
1033
+											$context[$type]['selected'] = 'default';
1034
+					}
920 1035
 				}
921 1036
 			}
922 1037
 
@@ -927,8 +1042,9 @@  discard block
 block discarded – undo
927 1042
 				package_put_contents($filename, $action->fetch('.'));
928 1043
 				$filename = strtr($filename, array($temp_path => ''));
929 1044
 			}
930
-			else
931
-				$filename = $action->fetch('.');
1045
+			else {
1046
+							$filename = $action->fetch('.');
1047
+			}
932 1048
 
933 1049
 			$return[] = array(
934 1050
 				'type' => $actionType,
@@ -964,7 +1080,9 @@  discard block
 block discarded – undo
964 1080
 				$url = addProtocol($url, array('http://', 'https://'));
965 1081
 
966 1082
 				if (strlen($url) < 8)
967
-					$url = '';
1083
+				{
1084
+									$url = '';
1085
+				}
968 1086
 			}
969 1087
 
970 1088
 			$return[] = array(
@@ -1034,7 +1152,9 @@  discard block
 block discarded – undo
1034 1152
 				{
1035 1153
 					$temp = $this_action['destination'];
1036 1154
 					while (!file_exists($temp) && strlen($temp) > 1)
1037
-						$temp = dirname($temp);
1155
+					{
1156
+											$temp = dirname($temp);
1157
+					}
1038 1158
 
1039 1159
 					$return[] = array(
1040 1160
 						'type' => 'chmod',
@@ -1049,7 +1169,9 @@  discard block
 block discarded – undo
1049 1169
 				{
1050 1170
 					$temp = dirname($this_action['destination']);
1051 1171
 					while (!file_exists($temp) && strlen($temp) > 1)
1052
-						$temp = dirname($temp);
1172
+					{
1173
+											$temp = dirname($temp);
1174
+					}
1053 1175
 
1054 1176
 					$return[] = array(
1055 1177
 						'type' => 'chmod',
@@ -1058,10 +1180,12 @@  discard block
 block discarded – undo
1058 1180
 				}
1059 1181
 
1060 1182
 				if (!is_writable($this_action['destination']) && (file_exists($this_action['destination']) || !is_writable(dirname($this_action['destination']))))
1061
-					$return[] = array(
1183
+				{
1184
+									$return[] = array(
1062 1185
 						'type' => 'chmod',
1063 1186
 						'filename' => $this_action['destination']
1064 1187
 					);
1188
+				}
1065 1189
 			}
1066 1190
 			elseif ($actionType == 'require-dir')
1067 1191
 			{
@@ -1069,7 +1193,9 @@  discard block
 block discarded – undo
1069 1193
 				{
1070 1194
 					$temp = $this_action['destination'];
1071 1195
 					while (!file_exists($temp) && strlen($temp) > 1)
1072
-						$temp = dirname($temp);
1196
+					{
1197
+											$temp = dirname($temp);
1198
+					}
1073 1199
 
1074 1200
 					$return[] = array(
1075 1201
 						'type' => 'chmod',
@@ -1080,13 +1206,17 @@  discard block
 block discarded – undo
1080 1206
 			elseif ($actionType == 'require-file')
1081 1207
 			{
1082 1208
 				if ($action->exists('@theme'))
1083
-					$this_action['theme_action'] = $action->fetch('@theme');
1209
+				{
1210
+									$this_action['theme_action'] = $action->fetch('@theme');
1211
+				}
1084 1212
 
1085 1213
 				if (!mktree(dirname($this_action['destination']), false))
1086 1214
 				{
1087 1215
 					$temp = dirname($this_action['destination']);
1088 1216
 					while (!file_exists($temp) && strlen($temp) > 1)
1089
-						$temp = dirname($temp);
1217
+					{
1218
+											$temp = dirname($temp);
1219
+					}
1090 1220
 
1091 1221
 					$return[] = array(
1092 1222
 						'type' => 'chmod',
@@ -1095,10 +1225,12 @@  discard block
 block discarded – undo
1095 1225
 				}
1096 1226
 
1097 1227
 				if (!is_writable($this_action['destination']) && (file_exists($this_action['destination']) || !is_writable(dirname($this_action['destination']))))
1098
-					$return[] = array(
1228
+				{
1229
+									$return[] = array(
1099 1230
 						'type' => 'chmod',
1100 1231
 						'filename' => $this_action['destination']
1101 1232
 					);
1233
+				}
1102 1234
 			}
1103 1235
 			elseif ($actionType == 'move-dir' || $actionType == 'move-file')
1104 1236
 			{
@@ -1106,7 +1238,9 @@  discard block
 block discarded – undo
1106 1238
 				{
1107 1239
 					$temp = dirname($this_action['destination']);
1108 1240
 					while (!file_exists($temp) && strlen($temp) > 1)
1109
-						$temp = dirname($temp);
1241
+					{
1242
+											$temp = dirname($temp);
1243
+					}
1110 1244
 
1111 1245
 					$return[] = array(
1112 1246
 						'type' => 'chmod',
@@ -1115,26 +1249,32 @@  discard block
 block discarded – undo
1115 1249
 				}
1116 1250
 
1117 1251
 				if (!is_writable($this_action['destination']) && (file_exists($this_action['destination']) || !is_writable(dirname($this_action['destination']))))
1118
-					$return[] = array(
1252
+				{
1253
+									$return[] = array(
1119 1254
 						'type' => 'chmod',
1120 1255
 						'filename' => $this_action['destination']
1121 1256
 					);
1257
+				}
1122 1258
 			}
1123 1259
 			elseif ($actionType == 'remove-dir')
1124 1260
 			{
1125 1261
 				if (!is_writable($this_action['filename']) && file_exists($this_action['filename']))
1126
-					$return[] = array(
1262
+				{
1263
+									$return[] = array(
1127 1264
 						'type' => 'chmod',
1128 1265
 						'filename' => $this_action['filename']
1129 1266
 					);
1267
+				}
1130 1268
 			}
1131 1269
 			elseif ($actionType == 'remove-file')
1132 1270
 			{
1133 1271
 				if (!is_writable($this_action['filename']) && file_exists($this_action['filename']))
1134
-					$return[] = array(
1272
+				{
1273
+									$return[] = array(
1135 1274
 						'type' => 'chmod',
1136 1275
 						'filename' => $this_action['filename']
1137 1276
 					);
1277
+				}
1138 1278
 			}
1139 1279
 		}
1140 1280
 		else
@@ -1163,7 +1303,9 @@  discard block
 block discarded – undo
1163 1303
 
1164 1304
 	// Only testing - just return a list of things to be done.
1165 1305
 	if ($testing_only)
1166
-		return $return;
1306
+	{
1307
+			return $return;
1308
+	}
1167 1309
 
1168 1310
 	umask(0);
1169 1311
 
@@ -1172,36 +1314,48 @@  discard block
 block discarded – undo
1172 1314
 	foreach ($return as $action)
1173 1315
 	{
1174 1316
 		if (in_array($action['type'], array('modification', 'code', 'database', 'redirect', 'hook', 'credits')))
1175
-			$not_done[] = $action;
1317
+		{
1318
+					$not_done[] = $action;
1319
+		}
1176 1320
 
1177 1321
 		if ($action['type'] == 'create-dir')
1178 1322
 		{
1179 1323
 			if (!mktree($action['destination'], 0755) || !is_writable($action['destination']))
1180
-				$failure |= !mktree($action['destination'], 0777);
1324
+			{
1325
+							$failure |= !mktree($action['destination'], 0777);
1326
+			}
1181 1327
 		}
1182 1328
 		elseif ($action['type'] == 'create-file')
1183 1329
 		{
1184 1330
 			if (!mktree(dirname($action['destination']), 0755) || !is_writable(dirname($action['destination'])))
1185
-				$failure |= !mktree(dirname($action['destination']), 0777);
1331
+			{
1332
+							$failure |= !mktree(dirname($action['destination']), 0777);
1333
+			}
1186 1334
 
1187 1335
 			// Create an empty file.
1188 1336
 			package_put_contents($action['destination'], package_get_contents($action['source']), $testing_only);
1189 1337
 
1190 1338
 			if (!file_exists($action['destination']))
1191
-				$failure = true;
1339
+			{
1340
+							$failure = true;
1341
+			}
1192 1342
 		}
1193 1343
 		elseif ($action['type'] == 'require-dir')
1194 1344
 		{
1195 1345
 			copytree($action['source'], $action['destination']);
1196 1346
 			// Any other theme folders?
1197 1347
 			if (!empty($context['theme_copies']) && !empty($context['theme_copies'][$action['type']][$action['destination']]))
1198
-				foreach ($context['theme_copies'][$action['type']][$action['destination']] as $theme_destination)
1348
+			{
1349
+							foreach ($context['theme_copies'][$action['type']][$action['destination']] as $theme_destination)
1199 1350
 					copytree($action['source'], $theme_destination);
1351
+			}
1200 1352
 		}
1201 1353
 		elseif ($action['type'] == 'require-file')
1202 1354
 		{
1203 1355
 			if (!mktree(dirname($action['destination']), 0755) || !is_writable(dirname($action['destination'])))
1204
-				$failure |= !mktree(dirname($action['destination']), 0777);
1356
+			{
1357
+							$failure |= !mktree(dirname($action['destination']), 0777);
1358
+			}
1205 1359
 
1206 1360
 			package_put_contents($action['destination'], package_get_contents($action['source']), $testing_only);
1207 1361
 
@@ -1209,10 +1363,12 @@  discard block
 block discarded – undo
1209 1363
 
1210 1364
 			// Any other theme files?
1211 1365
 			if (!empty($context['theme_copies']) && !empty($context['theme_copies'][$action['type']][$action['destination']]))
1212
-				foreach ($context['theme_copies'][$action['type']][$action['destination']] as $theme_destination)
1366
+			{
1367
+							foreach ($context['theme_copies'][$action['type']][$action['destination']] as $theme_destination)
1213 1368
 				{
1214 1369
 					if (!mktree(dirname($theme_destination), 0755) || !is_writable(dirname($theme_destination)))
1215 1370
 						$failure |= !mktree(dirname($theme_destination), 0777);
1371
+			}
1216 1372
 
1217 1373
 					package_put_contents($theme_destination, package_get_contents($action['source']), $testing_only);
1218 1374
 
@@ -1222,14 +1378,18 @@  discard block
 block discarded – undo
1222 1378
 		elseif ($action['type'] == 'move-file')
1223 1379
 		{
1224 1380
 			if (!mktree(dirname($action['destination']), 0755) || !is_writable(dirname($action['destination'])))
1225
-				$failure |= !mktree(dirname($action['destination']), 0777);
1381
+			{
1382
+							$failure |= !mktree(dirname($action['destination']), 0777);
1383
+			}
1226 1384
 
1227 1385
 			$failure |= !rename($action['source'], $action['destination']);
1228 1386
 		}
1229 1387
 		elseif ($action['type'] == 'move-dir')
1230 1388
 		{
1231 1389
 			if (!mktree($action['destination'], 0755) || !is_writable($action['destination']))
1232
-				$failure |= !mktree($action['destination'], 0777);
1390
+			{
1391
+							$failure |= !mktree($action['destination'], 0777);
1392
+			}
1233 1393
 
1234 1394
 			$failure |= !rename($action['source'], $action['destination']);
1235 1395
 		}
@@ -1239,8 +1399,10 @@  discard block
 block discarded – undo
1239 1399
 
1240 1400
 			// Any other theme folders?
1241 1401
 			if (!empty($context['theme_copies']) && !empty($context['theme_copies'][$action['type']][$action['filename']]))
1242
-				foreach ($context['theme_copies'][$action['type']][$action['filename']] as $theme_destination)
1402
+			{
1403
+							foreach ($context['theme_copies'][$action['type']][$action['filename']] as $theme_destination)
1243 1404
 					deltree($theme_destination);
1405
+			}
1244 1406
 		}
1245 1407
 		elseif ($action['type'] == 'remove-file')
1246 1408
 		{
@@ -1251,16 +1413,20 @@  discard block
 block discarded – undo
1251 1413
 				$failure |= !unlink($action['filename']);
1252 1414
 			}
1253 1415
 			// The file that was supposed to be deleted couldn't be found.
1254
-			else
1255
-				$failure = true;
1416
+			else {
1417
+							$failure = true;
1418
+			}
1256 1419
 
1257 1420
 			// Any other theme folders?
1258 1421
 			if (!empty($context['theme_copies']) && !empty($context['theme_copies'][$action['type']][$action['filename']]))
1259
-				foreach ($context['theme_copies'][$action['type']][$action['filename']] as $theme_destination)
1422
+			{
1423
+							foreach ($context['theme_copies'][$action['type']][$action['filename']] as $theme_destination)
1260 1424
 					if (file_exists($theme_destination))
1261 1425
 						$failure |= !unlink($theme_destination);
1262
-					else
1263
-						$failure = true;
1426
+			}
1427
+					else {
1428
+											$failure = true;
1429
+					}
1264 1430
 		}
1265 1431
 	}
1266 1432
 
@@ -1285,7 +1451,9 @@  discard block
 block discarded – undo
1285 1451
 	static $near_version = 0;
1286 1452
 
1287 1453
 	if ($reset)
1288
-		$near_version = 0;
1454
+	{
1455
+			$near_version = 0;
1456
+	}
1289 1457
 
1290 1458
 	// Normalize the $versions
1291 1459
 	$versions = explode(',', str_replace(' ', '', strtolower($versions)));
@@ -1293,22 +1461,30 @@  discard block
 block discarded – undo
1293 1461
 	// If it is not ElkArte, let's just give up
1294 1462
 	list ($the_brand,) = explode(' ', FORUM_VERSION, 2);
1295 1463
 	if ($the_brand != 'ElkArte')
1296
-		return false;
1464
+	{
1465
+			return false;
1466
+	}
1297 1467
 
1298 1468
 	// Loop through each version, save the highest we can find
1299 1469
 	foreach ($versions as $for)
1300 1470
 	{
1301 1471
 		// Adjust for those wild cards
1302 1472
 		if (strpos($for, '*') !== false)
1303
-			$for = str_replace('*', '0', $for) . '-' . str_replace('*', '999', $for);
1473
+		{
1474
+					$for = str_replace('*', '0', $for) . '-' . str_replace('*', '999', $for);
1475
+		}
1304 1476
 
1305 1477
 		// If we have a range, grab the lower value, done this way so it looks normal-er to the user e.g. 1.0 vs 1.0.99
1306 1478
 		if (strpos($for, '-') !== false)
1307
-			list ($for,) = explode('-', $for);
1479
+		{
1480
+					list ($for,) = explode('-', $for);
1481
+		}
1308 1482
 
1309 1483
 		// Do the compare, if the for is greater, than what we have but not greater than what we are running .....
1310 1484
 		if (compareVersions($near_version, $for) === -1 && compareVersions($for, $the_version) !== 1)
1311
-			$near_version = $for;
1485
+		{
1486
+					$near_version = $for;
1487
+		}
1312 1488
 	}
1313 1489
 
1314 1490
 	return !empty($near_version) ? $near_version : false;
@@ -1334,14 +1510,18 @@  discard block
 block discarded – undo
1334 1510
 
1335 1511
 	// Perhaps we do accept anything?
1336 1512
 	if (in_array('all', $versions))
1337
-		return true;
1513
+	{
1514
+			return true;
1515
+	}
1338 1516
 
1339 1517
 	// Loop through each version.
1340 1518
 	foreach ($versions as $for)
1341 1519
 	{
1342 1520
 		// Wild card spotted?
1343 1521
 		if (strpos($for, '*') !== false)
1344
-			$for = str_replace('*', '0dev0', $for) . '-' . str_replace('*', '999', $for);
1522
+		{
1523
+					$for = str_replace('*', '0dev0', $for) . '-' . str_replace('*', '999', $for);
1524
+		}
1345 1525
 
1346 1526
 		// Do we have a range?
1347 1527
 		if (strpos($for, '-') !== false)
@@ -1350,11 +1530,15 @@  discard block
 block discarded – undo
1350 1530
 
1351 1531
 			// Compare the version against lower and upper bounds.
1352 1532
 			if (compareVersions($version, $lower) > -1 && compareVersions($version, $upper) < 1)
1353
-				return true;
1533
+			{
1534
+							return true;
1535
+			}
1354 1536
 		}
1355 1537
 		// Otherwise check if they are equal...
1356 1538
 		elseif (compareVersions($version, $for) === 0)
1357
-			return true;
1539
+		{
1540
+					return true;
1541
+		}
1358 1542
 	}
1359 1543
 
1360 1544
 	return false;
@@ -1397,11 +1581,15 @@  discard block
 block discarded – undo
1397 1581
 
1398 1582
 	// Are they the same, perhaps?
1399 1583
 	if ($versions[1] === $versions[2])
1400
-		return 0;
1584
+	{
1585
+			return 0;
1586
+	}
1401 1587
 
1402 1588
 	// Get version numbering categories...
1403 1589
 	if (!isset($categories))
1404
-		$categories = array_keys($versions[1]);
1590
+	{
1591
+			$categories = array_keys($versions[1]);
1592
+	}
1405 1593
 
1406 1594
 	// Loop through each category.
1407 1595
 	foreach ($categories as $category)
@@ -1412,12 +1600,17 @@  discard block
 block discarded – undo
1412 1600
 			// Dev builds are a problematic exception.
1413 1601
 			// (stable) dev < (stable) but (unstable) dev = (unstable)
1414 1602
 			if ($category == 'type')
1415
-				return $versions[1][$category] > $versions[2][$category] ? ($versions[1]['dev'] ? -1 : 1) : ($versions[2]['dev'] ? 1 : -1);
1603
+			{
1604
+							return $versions[1][$category] > $versions[2][$category] ? ($versions[1]['dev'] ? -1 : 1) : ($versions[2]['dev'] ? 1 : -1);
1605
+			}
1416 1606
 			elseif ($category == 'dev')
1417
-				return $versions[1]['dev'] ? ($versions[2]['type'] == 'stable' ? -1 : 0) : ($versions[1]['type'] == 'stable' ? 1 : 0);
1607
+			{
1608
+							return $versions[1]['dev'] ? ($versions[2]['type'] == 'stable' ? -1 : 0) : ($versions[1]['type'] == 'stable' ? 1 : 0);
1609
+			}
1418 1610
 			// Otherwise a simple comparison.
1419
-			else
1420
-				return $versions[1][$category] > $versions[2][$category] ? 1 : -1;
1611
+			else {
1612
+							return $versions[1][$category] > $versions[2][$category] ? 1 : -1;
1613
+			}
1421 1614
 		}
1422 1615
 	}
1423 1616
 
@@ -1437,7 +1630,9 @@  discard block
 block discarded – undo
1437 1630
 	global $modSettings, $settings, $temp_path;
1438 1631
 
1439 1632
 	if (empty($path))
1440
-		return '';
1633
+	{
1634
+			return '';
1635
+	}
1441 1636
 
1442 1637
 	$dirs = array(
1443 1638
 		'\\' => '/',
@@ -1457,14 +1652,20 @@  discard block
 block discarded – undo
1457 1652
 
1458 1653
 	// Do we parse in a package directory?
1459 1654
 	if (!empty($temp_path))
1460
-		$dirs['PACKAGE'] = $temp_path;
1655
+	{
1656
+			$dirs['PACKAGE'] = $temp_path;
1657
+	}
1461 1658
 
1462 1659
 	if (strlen($path) == 0)
1463
-		trigger_error('parse_path(): There should never be an empty filename', E_USER_ERROR);
1660
+	{
1661
+			trigger_error('parse_path(): There should never be an empty filename', E_USER_ERROR);
1662
+	}
1464 1663
 
1465 1664
 	// Check if they are using some old software install paths
1466 1665
 	if (strpos($path, '$') === 0 && isset($dirs[strtoupper(substr($path, 1))]))
1467
-		$path = strtoupper(substr($path, 1));
1666
+	{
1667
+			$path = strtoupper(substr($path, 1));
1668
+	}
1468 1669
 
1469 1670
 	return strtr($path, $dirs);
1470 1671
 }
@@ -1487,7 +1688,9 @@  discard block
 block discarded – undo
1487 1688
 	global $package_ftp;
1488 1689
 
1489 1690
 	if (!file_exists($dir))
1490
-		return;
1691
+	{
1692
+			return;
1693
+	}
1491 1694
 
1492 1695
 	// Read all the files in the directory
1493 1696
 	try
@@ -1497,7 +1700,9 @@  discard block
 block discarded – undo
1497 1700
 		{
1498 1701
 			// Recursively dive in to each directory looking for files to delete
1499 1702
 			if ($entryname->isDir())
1500
-				deltree($entryname->getPathname());
1703
+			{
1704
+							deltree($entryname->getPathname());
1705
+			}
1501 1706
 			// A file, delete it by any means necessary
1502 1707
 			else
1503 1708
 			{
@@ -1507,14 +1712,18 @@  discard block
 block discarded – undo
1507 1712
 					$ftp_file = strtr($entryname->getPathname(), array($_SESSION['pack_ftp']['root'] => ''));
1508 1713
 
1509 1714
 					if (!$entryname->isWritable())
1510
-						$package_ftp->chmod($ftp_file, 0777);
1715
+					{
1716
+											$package_ftp->chmod($ftp_file, 0777);
1717
+					}
1511 1718
 
1512 1719
 					$package_ftp->unlink($ftp_file);
1513 1720
 				}
1514 1721
 				else
1515 1722
 				{
1516 1723
 					if (!$entryname->isWritable())
1517
-						elk_chmod($entryname->getPathname(), 0777);
1724
+					{
1725
+											elk_chmod($entryname->getPathname(), 0777);
1726
+					}
1518 1727
 
1519 1728
 					@unlink($entryname->getPathname());
1520 1729
 				}
@@ -1528,8 +1737,10 @@  discard block
 block discarded – undo
1528 1737
 		{
1529 1738
 			$ftp_file = strtr($dir, array($_SESSION['pack_ftp']['root'] => ''));
1530 1739
 			if (!is_writable($dir . '/'))
1531
-				$package_ftp->chmod($ftp_file, 0777);
1532
-			$package_ftp->unlink($ftp_file);
1740
+			{
1741
+							$package_ftp->chmod($ftp_file, 0777);
1742
+			}
1743
+			$package_ftp->unlink($ftp_file);
1533 1744
 		}
1534 1745
 
1535 1746
 		return;
@@ -1543,14 +1754,18 @@  discard block
 block discarded – undo
1543 1754
 			$ftp_file = strtr($dir, array($_SESSION['pack_ftp']['root'] => ''));
1544 1755
 
1545 1756
 			if (!is_writable($dir . '/'))
1546
-				$package_ftp->chmod($ftp_file, 0777);
1757
+			{
1758
+							$package_ftp->chmod($ftp_file, 0777);
1759
+			}
1547 1760
 
1548 1761
 			$package_ftp->unlink($ftp_file);
1549 1762
 		}
1550 1763
 		else
1551 1764
 		{
1552 1765
 			if (!is_writable($dir))
1553
-				elk_chmod($dir, 0777);
1766
+			{
1767
+							elk_chmod($dir, 0777);
1768
+			}
1554 1769
 
1555 1770
 			@rmdir($dir);
1556 1771
 		}
@@ -1578,9 +1793,12 @@  discard block
 block discarded – undo
1578 1793
 		if (!is_writable($strPath) && $mode !== false)
1579 1794
 		{
1580 1795
 			if (isset($package_ftp))
1581
-				$package_ftp->chmod(strtr($strPath, array($_SESSION['pack_ftp']['root'] => '')), $mode);
1582
-			else
1583
-				elk_chmod($strPath, $mode);
1796
+			{
1797
+							$package_ftp->chmod(strtr($strPath, array($_SESSION['pack_ftp']['root'] => '')), $mode);
1798
+			}
1799
+			else {
1800
+							elk_chmod($strPath, $mode);
1801
+			}
1584 1802
 		}
1585 1803
 
1586 1804
 		// See if we can open it for access, return the result
@@ -1590,26 +1808,34 @@  discard block
 block discarded – undo
1590 1808
 			closedir($test);
1591 1809
 			return is_writable($strPath);
1592 1810
 		}
1593
-		else
1594
-			return false;
1811
+		else {
1812
+					return false;
1813
+		}
1595 1814
 	}
1596 1815
 
1597 1816
 	// Is this an invalid path and/or we can't make the directory?
1598 1817
 	if ($strPath == dirname($strPath) || !mktree(dirname($strPath), $mode))
1599
-		return false;
1818
+	{
1819
+			return false;
1820
+	}
1600 1821
 
1601 1822
 	// Is the dir writable and do we have permission to attempt to make it so
1602 1823
 	if (!is_writable(dirname($strPath)) && $mode !== false)
1603 1824
 	{
1604 1825
 		if (isset($package_ftp))
1605
-			$package_ftp->chmod(dirname(strtr($strPath, array($_SESSION['pack_ftp']['root'] => ''))), $mode);
1606
-		else
1607
-			elk_chmod(dirname($strPath), $mode);
1826
+		{
1827
+					$package_ftp->chmod(dirname(strtr($strPath, array($_SESSION['pack_ftp']['root'] => ''))), $mode);
1828
+		}
1829
+		else {
1830
+					elk_chmod(dirname($strPath), $mode);
1831
+		}
1608 1832
 	}
1609 1833
 
1610 1834
 	// Return an ftp control if using FTP
1611 1835
 	if ($mode !== false && isset($package_ftp))
1612
-		return $package_ftp->create_dir(strtr($strPath, array($_SESSION['pack_ftp']['root'] => '')));
1836
+	{
1837
+			return $package_ftp->create_dir(strtr($strPath, array($_SESSION['pack_ftp']['root'] => '')));
1838
+	}
1613 1839
 	// Can't change the mode so just return the current availability
1614 1840
 	elseif ($mode === false)
1615 1841
 	{
@@ -1619,8 +1845,9 @@  discard block
 block discarded – undo
1619 1845
 			closedir($test);
1620 1846
 			return true;
1621 1847
 		}
1622
-		else
1623
-			return false;
1848
+		else {
1849
+					return false;
1850
+		}
1624 1851
 	}
1625 1852
 	// Only one choice left and thats to try and make a directory
1626 1853
 	else
@@ -1634,8 +1861,9 @@  discard block
 block discarded – undo
1634 1861
 			closedir($test);
1635 1862
 			return true;
1636 1863
 		}
1637
-		else
1638
-			return false;
1864
+		else {
1865
+					return false;
1866
+		}
1639 1867
 	}
1640 1868
 }
1641 1869
 
@@ -1653,39 +1881,58 @@  discard block
 block discarded – undo
1653 1881
 	global $package_ftp;
1654 1882
 
1655 1883
 	if (!file_exists($destination) || !is_writable($destination))
1656
-		mktree($destination, 0755);
1884
+	{
1885
+			mktree($destination, 0755);
1886
+	}
1657 1887
 
1658 1888
 	if (!is_writable($destination))
1659
-		mktree($destination, 0777);
1889
+	{
1890
+			mktree($destination, 0777);
1891
+	}
1660 1892
 
1661 1893
 	$current_dir = opendir($source);
1662 1894
 	if ($current_dir === false)
1663
-		return;
1895
+	{
1896
+			return;
1897
+	}
1664 1898
 
1665 1899
 	while ($entryname = readdir($current_dir))
1666 1900
 	{
1667 1901
 		if (in_array($entryname, array('.', '..')))
1668
-			continue;
1902
+		{
1903
+					continue;
1904
+		}
1669 1905
 
1670 1906
 		if (isset($package_ftp))
1671
-			$ftp_file = strtr($destination . '/' . $entryname, array($_SESSION['pack_ftp']['root'] => ''));
1907
+		{
1908
+					$ftp_file = strtr($destination . '/' . $entryname, array($_SESSION['pack_ftp']['root'] => ''));
1909
+		}
1672 1910
 
1673 1911
 		if (is_file($source . '/' . $entryname))
1674 1912
 		{
1675 1913
 			if (isset($package_ftp) && !file_exists($destination . '/' . $entryname))
1676
-				$package_ftp->create_file($ftp_file);
1914
+			{
1915
+							$package_ftp->create_file($ftp_file);
1916
+			}
1677 1917
 			elseif (!file_exists($destination . '/' . $entryname))
1678
-				@touch($destination . '/' . $entryname);
1918
+			{
1919
+							@touch($destination . '/' . $entryname);
1920
+			}
1679 1921
 		}
1680 1922
 
1681 1923
 		package_chmod($destination . '/' . $entryname);
1682 1924
 
1683 1925
 		if (is_dir($source . '/' . $entryname))
1684
-			copytree($source . '/' . $entryname, $destination . '/' . $entryname);
1926
+		{
1927
+					copytree($source . '/' . $entryname, $destination . '/' . $entryname);
1928
+		}
1685 1929
 		elseif (file_exists($destination . '/' . $entryname))
1686
-			package_put_contents($destination . '/' . $entryname, package_get_contents($source . '/' . $entryname));
1687
-		else
1688
-			copy($source . '/' . $entryname, $destination . '/' . $entryname);
1930
+		{
1931
+					package_put_contents($destination . '/' . $entryname, package_get_contents($source . '/' . $entryname));
1932
+		}
1933
+		else {
1934
+					copy($source . '/' . $entryname, $destination . '/' . $entryname);
1935
+		}
1689 1936
 	}
1690 1937
 
1691 1938
 	closedir($current_dir);
@@ -1705,21 +1952,28 @@  discard block
 block discarded – undo
1705 1952
 
1706 1953
 	$dir = @dir($path . $sub_path);
1707 1954
 	if (!$dir)
1708
-		return array();
1955
+	{
1956
+			return array();
1957
+	}
1709 1958
 
1710 1959
 	while ($entry = $dir->read())
1711 1960
 	{
1712 1961
 		if ($entry == '.' || $entry == '..')
1713
-			continue;
1962
+		{
1963
+					continue;
1964
+		}
1714 1965
 
1715 1966
 		if (is_dir($path . $sub_path . '/' . $entry))
1716
-			$data = array_merge($data, listtree($path, $sub_path . '/' . $entry));
1717
-		else
1718
-			$data[] = array(
1967
+		{
1968
+					$data = array_merge($data, listtree($path, $sub_path . '/' . $entry));
1969
+		}
1970
+		else {
1971
+					$data[] = array(
1719 1972
 				'filename' => $sub_path == '' ? $entry : $sub_path . '/' . $entry,
1720 1973
 				'size' => filesize($path . $sub_path . '/' . $entry),
1721 1974
 				'skipped' => false,
1722 1975
 			);
1976
+		}
1723 1977
 	}
1724 1978
 	$dir->close();
1725 1979
 
@@ -1777,7 +2031,9 @@  discard block
 block discarded – undo
1777 2031
 			// If this filename is relative, if so take a guess at what it should be.
1778 2032
 			$real_filename = $filename;
1779 2033
 			if (strpos($filename, 'themes') === 0)
1780
-				$real_filename = BOARDDIR . '/' . $filename;
2034
+			{
2035
+							$real_filename = BOARDDIR . '/' . $filename;
2036
+			}
1781 2037
 
1782 2038
 			if (strpos($real_filename, $theme['theme_dir']) === 0)
1783 2039
 			{
@@ -1797,7 +2053,9 @@  discard block
 block discarded – undo
1797 2053
 		{
1798 2054
 			// Default is getting done anyway, so no need for involvement here.
1799 2055
 			if ($id == 1)
1800
-				continue;
2056
+			{
2057
+							continue;
2058
+			}
1801 2059
 
1802 2060
 			// For every template, do we want it? Yea, no, maybe?
1803 2061
 			foreach ($template_changes[1] as $index => $template_file)
@@ -1821,7 +2079,9 @@  discard block
 block discarded – undo
1821 2079
 
1822 2080
 		// Sometimes though, we have some additional files for other themes, if we have add them to the mix.
1823 2081
 		if (isset($custom_themes_add[$files_to_change[1]]))
1824
-			$files_to_change += $custom_themes_add[$files_to_change[1]];
2082
+		{
2083
+					$files_to_change += $custom_themes_add[$files_to_change[1]];
2084
+		}
1825 2085
 
1826 2086
 		// Now, loop through all the files we're changing, and, well, change them ;)
1827 2087
 		foreach ($files_to_change as $theme => $working_file)
@@ -1856,10 +2116,13 @@  discard block
 block discarded – undo
1856 2116
 			}
1857 2117
 			// Okay, we're creating this file then...?
1858 2118
 			elseif (!file_exists($working_file))
1859
-				$working_data = '';
2119
+			{
2120
+							$working_data = '';
2121
+			}
1860 2122
 			// Phew, it exists!  Load 'er up!
1861
-			else
1862
-				$working_data = str_replace("\r", '', package_get_contents($working_file));
2123
+			else {
2124
+							$working_data = str_replace("\r", '', package_get_contents($working_file));
2125
+			}
1863 2126
 
1864 2127
 			$actions[] = array(
1865 2128
 				'type' => 'opened',
@@ -1881,7 +2144,8 @@  discard block
 block discarded – undo
1881 2144
 				// Grab all search items of this operation (in most cases just 1).
1882 2145
 				$searches = $operation->set('search');
1883 2146
 				foreach ($searches as $i => $search)
1884
-					$actual_operation['searches'][] = array(
2147
+				{
2148
+									$actual_operation['searches'][] = array(
1885 2149
 						'position' => $search->exists('@position') && in_array(trim($search->fetch('@position')), array('before', 'after', 'replace', 'end')) ? trim($search->fetch('@position')) : 'replace',
1886 2150
 						'is_reg_exp' => $search->exists('@regexp') && trim($search->fetch('@regexp')) === 'true',
1887 2151
 						'loose_whitespace' => $search->exists('@whitespace') && trim($search->fetch('@whitespace')) === 'loose',
@@ -1890,6 +2154,7 @@  discard block
 block discarded – undo
1890 2154
 						'preg_search' => '',
1891 2155
 						'preg_replace' => '',
1892 2156
 					);
2157
+				}
1893 2158
 
1894 2159
 				// At least one search should be defined.
1895 2160
 				if (empty($actual_operation['searches']))
@@ -1914,12 +2179,14 @@  discard block
 block discarded – undo
1914 2179
 						if ($search['is_reg_exp'])
1915 2180
 						{
1916 2181
 							if ($actual_operation['error'] === 'fatal')
1917
-								$actions[] = array(
2182
+							{
2183
+															$actions[] = array(
1918 2184
 									'type' => 'failure',
1919 2185
 									'filename' => $working_file,
1920 2186
 									'search' => $search['search'],
1921 2187
 									'is_custom' => $theme > 1 ? $theme : 0,
1922 2188
 								);
2189
+							}
1923 2190
 
1924 2191
 							// Continue to the next operation.
1925 2192
 							continue 2;
@@ -1927,16 +2194,22 @@  discard block
 block discarded – undo
1927 2194
 
1928 2195
 						// The replacement is now the search subject...
1929 2196
 						if ($search['position'] === 'replace' || $search['position'] === 'end')
1930
-							$actual_operation['searches'][$i]['search'] = $search['add'];
2197
+						{
2198
+													$actual_operation['searches'][$i]['search'] = $search['add'];
2199
+						}
1931 2200
 						else
1932 2201
 						{
1933 2202
 							// Reversing a before/after modification becomes a replacement.
1934 2203
 							$actual_operation['searches'][$i]['position'] = 'replace';
1935 2204
 
1936 2205
 							if ($search['position'] === 'before')
1937
-								$actual_operation['searches'][$i]['search'] .= $search['add'];
2206
+							{
2207
+															$actual_operation['searches'][$i]['search'] .= $search['add'];
2208
+							}
1938 2209
 							elseif ($search['position'] === 'after')
1939
-								$actual_operation['searches'][$i]['search'] = $search['add'] . $search['search'];
2210
+							{
2211
+															$actual_operation['searches'][$i]['search'] = $search['add'] . $search['search'];
2212
+							}
1940 2213
 						}
1941 2214
 
1942 2215
 						// ...and the search subject is now the replacement.
@@ -1965,7 +2238,9 @@  discard block
 block discarded – undo
1965 2238
 				{
1966 2239
 					// Not much needed if the search subject is already a regexp.
1967 2240
 					if ($search['is_reg_exp'])
1968
-						$actual_operation['searches'][$i]['preg_search'] = $search['search'];
2241
+					{
2242
+											$actual_operation['searches'][$i]['preg_search'] = $search['search'];
2243
+					}
1969 2244
 					else
1970 2245
 					{
1971 2246
 						// Make the search subject fit into a regular expression.
@@ -1973,7 +2248,9 @@  discard block
 block discarded – undo
1973 2248
 
1974 2249
 						// Using 'loose', a random amount of tabs and spaces may be used.
1975 2250
 						if ($search['loose_whitespace'])
1976
-							$actual_operation['searches'][$i]['preg_search'] = preg_replace('~[ \t]+~', '[ \t]+', $actual_operation['searches'][$i]['preg_search']);
2251
+						{
2252
+													$actual_operation['searches'][$i]['preg_search'] = preg_replace('~[ \t]+~', '[ \t]+', $actual_operation['searches'][$i]['preg_search']);
2253
+						}
1977 2254
 					}
1978 2255
 
1979 2256
 					// Shuzzup.  This is done so we can safely use a regular expression. ($0 is bad!!)
@@ -2048,7 +2325,9 @@  discard block
 block discarded – undo
2048 2325
 
2049 2326
 					// Replace it into nothing? That's not an option...unless it's an undoing end.
2050 2327
 					if ($search['add'] === '' && ($search['position'] !== 'end' || !$undo))
2051
-						continue;
2328
+					{
2329
+											continue;
2330
+					}
2052 2331
 
2053 2332
 					// Finally, we're doing some replacements.
2054 2333
 					$working_data = preg_replace('~' . $actual_operation['searches'][$i]['preg_search'] . '~s', $actual_operation['searches'][$i]['preg_replace'], $working_data, 1);
@@ -2074,21 +2353,28 @@  discard block
 block discarded – undo
2074 2353
 			package_chmod($working_file);
2075 2354
 
2076 2355
 			if ((file_exists($working_file) && !is_writable($working_file)) || (!file_exists($working_file) && !is_writable(dirname($working_file))))
2077
-				$actions[] = array(
2356
+			{
2357
+							$actions[] = array(
2078 2358
 					'type' => 'chmod',
2079 2359
 					'filename' => $working_file
2080 2360
 				);
2361
+			}
2081 2362
 
2082 2363
 			if (basename($working_file) == 'Settings_bak.php')
2083
-				continue;
2364
+			{
2365
+							continue;
2366
+			}
2084 2367
 
2085 2368
 			if (!$testing && !empty($modSettings['package_make_backups']) && file_exists($working_file))
2086 2369
 			{
2087 2370
 				// No, no, not Settings.php!
2088 2371
 				if (basename($working_file) == 'Settings.php')
2089
-					@copy($working_file, dirname($working_file) . '/Settings_bak.php');
2090
-				else
2091
-					@copy($working_file, $working_file . '~');
2372
+				{
2373
+									@copy($working_file, dirname($working_file) . '/Settings_bak.php');
2374
+				}
2375
+				else {
2376
+									@copy($working_file, $working_file . '~');
2377
+				}
2092 2378
 			}
2093 2379
 
2094 2380
 			// Always call this, even if in testing, because it won't really be written in testing mode.
@@ -2127,16 +2413,22 @@  discard block
 block discarded – undo
2127 2413
 
2128 2414
 		// Windows doesn't seem to care about the memory_limit.
2129 2415
 		if (!empty($modSettings['package_disable_cache']) || $mem_check || stripos(PHP_OS, 'win') !== false)
2130
-			$package_cache = array();
2131
-		else
2132
-			$package_cache = false;
2416
+		{
2417
+					$package_cache = array();
2418
+		}
2419
+		else {
2420
+					$package_cache = false;
2421
+		}
2133 2422
 	}
2134 2423
 
2135 2424
 	if (strpos($filename, 'packages/') !== false || $package_cache === false || !isset($package_cache[$filename]))
2136
-		return file_get_contents($filename);
2137
-	else
2138
-		return $package_cache[$filename];
2139
-}
2425
+	{
2426
+			return file_get_contents($filename);
2427
+	}
2428
+	else {
2429
+			return $package_cache[$filename];
2430
+	}
2431
+	}
2140 2432
 
2141 2433
 /**
2142 2434
  * Writes data to a file, almost exactly like the file_put_contents() function.
@@ -2162,18 +2454,27 @@  discard block
 block discarded – undo
2162 2454
 		$mem_check = detectServer()->setMemoryLimit('128M');
2163 2455
 
2164 2456
 		if (!empty($modSettings['package_disable_cache']) || $mem_check || stripos(PHP_OS, 'win') !== false)
2165
-			$package_cache = array();
2166
-		else
2167
-			$package_cache = false;
2457
+		{
2458
+					$package_cache = array();
2459
+		}
2460
+		else {
2461
+					$package_cache = false;
2462
+		}
2168 2463
 	}
2169 2464
 
2170 2465
 	if (isset($package_ftp))
2171
-		$ftp_file = strtr($filename, array($_SESSION['pack_ftp']['root'] => ''));
2466
+	{
2467
+			$ftp_file = strtr($filename, array($_SESSION['pack_ftp']['root'] => ''));
2468
+	}
2172 2469
 
2173 2470
 	if (!file_exists($filename) && isset($package_ftp))
2174
-		$package_ftp->create_file($ftp_file);
2471
+	{
2472
+			$package_ftp->create_file($ftp_file);
2473
+	}
2175 2474
 	elseif (!file_exists($filename))
2176
-		@touch($filename);
2475
+	{
2476
+			@touch($filename);
2477
+	}
2177 2478
 
2178 2479
 	package_chmod($filename);
2179 2480
 
@@ -2183,13 +2484,17 @@  discard block
 block discarded – undo
2183 2484
 
2184 2485
 		// We should show an error message or attempt a rollback, no?
2185 2486
 		if (!$fp)
2186
-			return false;
2487
+		{
2488
+					return false;
2489
+		}
2187 2490
 
2188 2491
 		fwrite($fp, $data);
2189 2492
 		fclose($fp);
2190 2493
 	}
2191 2494
 	elseif (strpos($filename, 'packages/') !== false || $package_cache === false)
2192
-		return strlen($data);
2495
+	{
2496
+			return strlen($data);
2497
+	}
2193 2498
 	else
2194 2499
 	{
2195 2500
 		$package_cache[$filename] = $data;
@@ -2197,7 +2502,9 @@  discard block
 block discarded – undo
2197 2502
 		// Permission denied, eh?
2198 2503
 		$fp = @fopen($filename, 'r+');
2199 2504
 		if (!$fp)
2200
-			return false;
2505
+		{
2506
+					return false;
2507
+		}
2201 2508
 		fclose($fp);
2202 2509
 	}
2203 2510
 
@@ -2216,18 +2523,26 @@  discard block
 block discarded – undo
2216 2523
 	static $text_filetypes = array('php', 'txt', '.js', 'css', 'vbs', 'tml', 'htm');
2217 2524
 
2218 2525
 	if (empty($package_cache))
2219
-		return;
2526
+	{
2527
+			return;
2528
+	}
2220 2529
 
2221 2530
 	// First, let's check permissions!
2222 2531
 	foreach ($package_cache as $filename => $data)
2223 2532
 	{
2224 2533
 		if (isset($package_ftp))
2225
-			$ftp_file = strtr($filename, array($_SESSION['pack_ftp']['root'] => ''));
2534
+		{
2535
+					$ftp_file = strtr($filename, array($_SESSION['pack_ftp']['root'] => ''));
2536
+		}
2226 2537
 
2227 2538
 		if (!file_exists($filename) && isset($package_ftp))
2228
-			$package_ftp->create_file($ftp_file);
2539
+		{
2540
+					$package_ftp->create_file($ftp_file);
2541
+		}
2229 2542
 		elseif (!file_exists($filename))
2230
-			@touch($filename);
2543
+		{
2544
+					@touch($filename);
2545
+		}
2231 2546
 
2232 2547
 		$result = package_chmod($filename);
2233 2548
 
@@ -2279,7 +2594,9 @@  discard block
 block discarded – undo
2279 2594
 	global $package_ftp;
2280 2595
 
2281 2596
 	if (file_exists($filename) && is_writable($filename) && $perm_state == 'writable')
2282
-		return true;
2597
+	{
2598
+			return true;
2599
+	}
2283 2600
 
2284 2601
 	// Start off checking without FTP.
2285 2602
 	if (!isset($package_ftp) || $package_ftp === false)
@@ -2313,23 +2630,34 @@  discard block
 block discarded – undo
2313 2630
 					@touch($chmod_file);
2314 2631
 					elk_chmod($chmod_file, 0755);
2315 2632
 				}
2316
-				else
2317
-					$file_permissions = @fileperms($chmod_file);
2633
+				else {
2634
+									$file_permissions = @fileperms($chmod_file);
2635
+				}
2318 2636
 			}
2319 2637
 
2320 2638
 			// This looks odd, but it's another attempt to work around PHP suExec.
2321 2639
 			if ($perm_state != 'writable')
2322
-				elk_chmod($chmod_file, $perm_state == 'execute' ? 0755 : 0644);
2640
+			{
2641
+							elk_chmod($chmod_file, $perm_state == 'execute' ? 0755 : 0644);
2642
+			}
2323 2643
 			else
2324 2644
 			{
2325 2645
 				if (!@is_writable($chmod_file))
2326
-					elk_chmod($chmod_file, 0755);
2646
+				{
2647
+									elk_chmod($chmod_file, 0755);
2648
+				}
2327 2649
 				if (!@is_writable($chmod_file))
2328
-					elk_chmod($chmod_file, 0777);
2650
+				{
2651
+									elk_chmod($chmod_file, 0777);
2652
+				}
2329 2653
 				if (!@is_writable(dirname($chmod_file)))
2330
-					elk_chmod($chmod_file, 0755);
2654
+				{
2655
+									elk_chmod($chmod_file, 0755);
2656
+				}
2331 2657
 				if (!@is_writable(dirname($chmod_file)))
2332
-					elk_chmod($chmod_file, 0777);
2658
+				{
2659
+									elk_chmod($chmod_file, 0777);
2660
+				}
2333 2661
 			}
2334 2662
 
2335 2663
 			// The ultimate writable test.
@@ -2339,19 +2667,26 @@  discard block
 block discarded – undo
2339 2667
 				if (@is_writable($chmod_file) && $fp)
2340 2668
 				{
2341 2669
 					if (!is_dir($chmod_file))
2342
-						fclose($fp);
2343
-					else
2344
-						closedir($fp);
2670
+					{
2671
+											fclose($fp);
2672
+					}
2673
+					else {
2674
+											closedir($fp);
2675
+					}
2345 2676
 
2346 2677
 					// It worked!
2347 2678
 					if ($track_change)
2348
-						$_SESSION['pack_ftp']['original_perms'][$chmod_file] = $file_permissions;
2679
+					{
2680
+											$_SESSION['pack_ftp']['original_perms'][$chmod_file] = $file_permissions;
2681
+					}
2349 2682
 
2350 2683
 					return true;
2351 2684
 				}
2352 2685
 			}
2353 2686
 			elseif ($perm_state != 'writable' && isset($_SESSION['pack_ftp']['original_perms'][$chmod_file]))
2354
-				unset($_SESSION['pack_ftp']['original_perms'][$chmod_file]);
2687
+			{
2688
+							unset($_SESSION['pack_ftp']['original_perms'][$chmod_file]);
2689
+			}
2355 2690
 		}
2356 2691
 
2357 2692
 		// If we're here we're a failure.
@@ -2371,8 +2706,9 @@  discard block
 block discarded – undo
2371 2706
 			$package_ftp->create_file($ftp_file);
2372 2707
 			$package_ftp->chmod($ftp_file, 0755);
2373 2708
 		}
2374
-		else
2375
-			$file_permissions = @fileperms($filename);
2709
+		else {
2710
+					$file_permissions = @fileperms($filename);
2711
+		}
2376 2712
 
2377 2713
 		if ($perm_state != 'writable')
2378 2714
 		{
@@ -2381,20 +2717,28 @@  discard block
 block discarded – undo
2381 2717
 		else
2382 2718
 		{
2383 2719
 			if (!@is_writable($filename))
2384
-				$package_ftp->chmod($ftp_file, 0777);
2720
+			{
2721
+							$package_ftp->chmod($ftp_file, 0777);
2722
+			}
2385 2723
 			if (!@is_writable(dirname($filename)))
2386
-				$package_ftp->chmod(dirname($ftp_file), 0777);
2724
+			{
2725
+							$package_ftp->chmod(dirname($ftp_file), 0777);
2726
+			}
2387 2727
 		}
2388 2728
 
2389 2729
 		if (@is_writable($filename))
2390 2730
 		{
2391 2731
 			if ($track_change)
2392
-				$_SESSION['pack_ftp']['original_perms'][$filename] = $file_permissions;
2732
+			{
2733
+							$_SESSION['pack_ftp']['original_perms'][$filename] = $file_permissions;
2734
+			}
2393 2735
 
2394 2736
 			return true;
2395 2737
 		}
2396 2738
 		elseif ($perm_state != 'writable' && isset($_SESSION['pack_ftp']['original_perms'][$filename]))
2397
-			unset($_SESSION['pack_ftp']['original_perms'][$filename]);
2739
+		{
2740
+					unset($_SESSION['pack_ftp']['original_perms'][$filename]);
2741
+		}
2398 2742
 	}
2399 2743
 
2400 2744
 	// Oh dear, we failed if we get here.
@@ -2414,10 +2758,14 @@  discard block
 block discarded – undo
2414 2758
 
2415 2759
 	$salt = session_id();
2416 2760
 	while (strlen($salt) < $n)
2417
-		$salt .= session_id();
2761
+	{
2762
+			$salt .= session_id();
2763
+	}
2418 2764
 
2419 2765
 	for ($i = 0; $i < $n; $i++)
2420
-		$pass[$i] = chr(ord($pass[$i]) ^ (ord($salt[$i]) - 32));
2766
+	{
2767
+			$pass[$i] = chr(ord($pass[$i]) ^ (ord($salt[$i]) - 32));
2768
+	}
2421 2769
 
2422 2770
 	return $pass;
2423 2771
 }
@@ -2441,7 +2789,9 @@  discard block
 block discarded – undo
2441 2789
 	foreach ($base_files as $file)
2442 2790
 	{
2443 2791
 		if (file_exists(BOARDDIR . '/' . $file))
2444
-			$files[$use_relative_paths ? $file : realpath(BOARDDIR . '/' . $file)] = BOARDDIR . '/' . $file;
2792
+		{
2793
+					$files[$use_relative_paths ? $file : realpath(BOARDDIR . '/' . $file)] = BOARDDIR . '/' . $file;
2794
+		}
2445 2795
 	}
2446 2796
 
2447 2797
 	// Root directory where most of our files reside
@@ -2461,7 +2811,9 @@  discard block
 block discarded – undo
2461 2811
 		)
2462 2812
 	);
2463 2813
 	while ($row = $db->fetch_assoc($request))
2464
-		$dirs[$row['value']] = $use_relative_paths ? 'themes/' . basename($row['value']) . '/' : strtr($row['value'] . '/', '\\', '/');
2814
+	{
2815
+			$dirs[$row['value']] = $use_relative_paths ? 'themes/' . basename($row['value']) . '/' : strtr($row['value'] . '/', '\\', '/');
2816
+	}
2465 2817
 	$db->free_result($request);
2466 2818
 
2467 2819
 	try
@@ -2477,10 +2829,14 @@  discard block
 block discarded – undo
2477 2829
 			foreach ($iter as $entry => $dir)
2478 2830
 			{
2479 2831
 				if ($dir->isDir())
2480
-					continue;
2832
+				{
2833
+									continue;
2834
+				}
2481 2835
 
2482 2836
 				if (preg_match('~^(\.{1,2}|CVS|backup.*|help|images|.*\~)$~', $entry) != 0)
2483
-					continue;
2837
+				{
2838
+									continue;
2839
+				}
2484 2840
 
2485 2841
 				$files[$use_relative_paths ? str_replace(realpath(BOARDDIR), '', $entry) : $entry] = $entry;
2486 2842
 			}
@@ -2488,10 +2844,14 @@  discard block
 block discarded – undo
2488 2844
 
2489 2845
 		// Make sure we have a backup directory and its writable
2490 2846
 		if (!file_exists(BOARDDIR . '/packages/backups'))
2491
-			mktree(BOARDDIR . '/packages/backups', 0777);
2847
+		{
2848
+					mktree(BOARDDIR . '/packages/backups', 0777);
2849
+		}
2492 2850
 
2493 2851
 		if (!is_writable(BOARDDIR . '/packages/backups'))
2494
-			package_chmod(BOARDDIR . '/packages/backups');
2852
+		{
2853
+					package_chmod(BOARDDIR . '/packages/backups');
2854
+		}
2495 2855
 
2496 2856
 		// Name the output file, yyyy-mm-dd_before_package_name.tar.gz
2497 2857
 		$output_file = BOARDDIR . '/packages/backups/' . Util::strftime('%Y-%m-%d_') . preg_replace('~[$\\\\/:<>|?*"\']~', '', $id);
@@ -2501,11 +2861,14 @@  discard block
 block discarded – undo
2501 2861
 		{
2502 2862
 			$i = 2;
2503 2863
 			while (file_exists($output_file . '_' . $i . $output_ext . '.gz'))
2504
-				$i++;
2864
+			{
2865
+							$i++;
2866
+			}
2505 2867
 			$output_file = $output_file . '_' . $i . $output_ext;
2506 2868
 		}
2507
-		else
2508
-			$output_file .= $output_ext;
2869
+		else {
2870
+					$output_file .= $output_ext;
2871
+		}
2509 2872
 
2510 2873
 		// Buy some more time so we have enough to create this archive
2511 2874
 		detectServer()->setTimeLimit(300);
@@ -2555,13 +2918,17 @@  discard block
 block discarded – undo
2555 2918
 
2556 2919
 	// An FTP url. We should try connecting and RETRieving it...
2557 2920
 	if (empty($match[1]))
2558
-		return false;
2921
+	{
2922
+			return false;
2923
+	}
2559 2924
 	elseif ($match[1] == 'ftp')
2560 2925
 	{
2561 2926
 		// Establish a connection and attempt to enable passive mode.
2562 2927
 		$ftp = new Ftp_Connection(($match[2] ? 'ssl://' : '') . $match[3], empty($match[5]) ? 21 : $match[5], 'anonymous', $webmaster_email);
2563 2928
 		if ($ftp->error !== false || !$ftp->passive())
2564
-			return false;
2929
+		{
2930
+					return false;
2931
+		}
2565 2932
 
2566 2933
 		// I want that one *points*!
2567 2934
 		fwrite($ftp->connection, 'RETR ' . $match[6] . "\r\n");
@@ -2569,14 +2936,18 @@  discard block
 block discarded – undo
2569 2936
 		// Since passive mode worked (or we would have returned already!) open the connection.
2570 2937
 		$fp = @fsockopen($ftp->pasv['ip'], $ftp->pasv['port'], $err, $err, 5);
2571 2938
 		if (!$fp)
2572
-			return false;
2939
+		{
2940
+					return false;
2941
+		}
2573 2942
 
2574 2943
 		// The server should now say something in acknowledgement.
2575 2944
 		$ftp->check_response(150);
2576 2945
 
2577 2946
 		$data = '';
2578 2947
 		while (!feof($fp))
2579
-			$data .= fread($fp, 4096);
2948
+		{
2949
+					$data .= fread($fp, 4096);
2950
+		}
2580 2951
 		fclose($fp);
2581 2952
 
2582 2953
 		// All done, right?  Good.
@@ -2591,21 +2962,28 @@  discard block
 block discarded – undo
2591 2962
 
2592 2963
 		// no errors and a 200 result, then we have a good dataset, well we at least have data ;)
2593 2964
 		if ($fetch_data->result('code') == 200 && !$fetch_data->result('error'))
2594
-			$data = $fetch_data->result('body');
2595
-		else
2596
-			return false;
2965
+		{
2966
+					$data = $fetch_data->result('body');
2967
+		}
2968
+		else {
2969
+					return false;
2970
+		}
2597 2971
 	}
2598 2972
 	// This is more likely; a standard HTTP URL.
2599 2973
 	elseif (isset($match[1]) && $match[1] == 'http')
2600 2974
 	{
2601 2975
 		if ($keep_alive && $match[3] == $keep_alive_dom)
2602
-			$fp = $keep_alive_fp;
2976
+		{
2977
+					$fp = $keep_alive_fp;
2978
+		}
2603 2979
 		if (empty($fp))
2604 2980
 		{
2605 2981
 			// Open the socket on the port we want...
2606 2982
 			$fp = @fsockopen(($match[2] ? 'ssl://' : '') . $match[3], empty($match[5]) ? ($match[2] ? 443 : 80) : $match[5], $err, $err, 5);
2607 2983
 			if (!$fp)
2608
-				return false;
2984
+			{
2985
+							return false;
2986
+			}
2609 2987
 		}
2610 2988
 
2611 2989
 		if ($keep_alive)
@@ -2621,9 +2999,12 @@  discard block
 block discarded – undo
2621 2999
 			fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
2622 3000
 			fwrite($fp, 'User-Agent: PHP/ELK' . "\r\n");
2623 3001
 			if ($keep_alive)
2624
-				fwrite($fp, 'Connection: Keep-Alive' . "\r\n\r\n");
2625
-			else
2626
-				fwrite($fp, 'Connection: close' . "\r\n\r\n");
3002
+			{
3003
+							fwrite($fp, 'Connection: Keep-Alive' . "\r\n\r\n");
3004
+			}
3005
+			else {
3006
+							fwrite($fp, 'Connection: close' . "\r\n\r\n");
3007
+			}
2627 3008
 		}
2628 3009
 		else
2629 3010
 		{
@@ -2631,9 +3012,12 @@  discard block
 block discarded – undo
2631 3012
 			fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
2632 3013
 			fwrite($fp, 'User-Agent: PHP/ELK' . "\r\n");
2633 3014
 			if ($keep_alive)
2634
-				fwrite($fp, 'Connection: Keep-Alive' . "\r\n");
2635
-			else
2636
-				fwrite($fp, 'Connection: close' . "\r\n");
3015
+			{
3016
+							fwrite($fp, 'Connection: Keep-Alive' . "\r\n");
3017
+			}
3018
+			else {
3019
+							fwrite($fp, 'Connection: close' . "\r\n");
3020
+			}
2637 3021
 			fwrite($fp, 'Content-Type: application/x-www-form-urlencoded' . "\r\n");
2638 3022
 			fwrite($fp, 'Content-Length: ' . strlen($post_data) . "\r\n\r\n");
2639 3023
 			fwrite($fp, $post_data);
@@ -2646,28 +3030,38 @@  discard block
 block discarded – undo
2646 3030
 		{
2647 3031
 			$location = '';
2648 3032
 			while (!feof($fp) && trim($header = fgets($fp, 4096)) != '')
2649
-				if (strpos($header, 'Location:') !== false)
3033
+			{
3034
+							if (strpos($header, 'Location:') !== false)
2650 3035
 					$location = trim(substr($header, strpos($header, ':') + 1));
3036
+			}
2651 3037
 
2652 3038
 			if (empty($location))
2653
-				return false;
3039
+			{
3040
+							return false;
3041
+			}
2654 3042
 			else
2655 3043
 			{
2656 3044
 				if (!$keep_alive)
2657
-					fclose($fp);
3045
+				{
3046
+									fclose($fp);
3047
+				}
2658 3048
 				return fetch_web_data($location, $post_data, $keep_alive, $redirection_level + 1);
2659 3049
 			}
2660 3050
 		}
2661 3051
 
2662 3052
 		// Make sure we get a 200 OK.
2663 3053
 		elseif (preg_match('~^HTTP/\S+\s+20[01]~i', $response) === 0)
2664
-			return false;
3054
+		{
3055
+					return false;
3056
+		}
2665 3057
 
2666 3058
 		// Skip the headers...
2667 3059
 		while (!feof($fp) && trim($header = fgets($fp, 4096)) != '')
2668 3060
 		{
2669 3061
 			if (preg_match('~content-length:\s*(\d+)~i', $header, $match) != 0)
2670
-				$content_length = $match[1];
3062
+			{
3063
+							$content_length = $match[1];
3064
+			}
2671 3065
 			elseif (preg_match('~connection:\s*close~i', $header) != 0)
2672 3066
 			{
2673 3067
 				$keep_alive_dom = null;
@@ -2681,16 +3075,22 @@  discard block
 block discarded – undo
2681 3075
 		if (isset($content_length))
2682 3076
 		{
2683 3077
 			while (!feof($fp) && strlen($data) < $content_length)
2684
-				$data .= fread($fp, $content_length - strlen($data));
3078
+			{
3079
+							$data .= fread($fp, $content_length - strlen($data));
3080
+			}
2685 3081
 		}
2686 3082
 		else
2687 3083
 		{
2688 3084
 			while (!feof($fp))
2689
-				$data .= fread($fp, 4096);
3085
+			{
3086
+							$data .= fread($fp, 4096);
3087
+			}
2690 3088
 		}
2691 3089
 
2692 3090
 		if (!$keep_alive)
2693
-			fclose($fp);
3091
+		{
3092
+					fclose($fp);
3093
+		}
2694 3094
 	}
2695 3095
 	else
2696 3096
 	{
@@ -2727,7 +3127,9 @@  discard block
 block discarded – undo
2727 3127
 	);
2728 3128
 
2729 3129
 	if (empty($id))
2730
-		return $result;
3130
+	{
3131
+			return $result;
3132
+	}
2731 3133
 
2732 3134
 	// See if it is installed?
2733 3135
 	$request = $db->query('', '
@@ -2812,7 +3214,9 @@  discard block
 block discarded – undo
2812 3214
 		)
2813 3215
 	);
2814 3216
 	while ($row = $db->fetch_row($request))
2815
-		list ($version) = $row;
3217
+	{
3218
+			list ($version) = $row;
3219
+	}
2816 3220
 	$db->free_result($request);
2817 3221
 
2818 3222
 	return $version;
@@ -2884,11 +3288,15 @@  discard block
 block discarded – undo
2884 3288
 	// Know addon servers
2885 3289
 	$servers = Util::unserialize($modSettings['authorized_package_servers']);
2886 3290
 	if (empty($servers))
2887
-		return false;
3291
+	{
3292
+			return false;
3293
+	}
2888 3294
 
2889 3295
 	foreach ($servers as $server)
2890
-		if (preg_match('~^' . preg_quote($server) . '~', $remote_url) == 0)
3296
+	{
3297
+			if (preg_match('~^' . preg_quote($server) . '~', $remote_url) == 0)
2891 3298
 			return true;
3299
+	}
2892 3300
 
2893 3301
 	return false;
2894 3302
 }
@@ -2923,9 +3331,13 @@  discard block
 block discarded – undo
2923 3331
 
2924 3332
 	// Make sure we have a form of 0777 or '777' or '0777' so its safe for intval '8'
2925 3333
 	if (($mode % 10) >= 8)
2926
-		$mode = decoct($mode);
3334
+	{
3335
+			$mode = decoct($mode);
3336
+	}
2927 3337
 	if ($mode == decoct(octdec($mode)))
2928
-		$result = @chmod($file, intval($mode, 8));
3338
+	{
3339
+			$result = @chmod($file, intval($mode, 8));
3340
+	}
2929 3341
 
2930 3342
 	return $result;
2931 3343
 }
Please login to merge, or discard this patch.
sources/subs/Search/Search.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -514,7 +514,9 @@  discard block
 block discarded – undo
514 514
 		else
515 515
 		{
516 516
 			foreach ($this->_searchArray as $index => $value)
517
-				$orParts[$index] = array($value);
517
+			{
518
+							$orParts[$index] = array($value);
519
+			}
518 520
 		}
519 521
 
520 522
 		// Make sure the excluded words are in all or-branches.
@@ -612,7 +614,9 @@  discard block
 block discarded – undo
612 614
 		}
613 615
 
614 616
 		foreach ($temp_params as $k => $v)
615
-			$encoded[] = $k . '|\'|' . $v;
617
+		{
618
+					$encoded[] = $k . '|\'|' . $v;
619
+		}
616 620
 
617 621
 		if (!empty($encoded))
618 622
 		{
@@ -766,12 +770,14 @@  discard block
 block discarded – undo
766 770
 			// Create a list of database-escaped search names.
767 771
 			$realNameMatches = array();
768 772
 			foreach ($possible_users as $possible_user)
769
-				$realNameMatches[] = $this->_db->quote(
773
+			{
774
+							$realNameMatches[] = $this->_db->quote(
770 775
 					'{string:possible_user}',
771 776
 					array(
772 777
 						'possible_user' => $possible_user
773 778
 					)
774 779
 				);
780
+			}
775 781
 
776 782
 			// Retrieve a list of possible members.
777 783
 			$request = $this->_db->query('', '
@@ -889,7 +895,9 @@  discard block
 block discarded – undo
889 895
 		if (count($this->_search_params['brd']) != 0)
890 896
 		{
891 897
 			foreach ($this->_search_params['brd'] as $k => $v)
892
-				$this->_search_params['brd'][$k] = (int) $v;
898
+			{
899
+							$this->_search_params['brd'][$k] = (int) $v;
900
+			}
893 901
 
894 902
 			// If we've selected all boards, this parameter can be left empty.
895 903
 			require_once(SUBSDIR . '/Boards.subs.php');
@@ -1510,7 +1518,9 @@  discard block
 block discarded – undo
1510 1518
 		);
1511 1519
 		$posters = array();
1512 1520
 		while ($row = $this->_db->fetch_assoc($request))
1513
-			$posters[] = $row['id_member'];
1521
+		{
1522
+					$posters[] = $row['id_member'];
1523
+		}
1514 1524
 		$this->_db->free_result($request);
1515 1525
 
1516 1526
 		return $posters;
@@ -1957,7 +1967,9 @@  discard block
 block discarded – undo
1957 1967
 
1958 1968
 				$usedIDs[$row['id_topic']] = true;
1959 1969
 				foreach ($row as $key => $value)
1960
-					$inserts[$row['id_topic']][] = (int) $row[$key];
1970
+				{
1971
+									$inserts[$row['id_topic']][] = (int) $row[$key];
1972
+				}
1961 1973
 			}
1962 1974
 			$this->_db->free_result($ignoreRequest);
1963 1975
 
@@ -1966,7 +1978,9 @@  discard block
 block discarded – undo
1966 1978
 			{
1967 1979
 				$query_columns = array();
1968 1980
 				foreach ($main_query['select'] as $k => $v)
1969
-					$query_columns[$k] = 'int';
1981
+				{
1982
+									$query_columns[$k] = 'int';
1983
+				}
1970 1984
 
1971 1985
 				$this->_db->insert('',
1972 1986
 					'{db_prefix}log_search_results',
Please login to merge, or discard this patch.
sources/database/Db-postgresql.class.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1078,13 +1078,13 @@
 block discarded – undo
1078 1078
 	{
1079 1079
 		global $db_row_count;
1080 1080
 
1081
-		if(!is_resource($resource) && ($resource instanceof \PgSql\Result))
1081
+		if (!is_resource($resource) && ($resource instanceof \PgSql\Result))
1082 1082
 		{
1083 1083
 			$id = spl_object_id($resource);
1084 1084
 		}
1085 1085
 		else
1086 1086
 		{
1087
-			$id = (int)$resource;
1087
+			$id = (int) $resource;
1088 1088
 		}
1089 1089
 
1090 1090
 		return $id;
Please login to merge, or discard this patch.
Braces   +161 added lines, -61 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 // Let's define the name of the class so that we will be able to use it in the instantiations
19 19
 if (!defined('DB_TYPE'))
20
+{
20 21
 	define('DB_TYPE', 'PostgreSQL');
22
+}
21 23
 
22 24
 /**
23 25
  * PostgreSQL database class, implements database class to control mysql functions
@@ -67,25 +69,36 @@  discard block
 block discarded – undo
67 69
 	{
68 70
 		// initialize the instance... if not done already!
69 71
 		if (self::$_db === null)
70
-			self::$_db = new self();
72
+		{
73
+					self::$_db = new self();
74
+		}
71 75
 
72 76
 		if (!empty($db_options['port']))
73
-			$db_port = ' port=' . (int) $db_options['port'];
74
-		else
75
-			$db_port = '';
77
+		{
78
+					$db_port = ' port=' . (int) $db_options['port'];
79
+		}
80
+		else {
81
+					$db_port = '';
82
+		}
76 83
 
77 84
 		if (!empty($db_options['persist']))
78
-			$connection = @pg_pconnect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'');
79
-		else
80
-			$connection = @pg_connect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'');
85
+		{
86
+					$connection = @pg_pconnect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'');
87
+		}
88
+		else {
89
+					$connection = @pg_connect('host=' . $db_server . $db_port . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'');
90
+		}
81 91
 
82 92
 		// Something's wrong, show an error if its fatal (which we assume it is)
83 93
 		if (!$connection)
84 94
 		{
85 95
 			if (!empty($db_options['non_fatal']))
86
-				return null;
87
-			else
88
-				Errors::instance()->display_db_error();
96
+			{
97
+							return null;
98
+			}
99
+			else {
100
+							Errors::instance()->display_db_error();
101
+			}
89 102
 		}
90 103
 
91 104
 		self::$_db->_connection = $connection;
@@ -179,13 +192,17 @@  discard block
 block discarded – undo
179 192
 		);
180 193
 
181 194
 		if (isset($replacements[$identifier]))
182
-			$db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string);
195
+		{
196
+					$db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string);
197
+		}
183 198
 
184 199
 		// Limits need to be a little different.
185 200
 		$db_string = preg_replace('~\sLIMIT\s(\d+|{int:.+}),\s*(\d+|{int:.+})(.*)~i', 'LIMIT $2 OFFSET $1 $3', $db_string);
186 201
 
187 202
 		if (trim($db_string) == '')
188
-			return false;
203
+		{
204
+					return false;
205
+		}
189 206
 
190 207
 		// Comments that are allowed in a query are preg_removed.
191 208
 		static $allowed_comments_from = array(
@@ -206,7 +223,9 @@  discard block
 block discarded – undo
206 223
 		$this->_db_replace_result = null;
207 224
 
208 225
 		if (empty($modSettings['disableQueryCheck']) && strpos($db_string, '\'') !== false && empty($db_values['security_override']))
209
-			$this->error_backtrace('Hacking attempt...', 'Illegal character (\') used in query...', true, __FILE__, __LINE__);
226
+		{
227
+					$this->error_backtrace('Hacking attempt...', 'Illegal character (\') used in query...', true, __FILE__, __LINE__);
228
+		}
210 229
 
211 230
 		if (empty($db_values['security_override']) && (!empty($db_values) || strpos($db_string, '{db_prefix}') !== false))
212 231
 		{
@@ -257,7 +276,9 @@  discard block
 block discarded – undo
257 276
 			{
258 277
 				$pos = strpos($db_string, '\'', $pos + 1);
259 278
 				if ($pos === false)
260
-					break;
279
+				{
280
+									break;
281
+				}
261 282
 				$clean .= substr($db_string, $old_pos, $pos - $old_pos);
262 283
 
263 284
 				while (true)
@@ -266,7 +287,9 @@  discard block
 block discarded – undo
266 287
 					$pos2 = strpos($db_string, '\'\'', $pos + 1);
267 288
 
268 289
 					if ($pos1 === false)
269
-						break;
290
+					{
291
+											break;
292
+					}
270 293
 					elseif ($pos2 === false || $pos2 > $pos1)
271 294
 					{
272 295
 						$pos = $pos1;
@@ -285,19 +308,29 @@  discard block
 block discarded – undo
285 308
 
286 309
 			// Comments?  We don't use comments in our queries, we leave 'em outside!
287 310
 			if (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false)
288
-				$fail = true;
311
+			{
312
+							$fail = true;
313
+			}
289 314
 			// Trying to change passwords, slow us down, or something?
290 315
 			elseif (strpos($clean, 'sleep') !== false && preg_match('~(^|[^a-z])sleep($|[^[_a-z])~s', $clean) != 0)
291
-				$fail = true;
316
+			{
317
+							$fail = true;
318
+			}
292 319
 			elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
293
-				$fail = true;
320
+			{
321
+							$fail = true;
322
+			}
294 323
 
295 324
 			if (!empty($fail) && class_exists('Errors'))
296
-				$this->error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__);
325
+			{
326
+							$this->error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__);
327
+			}
297 328
 
298 329
 			// If we are updating something, better start a transaction so that indexes may be kept consistent
299 330
 			if (!$this->_in_transaction && strpos($clean, 'update') !== false)
300
-				$this->db_transaction('begin', $connection);
331
+			{
332
+							$this->db_transaction('begin', $connection);
333
+			}
301 334
 		}
302 335
 
303 336
 		$this->_db_last_result = @pg_query($connection, $db_string);
@@ -320,7 +353,9 @@  discard block
 block discarded – undo
320 353
 		}
321 354
 
322 355
 		if ($this->_in_transaction)
323
-			$this->db_transaction('commit', $connection);
356
+		{
357
+					$this->db_transaction('commit', $connection);
358
+		}
324 359
 
325 360
 		// Debugging.
326 361
 		if ($db_show_debug === true)
@@ -340,9 +375,13 @@  discard block
 block discarded – undo
340 375
 	public function affected_rows($result = null)
341 376
 	{
342 377
 		if ($this->_db_replace_result !== null)
343
-			return $this->_db_replace_result;
378
+		{
379
+					return $this->_db_replace_result;
380
+		}
344 381
 		elseif ($result === null && !$this->_db_last_result)
345
-			return 0;
382
+		{
383
+					return 0;
384
+		}
346 385
 
347 386
 		return pg_affected_rows($result === null ? $this->_db_last_result : $result);
348 387
 	}
@@ -371,7 +410,9 @@  discard block
 block discarded – undo
371 410
 		);
372 411
 
373 412
 		if (!$request)
374
-			return false;
413
+		{
414
+					return false;
415
+		}
375 416
 
376 417
 		list ($lastID) = $this->fetch_row($request);
377 418
 		$this->free_result($request);
@@ -391,11 +432,15 @@  discard block
 block discarded – undo
391 432
 		global $db_row_count;
392 433
 
393 434
 		if ($counter !== false)
394
-			return pg_fetch_row($result, $counter);
435
+		{
436
+					return pg_fetch_row($result, $counter);
437
+		}
395 438
 
396 439
 		// Reset the row counter...
397 440
 		if (!isset($db_row_count[$this->seekCounter($result)]))
398
-			$db_row_count[$this->seekCounter($result)] = 0;
441
+		{
442
+					$db_row_count[$this->seekCounter($result)] = 0;
443
+		}
399 444
 
400 445
 		// Return the right row.
401 446
 		return @pg_fetch_row($result, $db_row_count[$this->seekCounter($result)]++);
@@ -413,7 +458,9 @@  discard block
 block discarded – undo
413 458
 		$id = $this->seekCounter($result);
414 459
 		// Reset the row counter...
415 460
 		if (isset($db_row_count[$id]))
416
-			unset($db_row_count[$id]);
461
+		{
462
+					unset($db_row_count[$id]);
463
+		}
417 464
 
418 465
 		// Just delegate to the native function
419 466
 		pg_free_result($result);
@@ -472,7 +519,9 @@  discard block
 block discarded – undo
472 519
 			return @pg_query($connection, 'BEGIN');
473 520
 		}
474 521
 		elseif ($type == 'rollback')
475
-			return @pg_query($connection, 'ROLLBACK');
522
+		{
523
+					return @pg_query($connection, 'ROLLBACK');
524
+		}
476 525
 		elseif ($type == 'commit')
477 526
 		{
478 527
 			$this->_in_transaction = false;
@@ -493,7 +542,9 @@  discard block
 block discarded – undo
493 542
 		$connection = $connection === null ? $this->_connection : $connection;
494 543
 
495 544
 		if (is_resource($connection) || $connection instanceof \PgSql\Connection)
496
-			return pg_last_error($connection);
545
+		{
546
+					return pg_last_error($connection);
547
+		}
497 548
 	}
498 549
 
499 550
 	/**
@@ -526,21 +577,30 @@  discard block
 block discarded – undo
526 577
 
527 578
 		// Nothing's defined yet... just die with it.
528 579
 		if (empty($context) || empty($txt))
529
-			die($query_error);
580
+		{
581
+					die($query_error);
582
+		}
530 583
 
531 584
 		// Show an error message, if possible.
532 585
 		$context['error_title'] = $txt['database_error'];
533 586
 		if (allowedTo('admin_forum'))
534
-			$context['error_message'] = nl2br($query_error) . '<br />' . $txt['file'] . ': ' . $file . '<br />' . $txt['line'] . ': ' . $line;
535
-		else
536
-			$context['error_message'] = $txt['try_again'];
587
+		{
588
+					$context['error_message'] = nl2br($query_error) . '<br />' . $txt['file'] . ': ' . $file . '<br />' . $txt['line'] . ': ' . $line;
589
+		}
590
+		else {
591
+					$context['error_message'] = $txt['try_again'];
592
+		}
537 593
 
538 594
 		// Add database version that we know of, for the admin to know. (and ask for support)
539 595
 		if (allowedTo('admin_forum'))
540
-			$context['error_message'] .= '<br /><br />' . sprintf($txt['database_error_versions'], $modSettings['elkVersion']);
596
+		{
597
+					$context['error_message'] .= '<br /><br />' . sprintf($txt['database_error_versions'], $modSettings['elkVersion']);
598
+		}
541 599
 
542 600
 		if (allowedTo('admin_forum') && $db_show_debug === true)
543
-			$context['error_message'] .= '<br /><br />' . nl2br($db_string);
601
+		{
602
+					$context['error_message'] .= '<br /><br />' . nl2br($db_string);
603
+		}
544 604
 
545 605
 		// It's already been logged... don't log it again.
546 606
 		throw new Elk_Exception($context['error_message'], false);
@@ -566,11 +626,15 @@  discard block
 block discarded – undo
566 626
 
567 627
 		// With nothing to insert, simply return.
568 628
 		if (empty($data))
569
-			return;
629
+		{
630
+					return;
631
+		}
570 632
 
571 633
 		// Inserting data as a single row can be done as a single array.
572 634
 		if (!is_array($data[array_rand($data)]))
573
-			$data = array($data);
635
+		{
636
+					$data = array($data);
637
+		}
574 638
 
575 639
 		// Replace the prefix holder with the actual prefix.
576 640
 		$table = str_replace('{db_prefix}', $db_prefix, $table);
@@ -592,13 +656,18 @@  discard block
 block discarded – undo
592 656
 			{
593 657
 				// Are we restricting the length?
594 658
 				if (strpos($type, 'string-') !== false)
595
-					$actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $count);
596
-				else
597
-					$actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $count);
659
+				{
660
+									$actualType = sprintf($columnName . ' = SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $count);
661
+				}
662
+				else {
663
+									$actualType = sprintf($columnName . ' = {%1$s:%2$s}, ', $type, $count);
664
+				}
598 665
 
599 666
 				// A key? That's what we were looking for.
600 667
 				if (in_array($columnName, $keys))
601
-					$where .= (empty($where) ? '' : ' AND ') . substr($actualType, 0, -2);
668
+				{
669
+									$where .= (empty($where) ? '' : ' AND ') . substr($actualType, 0, -2);
670
+				}
602 671
 				$count++;
603 672
 			}
604 673
 
@@ -625,9 +694,12 @@  discard block
 block discarded – undo
625 694
 			{
626 695
 				// Are we restricting the length?
627 696
 				if (strpos($type, 'string-') !== false)
628
-					$insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName);
629
-				else
630
-					$insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName);
697
+				{
698
+									$insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName);
699
+				}
700
+				else {
701
+									$insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName);
702
+				}
631 703
 			}
632 704
 			$insertData = substr($insertData, 0, -2) . ')';
633 705
 
@@ -637,7 +709,9 @@  discard block
 block discarded – undo
637 709
 			// Here's where the variables are injected to the query.
638 710
 			$insertRows = array();
639 711
 			foreach ($data as $dataRow)
640
-				$insertRows[] = $this->quote($insertData, $this->_array_combine($indexed_columns, $dataRow), $connection);
712
+			{
713
+							$insertRows[] = $this->quote($insertData, $this->_array_combine($indexed_columns, $dataRow), $connection);
714
+			}
641 715
 
642 716
 			$inserted_results = 0;
643 717
 			$skip_error = $method == 'ignore' || $table === $db_prefix . 'log_errors';
@@ -658,11 +732,15 @@  discard block
 block discarded – undo
658 732
 				$inserted_results += (!$this->_db_last_result ? 0 : pg_affected_rows($this->_db_last_result));
659 733
 			}
660 734
 			if (isset($db_replace_result))
661
-				$this->_db_replace_result = $db_replace_result + $inserted_results;
735
+			{
736
+							$this->_db_replace_result = $db_replace_result + $inserted_results;
737
+			}
662 738
 		}
663 739
 
664 740
 		if ($priv_trans)
665
-			$this->db_transaction('commit', $connection);
741
+		{
742
+					$this->db_transaction('commit', $connection);
743
+		}
666 744
 	}
667 745
 
668 746
 	/**
@@ -726,7 +804,9 @@  discard block
 block discarded – undo
726 804
 		$num_rows = $this->num_rows($result);
727 805
 
728 806
 		if ($num_rows == 0)
729
-			return '';
807
+		{
808
+					return '';
809
+		}
730 810
 
731 811
 		if ($new_table)
732 812
 		{
@@ -747,11 +827,16 @@  discard block
 block discarded – undo
747 827
 			{
748 828
 				// Try to figure out the type of each field. (NULL, number, or 'string'.)
749 829
 				if (!isset($item))
750
-					$field_list[] = 'NULL';
830
+				{
831
+									$field_list[] = 'NULL';
832
+				}
751 833
 				elseif (is_numeric($item) && (int) $item == $item)
752
-					$field_list[] = $item;
753
-				else
754
-					$field_list[] = '\'' . $this->escape_string($item) . '\'';
834
+				{
835
+									$field_list[] = $item;
836
+				}
837
+				else {
838
+									$field_list[] = '\'' . $this->escape_string($item) . '\'';
839
+				}
755 840
 			}
756 841
 
757 842
 			// 'Insert' the data.
@@ -801,12 +886,18 @@  discard block
 block discarded – undo
801 886
 		while ($row = $this->fetch_assoc($result))
802 887
 		{
803 888
 			if ($row['data_type'] == 'character varying')
804
-				$row['data_type'] = 'varchar';
889
+			{
890
+							$row['data_type'] = 'varchar';
891
+			}
805 892
 			elseif ($row['data_type'] == 'character')
806
-				$row['data_type'] = 'char';
893
+			{
894
+							$row['data_type'] = 'char';
895
+			}
807 896
 
808 897
 			if ($row['character_maximum_length'])
809
-				$row['data_type'] .= '(' . $row['character_maximum_length'] . ')';
898
+			{
899
+							$row['data_type'] .= '(' . $row['character_maximum_length'] . ')';
900
+			}
810 901
 
811 902
 			// Make the CREATE for this column.
812 903
 			$schema_create .= ' "' . $row['column_name'] . '" ' . $row['data_type'] . ($row['is_nullable'] != 'YES' ? ' NOT NULL' : '');
@@ -859,12 +950,15 @@  discard block
 block discarded – undo
859 950
 			if ($row['is_primary'])
860 951
 			{
861 952
 				if (preg_match('~\(([^\)]+?)\)~i', $row['inddef'], $matches) == 0)
862
-					continue;
953
+				{
954
+									continue;
955
+				}
863 956
 
864 957
 				$index_create .= $crlf . 'ALTER TABLE ' . $tableName . ' ADD PRIMARY KEY ("' . $matches[1] . '");';
865 958
 			}
866
-			else
867
-				$index_create .= $crlf . $row['inddef'] . ';';
959
+			else {
960
+							$index_create .= $crlf . $row['inddef'] . ';';
961
+			}
868 962
 		}
869 963
 		$this->free_result($result);
870 964
 
@@ -892,7 +986,9 @@  discard block
 block discarded – undo
892 986
 		);
893 987
 		$tables = array();
894 988
 		while ($row = $this->fetch_row($request))
895
-			$tables[] = $row[0];
989
+		{
990
+					$tables[] = $row[0];
991
+		}
896 992
 		$this->free_result($request);
897 993
 
898 994
 		return $tables;
@@ -1008,11 +1104,15 @@  discard block
 block discarded – undo
1008 1104
 		global $db_row_count;
1009 1105
 
1010 1106
 		if ($counter !== false)
1011
-			return pg_fetch_assoc($request, $counter);
1107
+		{
1108
+					return pg_fetch_assoc($request, $counter);
1109
+		}
1012 1110
 
1013 1111
 		// Reset the row counter...
1014 1112
 		if (!isset($db_row_count[$this->seekCounter($request)]))
1015
-			$db_row_count[$this->seekCounter($request)] = 0;
1113
+		{
1114
+					$db_row_count[$this->seekCounter($request)] = 0;
1115
+		}
1016 1116
 
1017 1117
 		// Return the right row.
1018 1118
 		return @pg_fetch_assoc($request, $db_row_count[$this->seekCounter($request)]++);
Please login to merge, or discard this patch.
SSI.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -803,8 +803,10 @@
 block discarded – undo
803 803
 	global $txt, $context;
804 804
 
805 805
 	if ($output_method === 'echo')
806
-		echo '
806
+	{
807
+			echo '
807 808
 		', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br />';
809
+	}
808 810
 	else
809 811
 	{
810 812
 		return $context['common_stats']['latest_member'];
Please login to merge, or discard this patch.
themes/default/MessageIndex.template.php 1 patch
Braces   +102 added lines, -37 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@  discard block
 block discarded – undo
51 51
 	global $context, $settings, $txt, $options;
52 52
 
53 53
 	if ($context['no_topic_listing'])
54
-		return;
54
+	{
55
+			return;
56
+	}
55 57
 
56 58
 	template_pagesection('normal_buttons', 'right');
57 59
 
@@ -62,14 +64,18 @@  discard block
 block discarded – undo
62 64
 
63 65
 	// Show the board description
64 66
 	if (!empty($context['description']))
65
-		echo '
67
+	{
68
+			echo '
66 69
 				<div id="boarddescription">
67 70
 					', $context['description'], '
68 71
 				</div>';
72
+	}
69 73
 
70 74
 	if (!empty($context['moderators']))
71
-		echo '
75
+	{
76
+			echo '
72 77
 				<div class="moderators">', count($context['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $context['link_moderators']), '.</div>';
78
+	}
73 79
 
74 80
 	echo '
75 81
 				<div id="whoisviewing">';
@@ -78,9 +84,12 @@  discard block
 block discarded – undo
78 84
 	if (!empty($settings['display_who_viewing']))
79 85
 	{
80 86
 		if ($settings['display_who_viewing'] == 1)
81
-			echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
82
-		else
83
-			echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
87
+		{
88
+					echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
89
+		}
90
+		else {
91
+					echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
92
+		}
84 93
 
85 94
 		echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'];
86 95
 	}
@@ -90,10 +99,12 @@  discard block
 block discarded – undo
90 99
 					<ul id="sort_by" class="topic_sorting">';
91 100
 
92 101
 	if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1)
93
-		echo '
102
+	{
103
+			echo '
94 104
 						<li class="listlevel1 quickmod_select_all">
95 105
 							<input type="checkbox" onclick="invertAll(this, document.getElementById(\'quickModForm\'), \'topics[]\');" />
96 106
 						</li>';
107
+	}
97 108
 
98 109
 	$current_header = $context['topics_headers'][$context['sort_by']];
99 110
 	echo '
@@ -106,8 +117,10 @@  discard block
 block discarded – undo
106 117
 							<ul class="menulevel2" id="sortby">';
107 118
 
108 119
 	foreach ($context['topics_headers'] as $key => $value)
109
-		echo '
120
+	{
121
+			echo '
110 122
 								<li class="listlevel2 sort_by_item" id="sort_by_item_', $key, '"><a href="', $value['url'], '" class="linklevel2">', $txt[$key], ' ', $value['sort_dir_img'], '</a></li>';
123
+	}
111 124
 
112 125
 	echo '
113 126
 							</ul>
@@ -129,13 +142,17 @@  discard block
 block discarded – undo
129 142
 	{
130 143
 		// If Quick Moderation is enabled start the form.
131 144
 		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
132
-			echo '
145
+		{
146
+					echo '
133 147
 	<form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="UTF-8" class="clear" name="quickModForm" id="quickModForm">';
148
+		}
134 149
 
135 150
 		// If this person can approve items and we have some awaiting approval tell them.
136 151
 		if (!empty($context['unapproved_posts_message']))
137
-			echo '
152
+		{
153
+					echo '
138 154
 		<div class="warningbox">', $context['unapproved_posts_message'], '</div>';
155
+		}
139 156
 
140 157
 		echo '
141 158
 		<main>
@@ -143,7 +160,8 @@  discard block
 block discarded – undo
143 160
 
144 161
 		// No topics.... just say, "sorry bub".
145 162
 		if (empty($context['topics']))
146
-			echo '
163
+		{
164
+					echo '
147 165
 			<li class="basic_row">
148 166
 				<div class="topic_info">
149 167
 					<div class="topic_name">
@@ -153,24 +171,34 @@  discard block
 block discarded – undo
153 171
 					</div>
154 172
 				</div>
155 173
 			</li>';
174
+		}
156 175
 
157 176
 		foreach ($context['topics'] as $topic)
158 177
 		{
159 178
 			// Is this topic pending approval, or does it have any posts pending approval?
160 179
 			if ($context['can_approve_posts'] && $topic['unapproved_posts'])
161
-				$color_class = !$topic['approved'] ? 'approvetopic_row' : 'approve_row';
180
+			{
181
+							$color_class = !$topic['approved'] ? 'approvetopic_row' : 'approve_row';
182
+			}
162 183
 			// We start with locked and sticky topics.
163 184
 			elseif ($topic['is_sticky'] && $topic['is_locked'])
164
-				$color_class = 'locked_row sticky_row';
185
+			{
186
+							$color_class = 'locked_row sticky_row';
187
+			}
165 188
 			// Sticky topics should get a different color, too.
166 189
 			elseif ($topic['is_sticky'])
167
-				$color_class = 'sticky_row';
190
+			{
191
+							$color_class = 'sticky_row';
192
+			}
168 193
 			// Locked topics get special treatment as well.
169 194
 			elseif ($topic['is_locked'])
170
-				$color_class = 'locked_row';
195
+			{
196
+							$color_class = 'locked_row';
197
+			}
171 198
 			// Last, but not least: regular topics.
172
-			else
173
-				$color_class = 'basic_row';
199
+			else {
200
+							$color_class = 'basic_row';
201
+			}
174 202
 
175 203
 			echo '
176 204
 			<li class="', $color_class, '">
@@ -178,8 +206,10 @@  discard block
 block discarded – undo
178 206
 					<p class="topic_icons', empty($modSettings['messageIcons_enable']) ? ' topicicon i-' . $topic['first_post']['icon'] : '', '">';
179 207
 
180 208
 			if (!empty($modSettings['messageIcons_enable']))
181
-				echo '
209
+			{
210
+							echo '
182 211
 						<img src="', $topic['first_post']['icon_url'], '" alt="" />';
212
+			}
183 213
 
184 214
 			echo '
185 215
 						', $topic['is_posted_in'] ? '<span class="fred topicicon i-profile"></span>' : '', '
@@ -189,12 +219,16 @@  discard block
 block discarded – undo
189 219
 
190 220
 			// Is this topic new? (assuming they are logged in!)
191 221
 			if ($topic['new'] && $context['user']['is_logged'])
192
-				echo '
222
+			{
223
+							echo '
193 224
 							<a class="new_posts" href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '">' . $txt['new'] . '</a>';
225
+			}
194 226
 
195 227
 			// Is this an unapproved topic and they can approve it?
196 228
 			if ($context['can_approve_posts'] && !$topic['approved'])
197
-				echo '<span class="require_approval">' . $txt['awaiting_approval'] . '</span>';
229
+			{
230
+							echo '<span class="require_approval">' . $txt['awaiting_approval'] . '</span>';
231
+			}
198 232
 
199 233
 			echo '
200 234
 							', $topic['is_sticky'] ? '<strong>' : '', '<span class="preview" title="', $topic['default_preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span></span>', $topic['is_sticky'] ? '</strong>' : '', '
@@ -212,19 +246,24 @@  discard block
 block discarded – undo
212 246
 
213 247
 			// Show likes?
214 248
 			if (!empty($modSettings['likes_enabled']))
215
-				echo '<br />
249
+			{
250
+							echo '<br />
216 251
 					', $topic['likes'], ' ', $txt['likes'];
252
+			}
217 253
 
218 254
 			echo '
219 255
 					</p>
220 256
 					<p class="topic_lastpost">';
221 257
 
222 258
 			if (!empty($topic['last_post']['member']['avatar']))
223
-				echo '
259
+			{
260
+							echo '
224 261
 						<span class="board_avatar"><a href="', $topic['last_post']['member']['href'], '"><img class="avatar" src="', $topic['last_post']['member']['avatar']['href'], '" alt="" loading="lazy" /></a></span>';
225
-			else
226
-				echo '
262
+			}
263
+			else {
264
+							echo '
227 265
 						<span class="board_avatar"><a href="#"></a></span>';
266
+			}
228 267
 
229 268
 			echo '
230 269
 						<a class="topicicon i-last_post" href="', $topic['last_post']['href'], '" title="', $txt['last_post'], '"></a>
@@ -240,25 +279,37 @@  discard block
 block discarded – undo
240 279
 				<p class="topic_moderation', $options['display_quick_mod'] == 1 ? '' : '_alt', '" >';
241 280
 
242 281
 				if ($options['display_quick_mod'] == 1)
243
-					echo '
282
+				{
283
+									echo '
244 284
 						<input type="checkbox" name="topics[]" value="', $topic['id'], '" />';
285
+				}
245 286
 				else
246 287
 				{
247 288
 					// Check permissions on each and show only the ones they are allowed to use.
248 289
 					if ($topic['quick_mod']['remove'])
249
-						echo '<a class="topicicon i-remove" href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');" title="', $txt['remove_topic'], '"></a>';
290
+					{
291
+											echo '<a class="topicicon i-remove" href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');" title="', $txt['remove_topic'], '"></a>';
292
+					}
250 293
 
251 294
 					if ($topic['quick_mod']['lock'])
252
-						echo '<a class="topicicon i-locked" href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');" title="', $txt[$topic['is_locked'] ? 'set_unlock' : 'set_lock'], '"></a>';
295
+					{
296
+											echo '<a class="topicicon i-locked" href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');" title="', $txt[$topic['is_locked'] ? 'set_unlock' : 'set_lock'], '"></a>';
297
+					}
253 298
 
254 299
 					if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
255
-						echo '<br />';
300
+					{
301
+											echo '<br />';
302
+					}
256 303
 
257 304
 					if ($topic['quick_mod']['sticky'])
258
-						echo '<a class="topicicon i-sticky" href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');" title="', $txt[$topic['is_sticky'] ? 'set_nonsticky' : 'set_sticky'], '"></a>';
305
+					{
306
+											echo '<a class="topicicon i-sticky" href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');" title="', $txt[$topic['is_sticky'] ? 'set_nonsticky' : 'set_sticky'], '"></a>';
307
+					}
259 308
 
260 309
 					if ($topic['quick_mod']['move'])
261
-						echo '<a class="topicicon i-move" href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0" title="', $txt['move_topic'], '"></a>';
310
+					{
311
+											echo '<a class="topicicon i-move" href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0" title="', $txt['move_topic'], '"></a>';
312
+					}
262 313
 				}
263 314
 
264 315
 				echo '
@@ -281,17 +332,21 @@  discard block
 block discarded – undo
281 332
 					<option value="">&nbsp;</option>';
282 333
 
283 334
 			foreach ($context['qmod_actions'] as $qmod_action)
284
-				if ($context['can_' . $qmod_action])
335
+			{
336
+							if ($context['can_' . $qmod_action])
285 337
 					echo '
286 338
 					<option value="' . $qmod_action . '">&#10148;&nbsp;', $txt['quick_mod_' . $qmod_action] . '</option>';
339
+			}
287 340
 
288 341
 			echo '
289 342
 				</select>';
290 343
 
291 344
 			// Show a list of boards they can move the topic to.
292 345
 			if ($context['can_move'])
293
-				echo '
346
+			{
347
+							echo '
294 348
 				<span id="quick_mod_jump_to">&nbsp;</span>';
349
+			}
295 350
 
296 351
 			echo '
297 352
 				<input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' &amp;&amp; confirm(\'', $txt['quickmod_confirm'], '\');" />
@@ -300,9 +355,11 @@  discard block
 block discarded – undo
300 355
 
301 356
 		// Finish off the form - again.
302 357
 		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
303
-			echo '
358
+		{
359
+					echo '
304 360
 	<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
305 361
 	</form>';
362
+		}
306 363
 	}
307 364
 }
308 365
 
@@ -314,7 +371,9 @@  discard block
 block discarded – undo
314 371
 	global $context, $txt, $options;
315 372
 
316 373
 	if ($context['no_topic_listing'])
317
-		return;
374
+	{
375
+			return;
376
+	}
318 377
 
319 378
 	template_pagesection('normal_buttons', 'right');
320 379
 
@@ -326,17 +385,22 @@  discard block
 block discarded – undo
326 385
 		<div class="qaction_row floatright" id="message_index_jump_to">&nbsp;</div>';
327 386
 
328 387
 	if (!$context['no_topic_listing'])
329
-		template_basicicons_legend();
388
+	{
389
+			template_basicicons_legend();
390
+	}
330 391
 
331 392
 	echo '
332 393
 			<script>';
333 394
 
334 395
 	if (!empty($context['using_relative_time']))
335
-		echo '
396
+	{
397
+			echo '
336 398
 				$(\'.topic_latest\').addClass(\'relative\');';
399
+	}
337 400
 
338 401
 	if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move'])
339
-		echo '
402
+	{
403
+			echo '
340 404
 				aJumpTo[aJumpTo.length] = new JumpTo({
341 405
 					sContainerId: "quick_mod_jump_to",
342 406
 					sClassName: "qaction",
@@ -352,6 +416,7 @@  discard block
 block discarded – undo
352 416
 					bDisabled: true,
353 417
 					sCustomName: "move_to"
354 418
 				});';
419
+	}
355 420
 
356 421
 	echo '
357 422
 				aJumpTo[aJumpTo.length] = new JumpTo({
Please login to merge, or discard this patch.
themes/default/Post.template.php 1 patch
Braces   +93 added lines, -32 removed lines patch added patch discarded remove patch
@@ -35,15 +35,19 @@  discard block
 block discarded – undo
35 35
 
36 36
 	// When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
37 37
 	if (isBrowser('is_firefox'))
38
-		echo '
38
+	{
39
+			echo '
39 40
 			window.addEventListener("pageshow", reActivate, false);';
41
+	}
40 42
 
41 43
 	// Start with message icons - and any missing from this theme.
42 44
 	echo '
43 45
 			var icon_urls = {';
44 46
 	foreach ($context['icons'] as $icon)
45
-		echo '
47
+	{
48
+			echo '
46 49
 				\'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ',';
50
+	}
47 51
 	echo '
48 52
 			};';
49 53
 
@@ -76,7 +80,9 @@  discard block
 block discarded – undo
76 80
 	// If an error occurred, explain what happened.
77 81
 	template_show_error('post_error');
78 82
 	if (!empty($context['attachment_error_keys']))
79
-		template_attachment_errors();
83
+	{
84
+			template_attachment_errors();
85
+	}
80 86
 
81 87
 	// If this won't be approved let them know!
82 88
 	// @todo why not use the template_show_error above?
@@ -97,10 +103,12 @@  discard block
 block discarded – undo
97 103
 						</p>';
98 104
 
99 105
 	if (!empty($context['drafts_autosave']))
100
-		echo '
106
+	{
107
+			echo '
101 108
 						<div id="draft_section" class="successbox', isset($context['draft_saved']) ? '"' : ' hide"', '>
102 109
 							', sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), '
103 110
 						</div>';
111
+	}
104 112
 
105 113
 	// The post header... important stuff
106 114
 	echo '
@@ -118,13 +126,15 @@  discard block
 block discarded – undo
118 126
 							</dd>';
119 127
 
120 128
 		if (empty($modSettings['guest_post_no_email']))
121
-			echo '
129
+		{
130
+					echo '
122 131
 							<dt>
123 132
 								<label for="email"', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' class="error"' : '', ' id="caption_email">', $txt['email'], ':</label>
124 133
 							</dt>
125 134
 							<dd>
126 135
 								<input type="email" id="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required="required" />
127 136
 							</dd>';
137
+		}
128 138
 	}
129 139
 
130 140
 	// Now show the subject box for this post.
@@ -143,8 +153,10 @@  discard block
 block discarded – undo
143 153
 
144 154
 	// Loop through each message icon allowed, adding it to the drop down list.
145 155
 	foreach ($context['icons'] as $icon)
146
-		echo '
156
+	{
157
+			echo '
147 158
 									<option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';
159
+	}
148 160
 
149 161
 	echo '
150 162
 								</select>
@@ -152,12 +164,14 @@  discard block
 block discarded – undo
152 164
 							</dd>';
153 165
 
154 166
 	if (!empty($context['show_boards_dropdown']))
155
-		echo '
167
+	{
168
+			echo '
156 169
 							<dt class="clear_left">
157 170
 								<label for="post_in_board">', $txt['post_in_board'], '</label>:
158 171
 							</dt>
159 172
 							<dd>', template_select_boards('post_in_board'), '
160 173
 							</dd>';
174
+	}
161 175
 
162 176
 	echo '
163 177
 						</dl>';
@@ -199,8 +213,10 @@  discard block
 block discarded – undo
199 213
 
200 214
 	// Show a list of all the years we allow...
201 215
 	for ($year = $context['cal_minyear']; $year <= $context['cal_maxyear']; $year++)
202
-		echo '
216
+	{
217
+			echo '
203 218
 										<option value="', $year, '"', $year == $context['event']['year'] ? ' selected="selected"' : '', '>', $year, '&nbsp;</option>';
219
+	}
204 220
 
205 221
 	echo '
206 222
 									</select>
@@ -209,8 +225,10 @@  discard block
 block discarded – undo
209 225
 
210 226
 	// There are 12 months per year - ensure that they all get listed.
211 227
 	for ($month = 1; $month <= 12; $month++)
212
-		echo '
228
+	{
229
+			echo '
213 230
 										<option value="', $month, '"', $month == $context['event']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '&nbsp;</option>';
231
+	}
214 232
 
215 233
 	echo '
216 234
 									</select>
@@ -219,8 +237,10 @@  discard block
 block discarded – undo
219 237
 
220 238
 	// This prints out all the days in the current month - this changes dynamically as we switch months.
221 239
 	for ($day = 1; $day <= $context['event']['last_day']; $day++)
222
-		echo '
240
+	{
241
+			echo '
223 242
 										<option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '&nbsp;</option>';
243
+	}
224 244
 
225 245
 	echo '
226 246
 									</select>
@@ -240,8 +260,10 @@  discard block
 block discarded – undo
240 260
 										<select id="span" name="span">';
241 261
 
242 262
 			for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++)
243
-				echo '
263
+			{
264
+							echo '
244 265
 											<option value="', $days, '"', $days == $context['event']['span'] ? ' selected="selected"' : '', '>', $days, '&nbsp;</option>';
266
+			}
245 267
 
246 268
 			echo '
247 269
 										</select>
@@ -262,8 +284,10 @@  discard block
 block discarded – undo
262 284
 	}
263 285
 
264 286
 	if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
265
-		echo '
287
+	{
288
+			echo '
266 289
 								<input type="hidden" name="eventid" value="', $context['event']['id'], '" />';
290
+	}
267 291
 
268 292
 	echo '
269 293
 							</fieldset>
@@ -288,8 +312,10 @@  discard block
 block discarded – undo
288 312
 							<div id="mentioned" class="hide">';
289 313
 
290 314
 		foreach ($context['member_ids'] as $id)
291
-			echo '
315
+		{
316
+					echo '
292 317
 								<input type="hidden" name="uid[]" value="', $id, '" />';
318
+		}
293 319
 
294 320
 		echo '
295 321
 							</div>';
@@ -302,13 +328,17 @@  discard block
 block discarded – undo
302 328
 
303 329
 	// Option to delete an event if user is editing one.
304 330
 	if (!empty($context['make_event']) && !$context['event']['new'])
305
-		echo '
331
+	{
332
+			echo '
306 333
 							<input type="submit" name="deleteevent" value="', $txt['event_delete'], '" onclick="return confirm(\'', $txt['event_delete_confirm'], '\');" />';
334
+	}
307 335
 
308 336
 	// Option to add a poll (javascript if enabled, otherwise preview with poll)
309 337
 	if (empty($context['make_poll']) && $context['can_add_poll'])
310
-		echo '
338
+	{
339
+			echo '
311 340
 							<input type="submit" name="poll" aria-label="', $txt['add_poll'], '" value="', $txt['add_poll'], '" onclick="return loadAddNewPoll(this, ', empty($context['current_board']) ? '0' : $context['current_board'], ', \'postmodify\');" />';
341
+	}
312 342
 
313 343
 	echo '
314 344
 						</div>';
@@ -323,18 +353,22 @@  discard block
 block discarded – undo
323 353
 
324 354
 	// If the admin has enabled the hiding of the additional options - show a link and image for it.
325 355
 	if (!empty($settings['additional_options_collapsible']))
326
-		echo '
356
+	{
357
+			echo '
327 358
 					<h3 id="postAdditionalOptionsHeader" class="category_header panel_toggle">
328 359
 							<i id="postMoreExpand" class="chevricon i-chevron-', empty($context['minmax_preferences']['post']) ? 'up' : 'down', ' hide" title="', $txt['hide'], '"></i>
329 360
 						<a href="#" id="postMoreExpandLink">', !empty($context['attachments']) && $context['attachments']['can']['post'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a>
330 361
 					</h3>';
362
+	}
331 363
 
332 364
 	echo '
333 365
 					<div id="', empty($settings['additional_options_collapsible']) ? 'postAdditionalOptionsNC"' : 'postAdditionalOptions"', empty($settings['additional_options_collapsible']) || empty($context['minmax_preferences']['post']) ? '' : ' class="hide"', '>';
334 366
 
335 367
 	// Is the user allowed to post or if this post already has attachments on it give them the boxes.
336 368
 	if (!empty($context['attachments']) && ($context['attachments']['can']['post'] || !empty($context['attachments']['current'])))
337
-		$context['attachments']['template']();
369
+	{
370
+			$context['attachments']['template']();
371
+	}
338 372
 
339 373
 	// Display the check boxes for all the standard options - if they are available to the user!
340 374
 	echo '
@@ -387,7 +421,8 @@  discard block
 block discarded – undo
387 421
 
388 422
 		// Show more boxes if they aren't approaching that limit.
389 423
 		if ($context['attachments']['num_allowed'] > 1)
390
-			echo '
424
+		{
425
+					echo '
391 426
 								<script>
392 427
 									var allowed_attachments = ', $context['attachments']['num_allowed'], ',
393 428
 										current_attachment = 1,
@@ -397,18 +432,24 @@  discard block
 block discarded – undo
397 432
 								</script>
398 433
 							</dd>
399 434
 							<dd class="smalltext drop_attachments_no_js" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';
400
-		else
401
-			echo '
435
+		}
436
+		else {
437
+					echo '
402 438
 							</dd>';
439
+		}
403 440
 	}
404 441
 
405 442
 	foreach ($context['attachments']['current'] as $attachment)
406 443
 	{
407 444
 		$label = $attachment['name'];
408 445
 		if (empty($attachment['approved']))
409
-			$label .= ' (' . $txt['awaiting_approval'] . ')';
446
+		{
447
+					$label .= ' (' . $txt['awaiting_approval'] . ')';
448
+		}
410 449
 		if (!empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']))
411
-			$label .= sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1024) / 1024), 0));
450
+		{
451
+					$label .= sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1024) / 1024), 0));
452
+		}
412 453
 
413 454
 		echo '
414 455
 							<dd class="smalltext">
@@ -423,20 +464,28 @@  discard block
 block discarded – undo
423 464
 
424 465
 	// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
425 466
 	if (!empty($context['attachments']['allowed_extensions']))
426
-		echo '
467
+	{
468
+			echo '
427 469
 								<p id="types">', $txt['allowed_types'], ': ', $context['attachments']['allowed_extensions'], '</p>';
470
+	}
428 471
 
429 472
 	if (!empty($context['attachments']['restrictions']))
430
-		echo '
473
+	{
474
+			echo '
431 475
 								<p id="restrictions">', $txt['attach_restrictions'], ' ', implode(', ', $context['attachments']['restrictions']), '</p>';
476
+	}
432 477
 
433 478
 	if ($context['attachments']['num_allowed'] == 0)
434
-		echo '
479
+	{
480
+			echo '
435 481
 								<p class="infobox">', $txt['attach_limit_nag'], '</p>';
482
+	}
436 483
 
437 484
 	if (!$context['attachments']['can']['post_unapproved'])
438
-		echo '
485
+	{
486
+			echo '
439 487
 								<p class="warningbox">', $txt['attachment_requires_approval'], '</p>';
488
+	}
440 489
 
441 490
 	echo '
442 491
 							</dd>
@@ -537,9 +586,11 @@  discard block
 block discarded – undo
537 586
 							</dd>';
538 587
 
539 588
 	foreach ($context['drafts'] as $draft)
540
-		echo '
589
+	{
590
+			echo '
541 591
 							<dt>', $draft['link'], '</dt>
542 592
 							<dd>', $draft['poster_time'], '</dd>';
593
+	}
543 594
 
544 595
 	echo '
545 596
 						</dl>
@@ -600,7 +651,9 @@  discard block
 block discarded – undo
600 651
 		{
601 652
 			$ignoring = false;
602 653
 			if (!empty($post['is_ignored']))
603
-				$ignored_posts[] = $ignoring = $post['id'];
654
+			{
655
+							$ignored_posts[] = $ignoring = $post['id'];
656
+			}
604 657
 
605 658
 			echo '
606 659
 			<div class="content forumposts">
@@ -611,20 +664,24 @@  discard block
 block discarded – undo
611 664
 						</h5>';
612 665
 
613 666
 			if ($context['can_quote'])
614
-				echo '
667
+			{
668
+							echo '
615 669
 						<ul class="quickbuttons" id="msg_', $post['id'], '_quote">
616 670
 							<li class="listlevel1"><a href="#postmodify" onmousedown="return insertQuoteFast(', $post['id'], ');" class="linklevel1 quote_button">', $txt['bbc_quote'], '</a></li>
617 671
 						</ul>';
672
+			}
618 673
 
619 674
 			echo '
620 675
 					</div>';
621 676
 
622 677
 			if ($ignoring)
623
-				echo '
678
+			{
679
+							echo '
624 680
 					<div id="msg_', $post['id'], '_ignored_prompt">
625 681
 						', $txt['ignoring_user'], '
626 682
 						<a href="#" id="msg_', $post['id'], '_ignored_link" class="hide">', $txt['show_ignore_user_post'], '</a>
627 683
 					</div>';
684
+			}
628 685
 
629 686
 			echo '
630 687
 					<div class="inner" id="msg_', $post['id'], '_body">', $post['body'], '</div>
@@ -706,8 +763,10 @@  discard block
 block discarded – undo
706 763
 
707 764
 	// If we are starting a new topic starting from another one, here is the place to remember some details
708 765
 	if (!empty($context['original_post']))
709
-		echo '
766
+	{
767
+			echo '
710 768
 			<input type="hidden" name="followup" value="' . $context['original_post'] . '" />';
769
+	}
711 770
 
712 771
 	echo '
713 772
 			<input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '" />
@@ -737,7 +796,8 @@  discard block
 block discarded – undo
737 796
 
738 797
 	// Code for showing and hiding additional options.
739 798
 	if (!empty($settings['additional_options_collapsible']))
740
-		addInlineJavascript('
799
+	{
800
+			addInlineJavascript('
741 801
 			var oSwapAdditionalOptions = new elk_Toggle({
742 802
 				bToggleEnabled: true,
743 803
 				bCurrentlyCollapsed: ' . (empty($context['minmax_preferences']['post']) ? 'false' : 'true') . ',
@@ -774,6 +834,7 @@  discard block
 block discarded – undo
774 834
 					sAdditionalVars: \';minmax_key=post\'
775 835
 				},
776 836
 			});', true);
837
+	}
777 838
 
778 839
 	template_topic_replies_below();
779 840
 }
Please login to merge, or discard this patch.
themes/default/Theme.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -316,7 +316,9 @@  discard block
 block discarded – undo
316 316
 		if (!empty($this->js_vars) && !$do_deferred)
317 317
 		{
318 318
 			foreach ($this->js_vars as $var => $value)
319
-				$js_vars[] = $var . ' = ' . $value;
319
+			{
320
+							$js_vars[] = $var . ' = ' . $value;
321
+			}
320 322
 
321 323
 			// Newlines and tabs are here to make it look nice in the page source view, stripped if minimized though
322 324
 			$this->js_inline['standard'][] = 'var ' . implode(",\n\t\t\t", $js_vars) . ';';
@@ -383,14 +385,18 @@  discard block
 block discarded – undo
383 385
 				}
384 386
 
385 387
 				foreach ($combiner->getSpares() as $id => $file)
386
-					echo '
388
+				{
389
+									echo '
387 390
 	<link rel="stylesheet" href="', $file['filename'], '" id="', $id, '" />';
391
+				}
388 392
 			}
389 393
 			else
390 394
 			{
391 395
 				foreach ($this->css_files as $id => $file)
392
-					echo '
396
+				{
397
+									echo '
393 398
 	<link rel="stylesheet" href="', $file['filename'], '" id="', $id, '" />';
399
+				}
394 400
 			}
395 401
 		}
396 402
 	}
@@ -766,7 +772,9 @@  discard block
 block discarded – undo
766 772
 		// Since it's nice to have avatars all of the same size, and in some cases the size detection may fail,
767 773
 		// let's add the css in any case
768 774
 		if (!isset($context['html_headers']))
769
-			$context['html_headers'] = '';
775
+		{
776
+					$context['html_headers'] = '';
777
+		}
770 778
 
771 779
 		if (!empty($modSettings['avatar_max_width']) || !empty($modSettings['avatar_max_height']))
772 780
 		{
@@ -1097,7 +1105,9 @@  discard block
 block discarded – undo
1097 1105
 
1098 1106
 			// Load each template...
1099 1107
 			foreach ($templates as $template)
1100
-				$this->templates->load($template);
1108
+			{
1109
+							$this->templates->load($template);
1110
+			}
1101 1111
 
1102 1112
 			// ...and attempt to load their associated language files.
1103 1113
 			$required_files = implode('+', array_merge($templates, array('Addons')));
Please login to merge, or discard this patch.
themes/default/ProfileOptions.template.php 1 patch
Braces   +161 added lines, -56 removed lines patch added patch discarded remove patch
@@ -39,8 +39,10 @@  discard block
 block discarded – undo
39 39
 				<th scope="col">', $txt['status'], '</th>';
40 40
 
41 41
 	if ($context['can_send_email'])
42
-		echo '
42
+	{
43
+			echo '
43 44
 				<th scope="col">', $txt['email'], '</th>';
45
+	}
44 46
 
45 47
 	echo '
46 48
 				<th scope="col">', $txt['profile_contact'], '</th>
@@ -49,12 +51,14 @@  discard block
 block discarded – undo
49 51
 
50 52
 	// If they don't have any buddies don't list them!
51 53
 	if (empty($context['buddies']))
52
-		echo '
54
+	{
55
+			echo '
53 56
 			<tr>
54 57
 				<td colspan="5" class="centertext">
55 58
 					<strong>', $txt['no_buddies'], '</strong>
56 59
 				</td>
57 60
 			</tr>';
61
+	}
58 62
 
59 63
 	// Now loop through each buddy showing info on each.
60 64
 	foreach ($context['buddies'] as $buddy)
@@ -67,8 +71,10 @@  discard block
 block discarded – undo
67 71
 				</td>';
68 72
 
69 73
 		if ($context['can_send_email'])
70
-			echo '
74
+		{
75
+					echo '
71 76
 				<td>', template_member_email($buddy), '</td>';
77
+		}
72 78
 
73 79
 		//  Any custom profile (with icon) fields to show
74 80
 		$im = array();
@@ -76,8 +82,10 @@  discard block
 block discarded – undo
76 82
 		{
77 83
 
78 84
 			foreach ($buddy['custom_fields'] as $key => $cpf)
79
-				if ($cpf['placement'] == 1)
85
+			{
86
+							if ($cpf['placement'] == 1)
80 87
 					$im[] = $cpf['value'];
88
+			}
81 89
 		}
82 90
 
83 91
 		echo '
@@ -111,8 +119,10 @@  discard block
 block discarded – undo
111 119
 				</dl>';
112 120
 
113 121
 	if (!empty($context['token_check']))
114
-		echo '
122
+	{
123
+			echo '
115 124
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
125
+	}
116 126
 
117 127
 	echo '
118 128
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
@@ -152,8 +162,10 @@  discard block
 block discarded – undo
152 162
 				<th scope="col">', $txt['status'], '</th>';
153 163
 
154 164
 	if ($context['can_send_email'])
155
-		echo '
165
+	{
166
+			echo '
156 167
 				<th scope="col">', $txt['email'], '</th>';
168
+	}
157 169
 
158 170
 	echo '
159 171
 				<th scope="col"></th>
@@ -161,12 +173,14 @@  discard block
 block discarded – undo
161 173
 
162 174
 	// If they don't have anyone on their ignore list, don't list it!
163 175
 	if (empty($context['ignore_list']))
164
-		echo '
176
+	{
177
+			echo '
165 178
 			<tr>
166 179
 				<td colspan="4" class="centertext">
167 180
 					<strong>', $txt['no_ignore'], '</strong>
168 181
 				</td>
169 182
 			</tr>';
183
+	}
170 184
 
171 185
 	// Now loop through each buddy showing info on each.
172 186
 	foreach ($context['ignore_list'] as $member)
@@ -179,8 +193,10 @@  discard block
 block discarded – undo
179 193
 				</td>';
180 194
 
181 195
 		if ($context['can_send_email'])
182
-			echo '
196
+		{
197
+					echo '
183 198
 				<td>', template_member_email($member), '</td>';
199
+		}
184 200
 
185 201
 		echo '
186 202
 				<td class="righttext">
@@ -211,8 +227,10 @@  discard block
 block discarded – undo
211 227
 				</dl>';
212 228
 
213 229
 	if (!empty($context['token_check']))
214
-		echo '
230
+	{
231
+			echo '
215 232
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
233
+	}
216 234
 
217 235
 	echo '
218 236
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
@@ -249,31 +267,40 @@  discard block
 block discarded – undo
249 267
 
250 268
 	// Don't say "Profile" if this isn't the profile...
251 269
 	if (!empty($context['profile_header_text']))
252
-		echo '
270
+	{
271
+			echo '
253 272
 				', $context['profile_header_text'];
254
-	else
255
-		echo '
273
+	}
274
+	else {
275
+			echo '
256 276
 				', $txt['profile'];
277
+	}
257 278
 
258 279
 	echo '
259 280
 			</h2>';
260 281
 
261 282
 	// Have we some description?
262 283
 	if ($context['page_desc'])
263
-		echo '
284
+	{
285
+			echo '
264 286
 			<p class="description">', $context['page_desc'], '</p>';
287
+	}
265 288
 
266 289
 	echo '
267 290
 			<div class="content">';
268 291
 
269 292
 	// Any bits at the start?
270 293
 	if (!empty($context['profile_prehtml']))
271
-		echo '
294
+	{
295
+			echo '
272 296
 				<div>', $context['profile_prehtml'], '</div>';
297
+	}
273 298
 
274 299
 	if (!empty($context['profile_fields']))
275
-		echo '
300
+	{
301
+			echo '
276 302
 				<dl>';
303
+	}
277 304
 
278 305
 	// Start the big old loop 'of love.
279 306
 	$lastItem = 'hr';
@@ -281,7 +308,9 @@  discard block
 block discarded – undo
281 308
 	{
282 309
 		// We add a little hack to be sure we never get more than one hr in a row!
283 310
 		if ($lastItem === 'hr' && $field['type'] === 'hr')
284
-			continue;
311
+		{
312
+					continue;
313
+		}
285 314
 
286 315
 		$lastItem = $field['type'];
287 316
 		if ($field['type'] === 'hr')
@@ -307,8 +336,10 @@  discard block
 block discarded – undo
307 336
 
308 337
 			// Does it have any subtext to show?
309 338
 			if (!empty($field['subtext']))
310
-				echo '
339
+			{
340
+							echo '
311 341
 						<p class="smalltext">', $field['subtext'], '</p>';
342
+			}
312 343
 
313 344
 			echo '
314 345
 					</dt>
@@ -316,28 +347,38 @@  discard block
 block discarded – undo
316 347
 
317 348
 			// Want to put something in front of the box?
318 349
 			if (!empty($field['preinput']))
319
-				echo '
350
+			{
351
+							echo '
320 352
 						', $field['preinput'];
353
+			}
321 354
 
322 355
 			// What type of data are we showing?
323 356
 			if ($field['type'] === 'label')
324
-				echo '
357
+			{
358
+							echo '
325 359
 						', $field['value'];
360
+			}
326 361
 
327 362
 			// Maybe it's a text box - very likely!
328 363
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password')))
329
-				echo '
364
+			{
365
+							echo '
330 366
 						<input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
367
+			}
331 368
 
332 369
 			// Maybe it's an html5 input
333 370
 			elseif (in_array($field['type'], array('url', 'search', 'date', 'email', 'color')))
334
-				echo '
371
+			{
372
+							echo '
335 373
 						<input type="', $field['type'], '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
374
+			}
336 375
 
337 376
 			// You "checking" me out? ;)
338 377
 			elseif ($field['type'] === 'check')
339
-				echo '
378
+			{
379
+							echo '
340 380
 						<input type="hidden" name="', $key, '" value="0" /><input type="checkbox" name="', $key, '" id="', $key, '" ', !empty($field['value']) ? ' checked="checked"' : '', ' value="1" ', $field['input_attr'], ' />';
381
+			}
341 382
 
342 383
 			// Always fun - select boxes!
343 384
 			elseif ($field['type'] === 'select')
@@ -362,9 +403,11 @@  discard block
 block discarded – undo
362 403
 
363 404
 					// Assuming we now have some!
364 405
 					if (is_array($field['options']))
365
-						foreach ($field['options'] as $value => $name)
406
+					{
407
+											foreach ($field['options'] as $value => $name)
366 408
 							echo '
367 409
 							<option value="', $value, '" ', $value == $field['value'] ? 'selected="selected"' : '', '>', $name, '</option>';
410
+					}
368 411
 				}
369 412
 
370 413
 				echo '
@@ -373,8 +416,10 @@  discard block
 block discarded – undo
373 416
 
374 417
 			// Something to end with?
375 418
 			if (!empty($field['postinput']))
376
-				echo '
419
+			{
420
+							echo '
377 421
 						', $field['postinput'];
422
+			}
378 423
 
379 424
 			echo '
380 425
 					</dd>';
@@ -382,15 +427,19 @@  discard block
 block discarded – undo
382 427
 	}
383 428
 
384 429
 	if (!empty($context['profile_fields']))
385
-		echo '
430
+	{
431
+			echo '
386 432
 				</dl>';
433
+	}
387 434
 
388 435
 	// Are there any custom profile fields - if so print them!
389 436
 	if (!empty($context['custom_fields']))
390 437
 	{
391 438
 		if ($lastItem !== 'hr')
392
-			echo '
439
+		{
440
+					echo '
393 441
 				<hr class="clear" />';
442
+		}
394 443
 
395 444
 		echo '
396 445
 				<dl>';
@@ -413,8 +462,10 @@  discard block
 block discarded – undo
413 462
 
414 463
 	// Any closing HTML?
415 464
 	if (!empty($context['profile_posthtml']))
416
-		echo '
465
+	{
466
+			echo '
417 467
 				<div>', $context['profile_posthtml'], '</div>';
468
+	}
418 469
 
419 470
 	// Only show the password box if it's actually needed.
420 471
 	template_profile_save();
@@ -431,18 +482,22 @@  discard block
 block discarded – undo
431 482
 
432 483
 	// If this part requires a password, make sure to give a warning.
433 484
 	if ($context['require_password'])
434
-		echo '
485
+	{
486
+			echo '
435 487
 				// Did you forget to type your password?
436 488
 				if (document.forms.creator.oldpasswrd.value === "")
437 489
 				{
438 490
 					alert("', $txt['required_security_reasons'], '");
439 491
 					return false;
440 492
 				}';
493
+	}
441 494
 
442 495
 	// Any onsubmit javascript?
443 496
 	if (!empty($context['profile_onsubmit_javascript']))
444
-		echo '
497
+	{
498
+			echo '
445 499
 				', $context['profile_onsubmit_javascript'];
500
+	}
446 501
 
447 502
 	echo '
448 503
 			}
@@ -450,12 +505,14 @@  discard block
 block discarded – undo
450 505
 
451 506
 	// Any final spellchecking stuff?
452 507
 	if (!empty($context['show_spellchecking']))
453
-		echo '
508
+	{
509
+			echo '
454 510
 		<form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck">
455 511
 			<input type="hidden" id="spellstring" name="spellstring" value="" />
456 512
 			<input type="hidden" id="fulleditor" name="fulleditor" value="" />
457 513
 		</form>';
458
-}
514
+	}
515
+	}
459 516
 
460 517
 /**
461 518
  * Personal Message settings.
@@ -493,8 +550,10 @@  discard block
 block discarded – undo
493 550
 									<option value="1"', !empty($context['send_email']) && ($context['send_email'] == 1 || (empty($modSettings['enable_buddylist']) && $context['send_email'] > 1)) ? ' selected="selected"' : '', '>', $txt['email_notify_always'], '</option>';
494 551
 
495 552
 	if (!empty($modSettings['enable_buddylist']))
496
-		echo '
553
+	{
554
+			echo '
497 555
 										<option value="2"', !empty($context['send_email']) && $context['send_email'] > 1 ? ' selected="selected"' : '', '>', $txt['email_notify_buddies'], '</option>';
556
+	}
498 557
 
499 558
 	echo '
500 559
 								</select>
@@ -562,7 +621,8 @@  discard block
 block discarded – undo
562 621
 							</dd>';
563 622
 
564 623
 	if ($context['allow_no_censored'])
565
-		echo '
624
+	{
625
+			echo '
566 626
 							<dt>
567 627
 								<label for="show_no_censored">', $txt['show_no_censored'], '</label>
568 628
 							</dt>
@@ -570,6 +630,7 @@  discard block
 block discarded – undo
570 630
 								<input type="hidden" name="default_options[show_no_censored]" value="0" />
571 631
 								<input type="checkbox" name="default_options[show_no_censored]" id="show_no_censored" value="1"' . (!empty($context['member']['options']['show_no_censored']) ? ' checked="checked"' : '') . ' />
572 632
 							</dd>';
633
+	}
573 634
 
574 635
 	echo '
575 636
 							<dt>
@@ -624,7 +685,8 @@  discard block
 block discarded – undo
624 685
 	}
625 686
 
626 687
 	if (!empty($modSettings['cal_enabled']))
627
-		echo '
688
+	{
689
+			echo '
628 690
 							<dt>
629 691
 								<label for="calendar_start_day">', $txt['calendar_start_day'], '</label>
630 692
 							</dt>
@@ -635,9 +697,11 @@  discard block
 block discarded – undo
635 697
 									<option value="6"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 6 ? ' selected="selected"' : '', '>', $txt['days'][6], '</option>
636 698
 								</select>
637 699
 								</dd>';
700
+	}
638 701
 
639 702
 	if (!empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_autosave_enabled']))
640
-		echo '
703
+	{
704
+			echo '
641 705
 							<dt>
642 706
 								<label for="drafts_autosave_enabled">', $txt['drafts_autosave_enabled'], '</label>
643 707
 							</dt>
@@ -645,6 +709,7 @@  discard block
 block discarded – undo
645 709
 								<input type="hidden" name="default_options[drafts_autosave_enabled]" value="0" />
646 710
 								<label for="drafts_autosave_enabled"><input type="checkbox" name="default_options[drafts_autosave_enabled]" id="drafts_autosave_enabled" value="1"', !empty($context['member']['options']['drafts_autosave_enabled']) ? ' checked="checked"' : '', ' /></label>
647 711
 							</dd>';
712
+	}
648 713
 
649 714
 	echo '
650 715
 							<dt>
@@ -719,7 +784,8 @@  discard block
 block discarded – undo
719 784
 
720 785
 	// Allow notification on announcements to be disabled?
721 786
 	if (!empty($modSettings['allow_disableAnnounce']))
722
-		echo '
787
+	{
788
+			echo '
723 789
 					<dt>
724 790
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
725 791
 					</dt>
@@ -727,6 +793,7 @@  discard block
 block discarded – undo
727 793
 						<input type="hidden" name="notify_announcements" value="0" />
728 794
 						<input type="checkbox" id="notify_announcements" name="notify_announcements"', !empty($context['member']['notify_announcements']) ? ' checked="checked"' : '', ' />
729 795
 					</dd>';
796
+	}
730 797
 
731 798
 	// Auto notification when you reply / start a topic?
732 799
 	echo '
@@ -741,7 +808,8 @@  discard block
 block discarded – undo
741 808
 
742 809
 	// Can the body of the post be sent, PBE will ensure it can
743 810
 	if (empty($modSettings['disallow_sendBody']))
744
-		echo '
811
+	{
812
+			echo '
745 813
 					<dt>
746 814
 						<label for="notify_send_body">', $txt['notify_send_body' . (!empty($modSettings['maillist_enabled']) ? '_pbe' : '')], '</label>
747 815
 					</dt>
@@ -750,6 +818,7 @@  discard block
 block discarded – undo
750 818
 						<input type="checkbox" id="notify_send_body" name="notify_send_body"', !empty($context['member']['notify_send_body']) ? ' checked="checked"' : '', ' />
751 819
 						', (!empty($modSettings['maillist_enabled']) ? $txt['notify_send_body_pbe_post'] : ''), '
752 820
 					</dd>';
821
+	}
753 822
 
754 823
 	// How often do you want to hear from us, instant, daily, weekly?
755 824
 	echo '
@@ -823,10 +892,12 @@  discard block
 block discarded – undo
823 892
 
824 893
 	// Do we have an update message?
825 894
 	if (!empty($context['update_message']))
826
-		echo '
895
+	{
896
+			echo '
827 897
 			<div class="successbox">
828 898
 				', $context['update_message'], '
829 899
 			</div>';
900
+	}
830 901
 
831 902
 	// Requesting membership to a group?
832 903
 	if (!empty($context['group_request']))
@@ -862,10 +933,12 @@  discard block
 block discarded – undo
862 933
 					<tr  id="primdiv_', $group['id'], '">';
863 934
 
864 935
 			if ($context['can_edit_primary'])
865
-				echo '
936
+			{
937
+							echo '
866 938
 						<td>
867 939
 							<input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '" ', $group['is_primary'] ? 'checked="checked" ' : '', $group['can_be_primary'] ? '' : 'disabled="disabled" ', ' />
868 940
 						</td>';
941
+			}
869 942
 
870 943
 			echo '
871 944
 						<td>
@@ -877,8 +950,10 @@  discard block
 block discarded – undo
877 950
 
878 951
 			// Can they leave their group?
879 952
 			if ($group['can_leave'])
880
-				echo '
953
+			{
954
+							echo '
881 955
 							<a class="linkbutton" href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
956
+			}
882 957
 			echo '
883 958
 						</td>
884 959
 					</tr>';
@@ -889,10 +964,12 @@  discard block
 block discarded – undo
889 964
 			</table>';
890 965
 
891 966
 		if ($context['can_edit_primary'])
892
-			echo '
967
+		{
968
+					echo '
893 969
 			<div class="submitbutton">
894 970
 				<input type="submit" value="', $txt['make_primary'], '" />
895 971
 			</div>';
972
+		}
896 973
 
897 974
 		// Any groups they can join?
898 975
 		if (!empty($context['groups']['available']))
@@ -920,15 +997,21 @@  discard block
 block discarded – undo
920 997
 						<td class="lefttext">';
921 998
 
922 999
 				if ($group['type'] == 3)
923
-					echo '
1000
+				{
1001
+									echo '
924 1002
 							<a class="linkbutton_right" href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">', $txt['join_group'], '</a>';
1003
+				}
925 1004
 				elseif ($group['type'] == 2 && $group['pending'])
926
-					echo '
1005
+				{
1006
+									echo '
927 1007
 							', $txt['approval_pending'];
1008
+				}
928 1009
 				elseif ($group['type'] == 2)
929
-					echo '
1010
+				{
1011
+									echo '
930 1012
 							<a class="linkbutton_right" href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['request_group'], '</a>';
931
-// @todo
1013
+				}
1014
+				// @todo
932 1015
 //				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
933 1016
 
934 1017
 				echo '
@@ -948,16 +1031,20 @@  discard block
 block discarded – undo
948 1031
 				prevDiv = "";';
949 1032
 
950 1033
 		if (isset($context['groups']['member'][$context['primary_group']]))
951
-			echo '
1034
+		{
1035
+					echo '
952 1036
 			initHighlightSelection("primdiv_' . $context['primary_group'] . '");';
1037
+		}
953 1038
 
954 1039
 		echo '
955 1040
 		</script>';
956 1041
 	}
957 1042
 
958 1043
 	if (!empty($context['token_check']))
959
-		echo '
1044
+	{
1045
+			echo '
960 1046
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
1047
+	}
961 1048
 
962 1049
 	echo '
963 1050
 				<input type="hidden" name="save" value="save" />
@@ -1011,11 +1098,13 @@  discard block
 block discarded – undo
1011 1098
 
1012 1099
 	// Fill the select box with all primary membergroups that can be assigned to a member.
1013 1100
 	foreach ($context['member_groups'] as $member_group)
1014
-		if (!empty($member_group['can_be_primary']))
1101
+	{
1102
+			if (!empty($member_group['can_be_primary']))
1015 1103
 			echo '
1016 1104
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected="selected"' : '', '>
1017 1105
 										', $member_group['name'], '
1018 1106
 									</option>';
1107
+	}
1019 1108
 
1020 1109
 	echo '
1021 1110
 								</select>
@@ -1031,11 +1120,13 @@  discard block
 block discarded – undo
1031 1120
 
1032 1121
 	// For each membergroup show a checkbox so members can be assigned to more than one group.
1033 1122
 	foreach ($context['member_groups'] as $member_group)
1034
-		if ($member_group['can_be_additional'])
1123
+	{
1124
+			if ($member_group['can_be_additional'])
1035 1125
 			echo '
1036 1126
 										<li>
1037 1127
 											<label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked="checked"' : '', ' /> ', $member_group['name'], '</label>
1038 1128
 										</li>';
1129
+	}
1039 1130
 
1040 1131
 	echo '
1041 1132
 									</ul>
@@ -1093,20 +1184,28 @@  discard block
 block discarded – undo
1093 1184
 
1094 1185
 	// If there is a limit at all!
1095 1186
 	if (!empty($context['signature_limits']['max_length']))
1096
-		echo '
1187
+	{
1188
+			echo '
1097 1189
 								<p class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></p>';
1190
+	}
1098 1191
 
1099 1192
 	if ($context['show_spellchecking'])
1100
-		echo '
1193
+	{
1194
+			echo '
1101 1195
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\', false);"  tabindex="', $context['tabindex']++, '" class="right_submit" />';
1196
+	}
1102 1197
 
1103 1198
 	if (!empty($context['show_preview_button']))
1104
-		echo '
1199
+	{
1200
+			echo '
1105 1201
 								<input type="submit" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '"  tabindex="', $context['tabindex']++, '" class="right_submit" />';
1202
+	}
1106 1203
 
1107 1204
 	if ($context['signature_warning'])
1108
-		echo '
1205
+	{
1206
+			echo '
1109 1207
 								<span class="smalltext">', $context['signature_warning'], '</span>';
1208
+	}
1110 1209
 
1111 1210
 	// Some javascript used to count how many characters have been used so far in the signature.
1112 1211
 	echo '
@@ -1179,8 +1278,10 @@  discard block
 block discarded – undo
1179 1278
 
1180 1279
 		// This lists all the file categories.
1181 1280
 		foreach ($context['avatars'] as $avatar)
1182
-			echo '
1281
+		{
1282
+					echo '
1183 1283
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected="selected"' : ''), '>', $avatar['name'], '</option>';
1284
+		}
1184 1285
 		echo '
1185 1286
 										</select>
1186 1287
 									</div>
@@ -1290,8 +1391,10 @@  discard block
 block discarded – undo
1290 1391
 
1291 1392
 	// Help the user by showing a list of common time formats.
1292 1393
 	foreach ($context['easy_timeformats'] as $time_format)
1293
-		echo '
1394
+	{
1395
+			echo '
1294 1396
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected="selected"' : '', '>', $time_format['title'], '</option>';
1397
+	}
1295 1398
 
1296 1399
 	echo '
1297 1400
 								</select>
@@ -1348,8 +1451,10 @@  discard block
 block discarded – undo
1348 1451
 								<select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">';
1349 1452
 
1350 1453
 	foreach ($context['smiley_sets'] as $set)
1351
-		echo '
1454
+	{
1455
+			echo '
1352 1456
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected="selected"' : '', '>', $set['name'], '</option>';
1457
+	}
1353 1458
 
1354 1459
 	echo '
1355 1460
 								</select>
Please login to merge, or discard this patch.
themes/default/GenericBoards.template.php 1 patch
Braces   +45 added lines, -20 removed lines patch added patch discarded remove patch
@@ -60,9 +60,12 @@  discard block
 block discarded – undo
60 60
 		$diff_alternate = $diff_current - 2 * ($categories[$last_group] + 1);
61 61
 
62 62
 		if (abs($diff_alternate) < $diff_current)
63
-			array_unshift($groups[1], $last_group);
64
-		else
65
-			$groups[0][] = $last_group;
63
+		{
64
+					array_unshift($groups[1], $last_group);
65
+		}
66
+		else {
67
+					$groups[0][] = $last_group;
68
+		}
66 69
 	}
67 70
 	// If we have less on the left, let's try picking one from the right
68 71
 	elseif ($diff_current < 0)
@@ -72,9 +75,12 @@  discard block
 block discarded – undo
72 75
 		$diff_alternate = $diff_current + 2 * ($categories[$first_group] + 1);
73 76
 
74 77
 		if (abs($diff_alternate) < abs($diff_current))
75
-			$groups[0][] = $first_group;
76
-		else
77
-			array_unshift($groups[1], $first_group);
78
+		{
79
+					$groups[0][] = $first_group;
80
+		}
81
+		else {
82
+					array_unshift($groups[1], $first_group);
83
+		}
78 84
 	}
79 85
 
80 86
 	return $groups;
@@ -106,18 +112,23 @@  discard block
 block discarded – undo
106 112
 
107 113
 		// If the board or children is new, show an indicator.
108 114
 		if ($board['new'] || $board['children_new'])
109
-			echo '
115
+		{
116
+					echo '
110 117
 							<span class="board_icon ', $board['new'] ? 'i-board-new' : 'i-board-sub', '" title="', $txt['new_posts'], '"></span>';
118
+		}
111 119
 
112 120
 		// Is it a redirection board?
113 121
 		elseif ($board['is_redirect'])
114
-			echo '
122
+		{
123
+					echo '
115 124
 							<span class="board_icon i-board-redirect" title="', sprintf($txt['redirect_board_to'], Util::htmlspecialchars($board['name'])), '"></span>';
125
+		}
116 126
 
117 127
 		// No new posts at all! The agony!!
118
-		else
119
-			echo '
128
+		else {
129
+					echo '
120 130
 							<span class="board_icon i-board-off" title="', $txt['old_posts'], '"></span>';
131
+		}
121 132
 
122 133
 		echo '
123 134
 						</a>
@@ -126,8 +137,10 @@  discard block
 block discarded – undo
126 137
 
127 138
 		// Has it outstanding posts for approval? @todo - Might change presentation here.
128 139
 		if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
129
-			echo '
140
+		{
141
+					echo '
130 142
 							<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link"><i class="icon i-alert"></i></a>';
143
+		}
131 144
 
132 145
 		echo '
133 146
 						</h3>
@@ -135,8 +148,10 @@  discard block
 block discarded – undo
135 148
 
136 149
 		// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
137 150
 		if (!empty($board['moderators']))
138
-			echo '
151
+		{
152
+					echo '
139 153
 						<p class="moderators">', count($board['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
154
+		}
140 155
 
141 156
 		// Show some basic information about the number of posts, etc.
142 157
 		echo '
@@ -156,11 +171,14 @@  discard block
 block discarded – undo
156 171
 						<p class="board_lastpost">';
157 172
 
158 173
 			if (!empty($board['last_post']['member']['avatar']))
159
-				echo '
174
+			{
175
+							echo '
160 176
 							<span class="board_avatar"><a href="', $board['last_post']['member']['href'], '"><img class="avatar" src="', $board['last_post']['member']['avatar']['href'], '" alt="" loading="lazy" /></a></span>';
161
-			else
162
-				echo '
177
+			}
178
+			else {
179
+							echo '
163 180
 							<span class="board_avatar"><a href="#"></a></span>';
181
+			}
164 182
 			echo '
165 183
 							', $board['last_post']['last_post_message'], '
166 184
 						</p>';
@@ -181,13 +199,18 @@  discard block
 block discarded – undo
181 199
 			foreach ($board['children'] as $child)
182 200
 			{
183 201
 				if (!$child['is_redirect'])
184
-					$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a ' . ($child['new'] ? 'class="new_posts" ' : '') . 'href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</a>';
185
-				else
186
-					$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
202
+				{
203
+									$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a ' . ($child['new'] ? 'class="new_posts" ' : '') . 'href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</a>';
204
+				}
205
+				else {
206
+									$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
207
+				}
187 208
 
188 209
 				// Has it posts awaiting approval?
189 210
 				if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
190
-					$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link"><i class="icon i-alert"></i></a>';
211
+				{
212
+									$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link"><i class="icon i-alert"></i></a>';
213
+				}
191 214
 
192 215
 				$children[] = $child['link'];
193 216
 			}
@@ -226,7 +249,8 @@  discard block
 block discarded – undo
226 249
 	global $context, $txt;
227 250
 
228 251
 	if ($select_all)
229
-		echo '
252
+	{
253
+			echo '
230 254
 						<h3 class="secondary_header panel_toggle">
231 255
 							<span>
232 256
 								<span id="advanced_panel_toggle" class="chevricon i-chevron-', $context['boards_check_all'] ? 'down' : 'up', ' hide" title="', $txt['hide'], '"></span>
@@ -234,6 +258,7 @@  discard block
 block discarded – undo
234 258
 							<a href="#" id="advanced_panel_link">', $txt['choose_board'], '</a>
235 259
 						</h3>
236 260
 						<div id="advanced_panel_div"', $context['boards_check_all'] ? ' class="hide"' : '', '>';
261
+	}
237 262
 
238 263
 	// Make two nice columns of boards, link each category header to toggle select all boards in each
239 264
 	$group_cats = optimizeBoardsSubdivision($context['boards_in_category'], $context['num_boards']);
Please login to merge, or discard this patch.