diff options
author | friendica <info@friendica.com> | 2014-09-10 22:21:19 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-09-10 22:21:19 -0700 |
commit | f1539a65e5b157595704bd90194cd1d18d333ff2 (patch) | |
tree | 3a3db33714599513ac77a7a835d4c3768ce86674 | |
parent | 6991a3ac0132ca3e63cdb9345ec3b9f5cbc4abf0 (diff) | |
download | volse-hubzilla-f1539a65e5b157595704bd90194cd1d18d333ff2.tar.gz volse-hubzilla-f1539a65e5b157595704bd90194cd1d18d333ff2.tar.bz2 volse-hubzilla-f1539a65e5b157595704bd90194cd1d18d333ff2.zip |
possible solution to diaspora walltowall mistaken attribution
-rw-r--r-- | include/bb2diaspora.php | 27 | ||||
-rwxr-xr-x | include/diaspora.php | 4 |
2 files changed, 22 insertions, 9 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 0389cf902..46dc4982a 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -259,6 +259,18 @@ function bb2dmention_callback($match) { } +function bb2diaspora_itemwallwall(&$item) { + + if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author']))) { + logger('bb2diaspora_itemwallwall: wall to wall post',LOGGER_DEBUG); + // post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author. + $item['body'] = "\n\n" + . '[img]' . $item['author']['photo']['src'] . '[/img]' + . '[url=' . $item['author']['url'] . ']' . $item['author']['name'] . '[/url]' . "\n\n" + . $item['body']; + } +} + function bb2diaspora_itembody($item) { @@ -274,20 +286,25 @@ function bb2diaspora_itembody($item) { } if($meta) { logger('bb2diaspora_itembody: cached '); - return $meta['body']; + $newitem = $item; + $newitem['body'] = $meta['body']; + bb2diaspora_itemwallwall($newitem); + return $newitem['body']; } } } - $body = $item['body']; + $newitem = $item; if(array_key_exists('item_flags',$item) && ($item['item_flags'] & ITEM_OBSCURED)) { $key = get_config('system','prvkey'); - $title = (($item['title']) ? crypto_unencapsulate(json_decode($item['title'],true),$key) : ''); - $body = (($item['body']) ? crypto_unencapsulate(json_decode($item['body'],true),$key) : ''); + $newitem['title'] = (($item['title']) ? crypto_unencapsulate(json_decode($item['title'],true),$key) : ''); + $newitem['body'] = (($item['body']) ? crypto_unencapsulate(json_decode($item['body'],true),$key) : ''); } - $body = preg_replace('/\#\^http/i', 'http', $body); + bb2diaspora_itemwallwall($newitem); + + $body = preg_replace('/\#\^http/i', 'http', $newitem['body']); // protect tags and mentions from hijacking diff --git a/include/diaspora.php b/include/diaspora.php index cc224d258..fe0ecad17 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -160,8 +160,6 @@ function diaspora_process_outbound($arr) { $target_item['body'] = crypto_unencapsulate(json_decode($target_item['body'],true),$key); } - if($arr['walltowall']) - return; if($arr['env_recips']) { $hashes = array(); @@ -761,8 +759,6 @@ function diaspora_post($importer,$xml,$msg) { $app = notags(xmlify($xml->provider_display_name)); - - if($diaspora_handle != $msg['author']) { logger('diaspora_post: Potential forgery. Message handle is not the same as envelope sender.'); return 202; |