From 7fa9181a2697d343fce30124792fae664c9c0510 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 11 Feb 2013 11:50:41 +0100 Subject: Share: fix sorting of files in public shared folder --- apps/files_sharing/public.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index ac889cd2dcb..b478ac8a4ad 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -3,6 +3,16 @@ $RUNTIME_NOSETUPFS = true; // Load other apps for file previews OC_App::loadApps(); +function fileCmp($a, $b) { + if ($a['type'] == 'dir' and $b['type'] != 'dir') { + return -1; + } elseif ($a['type'] != 'dir' and $b['type'] == 'dir') { + return 1; + } else { + return strnatcasecmp($a['name'], $b['name']); + } +} + if (isset($_GET['t'])) { $token = $_GET['t']; $linkItem = OCP\Share::getShareByToken($token); @@ -146,6 +156,8 @@ if (isset($path)) { $i['permissions'] = OCP\PERMISSION_READ; $files[] = $i; } + usort($files, "fileCmp"); + // Make breadcrumb $breadcrumb = array(); $pathtohere = ''; -- cgit v1.2.3