当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Mime::mimeIdArithmetic方法代码示例

本文整理汇总了PHP中Horde_Mime::mimeIdArithmetic方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime::mimeIdArithmetic方法的具体用法?PHP Horde_Mime::mimeIdArithmetic怎么用?PHP Horde_Mime::mimeIdArithmetic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Mime的用法示例。


在下文中一共展示了Horde_Mime::mimeIdArithmetic方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _renderInfo

 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     $mdn_id = $this->_mimepart->getMimeId();
     $parts = array_keys($this->_mimepart->contentTypeMap());
     $status = new IMP_Mime_Status(_("A message you have sent has resulted in a return notification from the recipient."));
     $status->icon('info_icon.png', _("Info"));
     /* RFC 3798 [3]: There are three parts to a delivery status
      * multipart/report message:
      *   (1) Human readable message
      *   (2) Machine parsable body part (message/disposition-notification)
      *   (3) Original message (optional) */
     /* Get the human readable message. */
     reset($parts);
     $part1_id = next($parts);
     /* Display a link to more detailed message. */
     $part2_id = Horde_Mime::mimeIdArithmetic($part1_id, 'next');
     $part = $this->getConfigParam('imp_contents')->getMIMEPart($part2_id);
     if ($part) {
         $status->addText(sprintf(_("Technical details can be viewed %s."), $this->getConfigParam('imp_contents')->linkViewJS($part, 'view_attach', _("HERE"), array('jstext' => _("Technical details"), 'params' => array('ctype' => 'text/plain', 'mode' => IMP_Contents::RENDER_FULL)))));
     }
     $ret[$part2_id] = null;
     /* Display a link to the sent message. */
     $part3_id = Horde_Mime::mimeIdArithmetic($part2_id, 'next');
     $part = $this->getConfigParam('imp_contents')->getMIMEPart($part3_id);
     if ($part) {
         $status->addText(sprintf(_("The text of the sent message can be viewed %s."), $this->getConfigParam('imp_contents')->linkViewJS($part, 'view_attach', _("HERE"), array('jstext' => _("The text of the sent message"), 'params' => array('ctype' => 'message/rfc822', 'mode' => IMP_Contents::RENDER_FULL)))));
         foreach (array_keys($part->contentTypeMap()) as $key) {
             $ret[$key] = null;
         }
     }
     $ret[$mdn_id] = array('data' => '', 'status' => $status, 'type' => 'text/html; charset=' . $this->getConfigParam('charset'), 'wrap' => 'mimePartWrap');
     return $ret;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:38,代码来源:Mdn.php

