Remote-self: It is now possible to chose between two different modes of mirroring.

This commit is contained in:
Michael Vogel 2014-09-01 14:00:21 +02:00
parent 522b9edffe
commit e35c55dd3b
3 changed files with 33 additions and 10 deletions

View File

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

View File

@ -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'],

View File

@ -39,7 +39,7 @@
<div class="clear"></div>
{{if $allow_remote_self eq 1}}
<h4>{{$label_remote_self}}</h4>
{{include file="field_checkbox.tpl" field=$remote_self}}
{{include file="field_select.tpl" field=$remote_self}}
{{/if}}
<input type="submit" name="submit" value="{{$lbl_submit}}" />