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


PHP rcube_mime::decode_header方法代码示例

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


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

示例1: mh_find_match

 function mh_find_match($message)
 {
     foreach ($this->prefs as $p) {
         if (stristr(rcube_mime::decode_header($message->{$p}['header']), $p['input'])) {
             return $p['color'];
         }
     }
     return false;
 }
开发者ID:internero,项目名称:message_highlight,代码行数:9,代码来源:message_highlight.php

示例2: get

 /**
  * Returns header value
  */
 public function get($name, $decode = true)
 {
     $name = strtolower($name);
     if (isset($this->obj_headers[$name])) {
         $value = $this->{$this->obj_headers[$name]};
     } else {
         $value = $this->others[$name];
     }
     return $decode ? rcube_mime::decode_header($value, $this->charset) : $value;
 }
开发者ID:CodericSandbox,项目名称:roundcube-openshift-quickstart,代码行数:13,代码来源:rcube_imap_generic.php

示例3: get_header

 /**
  * Return a (decoded) message header
  *
  * @param string $name Header name
  * @param bool   $row  Don't mime-decode the value
  * @return string Header value
  */
 public function get_header($name, $raw = false)
 {
     if (empty($this->headers)) {
         return null;
     }
     if ($this->headers->{$name}) {
         $value = $this->headers->{$name};
     } else {
         if ($this->headers->others[$name]) {
             $value = $this->headers->others[$name];
         }
     }
     return $raw ? $value : $this->mime->decode_header($value);
 }
开发者ID:rockchow2002,项目名称:roundcubemail,代码行数:21,代码来源:rcube_message.php

示例4: parse_headers

 /**
  * Extract mail headers for new filter form
  */
 private function parse_headers($headers)
 {
     $result = array();
     if ($headers->subject) {
         $result[] = array('Subject', rcube_mime::decode_header($headers->subject));
     }
     // @TODO: List-Id, others?
     foreach (array('From', 'To') as $h) {
         $hl = strtolower($h);
         if ($headers->{$hl}) {
             $list = rcube_mime::decode_address_list($headers->{$hl});
             foreach ($list as $item) {
                 if ($item['mailto']) {
                     $result[] = array($h, $item['mailto']);
                 }
             }
         }
     }
     return $result;
 }
开发者ID:normalnorge,项目名称:roundcubemail,代码行数:23,代码来源:managesieve.php

示例5: get

 /**
  * Returns header value
  */
 public function get($name, $decode = true)
 {
     $name = strtolower($name);
     if (isset($this->obj_headers[$name])) {
         $value = $this->{$this->obj_headers[$name]};
     } else {
         $value = $this->others[$name];
     }
     if ($decode) {
         if (is_array($value)) {
             foreach ($value as $key => $val) {
                 $value[$key] = rcube_mime::decode_header($val, $this->charset);
                 $value[$key] = rcube_charset::clean($val);
             }
         } else {
             $value = rcube_mime::decode_header($value, $this->charset);
             $value = rcube_charset::clean($value);
         }
     }
     return $value;
 }
开发者ID:alecchisi,项目名称:roundcubemail,代码行数:24,代码来源:rcube_message_header.php

示例6: mail_headers

 /**
  * Get message headers for popup window
  */
 function mail_headers($args)
 {
     $headers = $args['headers'];
     $ret = array();
     if ($headers->subject) {
         $ret[] = array('Subject', rcube_mime::decode_header($headers->subject));
     }
     // @TODO: List-Id, others?
     foreach (array('From', 'To') as $h) {
         $hl = strtolower($h);
         if ($headers->{$hl}) {
             $list = rcube_mime::decode_address_list($headers->{$hl});
             foreach ($list as $item) {
                 if ($item['mailto']) {
                     $ret[] = array($h, $item['mailto']);
                 }
             }
         }
     }
     if ($this->rc->action == 'preview') {
         $this->rc->output->command('parent.set_env', array('sieve_headers' => $ret));
     } else {
         $this->rc->output->set_env('sieve_headers', $ret);
     }
     return $args;
 }
开发者ID:npk,项目名称:roundcubemail,代码行数:29,代码来源:managesieve.php

