Completed
Pull Request — release-2.1 (#4993)
by Jeremy
06:20
created
Sources/ManagePaid.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1129,7 +1129,7 @@
 block discarded – undo
1129 1129
 					'{db_prefix}log_subscribed',
1130 1130
 					array(
1131 1131
 						'id_subscribe' => 'int', 'id_member' => 'int', 'old_id_group' => 'int', 'start_time' => 'int',
1132
-						'end_time' => 'int', 'status' => 'int','pending_details' => 'string-65534'
1132
+						'end_time' => 'int', 'status' => 'int', 'pending_details' => 'string-65534'
1133 1133
 					),
1134 1134
 					array(
1135 1135
 						$context['sub_id'], $id_member, $id_group, $starttime,
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Spacing   +112 added lines, -112 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 '. count(fetch_alerts($v, false, 0, array(), false)) . ' ';
394
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . count(fetch_alerts($v, false, 0, array(), false)) . ' ';
395 395
 				$val = $val . ' END';
396 396
 				$type = 'raw';
397 397
 			}
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	static $non_twelve_hour, $locale_cache;
745 745
 	static $unsupportedFormats, $finalizedFormats;
746 746
 
747
-	$unsupportedFormatsWindows = array('z','Z');
747
+	$unsupportedFormatsWindows = array('z', 'Z');
748 748
 
749 749
 	// Ensure required values are set
750 750
 	$user_info['time_offset'] = !empty($user_info['time_offset']) ? $user_info['time_offset'] : 0;
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
830 830
 		if (empty($unsupportedFormats))
831 831
 		{
832
-			foreach($strftimeFormatSubstitutions as $format => $substitution)
832
+			foreach ($strftimeFormatSubstitutions as $format => $substitution)
833 833
 			{
834 834
 				// Avoid a crashing bug with PHP 7 on certain versions of Windows
835 835
 				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
 					{
@@ -1788,7 +1788,7 @@  discard block
 block discarded – undo
1788 1788
 				'test' => '[1-7]\]',
1789 1789
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1790 1790
 				'after' => '</span>',
1791
-				'validate' => function (&$tag, &$data, $disabled)
1791
+				'validate' => function(&$tag, &$data, $disabled)
1792 1792
 				{
1793 1793
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1794 1794
 					$data = $sizes[$data] . 'em';
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 				'tag' => 'time',
1827 1827
 				'type' => 'unparsed_content',
1828 1828
 				'content' => '$1',
1829
-				'validate' => function (&$tag, &$data, $disabled)
1829
+				'validate' => function(&$tag, &$data, $disabled)
1830 1830
 				{
1831 1831
 					if (is_numeric($data))
1832 1832
 						$data = timeformat($data);
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 				'tag' => 'url',
1860 1860
 				'type' => 'unparsed_content',
1861 1861
 				'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>',
1862
-				'validate' => function (&$tag, &$data, $disabled)
1862
+				'validate' => function(&$tag, &$data, $disabled)
1863 1863
 				{
1864 1864
 					$data = strtr($data, array('<br>' => ''));
1865 1865
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1873,7 +1873,7 @@  discard block
 block discarded – undo
1873 1873
 				'quoted' => 'optional',
1874 1874
 				'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">',
1875 1875
 				'after' => '</a>',
1876
-				'validate' => function (&$tag, &$data, $disabled)
1876
+				'validate' => function(&$tag, &$data, $disabled)
1877 1877
 				{
1878 1878
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1879 1879
 					if (empty($scheme))
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 		{
1920 1920
 			if (isset($temp_bbc))
1921 1921
 				$bbc_codes = $temp_bbc;
1922
-			usort($codes, function ($a, $b) {
1922
+			usort($codes, function($a, $b) {
1923 1923
 				return strcmp($a['tag'], $b['tag']);
1924 1924
 			});
1925 1925
 			return $codes;
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
 										# a run of Unicode domain name characters and a dot
2136 2136
 										[\p{L}\p{M}\p{N}\-.:@]+\.
2137 2137
 										# and then a TLD valid in the DNS or the reserved "local" TLD
2138
-										(?:'. $modSettings['tld_regex'] .'|local)
2138
+										(?:'. $modSettings['tld_regex'] . '|local)
2139 2139
 									)
2140 2140
 									# followed by a non-domain character or end of line
2141 2141
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -2203,7 +2203,7 @@  discard block
 block discarded – undo
2203 2203
 						)?
2204 2204
 						';
2205 2205
 
2206
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2206
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
2207 2207
 							$url = array_shift($matches);
2208 2208
 
2209 2209
 							// If this isn't a clean URL, bail out
@@ -2228,7 +2228,7 @@  discard block
 block discarded – undo
2228 2228
 								$fullUrl = $url;
2229 2229
 
2230 2230
 							// Make sure that $fullUrl really is valid
2231
-							if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '' ) . $fullUrl) === false)
2231
+							if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '') . $fullUrl) === false)
2232 2232
 								return $url;
2233 2233
 
2234 2234
 							return '[url=&quot;' . str_replace(array('[', ']'), array('&#91;', '&#93;'), $fullUrl) . '&quot;]' . $url . '[/url]';
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
 			$look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2));
2293 2293
 
2294 2294
 			// A closing tag that doesn't match any open tags? Skip it.
2295
-			if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags)))
2295
+			if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags)))
2296 2296
 				continue;
