Completed
Push — release-2.1 ( 7e16ce...4e239b )
by Mathias
08:01
created
Sources/ManageServer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
 		while ($row = $smcFunc['db_fetch_assoc']($request))
252 252
 			$fts_language[$row['cfgname']] = $row['cfgname'];
253 253
 		
254
-		$config_vars = array_merge ($config_vars, array(
254
+		$config_vars = array_merge($config_vars, array(
255 255
 				'',
256 256
 				array('search_language', $txt['search_language'], 'db', 'select', $fts_language, 'pgFulltextSearch')
257 257
 			)
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
801 801
 		if (empty($unsupportedFormats))
802 802
 		{
803
-			foreach($strftimeFormatSubstitutions as $format => $substitution)
803
+			foreach ($strftimeFormatSubstitutions as $format => $substitution)
804 804
 			{
805 805
 				$value = @strftime('%' . $format);
806 806
 
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 					'height' => array('optional' => true, 'match' => '(\d+)'),
1166 1166
 				),
1167 1167
 				'content' => '$1',
1168
-				'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1168
+				'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1169 1169
 				{
1170 1170
 					$returnContext = '';
1171 1171
 
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 						}
1201 1201
 
1202 1202
 						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1203
-							$returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>';
1203
+							$returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '"' . $alt . $title . ' id="thumb_' . $currentAttachment['id'] . '" class="atc_img"></a>';
1204 1204
 						else
1205 1205
 							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1206 1206
 					}
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 				'type' => 'unparsed_content',
1230 1230
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1231 1231
 				// @todo Maybe this can be simplified?
1232
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1232
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1233 1233
 				{
1234 1234
 					if (!isset($disabled['code']))
1235 1235
 					{
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 				'type' => 'unparsed_equals_content',
1267 1267
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1268 1268
 				// @todo Maybe this can be simplified?
1269
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1269
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1270 1270
 				{
1271 1271
 					if (!isset($disabled['code']))
1272 1272
 					{
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 				'type' => 'unparsed_content',
1311 1311
 				'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
1312 1312
 				// @todo Should this respect guest_hideContacts?
1313
-				'validate' => function (&$tag, &$data, $disabled)
1313
+				'validate' => function(&$tag, &$data, $disabled)
1314 1314
 				{
1315 1315
 					$data = strtr($data, array('<br>' => ''));
1316 1316
 				},
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 				'type' => 'unparsed_commas_content',
1330 1330
 				'test' => '\d+,\d+\]',
1331 1331
 				'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">',
1332
-				'validate' => function (&$tag, &$data, $disabled)
1332
+				'validate' => function(&$tag, &$data, $disabled)
1333 1333
 				{
1334 1334
 					if (isset($disabled['url']))
1335 1335
 						$tag['content'] = '$1';
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 				'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]',
1346 1346
 				'before' => '<div $1>',
1347 1347
 				'after' => '</div>',
1348
-				'validate' => function (&$tag, &$data, $disabled)
1348
+				'validate' => function(&$tag, &$data, $disabled)
1349 1349
 				{
1350 1350
 					$class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"';
1351 1351
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 					'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
1395 1395
 				),
1396 1396
 				'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">',
1397
-				'validate' => function (&$tag, &$data, $disabled)
1397
+				'validate' => function(&$tag, &$data, $disabled)
1398 1398
 				{
1399 1399
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1400 1400
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 				'tag' => 'img',
1418 1418
 				'type' => 'unparsed_content',
1419 1419
 				'content' => '<img src="$1" alt="" class="bbc_img">',
1420
-				'validate' => function (&$tag, &$data, $disabled)
1420
+				'validate' => function(&$tag, &$data, $disabled)
1421 1421
 				{
1422 1422
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1423 1423
 
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 				'tag' => 'iurl',
1441 1441
 				'type' => 'unparsed_content',
1442 1442
 				'content' => '<a href="$1" class="bbc_link">$1</a>',
1443
-				'validate' => function (&$tag, &$data, $disabled)
1443
+				'validate' => function(&$tag, &$data, $disabled)
1444 1444
 				{
1445 1445
 					$data = strtr($data, array('<br>' => ''));
1446 1446
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 				'quoted' => 'optional',
1455 1455
 				'before' => '<a href="$1" class="bbc_link">',
1456 1456
 				'after' => '</a>',
1457
-				'validate' => function (&$tag, &$data, $disabled)
1457
+				'validate' => function(&$tag, &$data, $disabled)
1458 1458
 				{
1459 1459
 					if (substr($data, 0, 1) == '#')
1460 1460
 						$data = '#post_' . substr($data, 1);
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 				'tag' => 'php',
1535 1535
 				'type' => 'unparsed_content',
1536 1536
 				'content' => '<span class="phpcode">$1</span>',
1537
-				'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled)
1537
+				'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled)
1538 1538
 				{
1539 1539
 					if (!isset($disabled['php']))
1540 1540
 					{
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 				'test' => '[1-7]\]',
1633 1633
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1634 1634
 				'after' => '</span>',
1635
-				'validate' => function (&$tag, &$data, $disabled)
1635
+				'validate' => function(&$tag, &$data, $disabled)
1636 1636
 				{
1637 1637
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1638 1638
 					$data = $sizes[$data] . 'em';
@@ -1670,7 +1670,7 @@  discard block
 block discarded – undo
1670 1670
 				'tag' => 'time',
1671 1671
 				'type' => 'unparsed_content',
1672 1672
 				'content' => '$1',
1673
-				'validate' => function (&$tag, &$data, $disabled)
1673
+				'validate' => function(&$tag, &$data, $disabled)
1674 1674
 				{
1675 1675
 					if (is_numeric($data))
1676 1676
 						$data = timeformat($data);
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 				'tag' => 'url',
1699 1699
 				'type' => 'unparsed_content',
1700 1700
 				'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
1701
-				'validate' => function (&$tag, &$data, $disabled)
1701
+				'validate' => function(&$tag, &$data, $disabled)
1702 1702
 				{
1703 1703
 					$data = strtr($data, array('<br>' => ''));
1704 1704
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 				'quoted' => 'optional',
1713 1713
 				'before' => '<a href="$1" class="bbc_link" target="_blank">',
1714 1714
 				'after' => '</a>',
1715
-				'validate' => function (&$tag, &$data, $disabled)
1715
+				'validate' => function(&$tag, &$data, $disabled)
1716 1716
 				{
1717 1717
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1718 1718
 					if (empty($scheme))
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 		{
1739 1739
 			if (isset($temp_bbc))
1740 1740
 				$bbc_codes = $temp_bbc;
1741
-			usort($codes, function ($a, $b) {
1741
+			usort($codes, function($a, $b) {
1742 1742
 				return strcmp($a['tag'], $b['tag']);
1743 1743
 			});
1744 1744
 			return $codes;
@@ -1975,7 +1975,7 @@  discard block
 block discarded – undo
1975 1975
 										# a run of Unicode domain name characters and a dot
1976 1976
 										[\p{L}\p{M}\p{N}\-.:@]+\.
1977 1977
 										# and then a TLD valid in the DNS or the reserved "local" TLD
1978
-										(?:'. $modSettings['tld_regex'] .'|local)
1978
+										(?:'. $modSettings['tld_regex'] . '|local)
1979 1979
 									)
1980 1980
 									# followed by a non-domain character or end of line
1981 1981
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 						)?
2044 2044
 						';
2045 2045
 
2046
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2046
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
2047 2047
 							$url = array_shift($matches);
2048 2048
 
2049 2049
 							$scheme = parse_url($url, PHP_URL_SCHEME);
@@ -2780,7 +2780,7 @@  discard block
 block discarded – undo
2780 2780
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
2781 2781
 		{
2782 2782
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2783
-			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2783
+			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2784 2784
 
2785 2785
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2786 2786
 
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
 
2798 2798
 	// Replace away!
2799 2799
 	$message = preg_replace_callback($smileyPregSearch,
2800
-		function ($matches) use ($smileyPregReplacements)
2800
+		function($matches) use ($smileyPregReplacements)
2801 2801
 		{
2802 2802
 			return $smileyPregReplacements[$matches[1]];
2803 2803
 		}, $message);
@@ -2863,13 +2863,13 @@  discard block
 block discarded – undo
2863 2863
 	{
2864 2864
 		if (defined('SID') && SID != '')
2865 2865
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
2866
-				function ($m) use ($scripturl)
2866
+				function($m) use ($scripturl)
2867 2867
 				{
2868
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
2868
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
2869 2869
 				}, $setLocation);
2870 2870
 		else
2871 2871
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
2872
-				function ($m) use ($scripturl)
2872
+				function($m) use ($scripturl)
2873 2873
 				{
2874 2874
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
2875 2875
 				}, $setLocation);
@@ -3192,7 +3192,7 @@  discard block
 block discarded – undo
3192 3192
 
3193 3193
 	// Add a generic "Are you sure?" confirmation message.
3194 3194
 	addInlineJavaScript('
3195
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3195
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3196 3196
 
3197 3197
 	// Now add the capping code for avatars.
3198 3198
 	if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize')
@@ -3553,7 +3553,7 @@  discard block
 block discarded – undo
3553 3553
 
3554 3554
 		else
3555 3555
 			echo '
3556
-	<script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>';
3556
+	<script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>';
3557 3557
 	}
3558 3558
 
3559 3559
 	// Inline JavaScript - Actually useful some times!
@@ -3631,14 +3631,14 @@  discard block
 block discarded – undo
3631 3631
 
3632 3632
 		else
3633 3633
 			echo '
3634
-	<link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">';
3634
+	<link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">';
3635 3635
 	}
3636 3636
 
3637 3637
 	// Print the rest after the minified files.
3638 3638
 	if (!empty($normal))
3639 3639
 		foreach ($normal as $nf)
3640 3640
 			echo '
3641
-	<link rel="stylesheet" href="', $nf ,'">';
3641
+	<link rel="stylesheet" href="', $nf, '">';
3642 3642
 
3643 3643
 	if ($db_show_debug === true)
3644 3644
 	{
@@ -3654,7 +3654,7 @@  discard block
 block discarded – undo
3654 3654
 	<style>';
3655 3655
 
3656 3656
 		foreach ($context['css_header'] as $css)
3657
-			echo $css .'
3657
+			echo $css . '
3658 3658
 	';
3659 3659
 
3660 3660
 		echo'
@@ -3683,27 +3683,27 @@  discard block
 block discarded – undo
3683 3683
 		return false;
3684 3684
 
3685 3685
 	// Did we already did this?
3686
-	$toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400);
3686
+	$toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400);
3687 3687
 
3688 3688
 	// Already done?
3689 3689
 	if (!empty($toCache))
3690 3690
 		return true;
3691 3691
 
3692 3692
 	// No namespaces, sorry!
3693
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3693
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3694 3694
 
3695 3695
 	// Temp path.
3696
-	$cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/';
3696
+	$cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/';
3697 3697
 
3698 3698
 	// What kind of file are we going to create?
3699
-	$toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type;
3699
+	$toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type;
3700 3700
 
3701 3701
 	// File has to exists, if it isn't try to create it.
3702 3702
 	if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate))
3703 3703
 	{
3704 3704
 		loadLanguage('Errors');
3705 3705
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3706
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3706
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3707 3707
 
3708 3708
 		// The process failed so roll back to print each individual file.
3709 3709
 		return $data;
@@ -3738,14 +3738,14 @@  discard block
 block discarded – undo
3738 3738
 	{
3739 3739
 		loadLanguage('Errors');
3740 3740
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3741
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3741
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3742 3742
 
3743 3743
 		// The process failed so roll back to print each individual file.
3744 3744
 		return $data;
3745 3745
 	}
3746 3746
 
3747 3747
 	// And create a long lived cache entry.
3748
-	cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400);
3748
+	cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400);
3749 3749
 
3750 3750
 	return true;
3751 3751
 }
@@ -3805,7 +3805,7 @@  discard block
 block discarded – undo
3805 3805
 	else
3806 3806
 		$path = $modSettings['attachmentUploadDir'];
3807 3807
 
3808
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
3808
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
3809 3809
 }
3810 3810
 
3811 3811
 /**
@@ -3849,10 +3849,10 @@  discard block
 block discarded – undo
3849 3849
 		$valid_low = isValidIP($ip_parts[0]);
3850 3850
 		$valid_high = isValidIP($ip_parts[1]);
3851 3851
 		$count = 0;
3852
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
3852
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
3853 3853
 		$max = ($mode == ':' ? 'ffff' : '255');
3854 3854
 		$min = 0;
3855
-		if(!$valid_low)
3855
+		if (!$valid_low)
3856 3856
 		{
3857 3857
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
3858 3858
 			$valid_low = isValidIP($ip_parts[0]);
@@ -3866,7 +3866,7 @@  discard block
 block discarded – undo
3866 3866
 		}
3867 3867
 
3868 3868
 		$count = 0;
3869
-		if(!$valid_high)
3869
+		if (!$valid_high)
3870 3870
 		{
3871 3871
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
3872 3872
 			$valid_high = isValidIP($ip_parts[1]);
@@ -3879,7 +3879,7 @@  discard block
 block discarded – undo
3879 3879
 			}
3880 3880
 		}
3881 3881
 
3882
-		if($valid_high && $valid_low)
3882
+		if ($valid_high && $valid_low)
3883 3883
 		{
3884 3884
 			$ip_array['low'] = $ip_parts[0];
3885 3885
 			$ip_array['high'] = $ip_parts[1];
@@ -4061,7 +4061,7 @@  discard block
 block discarded – undo
4061 4061
 		addInlineJavaScript('
4062 4062
 	var user_menus = new smc_PopupMenu();
4063 4063
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4064
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4064
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4065 4065
 		if ($context['allow_pm'])
4066 4066
 			addInlineJavaScript('
4067 4067
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4681,7 +4681,7 @@  discard block
 block discarded – undo
4681 4681
 		// No? try a fallback to $sourcedir
4682 4682
 		else
4683 4683
 		{
4684
-			$absPath = $sourcedir .'/'. $file;
4684
+			$absPath = $sourcedir . '/' . $file;
4685 4685
 
4686 4686
 			if (file_exists($absPath))
4687 4687
 				require_once($absPath);
@@ -4762,15 +4762,15 @@  discard block
 block discarded – undo
4762 4762
 
4763 4763
 	// UTF-8 occurences of MS special characters
4764 4764
 	$findchars_utf8 = array(
4765
-		"\xe2\x80\x9a",	// single low-9 quotation mark
4766
-		"\xe2\x80\x9e",	// double low-9 quotation mark
4767
-		"\xe2\x80\xa6",	// horizontal ellipsis
4768
-		"\xe2\x80\x98",	// left single curly quote
4769
-		"\xe2\x80\x99",	// right single curly quote
4770
-		"\xe2\x80\x9c",	// left double curly quote
4771
-		"\xe2\x80\x9d",	// right double curly quote
4772
-		"\xe2\x80\x93",	// en dash
4773
-		"\xe2\x80\x94",	// em dash
4765
+		"\xe2\x80\x9a", // single low-9 quotation mark
4766
+		"\xe2\x80\x9e", // double low-9 quotation mark
4767
+		"\xe2\x80\xa6", // horizontal ellipsis
4768
+		"\xe2\x80\x98", // left single curly quote
4769
+		"\xe2\x80\x99", // right single curly quote
4770
+		"\xe2\x80\x9c", // left double curly quote
4771
+		"\xe2\x80\x9d", // right double curly quote
4772
+		"\xe2\x80\x93", // en dash
4773
+		"\xe2\x80\x94", // em dash
4774 4774
 	);
4775 4775
 
4776 4776
 	// windows 1252 / iso equivalents
@@ -4788,15 +4788,15 @@  discard block
 block discarded – undo
4788 4788
 
4789 4789
 	// safe replacements
4790 4790
 	$replacechars = array(
4791
-		',',	// &sbquo;
4792
-		',,',	// &bdquo;
4793
-		'...',	// &hellip;
4794
-		"'",	// &lsquo;
4795
-		"'",	// &rsquo;
4796
-		'"',	// &ldquo;
4797
-		'"',	// &rdquo;
4798
-		'-',	// &ndash;
4799
-		'--',	// &mdash;
4791
+		',', // &sbquo;
4792
+		',,', // &bdquo;
4793
+		'...', // &hellip;
4794
+		"'", // &lsquo;
4795
+		"'", // &rsquo;
4796
+		'"', // &ldquo;
4797
+		'"', // &rdquo;
4798
+		'-', // &ndash;
4799
+		'--', // &mdash;
4800 4800
 	);
4801 4801
 
4802 4802
 	if ($context['utf8'])
@@ -5214,7 +5214,7 @@  discard block
 block discarded – undo
5214 5214
  */
5215 5215
 function inet_dtop($bin)
5216 5216
 {
5217
-	if(empty($bin))
5217
+	if (empty($bin))
5218 5218
 		return '';
5219 5219
 
5220 5220
 	global $db_type;
@@ -5245,28 +5245,28 @@  discard block
 block discarded – undo
5245 5245
  */
5246 5246
 function _safe_serialize($value)
5247 5247
 {
5248
-	if(is_null($value))
5248
+	if (is_null($value))
5249 5249
 		return 'N;';
5250 5250
 
5251
-	if(is_bool($value))
5252
-		return 'b:'. (int) $value .';';
5251
+	if (is_bool($value))
5252
+		return 'b:' . (int) $value . ';';
5253 5253
 
5254
-	if(is_int($value))
5255
-		return 'i:'. $value .';';
5254
+	if (is_int($value))
5255
+		return 'i:' . $value . ';';
5256 5256
 
5257
-	if(is_float($value))
5258
-		return 'd:'. str_replace(',', '.', $value) .';';
5257
+	if (is_float($value))
5258
+		return 'd:' . str_replace(',', '.', $value) . ';';
5259 5259
 
5260
-	if(is_string($value))
5261
-		return 's:'. strlen($value) .':"'. $value .'";';
5260
+	if (is_string($value))
5261
+		return 's:' . strlen($value) . ':"' . $value . '";';
5262 5262
 
5263
-	if(is_array($value))
5263
+	if (is_array($value))
5264 5264
 	{
5265 5265
 		$out = '';
5266
-		foreach($value as $k => $v)
5266
+		foreach ($value as $k => $v)
5267 5267
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5268 5268
 
5269
-		return 'a:'. count($value) .':{'. $out .'}';
5269
+		return 'a:' . count($value) . ':{' . $out . '}';
5270 5270
 	}
5271 5271
 
5272 5272
 	// safe_serialize cannot serialize resources or objects.
@@ -5308,7 +5308,7 @@  discard block
 block discarded – undo
5308 5308
 function _safe_unserialize($str)
5309 5309
 {
5310 5310
 	// Input  is not a string.
5311
-	if(empty($str) || !is_string($str))
5311
+	if (empty($str) || !is_string($str))
5312 5312
 		return false;
5313 5313
 
5314 5314
 	$stack = array();
@@ -5322,40 +5322,40 @@  discard block
 block discarded – undo
5322 5322
 	 *   3 - in array, expecting value or another array
5323 5323
 	 */
5324 5324
 	$state = 0;
5325
-	while($state != 1)
5325
+	while ($state != 1)
5326 5326
 	{
5327 5327
 		$type = isset($str[0]) ? $str[0] : '';
5328
-		if($type == '}')
5328
+		if ($type == '}')
5329 5329
 			$str = substr($str, 1);
5330 5330
 
5331
-		else if($type == 'N' && $str[1] == ';')
5331
+		else if ($type == 'N' && $str[1] == ';')
5332 5332
 		{
5333 5333
 			$value = null;
5334 5334
 			$str = substr($str, 2);
5335 5335
 		}
5336
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5336
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5337 5337
 		{
5338 5338
 			$value = $matches[1] == '1' ? true : false;
5339 5339
 			$str = substr($str, 4);
5340 5340
 		}
5341
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5341
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5342 5342
 		{
5343
-			$value = (int)$matches[1];
5343
+			$value = (int) $matches[1];
5344 5344
 			$str = $matches[2];
5345 5345
 		}
5346
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5346
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5347 5347
 		{
5348
-			$value = (float)$matches[1];
5348
+			$value = (float) $matches[1];
5349 5349
 			$str = $matches[3];
5350 5350
 		}
5351
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5351
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5352 5352
 		{
5353
-			$value = substr($matches[2], 0, (int)$matches[1]);
5354
-			$str = substr($matches[2], (int)$matches[1] + 2);
5353
+			$value = substr($matches[2], 0, (int) $matches[1]);
5354
+			$str = substr($matches[2], (int) $matches[1] + 2);
5355 5355
 		}
5356
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5356
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5357 5357
 		{
5358
-			$expectedLength = (int)$matches[1];
5358
+			$expectedLength = (int) $matches[1];
5359 5359
 			$str = $matches[2];
5360 5360
 		}
5361 5361
 
@@ -5363,10 +5363,10 @@  discard block
 block discarded – undo
5363 5363
 		else
5364 5364
 			return false;
5365 5365
 
5366
-		switch($state)
5366
+		switch ($state)
5367 5367
 		{
5368 5368
 			case 3: // In array, expecting value or another array.
5369
-				if($type == 'a')
5369
+				if ($type == 'a')
5370 5370
 				{
5371 5371
 					$stack[] = &$list;
5372 5372
 					$list[$key] = array();
@@ -5375,7 +5375,7 @@  discard block
 block discarded – undo
5375 5375
 					$state = 2;
5376 5376
 					break;
5377 5377
 				}
5378
-				if($type != '}')
5378
+				if ($type != '}')
5379 5379
 				{
5380 5380
 					$list[$key] = $value;
5381 5381
 					$state = 2;
@@ -5386,29 +5386,29 @@  discard block
 block discarded – undo
5386 5386
 				return false;
5387 5387
 
5388 5388
 			case 2: // in array, expecting end of array or a key
5389
-				if($type == '}')
5389
+				if ($type == '}')
5390 5390
 				{
5391 5391
 					// Array size is less than expected.
5392
-					if(count($list) < end($expected))
5392
+					if (count($list) < end($expected))
5393 5393
 						return false;
5394 5394
 
5395 5395
 					unset($list);
5396
-					$list = &$stack[count($stack)-1];
5396
+					$list = &$stack[count($stack) - 1];
5397 5397
 					array_pop($stack);
5398 5398
 
5399 5399
 					// Go to terminal state if we're at the end of the root array.
5400 5400
 					array_pop($expected);
5401 5401
 
5402
-					if(count($expected) == 0)
5402
+					if (count($expected) == 0)
5403 5403
 						$state = 1;
5404 5404
 
5405 5405
 					break;
5406 5406
 				}
5407 5407
 
5408
-				if($type == 'i' || $type == 's')
5408
+				if ($type == 'i' || $type == 's')
5409 5409
 				{
5410 5410
 					// Array size exceeds expected length.
5411
-					if(count($list) >= end($expected))
5411
+					if (count($list) >= end($expected))
5412 5412
 						return false;
5413 5413
 
5414 5414
 					$key = $value;
@@ -5421,7 +5421,7 @@  discard block
 block discarded – undo
5421 5421
 
5422 5422
 			// Expecting array or value.
5423 5423
 			case 0:
5424
-				if($type == 'a')
5424
+				if ($type == 'a')
5425 5425
 				{
5426 5426
 					$data = array();
5427 5427
 					$list = &$data;
@@ -5430,7 +5430,7 @@  discard block
 block discarded – undo
5430 5430
 					break;
5431 5431
 				}
5432 5432
 
5433
-				if($type != '}')
5433
+				if ($type != '}')
5434 5434
 				{
5435 5435
 					$data = $value;
5436 5436
 					$state = 1;
@@ -5443,7 +5443,7 @@  discard block
 block discarded – undo
5443 5443
 	}
5444 5444
 
5445 5445
 	// Trailing data in input.
5446
-	if(!empty($str))
5446
+	if (!empty($str))
5447 5447
 		return false;
5448 5448
 
5449 5449
 	return $data;
@@ -5497,7 +5497,7 @@  discard block
 block discarded – undo
5497 5497
 	// Set different modes.
5498 5498
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5499 5499
 
5500
-	foreach($chmodValues as $val)
5500
+	foreach ($chmodValues as $val)
5501 5501
 	{
5502 5502
 		// If it's writable, break out of the loop.
5503 5503
 		if (is_writable($file))
@@ -5532,13 +5532,13 @@  discard block
 block discarded – undo
5532 5532
 	$returnArray = @json_decode($json, $returnAsArray);
5533 5533
 
5534 5534
 	// PHP 5.3 so no json_last_error_msg()
5535
-	switch(json_last_error())
5535
+	switch (json_last_error())
5536 5536
 	{
5537 5537
 		case JSON_ERROR_NONE:
5538 5538
 			$jsonError = false;
5539 5539
 			break;
5540 5540
 		case JSON_ERROR_DEPTH:
5541
-			$jsonError =  'JSON_ERROR_DEPTH';
5541
+			$jsonError = 'JSON_ERROR_DEPTH';
5542 5542
 			break;
5543 5543
 		case JSON_ERROR_STATE_MISMATCH:
5544 5544
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -5566,10 +5566,10 @@  discard block
 block discarded – undo
5566 5566
 		loadLanguage('Errors');
5567 5567
 
5568 5568
 		if (!empty($jsonDebug))
5569
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5569
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5570 5570
 
5571 5571
 		else
5572
-			log_error($txt['json_'. $jsonError], 'critical');
5572
+			log_error($txt['json_' . $jsonError], 'critical');
5573 5573
 
5574 5574
 		// Everyone expects an array.
5575 5575
 		return array();
@@ -5681,7 +5681,7 @@  discard block
 block discarded – undo
5681 5681
 		});
5682 5682
 
5683 5683
 		// Convert Punycode to Unicode
5684
-		$tlds = array_map(function ($input) {
5684
+		$tlds = array_map(function($input) {
5685 5685
 			$prefix = 'xn--';
5686 5686
 			$safe_char = 0xFFFC;
5687 5687
 			$base = 36;
@@ -5697,7 +5697,7 @@  discard block
 block discarded – undo
5697 5697
 
5698 5698
 			foreach ($enco_parts as $encoded)
5699 5699
 			{
5700
-				if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0)
5700
+				if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0)
5701 5701
 				{
5702 5702
 					$output_parts[] = $encoded;
5703 5703
 					continue;
@@ -5708,7 +5708,7 @@  discard block
 block discarded – undo
5708 5708
 				$idx = 0;
5709 5709
 				$char = 0x80;
5710 5710
 				$decoded = array();
5711
-				$output='';
5711
+				$output = '';
5712 5712
 				$delim_pos = strrpos($encoded, '-');
5713 5713
 
5714 5714
 				if ($delim_pos > strlen($prefix))
@@ -5724,7 +5724,7 @@  discard block
 block discarded – undo
5724 5724
 
5725 5725
 				for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len)
5726 5726
 				{
5727
-					for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base)
5727
+					for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base)
5728 5728
 					{
5729 5729
 						$cp = ord($encoded{$enco_idx++});
5730 5730
 						$digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base));
@@ -5765,15 +5765,15 @@  discard block
 block discarded – undo
5765 5765
 
5766 5766
 					// 2 bytes
5767 5767
 					elseif ($v < (1 << 11))
5768
-						$output .= chr(192+($v >> 6)) . chr(128+($v & 63));
5768
+						$output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
5769 5769
 
5770 5770
 					// 3 bytes
5771 5771
 					elseif ($v < (1 << 16))
5772
-						$output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5772
+						$output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5773 5773
 
5774 5774
 					// 4 bytes
5775 5775
 					elseif ($v < (1 << 21))
5776
-						$output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5776
+						$output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5777 5777
 
5778 5778
 					//  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
5779 5779
 					else
@@ -5878,7 +5878,7 @@  discard block
 block discarded – undo
5878 5878
 	}
5879 5879
 
5880 5880
 	// This recursive function creates the index array from the strings
5881
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5881
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5882 5882
 	{
5883 5883
 		static $depth = 0;
5884 5884
 		$depth++;
@@ -5905,7 +5905,7 @@  discard block
 block discarded – undo
5905 5905
 	};
5906 5906
 
5907 5907
 	// This recursive function turns the index array into a regular expression
5908
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
5908
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
5909 5909
 	{
5910 5910
 		static $depth = 0;
5911 5911
 		$depth++;
@@ -5929,11 +5929,11 @@  discard block
 block discarded – undo
5929 5929
 
5930 5930
 				if (count(array_keys($value)) == 1)
5931 5931
 				{
5932
-					$new_key_array = explode('(?'.'>', $sub_regex);
5932
+					$new_key_array = explode('(?' . '>', $sub_regex);
5933 5933
 					$new_key .= $new_key_array[0];
5934 5934
 				}
5935 5935
 				else
5936
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
5936
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
5937 5937
 			}
5938 5938
 
5939 5939
 			if ($depth > 1)
@@ -5976,10 +5976,10 @@  discard block
 block discarded – undo
5976 5976
 	{
5977 5977
 		$regex = array();
5978 5978
 		while (!empty($index))
5979
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5979
+			$regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
5980 5980
 	}
5981 5981
 	else
5982
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5982
+		$regex = '(?' . '>' . $index_to_regex($index, $delim) . ')';
5983 5983
 
5984 5984
 	// Restore PHP's internal character encoding to whatever it was originally
5985 5985
 	if (!empty($current_encoding))
@@ -6000,7 +6000,7 @@  discard block
 block discarded – undo
6000 6000
 	$url = str_ireplace('http://', 'https://', $url) . '/';
6001 6001
 
6002 6002
 	$result = false;
6003
-	$stream = stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
6003
+	$stream = stream_context_create(array("ssl" => array("capture_peer_cert" => true)));
6004 6004
 	$read = @fopen($url, "rb", false, $stream);
6005 6005
 	if ($read !== false) {
6006 6006
 		$cont = stream_context_get_params($read);
Please login to merge, or discard this patch.