Gossamer Forum
Home : Products : DBMan : Customization :

Re: [Watts] bold predefined words in textarea field

Quote Reply
Re: [Watts] bold predefined words in textarea field In reply to
I found a way to do it! Using JPdeni's dirty word filter mod, I made a few changes to it and it works! Here is what I did in case anyone is interested:

Installed everything in the mod according to directions.

Made these changes (marked in bold):

Quote:


# Censor dirty words
# 0 = do not censor
# 1 = reject records that contain any of the words
# 2 = replace words with ***
# 3 = replace the middle letters with *s, as in "f**k" "a*****e" "c********r"
# 4 = replace vowels with *s, as in "f*ck" "*ssh*l*" "c*cks*ck*r"
# 5 = replace words with the first letter of the word and * for the other letters, as in f*** a******, c*********
# 6 = replace each letter with a *, as in **** ******* **********
$db_censor = 2;

## You can edit the @dirty_words list however you want. Just be sure to put
## single quotes around each word, keep the list all on one line, and be sure they
## are in lower case.
# Dirty word list
@dirty_words = ('rainbow','Rainbow');


censor routine

if ($db_censor) {
foreach $dirty_word (@dirty_words) {
if (lc($in{$col}) =~ /$dirty_word/) {
if ($db_censor == 1) {
push(@input_err, "$col (Includes a banned word -- $dirty_word)");
}
else {
if ($db_censor == 2) { $replace = "<b>Rainbow</b>"; }
elsif ($db_censor == 3) {
$replace = substr($dirty_word,0,1).("*" x (length($dirty_word)-2)).substr($dirty_word,length($dirty_word)-1,1);
}
elsif ($db_censor == 4) {
$replace = $dirty_word; $replace =~ s/a|e|i|o|u/\*/ig;
}
elsif ($db_censor == 5) {
$replace = substr($dirty_word,0,1).("*" x (length($dirty_word)-1));
}
else {
$replace = ("*" x (length($dirty_word)));
}
$in{$col} =~ s/$dirty_word/$replace/ig;
}
}
}
}


Just a couple of easy changes. I still have to modify all of the forms so that it will change them all to bold, but from here on out, any time any of the records are modified, it will bold them.

Thanks for the suggestions Watts! Sly


DBMan SQL Version 1 mods available at:
http://dbmansqlmods.rainbowroomies.com
(Mods based on JPDeni's original mods.)
Subject Author Views Date
Thread bold predefined words in textarea field shann123 4330 Nov 22, 2003, 11:52 AM
Thread Re: [shann123] bold predefined words in textarea field
shann123 4253 Nov 26, 2003, 2:15 AM
Thread Re: [shann123] bold predefined words in textarea field
Watts 4232 Nov 26, 2003, 7:50 AM
Thread Re: [Watts] bold predefined words in textarea field
shann123 4242 Nov 26, 2003, 8:00 AM
Thread Re: [shann123] bold predefined words in textarea field
Watts 4224 Nov 26, 2003, 11:25 AM
Thread Re: [Watts] bold predefined words in textarea field
shann123 4221 Nov 26, 2003, 11:30 AM
Thread Re: [shann123] bold predefined words in textarea field
Watts 4234 Nov 26, 2003, 2:05 PM
Post Re: [Watts] bold predefined words in textarea field
shann123 4216 Nov 27, 2003, 8:18 AM