class NP_GlobalBlacklist extends NucleusPlugin {
function getIndexPath() { return "http://www.jrbtech.com/"; }
function getName() { return 'Global Blacklist'; }
function getAuthor() { return 'Jim Burnett'; }
function getURL() { return 'http://www.jrbtech.com/projects.php?catid=37&blogid=7'; }
function getVersion() { return '0.1'; }
function getDescription() { return 'This plugin allows for a global black list. All nucleus users can participate in submitting keyword variations, domain names and IP addresses. All submitted keywords, domain names and IPs are reviewed by a global blacklist administrator before being globaly availible. Update your blacklist with one click of the button! Comments are filtered through as well!'; }
function hasAdminArea() { return 1; }
function supportsFeature($what) {
switch($what) {
case 'SqlTablePrefix':
return 1;
default:
return 0;
}
}
function install() {
sql_query('CREATE TABLE IF NOT EXISTS ' . sql_table('plugin_globalblacklist') . ' (itemid int(11) NOT NULL auto_increment, primary key( itemid),itemstring varchar(150) NOT NULL,type SMALLINT NOT NULL )');
sql_query("ALTER TABLE " . sql_table('plugin_globalblacklist') . " ADD UNIQUE ( `itemstring`)");
$strComment = "Automatically submit the comment authors IP, and the comment text to the central database when deleting comments?
(An administor at the global ban list database will review the submission.)";
// $this->createOption('submitComment', $strComment,'yesno','yes');
}
function unInstall() {
mysql_query('DROP TABLE ' . sql_table('plugin_globalblacklist'));
}
function getEventList() { return array('PostAddBan','PreSendContentType','PreAddComment'); }
function event_PostAddBan(&$data) {
$ban = $data['iprange'];
$this->addGlobalBan( $ban,2 );
}
function event_PreSendContentType(&$data){
$ip = getenv('REMOTE_ADDR');
$referer = getenv('HTTP_REFERER');
$host = split("/",str_replace("http://","",$referer));
$domain = str_replace("www.","",$host[0]);
$this->checkHost( $domain );
$this->checkHost( $ip );
$this->checkText( $referer );
}
function event_PreAddComment(&$data) {
$host = split("/",str_replace("http://","", $data['comment']['userid']));
$domain = str_replace("www.","",$host[0]);
$this->checkText( $data['comment']['body'] );
$this->checkHost( $data['comment']['ip'] );
$this->checkHost( $domain );
//die ( $data['comment']['userid'] . " - " . $domain );
}
function checkHost( $host ){
$sql2 = "SELECT itemstring FROM " . sql_table('plugin_globalblacklist') . " WHERE itemstring LIKE '%$host%' AND type=2";
if ( $host <> "" ) {
$result2 = mysql_query( $sql2 ) or die( $sql2 . "
" . mysql_error());
if ( mysql_num_rows($result2) ) {
die( $this->showBanError() );
}
}
}
function checkText($text){
$sql = "SELECT itemstring FROM " . sql_table('plugin_globalblacklist') . " WHERE type=1" ;
$result = mysql_query( $sql );
while ( $row = mysql_fetch_array( $result ) ) {
if ( $row[0] <> "" ) {
if ( preg_match("/$row[0]/",$text)){
die( $this->showBanError() );
}
}
}
}
function addGlobalBan( $itemstring,$type ) {
$sql = "INSERT INTO " . sql_table('plugin_globalblacklist') . "(itemstring,type) VALUES ('$itemstring',$type)";
mysql_query( $sql ) ;
$handle = fopen("http://www.jrbtech.com/globalblacklist/add.php?itemvalue=$itemstring&type=$type", "r");
$read = fread($handle, 1024);
}
function showBanError(){
return "
| Archivo | Indicadores | Escríbanos |
|
|
Website: http://costarica.capitalfinanciero.com/ Enviar mensaje El usuario debe estar registrado para hacer eso
|
Búsqueda |
|
|
| ¿Quiénes Somos? | Condiciones de Uso | Privacidad | Anúnciese en la versión impresa de El Financiero y Capital Financiero |
|
© 2006 El Financiero y Capital Financiero. El contenido de El Financiero y de Capital Financiero no puede ser reproducido, transmitido ni distribuido total o parcialmente sin la autorización previa y por escrito de El Financiero o de Capital Financiero. |