]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
po: inject custom isselflink to fix selflink detection on translation pages
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index 52cafade0f9f7f7ae155402464283e22c991a67d..866711a719478cd7bde8a0fb8ecdfc44e8678ef9 100644 (file)
@@ -40,7 +40,8 @@ sub showform ($$$$;@) {
 
 sub redirect ($$) {
        my $q=shift;
-       my $url=shift;
+       eval q{use URI};
+       my $url=URI->new(shift);
        if (! $config{w3mmode}) {
                print $q->redirect($url);
        }
@@ -234,11 +235,15 @@ sub cgi_prefs ($$) {
        showform($form, $buttons, $session, $q);
 }
 
-sub cgi_custom_failure ($$) {
-       my $header=shift;
+sub cgi_custom_failure ($$$) {
+       my $q=shift;
+       my $httpstatus=shift;
        my $message=shift;
 
-       print $header;
+       print $q->header(
+               -status => $httpstatus,
+               -charset => 'utf-8',
+       );
        print $message;
 
        # Internet Explod^Hrer won't show custom 404 responses
@@ -273,7 +278,7 @@ sub check_banned ($$) {
                $session->delete();
                cgi_savesession($session);
                cgi_custom_failure(
-                       $q->header(-status => "403 Forbidden"),
+                       $q, "403 Forbidden",
                        gettext("You are banned."));
        }
 }