CVE-2012-10013 (Other, published 2023-04-24T18:15Z)
Description: value: A vulnerability was found in Kau-Boy Backend Localization Plugin up to 1.6.1 on WordPress. It has been rated as problematic. This issue affects some unknown processing of the file backend_localization.php. The manipulation leads to cross site scripting. The attack may be initiated remotely. Upgrading to version 2.0 is able to address this issue. The patch is named 43dc96defd7944da12ff116476a6890acd7dd24b. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-227231.
Severity: nan (CVSS v3 base score: 6.1)
Weakness: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Repository: https://github.com/wp-plugins/kau-boys-backend-localization
Files changed:
backend-localization-de_DE.po
backend_localization.php
readme.txt
Commit message: Adding Version 2.0: Adding some new languages. Fixing link to switch languages in backend. Thanks to Justin! Fixing XSS vulnerabilities. Many Thanks to Matt Fuller from MOZILLA!

git-svn-id: https://plugins.svn.wordpress.org/kau-boys-backend-localization/trunk@579507 b8457f37-d9ea-0310-8a92-e5e31aec5664


Vulnerable code:
"POT-Creation-Date: 2011-10-31 13:15+0100\n"
"PO-Revision-Date: 2011-10-31 13:16+0100\n"
#: backend_localization.php:24
#: backend_localization.php:25
#: backend_localization.php:26
#: backend_localization.php:27
#: backend_localization.php:28
#: backend_localization.php:29
#: backend_localization.php:69
#: backend_localization.php:30
#: backend_localization.php:31
#: backend_localization.php:32
#: backend_localization.php:33
#: backend_localization.php:34
#: backend_localization.php:35
#: backend_localization.php:36
#: backend_localization.php:37
#: backend_localization.php:38
#: backend_localization.php:39
#: backend_localization.php:40
#: backend_localization.php:41
#: backend_localization.php:42
#: backend_localization.php:43
#: backend_localization.php:44
#: backend_localization.php:45
#: backend_localization.php:46
#: backend_localization.php:47
#: backend_localization.php:48
#: backend_localization.php:49
#: backend_localization.php:50
#: backend_localization.php:51
#: backend_localization.php:52
msgid "Galician "
#: backend_localization.php:53
#: backend_localization.php:54
#: backend_localization.php:55
#: backend_localization.php:56
#: backend_localization.php:57
#: backend_localization.php:58
#: backend_localization.php:59
#: backend_localization.php:60
#: backend_localization.php:61
#: backend_localization.php:62
#: backend_localization.php:63
#: backend_localization.php:64
#: backend_localization.php:65
#: backend_localization.php:66
#: backend_localization.php:67
#: backend_localization.php:68
#: backend_localization.php:70
#: backend_localization.php:71
#: backend_localization.php:72
#: backend_localization.php:74
#: backend_localization.php:75
#: backend_localization.php:76
#: backend_localization.php:77
#: backend_localization.php:78
#: backend_localization.php:79
#: backend_localization.php:80
#: backend_localization.php:81
#: backend_localization.php:82
#: backend_localization.php:83
#: backend_localization.php:84
#: backend_localization.php:85
#: backend_localization.php:86
#: backend_localization.php:87
#: backend_localization.php:88
#: backend_localization.php:89
#: backend_localization.php:90
#: backend_localization.php:91
#: backend_localization.php:92
#: backend_localization.php:93
#: backend_localization.php:94
#: backend_localization.php:95
#: backend_localization.php:96
#: backend_localization.php:97
#: backend_localization.php:98
#: backend_localization.php:99
#: backend_localization.php:100
#: backend_localization.php:101
#: backend_localization.php:102
#: backend_localization.php:103
#: backend_localization.php:104
#: backend_localization.php:105
#: backend_localization.php:106
#: backend_localization.php:107
#: backend_localization.php:108
#: backend_localization.php:109
#: backend_localization.php:110
#: backend_localization.php:111
#: backend_localization.php:112
#: backend_localization.php:113
#: backend_localization.php:114
#: backend_localization.php:115
#: backend_localization.php:116
#: backend_localization.php:123
#: backend_localization.php:139
#: backend_localization.php:163
#: backend_localization.php:166
#: backend_localization.php:171
#: backend_localization.php:174
#: backend_localization.php:185
#: backend_localization.php:189
#: backend_localization.php:244
Plugin URI: http://kau-boys.de/230/wordpress/kau-boys-backend-localization-plugin
Version: 1.6.1
Author URI: http://kau-boys.de

