[ciapug] Moderating message forums
Dave J. Hala Jr.
dave at 58ghz.net
Thu May 18 13:07:01 CDT 2006
Yummy, Yummy... That's a nice a little snippet... thanks!
On Thu, 2006-05-18 at 13:00, Tony Bibbs wrote:
> Here's the snippet I was referring to. The first three variables define
> settings for the function:
>
> $_CONF['censormode'] = 1;
> $_CONF['censorreplace'] = '*censored*';
> $_CONF['censorlist'] = array('firstbadword','secondbadword','etc');
>
> function COM_checkWords( $Message )
> {
> global $_CONF;
>
> $EditedMessage = $Message;
>
> if( $_CONF['censormode'] != 0 )
> {
> if( is_array( $_CONF['censorlist'] ))
> {
> $Replacement = $_CONF['censorreplace'];
>
> switch( $_CONF['censormode'])
> {
> case 1: # Exact match
> $RegExPrefix = '(\s*)';
> $RegExSuffix = '(\W*)';
> break;
>
> case 2: # Word beginning
> $RegExPrefix = '(\s*)';
> $RegExSuffix = '(\w*)';
> break;
>
> case 3: # Word fragment
> $RegExPrefix = '(\w*)';
> $RegExSuffix = '(\w*)';
> break;
> }
>
> for( $i = 0; $i < count( $_CONF['censorlist']); $i++ )
> {
> $EditedMessage = eregi_replace( $RegExPrefix .
> $_CONF['censorlist'][$i] . $RegExSuffix, "\\1$Replacement\\2",
> $EditedMessage );
> }
> }
> }
>
> return $EditedMessage;
> }
>
>
>
> James Loghry wrote:
> > If you're using PHP, you may want to set up a simple regular
> > expression(s) for filtering the content. Using the preg_replace()
> > method in PHP or one of its counter-parts, you can specify an array of
> > both "bad words" as well as "good words" to replace the profanity with.
> >
> > The manual for preg_replace() can be found here:
> > http://us2.php.net/manual/en/function.preg-replace.php.
> >
> > Many other languages including Perl and Java for starters support
> > regex's as well.
> >
> > As for a list of words to filter.. I might suggest checking out an
> > installation of phpBB or other suitable message board programs, and
> > looking through the config files or database.
> >
> >
> > Dave J. Hala Jr. wrote:
> >> On Thu, 2006-05-18 at 10:51, Tony Bibbs wrote:
> >>
> >>> I can't help with a list of words but could probably give you snippets
> >>> that I wrote that does this in Geeklog.
> >>>
> >>> Just a bit of semantics though, when you say moderate to me that means
> >>> having an administrator explicitly approve something before it's visible
> >>> publicly. Is that what you mean or are we really talking about content
> >>> filtering? Content filtering in Geeklog handles both profanity but
> >>> other stuff too like allowable HTML, etc.
> >>>
> >>>
> >> I guess that maybe "moderate" isn't the best word. I'd like to come up
> >> with a way to eliminate and/or filter the profanity and flag any posts
> >> that could potentially create any issues. I'd like to make the system
> >> as automated as possible without me having to read and "approve" a ton
> >> of posts. If I could automate most of the grunt work (profanity, etc.)
> >> I could spend my time on the tough issues.
> >>
> >>
> >> I've been googling, and it looks like the profane list words is fairly
> >> small. However "phrases" could be an issue. ..
> >>
> >>
> >>
> >>
> >>> --Tony
> >>>
> >>> Dave J. Hala Jr. wrote:
> >>>
> >>>> I'm working on a *very* simple message forum project. Basically you post
> >>>> a message, and then people can post comments etc. You know the drill.
> >>>>
> >>>> Anyway, I'm mulling over the "moderating" issue. One thing I want to
> >>>> spend some time on is the issue of profanity. What I'd like to do is
> >>>> substitute a string of characters for certain words. I might even do
> >>>> something silly like substitute in <radio edit> for each profanity..
> >>>>
> >>>> I'm looking for a list of profanities that I could import into a table.
> >>>>
> >>>> Anyone know where to look? Anyone have any thoughts on writing the
> >>>> moderating code? Its important to keep it as simple as possible.
> >>>>
> >>>>
> >>>> :) Dave
> >>>>
> >>>>
> >>> _______________________________________________
> >>> ciapug mailing list
> >>> ciapug at cialug.org
> >>> http://cialug.org/mailman/listinfo/ciapug
> >>>
> >
> >
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
--
Open Source Information Systems, Inc. (OSIS)
Dave J. Hala Jr., President <dave at osis.us>
641.485.1606
More information about the ciapug
mailing list