TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 05:03:07 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 310
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 298
  • Total: 299
  • lurkalot

Link goes no where

Started by bigguy, December 03, 2018, 03:04:29 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

@rjen

Just updated my local install to todays version of Github and it still breaks...

You can check my phpinfo in my signature...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

I think I found the cause of the problem... since we inject the Read More link onto the body text the SMF2.1 parser may affect it?

This code in Subs.php seems to cause the issue...


array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br>' => ''));
$scheme = parse_url($data, PHP_URL_SCHEME);
if (empty($scheme))
$data = '//' . ltrim($data, ':/');
},


I could be wrong. Tino, can you check this?
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

Ok, yes, that's it.

When deactivating this option in SMF settings the links work...
Admin > Configuration > Bulletin Board code: Automatically link posted URLs

This 2.1 function seems to break the Read More link if activated...

So bigguy, for now you can consider deactivating that option till we find a fix...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Weird I also have that checked and its ok.

@rjen

Quote from: tino on December 03, 2018, 11:22:59 AM
Weird I also have that checked and its ok.

and now what?

This settings makes and breaks the Read More links on the forum posts, so it must be at least related to the issue...
Perhaps it would be better to not include the Read More link in the body text, but add it separately somehow?
That way it will not be touched by SMF 's parser anymore...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Quote from: @rjen on December 03, 2018, 11:41:03 AM
Quote from: tino on December 03, 2018, 11:22:59 AM
Weird I also have that checked and its ok.

and now what?

This settings makes and breaks the Read More links on the forum posts, so it must be at least related to the issue...
Perhaps it would be better to not include the Read More link in the body text, but add it separately somehow?
That way it will not be touched by SMF 's parser anymore...

My issue is it doesn't break for me... Second I can't see the path where we call the forum posts and then put it through parse_bbc...

@rjen

QuoteSecond I can't see the path where we call the forum posts and then put it through parse_bbc...

Sorry, can you explain what you mean? Perhaps I am incorrectly using the parser reference.

What I see is that TPortal.php collects the posts to be displayed and adds a "Read More" link to the $row['body']

Then sometime later the $row['body'] is outputted onto the frontpage. I am not seeing where this happens in the code, but I assume somewhere the SMF logic kicks in and it changes the link  on screen...

Any hints as to where that happens would be appreciated...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Quote from: @rjen on December 03, 2018, 11:53:54 AM
Any hints as to where that happens would be appreciated...

I can't see where it does that. It would be in the TPortal.template.php I would expect.

If disabling it fixes the issue then it is related to that somehow... I just can't work out how  :'(


tino

Here are all the instances we use parse_bbc, with the line number after the file name.


grep -nr parse_bbc *
Sources/TPSubs.php:1686: echo parse_bbc($context['TPortal']['article']['intro']), '<p><b><a href="' .$scripturl . '?page=' , !empty($context['TPortal']['article']['shortname']) ? $context['TPortal']['article']['shortname'] : $context['TPortal']['article']['id'] , '' , WIRELESS ? ';' . WIRELESS_PROTOCOL : '' , '">'.$txt['tp-readmore'].'</a></b></p>';
Sources/TPSubs.php:1688: echo parse_bbc($context['TPortal']['article']['intro']);
Sources/TPSubs.php:1706: echo parse_bbc($context['TPortal']['article']['body']);
Sources/TPSubs.php:1764: echo parse_bbc($context['TPortal']['blockarticles'][$context['TPortal']['blockarticle']]['body']);
Sources/TPSubs.php:2336: $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '')));
Sources/TPdlmanager.php:544: 'description' => $context['TPortal']['dl_wysiwyg'] == 'bbc' ? parse_bbc(trim(strip_tags($row['description']))) : $row['description'],
Sources/TPdlmanager.php:690: 'description' => $context['TPortal']['dl_wysiwyg'] == 'bbc' ? parse_bbc(trim(strip_tags($row['description']))) : $row['description'],
Sources/TPdlmanager.php:774: 'description' => $context['TPortal']['dl_wysiwyg'] == 'bbc' ? parse_bbc(trim(strip_tags($row['description']))) : $row['description'],
Sources/TPdlmanager.php:930: 'description' => $context['TPortal']['dl_wysiwyg'] == 'bbc' ? parse_bbc(trim(strip_tags($row['description']))) : $row['description'],
Sources/TPdlmanager.php:1051: 'ingress' => $context['TPortal']['dl_wysiwyg']=='bbc' ? parse_bbc(trim(strip_tags($row['ingress']))) : $row['ingress'],
Sources/TPdlmanager.php:1350: 'description' => $context['TPortal']['dl_wysiwyg'] == 'bbc' ? parse_bbc(trim(strip_tags($row['description']))) : $row['description'],
Sources/TPortal.php:750: 'text' => parse_bbc($row['value2']),
Sources/TPortal.php:892: $context['TPortal']['printbody'] = parse_bbc($what);
Sources/TPortalAdmin.php:267: $message = trim(un_htmlspecialchars(strip_tags(strtr(parse_bbc($message2, false), array('<br />' => "\n", '</div>' => "\n", '</li>' => "\n", '[' => '[', ']' => ']')))));
Sources/TPmodules.php:591: $row['body'] = parse_bbc($row['body']);
Sources/TPmodules.php:1604: 'shout' => parse_bbc(censorText($row['value1'])),
Themes/default/TPsubs.template.php:1127: echo '<div class="blockbody" style="overflow: auto;' , !empty($context['TPortal']['blockheight_'.$side]) ? 'height: '.$context['TPortal']['blockheight_'.$side].';' : '' , '">' , parse_bbc($block['body']) , '</div>';
Themes/default/TPsubs.template.php:1163: echo parse_bbc($block['body']);
Themes/default/TPortalAdmin.template.php:350: <dd><div class="post">', !empty($mod['description']) ? parse_bbc($mod['description']) : '' , '</div>
Themes/default/TPShout.template.php:284: <p style="margin-top: 0;">' . parse_bbc($context['TPortal']['shoutbox_stitle'],true) . '</p><hr>';
Themes/default/TPdlmanager.template.php:55: <div class="windowbg tp_pad" style="margin-bottom: 5px">' , $context['TPortal']['dl_wysiwyg'] == 'bbc' ? parse_bbc($context['TPortal']['dl_introtext']) : $context['TPortal']['dl_introtext'] , '</div>';
tp-files/tp-modules/TPShout/Sources/TPShout.php:648: $row['value1'] = parse_bbc(censorText($row['value1']), true);
tp-files/tp-blockcodes/singleshout.blockcode:60: $row['value1'] = parse_bbc(censorText($row['value1']), true);

@rjen

Can you check the settings for the allowed tags?

It seems that the url tag is causing it.
If I disable the url tag I can leave the autolink URL on, and it also works...
Running Latest TP on SMF2.1 at: www.fjr-club.nl