[! use Proxmox::Form; use Proxmox::Utils; use Proxmox::ConfigServer; use Proxmox::Config::System; use Proxmox::RuleDB; use Proxmox::HTMLTable; !] [- my $system_cfg = $fdat{__system_config}; my $rdb = Proxmox::RuleDB->new(); my $dbh = $rdb->{dbh}; my $url = $req_rec->uri; my $out = ""; my $page_size = 1000; my $cpos; my $sth = $dbh->prepare("SELECT COUNT(*) as max FROM CGreylist WHERE passed = 0"); $sth->execute(); my $ref = $sth->fetchrow_hashref(); my $max = $ref->{'max'}; if (!defined ($fdat{cpos})) { $cpos = int (($max - 1)/$page_size) * $page_size; } else { $cpos = $fdat{cpos}; } $sth = $dbh->prepare("SELECT * FROM CGreylist " . "WHERE passed = 0 ORDER BY RCTime LIMIT ? OFFSET ?"); if ($sth->execute($page_size, $cpos) > 0) { $out .= Proxmox::HTMLTable::generate_page_navigator ($url, $max, $page_size, $cpos); $out .= "\n"; $out .= ""; $out .= ""; $out .= ""; $out .= ""; $out .= "\n"; my $count = 0; while (my $ref = $sth->fetchrow_hashref()) { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime ($ref->{'rctime'}); $mon++; $year+=1900; my $rctime = sprintf ("%02d.%02d.%04d %02d:%02d", $mday, $mon, $year, $hour, $min); my $sender = $ref->{sender}; # Too long Email sender can expand the GUI too much. if (length $sender > 23) { $sender =~ m/(.{10})(.*)(.{10})/; $sender = $1."...".$3; } $rctime =~ s/\s+/ /; my $col = $count & 1 ? "#FFFFFF" : "#EDEDED"; $out .= "\n"; $count++; } $out .= "
" . __('Sender IP') . "" . __('Arrival Time') . "" . __('From') . "" . __('To') . "
" . $ref->{ipnet} . '.' . $ref->{host} . '' . $rctime . '' . $sender . '' . $ref->{receiver} . "
\n"; } else { $out .= "

" . __("There are no items in this list") . ".

"; } print OUT $out; -]