From 39fb37233b80bd5eed7682fd8af70794000858be Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 18 Nov 2008 14:11:55 -0700 Subject: [PATCH] Use Horde_Crypt to instantiate. --- imp/compose.php | 9 +++------ imp/lib/Compose.php | 3 +-- imp/lib/Mime/Viewer/plain.php | 5 +++-- imp/smime.php | 4 +--- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/imp/compose.php b/imp/compose.php index b35d3ca4f..c06199220 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -719,13 +719,11 @@ if ($get_sig && isset($msg) && !empty($sig)) { /* Open the passphrase window here. */ if ($pgp_passphrase_dialog || $pgp_symmetric_passphrase_dialog) { - require_once IMP_BASE .'/lib/Crypt/PGP.php'; - $imp_pgp = new IMP_PGP(); + $imp_pgp = &Horde_Crypt::singleton(array('imp', 'pgp')); Horde::addScriptFile('popup.js', 'imp', true); $notification->push($imp_pgp->getJSOpenWinCode($pgp_symmetric_passphrase_dialog ? 'open_symmetric_passphrase_dialog' : 'open_passphrase_dialog', "opener.focus();opener.uniqSubmit('send_message');"), 'javascript'); } elseif ($smime_passphrase_dialog) { - require_once IMP_BASE .'/lib/Crypt/SMIME.php'; - $imp_smime = new IMP_SMIME(); + $imp_smime = &Horde_Crypt::singleton(array('imp', 'smime')); Horde::addScriptFile('popup.js', 'imp', true); $notification->push($imp_smime->getJSOpenWinCode('open_passphrase_dialog', "opener.focus();opener.uniqSubmit('send_message');"), 'javascript'); } @@ -740,8 +738,7 @@ if ($use_pgp) { in_array($default_encrypt, array(IMP::PGP_ENCRYPT, IMP::PGP_SIGNENC))) { $addrs = $imp_compose->recipientList($header); if (!is_a($addrs, 'PEAR_Error') && !empty($addrs['list'])) { - require_once IMP_BASE .'/lib/Crypt/PGP.php'; - $imp_pgp = new IMP_PGP(); + $imp_pgp = &Horde_Crypt::singleton(array('imp', 'pgp')); foreach ($addrs['list'] as $val) { $res = $imp_pgp->getPublicKey($val); if (is_a($res, 'PEAR_Error')) { diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 78ae8e638..9d3331b81 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -1216,8 +1216,7 @@ class IMP_Compose } } elseif ($useSMIME && in_array($encrypt, array(IMP::SMIME_ENCRYPT, IMP::SMIME_SIGN, IMP::SMIME_SIGNENC))) { - require_once IMP_BASE. '/lib/Crypt/SMIME.php'; - $imp_smime = new IMP_SMIME(); + $imp_smime = &Horde_Crypt::singleton(array('imp', 'smime')); /* Check to see if we have the user's passphrase yet. */ if (in_array($encrypt, array(IMP::SMIME_SIGN, IMP::SMIME_SIGNENC))) { diff --git a/imp/lib/Mime/Viewer/plain.php b/imp/lib/Mime/Viewer/plain.php index 01badb3eb..520b7950f 100644 --- a/imp/lib/Mime/Viewer/plain.php +++ b/imp/lib/Mime/Viewer/plain.php @@ -42,8 +42,9 @@ class IMP_Horde_Mime_Viewer_plain extends Horde_Mime_Viewer_plain if (!empty($conf['utils']['gnupg']) && $prefs->getValue('pgp_scan_body') && preg_match('/-----BEGIN PGP ([^-]+)-----/', $text)) { - require_once IMP_BASE . '/lib/Crypt/PGP.php'; - $imp_pgp = new IMP_PGP(); + // TODO: Convert this to embedded scanning. + $imp_pgp = &Horde_Crypt::singleton(array('imp', 'pgp')); + if (($out = $imp_pgp->parseMessageOutput($this->_mimepart, $this->_params['contents']))) { return array( $this->_mimepart->getMimeId() => array( diff --git a/imp/smime.php b/imp/smime.php index 11a026e4e..790087de5 100644 --- a/imp/smime.php +++ b/imp/smime.php @@ -99,10 +99,8 @@ function _printKeyInfo($cert) @define('IMP_BASE', dirname(__FILE__)); require_once IMP_BASE . '/lib/base.php'; -require_once IMP_BASE . '/lib/Crypt/SMIME.php'; - -$imp_smime = new IMP_SMIME(); +$imp_smime = &Horde_Crypt::singleton(array('imp', 'smime')); $secure_check = $imp_smime->requireSecureConnection(); /* Run through the action handlers */ -- 2.11.0