From b6ae2b7eab8b2ef73a40348c0e33a969f1ee9759 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 23 Sep 2019 16:11:36 -0700 Subject: [PATCH] more fixes --- Zotlabs/Lib/Connect.php | 9 ++++++--- Zotlabs/Lib/ThreadItem.php | 2 +- include/bbcode.php | 15 +++++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Zotlabs/Lib/Connect.php b/Zotlabs/Lib/Connect.php index e25129609..f59d1942a 100644 --- a/Zotlabs/Lib/Connect.php +++ b/Zotlabs/Lib/Connect.php @@ -150,9 +150,12 @@ class Connect { $ap_allowed = get_config('system','activitypub',false) && get_pconfig($uid,'system','activitypub',true); - if ($r['xchan_network'] === 'activitypub' && ! $ap_allowed) { - $result['message'] = t('Protocol not supported'); - return $result; + if ($r['xchan_network'] === 'activitypub') + if (! $ap_allowed) { + $result['message'] = t('Protocol not supported'); + return $result; + } + $singleton = true; } // Now start processing the new connection diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 3c9ccfce7..886da8f73 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -495,7 +495,7 @@ class ThreadItem { $result['children'] = []; - if (get_config('system','activitypub')) { + if (get_config('system','activitypub') && local_channel() && get_pconfig(local_channel(),'system','activitypub',true)) { // place to store all the author addresses (links if not available) in the thread so we can auto-mention them in JS. $result['authors'] = []; if ($observer && ($profile_addr === $observer['xchan_hash'] || $profile_addr === $observer['xchan_addr'])) { diff --git a/include/bbcode.php b/include/bbcode.php index f8e349a11..8cb4a8729 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -803,6 +803,16 @@ function bb_code_unprotect_sub($match) { return base64_decode($match[1]); } +function bb_colorbox($match) { + if (strpos($match[1],'zrl')) { + $url = zid($match[2]); + } + else { + $url = $match[2]; + } + return 'censored'; +} + function bb_code($match) { if(strpos($match[0], "
")) return '
' . bb_code_protect(trim($match[1])) . '
'; @@ -1425,10 +1435,7 @@ function bbcode($Text, $options = []) { if($censored) { $Text = separate_img_links($Text); - - //@fixme make this work with OWA image links - - $Text = preg_replace("/\/ism",' $2',$Text); + $Text = preg_replace_callback("/\/ism","bb_colorbox",$Text); }