Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2021-01-21 18:37:35 -08:00
commit 9432b81ee1
3 changed files with 49 additions and 32 deletions

View file

@ -2696,7 +2696,21 @@ class Activity {
if ($cacheable) {
if ((! array_key_exists('mimetype',$s)) || ($s['mimetype'] === 'text/bbcode')) {
$s['html'] = bbcode($s['body']);
// preserve the original purified HTML content *unless* we've modified $s['body']
// within this function (to add attachments or reaction descriptions or mention rewrites).
// This avoids/bypasses some markdown rendering issues which can occur when
// converting to our markdown-enhanced bbcode and then back to HTML again.
// Also if we do need bbcode, use the 'bbonly' flag to ignore markdown and only
// interpret bbcode; which is much less susceptible to false positives in the
// conversion regexes.
if ($s['body'] === self::bb_content($content,'content')) {
$s['html'] = $content['content'];
}
else {
$s['html'] = bbcode($s['body'], [ 'bbonly' => true ]);
}
}
}
@ -3000,7 +3014,7 @@ class Activity {
}
else {
$fetch = false;
if (perm_is_allowed($channel['channel_id'],$observer_hash,'send_stream') && (PConfig::Get($channel['channel_id'],'system','hyperdrive',true) || $act->type === 'Announce')) {
if (intval($channel['channel_system']) || (perm_is_allowed($channel['channel_id'],$observer_hash,'send_stream') && (PConfig::Get($channel['channel_id'],'system','hyperdrive',true) || $act->type === 'Announce'))) {
$fetch = (($fetch_parents) ? self::fetch_and_store_parents($channel,$observer_hash,$act,$item) : false);
}
if ($fetch) {

View file

@ -27,9 +27,8 @@ class Profiles extends Controller {
if(! $r) {
notice( t('Profile not found.') . EOL);
goaway(z_root() . '/profiles');
return; // NOTREACHED
}
$profile_guid = $r['profile_guid'];
$profile_guid = $r[0]['profile_guid'];
check_form_security_token_redirectOnErr('/profiles', 'profile_drop', 't');

View file

@ -1238,6 +1238,7 @@ function bbcode($Text, $options = []) {
$activitypub = ((array_key_exists('activitypub',$options)) ? $options['activitypub'] : false);
$censored = ((array_key_exists('censored',$options)) ? $options['censored'] : false);
$plain = ((array_key_exists('plain',$options)) ? $options['plain'] : false);
$bbonly = ((array_key_exists('bbonly',$options)) ? $options['bbonly'] : false);
if ($activitypub) {
$export = true;
@ -1248,8 +1249,6 @@ function bbcode($Text, $options = []) {
call_hooks('bbcode_filter', $Text);
// Hide all [noparse] contained bbtags by spacefying them
if (strpos($Text,'[noparse]') !== false) {
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text);
@ -1341,6 +1340,9 @@ function bbcode($Text, $options = []) {
$Text = str_replace("\r\n", "\n", $Text);
if (! $bbonly) {
// save code blocks from being interpreted as markdown
$Text = preg_replace_callback("/\[code(.*?)\](.*?)\[\/code\]/ism", 'bb_code_preprotect', $Text);
@ -1374,6 +1376,8 @@ function bbcode($Text, $options = []) {
$Text = preg_replace('/\s*<\/(ol|ul)>\n+<\1>\s*/',"\n",$Text);
$Text = bb_code_preunprotect($Text);
}
// Convert new line chars to html <br> tags