]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
search: add more classes as a hook for CSS. Thanks, sajolida
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index b6f47a3a7f73c2e0c8cba26f859ea47b334a8ad9..f448db6ef8a213fa84d57f72ad236569c510d304 100644 (file)
@@ -59,14 +59,17 @@ sub cgitemplate ($$$;@) {
        my $template=template("page.tmpl");
 
        my $topurl = $config{url};
        my $template=template("page.tmpl");
 
        my $topurl = $config{url};
-       if (defined $cgi && ! $config{w3mmode}) {
+       if (defined $cgi && ! $config{w3mmode} && ! $config{reverse_proxy}) {
                $topurl = $cgi->url;
        }
 
        my $page="";
        if (exists $params{page}) {
                $page=delete $params{page};
                $topurl = $cgi->url;
        }
 
        my $page="";
        if (exists $params{page}) {
                $page=delete $params{page};
-               $params{forcebaseurl}=urlabs(urlto($page), $topurl);
+               $params{forcebaseurl}=urlto($page);
+               if (! $config{html5}) {
+                       $params{forcebaseurl}=urlabs($params{forcebaseurl}, $topurl);
+               }
        }
        run_hooks(pagetemplate => sub {
                shift->(
        }
        run_hooks(pagetemplate => sub {
                shift->(
@@ -77,12 +80,17 @@ sub cgitemplate ($$$;@) {
        });
        templateactions($template, "");
 
        });
        templateactions($template, "");
 
+       my $baseurl = baseurl();
+       if (! $config{html5}) {
+               $baseurl = urlabs($baseurl, $topurl),
+       }
+
        $template->param(
                dynamic => 1,
                title => $title,
                wikiname => $config{wikiname},
                content => $content,
        $template->param(
                dynamic => 1,
                title => $title,
                wikiname => $config{wikiname},
                content => $content,
-               baseurl => urlabs(baseurl(), $topurl),
+               baseurl => $baseurl,
                html5 => $config{html5},
                %params,
        );
                html5 => $config{html5},
                %params,
        );
@@ -93,7 +101,13 @@ sub cgitemplate ($$$;@) {
 sub redirect ($$) {
        my $q=shift;
        eval q{use URI};
 sub redirect ($$) {
        my $q=shift;
        eval q{use URI};
-       my $url=URI->new(urlabs(shift, $q->url));
+
+       my $topurl;
+       if (defined $q && ! $config{w3mmode} && ! $config{reverse_proxy}) {
+               $topurl = $q->url;
+       }
+
+       my $url=URI->new(urlabs(shift, $topurl));
        if (! $config{w3mmode}) {
                print $q->redirect($url);
        }
        if (! $config{w3mmode}) {
                print $q->redirect($url);
        }
@@ -108,7 +122,8 @@ sub decode_cgi_utf8 ($) {
        if ($] < 5.01) {
                my $cgi = shift;
                foreach my $f ($cgi->param) {
        if ($] < 5.01) {
                my $cgi = shift;
                foreach my $f ($cgi->param) {
-                       $cgi->param($f, map { decode_utf8 $_ } $cgi->param($f));
+                       $cgi->param($f, map { decode_utf8 $_ }
+                               @{$cgi->param_fetch($f)});
                }
        }
 }
                }
        }
 }