7 * Copyright (c) 1999-2002 The SquirrelMail development team
8 * Licensed under the GNU GPL. For full terms see the file COPYING.
10 * This module changes the international dictionaries selection
11 * for the user. Called after LANG_SETUP module.
15 * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
19 global $SQSPELL_APP_DEFAULT;
21 $use_langs = $_POST['use_langs'];
22 $lang_default = $_POST['lang_default'];
24 $words = sqspell_getWords();
26 $words = sqspell_makeDummy();
28 $langs = sqspell_getSettings($words);
29 if (sizeof($use_langs)){
31 * See if the user clicked any options on the previous page.
33 if (sizeof($use_langs)>1){
35 * See if s/he wants more than one dictionary.
37 if ($use_langs[0]!=$lang_default){
39 * See if we need to juggle the order of the dictionaries
40 * to make the default dictionary first in line.
42 if (in_array($lang_default, $use_langs)){
44 * See if the user was dumb and chose a default dictionary
45 * to be something other than the ones he selected.
47 $hold = array_shift($use_langs);
48 $lang_string = join(", ", $use_langs);
49 $lang_string = str_replace("$lang_default", "$hold", $lang_string);
50 $lang_string = $lang_default . ", " . $lang_string;
55 $lang_string = join(', ', $use_langs);
59 * No need to juggle the order -- preferred is already first.
61 $lang_string = join(', ', $use_langs);
65 * Just one dictionary, please.
67 $lang_string = $use_langs[0];
69 $lang_array = explode( ',', $lang_string );
71 foreach( $lang_array as $a) {
72 $dsp_string .= _(trim($a)) . ', ';
74 $dsp_string = substr( $dsp_string, 0, -2 );
76 . sprintf(_("Settings adjusted to: <strong>%s</strong> with <strong>%s</strong> as default dictionary."), $dsp_string, _($lang_default))
80 * No dictionaries selected. Use system default.
83 . sprintf(_("Using <strong>%s</strong> dictionary (system default) for spellcheck." ), $SQSPELL_APP_DEFAULT)
85 $lang_string = $SQSPELL_APP_DEFAULT;
87 $old_lang_string = join(", ", $langs);
88 $words = str_replace("# LANG: $old_lang_string", "# LANG: $lang_string",
91 * Write it down where the sun don't shine.
93 sqspell_writeWords($words);
94 sqspell_makePage(_("International Dictionaries Preferences Updated"),