PDA

View Full Version : REQUEST: Exemption From Swear Filter?


Amiga-uk
01-09-2004, 02:22 PM
Me again.. heh..

Okay, i havent seen this in vB's options, so please correct me if im wrong, but is there a way to get it so certain individual forums arent included in the swear filter?

Would i have to modify code?

Please help.. :)

MindTrix
01-09-2004, 02:50 PM
Dont believe this is an option, would end up beeing a PHP edit as you said :)

Amiga-uk
01-09-2004, 07:39 PM
Right, thought so..

Any idea how/which files? :)

Amiga-uk
01-10-2004, 02:46 PM
pleaaaaaaaaaase? *sweet smile*

MindTrix
01-10-2004, 03:38 PM
Ill take a look and see if i can do anything :)

Amiga-uk
01-10-2004, 05:08 PM
Thanks much ^_^

Amiga-uk
01-11-2004, 09:17 PM
This site gets posts way too fast..

x.x

Any help?

MindTrix
01-11-2004, 09:25 PM
i been working on this ALL day, im getting somewhere, afraid you might have to be patient on this one :)

Amiga-uk
01-12-2004, 09:03 PM
Alright, thanks for workin on it ^_^

:)

NTLDR
01-12-2004, 09:53 PM
Seeing as I did this totaly wrong the first time ;) This should exempt forums from the censor as per the request.

In includes/functions.php find:


function fetch_censored_text($text)
{
global $vboptions;
static $censorwords;



Replace with (change X, Y, Z to your forumids seperated by commas):


function fetch_censored_text($text)
{
global $vboptions, $foruminfo;
static $censorwords;

if (!empty($foruminfo['forumid'] && in_array($foruminfo['forumid'], array(X, Y, X))) {
return $text;
}

Boofo
01-12-2004, 09:54 PM
But won't it still get filtered out when someone else reads the message?

NTLDR
01-12-2004, 09:56 PM
Very good point Boofo *lmao* I'll go edit that code now ;)

MindTrix
01-12-2004, 09:57 PM
Yeah but the request was to stop certain FORUMS getting censored, not users.

NTLDR
01-12-2004, 10:00 PM
As I also noticed and changed :P

MindTrix
01-12-2004, 10:01 PM
Ah ok, but please check post 8 in this thread :)

NTLDR
01-12-2004, 10:04 PM
I thought I'd whip something up as I knew I could do it pretty quicky ;) Continue working on your version and then release it, I've not even tested mine :)

MindTrix
01-12-2004, 10:06 PM
Not much point if you just did it :)

Oh well back to the drawing board, cheers for doing it for me :)

Boofo
01-12-2004, 10:20 PM
But isn't there a way to exempt the admin from censorship in every forum no matter who reads it?

NTLDR
01-12-2004, 10:23 PM
A small adjustment to my old code would have allowed an admin, or other userid/usergroupid to post uncensored.

Boofo
01-12-2004, 10:35 PM
In any forum no matter who reads it? Can you give me the code for that? ;)

NTLDR
01-12-2004, 10:46 PM
This should do it, for posts/pms only, replace the code with (change X to your userid:


function fetch_censored_text($text)
{
global $vboptions, $post;
static $censorwords;

if (!empty($post['userid']) && $post['userid'] == X) {
return $text;
}

Boofo
01-13-2004, 02:09 AM
Thank you, sir. ;) I'll give it a try.

Boofo
01-13-2004, 02:18 AM
It didn't work. It censored the text out. :(

EDIT: Did you give up on this, NTLDR? ;)

NTLDR
01-13-2004, 10:18 AM
Ah, that would be because the post should have already been censored. A more suitable edit would be:

in includes/functions_newpost.php:

Find:

$post['title'] = htmlspecialchars_uni(fetch_censored_text($post['title']));

Replace with:


$post['title'] = htmlspecialchars_uni(iif($bbuserinfo['userid'] != X, fetch_censored_text($post['title']), $post['title']));

Find:

$post['message'] = fetch_censored_text($post['message']);

Replace with:

$post['message'] = iif($bbuserinfo['userid'] != X, fetch_censored_text($post['message']), $post['message']);

Again replacing X with the userid. Note this will only effect new posts due to the nature of the censoring system.

Boofo
01-13-2004, 10:37 AM
That doesn't work either. The words get censored when you go to read the message. :(

Amiga-uk
01-13-2004, 05:47 PM
So.. the first one would remove the filter from one forum? Meaning every usergroup allowed in that forum can see/read the filtered words? Or..?

o.o The topic confused me.. heh

NTLDR
01-13-2004, 06:09 PM
Correct :)

MindTrix
01-13-2004, 06:10 PM
So you've got it all working now NTLDR?

NTLDR
01-13-2004, 06:14 PM
I've not tested any of them. Boofo said the code I did for him didn't work.

