Parent Directory
|
Revision Log
Now more strict code
| 1 | wakaba | 1.1 | #!/usr/bin/perl |
| 2 | |||
| 3 | wakaba | 1.2 | ## NOTE: This script must not be called other than from mod_rewrite |
| 4 | wakaba | 1.1 | use strict; |
| 5 | |||
| 6 | my $path = $ENV{QUERY_STRING}; | ||
| 7 | $path =~ s#^uri=##; | ||
| 8 | $path =~ s#,[^,]+$##; | ||
| 9 | $path =~ s/\#.*\z//s; | ||
| 10 | $path =~ s/\?.*\z//s; | ||
| 11 | wakaba | 1.2 | $path = decode_path (canon_path ($path)); |
| 12 | wakaba | 1.1 | |
| 13 | my $file; | ||
| 14 | wakaba | 1.2 | if ($path =~ s#^/~(hero|wakaba|fuyu)/##) { |
| 15 | wakaba | 1.1 | $file = qq'/home/$1/public_html/' . $path; |
| 16 | } else { | ||
| 17 | $file = '/home/httpd/html' . $path; | ||
| 18 | } | ||
| 19 | |||
| 20 | my $dir = $file; | ||
| 21 | my $file_name = ''; | ||
| 22 | $dir =~ s#/$##; | ||
| 23 | unless (-d $dir) { | ||
| 24 | $dir =~ s#/([^/]+)$ |