| | |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Struct representing an e-mail message header |
| | | * |
| | | * @package Mail |
| | | * @author Aleksander Machniak <alec@alec.pl> |
| | | */ |
| | | class rcube_mail_header |
| | | { |
| | | public $id; |
| | |
| | | public $others = array(); |
| | | } |
| | | |
| | | // For backward compatibility with cached messages (#1486602) |
| | | class iilBasicHeader extends rcube_mail_header |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * PHP based wrapper class to connect to an IMAP server |
| | | * |
| | | * @package Mail |
| | | * @author Aleksander Machniak <alec@alec.pl> |
| | | */ |
| | | class rcube_imap_generic |
| | | { |
| | | public $error; |
| | |
| | | } |
| | | |
| | | // generate hash |
| | | $hash = md5($this->xor($pass,$opad) . pack("H*", md5($this->xor($pass, $ipad) . base64_decode($encChallenge)))); |
| | | $hash = md5($this->_xor($pass,$opad) . pack("H*", md5($this->_xor($pass, $ipad) . base64_decode($encChallenge)))); |
| | | |
| | | // generate reply |
| | | $reply = base64_encode($user . ' ' . $hash); |
| | |
| | | // process result |
| | | $result = $this->parseResult($line); |
| | | if ($result == 0) { |
| | | $this->error .= ''; |
| | | $this->errornum = 0; |
| | | $this->errornum = 0; |
| | | return $this->fp; |
| | | } |
| | | |
| | | $this->error .= 'Authentication for ' . $user . ' failed (AUTH): "'; |
| | | $this->error .= htmlspecialchars($line) . '"'; |
| | | $this->errornum = $result; |
| | | $this->error = "Authentication for $user failed (AUTH): $line"; |
| | | $this->errornum = $result; |
| | | |
| | | return $result; |
| | | } |
| | |
| | | $result = $this->parseResult($line); |
| | | |
| | | if ($result == 0) { |
| | | $this->error .= ''; |
| | | $this->errornum = 0; |
| | | $this->errornum = 0; |
| | | return $this->fp; |
| | | } |
| | | |
| | | fclose($this->fp); |
| | | $this->fp = false; |
| | | |
| | | $this->error .= 'Authentication for ' . $user . ' failed (LOGIN): "'; |
| | | $this->error .= htmlspecialchars($line)."\""; |
| | | $this->errornum = $result; |
| | | $this->error = "Authentication for $user failed (LOGIN): $line"; |
| | | $this->errornum = $result; |
| | | |
| | | return $result; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | function search($folder, $criteria) |
| | | function search($folder, $criteria, $return_uid=false) |
| | | { |
| | | if (!$this->select($folder)) { |
| | | return false; |
| | | } |
| | | |
| | | $data = ''; |
| | | $query = "srch1 SEARCH " . chop($criteria); |
| | | $query = 'srch1 ' . ($return_uid ? 'UID ' : '') . 'SEARCH ' . chop($criteria); |
| | | |
| | | if (!$this->putLineC($query)) { |
| | | return false; |
| | | } |
| | | |
| | | do { |
| | | $line = trim($this->readLine()); |
| | | if ($this->startsWith($line, '* SEARCH')) { |
| | |
| | | return $result; |
| | | } |
| | | |
| | | private function xor($string, $string2) |
| | | private function _xor($string, $string2) |
| | | { |
| | | $result = ''; |
| | | $size = strlen($string); |