check_perm( 'spamblacklist', 'view', true ); ?>
check_perm( 'spamblacklist', 'edit', true ); $keyword = substr( $keyword, 0, 80 ); param( 'delhits', 'integer', 0 ); param( 'delcomments', 'integer', 0 ); param( 'blacklist', 'integer', 0 ); param( 'report', 'integer', 0 ); // Check if the string is too short, // it has to be a minimum of 5 characters to avoid being too generic if( strlen($keyword) < 5 ) { echo '
'; printf( '

'.T_('The keyword [%s] is too short, it has to be a minimum of 5 characters!').'

', htmlspecialchars($keyword) ); echo '
'; break; } if( $delhits && $deluxe_ban ) { // Delete all banned hit-log entries echo '
'; printf( '

'.T_('Deleting log-hits matching [%s]...').'

', htmlspecialchars($keyword) ); // Stats entries first $sql = 'DELETE FROM T_hitlog WHERE referingURL LIKE '.$DB->quote('%'.$keyword.'%'); $DB->query($sql); echo '
'; } if( $delcomments && $deluxe_ban ) { // Then all banned comments echo '
'; printf( '

'.T_('Deleting comments matching [%s]...').'

', htmlspecialchars($keyword) ); $sql = 'DELETE FROM T_comments WHERE comment_author LIKE '.$DB->quote('%'.$keyword.'%').' OR comment_author_url LIKE '.$DB->quote('%'.$keyword.'%').' OR comment_author_email LIKE '.$DB->quote('%'.$keyword.'%').' OR comment_content LIKE '.$DB->quote('%'.$keyword.'%'); $DB->query($sql); echo '
'; } if( $blacklist ) { // Local blacklist: echo '
'; printf( '

'.T_('Blacklisting the keyword [%s]...').'

', htmlspecialchars($keyword) ); // Insert into DB: antispam_create( $keyword ); echo '
'; } if( $report && $report_abuse ) { // Report this keyword as abuse: b2evonet_report_abuse( $keyword ); } if( !( $delhits || $delcomments || $blacklist || $report ) ) { // Nothing to do, ask user: ?>

quote('%'.$keyword.'%').' ORDER BY hit_remote_addr ASC, baseDomain ASC, visitTime DESC'; $res_affected_hits = $DB->get_results( $sql, ARRAY_A ); if( $DB->num_rows == 0 ) { // No matching hits. printf( '

'.T_('No log-hits match the keyword [%s].').'

', htmlspecialchars($keyword) ); } else { ?>

num_rows ) ?>

