TinyPortal

Development => Block Codes => Topic started by: Thurnok on February 03, 2007, 09:05:27 AM

Title: [Hack] Censor TP Shoutbox
Post by: Thurnok on February 03, 2007, 09:05:27 AM
This hack will let you provide a "censorable" shoutbox experience.  This allows you to apply the SMF built-in censor mechanism to the TP Shoutbox both in the regular shoutbox, as well as the "view shouts" of a specific member from that member's profile.  It works the same way the "post" censoring works.  In otherwords, if a member elects to view uncensored posts (from their profile settings), then they also get uncensored shouts.  If they do not bypass the "post" censoring, then shouts are also censored.

Note: The ACP area is not censored.  This means as an Admin, if you look at the Shoutbox settings where you can remove shouts, it is never censored there so you will always see the uncensored version (i.e. what is actually stored in the database) regardless if you are bypassing censoring or not.

First, edit the /Sources/TPortal.php file:
[FIND]

$shouts .= doUBBC($myshout);


[REPLACE WITH]

$shouts .= doUBBC(censorText($myshout));



Next, edit the /Sources/TPmodules.php file:
[FIND]

'shout' => doUBBC($row['value1']),


[REPLACE WITH]

'shout' => doUBBC(censorText($row['value1'])),


Title: Re: [Hack] Censor TP Shoutbox
Post by: Zetan on February 03, 2007, 09:34:42 AM
This hack works a treat..
"Does exactly what it says on the tin" (UK commercial if you have no clue what that meant) ;)
Keeps the ever dutiful company firewall quiet.


Thanks Thurnok




ZTN
Title: Re: [Hack] Censor TP Shoutbox
Post by: TWD on March 07, 2007, 08:19:35 PM
Hey, Thurnok!

Since you're apparently pretty familiar with the workings of SMF's censoring function (and since I've pretty much been ignored on the SMF boards), can you point me to the spots in the code where it is invoked for displaying posts?  I want to disable it an a specific forum.  Was able to accomplish this when I ran a snitz forum with a simple "if forumid<>{specific forum} then {use the cuss filter}

I've discovered that if I give certain of my more "colorful" members access to a hidden forum where they can spew all the profanity they want to, they don't feel the need to do it in the open forums.

Thanks for any help.
Title: Re: [Hack] Censor TP Shoutbox
Post by: Thurnok on March 10, 2007, 10:26:52 AM
Sorry.. been out with a back injury all week - still am actually, but I figured I better catch up on some posts at TP.net... heh

Ok, so you basically want to disable the censor for a certain board?  Or did you want it to be more versatile so you can "flag" certain boards to not run thru the censor?  In other words, are you looking for a block that you can manage boards' censorship settings?  Or do you just want to hard code it for a specific board number?
Title: Re: [Hack] Censor TP Shoutbox
Post by: TWD on March 10, 2007, 04:28:31 PM
I guess ideally it'd be cool to be able to edit a board's settings and disable censorship from there - much like setting permissions, I guess.  In a pinch, however, I'm not against just hard-coding to exclude a specific board.
Title: Re: [Hack] Censor TP Shoutbox
Post by: RoarinRow on March 10, 2007, 05:48:45 PM
dang cool hack!   8)
Title: Re: [Hack] Censor TP Shoutbox
Post by: Thurnok on March 10, 2007, 10:28:05 PM
Ok... I'll look into this as soon as I'm able to sit in my chair for more than 30 minutes at a time.  LOL
Title: Re: [Hack] Censor TP Shoutbox
Post by: bloc on March 11, 2007, 01:44:27 PM
This is actually a great way of censoring the shoutbox. If paired with a on/off setting it can be really useful.
Title: Re: [Hack] Censor TP Shoutbox
Post by: Zetan on March 11, 2007, 02:02:33 PM
I made a request for this in another thread... and Thurnok went off and came up with this.
It's excellent... My company firewall had blocked my site because a member was using offensive language in the shoutbox.
I had to beg the webmaster to unblock the site again.

