From 1fbc8739b9521703e68f274728ec04b4b941d49e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 4 Oct 2019 07:18:19 +0000 Subject: fix bbcode event reshare timezone issue (cherry picked from commit 79bcc157bf8f0c67a8ee41ae9c53a9dec969f8d1) --- include/bbcode.php | 1 + include/event.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/bbcode.php b/include/bbcode.php index 485a1f5b2..bb9144b1d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1346,6 +1346,7 @@ function bbcode($Text, $options = []) { $Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text); $Text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism",'',$Text); $Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text); + $Text = preg_replace("/\[event\-timezone\](.*?)\[\/event\-timezone\]/ism",'',$Text); $Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text); $Text = str_replace("\0",'$',$Text); diff --git a/include/event.php b/include/event.php index 6689919cf..6be1b6705 100644 --- a/include/event.php +++ b/include/event.php @@ -276,6 +276,9 @@ function format_event_bbcode($ev) { if($ev['event_hash']) $o .= '[event-id]' . $ev['event_hash'] . '[/event-id]'; + if($ev['timezone']) + $o .= '[event-timezone]' . $ev['timezone'] . '[/event-timezone]'; + if($ev['adjust']) $o .= '[event-adjust]' . $ev['adjust'] . '[/event-adjust]'; @@ -324,6 +327,9 @@ function bbtoevent($s) { if(preg_match("/\[event\-id\](.*?)\[\/event\-id\]/is",$s,$match)) $ev['event_hash'] = $match[1]; $match = ''; + if(preg_match("/\[event\-timezone\](.*?)\[\/event\-timezone\]/is",$s,$match)) + $ev['timezone'] = $match[1]; + $match = ''; if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) $ev['adjust'] = $match[1]; if(array_key_exists('dtstart',$ev)) { -- cgit v1.2.3 From 562e39c9c5d79823b047886dbfb87deee3f4ca01 Mon Sep 17 00:00:00 2001 From: Zot Date: Sat, 5 Oct 2019 10:31:11 +0200 Subject: another timezone fix --- Zotlabs/Lib/Activity.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index b74f6b2bc..b869c55b5 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -202,6 +202,11 @@ class Activity { $ev = bbtoevent($x['content']); if($ev) { + + if (! $ev['timezone']) { + $ev['timezone'] = 'UTC'; + } + $actor = null; if(array_key_exists('author',$x) && array_key_exists('link',$x['author'])) { $actor = $x['author']['link'][0]['href']; @@ -212,14 +217,14 @@ class Activity { 'name' => $ev['summary'], // 'summary' => bbcode($ev['summary'], [ 'cache' => true ]), // RFC3339 Section 4.3 - 'startTime' => (($ev['adjust']) ? datetime_convert('UTC','UTC',$ev['dtstart'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtstart'],'Y-m-d\\TH:i:s-00:00')), + 'startTime' => (($ev['adjust']) ? datetime_convert($ev['timezone'],'UTC',$ev['dtstart'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtstart'],'Y-m-d\\TH:i:s-00:00')), 'content' => bbcode($ev['description'], [ 'cache' => true ]), 'location' => [ 'type' => 'Place', 'content' => bbcode($ev['location'], [ 'cache' => true ]) ], 'source' => [ 'content' => format_event_bbcode($ev), 'mediaType' => 'text/bbcode' ], 'actor' => $actor, ]; if(! $ev['nofinish']) { - $y['endTime'] = (($ev['adjust']) ? datetime_convert('UTC','UTC',$ev['dtend'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtend'],'Y-m-d\\TH:i:s-00:00')); + $y['endTime'] = (($ev['adjust']) ? datetime_convert($ev['timezone'],'UTC',$ev['dtend'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtend'],'Y-m-d\\TH:i:s-00:00')); } // copy attachments from the passed object - these are already formatted for ActivityStreams -- cgit v1.2.3 From 79b0a6ba9c1a45f98a39870e424335613dc2e77f Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 5 Oct 2019 10:31:47 +0200 Subject: Allow addons to process forum posts published through mentions --- Zotlabs/Lib/Libzot.php | 2 +- include/zot.php | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 0c90ff34d..100d45c05 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1764,7 +1764,7 @@ class Libzot { // if it's a sourced post, call the post_local hooks as if it were // posted locally so that crosspost connectors will be triggered. - if(check_item_source($arr['uid'], $arr)) { + if(check_item_source($arr['uid'], $arr) || ($channel['xchan_pubforum'] == 1)) { /** * @hooks post_local * Called when an item has been posted on this machine via mod/item.php (also via API). diff --git a/include/zot.php b/include/zot.php index bd85dd755..d08146287 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1776,17 +1776,14 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ $DR = new Zotlabs\Lib\DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']); - $r = q("select * from channel where channel_hash = '%s' limit 1", - dbesc($d['hash']) - ); + $channel = channelx_by_hash($d['hash']); - if(! $r) { + if(! $channel) { $DR->update('recipient not found'); $result[] = $DR->get(); continue; } - $channel = $r[0]; $DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>'); /* blacklisted channels get a permission denied, no special message to tip them off */ @@ -2032,7 +2029,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ // if it's a sourced post, call the post_local hooks as if it were // posted locally so that crosspost connectors will be triggered. - if(check_item_source($arr['uid'], $arr)) { + if(check_item_source($arr['uid'], $arr) || ($channel['xchan_pubforum'] == 1)) { /** * @hooks post_local * Called when an item has been posted on this machine via mod/item.php (also via API). -- cgit v1.2.3 From d6634eb14e3fd6afdfd8b1f0a74a200a55c2826d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 5 Oct 2019 20:02:08 +0000 Subject: fix zap->hubzlla event title compatibility (cherry picked from commit d8b8d8ceb5cc9d701f91dac26834af15f3257cce) --- Zotlabs/Lib/Activity.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index b869c55b5..844127ee3 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1693,11 +1693,12 @@ class Activity { } if($act->obj['type'] === 'Event') { + $s['obj'] = []; $s['obj']['asld'] = $act->obj; $s['obj']['type'] = ACTIVITY_OBJ_EVENT; $s['obj']['id'] = $act->obj['id']; - $s['obj']['title'] = $act->obj['summary']; + $s['obj']['title'] = $act->obj['name']; if(strpos($act->obj['startTime'],'Z')) $s['obj']['adjust'] = true; -- cgit v1.2.3