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


PHP Horde_Imap_Client_Fetch_Query::seq方法代码示例

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


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

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

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

示例3: 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

示例4: loadMessageBodies

 private function loadMessageBodies()
 {
     $headers = array();
     $fetch_query = new \Horde_Imap_Client_Fetch_Query();
     $fetch_query->envelope();
     $fetch_query->structure();
     $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));
     $fetch = $headers[$this->message_id];
     // set $this->fetch to get to, from ...
     $this->fetch = $fetch;
     // analyse the body part
     $structure = $fetch->getStructure();
     // debugging below
     $structure_type = $structure->getPrimaryType();
     if ($structure_type == 'multipart') {
         $i = 1;
         foreach ($structure->getParts() as $p) {
             $this->getpart($p, $i++);
         }
     } else {
         if ($structure->findBody() != null) {
             // get the body from the server
             $partId = $structure->findBody();
             $this->queryBodyPart($partId);
         }
     }
 }
开发者ID:noldmess,项目名称:apps,代码行数:37,代码来源:message.php

示例5: fetch

 /**
  * Fetch message data (see RFC 3501 [6.4.5]).
  *
  * @param mixed $mailbox                        The mailbox to search.
  *                                              Either a
  *                                              Horde_Imap_Client_Mailbox
  *                                              object or a string (UTF-8).
  * @param Horde_Imap_Client_Fetch_Query $query  Fetch query object.
  * @param array $options                        Additional options:
  *   - changedsince: (integer) Only return messages that have a
  *                   mod-sequence larger than this value. This option
  *                   requires the CONDSTORE IMAP extension (if not present,
  *                   this value is ignored). Additionally, the mailbox
  *                   must support mod-sequences or an exception will be
  *                   thrown. If valid, this option implicity adds the
  *                   mod-sequence fetch criteria to the fetch command.
  *                   DEFAULT: Mod-sequence values are ignored.
  *   - ids: (Horde_Imap_Client_Ids) A list of messages to fetch data from.
  *          DEFAULT: All messages in $mailbox will be fetched.
  *
  * @return Horde_Imap_Client_Fetch_Results  A results object.
  *
  * @throws Horde_Imap_Client_Exception
  * @throws Horde_Imap_Client_Exception_NoSupportExtension
  */
 public function fetch($mailbox, $query, array $options = array())
 {
     $this->login();
     $query = clone $query;
     $cache_array = $header_cache = $new_query = array();
     $res_seq = null;
     if (empty($options['ids'])) {
         $options['ids'] = $this->getIdsOb(Horde_Imap_Client_Ids::ALL);
     } elseif ($options['ids']->isEmpty()) {
         return new Horde_Imap_Client_Fetch_Results($this->_fetchDataClass);
     } elseif ($options['ids']->search_res && !$this->queryCapability('SEARCHRES')) {
         /* SEARCHRES requires server support. */
         throw new Horde_Imap_Client_Exception_NoSupportExtension('SEARCHRES');
     }
     $this->openMailbox($mailbox, Horde_Imap_Client::OPEN_AUTO);
     $cf = $this->_initCache(true) ? $this->_cacheFields() : array();
     if (!empty($cf)) {
         /* If using cache, we store by UID so we need to return UIDs. */
         $query->uid();
     }
     if ($query->contains(Horde_Imap_Client::FETCH_MODSEQ) && !isset($this->_init['enabled']['CONDSTORE'])) {
         unset($query[$k]);
     }
     /* Determine if caching is available and if anything in $query is
      * cacheable.
      * TODO: Re-add base headertext caching. */
     foreach ($cf as $k => $v) {
         if (isset($query[$k])) {
             switch ($k) {
                 case Horde_Imap_Client::FETCH_ENVELOPE:
                 case Horde_Imap_Client::FETCH_FLAGS:
                 case Horde_Imap_Client::FETCH_IMAPDATE:
                 case Horde_Imap_Client::FETCH_SIZE:
                 case Horde_Imap_Client::FETCH_STRUCTURE:
                     $cache_array[$k] = $v;
                     break;
                 case Horde_Imap_Client::FETCH_HEADERS:
                     $this->_temp['headers_caching'] = array();
                     foreach ($query[$k] as $key => $val) {
                         /* Only cache if directly requested.  Iterate through
                          * requests to ensure at least one can be cached. */
                         if (!empty($val['cache']) && !empty($val['peek'])) {
                             $cache_array[$k] = $v;
                             ksort($val);
                             $header_cache[$key] = hash('md5', serialize($val));
                         }
                     }
                     break;
             }
         }
     }
     $ret = new Horde_Imap_Client_Fetch_Results($this->_fetchDataClass, $options['ids']->sequence ? Horde_Imap_Client_Fetch_Results::SEQUENCE : Horde_Imap_Client_Fetch_Results::UID);
     /* If nothing is cacheable, we can do a straight search. */
     if (empty($cache_array)) {
         $this->_fetch($ret, $query, $options);
         return $ret;
     }
     /* If doing a changedsince search, limit the UIDs now. */
     if (!empty($options['changedsince'])) {
         $changed_query = new Horde_Imap_Client_Fetch_Query();
         if ($options['ids']->sequence) {
             $changed_query->seq();
         } else {
             $changed_query->uid();
         }
         $this->_fetch($ret, $changed_query, array('changedsince' => $options['changedsince'], 'ids' => $options['ids']));
         if (!count($ret)) {
             return $ret;
         }
         $options['ids'] = $this->getIdsOb($ret->ids(), $options['ids']->sequence);
     }
     /* Grab Seq -> UID lookup. */
     $res_seq = $this->_getSeqUidLookup($options['ids']);
     $ids = $options['ids']->sequence ? array_keys($res_seq['lookup']) : $res_seq['uids'];
     /* Get the cached values. */
//.........这里部分代码省略.........
开发者ID:netcon-source,项目名称:apps,代码行数:101,代码来源:Base.php

示例6: getMessages

 /**
  * @static
  * @param $user_id
  * @param $account_id
  * @param $folder_id
  * @param int $from
  * @param int $count
  * @return array
  */
 public static function getMessages($user_id, $account_id, $folder_id, $from = 0, $count = 20)
 {
     // get the account
     $account = App::getAccount($user_id, $account_id);
     if (!$account) {
         #TODO: i18n
         return array('error' => 'unknown account');
     }
     try {
         // connect to the imap server
         $conn = App::getImapConnection($account);
         $messages = array();
         //			$mb = new \Horde_Imap_Client_Mailbox($folder_id);
         $status = $conn->status($folder_id, \Horde_Imap_Client::STATUS_MESSAGES);
         $total = $status['messages'];
         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));
         // $list is an array of Horde_Imap_Client_Data_Fetch objects.
         $headers = $conn->fetch($folder_id, $fetch_query);
         foreach ($headers as $header) {
             $flags = array('SEEN' => True, 'ANSWERED' => False, 'FORWARDED' => False, 'DRAFT' => False, 'HAS_ATTACHMENTS' => True);
             //					\Horde_Imap_Client_Data_Fetch::HEADER_PARSE
             $f = $header->getFlags();
             $date = $header->getImapDate()->format('U');
             $id = $header->getUid();
             $e = $header->getEnvelope();
             $flags = array();
             $to = $e->to_decoded[0];
             $to = $to['personal'];
             //."<".$to['mailbox']."@".$to['host'].">";
             $from = $e->from_decoded[0];
             $from = $from['personal'];
             //."<".$from['mailbox']."@".$from['host'].">";
             $messages[] = array('id' => $id, 'from' => $from, 'to' => $to, 'subject' => $e->subject_decoded, 'date' => $date, 'size' => $header->getSize(), 'flags' => $flags);
         }
         return array('account_id' => $account_id, 'folder_id' => $folder_id, 'messages' => $messages);
     } catch (\Horde_Imap_Client_Exception $e) {
         return array('error' => $e->getMessage());
     }
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:62,代码来源:mail.php


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