X-Git-Url: http://git.shiar.nl/gitweb.cgi/perl/plp/.git/blobdiff_plain/6b971262dcda8586066379c1b3fcea9c457ce575..a90cee2f6bfee8b46014eeafaf42ed653ba8740b:/plp.cgi?ds=inline diff --git a/plp.cgi b/plp.cgi old mode 100755 new mode 100644 index c281fc0..aa3b32f --- a/plp.cgi +++ b/plp.cgi @@ -1,74 +1,9 @@ #!/usr/bin/perl -$VERSION = '2.01'; +# This script is not installed automatically, and is not needed for mod_perl +# installations. -$INTERNAL{file} = $ENV{PATH_TRANSLATED}; -unless (-e $INTERNAL{file}){ - $ENV{REDIRECT_STATUS} = '404'; - print STDERR "htmpl: Not found: $INTERNAL{file}\n"; +use PLP; +PLP::everything(); - #Change this if you have an error handling script. - print `/vhost/COMMON/err.cgi` || "Status: 404 Not found\n\nFile not found"; - - exit; -} -($INTERNAL{dir} = $INTERNAL{file}) =~ s{^(.*)/.*?$}[$1]; -chdir $INTERNAL{dir}; - -($ENV{PLP_NAME} = $ENV{REQUEST_URI}) =~ s/\?.*$//; - -use plp; - -$INTERNAL{qq} = ""; #^P -$INTERNAL{q} = ""; #^Q - -$header{'content-type'} = 'text/html'; -$header{'status'} = '200 OK'; - -$INTERNAL{code} = ReadFile($INTERNAL{file}); - -while ($INTERNAL{code} =~ /<\((.*?)\)>/ ){ - ($INTERNAL{file} = $1) =~ s/[<>\|]//g; - $INTERNAL{code} =~ s//ReadFile($INTERNAL{file})/e; -} - -$INTERNAL{code} =~ s(<:)($INTERNAL{q};)g; -$INTERNAL{code} =~ s(:>)(;\nprint q$INTERNAL{q})g; - -while ($INTERNAL{code} =~ /(<\[1(.*?)\]>(.*?)<\[2\]>(.*?)<\[3\]>)/s){ - $INTERNAL{naam} = $2; - $BLOCK{"$INTERNAL{naam}-1"} = $3; - $BLOCK{"$INTERNAL{naam}-2"} = $4; - $INTERNAL{code} =~ s///; #Redo last match -} -$INTERNAL{code} =~ s(\\\\\r?\n)()g; -$INTERNAL{code} =~ s(<\[([^>]*?):(.*?)\]>)($BLOCK{"${1}-1"}$2$BLOCK{"${1}-2"})g; -$INTERNAL{code} =~ s(<\[(?!/)(.*?)\]>)($BLOCK{"${1}-1"})g; -$INTERNAL{code} =~ s(<\[/(.*?)\]>)($BLOCK{"${1}-2"})g; -$INTERNAL{code} =~ s(<{[ \08\09]*)($INTERNAL{q};print qq$INTERNAL{qq})g; -$INTERNAL{code} =~ s([ \08\09]*}>)($INTERNAL{qq};print q$INTERNAL{q})g; -$INTERNAL{code} = "print q$INTERNAL{q}$INTERNAL{code}$INTERNAL{q};"; - -$INTERNAL{code} =~ s{print qq$INTERNAL{qq}$INTERNAL{qq};}[]g; -$INTERNAL{code} =~ s{print q$INTERNAL{q}$INTERNAL{q};}[]g; - - -while ($INTERNAL{code} =~ s/<_(.*?)_>//s){ - $INTERNAL{pre} = $1; - eval $INTERNAL{pre}; -} - -for (keys %header){ - print "$_: $header{$_}\n"; -} -print "\n"; - -eval $INTERNAL{code}; -if ($@){ - print "
$INTERNAL{code}
$output"; -}