Passed
Pull Request — release-2.1 (#5733)
by Mathias
04:11
created
Sources/Subs.php 2 patches
Braces   +3 added lines, -8 removed lines patch added patch discarded remove patch
@@ -279,7 +279,6 @@  discard block
 block discarded – undo
279 279
 		$condition = 'id_member IN ({array_int:members})';
280 280
 		$parameters['members'] = $members;
281 281
 	}
282
-
283 282
 	elseif ($members === null)
284 283
 		$condition = '1=1';
285 284
 
@@ -382,11 +381,9 @@  discard block
 block discarded – undo
382 381
 				$val = $val . ' END';
383 382
 				$type = 'raw';
384 383
 			}
385
-
386 384
 			else
387 385
 				$val = alert_count($members, true);
388 386
 		}
389
-
390 387
 		elseif ($type == 'int' && ($val === '+' || $val === '-'))
391 388
 		{
392 389
 			$val = $var . ' ' . $val . ' 1';
@@ -2176,12 +2173,12 @@  discard block
 block discarded – undo
2176 2173
 			'tag' => 'cowsay',
2177 2174
 			'parameters' => array(
2178 2175
 				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2179
-					{
2176
+				{
2180 2177
 						return $smcFunc['substr']($eyes . 'oo', 0, 2);
2181 2178
 					},
2182 2179
 				),
2183 2180
 				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2184
-					{
2181
+				{
2185 2182
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2186 2183
 					},
2187 2184
 				),
@@ -3279,7 +3276,7 @@  discard block
 block discarded – undo
3279 3276
 
3280 3277
 	// Replace away!
3281 3278
 	$message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements)
3282
-		{
3279
+	{
3283 3280
 			return $smileyPregReplacements[$matches[1]];
3284 3281
 		}, $message);
3285 3282
 }
@@ -4077,7 +4074,6 @@  discard block
 block discarded – undo
4077 4074
 				if (!isset($minSeed) && isset($js_file['options']['seed']))
4078 4075
 					$minSeed = $js_file['options']['seed'];
4079 4076
 			}
4080
-
4081 4077
 			else
4082 4078
 			{
4083 4079
 				echo '
@@ -6360,7 +6356,6 @@  discard block
 block discarded – undo
6360 6356
 			$isWritable = true;
6361 6357
 			break;
6362 6358
 		}
6363
-
6364 6359
 		else
6365 6360
 			@chmod($file, $val);
6366 6361
 	}
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 			{
378 378
 				$val = 'CASE ';
379 379
 				foreach ($members as $k => $v)
380
-					$val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, true) . ' ';
380
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, true) . ' ';
381 381
 
382 382
 				$val = $val . ' END';
383 383
 				$type = 'raw';
@@ -1039,11 +1039,11 @@  discard block
 block discarded – undo
1039 1039
 			// Anything that isn't a specification, punctuation mark, or whitespace.
1040 1040
 			'~(?<!%)\p{L}|[^\p{L}\p{P}\s]~u',
1041 1041
 			// A series of punctuation marks (except %), possibly separated by whitespace.
1042
-			'~([^%\P{P}])(\s*)(?'.'>(\1|[^%\P{Po}])\s*(?!$))*~u',
1042
+			'~([^%\P{P}])(\s*)(?' . '>(\1|[^%\P{Po}])\s*(?!$))*~u',
1043 1043
 			// Unwanted trailing punctuation and whitespace.
1044
-			'~(?'.'>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
1044
+			'~(?' . '>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
1045 1045
 			// Unwanted opening punctuation and whitespace.
1046
-			'~^\s*(?'.'>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
1046
+			'~^\s*(?' . '>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
1047 1047
 		),
1048 1048
 		array(
1049 1049
 			'',
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 				$dt_user = new DateTime('@' . $timestamp);
1156 1156
 				$temp_offset = $dtz_user->getOffset($dt_user);
1157 1157
 				if ($temp_offset !== false)
1158
-					$user_offset = $temp_offset/3600;
1158
+					$user_offset = $temp_offset / 3600;
1159 1159
 			}
1160 1160
 		}
1161 1161
 	}
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
 							$width = !empty($width) ? ' width="' . $width . '"' : '';
1487 1487
 							$height = !empty($height) ? ' height="' . $height . '"' : '';
