more fixes

This commit is contained in:
zotlabs 2019-09-23 16:11:36 -07:00
parent 335781e40f
commit b6ae2b7eab
3 changed files with 18 additions and 8 deletions

View file

@ -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

View file

@ -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'])) {

View file

@ -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 '<a href="' . $url . '" target="censored"><img src="' . $url . '" alt="censored" style="opacity: 0.03;"></a>';
}
function bb_code($match) {
if(strpos($match[0], "<br />"))
return '<pre><code>' . bb_code_protect(trim($match[1])) . '</code></pre>';
@ -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("/\<img(.*?)src=\"(.*?)\"(.*?)\>/ism",'<i class="fa fa-image"></i> <a href="#" onclick="\\$.colorbox({ \'href\': \'$2\' }); return false;">$2</a>',$Text);
$Text = preg_replace_callback("/\<img(.*?)src=\"(.*?)\"(.*?)\>/ism","bb_colorbox",$Text);
}