Some uniformity into the sec index.php flavor
[squirrelmail.git] / plugins / squirrelspell / modules / crypto.mod
CommitLineData
849bdf42 1<?php
d112ed5a 2/**
3 * crypto.mod.php
4 * ---------------
5 * Squirrelspell module
6 *
7 * Copyright (c) 1999-2002 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 * $Id$
14 *
15 * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
16 * @version $Date$
17 */
849bdf42 18
d112ed5a 19/**
20 * Declaring globals for E_ALL
21 */
22global $action, $SQSPELL_CRYPTO;
23switch ($action){
24 case 'encrypt':
25 /**
26 * Let's encrypt the file and save it in an encrypted format.
27 */
28 $words=sqspell_getWords();
29 /**
30 * Flip the flag so the sqspell_writeWords function knows to encrypt
31 * the message before writing it to the disk.
32 */
33 $SQSPELL_CRYPTO=true;
34 /**
35 * Call the function that does the actual encryption_decryption.
36 */
37 sqspell_writeWords($words);
38 $msg='<p>'
39 . _("Your personal dictionary has been <strong>encrypted</strong> and is now stored in an <strong>encrypted format</strong>.")
40 . '</p>';
41 break;
42 case 'decrypt':
43 /**
44 * Let's decrypt the file and save it as plain text.
45 */
46 $words=sqspell_getWords();
47 /**
48 * Flip the flag and tell the sqspell_writeWords() function that we
49 * want to save it plaintext.
50 */
51 $SQSPELL_CRYPTO=false;
52 sqspell_writeWords($words);
53 $msg='<p>'
54 . _("Your personal dictionary has been <strong>decrypted</strong> and is now stored as <strong>clear text</strong>.")
55 . '</p>';
56 break;
57
58 case "":
59 /**
60 * Wait, this shouldn't happen! :)
61 */
62 $msg = "<p>No action requested.</p>";
63 break;
64}
65sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg);
66
67/**
68 * For Emacs weenies:
69 * Local variables:
70 * mode: php
71 * End:
72 */
849bdf42 73
849bdf42 74?>