Search was broken. fixed. List all is weird however, it works but does not alternate...
[squirrelmail.git] / plugins / squirrelspell / modules / crypto_badkey.mod
CommitLineData
849bdf42 1<?php
849bdf42 2
2b5a7157 3 /**
4 ** CRYPTO_BADKEY.MOD.PHP -- Squirrelspell module
5 **
15e6162e 6 ** Copyright (c) 1999-2002 The SquirrelMail development team
2b5a7157 7 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 **
9 ** This module tries to decrypt the user dictionary with a newly provided
10 ** old password, or erases the file if everything else fails. :(
11 **
12 ** $Id$
13 **/
14
15 // Just for fidian! :)
16 global $delete_words, $SCRIPT_NAME, $old_key;
17 if ($delete_words=='ON'){
18 // All attemts to decrypt the file were futile. Erase the bastard and
19 // hope this never happens again.
20 sqspell_deleteWords();
21 // See where we were called from -- pop-up window or options page
22 // and call whichever wrapper is appropriate.
23 if (strstr($SCRIPT_NAME, 'sqspell_options')){
24 $msg='<p>' . _("Your personal dictionary was erased.") . '</p>';
25 sqspell_makePage(_("Dictionary Erased"), null, $msg);
26 } else {
27 $msg = '<p>' . ("Your personal dictionary was erased. Please close this window and click \"Check Spelling\" button again to start your spellcheck over." ) .
28 '</p> '.
29 '<p align="center"><form>'.
30 '<input type="button" value=" ' _("Close this Window") . ' " onclick="self.close()">'.
31 '</form></p>';
32 sqspell_makeWindow(null, _("Dictionary Erased"), null, $msg);
33 }
34 exit;
35 }
36
37 if ($old_key){
38 // User provided another key to try and decrypt the dictionary.
39 // call sqspell_getWords. If this key fails, the function will
40 // handle it.
41 $words=sqspell_getWords();
42 // It worked! Pinky, you're a genius!
43 // Write it back this time encrypted with a new key.
44 sqspell_writeWords($words);
45 // See where we are and call a necessary GUI-wrapper.
46 if (strstr($SCRIPT_NAME, 'sqspell_options')){
47 $msg = '<p>' .
48 _("Your personal dictionary was re-encrypted successfully. Now "
49 "return to the &quot;SpellChecker options&quot; menu and make your selection "
50 "again." ) . '</p>';
51 sqspell_makePage(_("Successful Re-encryption"), null, $msg);
52 } else {
53 $msg = '<p>'.
54 _("Your personal dictionary was re-encrypted successfully. Please "
55 "close this window and click \"Check Spelling\" button again to start your "
56 "spellcheck over.") . '</p>' .
57 '<form><p align="center"><input type="button" value=" ' . _("Close this Window") . ' "'.
58 'onclick="self.close()"></p></form>';
59 sqspell_makeWindow(null, _("Dictionary re-encrypted"), null, $msg);
60 }
61 exit;
62 }
63
15e6162e 64?>