2297 2297
 
2298 2298
 			$to_close = array();
@@ -2965,7 +2965,7 @@  discard block
 block discarded – undo
2965 2965
 			{
2966 2966
 				$exts = array('svg', 'png', 'gif', 'jpg');
2967 2967
 				$fname = pathinfo($smileysto[$i], PATHINFO_FILENAME);
2968
-				$alt_images = glob($smileys_dir . $fname .  '.{' . (implode(',', $exts)) . '}', GLOB_BRACE);
2968
+				$alt_images = glob($smileys_dir . $fname . '.{' . (implode(',', $exts)) . '}', GLOB_BRACE);
2969 2969
 				if (!empty($alt_images))
2970 2970
 				{
2971 2971
 					foreach ($exts as $ext)
@@ -2981,7 +2981,7 @@  discard block
 block discarded – undo
2981 2981
 			}
2982 2982
 
2983 2983
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2984
-			$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">';
2984
+			$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">';
2985 2985
 
2986 2986
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2987 2987
 
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
 
3007 3007
 	// Replace away!
3008 3008
 	$message = preg_replace_callback($smileyPregSearch,
3009
-		function ($matches) use ($smileyPregReplacements)
3009
+		function($matches) use ($smileyPregReplacements)
3010 3010
 		{
3011 3011
 			return $smileyPregReplacements[$matches[1]];
3012 3012
 		}, $message);
@@ -3103,13 +3103,13 @@  discard block
 block discarded – undo
3103 3103
 	{
3104 3104
 		if (defined('SID') && SID != '')
3105 3105
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
3106
-				function ($m) use ($scripturl)
3106
+				function($m) use ($scripturl)
3107 3107
 				{
3108
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
3108
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
3109 3109
 				}, $setLocation);
3110 3110
 		else
3111 3111
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
3112
-				function ($m) use ($scripturl)
3112
+				function($m) use ($scripturl)
3113 3113
 				{
3114 3114
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
3115 3115
 				}, $setLocation);
@@ -3430,7 +3430,7 @@  discard block
 block discarded – undo
3430 3430
 
3431 3431
 	// Add a generic "Are you sure?" confirmation message.
