From 6806888fa41a88df698d834e6edafde383ef03ad Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Oct 2014 03:36:50 -0700 Subject: return of the missing diaspora wall-to-wall attribution --- include/bb2diaspora.php | 12 ++++++++++++ include/items.php | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 65f4311a0..a80b3343b 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -263,8 +263,15 @@ function bb2dmention_callback($match) { function bb2diaspora_itemwallwall(&$item) { + $author_exists = true; if(! array_key_exists('author',$item)) { + $author_exists = false; logger('bb2diaspora_itemwallwall: no author'); + $r = q("select * from xchan where xchan_hash = '%s' limit 1", + dbesc($item['author_xchan']) + ); + if($r) + $item['author'] = $r[0]; } if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author']))) { @@ -279,6 +286,11 @@ function bb2diaspora_itemwallwall(&$item) { . '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]' . "\n\n" . $item['body']; } + // $item['author'] might cause a surprise further down the line if it wasn't expected to be here. + + if(! $author_exists) + $unset($item['author']); + } diff --git a/include/items.php b/include/items.php index c9810bb7c..a930a7c3e 100755 --- a/include/items.php +++ b/include/items.php @@ -2522,12 +2522,6 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id) // since Diaspora doesn't handle edits we can only do this for the original text and not update it. - $enabled = intval(get_config('system','diaspora_enabled')); - if(! $enabled) { - logger('mod_item: diaspora support disabled, not storing comment signature', LOGGER_DEBUG); - return; - } - require_once('include/bb2diaspora.php'); $signed_body = bb2diaspora_itembody($datarray); @@ -2552,12 +2546,6 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id) intval($post_id) ); - $r = q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", - intval($post_id), - dbesc($signed_text), - dbesc(base64_encode($authorsig)), - dbesc($diaspora_handle) - ); if(! $r) logger('store_diaspora_comment_sig: DB write failed'); -- cgit v1.2.3