| | |
| | | <?php |
| | | |
| | | /** |
| | | /* |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | 'MDNSENT' => '$MDNSent', |
| | | '*' => '\\*', |
| | | ); |
| | | |
| | | public static $mupdate; |
| | | |
| | | protected $fp; |
| | | protected $host; |
| | |
| | | // folder name with spaces. Let's try to handle this situation |
| | | if (!is_array($items) && ($pos = strpos($response, '(')) !== false) { |
| | | $response = substr($response, $pos); |
| | | $items = $this->tokenizeResponse($response, 1); |
| | | $items = $this->tokenizeResponse($response, 1); |
| | | |
| | | if (!is_array($items)) { |
| | | return $result; |
| | | } |
| | |
| | | $encoding = $encoding ? trim($encoding) : 'US-ASCII'; |
| | | $algorithm = $algorithm ? trim($algorithm) : 'REFERENCES'; |
| | | $criteria = $criteria ? 'ALL '.trim($criteria) : 'ALL'; |
| | | $data = ''; |
| | | |
| | | list($code, $response) = $this->execute($return_uid ? 'UID THREAD' : 'THREAD', |
| | | array($algorithm, $encoding, $criteria)); |
| | |
| | | return false; |
| | | } |
| | | |
| | | $initiated = false; |
| | | $binary = true; |
| | | |
| | | do { |
| | | if (!$initiated) { |
| | |
| | | } |
| | | |
| | | // Use BINARY extension when possible (and safe) |
| | | $binary = !$binary_err && $mode && preg_match('/^[0-9.]+$/', $part) && $this->hasCapability('BINARY'); |
| | | $binary = $binary && $mode && preg_match('/^[0-9.]+$/', $part) && $this->hasCapability('BINARY'); |
| | | $fetch_mode = $binary ? 'BINARY' : 'BODY'; |
| | | $partial = $max_bytes ? sprintf('<0.%d>', $max_bytes) : ''; |
| | | |
| | | // format request |
| | | $key = $this->nextTag(); |
| | | $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id ($fetch_mode.PEEK[$part]$partial)"; |
| | | $result = false; |
| | | $found = false; |
| | | $initiated = true; |
| | | $key = $this->nextTag(); |
| | | $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id ($fetch_mode.PEEK[$part]$partial)"; |
| | | $result = false; |
| | | $found = false; |
| | | $initiated = true; |
| | | |
| | | // send request |
| | | if (!$this->putLine($request)) { |
| | |
| | | |
| | | $line = trim($this->readLine(1024)); |
| | | |
| | | // handle UNKNOWN-CTE response - RFC 3516, try standard BODY request instead of BINARY |
| | | if ($binary && preg_match('/^' . $key . ' NO \[UNKNOWN-CTE\]/i', $line)) { |
| | | $initiated = false; |
| | | continue; |
| | | } |
| | | |
| | | if (!$line) { |
| | | break; |
| | | } |
| | | |
| | | // handle UNKNOWN-CTE response - RFC 3516, try again with standard BODY request |
| | | if ($binary && !$found && preg_match('/^' . $key . ' NO \[UNKNOWN-CTE\]/i', $line)) { |
| | | $binary = $initiated = false; |
| | | continue; |
| | | } |
| | | |
| | | // skip irrelevant untagged responses (we have a result already) |
| | |
| | | } |
| | | } |
| | | } |
| | | } while (!$this->startsWith($line, $key, true)); |
| | | } while (!$this->startsWith($line, $key, true) || !$initiated); |
| | | |
| | | if ($result !== false) { |
| | | if ($file) { |
| | |
| | | } |
| | | |
| | | foreach ($data as $entry) { |
| | | // Workaround cyrus-murder bug, the entry[2] string needs to be escaped |
| | | if (self::$mupdate) { |
| | | $entry[2] = addcslashes($entry[2], '\\"'); |
| | | } |
| | | |
| | | // ANNOTATEMORE drafts before version 08 require quoted parameters |
| | | $entries[] = sprintf('%s (%s %s)', $this->escape($entry[0], true), |
| | | $this->escape($entry[1], true), $this->escape($entry[2], true)); |
| | |
| | | |
| | | if (!isset($this->prefs['literal+']) && in_array('LITERAL+', $this->capability)) { |
| | | $this->prefs['literal+'] = true; |
| | | } |
| | | |
| | | if (preg_match('/(\[| )MUPDATE=.*/', $str)) { |
| | | self::$mupdate = true; |
| | | } |
| | | |
| | | if ($trusted) { |