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