summaryrefslogtreecommitdiffstats
path: root/apps/files/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/index.php')
-rw-r--r--apps/files/index.php28
1 files changed, 20 insertions, 8 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 3441e371a31..43a559d034e 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -38,13 +38,23 @@ OCP\App::setActiveNavigationEntry( 'files_index' );
// Load the files
$dir = isset( $_GET['dir'] ) ? urldecode(stripslashes($_GET['dir'])) : '';
// Redirect if directory does not exist
-if(!OC_Filesystem::is_dir($dir.'/')) {
+if(!\OC\Files\Filesystem::is_dir($dir.'/')) {
header('Location: '.$_SERVER['SCRIPT_NAME'].'');
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::getdirectorycontent( $dir ) as $i ) {
+foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
$i['date'] = OCP\Util::formatDate($i['mtime'] );
if($i['type']=='file') {
$fileinfo=pathinfo($i['name']);
@@ -62,6 +72,8 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ) {
$files[] = $i;
}
+usort($files, "fileCmp");
+
// Make breadcrumb
$breadcrumb = array();
$pathtohere = '';
@@ -85,26 +97,26 @@ $upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize')
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
-$freeSpace=OC_Filesystem::free_space($dir);
+$freeSpace=\OC\Files\Filesystem::free_space($dir);
$freeSpace=max($freeSpace,0);
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
$permissions = OCP\Share::PERMISSION_READ;
-if (OC_Filesystem::isUpdatable($dir.'/')) {
+if (\OC\Files\Filesystem::isUpdatable($dir.'/')) {
$permissions |= OCP\Share::PERMISSION_UPDATE;
}
-if (OC_Filesystem::isDeletable($dir.'/')) {
+if (\OC\Files\Filesystem::isDeletable($dir.'/')) {
$permissions |= OCP\Share::PERMISSION_DELETE;
}
-if (OC_Filesystem::isSharable($dir.'/')) {
+if (\OC\Files\Filesystem::isSharable($dir.'/')) {
$permissions |= OCP\Share::PERMISSION_SHARE;
}
$tmpl = new OCP\Template( 'files', 'index', 'user' );
$tmpl->assign( 'fileList', $list->fetchPage(), false );
$tmpl->assign( 'breadcrumb', $breadcrumbNav->fetchPage(), false );
-$tmpl->assign( 'dir', OC_Filesystem::normalizePath($dir));
-$tmpl->assign( 'isCreatable', OC_Filesystem::isCreatable($dir.'/'));
+$tmpl->assign( 'dir', \OC\Files\Filesystem::normalizePath($dir));
+$tmpl->assign( 'isCreatable', \OC\Files\Filesystem::isCreatable($dir.'/'));
$tmpl->assign('permissions', $permissions);
$tmpl->assign( 'files', $files );
$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);