1488 1488
 
1489
-							$returnContext .= '<div class="videocontainer"><video controls preload="metadata" src="'. $currentAttachment['href'] . '" playsinline' . $width . $height . '><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : '');
1489
+							$returnContext .= '<div class="videocontainer"><video controls preload="metadata" src="' . $currentAttachment['href'] . '" playsinline' . $width . $height . '><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : '');
1490 1490
 						}
1491 1491
 						// Audio.
1492 1492
 						elseif (strpos($currentAttachment['mime_type'], 'audio/') === 0)
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
 							$width = 'max-width:100%; width: ' . (!empty($width) ? $width : '400') . 'px;';
1495 1495
 							$height = !empty($height) ? 'height: ' . $height . 'px;' : '';
1496 1496
 
1497
-							$returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="'. $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>';
1497
+							$returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="' . $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>';
1498 1498
 						}
1499 1499
 						// Anything else.
1500 1500
 						else
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 				'type' => 'unparsed_commas_content',
1664 1664
 				'test' => '\d+,\d+\]',
1665 1665
 				'content' => '<a href="$1" target="_blank" rel="noopener">$1</a>',
1666
-				'validate' => function (&$tag, &$data, $disabled)
1666
+				'validate' => function(&$tag, &$data, $disabled)
1667 1667
 				{
1668 1668
 					$scheme = parse_url($data[0], PHP_URL_SCHEME);
1669 1669
 					if (empty($scheme))
@@ -2201,12 +2201,12 @@  discard block
 block discarded – undo
2201 2201
 		$codes[] = array(
2202 2202
 			'tag' => 'cowsay',
2203 2203
 			'parameters' => array(
2204
-				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2204
+				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function($eyes) use ($smcFunc)
2205 2205
 					{
2206 2206
 						return $smcFunc['substr']($eyes . 'oo', 0, 2);
2207 2207
 					},
2208 2208
 				),
2209
-				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2209
+				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function($tongue) use ($smcFunc)
2210 2210
 					{
2211 2211
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2212 2212
 					},
@@ -3578,7 +3578,7 @@  discard block
 block discarded – undo
3578 3578
 		if ($fp != false)
3579 3579
 		{
3580 3580
 			// Send the HEAD request (since we don't have to worry about chunked, HTTP/1.1 is fine here.)
3581
-			fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: '. SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n");
3581
+			fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: ' . SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n");
3582 3582
 
3583 3583
 			// Read in the HTTP/1.1 or whatever.
3584 3584
 			$test = substr(fgets($fp, 11), -1);
@@ -4182,7 +4182,7 @@  discard block
 block discarded – undo
4182 4182
 	$toMinify = array();
4183 4183
 	$normal = array();
4184 4184
 
4185
-	uasort($context['css_files'], function ($a, $b)
4185
+	uasort($context['css_files'], function($a, $b)
4186 4186
 	{
4187 4187
 		return $a['options']['order_pos'] < $b['options']['order_pos'] ? -1 : ($a['options']['order_pos'] > $b['options']['order_pos'] ? 1 : 0);
4188 4188
 	});
@@ -5478,7 +5478,7 @@  discard block
 block discarded – undo
5478 5478
 			{
5479 5479
 				fwrite($fp, 'GET ' . ($match[6] !== '/' ? str_replace(' ', '%20', $match[6]) : '') . ' HTTP/1.0' . "\r\n");
5480 5480
 				fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
5481
-				fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n");
5481
+				fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n");
5482 5482
 				if ($keep_alive)
5483 5483
 					fwrite($fp, 'connection: Keep-Alive' . "\r\n\r\n");
5484 5484
 				else
@@ -5488,7 +5488,7 @@  discard block
 block discarded – undo
5488 5488
 			{
5489 5489
 				fwrite($fp, 'POST ' . ($match[6] !== '/' ? $match[6] : '') . ' HTTP/1.0' . "\r\n");
5490 5490
 				fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
5491
-				fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n");
5491
+				fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n");
5492 5492
 				if ($keep_alive)
5493 5493
 					fwrite($fp, 'connection: Keep-Alive' . "\r\n");
5494 5494
 				else
@@ -5736,13 +5736,13 @@  discard block
 block discarded – undo
5736 5736
 
5737 5737
 	// UTF-8 occurences of MS special characters
5738 5738
 	$findchars_utf8 = array(
5739
-		"\xe2\x80\x9a",	// single low-9 quotation mark
5740
-		"\xe2\x80\x9e",	// double low-9 quotation mark
5741
-		"\xe2\x80\xa6",	// horizontal ellipsis
5742
-		"\xe2\x80\x98",	// left single curly quote
5743
-		"\xe2\x80\x99",	// right single curly quote
5744
-		"\xe2\x80\x9c",	// left double curly quote
5745
-		"\xe2\x80\x9d",	// right double curly quote
5739
+		"\xe2\x80\x9a", // single low-9 quotation mark
5740
+		"\xe2\x80\x9e", // double low-9 quotation mark
5741
+		"\xe2\x80\xa6", // horizontal ellipsis
5742
+		"\xe2\x80\x98", // left single curly quote
5743
+		"\xe2\x80\x99", // right single curly quote
5744
+		"\xe2\x80\x9c", // left double curly quote
5745
+		"\xe2\x80\x9d", // right double curly quote
5746 5746
 	);
5747 5747
 
5748 5748
 	// windows 1252 / iso equivalents
@@ -5758,13 +5758,13 @@  discard block
 block discarded – undo
5758 5758
 
5759 5759
 	// safe replacements
5760 5760
 	$replacechars = array(
5761
-		',',	// &sbquo;
5762
-		',,',	// &bdquo;
5763
-		'...',	// &hellip;
5764
-		"'",	// &lsquo;
5765
-		"'",	// &rsquo;
5766
-		'"',	// &ldquo;
5767
-		'"',	// &rdquo;
5761
+		',', // &sbquo;
5762
+		',,', // &bdquo;
5763
+		'...', // &hellip;
5764
+		"'", // &lsquo;
5765
+		"'", // &rsquo;
5766
+		'"', // &ldquo;
5767
+		'"', // &rdquo;
5768 5768
 	);
5769 5769
 
5770 5770
 	if ($context['utf8'])
@@ -6949,7 +6949,7 @@  discard block
 block discarded – undo
6949 6949
 			EXISTS (
6950 6950
 				SELECT bpv.id_board
6951 6951
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
6952
-				WHERE bpv.id_group IN ('. implode(',', $groups) .')
6952
+				WHERE bpv.id_group IN ('. implode(',', $groups) . ')
6953 6953
 					AND bpv.deny = 0
6954 6954
 					AND bpv.id_board = b.id_board
6955 6955
 			)';
@@ -6959,7 +6959,7 @@  discard block
 block discarded – undo
6959 6959
 			AND NOT EXISTS (
6960 6960
 				SELECT bpv.id_board
6961 6961
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
6962
-				WHERE bpv.id_group IN ( '. implode(',', $groups) .')
6962
+				WHERE bpv.id_group IN ( '. implode(',', $groups) . ')
6963 6963
 					AND bpv.deny = 1
6964 6964
 					AND bpv.id_board = b.id_board
6965 6965
 			)';
@@ -7230,8 +7230,8 @@  discard block
 block discarded – undo
7230 7230
 	$i = 0;
7231 7231
 	while (empty($done))
7232 7232
 	{
7233
-		if (strpos($format, '{'. --$i . '}') !== false)
7234
-			$replacements['{'. $i . '}'] = array_pop($list);
7233
+		if (strpos($format, '{' . --$i . '}') !== false)
7234
+			$replacements['{' . $i . '}'] = array_pop($list);
7235 7235
 		else
7236 7236
 			$done = true;
7237 7237
 	}
@@ -7241,8 +7241,8 @@  discard block
 block discarded – undo
7241 7241
 	$i = 0;
7242 7242
 	while (empty($done))
7243 7243
 	{
7244
-		if (strpos($format, '{'. ++$i . '}') !== false)
7245
-			$replacements['{'. $i . '}'] = array_shift($list);
7244
+		if (strpos($format, '{' . ++$i . '}') !== false)
7245
+			$replacements['{' . $i . '}'] = array_shift($list);
7246 7246
 		else
7247 7247
 			$done = true;
7248 7248
 	}
Please login to merge, or discard this patch.
Sources/Load.php 2 patches
Braces   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	// Set a list of common functions.
105 105
 	$ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);';
106 106
 	$ent_check = empty($modSettings['disableEntityCheck']) ? function($string)
107
-		{
107
+	{
108 108
 			$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
109 109
 			return $string;
110 110
 		} : function($string)
@@ -929,7 +929,6 @@  discard block
 block discarded – undo
929 929
 			$user_info_min[$row['id_member']]['time_offset'] = ($tz_user->getOffset($time_user) -
930 930
 					$tz_system->getOffset($time_system)) / 3600;
931 931
 		}
932
-
933 932
 		else
934 933
 			$user_info_min[$row['id_member']]['time_offset'] = empty($row['time_offset']) ? 0 : $row['time_offset'];
935 934
 	}
@@ -1657,7 +1656,6 @@  discard block
 block discarded – undo
1657 1656
 			$time_user = new DateTime('now', $tz_user);
1658 1657
 			$profile['time_offset'] = ($tz_user->getOffset($time_user) - $tz_system->getOffset($time_system)) / 3600;
1659 1658
 		}
1660
-
1661 1659
 		else
1662 1660
 		{
1663 1661
 			// !!! Compatibility.
@@ -2322,7 +2320,6 @@  discard block
 block discarded – undo
2322 2320
 		loadLanguage('index+Modifications');
2323 2321
 		$context['template_layers'] = array();
2324 2322
 	}
2325
-
2326 2323
 	else
2327 2324
 	{
2328 2325
 		// Custom templates to load, or just default?
Please login to merge, or discard this patch.
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2705,8 +2705,7 @@  discard block
 block discarded – undo
2705 2705
 		$context['css_files_order'] = array();
2706 2706
 
2707 2707
 	$params['seed'] = (!array_key_exists('seed', $params) || (array_key_exists('seed', $params) && $params['seed'] === true)) ?
2708
-		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') :
2709
-		(is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2708
+		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2710 2709
 	$params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false;
2711 2710
 	$themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme';
2712 2711
 	$params['minimize'] = isset($params['minimize']) ? $params['minimize'] : true;
@@ -2820,8 +2819,7 @@  discard block
 block discarded – undo
2820 2819
 	global $settings, $context, $modSettings;
2821 2820
 
2822 2821
 	$params['seed'] = (!array_key_exists('seed', $params) || (array_key_exists('seed', $params) && $params['seed'] === true)) ?
2823
-		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') :
2824
-		(is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2822
+		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2825 2823
 	$params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false;
2826 2824
 	$themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme';
2827 2825
 	$params['async'] = isset($params['async']) ? $params['async'] : false;
Please login to merge, or discard this patch.
Themes/default/Profile.template.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
 		{
1722 1722
 			// Avoid double separators and empty titled sections
1723 1723
 			$empty_section = true;
1724
-			for ($j=$i+1; $j < count($context['theme_options']); $j++)
1724
+			for ($j = $i + 1; $j < count($context['theme_options']); $j++)
1725 1725
 			{
1726 1726
 				// Found another separator, so we're done
1727 1727
 				if (!is_array($context['theme_options'][$j]))
@@ -2700,8 +2700,7 @@  discard block
 block discarded – undo
2700 2700
 		foreach ($context['post_errors'] as $error)
2701 2701
 		{
2702 2702
 			$text_key_error = $error == 'password_short' ?
2703
-				sprintf($txt['profile_error_' . $error], (empty($modSettings['password_strength']) ? 4 : 8)) :
2704
-				$txt['profile_error_' . $error];
2703
+				sprintf($txt['profile_error_' . $error], (empty($modSettings['password_strength']) ? 4 : 8)) : $txt['profile_error_' . $error];
2705 2704
 
2706 2705
 			echo '
2707 2706
 				<li>', isset($txt['profile_error_' . $error]) ? $text_key_error : $error, '</li>';
Please login to merge, or discard this patch.
Themes/default/Packages.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -455,7 +455,7 @@
 block discarded – undo
455 455
 
456 456
 	elseif ($context['uninstalling'])
457 457
 		echo '
458
-			', $txt['package_uninstall_done'] .' <br>
458
+			', $txt['package_uninstall_done'] . ' <br>
459 459
 			', '<a href="', $context['remove_url'], '" class="button">', $txt['package_delete'], '</a>';
460 460
 
461 461
 	elseif ($context['install_finished'])
Please login to merge, or discard this patch.