Code Search for Developers
 
 
  

get_attachment.html from AlphaMail at Krugle


Show get_attachment.html syntax highlighted

% # vim: set syntax=mason:
<%args>
$file
$type
$subtype
</%args>
<%init>
my $user = Apache::SiteControl->getCurrentUser($r);
my $logger = Log::Log4perl->get_logger('alphamail');
my $prefix = $config->get("message_tmpdir", '/tmp') . "/" .  
             $user->getAttribute('imap') .  "_" . $user->getUsername();
my $username = $user->getUsername();

if($file !~ m/^\Q$prefix\E\/msg[-\d]*\/[^\/]*$/i || $file =~ m!/\.\./!) {
   $logger->logcroak("Security Violation! $username attempted to view $file. Prefix was $prefix");
}

my $sf = $file;
$sf =~ s!^.*/([^/]+)$!$1!;

$logger->debug("Getting attachment $file ($type/$subtype)");

$r->content_type("$type/$subtype");
$r->header_out('Content-Disposition' => qq(attachment; filename="$sf"));
$r->send_http_header;

open DATA, "<$file" or logger->logcroak("Could not open file: $file");
my $line;
while($line = <DATA>) {
   $m->print($line);
}
close DATA;
</%init>




See more files for this project here

AlphaMail

AlphaMail is an accelerated web mail interface with a C++ middleware layer that is more effective than an IMAP proxy which is a highly scalable (10k+ users). The interface includes modern features, Section 508 compliance, and universal browser support.

Project homepage: http://sourceforge.net/projects/alphamail
Programming language(s): C++,Java,JavaScript,Perl
License: other

  addressbook/
    autohandler
    edit.mhtml
    import.mhtml
    import_csv.html
    import_imho.html
    index.html
    process_edit.html
    take.html
  settings/
    altfolder_update.html
    autohandler
    edit_folders.html
    folders.mhtml
    general.mhtml
    index.html
    share.mhtml
    sharing_agree.html
    signatures.mhtml
    update_folderlist.html
    update_general.html
    update_signatures.html
  viewers/
    excel.html
    html.html
    targz.html
    word.html
    zip.html
  address_mail.html
  addresslist.mhtml
  check_spelling.html
  compose.html
  filevault.html
  first_login.html
  fix_spelling.html
  folderlist.mhtml
  footer.mhtml
  get_attachment.html
  header.mhtml
  index.html
  logout.html
  menu.mhtml
  other_folders.html
  print.html
  process_compose.html
  process_first_login.html
  process_messages.html
  read.html
  renew_session.html
  share_options.html
  share_upload.html
  verify_password.html
  view_attachment.html