8 * This module saves the added words into the user dictionary. Called
9 * after CHECK_ME module.
11 * @author Konstantin Riabitsev <icon at duke.edu>
12 * @copyright 1999-2018 The SquirrelMail Project Team
13 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
16 * @subpackage squirrelspell
19 global $SQSPELL_VERSION, $SQSPELL_APP_DEFAULT;
21 if (! sqgetGlobalVar('words',$words,SQ_POST)) {
24 if (! sqgetGlobalVar('sqspell_use_app',$sqspell_use_app,SQ_POST)) {
25 $sqspell_use_app = $SQSPELL_APP_DEFAYLT;
29 * Because of the nature of Javascript, there is no way to efficiently
30 * pass an array. Hence, the words will arrive as a string separated by
31 * "%". To get the array, we explode the "%"'s.
32 * Dirty: yes. Is there a better solution? Let me know. ;)
34 $new_words = explode("%",$words);
36 * Load the user dictionary and see if there is anything in it.
38 $old_words=sqspell_getLang($sqspell_use_app);
39 if (empty($old_words)){
40 $word_dic = $new_words;
42 foreach($new_words as $new_word) {
43 $old_words[]=$new_word;
45 // make sure that dictionary contains only unique values
46 $word_dic = array_unique($old_words);
52 sqspell_writeWords($word_dic,$sqspell_use_app);
54 * display the splash screen, then close it automatically after 2 sec.
56 $onload = "setTimeout('self.close()', 2000)";
57 $msg = '<form onsubmit="return false"><div style="text-align: center;">'
58 . '<input type="submit" value=" '
59 . _("Close") . ' " onclick="self.close()" /></div></form>';
60 sqspell_makeWindow($onload, _("Personal Dictionary Updated"), null, $msg);