diff options
author | Mario <mario@mariovavti.com> | 2025-02-26 15:32:36 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2025-02-26 15:32:36 +0000 |
commit | e3eebcd95de6be2be78ea81edef00ab5c2355503 (patch) | |
tree | 62b266a25a0fdb63e0418898809ec2459f5ae318 /include | |
parent | cfcac590c3a5d183db3a496fa2e9be344b599705 (diff) | |
download | volse-hubzilla-e3eebcd95de6be2be78ea81edef00ab5c2355503.tar.gz volse-hubzilla-e3eebcd95de6be2be78ea81edef00ab5c2355503.tar.bz2 volse-hubzilla-e3eebcd95de6be2be78ea81edef00ab5c2355503.zip |
calculate observer.baseurl from xchan_url since xchan_connurl is only set for zot xchans
Diffstat (limited to 'include')
-rw-r--r-- | include/bbcode.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 15a75ce3f..65bda1b7b 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1126,9 +1126,11 @@ function parseIdentityAwareHTML($Text) { if ($observer) { $s1 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">'; $s2 = '</span>'; - $obsBaseURL = $observer['xchan_connurl']; - $obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL); - $Text = str_replace('[observer.baseurl]', $obsBaseURL, $Text); + + $parsed = parse_url($observer['xchan_url']); + $observer_base_url = unparse_url($parsed, ['scheme', 'host', 'port']); + + $Text = str_replace('[observer.baseurl]', $observer_base_url, $Text); $Text = str_replace('[observer.url]',$observer['xchan_url'], $Text); $Text = str_replace('[observer.name]',$s1 . $observer['xchan_name'] . $s2, $Text); $Text = str_replace('[observer.address]',$s1 . $observer['xchan_addr'] . $s2, $Text); @@ -1311,9 +1313,11 @@ function bbcode($text, $options = []) { if ($observer) { $s1 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">'; $s2 = '</span>'; - $obsBaseURL = $observer['xchan_connurl']; - $obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL); - $text = str_replace('[observer.baseurl]', $obsBaseURL, $text); + + $parsed = parse_url($observer['xchan_url']); + $observer_base_url = unparse_url($parsed, ['scheme', 'host', 'port']); + + $text = str_replace('[observer.baseurl]', $observer_base_url, $text); $text = str_replace('[observer.url]',$observer['xchan_url'], $text); $text = str_replace('[observer.name]',$s1 . $observer['xchan_name'] . $s2, $text); $text = str_replace('[observer.address]',$s1 . $observer['xchan_addr'] . $s2, $text); |