summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------3rdparty0
-rw-r--r--apps/files/css/files.css62
-rw-r--r--apps/files/index.php1
-rw-r--r--apps/files/js/filelist.js5
-rw-r--r--apps/files/js/files.js21
-rw-r--r--apps/files/templates/index.php2
-rw-r--r--apps/files/templates/part.list.php18
-rw-r--r--apps/files_sharing/public.php3
-rw-r--r--apps/files_trashbin/lib/trash.php3
-rw-r--r--apps/files_trashbin/templates/part.list.php6
-rw-r--r--config/config.sample.php11
-rw-r--r--core/ajax/preview.php42
-rw-r--r--core/ajax/publicpreview.php92
-rw-r--r--core/ajax/trashbinpreview.php46
-rw-r--r--core/img/filetypes/application-pdf.pngbin591 -> 1746 bytes
-rw-r--r--core/img/filetypes/application-pdf.svg52
-rw-r--r--core/img/filetypes/application-rss+xml.pngbin691 -> 1098 bytes
-rw-r--r--core/img/filetypes/application-rss+xml.svg40
-rw-r--r--core/img/filetypes/application.pngbin464 -> 1018 bytes
-rw-r--r--core/img/filetypes/application.svg59
-rw-r--r--core/img/filetypes/audio.pngbin385 -> 816 bytes
-rw-r--r--core/img/filetypes/audio.svg49
-rw-r--r--core/img/filetypes/code.pngbin603 -> 908 bytes
-rw-r--r--core/img/filetypes/code.svg66
-rw-r--r--core/img/filetypes/file.pngbin294 -> 374 bytes
-rw-r--r--core/img/filetypes/file.svg36
-rw-r--r--core/img/filetypes/flash.pngbin580 -> 954 bytes
-rw-r--r--core/img/filetypes/flash.svg60
-rw-r--r--core/img/filetypes/folder.pngbin537 -> 709 bytes
-rw-r--r--core/img/filetypes/folder.svg60
-rw-r--r--core/img/filetypes/font.pngbin813 -> 1697 bytes
-rw-r--r--core/img/filetypes/font.svg37
-rw-r--r--core/img/filetypes/image-svg+xml.pngbin481 -> 959 bytes
-rw-r--r--core/img/filetypes/image-svg+xml.svg56
-rw-r--r--core/img/filetypes/image.pngbin606 -> 976 bytes
-rw-r--r--core/img/filetypes/image.svg61
-rw-r--r--core/img/filetypes/text-html.pngbin578 -> 654 bytes
-rw-r--r--core/img/filetypes/text-html.svg49
-rw-r--r--core/img/filetypes/text.pngbin342 -> 693 bytes
-rw-r--r--core/img/filetypes/text.svg43
-rw-r--r--core/img/web.pngbin0 -> 4472 bytes
-rw-r--r--core/img/web.svg183
-rw-r--r--core/routes.php7
-rw-r--r--lib/base.php9
-rw-r--r--lib/helper.php15
-rwxr-xr-xlib/preview.php621
-rw-r--r--lib/preview/images.php36
-rw-r--r--lib/preview/libreoffice-cl.php131
-rw-r--r--lib/preview/movies.php47
-rw-r--r--lib/preview/mp3.php48
-rw-r--r--lib/preview/msoffice.php142
-rw-r--r--lib/preview/office.php22
-rw-r--r--lib/preview/pdf.php40
-rw-r--r--lib/preview/provider.php19
-rw-r--r--lib/preview/svg.php44
-rw-r--r--lib/preview/txt.php68
-rw-r--r--lib/preview/unknown.php43
-rw-r--r--lib/public/preview.php34
-rw-r--r--lib/public/template.php19
-rw-r--r--lib/template/functions.php16
-rw-r--r--tests/lib/preview.php108
61 files changed, 2606 insertions, 26 deletions
diff --git a/3rdparty b/3rdparty
-Subproject 2f3ae9f56a9838b45254393e13c14f8a8c380d6
+Subproject bd366f82084718903c8a7b85fbc9ad0595d29c5
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index 117aac4c93e..c66484db536 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -19,9 +19,9 @@
background:#f8f8f8; border:1px solid #ddd; border-radius:10px; border-top-left-radius:0;
box-shadow:0 2px 7px rgba(170,170,170,.4);
}
-#new>ul>li { height:20px; margin:.3em; padding-left:2em; padding-bottom:0.1em;
+#new>ul>li { height:36px; margin:.3em; padding-left:3em; padding-bottom:0.1em;
background-repeat:no-repeat; cursor:pointer; }
-#new>ul>li>p { cursor:pointer; }
+#new>ul>li>p { cursor:pointer; padding-top: 7px; padding-bottom: 7px;}
#new>ul>li>form>input { padding:0.3em; margin:-0.3em; }
#trash { margin: 0 1em; z-index:1010; float: right; }
@@ -62,7 +62,10 @@
color:#888; text-shadow:#fff 0 1px 0;
}
#filestable { position: relative; top:37px; width:100%; }
-tbody tr { background-color:#fff; height:2.5em; }
+tbody tr {
+ background-color: #fff;
+ height: 44px;
+}
tbody tr:hover, tbody tr:active {
background-color: rgb(240,240,240);
}
@@ -75,12 +78,25 @@ span.extension { text-transform:lowercase; -ms-filter:"progid:DXImageTransform.M
tr:hover span.extension { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; color:#777; }
table tr.mouseOver td { background-color:#eee; }
table th { height:2em; padding:0 .5em; color:#999; }
-table th .name { float:left; margin-left:.5em; }
+table th .name {
+ float: left;
+ margin-left: 17px;
+}
table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; }
-table td { border-bottom:1px solid #eee; font-style:normal; background-position:1em .5em; background-repeat:no-repeat; }
+table td {
+ border-bottom: 1px solid #eee;
+ font-style: normal;
+ background-position: 8px center;
+ background-repeat: no-repeat;
+}
table th#headerName { width:100em; /* not really sure why this works better than 100% … table styling */ }
table th#headerSize, table td.filesize { min-width:3em; padding:0 1em; text-align:right; }
-table th#headerDate, table td.date { min-width:11em; padding:0 .1em 0 1em; text-align:left; }
+table th#headerDate, table td.date {
+ position: relative;
+ min-width: 11em;
+ padding:0 .1em 0 1em;
+ text-align:left;
+}
/* Multiselect bar */
#filestable.multiselect { top:63px; }
@@ -93,13 +109,29 @@ table.multiselect thead th {
}
table.multiselect #headerName { width: 100%; }
table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; }
-table td.filename a.name { display:block; height:1.5em; vertical-align:middle; margin-left:3em; }
+table td.filename a.name {
+ box-sizing: border-box;
+ display: block;
+ height: 44px;
+ vertical-align: middle;
+ margin-left: 50px;
+}
table tr[data-type="dir"] td.filename a.name span.nametext {font-weight:bold; }
table td.filename input.filename { width:100%; cursor:text; }
-table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em 0; }
+table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em .3em; }
table td.filename .nametext, .uploadtext, .modified { float:left; padding:.3em 0; }
+.modified {
+ position: absolute;
+ top: 10px;
+}
/* TODO fix usability bug (accidental file/folder selection) */
-table td.filename .nametext { overflow:hidden; text-overflow:ellipsis; max-width:800px; }
+table td.filename .nametext {
+ position: absolute;
+ top: 10px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 800px;
+}
table td.filename .uploadtext { font-weight:normal; margin-left:.5em; }
table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; }
@@ -119,8 +151,10 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; }
/* File actions */
.fileactions {
- position:absolute; top:.6em; right:0;
- font-size:.8em;
+ position: absolute;
+ top: 13px;
+ right: 0;
+ font-size: 11px;
}
#fileList .name { position:relative; /* Firefox needs to explicitly have this default set … */ }
#fileList tr:hover .fileactions { /* background to distinguish when overlaying with file names */
@@ -132,7 +166,11 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; }
box-shadow: -5px 0 7px rgba(230,230,230,.9);
}
#fileList .fileactions a.action img { position:relative; top:.2em; }
-#fileList a.action { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; }
+#fileList a.action {
+ display: inline;
+ margin: -.5em 0;
+ padding: 16px 8px !important;
+}
#fileList img.move2trash { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; float:right; }
a.action.delete { float:right; }
a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
diff --git a/apps/files/index.php b/apps/files/index.php
index 4f9e881eb2d..e2ea8802d0d 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -95,6 +95,7 @@ $list->assign('files', $files);
$list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
$list->assign('disableSharing', false);
+$list->assign('isPublic', false);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index b858e2580ee..288648693be 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -185,8 +185,9 @@ var FileList={
if (id != null) {
tr.attr('data-id', id);
}
- getMimeIcon(mime,function(path){
- tr.find('td.filename').attr('style','background-image:url('+path+')');
+ var path = $('#dir').val()+'/'+name;
+ getPreviewIcon(path, function(previewpath){
+ tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
});
tr.find('td.filename').draggable(dragOptions);
},
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 3fad3fae7d3..8b66ed6747b 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -366,8 +366,9 @@ $(document).ready(function() {
var tr=$('tr').filterAttr('data-file',name);
tr.attr('data-mime',result.data.mime);
tr.attr('data-id', result.data.id);
- getMimeIcon(result.data.mime,function(path){
- tr.find('td.filename').attr('style','background-image:url('+path+')');
+ var path = $('#dir').val()+'/'+name;
+ getPreviewIcon(path, function(previewpath){
+ tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
});
} else {
OC.dialogs.alert(result.data.message, t('core', 'Error'));
@@ -430,8 +431,9 @@ $(document).ready(function() {
var tr=$('tr').filterAttr('data-file',localName);
tr.data('mime',mime).data('id',id);
tr.attr('data-id', id);
- getMimeIcon(mime,function(path){
- tr.find('td.filename').attr('style','background-image:url('+path+')');
+ var path = $('#dir').val()+'/'+localName;
+ getPreviewIcon(path, function(previewpath){
+ tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
});
});
eventSource.listen('error',function(error){
@@ -636,8 +638,9 @@ var createDragShadow = function(event){
if (elem.type === 'dir') {
newtr.find('td.filename').attr('style','background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')');
} else {
- getMimeIcon(elem.mime,function(path){
- newtr.find('td.filename').attr('style','background-image:url('+path+')');
+ var path = $('#dir').val()+'/'+elem.name;
+ getPreviewIcon(path, function(previewpath){
+ newtr.find('td.filename').attr('style','background-image:url('+previewpath+')');
});
}
});
@@ -821,6 +824,10 @@ function getMimeIcon(mime, ready){
}
getMimeIcon.cache={};
+function getPreviewIcon(path, ready){
+ ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:36, y:36}));
+}
+
function getUniqueName(name){
if($('tr').filterAttr('data-file',name).length>0){
var parts=name.split('.');
@@ -852,4 +859,4 @@ function checkTrashStatus() {
$("input[type=button][id=trash]").removeAttr("disabled");
}
});
-} \ No newline at end of file
+}
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index 79c283dc336..e4348904671 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -10,7 +10,7 @@
data-type='file'><p><?php p($l->t('Text file'));?></p></li>
<li style="background-image:url('<?php p(OCP\mimetype_icon('dir')) ?>')"
data-type='folder'><p><?php p($l->t('Folder'));?></p></li>
- <li style="background-image:url('<?php p(OCP\image_path('core', 'actions/public.png')) ?>')"
+ <li style="background-image:url('<?php p(OCP\image_path('core', 'web.png')) ?>')"
data-type='web'><p><?php p($l->t('From link'));?></p></li>
</ul>
</div>
diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
index 0c7d6936697..ab1b91167db 100644
--- a/apps/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
@@ -3,6 +3,7 @@
$totaldirs = 0;
$totalsize = 0; ?>
<?php foreach($_['files'] as $file):
+ $relativePath = substr($file['path'], 6); //strlen('files/') => 6
$totalsize += $file['size'];
if ($file['type'] === 'dir') {
$totaldirs++;
@@ -28,7 +29,22 @@ $totalsize = 0; ?>
<?php if($file['type'] == 'dir'): ?>
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon('dir')); ?>)"
<?php else: ?>
- style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
+ <?php if($_['isPublic']): ?>
+ <?php
+ $relativePath = substr($relativePath, strlen($_['sharingroot']));
+ ?>
+ <?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
+ style="background-image:url(<?php print_unescaped(OCP\publicPreview_icon($relativePath, $_['sharingtoken'])); ?>)" class="preview-icon"
+ <?php else: ?>
+ style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
+ <?php endif; ?>
+ <?php else: ?>
+ <?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
+ style="background-image:url(<?php print_unescaped(OCP\preview_icon($relativePath)); ?>)" class="preview-icon"
+ <?php else: ?>
+ style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
+ <?php endif; ?>
+ <?php endif; ?>
<?php endif; ?>
>
<?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 741ab145384..b3d713097d2 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -194,6 +194,9 @@ if (isset($path)) {
$list->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=');
$list->assign('downloadURL',
OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=');
+ $list->assign('isPublic', true);
+ $list->assign('sharingtoken', $token);
+ $list->assign('sharingroot', $basePath);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
$breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=');
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index 30913e00a47..615eafee617 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -908,4 +908,7 @@ class Trashbin {
return true;
}
+ public static function preview_icon($path) {
+ return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) ));
+ }
}
diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php
index 254b08dd36a..6c6d2162846 100644
--- a/apps/files_trashbin/templates/part.list.php
+++ b/apps/files_trashbin/templates/part.list.php
@@ -25,7 +25,11 @@
<?php if($file['type'] === 'dir'): ?>
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon('dir')); ?>)"
<?php else: ?>
- style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
+ <?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
+ style="background-image:url(<?php print_unescaped(OCA\Files_Trashbin\Trashbin::preview_icon(!$_['dirlisting'] ? ($file['name'].'.d'.$file['timestamp']) : ($file['directory'].'/'.$file['name']))); ?>)" class="preview-icon"
+ <?php else: ?>
+ style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
+ <?php endif; ?>
<?php endif; ?>
>
<?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
diff --git a/config/config.sample.php b/config/config.sample.php
index 24ba541ac5c..86bc20b714e 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -190,6 +190,15 @@ $CONFIG = array(
'customclient_android' => '', //https://play.google.com/store/apps/details?id=com.owncloud.android
'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8
+// PREVIEW
+/* the max width of a generated preview, if value is null, there is no limit */
+'preview_max_x' => null,
+/* the max height of a generated preview, if value is null, there is no limit */
+'preview_max_y' => null,
+/* the max factor to scale a preview, default is set to 10 */
+'preview_max_scale_factor' => 10,
+/* custom path for libreoffice / openoffice binary */
+'preview_libreoffice_path' => '/usr/bin/libreoffice',
// date format to be used while writing to the owncloud logfile
-'logdateformat' => 'F d, Y H:i:s'
+'logdateformat' => 'F d, Y H:i:s',
);
diff --git a/core/ajax/preview.php b/core/ajax/preview.php
new file mode 100644
index 00000000000..a9d127ffcc4
--- /dev/null
+++ b/core/ajax/preview.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+\OC_Util::checkLoggedIn();
+
+$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
+$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
+$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
+$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
+
+if($file === '') {
+ \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+if($maxX === 0 || $maxY === 0) {
+ \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+try{
+ $preview = new \OC\Preview(\OC_User::getUser(), 'files');
+ $preview->setFile($file);
+ $preview->setMaxX($maxX);
+ $preview->setMaxY($maxY);
+ $preview->setScalingUp($scalingUp);
+
+ $preview->show();
+}catch(\Exception $e) {
+ \OC_Response::setStatus(500);
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ \OC\Preview::showErrorPreview();
+ exit;
+} \ No newline at end of file
diff --git a/core/ajax/publicpreview.php b/core/ajax/publicpreview.php
new file mode 100644
index 00000000000..955fbc2626a
--- /dev/null
+++ b/core/ajax/publicpreview.php
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+if(!\OC_App::isEnabled('files_sharing')){
+ exit;
+}
+
+$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
+$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
+$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
+$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
+$token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : '';
+
+if($token === ''){
+ \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Log::write('core-preview', 'No token parameter was passed', \OC_Log::DEBUG);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+$linkedItem = \OCP\Share::getShareByToken($token);
+if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) {
+ \OC_Response::setStatus(404);
+ \OC_Log::write('core-preview', 'Passed token parameter is not valid', \OC_Log::DEBUG);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) {
+ \OC_Response::setStatus(500);
+ \OC_Log::write('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")', \OC_Log::WARN);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+$userId = $linkedItem['uid_owner'];
+\OC_Util::setupFS($userId);
+
+$pathId = $linkedItem['file_source'];
+$path = \OC\Files\Filesystem::getPath($pathId);
+$pathInfo = \OC\Files\Filesystem::getFileInfo($path);
+$sharedFile = null;
+
+if($linkedItem['item_type'] === 'folder') {
+ $isvalid = \OC\Files\Filesystem::isValidPath($file);
+ if(!$isvalid) {
+ \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Log::write('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . $_SERVER['REMOTE_ADDR'] . '")', \OC_Log::WARN);
+ \OC\Preview::showErrorPreview();
+ exit;
+ }
+ $sharedFile = \OC\Files\Filesystem::normalizePath($file);
+}
+
+if($linkedItem['item_type'] === 'file') {
+ $parent = $pathInfo['parent'];
+ $path = \OC\Files\Filesystem::getPath($parent);
+ $sharedFile = $pathInfo['name'];
+}
+
+$path = \OC\Files\Filesystem::normalizePath($path, false);
+if(substr($path, 0, 1) === '/') {
+ $path = substr($path, 1);
+}
+
+if($maxX === 0 || $maxY === 0) {
+ \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+$root = 'files/' . $path;
+
+try{
+ $preview = new \OC\Preview($userId, $root);
+ $preview->setFile($sharedFile);
+ $preview->setMaxX($maxX);
+ $preview->setMaxY($maxY);
+ $preview->setScalingUp($scalingUp);
+
+ $preview->show();
+} catch (\Exception $e) {
+ \OC_Response::setStatus(500);
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ \OC\Preview::showErrorPreview();
+ exit;
+} \ No newline at end of file
diff --git a/core/ajax/trashbinpreview.php b/core/ajax/trashbinpreview.php
new file mode 100644
index 00000000000..d018a57d37b
--- /dev/null
+++ b/core/ajax/trashbinpreview.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+\OC_Util::checkLoggedIn();
+
+if(!\OC_App::isEnabled('files_trashbin')){
+ exit;
+}
+
+$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
+$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44';
+$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44';
+$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
+
+if($file === '') {
+ \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+if($maxX === 0 || $maxY === 0) {
+ \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
+ \OC\Preview::showErrorPreview();
+ exit;
+}
+
+try{
+ $preview = new \OC\Preview(\OC_User::getUser(), 'files_trashbin/files');
+ $preview->setFile($file);
+ $preview->setMaxX($maxX);
+ $preview->setMaxY($maxY);
+ $preview->setScalingUp($scalingUp);
+
+ $preview->showPreview();
+}catch(\Exception $e) {
+ \OC_Response::setStatus(500);
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ \OC\Preview::showErrorPreview();
+ exit;
+} \ No newline at end of file
diff --git a/core/img/filetypes/application-pdf.png b/core/img/filetypes/application-pdf.png
index 8f8095e46fa..a9ab6d279b6 100644
--- a/core/img/filetypes/application-pdf.png
+++ b/core/img/filetypes/application-pdf.png
Binary files differ
diff --git a/core/img/filetypes/application-pdf.svg b/core/img/filetypes/application-pdf.svg
new file mode 100644
index 00000000000..47c2caabdad
--- /dev/null
+++ b/core/img/filetypes/application-pdf.svg
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="e" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.62162 0 0 .62162 1.0811 2.0811)" y1="5" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".063165"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="d" y2="54.78" gradientUnits="userSpaceOnUse" x2="167.98" gradientTransform="matrix(.44444 0 0 .44444 -24 2.7778)" y1="8.5081" x1="167.98">
+ <stop stop-color="#fffdf3" offset="0"/>
+ <stop stop-color="#fbebeb" offset="1"/>
+ </linearGradient>
+ <radialGradient id="a" gradientUnits="userSpaceOnUse" cy="9.9941" cx="8.2761" gradientTransform="matrix(0 4.2742 -5.2474 0 68.489 -37.143)" r="12.672">
+ <stop stop-color="#f89b7e" offset="0"/>
+ <stop stop-color="#e35d4f" offset=".26238"/>
+ <stop stop-color="#c6262e" offset=".66094"/>
+ <stop stop-color="#690b2c" offset="1"/>
+ </radialGradient>
+ <radialGradient id="c" gradientUnits="userSpaceOnUse" cy="43.5" cx="4.993" gradientTransform="matrix(2.0038 0 0 1.4 27.988 -17.4)" r="2.5">
+ <stop stop-color="#181818" offset="0"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <radialGradient id="b" gradientUnits="userSpaceOnUse" cy="43.5" cx="4.993" gradientTransform="matrix(2.0038 0 0 1.4 -20.012 -104.4)" r="2.5">
+ <stop stop-color="#181818" offset="0"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <linearGradient id="f" y2="39.999" gradientUnits="userSpaceOnUse" x2="25.058" y1="47.028" x1="25.058">
+ <stop stop-color="#181818" stop-opacity="0" offset="0"/>
+ <stop stop-color="#181818" offset=".5"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g transform="matrix(0.7 0 0 .33333 -0.8 15.333)">
+ <g opacity=".4" transform="matrix(1.0526 0 0 1.2857 -1.2632 -13.429)">
+ <rect height="7" width="5" y="40" x="38" fill="url(#c)"/>
+ <rect transform="scale(-1)" height="7" width="5" y="-47" x="-10" fill="url(#b)"/>
+ <rect height="7" width="28" y="40" x="10" fill="url(#f)"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <rect style="color:#000000" rx="2" ry="2" height="25" width="25" y="4.5" x="3.5" fill="url(#a)"/>
+ <path opacity=".15" style="color:#000000" d="m18.188 4.9688a1.0386 1.0386 0 0 0 -0.46875 0.25c-8.0692 6.9232-12.522 7.7862-13.782 7.8752a1.0386 1.0386 0 0 0 -0.4375 0.125v8.7187a1.0386 1.0386 0 0 0 0.5 0.125c1.2408 0 3.1922 0.83225 5.0625 2.2812 1.726 1.337 3.383 3.164 4.594 5.156h12.844c1.108 0 2-0.892 2-2v-0.125c-1.2349-2.981-2.1282-7.0748-2.8125-10.781-0.003-0.023 0.003-0.0395 0-0.0625-0.61012-4.7373 0.28634-8.959 0.625-10.281a1.0386 1.0386 0 0 0 -1 -1.2812h-6.9062a1.0386 1.0386 0 0 0 -0.21875 0zm0 4.875c-0.19809 1.3497-0.34502 2.9178-0.46875 4.7812-0.23961 3.6087-0.31211 8.3302-0.34375 13.438-1.2326-2.3066-3.3956-4.6736-5.8438-6.6875-1.4134-1.1626-2.8465-2.1591-4.125-2.9062-0.81148-0.4742-1.5307-0.8115-2.2188-1.0312 1.5275-0.29509 3.8744-0.90217 6.625-2.625 2.3056-1.4441 4.5975-3.3663 6.375-4.9687z" fill-rule="evenodd" fill="#661215"/>
+ <path opacity=".3" style="color:#000000" d="m18.406 6c-8.18 7.019-12.852 8.016-14.406 8.125v2.5312c1.1732-0.164 4.1092-0.751 7.25-2.718 4.027-2.523 8.844-7.313 8.844-7.313-1.302 2.5536-1.684 11.312-1.719 22.875h8.125c0.60271 0 1.1339-0.26843 1.5-0.6875 0.00027-0.0105 0-0.0207 0-0.0312-1.565-3.227-2.576-7.895-3.344-12.062-0.655-4.973 0.298-9.3183 0.656-10.719h-6.9062zm-14.406 12.219v2.8125c3.2857 0 8.2665 3.8155 10.875 8.4688h2.2188c-1.665-4.451-10.589-11.282-13.094-11.282z" fill-rule="evenodd" fill="#661215"/>
+ <path style="color:#000000" d="m18.408 5c-8.18 7.019-12.854 8.01-14.408 8.119v2.5225c1.1732-0.16382 4.1224-0.73265 7.2632-2.6998 4.0274-2.5225 8.8421-7.3113 8.8421-7.3113-1.32 2.5898-1.705 11.522-1.73 23.333h8.441c0.661 0 1.184-0.523 1.184-1.183-1.565-3.227-2.588-7.893-3.355-12.06-0.656-4.973 0.312-9.3203 0.671-10.721h-6.9079zm-14.408 12.23v2.7938c3.3961 0 8.6171 4.0752 11.143 8.9398h2.1215c-1.187-4.423-10.673-11.734-13.264-11.734z" fill="url(#d)"/>
+ </g>
+ <path opacity=".05" d="m25.688 5.0313c-3.216 1.9588-13.74 7.9437-21.688 7.1877v5.4062s17.674 2.6262 24-2.5938v-8.7187c0-0.69873-0.55021-1.2812-1.25-1.2812h-1.0625zm2.312 12.25c-3.181 3.168-6.45 7.386-8.625 11.719h2.5312c1.761-2.975 4.072-6.235 6.094-8.25v-3.4688z" fill-rule="evenodd"/>
+ </g>
+ <rect opacity=".5" stroke-linejoin="round" rx="1" ry="1" height="23" width="23" stroke="url(#e)" stroke-linecap="round" y="5.5" x="4.5" fill="none"/>
+ <rect opacity=".35" stroke-linejoin="round" style="color:#000000" rx="2" ry="2" height="25" width="25" stroke="#410000" stroke-linecap="round" y="4.5" x="3.5" fill="none"/>
+</svg>
diff --git a/core/img/filetypes/application-rss+xml.png b/core/img/filetypes/application-rss+xml.png
index 315c4f4fa62..e5bb322c573 100644
--- a/core/img/filetypes/application-rss+xml.png
+++ b/core/img/filetypes/application-rss+xml.png
Binary files differ
diff --git a/core/img/filetypes/application-rss+xml.svg b/core/img/filetypes/application-rss+xml.svg
new file mode 100644
index 00000000000..4fd98545a7d
--- /dev/null
+++ b/core/img/filetypes/application-rss+xml.svg
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32px" width="32px" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="g" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.57063 0 0 .57063 2.3049 3.3049)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" fx="7.2758" gradientUnits="userSpaceOnUse" cy="9.9571" cx="7.8061" gradientTransform="matrix(-1.0673e-7 3.4663 -5.3421 -1.0405e-7 69.185 -26.355)" r="12.672">
+ <stop stop-color="#ffcd7d" offset="0"/>
+ <stop stop-color="#fc8f36" offset=".26238"/>
+ <stop stop-color="#e23a0e" offset=".70495"/>
+ <stop stop-color="#ac441f" offset="1"/>
+ </radialGradient>
+ <linearGradient id="f" y2=".91791" gradientUnits="userSpaceOnUse" x2="25" gradientTransform="matrix(.66015 0 0 .52505 .15636 5.186)" y1="47.935" x1="25">
+ <stop stop-color="#ba3d12" offset="0"/>
+ <stop stop-color="#db6737" offset="1"/>
+ </linearGradient>
+ <radialGradient id="d" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.015663 0 0 .0082353 17.61 24.981)" r="117.14"/>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.015663 0 0 .0082353 14.39 24.981)" r="117.14"/>
+ <linearGradient id="e" y2="609.51" gradientUnits="userSpaceOnUse" y1="366.65" gradientTransform="matrix(.045769 0 0 .0082353 -.54232 24.981)" x2="302.86" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <rect opacity=".15" height="2" width="22.1" y="28" x="4.95" fill="url(#e)"/>
+ <path opacity=".15" d="m4.95 28v1.9999c-0.80662 0.0038-1.95-0.44807-1.95-1.0001 0-0.552 0.90012-0.99982 1.95-0.99982z" fill="url(#c)"/>
+ <path opacity=".15" d="m27.05 28v1.9999c0.80661 0.0038 1.95-0.44807 1.95-1.0001 0-0.552-0.90012-0.99982-1.95-0.99982z" fill="url(#d)"/>
+ <path stroke-linejoin="round" style="color:#000000" d="m4.4473 5.4473c5.2946 0 23.105 0.00147 23.105 0.00147l0.000029 23.104h-23.105v-23.105z" stroke="url(#f)" stroke-width=".89464" fill="url(#b)"/>
+ </g>
+ <path opacity=".5" stroke-linejoin="round" d="m26.557 27.557h-21.113v-21.113h21.113z" stroke="url(#g)" stroke-linecap="round" stroke-width=".88668" fill="none"/>
+ <path d="m7.0633 24.902c0-0.30708 0.10601-0.56488 0.31803-0.7734 0.21203-0.2123 0.47138-0.31845 0.77805-0.31846 0.2991 0.000007 0.55277 0.10616 0.76101 0.31846 0.21202 0.20852 0.31803 0.46632 0.31803 0.7734 0 0.29951-0.10601 0.55541-0.31803 0.76771-0.20824 0.20852-0.46191 0.31278-0.76101 0.31277-0.30667 0.000007-0.56603-0.10425-0.77805-0.31277-0.2121-0.209-0.3181-0.465-0.3181-0.768m-0.0633-4.931v1.816c2.3202 0 4.2047 1.8882 4.2047 4.2129h1.8223c0-3.33-2.7035-6.0293-6.027-6.0293zm0.00312-3.9745v2.0078c4.4053 0 7.9822 3.5816 7.9822 7.9928h2.0147c0.000015-5.5219-4.4823-10.001-9.9969-10.001z" fill="#fff"/>
+</svg>
diff --git a/core/img/filetypes/application.png b/core/img/filetypes/application.png
index 1dee9e36609..9152cc1b744 100644
--- a/core/img/filetypes/application.png
+++ b/core/img/filetypes/application.png
Binary files differ
diff --git a/core/img/filetypes/application.svg b/core/img/filetypes/application.svg
new file mode 100644
index 00000000000..870a4ac2467
--- /dev/null
+++ b/core/img/filetypes/application.svg
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="e" y2="25" xlink:href="#a" gradientUnits="userSpaceOnUse" x2="16" gradientTransform="matrix(1 0 0 -1 0 34.004)" y1="9" x1="16"/>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="25" xlink:href="#a" gradientUnits="userSpaceOnUse" x2="16" y1="9" x1="16"/>
+ <linearGradient id="g" y2="4.9969" gradientUnits="userSpaceOnUse" x2="19.927" gradientTransform="matrix(.66667 0 0 .66667 0.0000011 .33333)" y1="44.949" x1="19.927">
+ <stop stop-color="#505050" offset="0"/>
+ <stop stop-color="#8e8e8e" offset="1"/>
+ </linearGradient>
+ <linearGradient id="i" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.62162 0 0 .62162 1.0811 2.0811)" y1="5" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".063165"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" gradientUnits="userSpaceOnUse" cy="8.4498" cx="7.4957" gradientTransform="matrix(1.2454e-8 1.4981 -1.5848 -2.76e-8 29.391 -6.3556)" r="20">
+ <stop stop-color="#c7c7c7" offset="0"/>
+ <stop stop-color="#a6a6a6" offset=".26238"/>
+ <stop stop-color="#7b7b7b" offset=".70495"/>
+ <stop stop-color="#595959" offset="1"/>
+ </radialGradient>
+ <linearGradient id="h" y2="3.899" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.64103 0 0 .64103 .61539 1.6154)" y1="44" x1="24">
+ <stop stop-color="#505050" offset="0"/>
+ <stop stop-color="#8e8e8e" offset="1"/>
+ </linearGradient>
+ <radialGradient id="d" gradientUnits="userSpaceOnUse" cy="43.5" cx="4.993" gradientTransform="matrix(2.0038 0 0 1.4 27.988 -17.4)" r="2.5">
+ <stop stop-color="#181818" offset="0"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <radialGradient id="c" gradientUnits="userSpaceOnUse" cy="43.5" cx="4.993" gradientTransform="matrix(2.0038 0 0 1.4 -20.012 -104.4)" r="2.5">
+ <stop stop-color="#181818" offset="0"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <linearGradient id="j" y2="39.999" gradientUnits="userSpaceOnUse" x2="25.058" y1="47.028" x1="25.058">
+ <stop stop-color="#181818" stop-opacity="0" offset="0"/>
+ <stop stop-color="#181818" offset=".5"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g transform="matrix(0.7 0 0 .33333 -0.8 15.333)">
+ <g opacity=".4" transform="matrix(1.0526 0 0 1.2857 -1.2632 -13.429)">
+ <rect height="7" width="5" y="40" x="38" fill="url(#d)"/>
+ <rect transform="scale(-1)" height="7" width="5" y="-47" x="-10" fill="url(#c)"/>
+ <rect height="7" width="28" y="40" x="10" fill="url(#j)"/>
+ </g>
+ </g>
+ <rect stroke-linejoin="round" height="25" stroke="url(#h)" stroke-linecap="round" fill="url(#b)" style="color:#000000" rx="2" ry="2" width="25" y="4.5" x="3.5"/>
+ <rect opacity=".5" stroke-linejoin="round" rx="1" ry="1" height="23" width="23" stroke="url(#i)" stroke-linecap="round" y="5.5" x="4.5" fill="none"/>
+ <g>
+ <path opacity="0.41" style="color:#000000" d="m15 10c-0.277 0-0.5 0.223-0.5 0.5v1.6875c-0.54864 0.14074-1.055 0.37601-1.5312 0.65625l-1.219-1.219c-0.19587-0.19587-0.49163-0.19587-0.6875 0l-1.437 1.437c-0.19587 0.19587-0.19587 0.49163 0 0.6875l1.2188 1.2188c-0.28 0.476-0.516 0.982-0.656 1.531h-1.688c-0.277 0-0.5 0.223-0.5 0.5v2c0 0.277 0.223 0.5 0.5 0.5h1.6875c0.14074 0.54864 0.37601 1.055 0.65625 1.5312l-1.219 1.219c-0.19587 0.19587-0.19587 0.49163 0 0.6875l1.4375 1.4375c0.19587 0.19587 0.49163 0.19587 0.6875 0l1.2188-1.2188c0.47623 0.28024 0.98261 0.51551 1.5312 0.65625v1.6875c0 0.277 0.223 0.5 0.5 0.5h2c0.277 0 0.5-0.223 0.5-0.5v-1.6875c0.54864-0.14074 1.055-0.37601 1.5312-0.65625l1.219 1.219c0.19587 0.19587 0.49163 0.19587 0.6875 0l1.4375-1.4375c0.19587-0.19587 0.19587-0.49163 0-0.6875l-1.22-1.219c0.28-0.476 0.516-0.982 0.656-1.531h1.6875c0.277 0 0.5-0.223 0.5-0.5v-2c0-0.277-0.223-0.5-0.5-0.5h-1.6875c-0.14-0.549-0.376-1.055-0.656-1.531l1.219-1.219c0.19587-0.19587 0.19587-0.49163 0-0.6875l-1.437-1.437c-0.19587-0.19587-0.49163-0.19587-0.6875 0l-1.2188 1.2188c-0.476-0.28-0.982-0.516-1.531-0.656v-1.688c0-0.277-0.223-0.5-0.5-0.5h-2zm1 5c1.6569 0 3 1.3431 3 3s-1.3431 3-3 3-3-1.3431-3-3 1.3431-3 3-3z" fill="#fff"/>
+ <path style="color:#000000" d="m15 9c-0.277 0-0.5 0.223-0.5 0.5v1.6875c-0.54864 0.14074-1.055 0.37601-1.5312 0.65625l-1.219-1.219c-0.19587-0.19587-0.49163-0.19587-0.6875 0l-1.437 1.437c-0.19587 0.19587-0.19587 0.49163 0 0.6875l1.2188 1.2188c-0.28 0.476-0.516 0.982-0.656 1.531h-1.688c-0.277 0-0.5 0.223-0.5 0.5v2c0 0.277 0.223 0.5 0.5 0.5h1.6875c0.14074 0.54864 0.37601 1.055 0.65625 1.5312l-1.219 1.219c-0.19587 0.19587-0.19587 0.49163 0 0.6875l1.4375 1.4375c0.19587 0.19587 0.49163 0.19587 0.6875 0l1.2188-1.2188c0.47623 0.28024 0.98261 0.51551 1.5312 0.65625v1.6875c0 0.277 0.223 0.5 0.5 0.5h2c0.277 0 0.5-0.223 0.5-0.5v-1.6875c0.54864-0.14074 1.055-0.37601 1.5312-0.65625l1.219 1.219c0.19587 0.19587 0.49163 0.19587 0.6875 0l1.4375-1.4375c0.19587-0.19587 0.19587-0.49163 0-0.6875l-1.22-1.219c0.28-0.476 0.516-0.982 0.656-1.531h1.6875c0.277 0 0.5-0.223 0.5-0.5v-2c0-0.277-0.223-0.5-0.5-0.5h-1.6875c-0.14-0.549-0.376-1.055-0.656-1.531l1.219-1.219c0.19587-0.19587 0.19587-0.49163 0-0.6875l-1.437-1.437c-0.19587-0.19587-0.49163-0.19587-0.6875 0l-1.2188 1.2188c-0.476-0.28-0.982-0.516-1.531-0.656v-1.688c0-0.277-0.223-0.5-0.5-0.5h-2zm1 5c1.6569 0 3 1.3431 3 3s-1.3431 3-3 3-3-1.3431-3-3 1.3431-3 3-3z" fill="url(#g)"/>
+ <path opacity=".1" stroke-linejoin="round" style="color:#000000" d="m15.062 9.5625c-0.02465 0.61514 0.0508 1.2431-0.0404 1.8499-0.22156 0.48267-0.86813 0.38946-1.2591 0.66131-0.35888 0.1777-0.83286 0.55716-1.2005 0.17633l-1.1562-1.1562-1.3125 1.3125c0.41328 0.43651 0.87815 0.8308 1.2579 1.2948 0.23668 0.48316-0.28717 0.88122-0.39325 1.3266-0.17191 0.37402-0.17866 1.0023-0.7161 1.0335-0.55991 0.0032-1.1199 0.000478-1.6798 0.0014v1.875c0.61514 0.02465 1.2431-0.0508 1.8499 0.0404 0.48267 0.22156 0.38946 0.86813 0.66131 1.2591 0.1777 0.35888 0.55716 0.83286 0.17633 1.2005l-1.1562 1.1562 1.3125 1.3125c0.43651-0.41328 0.8308-0.87815 1.2948-1.2579 0.48316-0.23668 0.88122 0.28717 1.3266 0.39325 0.37402 0.17191 1.0023 0.17866 1.0335 0.7161 0.0032 0.55991 0.000478 1.1199 0.0014 1.6798h1.875c0.02465-0.61514-0.0508-1.2431 0.0404-1.8499 0.22156-0.48267 0.86813-0.38946 1.2591-0.66131 0.35888-0.1777 0.83286-0.55716 1.2005-0.17633l1.1562 1.1562 1.3125-1.3125c-0.41328-0.43651-0.87815-0.8308-1.2579-1.2948-0.23668-0.48316 0.28717-0.88122 0.39325-1.3266 0.17191-0.37402 0.17866-1.0023 0.7161-1.0335 0.55991-0.0032 1.1199-0.000478 1.6798-0.0014v-1.875c-0.61514-0.02465-1.2431 0.0508-1.8499-0.0404-0.482-0.222-0.389-0.869-0.661-1.26-0.177-0.359-0.557-0.833-0.176-1.201l1.1562-1.1562-1.3125-1.3125c-0.43651 0.41328-0.8308 0.87815-1.2948 1.2579-0.48316 0.23668-0.88122-0.28717-1.3266-0.39325-0.37402-0.17191-1.0023-0.17866-1.0335-0.7161-0.0032-0.55991-0.000478-1.1199-0.0014-1.6798h-1.875z" stroke="url(#f)" fill="none"/>
+ <path opacity=".1" stroke-linejoin="round" style="color:#000000" d="m16 20.566c1.9374 0.05315 3.6634-1.7201 3.5613-3.6545 0.004-1.9389-1.8147-3.6163-3.7447-3.4659-1.9392 0.04516-3.5671 1.9074-3.3688 3.832 0.10413 1.8114 1.739 3.3229 3.5521 3.2884z" stroke="url(#e)" fill="none"/>
+ </g>
+</svg>
diff --git a/core/img/filetypes/audio.png b/core/img/filetypes/audio.png
index a8b3ede3df9..3f56a7e2a9a 100644
--- a/core/img/filetypes/audio.png
+++ b/core/img/filetypes/audio.png
Binary files differ
diff --git a/core/img/filetypes/audio.svg b/core/img/filetypes/audio.svg
new file mode 100644
index 00000000000..d5eda38e8aa
--- /dev/null
+++ b/core/img/filetypes/audio.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32px" width="32px" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="e" y2="24.628" gradientUnits="userSpaceOnUse" x2="20.055" gradientTransform="matrix(.52104 0 0 .81327 3.4707 .35442)" y1="15.298" x1="16.626">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="d" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.62162 0 0 .62162 1.0811 2.0811)" y1="5" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".063165"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <radialGradient id="a" gradientUnits="userSpaceOnUse" cy="8.4498" cx="7.4957" gradientTransform="matrix(1.2454e-8 1.4981 -1.5848 -2.76e-8 29.391 -6.3556)" r="20">
+ <stop stop-color="#3e3e3e" offset="0"/>
+ <stop stop-color="#343434" offset=".26238"/>
+ <stop stop-color="#272727" offset=".70495"/>
+ <stop stop-color="#1d1d1d" offset="1"/>
+ </radialGradient>
+ <radialGradient id="c" gradientUnits="userSpaceOnUse" cy="43.5" cx="4.993" gradientTransform="matrix(2.0038 0 0 1.4 27.988 -17.4)" r="2.5">
+ <stop stop-color="#181818" offset="0"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <radialGradient id="b" gradientUnits="userSpaceOnUse" cy="43.5" cx="4.993" gradientTransform="matrix(2.0038 0 0 1.4 -20.012 -104.4)" r="2.5">
+ <stop stop-color="#181818" offset="0"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <linearGradient id="f" y2="39.999" gradientUnits="userSpaceOnUse" x2="25.058" y1="47.028" x1="25.058">
+ <stop stop-color="#181818" stop-opacity="0" offset="0"/>
+ <stop stop-color="#181818" offset=".5"/>
+ <stop stop-color="#181818" stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g transform="matrix(0.7 0 0 .33333 -0.8 15.333)">
+ <g opacity=".4" transform="matrix(1.0526 0 0 1.2857 -1.2632 -13.429)">
+ <rect height="7" width="5" y="40" x="38" fill="url(#c)"/>
+ <rect transform="scale(-1)" height="7" width="5" y="-47" x="-10" fill="url(#b)"/>
+ <rect height="7" width="28" y="40" x="10" fill="url(#f)"/>
+ </g>
+ </g>
+ <rect style="color:#000000" height="25" width="25" y="4.5" x="3.5" fill="url(#a)"/>
+ <rect opacity=".7" style="color:#000000" height="25" width="25" stroke="#000" y="4.5" x="3.5" fill="none"/>
+ <rect opacity=".5" height="23" width="23" stroke="url(#d)" stroke-linecap="round" y="5.5" x="4.5" fill="none"/>
+ <g>
+ <path opacity=".1" d="m4 5 0.008 15c0.6904-0.015 23.468-5.529 23.992-5.795v-9.205z" fill-rule="evenodd" fill="url(#e)"/>
+ <path opacity=".1" style="color:#000000" d="m16.467 8.0001c-0.53931-0.077588-0.45336 0.42193-0.44484 0.7731-0.0059 4.1692 0.01172 8.3407-0.0088 12.508-0.145 0.32452-0.55212 0.0099-0.80112 0.07215-1.7342-0.05405-3.6017 1.1946-3.847 3.0302-0.25326 1.3789 1.032 2.5932 2.3216 2.6149 1.9178 0.05257 3.5779-1.8787 3.3343-3.8146 0.0065-3.3283-0.01298-6.6593 0.0097-9.9859 0.13139-0.31618 0.4856-0.01847 0.65097 0.09458 1.5212 0.9203 2.8505 2.4463 2.9447 4.3279 0.0815 1.0885-0.14664 2.173-0.46032 3.2072 1.3984-2.3007 1.3227-5.5038-0.40514-7.6054-1.3305-1.3884-2.5797-3.0451-2.8335-5.0311-0.04896-0.18667-0.30655-0.18423-0.46044-0.19158z" fill="#fff"/>
+ <path opacity=".9" style="color:#000000" d="m16.467 7.0001c-0.53931-0.077588-0.45336 0.42193-0.44484 0.7731-0.0059 4.1692 0.01172 8.3407-0.0088 12.508-0.145 0.32452-0.55212 0.0099-0.80112 0.07215-1.7342-0.05405-3.6017 1.1946-3.847 3.0302-0.25326 1.3789 1.032 2.5932 2.3216 2.6149 1.9178 0.05257 3.5779-1.8787 3.3343-3.8146 0.0065-3.3283-0.01298-6.6593 0.0097-9.9859 0.13139-0.31618 0.4856-0.01847 0.65097 0.09458 1.5212 0.9203 2.8505 2.4463 2.9447 4.3279 0.0815 1.0885-0.14664 2.173-0.46032 3.2072 1.3984-2.3007 1.3227-5.5038-0.40514-7.6054-1.33-1.388-2.58-3.0443-2.833-5.0303-0.049-0.1866-0.307-0.1842-0.461-0.1916z"/>
+ </g>
+</svg>
diff --git a/core/img/filetypes/code.png b/core/img/filetypes/code.png
index 0c76bd12977..753d151f538 100644
--- a/core/img/filetypes/code.png
+++ b/core/img/filetypes/code.png
Binary files differ
diff --git a/core/img/filetypes/code.svg b/core/img/filetypes/code.svg
new file mode 100644
index 00000000000..61a5c19f511
--- /dev/null
+++ b/core/img/filetypes/code.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32px" width="32px" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="g" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.56757 0 0 .72973 2.3784 -2.5135)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.65714 0 0 .63012 .22856 -1.0896)" y1=".98521" x1="25.132">
+ <stop stop-color="#f4f4f4" offset="0"/>
+ <stop stop-color="#dbdbdb" offset="1"/>
+ </linearGradient>
+ <linearGradient id="e" y2="2.9062" gradientUnits="userSpaceOnUse" x2="-51.786" gradientTransform="matrix(.53064 0 0 .58970 39.27 -1.7919)" y1="50.786" x1="-51.786">
+ <stop stop-color="#a0a0a0" offset="0"/>
+ <stop stop-color="#bebebe" offset="1"/>
+ </linearGradient>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.015663 0 0 .0082353 17.61 25.981)" r="117.14"/>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.015663 0 0 .0082353 14.39 25.981)" r="117.14"/>
+ <linearGradient id="d" y2="609.51" gradientUnits="userSpaceOnUse" y1="366.65" gradientTransform="matrix(.045769 0 0 .0082353 -.54232 25.981)" x2="302.86" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <g>
+ <rect opacity=".15" height="2" width="22.1" y="29" x="4.95" fill="url(#d)"/>
+ <path opacity=".15" d="m4.95 29v1.9999c-0.80662 0.0038-1.95-0.44807-1.95-1.0001 0-0.552 0.90012-0.99982 1.95-0.99982z" fill="url(#b)"/>
+ <path opacity=".15" d="m27.05 29v1.9999c0.80661 0.0038 1.95-0.44807 1.95-1.0001 0-0.552-0.90012-0.99982-1.95-0.99982z" fill="url(#c)"/>
+ </g>
+ <path stroke-linejoin="round" d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" stroke="url(#e)" stroke-width=".99992" fill="url(#f)"/>
+ </g>
+ <path stroke-linejoin="round" d="m26.5 28.5h-21v-27h21z" stroke="url(#g)" stroke-linecap="round" fill="none"/>
+ <path d="m8 5.505h2.3438zm2.6875 0h2.1875zm2.5312 0h1.9375zm2.25 0h0.84375zm-7.4688 2h3.6562zm4.0625 0h1.75zm2.0625 0h0.875zm1.2188 0h1.5938zm1.9375 0h1.625zm-9.282 1.995h4.2812zm4.625 0h4.625zm1.703 8h0.84375zm1.1875 0h1.875zm2.25 0h4.9062zm-2.6875 2.075h1.8438zm-1.028 5.925h2.9688zm3.8562 0h1.1875z" stroke="#89adc2" stroke-width="1px" fill="none"/>
+ <g transform="translate(27.06 6.7752)">
+ <path d="m-15.57 10.277h0.93368v1h-0.93368z" fill="#d48eb3"/>
+ <path d="m-14.483 10.277h0.41011v1h-0.41011z" fill="#d48eb3"/>
+ <path opacity=".7" d="m-19.06 16.277h1.9967v1h-1.9967v-1z" fill="#666"/>
+ <path opacity=".7" d="m-16.907 16.277h2.1395v1h-2.1395v-1z" fill="#666"/>
+ <g fill="#d48eb3">
+ <path d="m-14.611 16.277h0.85436v1h-0.85436v-1z"/>
+ <path d="m-13.6 16.277h2.0125v1h-2.0125v-1z"/>
+ <path d="m-9.8967 16.277h0.53704v1h-0.53704v-1z"/>
+ <path d="m-11.431 16.277h1.3779v1h-1.3779v-1z"/>
+ <path d="m-9.2031 16.277h0.31492v1h-0.31492v-1z"/>
+ <path d="m-8.7317 16.277h0.85436v1h-0.85436v-1z"/>
+ <path d="m-16.466 12.277h2.3933v1h-2.3933z"/>
+ </g>
+ <path d="m-19.06 14.277h1.8063v1h-1.8063v-1z" fill="#94d48e"/>
+ <path d="m-17.105 14.277h0.56877v1h-0.56877v-1z" fill="#94d48e"/>
+ <path opacity=".7" d="m-16.387 14.277h1.2986v1h-1.2986v-1z" fill="#666"/>
+ <path opacity=".7" d="m-14.939 14.277h0.88609v1h-0.88609v-1z" fill="#666"/>
+ <path d="m-19.06 18.277h1.4875v1h-1.4875v-1z" fill="#de6161"/>
+ <path opacity=".7" d="m-17.334 18.277h2.6472v1h-2.6472v-1z" fill="#666"/>
+ </g>
+ <g>
+ <path d="m8 12v1h3.0625v-1h-3.062zm0 2v1h3.0938v-1h-3.094z" fill="#b78ed4"/>
+ <path d="m12.406 12v1h5.594v-1zm0.03125 2v1h5.0938v-1z" fill="#d48eb3"/>
+ <path d="m8 17v1h2.5312v-1zm0 2.031v0.969h2.2188v-0.96875z" fill="#94d48e"/>
+ </g>
+</svg>
diff --git a/core/img/filetypes/file.png b/core/img/filetypes/file.png
index 8b8b1ca0000..c20f13c2e13 100644
--- a/core/img/filetypes/file.png
+++ b/core/img/filetypes/file.png
Binary files differ
diff --git a/core/img/filetypes/file.svg b/core/img/filetypes/file.svg
new file mode 100644
index 00000000000..3d91c341143
--- /dev/null
+++ b/core/img/filetypes/file.svg
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.56757 0 0 .72973 2.3784 -2.5135)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="e" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.65714 0 0 .63012 .22856 -1.0896)" y1=".98521" x1="25.132">
+ <stop stop-color="#f4f4f4" offset="0"/>
+ <stop stop-color="#dbdbdb" offset="1"/>
+ </linearGradient>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.015663 0 0 .0082353 17.61 25.981)" r="117.14"/>
+ <radialGradient id="b" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.015663 0 0 .0082353 14.39 25.981)" r="117.14"/>
+ <linearGradient id="d" y2="609.51" gradientUnits="userSpaceOnUse" x2="302.86" gradientTransform="matrix(.045769 0 0 .0082353 -.54232 25.981)" y1="366.65" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <g>
+ <rect opacity=".15" height="2" width="22.1" y="29" x="4.95" fill="url(#d)"/>
+ <path opacity=".15" d="m4.95 29v1.9999c-0.80662 0.0038-1.95-0.44807-1.95-1.0001 0-0.552 0.90012-0.99982 1.95-0.99982z" fill="url(#b)"/>
+ <path opacity=".15" d="m27.05 29v1.9999c0.80661 0.0038 1.95-0.44807 1.95-1.0001 0-0.552-0.90012-0.99982-1.95-0.99982z" fill="url(#c)"/>
+ </g>
+ <path d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" fill="url(#e)"/>
+ </g>
+ <path stroke-linejoin="round" d="m26.5 28.5h-21v-27h21z" stroke="url(#f)" stroke-linecap="round" fill="none"/>
+ <path stroke-linejoin="round" opacity=".3" d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" stroke="#000" stroke-width=".99992" fill="none"/>
+</svg>
diff --git a/core/img/filetypes/flash.png b/core/img/filetypes/flash.png
index 9f5db634a4f..bcde641da3c 100644
--- a/core/img/filetypes/flash.png
+++ b/core/img/filetypes/flash.png
Binary files differ
diff --git a/core/img/filetypes/flash.svg b/core/img/filetypes/flash.svg
new file mode 100644
index 00000000000..cb823703d9b
--- /dev/null
+++ b/core/img/filetypes/flash.svg
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="j" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.56757 0 0 .72973 2.3784 -2.5135)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="i" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.65714 0 0 .63012 .22856 -1.0896)" y1=".98521" x1="25.132">
+ <stop stop-color="#f4f4f4" offset="0"/>
+ <stop stop-color="#dbdbdb" offset="1"/>
+ </linearGradient>
+ <radialGradient id="d" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.015663 0 0 .0082353 17.61 25.981)" r="117.14"/>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.015663 0 0 .0082353 14.39 25.981)" r="117.14"/>
+ <linearGradient id="h" y2="609.51" gradientUnits="userSpaceOnUse" x2="302.86" gradientTransform="matrix(.045769 0 0 .0082353 -.54232 25.981)" y1="366.65" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="g" y2="25.726" gradientUnits="userSpaceOnUse" x2="27.401" gradientTransform="matrix(.65714 0 0 .65901 .22856 .17230)" y1="22.442" x1="27.401">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="35" gradientUnits="userSpaceOnUse" x2="25" gradientTransform="matrix(.65714 0 0 .65901 .22856 .17230)" y1="12" x1="25">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" fx="30.345" gradientUnits="userSpaceOnUse" cy="10.417" cx="28.897" gradientTransform="matrix(.85740 -2.1584e-8 0 1.4143 -9.1048 9.1644)" r="20">
+ <stop stop-color="#f8b17e" offset="0"/>
+ <stop stop-color="#e35d4f" offset=".26238"/>
+ <stop stop-color="#c6262e" offset=".66094"/>
+ <stop stop-color="#690b54" offset="1"/>
+ </radialGradient>
+ <linearGradient id="e" y2="36.647" gradientUnits="userSpaceOnUse" x2="21.587" gradientTransform="matrix(.65714 0 0 .65901 -0.1 -.12653)" y1="11.492" x1="21.587">
+ <stop stop-color="#911313" offset="0"/>
+ <stop stop-color="#bc301e" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <g>
+ <rect opacity=".15" height="2" width="22.1" y="29" x="4.95" fill="url(#h)"/>
+ <path opacity=".15" d="m4.95 29v1.9999c-0.80662 0.0038-1.95-0.44807-1.95-1.0001 0-0.552 0.90012-0.99982 1.95-0.99982z" fill="url(#c)"/>
+ <path opacity=".15" d="m27.05 29v1.9999c0.80661 0.0038 1.95-0.44807 1.95-1.0001 0-0.552-0.90012-0.99982-1.95-0.99982z" fill="url(#d)"/>
+ </g>
+ <path d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" fill="url(#i)"/>
+ </g>
+ <path stroke-linejoin="round" d="m26.5 28.5h-21v-27h21z" stroke="url(#j)" stroke-linecap="round" fill="none"/>
+ <path stroke-linejoin="round" opacity=".3" d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" stroke="#000" stroke-width=".99992" fill="none"/>
+ <path opacity=".6" style="color:#000000" d="m22.499 8.0004c-2.6636-0.029674-5.0587 1.658-6.5324 3.7793-0.94364 1.305-1.5732 2.7991-2.0832 4.3148-0.69136 1.6778-1.5201 3.4583-3.0765 4.5016-0.45903 0.43459-1.0981 0.2-1.5957 0.43224-0.34845 0.3228-0.14701 0.84514-0.20078 1.2625 0.014388 0.76734-0.029122 1.5402 0.022375 2.304 0.18898 0.54758 0.88853 0.37796 1.3325 0.38828 2.2257-0.09973 4.2002-1.5034 5.3804-3.336 0.54977-0.82122 0.97797-1.7194 1.3143-2.6473 1.5061-0.0077 3.0142 0.01532 4.519-0.01144 0.47522-0.09148 0.43944-0.63085 0.42264-1.001-0.0162-0.88446 0.03272-1.7755-0.02502-2.6558-0.16487-0.50455-0.76136-0.34818-1.1638-0.37106h-1.4529c0.52776-1.2578 1.4889-2.5011 2.8611-2.8681 0.36161 0.0036 0.81834-0.19473 0.77518-0.62481-0.01611-1.0312 0.03245-2.0689-0.02468-3.096-0.06232-0.20565-0.25794-0.35925-0.47259-0.37101z" fill="#fff"/>
+ <g stroke-linecap="round">
+ <path stroke-linejoin="round" style="color:#000000" d="m9.5 20.5v3s4.9977 0.73959 7.2131-6c0.14685-0.000002 4.7869 0 4.7869 0v-3h-3s1.2833-3.7081 4-4l-0.000016-3s-5.0297-0.35936-7.7464 6.7199c-2.35 6.933-5.254 6.28-5.254 6.28z" stroke="url(#e)" fill="url(#b)"/>
+ <path opacity=".1" style="color:#000000" d="m21.5 9.8357v-1.2407c-1.6165 0.19395-3.8735 2.0585-4.8706 4.0955-0.67454 1.078-0.96187 2.016-1.4144 3.1932-0.81519 1.9428-2.1324 4.1368-4.0625 5.1513" stroke="url(#f)" fill="none"/>
+ <path opacity=".1" style="color:#000000" d="m20.5 16.656v-1.1418l-2.3993-0.02926" stroke="url(#g)" fill="none"/>
+ </g>
+</svg>
diff --git a/core/img/filetypes/folder.png b/core/img/filetypes/folder.png
index 784e8fa4823..b7be63d5836 100644
--- a/core/img/filetypes/folder.png
+++ b/core/img/filetypes/folder.png
Binary files differ
diff --git a/core/img/filetypes/folder.svg b/core/img/filetypes/folder.svg
new file mode 100644
index 00000000000..92d4cc22718
--- /dev/null
+++ b/core/img/filetypes/folder.svg
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32px" width="32px" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="c" y2="21.387" gradientUnits="userSpaceOnUse" x2="27.557" gradientTransform="matrix(.89186 0 0 1.0539 3.1208 5.4125)" y1="7.1627" x1="27.557">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".0097359"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".99001"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="d" y2="36.658" gradientUnits="userSpaceOnUse" x2="22.809" gradientTransform="matrix(.74675 0 0 .65549 -1.9219 1.1676)" y1="49.629" x1="22.935">
+ <stop stop-color="#0a0a0a" stop-opacity=".498" offset="0"/>
+ <stop stop-color="#0a0a0a" stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="e" y2="43.761" gradientUnits="userSpaceOnUse" x2="35.793" gradientTransform="matrix(.64444 0 0 .64286 .53352 .89286)" y1="17.118" x1="35.793">
+ <stop stop-color="#b4cee1" offset="0"/>
+ <stop stop-color="#5d9fcd" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="609.51" gradientUnits="userSpaceOnUse" x2="302.86" gradientTransform="matrix(.051143 0 0 .015916 -2.49 22.299)" y1="366.65" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.019836 0 0 .015916 16.388 22.299)" r="117.14">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <radialGradient id="a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.019836 0 0 .015916 15.601 22.299)" r="117.14">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </radialGradient>
+ <linearGradient id="g" y2="34.143" gradientUnits="userSpaceOnUse" x2="21.37" gradientTransform="matrix(.54384 0 0 .61466 3.2689 5.0911)" y1="4.7324" x1="21.37">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".11063"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".99001"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="h" y2="16" gradientUnits="userSpaceOnUse" x2="62.989" gradientTransform="matrix(.61905 0 0 .61905 -30.392 1.4286)" y1="13" x1="62.989">
+ <stop stop-color="#f9f9f9" offset="0"/>
+ <stop stop-color="#d8d8d8" offset="1"/>
+ </linearGradient>
+ <linearGradient id="i" y2="3.6337" gradientUnits="userSpaceOnUse" y1="53.514" gradientTransform="matrix(.50703 0 0 0.503 68.029 1.3298)" x2="-51.786" x1="-51.786">
+ <stop stop-opacity=".32174" offset="0"/>
+ <stop stop-opacity=".27826" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <path opacity=".8" style="color:#000000" d="m4.0002 6.5001c-0.43342 0.005-0.5 0.21723-0.5 0.6349v1.365c-1.2457 0-1-0.002-1 0.54389 0.0216 6.5331 0 6.9014 0 7.4561 0.90135 0 27-2.349 27-3.36v-4.0961c0-0.41767-0.34799-0.54876-0.78141-0.54389h-14.219v-1.365c0-0.41767-0.26424-0.63977-0.69767-0.6349h-9.8023z" stroke="url(#i)" fill="none"/>
+ <path style="color:#000000" d="m4.0002 7v2h-1v4h26v-4h-15v-2h-10z" fill="url(#h)"/>
+ <path style="color:#000000" d="m4.5002 7.5v2h-1v4h25v-4h-15v-2h-9z" stroke="url(#g)" stroke-linecap="round" fill="none"/>
+ </g>
+ <g transform="translate(.00017936 -1)">
+ <rect opacity=".3" height="3.8653" width="24.695" y="28.135" x="3.6472" fill="url(#f)"/>
+ <path opacity=".3" d="m28.342 28.135v3.865c1.0215 0.0073 2.4695-0.86596 2.4695-1.9328s-1.1399-1.9323-2.4695-1.9323z" fill="url(#b)"/>
+ <path opacity=".3" d="m3.6472 28.135v3.865c-1.0215 0.0073-2.4695-0.86596-2.4695-1.9328s1.1399-1.9323 2.4695-1.9323z" fill="url(#a)"/>
+ </g>
+ <path style="color:#000000" d="m1.927 11.5c-0.69105 0.0796-0.32196 0.90258-0.37705 1.3654 0.0802 0.29906 0.59771 15.718 0.59771 16.247 0 0.46018 0.22667 0.38222 0.80101 0.38222h26.397c0.61872 0.0143 0.48796 0.007 0.48796-0.38947 0.0452-0.20269 0.63993-16.978 0.66282-17.243 0-0.279 0.0581-0.3621-0.30493-0.3621h-28.265z" fill="url(#e)"/>
+ <path opacity=".4" d="m1.682 11 28.636 0.00027c0.4137 0 0.68181 0.29209 0.68181 0.65523l-0.6735 17.712c0.01 0.45948-0.1364 0.64166-0.61707 0.63203l-27.256-0.0115c-0.4137 0-0.83086-0.27118-0.83086-0.63432l-0.62244-17.698c0-0.36314 0.26812-0.65549 0.68182-0.65549z" fill="url(#d)"/>
+ <path opacity=".5" style="color:#000000" d="m2.5002 12.5 0.62498 16h25.749l0.62498-16z" stroke="url(#c)" stroke-linecap="round" fill="none"/>
+ <path opacity=".3" stroke-linejoin="round" style="color:#000000" d="m1.927 11.5c-0.69105 0.0796-0.32196 0.90258-0.37705 1.3654 0.0802 0.29906 0.59771 15.718 0.59771 16.247 0 0.46018 0.22667 0.38222 0.80101 0.38222h26.397c0.61872 0.0143 0.48796 0.007 0.48796-0.38947 0.0452-0.20269 0.63993-16.978 0.66282-17.243 0-0.279 0.0581-0.3621-0.30493-0.3621h-28.265z" stroke="#000" stroke-linecap="round" fill="none"/>
+</svg>
diff --git a/core/img/filetypes/font.png b/core/img/filetypes/font.png
index 81e41de7d3a..9404c3ca6ac 100644
--- a/core/img/filetypes/font.png
+++ b/core/img/filetypes/font.png
Binary files differ
diff --git a/core/img/filetypes/font.svg b/core/img/filetypes/font.svg
new file mode 100644
index 00000000000..8fca5ff9eff
--- /dev/null
+++ b/core/img/filetypes/font.svg
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.0" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="h" y2="45.497" gradientUnits="userSpaceOnUse" x2="22.056" gradientTransform="matrix(.85825 0 0 .86435 .35576 -11.07)" y1="15.834" x1="22.056">
+ <stop stop-color="#575757" offset="0"/>
+ <stop stop-color="#333" offset="1"/>
+ </linearGradient>
+ <radialGradient id="e" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="36.686" cx="-6.1603" gradientTransform="matrix(.25444 0 0 .18504 6.1544 20.059)" r="14.098"/>
+ <radialGradient id="d" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="36.686" cx="-6.1603" gradientTransform="matrix(.83270 0 0 .18284 17.869 20.171)" r="14.098"/>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="36.686" cx="-6.1603" gradientTransform="matrix(.69391 0 0 .18504 25.492 20.059)" r="14.098"/>
+ <linearGradient id="g" y2="103.13" gradientUnits="userSpaceOnUse" x2="143.92" gradientTransform="matrix(.97891 0 0 .95244 -119.66 -63.433)" y1="75.221" x1="143.92">
+ <stop stop-color="#f8b17e" offset="0"/>
+ <stop stop-color="#e35d4f" offset=".31210"/>
+ <stop stop-color="#c6262e" offset=".57054"/>
+ <stop stop-color="#690b54" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="75.221" gradientUnits="userSpaceOnUse" x2="153.41" gradientTransform="matrix(.97891 0 0 .95244 -119.66 -63.433)" y1="98.785" x1="153.41">
+ <stop stop-color="#791235" offset="0"/>
+ <stop stop-color="#dd3b27" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="36.686" cx="-6.1603" gradientTransform="matrix(.25444 0 0 .18504 22.459 20.059)" r="14.098"/>
+ </defs>
+ <g>
+ <g fill-rule="evenodd">
+ <path opacity=".2" d="m24.478 26.848a3.587 2.6087 0 1 1 -7.1739 0 3.587 2.6087 0 1 1 7.1739 0z" fill="url(#b)"/>
+ <path d="m29.106 9.9132c-0.478-1.0813-1.642-0.968-2.441-1.1397-2.646-0.3044-5.287 0.181-7.504 1.6705-2.1399 1.4497-4.0763 3.4112-5.4365 5.9425-1.1823 2.2548-1.7132 5.267-0.96727 8.1364 0.58709 1.9316 2.3544 3.1247 3.845 2.803 2.2818-0.38055 3.9079-2.4984 5.2493-4.5646 0.60658-0.85208 0.97918-1.9805 1.6952-2.6966-0.1019 1.8363-0.14753 3.7435 0.26981 5.6082 0.2372 1.0995 1.1049 1.9662 1.9843 1.9261 0.89467-0.10266 1.5757-0.87918 2.3174-1.386 0.66706-0.59088 1.4312-1.0989 1.9035-1.9532-0.08137-1.4151-1.3465-0.52654-1.7881-0.04084-0.61732 0.97151-1.8927 0.19955-1.6199-1.1225 0.14283-3.0198 0.84698-5.8557 1.4425-8.7028 0.3348-1.5009 0.68722-2.9931 1.0492-4.4802h-0.000001zm-3.696 1.8848c-1.1333 3.5797-2.3575 7.223-4.4519 9.9984-0.98815 1.2662-2.437 2.4144-4.0344 1.8053-1.1039-0.48951-1.3597-2.0989-1.3836-3.3097-0.14247-3.5752 1.5838-6.5362 3.7419-8.3224 1.5043-1.1975 3.4487-1.7396 5.3479-1.1547 0.35854 0.1335 0.74746 0.47906 0.78012 0.983v-0.000001z" stroke="url(#f)" fill="url(#g)"/>
+ <path opacity=".2" d="m31 26.848a9.7826 2.6087 0 1 1 -19.565 0 9.7826 2.6087 0 1 1 19.565 0z" fill="url(#c)"/>
+ <path opacity=".05" d="m24.478 26.879a11.739 2.5777 0 1 1 -23.478 0 11.739 2.5777 0 1 1 23.478 0z" fill="url(#d)"/>
+ <path opacity=".2" d="m8.1739 26.848a3.587 2.6087 0 1 1 -7.1739 0 3.587 2.6087 0 1 1 7.1739 0z" fill="url(#e)"/>
+ </g>
+ <path d="m19.663 27.5c-0.79147-2.2568-1.583-4.5913-2.3744-6.8481h-9.7253c-0.8117 2.284-1.6229 4.564-2.4341 6.848h-3.1514c3.0005-8.2609 6.001-15.739 9.0016-24h2.8497c3.0061 8.2609 6.0122 15.739 9.0183 24h-3.1849zm-3.337-10.109-3.913-10.391-3.913 10.391z" stroke="#333" stroke-width="1px" fill="url(#h)"/>
+ </g>
+</svg>
diff --git a/core/img/filetypes/image-svg+xml.png b/core/img/filetypes/image-svg+xml.png
index a1291c2dfad..e3dd52489d3 100644
--- a/core/img/filetypes/image-svg+xml.png
+++ b/core/img/filetypes/image-svg+xml.png
Binary files differ
diff --git a/core/img/filetypes/image-svg+xml.svg b/core/img/filetypes/image-svg+xml.svg
new file mode 100644
index 00000000000..06df5f54da6
--- /dev/null
+++ b/core/img/filetypes/image-svg+xml.svg
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32px" width="32px" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="h" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.56757 0 0 .72973 2.3784 -2.5135)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="g" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.65714 0 0 .63012 .22856 -1.0896)" y1=".98521" x1="25.132">
+ <stop stop-color="#f4f4f4" offset="0"/>
+ <stop stop-color="#dbdbdb" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="2.9062" gradientUnits="userSpaceOnUse" x2="-51.786" gradientTransform="matrix(.53064 0 0 .58970 39.27 -1.7919)" y1="50.786" x1="-51.786">
+ <stop stop-color="#a0a0a0" offset="0"/>
+ <stop stop-color="#bebebe" offset="1"/>
+ </linearGradient>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.015663 0 0 .0082353 17.61 25.981)" r="117.14"/>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.015663 0 0 .0082353 14.39 25.981)" r="117.14"/>
+ <linearGradient id="e" y2="609.51" gradientUnits="userSpaceOnUse" y1="366.65" gradientTransform="matrix(.045769 0 0 .0082353 -.54232 25.981)" x2="302.86" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="d" y2="13.664" gradientUnits="userSpaceOnUse" x2="16.887" gradientTransform="matrix(.65943 0 0 .64652 -27.821 1.2237)" y1="24.24" x1="28.534">
+ <stop stop-color="#fda852" offset="0"/>
+ <stop stop-color="#fff" stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <g>
+ <rect opacity=".15" height="2" width="22.1" y="29" x="4.95" fill="url(#e)"/>
+ <path opacity=".15" d="m4.95 29v1.9999c-0.80662 0.0038-1.95-0.44807-1.95-1.0001 0-0.552 0.90012-0.99982 1.95-0.99982z" fill="url(#b)"/>
+ <path opacity=".15" d="m27.05 29v1.9999c0.80661 0.0038 1.95-0.44807 1.95-1.0001 0-0.552-0.90012-0.99982-1.95-0.99982z" fill="url(#c)"/>
+ </g>
+ <path stroke-linejoin="round" d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" stroke="url(#f)" stroke-width=".99992" fill="url(#g)"/>
+ </g>
+ <path stroke-linejoin="round" d="m26.5 28.5h-21v-27h21z" stroke="url(#h)" stroke-linecap="round" fill="none"/>
+ <g transform="translate(27.788 -2.3184)">
+ <g>
+ <path d="m-17.037 24.229c2.7541 1.8316 8.7672-0.61882 3.7681-7.1764-4.9538-6.4982 4.9219-10.76 7.8525-3.2453" fill-rule="evenodd" stroke="#ea541a" stroke-width="1px" fill="url(#d)"/>
+ <rect height="2" width="2" y="22.818" x="-18.788" fill="#ea541a"/>
+ <rect height="2" width="2" y="12.818" x="-6.788" fill="#ea541a"/>
+ </g>
+ <path d="m-17.699 11.147 9.5001 12.316" stroke="#ea541a" stroke-width="1px" fill="none"/>
+ <g>
+ <path d="m-16.288 11.318c0.000372 0.55218-0.44745 1-1 1s-1.0004-0.44782-1-1c-0.000372-0.55218 0.44745-1 1-1s1.0004 0.44782 1 1z" stroke="#ea541a" fill="#e6e6e6"/>
+ <path d="m-7.288 23.318c0.000373 0.55218-0.44745 1-1 1s-1.0004-0.44782-1-1c-0.000372-0.55218 0.44745-1 1-1s1.0004 0.44782 1 1z" stroke="#ea541a" fill="#e6e6e6"/>
+ <rect height="2" width="2" y="15.818" x="-14.788" fill="#ea541a"/>
+ </g>
+ </g>
+</svg>
diff --git a/core/img/filetypes/image.png b/core/img/filetypes/image.png
index 4a158fef7e0..087f5dcdbdf 100644
--- a/core/img/filetypes/image.png
+++ b/core/img/filetypes/image.png
Binary files differ
diff --git a/core/img/filetypes/image.svg b/core/img/filetypes/image.svg
new file mode 100644
index 00000000000..50991f7359d
--- /dev/null
+++ b/core/img/filetypes/image.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.0" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.028917 0 0 .012353 26.973 38.471)" r="117.14"/>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.028917 0 0 .012353 21.027 38.471)" r="117.14"/>
+ <linearGradient id="k" y2="609.51" gradientUnits="userSpaceOnUse" x2="302.86" gradientTransform="matrix(.084497 0 0 .012353 -6.5396 38.471)" y1="366.65" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="e" y2="24.628" gradientUnits="userSpaceOnUse" x2="20.055" gradientTransform="matrix(.57894 0 0 .65062 2.0784 1.9502)" y1="15.298" x1="16.626">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <linearGradient id="h" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.77477 0 0 .61261 -2.5946 1.2973)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="g" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.85714 0 0 .52148 -4.5714 2.6844)" y1=".98521" x1="25.132">
+ <stop stop-color="#f4f4f4" offset="0"/>
+ <stop stop-color="#dbdbdb" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="2.9062" gradientUnits="userSpaceOnUse" x2="-51.786" gradientTransform="matrix(.69214 0 0 .48803 46.352 2.1033)" y1="50.786" x1="-51.786">
+ <stop stop-color="#a0a0a0" offset="0"/>
+ <stop stop-color="#bebebe" offset="1"/>
+ </linearGradient>
+ <linearGradient id="j" y2="96.253" gradientUnits="userSpaceOnUse" x2="45.567" gradientTransform="matrix(.32723 0 0 .25356 -38.234 -30.559)" y1="15.27" x1="45.414">
+ <stop stop-color="#262626" offset="0"/>
+ <stop stop-color="#4d4d4d" offset="1"/>
+ </linearGradient>
+ <linearGradient id="i" y2="-40.164" gradientUnits="userSpaceOnUse" x2="-24.098" gradientTransform="matrix(.74286 0 0 .74074 1.8384 4.0069)" y1="-13.091" x1="-24.032">
+ <stop stop-color="#1d1d1d" offset="0"/>
+ <stop offset="1"/>
+ </linearGradient>
+ <linearGradient id="d" y2="-174.97" gradientUnits="userSpaceOnUse" x2="149.98" gradientTransform="matrix(.28088 0 0 .28276 -22.128 49.806)" y1="-104.24" x1="149.98">
+ <stop stop-color="#272727" offset="0"/>
+ <stop stop-color="#454545" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <g opacity=".4" transform="matrix(.66667 0 0 .66667 0 -1.6667)" stroke-width=".0225">
+ <rect height="3" width="40.8" y="43" x="3.6" fill="url(#k)"/>
+ <path d="m3.6 43v2.9998c-1.4891 0.006-3.6-0.672-3.6-1.5s1.6618-1.5 3.6-1.5z" fill="url(#b)"/>
+ <path d="m44.4 43v2.9998c1.4891 0.0056 3.6-0.67211 3.6-1.5001 0-0.828-1.6618-1.4997-3.6-1.4997z" fill="url(#c)"/>
+ </g>
+ <path stroke-linejoin="round" d="m0.99997 4c6.8745 0 30 0.0015 30 0.0015l0.000036 23.999h-30v-24z" stroke="url(#f)" stroke-width=".0066667" fill="url(#g)"/>
+ <path stroke-linejoin="round" d="m30.333 27.333h-28.667v-22.667h28.667z" stroke="url(#h)" stroke-linecap="round" stroke-width=".0066667" fill="none"/>
+ </g>
+ <g>
+ <rect transform="matrix(-.99999 .0037552 .0024409 -1 0 0)" rx="0" ry="0" height="19.903" width="25.952" stroke="url(#i)" stroke-linecap="round" y="-26.012" x="-29.015" stroke-width=".0066668" fill="url(#j)"/>
+ <path style="color:#000000" d="m14.458 9.5417c-0.73638 0-1.3333 1.1939-1.3333 2.6667 0 0.24505 0.01072 0.48294 0.04167 0.70833-0.15826-0.15989-0.30816-0.33156-0.5-0.47917-1.1673-0.89808-2.4885-1.1461-2.9375-0.5625-0.44904 0.58363 0.14525 1.7894 1.3125 2.6875 0.22148 0.1704 0.44175 0.29391 0.66667 0.41667-0.25479 0.03257-0.52266 0.08822-0.79167 0.16667-1.4139 0.41232-2.3937 1.3347-2.1875 2.0417 0.20616 0.70693 1.5236 0.93315 2.9375 0.52083 0.2651-0.07731 0.52042-0.1633 0.75-0.27083-0.05604 0.10202-0.11595 0.20204-0.16667 0.3125-2.7782 2.4796-5.0625 7.2292-5.0625 7.2292l0.95833 0.02083c0.5207-1.25 1.8077-3.994 3.7925-6.293-0.28085 1.1684-0.0992 2.2006 0.5 2.4167 0.69271 0.24982 1.667-0.67708 2.1667-2.0625 0.04494-0.12462 0.06976-0.25209 0.10417-0.375 0.05396 0.11891 0.10152 0.23517 0.16667 0.35417 0.70727 1.2918 1.8124 2.062 2.4583 1.7083 0.64591-0.35364 0.58227-1.6874-0.125-2.9792-0.04035-0.07369-0.08227-0.13821-0.125-0.20833 0.07835 0.02437 0.14794 0.04131 0.22917 0.0625 1.4251 0.37181 2.7308 0.10836 2.9167-0.60417 0.18591-0.71253-0.82495-1.5865-2.25-1.9583-0.02183-0.0057-0.04073-0.01544-0.0625-0.02083 0.01921-0.01078 0.04331-0.0098 0.0625-0.02083 1.2754-0.73638 2.014-1.8623 1.6458-2.5-0.36819-0.63772-1.7037-0.54888-2.9792 0.1875-0.40854 0.23587-0.74162 0.50638-1.0208 0.79167 0.10589-0.38234 0.16667-0.82364 0.16667-1.2917 0-1.4728-0.59695-2.6667-1.3333-2.6667zm0.042 4.4583c0.92048 0 1.6667 0.74619 1.6667 1.6667 0 0.92047-0.74619 1.6667-1.6667 1.6667-0.92048 0-1.6667-0.74619-1.6667-1.6667 0-0.921 0.747-1.667 1.667-1.667z" fill="url(#d)"/>
+ <path fill="#d2d2d2" d="m14.458 10.188c-0.73638 0-1.3333 1.1939-1.3333 2.6667 0 0.24504 0.01072 0.48294 0.04167 0.70833-0.15826-0.15989-0.30816-0.33156-0.5-0.47917-1.1673-0.89808-2.4885-1.1461-2.9375-0.5625-0.44904 0.58363 0.14525 1.7894 1.3125 2.6875 0.22148 0.1704 0.44175 0.29391 0.66667 0.41667-0.25479 0.03257-0.52266 0.08822-0.79167 0.16667-1.4139 0.41232-2.3937 1.3347-2.1875 2.0417 0.20616 0.70693 1.5236 0.93315 2.9375 0.52083 0.2651-0.07731 0.52042-0.1633 0.75-0.27083-0.05604 0.10202-0.11595 0.20204-0.16667 0.3125-2.7782 2.479-5.0625 7.229-5.0625 7.229l0.95833 0.02083c0.52039-1.2493 1.8073-3.9927 3.7917-6.2917-0.28085 1.1684-0.0992 2.2006 0.5 2.4167 0.69271 0.24982 1.667-0.67708 2.1667-2.0625 0.04494-0.12462 0.06976-0.25209 0.10417-0.375 0.05396 0.11891 0.10152 0.23517 0.16667 0.35417 0.70727 1.2918 1.8124 2.062 2.4583 1.7083 0.64591-0.35364 0.58227-1.6874-0.125-2.9792-0.04035-0.07369-0.08227-0.13821-0.125-0.20833 0.07835 0.02437 0.14794 0.04131 0.22917 0.0625 1.4251 0.37181 2.7308 0.10836 2.9167-0.60417 0.18591-0.71253-0.82495-1.5865-2.25-1.9583-0.02183-0.0057-0.04073-0.01544-0.0625-0.02083 0.01921-0.01078 0.04331-0.0098 0.0625-0.02083 1.2754-0.73638 2.014-1.8623 1.6458-2.5-0.36819-0.63772-1.7037-0.54888-2.9792 0.1875-0.40854 0.23587-0.74162 0.50638-1.0208 0.79167 0.10589-0.38234 0.16667-0.82364 0.16667-1.2917 0-1.4728-0.59695-2.6667-1.3333-2.6667zm0.042 4.458c0.92048 0 1.6667 0.74619 1.6667 1.6667 0 0.92048-0.74619 1.6667-1.6667 1.6667-0.92048 0-1.6667-0.74619-1.6667-1.6667 0-0.92048 0.74619-1.6667 1.6667-1.6667z"/>
+ <path opacity=".15" d="m2.6667 5.6667 0.0087 12c0.7672-0.012 26.076-4.424 26.658-4.636l-0.000092-7.3644z" fill-rule="evenodd" fill="url(#e)"/>
+ </g>
+</svg>
diff --git a/core/img/filetypes/text-html.png b/core/img/filetypes/text-html.png
index 55d1072eafd..dd17b750103 100644
--- a/core/img/filetypes/text-html.png
+++ b/core/img/filetypes/text-html.png
Binary files differ
diff --git a/core/img/filetypes/text-html.svg b/core/img/filetypes/text-html.svg
new file mode 100644
index 00000000000..c41964738d0
--- /dev/null
+++ b/core/img/filetypes/text-html.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32px" width="32px" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="g" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.56757 0 0 .72973 2.3784 -2.5135)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.65714 0 0 .63012 .22856 -1.0896)" y1=".98521" x1="25.132">
+ <stop stop-color="#f4f4f4" offset="0"/>
+ <stop stop-color="#dbdbdb" offset="1"/>
+ </linearGradient>
+ <linearGradient id="e" y2="2.9062" gradientUnits="userSpaceOnUse" x2="-51.786" gradientTransform="matrix(.53064 0 0 .58970 39.27 -1.7919)" y1="50.786" x1="-51.786">
+ <stop stop-color="#a0a0a0" offset="0"/>
+ <stop stop-color="#bebebe" offset="1"/>
+ </linearGradient>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.015663 0 0 .0082353 17.61 25.981)" r="117.14"/>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.015663 0 0 .0082353 14.39 25.981)" r="117.14"/>
+ <linearGradient id="d" y2="609.51" gradientUnits="userSpaceOnUse" y1="366.65" gradientTransform="matrix(.045769 0 0 .0082353 -.54232 25.981)" x2="302.86" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <g>
+ <rect opacity=".15" height="2" width="22.1" y="29" x="4.95" fill="url(#d)"/>
+ <path opacity=".15" d="m4.95 29v1.9999c-0.80662 0.0038-1.95-0.44807-1.95-1.0001 0-0.552 0.90012-0.99982 1.95-0.99982z" fill="url(#b)"/>
+ <path opacity=".15" d="m27.05 29v1.9999c0.80661 0.0038 1.95-0.44807 1.95-1.0001 0-0.552-0.90012-0.99982-1.95-0.99982z" fill="url(#c)"/>
+ </g>
+ <path stroke-linejoin="round" d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" stroke="url(#e)" stroke-width=".99992" fill="url(#f)"/>
+ </g>
+ <path stroke-linejoin="round" d="m26.5 28.5h-21v-27h21z" stroke="url(#g)" stroke-linecap="round" fill="none"/>
+ <g fill="#fff">
+ <rect opacity=".6" style="color:#000000" fill-rule="evenodd" transform="matrix(1 0 -.42525 .90508 0 0)" height="8.839" width="1.2412" y="14.363" x="23.867"/>
+ <path opacity=".6" d="m23.142 16.907-2.939-3.68 0.979-1.227 3.818 4.907-3.919 5.093-1.081-1.12 3.142-3.973z"/>
+ <path opacity=".6" d="m8.8581 16.907 2.9389-3.68-0.979-1.227-3.818 4.907 3.919 5.093 1.081-1.12-3.1419-3.973z"/>
+ </g>
+ <g>
+ <path opacity=".4" d="m8.8581 15.907 2.9389-3.68-0.979-1.227-3.818 4.907 3.919 5.093 1.081-1.12-3.1419-3.973z" fill="#666"/>
+ <rect opacity=".4" style="color:#000000" fill-rule="evenodd" transform="matrix(1 0 -.42525 .90508 0 0)" height="8.839" width="1.2412" y="13.259" x="23.397"/>
+ <path opacity=".4" d="m23.142 15.907-2.939-3.68 0.979-1.227 3.818 4.907-3.919 5.093-1.081-1.12 3.142-3.973z" fill="#666"/>
+ </g>
+</svg>
diff --git a/core/img/filetypes/text.png b/core/img/filetypes/text.png
index 813f712f726..6b069c82c11 100644
--- a/core/img/filetypes/text.png
+++ b/core/img/filetypes/text.png
Binary files differ
diff --git a/core/img/filetypes/text.svg b/core/img/filetypes/text.svg
new file mode 100644
index 00000000000..69a1bcd98c3
--- /dev/null
+++ b/core/img/filetypes/text.svg
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32px" width="32px" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <defs>
+ <linearGradient id="e" y2="3.3639" gradientUnits="userSpaceOnUse" x2="22.004" gradientTransform="matrix(.66858 0 0 .67037 -.67962 -2.3083)" y1="47.813" x1="22.004">
+ <stop stop-color="#aaa" offset="0"/>
+ <stop stop-color="#c8c8c8" offset="1"/>
+ </linearGradient>
+ <linearGradient id="g" y2="43" gradientUnits="userSpaceOnUse" x2="24" gradientTransform="matrix(.56757 0 0 .72973 2.3784 -2.5135)" y1="5.5641" x1="24">
+ <stop stop-color="#fff" offset="0"/>
+ <stop stop-color="#fff" stop-opacity=".23529" offset=".036262"/>
+ <stop stop-color="#fff" stop-opacity=".15686" offset=".95056"/>
+ <stop stop-color="#fff" stop-opacity=".39216" offset="1"/>
+ </linearGradient>
+ <linearGradient id="f" y2="47.013" gradientUnits="userSpaceOnUse" x2="25.132" gradientTransform="matrix(.65714 0 0 .63012 .22856 -1.0896)" y1=".98521" x1="25.132">
+ <stop stop-color="#f4f4f4" offset="0"/>
+ <stop stop-color="#dbdbdb" offset="1"/>
+ </linearGradient>
+ <radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(.015663 0 0 .0082353 17.61 25.981)" r="117.14"/>
+ <linearGradient id="a">
+ <stop offset="0"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ <radialGradient id="b" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="486.65" cx="605.71" gradientTransform="matrix(-.015663 0 0 .0082353 14.39 25.981)" r="117.14"/>
+ <linearGradient id="d" y2="609.51" gradientUnits="userSpaceOnUse" y1="366.65" gradientTransform="matrix(.045769 0 0 .0082353 -.54232 25.981)" x2="302.86" x1="302.86">
+ <stop stop-opacity="0" offset="0"/>
+ <stop offset=".5"/>
+ <stop stop-opacity="0" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g>
+ <g>
+ <rect opacity=".15" height="2" width="22.1" y="29" x="4.95" fill="url(#d)"/>
+ <path opacity=".15" d="m4.95 29v1.9999c-0.80662 0.0038-1.95-0.44807-1.95-1.0001 0-0.552 0.90012-0.99982 1.95-0.99982z" fill="url(#b)"/>
+ <path opacity=".15" d="m27.05 29v1.9999c0.80661 0.0038 1.95-0.44807 1.95-1.0001 0-0.552-0.90012-0.99982-1.95-0.99982z" fill="url(#c)"/>
+ </g>
+ <path d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" fill="url(#f)"/>
+ </g>
+ <g fill="none">
+ <path stroke-linejoin="round" d="m26.5 28.5h-21v-27h21z" stroke="url(#g)" stroke-linecap="round"/>
+ <path opacity=".3" stroke-linejoin="round" d="m4.5 0.49996c5.2705 0 23 0.00185 23 0.00185l0.000028 28.998h-23v-29z" stroke="#000" stroke-width=".99992"/>
+ <path d="m8 5.5677h1.567zm1.7968 0h1.4625zm1.6924 0h1.2954zm1.5043 0h0.56412zm0.79394 0h1.2536zm1.5043 0h3.3011zm3.5101 0h2.5281zm2.737 0h0.77305zm-13.539 1.9218h2.0684zm2.2774 0h3.3847zm3.5936 0h1.6506zm1.8595 0h1.5461zm1.755 0h1.3163zm1.5252 0 2.0684 0.020955zm2.2565 0.020955h3.3638zm-13.266 1.9895h2.8624zm3.0922 0h3.0922zm3.3011 0h1.2327zm1.4416 0h2.9042zm3.0922 0h1.9849zm2.2147 0h0.79394zm1.0029 0h0.43876zm0.66858 0h1.2327zm-14.813 2h1.0656zm1.3998 0h3.9488zm-1.3998 3h2.6325zm2.8415 0h2.8206zm3.0295 0h1.0864zm1.2954 0h2.6534zm2.8624 0h3.3429zm3.5727 0h1.2327zm-13.602 2h2.8624zm3.0922 0h3.0922zm3.3011 0h1.2327zm1.4416 0h2.9042zm3.0922 0h1.9849zm2.2147 0h0.79394zm1.0029 0h0.43876zm0.66858 0h1.2327zm-14.813 2h2.4445zm2.7161 0h1.17zm1.379 0h0.58501zm0.81484 0h1.0656zm1.2954 0h1.0864zm1.2954 0h1.7341zm1.964 0h2.2565zm2.4654 0h1.5043zm1.7132 0h0.37608zm-13.643 2.9895h2.0684zm2.2774 0h3.3847zm3.5936 0h1.6506zm1.8595 0h1.5461zm1.755 0h1.3163zm1.5252 0 2.0684 0.02095zm2.2565 0.02095h3.3638zm-13.266 1.989h2.5908zm2.8206 0h0.81484zm1.0238 0h1.8595zm2.0684 0h2.737zm2.9668 0h1.8595zm2.0475 0h0.39697zm0.6059 0h2.3609zm2.6117 0h1.2327zm-14.145 2h2.5908zm2.8206 0h1.17zm1.379 0h1.8386zm2.0475 0h1.9849zm2.2147 0h0.79394zm1.0029 0h0.43876zm0.66858 0h1.2327z" stroke="url(#e)" stroke-width="1px"/>
+ </g>
+</svg>
diff --git a/core/img/web.png b/core/img/web.png
new file mode 100644
index 00000000000..bdc2f4a84a5
--- /dev/null
+++ b/core/img/web.png
Binary files differ
diff --git a/core/img/web.svg b/core/img/web.svg
new file mode 100644
index 00000000000..bc6c6bde650
--- /dev/null
+++ b/core/img/web.svg
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ width="48"
+ height="48"
+ id="svg3759">
+ <metadata
+ id="metadata37">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs3761">
+ <radialGradient
+ cx="17.81411"
+ cy="24.149399"
+ r="9.125"
+ fx="17.81411"
+ fy="24.149399"
+ id="radialGradient2418"
+ xlink:href="#linearGradient4845"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.643979,0,2.93653e-8,2.534421,78.72514,-37.986139)" />
+ <linearGradient
+ id="linearGradient4845">
+ <stop
+ id="stop4847"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop4849"
+ style="stop-color:#b6b6b6;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="62.200409"
+ y1="-12.489107"
+ x2="62.200409"
+ y2="-1.4615115"
+ id="linearGradient3697"
+ xlink:href="#linearGradient4873"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.1153734,0,0,2.1153252,-107.57708,31.426557)" />
+ <linearGradient
+ id="linearGradient4873">
+ <stop
+ id="stop4875"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop4877"
+ style="stop-color:#ffffff;stop-opacity:0"
+ offset="1" />
+ </linearGradient>
+ <radialGradient
+ cx="61.240059"
+ cy="-8.7256308"
+ r="9.7552834"
+ fx="61.240059"
+ fy="-8.7256308"
+ id="radialGradient3705"
+ xlink:href="#linearGradient2867-449-88-871-390-598-476-591-434-148"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,3.5234091,-3.5234073,0,-6.7439676,-205.79862)" />
+ <linearGradient
+ id="linearGradient2867-449-88-871-390-598-476-591-434-148">
+ <stop
+ id="stop4627"
+ style="stop-color:#51cfee;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop4629"
+ style="stop-color:#49a3d2;stop-opacity:1"
+ offset="0.26238" />
+ <stop
+ id="stop4631"
+ style="stop-color:#3470b4;stop-opacity:1"
+ offset="0.704952" />
+ <stop
+ id="stop4633"
+ style="stop-color:#273567;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="20"
+ y1="43"
+ x2="20"
+ y2="2.6887112"
+ id="linearGradient3713"
+ xlink:href="#linearGradient3707-319-631"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.98001402,0,0,0.97999168,0.08994011,0.8703621)" />
+ <linearGradient
+ id="linearGradient3707-319-631">
+ <stop
+ id="stop4637"
+ style="stop-color:#254b6d;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop4639"
+ style="stop-color:#415b73;stop-opacity:1"
+ offset="0.5" />
+ <stop
+ id="stop4641"
+ style="stop-color:#6195b5;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient8838">
+ <stop
+ id="stop8840"
+ style="stop-color:#000000;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop8842"
+ style="stop-color:#000000;stop-opacity:0"
+ offset="1" />
+ </linearGradient>
+ <radialGradient
+ cx="62.625"
+ cy="4.625"
+ r="10.625"
+ fx="62.625"
+ fy="4.625"
+ id="radialGradient3757"
+ xlink:href="#linearGradient8838"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.341176,0,3.047059)" />
+ </defs>
+ <g
+ id="layer1">
+ <path
+ d="m 73.25,4.625 a 10.625,3.625 0 1 1 -21.25,0 10.625,3.625 0 1 1 21.25,0 z"
+ inkscape:connector-curvature="0"
+ transform="matrix(2.1647059,0,0,2.5636643,-111.56471,26.849769)"
+ id="path8836"
+ style="opacity:0.4;fill:url(#radialGradient3757);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999988;marker:none;visibility:visible;display:inline;overflow:visible" />
+ <path
+ d="M 43.500003,23.999309 C 43.500003,34.769208 34.768912,43.5 24.000248,43.5 13.230599,43.5 4.5000032,34.769109 4.5000032,23.999309 4.5000032,13.229904 13.230599,4.5 24.000248,4.5 c 10.768664,0 19.499755,8.729904 19.499755,19.499309 l 0,0 z"
+ inkscape:connector-curvature="0"
+ id="path6495"
+ style="fill:url(#radialGradient3705);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3713);stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ d="m 24.329633,5.218182 -2.362344,0.2704567 -2.59858,0.7099494 c 0.221353,-0.077615 0.445595,-0.1623374 0.674956,-0.2366499 L 19.739934,5.4210246 18.727501,5.5900601 18.221284,6.0633596 17.445085,6.1647809 16.736382,6.502852 16.398905,6.6718876 16.29766,6.807116 15.791444,6.9085373 15.487716,7.5508723 15.08274,6.7395017 l -0.134989,0.3380711 0.0675,0.9127919 -0.641208,0.5409137 -0.371225,0.9804061 0.7762,0 0.303728,-0.642335 0.101245,-0.2366498 c 0.341288,-0.241775 0.66483,-0.5110331 1.012433,-0.7437563 l 0.809946,0.2704568 c 0.527335,0.3588995 1.058376,0.7234732 1.586147,1.0818274 L 19.368709,8.5312784 18.491266,8.1594002 18.086294,7.3480297 16.601391,7.1789941 16.567641,7.0099586 17.208847,7.145187 17.580075,6.7733087 18.390021,6.6042734 C 18.581694,6.5108897 18.770243,6.44363 18.963732,6.3676236 l -0.506216,0.4732995 1.82238,1.250863 0,0.7437562 -0.708703,0.7099493 0.944937,1.8931994 0.641208,-0.371881 0.809948,-1.2508614 c 1.138725,-0.3526792 2.165016,-0.7630693 3.239789,-1.2508632 l -0.0675,0.4732995 0.539963,0.3718782 0.944939,-0.6423349 -0.47247,-0.5409137 -0.641209,0.3718781 -0.202486,-0.067613 c 0.04651,-0.02129 0.08828,-0.045973 0.13499,-0.067613 L 26.388247,6.0295525 24.329633,5.218182 z m -9.246893,3.6511675 0.776199,0.5409136 0.641209,0 0,-0.6423349 L 15.72395,8.429857 15.08274,8.8693495 z M 33.002811,8.429857 31.619153,8.7679282 30.741712,9.342649 l 0,0.5071058 -1.383659,0.8789842 0.269983,1.31848 0.809946,-0.574723 0.506216,0.574723 0.573714,0.338071 0.371224,-0.980408 -0.202486,-0.57472 0.202486,-0.405687 0.809948,-0.7437548 0.371225,0 -0.371225,0.8113728 0,0.743754 c 0.333836,-0.09103 0.6708,-0.126483 1.012433,-0.169037 l -0.944938,0.676145 -0.0675,0.405683 -1.079929,0.912794 -1.113678,-0.270459 0,-0.642335 -0.506216,0.338072 0.236235,0.574722 -0.809947,0 -0.438721,0.743756 -0.539965,0.608528 -0.978685,0.202842 0.573712,0.574721 0.134991,0.57472 -0.708703,0 -0.944938,0.507108 0,1.48751 0.438721,0 0.404973,0.439494 0.91119,-0.439494 0.337478,-0.912791 0.674956,-0.405685 0.134991,-0.338071 1.079928,-0.270457 0.60746,0.676142 0.641209,0.338071 -0.371227,0.743758 0.573715,-0.169037 0.303728,-0.743757 -0.74245,-0.845177 0.303729,0 0.742451,0.608528 0.134992,0.811371 0.641207,0.743757 0.168739,-1.081827 0.337478,-0.169037 c 0.359225,0.373574 0.642383,0.83043 0.944938,1.250864 l 1.113677,0.06762 0.641207,0.405686 -0.303729,0.439492 -0.641208,0.574721 -0.944939,0 -1.248667,-0.405684 -0.641208,0.06762 -0.472469,0.540915 -1.349912,-1.352286 -0.944937,-0.270456 -1.383659,0.169036 -1.21492,0.33807 c -0.693063,0.7871 -1.402636,1.582869 -2.058616,2.400307 l -0.776198,1.893195 0.371226,0.405687 -0.674956,0.980406 0.742451,1.724162 c 0.617799,0.700089 1.239228,1.395452 1.856128,2.09604 l 0.91119,-0.777564 0.371226,0.473301 0.978687,-0.642335 0.337477,0.371878 0.978685,0 0.573713,0.642335 -0.337478,1.149442 0.674955,0.777564 -0.03375,1.352283 0.506216,0.980406 -0.371225,0.845178 c -0.03619,0.60617 -0.0675,1.18551 -0.0675,1.791777 0.297757,0.821342 0.59628,1.640668 0.877443,2.467918 l 0.202487,1.318476 0,0.676143 0.539963,0 0.7762,-0.507106 0.944939,0 1.417406,-1.588934 -0.168739,-0.540915 0.944939,-0.845177 -0.708705,-0.777563 0.843694,-0.676141 0.809948,-0.507109 0.371225,-0.405685 -0.236234,-0.912791 c 0,-0.768475 2e-6,-1.530306 0,-2.298884 l 0.641209,-1.419897 0.809945,-0.878985 0.877443,-2.163655 0,-0.574721 c -0.436643,0.0551 -0.855168,0.10478 -1.282416,0.13523 l 0.877442,-0.878986 1.21492,-0.81137 0.641209,-0.743758 0,-0.811369 C 41.631793,22.01604 41.484928,21.720356 41.338501,21.44561 l -0.573712,0.676141 -0.438721,-0.507105 -0.641209,-0.507107 0,-1.048021 0.742452,0.845178 0.843696,-0.101421 c 0.380615,0.346139 0.746089,0.65392 1.079927,1.04802 l 0.539978,-0.608545 c 0,-0.655131 -0.736573,-3.889319 -2.328596,-6.626192 -1.592024,-2.735972 -4.387213,-5.240102 -4.387211,-5.240102 l -0.202488,0.3718783 -0.742451,0.8113707 -0.944937,-0.9804063 0.944937,0 L 35.668888,9.1059992 33.914003,8.7679282 33.002811,8.429857 z M 12.720395,8.8693495 12.382918,9.7483343 c 0,0 -0.590841,0.097717 -0.74245,0.1352286 -1.9362043,1.7873441 -5.8406714,5.6641681 -6.7495557,12.9481221 0.035987,0.168879 0.6412078,1.14944 0.6412078,1.14944 l 1.4849023,0.878986 1.4849024,0.405684 0.6412079,0.777564 0.9786853,0.743756 0.573712,-0.101421 0.404974,0.202844 0,0.135226 -0.539965,1.521321 -0.438721,0.642336 0.134991,0.304263 -0.3374777,1.217057 1.2486677,2.298882 1.282416,1.115635 0.573711,0.81137 -0.0675,1.690355 0.404974,0.946598 -0.404974,1.825586 c 0,0 -0.05404,-0.01501 0,0.169036 0.05452,0.184134 2.25593,1.422835 2.396091,1.318476 0.139681,-0.106305 0.269983,-0.202843 0.269983,-0.202843 l -0.13499,-0.405685 0.573712,-0.540913 0.202486,-0.574722 0.911191,-0.304265 0.708702,-1.757968 -0.202486,-0.4733 0.472468,-0.743756 1.07993,-0.236649 0.539965,-1.28467 -0.134992,-1.588935 0.843695,-1.183247 0.13499,-1.217056 c -1.15759,-0.575052 -2.293316,-1.165913 -3.442272,-1.75797 l -0.573713,-1.115634 -1.046181,-0.23665 -0.573712,-1.521321 -1.383659,0.169035 -1.214921,-0.878983 -1.282415,1.115634 0,0.169036 C 10.716387,26.202752 10.261353,26.186409 9.9193333,25.975746 l -0.2699819,-0.811371 0,-0.878985 -0.8774423,0.101421 c 0.070612,-0.559892 0.1651315,-1.13056 0.2362324,-1.690355 l -0.5062167,0 -0.5062167,0.642335 -0.4724689,0.23665 -0.7087034,-0.405685 -0.067496,-0.878985 0.1349912,-0.946599 1.0461812,-0.811371 0.8436945,0 0.1687389,-0.473299 1.0461817,0.236648 0.7761987,0.980407 0.134991,-1.622742 1.349911,-1.115633 0.472468,-1.183248 1.012435,-0.405685 0.539964,-0.811372 1.282416,-0.23665 0.641208,-0.946599 c -0.634667,0 -1.288957,0 -1.923624,0 l 1.214921,-0.574721 0.843693,0 1.07993,-0.371877 0.202487,1.04802 0.472469,-0.743757 -0.539966,-0.371878 0.134992,-0.439491 -0.438721,-0.405687 -0.47247,-0.135228 0.134992,-0.507106 -0.371226,-0.709948 -0.843695,0.33807 0.134992,-0.642334 -0.978686,-0.574722 -0.776198,1.352284 0.0675,0.4733 -0.776198,0.338071 -0.472469,1.04802 -0.236234,-0.980407 -1.316164,-0.540913 -0.236234,-0.743756 1.788632,-1.014213 0.776198,-0.743757 0.0675,-0.8789846 -0.438721,-0.2366498 -0.573713,-0.067613 z m 14.477799,1.6227435 0,0.54091 0.30373,0.338072 0,0.811371 -0.168739,1.081827 0.877442,-0.169036 0.641209,-0.642334 -0.573713,-0.540915 c -0.186049,-0.496308 -0.3746,-0.943871 -0.607459,-1.419895 l -0.47247,0 z m -0.742452,1.081824 -0.539963,0.169038 0.13499,0.980405 0.708703,-0.371881 -0.30373,-0.777562 z m 9.888101,8.89127 0.809946,0.946598 0.978686,2.096042 0.607459,0.67614 -0.303728,0.709952 0.539964,0.642335 c -0.247792,0.01643 -0.487764,0.03381 -0.742451,0.03381 -0.462673,-0.973935 -0.828843,-1.956133 -1.181173,-2.975025 l -0.60746,-0.676142 -0.337478,-1.217056 0.236235,-0.23665 z"
+ inkscape:connector-curvature="0"
+ id="path6534"
+ style="opacity:0.4;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 42.500001,23.999343 c 0,10.217597 -8.283342,18.500655 -18.499766,18.500655 -10.217359,0 -18.5002317,-8.283152 -18.5002317,-18.500655 0,-10.217125 8.2828727,-18.4993427 18.5002317,-18.4993427 10.216424,0 18.499766,8.2822177 18.499766,18.4993427 l 0,0 z"
+ inkscape:connector-curvature="0"
+ id="path8655"
+ style="opacity:0.4;fill:none;stroke:url(#linearGradient3697);stroke-width:1.0000006;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <g
+ transform="matrix(0.9999061,-0.01370139,0.01370139,0.9999061,-0.2886966,0.5358538)"
+ id="g2414">
+ <path
+ d="m 30.5,20.93716 17,16.500001 -7.75,0.25 c 0,0 3.25,6.75 3.25,6.75 1,3 -3.5,4.125 -4.25,1.875 0,0 -3,-6.75 -3,-6.75 l -5.5,5.875 0.25,-24.500001 z"
+ inkscape:connector-curvature="0"
+ id="path3970"
+ style="fill:url(#radialGradient2418);fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
+ <path
+ d="m 31.657235,23.378571 13.475546,13.185793 -6.921861,0.277459 c 0,0 3.872136,7.756567 3.872136,7.756567 0.402731,1.650134 -2.028275,2.412565 -2.5071,1.152867 0,0 -3.683065,-7.844955 -3.683065,-7.844955 l -4.424727,4.708334 0.189071,-19.236065 z"
+ inkscape:connector-curvature="0"
+ id="path4853"
+ style="opacity:0.4;fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+</svg>
diff --git a/core/routes.php b/core/routes.php
index be19b66bf72..75cc4d511c0 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -42,7 +42,12 @@ $this->create('js_config', '/core/js/config.js')
// Routing
$this->create('core_ajax_routes', '/core/routes.json')
->action('OC_Router', 'JSRoutes');
-
+$this->create('core_ajax_preview', '/core/preview.png')
+ ->actionInclude('core/ajax/preview.php');
+$this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png')
+ ->actionInclude('core/ajax/trashbinpreview.php');
+$this->create('core_ajax_public_preview', '/core/publicpreview.png')
+ ->actionInclude('core/ajax/publicpreview.php');
OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php';
$this->create('core_lostpassword_index', '/lostpassword/')
->get()
diff --git a/lib/base.php b/lib/base.php
index eaee8424651..b51becc4d93 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -487,6 +487,7 @@ class OC {
self::registerCacheHooks();
self::registerFilesystemHooks();
+ self::registerPreviewHooks();
self::registerShareHooks();
//make sure temporary files are cleaned up
@@ -559,6 +560,14 @@ class OC {
}
/**
+ * register hooks for previews
+ */
+ public static function registerPreviewHooks() {
+ OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write');
+ OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete');
+ }
+
+ /**
* register hooks for sharing
*/
public static function registerShareHooks() {
diff --git a/lib/helper.php b/lib/helper.php
index ca508e1d933..b74e4c4512e 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -223,6 +223,21 @@ class OC_Helper {
}
/**
+ * @brief get path to preview of file
+ * @param string $path path
+ * @return string the url
+ *
+ * Returns the path to the preview of the file.
+ */
+ public static function previewIcon($path) {
+ return self::linkToRoute( 'core_ajax_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) ));
+ }
+
+ public static function publicPreviewIcon( $path, $token ) {
+ return self::linkToRoute( 'core_ajax_public_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path), 't' => $token));
+ }
+
+ /**
* @brief Make a human file size
* @param int $bytes file size in bytes
* @return string a human readable file size
diff --git a/lib/preview.php b/lib/preview.php
new file mode 100755
index 00000000000..9f4d20b4650
--- /dev/null
+++ b/lib/preview.php
@@ -0,0 +1,621 @@
+<?php
+/**
+ * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ *
+ * Thumbnails:
+ * structure of filename:
+ * /data/user/thumbnails/pathhash/x-y.png
+ *
+ */
+namespace OC;
+
+require_once('preview/images.php');
+require_once('preview/movies.php');
+require_once('preview/mp3.php');
+require_once('preview/pdf.php');
+require_once('preview/svg.php');
+require_once('preview/txt.php');
+require_once('preview/unknown.php');
+require_once('preview/office.php');
+
+class Preview {
+ //the thumbnail folder
+ const THUMBNAILS_FOLDER = 'thumbnails';
+
+ //config
+ private $maxScaleFactor;
+ private $configMaxX;
+ private $configMaxY;
+
+ //fileview object
+ private $fileview = null;
+ private $userview = null;
+
+ //vars
+ private $file;
+ private $maxX;
+ private $maxY;
+ private $scalingup;
+
+ //preview images object
+ private $preview;
+
+ //preview providers
+ static private $providers = array();
+ static private $registeredProviders = array();
+
+ /**
+ * @brief check if thumbnail or bigger version of thumbnail of file is cached
+ * @param string $user userid - if no user is given, OC_User::getUser will be used
+ * @param string $root path of root
+ * @param string $file The path to the file where you want a thumbnail from
+ * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
+ * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
+ * @param bool $scalingUp Disable/Enable upscaling of previews
+ * @return mixed (bool / string)
+ * false if thumbnail does not exist
+ * path to thumbnail if thumbnail exists
+ */
+ public function __construct($user='', $root='/', $file='', $maxX=1, $maxY=1, $scalingUp=true) {
+ //set config
+ $this->configMaxX = \OC_Config::getValue('preview_max_x', null);
+ $this->configMaxY = \OC_Config::getValue('preview_max_y', null);
+ $this->maxScaleFactor = \OC_Config::getValue('preview_max_scale_factor', 2);
+
+ //save parameters
+ $this->setFile($file);
+ $this->setMaxX($maxX);
+ $this->setMaxY($maxY);
+ $this->setScalingUp($scalingUp);
+
+ //init fileviews
+ if($user === ''){
+ $user = \OC_User::getUser();
+ }
+ $this->fileview = new \OC\Files\View('/' . $user . '/' . $root);
+ $this->userview = new \OC\Files\View('/' . $user);
+
+ $this->preview = null;
+
+ //check if there are preview backends
+ if(empty(self::$providers)) {
+ self::initProviders();
+ }
+
+ if(empty(self::$providers)) {
+ \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR);
+ throw new \Exception('No preview providers');
+ }
+ }
+
+ /**
+ * @brief returns the path of the file you want a thumbnail from
+ * @return string
+ */
+ public function getFile() {
+ return $this->file;
+ }
+
+ /**
+ * @brief returns the max width of the preview
+ * @return integer
+ */
+ public function getMaxX() {
+ return $this->maxX;
+ }
+
+ /**
+ * @brief returns the max height of the preview
+ * @return integer
+ */
+ public function getMaxY() {
+ return $this->maxY;
+ }
+
+ /**
+ * @brief returns whether or not scalingup is enabled
+ * @return bool
+ */
+ public function getScalingUp() {
+ return $this->scalingup;
+ }
+
+ /**
+ * @brief returns the name of the thumbnailfolder
+ * @return string
+ */
+ public function getThumbnailsFolder() {
+ return self::THUMBNAILS_FOLDER;
+ }
+
+ /**
+ * @brief returns the max scale factor
+ * @return integer
+ */
+ public function getMaxScaleFactor() {
+ return $this->maxScaleFactor;
+ }
+
+ /**
+ * @brief returns the max width set in ownCloud's config
+ * @return integer
+ */
+ public function getConfigMaxX() {
+ return $this->configMaxX;
+ }
+
+ /**
+ * @brief returns the max height set in ownCloud's config
+ * @return integer
+ */
+ public function getConfigMaxY() {
+ return $this->configMaxY;
+ }
+
+ /**
+ * @brief set the path of the file you want a thumbnail from
+ * @param string $file
+ * @return $this
+ */
+ public function setFile($file) {
+ $this->file = $file;
+ return $this;
+ }
+
+ /**
+ * @brief set the the max width of the preview
+ * @param int $maxX
+ * @return $this
+ */
+ public function setMaxX($maxX=1) {
+ if($maxX <= 0) {
+ throw new \Exception('Cannot set width of 0 or smaller!');
+ }
+ $configMaxX = $this->getConfigMaxX();
+ if(!is_null($configMaxX)) {
+ if($maxX > $configMaxX) {
+ \OC_Log::write('core', 'maxX reduced from ' . $maxX . ' to ' . $configMaxX, \OC_Log::DEBUG);
+ $maxX = $configMaxX;
+ }
+ }
+ $this->maxX = $maxX;
+ return $this;
+ }
+
+ /**
+ * @brief set the the max height of the preview
+ * @param int $maxY
+ * @return $this
+ */
+ public function setMaxY($maxY=1) {
+ if($maxY <= 0) {
+ throw new \Exception('Cannot set height of 0 or smaller!');
+ }
+ $configMaxY = $this->getConfigMaxY();
+ if(!is_null($configMaxY)) {
+ if($maxY > $configMaxY) {
+ \OC_Log::write('core', 'maxX reduced from ' . $maxY . ' to ' . $configMaxY, \OC_Log::DEBUG);
+ $maxY = $configMaxY;
+ }
+ }
+ $this->maxY = $maxY;
+ return $this;
+ }
+
+ /**
+ * @brief set whether or not scalingup is enabled
+ * @param bool $scalingUp
+ * @return $this
+ */
+ public function setScalingup($scalingUp) {
+ if($this->getMaxScaleFactor() === 1) {
+ $scalingUp = false;
+ }
+ $this->scalingup = $scalingUp;
+ return $this;
+ }
+
+ /**
+ * @brief check if all parameters are valid
+ * @return bool
+ */
+ public function isFileValid() {
+ $file = $this->getFile();
+ if($file === '') {
+ \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR);
+ return false;
+ }
+
+ if(!$this->fileview->file_exists($file)) {
+ \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @brief deletes previews of a file with specific x and y
+ * @return bool
+ */
+ public function deletePreview() {
+ $file = $this->getFile();
+
+ $fileInfo = $this->fileview->getFileInfo($file);
+ $fileId = $fileInfo['fileid'];
+
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png';
+ $this->userview->unlink($previewPath);
+ return !$this->userview->file_exists($previewPath);
+ }
+
+ /**
+ * @brief deletes all previews of a file
+ * @return bool
+ */
+ public function deleteAllPreviews() {
+ $file = $this->getFile();
+
+ $fileInfo = $this->fileview->getFileInfo($file);
+ $fileId = $fileInfo['fileid'];
+
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
+ $this->userview->deleteAll($previewPath);
+ $this->userview->rmdir($previewPath);
+ return !$this->userview->is_dir($previewPath);
+ }
+
+ /**
+ * @brief check if thumbnail or bigger version of thumbnail of file is cached
+ * @return mixed (bool / string)
+ * false if thumbnail does not exist
+ * path to thumbnail if thumbnail exists
+ */
+ private function isCached() {
+ $file = $this->getFile();
+ $maxX = $this->getMaxX();
+ $maxY = $this->getMaxY();
+ $scalingUp = $this->getScalingUp();
+ $maxscalefactor = $this->getMaxScaleFactor();
+
+ $fileInfo = $this->fileview->getFileInfo($file);
+ $fileId = $fileInfo['fileid'];
+
+ if(is_null($fileId)) {
+ return false;
+ }
+
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
+ if(!$this->userview->is_dir($previewPath)) {
+ return false;
+ }
+
+ //does a preview with the wanted height and width already exist?
+ if($this->userview->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) {
+ return $previewPath . $maxX . '-' . $maxY . '.png';
+ }
+
+ $wantedAspectRatio = (float) ($maxX / $maxY);
+
+ //array for usable cached thumbnails
+ $possibleThumbnails = array();
+
+ $allThumbnails = $this->userview->getDirectoryContent($previewPath);
+ foreach($allThumbnails as $thumbnail) {
+ $name = rtrim($thumbnail['name'], '.png');
+ $size = explode('-', $name);
+ $x = (int) $size[0];
+ $y = (int) $size[1];
+
+ $aspectRatio = (float) ($x / $y);
+ if($aspectRatio !== $wantedAspectRatio) {
+ continue;
+ }
+
+ if($x < $maxX || $y < $maxY) {
+ if($scalingUp) {
+ $scalefactor = $maxX / $x;
+ if($scalefactor > $maxscalefactor) {
+ continue;
+ }
+ }else{
+ continue;
+ }
+ }
+ $possibleThumbnails[$x] = $thumbnail['path'];
+ }
+
+ if(count($possibleThumbnails) === 0) {
+ return false;
+ }
+
+ if(count($possibleThumbnails) === 1) {
+ return current($possibleThumbnails);
+ }
+
+ ksort($possibleThumbnails);
+
+ if(key(reset($possibleThumbnails)) > $maxX) {
+ return current(reset($possibleThumbnails));
+ }
+
+ if(key(end($possibleThumbnails)) < $maxX) {
+ return current(end($possibleThumbnails));
+ }
+
+ foreach($possibleThumbnails as $width => $path) {
+ if($width < $maxX) {
+ continue;
+ }else{
+ return $path;
+ }
+ }
+ }
+
+ /**
+ * @brief return a preview of a file
+ * @return \OC_Image
+ */
+ public function getPreview() {
+ if(!is_null($this->preview) && $this->preview->valid()){
+ return $this->preview;
+ }
+
+ $this->preview = null;
+ $file = $this->getFile();
+ $maxX = $this->getMaxX();
+ $maxY = $this->getMaxY();
+ $scalingUp = $this->getScalingUp();
+
+ $fileInfo = $this->fileview->getFileInfo($file);
+ $fileId = $fileInfo['fileid'];
+
+ $cached = $this->isCached();
+
+ if($cached) {
+ $image = new \OC_Image($this->userview->file_get_contents($cached, 'r'));
+ $this->preview = $image->valid() ? $image : null;
+ $this->resizeAndCrop();
+ }
+
+ if(is_null($this->preview)) {
+ $mimetype = $this->fileview->getMimeType($file);
+ $preview = null;
+
+ foreach(self::$providers as $supportedMimetype => $provider) {
+ if(!preg_match($supportedMimetype, $mimetype)) {
+ continue;
+ }
+
+ $preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingUp, $this->fileview);
+
+ if(!($preview instanceof \OC_Image)) {
+ continue;
+ }
+
+ $this->preview = $preview;
+ $this->resizeAndCrop();
+
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
+ $cachePath = $previewPath . $maxX . '-' . $maxY . '.png';
+
+ if($this->userview->is_dir($this->getThumbnailsFolder() . '/') === false) {
+ $this->userview->mkdir($this->getThumbnailsFolder() . '/');
+ }
+
+ if($this->userview->is_dir($previewPath) === false) {
+ $this->userview->mkdir($previewPath);
+ }
+
+ $this->userview->file_put_contents($cachePath, $preview->data());
+
+ break;
+ }
+ }
+
+ if(is_null($this->preview)) {
+ $this->preview = new \OC_Image();
+ }
+
+ return $this->preview;
+ }
+
+ /**
+ * @brief show preview
+ * @return void
+ */
+ public function showPreview() {
+ \OCP\Response::enableCaching(3600 * 24); // 24 hours
+ if(is_null($this->preview)) {
+ $this->getPreview();
+ }
+ $this->preview->show();
+ return;
+ }
+
+ /**
+ * @brief show preview
+ * @return void
+ */
+ public function show() {
+ return $this->showPreview();
+ }
+
+ /**
+ * @brief resize, crop and fix orientation
+ * @return void
+ */
+ private function resizeAndCrop() {
+ $image = $this->preview;
+ $x = $this->getMaxX();
+ $y = $this->getMaxY();
+ $scalingUp = $this->getScalingUp();
+ $maxscalefactor = $this->getMaxScaleFactor();
+
+ if(!($image instanceof \OC_Image)) {
+ \OC_Log::write('core', '$this->preview is not an instance of OC_Image', \OC_Log::DEBUG);
+ return;
+ }
+
+ $image->fixOrientation();
+
+ $realx = (int) $image->width();
+ $realy = (int) $image->height();
+
+ if($x === $realx && $y === $realy) {
+ $this->preview = $image;
+ return true;
+ }
+
+ $factorX = $x / $realx;
+ $factorY = $y / $realy;
+
+ if($factorX >= $factorY) {
+ $factor = $factorX;
+ }else{
+ $factor = $factorY;
+ }
+
+ if($scalingUp === false) {
+ if($factor > 1) {
+ $factor = 1;
+ }
+ }
+
+ if(!is_null($maxscalefactor)) {
+ if($factor > $maxscalefactor) {
+ \OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $maxscalefactor, \OC_Log::DEBUG);
+ $factor = $maxscalefactor;
+ }
+ }
+
+ $newXsize = (int) ($realx * $factor);
+ $newYsize = (int) ($realy * $factor);
+
+ $image->preciseResize($newXsize, $newYsize);
+
+ if($newXsize === $x && $newYsize === $y) {
+ $this->preview = $image;
+ return;
+ }
+
+ if($newXsize >= $x && $newYsize >= $y) {
+ $cropX = floor(abs($x - $newXsize) * 0.5);
+ //don't crop previews on the Y axis, this sucks if it's a document.
+ //$cropY = floor(abs($y - $newYsize) * 0.5);
+ $cropY = 0;
+
+ $image->crop($cropX, $cropY, $x, $y);
+
+ $this->preview = $image;
+ return;
+ }
+
+ if($newXsize < $x || $newYsize < $y) {
+ if($newXsize > $x) {
+ $cropX = floor(($newXsize - $x) * 0.5);
+ $image->crop($cropX, 0, $x, $newYsize);
+ }
+
+ if($newYsize > $y) {
+ $cropY = floor(($newYsize - $y) * 0.5);
+ $image->crop(0, $cropY, $newXsize, $y);
+ }
+
+ $newXsize = (int) $image->width();
+ $newYsize = (int) $image->height();
+
+ //create transparent background layer
+ $backgroundlayer = imagecreatetruecolor($x, $y);
+ $white = imagecolorallocate($backgroundlayer, 255, 255, 255);
+ imagefill($backgroundlayer, 0, 0, $white);
+
+ $image = $image->resource();
+
+ $mergeX = floor(abs($x - $newXsize) * 0.5);
+ $mergeY = floor(abs($y - $newYsize) * 0.5);
+
+ imagecopy($backgroundlayer, $image, $mergeX, $mergeY, 0, 0, $newXsize, $newYsize);
+
+ //$black = imagecolorallocate(0,0,0);
+ //imagecolortransparent($transparentlayer, $black);
+
+ $image = new \OC_Image($backgroundlayer);
+
+ $this->preview = $image;
+ return;
+ }
+ }
+
+ /**
+ * @brief register a new preview provider to be used
+ * @param string $provider class name of a Preview_Provider
+ * @param array $options
+ * @return void
+ */
+ public static function registerProvider($class, $options=array()) {
+ self::$registeredProviders[]=array('class'=>$class, 'options'=>$options);
+ }
+
+ /**
+ * @brief create instances of all the registered preview providers
+ * @return void
+ */
+ private static function initProviders() {
+ if(count(self::$providers)>0) {
+ return;
+ }
+
+ foreach(self::$registeredProviders as $provider) {
+ $class=$provider['class'];
+ $options=$provider['options'];
+
+ $object = new $class($options);
+
+ self::$providers[$object->getMimeType()] = $object;
+ }
+
+ $keys = array_map('strlen', array_keys(self::$providers));
+ array_multisort($keys, SORT_DESC, self::$providers);
+ }
+
+ public static function post_write($args) {
+ self::post_delete($args);
+ }
+
+ public static function post_delete($args) {
+ $path = $args['path'];
+ if(substr($path, 0, 1) === '/') {
+ $path = substr($path, 1);
+ }
+ $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true);
+ $preview->deleteAllPreviews();
+ }
+
+ public static function isMimeSupported($mimetype) {
+ //check if there are preview backends
+ if(empty(self::$providers)) {
+ self::initProviders();
+ }
+
+ //remove last element because it has the mimetype *
+ $providers = array_slice(self::$providers, 0, -1);
+ foreach($providers as $supportedMimetype => $provider) {
+ if(preg_match($supportedMimetype, $mimetype)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static function showErrorPreview() {
+ $path = \OC::$SERVERROOT . '/core/img/actions/delete.png';
+ $preview = new \OC_Image($path);
+ $preview->preciseResize(36, 36);
+ $preview->show();
+ }
+} \ No newline at end of file
diff --git a/lib/preview/images.php b/lib/preview/images.php
new file mode 100644
index 00000000000..9aec967282d
--- /dev/null
+++ b/lib/preview/images.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+class Image extends Provider {
+
+ public function getMimeType() {
+ return '/image\/.*/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ //get fileinfo
+ $fileInfo = $fileview->getFileInfo($path);
+ if(!$fileInfo) {
+ return false;
+ }
+
+ //check if file is encrypted
+ if($fileInfo['encrypted'] === true) {
+ $image = new \OC_Image(stream_get_contents($fileview->fopen($path, 'r')));
+ }else{
+ $image = new \OC_Image();
+ $image->loadFromFile($fileview->getLocalFile($path));
+ }
+
+ return $image->valid() ? $image : false;
+ }
+}
+
+\OC\Preview::registerProvider('OC\Preview\Image'); \ No newline at end of file
diff --git a/lib/preview/libreoffice-cl.php b/lib/preview/libreoffice-cl.php
new file mode 100644
index 00000000000..2f1d08499ef
--- /dev/null
+++ b/lib/preview/libreoffice-cl.php
@@ -0,0 +1,131 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+//we need imagick to convert
+class Office extends Provider {
+
+ private $cmd;
+
+ public function getMimeType() {
+ return null;
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $this->initCmd();
+ if(is_null($this->cmd)) {
+ return false;
+ }
+
+ $absPath = $fileview->toTmpFile($path);
+
+ $tmpDir = get_temp_dir();
+
+ $exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
+ $export = 'export HOME=/' . $tmpDir;
+
+ shell_exec($export . "\n" . $exec);
+
+ //create imagick object from pdf
+ try{
+ $pdf = new \imagick($absPath . '.pdf' . '[0]');
+ $pdf->setImageFormat('jpg');
+ } catch (\Exception $e) {
+ unlink($absPath);
+ unlink($absPath . '.pdf');
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
+ }
+
+ $image = new \OC_Image($pdf);
+
+ unlink($absPath);
+ unlink($absPath . '.pdf');
+
+ return $image->valid() ? $image : false;
+ }
+
+ private function initCmd() {
+ $cmd = '';
+
+ if(is_string(\OC_Config::getValue('preview_libreoffice_path', null))) {
+ $cmd = \OC_Config::getValue('preview_libreoffice_path', null);
+ }
+
+ $whichLibreOffice = shell_exec('which libreoffice');
+ if($cmd === '' && !empty($whichLibreOffice)) {
+ $cmd = 'libreoffice';
+ }
+
+ $whichOpenOffice = shell_exec('which openoffice');
+ if($cmd === '' && !empty($whichOpenOffice)) {
+ $cmd = 'openoffice';
+ }
+
+ if($cmd === '') {
+ $cmd = null;
+ }
+
+ $this->cmd = $cmd;
+ }
+}
+
+//.doc, .dot
+class MSOfficeDoc extends Office {
+
+ public function getMimeType() {
+ return '/application\/msword/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\MSOfficeDoc');
+
+//.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m)
+class MSOffice2003 extends Office {
+
+ public function getMimeType() {
+ return '/application\/vnd.ms-.*/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\MSOffice2003');
+
+//.docx, .dotx, .xlsx, .xltx, .pptx, .potx, .ppsx
+class MSOffice2007 extends Office {
+
+ public function getMimeType() {
+ return '/application\/vnd.openxmlformats-officedocument.*/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\MSOffice2007');
+
+//.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt
+class OpenDocument extends Office {
+
+ public function getMimeType() {
+ return '/application\/vnd.oasis.opendocument.*/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\OpenDocument');
+
+//.sxw, .stw, .sxc, .stc, .sxd, .std, .sxi, .sti, .sxg, .sxm
+class StarOffice extends Office {
+
+ public function getMimeType() {
+ return '/application\/vnd.sun.xml.*/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\StarOffice'); \ No newline at end of file
diff --git a/lib/preview/movies.php b/lib/preview/movies.php
new file mode 100644
index 00000000000..e2a1b8edddc
--- /dev/null
+++ b/lib/preview/movies.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+$isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions')));
+$whichFFMPEG = shell_exec('which ffmpeg');
+$isFFMPEGAvailable = !empty($whichFFMPEG);
+
+if($isShellExecEnabled && $isFFMPEGAvailable) {
+
+ class Movie extends Provider {
+
+ public function getMimeType() {
+ return '/video\/.*/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $absPath = \OC_Helper::tmpFile();
+ $tmpPath = \OC_Helper::tmpFile();
+
+ $handle = $fileview->fopen($path, 'rb');
+
+ $firstmb = stream_get_contents($handle, 1048576); //1024 * 1024 = 1048576
+ file_put_contents($absPath, $firstmb);
+
+ //$cmd = 'ffmpeg -y -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmpPath;
+ $cmd = 'ffmpeg -an -y -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 -ss 1 ' . escapeshellarg($tmpPath);
+
+ shell_exec($cmd);
+
+ $image = new \OC_Image($tmpPath);
+
+ unlink($absPath);
+ unlink($tmpPath);
+
+ return $image->valid() ? $image : false;
+ }
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\Movie');
+} \ No newline at end of file
diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php
new file mode 100644
index 00000000000..1eed566315c
--- /dev/null
+++ b/lib/preview/mp3.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+class MP3 extends Provider {
+
+ public function getMimeType() {
+ return '/audio\/mpeg/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ require_once('getid3/getid3.php');
+
+ $getID3 = new \getID3();
+
+ $tmpPath = $fileview->toTmpFile($path);
+
+ $tags = $getID3->analyze($tmpPath);
+ \getid3_lib::CopyTagsToComments($tags);
+ if(isset($tags['id3v2']['APIC'][0]['data'])) {
+ $picture = @$tags['id3v2']['APIC'][0]['data'];
+ unlink($tmpPath);
+ $image = new \OC_Image($picture);
+ return $image->valid() ? $image : $this->getNoCoverThumbnail();
+ }
+
+ return $this->getNoCoverThumbnail();
+ }
+
+ private function getNoCoverThumbnail() {
+ $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.png';
+
+ if(!file_exists($icon)) {
+ return false;
+ }
+
+ $image = new \OC_Image($icon);
+ return $image->valid() ? $image : false;
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\MP3'); \ No newline at end of file
diff --git a/lib/preview/msoffice.php b/lib/preview/msoffice.php
new file mode 100644
index 00000000000..e69ab0ab8cb
--- /dev/null
+++ b/lib/preview/msoffice.php
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+/* //There is no (good) php-only solution for converting 2003 word documents to pdfs / pngs ...
+class DOC extends Provider {
+
+ public function getMimeType() {
+ return '/application\/msword/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ require_once('');
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\DOC');
+*/
+
+class DOCX extends Provider {
+
+ public function getMimeType() {
+ return '/application\/vnd.openxmlformats-officedocument.wordprocessingml.document/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ require_once('phpdocx/classes/TransformDoc.inc');
+
+ $tmpDoc = $fileview->toTmpFile($path);
+
+ $transformdoc = new \TransformDoc();
+ $transformdoc->setStrFile($tmpDoc);
+ $transformdoc->generatePDF($tmpDoc);
+
+ $pdf = new \imagick($tmpDoc . '[0]');
+ $pdf->setImageFormat('jpg');
+
+ unlink($tmpDoc);
+
+ $image = new \OC_Image($pdf);
+
+ return $image->valid() ? $image : false;
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\DOCX');
+
+class MSOfficeExcel extends Provider {
+
+ public function getMimeType() {
+ return null;
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ require_once('PHPExcel/Classes/PHPExcel.php');
+ require_once('PHPExcel/Classes/PHPExcel/IOFactory.php');
+
+ $absPath = $fileview->toTmpFile($path);
+ $tmpPath = \OC_Helper::tmpFile();
+
+ $rendererName = \PHPExcel_Settings::PDF_RENDERER_DOMPDF;
+ $rendererLibraryPath = \OC::$THIRDPARTYROOT . '/3rdparty/dompdf';
+
+ \PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath);
+
+ $phpexcel = new \PHPExcel($absPath);
+ $excel = \PHPExcel_IOFactory::createWriter($phpexcel, 'PDF');
+ $excel->save($tmpPath);
+
+ $pdf = new \imagick($tmpPath . '[0]');
+ $pdf->setImageFormat('jpg');
+
+ unlink($absPath);
+ unlink($tmpPath);
+
+ $image = new \OC_Image($pdf);
+
+ return $image->valid() ? $image : false;
+ }
+
+}
+
+class XLS extends MSOfficeExcel {
+
+ public function getMimeType() {
+ return '/application\/vnd.ms-excel/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\XLS');
+
+class XLSX extends MSOfficeExcel {
+
+ public function getMimeType() {
+ return '/application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\XLSX');
+
+/* //There is no (good) php-only solution for converting powerpoint documents to pdfs / pngs ...
+class MSOfficePowerPoint extends Provider {
+
+ public function getMimeType() {
+ return null;
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ return false;
+ }
+
+}
+
+class PPT extends MSOfficePowerPoint {
+
+ public function getMimeType() {
+ return '/application\/vnd.ms-powerpoint/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\PPT');
+
+class PPTX extends MSOfficePowerPoint {
+
+ public function getMimeType() {
+ return '/application\/vnd.openxmlformats-officedocument.presentationml.presentation/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\PPTX');
+*/ \ No newline at end of file
diff --git a/lib/preview/office.php b/lib/preview/office.php
new file mode 100644
index 00000000000..b93e1e57c8b
--- /dev/null
+++ b/lib/preview/office.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+//both, libreoffice backend and php fallback, need imagick
+if (extension_loaded('imagick')) {
+ $isShellExecEnabled = !in_array('shell_exec', explode(', ', ini_get('disable_functions')));
+ $whichLibreOffice = shell_exec('which libreoffice');
+ $isLibreOfficeAvailable = !empty($whichLibreOffice);
+ $whichOpenOffice = shell_exec('which libreoffice');
+ $isOpenOfficeAvailable = !empty($whichOpenOffice);
+ //let's see if there is libreoffice or openoffice on this machine
+ if($isShellExecEnabled && ($isLibreOfficeAvailable || $isOpenOfficeAvailable || is_string(\OC_Config::getValue('preview_libreoffice_path', null)))) {
+ require_once('libreoffice-cl.php');
+ }else{
+ //in case there isn't, use our fallback
+ require_once('msoffice.php');
+ }
+} \ No newline at end of file
diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php
new file mode 100644
index 00000000000..cc974b68818
--- /dev/null
+++ b/lib/preview/pdf.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+if (extension_loaded('imagick')) {
+
+ class PDF extends Provider {
+
+ public function getMimeType() {
+ return '/application\/pdf/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $tmpPath = $fileview->toTmpFile($path);
+
+ //create imagick object from pdf
+ try{
+ $pdf = new \imagick($tmpPath . '[0]');
+ $pdf->setImageFormat('jpg');
+ } catch (\Exception $e) {
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
+ }
+
+ unlink($tmpPath);
+
+ //new image object
+ $image = new \OC_Image($pdf);
+ //check if image object is valid
+ return $image->valid() ? $image : false;
+ }
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\PDF');
+}
diff --git a/lib/preview/provider.php b/lib/preview/provider.php
new file mode 100644
index 00000000000..e4a730bafc8
--- /dev/null
+++ b/lib/preview/provider.php
@@ -0,0 +1,19 @@
+<?php
+namespace OC\Preview;
+
+abstract class Provider {
+ private $options;
+
+ public function __construct($options) {
+ $this->options=$options;
+ }
+
+ abstract public function getMimeType();
+
+ /**
+ * search for $query
+ * @param string $query
+ * @return
+ */
+ abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview);
+}
diff --git a/lib/preview/svg.php b/lib/preview/svg.php
new file mode 100644
index 00000000000..e939e526b1b
--- /dev/null
+++ b/lib/preview/svg.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+if (extension_loaded('imagick')) {
+
+ class SVG extends Provider {
+
+ public function getMimeType() {
+ return '/image\/svg\+xml/';
+ }
+
+ public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) {
+ try{
+ $svg = new \Imagick();
+ $svg->setResolution($maxX, $maxY);
+
+ $content = stream_get_contents($fileview->fopen($path, 'r'));
+ if(substr($content, 0, 5) !== '<?xml') {
+ $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content;
+ }
+
+ $svg->readImageBlob($content);
+ $svg->setImageFormat('jpg');
+ } catch (\Exception $e) {
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
+ }
+
+ //new image object
+ $image = new \OC_Image($svg);
+ //check if image object is valid
+ return $image->valid() ? $image : false;
+ }
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\SVG');
+
+} \ No newline at end of file
diff --git a/lib/preview/txt.php b/lib/preview/txt.php
new file mode 100644
index 00000000000..89927fd580a
--- /dev/null
+++ b/lib/preview/txt.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+class TXT extends Provider {
+
+ public function getMimeType() {
+ return '/text\/.*/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $content = $fileview->fopen($path, 'r');
+ $content = stream_get_contents($content);
+
+ $lines = preg_split("/\r\n|\n|\r/", $content);
+
+ $fontSize = 5; //5px
+ $lineSize = ceil($fontSize * 1.25);
+
+ $image = imagecreate($maxX, $maxY);
+ imagecolorallocate($image, 255, 255, 255);
+ $textColor = imagecolorallocate($image, 0, 0, 0);
+
+ foreach($lines as $index => $line) {
+ $index = $index + 1;
+
+ $x = (int) 1;
+ $y = (int) ($index * $lineSize) - $fontSize;
+
+ imagestring($image, 1, $x, $y, $line, $textColor);
+
+ if(($index * $lineSize) >= $maxY) {
+ break;
+ }
+ }
+
+ $image = new \OC_Image($image);
+
+ return $image->valid() ? $image : false;
+ }
+}
+
+\OC\Preview::registerProvider('OC\Preview\TXT');
+
+class PHP extends TXT {
+
+ public function getMimeType() {
+ return '/application\/x-php/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\PHP');
+
+class JavaScript extends TXT {
+
+ public function getMimeType() {
+ return '/application\/javascript/';
+ }
+
+}
+
+\OC\Preview::registerProvider('OC\Preview\JavaScript'); \ No newline at end of file
diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php
new file mode 100644
index 00000000000..ba13ca35d66
--- /dev/null
+++ b/lib/preview/unknown.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+class Unknown extends Provider {
+
+ public function getMimeType() {
+ return '/.*/';
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $mimetype = $fileview->getMimeType($path);
+ if(substr_count($mimetype, '/')) {
+ list($type, $subtype) = explode('/', $mimetype);
+ }
+
+ $iconsRoot = \OC::$SERVERROOT . '/core/img/filetypes/';
+
+ if(isset($type)){
+ $icons = array($mimetype, $type, 'text');
+ }else{
+ $icons = array($mimetype, 'text');
+ }
+ foreach($icons as $icon) {
+ $icon = str_replace('/', '-', $icon);
+
+ $iconPath = $iconsRoot . $icon . '.png';
+
+ if(file_exists($iconPath)) {
+ return new \OC_Image($iconPath);
+ }
+ }
+ return false;
+ }
+}
+
+\OC\Preview::registerProvider('OC\Preview\Unknown'); \ No newline at end of file
diff --git a/lib/public/preview.php b/lib/public/preview.php
new file mode 100644
index 00000000000..e488eade4da
--- /dev/null
+++ b/lib/public/preview.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OCP;
+
+/**
+ * This class provides functions to render and show thumbnails and previews of files
+ */
+class Preview {
+
+ /**
+ * @brief return a preview of a file
+ * @param $file The path to the file where you want a thumbnail from
+ * @param $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
+ * @param $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
+ * @param $scaleup Scale smaller images up to the thumbnail size or not. Might look ugly
+ * @return image
+ */
+ public static function show($file,$maxX=100,$maxY=75,$scaleup=false) {
+ return(\OC_Preview::show($file,$maxX,$maxY,$scaleup));
+ }
+
+
+
+ public static function isMimeSupported($mimetype='*') {
+ return \OC\Preview::isMimeSupported($mimetype);
+ }
+
+}
diff --git a/lib/public/template.php b/lib/public/template.php
index ab1089c332d..3b1a4ed4906 100644
--- a/lib/public/template.php
+++ b/lib/public/template.php
@@ -54,6 +54,25 @@ function mimetype_icon( $mimetype ) {
return(\mimetype_icon( $mimetype ));
}
+/**
+ * @brief make preview_icon available as a simple function
+ * Returns the path to the preview of the image.
+ * @param $path path of file
+ * @returns link to the preview
+ */
+function preview_icon( $path ) {
+ return(\preview_icon( $path ));
+}
+
+/**
+ * @brief make publicpreview_icon available as a simple function
+ * Returns the path to the preview of the image.
+ * @param $path path of file
+ * @returns link to the preview
+ */
+function publicPreview_icon ( $path, $token ) {
+ return(\publicPreview_icon( $path, $token ));
+}
/**
* @brief make OC_Helper::humanFileSize available as a simple function
diff --git a/lib/template/functions.php b/lib/template/functions.php
index 2d43cae1c0c..a892e310362 100644
--- a/lib/template/functions.php
+++ b/lib/template/functions.php
@@ -59,6 +59,22 @@ function mimetype_icon( $mimetype ) {
}
/**
+ * @brief make preview_icon available as a simple function
+ * Returns the path to the preview of the image.
+ * @param $path path of file
+ * @returns link to the preview
+ *
+ * For further information have a look at OC_Helper::previewIcon
+ */
+function preview_icon( $path ) {
+ return OC_Helper::previewIcon( $path );
+}
+
+function publicPreview_icon ( $path, $token ) {
+ return OC_Helper::publicPreviewIcon( $path, $token );
+}
+
+/**
* @brief make OC_Helper::humanFileSize available as a simple function
* @param int $bytes size in bytes
* @return string size as string
diff --git a/tests/lib/preview.php b/tests/lib/preview.php
new file mode 100644
index 00000000000..bebdc12b500
--- /dev/null
+++ b/tests/lib/preview.php
@@ -0,0 +1,108 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke <georg@ownCloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test;
+
+class Preview extends \PHPUnit_Framework_TestCase {
+
+ public function testIsPreviewDeleted() {
+ $user = $this->initFS();
+
+ $rootView = new \OC\Files\View('');
+ $rootView->mkdir('/'.$user);
+ $rootView->mkdir('/'.$user.'/files');
+
+ $samplefile = '/'.$user.'/files/test.txt';
+
+ $rootView->file_put_contents($samplefile, 'dummy file data');
+
+ $x = 50;
+ $y = 50;
+
+ $preview = new \OC\Preview($user, 'files/', 'test.txt', $x, $y);
+ $preview->getPreview();
+
+ $fileinfo = $rootView->getFileInfo($samplefile);
+ $fileid = $fileinfo['fileid'];
+
+ $thumbcachefile = '/' . $user . '/' . \OC\Preview::THUMBNAILS_FOLDER . '/' . $fileid . '/' . $x . '-' . $y . '.png';
+
+ $this->assertEquals($rootView->file_exists($thumbcachefile), true);
+
+ $preview->deletePreview();
+
+ $this->assertEquals($rootView->file_exists($thumbcachefile), false);
+ }
+
+ public function testAreAllPreviewsDeleted() {
+ $user = $this->initFS();
+
+ $rootView = new \OC\Files\View('');
+ $rootView->mkdir('/'.$user);
+ $rootView->mkdir('/'.$user.'/files');
+
+ $samplefile = '/'.$user.'/files/test.txt';
+
+ $rootView->file_put_contents($samplefile, 'dummy file data');
+
+ $x = 50;
+ $y = 50;
+
+ $preview = new \OC\Preview($user, 'files/', 'test.txt', $x, $y);
+ $preview->getPreview();
+
+ $fileinfo = $rootView->getFileInfo($samplefile);
+ $fileid = $fileinfo['fileid'];
+
+ $thumbcachefolder = '/' . $user . '/' . \OC\Preview::THUMBNAILS_FOLDER . '/' . $fileid . '/';
+
+ $this->assertEquals($rootView->is_dir($thumbcachefolder), true);
+
+ $preview->deleteAllPreviews();
+
+ $this->assertEquals($rootView->is_dir($thumbcachefolder), false);
+ }
+
+ public function testIsMaxSizeWorking() {
+ $user = $this->initFS();
+
+ $maxX = 250;
+ $maxY = 250;
+
+ \OC_Config::setValue('preview_max_x', $maxX);
+ \OC_Config::setValue('preview_max_y', $maxY);
+
+ $rootView = new \OC\Files\View('');
+ $rootView->mkdir('/'.$user);
+ $rootView->mkdir('/'.$user.'/files');
+
+ $samplefile = '/'.$user.'/files/test.txt';
+
+ $rootView->file_put_contents($samplefile, 'dummy file data');
+
+ $preview = new \OC\Preview($user, 'files/', 'test.txt', 1000, 1000);
+ $image = $preview->getPreview();
+
+ $this->assertEquals($image->width(), $maxX);
+ $this->assertEquals($image->height(), $maxY);
+ }
+
+ private function initFS() {
+ if(\OC\Files\Filesystem::getView()){
+ $user = \OC_User::getUser();
+ }else{
+ $user=uniqid();
+ \OC_User::setUserId($user);
+ \OC\Files\Filesystem::init($user, '/'.$user.'/files');
+ }
+
+ \OC\Files\Filesystem::mount('OC\Files\Storage\Temporary', array(), '/');
+
+ return $user;
+ }
+} \ No newline at end of file