Code Duplication    Length = 7-10 lines in 3 locations

other/install.php 2 locations

@@ 1337-1343 (lines=7) @@
1334
	require_once($sourcedir . '/Subs.php');
1335
1336
	// We need this to properly hash the password for Admin
1337
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1338
			global $sourcedir;
1339
			if (function_exists('mb_strtolower'))
1340
				return mb_strtolower($string, 'UTF-8');
1341
			require_once($sourcedir . '/Subs-Charset.php');
1342
			return utf8_strtolower($string);
1343
		};
1344
1345
	if (!isset($_POST['username']))
1346
		$_POST['username'] = '';
@@ 1593-1599 (lines=7) @@
1590
1591
	// This function is needed to do the updateStats('subject') call.
1592
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1593
		function($string){
1594
			global $sourcedir;
1595
			if (function_exists('mb_strtolower'))
1596
				return mb_strtolower($string, 'UTF-8');
1597
			require_once($sourcedir . '/Subs-Charset.php');
1598
			return utf8_strtolower($string);
1599
		};
1600
1601
	$request = $smcFunc['db_query']('', '
1602
		SELECT id_msg

Sources/Load.php 1 location

@@ 179-188 (lines=10) @@
176
			$ent_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|"|&|<|>| |.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
177
			return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length));
178
		},
179
		'strtolower' => $utf8 ? function($string) use ($sourcedir)
180
		{
181
			if (!function_exists('mb_strtolower'))
182
			{
183
				require_once($sourcedir . '/Subs-Charset.php');
184
				return utf8_strtolower($string);
185
			}
186
187
			return mb_strtolower($string, 'UTF-8');
188
		} : 'strtolower',
189
		'strtoupper' => $utf8 ? function($string)
190
		{
191
			global $sourcedir;