function stream_open($path, $mode, $options, &$opened_path) { $this->report_errors = ($options & STREAM_REPORT_ERRORS) != 0; if (strcmp($mode, "r")) { return $this->SetError("the message can only be opened for reading"); } $url = parse_url($path); $host = $url['host']; $pop3 =& pop3_class::SetConnection(0, $host, $this->pop3); if (isset($pop3)) { $this->pop3 =& $pop3; $this->previous_connection = 1; } else { $this->pop3 = new pop3_class(); } if (!$this->ParsePath($path, $url)) { return FALSE; } $message = substr($url["path"], 1); if (strcmp(intval($message), $message) || $message <= 0) { return $this->SetError("it was not specified a valid message to retrieve"); } if (!$this->previous_connection) { if (strlen($error = $this->pop3->Open())) { return $this->SetError($error); } $this->opened = 1; $apop = isset($url["query"]["apop"]) ? intval($url["query"]["apop"]) : 0; if (strlen($error = $this->pop3->Login(UrlDecode($url["user"]), UrlDecode($url["pass"]), $apop))) { $this->stream_close(); return $this->SetError($error); } } if (strlen($error = $this->pop3->OpenMessage($message, -1))) { $this->stream_close(); return $this->SetError($error); } $this->end_of_message = FALSE; if ($options & STREAM_USE_PATH) { $opened_path = $path; } $this->read = 0; $this->buffer = ""; return TRUE; }