From 0dc959d9fe40bddce5e99b8162bb0e770fc28ed9 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 24 Mar 2024 09:58:21 +0000 Subject: Deprecate *_config() functions in core. --- include/items.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index a5a23650e..efc45db38 100644 --- a/include/items.php +++ b/include/items.php @@ -4,6 +4,7 @@ * @brief Items related functions. */ +use Zotlabs\Lib\Config; use Zotlabs\Lib\Crypto; use Zotlabs\Lib\Enotify; use Zotlabs\Lib\MarkdownSoap; @@ -1078,7 +1079,7 @@ function encode_item($item,$mirror = false,$zap_compat = false) { $x['type'] = 'activity'; $x['encoding'] = 'zot'; - $key = get_config('system','prvkey'); + $key = Config::Get('system','prvkey'); // If we're trying to backup an item so that it's recoverable or for export/imprt, // add all the attributes we need to recover it @@ -2696,7 +2697,7 @@ function tag_deliver($uid, $item_id) { logger('Post mentions: ' . print_r($terms,true), LOGGER_DATA); } - $max_forums = get_config('system','max_tagged_forums',2); + $max_forums = Config::Get('system','max_tagged_forums',2); $matched_forums = 0; @@ -2968,7 +2969,7 @@ function tgroup_check($uid, $item) { if(! $u) return false; - $max_forums = get_config('system','max_tagged_forums',2); + $max_forums = Config::Get('system','max_tagged_forums',2); $matched_forums = 0; $link = normalise_link($u[0]['xchan_url']); @@ -3073,7 +3074,7 @@ function i_am_mentioned($channel, $item, $check_groups = false) { } } } - $unless = intval(get_pconfig($channel['channel_id'], 'system', 'unless_mention_count', get_config('system', 'unless_mention_count', 20))); + $unless = intval(get_pconfig($channel['channel_id'], 'system', 'unless_mention_count', Config::Get('system', 'unless_mention_count', 20))); if ($unless && $terms && count($terms) > $unless) { $tagged = false; } @@ -3762,7 +3763,7 @@ function item_expire($uid,$days,$comment_days = 7) { $sql_extra = ((intval($expire_network_only)) ? " AND item_wall = 0 " : ""); - $expire_limit = get_config('system','expire_limit', 1000); + $expire_limit = Config::Get('system','expire_limit', 1000); $item_normal = item_normal(); -- cgit v1.2.3 From 716013633ecb09b1c8fd950275f0cbf272b1fe43 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 17 Apr 2024 07:39:22 +0000 Subject: passing an empty filter to deliverable_abook_xchans() will return all deliverable abook xchans - we do not want this in this place. also add some docu --- include/items.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index efc45db38..2300f70ef 100644 --- a/include/items.php +++ b/include/items.php @@ -36,10 +36,10 @@ require_once('include/permissions.php'); * @param boolean $include_groups * @return array containing the recipients */ -function collect_recipients($item, &$private_envelope,$include_groups = true) { +function collect_recipients($item, &$private_envelope, $include_groups = true) { $private_envelope = ((intval($item['item_private'])) ? true : false); - $recipients = array(); + $recipients = []; if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) { @@ -54,8 +54,15 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { $allow_groups = []; } - $raw_recipients = array_unique(array_merge($allow_people, $allow_groups)); - $recipients = deliverable_abook_xchans($item['uid'], $raw_recipients); + $recipients = array_unique(array_merge($allow_people, $allow_groups)); + + if ($recipients) { + // deliverable_abook_xchans() will return all deliverable xchans + // if passed an empty array as 2nd argument (no filtering). + // Hence only call it if we do actually have any recipients. + $recipients = deliverable_abook_xchans($item['uid'], $recipients); + } + // if you specifically deny somebody but haven't allowed anybody, we'll allow everybody in your // address book minus the denied connections. The post is still private and can't be seen publicly @@ -201,6 +208,8 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { $recipients[] = $item['owner_xchan']; } +hz_syslog(print_r($recipients, true)); + return $recipients; } -- cgit v1.2.3 From 80e124f53e00088dc6f9a3d77623740d039b0c87 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 20 Apr 2024 18:57:37 +0000 Subject: remove logging --- include/items.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 2300f70ef..dc9e9a7d9 100644 --- a/include/items.php +++ b/include/items.php @@ -208,8 +208,6 @@ function collect_recipients($item, &$private_envelope, $include_groups = true) { $recipients[] = $item['owner_xchan']; } -hz_syslog(print_r($recipients, true)); - return $recipients; } -- cgit v1.2.3