Passed
Pull Request — release-2.1 (#4834)
by Jeremy
05:22
created
Sources/Profile-View.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 	if (count($context['ip']) !== 2)
1905 1905
 		fatal_lang_error('invalid_tracking_ip', false);
1906 1906
 
1907
-	$ip_string = array('{inet:ip_address_low}','{inet:ip_address_high}');
1907
+	$ip_string = array('{inet:ip_address_low}', '{inet:ip_address_high}');
1908 1908
 	$fields = array(
1909 1909
 			'ip_address_low' => $context['ip']['low'],
1910 1910
 			'ip_address_high' => $context['ip']['high'],
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 
1913 1913
 	$ip_var = $context['ip'];
1914 1914
 
1915
-	if ($context['ip']['low'] !==  $context['ip']['high'])
1915
+	if ($context['ip']['low'] !== $context['ip']['high'])
1916 1916
 		$context['ip'] = $context['ip']['low'] . ' - ' . $context['ip']['high'];
1917 1917
 	else
1918 1918
 		$context['ip'] = $context['ip']['low'];
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			{
392 392
 				$val = 'CASE ';
393 393
 				foreach ($members as $k => $v)
394
-					$val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, false) . ' ';
394
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, false) . ' ';
395 395
 				$val = $val . ' END';
396 396
 				$type = 'raw';
397 397
 			}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	static $non_twelve_hour, $locale_cache;
742 742
 	static $unsupportedFormats, $finalizedFormats;
743 743
 
744
-	$unsupportedFormatsWindows = array('z','Z');
744
+	$unsupportedFormatsWindows = array('z', 'Z');
745 745
 
746 746
 	// Ensure required values are set
747 747
 	$user_info['time_offset'] = !empty($user_info['time_offset']) ? $user_info['time_offset'] : 0;
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
827 827
 		if (empty($unsupportedFormats))
828 828
 		{
829
-			foreach($strftimeFormatSubstitutions as $format => $substitution)
829
+			foreach ($strftimeFormatSubstitutions as $format => $substitution)
830 830
 			{
831 831
 				// Avoid a crashing bug with PHP 7 on certain versions of Windows
832 832
 				if ($context['server']['is_windows'] && in_array($format, $unsupportedFormatsWindows))
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 					'height' => array('optional' => true, 'match' => '(\d+)'),
1207 1207
 				),
1208 1208
 				'content' => '$1',
1209
-				'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1209
+				'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1210 1210
 				{
1211 1211
 					$returnContext = '';
1212 1212
 
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 						}
1242 1242
 
1243 1243
 						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1244
-							$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>';
1244
+							$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>';
1245 1245
 						else
1246 1246
 							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1247 1247
 					}
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 				'type' => 'unparsed_content',
1294 1294
 				'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>',
1295 1295
 				// @todo Maybe this can be simplified?
