fix php5 mistakes and remove disabled code. disabled code might be used to make sure
[squirrelmail.git] / plugins / squirrelspell / modules / forget_me_not.mod
CommitLineData
91e0dccc 1<?php
d112ed5a 2/**
91e0dccc 3 * forget_me_not.mod
d112ed5a 4 * ------------------
5 * Squirrelspell module
6 *
9eb3fcb3 7 * Copyright (c) 1999-2005 The SquirrelMail Project Team
d112ed5a 8 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 *
10 * This module saves the added words into the user dictionary. Called
91e0dccc 11 * after CHECK_ME module.
d112ed5a 12 *
44d661aa 13 * @author Konstantin Riabitsev <icon@duke.edu>
14 * @version $Id$
15 * @package plugins
16 * @subpackage squirrelspell
d112ed5a 17 */
849bdf42 18
847d7c93 19global $SQSPELL_VERSION, $SQSPELL_APP_DEFAULT;
d8aa9efe 20
7996c920 21if (! sqgetGlobalVar('words',$words,SQ_POST)) {
22 $words='';
23}
24if (! 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);
39if (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 52sqspell_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)";
57$msg = '<form onsubmit="return false"><div align="center">'
58 . '<input type="submit" value=" '
04fa3c41 59 . _("Close") . ' " onclick="self.close()" /></div></form>';
d112ed5a 60sqspell_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 */
69
04fa3c41 70?>