Increment year in copyright notice.
[squirrelmail.git] / plugins / squirrelspell / modules / crypto.mod
1 <?php
2 /**
3 * crypto.mod
4 * ---------------
5 * Squirrelspell module
6 *
7 * Copyright (c) 1999-2005 The SquirrelMail development team
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 *
13 * @author Konstantin Riabitsev <icon@duke.edu>
14 * @version $Id$
15 * @package plugins
16 * @subpackage squirrelspell
17 */
18
19 /**
20 * Declaring globals for E_ALL
21 */
22 global $SQSPELL_CRYPTO;
23
24 switch ($_POST['action']){
25 case 'encrypt':
26 /**
27 * Let's encrypt the file and save it in an encrypted format.
28 */
29 $words=sqspell_getWords();
30 /**
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>'
40 . _("Your personal dictionary has been encrypted and is now stored in an encrypted format.")
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();
48 /**
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>'
55 . _("Your personal dictionary has been decrypted and is now stored as plain text.")
56 . '</p>';
57 break;
58 case '':
59 /**
60 * Wait, this shouldn't happen! :)
61 */
62 $msg = '<p>No action requested.</p>';
63 break;
64 }
65 sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg);
66
67 /**
68 * For Emacs weenies:
69 * Local variables:
70 * mode: php
71 * End:
72 * vim: syntax=php
73 */
74
75 ?>