One of my other members likes to use the word "p***k".. he got a shock when he read back his post and it read "member name is a p***k".
That'll learn ya ;)
Title: Re: [Hack] Censor TP Shoutbox
Post by: RvG on March 11, 2007, 05:10:13 PM
Quote from: Bloc on March 11, 2007, 01:44:27 PM
This is actually a great way of censoring the shoutbox. If paired with a on/off setting it can be really useful.

could be added to default installation perhaps :)
Title: Re: [Hack] Censor TP Shoutbox
Post by: brianjw on March 11, 2007, 05:20:52 PM
Yeah Bloc! Can you make this automatically set to censor the shoutbox. I mean if you have censored words on your website, people want to be able to censor our their shoutbox ;)

DEFAULT

Brianjw :)
Title: Re: [Hack] Censor TP Shoutbox
Post by: bloc on March 11, 2007, 11:09:17 PM
Yes, this will be in 0.9.8.
Title: Re: [Hack] Censor TP Shoutbox
Post by: brianjw on March 11, 2007, 11:17:35 PM
Ok good :)
Title: Re: [Hack] Censor TP Shoutbox
Post by: Thurnok on March 12, 2007, 07:39:55 PM
Quote from: Bloc on March 11, 2007, 01:44:27 PM
This is actually a great way of censoring the shoutbox. If paired with a on/off setting it can be really useful.

Not sure it is necessary for an on/off Bloc.  The function works with the censor parameters already in SMF.  So, if you allow members to turn off word censoring (in the theme settings) and they have censor on, words display in censored form, have censor off, they display as is.  If you disallow users to turn off censoring, then it is displayed in censored form.  All of these of course depend on the admin putting in what words to censor in the ACP.

So, the extra on/off for the shoutbox would seem redundant to me.  It would certainly make it more versatile, but I'm just not sure that an admin would want to censor words in the forum, but not the shoutbox, or vice versa.  Dunno...
Title: Re: [Hack] Censor TP Shoutbox
Post by: brianjw on March 12, 2007, 10:05:07 PM
Quote from: Thurnok on March 12, 2007, 07:39:55 PM
Quote from: Bloc on March 11, 2007, 01:44:27 PM
This is actually a great way of censoring the shoutbox. If paired with a on/off setting it can be really useful.

Not sure it is necessary for an on/off Bloc.  The function works with the censor parameters already in SMF.  So, if you allow members to turn off word censoring (in the theme settings) and they have censor on, words display in censored form, have censor off, they display as is.  If you disallow users to turn off censoring, then it is displayed in censored form.  All of these of course depend on the admin putting in what words to censor in the ACP.

So, the extra on/off for the shoutbox would seem redundant to me.  It would certainly make it more versatile, but I'm just not sure that an admin would want to censor words in the forum, but not the shoutbox, or vice versa.  Dunno...
Thats what I was trying to say before ;) This code should just be added to the TPortal.php as it was told here and that code would be in the files to be put up for download :D

Brianjw
Title: Re: [Hack] Censor TP Shoutbox
Post by: bloc on March 13, 2007, 06:33:56 PM
Yes, I can see that in fact the SMF itself would better off controlling it. :)
Title: Re: [Hack] Censor TP Shoutbox
Post by: Shadow on March 17, 2007, 07:08:00 AM
I put this code on my forum and I don't know how to work it....Can you point me in a correct way to use this....The code is in place all that....
Title: Re: [Hack] Censor TP Shoutbox
Post by: bloc on March 17, 2007, 09:53:46 AM
Its working just fine..but you control it through the censored word section in admin of SMF. So anything you censor in SMF, the shoutbox censors too.
Title: Re: [Hack] Censor TP Shoutbox
Post by: Shadow on March 27, 2007, 08:55:19 PM
THanks Bloc