Code Duplication    Length = 7-10 lines in 3 locations

Sources/Load.php 1 location

@@ 180-189 (lines=10) @@
177
			$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);
178
			return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length));
179
		},
180
		'strtolower' => $utf8 ? function($string) use ($sourcedir)
181
		{
182
			if (!function_exists('mb_strtolower'))
183
			{
184
				require_once($sourcedir . '/Subs-Charset.php');
185
				return utf8_strtolower($string);
186
			}
187
188
			return mb_strtolower($string, 'UTF-8');
189
		} : 'strtolower',
190
		'strtoupper' => $utf8 ? function($string)
191
		{
192
			global $sourcedir;

other/install.php 2 locations

@@ 1425-1431 (lines=7) @@
1422
	reloadSettings();
1423
1424
	// We need this to properly hash the password for Admin
1425
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1426
			global $sourcedir;
1427
			if (function_exists('mb_strtolower'))
1428
				return mb_strtolower($string, 'UTF-8');
1429
			require_once($sourcedir . '/Subs-Charset.php');
1430
			return utf8_strtolower($string);
1431
		};
1432
1433
	if (!isset($_POST['username']))
1434
		$_POST['username'] = '';
@@ 1683-1689 (lines=7) @@
1680
1681
	// This function is needed to do the updateStats('subject') call.
1682
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1683
		function($string){
1684
			global $sourcedir;
1685
			if (function_exists('mb_strtolower'))
1686
				return mb_strtolower($string, 'UTF-8');
1687
			require_once($sourcedir . '/Subs-Charset.php');
1688
			return utf8_strtolower($string);
1689
		};
1690
1691
	$request = $smcFunc['db_query']('', '
1692
		SELECT id_msg