]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/attachment.pm
git: Fix handling of utf-8 filenames in recentchanges.
[git.ikiwiki.info.git] / IkiWiki / Plugin / attachment.pm
index f1f792a5a56ffc4cdd5ec4547d614ddf98570de2..f1a9b19394701ea82558513ecc423b451ba2ddc4 100644 (file)
@@ -277,7 +277,7 @@ sub attachment_list ($) { #{{{
                        push @ret, {
                                "field-select" => '<input type="checkbox" name="attachment_select" value="'.$f.'" />',
                                link => htmllink($page, $page, $f, noimageinline => 1),
-                               size => humansize((stat(_))[7]),
+                               size => IkiWiki::Plugin::filecheck::humansize((stat(_))[7]),
                                mtime => displaytime($IkiWiki::pagemtime{$f}),
                                mtime_raw => $IkiWiki::pagemtime{$f},
                        };
@@ -311,6 +311,26 @@ sub match_user ($$;@) { #{{{
        }
 } #}}}
 
+sub match_admin ($$;@) { #{{{
+       shift;
+       shift;
+       my %params=@_;
+       
+       if (! exists $params{user}) {
+               return IkiWiki::FailReason->new("no user specified");
+       }
+
+       if (defined $params{user} && IkiWiki::is_admin($params{user})) {
+               return IkiWiki::SuccessReason->new("user is an admin");
+       }
+       elsif (! defined $params{user}) {
+               return IkiWiki::FailReason->new("not logged in");
+       }
+       else {
+               return IkiWiki::FailReason->new("user is not an admin");
+       }
+} #}}}
+
 sub match_ip ($$;@) { #{{{
        shift;
        my $ip=shift;