>
quote('%'.$keyword.'%').' OR comment_author_url LIKE '.$DB->quote('%'.$keyword.'%').' OR comment_author_email LIKE '.$DB->quote('%'.$keyword.'%').' OR comment_content LIKE '.$DB->quote('%'.$keyword.'%').' ORDER BY comment_author_IP ASC, comment_author_url ASC, comment_date DESC'; $res_affected_comments = $DB->get_results( $sql, ARRAY_A ); if( $DB->num_rows == 0 ) { // No matching hits. printf( '

'.T_('No comments match the keyword [%s].').'

', htmlspecialchars($keyword) ); } else { ?>

>
70 ) { // Trail off (truncate and add '...') after 70 chars echo substr($comment_content, 0, 70) . "..."; } else { echo $comment_content; } ?>
'.T_('The keyword [%s] is already handled by the blacklist.').'

', htmlspecialchars($keyword) ); } else { // Not in blacklist ?>

[]

check_perm( 'spamblacklist', 'edit', true ); if ($tab == 'antispam') { $spmd_keyword = substr ($keyword, 0, 80); if ( strlen($spmd_keyword) < 1 ) break; $sql = 'delete from T_potential where '.'spmd_string LIKE '.$DB->quote('%'.$spmd_keyword.'%'); } elseif ( $tab == 'authorised' ) { param( 'spmd_id', 'integer', 0 ); if ( $spmd_id <= 0 ) break; $sql = 'delete from T_authorised where '.'spmd_ID = '.$DB->quote($spmd_id).';'; } $DB->query($sql); break; case 'update': $current_User->check_perm( 'spamblacklist', 'edit', true ); $banned=''; $authorised=''; $relayed=''; foreach ($_POST as $Field=>$Value){ switch (substr($Field,0,3)) { case 'all': $authorised.=" or spmd_string like ".$DB->quote('%'.substr($Field,3).'%'); break; case 'ban': $banned.=" or spmd_string like ".$DB->quote('%'.substr($Field,3).'%'); break; } } if ($authorised) { $DB->query('insert into T_authorised (spmd_string) select distinct spmd_string from T_potential where '.substr($authorised,4)); $DB->query('delete from T_potential where '.substr($authorised,4)); } if ($banned) { $theResults=$DB->get_results('select distinct spmd_string from T_potential where '.substr($banned,4),'ARRAY_A'); foreach ($theResults as $aPain){ if ($DB->get_var('select count(*) from T_antispam where aspm_string = "'.$aPain['spmd_string'].'"')) { echo "
\n"; echo '

',$aPain['spmd_string'], T_(' is already registered in local blacklist.'), "

\n"; $DB->query('delete from T_potential where spmd_string like "%'.$aPain['spmd_string'].'%"'); echo "
"; } else { nuke_em($aPain['spmd_string']); } } } break; case 'remove': // Remove a domain from ban list: // Check permission: $current_User->check_perm( 'spamblacklist', 'edit', true ); param( 'hit_ID', 'integer', true ); // Required! ?>

check_perm( 'spamblacklist', 'edit', true ); // Report this keyword as abuse: b2evonet_report_abuse( $keyword ); break; case 'poll': // request abuse list from central blacklist: // Check permission: $current_User->check_perm( 'spamblacklist', 'edit', true ); b2evonet_poll_abuse( ); break; case 'filter': $filteron = $keyword; $keyword = ''; break; case 'setting': $Settings->set('spamEnabled',$enab); $Settings->set('spamAuto',$auto); $Settings->set('spamLevel',$level); $Settings->set('spamThreshold',$threshold); $Settings->updatedb(); break; case 'authedit': $notlog=''; $delete=''; foreach ($_POST as $Field=>$Value){ switch (substr($Field,0,3)) { case 'log'; $notlog.=" or spmd_ID='".substr($Field,3)."'"; break; case 'del'; $delete.=" or spmd_ID='".substr($Field,3)."'"; break; } } if ($notlog) $notlog=" where ".substr($notlog,4); $notlog="update T_authorised set spmd_logvisits='0'".$notlog; $DB->query("update T_authorised set spmd_logvisits='1'"); $DB->query($notlog); if ($delete) $DB->query('delete from T_authorised where '.substr($delete,4)); break; } switch ( $tab ) { case 'antispam': // ADD KEYWORD FORM: if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) { ?>
get_results($sql,ARRAY_A); echo '
'; echo '
'; echo ''; if($DB->num_rows==0){ echo ''; } else { $myCount=0; foreach ($theResults as $theRow) { echo ''; echo ''; echo ''; if (preg_match("/\d+\.\d+.\d+.\d+/", $theRow['spmd_string']) == 1) { // nothing to done } elseif (preg_match("/^((\w|\-)+\.)(((\w|\-)+\.)+(com|edu|org|info|tv|gov))$/", $theRow['spmd_string'], $match) == 1) { $theDomains[$match[3]]+=$theRow['Cnt']; } elseif (preg_match("/^((\w|\-)+\.)(((\w|\-)+\.)+(\w|\-)+\.\w+)$/", $theRow['spmd_string'], $match) == 1) { $theDomains[$match[3]]+=$theRow['Cnt']; } $myCount++; } echo '
DelCheckPotential spammersCountBlack/BanWhite/Auth
No potential spammers
Chk'.$theRow{'spmd_string'}.''.$theRow{'Cnt'}.'= $Settings->get('spamThreshold')) { echo ' CHECKED/>
'; echo ''; $myCount=0; // display sub-domian potential list arsort($theDomains); foreach (array_keys($theDomains) as $theDom){ if ($theDomains[$theDom] > 1) { echo ''; echo ''; $myCount++; } } } echo '
CheckPotential spammers (recount;domain name)CountBlack/BanWhite/Auth
Chk'.$theDom.''.$theDomains{$theDom}.'= $Settings->get('spamThreshold')) { echo ' CHECKED/>

'; echo '
'; break; case 'blacklist': ?>

check_perm( 'spamblacklist', 'edit' ) ) { echo '
'.T_( 'If a keyword restricts legitimate domains, click on the green tick to stop banning with this keyword.'); } ?>

check_perm( 'spamblacklist', 'edit' ) ) { ?>

[] []

100) ) { // We haven't requested the list echo '

'.sprintf( T_('The blacklist contains more than 100 items. [Click here to display].'), 'href="b2antispam.php?tab=blacklist&disp_blacklist=1"' ).'

'; } else { // The list is short enough to be displayed without being annoying $disp_blacklist = 1; } echo '

'.T_('Search blacklist:'); echo ''; echo ''; echo '

'; if( $disp_blacklist || $filteron ) { // Blacklist display is requested: ?> >
check_perm( 'spamblacklist', 'edit' ) ) { ?> <?php echo T_('Allow Back') ?> check_perm( 'spamblacklist', 'edit' ) ) { ?> [] []
'; echo '
Deluxe AntiSpam options
get('spamEnabled')) echo ' checked="checked"'; echo ' />Enables SpamDeluxe features (potential/whitelist handling)
'; echo '
get('spamAuto')) echo ' checked="checked"'; echo ' />Clean logs/comments above threadshold:
'; echo '
get('spamLevel')) echo ' checked="checked"'; echo ' />Check also comments with potential Urls.
'; echo '
'; break; case 'authorised': $sql="select spmd_ID,spmd_string,spmd_logvisits from T_authorised order by spmd_ID asc"; $theResults=$DB->get_results($sql, ARRAY_A); $return_top=-1; if($DB->num_rows==0){ echo "
No Authorised urls
"; } else { echo '
'; if ($DB->num_rows > 30) { $return_top = round($DB->num_rows / 2); echo '
'; } echo ''; $myCount=0; foreach ($theResults as $theRow){ if ($myCount == $return_top) { echo '
DelAuthorised UrlsNot logDelete
'; } echo ''; $myCount++; } echo '
DelAuthorised UrlsNot logDelete
'.$theRow{'spmd_string'}.'
'; if ($return_top != -1 ) echo '
'; echo '
'; } break; } ?>