/* 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');
}
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')) {
}
} 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))) {
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(
@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 */