X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fsquirrelspell%2Fmodules%2Fcrypto.mod;h=4d2078e61f01995795f9f4e5e14fc7187bc59daf;hb=d4e2e61a41bce2be1b005ecdd41f64cc60016f64;hp=cabd5c7322a28ead273b7d52f2259b60a153fef2;hpb=76911253eb850bacde3d86c8cb7b4af072e67ebe;p=squirrelmail.git diff --git a/plugins/squirrelspell/modules/crypto.mod b/plugins/squirrelspell/modules/crypto.mod index cabd5c73..4d2078e6 100644 --- a/plugins/squirrelspell/modules/crypto.mod +++ b/plugins/squirrelspell/modules/crypto.mod @@ -1,19 +1,19 @@ ($Author$) - * @version $Date$ + * @author Konstantin Riabitsev + * @copyright © 1999-2006 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage squirrelspell */ /** @@ -21,47 +21,65 @@ */ 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='

' - . _("Your personal dictionary has been encrypted and is now stored in an encrypted format.") - . '

'; - 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='

' - . _("Your personal dictionary has been decrypted and is now stored as clear text.") - . '

'; - break; - - case "": - /** - * Wait, this shouldn't happen! :) - */ - $msg = "

No action requested.

"; - break; +$langs=sqspell_getSettings(); + +if (! sqgetGlobalVar('action', $crypt_action, SQ_POST)) { + $crypt_action = 'noaction'; +} + +switch ($crypt_action){ + case 'encrypt': + $SQSPELL_CRYPTO_ORIG=$SQSPELL_CRYPTO; + + foreach ($langs as $lang) { + $SQSPELL_CRYPTO = $SQSPELL_CRYPTO_ORIG; + /** + * Let's encrypt the file and save it in an encrypted format. + */ + $words=sqspell_getLang($lang); + /** + * 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,$lang); + } + $msg='

' + . _("Your personal dictionary has been encrypted and is now stored in an encrypted format.") + . '

'; + break; + case 'decrypt': + $SQSPELL_CRYPTO_ORIG=$SQSPELL_CRYPTO; + + foreach ($langs as $lang) { + $SQSPELL_CRYPTO = $SQSPELL_CRYPTO_ORIG; + /** + * Let's encrypt the file and save it in an encrypted format. + */ + $words=sqspell_getLang($lang); + /** + * Flip the flag so the sqspell_writeWords function knows to decrypt + * the message before writing it to the disk. + */ + $SQSPELL_CRYPTO=false; + /** + * Call the function that does the actual encryption_decryption. + */ + sqspell_writeWords($words,$lang); + } + $msg='

' + . _("Your personal dictionary has been decrypted and is now stored as plain text.") + . '

'; + break; + default: + /** + * Wait, this shouldn't happen! :) + */ + $msg = '

'._("No action requested.").'

'; + break; } sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg); @@ -70,6 +88,5 @@ sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg); * Local variables: * mode: php * End: + * vim: syntax=php */ - -?>