| View previous topic :: View next topic |
| Author |
Message |
EdB /bb|[^b]{2}/
Joined: 05 Jan 2004 Posts: 7123
  votes: 90
|
Posted: Sat Jan 29, 2005 17:39 Post subject: Anti-spam update recheck prompter |
|
|
This comes from a request in the Feature request forum about antispam checking what it updates. It would be really cool if updating antispam included a re-check of everything it added, or at the very least asked you "do you want to re-check the new things?". The latter is a step above what I hacked in. This hack involves a new field in the antispam table and modifications to admin/b2antispam.php and b2evocore/_functions_antispam.php. The end result is that any banned keywords I haven't actually clicked "re-check" on tell me "NOT rechecked!" in the back office. It also sorts with the not rechecked keywords on the top so I can easily see which words got added with the latest update. I wrote up all the hackage in detail on my blog, and for those who don't need the details here's the quickie:
New field:
| Code: |
| ALTER TABLE `evo_antispam` ADD `aspm_checked` ENUM( 'needs', 'gotit' ) DEFAULT 'needs' NOT NULL |
Change _functions_antispam:
| Code: |
$sql = "SELECT aspm_ID, aspm_string, aspm_source, aspm_checked
FROM $tableantispam
ORDER BY aspm_checked ASC, aspm_string ASC";
$res_stats = $DB->get_results( $sql, ARRAY_A ); |
Change b2antispam:
| Code: |
if( $recheck > 0 ) {
$sql = "UPDATE $tableantispam SET aspm_checked='gotit' WHERE aspm_ID = $recheck";
$result = $DB->query( $sql );
}
if( $delhits && $deluxe_ban ) |
and
| Code: |
[blahblahblah T_('Check hit-logs and comments for this keyword!') blahblahblah]
</td>
<td>
<?php $been_rechecked = $row_stats['aspm_checked'];
if( $been_rechecked == 'needs' ) {
echo 'NOT rechecked!';
} else {
echo ' ';
}
?>
</td> |
Last edited by EdB on Wed Aug 03, 2005 10:13; edited 1 time in total |
|
| Back to top |
|
 |
EdB /bb|[^b]{2}/
Joined: 05 Jan 2004 Posts: 7123
  votes: 90
|
|
| Back to top |
|
 |
EdB /bb|[^b]{2}/
Joined: 05 Jan 2004 Posts: 7123
  votes: 90
|
Posted: Mon Feb 07, 2005 13:38 Post subject: |
|
|
http://wonderwinds.com/hackblo...tool_part3
This version is much cooler. You set the new field in the table then tell antispam to "Recheck 'em all!". It stops each time it finds a nasty and asks you if you want to delete the offenders or not, and it hides hits you've already rechecked. |
|
| Back to top |
|
 |
majort New Poster

Joined: 13 Aug 2004 Posts: 3
  
|
Posted: Mon Feb 07, 2005 16:54 Post subject: Great stuff - but i still like the comment "checked or |
|
|
EdB, please keep the code pieces
| Code: |
<td>
<?php $been_rechecked = $row_stats['aspm_checked'];
if( $been_rechecked == 'no' ) {
echo 'NOT rechecked!';
} else {
echo 'was rechecked! ';
}
?>
</td>
|
|
|
| Back to top |
|
 |
EdB /bb|[^b]{2}/
Joined: 05 Jan 2004 Posts: 7123
  votes: 90
|
Posted: Mon Feb 07, 2005 17:50 Post subject: |
|
|
Ya think so? I felt it was redundant because having "re-check" means it's not been re-checked. Oh wait a minute. On the short table it's intuitive because if it shows up then it must be not rechecked. On the full (original) table there's no explanation of what's been done or not, so it makes sense to add a reference to the checked/notrechecked status of each keyword.
Lemme know what you think and I'll work it back in. |
|
| Back to top |
|
 |
EdB /bb|[^b]{2}/
Joined: 05 Jan 2004 Posts: 7123
  votes: 90
|
Posted: Mon Feb 07, 2005 18:04 Post subject: |
|
|
| Code: |
<?php } else {
echo ' ';
} ?>
</td>
<?php if( $show_full ) { ?>
<td>
<?php $been_rechecked = $row_stats['aspm_checked'];
if( $been_rechecked == 'no' ) {
echo '<strong>NOT re-checked!</strong>';
} else {
echo 're-check done';
} ?>
</td>
<?php } ?>
</tr>
<?php
$count++;
} // End stat loop ?>
</table>
|
Add it to the tail end of the new file. You will get the extra column when you decide to view the full list of banned keywords, un-re-checked items will be flagged with bold, and re-checked items will be regular font. I'll update my blog post and associated files too.
Hope this addresses your concern. |
|
| Back to top |
|
 |
BenFranske Seasoned Poster

Joined: 28 Jun 2004 Posts: 84
     
|
Posted: Thu Jun 16, 2005 0:12 Post subject: |
|
|
I've been using EdB's hack for a while now and love it but it broke with 0.9.0.12 so I've updated it to version 4.
You can download the hack and instructions from this location until I setup a more permanent home.
If you run into problems with the installation or fuction of the hack please post and I'll do my best to assist you.
*UPDATED LINK*
Last edited by BenFranske on Thu Jun 16, 2005 0:26; edited 1 time in total |
|
| Back to top |
|
 |
John the uncertain
Joined: 22 Jun 2004 Posts: 2147
     votes: 27
|
Posted: Thu Jun 16, 2005 0:19 Post subject: |
|
|
| Quote: |
Forbidden
You don't have permission to access /ben/recheck4.zip on this server. |
_________________ See the Sites in in Venice |
|
| Back to top |
|
 |
