summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/index.php')
-rw-r--r--apps/files_trashbin/index.php31
1 files changed, 16 insertions, 15 deletions
diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php
index d7eb143f9af..b7d0ef012f4 100644
--- a/apps/files_trashbin/index.php
+++ b/apps/files_trashbin/index.php
@@ -23,23 +23,24 @@ if ($dir) {
$dirlisting = true;
$dirContent = $view->opendir($dir);
$i = 0;
- while(($entryName = readdir($dirContent)) !== false) {
- if (!\OC\Files\Filesystem::isIgnoredDir($entryName)) {
- $pos = strpos($dir.'/', '/', 1);
- $tmp = substr($dir, 0, $pos);
- $pos = strrpos($tmp, '.d');
- $timestamp = substr($tmp, $pos+2);
- $result[] = array(
- 'id' => $entryName,
- 'timestamp' => $timestamp,
- 'mime' => $view->getMimeType($dir.'/'.$entryName),
- 'type' => $view->is_dir($dir.'/'.$entryName) ? 'dir' : 'file',
- 'location' => $dir,
- );
+ if(is_resource($dirContent)) {
+ while(($entryName = readdir($dirContent)) !== false) {
+ if (!\OC\Files\Filesystem::isIgnoredDir($entryName)) {
+ $pos = strpos($dir.'/', '/', 1);
+ $tmp = substr($dir, 0, $pos);
+ $pos = strrpos($tmp, '.d');
+ $timestamp = substr($tmp, $pos+2);
+ $result[] = array(
+ 'id' => $entryName,
+ 'timestamp' => $timestamp,
+ 'mime' => $view->getMimeType($dir.'/'.$entryName),
+ 'type' => $view->is_dir($dir.'/'.$entryName) ? 'dir' : 'file',
+ 'location' => $dir,
+ );
+ }
}
+ closedir($dirContent);
}
- closedir($dirContent);
-
} else {
$dirlisting = false;
$query = \OC_DB::prepare('SELECT `id`,`location`,`timestamp`,`type`,`mime` FROM `*PREFIX*files_trash` WHERE `user` = ?');