Code Duplication    Length = 7-10 lines in 3 locations

other/install.php 2 locations

@@ 1337-1343 (lines=7) @@
1334
1335
	// We need this to properly hash the password for Admin
1336
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1337
		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'] = '';
@@ 1602-1608 (lines=7) @@
1599
1600
	// This function is needed to do the updateStats('subject') call.
1601
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1602
		function($string){
1603
			global $sourcedir;
1604
			if (function_exists('mb_strtolower'))
1605
				return mb_strtolower($string, 'UTF-8');
1606
			require_once($sourcedir . '/Subs-Charset.php');
1607
			return utf8_strtolower($string);
1608
		};
1609
1610
	$request = $smcFunc['db_query']('', '
1611
		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;