Removing hooks where we can from templates; one hook will probably have to stay;...
[squirrelmail.git] / plugins / squirrelspell / modules / enc_setup.mod
CommitLineData
849bdf42 1<?php
4b4abf93 2
d112ed5a 3/**
4 * enc_setup.mod
d112ed5a 5 *
4b4abf93 6 * Squirrelspell module
d112ed5a 7 *
91e0dccc 8 * This module shows the user a nice invitation to encrypt or decypt
9 * his/her personal dictionary and explains the caveats of such a decision.
d112ed5a 10 *
4b4abf93 11 * @author Konstantin Riabitsev <icon at duke.edu>
47ccfad4 12 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
4b4abf93 13 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
44d661aa 14 * @version $Id$
15 * @package plugins
16 * @subpackage squirrelspell
d112ed5a 17 */
849bdf42 18
91e0dccc 19global $SQSPELL_CRYPTO;
2b5a7157 20
a8380e75 21/**
22 * Set up some i18n'able wrappers for javascript.
23 */
2ad4cea9 24$msg = '<script type="text/javascript"><!--'."\n"
25 . 'var ui_makesel = "' . _("Please make your selection first.") . "\";\n"
91e0dccc 26 . 'var ui_encrypt = "'
27 . _("This will encrypt your personal dictionary and store it in an encrypted format. Proceed?")
2ad4cea9 28 . "\";\n"
29 . 'var ui_decrypt = "'
30 . _("This will decrypt your personal dictionary and store it in a plain text format. Proceed?")
31 . "\";\n"
32 . "//-->\n</script>";
a8380e75 33
7996c920 34$crypted=false;
35$langs=sqspell_getSettings();
36foreach ($langs as $lang) {
37 $words=sqspell_getLang($lang);
38 if ($SQSPELL_CRYPTO) $crypted = true;
39}
40
d112ed5a 41/**
42 * When getting the user dictionary, the SQSPELL_CRYPTO flag will be
43 * set to "true" if the dictionary is encrypted, or "false" if it is
44 * in plain text.
45 */
7996c920 46if ($crypted){
2ad4cea9 47 /**
48 * Current format is encrypted.
49 * Unfortunately, the following text needs to be all on one line,
50 * unless someone fixes xgettext. ;(
51 */
52 $msg .=
53 '<p>'
54 . _("Your personal dictionary is currently encrypted.")
55 . '</p><p>'
56 . _("This helps protect your privacy in case the web-mail system gets compromized and your personal dictionary ends up stolen. It is currently encrypted with the password you use to access your mailbox, making it hard for anyone to see what is stored in your personal dictionary.")
57 . '</p><p>'
58 . '<strong>' . _("ATTENTION:") . '</strong><br />'
59 . _("If you forget your password, your personal dictionary will become unaccessible, since it can no longer be decrypted. If you change your mailbox password, SquirrelSpell will recognize it and prompt you for your old password in order to re-encrypt the dictionary with a new key.")
60 . '</p>'
61 . '<form method="post" onsubmit="return checkMe()">'
04fa3c41 62 . '<input type="hidden" name="MOD" value="crypto" />'
2ad4cea9 63 . '<p align="center"><input type="checkbox" name="action" '
04fa3c41 64 . 'value="decrypt" /> '
2ad4cea9 65 . _("Please decrypt my personal dictionary and store it in a clear-text format." )
66 . '</p>'
67 . '<p align="center"><input type="submit" value=" '
68 . _("Change crypto settings")
04fa3c41 69 . ' " /></p>'
2ad4cea9 70 . '</form>';
d112ed5a 71} else {
2ad4cea9 72 /**
73 * Current format is clear text.
74 * Unfortunately, the following text needs to be all on one line,
75 * unless someone fixes xgettext. ;(
76 */
77 $msg .=
78 '<p>'
79 . _("Your personal dictionary is currently not encrypted.")
80 . '</p><p>'
81 . _("You may wish to encrypt your personal dictionary to protect your privacy in case the webmail system gets compromized and your personal dictionary file gets stolen. When encrypted, the file's contents look garbled and are hard to decrypt without knowing the correct key (which is your mailbox password).")
82 . '</p><p>'
83 . '<strong>' . _("ATTENTION:") . '</strong><br />'
84 . _("If you decide to encrypt your personal dictionary, you must remember that it gets &quot;hashed&quot; with your mailbox password. If you forget your mailbox password and the administrator changes it to a new value, your personal dictionary will become useless and will have to be created anew. However, if you or your system administrator change your mailbox password but you still have the old password at hand, you will be able to enter the old key to re-encrypt the dictionary with the new value.")
85 . '</p>'
86 . '<form method="post" onsubmit="return checkMe()">'
04fa3c41 87 . '<input type="hidden" name="MOD" value="crypto" />'
2ad4cea9 88 . '<p align="center"><input type="checkbox" name="action" '
04fa3c41 89 . 'value="encrypt" /> '
2ad4cea9 90 . _("Please encrypt my personal dictionary and store it in an encrypted format.")
91 . '</p>'
92 . '<p align="center"><input type="submit" value=" '
04fa3c41 93 . _("Change crypto settings") . ' " /></p>'
2ad4cea9 94 . '</form>';
d112ed5a 95}
91e0dccc 96sqspell_makePage(_("Personal Dictionary Crypto Settings"),
90ad8cd1 97 "crypto_settings.js", $msg);
d112ed5a 98
99/**
100 * For Emacs weenies:
101 * Local variables:
102 * mode: php
103 * End:
2b6b400e 104 * vim: syntax=php
91e0dccc 105 */