3432 3432
 	addInlineJavaScript('
3433
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3433
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3434 3434
 
3435 3435
 	// Now add the capping code for avatars.
3436 3436
 	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')
@@ -3896,7 +3896,7 @@  discard block
 block discarded – undo
3896 3896
 	if (!empty($normal))
3897 3897
 		foreach ($normal as $nf)
3898 3898
 			echo '
3899
-	<link rel="stylesheet" href="', $nf ,'">';
3899
+	<link rel="stylesheet" href="', $nf, '">';
3900 3900
 
3901 3901
 	if ($db_show_debug === true)
3902 3902
 	{
@@ -3912,7 +3912,7 @@  discard block
 block discarded – undo
3912 3912
 	<style>';
3913 3913
 
3914 3914
 		foreach ($context['css_header'] as $css)
3915
-			echo $css .'
3915
+			echo $css . '
3916 3916
 	';
3917 3917
 
3918 3918
 		echo'
@@ -3956,7 +3956,7 @@  discard block
 block discarded – undo
3956 3956
 
3957 3957
 
3958 3958
 	// No namespaces, sorry!
3959
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3959
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3960 3960
 
3961 3961
 	// Temp path.
3962 3962
 	$cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/';
@@ -4136,7 +4136,7 @@  discard block
 block discarded – undo
4136 4136
 	else
4137 4137
 		$path = $modSettings['attachmentUploadDir'];
4138 4138
 
4139
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
4139
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
4140 4140
 }
4141 4141
 
4142 4142
 /**
@@ -4180,10 +4180,10 @@  discard block
 block discarded – undo
4180 4180
 		$valid_low = isValidIP($ip_parts[0]);
4181 4181
 		$valid_high = isValidIP($ip_parts[1]);
4182 4182
 		$count = 0;
4183
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
4183
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
4184 4184
 		$max = ($mode == ':' ? 'ffff' : '255');
4185 4185
 		$min = 0;
4186
-		if(!$valid_low)
4186
+		if (!$valid_low)
4187 4187
 		{
4188 4188
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
4189 4189
 			$valid_low = isValidIP($ip_parts[0]);
@@ -4197,7 +4197,7 @@  discard block
 block discarded – undo
4197 4197
 		}
4198 4198
 
4199 4199
 		$count = 0;
4200
-		if(!$valid_high)
4200
+		if (!$valid_high)
4201 4201
 		{
4202 4202
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
4203 4203
 			$valid_high = isValidIP($ip_parts[1]);
@@ -4210,7 +4210,7 @@  discard block
 block discarded – undo
4210 4210
 			}
4211 4211
 		}
4212 4212
 
4213
-		if($valid_high && $valid_low)
4213
+		if ($valid_high && $valid_low)
4214 4214
 		{
4215 4215
 			$ip_array['low'] = $ip_parts[0];
4216 4216
 			$ip_array['high'] = $ip_parts[1];
@@ -4391,7 +4391,7 @@  discard block
 block discarded – undo
4391 4391
 		addInlineJavaScript('
4392 4392
 	var user_menus = new smc_PopupMenu();
4393 4393
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4394
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4394
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4395 4395
 		if ($context['allow_pm'])
4396 4396
 			addInlineJavaScript('
4397 4397
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4686,7 +4686,7 @@  discard block
 block discarded – undo
4686 4686
 		$total_admin_reports += $context['unapproved_members'];
4687 4687
 	}
4688 4688
 	
4689
-	if($total_admin_reports > 0 && !empty($context['menu_buttons']['admin']))
4689
+	if ($total_admin_reports > 0 && !empty($context['menu_buttons']['admin']))
4690 4690
 	{
4691 4691
 		$context['menu_buttons']['admin']['title'] .= ' <span class="amt">' . $total_admin_reports . '</span>';
4692 4692
 	}
@@ -5033,7 +5033,7 @@  discard block
 block discarded – undo
5033 5033
 		// No? try a fallback to $sourcedir
5034 5034
 		else
5035 5035
 		{
5036
-			$absPath = $sourcedir .'/'. $file;
5036
+			$absPath = $sourcedir . '/' . $file;
5037 5037
 
5038 5038
 			if (file_exists($absPath))
5039 5039
 				require_once($absPath);
@@ -5300,15 +5300,15 @@  discard block
 block discarded – undo
5300 5300
 
5301 5301
 	// UTF-8 occurences of MS special characters
5302 5302
 	$findchars_utf8 = array(
5303
-		"\xe2\x80\x9a",	// single low-9 quotation mark
5304
-		"\xe2\x80\x9e",	// double low-9 quotation mark
5305
-		"\xe2\x80\xa6",	// horizontal ellipsis
5306
-		"\xe2\x80\x98",	// left single curly quote
5307
-		"\xe2\x80\x99",	// right single curly quote
5308
-		"\xe2\x80\x9c",	// left double curly quote
5309
-		"\xe2\x80\x9d",	// right double curly quote
5310
-		"\xe2\x80\x93",	// en dash
5311
-		"\xe2\x80\x94",	// em dash
5303
+		"\xe2\x80\x9a", // single low-9 quotation mark
5304
+		"\xe2\x80\x9e", // double low-9 quotation mark
5305
+		"\xe2\x80\xa6", // horizontal ellipsis
5306
+		"\xe2\x80\x98", // left single curly quote
5307
+		"\xe2\x80\x99", // right single curly quote
5308
+		"\xe2\x80\x9c", // left double curly quote
5309
+		"\xe2\x80\x9d", // right double curly quote
5310
+		"\xe2\x80\x93", // en dash
5311
+		"\xe2\x80\x94", // em dash
5312 5312
 	);
5313 5313
 
5314 5314
 	// windows 1252 / iso equivalents
@@ -5326,15 +5326,15 @@  discard block
 block discarded – undo
5326 5326
 
5327 5327
 	// safe replacements
5328 5328
 	$replacechars = array(
5329
-		',',	// &sbquo;
5330
-		',,',	// &bdquo;
5331
-		'...',	// &hellip;
5332
-		"'",	// &lsquo;
5333
-		"'",	// &rsquo;
5334
-		'"',	// &ldquo;
5335
-		'"',	// &rdquo;
5336
-		'-',	// &ndash;
5337
-		'--',	// &mdash;
5329
+		',', // &sbquo;
5330
+		',,', // &bdquo;
5331
+		'...', // &hellip;
5332
+		"'", // &lsquo;
5333
+		"'", // &rsquo;
5334
+		'"', // &ldquo;
5335
+		'"', // &rdquo;
5336
+		'-', // &ndash;
5337
+		'--', // &mdash;
5338 5338
 	);
5339 5339
 
5340 5340
 	if ($context['utf8'])
@@ -5654,7 +5654,7 @@  discard block
 block discarded – undo
5654 5654
  */
5655 5655
 function inet_dtop($bin)
5656 5656
 {
5657
-	if(empty($bin))
5657
+	if (empty($bin))
5658 5658
 		return '';
5659 5659
 
5660 5660
 	global $db_type;
@@ -5685,28 +5685,28 @@  discard block
 block discarded – undo
5685 5685
  */
5686 5686
 function _safe_serialize($value)
5687 5687
 {
5688
-	if(is_null($value))
5688
+	if (is_null($value))
5689 5689
 		return 'N;';
5690 5690
 
5691
-	if(is_bool($value))
5692
-		return 'b:'. (int) $value .';';
5691
+	if (is_bool($value))
5692
+		return 'b:' . (int) $value . ';';
5693 5693
 
5694
-	if(is_int($value))
5695
-		return 'i:'. $value .';';
5694
+	if (is_int($value))
5695
+		return 'i:' . $value . ';';
5696 5696
 
5697
-	if(is_float($value))
5698
-		return 'd:'. str_replace(',', '.', $value) .';';
5697
+	if (is_float($value))
5698
+		return 'd:' . str_replace(',', '.', $value) . ';';
5699 5699
 
5700
-	if(is_string($value))
5701
-		return 's:'. strlen($value) .':"'. $value .'";';
5700
+	if (is_string($value))
5701
+		return 's:' . strlen($value) . ':"' . $value . '";';
5702 5702
 
5703
-	if(is_array($value))
5703
+	if (is_array($value))
5704 5704
 	{
5705 5705
 		$out = '';
5706
-		foreach($value as $k => $v)
5706
+		foreach ($value as $k => $v)
5707 5707
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5708 5708
 
5709
-		return 'a:'. count($value) .':{'. $out .'}';
5709
+		return 'a:' . count($value) . ':{' . $out . '}';
5710 5710
 	}
5711 5711
 
5712 5712
 	// safe_serialize cannot serialize resources or objects.
@@ -5748,7 +5748,7 @@  discard block
 block discarded – undo
5748 5748
 function _safe_unserialize($str)
5749 5749
 {
5750 5750
 	// Input  is not a string.
5751
-	if(empty($str) || !is_string($str))
5751
+	if (empty($str) || !is_string($str))
5752 5752
 		return false;
5753 5753
 
5754 5754
 	$stack = array();
@@ -5762,40 +5762,40 @@  discard block
 block discarded – undo
5762 5762
 	 *   3 - in array, expecting value or another array
5763 5763
 	 */
5764 5764
 	$state = 0;
5765
-	while($state != 1)
5765
+	while ($state != 1)
5766 5766
 	{
5767 5767
 		$type = isset($str[0]) ? $str[0] : '';
5768
-		if($type == '}')
5768
+		if ($type == '}')
5769 5769
 			$str = substr($str, 1);
5770 5770
 
5771
-		else if($type == 'N' && $str[1] == ';')
5771
+		else if ($type == 'N' && $str[1] == ';')
5772 5772
 		{
5773 5773
 			$value = null;
5774 5774
 			$str = substr($str, 2);
5775 5775
 		}
5776
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5776
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5777 5777
 		{
5778 5778
 			$value = $matches[1] == '1' ? true : false;
5779 5779
 			$str = substr($str, 4);
5780 5780
 		}
5781
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5781
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5782 5782
 		{
5783
-			$value = (int)$matches[1];
5783
+			$value = (int) $matches[1];
5784 5784
 			$str = $matches[2];
5785 5785
 		}
5786
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5786
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5787 5787
 		{
5788
-			$value = (float)$matches[1];
5788
+			$value = (float) $matches[1];
5789 5789
 			$str = $matches[3];
5790 5790
 		}
5791
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5791
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5792 5792
 		{
5793
-			$value = substr($matches[2], 0, (int)$matches[1]);
5794
-			$str = substr($matches[2], (int)$matches[1] + 2);
5793
+			$value = substr($matches[2], 0, (int) $matches[1]);
5794
+			$str = substr($matches[2], (int) $matches[1] + 2);
5795 5795
 		}
5796
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5796
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5797 5797
 		{
5798
-			$expectedLength = (int)$matches[1];
5798
+			$expectedLength = (int) $matches[1];
5799 5799
 			$str = $matches[2];
5800 5800
 		}
5801 5801
 
@@ -5803,10 +5803,10 @@  discard block
 block discarded – undo
5803 5803
 		else
5804 5804
 			return false;
5805 5805
 
5806
-		switch($state)
5806
+		switch ($state)
5807 5807
 		{
5808 5808
 			case 3: // In array, expecting value or another array.
5809
-				if($type == 'a')
5809
+				if ($type == 'a')
5810 5810
 				{
5811 5811
 					$stack[] = &$list;
5812 5812
 					$list[$key] = array();
@@ -5815,7 +5815,7 @@  discard block
 block discarded – undo
5815 5815
 					$state = 2;
5816 5816
 					break;
5817 5817
 				}
5818
-				if($type != '}')
5818
+				if ($type != '}')
5819 5819
 				{
5820 5820
 					$list[$key] = $value;
5821 5821
 					$state = 2;
@@ -5826,29 +5826,29 @@  discard block
 block discarded – undo
5826 5826
 				return false;
5827 5827
 
5828 5828
 			case 2: // in array, expecting end of array or a key
5829
-				if($type == '}')
5829
+				if ($type == '}')
5830 5830
 				{
5831 5831
 					// Array size is less than expected.
5832
-					if(count($list) < end($expected))
5832
+					if (count($list) < end($expected))
5833 5833
 						return false;
5834 5834
 
5835 5835
 					unset($list);
5836
-					$list = &$stack[count($stack)-1];
5836
+					$list = &$stack[count($stack) - 1];
5837 5837
 					array_pop($stack);
5838 5838
 
5839 5839
 					// Go to terminal state if we're at the end of the root array.
5840 5840
 					array_pop($expected);
5841 5841
 
5842
-					if(count($expected) == 0)
5842
+					if (count($expected) == 0)
5843 5843
 						$state = 1;
5844 5844
 
5845 5845
 					break;
5846 5846
 				}
5847 5847
 
5848
-				if($type == 'i' || $type == 's')
5848
+				if ($type == 'i' || $type == 's')
5849 5849
 				{
5850 5850
 					// Array size exceeds expected length.
5851
-					if(count($list) >= end($expected))
5851
+					if (count($list) >= end($expected))
5852 5852
 						return false;
5853 5853
 
5854 5854
 					$key = $value;
@@ -5861,7 +5861,7 @@  discard block
 block discarded – undo
5861 5861
 
5862 5862
 			// Expecting array or value.
5863 5863
 			case 0:
5864
-				if($type == 'a')
5864
+				if ($type == 'a')
5865 5865
 				{
5866 5866
 					$data = array();
5867 5867
 					$list = &$data;
@@ -5870,7 +5870,7 @@  discard block
 block discarded – undo
5870 5870
 					break;
5871 5871
 				}
5872 5872
 
5873
-				if($type != '}')
5873
+				if ($type != '}')
5874 5874
 				{
5875 5875
 					$data = $value;
5876 5876
 					$state = 1;
@@ -5883,7 +5883,7 @@  discard block
 block discarded – undo
5883 5883
 	}
5884 5884
 
5885 5885
 	// Trailing data in input.
5886
-	if(!empty($str))
5886
+	if (!empty($str))
5887 5887
 		return false;
5888 5888
 
5889 5889
 	return $data;
@@ -5937,7 +5937,7 @@  discard block
 block discarded – undo
5937 5937
 	// Set different modes.
5938 5938
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5939 5939
 
5940
-	foreach($chmodValues as $val)
5940
+	foreach ($chmodValues as $val)
5941 5941
 	{
5942 5942
 		// If it's writable, break out of the loop.
5943 5943
 		if (is_writable($file))
@@ -5972,13 +5972,13 @@  discard block
 block discarded – undo
5972 5972
 	$returnArray = @json_decode($json, $returnAsArray);
5973 5973
 
5974 5974
 	// PHP 5.3 so no json_last_error_msg()
5975
-	switch(json_last_error())
5975
+	switch (json_last_error())
5976 5976
 	{
5977 5977
 		case JSON_ERROR_NONE:
5978 5978
 			$jsonError = false;
5979 5979
 			break;
5980 5980
 		case JSON_ERROR_DEPTH:
5981
-			$jsonError =  'JSON_ERROR_DEPTH';
5981
+			$jsonError = 'JSON_ERROR_DEPTH';
5982 5982
 			break;
5983 5983
 		case JSON_ERROR_STATE_MISMATCH:
5984 5984
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -6006,10 +6006,10 @@  discard block
 block discarded – undo
6006 6006
 		loadLanguage('Errors');
6007 6007
 
6008 6008
 		if (!empty($jsonDebug))
6009
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
6009
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
6010 6010
 
6011 6011
 		else
6012
-			log_error($txt['json_'. $jsonError], 'critical');
6012
+			log_error($txt['json_' . $jsonError], 'critical');
6013 6013
 
6014 6014
 		// Everyone expects an array.
6015 6015
 		return array();
@@ -6126,7 +6126,7 @@  discard block
 block discarded – undo
6126 6126
 		// Convert Punycode to Unicode
6127 6127
 		require_once($sourcedir . '/Class-Punycode.php');
6128 6128
 		$Punycode = new Punycode();
6129
-		$tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds);
6129
+		$tlds = array_map(function($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds);
6130 6130
 	}
6131 6131
 	// Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update
6132 6132
 	else
@@ -6220,7 +6220,7 @@  discard block
 block discarded – undo
6220 6220
 	}
6221 6221
 
6222 6222
 	// This recursive function creates the index array from the strings
6223
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
6223
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
6224 6224
 	{
6225 6225
 		static $depth = 0;
6226 6226
 		$depth++;
@@ -6247,7 +6247,7 @@  discard block
 block discarded – undo
6247 6247
 	};
6248 6248
 
6249 6249
 	// This recursive function turns the index array into a regular expression
6250
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
6250
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
6251 6251
 	{
6252 6252
 		static $depth = 0;
6253 6253
 		$depth++;
@@ -6271,11 +6271,11 @@  discard block
 block discarded – undo
6271 6271
 
6272 6272
 				if (count(array_keys($value)) == 1)
6273 6273
 				{
6274
-					$new_key_array = explode('(?'.'>', $sub_regex);
6274
+					$new_key_array = explode('(?' . '>', $sub_regex);
6275 6275
 					$new_key .= $new_key_array[0];
6276 6276
 				}
6277 6277
 				else
6278
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
6278
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
6279 6279
 			}
6280 6280
 
6281 6281
 			if ($depth > 1)
@@ -6318,10 +6318,10 @@  discard block
 block discarded – undo
6318 6318
 	{
6319 6319
 		$regex = array();
6320 6320
 		while (!empty($index))
6321
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6321
+			$regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6322 6322
 	}
6323 6323
 	else
6324
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6324
+		$regex = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6325 6325
 
6326 6326
 	// Restore PHP's internal character encoding to whatever it was originally
6327 6327
 	if (!empty($current_encoding))
@@ -6545,7 +6545,7 @@  discard block
 block discarded – undo
6545 6545
 function sanitize_iri($iri)
6546 6546
 {
6547 6547
 	// Encode any non-ASCII characters (but not space or control characters of any sort)
6548
-	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) {
6548
+	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function($matches) {
6549 6549
 		return rawurlencode($matches[0]);
6550 6550
 	}, $iri);
6551 6551
 
@@ -6587,7 +6587,7 @@  discard block
 block discarded – undo
6587 6587
 	$unescaped = array(
6588 6588
 		'%21'=>'!', '%23'=>'#', '%24'=>'$', '%26'=>'&',
6589 6589
 		'%27'=>"'", '%28'=>'(', '%29'=>')', '%2A'=>'*',
6590
-		'%2B'=>'+', '%2C'=>',',	'%2F'=>'/', '%3A'=>':',
6590
+		'%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':',
6591 6591
 		'%3B'=>';', '%3D'=>'=', '%3F'=>'?', '%40'=>'@',
6592 6592
 	);
6593 6593
 	$iri = strtr(rawurlencode($iri), $unescaped);
Please login to merge, or discard this patch.