aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/index.php')
-rw-r--r--apps/files_trashbin/index.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php
index 2f1fb32f8ce..31b46cc2dec 100644
--- a/apps/files_trashbin/index.php
+++ b/apps/files_trashbin/index.php
@@ -3,6 +3,8 @@
// Check if we are a user
OCP\User::checkLoggedIn();
+OCP\App::setActiveNavigationEntry('files_index');
+
OCP\Util::addScript('files_trashbin', 'trash');
OCP\Util::addScript('files_trashbin', 'disableDefaultActions');
OCP\Util::addScript('files', 'fileactions');
@@ -41,7 +43,7 @@ if ($dir) {
} else {
$dirlisting = false;
- $query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?');
+ $query = \OC_DB::prepare('SELECT `id`,`location`,`timestamp`,`type`,`mime` FROM `*PREFIX*files_trash` WHERE user = ?');
$result = $query->execute(array($user))->fetchAll();
}
@@ -66,6 +68,18 @@ foreach ($result as $r) {
$files[] = $i;
}
+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']);
+ }
+}
+
+usort($files, "fileCmp");
+
// Make breadcrumb
$pathtohere = '';
$breadcrumb = array();
@@ -93,9 +107,9 @@ $list->assign('disableSharing', true);
$list->assign('dirlisting', $dirlisting);
$list->assign('disableDownloadActions', true);
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false);
+$tmpl->assign('dirlisting', $dirlisting);
$tmpl->assign('fileList', $list->fetchPage(), false);
$tmpl->assign('files', $files);
-$tmpl->assign('dirlisting', $dirlisting);
-$tmpl->assign('dir', OC_Filesystem::normalizePath($view->getAbsolutePath()));
+$tmpl->assign('dir', \OC\Files\Filesystem::normalizePath($view->getAbsolutePath()));
$tmpl->printPage();