diff -r dc6026376919 -r 5bd429428101 plugins/SpecialUserPrefs.php --- a/plugins/SpecialUserPrefs.php Wed Jan 23 12:48:22 2008 -0500 +++ b/plugins/SpecialUserPrefs.php Thu Jan 24 22:06:09 2008 -0500 @@ -547,8 +547,50 @@ if ( !$q ) $db->_die(); + // verify language id + $lang_id = strval(intval($_POST['lang_id'])); + $q = $db->sql_query('SELECT 1 FROM ' . table_prefix . 'language WHERE lang_id = ' . $lang_id . ';'); + if ( !$q ) + $db->_die(); + + if ( $db->numrows() > 0 ) + { + $db->free_result(); + + // unload / reload $lang, this verifies that the selected language works + unset($GLOBALS['lang']); + unset($lang); + $lang_id = intval($lang_id); + $GLOBALS['lang'] = new Language($lang_id); + global $lang; + + $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_lang = ' . $lang_id . " WHERE user_id = {$session->user_id};"); + if ( !$q ) + $db->_die(); + } + else + { + $db->free_result(); + } + echo '