1296
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1296
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1297 1297
 				{
1298 1298
 					if (!isset($disabled['code']))
1299 1299
 					{
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 				'type' => 'unparsed_equals_content',
1331 1331
 				'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>',
1332 1332
 				// @todo Maybe this can be simplified?
1333
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1333
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1334 1334
 				{
1335 1335
 					if (!isset($disabled['code']))
1336 1336
 					{
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
 				'type' => 'unparsed_content',
1375 1375
 				'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
1376 1376
 				// @todo Should this respect guest_hideContacts?
1377
-				'validate' => function (&$tag, &$data, $disabled)
1377
+				'validate' => function(&$tag, &$data, $disabled)
1378 1378
 				{
1379 1379
 					$data = strtr($data, array('<br>' => ''));
1380 1380
 				},
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 				'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]',
1395 1395
 				'before' => '<div $1>',
1396 1396
 				'after' => '</div>',
1397
-				'validate' => function (&$tag, &$data, $disabled)
1397
+				'validate' => function(&$tag, &$data, $disabled)
1398 1398
 				{
1399 1399
 					$class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"';
1400 1400
 
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 					'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
1481 1481
 				),
1482 1482
 				'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">',
1483
-				'validate' => function (&$tag, &$data, $disabled)
1483
+				'validate' => function(&$tag, &$data, $disabled)
1484 1484
 				{
1485 1485
 					global $image_proxy_enabled, $user_info;
1486 1486
 
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 				'tag' => 'img',
1507 1507
 				'type' => 'unparsed_content',
1508 1508
 				'content' => '<img src="$1" alt="" class="bbc_img">',
1509
-				'validate' => function (&$tag, &$data, $disabled)
1509
+				'validate' => function(&$tag, &$data, $disabled)
1510 1510
 				{
1511 1511
 					global $image_proxy_enabled, $user_info;
1512 1512
 
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 				'tag' => 'iurl',
1533 1533
 				'type' => 'unparsed_content',
1534 1534
 				'content' => '<a href="$1" class="bbc_link">$1</a>',
1535
-				'validate' => function (&$tag, &$data, $disabled)
1535
+				'validate' => function(&$tag, &$data, $disabled)
1536 1536
 				{
1537 1537
 					$data = strtr($data, array('<br>' => ''));
1538 1538
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 				'quoted' => 'optional',
1547 1547
 				'before' => '<a href="$1" class="bbc_link">',
1548 1548
 				'after' => '</a>',
1549
-				'validate' => function (&$tag, &$data, $disabled)
1549
+				'validate' => function(&$tag, &$data, $disabled)
1550 1550
 				{
1551 1551
 					if (substr($data, 0, 1) == '#')
1552 1552
 						$data = '#post_' . substr($data, 1);
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
 				'tag' => 'php',
1640 1640
 				'type' => 'unparsed_content',
1641 1641
 				'content' => '<span class="phpcode">$1</span>',
1642
-				'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled)
1642
+				'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled)
1643 1643
 				{
1644 1644
 					if (!isset($disabled['php']))
1645 1645
 					{
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
 				'test' => '[1-7]\]',
1768 1768
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1769 1769
 				'after' => '</span>',
1770
-				'validate' => function (&$tag, &$data, $disabled)
1770
+				'validate' => function(&$tag, &$data, $disabled)
1771 1771
 				{
1772 1772
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1773 1773
 					$data = $sizes[$data] . 'em';
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
 				'tag' => 'time',
1806 1806
 				'type' => 'unparsed_content',
1807 1807
 				'content' => '$1',
1808
-				'validate' => function (&$tag, &$data, $disabled)
1808
+				'validate' => function(&$tag, &$data, $disabled)
1809 1809
 				{
1810 1810
 					if (is_numeric($data))
1811 1811
 						$data = timeformat($data);
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 				'tag' => 'url',
1839 1839
 				'type' => 'unparsed_content',
1840 1840
 				'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>',
1841
-				'validate' => function (&$tag, &$data, $disabled)
1841
+				'validate' => function(&$tag, &$data, $disabled)
1842 1842
 				{
1843 1843
 					$data = strtr($data, array('<br>' => ''));
1844 1844
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 				'quoted' => 'optional',
1853 1853
 				'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">',
1854 1854
 				'after' => '</a>',
1855
-				'validate' => function (&$tag, &$data, $disabled)
1855
+				'validate' => function(&$tag, &$data, $disabled)
1856 1856
 				{
1857 1857
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1858 1858
 					if (empty($scheme))
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
 		{
1899 1899
 			if (isset($temp_bbc))
1900 1900
 				$bbc_codes = $temp_bbc;
1901
-			usort($codes, function ($a, $b) {
1901
+			usort($codes, function($a, $b) {
1902 1902
 				return strcmp($a['tag'], $b['tag']);
1903 1903
 			});
1904 1904
 			return $codes;
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 										# a run of Unicode domain name characters and a dot
2115 2115
 										[\p{L}\p{M}\p{N}\-.:@]+\.
2116 2116
 										# and then a TLD valid in the DNS or the reserved "local" TLD
2117
-										(?:'. $modSettings['tld_regex'] .'|local)
2117
+										(?:'. $modSettings['tld_regex'] . '|local)
2118 2118
 									)
2119 2119
 									# followed by a non-domain character or end of line
2120 2120
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
 						)?
2183 2183
 						';
2184 2184
 
2185
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2185
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
2186 2186
 							$url = array_shift($matches);
2187 2187
 
2188 2188
 							// If this isn't a clean URL, bail out
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
 								$fullUrl = $url;
2208 2208
 
2209 2209
 							// Make sure that $fullUrl really is valid
2210
-							if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '' ) . $fullUrl) === false)
2210
+							if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '') . $fullUrl) === false)
2211 2211
 								return $url;
2212 2212
 
2213 2213
 							return '[url=&quot;' . str_replace(array('[', ']'), array('&#91;', '&#93;'), $fullUrl) . '&quot;]' . $url . '[/url]';
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
 			$look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2));
2272 2272
 
2273 2273
 			// A closing tag that doesn't match any open tags? Skip it.
2274
-			if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags)))
2274
+			if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags)))
2275 2275
 				continue;
2276 2276
 
2277 2277
 			$to_close = array();
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
 		}
