91e0dccc |
1 | <?php |
4b4abf93 |
2 | |
d112ed5a |
3 | /** |
91e0dccc |
4 | * forget_me_not.mod |
d112ed5a |
5 | * |
4b4abf93 |
6 | * Squirrelspell module |
d112ed5a |
7 | * |
8 | * This module saves the added words into the user dictionary. Called |
91e0dccc |
9 | * after CHECK_ME module. |
d112ed5a |
10 | * |
4b4abf93 |
11 | * @author Konstantin Riabitsev <icon at duke.edu> |
47ccfad4 |
12 | * @copyright © 1999-2006 The SquirrelMail Project Team |
4b4abf93 |
13 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
44d661aa |
14 | * @version $Id$ |
15 | * @package plugins |
16 | * @subpackage squirrelspell |
d112ed5a |
17 | */ |
849bdf42 |
18 | |
847d7c93 |
19 | global $SQSPELL_VERSION, $SQSPELL_APP_DEFAULT; |
d8aa9efe |
20 | |
7996c920 |
21 | if (! sqgetGlobalVar('words',$words,SQ_POST)) { |
22 | $words=''; |
23 | } |
24 | if (! sqgetGlobalVar('sqspell_use_app',$sqspell_use_app,SQ_POST)) { |
25 | $sqspell_use_app = $SQSPELL_APP_DEFAYLT; |
26 | } |
d8aa9efe |
27 | |
d112ed5a |
28 | /** |
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. ;) |
33 | */ |
7996c920 |
34 | $new_words = explode("%",$words); |
d112ed5a |
35 | /** |
36 | * Load the user dictionary and see if there is anything in it. |
37 | */ |
7996c920 |
38 | $old_words=sqspell_getLang($sqspell_use_app); |
39 | if (empty($old_words)){ |
40 | $word_dic = $new_words; |
d112ed5a |
41 | } else { |
7996c920 |
42 | foreach($new_words as $new_word) { |
773d8dcd |
43 | $old_words[]=$new_word; |
2b5a7157 |
44 | } |
7996c920 |
45 | // make sure that dictionary contains only unique values |
46 | $word_dic = array_unique($old_words); |
d112ed5a |
47 | } |
91e0dccc |
48 | |
d112ed5a |
49 | /** |
50 | * Write out the file |
51 | */ |
7996c920 |
52 | sqspell_writeWords($word_dic,$sqspell_use_app); |
d112ed5a |
53 | /** |
54 | * display the splash screen, then close it automatically after 2 sec. |
55 | */ |
56 | $onload = "setTimeout('self.close()', 2000)"; |
0e271f86 |
57 | $msg = '<form onsubmit="return false"><div style="text-align: center;">' |
d112ed5a |
58 | . '<input type="submit" value=" ' |
04fa3c41 |
59 | . _("Close") . ' " onclick="self.close()" /></div></form>'; |
d112ed5a |
60 | sqspell_makeWindow($onload, _("Personal Dictionary Updated"), null, $msg); |
61 | |
62 | /** |
63 | * For Emacs weenies: |
64 | * Local variables: |
65 | * mode: php |
66 | * End: |
2b6b400e |
67 | * vim: syntax=php |
d112ed5a |
68 | */ |