849bdf42 |
1 | <?php |
2 | /** |
3 | FORGET_ME_NOT.MOD.PHP |
4 | ---------------------- |
5 | This module saves the added words into the user dictionary. Called |
6 | after CHECK_ME module. |
7 | **/ |
8 | // For our friends with E_ALL. |
9 | global $words, $SQSPELL_VERSION, $SQSPELL_APP_DEFFAULT, $sqspell_use_app; |
10 | |
11 | $new_words = ereg_replace("%", "\n", $words); |
12 | |
13 | // Load the user dictionary. |
14 | $words=sqspell_getWords(); |
15 | |
16 | if (!$words){ |
17 | // First time. |
18 | $words_dic="# SquirrelSpell User Dictionary $SQSPELL_VERSION\n# Last Revision: " . date("Y-m-d") . "\n# LANG: $SQSPELL_APP_DEFAULT\n# $SQSPELL_APP_DEFAULT\n"; |
19 | $words_dic .= $new_words . "# End\n"; |
20 | } else { |
21 | // Do some fancy stuff in order to save the dictionary and not mangle the |
22 | // rest. |
23 | $langs=sqspell_getSettings($words); |
24 | $words_dic = "# SquirrelSpell User Dictionary $SQSPELL_VERSION\n# Last Revision: " . date("Y-m-d") . "\n# LANG: " . join(", ", $langs) . "\n"; |
25 | for ($i=0; $i<sizeof($langs); $i++){ |
26 | $lang_words=sqspell_getLang($words, $langs[$i]); |
27 | if ($langs[$i]==$sqspell_use_app){ |
28 | if (!$lang_words) $lang_words="# $langs[$i]\n"; |
29 | $lang_words .= $new_words; |
30 | } |
31 | $words_dic .= $lang_words; |
32 | } |
33 | $words_dic .= "# End\n"; |
34 | } |
35 | |
36 | // Write out the file |
37 | sqspell_writeWords($words_dic); |
38 | // display the splash screen, then close it automatically after 2 sec. |
39 | $onload="setTimeout('self.close()', 2000)"; |
40 | $msg="<form onsubmit=\"return false\"><div align=\"center\"><input type=\"submit\" value=\" Close \" onclick=\"self.close()\"></div></form>"; |
41 | sqspell_makeWindow($onload, "Personal Dictionary Updated", null, $msg); |
42 | ?> |
43 | |