Completed
Push — release-2.1 ( 05696f...4bed0e )
by Colin
67:57 queued 54:38
created
Sources/ManageServer.php 1 patch
Braces   +315 added lines, -243 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
  * @version 2.1 Beta 4
60 60
  */
61 61
 
62
-if (!defined('SMF'))
62
+if (!defined('SMF')) {
63 63
 	die('No direct access...');
64
+}
64 65
 
65 66
 /**
66 67
  * This is the main dispatcher. Sets up all the available sub-actions, all the tabs and selects
@@ -111,10 +112,11 @@  discard block
 block discarded – undo
111 112
 	$settings_not_writable = !is_writable($boarddir . '/Settings.php');
112 113
 	$settings_backup_fail = !@is_writable($boarddir . '/Settings_bak.php') || !@copy($boarddir . '/Settings.php', $boarddir . '/Settings_bak.php');
113 114
 
114
-	if ($settings_not_writable)
115
-		$context['settings_message'] = '<div class="centertext"><strong>' . $txt['settings_not_writable'] . '</strong></div><br>';
116
-	elseif ($settings_backup_fail)
117
-		$context['settings_message'] = '<div class="centertext"><strong>' . $txt['admin_backup_fail'] . '</strong></div><br>';
115
+	if ($settings_not_writable) {
116
+			$context['settings_message'] = '<div class="centertext"><strong>' . $txt['settings_not_writable'] . '</strong></div><br>';
117
+	} elseif ($settings_backup_fail) {
118
+			$context['settings_message'] = '<div class="centertext"><strong>' . $txt['admin_backup_fail'] . '</strong></div><br>';
119
+	}
118 120
 
119 121
 	$context['settings_not_writable'] = $settings_not_writable;
120 122
 
@@ -142,10 +144,11 @@  discard block
 block discarded – undo
142 144
 
143 145
 	// If no cert, force_ssl must remain 0
144 146
 	require_once($sourcedir . '/Subs.php');
145
-	if (!ssl_cert_found($boardurl) && empty($modSettings['force_ssl']))
146
-		$disable_force_ssl = true;
147
-	else
148
-		$disable_force_ssl = false;
147
+	if (!ssl_cert_found($boardurl) && empty($modSettings['force_ssl'])) {
148
+			$disable_force_ssl = true;
149
+	} else {
150
+			$disable_force_ssl = false;
151
+	}
149 152
 
150 153
 	/* If you're writing a mod, it's a bad idea to add things here....
151 154
 	For each option:
@@ -174,8 +177,9 @@  discard block
 block discarded – undo
174 177
 
175 178
 	call_integration_hook('integrate_general_settings', array(&$config_vars));
176 179
 
177
-	if ($return_config)
178
-		return $config_vars;
180
+	if ($return_config) {
181
+			return $config_vars;
182
+	}
179 183
 
180 184
 	// Setup the template stuff.
181 185
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=general;save';
@@ -192,16 +196,18 @@  discard block
 block discarded – undo
192 196
 			$registerSMStats = registerSMStats();
193 197
 
194 198
 			// Failed to register, disable it again.
195
-			if (empty($registerSMStats))
196
-				$_POST['enable_sm_stats'] = 0;
199
+			if (empty($registerSMStats)) {
200
+							$_POST['enable_sm_stats'] = 0;
201
+			}
197 202
 		}
198 203
 
199 204
 		// Ensure all URLs are aligned with the new force_ssl setting
200 205
 		// Treat unset like 0
201
-		if (isset($_POST['force_ssl']))
202
-			AlignURLsWithSSLSetting($_POST['force_ssl']);
203
-		else
204
-			AlignURLsWithSSLSetting(0);
206
+		if (isset($_POST['force_ssl'])) {
207
+					AlignURLsWithSSLSetting($_POST['force_ssl']);
208
+		} else {
209
+					AlignURLsWithSSLSetting(0);
210
+		}
205 211
 
206 212
 		saveSettings($config_vars);
207 213
 		$_SESSION['adm-save'] = true;
@@ -254,10 +260,11 @@  discard block
 block discarded – undo
254 260
 	require_once($sourcedir . '/Subs-Admin.php');
255 261
 
256 262
 	// Check $boardurl
257
-	if (!empty($new_force_ssl))
258
-		$newval = strtr($boardurl, array('http://' => 'https://'));
259
-	else
260
-		$newval = strtr($boardurl, array('https://' => 'http://'));
263
+	if (!empty($new_force_ssl)) {
264
+			$newval = strtr($boardurl, array('http://' => 'https://'));
265
+	} else {
266
+			$newval = strtr($boardurl, array('https://' => 'http://'));
267
+	}
261 268
 	updateSettingsFile(array('boardurl' => '\'' . addslashes($newval) . '\''));
262 269
 
263 270
 	$new_settings = array();
@@ -265,20 +272,22 @@  discard block
 block discarded – undo
265 272
 	// Check $smileys_url, but only if it points to a subfolder of $boardurl
266 273
 	if (BoardurlMatch($modSettings['smileys_url']))
267 274
 	{
268
-		if (!empty($new_force_ssl))
269
-			$newval = strtr($modSettings['smileys_url'], array('http://' => 'https://'));
270
-		else
271
-			$newval = strtr($modSettings['smileys_url'], array('https://' => 'http://'));
275
+		if (!empty($new_force_ssl)) {
276
+					$newval = strtr($modSettings['smileys_url'], array('http://' => 'https://'));
277
+		} else {
278
+					$newval = strtr($modSettings['smileys_url'], array('https://' => 'http://'));
279
+		}
272 280
 		$new_settings['smileys_url'] = $newval;
273 281
 	}
274 282
 
275 283
 	// Check $avatar_url, but only if it points to a subfolder of $boardurl
276 284
 	if (BoardurlMatch($modSettings['avatar_url']))
277 285
 	{
278
-		if (!empty($new_force_ssl))
279
-			$newval = strtr($modSettings['avatar_url'], array('http://' => 'https://'));
280
-		else
281
-			$newval = strtr($modSettings['avatar_url'], array('https://' => 'http://'));
286
+		if (!empty($new_force_ssl)) {
287
+					$newval = strtr($modSettings['avatar_url'], array('http://' => 'https://'));
288
+		} else {
289
+					$newval = strtr($modSettings['avatar_url'], array('https://' => 'http://'));
290
+		}
282 291
 		$new_settings['avatar_url'] = $newval;
283 292
 	}
284 293
 
@@ -286,16 +295,18 @@  discard block
 block discarded – undo
286 295
 	// This one had been optional in the past, make sure it is set first
287 296
 	if (isset($modSettings['custom_avatar_url']) && BoardurlMatch($modSettings['custom_avatar_url']))
288 297
 	{
289
-		if (!empty($new_force_ssl))
290
-			$newval = strtr($modSettings['custom_avatar_url'], array('http://' => 'https://'));
291
-		else
292
-			$newval = strtr($modSettings['custom_avatar_url'], array('https://' => 'http://'));
298
+		if (!empty($new_force_ssl)) {
299
+					$newval = strtr($modSettings['custom_avatar_url'], array('http://' => 'https://'));
300
+		} else {
301
+					$newval = strtr($modSettings['custom_avatar_url'], array('https://' => 'http://'));
302
+		}
293 303
 		$new_settings['custom_avatar_url'] = $newval;
294 304
 	}
295 305
 
296 306
 	// Save updates to the settings table
297
-	if (!empty($new_settings))
298
-		updateSettings($new_settings, true);
307
+	if (!empty($new_settings)) {
308
+			updateSettings($new_settings, true);
309
+	}
299 310
 
300 311
 	// Now we move onto the themes.
301 312
 	// First, get a list of theme URLs...
@@ -316,10 +327,11 @@  discard block
 block discarded – undo
316 327
 		// First check to see if it points to a subfolder of $boardurl
317 328
 		if (BoardurlMatch($row['value']))
318 329
 		{
319
-			if (!empty($new_force_ssl))
320
-				$newval = strtr($row['value'], array('http://' => 'https://'));
321
-			else
322
-				$newval = strtr($row['value'], array('https://' => 'http://'));
330
+			if (!empty($new_force_ssl)) {
331
+							$newval = strtr($row['value'], array('http://' => 'https://'));
332
+			} else {
333
+							$newval = strtr($row['value'], array('https://' => 'http://'));
334
+			}
323 335
 			$smcFunc['db_query']('', '
324 336
 				UPDATE {db_prefix}themes
325 337
 				   SET value = {string:theme_val}
@@ -359,11 +371,12 @@  discard block
 block discarded – undo
359 371
 
360 372
 	// If leftmost portion of path matches boardurl, return true
361 373
 	$result = strpos($urlpath, $boardurlpath);
362
-	if ($result === false || $result != 0)
363
-		return false;
364
-	else
365
-		return true;
366
-}
374
+	if ($result === false || $result != 0) {
375
+			return false;
376
+	} else {
377
+			return true;
378
+	}
379
+	}
367 380
 
368 381
 /**
369 382
  * Basic database and paths settings - database name, host, etc.
@@ -402,8 +415,9 @@  discard block
 block discarded – undo
402 415
 		$request = $smcFunc['db_query']('', 'SELECT cfgname FROM pg_ts_config', array());
403 416
 		$fts_language = array();
404 417
 
405
-		while ($row = $smcFunc['db_fetch_assoc']($request))
406
-			$fts_language[$row['cfgname']] = $row['cfgname'];
418
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
419
+					$fts_language[$row['cfgname']] = $row['cfgname'];
420
+		}
407 421
 
408 422
 		$config_vars = array_merge ($config_vars, array(
409 423
 				'',
@@ -415,20 +429,22 @@  discard block
 block discarded – undo
415 429
 
416 430
 	call_integration_hook('integrate_database_settings', array(&$config_vars));
417 431
 
418
-	if ($return_config)
419
-		return $config_vars;
432
+	if ($return_config) {
433
+			return $config_vars;
434
+	}
420 435
 
421 436
 	// Setup the template stuff.
422 437
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=database;save';
423 438
 	$context['settings_title'] = $txt['database_settings'];
424 439
 	$context['save_disabled'] = $context['settings_not_writable'];
425 440
 
426
-	if (!$smcFunc['db_allow_persistent']())
427
-		addInlineJavaScript('
441
+	if (!$smcFunc['db_allow_persistent']()) {
442
+			addInlineJavaScript('
428 443
 			$(function()
429 444
 			{
430 445
 				$("#db_persist").prop("disabled", true);
431 446
 			});', true);
447
+	}
432 448
 
433 449
 	// Saving settings?
434 450
 	if (isset($_REQUEST['save']))
@@ -498,13 +514,15 @@  discard block
 block discarded – undo
498 514
 		hideGlobalCookies();
499 515
 	});', true);
500 516
 
501
-	if (empty($user_settings['tfa_secret']))
502
-		addInlineJavaScript('');
517
+	if (empty($user_settings['tfa_secret'])) {
518
+			addInlineJavaScript('');
519
+	}
503 520
 
504 521
 	call_integration_hook('integrate_cookie_settings', array(&$config_vars));
505 522
 
506
-	if ($return_config)
507
-		return $config_vars;
523
+	if ($return_config) {
524
+			return $config_vars;
525
+	}
508 526
 
509 527
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cookie;save';
510 528
 	$context['settings_title'] = $txt['cookies_sessions_settings'];
@@ -515,14 +533,17 @@  discard block
 block discarded – undo
515 533
 		call_integration_hook('integrate_save_cookie_settings');
516 534
 
517 535
 		// Local and global do not play nicely together.
518
-		if (!empty($_POST['localCookies']) && empty($_POST['globalCookies']))
519
-			unset ($_POST['globalCookies']);
536
+		if (!empty($_POST['localCookies']) && empty($_POST['globalCookies'])) {
537
+					unset ($_POST['globalCookies']);
538
+		}
520 539
 
521
-		if (empty($modSettings['localCookies']) != empty($_POST['localCookies']) || empty($modSettings['globalCookies']) != empty($_POST['globalCookies']))
522
-			$scope_changed = true;
540
+		if (empty($modSettings['localCookies']) != empty($_POST['localCookies']) || empty($modSettings['globalCookies']) != empty($_POST['globalCookies'])) {
541
+					$scope_changed = true;
542
+		}
523 543
 
524
-		if (!empty($_POST['globalCookiesDomain']) && strpos($boardurl, $_POST['globalCookiesDomain']) === false)
525
-			fatal_lang_error('invalid_cookie_domain', false);
544
+		if (!empty($_POST['globalCookiesDomain']) && strpos($boardurl, $_POST['globalCookiesDomain']) === false) {
545
+					fatal_lang_error('invalid_cookie_domain', false);
546
+		}
526 547
 
527 548
 		saveSettings($config_vars);
528 549
 
@@ -605,8 +626,9 @@  discard block
 block discarded – undo
605 626
 
606 627
 	call_integration_hook('integrate_general_security_settings', array(&$config_vars));
607 628
 
608
-	if ($return_config)
609
-		return $config_vars;
629
+	if ($return_config) {
630
+			return $config_vars;
631
+	}
610 632
 
611 633
 	// Saving?
612 634
 	if (isset($_GET['save']))
@@ -645,8 +667,7 @@  discard block
 block discarded – undo
645 667
 		$txt['cache_settings_message'] = $txt['detected_no_caching'];
646 668
 		$cache_level = array($txt['cache_off']);
647 669
 		$detected['none'] = $txt['cache_off'];
648
-	}
649
-	else
670
+	} else
650 671
 	{
651 672
 		$txt['cache_settings_message'] = sprintf($txt['detected_accelerators'], implode(', ', $detected));
652 673
 		$cache_level = array($txt['cache_off'], $txt['cache_level1'], $txt['cache_level2'], $txt['cache_level3']);
@@ -683,8 +704,9 @@  discard block
 block discarded – undo
683 704
 			}
684 705
 		}
685 706
 	}
686
-	if ($return_config)
687
-		return $config_vars;
707
+	if ($return_config) {
708
+			return $config_vars;
709
+	}
688 710
 
689 711
 	// Saving again?
690 712
 	if (isset($_GET['save']))
@@ -712,8 +734,9 @@  discard block
 block discarded – undo
712 734
 	$context['save_disabled'] = $context['settings_not_writable'];
713 735
 
714 736
 	// Decide what message to show.
715
-	if (!$context['save_disabled'])
716
-		$context['settings_message'] = $txt['caching_information'];
737
+	if (!$context['save_disabled']) {
738
+			$context['settings_message'] = $txt['caching_information'];
739
+	}
717 740
 
718 741
 	// Prepare the template.
719 742
 	prepareServerSettingsContext($config_vars);
@@ -736,24 +759,25 @@  discard block
 block discarded – undo
736 759
 	if (stripos(PHP_OS, 'win') === 0)
737 760
 	{
738 761
 		$context['settings_message'] = $txt['loadavg_disabled_windows'];
739
-		if (isset($_GET['save']))
740
-			$_SESSION['adm-save'] = $txt['loadavg_disabled_windows'];
741
-	}
742
-	elseif (stripos(PHP_OS, 'darwin') === 0)
762
+		if (isset($_GET['save'])) {
763
+					$_SESSION['adm-save'] = $txt['loadavg_disabled_windows'];
764
+		}
765
+	} elseif (stripos(PHP_OS, 'darwin') === 0)
743 766
 	{
744 767
 		$context['settings_message'] = $txt['loadavg_disabled_osx'];
745
-		if (isset($_GET['save']))
746
-			$_SESSION['adm-save'] = $txt['loadavg_disabled_osx'];
747
-	}
748
-	else
768
+		if (isset($_GET['save'])) {
769
+					$_SESSION['adm-save'] = $txt['loadavg_disabled_osx'];
770
+		}
771
+	} else
749 772
 	{
750 773
 		$modSettings['load_average'] = @file_get_contents('/proc/loadavg');
751
-		if (!empty($modSettings['load_average']) && preg_match('~^([^ ]+?) ([^ ]+?) ([^ ]+)~', $modSettings['load_average'], $matches) !== 0)
752
-			$modSettings['load_average'] = (float) $matches[1];
753
-		elseif (($modSettings['load_average'] = @`uptime`) !== null && preg_match('~load averages?: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)~i', $modSettings['load_average'], $matches) !== 0)
754
-			$modSettings['load_average'] = (float) $matches[1];
755
-		else
756
-			unset($modSettings['load_average']);
774
+		if (!empty($modSettings['load_average']) && preg_match('~^([^ ]+?) ([^ ]+?) ([^ ]+)~', $modSettings['load_average'], $matches) !== 0) {
775
+					$modSettings['load_average'] = (float) $matches[1];
776
+		} elseif (($modSettings['load_average'] = @`uptime`) !== null && preg_match('~load averages?: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)~i', $modSettings['load_average'], $matches) !== 0) {
777
+					$modSettings['load_average'] = (float) $matches[1];
778
+		} else {
779
+					unset($modSettings['load_average']);
780
+		}
757 781
 
758 782
 		if (!empty($modSettings['load_average']) || (isset($modSettings['load_average']) && $modSettings['load_average'] === 0.0))
759 783
 		{
@@ -789,8 +813,9 @@  discard block
 block discarded – undo
789 813
 
790 814
 	call_integration_hook('integrate_loadavg_settings', array(&$config_vars));
791 815
 
792
-	if ($return_config)
793
-		return $config_vars;
816
+	if ($return_config) {
817
+			return $config_vars;
818
+	}
794 819
 
795 820
 	$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=loads;save';
796 821
 	$context['settings_title'] = $txt['load_balancing_settings'];
@@ -801,24 +826,27 @@  discard block
 block discarded – undo
801 826
 		// Stupidity is not allowed.
802 827
 		foreach ($_POST as $key => $value)
803 828
 		{
804
-			if (strpos($key, 'loadavg') === 0 || $key === 'loadavg_enable' || !in_array($key, array_keys($default_values)))
805
-				continue;
806
-			else
807
-				$_POST[$key] = (float) $value;
808
-
809
-			if ($key == 'loadavg_auto_opt' && $value <= 1)
810
-				$_POST['loadavg_auto_opt'] = 1.0;
811
-			elseif ($key == 'loadavg_forum' && $value < 10)
812
-				$_POST['loadavg_forum'] = 10.0;
813
-			elseif ($value < 2)
814
-				$_POST[$key] = 2.0;
829
+			if (strpos($key, 'loadavg') === 0 || $key === 'loadavg_enable' || !in_array($key, array_keys($default_values))) {
830
+							continue;
831
+			} else {
832
+							$_POST[$key] = (float) $value;
833
+			}
834
+
835
+			if ($key == 'loadavg_auto_opt' && $value <= 1) {
836
+							$_POST['loadavg_auto_opt'] = 1.0;
837
+			} elseif ($key == 'loadavg_forum' && $value < 10) {
838
+							$_POST['loadavg_forum'] = 10.0;
839
+			} elseif ($value < 2) {
840
+							$_POST[$key] = 2.0;
841
+			}
815 842
 		}
816 843
 
817 844
 		call_integration_hook('integrate_save_loadavg_settings');
818 845
 
819 846
 		saveDBSettings($config_vars);
820
-		if (!isset($_SESSION['adm-save']))
821
-			$_SESSION['adm-save'] = true;
847
+		if (!isset($_SESSION['adm-save'])) {
848
+					$_SESSION['adm-save'] = true;
849
+		}
822 850
 		redirectexit('action=admin;area=serversettings;sa=loads;' . $context['session_var'] . '=' . $context['session_id']);
823 851
 	}
824 852
 
@@ -854,10 +882,11 @@  discard block
 block discarded – undo
854 882
 
855 883
 	if (isset($_SESSION['adm-save']))
856 884
 	{
857
-		if ($_SESSION['adm-save'] === true)
858
-			$context['saved_successful'] = true;
859
-		else
860
-			$context['saved_failed'] = $_SESSION['adm-save'];
885
+		if ($_SESSION['adm-save'] === true) {
886
+					$context['saved_successful'] = true;
887
+		} else {
888
+					$context['saved_failed'] = $_SESSION['adm-save'];
889
+		}
861 890
 
862 891
 		unset($_SESSION['adm-save']);
863 892
 	}
@@ -865,9 +894,9 @@  discard block
 block discarded – undo
865 894
 	$context['config_vars'] = array();
866 895
 	foreach ($config_vars as $identifier => $config_var)
867 896
 	{
868
-		if (!is_array($config_var) || !isset($config_var[1]))
869
-			$context['config_vars'][] = $config_var;
870
-		else
897
+		if (!is_array($config_var) || !isset($config_var[1])) {
898
+					$context['config_vars'][] = $config_var;
899
+		} else
871 900
 		{
872 901
 			$varname = $config_var[0];
873 902
 			global $$varname;
@@ -902,16 +931,19 @@  discard block
 block discarded – undo
902 931
 			if ($config_var[3] == 'int' || $config_var[3] == 'float')
903 932
 			{
904 933
 				// Default to a min of 0 if one isn't set
905
-				if (isset($config_var['min']))
906
-					$context['config_vars'][$config_var[0]]['min'] = $config_var['min'];
907
-				else
908
-					$context['config_vars'][$config_var[0]]['min'] = 0;
934
+				if (isset($config_var['min'])) {
935
+									$context['config_vars'][$config_var[0]]['min'] = $config_var['min'];
936
+				} else {
937
+									$context['config_vars'][$config_var[0]]['min'] = 0;
938
+				}
909 939
 
910
-				if (isset($config_var['max']))
911
-					$context['config_vars'][$config_var[0]]['max'] = $config_var['max'];
940
+				if (isset($config_var['max'])) {
941
+									$context['config_vars'][$config_var[0]]['max'] = $config_var['max'];
942
+				}
912 943
 
913
-				if (isset($config_var['step']))
914
-					$context['config_vars'][$config_var[0]]['step'] = $config_var['step'];
944
+				if (isset($config_var['step'])) {
945
+									$context['config_vars'][$config_var[0]]['step'] = $config_var['step'];
946
+				}
915 947
 			}
916 948
 
917 949
 			// If this is a select box handle any data.
@@ -919,12 +951,13 @@  discard block
 block discarded – undo
919 951
 			{
920 952
 				// If it's associative
921 953
 				$config_values = array_values($config_var[4]);
922
-				if (isset($config_values[0]) && is_array($config_values[0]))
923
-					$context['config_vars'][$config_var[0]]['data'] = $config_var[4];
924
-				else
954
+				if (isset($config_values[0]) && is_array($config_values[0])) {
955
+									$context['config_vars'][$config_var[0]]['data'] = $config_var[4];
956
+				} else
925 957
 				{
926
-					foreach ($config_var[4] as $key => $item)
927
-						$context['config_vars'][$config_var[0]]['data'][] = array($key, $item);
958
+					foreach ($config_var[4] as $key => $item) {
959
+											$context['config_vars'][$config_var[0]]['data'][] = array($key, $item);
960
+					}
928 961
 				}
929 962
 			}
930 963
 		}
@@ -949,10 +982,11 @@  discard block
 block discarded – undo
949 982
 
950 983
 	if (isset($_SESSION['adm-save']))
951 984
 	{
952
-		if ($_SESSION['adm-save'] === true)
953
-			$context['saved_successful'] = true;
954
-		else
955
-			$context['saved_failed'] = $_SESSION['adm-save'];
985
+		if ($_SESSION['adm-save'] === true) {
986
+					$context['saved_successful'] = true;
987
+		} else {
988
+					$context['saved_failed'] = $_SESSION['adm-save'];
989
+		}
956 990
 
957 991
 		unset($_SESSION['adm-save']);
958 992
 	}
@@ -964,26 +998,30 @@  discard block
 block discarded – undo
964 998
 	foreach ($config_vars as $config_var)
965 999
 	{
966 1000
 		// HR?
967
-		if (!is_array($config_var))
968
-			$context['config_vars'][] = $config_var;
969
-		else
1001
+		if (!is_array($config_var)) {
1002
+					$context['config_vars'][] = $config_var;
1003
+		} else
970 1004
 		{
971 1005
 			// If it has no name it doesn't have any purpose!
972
-			if (empty($config_var[1]))
973
-				continue;
1006
+			if (empty($config_var[1])) {
1007
+							continue;
1008
+			}
974 1009
 
975 1010
 			// Special case for inline permissions
976
-			if ($config_var[0] == 'permissions' && allowedTo('manage_permissions'))
977
-				$inlinePermissions[] = $config_var[1];
978
-			elseif ($config_var[0] == 'permissions')
979
-				continue;
1011
+			if ($config_var[0] == 'permissions' && allowedTo('manage_permissions')) {
1012
+							$inlinePermissions[] = $config_var[1];
1013
+			} elseif ($config_var[0] == 'permissions') {
1014
+							continue;
1015
+			}
980 1016
 
981
-			if ($config_var[0] == 'boards')
982
-				$board_list = true;
1017
+			if ($config_var[0] == 'boards') {
1018
+							$board_list = true;
1019
+			}
983 1020
 
984 1021
 			// Are we showing the BBC selection box?
985
-			if ($config_var[0] == 'bbc')
986
-				$bbcChoice[] = $config_var[1];
1022
+			if ($config_var[0] == 'bbc') {
1023
+							$bbcChoice[] = $config_var[1];
1024
+			}
987 1025
 
988 1026
 			// We need to do some parsing of the value before we pass it in.
989 1027
 			if (isset($modSettings[$config_var[1]]))
@@ -1002,8 +1040,7 @@  discard block
 block discarded – undo
1002 1040
 					default:
1003 1041
 						$value = $smcFunc['htmlspecialchars']($modSettings[$config_var[1]]);
1004 1042
 				}
1005
-			}
1006
-			else
1043
+			} else
1007 1044
 			{
1008 1045
 				// Darn, it's empty. What type is expected?
1009 1046
 				switch ($config_var[0])
@@ -1043,16 +1080,19 @@  discard block
 block discarded – undo
1043 1080
 			if ($config_var[0] == 'int' || $config_var[0] == 'float')
1044 1081
 			{
1045 1082
 				// Default to a min of 0 if one isn't set
1046
-				if (isset($config_var['min']))
1047
-					$context['config_vars'][$config_var[1]]['min'] = $config_var['min'];
1048
-				else
1049
-					$context['config_vars'][$config_var[1]]['min'] = 0;
1083
+				if (isset($config_var['min'])) {
1084
+									$context['config_vars'][$config_var[1]]['min'] = $config_var['min'];
1085
+				} else {
1086
+									$context['config_vars'][$config_var[1]]['min'] = 0;
1087
+				}
1050 1088
 
1051
-				if (isset($config_var['max']))
1052
-					$context['config_vars'][$config_var[1]]['max'] = $config_var['max'];
1089
+				if (isset($config_var['max'])) {
1090
+									$context['config_vars'][$config_var[1]]['max'] = $config_var['max'];
1091
+				}
1053 1092
 
1054
-				if (isset($config_var['step']))
1055
-					$context['config_vars'][$config_var[1]]['step'] = $config_var['step'];
1093
+				if (isset($config_var['step'])) {
1094
+									$context['config_vars'][$config_var[1]]['step'] = $config_var['step'];
1095
+				}
1056 1096
 			}
1057 1097
 
1058 1098
 			// If this is a select box handle any data.
@@ -1066,12 +1106,13 @@  discard block
 block discarded – undo
1066 1106
 				}
1067 1107
 
1068 1108
 				// If it's associative
1069
-				if (isset($config_var[2][0]) && is_array($config_var[2][0]))
1070
-					$context['config_vars'][$config_var[1]]['data'] = $config_var[2];
1071
-				else
1109
+				if (isset($config_var[2][0]) && is_array($config_var[2][0])) {
1110
+									$context['config_vars'][$config_var[1]]['data'] = $config_var[2];
1111
+				} else
1072 1112
 				{
1073
-					foreach ($config_var[2] as $key => $item)
1074
-						$context['config_vars'][$config_var[1]]['data'][] = array($key, $item);
1113
+					foreach ($config_var[2] as $key => $item) {
1114
+											$context['config_vars'][$config_var[1]]['data'][] = array($key, $item);
1115
+					}
1075 1116
 				}
1076 1117
 			}
1077 1118
 
@@ -1080,17 +1121,19 @@  discard block
 block discarded – undo
1080 1121
 			{
1081 1122
 				if (!is_numeric($k))
1082 1123
 				{
1083
-					if (substr($k, 0, 2) == 'on')
1084
-						$context['config_vars'][$config_var[1]]['javascript'] .= ' ' . $k . '="' . $v . '"';
1085
-					else
1086
-						$context['config_vars'][$config_var[1]][$k] = $v;
1124
+					if (substr($k, 0, 2) == 'on') {
1125
+											$context['config_vars'][$config_var[1]]['javascript'] .= ' ' . $k . '="' . $v . '"';
1126
+					} else {
1127
+											$context['config_vars'][$config_var[1]][$k] = $v;
1128
+					}
1087 1129
 				}
1088 1130
 
1089 1131
 				// See if there are any other labels that might fit?
1090
-				if (isset($txt['setting_' . $config_var[1]]))
1091
-					$context['config_vars'][$config_var[1]]['label'] = $txt['setting_' . $config_var[1]];
1092
-				elseif (isset($txt['groups_' . $config_var[1]]))
1093
-					$context['config_vars'][$config_var[1]]['label'] = $txt['groups_' . $config_var[1]];
1132
+				if (isset($txt['setting_' . $config_var[1]])) {
1133
+									$context['config_vars'][$config_var[1]]['label'] = $txt['setting_' . $config_var[1]];
1134
+				} elseif (isset($txt['groups_' . $config_var[1]])) {
1135
+									$context['config_vars'][$config_var[1]]['label'] = $txt['groups_' . $config_var[1]];
1136
+				}
1094 1137
 			}
1095 1138
 
1096 1139
 			// Set the subtext in case it's part of the label.
@@ -1123,8 +1166,9 @@  discard block
 block discarded – undo
1123 1166
 		// What are the options, eh?
1124 1167
 		$temp = parse_bbc(false);
1125 1168
 		$bbcTags = array();
1126
-		foreach ($temp as $tag)
1127
-			$bbcTags[] = $tag['tag'];
1169
+		foreach ($temp as $tag) {
1170
+					$bbcTags[] = $tag['tag'];
1171
+		}
1128 1172
 
1129 1173
 		$bbcTags = array_unique($bbcTags);
1130 1174
 		$totalTags = count($bbcTags);
@@ -1139,8 +1183,9 @@  discard block
 block discarded – undo
1139 1183
 		$col = 0; $i = 0;
1140 1184
 		foreach ($bbcTags as $tag)
1141 1185
 		{
1142
-			if ($i % $tagsPerColumn == 0 && $i != 0)
1143
-				$col++;
1186
+			if ($i % $tagsPerColumn == 0 && $i != 0) {
1187
+							$col++;
1188
+			}
1144 1189
 
1145 1190
 			$context['bbc_columns'][$col][] = array(
1146 1191
 				'tag' => $tag,
@@ -1183,18 +1228,21 @@  discard block
 block discarded – undo
1183 1228
 	validateToken('admin-ssc');
1184 1229
 
1185 1230
 	// Fix the darn stupid cookiename! (more may not be allowed, but these for sure!)
1186
-	if (isset($_POST['cookiename']))
1187
-		$_POST['cookiename'] = preg_replace('~[,;\s\.$]+~' . ($context['utf8'] ? 'u' : ''), '', $_POST['cookiename']);
1231
+	if (isset($_POST['cookiename'])) {
1232
+			$_POST['cookiename'] = preg_replace('~[,;\s\.$]+~' . ($context['utf8'] ? 'u' : ''), '', $_POST['cookiename']);
1233
+	}
1188 1234
 
1189 1235
 	// Fix the forum's URL if necessary.
1190 1236
 	if (isset($_POST['boardurl']))
1191 1237
 	{
1192
-		if (substr($_POST['boardurl'], -10) == '/index.php')
1193
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
1194
-		elseif (substr($_POST['boardurl'], -1) == '/')
1195
-			$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
1196
-		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://')
1197
-			$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
1238
+		if (substr($_POST['boardurl'], -10) == '/index.php') {
1239
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
1240
+		} elseif (substr($_POST['boardurl'], -1) == '/') {
1241
+					$_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
1242
+		}
1243
+		if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') {
1244
+					$_POST['boardurl'] = 'http://' . $_POST['boardurl'];
1245
+		}
1198 1246
 	}
1199 1247
 
1200 1248
 	// Any passwords?
@@ -1229,21 +1277,21 @@  discard block
 block discarded – undo
1229 1277
 	// Figure out which config vars we're saving here...
1230 1278
 	foreach ($config_vars as $var)
1231 1279
 	{
1232
-		if (!is_array($var) || $var[2] != 'file' || (!in_array($var[0], $config_bools) && !isset($_POST[$var[0]])))
1233
-			continue;
1280
+		if (!is_array($var) || $var[2] != 'file' || (!in_array($var[0], $config_bools) && !isset($_POST[$var[0]]))) {
1281
+					continue;
1282
+		}
1234 1283
 
1235 1284
 		$config_var = $var[0];
1236 1285
 
1237 1286
 		if (in_array($config_var, $config_passwords))
1238 1287
 		{
1239
-			if (isset($_POST[$config_var][1]) && $_POST[$config_var][0] == $_POST[$config_var][1])
1240
-				$new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var][0], '\'\\') . '\'';
1241
-		}
1242
-		elseif (in_array($config_var, $config_strs))
1288
+			if (isset($_POST[$config_var][1]) && $_POST[$config_var][0] == $_POST[$config_var][1]) {
1289
+							$new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var][0], '\'\\') . '\'';
1290
+			}
1291
+		} elseif (in_array($config_var, $config_strs))
1243 1292
 		{
1244 1293
 			$new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var], '\'\\') . '\'';
1245
-		}
1246
-		elseif (in_array($config_var, $config_ints))
1294
+		} elseif (in_array($config_var, $config_ints))
1247 1295
 		{
1248 1296
 			$new_settings[$config_var] = (int) $_POST[$config_var];
1249 1297
 
@@ -1252,17 +1300,17 @@  discard block
 block discarded – undo
1252 1300
 			$new_settings[$config_var] = max($min, $new_settings[$config_var]);
1253 1301
 
1254 1302
 			// Is there a max value for this as well?
1255
-			if (isset($var['max']))
1256
-				$new_settings[$config_var] = min($var['max'], $new_settings[$config_var]);
1257
-		}
1258
-		elseif (in_array($config_var, $config_bools))
1303
+			if (isset($var['max'])) {
1304
+							$new_settings[$config_var] = min($var['max'], $new_settings[$config_var]);
1305
+			}
1306
+		} elseif (in_array($config_var, $config_bools))
1259 1307
 		{
1260
-			if (!empty($_POST[$config_var]))
1261
-				$new_settings[$config_var] = '1';
1262
-			else
1263
-				$new_settings[$config_var] = '0';
1264
-		}
1265
-		else
1308
+			if (!empty($_POST[$config_var])) {
1309
+							$new_settings[$config_var] = '1';
1310
+			} else {
1311
+							$new_settings[$config_var] = '0';
1312
+			}
1313
+		} else
1266 1314
 		{
1267 1315
 			// This shouldn't happen, but it might...
1268 1316
 			fatal_error('Unknown config_var \'' . $config_var . '\'');
@@ -1278,30 +1326,35 @@  discard block
 block discarded – undo
1278 1326
 	foreach ($config_vars as $config_var)
1279 1327
 	{
1280 1328
 		// We just saved the file-based settings, so skip their definitions.
1281
-		if (!is_array($config_var) || $config_var[2] == 'file')
1282
-			continue;
1329
+		if (!is_array($config_var) || $config_var[2] == 'file') {
1330
+					continue;
1331
+		}
1283 1332
 
1284 1333
 		$new_setting = array($config_var[3], $config_var[0]);
1285 1334
 
1286 1335
 		// Select options need carried over, too.
1287
-		if (isset($config_var[4]))
1288
-			$new_setting[] = $config_var[4];
1336
+		if (isset($config_var[4])) {
1337
+					$new_setting[] = $config_var[4];
1338
+		}
1289 1339
 
1290 1340
 		// Include min and max if necessary
1291
-		if (isset($config_var['min']))
1292
-			$new_setting['min'] = $config_var['min'];
1341
+		if (isset($config_var['min'])) {
1342
+					$new_setting['min'] = $config_var['min'];
1343
+		}
1293 1344
 
1294
-		if (isset($config_var['max']))
1295
-			$new_setting['max'] = $config_var['max'];
1345
+		if (isset($config_var['max'])) {
1346
+					$new_setting['max'] = $config_var['max'];
1347
+		}
1296 1348
 
1297 1349
 		// Rewrite the definition a bit.
1298 1350
 		$new_settings[] = $new_setting;
1299 1351
 	}
1300 1352
 
1301 1353
 	// Save the new database-based settings, if any.
1302
-	if (!empty($new_settings))
1303
-		saveDBSettings($new_settings);
1304
-}
1354
+	if (!empty($new_settings)) {
1355
+			saveDBSettings($new_settings);
1356
+	}
1357
+	}
1305 1358
 
1306 1359
 /**
1307 1360
  * Helper function for saving database settings.
@@ -1319,22 +1372,25 @@  discard block
 block discarded – undo
1319 1372
 	$inlinePermissions = array();
1320 1373
 	foreach ($config_vars as $var)
1321 1374
 	{
1322
-		if (!isset($var[1]) || (!isset($_POST[$var[1]]) && $var[0] != 'check' && $var[0] != 'permissions' && $var[0] != 'boards' && ($var[0] != 'bbc' || !isset($_POST[$var[1] . '_enabledTags']))))
1323
-			continue;
1375
+		if (!isset($var[1]) || (!isset($_POST[$var[1]]) && $var[0] != 'check' && $var[0] != 'permissions' && $var[0] != 'boards' && ($var[0] != 'bbc' || !isset($_POST[$var[1] . '_enabledTags'])))) {
1376
+					continue;
1377
+		}
1324 1378
 
1325 1379
 		// Checkboxes!
1326
-		elseif ($var[0] == 'check')
1327
-			$setArray[$var[1]] = !empty($_POST[$var[1]]) ? '1' : '0';
1380
+		elseif ($var[0] == 'check') {
1381
+					$setArray[$var[1]] = !empty($_POST[$var[1]]) ? '1' : '0';
1382
+		}
1328 1383
 		// Select boxes!
1329
-		elseif ($var[0] == 'select' && in_array($_POST[$var[1]], array_keys($var[2])))
1330
-			$setArray[$var[1]] = $_POST[$var[1]];
1331
-		elseif ($var[0] == 'select' && !empty($var['multiple']) && array_intersect($_POST[$var[1]], array_keys($var[2])) != array())
1384
+		elseif ($var[0] == 'select' && in_array($_POST[$var[1]], array_keys($var[2]))) {
1385
+					$setArray[$var[1]] = $_POST[$var[1]];
1386
+		} elseif ($var[0] == 'select' && !empty($var['multiple']) && array_intersect($_POST[$var[1]], array_keys($var[2])) != array())
1332 1387
 		{
1333 1388
 			// For security purposes we validate this line by line.
1334 1389
 			$lOptions = array();
1335
-			foreach ($_POST[$var[1]] as $invar)
1336
-				if (in_array($invar, array_keys($var[2])))
1390
+			foreach ($_POST[$var[1]] as $invar) {
1391
+							if (in_array($invar, array_keys($var[2])))
1337 1392
 					$lOptions[] = $invar;
1393
+			}
1338 1394
 
1339 1395
 			$setArray[$var[1]] = $smcFunc['json_encode']($lOptions);
1340 1396
 		}
@@ -1348,18 +1404,20 @@  discard block
 block discarded – undo
1348 1404
 				$request = $smcFunc['db_query']('', '
1349 1405
 					SELECT id_board
1350 1406
 					FROM {db_prefix}boards');
1351
-				while ($row = $smcFunc['db_fetch_row']($request))
1352
-					$board_list[$row[0]] = true;
1407
+				while ($row = $smcFunc['db_fetch_row']($request)) {
1408
+									$board_list[$row[0]] = true;
1409
+				}
1353 1410
 
1354 1411
 				$smcFunc['db_free_result']($request);
1355 1412
 			}
1356 1413
 
1357 1414
 			$lOptions = array();
1358 1415
 
1359
-			if (!empty($_POST[$var[1]]))
1360
-				foreach ($_POST[$var[1]] as $invar => $dummy)
1416
+			if (!empty($_POST[$var[1]])) {
1417
+							foreach ($_POST[$var[1]] as $invar => $dummy)
1361 1418
 					if (isset($board_list[$invar]))
1362 1419
 						$lOptions[] = $invar;
1420
+			}
1363 1421
 
1364 1422
 			$setArray[$var[1]] = !empty($lOptions) ? implode(',', $lOptions) : '';
1365 1423
 		}
@@ -1373,8 +1431,9 @@  discard block
 block discarded – undo
1373 1431
 			$setArray[$var[1]] = max($min, $setArray[$var[1]]);
1374 1432
 
1375 1433
 			// Do we have a max value for this as well?
1376
-			if (isset($var['max']))
1377
-				$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1434
+			if (isset($var['max'])) {
1435
+							$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1436
+			}
1378 1437
 		}
1379 1438
 		// Floating point!
1380 1439
 		elseif ($var[0] == 'float')
@@ -1386,39 +1445,46 @@  discard block
 block discarded – undo
1386 1445
 			$setArray[$var[1]] = max($min, $setArray[$var[1]]);
1387 1446
 
1388 1447
 			// Do we have a max value for this as well?
1389
-			if (isset($var['max']))
1390
-				$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1448
+			if (isset($var['max'])) {
1449
+							$setArray[$var[1]] = min($var['max'], $setArray[$var[1]]);
1450
+			}
1391 1451
 		}
1392 1452
 		// Text!
1393
-		elseif (in_array($var[0], array('text', 'large_text', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time')))
1394
-			$setArray[$var[1]] = $_POST[$var[1]];
1453
+		elseif (in_array($var[0], array('text', 'large_text', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'))) {
1454
+					$setArray[$var[1]] = $_POST[$var[1]];
1455
+		}
1395 1456
 		// Passwords!
1396 1457
 		elseif ($var[0] == 'password')
1397 1458
 		{
1398
-			if (isset($_POST[$var[1]][1]) && $_POST[$var[1]][0] == $_POST[$var[1]][1])
1399
-				$setArray[$var[1]] = $_POST[$var[1]][0];
1459
+			if (isset($_POST[$var[1]][1]) && $_POST[$var[1]][0] == $_POST[$var[1]][1]) {
1460
+							$setArray[$var[1]] = $_POST[$var[1]][0];
1461
+			}
1400 1462
 		}
1401 1463
 		// BBC.
1402 1464
 		elseif ($var[0] == 'bbc')
1403 1465
 		{
1404 1466
 			$bbcTags = array();
1405
-			foreach (parse_bbc(false) as $tag)
1406
-				$bbcTags[] = $tag['tag'];
1467
+			foreach (parse_bbc(false) as $tag) {
1468
+							$bbcTags[] = $tag['tag'];
1469
+			}
1407 1470
 
1408
-			if (!isset($_POST[$var[1] . '_enabledTags']))
1409
-				$_POST[$var[1] . '_enabledTags'] = array();
1410
-			elseif (!is_array($_POST[$var[1] . '_enabledTags']))
1411
-				$_POST[$var[1] . '_enabledTags'] = array($_POST[$var[1] . '_enabledTags']);
1471
+			if (!isset($_POST[$var[1] . '_enabledTags'])) {
1472
+							$_POST[$var[1] . '_enabledTags'] = array();
1473
+			} elseif (!is_array($_POST[$var[1] . '_enabledTags'])) {
1474
+							$_POST[$var[1] . '_enabledTags'] = array($_POST[$var[1] . '_enabledTags']);
1475
+			}
1412 1476
 
1413 1477
 			$setArray[$var[1]] = implode(',', array_diff($bbcTags, $_POST[$var[1] . '_enabledTags']));
1414 1478
 		}
1415 1479
 		// Permissions?
1416
-		elseif ($var[0] == 'permissions')
1417
-			$inlinePermissions[] = $var[1];
1480
+		elseif ($var[0] == 'permissions') {
1481
+					$inlinePermissions[] = $var[1];
1482
+		}
1418 1483
 	}
1419 1484
 
1420
-	if (!empty($setArray))
1421
-		updateSettings($setArray);
1485
+	if (!empty($setArray)) {
1486
+			updateSettings($setArray);
1487
+	}
1422 1488
 
1423 1489
 	// If we have inline permissions we need to save them.
1424 1490
 	if (!empty($inlinePermissions) && allowedTo('manage_permissions'))
@@ -1455,18 +1521,21 @@  discard block
 block discarded – undo
1455 1521
 	// put all of it into an array
1456 1522
 	foreach ($info_lines as $line)
1457 1523
 	{
1458
-		if (preg_match('~(' . $remove . ')~', $line))
1459
-			continue;
1524
+		if (preg_match('~(' . $remove . ')~', $line)) {
1525
+					continue;
1526
+		}
1460 1527
 
1461 1528
 		// new category?
1462
-		if (strpos($line, '<h2>') !== false)
1463
-			$category = preg_match('~<h2>(.*)</h2>~', $line, $title) ? $category = $title[1] : $category;
1529
+		if (strpos($line, '<h2>') !== false) {
1530
+					$category = preg_match('~<h2>(.*)</h2>~', $line, $title) ? $category = $title[1] : $category;
1531
+		}
1464 1532
 
1465 1533
 		// load it as setting => value or the old setting local master
1466
-		if (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val))
1467
-			$pinfo[$category][$val[1]] = $val[2];
1468
-		elseif (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val))
1469
-			$pinfo[$category][$val[1]] = array($txt['phpinfo_localsettings'] => $val[2], $txt['phpinfo_defaultsettings'] => $val[3]);
1534
+		if (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val)) {
1535
+					$pinfo[$category][$val[1]] = $val[2];
1536
+		} elseif (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val)) {
1537
+					$pinfo[$category][$val[1]] = array($txt['phpinfo_localsettings'] => $val[2], $txt['phpinfo_defaultsettings'] => $val[3]);
1538
+		}
1470 1539
 	}
1471 1540
 
1472 1541
 	// load it in to context and display it
@@ -1501,8 +1570,9 @@  discard block
 block discarded – undo
1501 1570
 				$testAPI = new $cache_class_name();
1502 1571
 
1503 1572
 				// No Support?  NEXT!
1504
-				if (!$testAPI->isSupported(true))
1505
-					continue;
1573
+				if (!$testAPI->isSupported(true)) {
1574
+									continue;
1575
+				}
1506 1576
 
1507 1577
 				$apis[$tryCache] = isset($txt[$tryCache . '_cache']) ? $txt[$tryCache . '_cache'] : $tryCache;
1508 1578
 			}
@@ -1527,8 +1597,9 @@  discard block
 block discarded – undo
1527 1597
 	global $modSettings, $boardurl, $smcFunc;
1528 1598
 
1529 1599
 	// Already have a key?  Can't register again.
1530
-	if (!empty($modSettings['sm_stats_key']))
1531
-		return true;
1600
+	if (!empty($modSettings['sm_stats_key'])) {
1601
+			return true;
1602
+	}
1532 1603
 
1533 1604
 	$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
1534 1605
 	if ($fp)
@@ -1539,8 +1610,9 @@  discard block
 block discarded – undo
1539 1610
 		fwrite($fp, $out);
1540 1611
 
1541 1612
 		$return_data = '';
1542
-		while (!feof($fp))
1543
-			$return_data .= fgets($fp, 128);
1613
+		while (!feof($fp)) {
1614
+					$return_data .= fgets($fp, 128);
1615
+		}
1544 1616
 
1545 1617
 		fclose($fp);
1546 1618
 
Please login to merge, or discard this patch.