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) );
// 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 '
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 '
';
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 '';
if( $disp_blacklist || $filteron )
{ // Blacklist display is requested:
?>
';
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 "