TinyPortal

Development => Support => Topic started by: Kokoro on July 11, 2022, 01:16:53 AM

Title: Hyperlinks not working on Front Page
Post by: Kokoro on July 11, 2022, 01:16:53 AM
Link to my forum: https://www.AnimeRPGs dot com/
SMF version: 2.1.2
TP version: 2.2.2
Default Forum Language: English
Theme name and version: Default (with Curve Color Changer v. 1.3 MOD)
Browser Name and Version: Firefox 102.0.1 (64-bit)
Mods installed: Activity Bar (2.0.1), Avatars Display Integration (1.5.3), Curve2 Color Changer (1.3), Dice Roller BBcode (2.0), Login Menu Button (2.0), Members Online Today (1.0), More Spiders (1.3.1), Post as Another Member (1.6), SMF 2.1.2 Update (1.0), SMF Gallery Lite (7.1), SMFPacks Social Login (2.3.2), Similar Topics (1.2.2), Yet Another Spoiler Mod (1.2)
Related Error messages: N/A

Problem:  Web links aren't working on Front Page article.


[list]
[li][url="https://www.animerpgs.com/index.php?topic=3.0"]Introduction to the Site[/url][/li]
[/list]
Title: Re: Hyperlinks not working on Front Page
Post by: @rjen on July 11, 2022, 05:46:39 AM
Please provide more detail ; links are not working in what? Forum topics? Blocks? Articles ?

Please provide a full description on what you did to create the broken link.
Title: Re: Hyperlinks not working on Front Page
Post by: @rjen on July 11, 2022, 08:01:56 AM
I just put your code in a frontpanel BBC code block on a test site and the link works just fine...

Title: Re: Hyperlinks not working on Front Page
Post by: lurkalot on July 11, 2022, 08:24:50 AM
@rjen, did you click the link to see if it works?  It breaks for me on my test site.

I reported this bug some time back, when all my article links broke.  Seems removing the " " from beginning and end of link, then resaving seems to fix it.

Also, if I remember it was working ok in a front page block, it was bbc articles where they had this issue.
Title: Re: Hyperlinks not working on Front Page
Post by: @rjen on July 11, 2022, 09:00:24 AM
Yeah, the link works just fine. The issue you are referring to was fixed in TP 2.2.2...

I assume you are referring to this one:
https://www.tinyportal.net/index.php?topic=36743.msg302241#msg302241
Title: Re: Hyperlinks not working on Front Page
Post by: Kokoro on July 11, 2022, 11:53:05 AM
Thank you!  Manually removing the end quotes fixed the problem.  I'll just have to remember to do that whenever I edit or make a new BBC article.
Title: Re: Hyperlinks not working on Front Page
Post by: @rjen on July 11, 2022, 11:55:31 AM
Just reproduced it in a BBC article. It is actually the same issue we saw on the BBC blocks before: if the link is created with the quotes it breaks when parsed..

Remove the quotes and link will work, but it will break the next time the article is saved...

It is definately a bug in the BBC articles...

Note: I was a bit confused by the statement that links break on the frontpage. The link breaks in the article regardless of where is it showing...
Title: Re: Hyperlinks not working on Front Page
Post by: Kokoro on July 11, 2022, 11:57:20 AM
Sorry, that was poor vocabulary on my part.  That's the only place I'm using articles at the moment.
Title: Re: Hyperlinks not working on Front Page
Post by: lurkalot on July 11, 2022, 06:18:01 PM
Quote from: @rjen on July 11, 2022, 09:00:24 AM
Yeah, the link works just fine. The issue you are referring to was fixed in TP 2.2.2...

I assume you are referring to this one:
https://www.tinyportal.net/index.php?topic=36743.msg302241#msg302241

Yes, that was the one, I was confusing it with my other issue where it stripped all my bbc html tags and broke my articles.  But yes that thread you mentioned is the one.  Strange that issue came back after the fix. 
Title: Re: Hyperlinks not working on Front Page
Post by: @rjen on July 11, 2022, 06:26:39 PM
It did not come back: that issue was with php blocks. And that still works ...
Title: Re: Hyperlinks not working on Front Page
Post by: tino on July 24, 2022, 08:46:58 PM
What am I doing wrong? As I can't recreate it atm

See the images for what I have done..
Title: Re: Hyperlinks not working on Front Page
Post by: @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.
Title: Re: Hyperlinks not working on Front Page
Post by: tino on July 24, 2022, 09:19:41 PM
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.
Title: Re: Hyperlinks not working on Front Page
Post by: @rjen on July 24, 2022, 09:27:10 PM
I can reproduce it, so I can verify the fix
Title: Re: Hyperlinks not working on Front Page
Post by: tino on July 24, 2022, 09:43:39 PM
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.
Title: Re: Hyperlinks not working on Front Page
Post by: tino on July 24, 2022, 09:53:33 PM
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);
      }
Title: Re: Hyperlinks not working on Front Page
Post by: @rjen on July 25, 2022, 08:44:57 AM
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.
Title: Re: Hyperlinks not working on Front Page
Post by: Kokoro on August 06, 2022, 11:12:45 PM
Thank you!  That fixed it great!