aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-10-02 02:43:07 -0700
committerfriendica <info@friendica.com>2014-10-02 02:43:07 -0700
commit16b94f1dc0ae8ae812e6e584f76bfb7643f9aa20 (patch)
treeafd673f8854b3aad116d1891f7788862c419bd39 /include/items.php
parentbaa0b0f3939c262a1d9722a2e103c35954a5e8b5 (diff)
downloadvolse-hubzilla-16b94f1dc0ae8ae812e6e584f76bfb7643f9aa20.tar.gz
volse-hubzilla-16b94f1dc0ae8ae812e6e584f76bfb7643f9aa20.tar.bz2
volse-hubzilla-16b94f1dc0ae8ae812e6e584f76bfb7643f9aa20.zip
issues with diaspora comment signatures on relayed comments that are relayed through a redmatrix site (parent post is redmatrix) and involve a private post.
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php
index ac960258c..730d81268 100755
--- a/include/items.php
+++ b/include/items.php
@@ -759,6 +759,8 @@ function get_item_elements($x) {
$arr = array();
$arr['body'] = (($x['body']) ? htmlspecialchars($x['body'],ENT_COMPAT,'UTF-8',false) : '');
+ $key = get_config('system','pubkey');
+
$maxlen = get_max_import_size();
if($maxlen && mb_strlen($arr['body']) > $maxlen) {
@@ -813,7 +815,7 @@ function get_item_elements($x) {
$arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : '');
- $arr['diaspora_meta'] = (($x['diaspora_meta']) ? $x['diaspora_meta'] : '');
+ $arr['diaspora_meta'] = (($x['diaspora_signature']) ? json_encode(crypto_encapsulate($x['diaspora_signature'],$key)) : '');
$arr['object'] = activity_sanitise($x['object']);
$arr['target'] = activity_sanitise($x['target']);
@@ -865,7 +867,6 @@ function get_item_elements($x) {
// We have to do that here because we need to cleanse the input and prevent bad stuff from getting in,
// and we need plaintext to do that.
- $key = get_config('system','pubkey');
if(intval($arr['item_private'])) {
@@ -891,7 +892,6 @@ function get_item_elements($x) {
$arr['resource_type'] = $x['resource_type'];
$arr['item_restrict'] = $x['item_restrict'];
$arr['item_flags'] = $x['item_flags'];
- $arr['diaspora_meta'] = (($x['diaspora_meta']) ? json_encode(crypto_encapsulate($x['diaspora_meta'],$key)) : '');
$arr['attach'] = $x['attach'];
}
@@ -1078,7 +1078,6 @@ function encode_item($item,$mirror = false) {
$x['resource_type'] = $item['resource_type'];
$x['item_restrict'] = $item['item_restrict'];
$x['item_flags'] = $item['item_flags'];
- $x['diaspora_meta'] = crypto_unencapsulate(json_decode($item['diaspora_meta'],true),$key);
$x['attach'] = $item['attach'];
}
@@ -1127,6 +1126,9 @@ function encode_item($item,$mirror = false) {
if($item['term'])
$x['tags'] = encode_item_terms($item['term']);
+ if($item['diaspora_meta'])
+ $x['diaspora_signature'] = crypto_unencapsulate(json_decode($item['diaspora_meta'],true),$key);
+
logger('encode_item: ' . print_r($x,true), LOGGER_DATA);
return $x;