Форуми / Cotonti / Extensions / [Plugin] Wordcensor

Dave
#41400 17.02.2016 03:21

hey ppl, i did some small porting to SIENA 9.18 and i stopped, for now, its like i have to make these for tons of 'parts' (like urlkiller mentioned: list),

basicly i have doubts about the idea, i mean first of all there has to be a way to make php file for every input and the second - which way is better, such plugin or simply bbcode (pcre) i did dig in google but still not sure

my goal is to block (preg_replace) all bad words and illegal links @ my site

@Trustmaster: i did like u suggested

<?PHP

/* ====================
[BEGIN_COT_EXT]
Code=wordcensor
Name=Word Censor
Description=Word filter
Version=0.9b
Date=16-feb-2016
Author=Dave
Copyright=urlkiller (neocrome.net)
Notes=This plugin was coded in 12-09-2007 by urlkiller<br /> Ported to Cotonti Genoa / Siena in 2012-2016.<br />-Dave.
Auth_guests=R
Lock_guests=W12345A
Auth_members=R
Lock_members=W12345A
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');

?>
<?PHP

/* ====================
[BEGIN_COT_EXT]
Hooks=forums.posts.loop
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');

require_once cot_incfile('wordcensor', 'plug');

// overwrite the original output from forum posts...
$t->assign(array(
	"FORUMS_POSTS_ROW_TEXT" => str_replace($wc_censor,$wc_replace,$row['fp_text']),
	"FORUMS_POSTS_PAGETITLE" => str_replace($wc_censor,$wc_replace,$toptitle),
));

// note: need to add line for topic_description

?>
<?PHP

include('wordlist.php');

$filename = $cfg['plugins_dir']."/wordcensor/inc/words.txt";
$fp = fopen( $filename, "r" ) or die("Couldn't open $filename");
while ( ! feof( $fp ) ) {
   $line = fgets( $fp );
    if (trim($line) != "") {
	$values = explode("\t", $line);
	array_push($wc_censor, "/".$values[0]."/i");
	array_push($wc_replace, $values[1]);
	}
      }

?>
<?PHP
$wc_censor = array(
'word',
'word2'
'www.link.com'
'www.link2.com'
);
$wc_replace = array(
' CENZORED ',
' CENZORED_different_way ',
' FORBIDDEN LINK '
' ALSO FORBIDDEN' ,
);

?>

 

Your advertisement here :-)

Cotonti Genoa based site: forgotten-garage.pl