possible solution to diaspora walltowall mistaken attribution

This commit is contained in:
friendica 2014-09-10 22:21:19 -07:00
parent 6991a3ac01
commit f1539a65e5
2 changed files with 22 additions and 9 deletions

View File

@ -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

View File

@ -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;