$files = array();
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"] );
+ $i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
$files[] = $i;
}
}
}
+function determineIcon($file, $sharingRoot, $sharingToken) {
+ // for folders we simply reuse the files logic
+ if($file['type'] == 'dir') {
+ return \OCA\files\lib\Helper::determineIcon($file);
+ }
+
+ $relativePath = substr($file['path'], 6);
+ $relativePath = substr($relativePath, strlen($sharingRoot));
+ if($file['isPreviewAvailable']) {
+ return OCP\publicPreview_icon($relativePath, $sharingToken);
+ }
+ return OCP\mimetype_icon($file['mimetype']);
+}
+
if (isset($_GET['t'])) {
$token = $_GET['t'];
$linkItem = OCP\Share::getShareByToken($token);
}
$i['directory'] = $getPath;
$i['permissions'] = OCP\PERMISSION_READ;
+ $i['icon'] = determineIcon($i, $basePath, $token);
$files[] = $i;
}
usort($files, "fileCmp");