Use Horde_Crypt to instantiate.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 18 Nov 2008 21:11:55 +0000 (14:11 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 18 Nov 2008 21:11:55 +0000 (14:11 -0700)
imp/compose.php
imp/lib/Compose.php
imp/lib/Mime/Viewer/plain.php
imp/smime.php

index b35d3ca..c061992 100644 (file)
@@ -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')) {
index 78ae8e6..9d3331b 100644 (file)
@@ -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))) {
index 01badb3..520b795 100644 (file)
@@ -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(
index 11a026e..790087d 100644 (file)
@@ -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 */