MindTrix
01-13-2004, 06:21 PM
Ahh, Welcome to my world :) Then again i been trying totaly different too you.

Boofo
01-14-2004, 03:26 AM
I've not tested any of them. Boofo said the code I did for him didn't work.
I DO appreciate your trying, though. At least you gave it a shot. ;)

NTLDR
01-14-2004, 01:44 PM
I've worked out not why it wasn't working ;) When it parses the vB code (in parse_bbcode2())it runs the censor again regardless, the following is tested and will work ;)

In addition to the other edits I posted, the following are required:

in functions_showthread.php find:

$post['title'] = fetch_censored_text($post['title']);

Replace with:

if ($post['userid'] == X) {
$GLOBALS['no_censor_text'] = true;
} else {
$GLOBALS['no_censor_text'] = false;
$post['title'] = fetch_censored_text($post['title']);
}

in functions_bbcodeparse.php find:

$bbcode = fetch_censored_text($bbcode);

replace with:

if (!$GLOBALS['no_censor_text']) {
$bbcode = fetch_censored_text($bbcode);
}

This removes censoring from posts and post titles on showthread/post only.

Boofo
01-14-2004, 04:33 PM
Can you tell me which posts contain the edits for this? There were quite a few and some didn't work. ;)

NTLDR
01-14-2004, 05:25 PM
This post (https://vborg.vbsupport.ru/showpost.php?p=461754&postcount=24) has the "other half" of the edits :)

MindTrix
01-14-2004, 06:16 PM
NTLDR can i add you to my hate list now? I spent ages on this, and i was sooo going in the wrong direction and definetly doing it wrong!! Doh!! Guess i should stick to tutorials huh ;)

anyways i was only joking bout the hate list ;) Your taking over the site NTLDR, and i like it :)

Boofo
01-14-2004, 06:54 PM
This post (https://vborg.vbsupport.ru/showpost.php?p=461754&postcount=24) has the "other half" of the edits :)
Ok, it seems to work until you edit a message with the word in it. Then it gets censored. Can we fix that, too? And, also, if I wanted to do more than 1 userid, how would I add that?

Excellent job, by the way, my man! ;)

NTLDR
01-14-2004, 07:11 PM
In editpost.php find:

$edit['title'] = fetch_censored_text(fetch_no_shouting_text($edit['title']));

Replace with:


if ($edit['userid'] == X) {
$GLOBALS['no_censor_text'] = true;
$edit['title'] = fetch_no_shouting_text($edit['title']);
} else {
$GLOBALS['no_censor_text'] = false;
$edit['title'] = fetch_censored_text(fetch_no_shouting_text($edit['title']));
}

Find:


$edit['message'] = fetch_censored_text(fetch_removed_sessionhash($edi t['message']));

Replace with:


if ($edit['userid'] == X) {
$edit['message'] = fetch_removed_sessionhash($edit['message']);
} else {
$edit['message'] = fetch_censored_text(fetch_removed_sessionhash($edi t['message']));
}


Find:

$edit['reason'] = htmlspecialchars_uni(fetch_censored_text(trim($_PO ST['reason'])));

Replace with:


if ($edit['userid'] == X) {
$edit['reason'] = htmlspecialchars_uni(trim($_POST['reason']));
} else {
$edit['reason'] = htmlspecialchars_uni(fetch_censored_text(trim($_PO ST['reason'])));
}


Adding extra users is just a case of adding || $varname['userid'] == X (where varname is post or edit depending on the file).

*lmao* @ MindTrix :p

MindTrix
01-14-2004, 07:21 PM
NTLDR why dont you just go release it as a hack :) Sure alot of people would use this.

Boofo
01-14-2004, 07:24 PM
Thank you, sir. I will test it thoroughly and get back to you. ;)

BTW: Shouldn't that last piece of code have a bracket at the bottom of it? ;)

NTLDR
01-14-2004, 07:25 PM
These changes only do certain places, it needs some more work and thought to make it global, although I have some ideas howto do it with less file edits and make work everywhere.

Edit: Yes Boofo it should :) Code edited :) Thanks.

MindTrix
01-14-2004, 07:27 PM
I expect the bracket doesnt need to be there because it is still in the file (Wasnt told to replace it if you look ;) )

MindTrix
01-14-2004, 07:28 PM
But you never said to replace the bracket when saying too find

$edit['reason'] = htmlspecialchars_uni(fetch_censored_text(trim($_PO ST['reason'])));

NTLDR
01-14-2004, 07:30 PM
I think he ment Brace (a closing }), which is what I missed in the code.

MindTrix
01-14-2004, 07:32 PM
god damn bugs!!!

NTLDR
01-14-2004, 08:18 PM
Heres a much better version which seems to work in the most common areas with only one file edit:

Find:


