Hmm, that is true. So we would need a more complex function to accept HTML tags from ALL users. However, assuming that your staff are OK with HTML, and not interested in breaking things, it would be OK to use the above stripMostTags() functions in scp/profile.php to allow staff signatures to include HTML?
Yeah, sure. If you feel comfortable with it, go for it. I'm not saying it's a bad idea. Heck, it's something we're going to support soon. I'm just saying that if you're going to allow everyone to do it, there are more things to consider than just using strip_tags(), because even if you strip out scripts and solve the security issues, ill-formatted markup and in-line CSS can still muck up the way things display.
Alternatively, you make use of fancy bracketted tags (such as the tags used in this forum) to give users options.
Yep, but the only real advantage I see to this is that there are a lot of BBCode parsing functions out there already to draw from so it might be a little easier to implement securely if your regex-fu isn't all-powerful (also, the format feels a bit 'friendlier' to some users). In my personal opinion, I don't think one is necessarily better than the other.
I guess you still have the issue of checking for properly closed tags... Would wrapping it all in < pre>< /pre> address this?
Not really... besides, then you're screwing up line wrapping, too.
Is it possible to do something like:
$html = preg_replace("<STRONG><s>**</s>...<e>**</e></STRONG>", "<b>...</b>", $html);
???
Sure, but you can do the same with HTML. It's just regex matching, either way you look at it. This would be a better alternative than strip_tags() (or possibly used in conjunction with it), since it would only match on complete tag pairs. Mind you, you also have to consider nested tags and you'd want to strip out tag attributes.
The regex pattern/s for that is more than I can wrap my brain around, I'm afraid, but yeah, it could be done... Hey, I just design/build the UI. ;)