aboutsummaryrefslogtreecommitdiff
path: root/orig/minimun
diff options
context:
space:
mode:
Diffstat (limited to 'orig/minimun')
-rw-r--r--orig/minimun55
1 files changed, 55 insertions, 0 deletions
diff --git a/orig/minimun b/orig/minimun
new file mode 100644
index 0000000..f6f9407
--- /dev/null
+++ b/orig/minimun
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use File::Temp qw( tempfile );
+use File::Copy;
+
+chdir('/tmp');
+
+$buffer, %FORM;
+
+if ($ENV{'REQUEST_METHOD'} eq "GET") {
+ $buffer = $ENV{'QUERY_STRING'};
+}
+@pairs = split(/&/, $buffer);
+
+foreach $pair (@pairs) {
+ my ($name, $val) = split(/=/, $pair);
+ $val =~ tr/+/ /;
+ $val =~ s/%(..)/pack("C", hex($1))/eg;
+ $val =~ s/([#%_\$^&{}\\])/\\$1/g;
+ $FORM{$name} = $val;
+}
+
+($fh, $filename) = tempfile(UNLINK => 1);
+copy("%%DEST%%/format.tex",$fh);
+
+print $fh "\n";
+
+if (index($ENV{'PATH_INFO'},'award.pdf') != -1){
+ say $fh "\\award{$FORM{'committee'}}{$FORM{'country'}}{$FORM{'award'}}{$FORM{'school'}}";
+}
+elsif (index($ENV{'PATH_INFO'},'room.pdf') != -1){
+ say $fh "\\room{$FORM{'committee'}}";
+}
+else{
+ print "Content-type: text/html\n";
+ print "Status: 404 File Not Found Error\n\n";
+ print '<a href="/">404 Error. Go back.</a>';
+ die;
+}
+
+say $fh "\\bye";
+
+system ('/usr/bin/pdftex', $filename);
+open(DOC, '<', "$filename.pdf") or {
+ print "Content-type: text/html\n";
+ print "Status: 400 Bad Request Error\n\n";
+ print '<h1>400 Bad Request</h1>';
+ die;
+}
+print "Content-type: application/pdf\n\n";
+print <DOC>;
+close(DOC);
+unlink "$filename.pdf", "$filename.log";