aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-11-19 20:12:55 +0100
committerMario Vavti <mario@mariovavti.com>2017-11-19 20:12:55 +0100
commit0aa01740d16a148e7b92734b0f15881781367625 (patch)
treebaba1b033312306f7e28303e0a6134713ab5829b
parent1c75e71eb3f634dd3cbd24d58f0cf3a483954fd9 (diff)
parent60fcb5f4f2729e6e164abcb515540cc752881b9b (diff)
downloadvolse-hubzilla-0aa01740d16a148e7b92734b0f15881781367625.tar.gz
volse-hubzilla-0aa01740d16a148e7b92734b0f15881781367625.tar.bz2
volse-hubzilla-0aa01740d16a148e7b92734b0f15881781367625.zip
Merge remote-tracking branch 'mike/master' into dev
-rw-r--r--Zotlabs/Storage/Browser.php13
-rw-r--r--doc/hooklist.bb3
-rw-r--r--include/socgraph.php2
3 files changed, 15 insertions, 3 deletions
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index ee5a9fef4..17b07ad82 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -200,9 +200,13 @@ class Browser extends DAV\Browser\Plugin {
// generate preview icons for tile view.
// Currently we only handle images, but this could potentially be extended with plugins
- // to provide document and video thumbnails
+ // to provide document and video thumbnails. SVG, PDF and office documents have some
+ // security concerns and should only be allowed on single-user sites with tightly controlled
+ // upload access. system.thumbnail_security should be set to 1 if you want to include these
+ // types
$photo_icon = '';
+ $preview_style = intval(get_config('system','thumbnail_security',0));
if(strpos($type,'image/') === 0 && $attachHash) {
$r = q("select resource_id, imgscale from photo where resource_id = '%s' and imgscale in ( %d, %d ) order by imgscale asc limit 1",
@@ -213,12 +217,17 @@ class Browser extends DAV\Browser\Plugin {
if($r) {
$photo_icon = 'photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
}
- if($type === 'image/svg+xml') {
+ if($type === 'image/svg+xml' && $preview_style > 0) {
$photo_icon = $fullPath;
}
}
+ $g = [ 'resource_id' => $attachHash, 'thumbnail' => $photo_icon, 'security' => $preview_style ];
+ call_hooks('file_thumbnail', $g);
+ $photo_icon = $g['photo_icon'];
+
+
$attachIcon = ""; // "<a href=\"attach/".$attachHash."\" title=\"".$displayName."\"><i class=\"fa fa-arrow-circle-o-down\"></i></a>";
// put the array for this file together
diff --git a/doc/hooklist.bb b/doc/hooklist.bb
index 1192a1506..5b34ef0ca 100644
--- a/doc/hooklist.bb
+++ b/doc/hooklist.bb
@@ -229,6 +229,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/feature_settings_post]feature_settings_post[/zrl]
called from settings page when posting from 'addon/feature settings'
+[zrl=[baseurl]/help/hook/file_thumbnail]file_thumbnail[/zrl]
+ called when generating thumbnail images for cloud page in 'view tiles' mode
+
[zrl=[baseurl]/help/hook/follow]follow[/zrl]
called when a follow operation takes place
diff --git a/include/socgraph.php b/include/socgraph.php
index a5b5d1378..3c7a893c6 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -385,7 +385,7 @@ function poco($a,$extended = false) {
$sql_extra = " and abook_self = 0 ";
if($cid)
- $sql_extra = sprintf(" and abook_id = %d and abook_hidden = 0 ",intval($cid));
+ $sql_extra = sprintf(" and abook_id = %d and abook_hidden = 0 and abook_pending = 0 ",intval($cid));
if($system_mode) {
$r = q("SELECT count(*) as total from abook where abook_self = 1