示例7: _download_messages

 /**
  * Helper method to packs all the given messages into a zip archive
  *
  * @param array List of message UIDs to download
  */
 private function _download_messages($messageset)
 {
     $rcmail = rcmail::get_instance();
     $imap = $rcmail->get_storage();
     $mode = rcube_utils::get_input_value('_mode', rcube_utils::INPUT_POST);
     $temp_dir = $rcmail->config->get('temp_dir');
     $tmpfname = tempnam($temp_dir, 'zipdownload');
     $tempfiles = array($tmpfname);
     $folders = count($messageset) > 1;
     // @TODO: file size limit
     // open zip file
     $zip = new ZipArchive();
     $zip->open($tmpfname, ZIPARCHIVE::OVERWRITE);
     if ($mode == 'mbox') {
         $tmpfp = fopen($tmpfname . '.mbox', 'w');
     }
     foreach ($messageset as $mbox => $uids) {
         $imap->set_folder($mbox);
         $path = $folders ? str_replace($imap->get_hierarchy_delimiter(), '/', $mbox) . '/' : '';
         if ($uids === '*') {
             $index = $imap->index($mbox, null, null, true);
             $uids = $index->get();
         }
         foreach ($uids as $uid) {
             $headers = $imap->get_message_headers($uid);
             if ($mode == 'mbox') {
                 // Sender address
                 $from = rcube_mime::decode_address_list($headers->from, null, true, $headers->charset, true);
                 $from = array_shift($from);
                 $from = preg_replace('/\\s/', '-', $from);
                 // Received (internal) date
                 $date = rcube_utils::anytodatetime($headers->internaldate);
                 if ($date) {
                     $date->setTimezone(new DateTimeZone('UTC'));
                     $date = $date->format(self::MBOX_DATE_FORMAT);
                 }
                 // Mbox format header (RFC4155)
                 $header = sprintf("From %s %s\r\n", $from ?: 'MAILER-DAEMON', $date ?: '');
                 fwrite($tmpfp, $header);
                 // Use stream filter to quote "From " in the message body
                 stream_filter_register('mbox_filter', 'zipdownload_mbox_filter');
                 $filter = stream_filter_append($tmpfp, 'mbox_filter');
                 $imap->get_raw_body($uid, $tmpfp);
                 stream_filter_remove($filter);
                 fwrite($tmpfp, "\r\n");
             } else {
                 // maildir
                 $subject = rcube_mime::decode_header($headers->subject, $headers->charset);
                 $subject = $this->_filename_from_subject(mb_substr($subject, 0, 16));
                 $subject = $this->_convert_filename($subject);
                 $disp_name = $path . $uid . ($subject ? " {$subject}" : '') . '.eml';
                 $tmpfn = tempnam($temp_dir, 'zipmessage');
                 $tmpfp = fopen($tmpfn, 'w');
                 $imap->get_raw_body($uid, $tmpfp);
                 $tempfiles[] = $tmpfn;
                 fclose($tmpfp);
                 $zip->addFile($tmpfn, $disp_name);
             }
         }
     }
     $filename = $folders ? 'messages' : $imap->get_folder();
     if ($mode == 'mbox') {
         $tempfiles[] = $tmpfname . '.mbox';
         fclose($tmpfp);
         $zip->addFile($tmpfname . '.mbox', $filename . '.mbox');
     }
     $zip->close();
     $this->_deliver_zipfile($tmpfname, $filename . '.zip');
     // delete temporary files from disk
     foreach ($tempfiles as $tmpfn) {
         unlink($tmpfn);
     }
     exit;
 }
开发者ID:jimjag,项目名称:roundcubemail,代码行数:79,代码来源:zipdownload.php

示例8: message_set_label

 /**
  * Set label by config to mail from maillist
  *
  * @access  public
  */
 function message_set_label($p)
 {
     $prefs = $this->rc->config->get('message_label', array());
     //write_log('debug', preg_replace('/\r\n$/', '', print_r($prefs, true)));
     if (!count($prefs) or !isset($p['messages']) or !is_array($p['messages'])) {
         return $p;
     }
     foreach ($p['messages'] as $message) {
         $type = 'filter';
         $color = '';
         $ret_key = array();
         foreach ($prefs as $key => $p) {
             if ($p['header'] == 'subject') {
                 $cont = trim(rcube_mime::decode_header($message->{$p}['header'], $message->charset));
             } else {
                 $cont = $message->{$p}['header'];
             }
             if (stristr($cont, $p['input'])) {
                 array_push($ret_key, array('id' => $key, 'type' => $type));
             }
         }
         if (!empty($message->flags)) {
             foreach ($message->flags as $flag => $set_val) {
                 if (stripos($flag, 'ulabels') === 0) {
                     $flag_id = str_ireplace('ulabels_', '', $flag);
                     if (!empty($ret_key)) {
                         foreach ($ret_key as $key_search => $value) {
                             $id = $value['id'];
                             if ($prefs[$id]['id'] == strtolower($flag_id) && $value['type'] == 'filter') {
                                 unset($ret_key[$key_search]);
                             }
                         }
                     }
                 }
                 $type = 'label';
                 if (stripos($flag, 'labels') === 0) {
                     $flag_id = str_ireplace('labels_', '', $flag);
                     foreach ($prefs as $key => $p) {
                         if ($p['id'] == strtolower($flag_id)) {
                             $flabel = false;
                             if (!empty($ret_key)) {
                                 foreach ($ret_key as $key_filter => $value_filter) {
                                     $searh_filter = array('id' => $key, 'type' => 'filter');
                                     if ($value_filter == $searh_filter) {
                                         $flabel = $key_filter;
                                     }
                                 }
                             }
                             if ($flabel !== false) {
                                 unset($ret_key[$flabel]);
                                 $type = 'flabel';
                             }
                             array_push($ret_key, array('id' => $key, 'type' => $type));
                         }
                     }
                 }
             }
         }
         //write_log('debug', preg_replace('/\r\n$/', '', print_r($ret_key,true)));
         if (!empty($ret_key)) {
             sort($ret_key);
             $message->list_flags['extra_flags']['plugin_label'] = array();
             $k = 0;
             foreach ($ret_key as $label_id) {
                 !empty($p['text']) ? $text = $p['text'] : ($text = 'label');
                 $id = $label_id['id'];
                 $type = $label_id['type'];
                 $message->list_flags['extra_flags']['plugin_label'][$k]['color'] = $prefs[$id]['color'];
                 $message->list_flags['extra_flags']['plugin_label'][$k]['text'] = $prefs[$id]['text'];
                 $message->list_flags['extra_flags']['plugin_label'][$k]['id'] = $prefs[$id]['id'];
                 $message->list_flags['extra_flags']['plugin_label'][$k]['type'] = $type;
                 $k++;
             }
         }
     }
     return $p;
 }
开发者ID:dropz-one,项目名称:docker-roundcube,代码行数:82,代码来源:message_label.php


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