From 9027cce6d2cf6af0f2b6e7659921739b5c567f4e Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 7 Jan 2011 11:56:42 -0700 Subject: [PATCH] Don't output default encryption option if no encryption is available --- imp/lib/IMP.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 834cbe9ed..2c7362950 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -665,7 +665,8 @@ class IMP * @param boolean $returnList Whether to return a hash with options * instead of the options tag. * - * @return string The list of option tags. + * @return mixed The list of option tags. This is empty if no encryption + * is available. */ static public function encryptList($default = null, $returnList = false) { @@ -673,7 +674,7 @@ class IMP $default = $GLOBALS['prefs']->getValue('default_encrypt'); } - $enc_opts = array(self::ENCRYPT_NONE => _("None")); + $enc_opts = array(); $output = ''; if (!empty($GLOBALS['conf']['gnupg']['path']) && @@ -685,6 +686,13 @@ class IMP $enc_opts += $GLOBALS['injector']->getInstance('IMP_Crypt_Smime')->encryptList(); } + if (!empty($enc_opts)) { + $enc_opts = array_merge( + array(self::ENCRYPT_NONE => _("None")), + $enc_opts + ); + } + if ($returnList) { return $enc_opts; } -- 2.11.0