Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-09-2009, 09:16 PM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Advanced Text Filter.

Ok, here is the situation.

A while ago, i noted much lacking features in two key parts of the vb admin cp. One being ip banning, the other text filtering. I went ahead and created a ip ban manager and have always intended to create a matching text filter manager. However, i've never really had the time and its not really that important to me as we barely use text filters on my forum.

Anyway, i did do a little work on some algorithms and have a feature list in mind. As I dont want this work to goto waste and feel that many people would find this useful, i'm going to release my work here in the hope that someone with more time/motivation than me will be able to release a working product.

Features
Separate out from current settings based text field into its own database table.
Have a form for adding and editing text bans.
List ban and setter in a useful list.

(for the above features, take a look at my advanced ip bans mod for a 'feel' of how it should work and feel free to reuse any of the code contained within it)

Options available to admin:
*Straight ban - works the same as currently
*BBcode avoiding ban - see code at bottom of post
*regex ban - ban against a regular expression
*regex bbcode avoiding ban - this is a combination of the above.

Code
http://www.imhotek.net/regexpban.php For example

You may make use of the following and any code found in the advanced IP ban management mod (https://vborg.vbsupport.ru/showthread.php?t=186342) but you should comment any sections based on my code with this line: "Based on original code by: Christopher Riley (Carnage) http://www.giveupalready.com" The mod should be released in full for free on vbulletin.org and its release thread should also credit me for the contributed code.

PHP Code:
<?php

/* This code provides the basis of an algorithm which matches against a string, regardless of any bbcode that might be in the way.
It starts by stripping bbtags from the string, then matches the words. Then it censors out the correct characters in the original
string.

Original code by: Christopher Riley (Carnage) http://www.giveupalready.com
*/

$string "some text ++++ f[b]uck[/b] some more text ++++ [b]++++[/b] ++++ extra text<br />";
echo 
"String = " $string;
$ban "++++";

$new_array $original_array preg_split("//",$string);

preg_match_all("#\[/?[a-z0-9=]+\]#i",$string,$processing_array,PREG_OFFSET_CAPTURE|PREG_SET_ORDER);

foreach(
$processing_array AS $set)
{
    
$offset $set[0][1];
    
$length strlen($set[0][0]);

    for(
$i 1;$i<=$length;$i++)
    {
        unset(
$new_array[$offset+$i]);
    }

}


$new_string implode("",$new_array);

preg_match_all("#".$ban."#i",$new_string,$processing_array,PREG_OFFSET_CAPTURE|PREG_SET_ORDER);

foreach(
$processing_array AS $set)
{
    
$offset $set[0][1];
    
$length strlen($set[0][0]);
    
$tmparray array_slice($new_array,$offset+1,$length,true);
    
$keys_array array_keys($tmparray);

    foreach(
$keys_array AS $key)
    {
        
$original_array[$key] = '*';
    }
}

$filtered_string implode('',$original_array);

echo 
"censored =" $filtered_string;
?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:33 PM.


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.04910 seconds
  • Memory Usage 2,180KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete