~ubuntu-branches/ubuntu/hardy/squirrelmail/hardy-updates

« back to all changes in this revision

Viewing changes to plugins/squirrelspell/modules/crypto.mod

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2005-02-06 21:41:51 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050206214151-z4n1o8mnttgzuj0y
Tags: 2:1.4.4-3
* Move default_pref config file from /var to /etc, as per Debian policy
  (Closes: #293281)
* [JvW] (finally) override two lintian warnings about nonstandard
  permissions that are intentional (Closes: #293366)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
/**
3
 
 * crypto.mod.php 
 
3
 * crypto.mod
4
4
 * --------------- 
5
5
 * Squirrelspell module
6
6
 *
10
10
 * This module handles the encryption/decryption of the user dictionary
11
11
 * if the user so chooses from the options page.
12
12
 *
13
 
 * $Id: crypto.mod,v 1.4 2002/12/31 12:49:40 kink Exp $
 
13
 * $Id: crypto.mod,v 1.4.2.3 2004/09/06 08:35:05 tokul Exp $
14
14
 *
15
 
 * @author Konstantin Riabitsev <icon@duke.edu> ($Author: kink $)
16
 
 * @version $Date: 2002/12/31 12:49:40 $
 
15
 * @author Konstantin Riabitsev <icon@duke.edu> ($Author: tokul $)
 
16
 * @version $Date: 2004/09/06 08:35:05 $
17
17
 */
18
18
 
19
19
/**
22
22
global $SQSPELL_CRYPTO;
23
23
 
24
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 <strong>encrypted</strong> and is now stored in an <strong>encrypted format</strong>.")
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 <strong>decrypted</strong> and is now stored as <strong>clear text</strong>.") 
56
 
       . '</p>';
57
 
  break;
58
 
  
59
 
  case "":
60
 
    /**
61
 
     * Wait, this shouldn't happen! :)
62
 
     */
63
 
    $msg = "<p>No action requested.</p>";
64
 
  break;
 
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;
65
64
}
66
65
sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg);
67
66
 
70
69
 * Local variables:
71
70
 * mode: php
72
71
 * End:
 
72
 * vim: syntax=php
73
73
 */
74
74
 
75
75
?>