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
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