| | |
| | | |
| | | do { |
| | | $buffer = fgets($fp, $size); |
| | | |
| | | if ($buffer === false) { |
| | | break; |
| | | } |
| | |
| | | return $data; |
| | | } |
| | | |
| | | // don't use it in loops, until you exactly know what you're doing |
| | | function iil_ReadReply($fp) { |
| | | do { |
| | | $line = trim(iil_ReadLine($fp, 1024)); |
| | |
| | | |
| | | iil_PutLine($conn->fp, 'a001 LOGIN "'.iil_Escape($user).'" "'.iil_Escape($password).'"'); |
| | | |
| | | do { |
| | | $line = iil_ReadReply($conn->fp); |
| | | if ($line === false) { |
| | | break; |
| | | } |
| | | } while (!iil_StartsWith($line, 'a001 ', true)); |
| | | |
| | | // process result |
| | | $result = iil_ParseResult($line); |
| | |
| | | } else if ($my_prefs['sort_field'] == 'DATE') { |
| | | $IMAP_USE_INTERNAL_DATE = false; |
| | | } |
| | | //echo '<!-- conn sort_field: '.$my_prefs['sort_field'].' //-->'; |
| | | |
| | | //check input |
| | | if (empty($host)) { |
| | |
| | | stream_set_timeout($conn->fp, 10); |
| | | $line = stream_get_line($conn->fp, 8192, "\r\n"); |
| | | |
| | | if ($my_prefs['debug_mode'] && $line) |
| | | write_log('imap', 'S: '. $line); |
| | | |
| | | // Connected to wrong port or connection error? |
| | | if (!preg_match('/^\* (OK|PREAUTH)/i', $line)) { |
| | | if ($line) |