Passed
Pull Request — release-2.1 (#5093)
by 01
05:01
created
Sources/Subs-Members.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
 
469 469
 	// 4-byte Unicode characters are not permitted within user names where db_mb4 is false and character set is non-UTF
470 470
 	if (!$smcFunc['db_mb4'] && max(array_map('ord', str_split($regOptions['username']))) >= 240 && stripos($context['character_set'], 'utf') !== false)
471
-		$regOptions['username'] = preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']);
471
+		$regOptions['username'] = preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']); }, $regOptions['username']);
472 472
 	// if the character set is non-UTF then characters would be replaced by ???'s therefore do not allow it but purposely change them for logging
473 473
 	elseif (max(array_map('ord', str_split($regOptions['username']))) >= 240 && stripos($context['character_set'], 'utf') === false)
474 474
 	{
475 475
 		$reg_errors[] = array('lang', 'name_invalid_character');
476
-		preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']);
476
+		preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']); }, $regOptions['username']);
477 477
 	}
478 478
 
479 479
 	// @todo Separate the sprintf?
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 		'member_name' => $regOptions['username'],
597 597
 		'email_address' => $regOptions['email'],
598 598
 		'passwd' => hash_password($regOptions['username'], $regOptions['password']),
599
-		'password_salt' => substr(md5(mt_rand()), 0, 4) ,
599
+		'password_salt' => substr(md5(mt_rand()), 0, 4),
600 600
 		'posts' => 0,
601 601
 		'date_registered' => time(),
602 602
 		'member_ip' => $regOptions['interface'] == 'admin' ? '127.0.0.1' : $user_info['ip'],
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		'time_offset',
687 687
 	);
688 688
 	$knownInets = array(
689
-		'member_ip','member_ip2',
689
+		'member_ip', 'member_ip2',
690 690
 	);
691 691
 
692 692
 	// Call an optional function to validate the users' input.
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	$checkName = strtr($name, array('_' => '\\_', '%' => '\\%'));
915 915
 
916 916
 	//when we got no wildcard we can use equal -> fast
917
-	$operator = (strpos($checkName, '%') || strpos($checkName, '_') ? 'LIKE' : '=' );
917
+	$operator = (strpos($checkName, '%') || strpos($checkName, '_') ? 'LIKE' : '=');
918 918
 
919 919
 	// Make sure they don't want someone else's name.
920 920
 	$request = $smcFunc['db_query']('', '
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 		$user_info['buddies'][] = $userReceiver;
1284 1284
 
1285 1285
 		// And add a nice alert. Don't abuse though!
1286
-		if ((cache_get_data('Buddy-sent-'. $user_info['id'] .'-'. $userReceiver, 86400)) == null)
1286
+		if ((cache_get_data('Buddy-sent-' . $user_info['id'] . '-' . $userReceiver, 86400)) == null)
1287 1287
 		{
1288 1288
 			$smcFunc['db_insert']('insert',
1289 1289
 				'{db_prefix}background_tasks',
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 			);
1299 1299
 
1300 1300
 			// Store this in a cache entry to avoid creating multiple alerts. Give it a long life cycle.
1301
-			cache_put_data('Buddy-sent-'. $user_info['id'] .'-'. $userReceiver, '1', 86400);
1301
+			cache_put_data('Buddy-sent-' . $user_info['id'] . '-' . $userReceiver, '1', 86400);
1302 1302
 		}
1303 1303
 	}
1304 1304
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -468,12 +468,16 @@
 block discarded – undo
468 468
 
469 469
 	// 4-byte Unicode characters are not permitted within user names where db_mb4 is false and character set is non-UTF
470 470
 	if (!$smcFunc['db_mb4'] && max(array_map('ord', str_split($regOptions['username']))) >= 240 && stripos($context['character_set'], 'utf') !== false)
471
-		$regOptions['username'] = preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']);
471
+		$regOptions['username'] = preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc)
472
+		{
473
+return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']);
472 474
 	// if the character set is non-UTF then characters would be replaced by ???'s therefore do not allow it but purposely change them for logging
473 475
 	elseif (max(array_map('ord', str_split($regOptions['username']))) >= 240 && stripos($context['character_set'], 'utf') === false)
474 476
 	{
475 477
 		$reg_errors[] = array('lang', 'name_invalid_character');
476
-		preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']);
478
+		preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc)
479
+		{
480
+return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']);
477 481
 	}
478 482
 
479 483
 	// @todo Separate the sprintf?
Please login to merge, or discard this patch.