define('BACKEND_LOCALIZATION_URL', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)));
	load_plugin_textdomain('backend-localization', false, dirname(plugin_basename(__FILE__)));
		'af' => __('Afrikaans', 'backend-localization'),
			'ar' => __('Arabic', 'backend-localization'),
			'az' => __('Azerbaijani', 'backend-localization'),
			'bg_BG' => __('Bulgarian', 'backend-localization'),
			'bn_BD' => __('Bengali', 'backend-localization'),
			'bs_BA' => __('Bosnian', 'backend-localization'),
			'ca' => __('Catalan', 'backend-localization'),
			'ckb' => __('Kurdish', 'backend-localization'),
			'cpp' => __('Cape Verdean Creole', 'backend-localization'),
			'cs_CZ' => __('Czech', 'backend-localization'),
			'cy' => __('Cymraeg (Welsh)', 'backend-localization'),
			'da_DK' => __('Danish', 'backend-localization'),
			'de_DE' => __('German', 'backend-localization'),
			'el' => __('Greek', 'backend-localization'),
			'en_US' => __('English', 'backend-localization'),
			'eo' => __('Esperanto', 'backend-localization'),
			'es_CL' => __('Spanish (Chile)', 'backend-localization'),
			'es_ES' => __('Spanish', 'backend-localization'),
			'es_PE' => __('Spanish (Peru)', 'backend-localization'),
			'es_VE' => __('Spanish (Venezuela)', 'backend-localization'),
			'et' => __('Estonian', 'backend-localization'),
			'eu' => __('Basque', 'backend-localization'),
			'fa_AF' => __('Persian (Afghanistan)', 'backend-localization'),
			'fa_IR' => __('Persian', 'backend-localization'),
			'fi' => __('Finnish', 'backend-localization'),
			'fo' => __('Faroese', 'backend-localization'),
			'fr_BE' => __('French (Belgium)', 'backend-localization'),
			'fr_FR' => __('French', 'backend-localization'),
			'fy' => __('Western Frisian', 'backend-localization'),
			'gd' => __('Scottish Gaelic', 'backend-localization'),
			'gl_ES' => __('Galician ', 'backend-localization'),
			'haw_US' => __('Hawaiian', 'backend-localization'),
			'he_IL' => __('Hebrew', 'backend-localization'),
			'hi_IN' => __('Hindi', 'backend-localization'),
			'hr' => __('Croatian', 'backend-localization'),
			'hu_HU' => __('Hungarian', 'backend-localization'),
			'hy' => __('Armenian', 'backend-localization'),
			'id_ID' => __('Indonesian', 'backend-localization'),
			'is_IS' => __('Icelandic', 'backend-localization'),
			'it_IT' => __('Italian', 'backend-localization'),
			'ja' => __('Japanese', 'backend-localization'),
			'jv_ID' => __('Javanese', 'backend-localization'),
			'ka_GE' => __('Georgian', 'backend-localization'),
			'kea' => __('Kabuverdianu', 'backend-localization'),
			'kk' => __('Kazakh', 'backend-localization'),
			'kn' => __('Kannada', 'backend-localization'),
			'ko_KR' => __('Korean', 'backend-localization'),
			'ku' => __('Kurdish', 'backend-localization'),
			'ky_KY' => __('Kyrgyz', 'backend-localization'),
			'li' => __('Limburgish', 'backend-localization'),
			'lv' => __('Latvian', 'backend-localization'),
			// 'me_ME' => __('', 'backend-localization'),
			'mg_MG' => __('Malagasy', 'backend-localization'),
			'mk_MK' => __('Macedonian', 'backend-localization'),
			'ml_IN' => __('Malayalam', 'backend-localization'),
			'mn' => __('Mongolian', 'backend-localization'),
			'ms_MY' => __('Malay', 'backend-localization'),
			'my_MM' => __('Burmese (Myanmar)', 'backend-localization'),
			'nb_NO' => __('Norwegian (Bokm&aring;l)', 'backend-localization'),
			'ne_NP' => __('Nepali', 'backend-localization'),
			'nl' => __('Dutch', 'backend-localization'),
			'nl_BE' => __('Dutch (Belgium)', 'backend-localization'),
			'nl_NL' => __('Dutch (Netherlands)', 'backend-localization'),
			'nn_NO' => __('Norwegian (Nynorsk)', 'backend-localization'),
			'pa_IN' => __('Punjabi', 'backend-localization'),
			'pl_PL' => __('Polish', 'backend-localization'),
			'pt_BR' => __('Portuguese (Brazil)', 'backend-localization'),
			'pt_PT' => __('Portuguese', 'backend-localization'),
			'ro_RO' => __('Romanian', 'backend-localization'),
			'ru_RU' => __('Russian', 'backend-localization'),
			'ru_UA' => __('Russian (Ukraine)', 'backend-localization'),
			'sa_IN' => __('Sanskrit', 'backend-localization'),
			'sd_PK' => __('Sindhi', 'backend-localization'),
			'si_LK' => __('Sinhalese', 'backend-localization'),
			'sk_SK' => __('Slovak', 'backend-localization'),
			'sl_SI' => __('Slovenian', 'backend-localization'),
			'so_SO' => __('Somali', 'backend-localization'),
			'sq' => __('Albanian', 'backend-localization'),
			'sr_RS' => __('Serbian', 'backend-localization'),
			'srd' => __('Sardinian', 'backend-localization'),
			'su_ID' => __('Sundanese', 'backend-localization'),
			'sv_SE' => __('Swedish', 'backend-localization'),
			'sw' => __('Swahili', 'backend-localization'),
			'ta_IN' => __('Tamil', 'backend-localization'),
			'ta_LK' => __('Tamil (Sri Lanka)', 'backend-localization'),
			'th' => __('Thai', 'backend-localization'),
			'tr_TR' => __('Turkish', 'backend-localization'),
			'ug_CN' => __('Uighur', 'backend-localization'),
			'uk' => __('Ukrainian', 'backend-localization'),
			'ur' => __('Urdu', 'backend-localization'),
			'uz_UZ' => __('Uzbek', 'backend-localization'),
			'vi' => __('Vietnamese', 'backend-localization'),
			'zh_CN' => __('Chinese', 'backend-localization'),
			'zh_HK' => __('Chinese (Hong Kong)', 'backend-localization'),
			'zh_TW' => __('Chinese (Taiwan)', 'backend-localization')
	add_options_page("Kau-Boy's Backend Localization settings", __('Backend Language', 'backend-localization'), 8, __FILE__, 'backend_localization_admin_settings');
	foreach($backend_locale_array as $locale_value){
		$link = 'http://'.add_query_arg('kau-boys_backend_localization_language', $locale_value);
		add_menu_page($wp_locale_all[$locale_value], $wp_locale_all[$locale_value], 'read', $link, NULL, BACKEND_LOCALIZATION_URL.'flag_icons/'.strtolower(substr($locale_value, (strpos($locale_value, '_') * -1))).'.png');
function backend_localization_filter_plugin_actions($links, $file){
	if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);
	if ($file == $this_plugin){
		$settings_link = '<a href="options-general.php?page=kau-boys-backend-localization/backend_localization.php">'.__('Settings').'</a>';
		array_unshift($links, $settings_link);
	if(isset($_POST['save'])){
		update_option('kau-boys_backend_localization_loginselect', $_POST['kau-boys_backend_localization_loginselect']);
	$loginselect = get_option('kau-boys_backend_localization_loginselect');
	if(empty($backend_locale)) $backend_locale = 'en_US';
	<?php if($settings_saved) : ?>
	<div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>
		<?php _e('Here you can customize the plugin for your needs.', 'backend-localization') ?>
			<input type="checkbox" name="kau-boys_backend_localization_loginselect" id="kau-boys_backend_localization_loginselect"<?php echo ($loginselect == 'on')? ' checked="checked"' : '' ?>/>
			<label for="kau-boys_backend_localization_loginselect"><?php _e('Hide language selection on login form', 'backend-localization') ?></label>
			<input type="radio" value="<?php echo $locale_value ?>" id="kau-boys_backend_localization_language_<?php echo $locale_value ?>" name="kau-boys_backend_localization_language"<?php echo ($backend_locale == $locale_value)? ' checked="checked"' : '' ?> />
				<img src="<?php echo BACKEND_LOCALIZATION_URL.'flag_icons/'.strtolower(substr($locale_value, (strpos($locale_value, '_') * -1))).'.png' ?>" alt="<?php echo $locale_value ?>" />
				<?php echo $wp_locale_all[$locale_value].' ('.$locale_value.')' ?>
				<?php echo sprintf(__('If your language isn\'t listed, you have to download the right version from the WordPress repository: <a href="http://svn.automattic.com/wordpress-i18n">http://svn.automattic.com/wordpress-i18n</a>. Browser to the language folder of your choice and get the <b>all</b> .mo files for your WordPress Version from <i><b>tags/%1s/messages/</b></i> or from the <i><b>trunk/messages/</b></i> folder. Upload them to the langauge folder <i>%2s</i>. You should than be able to choose the new language (or after a refresh of this page).', 'backend-localization'), $wp_version, WP_LANG_DIR) ?>
			<input class="button-primary" name="save" type="submit" value="<?php _e('Save Changes') ?>" />
	if(is_dir(WP_LANG_DIR)){
		$dh = opendir($dir);
		while (false !== ($filename = readdir($dh))) {
		foreach($files as $file){
			$fileParts = pathinfo($file);
			if($fileParts['extension'] == 'mo' && (strlen($fileParts['filename']) <= 5)){
				$fileParts['filename'] = substr($fileParts['basename'], 0,strpos($fileParts['basename'],'.'));
	if(!in_array('en_US', $backend_locale_array)){
	if(isset($_REQUEST['kau-boys_backend_localization_language'])){
		setcookie('kau-boys_backend_localization_language', $_REQUEST['kau-boys_backend_localization_language'], time()+60*60*24*30, '/');
	if(get_option('kau-boys_backend_localization_loginselect')) return;
		<?php _e('Language', 'backend-localization') ?><br />
		<?php foreach($backend_locale_array as $locale_value) : ?>
			<option value="<?php echo $locale_value ?>"<?php echo ($backend_locale == $locale_value)? ' selected="selected"' : '' ?>>
				<?php echo $wp_locale_all[$locale_value].' ('.$locale_value.')' ?>
	return 	isset($_REQUEST['kau-boys_backend_localization_language'])
			? $_REQUEST['kau-boys_backend_localization_language']
			: (	isset($_COOKIE['kau-boys_backend_localization_language'])
				: get_option('kau-boys_backend_localization_language'));
	if(defined('WP_ADMIN') || (isset($_REQUEST['pwd']) && isset($_REQUEST['kau-boys_backend_localization_language']))) {
	setcookie('kau-boys_backend_localization_language', "", time() - 3600, '/');
	setcookie('kau-boys_backend_localization_language', $_REQUEST['kau-boys_backend_localization_language'], time()+60*60*24*30, '/');
add_action('init', 'init_backend_localization');
add_action('admin_menu', 'backend_localization_admin_menu');
add_action('admin_menu', 'backend_localization_save_setting');
add_action('wp_login', 'backend_localization_set_login_language');
add_action('login_form_locale', 'localize_backend');
add_action('login_head', 'localize_backend');
add_action('login_form', 'backend_localization_login_form');
add_filter('plugin_action_links', 'backend_localization_filter_plugin_actions', 10, 2);
add_filter('locale', 'localize_backend');
Requires at least: 2.7
Stable tag: 1.6
A list of all of my plugins can be found on the [WordPress Plugin page](http://kau-boys.de/wordpress-plugins?lang=en "WordPress Plugins") on my blog [kau-boys.de](http://kau-boys.de). 

Fixed code:
"POT-Creation-Date: 2012-07-31 00:54+0100\n"
"PO-Revision-Date: 2012-07-31 00:57+0100\n"
msgid "Aragonese"
msgstr "Aragonesisch"

#: backend_localization.php:24
#: backend_localization.php:25
#: backend_localization.php:26
msgid "Azerbaijani (Turkey)"
msgstr "Azerbaijani (Türkei)"

#: backend_localization.php:27
#: backend_localization.php:28
#: backend_localization.php:29
#: backend_localization.php:30
#: backend_localization.php:31
#: backend_localization.php:77
#: backend_localization.php:32
msgid "Corsican"
msgstr "Korsisch"

#: backend_localization.php:33
#: backend_localization.php:34
#: backend_localization.php:35
#: backend_localization.php:36
#: backend_localization.php:37
#: backend_localization.php:38
msgid "Divehi/Maldivian"
msgstr "Dhivehi"

#: backend_localization.php:39
#: backend_localization.php:40
#: backend_localization.php:41
msgid "English (Canada)"
msgstr "Englisch (Kanada)"

#: backend_localization.php:42
msgid "English (United Kingdom)"
msgstr "Englisch (Vereinigtes Königreich)"

#: backend_localization.php:43
#: backend_localization.php:44
#: backend_localization.php:45
#: backend_localization.php:46
#: backend_localization.php:47
#: backend_localization.php:48
#: backend_localization.php:49
#: backend_localization.php:50
#: backend_localization.php:51
#: backend_localization.php:52
#: backend_localization.php:53
#: backend_localization.php:54
#: backend_localization.php:55
#: backend_localization.php:56
#: backend_localization.php:57
msgid "Gaeilge/Irish"
msgstr "Gaeilge/Irisch"

#: backend_localization.php:58
#: backend_localization.php:59
msgid "Galician"
#: backend_localization.php:60
msgid "Gujarati"
msgstr "Gujarati"

#: backend_localization.php:61
#: backend_localization.php:62
#: backend_localization.php:63
#: backend_localization.php:64
#: backend_localization.php:65
#: backend_localization.php:66
#: backend_localization.php:67
#: backend_localization.php:68
#: backend_localization.php:69
#: backend_localization.php:70
#: backend_localization.php:71
#: backend_localization.php:72
#: backend_localization.php:73
#: backend_localization.php:74
#: backend_localization.php:75
#: backend_localization.php:76
#: backend_localization.php:78
#: backend_localization.php:79
#: backend_localization.php:80
msgid "Lao"
msgstr "Laotisch"

#: backend_localization.php:81
#: backend_localization.php:83
#: backend_localization.php:84
#: backend_localization.php:85
#: backend_localization.php:86
#: backend_localization.php:87
#: backend_localization.php:88
#: backend_localization.php:89
#: backend_localization.php:90
#: backend_localization.php:91
#: backend_localization.php:92
#: backend_localization.php:93
#: backend_localization.php:94
#: backend_localization.php:95
msgid "Ossetic/Ossetian"
msgstr "Ossetisch"

#: backend_localization.php:96
#: backend_localization.php:97
#: backend_localization.php:98
#: backend_localization.php:99
#: backend_localization.php:100
#: backend_localization.php:101
#: backend_localization.php:102
#: backend_localization.php:103
#: backend_localization.php:104
#: backend_localization.php:105
#: backend_localization.php:106
#: backend_localization.php:107
#: backend_localization.php:108
#: backend_localization.php:109
#: backend_localization.php:110
#: backend_localization.php:111
#: backend_localization.php:112
#: backend_localization.php:113
#: backend_localization.php:114
#: backend_localization.php:115
#: backend_localization.php:116
#: backend_localization.php:117
msgid "Telugu"
msgstr "Telugu"

#: backend_localization.php:118
#: backend_localization.php:119
#: backend_localization.php:120
#: backend_localization.php:121
#: backend_localization.php:122
#: backend_localization.php:123
#: backend_localization.php:124
#: backend_localization.php:125
#: backend_localization.php:126
#: backend_localization.php:127
#: backend_localization.php:134
#: backend_localization.php:162
#: backend_localization.php:180
msgid "Switching Language"
msgstr "Sprache wechseln"

#: backend_localization.php:181
#, php-format
msgid "Switching language to %1$s... If the Dashboard isn't loading, use this <a href=\"%2$s\" title=\"Dashboard\">link</a>."
msgstr "Wechsele Sprache zu %1$s... Wenn der Dashboard nicht laden sollte, klicke<a href=\"%2$s\" title=\"Dashboard\">hier</a>."

#: backend_localization.php:194
#: backend_localization.php:197
#: backend_localization.php:202
#: backend_localization.php:205
#: backend_localization.php:216
#: backend_localization.php:220
#: backend_localization.php:275
Plugin URI: http://kau-boys.com/230/wordpress/kau-boys-backend-localization-plugin
Version: 2.0
Requires at least: 3.2
Author URI: http://kau-boys.com
define( 'BACKEND_LOCALIZATION_URL', WP_PLUGIN_URL . '/' . str_replace( basename(  __FILE__ ), "", plugin_basename( __FILE__ ) ) );
	load_plugin_textdomain( 'backend-localization', false, dirname( plugin_basename( __FILE__ ) ) );
		'af' => __( 'Afrikaans', 'backend-localization' ),
		'an' => __( 'Aragonese', 'backend-localization' ),
		'ar' => __( 'Arabic', 'backend-localization' ),
		'az' => __( 'Azerbaijani', 'backend-localization' ),
		'az_TR' => __( 'Azerbaijani (Turkey)', 'backend-localization' ),
		'bg_BG' => __( 'Bulgarian', 'backend-localization' ),
		'bn_BD' => __( 'Bengali', 'backend-localization' ),
		'bs_BA' => __( 'Bosnian', 'backend-localization' ),
		'ca' => __( 'Catalan', 'backend-localization' ),
		'ckb' => __( 'Kurdish', 'backend-localization' ),
		'co' => __( 'Corsican', 'backend-localization' ),
		'cpp' => __( 'Cape Verdean Creole', 'backend-localization' ),
		'cs_CZ' => __( 'Czech', 'backend-localization' ),
		'cy' => __( 'Cymraeg (Welsh)', 'backend-localization' ),
		'da_DK' => __( 'Danish', 'backend-localization' ),
		'de_DE' => __( 'German', 'backend-localization' ),
		'dv' => __( 'Divehi/Maldivian', 'backend-localization' ),
		'el' => __( 'Greek', 'backend-localization' ),
		'en_US' => __( 'English', 'backend-localization' ),
		'en_CA' => __( 'English (Canada)', 'backend-localization' ),
		'en_GB' => __( 'English (United Kingdom)', 'backend-localization' ),
		'eo' => __( 'Esperanto', 'backend-localization' ),
		'es_CL' => __( 'Spanish (Chile)', 'backend-localization' ),
		'es_ES' => __( 'Spanish', 'backend-localization' ),
		'es_PE' => __( 'Spanish (Peru)', 'backend-localization' ),
		'es_VE' => __( 'Spanish (Venezuela)', 'backend-localization' ),
		'et' => __( 'Estonian', 'backend-localization' ),
		'eu' => __( 'Basque', 'backend-localization' ),
		'fa_AF' => __( 'Persian (Afghanistan)', 'backend-localization' ),
		'fa_IR' => __( 'Persian', 'backend-localization' ),
		'fi' => __( 'Finnish', 'backend-localization' ),
		'fo' => __( 'Faroese', 'backend-localization' ),
		'fr_BE' => __( 'French (Belgium)', 'backend-localization' ),
		'fr_FR' => __( 'French', 'backend-localization' ),
		'fy' => __( 'Western Frisian', 'backend-localization' ),
		'ga' => __( 'Gaeilge/Irish', 'backend-localization' ),
		'gd' => __( 'Scottish Gaelic', 'backend-localization' ),
		'gl_ES' => __( 'Galician', 'backend-localization' ),
		'gu' => __( 'Gujarati', 'backend-localization' ),
		'haw_US' => __( 'Hawaiian', 'backend-localization' ),
		'he_IL' => __( 'Hebrew', 'backend-localization' ),
		'hi_IN' => __( 'Hindi', 'backend-localization' ),
		'hr' => __( 'Croatian', 'backend-localization' ),
		'hu_HU' => __( 'Hungarian', 'backend-localization' ),
		'hy' => __( 'Armenian', 'backend-localization' ),
		'id_ID' => __( 'Indonesian', 'backend-localization' ),
		'is_IS' => __( 'Icelandic', 'backend-localization' ),
		'it_IT' => __( 'Italian', 'backend-localization' ),
		'ja' => __( 'Japanese', 'backend-localization' ),
		'jv_ID' => __( 'Javanese', 'backend-localization' ),
		'ka_GE' => __( 'Georgian', 'backend-localization' ),
		'kea' => __( 'Kabuverdianu', 'backend-localization' ),
		'kk' => __( 'Kazakh', 'backend-localization' ),
		'kn' => __( 'Kannada', 'backend-localization' ),
		'ko_KR' => __( 'Korean', 'backend-localization' ),
		'ku' => __( 'Kurdish', 'backend-localization' ),
		'ky_KY' => __( 'Kyrgyz', 'backend-localization' ),
		'li' => __( 'Limburgish', 'backend-localization' ),
		'lo' => __( 'Lao', 'backend-localization' ),
		'lv' => __( 'Latvian', 'backend-localization' ),
		// 'me_ME' => __( '', 'backend-localization' ),
		'mg_MG' => __( 'Malagasy', 'backend-localization' ),
		'mk_MK' => __( 'Macedonian', 'backend-localization' ),
		'ml_IN' => __( 'Malayalam', 'backend-localization' ),
		'mn' => __( 'Mongolian', 'backend-localization' ),
		'ms_MY' => __( 'Malay', 'backend-localization' ),
		'my_MM' => __( 'Burmese (Myanmar)', 'backend-localization' ),
		'nb_NO' => __( 'Norwegian (Bokm&aring;l)', 'backend-localization' ),
		'ne_NP' => __( 'Nepali', 'backend-localization' ),
		'nl' => __( 'Dutch', 'backend-localization' ),
		'nl_BE' => __( 'Dutch (Belgium)', 'backend-localization' ),
		'nl_NL' => __( 'Dutch (Netherlands)', 'backend-localization' ),
		'nn_NO' => __( 'Norwegian (Nynorsk)', 'backend-localization' ),
		'os' => __( 'Ossetic/Ossetian', 'backend-localization' ),
		'pa_IN' => __( 'Punjabi', 'backend-localization' ),
		'pl_PL' => __( 'Polish', 'backend-localization' ),
		'pt_BR' => __( 'Portuguese (Brazil)', 'backend-localization' ),
		'pt_PT' => __( 'Portuguese', 'backend-localization' ),
		'ro_RO' => __( 'Romanian', 'backend-localization' ),
		'ru_RU' => __( 'Russian', 'backend-localization' ),
		'ru_UA' => __( 'Russian (Ukraine)', 'backend-localization' ),
		'sa_IN' => __( 'Sanskrit', 'backend-localization' ),
		'sd_PK' => __( 'Sindhi', 'backend-localization' ),
		'si_LK' => __( 'Sinhalese', 'backend-localization' ),
		'sk_SK' => __( 'Slovak', 'backend-localization' ),
		'sl_SI' => __( 'Slovenian', 'backend-localization' ),
		'so_SO' => __( 'Somali', 'backend-localization' ),
		'sq' => __( 'Albanian', 'backend-localization' ),
		'sr_RS' => __( 'Serbian', 'backend-localization' ),
		'srd' => __( 'Sardinian', 'backend-localization' ),
		'su_ID' => __( 'Sundanese', 'backend-localization' ),
		'sv_SE' => __( 'Swedish', 'backend-localization' ),
		'sw' => __( 'Swahili', 'backend-localization' ),
		'ta_IN' => __( 'Tamil', 'backend-localization' ),
		'ta_LK' => __( 'Tamil (Sri Lanka)', 'backend-localization' ),
		'te' => __( 'Telugu', 'backend-localization' ),
		'th' => __( 'Thai', 'backend-localization' ),
		'tr_TR' => __( 'Turkish', 'backend-localization' ),
		'ug_CN' => __( 'Uighur', 'backend-localization' ),
		'uk' => __( 'Ukrainian', 'backend-localization' ),
		'ur' => __( 'Urdu', 'backend-localization' ),
		'uz_UZ' => __( 'Uzbek', 'backend-localization' ),
		'vi' => __( 'Vietnamese', 'backend-localization' ),
		'zh_CN' => __( 'Chinese', 'backend-localization' ),
		'zh_HK' => __( 'Chinese (Hong Kong)', 'backend-localization' ),
		'zh_TW' => __( 'Chinese (Taiwan)', 'backend-localization' )
	add_options_page( "Kau-Boy's Backend Localization settings", __( 'Backend Language', 'backend-localization' ), 'manage_options', 'backend_localization', 'backend_localization_admin_settings' );
	foreach( $backend_locale_array as $locale_value ){
		$link = add_query_arg('kau-boys_backend_localization_language', $locale_value);
		$link = ( strpos( $link, "wp-admin/" ) === false ) ? preg_replace( '#[^?&]*/#i', '', $link ) : preg_replace( '#[^?&]*wp-admin/#i', '', $link );
		if( strpos($link, "?" ) === 0|| strpos( $link, "index.php?" ) ===0 ){
			if( current_user_can( 'manage_options' ) ){
				$link = 'options-general.php?page=backend_localization&godashboard=1&kau-boys_backend_localization_language=' . $locale_value; 
			} else {
				$link = 'edit.php?lang='.$language;
			}
		}
		add_menu_page( __( $wp_locale_all[$locale_value], 'qtranslate' ), $wp_locale_all[$locale_value], 'read', $link, NULL, BACKEND_LOCALIZATION_URL . 'flag_icons/' . strtolower( substr( $locale_value, ( strpos($locale_value, '_' ) * -1 ) ) ) . '.png' );
		/*
		$link = admin_url( add_query_arg( 'kau-boys_backend_localization_language', $locale_value, $link ) );
		add_menu_page( $wp_locale_all[$locale_value], $wp_locale_all[$locale_value], 'read', $link, NULL, BACKEND_LOCALIZATION_URL . 'flag_icons/' . strtolower( substr( $locale_value, ( strpos($locale_value, '_' ) * -1 ) ) ) . '.png' );
		*/
function backend_localization_filter_plugin_actions( $links, $file ){
	if ( !$this_plugin ) $this_plugin = plugin_basename( __FILE__ );
	if ( $file == $this_plugin ){
		$settings_link = '<a href="options-general.php?page=backend_localization">' . __( 'Settings' ) . '</a>';
		array_unshift( $links, $settings_link );
	if( isset($_POST['save'] ) ) {
		update_option( 'kau-boys_backend_localization_loginselect', $_POST['kau-boys_backend_localization_loginselect'] );
	$loginselect = get_option( 'kau-boys_backend_localization_loginselect' );
	// do redirection for dashboard from the qTranslate Plugin (www.qianqin.de/qtranslate)
	if(isset($_GET['godashboard'])) {
		echo '<h2>' . __( 'Switching Language', 'backend-localization' ) . '</h2>'
			. sprintf( __( 'Switching language to %1$s... If the Dashboard isn\'t loading, use this <a href="%2$s" title="Dashboard">link</a>.', 'backend-localization' ), $wp_locale_all[$locale_value], admin_url() )
			. '<script type="text/javascript">document.location="' . admin_url() . '";</script>';
		exit();
	}
	
	if( empty( $backend_locale ) ) $backend_locale = 'en_US';
	<?php if( $settings_saved ) : ?>
	<div id="message" class="updated fade"><p><strong><?php _e( 'Options saved.' ) ?></strong></p></div>
		<?php _e( 'Here you can customize the plugin for your needs.', 'backend-localization' ) ?>
			<input type="checkbox" name="kau-boys_backend_localization_loginselect" id="kau-boys_backend_localization_loginselect"<?php echo ( $loginselect == 'on' )? ' checked="checked"' : '' ?>/>
			<label for="kau-boys_backend_localization_loginselect"><?php _e( 'Hide language selection on login form', 'backend-localization' ) ?></label>
			<input type="radio" value="<?php echo $locale_value ?>" id="kau-boys_backend_localization_language_<?php echo $locale_value ?>" name="kau-boys_backend_localization_language"<?php echo ( $backend_locale == $locale_value )? ' checked="checked"' : '' ?> />
				<img src="<?php echo BACKEND_LOCALIZATION_URL . 'flag_icons/' . strtolower( substr( $locale_value, ( strpos( $locale_value, '_' ) * -1 ) ) ) . '.png' ?>" alt="<?php echo $locale_value ?>" />
				<?php echo $wp_locale_all[$locale_value] . ' (' . $locale_value . ')' ?>
				<?php echo sprintf( __( 'If your language isn\'t listed, you have to download the right version from the WordPress repository: <a href="http://svn.automattic.com/wordpress-i18n">http://svn.automattic.com/wordpress-i18n</a>. Browser to the language folder of your choice and get the <b>all</b> .mo files for your WordPress Version from <i><b>tags/%1s/messages/</b></i> or from the <i><b>trunk/messages/</b></i> folder. Upload them to the langauge folder <i>%2s</i>. You should than be able to choose the new language (or after a refresh of this page).', 'backend-localization' ), $wp_version, WP_LANG_DIR ) ?>
			<input class="button-primary" name="save" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
	if( is_dir( WP_LANG_DIR ) ){
		$dh = opendir( $dir );
		while ( false !== ( $filename = readdir( $dh ) ) ){
		foreach( $files as $file ){
			$fileParts = pathinfo( $file );
			if($fileParts['extension'] == 'mo' && ( strlen($fileParts['filename'] ) <= 5 ) ){
				$fileParts['filename'] = substr( $fileParts['basename'], 0, strpos($fileParts['basename'], '.') );
	if( !in_array( 'en_US', $backend_locale_array ) ){
	if( isset( $_REQUEST['kau-boys_backend_localization_language'] ) ){
		setcookie( 'kau-boys_backend_localization_language', backend_localization_filter_var( $_REQUEST['kau-boys_backend_localization_language'] ), time()+60*60*24*30, '/' );
	if( get_option( 'kau-boys_backend_localization_loginselect' ) ) return;
		<?php _e( 'Language', 'backend-localization' ) ?><br />
		<?php foreach( $backend_locale_array as $locale_value ) : ?>
			<option value="<?php echo $locale_value ?>"<?php echo ($backend_locale == $locale_value )? ' selected="selected"' : '' ?>>
				<?php echo $wp_locale_all[$locale_value] . ' (' . $locale_value . ')' ?>
	return 	isset( $_REQUEST['kau-boys_backend_localization_language'] )
			? backend_localization_filter_var( $_REQUEST['kau-boys_backend_localization_language'] )
			: (	isset( $_COOKIE['kau-boys_backend_localization_language'] )
				: get_option( 'kau-boys_backend_localization_language' ) );
	if( defined( 'WP_ADMIN' ) || ( isset( $_REQUEST['pwd'] ) && isset( $_REQUEST['kau-boys_backend_localization_language'] ) ) ){
	setcookie( 'kau-boys_backend_localization_language', "", time() - 3600, '/' );
	setcookie( 'kau-boys_backend_localization_language', backend_localization_filter_var( $_REQUEST['kau-boys_backend_localization_language'] ), time()+60*60*24*30, '/' );
}

function backend_localization_filter_var($lang){
	return preg_replace('/\W/', '', $lang);
add_action( 'init', 'init_backend_localization' );
add_action( 'admin_menu', 'backend_localization_admin_menu' );
add_action( 'admin_menu', 'backend_localization_save_setting' );
add_action( 'wp_login', 'backend_localization_set_login_language' );
add_action( 'login_form_locale', 'localize_backend' );
add_action( 'login_head', 'localize_backend' );
add_action( 'login_form', 'backend_localization_login_form' );
add_filter( 'plugin_action_links', 'backend_localization_filter_plugin_actions', 10, 2 );
add_filter( 'locale', 'localize_backend' );
Requires at least: 3.2
Stable tag: 2.0
A list of all of my plugins can be found on the [WordPress Plugin page](http://kau-boys.com/wordpress-plugins "WordPress Plugins") on my blog [kau-boys.com](http://kau-boys.com). 
* **2.0** Adding some new languages. Fixing link to switch languages in backend. Thanks to Justin! Fixing XSS vulnerabilities. Many Thanks to Matt Fuller from MOZILLA!