'http://www.jayallen.org/comment_spam/blacklist.txt', 'Chongqed' => 'http://blacklist.chongqed.org/', 'MoinMaster' => 'http://moinmaster.wikiwikiweb.de/BadContent?action=raw' ); // Loop through black lists foreach( $BlackLists as $MTB_name => $MTB_url ) { // Automatic File Update $MTB_time = 86400; // Time in seconds since last update of master file - 0 = don't update $MTB_fname = $arcDir . $MTB_name . ".txt"; // local file name // Check to see if Blacklist file is in current directory and it's current if( $MTB_time > 0 ) if( ( ! ($MTStat = @stat( $MTB_fname ) ) ) || ( $MTStat["mtime"] < (time()-($MTB_time)) ) ) { // Download file if( ( $MTB = @file($MTB_url) ) ) if( $MTB_file = fopen( $MTB_fname, "wb" ) ) { fwrite( $MTB_file, implode( '', $MTB ) ); fclose( $MTB_file ); } } if(( ! isset( $MTB ) ) || ( ! $MTB ) ) $MTB = file( $MTB_fname ); // Check post against regular expressions $count[ $MTB_name ] = 0; $expcnt[ $MTB_name ] = 0; foreach( $MTB as $MTB_check ) { $MTB_check = preg_replace( "/( *#.*)*$/", "", trim( $MTB_check ) ); // Quote the "." to avoid false positives if( ! strpos( $MTB_check, "\\" ) ) $MTB_check = preg_replace( "/\./", "\\.", $MTB_check ); if( $MTB_check != "" ) if( ($matched = preg_match_all( "~" . $MTB_check . "~i", $str, $matches ) ) ) { $count[$MTB_name] += $matched; $expcnt[ $MTB_name ] ++; } } // Clear Regular Expression list unset( $MTB ); } // Build return string $ret = ""; foreach( $count as $MTB_name => $found ) if( $found > 0 ) $ret .= sprintf( "Found %6d expression(s) with %6d total hit(s) using %s\n", $expcnt[ $MTB_name ], $found, $MTB_name ); // Return found counts if( $ret == "" ) return( FALSE ); else return( $ret ); } // Skip the Blocklist Cookbook control file (so you can add "special" words in addition to this if( ($pagename != "Main.Blocklist") && ($pagename != "Site.Blocklist") ) if( $ret = check_Blacklist( $_POST['text'] ) ) { // E-Mail the administrator if an e-mail address is entered if( $eMailAddress != "" ) mail( $eMailAddress, "Blocked Wiki Comment", sprintf( "BLOCKED Wiki Post\n\nHTTP_REFERER: %s\nREMOTE_ADDR: %s\n\n%s\n\n-------- Blocked Content ---------\n%s", $_SERVER['HTTP_REFERER'], $_SERVER['REMOTE_ADDR'], $ret, $_POST['text'] ) ); $EnablePost = 0; unset($_POST['post']); unset($_POST['postattr']); // // This is the message returned to the user. // $EditMessageFmt .= "

$[This post has been blocked by the administrator]

"; // Version 1.5 changes - Thanks John! // Added support for pmwiki-2.1.14 global $MessagesFmt; $MessagesFmt[] = $EditMessageFmt; // sleep (Lock) the process for LockTime seconds if( $lockTime > 0 ) sleep( $lockTime ); } ?>