Browse Source

Add support in popcon-submit.cgi to save directly to disk instead of sending emails.

suites/ascii
Petter Reinholdtsen 17 years ago
parent
commit
2ec7f6c679
  1. 2
      debian/changelog
  2. 34
      popcon-submit.cgi

2
debian/changelog

@ -12,6 +12,8 @@ popularity-contest (1.31) UNRELEASED; urgency=low
- Change popcon-submit.cgi to handle uploads in both the old
upload format and the new upload format, as well as the ubuntu
(uncompressed) format.
- Add support in popcon-submit.cgi to save directly to disk
instead of sending emails.
* Translations
- Updated Japanese from Kenshi Muto. (Closes: #317402)
- Updated Russian from Yuri Kozlov. (Closes: #317449)

34
popcon-submit.cgi

@ -17,6 +17,10 @@ use Compress::Zlib;
my $email='survey@popcon.debian.org';
my $directsave = 0; # Enable to store on disk instead of sending an email
my $basedir = "/var/lib/popcon";
my $uploaddir = "$basedir/popcon-data/";
$ENV{PATH}="";
print "Content-Type: text/plain\n\n";
@ -69,15 +73,31 @@ if (exists $ENV{CONTENT_TYPE} && $ENV{CONTENT_TYPE} =~ m%multipart/form-data%){
@entry = <GZIP>;
}
open POPCON, "|/usr/lib/sendmail -oi $email" or die "sendmail";
print POPCON <<"EOF";
my ($id1, $id2) =
$entry[0] =~ m/POPULARITY-CONTEST-0 .+ ID:(\S\S)(\S+) /;
if ($id1) {
if ($directsave) {
-d $uploaddir || mkdir $uploaddir;
my $dir = "$uploaddir/$id1";
-d $dir || mkdir $dir;
open(POPCON, ">$dir/$id1$id2") || die "Unable to write to '$dir/$id1$id2'";
print POPCON @entry;
close POPCON;
} else {
open POPCON, "|/usr/lib/sendmail -oi $email" or die "sendmail";
print POPCON <<"EOF";
To: $email
Subject: popularity-contest submission
EOF
print POPCON @entry;
close POPCON;
print "Thanks for your submission to Debian Popularity-Contest!\n";
print "DEBIAN POPCON HTTP-POST OK\n";
print POPCON @entry;
close POPCON;
}
}
if ($id1) {
print "Thanks for your submission to Debian Popularity-Contest!\n";
print "DEBIAN POPCON HTTP-POST OK\n";
} else {
print "The submission to Debian Popularity-Contest!\n";
}
exit 0;

Loading…
Cancel
Save