diff options
author | kondou <kondou@ts.unde.re> | 2013-09-05 18:40:55 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-09-05 18:40:55 +0200 |
commit | f84fe479a5af35cc51b4bee39492093c75ddc64e (patch) | |
tree | 0ece552e8fa95d570aad141992144ac634bd10e8 /apps | |
parent | 992b59f70bec5dcc6681db14c3a97036b4961403 (diff) | |
download | nextcloud-server-f84fe479a5af35cc51b4bee39492093c75ddc64e.tar.gz nextcloud-server-f84fe479a5af35cc51b4bee39492093c75ddc64e.zip |
Only use mimetype_list and clean up a bit
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/rawlist.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php index 37fd12f71d0..2fd6f67d308 100644 --- a/apps/files/ajax/rawlist.php +++ b/apps/files/ajax/rawlist.php @@ -11,22 +11,23 @@ OCP\JSON::checkLoggedIn(); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; -$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : ''; -$mimetypeList = isset($_GET['mimetype_list']) ? json_decode($_GET['mimetype_list'], true) : ''; +$mimetypes = isset($_GET['mimetypes']) ? array_unique(json_decode($_GET['mimetypes'], true)) : ''; // make filelist $files = array(); // If a type other than directory is requested first load them. -if( ($mimetype || $mimetypeList) && strpos($mimetype, 'httpd/unix-directory') === false) { +if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $i ) { $i["date"] = OCP\Util::formatDate($i["mtime"] ); - $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']); + $i['mimetype_icon'] = ($i['type'] == 'dir') + ? \mimetype_icon('dir') + : \mimetype_icon($i['mimetype']); $files[] = $i; } } -if (is_array($mimetypeList)) { - foreach ($mimetypeList as $mimetype) { +if (is_array($mimetypes) && count($mimetypes)) { + foreach ($mimetypes as $mimetype) { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) { $i["date"] = OCP\Util::formatDate($i["mtime"]); $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']); @@ -34,11 +35,11 @@ if (is_array($mimetypeList)) { } } } else { - foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) { - $i["date"] = OCP\Util::formatDate($i["mtime"] ); + foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) { + $i["date"] = OCP\Util::formatDate($i["mtime"]); $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']); $files[] = $i; } } -OCP\JSON::success(array('data' => $files)); +OC_JSON::success(array('data' => $files)); |