it didn't really parse all directories, eerhhmmm
[squirrelmail.git] / plugins / squirrelspell / modules / forget_me.mod.php
CommitLineData
849bdf42 1<?php
849bdf42 2
2b5a7157 3 /**
4 ** FORGET_ME.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 deletes the words from the user dictionary. Called
10 ** after EDIT_DIC module.
11 **
12 ** $Id$
13 **/
14
15 // Make it two packs of Guinness and a bag of pistachios, fidian. :)
16 global $words_ary, $sqspell_use_app, $SQSPELL_VERSION;
17 if (sizeof($words_ary)){
18 // something needs to be deleted.
19 $words=sqspell_getWords();
20 $lang_words = sqspell_getLang($words, $sqspell_use_app);
21 $msg = '<p>'.
22 sprintf( _("Deleting the following entries from <strong>%s</strong> dictionary:", $sqspell_use_app ) .
23 '</p>'.
24 "<ul>\n";
25 for ($i=0; $i<sizeof($words_ary); $i++){
26 // remove word by word...
27 $lang_words=str_replace("$words_ary[$i]\n", "", $lang_words);
28 $msg .= "<li>$words_ary[$i]</li>\n";
29 }
30 $new_words_ary=split("\n", $lang_words);
31 // Wipe this lang, if only 2 members in array (no words left).
32 if (sizeof($new_words_ary)<=2) {
33 $lang_words='';
34 }
35 $new_lang_words = $lang_words;
36 // process the stuff and write the dic back.
37 $langs=sqspell_getSettings($words);
38 $words_dic = "# SquirrelSpell User Dictionary $SQSPELL_VERSION\n# Last Revision: " . date("Y-m-d") . "\n# LANG: " . join(", ", $langs) . "\n";
39 for ($i=0; $i<sizeof($langs); $i++){
40 if ($langs[$i]==$sqspell_use_app) {
41 $lang_words = $new_lang_words;
42 } else {
43 $lang_words = sqspell_getLang($words, $langs[$i]);
44 }
45 if ($lang_words) {
46 $words_dic .= $lang_words;
47 }
48 }
49 $words_dic .= "# End\n";
50 sqspell_writeWords($words_dic);
51 $msg .= '</ul>' .
52 '<p>' _("All done!") . "</p>\n";
53 sqspell_makePage(_("Personal Dictionary Updated"), null, $msg);
54 } else {
55 // Click on some words first, Einstein!
56 sqspell_makePage(_("Personal Dictionary"), null, '<p>' . _("No changes requested.") . '</p>');
57 }
58
59?>