News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[4905] Extra Signature Space Bug

Started by RayRay26, August 13, 2011, 04:33:36 PM

Previous topic - Next topic

RayRay26

I found out that you can go above 500 characters in your signature for one edit. I had an urge to see if you could just remove part of a Simple Machines url and see if it worked like any url. It's temporary though, leaving you with having to redo some stuff. It has to be a Simple Machines forum (or the forum you are on) url though.
That's because it adds back in http://www.simplemachines.org/community/index.php into your signature, BUT it doesn't delete any of the extra at the end, leaving you with an extended signature. (if you edit your sig again, you'll see the extra text is already deleted, but that doesn't mean it's gone (until you update again as it is))

I did do a search on this board about this and didn't find it.

emanuele

Hi RayRay26!

Thanks for the report.
Could you please explain what do you mean with "the extra at the end"? (a screenshot would be useful)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

* emanuele sometime is completely blind...or simply doesn't read everything... :P

Now I got it.
Yes, I think it can be considered a bug.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Illori


emanuele

#4
Looking into this.

The simplest way to fix it I can think of is to...preparse it twice...

Code (find) Select
// Too long?
if (!empty($sig_limits[1]) && $smcFunc['strlen']($unparsed_signature) > $sig_limits[1])
{
$_POST['signature'] = trim(htmlspecialchars($smcFunc['substr']($unparsed_signature, 0, $sig_limits[1]), ENT_QUOTES));


Code (replace with) Select

// Lenght is something particular...unfortunately...
$unparsed_signature_length = $unparsed_signature;
preparsecode($unparsed_signature_length);
$unparsed_signature_length = str_replace('<br />', "\n", $unparsed_signature_length);

// Too long?
if (!empty($sig_limits[1]) && $smcFunc['strlen']($unparsed_signature_length) > $sig_limits[1])
{
$_POST['signature'] = trim(htmlspecialchars($smcFunc['substr']($unparsed_signature_length, 0, $sig_limits[1]), ENT_QUOTES));


I'm wondering if it is worth.

Opinions?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Spuds

Not sure if this is a bug or a tip / trick

Seems like a pretty narrow case, if I'm reading it right,  where it has to be a forum link that SMF knows to 'fix' the link to cause the overflow on the save.  I don't think its worth the fix, especially since its a bit ugly  :D

emanuele

Let's say there are other cases (like /me and most likely img in certain conditions, etc.).

Yes, the fix workaround is a bit ugly.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

Much cleaner version:
}

preparsecode($value);
// Too long?
if (!allowedTo('admin_forum') && !empty($sig_limits[1]) && $smcFunc['strlen'](str_replace('<br />', "\n", $value)) > $sig_limits[1] && !)
{
$_POST['signature'] = trim(htmlspecialchars(str_replace('<br />', "\n", $value), ENT_QUOTES));
$txt['profile_error_signature_max_length'] = sprintf($txt['profile_error_signature_max_length'], $sig_limits[1]);
return 'signature_max_length';
}
return true;
}


moved the length check at the end (not shortened because there is javascript client side that will do).


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Spuds


emanuele

Speaking of which, I have always found pretty annoying the javascript that cuts out the last bit of the signature when is too long.
Wouldn't be much nicer and less destructive a red border around the box and an error box at the top?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: