Make Sorting Switchable

This commit is contained in:
seiichiro 2022-02-03 17:49:28 +01:00
parent 0dbe0be78c
commit 12010ee2db
2 changed files with 10 additions and 2 deletions

View file

@ -82,8 +82,11 @@ if (isset($_GET['f'])) {
// Sort and Reverse Filelist // Sort and Reverse Filelist
natcasesort($files); natcasesort($files);
if ($sort == 1) if ($sort == 1) {
$files = array_reverse($files); $files = array_reverse($files);
} else {
$files = array_values($files);
}
if (!empty($dirs)) if (!empty($dirs))
$files = array_merge($dirs, $files); $files = array_merge($dirs, $files);

View file

@ -49,7 +49,12 @@
<a id="link-first" href="/index.php?d={{ $dir }}&so={{ $sort }}&p=1&s={{ $slice }}{{ $filter }}">1</a> <a id="link-first" href="/index.php?d={{ $dir }}&so={{ $sort }}&p=1&s={{ $slice }}{{ $filter }}">1</a>
<a id="link-prev" href="/index.php?d={{ $dir }}&so={{ $sort }}&p={{ $prev_page }}&s={{ $slice }}{{ $filter }}"><i class="fa fa-caret-left"></i></a> <a id="link-prev" href="/index.php?d={{ $dir }}&so={{ $sort }}&p={{ $prev_page }}&s={{ $slice }}{{ $filter }}"><i class="fa fa-caret-left"></i></a>
{% endif %} {% endif %}
<span class="info">{{ $page }}</span>
{% if ($sort == 1): %}
<a class="info" href="/index.php?d={{ $dir }}&so=0&p={{ page }}&s={{ $slice }}{{ $filter }}">{<i class="fa fa-caret-down"></i>{ $page }}</a>
{% else: %}
<a class="info" href="/index.php?d={{ $dir }}&so=1&p={{ page }}&s={{ $slice }}{{ $filter }}">{<i class="fa fa-caret-up"></i>{ $page }}</a>
{% endif %}
{% if ($page < $last_page): %} {% if ($page < $last_page): %}
<a id="link-next" href="/index.php?d={{ $dir }}&so={{ $sort }}&p={{ $next_page }}&s={{ $slice }}{{ $filter }}"><i class="fa fa-caret-right"></i></a> <a id="link-next" href="/index.php?d={{ $dir }}&so={{ $sort }}&p={{ $next_page }}&s={{ $slice }}{{ $filter }}"><i class="fa fa-caret-right"></i></a>
<a id="link-last" href="/index.php?d={{ $dir }}&so={{ $sort }}&p={{ $last_page }}&s={{ $slice }}{{ $filter }}">{{ $last_page }}</a> <a id="link-last" href="/index.php?d={{ $dir }}&so={{ $sort }}&p={{ $last_page }}&s={{ $slice }}{{ $filter }}">{{ $last_page }}</a>