From: Michael M Slusarz Date: Thu, 28 Jan 2010 17:23:04 +0000 (-0700) Subject: S/MIME Viewer fixes X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=70d4453668f1f37b10e5602e58f18c3683ce732a;p=horde.git S/MIME Viewer fixes Clean up verification status output Fix function name typo --- diff --git a/imp/lib/Mime/Viewer/Smime.php b/imp/lib/Mime/Viewer/Smime.php index 992b3ef2d..bdded74d4 100644 --- a/imp/lib/Mime/Viewer/Smime.php +++ b/imp/lib/Mime/Viewer/Smime.php @@ -88,7 +88,7 @@ class IMP_Horde_Mime_Viewer_Smime extends Horde_Mime_Viewer_Driver $this->_initSmime(); if (Horde_Util::getFormData('view_smime_key')) { - return $this->_outputSmime(); + return $this->_outputSmimeKey(); } if (is_null($this->_impsmime)) { @@ -269,35 +269,29 @@ class IMP_Horde_Mime_Viewer_Smime extends Horde_Mime_Viewer_Driver self::$_cache[$base_id]['status'][0]['icon'] = Horde::img('alerts/success.png', _("Success"), null, $graphicsdir); self::$_cache[$base_id]['wrap'] = 'mimePartWrapValid'; - /* This data has been verified but there was no output from - * the S/MIME program. */ if (empty($sig_result->result) || ($sig_result->result === true)) { $email = is_array($sig_result->email) ? implode(', ', $sig_result->email) : $sig_result->email; - $status[] = sprintf(_("The data has been verified. Sender: %s."), htmlspecialchars($email)); - } - if (!empty($sig_result->cert)) { - $cert = $this->_impsmime->parseCert($sig_result->cert); - if (isset($cert['certificate']['subject']['CommonName'])) { - $subject = $cert['certificate']['subject']['CommonName']; - } elseif (isset($cert['certificate']['subject']['Email'])) { - $subject = $cert['certificate']['subject']['Email']; - } elseif (isset($sig_result->email)) { - $subject = $sig_result->email; - } elseif (isset($smime_from)) { - $subject = $smime_from; - } else { - $subject = null; - } + $status[] = _("The data has been verified."); - if (!empty($subject) && - $GLOBALS['registry']->hasMethod('contacts/addField') && - $GLOBALS['prefs']->getValue('add_source')) { - $status[] = sprintf(_("The S/MIME certificate of %s: "), @htmlspecialchars($subject, ENT_COMPAT, Horde_Nls::getCharset())) . $this->_params['contents']->linkViewJS($this->_mimepart, 'view_attach', _("View"), array('params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1))) . '/' . Horde::link('#', '', null, null, $this->_impsmime->savePublicKeyURL($sig_result->cert, $this->_params['contents']->getUid(), $sig_id) . ' return false;') . _("Save in your Address Book") . ''; + if (!empty($sig_result->cert)) { + $cert = $this->_impsmime->parseCert($sig_result->cert); + if (isset($cert['certificate']['subject']['CommonName'])) { + $email = $cert['certificate']['subject']['CommonName'] . ' (' . $email . ' )'; + } } + + $status[] = sprintf(_("Sender: %s"), htmlspecialchars($email)); + } + + if (!empty($sig_result->cert) && + isset($sig_result->email) && + $GLOBALS['registry']->hasMethod('contacts/addField') && + $GLOBALS['prefs']->getValue('add_source')) { + $status[] = '[' . $this->_params['contents']->linkViewJS($this->_mimepart, 'view_attach', _("View Certificate"), array('params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1))) . '] [' . Horde::link('#', '', null, null, $this->_impsmime->savePublicKeyURL($sig_result->cert, $this->_params['contents']->getUid(), $sig_id) . ' return false;') . _("Save Certificate in your Address Book") . ']'; } } catch (Horde_Exception $e) { self::$_cache[$base_id]['status'][0]['icon'] = ($e->getCode() == 'horde.warning')