FAQ FAQ   Search Search   Memberlist Memberlist   Usergroups Usergroups   Register Register 
PhpBB- & WordPress- antispam.com
Home of the Antispam for all fields mod ! 
  Profile Profile   Log in to check your private messages Log in to check your private messages  Log inLog in 

 PhpBB- & WordPress- antispam.com Forum Index » [PhpBB2] Feature requests » Notice of spam entires for admins
  The time now is Fri Apr 28, 2017 5:23 am 

 Post new topic   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic  
Author Message
PostPosted: Tue Dec 12, 2006 7:07 am    Post subject: Notice of spam entires for admins  Reply with quote  

Lord Raiden
Experienced user


Joined: 11 Dec 2006
Posts: 123

Ok, I think I posted this over at phpbb, but I'll add it here for simplicity sake.

We need something either at the top, or the bottom, that says "You have x spam entries waiting" so that we don't have to keep diving into the admin control panel 3-5 times a day or more to see if any came in. It should also be hidden unless there are spam entries to be looked at. It can be a clickable link, or just plain text. Either is fine. Smile

In fact, I could help you write this little addition out if you want. It'd probubly take me less than 5-10 minutes to do. Smile All I'd need to know is what common element exists between all the different database entries. I see the "core id" under "antispamdb_data" groups all the elements there together which means one part of the search would be completed. Smile So that just leaves a second sort field to narrow down the results a bit. I figure if there were one common element across all the entires (the values under "varkey" of "post" and "mode" look promising) then we could do a simple sql command like this:

SELECT core_id, varkey from phpbb_antispamdb_data where varkey = 'post' ORDER BY core_id

That should render all the entires in order and then all I have to do is count them with something like "$total = count($entires)" or something similar to get the total, push that to the template, and bingo, instant report. Very Happy

TOP View user's profileSend private message  BOTTOM
PostPosted: Tue Dec 12, 2006 10:47 am    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

nice idea Wink

yet finding out if action is needed will be in the
Code:
phpbb_antispamdb


table Smile
_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Wed Dec 13, 2006 6:23 am    Post subject:  Reply with quote  

Lord Raiden
Experienced user


Joined: 11 Dec 2006
Posts: 123

Ah, ok. Now I see what you were talking about. Guess I overlooked that for some reason. Now that I have this, I can build this pretty quickly for you. Can't touch it till Thursday, but I'll whip something up for you that you can toss in the mod. Smile

TOP View user's profileSend private message  BOTTOM
PostPosted: Wed Dec 13, 2006 9:39 am    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

that'll be great !

make sure you know what all the fields in that table are for and you should be fine Smile
_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Fri Dec 15, 2006 12:38 am    Post subject:  Reply with quote  

Lord Raiden
Experienced user


Joined: 11 Dec 2006
Posts: 123

Ok, this isn't exactly the cleanest code, but it works. The setup I have here puts the notice at the bottom of the page above the admin link and is not clickable. Moving the info that goes into page_tail into page_header will allow someone to move the {SPAM_REPORT_NOTICE} link to the overall header wherever they want to put it. Smile

Code:
#
#-----[ OPEN ]------------------------------------------
#
includes/page_tail.php
#
#-----[ FIND ]------------------------------------------
#
$admin_link = ( $userdata['user_level'] == ADMIN ) ? '<a href="admin/index.' . $phpEx . '?sid=' . $userdata['session_id'] . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
/*******************
** MOD: Spam Filter (items waiting notification)
*******************/

if ( $userdata['user_level'] >= ADMIN )
{
   // Gather our pagination info.
   $query  = "SELECT Id FROM phpbb_antispamdb";
   $row = mysql_query($query);
   $counter = 0;
   while (list($id[$counter]) = mysql_fetch_row($row))
   {
      $counter++;
   }

   if ($counter > 0)
   {
      $spam_open_reports = sprintf(( ($counter == 1) ? $lang['Spam_open_reports_one'] : $lang['Spam_open_reports_many']), $counter);
      $spam_open_reports = '<b><font color="red">' . $spam_open_reports . '</font></b>';
      $spam_report_notice = '&nbsp; ' . $spam_open_reports . '&nbsp;';
   } else {
      $spam_report_notice = '';
   }
}
else
{
   $SPAM_REPORT_NOTICE = '';
}
// END : AFTER, ADD
#
#-----[ FIND ]------------------------------------------
#
   'ADMIN_LINK' => $admin_link)
#
#-----[ BEFORE, ADD ]------------------------------------------
#
/*******************
** MOD: Spam Report Posts
*******************/
// BEGIN : BEFORE, ADD
   'SPAM_REPORT_NOTICE' => $spam_report_notice,
// END : BEFORE, ADD
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#

/*******************
** MOD: Spam Report Posts
*******************/
// BEGIN : BEFORE, ADD
$lang['Spam_open_reports_one'] = 'There is %s open spam report';
$lang['Spam_open_reports_many'] = 'There are %s open spam reports';
// END : BEFORE, ADD

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_footer.tpl
#
#-----[ FIND ]------------------------------------------
#
<div align="center"><span class="copyright"><br />{ADMIN_LINK}<br />
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{ADMIN_LINK}
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
{SPAM_REPORT_NOTICE}<br /><br />
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


