aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-09-10 19:02:00 -0700
committerfriendica <info@friendica.com>2014-09-10 19:02:00 -0700
commitde89bdc45f4a940e58694537ebb82a234f0f59d9 (patch)
treed2879160f61a52d0aa162c517e47cb77f9f94246 /include/bb2diaspora.php
parent6ab21b3d4f3b3cde6e967257490781815dbec103 (diff)
downloadvolse-hubzilla-de89bdc45f4a940e58694537ebb82a234f0f59d9.tar.gz
volse-hubzilla-de89bdc45f4a940e58694537ebb82a234f0f59d9.tar.bz2
volse-hubzilla-de89bdc45f4a940e58694537ebb82a234f0f59d9.zip
encrypt diaspora_meta since it may contain private message contents
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index d3be22225..0389cf902 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -263,10 +263,19 @@ function bb2dmention_callback($match) {
function bb2diaspora_itembody($item) {
if($item['diaspora_meta']) {
- $j = json_decode($item['diaspora_meta'],true);
- if($j && $j['body']) {
- logger('bb2diaspora_itembody: cached ');
- return $j['body'];
+ $diaspora_meta = json_decode($item['diaspora_meta'],true);
+ if($diaspora_meta) {
+ if(array_key_exists('iv',$diaspora_meta)) {
+ $key = get_config('system','prvkey');
+ $meta = json_decode(crypto_unencapsulate($diaspora_meta,$key),true);
+ }
+ else {
+ $meta = $diaspora_meta;
+ }
+ if($meta) {
+ logger('bb2diaspora_itembody: cached ');
+ return $meta['body'];
+ }
}
}