From 8702c3c30632dc17cfec47f1a52ef85bfde1a9f5 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 18 Nov 2008 20:30:25 -0700 Subject: [PATCH] Remove unused functions. --- imp/lib/Crypt/pgp.php | 147 -------------------------------------------------- 1 file changed, 147 deletions(-) diff --git a/imp/lib/Crypt/pgp.php b/imp/lib/Crypt/pgp.php index 2b4482988..97118453d 100644 --- a/imp/lib/Crypt/pgp.php +++ b/imp/lib/Crypt/pgp.php @@ -248,153 +248,6 @@ class IMP_Horde_Crypt_pgp extends Horde_Crypt_pgp } /** - * Parse a message into its PGP components. - * - * @param string $text See Horde_Crypt_pgp::parsePGPData() - * - * @return array Returns an array of Horde_Mime_Part objects. - * If there was no PGP data, returns false. - */ - public function &parseMessage($text) - { - $result = $this->parsePGPData($text); - if (empty($result) || - ((count($result) == 1) && ($result[0]['type'] == self::ARMOR_TEXT))) { - $result = false; - return $result; - } - - $return_array = array(); - - reset($result); - do { - $block = current($result); - $temp_part = new Horde_Mime_Part(); - $temp_part->setContents(implode("\n", $block['data'])); - - /* Since private keys should NEVER be sent across email (in fact, - there is no MIME type to handle them) we will render them, if - someone is foolish enough to send one, in simple text. */ - if (($block['type'] == self::ARMOR_TEXT) || - ($block['type'] == self::ARMOR_PRIVATE_KEY)) { - $temp_part->setType('text/plain'); - } elseif ($block['type'] == self::ARMOR_PUBLIC_KEY) { - $temp_part->setType('application/pgp-keys'); - } elseif ($block['type'] == self::ARMOR_MESSAGE) { - $temp_part->setType('application/pgp-encrypted'); - } elseif ($block['type'] == self::ARMOR_SIGNED_MESSAGE) { - $temp_part->setType('application/pgp-signature'); - if (($block = next($result))) { - if (!empty($block) && ($block['type'] == self::ARMOR_SIGNATURE)) { - $temp_part->appendContents("\n" . implode("\n", $block['data'])); - } - } - } elseif ($block['type'] == self::ARMOR_SIGNATURE) { - continue; - } - - $return_array[] = $temp_part; - } while (next($result)); - - return $return_array; - } - - /** - * Renders a text message with PGP components. - * - * @param Horde_Mime_Part &$part The part containing the data to - * render. - * @param IMP_Contents &$contents The IMP_Contents:: module to use to - * output the text. - * - * @return string Returns the rendered text. - * If there was no PGP data, returns false. - */ - function parseMessageOutput(&$part, &$contents) - { - if (!($parts = &$this->parseMessage($part->getContents()))) { - return false; - } - - $text = ''; - - // TODO - $base_ob = &$contents->getBaseObjectPtr(); - $addr = $base_ob->getFromAddress(); - - $message = new Horde_Mime_Message(); - foreach ($parts as $val) { - $message->addPart($val); - } - - // TODO - $mc = new IMP_Contents($message, array('download' => 'download_attach', 'view' => 'view_attach'), array(&$contents)); - $message->buildMessage(); - - foreach ($message->getParts() as $val) { - /* If the part appears to be nothing but empty space, don't - display it. */ - if (($val->getBytes() < 5) && - !(rtrim($val->getContents()))) { - continue; - } - $v = &$mc->getMIMEViewer($val); - if (!is_a($v, 'IMP_Horde_Mime_Viewer_pgp')) { - $text .= $mc->formatStatusMsg(_("The message below has not been digitally signed or encrypted with PGP."), Horde::img('alerts/warning.png', _("Warning"), '', $GLOBALS['registry']->getImageDir('horde'))); - } - $text .= $mc->renderMIMEPart($val); - } - - return $text; - } - - /** - * Returns the signed data only for a plaintext signed Horde_Mime_Part. - * - * @param Horde_Mime_Part $mime_part The object with a plaintext PGP - * signed message in the contents. - * - * @return string The contents of the signed message. - */ - public function getSignedMessage(&$mime_part) - { - $msg = ''; - - /* Just output signed data - remove all PGP headers. */ - $result = $this->parsePGPData($mime_part->getContents()); - foreach ($result as $block) { - if ($block['type'] == self::ARMOR_SIGNED_MESSAGE) { - $headerSeen = false; - $headerDone = false; - foreach ($block['data'] as $line) { - if ($headerDone) { - $msg .= $line . "\n"; - } elseif (strpos($line, "-----") === 0) { - $headerSeen = true; - continue; - } elseif ($headerSeen) { - /* There are some versions of GnuPG (like Version: - GnuPG v1.2.1 (MingW32)) which separate headers from - content with a line containing a blank, but this - isn't RFC conforming, so this isn't handled. - It results in a good signature with an empty - message. - The wrong code would be: - elseif (empty($line) || (strcmp($line, ' ') == 0)) - */ - $line = trim($line); - if (empty($line)) { - $headerDone = true; - } - } - } - } - } - - return rtrim($msg); - } - - /** * Get a public key via a public PGP keyserver. * * @param string $fingerprint The fingerprint of the requested key. -- 2.11.0