From 3d264f5a55f340e3c20c1181c8b4578abecf3f1c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 3 Mar 2021 12:39:41 +0000 Subject: php8: fix warnings during install procedure (cherry picked from commit 48bae9d4219735bc44f4ee72228d19d3e6b9efc9) --- include/channel.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/channel.php') diff --git a/include/channel.php b/include/channel.php index c6ca673eb..d1095115d 100644 --- a/include/channel.php +++ b/include/channel.php @@ -303,8 +303,8 @@ function create_identity($arr) { $photo_type = null; $z = [ - 'account' => $a[0], - 'channel' => $r[0], + 'account' => $a[0] ?? [], + 'channel' => $r[0] ?? [], 'photo_url' => '' ]; /** @@ -1098,11 +1098,11 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals // @fixme - Not totally certain how to handle $zot_compat for the event timezone which exists // in Hubzilla but is stored with the item and not the event. In Zap, stored information is - // always UTC and localised on access as per standard conventions for working with global time data. + // always UTC and localised on access as per standard conventions for working with global time data. // Older Zot (pre-Zot6) records aren't translated correctly w/r/t AS2 so only include events for the last year or so if - // migrating to Zap. - + // migrating to Zap. + $sqle = (($zap_compat) ? " and created > '2020-01-01 00:00:00' " : ''); $r = q("select * from event where uid = %d $sqle", -- cgit v1.2.3 From c2dc3e8dec7acf1f1750f7379e641ae8c7a2ed81 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 3 Mar 2021 13:09:17 +0000 Subject: set the default collection acl if indicated so by the role permissions but always set the created friends group as channel_default_group when creating a new channel (cherry picked from commit 9389abdb757d5cb5b4b4322260e86c47d11ff043) --- include/channel.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'include/channel.php') diff --git a/include/channel.php b/include/channel.php index d1095115d..4f48402d2 100644 --- a/include/channel.php +++ b/include/channel.php @@ -503,23 +503,22 @@ function create_identity($arr) { // right away as a default group for new contacts. require_once('include/group.php'); - group_add($newuid, t('Friends')); - group_add_member($newuid,t('Friends'),$ret['channel']['channel_hash']); + $group_hash = group_add($newuid, t('Friends')); - // if our role_permissions indicate that we're using a default collection ACL, add it. + if($group_hash) { + group_add_member($newuid,t('Friends'),$ret['channel']['channel_hash']); - if(is_array($role_permissions) && $role_permissions['default_collection']) { - $r = q("select hash from pgrp where uid = %d and gname = '%s' limit 1", - intval($newuid), - dbesc( t('Friends') ) - ); - if($r) { - q("update channel set channel_default_group = '%s', channel_allow_gid = '%s' where channel_id = %d", - dbesc($r[0]['hash']), - dbesc('<' . $r[0]['hash'] . '>'), - intval($newuid) - ); + $default_collection = ''; + // if our role_permissions indicate that we're using a default collection ACL, add it. + if(is_array($role_permissions) && $role_permissions['default_collection']) { + $default_collection_str = '<' . $group_hash . '>'; } + + q("update channel set channel_default_group = '%s', channel_allow_gid = '%s' where channel_id = %d", + dbesc($group_hash), + dbesc($default_collection_str), + intval($newuid) + ); } if(! $system) { -- cgit v1.2.3 From 7460b1eecbb1d4eb7937ab551f7d4b333eba5a38 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 6 Mar 2021 08:50:36 +0000 Subject: fix varable name and more changelog --- include/channel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/channel.php') diff --git a/include/channel.php b/include/channel.php index 4f48402d2..ecb7c24f7 100644 --- a/include/channel.php +++ b/include/channel.php @@ -508,7 +508,7 @@ function create_identity($arr) { if($group_hash) { group_add_member($newuid,t('Friends'),$ret['channel']['channel_hash']); - $default_collection = ''; + $default_collection_str = ''; // if our role_permissions indicate that we're using a default collection ACL, add it. if(is_array($role_permissions) && $role_permissions['default_collection']) { $default_collection_str = '<' . $group_hash . '>'; -- cgit v1.2.3