From: Michael M Slusarz Date: Fri, 7 Jan 2011 18:56:42 +0000 (-0700) Subject: Don't output default encryption option if no encryption is available X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9027cce6d2cf6af0f2b6e7659921739b5c567f4e;p=horde.git Don't output default encryption option if no encryption is available --- 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; }