mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 16:17:48 +02:00
IMAP: Use halfopen
This commit is contained in:
@@ -26,7 +26,7 @@ if (isset($_GET["imap"])) {
|
|||||||
|
|
||||||
function connect($server, $username, $password) {
|
function connect($server, $username, $password) {
|
||||||
$this->mailbox = "{" . "$server:993/ssl}"; // Adminer disallows specifying privileged port in server name
|
$this->mailbox = "{" . "$server:993/ssl}"; // Adminer disallows specifying privileged port in server name
|
||||||
$this->imap = @imap_open($this->mailbox, $username, $password, 0, 1);
|
$this->imap = @imap_open($this->mailbox, $username, $password, OP_HALFOPEN, 1);
|
||||||
if (!$this->imap) {
|
if (!$this->imap) {
|
||||||
$this->error = imap_last_error();
|
$this->error = imap_last_error();
|
||||||
}
|
}
|
||||||
@@ -46,10 +46,10 @@ if (isset($_GET["imap"])) {
|
|||||||
return new Result(array(array($status["Rows"])));
|
return new Result(array(array($status["Rows"])));
|
||||||
} elseif (preg_match('~^SELECT (.+)\sFROM "(.+?)"(?:\sWHERE "uid" = (\d+))?.*?(?:\sLIMIT (\d+)(?:\sOFFSET (\d+))?)?~s', $query, $match)) {
|
} elseif (preg_match('~^SELECT (.+)\sFROM "(.+?)"(?:\sWHERE "uid" = (\d+))?.*?(?:\sLIMIT (\d+)(?:\sOFFSET (\d+))?)?~s', $query, $match)) {
|
||||||
list(, $columns, $table, $uid, $limit, $offset) = $match;
|
list(, $columns, $table, $uid, $limit, $offset) = $match;
|
||||||
|
imap_reopen($this->imap, $this->mailbox . $table);
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
$return = array((array) imap_fetchstructure($this->imap, $uid, FT_UID));
|
$return = array((array) imap_fetchstructure($this->imap, $uid, FT_UID));
|
||||||
} else {
|
} else {
|
||||||
imap_reopen($this->imap, "$this->mailbox$table");
|
|
||||||
$check = imap_check($this->imap);
|
$check = imap_check($this->imap);
|
||||||
$range = ($offset + 1) . ":" . ($limit ? min($check->Nmsgs, $offset + $limit) : $check->Nmsgs);
|
$range = ($offset + 1) . ":" . ($limit ? min($check->Nmsgs, $offset + $limit) : $check->Nmsgs);
|
||||||
$return = array();
|
$return = array();
|
||||||
|
Reference in New Issue
Block a user