示例2: _IMPrender

 /**
  * Render the part based on the view mode.
  *
  * @param boolean $inline  True if viewing inline.
  *
  * @return array  See parent::render().
  */
 protected function _IMPrender($inline)
 {
     /* RFC 1740 [4]: There are two parts to an appledouble message:
      *   (1) application/applefile
      *   (2) Data embedded in the Mac file
      * Since the resource fork is not very useful to us, only provide a
      * means to download. */
     /* Display the resource fork download link. */
     $mime_id = $this->_mimepart->getMimeId();
     $parts_list = array_keys($this->_mimepart->contentTypeMap());
     reset($parts_list);
     $applefile_id = next($parts_list);
     $data_id = Horde_Mime::mimeIdArithmetic($applefile_id, 'next');
     $applefile_part = $this->_mimepart->getPart($applefile_id);
     $data_part = $this->_mimepart->getPart($data_id);
     $data_name = $this->getConfigParam('imp_contents')->getPartName($data_part);
     $status = new IMP_Mime_Status(array(sprintf(_("This message contains a Macintosh file (named \"%s\")."), $data_name), sprintf(_("The Macintosh resource fork can be downloaded %s."), $this->getConfigParam('imp_contents')->linkViewJS($applefile_part, 'download_attach', _("HERE"), array('jstext' => _("The Macintosh resource fork"))))));
     $status->icon('mime/apple.png', _("Macintosh File"));
     /* For inline viewing, attempt to display the data inline. */
     $ret = array();
     if ($inline && ($disp = $this->getConfigParam('imp_contents')->canDisplay($data_part, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO))) {
         $ret = $this->getConfigParam('imp_contents')->renderMIMEPart($data_id, $disp);
     }
     foreach ($parts_list as $val) {
         if (!isset($ret[$val]) && strcmp($val, $data_id) !== 0) {
             $ret[$val] = strcmp($val, $mime_id) === 0 ? array('data' => '', 'status' => $status, 'type' => 'text/html; charset=' . $this->getConfigParam('charset'), 'wrap' => 'mimePartWrap') : null;
         }
     }
     return $ret;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:37,代码来源:Appledouble.php

示例3: _buildMailMessage


//.........这里部分代码省略.........
         // check for that.
         if ($version > Horde_ActiveSync::VERSION_FOURTEEN && !empty($options['bodypartprefs'])) {
             $body_part = Horde_ActiveSync::messageFactory('AirSyncBaseBodypart');
             $eas_message->airsyncbasebodypart = $this->_buildBodyPart($mbd, $options, $body_part);
         }
         if ($version > Horde_ActiveSync::VERSION_TWELVEONE) {
             $flags = array();
             $msgFlags = $this->_getMsgFlags();
             foreach ($imap_message->getFlags() as $flag) {
                 if (!empty($msgFlags[Horde_String::lower($flag)])) {
                     $flags[] = $msgFlags[Horde_String::lower($flag)];
                 }
             }
             $eas_message->categories = $flags;
         }
     }
     // Body Preview? Note that this is different from BodyPart's preview
     if ($version >= Horde_ActiveSync::VERSION_FOURTEEN && !empty($options['bodyprefs']['preview'])) {
         $mbd->plain['body']->rewind();
         $eas_message->airsyncbasebody->preview = $mbd->plain['body']->substring(0, $options['bodyprefs']['preview']);
     }
     $mbd = null;
     // Check for special message types.
     if ($imap_message->isEncrypted()) {
         $eas_message->messageclass = 'IPM.Note.SMIME';
     } elseif ($imap_message->isSigned()) {
         $eas_message->messageclass = 'IPM.Note.SMIME.MultipartSigned';
     }
     $part = $imap_message->getStructure();
     if ($part->getType() == 'multipart/report') {
         $ids = array_keys($imap_message->contentTypeMap());
         reset($ids);
         $part1_id = next($ids);
         $part2_id = Horde_Mime::mimeIdArithmetic($part1_id, 'next');
         $lines = explode(chr(13), $imap_message->getBodyPart($part2_id, array('decode' => true)));
         switch ($part->getContentTypeParameter('report-type')) {
             case 'delivery-status':
                 foreach ($lines as $line) {
                     if (strpos(trim($line), 'Action:') === 0) {
                         switch (trim(substr(trim($line), 7))) {
                             case 'failed':
                                 $eas_message->messageclass = 'REPORT.IPM.NOTE.NDR';
                                 break 2;
                             case 'delayed':
                                 $eas_message->messageclass = 'REPORT.IPM.NOTE.DELAYED';
                                 break 2;
                             case 'delivered':
                                 $eas_message->messageclass = 'REPORT.IPM.NOTE.DR';
                                 break 2;
                         }
                     }
                 }
                 break;
             case 'disposition-notification':
                 foreach ($lines as $line) {
                     if (strpos(trim($line), 'Disposition:') === 0) {
                         if (strpos($line, 'displayed') !== false) {
                             $eas_message->messageclass = 'REPORT.IPM.NOTE.IPNRN';
                         } elseif (strpos($line, 'deleted') !== false) {
                             $eas_message->messageclass = 'REPORT.IPM.NOTE.IPNNRN';
                         }
                         break;
                     }
                 }
         }
     }
开发者ID:raz0rsdge,项目名称:horde,代码行数:67,代码来源:Adapter.php

