Changing squirrelmail/Squirrelmail to SquirrelMail in some strings as well as other...
[squirrelmail.git] / plugins / squirrelspell / modules / crypto_badkey.mod
CommitLineData
849bdf42 1<?php
d112ed5a 2/**
3 * crypto_badkey.mod
4 * ------------------
5 * Squirrelspell module
6 *
6c84ba1e 7 * Copyright (c) 1999-2005 The SquirrelMail development team
d112ed5a 8 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 *
10 * This module tries to decrypt the user dictionary with a newly provided
44d661aa 11 * old password, or erases the file if everything else fails. :(
d112ed5a 12 *
44d661aa 13 * @author Konstantin Riabitsev <icon@duke.edu>
14 * @version $Id$
15 * @package plugins
16 * @subpackage squirrelspell
d112ed5a 17 */
849bdf42 18
d8aa9efe 19global $SCRIPT_NAME;
20
21$delete_words = $_POST['delete_words'];
22if(isset($_POST['old_key'])) {
23 $old_key = $_POST['old_key'];
24}
25
d112ed5a 26if ($delete_words=='ON'){
27 /**
28 * $delete_words is passed via the query_string. If it's set, then
29 * the user asked to delete the file. Erase the bastard and hope
30 * this never happens again.
31 */
91e0dccc 32 sqspell_deleteWords();
d112ed5a 33 /**
34 * See where we were called from -- pop-up window or options page
35 * and call whichever wrapper is appropriate.
36 * I agree, this is dirty. TODO: make it so it's not dirty.
37 */
38 if (strstr($SCRIPT_NAME, 'sqspell_options')){
39 $msg='<p>' . _("Your personal dictionary was erased.") . '</p>';
40 sqspell_makePage(_("Dictionary Erased"), null, $msg);
41 } else {
42 /**
43 * The _("Your....") has to be on one line. Otherwise xgettext borks
44 * on getting the strings.
45 */
91e0dccc 46 $msg = '<p>'
d112ed5a 47 . _("Your personal dictionary was erased. Please close this window and click \"Check Spelling\" button again to start your spellcheck over.")
48 . '</p> '
49 . '<p align="center"><form>'
50 . '<input type="button" value=" '
74091b64 51 . _("Close this Window") . ' " onclick="self.close()" />'
d112ed5a 52 . '</form></p>';
53 sqspell_makeWindow(null, _("Dictionary Erased"), null, $msg);
54 }
55 exit;
56}
91e0dccc 57
d112ed5a 58if ($old_key){
59 /**
60 * User provided another key to try and decrypt the dictionary.
61 * Call sqspell_getWords. If this key fails, the function will
62 * handle it.
63 */
64 $words=sqspell_getWords();
65 /**
66 * It worked! Pinky, you're a genius!
67 * Write it back this time encrypted with a new key.
68 */
69 sqspell_writeWords($words);
70 /**
71 * See where we are and call a necessary GUI-wrapper.
72 * Also dirty. TODO: Make this not dirty.
73 */
74 if (strstr($SCRIPT_NAME, 'sqspell_options')){
75 $msg = '<p>'
91e0dccc 76 . _("Your personal dictionary was re-encrypted successfully. Now return to the &quot;SpellChecker options&quot; menu and make your selection again." )
d112ed5a 77 . '</p>';
74091b64 78 sqspell_makePage(_("Successful re-encryption"), null, $msg);
d112ed5a 79 } else {
80 $msg = '<p>'
91e0dccc 81 . _("Your personal dictionary was re-encrypted successfully. Please close this window and click \"Check Spelling\" button again to start your spellcheck over.")
82 . '</p><form><p align="center"><input type="button" value=" '
d112ed5a 83 . _("Close this Window") . ' "'
74091b64 84 . 'onclick="self.close()" /></p></form>';
d112ed5a 85 sqspell_makeWindow(null, _("Dictionary re-encrypted"), null, $msg);
86 }
87 exit;
88}
89
90/**
91 * For Emacs weenies:
92 * Local variables:
93 * mode: php
94 * End:
2b6b400e 95 * vim: syntax=php
91e0dccc 96 */
97?>