From 3e38a24f0a28e9ad25dc322441ba45adf3bf2c02 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 31 Mar 2022 10:07:15 +0000 Subject: fix PHP error --- include/html2bbcode.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/html2bbcode.php b/include/html2bbcode.php index cc67a5666..0aa067371 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -87,7 +87,7 @@ function deletenode(&$doc, $node) function html2bbcode($message) { - if(!is_string($message) && !$message) + if(!is_string($message)) return; $message = str_replace("\r", "", $message); @@ -104,11 +104,14 @@ function html2bbcode($message) $message = preg_replace('=<(\w+):(.+?)>=', '', $message); $message = preg_replace('==', '', $message); + $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8"); + + if(!$message) + return; + $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; - $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8"); - @$doc->loadHTML($message); deletenode($doc, 'style'); -- cgit v1.2.3 From 38d977e54612e0cfbe69aae47c656f1cada037c6 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 1 Apr 2022 09:50:12 +0000 Subject: fixes in regard to hub re-installs: dismiss deleted hublocs, make sure we use the latest hubloc entry for addressing, in Queue::deliver() prefer primaries since their info is probably more accurate --- Zotlabs/Lib/Activity.php | 4 ++-- Zotlabs/Lib/Queue.php | 2 +- Zotlabs/Module/Zot_probe.php | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 0c25605e7..7663131bb 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -567,7 +567,7 @@ class Activity { } } } - $d = q("select hubloc.* from hubloc left join item on hubloc_hash = owner_xchan where item.id = %d limit 1", + $d = q("select hubloc.* from hubloc left join item on hubloc_hash = owner_xchan where item.id = %d and hubloc_deleted = 0 order by hubloc_id desc limit 1", intval($i['parent']) ); if ($d) { @@ -980,7 +980,7 @@ class Activity { } } - $d = q("select hubloc.* from hubloc left join item on hubloc_hash = owner_xchan where item.id = %d limit 1", + $d = q("select hubloc.* from hubloc left join item on hubloc_hash = owner_xchan where item.id = %d and hubloc_deleted = 0 order by hubloc_id desc limit 1", intval($i['parent']) ); if ($d) { diff --git a/Zotlabs/Lib/Queue.php b/Zotlabs/Lib/Queue.php index e03816f05..246b42667 100644 --- a/Zotlabs/Lib/Queue.php +++ b/Zotlabs/Lib/Queue.php @@ -202,7 +202,7 @@ class Queue { if($channel && $base) { $h = q("SELECT hubloc_sitekey, site_crypto FROM hubloc LEFT JOIN site ON hubloc_url = site_url - WHERE site_url = '%s' AND hubloc_network = 'zot6' ORDER BY hubloc_id DESC LIMIT 1", + WHERE site_url = '%s' AND hubloc_network = 'zot6' AND hubloc_deleted = 0 ORDER BY hubloc_primary DESC, hubloc_id DESC LIMIT 1", dbesc($base) ); if($h) { diff --git a/Zotlabs/Module/Zot_probe.php b/Zotlabs/Module/Zot_probe.php index 7585affdf..bdd9506eb 100644 --- a/Zotlabs/Module/Zot_probe.php +++ b/Zotlabs/Module/Zot_probe.php @@ -8,21 +8,21 @@ use Zotlabs\Web\HTTPSig; class Zot_probe extends \Zotlabs\Web\Controller { function get() { - + $o .= '

Zot6 Probe Diagnostic

'; - + $o .= '
'; $o .= 'Lookup URI:
'; - $o .= '
'; - + $o .= ''; + $o .= '

'; - + if(x($_GET,'addr')) { $addr = $_GET['addr']; $x = Zotfinger::exec($addr); - + $o .= '
' . htmlspecialchars(print_array($x)) . '
'; $headers = 'Accept: application/x-zot+json, application/jrd+json, application/json'; @@ -38,10 +38,10 @@ class Zot_probe extends \Zotlabs\Web\Controller { $o .= '
' . htmlspecialchars(json_encode(json_decode($x['body']),JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)) . '
' . EOL; - } + } } return $o; } - + } -- cgit v1.2.3 From b2fa63f2c8f07f0677e12c655bb39a2c1d6e5444 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 7 Apr 2022 09:20:06 +0200 Subject: move AP addressing to pubcrawl (cherry picked from commit 1390e1db399c06cb76e191437eb5be24dd95a5c7) --- Zotlabs/Lib/Activity.php | 136 +++++------------------------------------------ 1 file changed, 14 insertions(+), 122 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 7663131bb..6814c2acd 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -530,71 +530,18 @@ class Activity { $ret['attachment'] = $a; } - $public = (($i['item_private']) ? false : true); - $top_level = (($i['mid'] === $i['parent_mid']) ? true : false); - - if ($public) { - + if (intval($i['item_private']) === 0) { $ret['to'] = [ACTIVITY_PUBLIC_INBOX]; - $ret['cc'] = [z_root() . '/followers/' . substr($i['author']['xchan_addr'], 0, strpos($i['author']['xchan_addr'], '@'))]; } - else { - - // private activity - if ($top_level) { - $ret['to'] = self::map_acl($i); - } - else { - $ret['to'] = []; - if ($ret['tag']) { - foreach ($ret['tag'] as $mention) { - if (is_array($mention) && array_key_exists('href', $mention) && $mention['href']) { - $h = q("select * from hubloc where hubloc_id_url = '%s' limit 1", - dbesc($mention['href']) - ); - if ($h) { - if ($h[0]['hubloc_network'] === 'activitypub') { - $addr = $h[0]['hubloc_hash']; - } - else { - $addr = $h[0]['hubloc_id_url']; - } - if (!in_array($addr, $ret['to'])) { - $ret['to'][] = $addr; - } - } - } - } - } - $d = q("select hubloc.* from hubloc left join item on hubloc_hash = owner_xchan where item.id = %d and hubloc_deleted = 0 order by hubloc_id desc limit 1", - intval($i['parent']) - ); - if ($d) { - if ($d[0]['hubloc_network'] === 'activitypub') { - $addr = $d[0]['hubloc_hash']; - } - else { - $addr = $d[0]['hubloc_id_url']; - } - if (!in_array($addr, $ret['to'])) { - $ret['cc'][] = $addr; - } - } - } - } + $hookinfo = [ + 'item' => $i, + 'encoded' => $ret + ]; - $mentions = self::map_mentions($i); - if (count($mentions) > 0) { - if (!$ret['to']) { - $ret['to'] = $mentions; - } - else { - $ret['to'] = array_values(array_unique(array_merge($ret['to'], $mentions))); - } - } + call_hooks('encode_item', $hookinfo); - return $ret; + return $hookinfo['encoded']; } @@ -941,73 +888,18 @@ class Activity { $ret['attachment'] = $a; } - // addressing madness - - $public = (($i['item_private']) ? false : true); - $top_level = (($reply) ? false : true); - - if ($public) { + if (intval($i['item_private']) === 0) { $ret['to'] = [ACTIVITY_PUBLIC_INBOX]; - $ret['cc'] = [z_root() . '/followers/' . substr($i['author']['xchan_addr'], 0, strpos($i['author']['xchan_addr'], '@'))]; } - else { - // private activity - - if ($top_level) { - $ret['to'] = self::map_acl($i); - } - else { - $ret['to'] = []; - if ($ret['tag']) { - foreach ($ret['tag'] as $mention) { - if (is_array($mention) && array_key_exists('href', $mention) && $mention['href']) { - $h = q("select * from hubloc where hubloc_id_url = '%s' limit 1", - dbesc($mention['href']) - ); - if ($h) { - if ($h[0]['hubloc_network'] === 'activitypub') { - $addr = $h[0]['hubloc_hash']; - } - else { - $addr = $h[0]['hubloc_id_url']; - } - if (!in_array($addr, $ret['to'])) { - $ret['to'][] = $addr; - } - } - } - } - } - - $d = q("select hubloc.* from hubloc left join item on hubloc_hash = owner_xchan where item.id = %d and hubloc_deleted = 0 order by hubloc_id desc limit 1", - intval($i['parent']) - ); - if ($d) { - if ($d[0]['hubloc_network'] === 'activitypub') { - $addr = $d[0]['hubloc_hash']; - } - else { - $addr = $d[0]['hubloc_id_url']; - } - if (!in_array($addr, $ret['to'])) { - $ret['cc'][] = $addr; - } - } - } - } + $hookinfo = [ + 'item' => $i, + 'encoded' => $ret + ]; - $mentions = self::map_mentions($i); - if (count($mentions) > 0) { - if (!$ret['to']) { - $ret['to'] = $mentions; - } - else { - $ret['to'] = array_values(array_unique(array_merge($ret['to'], $mentions))); - } - } + call_hooks('encode_activity', $hookinfo); - return $ret; + return $hookinfo['encoded']; } // Returns an array of URLS for any mention tags found in the item array $i. -- cgit v1.2.3 From 4c7c5137c5289fa07695eff21c521343bedd954f Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 22 Apr 2022 07:42:31 +0000 Subject: check if addons have been removed from the filesystem and also remove them from the db if that is the case --- include/plugin.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/plugin.php b/include/plugin.php index f9cee7ed6..a17f5761d 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -275,13 +275,16 @@ function plugins_sync() { if(! array_walk($plugins_arr,'array_trim')) return; - App::$plugins = $plugins_arr; - $installed_arr = []; if(count($installed)) { foreach($installed as $i) { - if(! in_array($i, $plugins_arr)) { + if (! file_exists('addon/' . $i . '/' . $i . '.php')) { + q("DELETE FROM addon WHERE aname = '%s' ", + dbesc($i) + ); + } + elseif(! in_array($i, $plugins_arr)) { unload_plugin($i); } else { @@ -298,6 +301,8 @@ function plugins_sync() { } } + App::$plugins = $installed_arr; + } -- cgit v1.2.3 From 376733bd084350bcb0854b4f6592bb0565fac018 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 23 Apr 2022 20:52:45 +0200 Subject: fix regression with incoming poll answers from activitypub --- Zotlabs/Lib/Activity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 6814c2acd..9b3cab9d0 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2834,7 +2834,7 @@ class Activity { } if ($p && $p[0]['obj_type'] === 'Question') { - if ($item['obj_type'] === 'Note' && $item['title'] && (!$item['content'])) { + if ($item['obj_type'] === ACTIVITY_OBJ_COMMENT && $item['title'] && (!$item['body'])) { $item['obj_type'] = 'Answer'; } } -- cgit v1.2.3 From b94da93c74fa3cebee50f7756a148ef1df0efe07 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 25 Apr 2022 21:34:05 +0200 Subject: if we have not been provided a profile id set the profile id to the default profile - fixes #1671 --- Zotlabs/Module/Profile_photo.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 022efc2cd..ecfbca662 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -403,6 +403,10 @@ class Profile_photo extends Controller { foreach ($r as $rr) { if ($rr['is_default']) { $default_profile_id = intval($rr['id']); + if (!$profile_id) { + $profile_id = $default_profile_id; + } + } if ($profile_id === intval($rr['id'])) { -- cgit v1.2.3 From 2d8065a78089412d6947e11e52bd290892fd6566 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 25 Apr 2022 21:34:47 +0200 Subject: whitespace --- Zotlabs/Module/Profile_photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index ecfbca662..a5e87bbe2 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -403,10 +403,10 @@ class Profile_photo extends Controller { foreach ($r as $rr) { if ($rr['is_default']) { $default_profile_id = intval($rr['id']); + if (!$profile_id) { $profile_id = $default_profile_id; } - } if ($profile_id === intval($rr['id'])) { -- cgit v1.2.3 From 4552630bf884682c3e8ceb45bcf369a59bb1ce7e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 25 Apr 2022 22:15:31 +0200 Subject: changelog --- CHANGELOG | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 23033eb9f..8ef4d8f7c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +Hubzilla 7.2.1 (2022-04-25) + - Fix changing profile image from new member widget - issue #1671 + - Fix regression with incoming poll answers from activitypub introduced in 7.2 + - Fix addons not removed from the DB when removed from the filesystem + - Fix regression in attaching images for activitypub introduced in 7.2 + - Move activitypub addressing from core to the pubcrawl addon + - Fix hub re-install issues + + Hubzilla 7.2 (2022-03-29) - Streamline comment policy with downstream project - Add new function is_local_url() -- cgit v1.2.3