2930 2930
 
2931 2931
 		// Set proper extensions; do this post caching so cache doesn't become extension-specific
2932
-		foreach($smileysto AS $ix=>$file)
2932
+		foreach ($smileysto AS $ix=>$file)
2933 2933
 			// Need to use the default if user selection is disabled
2934 2934
 			if (empty($modSettings['smiley_sets_enable']))
2935 2935
 				$smileysto[$ix] = $file . $context['user']['smiley_set_default_ext'];
@@ -2947,7 +2947,7 @@  discard block
 block discarded – undo
2947 2947
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
2948 2948
 		{
2949 2949
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2950
-			$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">';
2950
+			$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">';
2951 2951
 
2952 2952
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2953 2953
 
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
 
2973 2973
 	// Replace away!
2974 2974
 	$message = preg_replace_callback($smileyPregSearch,
2975
-		function ($matches) use ($smileyPregReplacements)
2975
+		function($matches) use ($smileyPregReplacements)
2976 2976
 		{
2977 2977
 			return $smileyPregReplacements[$matches[1]];
2978 2978
 		}, $message);
@@ -3069,13 +3069,13 @@  discard block
 block discarded – undo
3069 3069
 	{
3070 3070
 		if (defined('SID') && SID != '')
3071 3071
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
3072
-				function ($m) use ($scripturl)
3072
+				function($m) use ($scripturl)
3073 3073
 				{
3074
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
3074
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
3075 3075
 				}, $setLocation);
3076 3076
 		else
3077 3077
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
3078
-				function ($m) use ($scripturl)
3078
+				function($m) use ($scripturl)
3079 3079
 				{
3080 3080
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
3081 3081
 				}, $setLocation);
@@ -3396,7 +3396,7 @@  discard block
 block discarded – undo
3396 3396
 
3397 3397
 	// Add a generic "Are you sure?" confirmation message.
