From e35c55dd3bd5de9cd39abaeb2d7d0867f681886d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 1 Sep 2014 14:00:21 +0200 Subject: [PATCH] Remote-self: It is now possible to chose between two different modes of mirroring. --- include/items.php | 39 ++++++++++++++++++++++++++++++-------- mod/crepair.php | 2 +- view/templates/crepair.tpl | 2 +- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/include/items.php b/include/items.php index c3deed35df..0df200aebc 100644 --- a/include/items.php +++ b/include/items.php @@ -2565,10 +2565,21 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) if($contact['remote_self']) { $datarray['wall'] = 1; - // Test - $datarray['author-name'] = $datarray['owner-name']; - $datarray['author-link'] = $datarray['owner-link']; - $datarray['author-avatar'] = $datarray['owner-avatar']; + if ($contact['remote_self'] == 2) { + $r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`", intval($importer['uid'])); + if (count($r)) { + $datarray['contact-id'] = $r[0]["id"]; + $datarray['network'] = $r[0]["network"]; + + $datarray['owner-name'] = $r[0]["name"]; + $datarray['owner-link'] = $r[0]["url"]; + $datarray['owner-avatar'] = $r[0]["photo"]; + + $datarray['author-name'] = $datarray['owner-name']; + $datarray['author-link'] = $datarray['owner-link']; + $datarray['author-avatar'] = $datarray['owner-avatar']; + } + } $notify = true; if($contact['network'] === NETWORK_FEED) { @@ -3670,10 +3681,22 @@ function local_delivery($importer,$data) { if($importer['remote_self']) { $datarray['wall'] = 1; - // Test - $datarray['author-name'] = $datarray['owner-name']; - $datarray['author-link'] = $datarray['owner-link']; - $datarray['author-avatar'] = $datarray['owner-avatar']; + if ($importer['remote_self'] == 2) { + $r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`", + intval($importer['importer_uid'])); + if (count($r)) { + $datarray['contact-id'] = $r[0]["id"]; + $datarray['network'] = $r[0]["network"]; + + $datarray['owner-name'] = $r[0]["name"]; + $datarray['owner-link'] = $r[0]["url"]; + $datarray['owner-avatar'] = $r[0]["photo"]; + + $datarray['author-name'] = $datarray['owner-name']; + $datarray['author-link'] = $datarray['owner-link']; + $datarray['author-avatar'] = $datarray['owner-avatar']; + } + } $notify = true; } else diff --git a/mod/crepair.php b/mod/crepair.php index ef5f361305..0706a102d4 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -158,7 +158,7 @@ function crepair_content(&$a) { '$label_photo' => t('New photo from this URL'), '$label_remote_self' => t('Remote Self'), '$allow_remote_self' => get_config('system','allow_users_remote_self'), - '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.')), + '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), array('0'=>t('No mirroring'), '1'=>t('Mirror as forwarded posting'), '2'=>t('Mirror as my own posting'))), '$contact_name' => $contact['name'], '$contact_nick' => $contact['nick'], '$contact_id' => $contact['id'], diff --git a/view/templates/crepair.tpl b/view/templates/crepair.tpl index d53af5dad7..37e2ef417b 100644 --- a/view/templates/crepair.tpl +++ b/view/templates/crepair.tpl @@ -39,7 +39,7 @@
{{if $allow_remote_self eq 1}}

{{$label_remote_self}}

-{{include file="field_checkbox.tpl" field=$remote_self}} +{{include file="field_select.tpl" field=$remote_self}} {{/if}}