function fetch_censored_text($text)
{
global $vboptions;
static $censorwords;


Add after:


switch(THIS_SCRIPT) {

case 'editpost':
$uservar = &$GLOBALS['postinfo'];
break;
case 'private':
$uservar = &$GLOBALS['pm'];
break;
case 'showthread':
case 'showpost':
$uservar = &$GLOBALS['post'];
break;
case 'newthread':
$uservar = &$GLOBALS['bbuserinfo'];
break;
case 'newreply':
$uservar = &$GLOBALS['post'];
break;
}

if ($uservar['userid'] == 1 || (THIS_SCRIPT == 'newreply' && ($uservar['userid'] == 1 || $GLOBALS['bbuserinfo']['userid'] == 1)) || (THIS_SCRIPT == 'private' && ($uservar['fromuserid'] == 1 || $GLOBALS['bbuserinfo']['userid'] == 1))) {
return $text;
}

Boofo
01-14-2004, 09:56 PM
The editpost code doesn't work. On an edit the word is censored.

NTLDR
01-14-2004, 10:01 PM
My improved single edit one definitely works for the edit screen.

Boofo
01-14-2004, 10:03 PM
Ok, so go back and undo the other code and try this one, right? ;)

NTLDR
01-14-2004, 10:07 PM
That one is much better though ;) *Should* work correctly on newreply/thread/editpost/showthread/pm's etc. I tested it on my board, but only having one user and and two posts limited the testing.

Boofo
01-14-2004, 10:19 PM
LOL Well, the editpost works great! But the newreply censors the text. I had to go into edit mode and type the word back in and then it stayed. We're close though. ;)

Now what? ;)

NTLDR
01-14-2004, 10:28 PM
I've edit the origional code and testing again, lets hope this time we're lucky ;)

Boofo
01-14-2004, 10:30 PM
You can't use the new code? It seems to work great for the editpost. ;)

NTLDR
01-14-2004, 10:33 PM
I ment the origional post with the new code ;)

https://vborg.vbsupport.ru/showpost.php?p=462508&postcount=45 (I updated the replace code with the edit to make it work correctly).

Boofo
01-14-2004, 11:06 PM
And we have a WINNER!!!!! It seems to work great so far. I'll play with it and see if I can break it for you. ;)

Will this cover user notes and annoncements, too? You might as well go all out. ;)

And adding another admin or a couple of mods to this would be done how? ;)

NTLDR
01-15-2004, 10:00 AM
Announcements and usernotes, now I knew there were some places I forgot ;)

As for adding users I knew that was coming ;) You need to modify that ridiculously long if statement I'd suggest creating an array before that code and changing the if statement to check if the userid is in the array:


$uids = array(1, 2, 3);

// my switch statement here

if (in_array($uservar['userid']), $uids) ......


I'll lookm into the announcements and notes later and see if I can makethe if statement a bit easier :)

Boofo
01-15-2004, 10:26 AM
Thank you, sir. And this time, it works great! I surprised the wife earlier tonight in an email (nothing too bad) but needless to say, she was shocked that I could bypass trhe censor, when she couldn't. ;)Once we get this all tweaked out and thoroughly tested, you ought to release this as a hack. I'm sure there are many who would find it useful, to some degree or another. ;)

NTLDR
01-15-2004, 07:55 PM
SHould work for announcements and usernotes now. Change the $uids array to contain comma seperated userids who can bypass the censor.

$uids = array(1);

switch(THIS_SCRIPT) {

case 'editpost':
$uservar = &$GLOBALS['postinfo'];
break;
case 'private':
$uservar = &$GLOBALS['pm'];
break;
case 'showthread':
case 'showpost':
case 'announcement':
case 'usernote':
$uservar = &$GLOBALS['post'];
break;
case 'newthread':
$uservar = &$GLOBALS['bbuserinfo'];
break;
case 'newreply':
$uservar = &$GLOBALS['post'];
break;
}

if (in_array($uservar['userid'], $uids) || (THIS_SCRIPT == 'newreply' && (in_array($uservar['userid'], $uids) || in_array($GLOBALS['bbuserinfo']['userid'], $uids))) || (THIS_SCRIPT == 'private' && (in_array($uservar['fromuserid'], $uids) || in_array($GLOBALS['bbuserinfo']['userid'], $uids)))) {
return $text;
}

Boofo
01-15-2004, 08:14 PM
There you go. Now it is all set for 1 or more userids. Very flexible now. ;) I will run it through the drill and let you know how it goes. But I have a feeling that this is going to be gold. ;)

Boofo
01-19-2004, 04:54 AM
We missed one other place. When I do a search for all my posts, it censors the text in the lisiting in the search.php. ;)

NTLDR
01-19-2004, 01:58 PM
$uids = array(1);

