]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
monotone.pm: while we're still only checking the major and minor
[ikiwiki.git] / IkiWiki.pm
index a4afef8e0381f337d9cf8c26fe961210a2f5aaf0..bbe1ad055b2935437c9d0ee6ccf76f8f51d6bf3d 100644 (file)
@@ -544,7 +544,7 @@ sub checkconfig () {
                error(gettext("Must specify url to wiki with --url when using --cgi"));
        }
 
-       if (length $config{url}) {
+       if (defined $config{url} && length $config{url}) {
                eval q{use URI};
                my $baseurl = URI->new($config{url});
 
@@ -566,6 +566,9 @@ sub checkconfig () {
 
                $local_url =~ s{//$}{/};
        }
+       else {
+               $local_cgiurl = $config{cgiurl};
+       }
 
        $config{wikistatedir}="$config{srcdir}/.ikiwiki"
                unless exists $config{wikistatedir} && defined $config{wikistatedir};
@@ -1131,13 +1134,13 @@ sub beautify_urlpath ($) {
        return $url;
 }
 
-sub urlto ($$;$) {
+sub urlto ($;$$) {
        my $to=shift;
        my $from=shift;
        my $absolute=shift;
        
        if (! length $to) {
-               return beautify_urlpath(baseurl($from)."index.$config{htmlext}");
+               $to = 'index';
        }
 
        if (! $destsources{$to}) {
@@ -1148,6 +1151,12 @@ sub urlto ($$;$) {
                return $config{url}.beautify_urlpath("/".$to);
        }
 
+       if (! defined $from) {
+               my $u = $local_url;
+               $u =~ s{/$}{};
+               return $u.beautify_urlpath("/".$to);
+       }
+
        my $link = abs2rel($to, dirname(htmlpage($from)));
 
        return beautify_urlpath($link);
@@ -1236,7 +1245,7 @@ sub userpage ($) {
 sub openiduser ($) {
        my $user=shift;
 
-       if ($user =~ m!^https?://! &&
+       if (defined $user && $user =~ m!^https?://! &&
            eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
                my $display;
 
@@ -1882,6 +1891,7 @@ sub template_depends ($$;@) {
                },
                loop_context_vars => 1,
                die_on_bad_params => 0,
+               parent_global_vars => 1,
                filename => $filename,
                @_,
                ($untrusted ? (no_includes => 1) : ()),