return $content;
}
-sub check_canedit ($$$;$) {
+sub check_canedit ($$$;$$) {
my $page=shift;
my $q=shift;
my $session=shift;
my $nonfatal=shift;
+ my $nosubs=shift;
my $canedit;
run_hooks(canedit => sub {
$canedit=1;
}
elsif (ref $ret eq 'CODE') {
+ error(sprintf(gettext("you are not allowed to change %s"), $page)) if $nosubs && ! $nonfatal;
$ret->() unless $nonfatal;
$canedit=0;
}
my $path=shift;
my $from=shift;
- if ($path =~ m!^\./!) {
- $from=~s#/?[^/]+$## if defined $from;
- $path=~s#^\./##;
- $path="$from/$path" if defined $from && length $from;
+ if ($path =~ m!^\.(/|$)!) {
+ if ($1) {
+ $from=~s#/?[^/]+$## if defined $from;
+ $path=~s#^\./##;
+ $path="$from/$path" if defined $from && length $from;
+ }
+ else {
+ $path = $from;
+ $path = "" unless defined $path;
+ }
}
return $path;