示例4: _IMPrender

 /**
  * Render out the currently set contents.
  *
  * @param boolean $inline  Are we viewing inline?
  *
  * @return array  See parent::render().
  */
 protected function _IMPrender($inline)
 {
     $base_id = $this->_mimepart->getMimeId();
     $subparts = $this->_mimepart->contentTypeMap();
     $display_ids = $ret = array();
     $prefer_plain = $GLOBALS['registry']->getView() == Horde_Registry::VIEW_MINIMAL || $GLOBALS['prefs']->getValue('alternative_display') == 'text';
     /* Look for a displayable part. RFC: show the LAST choice that can be
      * displayed inline. If an alternative is itself a multipart, the user
      * agent is allowed to show that alternative, an earlier alternative,
      * or both. If we find a multipart alternative that contains at least
      * one viewable part, we will display all viewable subparts of that
      * alternative. */
     $imp_contents = $this->getConfigParam('imp_contents');
     foreach ($subparts as $mime_id => $type) {
         $ret[$mime_id] = null;
         if (strcmp($base_id, $mime_id) !== 0 && $imp_contents->canDisplay($mime_id, $inline ? IMP_Contents::RENDER_INLINE : IMP_Contents::RENDER_FULL) && (!$prefer_plain || $type != 'text/html' && strpos($type, 'text/') === 0)) {
             $display_ids[strval($mime_id)] = true;
         }
     }
     /* If we found no IDs, return now. */
     if (empty($display_ids)) {
         $ret[$base_id] = array('data' => '', 'status' => new IMP_Mime_Status(_("There are no alternative parts that can be displayed inline.")), 'type' => 'text/html; charset=' . $this->getConfigParam('charset'));
         return $ret;
     }
     /* If the last viewable message exists in a subpart, back up to the
      * base multipart and display all viewable parts in that multipart.
      * Else, display the single part. */
     end($display_ids);
     $curr_id = key($display_ids);
     while (!is_null($curr_id) && strcmp($base_id, $curr_id) !== 0) {
         if (isset($subparts[$curr_id])) {
             $disp_id = $curr_id;
         }
         $curr_id = Horde_Mime::mimeIdArithmetic($curr_id, 'up');
     }
     /* At this point, $ret contains stubs for all parts living in the base
      * alternative part.
      * Go through all subparts of displayable part and make sure all parts
      * are rendered.  Parts not rendered will be marked as not being
      * handled by this viewer (Bug #9365). */
     $render_part = $this->_mimepart->getPart($disp_id);
     $need_render = $subparts = $render_part->contentTypeMap();
     foreach (array_keys($subparts) as $val) {
         if (isset($display_ids[$val]) && isset($need_render[$val])) {
             $render = $this->getConfigParam('imp_contents')->renderMIMEPart($val, $inline ? IMP_Contents::RENDER_INLINE : IMP_Contents::RENDER_FULL);
             foreach (array_keys($render) as $id) {
                 unset($need_render[$id]);
                 if (!$inline) {
                     if (!is_null($render[$id])) {
                         return array($base_id => $render[$id]);
                     }
                 } else {
                     $ret[$id] = $render[$id];
                 }
             }
         }
     }
     unset($need_render[$disp_id]);
     foreach (array_keys($need_render) as $val) {
         unset($ret[$val]);
     }
     return $inline ? $ret : null;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:70,代码来源:Alternative.php

示例5: _renderInfo

 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     $parts = array_keys($this->_mimepart->contentTypeMap());
     /* RFC 3464 [2]: There are three parts to a delivery status
      * multipart/report message:
      *   (1) Human readable message
      *   (2) Machine parsable body part (message/delivery-status)
      *   (3) Returned message (optional)
      *
      * Information on the message status is found in the 'Action' field
      * located in part #2 (RFC 3464 [2.3.3]). It can be either 'failed',
      * 'delayed', 'delivered', 'relayed', or 'expanded'. */
     if (count($parts) < 2) {
         return array();
     }
     reset($parts);
     $part1_id = next($parts);
     $part2_id = Horde_Mime::mimeIdArithmetic($part1_id, 'next');
     $part3_id = Horde_Mime::mimeIdArithmetic($part2_id, 'next');
     /* Get the action first - it appears in the second part. */
     $action = null;
     $part2 = $this->getConfigParam('imp_contents')->getMIMEPart($part2_id);
     foreach (explode("\n", $part2->getContents()) as $line) {
         if (stristr($line, 'Action:') !== false) {
             $action = strtolower(trim(substr($line, strpos($line, ':') + 1)));
             if (strpos($action, ' ') !== false) {
                 $action = substr($action, 0, strpos($action, ' '));
             }
             break;
         }
     }
     if (is_null($action)) {
         return array();
     }
     /* Get the correct text strings for the action type. */
     switch ($action) {
         case 'failed':
         case 'delayed':
             $status = new IMP_Mime_Status(array(_("ERROR: Your message could not be delivered."), sprintf(_("Technical error details can be viewed %s."), $this->getConfigParam('imp_contents')->linkViewJS($part2, 'view_attach', _("HERE"), array('jstext' => _("Technical details"), 'params' => array('ctype' => 'text/plain', 'mode' => IMP_Contents::RENDER_FULL))))));
             $status->action(IMP_Mime_Status::ERROR);
             $msg_link = _("The text of the returned message can be viewed %s.");
             $msg_link_status = _("The text of the returned message");
             break;
         case 'delivered':
         case 'expanded':
         case 'relayed':
             $status = new IMP_Mime_Status(array(_("Your message was successfully delivered."), sprintf(_("Technical message details can be viewed %s."), $this->getConfigParam('imp_contents')->linkViewJS($part2, 'view_attach', _("HERE"), array('jstext' => _("Technical details"), 'params' => array('ctype' => 'text/x-simple', 'mode' => IMP_Contents::RENDER_FULL))))));
             $status->action(IMP_Mime_Status::SUCCESS);
             $msg_link = _("The text of the message can be viewed %s.");
             $msg_link_status = _("The text of the message");
             break;
         default:
             return array();
     }
     /* Display a link to the returned message, if it exists. */
     $part3 = $this->getConfigParam('imp_contents')->getMIMEPart($part3_id);
     if ($part3) {
         $status->addText(sprintf($msg_link, $this->getConfigParam('imp_contents')->linkViewJS($part3, 'view_attach', _("HERE"), array('jstext' => $msg_link_status, 'params' => array('ctype' => 'message/rfc822')))));
     }
     $ret = array_fill_keys(array_diff($parts, array($part1_id)), null);
     $ret[$this->_mimepart->getMimeId()] = array('data' => '', 'status' => $status, 'type' => 'text/html; charset=' . $this->getConfigParam('charset'), 'wrap' => 'mimePartWrap');
     return $ret;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:68,代码来源:Status.php

示例6: _outputPGPSigned

 /**
  * Generates HTML output for 'multipart/signed' MIME parts.
  *
  * @return string  The HTML output.
  */
 protected function _outputPGPSigned()
 {
     global $conf, $injector, $prefs, $registry, $session;
     $partlist = array_keys($this->_mimepart->contentTypeMap());
     $base_id = reset($partlist);
     $signed_id = next($partlist);
     $sig_id = Horde_Mime::mimeIdArithmetic($signed_id, 'next');
     if (!$prefs->getValue('use_pgp') || empty($conf['gnupg']['path'])) {
         return array($sig_id => null);
     }
     $status = new IMP_Mime_Status();
     $status->addText(_("The data in this part has been digitally signed via PGP."));
     $status->icon('mime/encryption.png', 'PGP');
     $ret = array($base_id => array('data' => '', 'nosummary' => true, 'status' => array($status), 'type' => 'text/html; charset=' . $this->getConfigParam('charset'), 'wrap' => 'mimePartWrap'), $sig_id => null);
     if ($prefs->getValue('pgp_verify') || $injector->getInstance('Horde_Variables')->pgp_verify_msg) {
         $imp_contents = $this->getConfigParam('imp_contents');
         $sig_part = $imp_contents->getMIMEPart($sig_id);
         $status2 = new IMP_Mime_Status();
         if (!$sig_part) {
             $status2->action(IMP_Mime_Status::ERROR);
             $sig_text = _("This digitally signed message is broken.");
             $ret[$base_id]['wrap'] = 'mimePartWrapInvalid';
         } else {
             /* Close session, since this may be a long-running
              * operation. */
             $session->close();
             try {
                 $imp_pgp = $injector->getInstance('IMP_Crypt_Pgp');
                 if ($sig_raw = $sig_part->getMetadata(Horde_Crypt_Pgp_Parse::SIG_RAW)) {
                     $sig_result = $imp_pgp->verifySignature($sig_raw, $this->_getSender()->bare_address, null, $sig_part->getMetadata(Horde_Crypt_Pgp_Parse::SIG_CHARSET));
                 } else {
                     $stream = $imp_contents->isEmbedded($signed_id) ? $this->_mimepart->getMetadata(self::PGP_SIGN_ENC) : $imp_contents->getBodyPart($signed_id, array('mimeheaders' => true, 'stream' => true))->data;
                     rewind($stream);
                     stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol');
                     stream_filter_append($stream, 'horde_eol', STREAM_FILTER_READ, array('eol' => Horde_Mime_Part::RFC_EOL));
                     $sig_result = $imp_pgp->verifySignature(stream_get_contents($stream), $this->_getSender()->bare_address, $sig_part->getContents());
                 }
                 $status2->action(IMP_Mime_Status::SUCCESS);
                 $sig_text = $sig_result->message;
                 $ret[$base_id]['wrap'] = 'mimePartWrapValid';
             } catch (Horde_Exception $e) {
                 $status2->action(IMP_Mime_Status::ERROR);
                 $sig_text = $e->getMessage();
                 $ret[$base_id]['wrap'] = 'mimePartWrapInvalid';
             }
         }
         $status2->addText($this->_textFilter($sig_text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::NOHTML)));
         $ret[$base_id]['status'][] = $status2;
     } else {
         switch ($registry->getView()) {
             case Horde_Registry::VIEW_BASIC:
                 $status->addText(Horde::link(Horde::selfUrlParams()->add(array('pgp_verify_msg' => 1))) . _("Click HERE to verify the message.") . '</a>');
                 break;
             case Horde_Registry::VIEW_DYNAMIC:
                 $status->addText(Horde::link('#', '', 'pgpVerifyMsg') . _("Click HERE to verify the message.") . '</a>');
                 break;
         }
     }
     return $ret;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:65,代码来源:Pgp.php

示例7: toString

 /**
  * Return the entire part in MIME format.
  *
  * @param array $options  Additional options:
  *   - canonical: (boolean) Returns the encoded part in strict RFC 822 &
  *                2045 output - namely, all newlines end with the
  *                canonical <CR><LF> sequence.
  *                DEFAULT: false
  *   - defserver: (string) The default server to use when creating the
  *                header string.
  *                DEFAULT: none
  *   - encode: (integer) A mask of allowable encodings.
  *             DEFAULT: self::ENCODE_7BIT
  *   - headers: (mixed) Include the MIME headers? If true, create a new
  *              headers object. If a Horde_Mime_Headers object, add MIME
  *              headers to this object. If a string, use the string
  *              verbatim.
  *              DEFAULT: true
  *   - id: (string) Return only this MIME ID part.
  *         DEFAULT: Returns the base part.
  *   - stream: (boolean) Return a stream resource.
  *             DEFAULT: false
  *
  * @return mixed  The MIME string (returned as a resource if $stream is
  *                true).
  */
 public function toString($options = array())
 {
     $eol = $this->getEOL();
     $isbase = true;
     $oldbaseptr = null;
     $parts = $parts_close = array();
     if (isset($options['id'])) {
         $id = $options['id'];
         if (!($part = $this[$id])) {
             return $part;
         }
         unset($options['id']);
         $contents = $part->toString($options);
         $prev_id = Horde_Mime::mimeIdArithmetic($id, 'up', array('norfc822' => true));
         $prev_part = $prev_id == $this->getMimeId() ? $this : $this[$prev_id];
         if (!$prev_part) {
             return $contents;
         }
         $boundary = trim($this->getContentTypeParameter('boundary'), '"');
         $parts = array($eol . '--' . $boundary . $eol, $contents);
         if (!isset($this[Horde_Mime::mimeIdArithmetic($id, 'next')])) {
             $parts[] = $eol . '--' . $boundary . '--' . $eol;
         }
     } else {
         if ($isbase = empty($options['_notbase'])) {
             $headers = !empty($options['headers']) ? $options['headers'] : false;
             if (empty($options['encode'])) {
                 $options['encode'] = null;
             }
             if (empty($options['defserver'])) {
                 $options['defserver'] = null;
             }
             $options['headers'] = true;
             $options['_notbase'] = true;
         } else {
             $headers = true;
             $oldbaseptr =& $options['_baseptr'];
         }
         $this->_temp['toString'] = '';
         $options['_baseptr'] =& $this->_temp['toString'];
         /* Any information about a message is embedded in the message
          * contents themself. Simply output the contents of the part
          * directly and return. */
         $ptype = $this->getPrimaryType();
         if ($ptype == 'message') {
             $parts[] = $this->_contents;
         } else {
             if (!empty($this->_contents)) {
                 $encoding = $this->_getTransferEncoding($options['encode']);
                 switch ($encoding) {
                     case '8bit':
                         if (empty($options['_baseptr'])) {
                             $options['_baseptr'] = '8bit';
                         }
                         break;
                     case 'binary':
                         $options['_baseptr'] = 'binary';
                         break;
                 }
                 $parts[] = $this->_transferEncode($this->_contents, $encoding);
                 /* If not using $this->_contents, we can close the stream
                  * when finished. */
                 if ($this->_temp['transferEncodeClose']) {
                     $parts_close[] = end($parts);
                 }
             }
             /* Deal with multipart messages. */
             if ($ptype == 'multipart') {
                 if (empty($this->_contents)) {
                     $parts[] = 'This message is in MIME format.' . $eol;
                 }
                 $boundary = trim($this->getContentTypeParameter('boundary'), '"');
                 /* If base part is multipart/digest, children should not
                  * have content-type (automatically treated as
//.........这里部分代码省略.........
开发者ID:x59,项目名称:horde-mime,代码行数:101,代码来源:Part.php

示例8: _parseSignedData

 /**
  * Parse signed data.
  *
  * @param boolean $sig_only  Only do signature checking?
  *
  * @return mixed  See self::_getEmbeddedMimeParts().
  */
 protected function _parseSignedData($sig_only = false)
 {
     $partlist = array_keys($this->_mimepart->contentTypeMap());
     $base_id = reset($partlist);
     $data_id = next($partlist);
     $sig_id = Horde_Mime::mimeIdArithmetic($data_id, 'next');
     /* Initialize inline data. */
     $status = new IMP_Mime_Status(_("The data in this part has been digitally signed via S/MIME."));
     $status->icon('mime/encryption.png', 'S/MIME');
     $cache = $this->getConfigParam('imp_contents')->getViewCache();
     $cache->smime[$base_id] = array('sig' => $sig_id, 'status' => $status, 'wrap' => 'mimePartWrap');
     if (!$GLOBALS['prefs']->getValue('use_smime')) {
         $status->addText(_("S/MIME support is not enabled so the digital signature is unable to be verified."));
         return null;
     }
     /* Sanity checking to make sure MIME structure is correct. */
     if (!in_array($sig_id, $partlist)) {
         $status->action(IMP_Mime_Status::ERROR);
         $cache->smime[$base_id]['wrap'] = 'mimePartWrapInvalid';
         $status->addText(_("Invalid S/MIME data."));
         /* This will suppress displaying the invalid part. */
         $cache->smime[$base_id]['sig'] = $data_id;
         return null;
     }
     $imp_contents = $this->getConfigParam('imp_contents');
     $stream = $imp_contents->isEmbedded($base_id) ? $this->_mimepart->getMetadata('imp-smime-decrypt')->stream : $this->_getPartStream($base_id);
     $raw_text = $this->_mimepart->replaceEOL($stream, Horde_Mime_Part::RFC_EOL);
     $this->_initSmime();
     $sig_result = null;
     if ($GLOBALS['prefs']->getValue('smime_verify') || $GLOBALS['injector']->getInstance('Horde_Variables')->smime_verify_msg) {
         try {
             $sig_result = $this->_impsmime->verifySignature($raw_text);
             if ($sig_result->verify) {
                 $status->action(IMP_Mime_Status::SUCCESS);
             } else {
                 $status->action(IMP_Mime_Status::WARNING);
             }
             $cache->smime[$base_id]['wrap'] = 'mimePartWrapValid';
             $email = is_array($sig_result->email) ? implode(', ', $sig_result->email) : $sig_result->email;
             $status->addText($sig_result->msg);
             if (!empty($sig_result->cert)) {
                 $cert = $this->_impsmime->parseCert($sig_result->cert);
                 if (isset($cert['certificate']['subject']['CommonName']) && strcasecmp($email, $cert['certificate']['subject']['CommonName']) !== 0) {
                     $email = $cert['certificate']['subject']['CommonName'] . ' (' . trim($email) . ')';
                 }
             }
             if (!empty($sig_result->cert) && isset($sig_result->email) && $GLOBALS['registry']->hasMethod('contacts/addField') && $GLOBALS['prefs']->getValue('add_source')) {
                 $status->addText(sprintf(_("Sender: %s"), $imp_contents->linkViewJS($this->_mimepart, 'view_attach', htmlspecialchars(strlen($email) ? $email : $sig_result->email), array('jstext' => _("View certificate details"), 'params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1)))));
                 try {
                     $this->_impsmime->getPublicKey($sig_result->email);
                 } catch (Horde_Exception $e) {
                     $imple = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_ImportEncryptKey', array('mime_id' => $base_id, 'muid' => strval($imp_contents->getIndicesOb()), 'type' => 'smime'));
                     $status->addText(Horde::link('#', '', '', '', '', '', '', array('id' => $imple->getDomId())) . _("Save the certificate to your Address Book.") . '</a>');
                 }
             } elseif (strlen($email)) {
                 $status->addText(sprintf(_("Sender: %s"), htmlspecialchars($email)));
             }
         } catch (Horde_Exception $e) {
             $status->action(IMP_Mime_Status::ERROR);
             $cache->smime[$base_id]['wrap'] = 'mimePartWrapInvalid';
             $status->addText($e->getMessage());
         }
     } else {
         switch ($GLOBALS['registry']->getView()) {
             case Horde_Registry::VIEW_BASIC:
                 $status->addText(Horde::link(Horde::selfUrlParams()->add('smime_verify_msg', 1)) . _("Click HERE to verify the data.") . '</a>');
                 break;
             case Horde_Registry::VIEW_DYNAMIC:
                 $status->addText(Horde::link('#', '', 'smimeVerifyMsg') . _("Click HERE to verify the data.") . '</a>');
                 break;
         }
     }
     if ($sig_only) {
         return;
     }
     $subpart = $imp_contents->getMIMEPart($sig_id);
     if (empty($subpart)) {
         try {
             $msg_data = $this->_impsmime->extractSignedContents($raw_text);
             $subpart = Horde_Mime_Part::parseMessage($msg_data, array('forcemime' => true));
         } catch (Horde_Exception $e) {
             $status->addText($e->getMessage());
             return null;
         }
     }
     return $subpart;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:94,代码来源:Smime.php

示例9: findMimeType

 /**
  * Find a MIME type in parent parts.
  *
  * @param string $id    The MIME ID to begin the search at.
  * @param string $type  The MIME type to search for.
  *
  * @return mixed  Either the requested MIME part, or null if not found.
  */
 public function findMimeType($id, $type)
 {
     $id = Horde_Mime::mimeIdArithmetic($id, 'up');
     while (!is_null($id)) {
         if (($part = $this->getMIMEPart($id, array('nocontents' => true))) && $part->getType() == $type) {
             return $part;
         }
         $id = Horde_Mime::mimeIdArithmetic($id, 'up');
     }
     return null;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:19,代码来源:Contents.php


注:本文中的Horde_Mime::mimeIdArithmetic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。