3398 3398
 	addInlineJavaScript('
3399
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3399
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3400 3400
 
3401 3401
 	// Now add the capping code for avatars.
3402 3402
 	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')
@@ -3862,7 +3862,7 @@  discard block
 block discarded – undo
3862 3862
 	if (!empty($normal))
3863 3863
 		foreach ($normal as $nf)
3864 3864
 			echo '
3865
-	<link rel="stylesheet" href="', $nf ,'">';
3865
+	<link rel="stylesheet" href="', $nf, '">';
3866 3866
 
3867 3867
 	if ($db_show_debug === true)
3868 3868
 	{
@@ -3878,7 +3878,7 @@  discard block
 block discarded – undo
3878 3878
 	<style>';
3879 3879
 
3880 3880
 		foreach ($context['css_header'] as $css)
3881
-			echo $css .'
3881
+			echo $css . '
3882 3882
 	';
3883 3883
 
3884 3884
 		echo'
@@ -3922,7 +3922,7 @@  discard block
 block discarded – undo
3922 3922
 
3923 3923
 
3924 3924
 	// No namespaces, sorry!
3925
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3925
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3926 3926
 
3927 3927
 	// Temp path.
3928 3928
 	$cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/';
@@ -4102,7 +4102,7 @@  discard block
 block discarded – undo
4102 4102
 	else
4103 4103
 		$path = $modSettings['attachmentUploadDir'];
4104 4104
 
4105
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
4105
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
4106 4106
 }
4107 4107
 
4108 4108
 /**
@@ -4146,10 +4146,10 @@  discard block
 block discarded – undo
4146 4146
 		$valid_low = isValidIP($ip_parts[0]);
4147 4147
 		$valid_high = isValidIP($ip_parts[1]);
4148 4148
 		$count = 0;
4149
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
4149
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
4150 4150
 		$max = ($mode == ':' ? 'ffff' : '255');
4151 4151
 		$min = 0;
4152
-		if(!$valid_low)
4152
+		if (!$valid_low)
4153 4153
 		{
4154 4154
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
4155 4155
 			$valid_low = isValidIP($ip_parts[0]);
@@ -4163,7 +4163,7 @@  discard block
 block discarded – undo
4163 4163
 		}
4164 4164
 
4165 4165
 		$count = 0;
4166
-		if(!$valid_high)
4166
+		if (!$valid_high)
4167 4167
 		{
4168 4168
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
4169 4169
 			$valid_high = isValidIP($ip_parts[1]);
@@ -4176,7 +4176,7 @@  discard block
 block discarded – undo
4176 4176
 			}
4177 4177
 		}
4178 4178
 
4179
-		if($valid_high && $valid_low)
4179
+		if ($valid_high && $valid_low)
4180 4180
 		{
4181 4181
 			$ip_array['low'] = $ip_parts[0];
4182 4182
 			$ip_array['high'] = $ip_parts[1];
@@ -4357,7 +4357,7 @@  discard block
 block discarded – undo
4357 4357
 		addInlineJavaScript('
4358 4358
 	var user_menus = new smc_PopupMenu();
4359 4359
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4360
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4360
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4361 4361
 		if ($context['allow_pm'])
4362 4362
 			addInlineJavaScript('
4363 4363
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4652,7 +4652,7 @@  discard block
 block discarded – undo
4652 4652
 		$context['total_admin_reports'] += $context['unapproved_members'];
4653 4653
 	}
4654 4654
 
4655
-	if($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin']))
4655
+	if ($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin']))
4656 4656
 	{
4657 4657
 		$context['menu_buttons']['admin']['amt'] = $context['total_admin_reports'];
4658 4658
 	}
@@ -4999,7 +4999,7 @@  discard block
 block discarded – undo
4999 4999
 		// No? try a fallback to $sourcedir
5000 5000
 		else
5001 5001
 		{
5002
-			$absPath = $sourcedir .'/'. $file;
5002
+			$absPath = $sourcedir . '/' . $file;
5003 5003
 
5004 5004
 			if (file_exists($absPath))
5005 5005
 				require_once($absPath);
@@ -5266,15 +5266,15 @@  discard block
 block discarded – undo
5266 5266
 
5267 5267
 	// UTF-8 occurences of MS special characters
5268 5268
 	$findchars_utf8 = array(
5269
-		"\xe2\x80\x9a",	// single low-9 quotation mark
5270
-		"\xe2\x80\x9e",	// double low-9 quotation mark
5271
-		"\xe2\x80\xa6",	// horizontal ellipsis
5272
-		"\xe2\x80\x98",	// left single curly quote
5273
-		"\xe2\x80\x99",	// right single curly quote
5274
-		"\xe2\x80\x9c",	// left double curly quote
5275
-		"\xe2\x80\x9d",	// right double curly quote
5276
-		"\xe2\x80\x93",	// en dash
5277
-		"\xe2\x80\x94",	// em dash
5269
+		"\xe2\x80\x9a", // single low-9 quotation mark
5270
+		"\xe2\x80\x9e", // double low-9 quotation mark
5271
+		"\xe2\x80\xa6", // horizontal ellipsis
5272
+		"\xe2\x80\x98", // left single curly quote
5273
+		"\xe2\x80\x99", // right single curly quote
5274
+		"\xe2\x80\x9c", // left double curly quote
5275
+		"\xe2\x80\x9d", // right double curly quote
5276
+		"\xe2\x80\x93", // en dash
5277
+		"\xe2\x80\x94", // em dash
5278 5278
 	);
5279 5279
 
5280 5280
 	// windows 1252 / iso equivalents
@@ -5292,15 +5292,15 @@  discard block
 block discarded – undo
5292 5292
 
5293 5293
 	// safe replacements
5294 5294
 	$replacechars = array(
5295
-		',',	// &sbquo;
5296
-		',,',	// &bdquo;
5297
-		'...',	// &hellip;
5298
-		"'",	// &lsquo;
5299
-		"'",	// &rsquo;
5300
-		'"',	// &ldquo;
5301
-		'"',	// &rdquo;
5302
-		'-',	// &ndash;
5303
-		'--',	// &mdash;
5295
+		',', // &sbquo;
5296
+		',,', // &bdquo;
5297
+		'...', // &hellip;
5298
+		"'", // &lsquo;
5299
+		"'", // &rsquo;
5300
+		'"', // &ldquo;
5301
+		'"', // &rdquo;
5302
+		'-', // &ndash;
5303
+		'--', // &mdash;
5304 5304
 	);
5305 5305
 
5306 5306
 	if ($context['utf8'])
@@ -5620,7 +5620,7 @@  discard block
 block discarded – undo
5620 5620
  */
5621 5621
 function inet_dtop($bin)
5622 5622
 {
5623
-	if(empty($bin))
5623
+	if (empty($bin))
5624 5624
 		return '';
5625 5625
 
5626 5626
 	global $db_type;
@@ -5651,28 +5651,28 @@  discard block
 block discarded – undo
5651 5651
  */
5652 5652
 function _safe_serialize($value)
5653 5653
 {
5654
-	if(is_null($value))
5654
+	if (is_null($value))
5655 5655
 		return 'N;';
5656 5656
 
5657
-	if(is_bool($value))
5658
-		return 'b:'. (int) $value .';';
5657
+	if (is_bool($value))
5658
+		return 'b:' . (int) $value . ';';
5659 5659
 
5660
-	if(is_int($value))
5661
-		return 'i:'. $value .';';
5660
+	if (is_int($value))
5661
+		return 'i:' . $value . ';';
5662 5662
 
5663
-	if(is_float($value))
5664
-		return 'd:'. str_replace(',', '.', $value) .';';
5663
+	if (is_float($value))
5664
+		return 'd:' . str_replace(',', '.', $value) . ';';
5665 5665
 
5666
-	if(is_string($value))
5667
-		return 's:'. strlen($value) .':"'. $value .'";';
5666
+	if (is_string($value))
5667
+		return 's:' . strlen($value) . ':"' . $value . '";';
5668 5668
 
5669
-	if(is_array($value))
5669
+	if (is_array($value))
5670 5670
 	{
5671 5671
 		$out = '';
5672
-		foreach($value as $k => $v)
5672
+		foreach ($value as $k => $v)
5673 5673
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5674 5674
 
5675
-		return 'a:'. count($value) .':{'. $out .'}';
5675
+		return 'a:' . count($value) . ':{' . $out . '}';
5676 5676
 	}
5677 5677
 
5678 5678
 	// safe_serialize cannot serialize resources or objects.
@@ -5714,7 +5714,7 @@  discard block
 block discarded – undo
5714 5714
 function _safe_unserialize($str)
5715 5715
 {
5716 5716
 	// Input  is not a string.
5717
-	if(empty($str) || !is_string($str))
5717
+	if (empty($str) || !is_string($str))
5718 5718
 		return false;
5719 5719
 
5720 5720
 	$stack = array();
@@ -5728,40 +5728,40 @@  discard block
 block discarded – undo
5728 5728
 	 *   3 - in array, expecting value or another array
5729 5729
 	 */
5730 5730
 	$state = 0;
5731
-	while($state != 1)
5731
+	while ($state != 1)
5732 5732
 	{
5733 5733
 		$type = isset($str[0]) ? $str[0] : '';
5734
-		if($type == '}')
5734
+		if ($type == '}')
5735 5735
 			$str = substr($str, 1);
5736 5736
 
5737
-		else if($type == 'N' && $str[1] == ';')
5737
+		else if ($type == 'N' && $str[1] == ';')
5738 5738
 		{
5739 5739
 			$value = null;
5740 5740
 			$str = substr($str, 2);
5741 5741
 		}
5742
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5742
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5743 5743
 		{
5744 5744
 			$value = $matches[1] == '1' ? true : false;
5745 5745
 			$str = substr($str, 4);
5746 5746
 		}
5747
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5747
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5748 5748
 		{
5749
-			$value = (int)$matches[1];
5749
+			$value = (int) $matches[1];
5750 5750
 			$str = $matches[2];
5751 5751
 		}
5752
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5752
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5753 5753
 		{
5754
-			$value = (float)$matches[1];
5754
+			$value = (float) $matches[1];
5755 5755
 			$str = $matches[3];
5756 5756
 		}
5757
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5757
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5758 5758
 		{
5759
-			$value = substr($matches[2], 0, (int)$matches[1]);
5760
-			$str = substr($matches[2], (int)$matches[1] + 2);
5759
+			$value = substr($matches[2], 0, (int) $matches[1]);
5760
+			$str = substr($matches[2], (int) $matches[1] + 2);
5761 5761
 		}
5762
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5762
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5763 5763
 		{
5764
-			$expectedLength = (int)$matches[1];
5764
+			$expectedLength = (int) $matches[1];
5765 5765
 			$str = $matches[2];
5766 5766
 		}
5767 5767
 
@@ -5769,10 +5769,10 @@  discard block
 block discarded – undo
5769 5769
 		else
5770 5770
 			return false;
5771 5771
 
5772
-		switch($state)
5772
+		switch ($state)
5773 5773
 		{
5774 5774
 			case 3: // In array, expecting value or another array.
5775
-				if($type == 'a')
5775
+				if ($type == 'a')
5776 5776
 				{
5777 5777
 					$stack[] = &$list;
5778 5778
 					$list[$key] = array();
@@ -5781,7 +5781,7 @@  discard block
 block discarded – undo
5781 5781
 					$state = 2;
5782 5782
 					break;
5783 5783
 				}
5784
-				if($type != '}')
5784
+				if ($type != '}')
5785 5785
 				{
5786 5786
 					$list[$key] = $value;
5787 5787
 					$state = 2;
@@ -5792,29 +5792,29 @@  discard block
 block discarded – undo
5792 5792
 				return false;
5793 5793
 
5794 5794
 			case 2: // in array, expecting end of array or a key
5795
-				if($type == '}')
5795
+				if ($type == '}')
5796 5796
 				{
5797 5797
 					// Array size is less than expected.
5798
-					if(count($list) < end($expected))
5798
+					if (count($list) < end($expected))
5799 5799
 						return false;
5800 5800
 
5801 5801
 					unset($list);
5802
-					$list = &$stack[count($stack)-1];
5802
+					$list = &$stack[count($stack) - 1];
5803 5803
 					array_pop($stack);
5804 5804
 
5805 5805
 					// Go to terminal state if we're at the end of the root array.
5806 5806
 					array_pop($expected);
5807 5807
 
5808
-					if(count($expected) == 0)
5808
+					if (count($expected) == 0)
5809 5809
 						$state = 1;
5810 5810
 
5811 5811
 					break;
5812 5812
 				}
5813 5813
 
5814
-				if($type == 'i' || $type == 's')
5814
+				if ($type == 'i' || $type == 's')
5815 5815
 				{
5816 5816
 					// Array size exceeds expected length.
5817
-					if(count($list) >= end($expected))
5817
+					if (count($list) >= end($expected))
5818 5818
 						return false;
5819 5819
 
5820 5820
 					$key = $value;
@@ -5827,7 +5827,7 @@  discard block
 block discarded – undo
5827 5827
 
5828 5828
 			// Expecting array or value.
5829 5829
 			case 0:
5830
-				if($type == 'a')
5830
+				if ($type == 'a')
5831 5831
 				{
5832 5832
 					$data = array();
5833 5833
 					$list = &$data;
@@ -5836,7 +5836,7 @@  discard block
 block discarded – undo
5836 5836
 					break;
5837 5837
 				}
5838 5838
 
5839
-				if($type != '}')
5839
+				if ($type != '}')
5840 5840
 				{
5841 5841
 					$data = $value;
5842 5842
 					$state = 1;
@@ -5849,7 +5849,7 @@  discard block
 block discarded – undo
5849 5849
 	}
5850 5850
 
5851 5851
 	// Trailing data in input.
5852
-	if(!empty($str))
5852
+	if (!empty($str))
5853 5853
 		return false;
5854 5854
 
5855 5855
 	return $data;
@@ -5903,7 +5903,7 @@  discard block
 block discarded – undo
5903 5903
 	// Set different modes.
5904 5904
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5905 5905
 
5906
-	foreach($chmodValues as $val)
5906
+	foreach ($chmodValues as $val)
5907 5907
 	{
5908 5908
 		// If it's writable, break out of the loop.
5909 5909
 		if (is_writable($file))
@@ -5938,13 +5938,13 @@  discard block
 block discarded – undo
5938 5938
 	$returnArray = @json_decode($json, $returnAsArray);
5939 5939
 
5940 5940
 	// PHP 5.3 so no json_last_error_msg()
5941
-	switch(json_last_error())
5941
+	switch (json_last_error())
5942 5942
 	{
5943 5943
 		case JSON_ERROR_NONE:
5944 5944
 			$jsonError = false;
5945 5945
 			break;
5946 5946
 		case JSON_ERROR_DEPTH:
5947
-			$jsonError =  'JSON_ERROR_DEPTH';
5947
+			$jsonError = 'JSON_ERROR_DEPTH';
5948 5948
 			break;
5949 5949
 		case JSON_ERROR_STATE_MISMATCH:
5950 5950
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -5972,10 +5972,10 @@  discard block
 block discarded – undo
5972 5972
 		loadLanguage('Errors');
5973 5973
 
5974 5974
 		if (!empty($jsonDebug))
5975
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5975
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5976 5976
 
5977 5977
 		else
5978
-			log_error($txt['json_'. $jsonError], 'critical');
5978
+			log_error($txt['json_' . $jsonError], 'critical');
5979 5979
 
5980 5980
 		// Everyone expects an array.
5981 5981
 		return array();
@@ -6092,7 +6092,7 @@  discard block
 block discarded – undo
6092 6092
 		// Convert Punycode to Unicode
6093 6093
 		require_once($sourcedir . '/Class-Punycode.php');
6094 6094
 		$Punycode = new Punycode();
6095
-		$tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds);
6095
+		$tlds = array_map(function($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds);
6096 6096
 	}
6097 6097
 	// Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update
6098 6098
 	else
@@ -6186,7 +6186,7 @@  discard block
 block discarded – undo
6186 6186
 	}
6187 6187
 
6188 6188
 	// This recursive function creates the index array from the strings
6189
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
6189
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
6190 6190
 	{
6191 6191
 		static $depth = 0;
6192 6192
 		$depth++;
@@ -6213,7 +6213,7 @@  discard block
 block discarded – undo
6213 6213
 	};
6214 6214
 
6215 6215
 	// This recursive function turns the index array into a regular expression
6216
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
6216
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
6217 6217
 	{
6218 6218
 		static $depth = 0;
6219 6219
 		$depth++;
@@ -6237,11 +6237,11 @@  discard block
 block discarded – undo
6237 6237
 
6238 6238
 				if (count(array_keys($value)) == 1)
6239 6239
 				{
6240
-					$new_key_array = explode('(?'.'>', $sub_regex);
6240
+					$new_key_array = explode('(?' . '>', $sub_regex);
6241 6241
 					$new_key .= $new_key_array[0];
6242 6242
 				}
6243 6243
 				else
6244
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
6244
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
6245 6245
 			}
6246 6246
 
6247 6247
 			if ($depth > 1)
@@ -6284,10 +6284,10 @@  discard block
 block discarded – undo
6284 6284
 	{
6285 6285
 		$regex = array();
6286 6286
 		while (!empty($index))
6287
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6287
+			$regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6288 6288
 	}
6289 6289
 	else
6290
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6290
+		$regex = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6291 6291
 
6292 6292
 	// Restore PHP's internal character encoding to whatever it was originally
6293 6293
 	if (!empty($current_encoding))
@@ -6449,8 +6449,8 @@  discard block
 block discarded – undo
6449 6449
 		$query_part['query_see_board'] = '1=1';
6450 6450
 	// Otherwise just the groups in $user_info['groups'].
6451 6451
 	else
6452
-		$query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( '. implode(',', $groups) .') AND bpv.deny = 0) '
6453
-				.  ( !empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( '. implode(',', $groups) .') and bpv.deny = 1)' : '')
6452
+		$query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( ' . implode(',', $groups) . ') AND bpv.deny = 0) '
6453
+				.  (!empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( ' . implode(',', $groups) . ') and bpv.deny = 1)' : '')
6454 6454
 				. ' AND bpv.id_board = b.id_board)';
6455 6455
 		
6456 6456
 	// Build the list of boards they WANT to see.
@@ -6514,7 +6514,7 @@  discard block
 block discarded – undo
6514 6514
 function sanitize_iri($iri)
6515 6515
 {
6516 6516
 	// Encode any non-ASCII characters (but not space or control characters of any sort)
6517
-	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) {
6517
+	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function($matches) {
6518 6518
 		return rawurlencode($matches[0]);
6519 6519
 	}, $iri);
6520 6520
 
@@ -6556,7 +6556,7 @@  discard block
 block discarded – undo
6556 6556
 	$unescaped = array(
6557 6557
 		'%21'=>'!', '%23'=>'#', '%24'=>'$', '%26'=>'&',
6558 6558
 		'%27'=>"'", '%28'=>'(', '%29'=>')', '%2A'=>'*',
6559
-		'%2B'=>'+', '%2C'=>',',	'%2F'=>'/', '%3A'=>':',
6559
+		'%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':',
6560 6560
 		'%3B'=>';', '%3D'=>'=', '%3F'=>'?', '%40'=>'@',
6561 6561
 	);
6562 6562
 	$iri = strtr(rawurlencode($iri), $unescaped);
Please login to merge, or discard this patch.