TinyPortal

Development => Support => Topic started by: Kim on March 04, 2021, 12:03:05 AM

Title: Shoutbox character limit
Post by: Kim on March 04, 2021, 12:03:05 AM
Hi
I am trying to increase the character limit in the shoutbox but no matter what value I put in the box, it doesn't increase and stays at 300 
What am I doing wrong?  :hmm: :doh:
Thanks for any help
Title: Re: Shoutbox character limit
Post by: lurkalot on March 04, 2021, 12:24:36 AM
Hi Kim.  What version of SMF and TinyPortal are you running please?

I think 300 is the maximum allowed without modifying the code. There should I guess be a note added to that setting stating this to save confusion.
Title: Re: Shoutbox character limit
Post by: Kim on March 04, 2021, 02:06:54 AM
I'm running SMF 2.0.17 and TP 1.6.4

How do alter the code please?
Title: Re: Shoutbox character limit
Post by: lurkalot on March 04, 2021, 07:37:50 AM
Kim you should really upgrade because there was security issues with TinyPortal prior to versions older than 1.6.6

But in answer to your question,  In sources find file TPShout.php

Around line 175 you should find,

$shout = $smcFunc['htmlspecialchars'](substr($_POST['tp_shout'], 0, 300));

Change the 300 on the end of that line to 500 and save
Title: Re: Shoutbox character limit
Post by: Kim on March 04, 2021, 05:30:15 PM
Thank you and I'll upgrade asap  O0
Title: Re: Shoutbox character limit
Post by: @rjen on March 07, 2021, 07:38:14 PM
The 300 characters max surprised me a little: we have a setting for it, never realized that there is also a maximum coded. I think it will update that to use the maxlength setting from the shoutbox
Title: Re: Shoutbox character limit
Post by: lurkalot on March 07, 2021, 08:11:47 PM
Well to be honest I wasn't sure if the hard coded limit was still supposed to be there since you can enter any number in the shout settings.  But that limit has been in the code for a long time tbh. 
Title: Re: Shoutbox character limit
Post by: @rjen on March 07, 2021, 08:15:03 PM
Just checked it: you can use any number in the settings, but due to the hard-coded 300 it will always stop at 300, even if the setting is set higher...
Title: Re: Shoutbox character limit
Post by: lurkalot on March 07, 2021, 09:08:50 PM
Quote from: @rjen on March 07, 2021, 08:15:03 PM
Just checked it: you can use any number in the settings, but due to the hard-coded 300 it will always stop at 300, even if the setting is set higher...

Yep, that's why I mentioned the workaround edit to the line above.  Pretty sure changing that line worked for me when I tried it. 
Title: Re: Shoutbox character limit
Post by: @rjen on March 07, 2021, 09:10:01 PM
Fixed it for 2.1.0
Title: Re: Shoutbox character limit
Post by: lurkalot on March 07, 2021, 09:12:18 PM
Quote from: @rjen on March 07, 2021, 09:10:01 PM
Fixed it for 2.1.0

Cool, thanks @rjen.