1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-10 00:28:34 +02:00

IMAP: Use imap_num_msg()

This commit is contained in:
Jakub Vrana
2025-03-18 19:46:08 +01:00
parent bda53f0734
commit 8a64fb16cd

View File

@@ -21,7 +21,7 @@ if (isset($_GET["imap"])) {
class Db { class Db {
public $extension = "IMAP"; public $extension = "IMAP";
public $error; public $error;
public $server_info = "?"; // imap_mailboxmsginfo() doesn't return anything useful public $server_info = "?"; // imap_mailboxmsginfo() or imap_check() don't return anything useful
private $mailbox; private $mailbox;
private $imap; private $imap;
@@ -51,8 +51,8 @@ if (isset($_GET["imap"])) {
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 {
$check = imap_check($this->imap); $count = imap_num_msg($this->imap);
$range = ($offset + 1) . ":" . ($limit ? min($check->Nmsgs, $offset + $limit) : $check->Nmsgs); $range = ($offset + 1) . ":" . ($limit ? min($count, $offset + $limit) : $count);
$return = array(); $return = array();
$fields = fields($table); $fields = fields($table);
$columns = ($columns == "*" ? $fields : array_flip(explode(", ", $columns))); $columns = ($columns == "*" ? $fields : array_flip(explode(", ", $columns)));