X-Git-Url: http://git.shiar.nl/perl/plp/.git/blobdiff_plain/b5eadb0c810558015cd4dc943e2c25b4acbfec58..52b63e9e0c0e3d3019a2751158f59cae036b6fe4:/plp.cgi diff --git a/plp.cgi b/plp.cgi old mode 100755 new mode 100644 index 3bf77f9..aa3b32f --- a/plp.cgi +++ b/plp.cgi @@ -1,82 +1,9 @@ #!/usr/bin/perl -use strict; -use vars qw($VERSION %INTERNAL %get %post %fields %header %cookie %BLOCK $DEBUG $output); -$VERSION = '2.21'; -$DEBUG = 1; +# 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; - { - no strict; - eval $INTERNAL{pre}; - if ($@ && $DEBUG){ - print "\nDebug:\n $@"; - } - } -} - -for (keys %header){ - print "$_: $header{$_}\n"; -} -print "\n"; - -{ - no strict; - eval $INTERNAL{code}; - if ($@ && $DEBUG){ - print "
Debug
", Entity($@); - } -}