git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
upload: replace double line breaks by paragraphs in text input
[minimedit.git]
/
widget
/
doclist.php
diff --git
a/widget/doclist.php
b/widget/doclist.php
index 78b8c4941817c74e5a973e95f4be22e5bfdb5f98..796a4ad2812a7e3592d8d020974bb00becd976de 100644
(file)
--- a/
widget/doclist.php
+++ b/
widget/doclist.php
@@
-1,10
+1,17
@@
<?php
<?php
+global $User;
+
$cal = [];
foreach (glob("$Page$Args/2*") as $url) {
$cal = [];
foreach (glob("$Page$Args/2*") as $url) {
- $parts = pathinfo($url);
- @list ($date, $suffix) = explode('.', $parts['filename'], 2);
- $cal[$date][ $suffix ? '' : @$parts['extension'] ] =
- preg_replace('/\.html$/', '', $url);
+ $link = preg_replace('/\.html$/', '', $url);
+ $name = pathinfo($link, PATHINFO_BASENAME);
+ @list ($date, $suffix) = explode('.', $name, 2);
+ if (!filesize($url)) {
+ $cal[$date] = [];
+ }
+ else {
+ $cal[$date][$suffix] = $link;
+ }
}
print '<ul';
}
print '<ul';
@@
-12,20
+19,21
@@
if (count($cal) > 5) print ' class="cols"';
print ">\n";
foreach (array_reverse($cal) as $title => $versions) {
print '<li>';
print ">\n";
foreach (array_reverse($cal) as $title => $versions) {
print '<li>';
- if ($url = @$versions['
html
']) {
+ if ($url = @$versions['']) {
printf('<a href="/%s">%s</a>', $url, $title);
}
printf('<a href="/%s">%s</a>', $url, $title);
}
- elseif (implode('', array_keys($versions))) {
- list ($format, $url) = each($versions);
- include_once('format.inc.php');
- printf('%s (<a href="/%s">%sB %s</a>)',
- $title, $url, showsize(filesize($url)), $format
- );
- }
else {
print $title;
else {
print $title;
+ if ($versions and $User->admin("edit $Page$Args")) {
+ printf(' (%s)', implode(', ', array_map(
+ function ($format, $url) {
+ return sprintf('<a href="/%s">%s</a>', $url, $format);
+ },
+ array_keys($versions), $versions)
+ ));
+ }
}
}
- print "\n";
+ print "
</li>
\n";
}
print "</ul>\n\n";
}
print "</ul>\n\n";