• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Horde_Mime类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _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


示例2: _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


示例3: __construct

 /**
  * Constructor.
  *
  * @param string $str  The subject string.
  * @param array $opts  Additional options:
  *   - keepblob: (boolean) Don't remove any "blob" information (i.e. text
  *               leading text between square brackets) from string.
  *
  * @return string  The cleaned up subject string.
  */
 public function __construct($str, array $opts = array())
 {
     // Rule 1a: MIME decode.
     $str = Horde_Mime::decode($str);
     // Rule 1b: Remove superfluous whitespace.
     $str = preg_replace("/[\t\r\n ]+/", ' ', $str);
     do {
         /* (2) Remove all trailing text of the subject that matches the
          * the subj-trailer ABNF, repeat until no more matches are
          * possible. */
         $str = preg_replace("/(?:\\s*\\(fwd\\)\\s*)+\$/i", '', $str);
         do {
             /* (3) Remove all prefix text of the subject that matches the
              * subj-leader ABNF. */
             $found = $this->_removeSubjLeader($str, !empty($opts['keepblob']));
             /* (4) If there is prefix text of the subject that matches
              * the subj-blob ABNF, and removing that prefix leaves a
              * non-empty subj-base, then remove the prefix text. */
             $found = empty($opts['keepblob']) && $this->_removeBlobWhenNonempty($str) || $found;
             /* (5) Repeat (3) and (4) until no matches remain. */
         } while ($found);
         /* (6) If the resulting text begins with the subj-fwd-hdr ABNF and
          * ends with the subj-fwd-trl ABNF, remove the subj-fwd-hdr and
          * subj-fwd-trl and repeat from step (2). */
     } while ($this->_removeSubjFwdHdr($str));
     $this->_subject = strval($str);
 }
开发者ID:horde,项目名称:horde,代码行数:37,代码来源:BaseSubject.php


示例4: _setValue

 /**
  */
 protected function _setValue($value)
 {
     if ($value instanceof Horde_Mime_Headers_Element) {
         $value = $value->value;
     } elseif (is_array($value)) {
         $value = reset($value);
     }
     $this->_values = array($this->_sanityCheck(Horde_Mime::decode($value)));
 }
开发者ID:x59,项目名称:horde-mime,代码行数:11,代码来源:Single.php


示例5: _setValue

 /**
  */
 protected function _setValue($value)
 {
     if ($value instanceof Horde_Mime_Headers_Element) {
         $value = $value->value;
     }
     foreach (is_array($value) ? $value : array($value) as $val) {
         $this->_values[] = $this->_sanityCheck(Horde_Mime::decode($val));
     }
 }
开发者ID:x59,项目名称:horde-mime,代码行数:11,代码来源:Multiple.php


示例6: _setValue

 /**
  * @param mixed $value  Either a single language or an array of languages.
  */
 protected function _setValue($value)
 {
     if ($value instanceof Horde_Mime_Headers_Element) {
         $value = $value->value;
     }
     if (!is_array($value)) {
         $value = array_map('trim', explode(',', $value));
     }
     $this->_values = array();
     foreach ($value as $val) {
         $this->_values[] = Horde_String::lower($this->_sanityCheck(Horde_Mime::decode($val)));
     }
 }
开发者ID:x59,项目名称:horde-mime,代码行数:16,代码来源:ContentLanguage.php


