diff options
-rwxr-xr-x | php.req | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -35,10 +35,10 @@ foreach (@ARGV ? $ARGV : <> ) { while (<F>) { # skip comments next if (/^\s*(#|\/\/|\*|\/\*)/); - while (/(\W|^)(require|include)(_once)? \s* \(? \s* ("([^"]*)"|'([^']*)') \s* \)? \s* ;/xg) { + if ($5 ne "") { $x = $5; } elsif ($6 ne "") { @@ -46,7 +46,8 @@ foreach (@ARGV ? $ARGV : <> ) { } else { next; } - + do $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//; + do $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//; next if ($x =~ m|^\.\.?/| or $x =~ /\$/); next unless ($x =~ /\.php$/); $req{$x} = 1; @@ -69,7 +70,8 @@ foreach (@ARGV ? $ARGV : <> ) { next unless ($x =~ /\.php$/); $x = "$file_dir/$x"; - $x =~ s|/+|/|g; + do $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//; + do $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//; $req{$x} = 1; } } |