vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Censorword Chart (https://vborg.vbsupport.ru/showthread.php?t=31990)

Niels vdw 10-31-2001 10:00 PM

Requested @ https://vborg.vbsupport.ru/showthrea...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:
Code:

ALTER TABLE user ADD censorlist VARCHAR(250) AFTER ignorelist
Now goto your Admin CP and add a new template called modifyoptions_censor:
Code:

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

<select name="umaxposts">
<option value="-1" $postsdefaultselected>Use forum default</option>
$maxpostsoptions
</select>
</smallfont></td>
</tr>

After it add:
Code:

$censoroptions
Next open the file member.php and find (line 525):
Code:

$templatesused = "modifyoptions_maxposts,modifyoptions_styleset,modifyoptions_stylecell,usercpnav,modifyoptions";
And replace it with:
Code:

$templatesused = "modifyoptions_maxposts,modifyoptions_styleset,modifyoptions_stylecell,modifyoptions_censor,usercpnav,modifyoptions";
Again in member.php find:
Code:

//MaxPosts by User
And add before:
Code:

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

Still in member.php find:
Code:

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

And replace it with:
Code:

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

Now in functions.php add:
Code:

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

And the following after it:
Code:

// ###################### 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:
Code:

return censortext($bbcode);
And replace it with:
Code:

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

Code:

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


All times are GMT. The time now is 08:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01040 seconds
  • Memory Usage 1,744KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (15)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete