diff options
author | friendica <info@friendica.com> | 2014-10-24 04:17:48 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-10-24 04:17:48 -0700 |
commit | 1845ddc4c3d3f729dde3905f0f87741ac3d3bf66 (patch) | |
tree | 5d5df484c9a1859952741f7cb54aba7ea046a8ca | |
parent | 1d8aa7d817242114001a9d1cc011f4fe38c21d57 (diff) | |
download | volse-hubzilla-1845ddc4c3d3f729dde3905f0f87741ac3d3bf66.tar.gz volse-hubzilla-1845ddc4c3d3f729dde3905f0f87741ac3d3bf66.tar.bz2 volse-hubzilla-1845ddc4c3d3f729dde3905f0f87741ac3d3bf66.zip |
don't decrypt the message body more than once.
-rw-r--r-- | include/bb2diaspora.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 4f37e5aa8..d094e33c2 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -340,8 +340,13 @@ function bb2diaspora_itembody($item,$force_update = false) { if(array_key_exists('item_flags',$item) && ($item['item_flags'] & ITEM_OBSCURED)) { $key = get_config('system','prvkey'); - $newitem['title'] = (($item['title']) ? crypto_unencapsulate(json_decode($item['title'],true),$key) : ''); - $newitem['body'] = (($item['body']) ? crypto_unencapsulate(json_decode($item['body'],true),$key) : ''); + $b = json_decode($item['title'],true); + // if called from diaspora_process_outbound, this decoding has already been done. + // Everything else that calls us will not yet be decoded. + if($b && is_array($b) && array_key_exists('iv',$b)) { + $newitem['title'] = (($item['title']) ? crypto_unencapsulate(json_decode($item['title'],true),$key) : ''); + $newitem['body'] = (($item['body']) ? crypto_unencapsulate(json_decode($item['body'],true),$key) : ''); + } } bb2diaspora_itemwallwall($newitem); |