From a3acec96745f90443de84d8503334b3a204436fb Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 24 Mar 2020 18:26:20 -0700 Subject: issue 1454 - some photo item ActivityStreams links not returning json-ld; requires related fixes in addons/pubcrawl --- Zotlabs/Lib/Activity.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 02ec7614e..c50606d4f 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -323,6 +323,11 @@ class Activity { return $ret; } + + if ($i['obj']) { + $ret = Activity::encode_object($i['obj']); + } + $ret['type'] = $objtype; if ($objtype === 'Question') { -- cgit v1.2.3 From ffe429be65e8d6198579d3dd987053387799ca78 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 1 Apr 2020 07:44:07 +0000 Subject: transition connections to zot6 if their site has been updated --- Zotlabs/Daemon/Cron_daily.php | 2 ++ Zotlabs/Module/Connections.php | 2 +- Zotlabs/Update/_1236.php | 8 +++++--- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index 452ef45f1..2cf0c9119 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -96,7 +96,9 @@ class Cron_daily { Master::Summon(array('Cli_suggest')); remove_obsolete_hublocs(); + z6_discover(); + z6trans_connections(); call_hooks('cron_daily',datetime_convert()); diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php index 029601867..7dc301623 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -34,7 +34,7 @@ class Connections extends \Zotlabs\Web\Controller { } nav_set_selected('Connections'); - + $active = false; $blocked = false; $hidden = false; diff --git a/Zotlabs/Update/_1236.php b/Zotlabs/Update/_1236.php index d40cc9e25..6b4e7b299 100644 --- a/Zotlabs/Update/_1236.php +++ b/Zotlabs/Update/_1236.php @@ -105,10 +105,12 @@ class _1236 { } - if(count($r) == $i) + if(count($r) == $i) { + z6trans_connections(); return UPDATE_SUCCESS; - else - return UPDATE_FAILED; + } + + return UPDATE_FAILED; } -- cgit v1.2.3 From 643b2f9205b713bbb3667fdb4d0d549111ccfcaa Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 1 Apr 2020 08:03:19 +0000 Subject: do not enable transition of connections yet --- Zotlabs/Daemon/Cron_daily.php | 2 +- Zotlabs/Update/_1236.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index 2cf0c9119..23099745b 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -98,7 +98,7 @@ class Cron_daily { remove_obsolete_hublocs(); z6_discover(); - z6trans_connections(); + //z6trans_connections(); call_hooks('cron_daily',datetime_convert()); diff --git a/Zotlabs/Update/_1236.php b/Zotlabs/Update/_1236.php index 6b4e7b299..b27175f99 100644 --- a/Zotlabs/Update/_1236.php +++ b/Zotlabs/Update/_1236.php @@ -106,7 +106,7 @@ class _1236 { } if(count($r) == $i) { - z6trans_connections(); + //z6trans_connections(); return UPDATE_SUCCESS; } -- cgit v1.2.3 From 38be2386dd63a4a18c07e445b9859a5836ed5b46 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 1 Apr 2020 09:26:27 +0000 Subject: cheat with guid_sig to reflect transition to zot6 and re-enable transition of connections --- Zotlabs/Daemon/Cron_daily.php | 2 +- Zotlabs/Update/_1236.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index 23099745b..2cf0c9119 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -98,7 +98,7 @@ class Cron_daily { remove_obsolete_hublocs(); z6_discover(); - //z6trans_connections(); + z6trans_connections(); call_hooks('cron_daily',datetime_convert()); diff --git a/Zotlabs/Update/_1236.php b/Zotlabs/Update/_1236.php index b27175f99..6b4e7b299 100644 --- a/Zotlabs/Update/_1236.php +++ b/Zotlabs/Update/_1236.php @@ -106,7 +106,7 @@ class _1236 { } if(count($r) == $i) { - //z6trans_connections(); + z6trans_connections(); return UPDATE_SUCCESS; } -- cgit v1.2.3 From d925ec675984d59b750c91bdd53106ea414bcf71 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 1 Apr 2020 18:13:00 +0000 Subject: fix outgoing mails to zot connections --- Zotlabs/Daemon/Notifier.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index fdf0148a6..d66079216 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -737,10 +737,16 @@ class Notifier { } if(stripos($hub['site_project'], 'hubzilla') !== false && version_compare($hub['site_version'], '4.7.3', '<=')) { - $encoded_item['owner']['network'] = 'zot'; - $encoded_item['owner']['guid_sig'] = str_replace('sha256.', '', $encoded_item['owner']['guid_sig']); - $encoded_item['author']['network'] = 'zot'; - $encoded_item['author']['guid_sig'] = str_replace('sha256.', '', $encoded_item['author']['guid_sig']); + if($encoded_item['type'] === 'mail') { + $encoded_item['from']['network'] = 'zot'; + $encoded_item['from']['guid_sig'] = str_replace('sha256.', '', $encoded_item['from']['guid_sig']); + } + else { + $encoded_item['owner']['network'] = 'zot'; + $encoded_item['owner']['guid_sig'] = str_replace('sha256.', '', $encoded_item['owner']['guid_sig']); + $encoded_item['author']['network'] = 'zot'; + $encoded_item['author']['guid_sig'] = str_replace('sha256.', '', $encoded_item['author']['guid_sig']); + } } queue_insert( -- cgit v1.2.3 From 4b3979df04e0cba12049dced3ba037a004c324f6 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 3 Apr 2020 10:49:57 +0200 Subject: Avoid multiple run of expiry procedure on large sites --- Zotlabs/Daemon/Expire.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php index 398425861..f3f42df6f 100644 --- a/Zotlabs/Daemon/Expire.php +++ b/Zotlabs/Daemon/Expire.php @@ -8,6 +8,13 @@ class Expire { static public function run($argc,$argv){ cli_startup(); + + if ($pid = get_config('expire', 'procid', false) && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) { + logger('Expire: procedure already run with PID ' . $pid, LOGGER_DEBUG); + return; + } + + set_config('expire', 'procid', getmypid()); // perform final cleanup on previously delete items @@ -90,5 +97,7 @@ class Expire { logger('Expire: sys: done', LOGGER_DEBUG); } + + del_config('expire', 'procid'); } } -- cgit v1.2.3 From 625438ff642381472b4ba6c86bad7f26f69e8083 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 3 Apr 2020 19:22:31 +0000 Subject: use timezone info for timezone display only- the actual time is in utc already. --- Zotlabs/Module/Channel_calendar.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 7d75a7e41..79eb5797f 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -337,21 +337,15 @@ class Channel_calendar extends \Zotlabs\Web\Controller { } $events = []; - if($r) { foreach($r as $rr) { - $tz = get_iconfig($rr, 'event', 'timezone'); - - if(! $tz) - $tz = 'UTC'; - - $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); + $start = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ $end = null; } else { - $end = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); + $end = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); } $catsenabled = feature_enabled(local_channel(),'categories'); @@ -371,12 +365,14 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $drop = array(z_root().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); + $tz = get_iconfig($rr, 'event', 'timezone'); + $events[] = array( 'calendar_id' => 'channel_calendar', 'rw' => true, 'id'=>$rr['id'], 'uri' => $rr['event_hash'], - 'timezone' => $tz, + 'timezone' => (($tz) ? $tz : 'UTC'), 'start'=> $start, 'end' => $end, 'drop' => $drop, -- cgit v1.2.3 From cec2e92fe381a5e4bb67426290303639dd260358 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 3 Apr 2020 19:50:50 +0000 Subject: more timezone changes --- Zotlabs/Module/Channel_calendar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 79eb5797f..87dd2ffb6 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -34,8 +34,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $adjust = intval($_POST['adjust']); - $start = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart'])); - $finish = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend'])); + $start = datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtstart'])); + $finish = datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtend'])); $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); -- cgit v1.2.3 From a4831b0f7c608a4337954dfe0ad84486bdc606d6 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 3 Apr 2020 22:01:24 +0200 Subject: Revert "use timezone info for timezone display only- the actual time is in utc already." This reverts commit 625438ff642381472b4ba6c86bad7f26f69e8083 --- Zotlabs/Module/Channel_calendar.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 87dd2ffb6..c92e6ca1b 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -337,15 +337,21 @@ class Channel_calendar extends \Zotlabs\Web\Controller { } $events = []; + if($r) { foreach($r as $rr) { - $start = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); + $tz = get_iconfig($rr, 'event', 'timezone'); + + if(! $tz) + $tz = 'UTC'; + + $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ $end = null; } else { - $end = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); + $end = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); } $catsenabled = feature_enabled(local_channel(),'categories'); @@ -365,14 +371,12 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $drop = array(z_root().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); - $tz = get_iconfig($rr, 'event', 'timezone'); - $events[] = array( 'calendar_id' => 'channel_calendar', 'rw' => true, 'id'=>$rr['id'], 'uri' => $rr['event_hash'], - 'timezone' => (($tz) ? $tz : 'UTC'), + 'timezone' => $tz, 'start'=> $start, 'end' => $end, 'drop' => $drop, -- cgit v1.2.3 From cade25a112d3884034090135db421dab805a93d6 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 3 Apr 2020 22:01:44 +0200 Subject: Revert "more timezone changes" This reverts commit cec2e92fe381a5e4bb67426290303639dd260358 --- Zotlabs/Module/Channel_calendar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index c92e6ca1b..7d75a7e41 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -34,8 +34,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $adjust = intval($_POST['adjust']); - $start = datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtstart'])); - $finish = datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtend'])); + $start = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart'])); + $finish = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend'])); $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); -- cgit v1.2.3 From 44b935f8756ea751371065f1edc4f6fab339ab3d Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 4 Apr 2020 15:41:58 +0000 Subject: another attempt to get events right --- Zotlabs/Module/Channel_calendar.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 7d75a7e41..f83a0167d 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -16,7 +16,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller { if(! local_channel()) return; - + $event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0); $event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : ''); @@ -32,10 +32,11 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $categories = escape_tags(trim($_POST['categories'])); + // allday events have adjust = 0, normal events have adjust = 1 $adjust = intval($_POST['adjust']); - $start = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart'])); - $finish = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend'])); + $start = datetime_convert((($adjust) ? $tz : 'UTC'), 'UTC', escape_tags($_REQUEST['dtstart'])); + $finish = datetime_convert((($adjust) ? $tz : 'UTC'), 'UTC', escape_tags($_REQUEST['dtend'])); $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); @@ -337,21 +338,16 @@ class Channel_calendar extends \Zotlabs\Web\Controller { } $events = []; - + if($r) { foreach($r as $rr) { - $tz = get_iconfig($rr, 'event', 'timezone'); - - if(! $tz) - $tz = 'UTC'; - - $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); + $start = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ $end = null; } else { - $end = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); + $end = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); } $catsenabled = feature_enabled(local_channel(),'categories'); @@ -371,6 +367,11 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $drop = array(z_root().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); + $tz = get_iconfig($rr, 'event', 'timezone'); + + if(! $tz) + $tz = 'UTC'; + $events[] = array( 'calendar_id' => 'channel_calendar', 'rw' => true, -- cgit v1.2.3 From 67c9b5d04954012e062ee16619c1c8369582b670 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Apr 2020 06:47:12 +0000 Subject: fix unseen forum posts count --- Zotlabs/Module/Sse_bs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 90e870330..89e852120 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -399,7 +399,7 @@ class Sse_bs extends Controller { if($r) { $mids = flatten_array_recursive($r); - + $b64mids = []; foreach($mids as $mid) $b64mids[] = 'b64.' . base64url_encode($mid); -- cgit v1.2.3 From 84183d9f7ef669779841cfccd65aae8000012e6d Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Apr 2020 09:11:12 +0000 Subject: show event timezone only if adjust ist set and the offset of the event timezone is different from the channel default timezone offset --- Zotlabs/Module/Channel_calendar.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index f83a0167d..5d5fe300a 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -27,9 +27,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller { if(($xchan) && ($xchan !== get_observer_hash())) return; - $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); - $tz = (($timezone) ? $timezone : date_default_timezone_get()); - $categories = escape_tags(trim($_POST['categories'])); // allday events have adjust = 0, normal events have adjust = 1 @@ -38,6 +35,12 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $start = datetime_convert((($adjust) ? $tz : 'UTC'), 'UTC', escape_tags($_REQUEST['dtstart'])); $finish = datetime_convert((($adjust) ? $tz : 'UTC'), 'UTC', escape_tags($_REQUEST['dtend'])); + $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); + $tz = (($timezone) ? $timezone : date_default_timezone_get()); + + if(! $adjust) + $tz = 'UTC'; + $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); $location = escape_tags(trim($_POST['location'])); -- cgit v1.2.3 From a31981966e4916b6a40af0743f4dcb578511d239 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Apr 2020 09:29:23 +0000 Subject: fix warning if iconfig value is an array --- Zotlabs/Lib/Activity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index c50606d4f..3c16a5367 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -512,7 +512,7 @@ class Activity { if ($item['iconfig']) { foreach ($item['iconfig'] as $att) { if ($att['sharing']) { - $value = ((preg_match('|^a:[0-9]+:{.*}$|s', $att['v'])) ? unserialize($att['v']) : $att['v']); + $value = ((is_string($att['v']) && preg_match('|^a:[0-9]+:{.*}$|s', $att['v'])) ? unserialize($att['v']) : $att['v']); $ret[] = [ 'type' => 'PropertyValue', 'name' => 'zot.' . $att['cat'] . '.' . $att['k'], 'value' => $value ]; } } -- cgit v1.2.3 From 530b1d038fbd35690acbff5a42eca3a4332d8593 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Apr 2020 11:19:12 +0000 Subject: fix mod import --- Zotlabs/Module/Import.php | 112 +++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 57 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 18cb5560e..87d4739f3 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -212,50 +212,21 @@ class Import extends \Zotlabs\Web\Controller { // create new hubloc for the new channel at this site if(array_key_exists('channel',$data)) { - $r = hubloc_store_lowlevel( - [ - 'hubloc_guid' => $channel['channel_guid'], - 'hubloc_guid_sig' => $channel['channel_guid_sig'], - 'hubloc_hash' => $channel['channel_hash'], - 'hubloc_addr' => channel_reddress($channel), - 'hubloc_network' => 'zot', - 'hubloc_primary' => (($seize) ? 1 : 0), - 'hubloc_url' => z_root(), - 'hubloc_url_sig' => base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'])), - 'hubloc_host' => \App::get_hostname(), - 'hubloc_callback' => z_root() . '/post', - 'hubloc_sitekey' => get_config('system','pubkey'), - 'hubloc_updated' => datetime_convert() - ] - ); - - // reset the original primary hubloc if it is being seized - if($seize) { - $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ", - dbesc($channel['channel_hash']), - dbesc(z_root()) - ); - } - - // create a new zot6 hubloc if we have got a channel_portable_id if($channel['channel_portable_id']) { $r = hubloc_store_lowlevel( [ 'hubloc_guid' => $channel['channel_guid'], - 'hubloc_guid_sig' => 'sha256.' . $channel['channel_guid_sig'], + 'hubloc_guid_sig' => $channel['channel_guid_sig'], 'hubloc_hash' => $channel['channel_portable_id'], 'hubloc_addr' => channel_reddress($channel), - 'hubloc_network' => 'zot6', + 'hubloc_network' => 'zot', 'hubloc_primary' => (($seize) ? 1 : 0), 'hubloc_url' => z_root(), - 'hubloc_url_sig' => 'sha256.' . base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'])), + 'hubloc_url_sig' => base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'])), 'hubloc_host' => \App::get_hostname(), - 'hubloc_callback' => z_root() . '/zot', + 'hubloc_callback' => z_root() . '/post', 'hubloc_sitekey' => get_config('system','pubkey'), - 'hubloc_updated' => datetime_convert(), - 'hubloc_id_url' => channel_url($channel), - 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(),get_config('system','pubkey')) - + 'hubloc_updated' => datetime_convert() ] ); @@ -266,7 +237,35 @@ class Import extends \Zotlabs\Web\Controller { dbesc(z_root()) ); } + } + + // create a new zot6 hubloc if we have got a channel_portable_id + $r = hubloc_store_lowlevel( + [ + 'hubloc_guid' => $channel['channel_guid'], + 'hubloc_guid_sig' => 'sha256.' . $channel['channel_guid_sig'], + 'hubloc_hash' => $channel['channel_hash'], + 'hubloc_addr' => channel_reddress($channel), + 'hubloc_network' => 'zot6', + 'hubloc_primary' => (($seize) ? 1 : 0), + 'hubloc_url' => z_root(), + 'hubloc_url_sig' => 'sha256.' . base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'])), + 'hubloc_host' => \App::get_hostname(), + 'hubloc_callback' => z_root() . '/zot', + 'hubloc_sitekey' => get_config('system','pubkey'), + 'hubloc_updated' => datetime_convert(), + 'hubloc_id_url' => channel_url($channel), + 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(),get_config('system','pubkey')) + ] + ); + + // reset the original primary hubloc if it is being seized + if($seize) { + $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ", + dbesc($channel['channel_hash']), + dbesc(z_root()) + ); } } @@ -285,32 +284,12 @@ class Import extends \Zotlabs\Web\Controller { dbesc($channel['channel_portable_id']) ); - $r = xchan_store_lowlevel( - [ - 'xchan_hash' => $channel['channel_hash'], - 'xchan_guid' => $channel['channel_guid'], - 'xchan_guid_sig' => $channel['channel_guid_sig'], - 'xchan_pubkey' => $channel['channel_pubkey'], - 'xchan_photo_l' => z_root() . "/photo/profile/l/" . $channel['channel_id'], - 'xchan_photo_m' => z_root() . "/photo/profile/m/" . $channel['channel_id'], - 'xchan_photo_s' => z_root() . "/photo/profile/s/" . $channel['channel_id'], - 'xchan_addr' => channel_reddress($channel), - 'xchan_url' => z_root() . '/channel/' . $channel['channel_address'], - 'xchan_connurl' => z_root() . '/poco/' . $channel['channel_address'], - 'xchan_follow' => z_root() . '/follow?f=&url=%s', - 'xchan_name' => $channel['channel_name'], - 'xchan_network' => 'zot', - 'xchan_photo_date' => datetime_convert(), - 'xchan_name_date' => datetime_convert() - ] - ); - if($channel['channel_portable_id']) { $r = xchan_store_lowlevel( [ - 'xchan_hash' => \Zotlabs\Lib\Libzot::make_xchan_hash($channel['channel_guid'],$channel['channel_pubkey']), + 'xchan_hash' => $channel['channel_portable_id'], 'xchan_guid' => $channel['channel_guid'], - 'xchan_guid_sig' => 'sha256.' . $channel['channel_guid_sig'], + 'xchan_guid_sig' => $channel['channel_guid_sig'], 'xchan_pubkey' => $channel['channel_pubkey'], 'xchan_photo_l' => z_root() . "/photo/profile/l/" . $channel['channel_id'], 'xchan_photo_m' => z_root() . "/photo/profile/m/" . $channel['channel_id'], @@ -320,13 +299,32 @@ class Import extends \Zotlabs\Web\Controller { 'xchan_connurl' => z_root() . '/poco/' . $channel['channel_address'], 'xchan_follow' => z_root() . '/follow?f=&url=%s', 'xchan_name' => $channel['channel_name'], - 'xchan_network' => 'zot6', + 'xchan_network' => 'zot', 'xchan_photo_date' => datetime_convert(), 'xchan_name_date' => datetime_convert() ] ); } + $r = xchan_store_lowlevel( + [ + 'xchan_hash' => $channel['channel_hash'], + 'xchan_guid' => $channel['channel_guid'], + 'xchan_guid_sig' => 'sha256.' . $channel['channel_guid_sig'], + 'xchan_pubkey' => $channel['channel_pubkey'], + 'xchan_photo_l' => z_root() . "/photo/profile/l/" . $channel['channel_id'], + 'xchan_photo_m' => z_root() . "/photo/profile/m/" . $channel['channel_id'], + 'xchan_photo_s' => z_root() . "/photo/profile/s/" . $channel['channel_id'], + 'xchan_addr' => channel_reddress($channel), + 'xchan_url' => z_root() . '/channel/' . $channel['channel_address'], + 'xchan_connurl' => z_root() . '/poco/' . $channel['channel_address'], + 'xchan_follow' => z_root() . '/follow?f=&url=%s', + 'xchan_name' => $channel['channel_name'], + 'xchan_network' => 'zot6', + 'xchan_photo_date' => datetime_convert(), + 'xchan_name_date' => datetime_convert() + ] + ); } -- cgit v1.2.3 From ea237a97a16c35cc808d3f5a39139c94cc17cbaa Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Apr 2020 11:37:42 +0000 Subject: more mod import fixes --- Zotlabs/Module/Import.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 87d4739f3..ef11e1778 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -244,7 +244,7 @@ class Import extends \Zotlabs\Web\Controller { $r = hubloc_store_lowlevel( [ 'hubloc_guid' => $channel['channel_guid'], - 'hubloc_guid_sig' => 'sha256.' . $channel['channel_guid_sig'], + 'hubloc_guid_sig' => $channel['channel_guid_sig'], 'hubloc_hash' => $channel['channel_hash'], 'hubloc_addr' => channel_reddress($channel), 'hubloc_network' => 'zot6', @@ -310,7 +310,7 @@ class Import extends \Zotlabs\Web\Controller { [ 'xchan_hash' => $channel['channel_hash'], 'xchan_guid' => $channel['channel_guid'], - 'xchan_guid_sig' => 'sha256.' . $channel['channel_guid_sig'], + 'xchan_guid_sig' => $channel['channel_guid_sig'], 'xchan_pubkey' => $channel['channel_pubkey'], 'xchan_photo_l' => z_root() . "/photo/profile/l/" . $channel['channel_id'], 'xchan_photo_m' => z_root() . "/photo/profile/m/" . $channel['channel_id'], -- cgit v1.2.3 From cb2996a40cf86d727bfda2df86bdcc8d643b46da Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Apr 2020 15:00:08 +0000 Subject: another import fix and do not allow importing channels < version 4.7.4 for zot6 compatibility reasons --- Zotlabs/Module/Import.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index ef11e1778..2c6e09fa7 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -137,6 +137,11 @@ class Import extends \Zotlabs\Web\Controller { return; } + if(version_compare($data['compatibility']['version'], '4.7.3', '<=')) { + // zot6 transition: cloning is not compatible with older versions + notice('Data export format is not compatible with this software (not a zot6 channel)'); + return; + } if($moving) $seize = 1; @@ -344,7 +349,7 @@ class Import extends \Zotlabs\Web\Controller { } if($xchan['xchan_network'] === 'zot6') { - $zhash = \Zotlabs\Lib\Libzot::make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_pubkey']); + $zhash = Libzot::make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_pubkey']); if($zhash !== $xchan['xchan_hash']) { logger('forged xchan: ' . print_r($xchan,true)); continue; -- cgit v1.2.3 From af7a31cd1400a6b2f21e7c0a622ab448179f0ef8 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 6 Apr 2020 12:12:44 +0000 Subject: owa: look for zot6 first --- Zotlabs/Module/Owa.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 89f83bf8f..4c6fd6216 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -33,11 +33,11 @@ class Owa extends \Zotlabs\Web\Controller { if($keyId) { - // Hubzilla connections can have both zot and zot6 hublocs - // The connections will usually be zot so match those first + // Hubzilla connections can have both zot6 and zot hublocs + // The connections will usually be zot6 so match those first $r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash - where ( hubloc_addr = '%s' or hubloc_id_url = '%s' ) and hubloc_network = 'zot' ", + where ( hubloc_addr = '%s' or hubloc_id_url = '%s' ) and hubloc_network = 'zot6' ", dbesc(str_replace('acct:','',$keyId)), dbesc($keyId) ); -- cgit v1.2.3