From ea368b7d7b7a5a853c48f6247d8dfe46107c2ced Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 16 Oct 2019 23:53:56 +0200 Subject: [PATCH] widget/doclist: show hidden files to edit admins Include private files as alternate options for editors. Presence of html still takes precedence, and extension formats are considered a last resort and no longer include sizes. --- widget/doclist.php | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/widget/doclist.php b/widget/doclist.php index 78b8c49..e4fadef 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -1,10 +1,17 @@ 5) print ' class="cols"'; print ">\n"; foreach (array_reverse($cal) as $title => $versions) { print '
  • '; - if ($url = @$versions['html']) { + if ($url = @$versions['']) { printf('%s', $url, $title); } - elseif (implode('', array_keys($versions))) { - list ($format, $url) = each($versions); - include_once('format.inc.php'); - printf('%s (%sB %s)', - $title, $url, showsize(filesize($url)), $format - ); - } else { print $title; + if ($versions and $User->admin('edit')) { + printf(' (%s)', implode(', ', array_map( + function ($format, $url) { + return sprintf('%s', $url, $format); + }, + array_keys($versions), $versions) + )); + } } - print "\n"; + print "
  • \n"; } print "\n\n"; -- 2.30.0