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

PHP Horde_Imap_Client_Fetch_Query类代码示例

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

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



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

示例1: __construct

 /**
  * Constructor.
  *
  * @param IMP_Indices $indices  The index of the message.
  * @param boolean $peek         Don't set seen flag?
  */
 public function __construct(IMP_Indices $indices, $peek = false)
 {
     global $injector;
     /* Get envelope/header information. We don't use flags in this
      * view. */
     try {
         list($mbox, $uid) = $indices->getSingle();
         if (!$uid) {
             throw new Exception();
         }
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->envelope();
         $query->headers('imp', self::$headersUsed, array('cache' => true, 'peek' => true));
         $imp_imap = $mbox->imp_imap;
         $imp_imap->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE);
         $ret = $imp_imap->fetch($mbox, $query, array('ids' => $imp_imap->getIdsOb($uid)));
         if (!($ob = $ret->first())) {
             throw new Exception();
         }
         $this->contents = $injector->getInstance('IMP_Factory_Contents')->create($indices);
         if (!$peek) {
             $this->_loadHeaders();
         }
     } catch (Exception $e) {
         throw new IMP_Exception(_("Requested message not found."));
     }
     $this->_envelope = $ob->getEnvelope();
     $this->_headers = $ob->getHeaders('imp', Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
     $this->_indices = $indices;
     $this->_peek = $peek;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:37,代码来源:Message.php


示例2: execute

 /**
  * Renames the old sent-mail mailboxes.
  *
  * Mailbox name: sent-mail-month-year
  *   month = English:         3 letter abbreviation
  *           Other Languages: Month value (01-12)
  *   year  = 4 digit year
  *
  * The mailbox name needs to be in this specific format (as opposed to a
  * user-defined one) to ensure that 'delete_sentmail_monthly' processing
  * can accurately find all the old sent-mail mailboxes.
  *
  * @return boolean  Whether all sent-mail mailboxes were renamed.
  */
 public function execute()
 {
     global $notification;
     $date_format = substr($GLOBALS['language'], 0, 2) == 'en' ? 'M-Y' : 'm-Y';
     $datetime = new DateTime();
     $now = $datetime->format($date_format);
     foreach ($this->_getSentmail() as $sent) {
         /* Display a message to the user and rename the mailbox.
          * Only do this if sent-mail mailbox currently exists. */
         if ($sent->exists) {
             $notification->push(sprintf(_("\"%s\" mailbox being renamed at the start of the month."), $sent->display), 'horde.message');
             $query = new Horde_Imap_Client_Fetch_Query();
             $query->imapDate();
             $query->uid();
             $imp_imap = $sent->imp_imap;
             $res = $imp_imap->fetch($sent, $query);
             $msgs = array();
             foreach ($res as $val) {
                 $date_string = $val->getImapDate()->format($date_format);
                 if (!isset($msgs[$date_string])) {
                     $msgs[$date_string] = $imp_imap->getIdsOb();
                 }
                 $msgs[$date_string]->add($val->getUid());
             }
             unset($msgs[$now]);
             foreach ($msgs as $key => $val) {
                 $new_mbox = IMP_Mailbox::get(strval($sent) . '-' . Horde_String::lower($key));
                 $imp_imap->copy($sent, $new_mbox, array('create' => true, 'ids' => $val, 'move' => true));
             }
         }
     }
     return true;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:47,代码来源:RenameSentmailMonthly.php


示例3: getMessages

 public function getMessages($from = 0, $count = 2)
 {
     $total = $this->getTotalMessages();
     if ($from + $count > $total) {
         $count = $total - $from;
     }
     $headers = array();
     $fetch_query = new \Horde_Imap_Client_Fetch_Query();
     $fetch_query->envelope();
     $fetch_query->flags();
     $fetch_query->seq();
     $fetch_query->size();
     $fetch_query->uid();
     $fetch_query->imapDate();
     $headers = array_merge($headers, array('importance', 'list-post', 'x-priority'));
     $headers[] = 'content-type';
     $fetch_query->headers('imp', $headers, array('cache' => true, 'peek' => true));
     $opt = array('ids' => $from + 1 . ':' . ($from + 1 + $count));
     $opt = array();
     // $list is an array of Horde_Imap_Client_Data_Fetch objects.
     $headers = $this->conn->fetch($this->folder_id, $fetch_query, $opt);
     ob_start();
     // fix for Horde warnings
     $messages = array();
     foreach ($headers as $message_id => $header) {
         $message = new Message($this->conn, $this->folder_id, $message_id);
         $message->setInfo($header);
         $messages[] = $message->getListArray();
     }
     ob_clean();
     return $messages;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:32,代码来源:mailbox.php


示例4: fetchEnvelope

 /**
  */
 public function fetchEnvelope($indices)
 {
     if ($GLOBALS['registry']->hasMethod('mail/imapOb')) {
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->envelope();
         $query->uid();
         try {
             return $GLOBALS['registry']->call('mail/imapOb')->fetch($this->_getMboxOb(), $query, array('ids' => new Horde_Imap_Client_Ids($indices)));
         } catch (Horde_Imap_Client_Exception $e) {
         }
     }
     return false;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:15,代码来源:Live.php


示例5: getMessageIds

 /**
  */
 public function getMessageIds()
 {
     if (isset($this->_msgids)) {
         return $this->_msgids;
     }
     $this->_msgids = array();
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->envelope();
     $ret = $this->_mbox->imp_imap->fetch($this->_mbox, $query, array('ids' => $this->_ids));
     foreach ($ret as $ob) {
         $this->_msgids[] = $ob->getEnvelope()->message_id;
     }
     return $this->_msgids;
 }
开发者ID:horde,项目名称:horde,代码行数:16,代码来源:Messages.php


示例6: load

 private function load()
 {
     $headers = [];
     $fetch_query = new \Horde_Imap_Client_Fetch_Query();
     $fetch_query->bodyPart($this->attachmentId);
     $fetch_query->mimeHeader($this->attachmentId);
     $headers = array_merge($headers, ['importance', 'list-post', 'x-priority']);
     $headers[] = 'content-type';
     $fetch_query->headers('imp', $headers, ['cache' => true]);
     // $list is an array of Horde_Imap_Client_Data_Fetch objects.
     $ids = new \Horde_Imap_Client_Ids($this->messageId);
     $headers = $this->conn->fetch($this->mailBox, $fetch_query, ['ids' => $ids]);
     /** @var $fetch Horde_Imap_Client_Data_Fetch */
     if (!isset($headers[$this->messageId])) {
         throw new DoesNotExistException('Unable to load the attachment.');
     }
     $fetch = $headers[$this->messageId];
     $mimeHeaders = $fetch->getMimeHeader($this->attachmentId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
     $this->mimePart = new \Horde_Mime_Part();
     // To prevent potential problems with the SOP we serve all files with the
     // MIME type "application/octet-stream"
     $this->mimePart->setType('application/octet-stream');
     // Serve all files with a content-disposition of "attachment" to prevent Cross-Site Scripting
     $this->mimePart->setDisposition('attachment');
     // Extract headers from part
     $contentDisposition = $mimeHeaders->getValue('content-disposition', \Horde_Mime_Headers::VALUE_PARAMS);
     if (!is_null($contentDisposition)) {
         $vars = ['filename'];
         foreach ($contentDisposition as $key => $val) {
             if (in_array($key, $vars)) {
                 $this->mimePart->setDispositionParameter($key, $val);
             }
         }
     } else {
         $contentDisposition = $mimeHeaders->getValue('content-type', \Horde_Mime_Headers::VALUE_PARAMS);
         $vars = ['name'];
         foreach ($contentDisposition as $key => $val) {
             if (in_array($key, $vars)) {
                 $this->mimePart->setContentTypeParameter($key, $val);
             }
         }
     }
     /* Content transfer encoding. */
     if ($tmp = $mimeHeaders->getValue('content-transfer-encoding')) {
         $this->mimePart->setTransferEncoding($tmp);
     }
     $body = $fetch->getBodyPart($this->attachmentId);
     $this->mimePart->setContents($body);
 }
开发者ID:matiasdelellis,项目名称:mail,代码行数:49,代码来源:attachment.php


示例7: getMessages

 public function getMessages($from = 0, $count = 2, $filter = '')
 {
     if ($filter instanceof Horde_Imap_Client_Search_Query) {
         $query = $filter;
     } else {
         $query = new Horde_Imap_Client_Search_Query();
         if ($filter) {
             $query->text($filter, false);
         }
     }
     if ($this->getSpecialRole() !== 'trash') {
         $query->flag(Horde_Imap_Client::FLAG_DELETED, false);
     }
     $result = $this->conn->search($this->mailBox, $query, ['sort' => [Horde_Imap_Client::SORT_DATE]]);
     $ids = array_reverse($result['match']->ids);
     if ($from >= 0 && $count >= 0) {
         $ids = array_slice($ids, $from, $count);
     }
     $ids = new \Horde_Imap_Client_Ids($ids, false);
     $headers = [];
     $fetch_query = new \Horde_Imap_Client_Fetch_Query();
     $fetch_query->envelope();
     $fetch_query->flags();
     $fetch_query->size();
     $fetch_query->uid();
     $fetch_query->imapDate();
     $fetch_query->structure();
     $headers = array_merge($headers, ['importance', 'list-post', 'x-priority']);
     $headers[] = 'content-type';
     $fetch_query->headers('imp', $headers, ['cache' => true, 'peek' => true]);
     $options = ['ids' => $ids];
     // $list is an array of Horde_Imap_Client_Data_Fetch objects.
     $headers = $this->conn->fetch($this->mailBox, $fetch_query, $options);
     ob_start();
     // fix for Horde warnings
     $messages = [];
     foreach ($headers->ids() as $message_id) {
         $header = $headers[$message_id];
         $message = new IMAPMessage($this->conn, $this->mailBox, $message_id, $header);
         $messages[] = $message->getListArray();
     }
     ob_get_clean();
     // sort by time
     usort($messages, function ($a, $b) {
         return $a['dateInt'] < $b['dateInt'];
     });
     return $messages;
 }
开发者ID:Gomez,项目名称:mail,代码行数:48,代码来源:mailbox.php


示例8: getSize

 /**
  * Obtain the mailbox size
  *
  * @param IMP_Mailbox $mbox   The mailbox to obtain the size of.
  * @param boolean $formatted  Whether to return a human readable value.
  *
  * @return mixed  Either the size of the mailbox (in bytes) or a formatted
  *                string with this information.
  */
 public function getSize(IMP_Mailbox $mbox, $formatted = true)
 {
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->size();
     try {
         $imp_imap = $mbox->imp_imap;
         $res = $imp_imap->fetch($mbox, $query, array('ids' => $imp_imap->getIdsOb(Horde_Imap_Client_Ids::ALL, true)));
         $size = 0;
         foreach ($res as $v) {
             $size += $v->getSize();
         }
         return $formatted ? sprintf(_("%.2fMB"), $size / (1024 * 1024)) : $size;
     } catch (IMP_Imap_Exception $e) {
         return 0;
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:25,代码来源:Size.php


示例9: __get

 /**
  */
 public function __get($name)
 {
     switch ($name) {
         case 'indices':
             return $this->_indices;
         case 'msgid':
             if (!$this->_msgid) {
                 list($mbox, $uid) = $this->indices->getSingle();
                 $query = new Horde_Imap_Client_Fetch_Query();
                 $query->envelope();
                 $imp_imap = $mbox->imp_imap;
                 $ret = $imp_imap->fetch($mbox, $query, array('ids' => $imp_imap->getIdsOb($uid)));
                 $this->_msgid = ($ob = $ret->first()) ? $ob->getEnvelope()->message_id : '';
             }
             return $this->_msgid;
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:19,代码来源:Message.php


示例10: getLog

 /**
  */
 public function getLog(IMP_Maillog_Message $msg, array $types = array())
 {
     $log_ob = new IMP_Maillog_Log_Mdn();
     if (!empty($types) && !in_array('IMP_Maillog_Log_Mdn', $types) || !$this->isAvailable($msg, $log_ob)) {
         return array();
     }
     list($mbox, $uid) = $msg->indices->getSingle();
     $imp_imap = $mbox->imp_imap;
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->flags();
     try {
         $flags = $imp_imap->fetch($mbox, $query, array('ids' => $imp_imap->getIdsOb($uid)))->first()->getFlags();
     } catch (IMP_Imap_Exception $e) {
         $flags = array();
     }
     return in_array(Horde_Imap_Client::FLAG_MDNSENT, $flags) ? array($log_ob) : array();
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:19,代码来源:Mdnsent.php


示例11: getLog

 /**
  */
 public function getLog(IMP_Maillog_Message $msg, array $filter = array())
 {
     if (!$msg->indices || in_array('mdn', $filter)) {
         return array();
     }
     list($mbox, $uid) = $msg->indices->getSingle();
     if (!$mbox->permflags->allowed(Horde_Imap_Client::FLAG_MDNSENT)) {
         return array();
     }
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->flags();
     $imp_imap = $mbox->imp_imap;
     try {
         $flags = $imp_imap->fetch($mbox, $query, array('ids' => $imp_imap->getIdsOb($uid)))->first()->getFlags();
     } catch (IMP_Imap_Exception $e) {
         $flags = array();
     }
     return in_array(Horde_Imap_Client::FLAG_MDNSENT, $flags) ? array(new IMP_Maillog_Log_Mdn()) : array();
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:21,代码来源:Mdnsent.php


示例12: clientSort

 /**
  * Sort search results client side if the server does not support the SORT
  * IMAP extension (RFC 5256).
  *
  * @param Horde_Imap_Client_Ids $res  The search results.
  * @param array $opts                 The options to _search().
  *
  * @return array  The sort results.
  *
  * @throws Horde_Imap_Client_Exception
  */
 public function clientSort($res, $opts)
 {
     if (!count($res)) {
         return $res;
     }
     /* Generate the FETCH command needed. */
     $query = new Horde_Imap_Client_Fetch_Query();
     foreach ($opts['sort'] as $val) {
         switch ($val) {
             case Horde_Imap_Client::SORT_ARRIVAL:
                 $query->imapDate();
                 break;
             case Horde_Imap_Client::SORT_DATE:
                 $query->imapDate();
                 $query->envelope();
                 break;
             case Horde_Imap_Client::SORT_CC:
             case Horde_Imap_Client::SORT_DISPLAYFROM:
             case Horde_Imap_Client::SORT_DISPLAYTO:
             case Horde_Imap_Client::SORT_FROM:
             case Horde_Imap_Client::SORT_SUBJECT:
             case Horde_Imap_Client::SORT_TO:
                 $query->envelope();
                 break;
             case Horde_Imap_Client::SORT_SEQUENCE:
                 $query->seq();
                 break;
             case Horde_Imap_Client::SORT_SIZE:
                 $query->size();
                 break;
         }
     }
     if (!count($query)) {
         return $res;
     }
     $mbox = $this->_socket->currentMailbox();
     $fetch_res = $this->_socket->fetch($mbox['mailbox'], $query, array('ids' => $res));
     return $this->_clientSortProcess($res->ids, $fetch_res, $opts['sort']);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:50,代码来源:ClientSort.php


示例13: _content

 /**
  */
 protected function _content()
 {
     $inbox = IMP_Mailbox::get('INBOX');
     /* Filter on INBOX display, if requested. */
     $inbox->filterOnDisplay();
     $query = new Horde_Imap_Client_Search_Query();
     $query->flag(Horde_Imap_Client::FLAG_SEEN, false);
     $ids = $inbox->runSearchQuery($query, Horde_Imap_Client::SORT_SEQUENCE, 1);
     $indices = $ids['INBOX'];
     $html = '<table cellspacing="0" width="100%">';
     $text = _("Go to your Inbox...");
     if (empty($indices)) {
         $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
     } else {
         $imp_ui = new IMP_Mailbox_Ui($inbox);
         $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->envelope();
         try {
             $imp_imap = $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create($inbox);
             $fetch_ret = $imp_imap->fetch($inbox, $query, array('ids' => $imp_imap->getIdsOb(array_slice($indices, 0, $shown))));
         } catch (IMP_Imap_Exception $e) {
             $fetch_ret = new Horde_Imap_Client_Fetch_Results();
         }
         foreach ($fetch_ret as $uid => $ob) {
             $envelope = $ob->getEnvelope();
             $date = $imp_ui->getDate(isset($envelope->date) ? $envelope->date : null);
             $from = $imp_ui->getFrom($envelope);
             $subject = $imp_ui->getSubject($envelope->subject, true);
             $html .= '<tr style="cursor:pointer" class="text"><td>' . $inbox->url('message', $uid)->link() . '<strong>' . htmlspecialchars($from['from'], ENT_QUOTES, 'UTF-8') . '</strong><br />' . $subject . '</a></td>' . '<td>' . htmlspecialchars($date, ENT_QUOTES, 'UTF-8') . '</td></tr>';
         }
         $more_msgs = count($indices) - $shown;
         if ($more_msgs > 0) {
             $text = sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs);
         }
     }
     return $html . '<tr><td colspan="2" style="cursor:pointer" align="right">' . $inbox->url('mailbox')->link() . $text . '</a></td></tr>' . '</table>';
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:40,代码来源:Newmail.php


示例14: getChanges

 /**
  * Return a folder object containing all IMAP server change information.
  *
  * @param array $options  An array of options.
  *        @see Horde_ActiveSync_Imap_Adapter::getMessageChanges
  *
  * @return Horde_ActiveSync_Folder_Base  The populated folder object.
  */
 public function getChanges(array $options)
 {
     $this->_logger->info(sprintf('[%s] NO CONDSTORE or per mailbox MODSEQ. minuid: %s, total_messages: %s', $this->_procid, $this->_folder->minuid(), $this->_status['messages']));
     $query = new Horde_Imap_Client_Search_Query();
     if (!empty($options['sincedate'])) {
         $query->dateSearch(new Horde_Date($options['sincedate']), Horde_Imap_Client_Search_Query::DATE_SINCE);
     }
     try {
         $search_ret = $this->_imap_ob->search($this->_mbox, $query, array('results' => array(Horde_Imap_Client::SEARCH_RESULTS_MATCH)));
     } catch (Horde_Imap_Client_Exception $e) {
         $this->_logger->err($e->getMessage());
         throw new Horde_ActiveSync_Exception($e);
     }
     $cnt = $search_ret['count'] / Horde_ActiveSync_Imap_Adapter::MAX_FETCH + 1;
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->flags();
     $flags = array();
     for ($i = 0; $i <= $cnt; $i++) {
         $ids = new Horde_Imap_Client_Ids(array_slice($search_ret['match']->ids, $i * Horde_ActiveSync_Imap_Adapter::MAX_FETCH, Horde_ActiveSync_Imap_Adapter::MAX_FETCH));
         try {
             $fetch_ret = $this->_imap_ob->fetch($this->_mbox, $query, array('ids' => $ids));
         } catch (Horde_Imap_Client_Exception $e) {
             $this->_logger->err($e->getMessage());
             throw new Horde_ActiveSync_Exception($e);
         }
         foreach ($fetch_ret as $uid => $data) {
             $flags[$uid] = array('read' => array_search(Horde_Imap_Client::FLAG_SEEN, $data->getFlags()) !== false ? 1 : 0);
             if ($options['protocolversion'] > Horde_ActiveSync::VERSION_TWOFIVE) {
                 $flags[$uid]['flagged'] = array_search(Horde_Imap_Client::FLAG_FLAGGED, $data->getFlags()) !== false ? 1 : 0;
             }
         }
     }
     if (!empty($flags)) {
         $this->_folder->setChanges($search_ret['match']->ids, $flags);
     }
     $this->_folder->setRemoved($this->_imap_ob->vanished($this->_mbox, null, array('ids' => new Horde_Imap_Client_Ids($this->_folder->messages())))->ids);
     return $this->_folder;
 }
开发者ID:horde,项目名称:horde,代码行数:46,代码来源:Plain.php


示例15: searchCallback

 /**
  */
 public function searchCallback(IMP_Mailbox $mbox, array $ids)
 {
     $fetch_query = new Horde_Imap_Client_Fetch_Query();
     $fetch_query->structure();
     $fetch_res = $mbox->imp_imap->fetch($mbox, $fetch_query, array('ids' => $mbox->imp_imap->getIdsOb($ids)));
     $out = array();
     foreach ($ids as $v) {
         if (isset($fetch_res[$v])) {
             $atc = false;
             foreach ($fetch_res[$v]->getStructure()->partIterator() as $val) {
                 if ($val->isAttachment()) {
                     $atc = true;
                     break;
                 }
             }
             if ($this->_data && $atc || !$this->_data && !$atc) {
                 continue;
             }
         }
         $out[] = $v;
     }
     return $out;
 }
开发者ID:horde,项目名称:horde,代码行数:25,代码来源:Attachment.php


示例16: getmsg

 private function getmsg()
 {
     $headers = array();
     $fetch_query = new \Horde_Imap_Client_Fetch_Query();
     $fetch_query->envelope();
     //		$fetch_query->fullText();
     $fetch_query->bodyText();
     $fetch_query->flags();
     $fetch_query->seq();
     $fetch_query->size();
     $fetch_query->uid();
     $fetch_query->imapDate();
     $headers = array_merge($headers, array('importance', 'list-post', 'x-priority'));
     $headers[] = 'content-type';
     $fetch_query->headers('imp', $headers, array('cache' => true, 'peek' => true));
     // $list is an array of Horde_Imap_Client_Data_Fetch objects.
     $ids = new \Horde_Imap_Client_Ids($this->message_id);
     $headers = $this->conn->fetch($this->folder_id, $fetch_query, array('ids' => $ids));
     $this->plainmsg = $headers[$this->message_id]->getBodyText();
     //
     //		// HEADER
     //		$this->header = $this->conn->fetchHeader($this->folder_id, $this->message_id);
     //
     //		// BODY
     //		$bodystructure= $this->conn->getStructure($this->folder_id, $this->message_id);
     //		$a= \rcube_imap_generic::getStructurePartData($bodystructure, 0);
     //		if ($a['type'] == 'multipart') {
     //			for ($i=0; $i < count($bodystructure); $i++) {
     //				if (!is_array($bodystructure[$i]))
     //					break;
     //				$this->getpart($bodystructure[$i],$i+1);
     //			}
     //		} else {
     //			// get part no 1
     //			$this->getpart($bodystructure,1);
     //		}
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:37,代码来源:message.php


示例17: generate

 /**
  * Generates a string that can be saved out to an mbox format mailbox file
  * for a mailbox (or set of mailboxes), optionally including all
  * subfolders of the selected mailbox(es) as well. All mailboxes will be
  * output in the same string.
  *
  * @param mixed $mboxes  A mailbox name (UTF-8), or list of mailbox names,
  *                       to generate a mbox file for.
  *
  * @return resource  A stream resource containing the text of a mbox
  *                   format mailbox file.
  */
 public function generate($mboxes)
 {
     $body = fopen('php://temp', 'r+');
     if (!is_array($mboxes)) {
         if (!strlen($mboxes)) {
             return $body;
         }
         $mboxes = array($mboxes);
     }
     if (empty($mboxes)) {
         return $body;
     }
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->envelope();
     $query->imapDate();
     $query->headerText(array('peek' => true));
     $query->bodyText(array('peek' => true));
     foreach (IMP_Mailbox::get($mboxes) as $val) {
         $imp_imap = $val->imp_imap;
         $slices = $imp_imap->getSlices($val, $imp_imap->getIdsOb(Horde_Imap_Client_Ids::ALL, true));
         foreach ($slices as $slice) {
             try {
                 $res = $imp_imap->fetch($val, $query, array('ids' => $slice, 'nocache' => true));
             } catch (IMP_Imap_Exception $e) {
                 continue;
             }
             foreach ($res as $ptr) {
                 $from_env = $ptr->getEnvelope()->from;
                 $from = count($from_env) ? $from_env[0]->bare_address : '<>';
                 /* We need this long command since some MUAs (e.g. pine)
                  * require a space in front of single digit days. */
                 $imap_date = $ptr->getImapDate();
                 $date = sprintf('%s %2s %s', $imap_date->format('D M'), $imap_date->format('j'), $imap_date->format('H:i:s Y'));
                 fwrite($body, 'From ' . $from . ' ' . $date . "\r\n");
                 /* Remove spurious 'From ' line in headers. */
                 $stream = $ptr->getHeaderText(0, Horde_Imap_Client_Data_Fetch::HEADER_STREAM);
                 while (!feof($stream)) {
                     $line = fgets($stream);
                     if (substr($line, 0, 5) != 'From ') {
                         fwrite($body, $line);
                     }
                 }
                 fwrite($body, "\r\n");
                 /* Add Body text. */
                 $stream = $ptr->getBodyText(0, true);
                 while (!feof($stream)) {
                     fwrite($body, fread($stream, 8192));
                 }
                 fwrite($body, "\r\n");
             }
         }
     }
     return $body;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:66,代码来源:Generate.php


示例18: _fetchData

 /**
  * Fetch data from the IMAP client.
  *
  * @param  array $params  Parameter array.
  *     - html_id (string)  The MIME id of the HTML part, if any.
  *     - text_id (string)  The MIME id of the plain part, if any.
  *
  * @return Horde_Imap_Client_Data_Fetch  The results.
  */
 protected function _fetchData(array $params)
 {
     $query = new Horde_Imap_Client_Fetch_Query();
     $query_opts = array('decode' => true, 'peek' => true);
     // Get body information
     if ($this->_version >= Horde_ActiveSync::VERSION_TWELVE) {
         if (!empty($params['html_id'])) {
             $query->bodyPartSize($params['html_id']);
             $query->bodyPart($params['html_id'], $query_opts);
         }
         if (!empty($params['text_id'])) {
             $query->bodyPart($params['text_id'], $query_opts);
             $query->bodyPartSize($params['text_id']);
         }
     } else {
         // EAS 2.5 Plaintext body
         $query->bodyPart($params['text_id'], $query_opts);
         $query->bodyPartSize($params['text_id']);
     }
     try {
         $fetch_ret = $this->_imap->fetch($this->_mbox, $query, array('ids' => new Horde_Imap_Client_Ids(array($this->_uid))));
     } catch (Horde_Imap_Client_Exception $e) {
         throw new Horde_ActiveSync_Exception($e);
     }
     if (!($data = $fetch_ret->first())) {
         throw new Horde_Exception_NotFound(sprintf('Could not load message %s from server.', $this->_uid));
     }
     return $data;
 }
开发者ID:horde,项目名称:horde,代码行数:38,代码来源:MessageBodyData.php


示例19: fetchBodypart

 /**
  * Retrieves a bodypart for the given message ID and mime part ID.
  *
  * @param string $folder The folder to fetch the messages from.
  * @param array  $uid                 The message UID.
  * @param array  $id                  The mime part ID.
  *
  * @return resource  The body part, as a stream resource.
  */
 public function fetchBodypart($folder, $uid, $id)
 {
     $query = new Horde_Imap_Client_Fetch_Query();
     $query->structure();
     $query->bodyPart($id, array('decode' => true));
     try {
         $ret = $this->getBackend()->fetch($folder, $query, array('ids' => new Horde_Imap_Client_Ids($uid)));
         $part = $ret[$uid]->getStructure()->getPart($id);
         $part->setContents($ret[$uid]->getBodyPart($id, true), array('encoding' => $ret[$uid]->getBodyPartDecode($id), 'usestream' => true));
         return $part->getContents(array('stream' => true));
     } catch (Horde_Imap_Client_Exception_ServerResponse $e) {
         throw new Horde_Kolab_Storage_Exception($e->details);
     } catch (Horde_Imap_Client_Exception $e) {
         throw new Horde_Kolab_Storage_Exception($e);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:25,代码来源:Imap.php


示例20: is_bulk_message

 /**
  * Attempt to determine whether this message is a bulk message (e.g. automated reply).
  *
  * @param \Horde_Imap_Client_Data_Fetch $message The message to process
  * @param string|\Horde_Imap_Client_Ids $messageid The Hore message Uid
  * @return boolean
  */
 private function is_bulk_message(\Horde_Imap_Client_Data_Fetch $message, $messageid)
 {
     $query = new \Horde_Imap_Client_Fetch_Query();
     $query->headerText(array('peek' => true));
     $messagedata = $this->client->fetch($this->get_mailbox(), $query, array('ids' => $messageid))->first();
     // Assume that this message is not bulk to begin with.
     $isbulk = false;
     // An auto-reply may itself include the Bulk Precedence.
     $precedence = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('Precedence');
     $isbulk = $isbulk || strtolower($precedence) == 'bulk';
     // If the X-Autoreply header is set, and not 'no', then this is an automatic reply.
     $autoreply = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('X-Autoreply');
     $isbulk = $isbulk || $autoreply && $autoreply != 'no';
     // If the X-Autorespond header is set, and not 'no', then this is an automatic response.
     $autorespond = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('X-Autorespond');
     $isbulk = $isbulk || $autorespond && $autorespond != 'no';
     // If the Auto-Submitted header is set, and not 'no', then this is a non-human response.
     $autosubmitted = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('Auto-Submitted');
     $isbulk = $isbulk || $autosubmitted && $autosubmitted != 'no';
     return $isbulk;
 }
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:28,代码来源:manager.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Horde_Injector类代码示例发布时间:2022-05-23
下一篇:
PHP Horde_Icalendar类代码示例发布时间: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