switch(THIS_SCRIPT) {

case 'editpost':
$uservar = &$GLOBALS['postinfo'];
break;
case 'private':
$uservar = &$GLOBALS['pm'];
break;
case 'showthread':
case 'showpost':
case 'announcement':
case 'usernote':
case 'search':
case 'newreply':
$uservar = &$GLOBALS['post'];
break;
case 'newthread':
$uservar = &$GLOBALS['bbuserinfo'];
break;
}

if (in_array($uservar['userid'], $uids) || (THIS_SCRIPT == 'newreply' && (in_array($uservar['userid'], $uids) || in_array($GLOBALS['bbuserinfo']['userid'], $uids))) || (THIS_SCRIPT == 'private' && (in_array($uservar['fromuserid'], $uids) || in_array($GLOBALS['bbuserinfo']['userid'], $uids)))) {
return $text;
}

^^ Should now apply to search results too :)

Boofo
01-19-2004, 05:30 PM
Thank you, sir. I'm off to do some more testing. ;)

chrisvonc
04-02-2004, 03:09 PM
Hey gang, I am more than a little confused with this thread. :)

What did this end up becoming? Is this still per forum based or now user? Could someone make a clean post of directions on how to apply it or did it every get released as a hack? :)

I was asking in another thread for a way to allow admin only use of the IMG code in vB3. I was using censorship exemption for admins on my 2.3.2 forum and would need to have a similar solution when I upgrade my production forum to VB3.

Thanks in advance!

Chris

Boofo
04-02-2004, 03:17 PM
It is userid based at present.

chrisvonc
04-02-2004, 03:54 PM
OK, I'm an idiot... plain and simple. Sitting here crushing crackers in my soup and just realized that in all the forums I want to use the IMG code in, that I am the only one with permissions to post in those forums to begin with so the point is moot as I can simply leave IMG on for those sections.

Urrghh.... Old age.

Boofo
04-02-2004, 04:08 PM
How old?

chrisvonc
04-02-2004, 04:42 PM
Physically 39 this year, act like 13, memory like 97 sometimes... I know, not as old as you yet, but you can still code at least. :)

Boofo
04-02-2004, 04:58 PM
LOL My coding skills are very limited. I just get lucky with a lot of help from the guys here. ;) And I WISH I could remember being 39 again. :(

chrisvonc
05-08-2004, 02:17 AM
Revisiting this one.. I found I would like to give admins and mods the ability to have a site graphic in their signatures so maybe I can try this.

However, I still am a bit lost... Is post #45 (https://vborg.vbsupport.ru/showpost.php?p=462508&postcount=45) the golden code now and if so, where should one edit this? Also how would I add multiple groups to be included?

Thanks in advance! :)

Chris

ImportPassion
05-19-2004, 03:34 PM
i need this too. what's up with it?

chrisvonc
05-28-2004, 11:10 AM
Pretty please with sugar on top... can someone sort this one out and tell what the final code ended up being?

ImportPassion
05-28-2004, 11:11 AM
not exactly sure what u need, but https://vborg.vbsupport.ru/showthread.php?&threadid=65343

xplane
07-26-2004, 10:11 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=65343&highlight=censor" target="_blank">https://vborg.vbsupport.ru/showt...ghlight=censor</a>

SFishy
12-29-2004, 03:29 AM
https://vborg.vbsupport.ru/showthread.php?t=65343&highlight=censor
Bumping up an old post, I know... and maybe the answer is right in front of me and I'm missing it --

https://vborg.vbsupport.ru/show...&threadid=65343
Looks great -- but instead of a specific forum, I want to turn censoring off in user notes.

Help?

SFishy
12-29-2004, 04:18 PM
SHould work for announcements and usernotes now. Change the $uids array to contain comma seperated userids who can bypass the censor.

$uids = array(1);

switch(THIS_SCRIPT) {

case 'editpost':
$uservar = &$GLOBALS['postinfo'];
break;
case 'private':
$uservar = &$GLOBALS['pm'];
break;
case 'showthread':
case 'showpost':
case 'announcement':
case 'usernote':
$uservar = &$GLOBALS['post'];
break;
case 'newthread':
$uservar = &$GLOBALS['bbuserinfo'];
break;
case 'newreply':
$uservar = &$GLOBALS['post'];
break;
}

if (in_array($uservar['userid'], $uids) || (THIS_SCRIPT == 'newreply' && (in_array($uservar['userid'], $uids) || in_array($GLOBALS['bbuserinfo']['userid'], $uids))) || (THIS_SCRIPT == 'private' && (in_array($uservar['fromuserid'], $uids) || in_array($GLOBALS['bbuserinfo']['userid'], $uids)))) {
return $text;
}


I know this is an old post, and I HOPE someone will look at it, but I just tried this on version 3.0.3 and it works good EXCEPT the usernotes. My usernotes are still being censored.