2013-01-18 12:11:29 +00:00
|
|
|
<?php
|
|
|
|
|
2013-02-22 16:21:57 +00:00
|
|
|
// Check if we are a user
|
2013-01-18 12:11:29 +00:00
|
|
|
OCP\User::checkLoggedIn();
|
|
|
|
|
2013-01-31 16:59:01 +00:00
|
|
|
OCP\App::setActiveNavigationEntry('files_index');
|
|
|
|
|
2013-01-23 10:30:42 +00:00
|
|
|
OCP\Util::addScript('files_trashbin', 'disableDefaultActions');
|
2013-01-18 12:11:29 +00:00
|
|
|
OCP\Util::addScript('files', 'fileactions');
|
|
|
|
$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
|
|
|
|
|
|
|
|
OCP\Util::addStyle('files', 'files');
|
|
|
|
OCP\Util::addScript('files', 'filelist');
|
2013-08-17 11:07:18 +00:00
|
|
|
// filelist overrides
|
|
|
|
OCP\Util::addScript('files_trashbin', 'filelist');
|
2013-08-29 18:59:45 +00:00
|
|
|
OCP\Util::addscript('files', 'files');
|
2013-10-09 10:35:15 +00:00
|
|
|
OCP\Util::addScript('files_trashbin', 'trash');
|
2013-01-18 12:11:29 +00:00
|
|
|
|
2013-01-21 12:07:43 +00:00
|
|
|
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
|
|
|
|
|
2013-09-13 19:00:15 +00:00
|
|
|
$isIE8 = false;
|
|
|
|
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
|
|
|
|
if (count($matches) > 0 && $matches[1] <= 8){
|
|
|
|
$isIE8 = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if IE8 and "?dir=path" was specified, reformat the URL to use a hash like "#?dir=path"
|
|
|
|
if ($isIE8 && isset($_GET['dir'])){
|
|
|
|
if ($dir === ''){
|
|
|
|
$dir = '/';
|
|
|
|
}
|
|
|
|
header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$ajaxLoad = false;
|
|
|
|
|
|
|
|
if (!$isIE8){
|
2013-09-20 14:37:07 +00:00
|
|
|
$files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
|
2013-09-13 19:00:15 +00:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
$files = array();
|
|
|
|
$ajaxLoad = true;
|
|
|
|
}
|
2013-01-18 12:11:29 +00:00
|
|
|
|
2013-08-17 11:07:18 +00:00
|
|
|
// Redirect if directory does not exist
|
|
|
|
if ($files === null){
|
|
|
|
header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php'));
|
|
|
|
exit();
|
2013-01-18 12:11:29 +00:00
|
|
|
}
|
|
|
|
|
2013-08-17 11:07:18 +00:00
|
|
|
$dirlisting = false;
|
|
|
|
if ($dir && $dir !== '/') {
|
|
|
|
$dirlisting = true;
|
2013-01-31 18:36:59 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 14:37:07 +00:00
|
|
|
$breadcrumb = \OCA\Files_Trashbin\Helper::makeBreadcrumb($dir);
|
2013-01-21 12:07:43 +00:00
|
|
|
|
2013-03-07 12:48:02 +00:00
|
|
|
$breadcrumbNav = new OCP\Template('files_trashbin', 'part.breadcrumb', '');
|
2013-02-27 20:46:37 +00:00
|
|
|
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
|
|
|
|
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir=');
|
2013-03-07 12:51:18 +00:00
|
|
|
$breadcrumbNav->assign('home', OCP\Util::linkTo('files', 'index.php'));
|
2013-01-18 12:11:29 +00:00
|
|
|
|
|
|
|
$list = new OCP\Template('files_trashbin', 'part.list', '');
|
2013-02-27 20:46:37 +00:00
|
|
|
$list->assign('files', $files);
|
2013-07-04 16:41:42 +00:00
|
|
|
|
|
|
|
$encodedDir = \OCP\Util::encodePath($dir);
|
|
|
|
$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$encodedDir);
|
|
|
|
$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file='.$encodedDir);
|
2013-03-07 13:54:59 +00:00
|
|
|
$list->assign('dirlisting', $dirlisting);
|
2013-01-18 12:11:29 +00:00
|
|
|
$list->assign('disableDownloadActions', true);
|
2013-07-04 16:41:42 +00:00
|
|
|
|
|
|
|
$tmpl->assign('dirlisting', $dirlisting);
|
2013-02-27 20:46:37 +00:00
|
|
|
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
|
|
|
|
$tmpl->assign('fileList', $list->fetchPage());
|
2013-01-29 09:03:04 +00:00
|
|
|
$tmpl->assign('files', $files);
|
2013-08-17 11:07:18 +00:00
|
|
|
$tmpl->assign('dir', $dir);
|
|
|
|
$tmpl->assign('disableSharing', true);
|
2013-09-13 19:00:15 +00:00
|
|
|
$tmpl->assign('ajaxLoad', true);
|
2013-01-18 12:11:29 +00:00
|
|
|
|
|
|
|
$tmpl->printPage();
|