Text formatter differences

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.2.x. If you need support for phpBB 3.2.x please visit the 3.2.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
User avatar
RMcGirr83
Registered User
Posts: 357
Joined: Fri Mar 09, 2007 1:51 am
Contact:

Text formatter differences

Post by RMcGirr83 »

Morning,

I have an extension and when testing it am presented with an issue. In 3.1.x the extension would post into a designated forum and look like this
319.jpg
in 3.2 though it looks like this
32.jpg
The issue is that the name, while being generated using get_username_string function isn't being parsed in 3.2 as it was in 3.x.

This is how the name is being stored in the db in 3.2

Code: Select all

<a href="./memberlist.php?mode=viewprofile&u=2" style="color: #AA0000;" class="username-coloured">Admin</a>
and how it's being stored in 3.1.x

Code: Select all

<a href="./../memberlist.php?mode=viewprofile&u=2" style="color: #AA0000;" class="username-coloured">admin</a>
the < is being changed to a <, similarly the > is being changed to a >

I am not sure if I need to apply something to the extension or what. Any advice would be appreciated.
Do not hire Christian Bullock he won't finish the job and will keep your money

User avatar
3Di
Registered User
Posts: 772
Joined: Tue Nov 01, 2005 9:50 pm
Location: Milano (I) Frankfurt (D)
Contact:

Re: Text formatter differences

Post by 3Di »

Same here using submit_post function while porting an extension to RHEA.

I used html_entity_decode prior to pass the variable to generate_text_for_storage

Code: Select all

		$topic_title_plain = html_entity_decode($topic_title, ENT_QUOTES, 'UTF-8');
		$topic_content_plain = html_entity_decode($topic_content, ENT_QUOTES, 'UTF-8');
Not sure if this is the more elegant way to solve the issue but works just fine.
Last edited by 3Di on Sat May 21, 2016 12:09 pm, edited 1 time in total.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
david63
Registered User
Posts: 291
Joined: Mon Feb 07, 2005 7:23 am
Location: Lancashire, UK

Re: Text formatter differences

Post by david63 »

Thanks Rich - I have exactly the same problem with one of my extensions.

I have tried manually creating it, replacing various characters - all to no avail.
David
Remember: You only know what you know -
and you do not know what you do not know!

User avatar
3Di
Registered User
Posts: 772
Joined: Tue Nov 01, 2005 9:50 pm
Location: Milano (I) Frankfurt (D)
Contact:

Re: Text formatter differences

Post by 3Di »

^^ see above david..
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

User avatar
RMcGirr83
Registered User
Posts: 357
Joined: Fri Mar 09, 2007 1:51 am
Contact:

Re: Text formatter differences

Post by RMcGirr83 »

I am actually using the message parser instead of generate text for storage. When I do a var_dump after $message_parser->parse the output looks fine but it somehow gets translated into html characaters when inserted into the database.

Using html_entity_decode on $message_parser->message the post is stored as

Code: Select all

<r><B><s>[b]</s>Name:<e>[/b]</e></B> <a href="./memberlist.php?mode=viewprofile&u=2" style="color: #AA0000;" class="username-coloured">Admin</a><br/>
<B><s>[b]</s>Email Address:<e>[/b]</e></B> <EMAIL email="me@me.com">me@me.com</EMAIL><br/>
<B><s>[b]</s>IP:<e>[/b]</e></B> 127.0.0.1<br/>
<B><s>[b]</s>Reason:<e>[/b]</e></B> test<br/>
<B><s>[b]</s>Subject:<e>[/b]</e></B> testing<br/>
<B><s>[b]</s>Has entered the following message into the contact form:<e>[/b]</e></B><QUOTE><s>[quote]</s> just a test<e>[/quote]</e></QUOTE></r>
but displays as
Noname.jpg
the entire a href tag is completely removed from the data upon display. :roll:

Guess I'll stop for now and go mow the grass.
Do not hire Christian Bullock he won't finish the job and will keep your money

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 367
Joined: Thu Sep 16, 2004 9:02 am
Contact:

Re: Text formatter differences

Post by Paul »

You should use BBCode instead of HTML in posts.

User avatar
RMcGirr83
Registered User
Posts: 357
Joined: Fri Mar 09, 2007 1:51 am
Contact:

Re: Text formatter differences

Post by RMcGirr83 »

Hi Paul, how would you suggest I pass a username link using bbcode?
Do not hire Christian Bullock he won't finish the job and will keep your money

User avatar
david63
Registered User
Posts: 291
Joined: Mon Feb 07, 2005 7:23 am
Location: Lancashire, UK

Re: Text formatter differences

Post by david63 »

RMcGirr83 wrote:
Sat May 21, 2016 3:56 pm
Hi Paul, how would you suggest I pass a username link using bbcode?
I would be interested to know that as well
David
Remember: You only know what you know -
and you do not know what you do not know!

User avatar
JoshyPHP
Registered User
Posts: 367
Joined: Fri Jul 08, 2011 9:43 pm

Re: Text formatter differences

Post by JoshyPHP »

Have you tried just using BBCodes? Generally I would advise against modifying the data that's stored in the database.

Code: Select all

[url=./memberlist.php?mode=viewprofile&u=2][color=#AA0000]Admin[/color][/url]

User avatar
RMcGirr83
Registered User
Posts: 357
Joined: Fri Mar 09, 2007 1:51 am
Contact:

Re: Text formatter differences

Post by RMcGirr83 »

I'll give that a try. FWIW, I'm not trying to modify the data that's stored in the database. I'm trying to get the data that is stored in the database to parse correctly.
Do not hire Christian Bullock he won't finish the job and will keep your money

Post Reply