summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/index.php
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-01-18 13:11:29 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-01-22 15:33:53 +0100
commitd60522893713df7359d0e02c841f35a65d2186aa (patch)
treeb3ad81d7cc9163b3bed08e6ec2ce20dea643822f /apps/files_trashbin/index.php
parent8259768732e3456c5cc54cfe43975513881b6124 (diff)
downloadnextcloud-server-d60522893713df7359d0e02c841f35a65d2186aa.tar.gz
nextcloud-server-d60522893713df7359d0e02c841f35a65d2186aa.zip
first version of the trash bin app
Diffstat (limited to 'apps/files_trashbin/index.php')
-rw-r--r--apps/files_trashbin/index.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php
new file mode 100644
index 00000000000..28414cc1ce9
--- /dev/null
+++ b/apps/files_trashbin/index.php
@@ -0,0 +1,55 @@
+<?php
+
+// Check if we are a user
+OCP\User::checkLoggedIn();
+
+OCP\Util::addStyle('files_trashbin', 'trash');
+OCP\Util::addScript('files_trashbin', 'trash');
+OCP\Util::addScript('files', 'fileactions');
+$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
+
+$user = \OCP\User::getUser();
+$view = new OC_Filesystemview('/'.$user.'/files_trashbin');
+
+OCP\Util::addStyle('files', 'files');
+OCP\Util::addScript('files', 'filelist');
+
+$query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?');
+$result = $query->execute(array($user))->fetchAll();
+
+$files = array();
+foreach ($result as $r) {
+ $i = array();
+ $i['name'] = $r['id'];
+ $i['date'] = OCP\Util::formatDate($r['timestamp']);
+ $i['timestamp'] = $r['timestamp'];
+ $i['mimetype'] = $r['mime'];
+ $i['type'] = $r['type'];
+ if ($i['type'] == 'file') {
+ $fileinfo = pathinfo($r['id']);
+ $i['basename'] = $fileinfo['filename'];
+ $i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : '';
+ }
+ $i['directory'] = $r['location'];
+ if ($i['directory'] == '/') {
+ $i['directory'] = '';
+ }
+ $i['permissions'] = OCP\PERMISSION_READ;
+ $files[] = $i;
+}
+
+$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
+$breadcrumbNav->assign('breadcrumb', array(array('dir' => '', 'name' => 'Trash')), false);
+$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir=', false);
+
+$list = new OCP\Template('files_trashbin', 'part.list', '');
+$list->assign('files', $files, false);
+$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir=', false);
+$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file=', false);
+$list->assign('disableSharing', true);
+$list->assign('disableDownloadActions', true);
+$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false);
+$tmpl->assign('fileList', $list->fetchPage(), false);
+$tmpl->assign('dir', OC_Filesystem::normalizePath($view->getAbsolutePath()));
+
+$tmpl->printPage();