fix php5 mistakes and remove disabled code. disabled code might be used to make sure
[squirrelmail.git] / plugins / squirrelspell / modules / crypto.mod
CommitLineData
849bdf42 1<?php
d112ed5a 2/**
2ad4cea9 3 * crypto.mod
91e0dccc 4 * ---------------
d112ed5a 5 * Squirrelspell module
6 *
9eb3fcb3 7 * Copyright (c) 1999-2005 The SquirrelMail Project 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
7996c920 24$langs=sqspell_getSettings();
25
26if (! sqgetGlobalVar('action', $crypt_action, SQ_POST)) {
27 $crypt_action = 'noaction';
28}
29
30switch ($crypt_action){
2ad4cea9 31 case 'encrypt':
7996c920 32 $SQSPELL_CRYPTO_ORIG=$SQSPELL_CRYPTO;
33
34 foreach ($langs as $lang) {
35 $SQSPELL_CRYPTO = $SQSPELL_CRYPTO_ORIG;
36 /**
37 * Let's encrypt the file and save it in an encrypted format.
38 */
39 $words=sqspell_getLang($lang);
40 /**
41 * Flip the flag so the sqspell_writeWords function knows to encrypt
42 * the message before writing it to the disk.
43 */
44 $SQSPELL_CRYPTO=true;
45 /**
46 * Call the function that does the actual encryption_decryption.
47 */
48 sqspell_writeWords($words,$lang);
49 }
2ad4cea9 50 $msg='<p>'
91e0dccc 51 . _("Your personal dictionary has been encrypted and is now stored in an encrypted format.")
2ad4cea9 52 . '</p>';
53 break;
54 case 'decrypt':
7996c920 55 $SQSPELL_CRYPTO_ORIG=$SQSPELL_CRYPTO;
56
57 foreach ($langs as $lang) {
58 $SQSPELL_CRYPTO = $SQSPELL_CRYPTO_ORIG;
59 /**
60 * Let's encrypt the file and save it in an encrypted format.
61 */
62 $words=sqspell_getLang($lang);
63 /**
64 * Flip the flag so the sqspell_writeWords function knows to decrypt
65 * the message before writing it to the disk.
66 */
67 $SQSPELL_CRYPTO=false;
68 /**
69 * Call the function that does the actual encryption_decryption.
70 */
71 sqspell_writeWords($words,$lang);
72 }
2ad4cea9 73 $msg='<p>'
0091d9ae 74 . _("Your personal dictionary has been decrypted and is now stored as plain text.")
2ad4cea9 75 . '</p>';
76 break;
7996c920 77 default:
2ad4cea9 78 /**
79 * Wait, this shouldn't happen! :)
80 */
7996c920 81 $msg = '<p>'._("No action requested.").'</p>';
2ad4cea9 82 break;
d112ed5a 83}
84sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg);
85
86/**
87 * For Emacs weenies:
88 * Local variables:
89 * mode: php
90 * End:
2b6b400e 91 * vim: syntax=php
d112ed5a 92 */
849bdf42 93
91e0dccc 94?>