aboutsummaryrefslogtreecommitdiffstats
path: root/include
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
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')
-rwxr-xr-xinclude/diaspora.php3
-rw-r--r--include/identity.php11
-rwxr-xr-xinclude/items.php10
3 files changed, 20 insertions, 4 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index f9fd3b4ee..d91480c8f 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -2604,6 +2604,9 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$parentauthorsig = base64_encode(rsa_sign($sender_signed_text,$owner['channel_prvkey'],'sha256'));
+ if(! $text)
+ logger('diaspora_send_relay: no text');
+
$msg = replace_macros($tpl,array(
'$guid' => xmlify($item['mid']),
'$parent_guid' => xmlify($parent['mid']),
diff --git a/include/identity.php b/include/identity.php
index 6b1286ff7..ebe4c5d50 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -537,6 +537,17 @@ function identity_basic_export($channel_id, $items = false) {
$ret['photo'] = array('type' => $r[0]['type'], 'data' => base64url_encode($r[0]['data']));
}
+
+ // All other term types will be included in items, if requested.
+
+ $r = q("select * from term where type in (%d,%d) and uid = %d",
+ intval(TERM_SAVEDSEARCH),
+ intval(TERM_THING),
+ intval($channel_id)
+ );
+ if($r)
+ $ret['term'] = $r;
+
$r = q("select * from obj where obj_channel = %d",
intval($channel_id)
);
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;