]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
web commit by JeremyReed: add horizontal rule to separate, reply to feedback, remove...
[ikiwiki.git] / IkiWiki.pm
index 3f7bdb2a6184b4343e136b60da3b33799124602a..18a518f3f57ba06c7fdb4942e90cd13af4a1d882 100644 (file)
@@ -33,6 +33,7 @@ sub defaultconfig () { #{{{
        wiki_file_prune_regexps => [qr/\.\./, qr/^\./, qr/\/\./,
                qr/\.x?html?$/, qr/\.ikiwiki-new$/,
                qr/(^|\/).svn\//, qr/.arch-ids\//, qr/{arch}\//,
+               qr/(^|\/)_MTN\//,
                qr/\.dpkg-tmp$/],
        wiki_link_regexp => qr{
                \[\[                    # beginning of link
@@ -145,7 +146,7 @@ sub checkconfig () { #{{{
 
 sub loadplugins () { #{{{
        if (defined $config{libdir}) {
-               unshift @INC, $config{libdir};
+               unshift @INC, possibly_foolish_untaint($config{libdir});
        }
 
        loadplugin($_) foreach @{$config{plugin}};
@@ -165,7 +166,8 @@ sub loadplugin ($) { #{{{
 
        return if grep { $_ eq $plugin} @{$config{disable_plugins}};
 
-       foreach my $dir ($config{libdir}, "$installdir/lib/ikiwiki") {
+       foreach my $dir (defined $config{libdir} ? possibly_foolish_untaint($config{libdir}) : undef,
+                        "$installdir/lib/ikiwiki") {
                if (defined $dir && -x "$dir/plugins/$plugin") {
                        require IkiWiki::Plugin::external;
                        import IkiWiki::Plugin::external "$dir/plugins/$plugin";
@@ -772,7 +774,8 @@ sub lockwiki (;$) { #{{{
 } #}}}
 
 sub unlockwiki () { #{{{
-       return close($wikilock);
+       return close($wikilock) if $wikilock;
+       return;
 } #}}}
 
 my $commitlock;
@@ -798,7 +801,8 @@ sub disable_commit_hook () { #{{{
 } #}}}
 
 sub enable_commit_hook () { #{{{
-       return close($commitlock);
+       return close($commitlock) if $commitlock;
+       return;
 } #}}}
 
 sub loadindex () { #{{{
@@ -1015,7 +1019,9 @@ sub file_pruned ($$) { #{{{
 
 sub gettext { #{{{
        # Only use gettext in the rare cases it's needed.
-       if (exists $ENV{LANG} || exists $ENV{LC_ALL} || exists $ENV{LC_MESSAGES}) {
+       if ((exists $ENV{LANG} && length $ENV{LANG}) ||
+           (exists $ENV{LC_ALL} && length $ENV{LC_ALL}) ||
+           (exists $ENV{LC_MESSAGES} && length $ENV{LC_MESSAGES})) {
                if (! $gettext_obj) {
                        $gettext_obj=eval q{
                                use Locale::gettext q{textdomain};