diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-10-27 12:18:01 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-10-27 12:18:01 +0200 |
commit | dea0d20a9ad0270896e57a7459d6276798658d7c (patch) | |
tree | e7d20d756d1e802eccb524d84d37d3d015ad5bc9 /apps/files/index.php | |
parent | 5bfff6c56e8d4d911c7a5265bb5462c7122ca495 (diff) | |
download | nextcloud-server-dea0d20a9ad0270896e57a7459d6276798658d7c.tar.gz nextcloud-server-dea0d20a9ad0270896e57a7459d6276798658d7c.zip |
fix delete and sort files
Diffstat (limited to 'apps/files/index.php')
-rw-r--r-- | apps/files/index.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/files/index.php b/apps/files/index.php index 4676ebc6021..a2cf87d027e 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -43,6 +43,16 @@ if(!\OC\Files\Filesystem::is_dir($dir.'/')) { exit(); } +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']); + } +} + $files = array(); foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) { $i['date'] = OCP\Util::formatDate($i['mtime'] ); @@ -62,6 +72,8 @@ foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) { $files[] = $i; } +usort($files, "fileCmp"); + // Make breadcrumb $breadcrumb = array(); $pathtohere = ''; |