PDA

View Full Version : Censorword Chart


Niels vdw
10-31-2001, 10:00 PM
Requested @ https://vborg.vbsupport.ru/showthread.php?s=&threadid=31924

Hey,
this hack allows your members to specify their own list of 'badwords' wich will be blocked within posts.
Note that this only works when Censoring is enabled (In vBulletin Options), if not you won't notice anything from this hack.

First preform this query:
ALTER TABLE user ADD censorlist VARCHAR(250) AFTER ignorelist

Now goto your Admin CP and add a new template called modifyoptions_censor:
<tr>
<td bgcolor="#F1F1F1"><normalfont><b>Words to Censor in a
Thread :</b></normalfont><br>
<smallfont>Words you don't want to view, seperate them by spaces.</smallfont></td>
<td bgcolor="#F1F1F1">
<input type="text" name="censorlist" size="30" maxlength="250" value="$censorlist">
</td>
</tr>

Now find the template modifyoptions (it is in User Option Templates), open it and find:
<select name="umaxposts">
<option value="-1" $postsdefaultselected>Use forum default</option>
$maxpostsoptions
</select>
</smallfont></td>
</tr>

After it add:
$censoroptions

Next open the file member.php and find (line 525):
$templatesused = "modifyoptions_maxposts,modifyoptions_styleset,modi fyoptions_stylecell,usercpnav,modifyoptions";

And replace it with:
$templatesused = "modifyoptions_maxposts,modifyoptions_styleset,modi fyoptions_stylecell,modifyoptions_censor,usercpnav ,modifyoptions";

Again in member.php find:
//MaxPosts by User

And add before:
//Censorlist
if ($enablecensor == 1) {
$censorlist = $bbuserinfo[censorlist];
eval ("\$censoroptions .= \"".gettemplate("modifyoptions_censor")."\";");
}

Still in member.php find:
$DB_site->query("UPDATE user
SET ".$updatestyles."adminemail='$adminemail',
showemail='$showemail',invisible='$invisible',cook ieuser='$cookieuser',
maxposts='".addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
timezoneoffset='".addslashes($timezoneoffset)."',emailnotification='$emailnotification',
startofweek='".addslashes($startofweek)."',options='$options',receivepm='$receivepm',
emailonpm='$emailonpm',pmpopup='$pmpopup',usergrou pid='$bbuserinfo[usergroupid]',
nosessionhash='$nosessionhash'
WHERE userid='$bbuserinfo[userid]'");

And replace it with:
$DB_site->query("UPDATE user
SET ".$updatestyles."adminemail='$adminemail',
showemail='$showemail',invisible='$invisible',cook ieuser='$cookieuser',
maxposts='".addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
timezoneoffset='".addslashes($timezoneoffset)."',emailnotification='$emailnotification',
startofweek='".addslashes($startofweek)."',options='$options',receivepm='$receivepm',
emailonpm='$emailonpm',pmpopup='$pmpopup',usergrou pid='$bbuserinfo[usergroupid]',
nosessionhash='$nosessionhash',censorlist='".addslashes($censorlist)."'
WHERE userid='$bbuserinfo[userid]'");

Now in functions.php add:

// ###################### Start censortext #######################
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ,$bbuserinfo;
< Cutted >
return $text;
}


And the following after it:
// ###################### Start supercensortext #######################
function supercensortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ,$bbuserinfo;
$censorwords .= ' '.$bbuserinfo[censorlist];
if ($enablecensor==1 and $censorwords!="") {
if (!isset($censorword)) {
$censorwords = preg_quote($censorwords);
$censorwords = str_replace('/', '\\/', $censorwords);
$censorword=explode(" ",$censorwords);
} else {
reset($censorword);
}
while (list($key,$val)=each($censorword)) {
if ($val!="") {
if (substr($val,0,2)=="\\{") {
$val=substr($val,2,-2);

$text=trim(preg_replace("/([^A-Za-z])".$val."(?=[^A-Za-z])/si","\\1".repeatchar($censorchar,strlen($val))," $text "));
} else {
$text=trim(preg_replace("/$val/si",repeatchar($censorchar,strlen($val))," $text "));
}
}
}
}
return $text;
}


Finally in functions.php find:
return censortext($bbcode);

And replace it with:
return supercensortext($bbcode);

You can always reread it at http://www.vanderwildt.com/~vbulletin/personcensor.htm
It is tested, i cannot give you a demo as our boards aren't public yet, sorry

damicatz
11-01-2001, 11:15 PM
Cool hack, I'll have to install it later

On another note, out of curiosity, are you The Niels that makes OpenBB?

Syphin
11-01-2001, 11:33 PM
cool hack... ^^ Ill install it in a little bit.. Good idea... :p


-Syphin

damicatz
11-02-2001, 12:25 AM
EDIT : Minor Modifications

Wierd

I think I found another bug in vBulletin, it changes first alt color with brackets to some wierd color.

Anyways


<tr>
<td bgcolor="{ firstaltcolor }"><normalfont><b>Words to Censor in a
Thread :</b></normalfont><br>
<smallfont>Words you don't want to view, seperate them by spaces.</smallfont></td>
<td bgcolor="{ secondaltcolor }">
<input type="text" name="censorlist" size="30" maxlength="250" class="bginput" value="$censorlist">
</td>
</tr>


Notice the spaces between the brackets and firstalt and secondalt color, you should delete the spaces after copying and pasting. For some odd reason vBulletin wants to convery { firstaltcolor } typed like #13486D to whatever color it is on the board it's being posted on.

veedee
11-02-2001, 09:50 AM
Waahoooo

I just found this :)


superb, thanks so much, my code was coming along slowly as was crap.

brilliant ! :)

gmtalk
11-21-2001, 11:09 PM
works well thanks!

Night Owl
11-14-2002, 05:32 AM
Can someone update this for 2.2.8?