示例7: testGenerate

    public function testGenerate()
    {
        $h = new Horde_Mime_Headers();
        $ob = new Horde_Mime_Mdn($h);
        try {
            $ob->generate(true, true, 'deleted', 'foo', null);
            $this->fail('Expected Exception');
        } catch (RuntimeException $e) {
        }
        $date = 'Tue, 18 Nov 2014 20:14:17 -0700';
        $mdn_addr = 'Aäb <[email protected]>';
        $h->addHeader('Date', $date);
        $h->addHeader('Subject', 'Test');
        $h->addHeader('To', '"BAR" <[email protected]>');
        $ob->addMdnRequestHeaders($mdn_addr);
        $mailer = new Horde_Mail_Transport_Mock();
        $ob->generate(true, true, 'displayed', 'test.example.com', $mailer, array('from_addr' => '[email protected]'), array('error'), array('error' => 'Foo'));
        $sent = str_replace("\r\n", "\n", $mailer->sentMessages[0]);
        $this->assertEquals('auto-replied', $sent['headers']['Auto-Submitted']);
        $this->assertEquals('[email protected]', $sent['headers']['From']);
        $this->assertEquals($mdn_addr, Horde_Mime::decode($sent['headers']['To']));
        $this->assertEquals('Disposition Notification', $sent['headers']['Subject']);
        $this->assertStringMatchesFormat('This message is in MIME format.

--=%s
Content-Type: text/plain; format=flowed; DelSp=Yes

The message sent on Tue, 18 Nov 2014 20:14:17 -0700 to BAR  
<[email protected]> with subject "Test" has been displayed.

This is no guarantee that the message has been read or understood.

--=%s
Content-Type: message/disposition-notification

Reporting-UA: test.example.com; Horde Application Framework 5
Final-Recipient: rfc822;[email protected]
Disposition: manual-action/MDN-sent-manually; displayed/error
Error: Foo

--=%s
Content-Type: message/rfc822

Date: Tue, 18 Nov 2014 20:14:17 -0700
Subject: Test
To: BAR <[email protected]>
Disposition-Notification-To: =?utf-8?b?QcOkYg==?= <[email protected]>

--=%s
', $sent['body']);
    }
开发者ID:raz0rsdge,项目名称:horde,代码行数:51,代码来源:NonTranslatedTest.php


示例8: _parseStructureParams

 /**
  * Helper function to parse a parameters-like tokenized array.
  *
  * @param array $data   The tokenized data.
  * @param string $type  The header name.
  *
  * @return array  The parameter array.
  */
 protected function _parseStructureParams($data, $type)
 {
     $params = array();
     if (is_array($data)) {
         for ($i = 0, $cnt = count($data); $i < $cnt; ++$i) {
             $params[Horde_String::lower($data[$i])] = $data[++$i];
         }
     }
     $ret = Horde_Mime::decodeParam($type, $params);
     return $ret['params'];
 }
开发者ID:horde,项目名称:horde,代码行数:19,代码来源:Rcube.php


示例9: __construct

 /**
  * Constructs a new procmail recipe.
  *
  * @param array $params        Array of parameters.
  *                               REQUIRED FIELDS:
  *                                'action'
  *                               OPTIONAL FIELDS:
  *                                'action-value' (only used if the
  *                                'action' requires it)
  *                                'disable'
  * @param array $scriptparams  Array of parameters passed to
  *                             Ingo_Script_Procmail.
  */
 public function __construct($params = array(), $scriptparams = array())
 {
     $this->_disable = !empty($params['disable']);
     $this->_params = array_merge($this->_params, $scriptparams);
     $delivery = '| ';
     if (isset($this->_params['delivery_agent'])) {
         $delivery .= $this->_params['delivery_agent'] . ' ';
     }
     if (isset($this->_params['delivery_mailbox_prefix'])) {
         $delivery .= ' ' . $this->_params['delivery_mailbox_prefix'];
     }
     switch ($params['action']) {
         case 'Ingo_Rule_User_Keep':
             // Note: you may have to set the DEFAULT variable in your
             // backend configuration.
             $this->_action[] = $delivery .= '$DEFAULT';
             break;
         case 'Ingo_Rule_User_Move':
             $this->_action[] = $delivery .= $this->procmailPath($params['action-value']);
             break;
         case 'Ingo_Rule_User_Discard':
             $this->_action[] = '/dev/null';
             break;
         case 'Ingo_Rule_User_Redirect':
             $this->_action[] = '! ' . $params['action-value'];
             break;
         case 'Ingo_Rule_User_RedirectKeep':
             $this->_action[] = '{';
             $this->_action[] = '  :0 c';
             $this->_action[] = '  ! ' . $params['action-value'];
             if (strpos($this->_flags, 'c') === false) {
                 $this->_action[] = '';
                 $this->_action[] = '  :0' . (isset($this->_params['delivery_agent']) ? ' w' : '');
                 $this->_action[] = '  ' . $delivery . '$DEFAULT';
             }
             $this->_action[] = '}';
             break;
         case 'Ingo_Rule_User_Reject':
             $this->_action[] = '{';
             $this->_action[] = '  :0 h';
             $this->_action[] = '  SUBJECT=| formail -xSubject:';
             $this->_action[] = '';
             $this->_action[] = '  :0 h';
             $this->_action[] = '  SENDER=| formail -zxFrom:';
             $this->_action[] = '';
             $this->_action[] = '  :0 Wh';
             $this->_action[] = '  * !^FROM_DAEMON';
             $this->_action[] = '  * !^X-Loop: $SENDER';
             $this->_action[] = '  | (formail -rA"X-Loop: $SENDER" \\';
             $reason = $params['action-value'];
             if (Horde_Mime::is8bit($reason)) {
                 $this->_action[] = '    -i"Subject: Re: $SUBJECT" \\';
                 $this->_action[] = '    -i"Content-Transfer-Encoding: quoted-printable" \\';
                 $this->_action[] = '    -i"Content-Type: text/plain; charset=UTF-8" ; \\';
                 $reason = Horde_Mime_QuotedPrintable::encode($reason);
             } else {
                 $this->_action[] = '    -i"Subject: Re: $SUBJECT" ; \\';
             }
             $reason = addcslashes($reason, "\\\n\r\t\"`");
             $this->_action[] = '    ' . $this->_params['echo'] . ' -e "' . $reason . '" \\';
             $this->_action[] = '  ) | $SENDMAIL -oi -t';
             $this->_action[] = '}';
             break;
         case 'Ingo_Rule_System_Vacation':
             $days = $params['action-value']['days'];
             $timed = !empty($params['action-value']['start']) && !empty($params['action-value']['end']);
             $this->_action[] = '{';
             foreach ($params['action-value']['addresses'] as $address) {
                 if (empty($address)) {
                     continue;
                 }
                 $this->_action[] = '  :0';
                 $this->_action[] = '  * ^TO_' . $address;
                 $this->_action[] = '  {';
                 $this->_action[] = '    FILEDATE=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && ' . $this->_params['ls'] . ' -lcn --time-style=+%s ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' | ' . 'awk \'{ print $6 + (' . $days * 86400 . ') }\'`';
                 $this->_action[] = '    DATE=`' . $this->_params['date'] . ' +%s`';
                 $this->_action[] = '    DUMMY=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && ' . 'test $FILEDATE -le $DATE && ' . 'rm ${VACATION_DIR:-.}/\'.vacation.' . $address . '\'`';
                 if ($timed) {
                     $this->_action[] = '    START=' . $params['action-value']['start'];
                     $this->_action[] = '    END=' . $params['action-value']['end'];
                 }
                 $this->_action[] = '';
                 $this->_action[] = '    :0 h';
                 $this->_action[] = '    SUBJECT=| formail -xSubject:';
                 $this->_action[] = '';
                 $this->_action[] = '    :0 Whc: ${VACATION_DIR:-.}/vacation.lock';
                 if ($timed) {
//.........这里部分代码省略.........
开发者ID:platolin,项目名称:horde,代码行数:101,代码来源:Recipe.php


示例10: _parseUUencode

 /**
  * Scan text for UUencode data an, if it exists, convert the part to the
  * embedded MIME representation.
  *
  * @return mixed  See self::_getEmbeddedMimeParts().
  */
 protected function _parseUUencode()
 {
     $text = Horde_String::convertCharset($this->_mimepart->getContents(), $this->_mimepart->getCharset(), 'UTF-8');
     $files = Horde_Mime::uudecode($text);
     if (empty($files)) {
         return null;
     }
     $new_part = new Horde_Mime_Part();
     $new_part->setType('multipart/mixed');
     $text_part = new Horde_Mime_Part();
     $text_part->setType('text/plain');
     $text_part->setCharset($this->getConfigParam('charset'));
     $text_part->setContents(preg_replace("/begin [0-7]{3} .+\r?\n.+\r?\nend/Us", "\n", $text));
     $new_part->addPart($text_part);
     reset($files);
     while (list(, $file) = each($files)) {
         $uupart = new Horde_Mime_Part();
         $uupart->setType('application/octet-stream');
         $uupart->setContents($file['data']);
         $uupart->setName(strip_tags($file['name']));
         $new_part->addPart($uupart);
     }
     return $new_part;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:30,代码来源:Plain.php


示例11: _parseStructure

 /**
  * Parse the output from imap_fetchstructure() into a MIME Part object.
  *
  * @param object $data  Data from imap_fetchstructure().
  *
  * @return Horde_Mime_Part  A MIME Part object.
  */
 protected function _parseStructure($data)
 {
     $ob = new Horde_Mime_Part();
     $ob->setType(Horde_String::lower($data->type) . '/' . Horde_String::lower($data->subType));
     // Optional for multipart-parts, required for all others
     if (isset($data->parameters)) {
         $params = array();
         foreach ($data->parameters as $key => $value) {
             $params[Horde_String::lower($key)] = $value;
         }
         $params = Horde_Mime::decodeParam('content-type', $params);
         foreach ($params['params'] as $key => $value) {
             $ob->setContentTypeParameter($key, $value);
         }
     }
     // Optional entries. 'location' and 'language' not supported
     if (isset($data->disposition)) {
         $ob->setDisposition($data->disposition);
         if (isset($data->dparameters)) {
             $dparams = array();
             foreach ($data->dparameters as $key => $value) {
                 $dparams[Horde_String::lower($key)] = $value;
             }
             $dparams = Horde_Mime::decodeParam('content-disposition', $dparams);
             foreach ($dparams['params'] as $key => $value) {
                 $ob->setDispositionParameter($key, $value);
             }
         }
     }
     if ($ob->getPrimaryType() == 'multipart') {
         // multipart/* specific entries
         foreach ($data->subParts as $val) {
             $ob->addPart($this->_parseStructure($val));
         }
     } else {
         // Required options
         if (isset($data->partID)) {
             $ob->setContentId($data->partID);
         }
         $ob->setTransferEncoding(Horde_String::lower($data->encoding));
         $ob->setBytes($data->bytes);
         if ($ob->getType() == 'message/rfc822') {
             $ob->addPart($this->_parseStructure(reset($data->subParts)));
         }
     }
     return $ob;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:54,代码来源:Pear.php


示例12: _writeAddress

 /**
  */
 protected function _writeAddress($opts)
 {
     $addr = $this->addresses->writeAddress($opts);
     $groupname = $this->groupname;
     if (!empty($opts['encode'])) {
         $groupname = Horde_Mime::encode($groupname, $opts['encode']);
     }
     $rfc822 = new Horde_Mail_Rfc822();
     return $rfc822->encode($groupname, 'personal') . ':' . (strlen($addr) ? ' ' . $addr : '') . ';';
 }
开发者ID:netcon-source,项目名称:apps,代码行数:12,代码来源:Group.php


示例13: _writeAddress

 /**
  */
 protected function _writeAddress($opts)
 {
     $rfc822 = new Horde_Mail_Rfc822();
     $address = $rfc822->encode($this->mailbox, 'address');
     $host = empty($opts['idn']) ? $this->host : $this->host_idn;
     if (strlen($host)) {
         $address .= '@' . $host;
     }
     $personal = $this->personal;
     if (strlen($personal)) {
         if (!empty($opts['encode'])) {
             $personal = Horde_Mime::encode($this->personal, $opts['encode']);
         }
         if (empty($opts['noquote'])) {
             $personal = $rfc822->encode($personal, 'personal');
         }
     }
     if (!empty($opts['comment']) && !empty($this->comment)) {
         foreach ($this->comment as $val) {
             $personal .= ' (' . $rfc822->encode($val, 'comment') . ')';
         }
     }
     return strlen($personal) && $personal != $address ? ltrim($personal) . ' <' . $address . '>' : $address;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:26,代码来源:Address.php


示例14: _parseStructureParams

 /**
  * Helper function to parse a parameters-like tokenized array.
  *
  * @param mixed $data   Message data. Either a Horde_Imap_Client_Tokenize
  *                      object or null.
  * @param string $type  The header name.
  *
  * @return array  The parameter array.
  */
 protected function _parseStructureParams($data, $type)
 {
     $params = array();
     if (is_null($data)) {
         return $params;
     }
     while (($name = $data->next()) !== false) {
         $params[strtolower($name)] = $data->next();
     }
     $ret = Horde_Mime::decodeParam($type, $params);
     return $ret['params'];
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:21,代码来源:Socket.php


示例15: _perform


//.........这里部分代码省略.........
                         case Ingo_Rule_User::COMBINE_ALL:
                             $query->andSearch(array($ob));
                             break;
                         case Ingo_Rule_User::COMBINE_ANY:
                             $query->orSearch(array($ob));
                             break;
                     }
                 }
                 $base_query->andSearch(array($query));
                 $indices = $api->search($base_query);
                 if ($indices = array_diff($indices, $ignore_ids)) {
                     if ($rule->stop) {
                         /* If the stop action is set, add these
                          * indices to the list of ids that will be
                          * ignored by subsequent rules. */
                         $ignore_ids = array_unique($indices + $ignore_ids);
                     }
                     /* Set the flags. */
                     if ($class !== 'Ingo_Rule_User_Discard') {
                         $flags = array();
                         if ($rule->flags & Ingo_Rule_User::FLAG_ANSWERED) {
                             $flags[] = '\\answered';
                         }
                         if ($rule->flags & Ingo_Rule_User::FLAG_DELETED) {
                             $flags[] = '\\deleted';
                         }
                         if ($rule->flags & Ingo_Rule_User::FLAG_FLAGGED) {
                             $flags[] = '\\flagged';
                         }
                         if ($rule->flags & Ingo_Rule_User::FLAG_SEEN) {
                             $flags[] = '\\seen';
                         }
                         if (!empty($flags)) {
                             $api->setMessageFlags($indices, $flags);
                         }
                     }
                     switch ($class) {
                         case 'Ingo_Rule_User_Keep':
                             /* Add these indices to the ignore list. */
                             $ignore_ids = array_unique($indices + $ignore_ids);
                             break;
                         case 'Ingo_Rule_User_Move':
                             /* We need to grab the envelope first. */
                             if ($this->_params['show_filter_msg'] && !($fetch = $api->fetchEnvelope($indices))) {
                                 continue 2;
                             }
                             $mbox = new Horde_Imap_Client_Mailbox($rule->value);
                             /* Move the messages to the requested mailbox. */
                             $api->moveMessages($indices, strval($mbox));
                             /* Display notification message(s). */
                             if ($this->_params['show_filter_msg']) {
                                 foreach ($fetch as $msg) {
                                     $envelope = $msg->getEnvelope();
                                     $notification->push(sprintf(_("Filter activity: The message \"%s\" from \"%s\" has been moved to the folder \"%s\"."), !empty($envelope->subject) ? Horde_Mime::decode($envelope->subject) : _("[No Subject]"), !empty($envelope->from) ? strval($envelope->from) : _("[No Sender]"), $mbox), 'horde.message');
                                 }
                             } else {
                                 $notification->push(sprintf(_("Filter activity: %s message(s) have been moved to the folder \"%s\"."), count($indices), $mbox), 'horde.message');
                             }
                             break;
                         case 'Ingo_Rule_User_Discard':
                             /* We need to grab the envelope first. */
                             if ($this->_params['show_filter_msg'] && !($fetch = $api->fetchEnvelope($indices))) {
                                 continue;
                             }
                             /* Delete the messages now. */
                             $api->deleteMessages($indices);
                             /* Display notification message(s). */
                             if ($this->_params['show_filter_msg']) {
                                 foreach ($fetch as $msg) {
                                     $envelope = $msg->getEnvelope();
                                     $notification->push(sprintf(_("Filter activity: The message \"%s\" from \"%s\" has been deleted."), !empty($envelope->subject) ? Horde_Mime::decode($envelope->subject) : _("[No Subject]"), !empty($envelope->from) ? strval($envelope->from) : _("[No Sender]")), 'horde.message');
                                 }
                             } else {
                                 $notification->push(sprintf(_("Filter activity: %s message(s) have been deleted."), count($indices)), 'horde.message');
                             }
                             break;
                         case 'Ingo_Rule_User_MoveKeep':
                             $mbox = new Horde_Imap_Client_Mailbox($rule->value);
                             /* Copy the messages to the requested mailbox. */
                             $api->copyMessages($indices, strval($mbox));
                             /* Display notification message(s). */
                             if ($this->_params['show_filter_msg']) {
                                 if (!($fetch = $api->fetchEnvelope($indices))) {
                                     continue;
                                 }
                                 foreach ($fetch as $msg) {
                                     $envelope = $msg->getEnvelope();
                                     $notification->push(sprintf(_("Filter activity: The message \"%s\" from \"%s\" has been copied to the folder \"%s\"."), !empty($envelope->subject) ? Horde_Mime::decode($envelope->subject) : _("[No Subject]"), !empty($envelope->from) ? strval($envelope->from) : _("[No Sender]"), $mbox), 'horde.message');
                                 }
                             } else {
                                 $notification->push(sprintf(_("Filter activity: %s message(s) have been copied to the folder \"%s\"."), count($indices), $mbox), 'horde.message');
                             }
                     }
                 }
                 break;
         }
     }
     /* Set cache flag. */
     $api->storeCache($change);
 }
开发者ID:horde,项目名称:horde,代码行数:101,代码来源:Imap.php


示例16: deleteAttach

 /**
  * AJAX action: Delete an attachment from compose data.
  *
  * Variables used:
  *   - atc_indices: (string) [JSON array] Attachment IDs to delete.
  *   - imp_compose: (string) The IMP_Compose cache identifier.
  *   - quiet: (boolean) If true, don't output notifications.
  *
  * @return array  The list of attchment IDs that were deleted.
  */
 public function deleteAttach()
 {
     global $injector, $notification;
     $result = array();
     if (isset($this->vars->atc_indices)) {
         $imp_compose = $injector->getInstance('IMP_Factory_Compose')->create($this->vars->imp_compose);
         foreach (json_decode($this->vars->atc_indices) as $val) {
             if (isset($imp_compose[$val])) {
                 if (empty($this->vars->quiet)) {
                     $notification->push(sprintf(_("Deleted attachment \"%s\"."), Horde_Mime::decode($imp_compose[$val]->getPart()->getName(true))), 'horde.success');
                 }
                 unset($imp_compose[$val]);
                 $result[] = $val;
                 $this->_base->queue->compose($imp_compose);
             }
         }
     }
     if (empty($result) && empty($this->vars->quiet)) {
         $notification->push(_("At least one attachment could not be deleted."), 'horde.error');
     }
     return $result;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:32,代码来源:Dynamic.php


示例17: _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


示例18: _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


示例19: _unserialize

 /**
  * Unserialize data.
  *
  * @param mixed $data    The data to be unserialized.
  * @param mixed $mode    The mode of unserialization. Can be either a
  *                       single mode or array of modes.  If array, will be
  *                       unserialized in the order provided.
  * @param mixed $params  Any additional parameters the unserialization
  *                       method requires.
  *
  * @return mixed  Unserialized data.
  * @throws Horde_Serialize_Exception
  */
 protected static function _unserialize(&$data, $mode, $params = null)
 {
     switch ($mode) {
         case self::NONE:
             break;
         case self::RAW:
             $data = rawurldecode($data);
             break;
         case self::URL:
             $data = urldecode($data);
             break;
         case self::WDDX:
             $data = wddx_deserialize($data);
             break;
         case self::BZIP:
             // $params['small'] = Use bzip2 'small memory' mode?
             $data = bzdecompress($data, isset($params['small']) ? $params['small'] : false);
             break;
         case self::IMAP8:
             $data = quoted_printable_decode($data);
             break;
         case self::IMAPUTF7:
             $data = Horde_String::convertCharset(Horde_Imap_Client_Utf7imap::Utf7ImapToUtf8($data), 'UTF-8', 'ISO-8859-1');
             break;
         case self::IMAPUTF8:
             $data = Horde_Mime::encode($data);
             break;
         case self::BASIC:
             $data2 = @unserialize($data);
             // Unserialize can return false both on error and i 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Horde_Mime_Headers类代码示例发布时间:2022-05-23
下一篇:
PHP Horde_Injector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap