diff options
author | Mario Vavti <mario@mariovavti.com> | 2022-04-25 22:16:39 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2022-04-25 22:16:39 +0200 |
commit | e386499bfacdefff6c8b1c47cb16f0aa732a9daa (patch) | |
tree | 61992c689d955163b6621a6a3ae03972dba3e674 | |
parent | 930b9820f2829a129a93ed619a68754d2b43b530 (diff) | |
parent | 4552630bf884682c3e8ceb45bcf369a59bb1ce7e (diff) | |
download | volse-hubzilla-e386499bfacdefff6c8b1c47cb16f0aa732a9daa.tar.gz volse-hubzilla-e386499bfacdefff6c8b1c47cb16f0aa732a9daa.tar.bz2 volse-hubzilla-e386499bfacdefff6c8b1c47cb16f0aa732a9daa.zip |
Merge branch 'dev'
-rw-r--r-- | CHANGELOG | 9 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 138 | ||||
-rw-r--r-- | Zotlabs/Module/Profile_photo.php | 4 | ||||
-rw-r--r-- | include/html2bbcode.php | 9 | ||||
-rw-r--r-- | include/plugin.php | 11 |
5 files changed, 42 insertions, 129 deletions
@@ -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() diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 7663131bb..9b3cab9d0 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. @@ -2942,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'; } } diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 022efc2cd..a5e87bbe2 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'])) { 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+):(.+?)>=', '<removeme>', $message); $message = preg_replace('=</(\w+):(.+?)>=', '</removeme>', $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'); 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; + } |