Show show_stats.html syntax highlighted
% # vim: set syntax=mason:
<& /mail/header.mhtml, title => "Cache statistics" &>
<pre>
% $m->print(getStats($c));
</pre>
<& /mail/footer.mhtml &>
<%init>
my %allowed = (
tkay => 1,
hak => 1,
consult => 1,
joelja => 1,
joe => 1,
llynch => 1,
eyildiri => 1,
miyake => 1
);
my $user = Apache::SiteControl->getCurrentUser($r);
$m->redirect(build_url('/mail/index.html', { message => "Not allowed."})) if !$allowed{$user->getUsername()};
my $prefs = new AlphaMail::Preferences($user->getUsername(),
$user->getAttribute('imap'), $config);
my $c = new AlphaMail::Middleware($user->getAttribute('imap'),
$user->getUsername(),
$user->getAttribute('password'),
$config);
</%init>
<%once>
use Encode;
use AlphaMail::Preferences;
our $logger = Log::Log4perl->get_logger('alphamail');
sub getStats
{
my $this = shift;
my $line = 0;
my @resp;
$this->{con}->print("stats\n");
do {
last if($this->{con}->eof());
$line = $this->{con}->getline();
push @resp, $line;
last if(!defined($line));
} while($line !~ /^(ok|no)/i);
return @resp;
}
</%once>
See more files for this project here