Blame view
sources/apps/files_trashbin/index.php
2.46 KB
|
03e52840d
|
1 2 3 4 5 6 |
<?php
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::setActiveNavigationEntry('files_index');
|
|
03e52840d
|
7 8 9 |
OCP\Util::addScript('files_trashbin', 'disableDefaultActions');
OCP\Util::addScript('files', 'fileactions');
$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
|
|
03e52840d
|
10 |
OCP\Util::addStyle('files', 'files');
|
|
31b7f2792
|
11 |
OCP\Util::addStyle('files_trashbin', 'trash');
|
|
03e52840d
|
12 |
OCP\Util::addScript('files', 'filelist');
|
|
31b7f2792
|
13 14 15 16 |
// filelist overrides
OCP\Util::addScript('files_trashbin', 'filelist');
OCP\Util::addscript('files', 'files');
OCP\Util::addScript('files_trashbin', 'trash');
|
|
03e52840d
|
17 18 |
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; |
|
31b7f2792
|
19 20 21 22 |
$isIE8 = false;
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if (count($matches) > 0 && $matches[1] <= 8){
$isIE8 = true;
|
|
03e52840d
|
23 |
} |
|
31b7f2792
|
24 25 26 27 |
// 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 = '/';
|
|
03e52840d
|
28 |
} |
|
31b7f2792
|
29 30 |
header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
exit();
|
|
03e52840d
|
31 |
} |
|
31b7f2792
|
32 33 34 35 36 37 38 39 |
$ajaxLoad = false;
if (!$isIE8){
$files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
}
else{
$files = array();
$ajaxLoad = true;
|
|
03e52840d
|
40 |
} |
|
31b7f2792
|
41 42 43 44 45 46 47 48 49 |
// Redirect if directory does not exist
if ($files === null){
header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php'));
exit();
}
$dirlisting = false;
if ($dir && $dir !== '/') {
$dirlisting = true;
|
|
03e52840d
|
50 |
} |
|
31b7f2792
|
51 |
$breadcrumb = \OCA\Files_Trashbin\Helper::makeBreadcrumb($dir); |
|
03e52840d
|
52 53 54 55 56 57 58 |
$breadcrumbNav = new OCP\Template('files_trashbin', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir=');
$breadcrumbNav->assign('home', OCP\Util::linkTo('files', 'index.php'));
$list = new OCP\Template('files_trashbin', 'part.list', '');
$list->assign('files', $files);
|
|
31b7f2792
|
59 60 61 62 |
$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);
|
|
03e52840d
|
63 |
$list->assign('dirlisting', $dirlisting);
|
|
03e52840d
|
64 |
$list->assign('disableDownloadActions', true);
|
|
31b7f2792
|
65 66 |
$tmpl->assign('dirlisting', $dirlisting);
|
|
03e52840d
|
67 68 69 |
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
$tmpl->assign('fileList', $list->fetchPage());
$tmpl->assign('files', $files);
|
|
31b7f2792
|
70 71 72 |
$tmpl->assign('dir', $dir);
$tmpl->assign('disableSharing', true);
$tmpl->assign('ajaxLoad', true);
|
|
03e52840d
|
73 74 |
$tmpl->printPage(); |