I used the layout from the "report post" mod to make the general layout for this addition since the reporting function in that one is very similar to what I wanted to do here. Smile Feel free to clean this up and use however you see fit.

TOP View user's profileSend private message  BOTTOM
PostPosted: Tue Dec 19, 2006 3:47 pm    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

I'll get back to you tonight about this one,

I'm more thinking of putting this along with the {ADMIN_LINK} because that will reduce the tpl edits to zero Wink
_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Fri Dec 22, 2006 12:32 am    Post subject:  Reply with quote  

Lord Raiden
Experienced user


Joined: 11 Dec 2006
Posts: 123

Something just dawned on me. The code I'm using does mysql only, which is bad if others are using non-mysql databases. Sorry about that Ramon. You'll have to recode that to work with the phpbb multi-database system.

TOP View user's profileSend private message  BOTTOM
PostPosted: Fri Dec 22, 2006 12:35 am    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

Lord Raiden wrote:
Something just dawned on me. The code I'm using does mysql only, which is bad if others are using non-mysql databases. Sorry about that Ramon. You'll have to recode that to work with the phpbb multi-database system.


don't worry about that !!
Most of the times it's pretty much the same.
_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Sat Jan 27, 2007 10:43 pm    Post subject:  Reply with quote  

Lord Raiden
Experienced user


Joined: 11 Dec 2006
Posts: 123

lol. I just had one of my mods report to me that he could see these notifications even though he's not supposed to. Wink

So here's the fix:

Change this in the first "after, add"::

if ( $userdata['user_level'] >= ADMIN )
{

to this:

if ( $userdata['user_level'] == ADMIN )
{

That should make it admin only viewable. heh. It figures I'd miss something insignificant like that. Wink

TOP View user's profileSend private message  BOTTOM
PostPosted: Sat Jan 27, 2007 11:01 pm    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

should work Wink

admin is 1
mod is 2 Smile
user is 0
guest is -1
_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Wed Feb 07, 2007 12:35 am    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

how about this one Smile

and YES it is in 1.2.5 Smile


Code:
// ---------------- NEW ENTRIES FOR ADMINS
function show_newentrieslink()
{
   // 1.2.5
   global $db, $lang,$userdata;
   if(!($userdata['user_level'] == ADMIN)) return '';

   // till we have V 1.2.6 we only use the english string
   $lang['Spam_open_reports_one'] = 'There is %s open spam report';
   $lang['Spam_open_reports_many'] = 'There are %s open spam reports';

   $sql = "SELECT count(db.Id) as total FROM ".ANTISPAMDB_TABLE." as db
            WHERE time >= ". intval($userdata['user_lastvisit']);
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query spam information', '', __LINE__, __FILE__, $sql);
   }
   $total = 0;
   while( $row = $db->sql_fetchrow($result) )
   {
      $total = $row['total'];
   }
   if ($total > 0)
   {
      $spam_open_reports = sprintf(( ($total == 1) ? $lang['Spam_open_reports_one'] : $lang['Spam_open_reports_many']), $total);
      $spam_open_reports = '<b><font color="red">' . $spam_open_reports . '</font></b>';
      $spam_report_notice = '&nbsp; ' . $spam_open_reports . '&nbsp;';
   }
   return $spam_report_notice;
}
// ---------------- NEW ENTRIES FOR ADMINS

_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Wed Feb 07, 2007 12:36 am    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

this code will count the amount of NEW spam entries since your last visit Smile
_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Wed Feb 07, 2007 1:37 am    Post subject:  Reply with quote  

Lord Raiden
Experienced user


Joined: 11 Dec 2006
Posts: 123

Good lord. That code is WAY cleaner than what I made. Nice job. Very Happy

TOP View user's profileSend private message  BOTTOM
PostPosted: Sat Jun 16, 2007 4:19 pm    Post subject:  Reply with quote  

ramon fincken
Site Admin


Joined: 11 Dec 2006
Posts: 269
Location: A'dam/Diemen, The Netherlands

I had some trouble with the code too Smile

anyway I'm closing this topic, your input is much appreciated !
_________________
Phpbbantispam founder, available for freelance WordPress coding.

PhpBB2 mod: http://www.phpbbantispam.com/viewtopic.php?t=1
WordPress plugin: http://wordpress.org/extend/plugins/antispam-for-all-fields/
Project files & mailinglist: https://sourceforge.net/projects/phpbbantispam/

TOP View user's profileSend private messageVisit poster's website  BOTTOM
 Post new topic   This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour

Display posts from previous:   
 PhpBB- & WordPress- antispam.com Forum Index » [PhpBB2] Feature requests » Notice of spam entires for admins
 
 Page 1 of 1
 
 
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Jump to:  


     Powered by phpBB © 2001, 2005 phpBB Group | Template Neon | Snelle Managed WordPress webhosting