| | |
| | | |
| | | $GLOBALS['IMAP_SERVER_TZ'] = date('Z'); |
| | | |
| | | $GLOBALS['IMAP_FLAGS'] = array( |
| | | 'SEEN' => '\\Seen', |
| | | 'DELETED' => '\\Deleted', |
| | | 'RECENT' => '\\Recent', |
| | | 'ANSWERED' => '\\Answered', |
| | | 'DRAFT' => '\\Draft', |
| | | 'FLAGGED' => '\\Flagged', |
| | | 'FORWARDED' => '$Forwarded', |
| | | 'MDNSENT' => '$MDNSent'); |
| | | |
| | | $iil_error; |
| | | $iil_errornum; |
| | | $iil_selected; |
| | |
| | | var $rootdir; |
| | | var $delimiter; |
| | | var $capability = array(); |
| | | var $permanentflags = array(); |
| | | } |
| | | |
| | | /** |
| | |
| | | var $priority; |
| | | var $mdn_to; |
| | | var $mdn_sent = false; |
| | | var $is_reply = false; |
| | | var $is_draft = false; |
| | | var $seen = false; |
| | | var $deleted = false; |
| | | var $recent = false; |
| | | var $answered = false; |
| | | var $forwarded = false; |
| | | var $junk = false; |
| | | var $flagged = false; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | // generate hash |
| | | $hash = iil_xor($pass,$opad); |
| | | $hash .= pack("H*", md5(iil_xor($pass, $ipad) . base64_decode($encChallenge))); |
| | | $hash = md5($hash); |
| | | $hash = md5(iil_xor($pass,$opad) . pack("H*", md5(iil_xor($pass, $ipad) . base64_decode($encChallenge)))); |
| | | |
| | | // generate reply |
| | | $reply = base64_encode('"' . $user . '" "' . $hash . '"'); |
| | | $reply = base64_encode($user . ' ' . $hash); |
| | | |
| | | // send result, get reply |
| | | iil_PutLine($conn->fp, $reply); |
| | |
| | | //do CRAM-MD5 authentication |
| | | iil_PutLine($conn->fp, "a000 AUTHENTICATE CRAM-MD5"); |
| | | $line = trim(iil_ReadLine($conn->fp, 1024)); |
| | | |
| | | |
| | | $conn->message .= "$line\n"; |
| | | |
| | | |
| | | if ($line[0] == '+') { |
| | | $conn->message .= 'Got challenge: ' . htmlspecialchars($line) . "\n"; |
| | | |
| | |
| | | $conn->message .= "Tried CRAM-MD5: $result \n"; |
| | | } else { |
| | | $conn->message .='No challenge ('.htmlspecialchars($line)."), try plain\n"; |
| | | $auth = 'plain'; |
| | | $auth = 'plain'; |
| | | } |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | if (strcmp($conn->selected, $mailbox) == 0) { |
| | | return true; |
| | | return true; |
| | | } |
| | | |
| | | iil_C_LoadCache($conn, $mailbox); |
| | |
| | | if (strcasecmp($a[2], 'EXISTS') == 0) { |
| | | $conn->exists = (int) $a[1]; |
| | | } |
| | | if (strcasecmp($a[2], 'RECENT') == 0) { |
| | | $conn->recent = (int) $a[1]; |
| | | } |
| | | if (strcasecmp($a[2], 'RECENT') == 0) { |
| | | $conn->recent = (int) $a[1]; |
| | | } |
| | | } |
| | | else if (preg_match('/\[?PERMANENTFLAGS\s+\(([^\)]+)\)\]/U', $line, $match)) { |
| | | $conn->permanentflags = explode(' ', $match[1]); |
| | | } |
| | | } while (!iil_StartsWith($line, 'sel1')); |
| | | |
| | |
| | | // process flags |
| | | $flags_str = eregi_replace('[\\\"]', '', $flags_str); |
| | | $flags_a = explode(' ', $flags_str); |
| | | |
| | | /* |
| | | trigger_error("<!-- ID: $id FLAGS: ".implode(",", $flags_a)." //-->\n", |
| | | E_USER_WARNING); |
| | | */ |
| | | |
| | | if (is_array($flags_a)) { |
| | | reset($flags_a); |
| | |
| | | $result[$id]->recent = true; |
| | | } else if (strcasecmp($val, 'Answered') == 0) { |
| | | $result[$id]->answered = true; |
| | | } else if (strcasecmp($val, "\$MDNSent") == 0) { |
| | | } else if (strcasecmp($val, '$Forwarded') == 0) { |
| | | $result[$id]->forwarded = true; |
| | | } else if (strcasecmp($val, 'Draft') == 0) { |
| | | $result[$id]->is_draft = true; |
| | | } else if (strcasecmp($val, '$MDNSent') == 0) { |
| | | $result[$id]->mdn_sent = true; |
| | | } |
| | | } else if (strcasecmp($val, 'Flagged') == 0) { |
| | | $result[$id]->flagged = true; |
| | | } |
| | | } |
| | | $result[$id]->flags = $flags_a; |
| | | } |
| | |
| | | } |
| | | |
| | | $fp = $conn->fp; |
| | | $flags = array( |
| | | 'SEEN' => '\\Seen', |
| | | 'DELETED' => '\\Deleted', |
| | | 'RECENT' => '\\Recent', |
| | | 'ANSWERED' => '\\Answered', |
| | | 'DRAFT' => '\\Draft', |
| | | 'FLAGGED' => '\\Flagged', |
| | | 'MDNSENT' => "\$MDNSent"); |
| | | $flags = $GLOBALS['IMAP_FLAGS']; |
| | | |
| | | $flag = strtoupper($flag); |
| | | $flag = $flags[$flag]; |
| | |
| | | |
| | | if (iil_C_Select($conn, $folder)) { |
| | | $key = 'F1247'; |
| | | |
| | | |
| | | if (iil_PutLine($fp, "$key FETCH $id (BODYSTRUCTURE)")) { |
| | | do { |
| | | $line = iil_ReadLine($fp, 5000); |
| | | $line = iil_MultLine($fp, $line); |
| | | $result .= $line; |
| | | list(, $index, $rest) = explode(' ', $line); |
| | | if ($index == $id || preg_match("/^$key/", $line)) |
| | | $result .= $line; |
| | | } while (!preg_match("/^$key/", $line)); |
| | | |
| | | $result = trim(substr($result, strpos($result, 'BODYSTRUCTURE')+13, -(strlen($result)-strrpos($result, $key)+1))); |