aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-04-18 21:18:49 -0700
committerzotlabs <mike@macgirvin.com>2017-04-18 21:18:49 -0700
commit397fef519c7929c70636c50015f7a0389062bab5 (patch)
tree367d423542595fb831f3e06318a1a628871bea4d /include/text.php
parent53bd0146bb9a924a103646db0b628ede28d294a1 (diff)
downloadvolse-hubzilla-397fef519c7929c70636c50015f7a0389062bab5.tar.gz
volse-hubzilla-397fef519c7929c70636c50015f7a0389062bab5.tar.bz2
volse-hubzilla-397fef519c7929c70636c50015f7a0389062bab5.zip
give the item_obscured flag a new lease on life by using it to designate third party client-side e2ee or binary content which can only be downloaded and not viewed directly on the web (as a side effect this also allows binary files to be submitted as activities/content). The content display is suppressed and replaced with a download button. This is unfinished but harmless to backport while work is in progress unless told otherwise. Future development will take care of the remaining loose ends.
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php
index bbf0b5b98..d276595ae 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1570,7 +1570,12 @@ function prepare_body(&$item,$attach = false) {
}
}
- $s .= prepare_text($item['body'],$item['mimetype'], false);
+ if($item['item_obscured']) {
+ $s .= prepare_binary($item);
+ }
+ else {
+ $s .= prepare_text($item['body'],$item['mimetype'], false);
+ }
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event_obj($item['obj']) : false);
@@ -1633,6 +1638,17 @@ function prepare_body(&$item,$attach = false) {
return $prep_arr;
}
+
+function prepare_binary($item) {
+ return replace_macros(get_markup_template('item_binary.tpl'), [
+ '$download' => t('Download binary/encrypted content'),
+ '$url' => z_root() . '/viewsrc/' . $item['id'] . '/download'
+ ]);
+}
+
+
+
+
/**
* @brief Given a text string, convert from bbcode to html and add smilie icons.
*