phpdoc: added block tags, @version is set to Id:, removed Author: and Date:
[squirrelmail.git] / plugins / squirrelspell / modules / crypto.mod
CommitLineData
849bdf42 1<?php
d112ed5a 2/**
2ad4cea9 3 * crypto.mod
d112ed5a 4 * ---------------
5 * Squirrelspell module
6 *
44d661aa 7 * Copyright (c) 1999-2004 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 22global $SQSPELL_CRYPTO;
23
24switch ($_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();
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>'
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}
65sqspell_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
849bdf42 75?>