diff --git a/include/diaspora.php b/include/diaspora.php
index ebd1906f3..1e101b4a7 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -153,9 +153,9 @@ function diaspora_process_outbound($arr) {
if($arr['walltowall'])
return;
- if($arr['recipients']) {
+ if($arr['env_recips']) {
$r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_url = '%s'
- and xchan_hash in (" . implode(',',$arr['recipients']) . ")
+ and xchan_hash in (" . implode(',',$arr['env_recips']) . ")
and xchan_network in ('diaspora', 'friendica-over-diaspora') ",
dbesc($arr['hub']['hubloc_url'])
);
@@ -228,13 +228,13 @@ function diaspora_process_outbound($arr) {
diaspora_send_retraction($arr['target_item'],$arr['channel'],$contact,true);
return;
}
- elseif($arr['target_item']['mid'] !== $mid['target_item']['parent_mid']) {
+ elseif($arr['target_item']['mid'] !== $arr['target_item']['parent_mid']) {
// we are the relay - send comments, likes and relayable_retractions to our conversants
logger('delivery: diaspora relay: ' . $loc);
diaspora_send_relay($arr['target_item'],$arr['channel'],$contact,true);
return;
}
- elseif(($arr['top_level_post']) && (! $arr['walltowall'])) {
+ elseif($arr['top_level_post']) {
// currently no workable solution for sending walltowall
logger('delivery: diaspora status: ' . $loc);
diaspora_send_status($arr['target_item'],$arr['channel'],$contact,true);
@@ -2241,12 +2241,38 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
}
*/
- //if(strlen($title))
- // $body = "[b]".html_entity_decode($title)."[/b]\n\n".$body;
+
+ $body = str_ireplace("[quote", "\n\n[quote", $body);
+ $body = str_ireplace("[/quote]", "[/quote]\n\n", $body);
+
+ // strip bookmark indicators
+
+ $body = preg_replace('/\#\^\[([zu])rl/i', '[$1rl', $body);
+ $body = preg_replace('/\#\^http/i', 'http', $body);
+
+ // protect tags and mentions from hijacking
+
+ if(! intval(get_pconfig($owner['channel_id'],'system','allow_tag_hijacking'))) {
+ $new_tag = html_entity_decode('⋕',ENT_COMPAT,'UTF-8');
+ $new_mention = html_entity_decode('@',ENT_COMPAT,'UTF-8');
+
+ // #-tags
+ $body = preg_replace('/\#\[url/i', $new_tag . '[url', $body);
+ $body = preg_replace('/\#\[zrl/i', $new_tag . '[zrl', $body);
+ // @-mentions
+ $body = preg_replace('/\@\[url/i', $new_mention . '[url', $body);
+ $body = preg_replace('/\@\[zrl/i', $new_mention . '[zrl', $body);
+ }
+
+ // remove multiple newlines
+ do {
+ $oldbody = $body;
+ $body = str_replace("\n\n\n", "\n\n", $body);
+ } while ($oldbody != $body);
+
// convert to markdown
$body = xmlify(html_entity_decode(bb2diaspora($body)));
- //$body = bb2diaspora($body);
// Adding the title
if(strlen($title))
@@ -2262,7 +2288,6 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
}
}
-
$public = (($item['item_private']) ? 'false' : 'true');
require_once('include/datetime.php');
@@ -2279,7 +2304,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
'$handle' => xmlify($myaddr),
'$public' => $public,
'$created' => $created,
- '$provider' => $item['app']
+ '$provider' => (($item['app']) ? $item['app'] : 'redmatrix')
));
} else {
$tpl = get_markup_template('diaspora_post.tpl');
@@ -2289,11 +2314,11 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
'$handle' => xmlify($myaddr),
'$public' => $public,
'$created' => $created,
- '$provider' => $item['app']
+ '$provider' => (($item['app']) ? $item['app'] : 'redmatrix')
));
}
- logger('diaspora_send_status: '.$owner['channel_name'].' -> '.$contact['xchan_name'].' base message: '.$msg, LOGGER_DATA);
+ logger('diaspora_send_status: '.$owner['channel_name'].' -> '.$contact['xchan_name'].' base message: ' . $msg, LOGGER_DATA);
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],$public_batch)));
diff --git a/include/items.php b/include/items.php
index f10a5c570..e9f11ee4a 100755
--- a/include/items.php
+++ b/include/items.php
@@ -95,6 +95,7 @@ function collect_recipients($item,&$private_envelope) {
$recipients[] = $item['author_xchan'];
if($item['owner_xchan'] != $item['author_xchan'])
$recipients[] = $item['owner_xchan'];
+
return $recipients;
}
diff --git a/include/notifier.php b/include/notifier.php
index 7c4f64ae0..7f4d7a9f8 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -493,7 +493,7 @@ function notifier_run($argv, $argc){
}
- if($hub['network'] === 'diaspora' || $hub['network'] === 'friendica-over-diaspora') {
+ if($hub['hubloc_network'] === 'diaspora' || $hub['hubloc_network'] === 'friendica-over-diaspora') {
if(! get_config('system','diaspora_enabled'))
continue;
diff --git a/view/tpl/diaspora_comment.tpl b/view/tpl/diaspora_comment.tpl
new file mode 100644
index 000000000..8df3842d0
--- /dev/null
+++ b/view/tpl/diaspora_comment.tpl
@@ -0,0 +1,16 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$guid}}
+ {{$parent_guid}}
+ {{$authorsig}}
+ {{$body}}
+ {{$handle}}
+
+
+
\ No newline at end of file
diff --git a/view/tpl/diaspora_comment_relay.tpl b/view/tpl/diaspora_comment_relay.tpl
new file mode 100644
index 000000000..c01441e3c
--- /dev/null
+++ b/view/tpl/diaspora_comment_relay.tpl
@@ -0,0 +1,17 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$guid}}
+ {{$parent_guid}}
+ {{$parentsig}}
+ {{$authorsig}}
+ {{$body}}
+ {{$handle}}
+
+
+
\ No newline at end of file
diff --git a/view/tpl/diaspora_conversation.tpl b/view/tpl/diaspora_conversation.tpl
new file mode 100644
index 000000000..fd11b826a
--- /dev/null
+++ b/view/tpl/diaspora_conversation.tpl
@@ -0,0 +1,34 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$conv.guid}}
+ {{$conv.subject}}
+ {{$conv.created_at}}
+
+ {{foreach $conv.messages as $msg}}
+
+
+ {{$msg.guid}}
+ {{$msg.parent_guid}}
+ {{if $msg.parent_author_signature}}
+ {{$msg.parent_author_signature}}
+ {{/if}}
+ {{$msg.author_signature}}
+ {{$msg.text}}
+ {{$msg.created_at}}
+ {{$msg.diaspora_handle}}
+ {{$msg.conversation_guid}}
+
+
+ {{/foreach}}
+
+ {{$conv.diaspora_handle}}
+ {{$conv.participant_handles}}
+
+
+
diff --git a/view/tpl/diaspora_like.tpl b/view/tpl/diaspora_like.tpl
new file mode 100644
index 000000000..b35ec46ad
--- /dev/null
+++ b/view/tpl/diaspora_like.tpl
@@ -0,0 +1,17 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$positive}}
+ {{$guid}}
+ {{$target_type}}
+ {{$parent_guid}}
+ {{$authorsig}}
+ {{$handle}}
+
+
+
diff --git a/view/tpl/diaspora_like_relay.tpl b/view/tpl/diaspora_like_relay.tpl
new file mode 100644
index 000000000..379bf0f45
--- /dev/null
+++ b/view/tpl/diaspora_like_relay.tpl
@@ -0,0 +1,18 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$positive}}
+ {{$guid}}
+ {{$target_type}}
+ {{$parent_guid}}
+ {{$parentsig}}
+ {{$authorsig}}
+ {{$handle}}
+
+
+
diff --git a/view/tpl/diaspora_message.tpl b/view/tpl/diaspora_message.tpl
new file mode 100644
index 000000000..e1690734f
--- /dev/null
+++ b/view/tpl/diaspora_message.tpl
@@ -0,0 +1,18 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$msg.guid}}
+ {{$msg.parent_guid}}
+ {{$msg.author_signature}}
+ {{$msg.text}}
+ {{$msg.created_at}}
+ {{$msg.diaspora_handle}}
+ {{$msg.conversation_guid}}
+
+
+
diff --git a/view/tpl/diaspora_photo.tpl b/view/tpl/diaspora_photo.tpl
new file mode 100644
index 000000000..258a9c2f4
--- /dev/null
+++ b/view/tpl/diaspora_photo.tpl
@@ -0,0 +1,18 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$guid}}
+ {{$handle}}
+ {{$public}}
+ {{$created_at}}
+ {{$path}}
+ {{$filename}}
+ {{$msg_guid}}
+
+
+
diff --git a/view/tpl/diaspora_post.tpl b/view/tpl/diaspora_post.tpl
new file mode 100644
index 000000000..2fe916e00
--- /dev/null
+++ b/view/tpl/diaspora_post.tpl
@@ -0,0 +1,12 @@
+
+
+
+ {{$body}}
+ {{$guid}}
+ {{$handle}}
+ {{$public}}
+ {{$created}}
+ {{$provider}}
+
+
+
diff --git a/view/tpl/diaspora_profile.tpl b/view/tpl/diaspora_profile.tpl
new file mode 100644
index 000000000..e57b82820
--- /dev/null
+++ b/view/tpl/diaspora_profile.tpl
@@ -0,0 +1,21 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+ {{$handle}}
+ {{$first}}
+ {{$last}}
+ {{$large}}
+ {{$medium}}
+ {{$small}}
+ {{$dob}}
+ {{$gender}}
+ {{$about}}
+ {{$location}}
+ {{$searchable}}
+ {{$tags}}
+
+
diff --git a/view/tpl/diaspora_relay_retraction.tpl b/view/tpl/diaspora_relay_retraction.tpl
new file mode 100644
index 000000000..97a1344c9
--- /dev/null
+++ b/view/tpl/diaspora_relay_retraction.tpl
@@ -0,0 +1,15 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$type}}
+ {{$guid}}
+ {{$signature}}
+ {{$handle}}
+
+
+
diff --git a/view/tpl/diaspora_relayable_retraction.tpl b/view/tpl/diaspora_relayable_retraction.tpl
new file mode 100644
index 000000000..c25e13db1
--- /dev/null
+++ b/view/tpl/diaspora_relayable_retraction.tpl
@@ -0,0 +1,16 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$parentsig}}
+ {{$guid}}
+ {{$target_type}}
+ {{$handle}}
+ {{$authorsig}}
+
+
+
diff --git a/view/tpl/diaspora_reshare.tpl b/view/tpl/diaspora_reshare.tpl
new file mode 100644
index 000000000..c2b4bf774
--- /dev/null
+++ b/view/tpl/diaspora_reshare.tpl
@@ -0,0 +1,18 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$root_handle}}
+ {{$root_guid}}
+ {{$guid}}
+ {{$handle}}
+ {{$public}}
+ {{$created}}
+ {{$provider}}
+
+
+
diff --git a/view/tpl/diaspora_retract.tpl b/view/tpl/diaspora_retract.tpl
new file mode 100644
index 000000000..345f4bcb6
--- /dev/null
+++ b/view/tpl/diaspora_retract.tpl
@@ -0,0 +1,14 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$guid}}
+ {{$handle}}
+ {{$type}}
+
+
+
diff --git a/view/tpl/diaspora_share.tpl b/view/tpl/diaspora_share.tpl
new file mode 100644
index 000000000..5ff04440d
--- /dev/null
+++ b/view/tpl/diaspora_share.tpl
@@ -0,0 +1,13 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$sender}}
+ {{$recipient}}
+
+
+
\ No newline at end of file
diff --git a/view/tpl/diaspora_signed_retract.tpl b/view/tpl/diaspora_signed_retract.tpl
new file mode 100644
index 000000000..58c5cc237
--- /dev/null
+++ b/view/tpl/diaspora_signed_retract.tpl
@@ -0,0 +1,15 @@
+{{*
+ * AUTOMATICALLY GENERATED TEMPLATE
+ * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
+ *
+ *}}
+
+
+
+ {{$guid}}
+ {{$type}}
+ {{$handle}}
+ {{$signature}}
+
+
+