-$langs = sqspell_getSettings($words);
-if (sizeof($use_langs)){
- /**
- * See if the user clicked any options on the previous page.
- */
- if (sizeof($use_langs)>1){
- /**
- * See if s/he wants more than one dictionary.
- */
- if ($use_langs[0]!=$lang_default){
- /**
- * See if we need to juggle the order of the dictionaries
- * to make the default dictionary first in line.
- */
- if (in_array($lang_default, $use_langs)){
- /**
- * See if the user was dumb and chose a default dictionary
- * to be something other than the ones he selected.
- */
- $hold = array_shift($use_langs);
- $lang_string = join(", ", $use_langs);
- $lang_string = str_replace("$lang_default", "$hold", $lang_string);
- $lang_string = $lang_default . ", " . $lang_string;
- } else {
- /**
- * Yes, he is dumb.
- */
- $lang_string = join(', ', $use_langs);
- }
- } else {
- /**
- * No need to juggle the order -- preferred is already first.
- */
- $lang_string = join(', ', $use_langs);
+
+/**
+ * Rebuild languages. Default language is first one.
+ */
+$new_langs = array($lang_default);
+foreach ($use_langs as $lang) {
+ if (! in_array($lang,$new_langs)) {
+ $new_langs[]=$lang;