BenFranske Seasoned Poster

Joined: 28 Jun 2004 Posts: 84
     
|
Posted: Thu Jun 16, 2005 0:27 Post subject: |
|
|
| Should be fixed now. |
|
| Back to top |
|
 |
mikkyT Seasoned Poster

Joined: 14 Feb 2005 Posts: 76
  
|
Posted: Thu Jun 23, 2005 9:30 Post subject: |
|
|
MySQL error!
Unknown column 'aspm_checked' in 'field list'(Errno=1054)
Your query:
SELECT aspm_ID, aspm_string, aspm_source, aspm_checked FROM evo_antispam WHERE aspm_checked = 'FALSE' ORDER BY aspm_string ASC
Anyone any ideas?
I've added the field into the database,
Field Type Attributes Null Default Extra Action
aspm_ID bigint(11) No auto_increment Change Drop Primary Index Unique Fulltext
aspm_string varchar(80) No Change Drop Primary Index Unique Fulltext
aspm_source enum('local', 'reported', 'central') No reported Change Drop Primary Index Unique Fulltext
aspm_checked tinyint(1) No 0
But no cigar for me! .... executing the SQL command in MyPhpAdmin is successful. _________________ Smoke me a kipper, skipper
 |
|
| Back to top |
|
 |
BenFranske Seasoned Poster

Joined: 28 Jun 2004 Posts: 84
     
|
Posted: Thu Jun 23, 2005 17:54 Post subject: |
|
|
Check your hacks.php file. It should have a line like
| Code: |
$sql = "SELECT aspm_ID, aspm_string, aspm_source, aspm_checked
FROM $tableantispam
WHERE aspm_checked = '0'
ORDER BY aspm_string ASC";
$res_stats = $DB->get_results( $sql, ARRAY_A ); |
If the line says WHERE aspm_checked = 'FALSE' change it. You should be using 0 and 1 in the queries, not TRUE and FALSE. I beleive this is the only place that query appears.
Let us know what you find. |
|
| Back to top |
|
 |
mikkyT Seasoned Poster

Joined: 14 Feb 2005 Posts: 76
  
|
Posted: Wed Aug 03, 2005 6:53 Post subject: |
|
|
EDB/Anyone - have you thought about automating the update process so that I could call a cron job that automatically does a recheck & prune every X hours?
Currently, manual intervention is the only way, and you need to recheck for every unchecked entry. |
|
| Back to top |
|
 |
EdB /bb|[^b]{2}/
Joined: 05 Jan 2004 Posts: 7123
  votes: 90
|
Posted: Wed Aug 03, 2005 10:24 Post subject: |
|
|
Isaac made up a way to automatically get the update and do the recheck using a cron job. Check http://isaacschlueter.com/ for details.
BenFranske: why do you say it didn't work in v12? I have a v12 installation that uses my last version of this hack without issue. The "yes/no" version was problematic for some situations, but that became "needs/gotit" a long time ago. Effectively the same solution as "1/0"? |
|
| Back to top |
|
 |
Pneumatus New Poster

Joined: 22 Aug 2005 Posts: 8
  
|
Posted: Mon Aug 22, 2005 14:23 Post subject: |
|
|
Just a small modification:
on line 514 of you modifed b2antispam.php should read
| Code: |
| if( $_GET['show_full'] ) { |
to be register_globals off compatible - otherwise the user will never be able to see any of the keywords already checked. |
|
| Back to top |
|
 |
William New Poster

Joined: 27 Aug 2005 Posts: 13
 
|
Posted: Sat Aug 27, 2005 9:30 Post subject: Parse Error when running b2antispam_recheck.php |
|
|
I posted this in the plugins forum & EdB suggested that I try over here:
| Quote: |
I'm getting an error when cron runs it (same if I run it manually) - (MySQL 4.0.25-standard / B2Evo 0.9.0.12) / php ver: 4.3.10
Parse error: parse error, unexpected ';' in /home/mysite/public_html/blog/admin/b2antispam_recheck.php on line 24
Here's the code referenced:
| Code: |
| $report = ( $result->aspm_source != 'central' && $result->aspm_source != 'reported' ) ? 1 : 0; |
I've done EdB's "hacks": added database field, changed "no's" to "needs" & "yes's" to "gotit" in the script.
I'm using Isaac's blacklist update cron technique successfully & would like to get the re-check working, too.
any ideas?
__________________
Comment from: EdB [Visitor] · http://wonderwinds.com
Hi William. I'll try to figure something out on this, but Isaac wrote the 'automatic recheck' hack - all I did was copy it and be happy. What version of PHP are you running? Are you a member of the forums? If not you should sign up because pasting code works a lot better in there than out here.
It'll take me a while. I'm wondering about the syntax of that particular line. How it says "variable = this or that depending on a condition". I'm thinking maybe your PHP doesn't like the way Isaac wrote the code? It'd be odd because Isaac is really good with code, but I don't know what else to look at.
See you in the forums!
_________________
Comment from: EdB [Visitor] · http://wonderwinds.com
Try changing "? 1 : 0;" to "? true : false;. Just a thought based on the reason I had to change yes and no to gotit and needs. I don't understand why - I just remember my hack failed with yes and no for a few people. Something about how their server was setup.
Any additional followup we'll do in the forums. Lotsa smart people in there!
|
Thanks for your reply, EdB
I Tried true /false, but no joy. (my php ver: 4.3.10)
Thanks for any other thoughts... _________________ William |
|
| Back to top |
|
 |
|