Show excel.html syntax highlighted
% # vim: set syntax=mason:
<%args>
$file
$format => 'text'
</%args>
<%init>
my $logger = Log::Log4perl->get_logger('alphamail');
my $user = Apache::SiteControl->getCurrentUser($r);
my $prefix = $config->get("message_tmpdir", "/tmp");
my $legal = "/" . $user->getAttribute('imap') . "_" . $user->getUsername();
my $username = $user->getUsername();
my $xlhtml = $config->get('xlhtml');
my $sandbox_dir = $config->get('sandbox');
my $sandbox = $config->get('sandbox_util');
if($file !~ m/^\Q$legal\E/i || $file =~ m!/\.\./!) {
$logger->logcroak("Security Violation! $username attempted to view $file. Prefix was $prefix");
}
my $name = $file;
$name =~ s!^.*/([^/]*)$!$1!;
unlink "$sandbox_dir/tmp/$name";
link "$prefix$file", "$sandbox_dir/tmp/$name" or $logger->error("Could not create link from $file to $sandbox_dir/tmp");
$r->content_type('text/html');
my @lines = qx($sandbox $xlhtml '/tmp/$name' 2>&1);
unlink "$sandbox_dir/tmp/$name";
$m->print(@lines);
</%init>
<%once>
$config = new AlphaMail::Config($r->dir_config('AlphamailParameters'));
</%once>
See more files for this project here