849bdf42 |
1 | <?php |
d112ed5a |
2 | /** |
2ad4cea9 |
3 | * crypto.mod |
91e0dccc |
4 | * --------------- |
d112ed5a |
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 handles the encryption/decryption of the user dictionary |
11 | * if the user so chooses from the options page. |
12 | * |
44d661aa |
13 | * @author Konstantin Riabitsev <icon@duke.edu> |
14 | * @version $Id$ |
15 | * @package plugins |
16 | * @subpackage squirrelspell |
d112ed5a |
17 | */ |
849bdf42 |
18 | |
d112ed5a |
19 | /** |
20 | * Declaring globals for E_ALL |
21 | */ |
d8aa9efe |
22 | global $SQSPELL_CRYPTO; |
23 | |
24 | switch ($_POST['action']){ |
2ad4cea9 |
25 | case 'encrypt': |
26 | /** |
27 | * Let's encrypt the file and save it in an encrypted format. |
28 | */ |
29 | $words=sqspell_getWords(); |
91e0dccc |
30 | /** |
2ad4cea9 |
31 | * Flip the flag so the sqspell_writeWords function knows to encrypt |
32 | * the message before writing it to the disk. |
33 | */ |
34 | $SQSPELL_CRYPTO=true; |
35 | /** |
36 | * Call the function that does the actual encryption_decryption. |
37 | */ |
38 | sqspell_writeWords($words); |
39 | $msg='<p>' |
91e0dccc |
40 | . _("Your personal dictionary has been encrypted and is now stored in an encrypted format.") |
2ad4cea9 |
41 | . '</p>'; |
42 | break; |
43 | case 'decrypt': |
44 | /** |
45 | * Let's decrypt the file and save it as plain text. |
46 | */ |
47 | $words=sqspell_getWords(); |
91e0dccc |
48 | /** |
2ad4cea9 |
49 | * Flip the flag and tell the sqspell_writeWords() function that we |
50 | * want to save it plaintext. |
51 | */ |
52 | $SQSPELL_CRYPTO=false; |
53 | sqspell_writeWords($words); |
54 | $msg='<p>' |
0091d9ae |
55 | . _("Your personal dictionary has been decrypted and is now stored as plain text.") |
2ad4cea9 |
56 | . '</p>'; |
57 | break; |
58 | case '': |
59 | /** |
60 | * Wait, this shouldn't happen! :) |
61 | */ |
62 | $msg = '<p>No action requested.</p>'; |
63 | break; |
d112ed5a |
64 | } |
65 | sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg); |
66 | |
67 | /** |
68 | * For Emacs weenies: |
69 | * Local variables: |
70 | * mode: php |
71 | * End: |
2b6b400e |
72 | * vim: syntax=php |
d112ed5a |
73 | */ |
849bdf42 |
74 | |
91e0dccc |
75 | ?> |