summaryrefslogtreecommitdiffstats
path: root/apps/files/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/index.php')
-rw-r--r--apps/files/index.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 4b930f89024..d46d8e32eef 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -41,13 +41,40 @@ if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
exit();
}
+$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', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
+ exit();
+}
+
+$ajaxLoad = false;
$files = array();
$user = OC_User::getUser();
if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we need to upgrade the cache
$needUpgrade = true;
$freeSpace = 0;
} else {
- $files = \OCA\files\lib\Helper::getFiles($dir);
+ if ($isIE8){
+ // after the redirect above, the URL will have a format
+ // like "files#?dir=path" which means that no path was given
+ // (dir is not set). In that specific case, we don't return any
+ // files because the client will take care of switching the dir
+ // to the one from the hash, then ajax-load the initial file list
+ $files = array();
+ $ajaxLoad = true;
+ }
+ else{
+ $files = \OCA\files\lib\Helper::getFiles($dir);
+ }
$freeSpace = \OC\Files\Filesystem::free_space($dir);
$needUpgrade = false;
}
@@ -106,5 +133,6 @@ if ($needUpgrade) {
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
$tmpl->assign('disableSharing', false);
+ $tmpl->assign('ajaxLoad', $ajaxLoad);
$tmpl->printPage();
}