File: crypto.mod

package info (click to toggle)
squirrelmail 2%3A1.4.4-11
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,496 kB
  • ctags: 6,546
  • sloc: php: 32,906; perl: 3,049; sh: 166; ansic: 122; makefile: 83
file content (75 lines) | stat: -rw-r--r-- 2,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
 * crypto.mod
 * --------------- 
 * Squirrelspell module
 *
 * Copyright (c) 1999-2003 The SquirrelMail development team
 * Licensed under the GNU GPL. For full terms see the file COPYING.
 *
 * This module handles the encryption/decryption of the user dictionary
 * if the user so chooses from the options page.
 *
 * $Id: crypto.mod,v 1.4.2.3 2004/09/06 08:35:05 tokul Exp $
 *
 * @author Konstantin Riabitsev <icon@duke.edu> ($Author: tokul $)
 * @version $Date: 2004/09/06 08:35:05 $
 */

/**
 * Declaring globals for E_ALL
 */
global $SQSPELL_CRYPTO;

switch ($_POST['action']){
    case 'encrypt':
        /**
         * Let's encrypt the file and save it in an encrypted format.
         */
        $words=sqspell_getWords();
        /** 
         * Flip the flag so the sqspell_writeWords function knows to encrypt
         * the message before writing it to the disk.
         */
        $SQSPELL_CRYPTO=true;
        /**
         * Call the function that does the actual encryption_decryption.
         */
        sqspell_writeWords($words);
        $msg='<p>'
            . _("Your personal dictionary has been encrypted and is now stored in an encrypted format.") 
            . '</p>';
    break;
    case 'decrypt':
        /**
         * Let's decrypt the file and save it as plain text.
         */
        $words=sqspell_getWords();
        /** 
         * Flip the flag and tell the sqspell_writeWords() function that we
         * want to save it plaintext.
         */
        $SQSPELL_CRYPTO=false;
        sqspell_writeWords($words);
        $msg='<p>'
            . _("Your personal dictionary has been decrypted and is now stored as plain text.")
            . '</p>';
    break;
    case '':
        /**
         * Wait, this shouldn't happen! :)
         */
        $msg = '<p>No action requested.</p>';
    break;
}
sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg);

/**
 * For Emacs weenies:
 * Local variables:
 * mode: php
 * End:
 * vim: syntax=php
 */

?>