From ec2f20f72013f5ed6adcf5724006bd5ada462727 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 13 Sep 2013 21:00:15 +0200 Subject: [PATCH] Fixed files_trashbin to also use hash URL part for IE8 --- apps/files_trashbin/index.php | 26 ++++++++++++++++++++++++- apps/files_trashbin/templates/index.php | 3 ++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index c9468b60bd4..9f17448a757 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -18,7 +18,30 @@ OCP\Util::addscript('files', 'files'); $dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; -$files = \OCA\files_trashbin\lib\Helper::getTrashFiles($dir); +$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){ + $files = \OCA\files_trashbin\lib\Helper::getTrashFiles($dir); +} +else{ + $files = array(); + $ajaxLoad = true; +} // Redirect if directory does not exist if ($files === null){ @@ -53,5 +76,6 @@ $tmpl->assign('fileList', $list->fetchPage()); $tmpl->assign('files', $files); $tmpl->assign('dir', $dir); $tmpl->assign('disableSharing', true); +$tmpl->assign('ajaxLoad', true); $tmpl->printPage(); diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php index daae7753aeb..82ba0608834 100644 --- a/apps/files_trashbin/templates/index.php +++ b/apps/files_trashbin/templates/index.php @@ -5,10 +5,11 @@
- +
t('Nothing in here. Your trash bin is empty!'))?>
+ -- 2.39.5