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

Recent

Welcome to TinyPortal. Please login or sign up.

September 30, 2023, 01:50:15 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 194,549
  • Total Topics: 21,181
  • Online today: 90
  • Online ever: 3,540
  • (September 03, 2022, 01:38:54 AM)
Users Online
Users: 0
Guests: 51
Total: 51

Hyperlinks not working on Front Page

Started by Kokoro, July 11, 2022, 01:16:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tino

What am I doing wrong? As I can't recreate it atm

See the images for what I have done..

@rjen

Create a bbc article with a hyperlink enclosed in quotes. Save it and view. Try the link. If it works, edit the article and save it again. Try the link again.
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Quote from: @rjen on July 24, 2022, 09:17:17 PM
Create a bbc article with a hyperlink enclosed in quotes. Save it and view. Try the link. If it works, edit the article and save it again. Try the link again.

Done that, it links through ok.

I'll add what I think is the fix. But I can't verify it.

@rjen

I can reproduce it, so I can verify the fix
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Try adding this the line above here:

https://github.com/Tinyportal/TinyPortal/blob/7652754b0ad9a81e3d96a73d3b1a2df6409a1cdc/Sources/TPArticle.php#L431


            // BBC we need to encode quotes
            if( ($_REQUEST['tp_article_type'] == 'bbc') && ($setting == 'body') ) {
              $value = $smcFunc['htmlspecialchars']($value, ENT_QUOTES);
            }


That breaks things for me and add's localhost on the second save, but I'm not sure if that's my environment.

tino

https://github.com/Tinyportal/TinyPortal/blob/7652754b0ad9a81e3d96a73d3b1a2df6409a1cdc/Sources/TPortalAdmin.php#L1010

This line also needs to be changed to


      if($context['TPortal']['editarticle']['type'] != 'bbc') {
        $context['TPortal']['editarticle']['body'] = $smcFunc['htmlspecialchars']($context['TPortal']['editarticle']['body'], ENT_QUOTES);
      }

@rjen

Just tested the fixes on two test sites and as far as I can see they fix the problem with the links in bbc articles.
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Kokoro