[ABD] newpost2mail: Send new posts as email to admin

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
motif
Registered User
Posts: 10
Joined: Thu Mar 27, 2008 5:31 pm

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by motif » Thu Aug 28, 2008 11:21 pm

Thanks for this great mod, it works very well. I have a question though:

Would you be able to implement this so that it checks the actual phpBB3 thread/forum subscription settings for each user and send the messages out that way?

idreyer
Registered User
Posts: 9
Joined: Sun Sep 07, 2008 9:26 am

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by idreyer » Sun Sep 07, 2008 9:34 am

Hello Stefan,

thank you as well from me for this great mod.

I found a little "problem". It happened that there was no IP-Adresse provided. In this case the user got the following error messages:

[phpBB Debug] PHP Notice: in file /newpost2mail.php on line 27: gethostbyaddr() [function.gethostbyaddr]: Address is not a valid IPv4 or IPv6 address

Warning: Cannot modify header information - headers already sent by (output started at ...includes/functions.php:2983) in /..../includes/functions.php on line 3570

Warning: Cannot modify header information - headers already sent by (output started at ..../includes/functions.php:2983) in /..../includes/functions.php on line 3572

....

For a quick and dirty solution I added a simple plausibility check for the ip-address:

Code: Select all

$post_IP          = $data[poster_ip];
if (eregi("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})",$post_IP,$ipblocks ))
  {
   if ($ipblocks[1] > 0 && $ipblocks[1] < 256 && $ipblocks[2] >= 0 && $ipblocks[2] < 255 && $ipblocks[3] >= 0 && $ipblocks[3] < 255 && $ipblocks[4] >= 0 && $ipblocks[4] < 255)
     {
      $post_HOST        = gethostbyaddr($post_IP);
     }
  else 
     {
      $post_HOST        = "nicht verfuegbar";
     }
  }
else 
  {
   $post_HOST        = "nicht verfuegbar";
  }
Perhaps you can provide a better solution within the next version of your mod ?

With best regards
Ingo

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Wed Sep 10, 2008 8:18 am

At first sorry for not being here for a while - I simply didn't get notifications about new posts in this thread.

So I'm starting now to answer your questions and to fix some bugs. A new beta will be published soon.
uniteddiamonds wrote:***PostgreSQL error solved***

It seems that postgresql doesnt like single quotes and double quotes very much. The following revised SQL statement seems to fix the problem I reported earlier. I do not have MySQL, so I was unable to test whether or not it remains compatible.

Just a few notes...the function 'lcase' is not recognized in postgresql. The equivalent is 'lower'. I suspect 'lower' is recognized in MySQL, but like I said earlier, I dont have MySQL to test it. If it is compatible, you may want to change the SQL statement to use lower instead of lcase.

I am interested in knowing if this works for everyone else having the same problems. Let me know :)

Code: Select all

'WHERE' => 'ug.group_id = g.group_id AND ug.user_id = u.user_id AND u.user_email != \'\' AND lower(g.group_name) = \'' . strtolower($group) . '\''));
I've tested this here for MySQL and it works as expected, so this will be included in the next beta. Thanks for helping :-)

Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Wed Sep 10, 2008 8:28 am

ttuu wrote:when to users send message in forum you get this error:

Code: Select all

warning: cannot modify header information - headers alreaby sent by (output started at D:\hshome\enativ\enativ.com\forum\newpost2mail.php:1) in D:\hshome\enativ\enativ.com\forum\includes\functions.php on line 3546
warning: cannot modify header information - headers alreaby sent by (output started at D:\hshome\enativ\enativ.com\forum\newpost2mail.php:1) in D:\hshome\enativ\enativ.com\forum\includes\functions.php on line 3548
warning: cannot modify header information - headers alreaby sent by (output started at D:\hshome\enativ\enativ.com\forum\newpost2mail.php:1) in D:\hshome\enativ\enativ.com\forum\includes\functions.php on line 3549
warning: cannot modify header information - headers alreaby sent by (output started at D:\hshome\enativ\enativ.com\forum\newpost2mail.php:1) in D:\hshome\enativ\enativ.com\forum\includes\functions.php on line 3550
in functions.php

Code: Select all

3546: header('Content-type: text/html; charset=UTF-8');
3547:
3548: header('Cache-Control: private, no-cache="set-cookie"');
3549: header('Expires: 0');
3550: header('Pragma: no-cache');
Check if there are any empty lines in newpost2mail.php and newpost2mail.config.php before "<?php" or after "?>" at beginning and the end of the skript, this is the most common cause for that.

Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Wed Sep 10, 2008 8:36 am

bspano wrote:Great mod! Installed and working great.

Can I adjust who it comes from? Replies are going to an admin and I need it to go to a different address altogether.

Thanks!
Bryan
As we are using the phpBB3 internal mail functions the answer is "no" because this isn't supported here.
Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Wed Sep 10, 2008 8:39 am

AKeyworth wrote:HI,

This is exactly the type of mod I need, but my forum uses phpBB 2.0.23: is it sufficiently compatible with phpBB 3 for this mod to work?
n2m will not work with phpBB 2.x

Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Wed Sep 10, 2008 8:44 am

motif wrote:Would you be able to implement this so that it checks the actual phpBB3 thread/forum subscription settings for each user and send the messages out that way?
No, because this will make things very complicated (regarding the programming).
Also remember that n2m is an admin tool which sends out informations such as eMail addresses which shall not be visible for common users.

Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Wed Sep 10, 2008 8:48 am

idreyer wrote:Hello Stefan,

thank you as well from me for this great mod.

I found a little "problem". It happened that there was no IP-Adresse provided. In this case the user got the following error messages:

[phpBB Debug] PHP Notice: in file /newpost2mail.php on line 27: gethostbyaddr() [function.gethostbyaddr]: Address is not a valid IPv4 or IPv6 address

Warning: Cannot modify header information - headers already sent by (output started at ...includes/functions.php:2983) in /..../includes/functions.php on line 3570

Warning: Cannot modify header information - headers already sent by (output started at ..../includes/functions.php:2983) in /..../includes/functions.php on line 3572

....

For a quick and dirty solution I added a simple plausibility check for the ip-address:

Code: Select all

$post_IP          = $data[poster_ip];
if (eregi("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})",$post_IP,$ipblocks ))
  {
   if ($ipblocks[1] > 0 && $ipblocks[1] < 256 && $ipblocks[2] >= 0 && $ipblocks[2] < 255 && $ipblocks[3] >= 0 && $ipblocks[3] < 255 && $ipblocks[4] >= 0 && $ipblocks[4] < 255)
     {
      $post_HOST        = gethostbyaddr($post_IP);
     }
  else 
     {
      $post_HOST        = "nicht verfuegbar";
     }
  }
else 
  {
   $post_HOST        = "nicht verfuegbar";
  }
Perhaps you can provide a better solution within the next version of your mod ?

With best regards
Ingo
Ingo, could you please try

Code: Select all

$post_HOST        = @gethostbyaddr($post_IP);
instead of

Code: Select all

$post_HOST        = gethostbyaddr($post_IP);
and see if it fixes your issue?

But I'm wondering how it can be that no IP is provided

Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

idreyer
Registered User
Posts: 9
Joined: Sun Sep 07, 2008 9:26 am

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by idreyer » Fri Sep 19, 2008 3:15 pm

henmedia wrote:Ingo, could you please try

Code: Select all

$post_HOST        = @gethostbyaddr($post_IP);
instead of

Code: Select all

$post_HOST        = gethostbyaddr($post_IP);
and see if it fixes your issue?

But I'm wondering how it can be that no IP is provided

Stefan
Hy Stefan,

It's hard to test as this happened only once and it was reported by a user who was not able to reproduce it. I don't know how it was possible to send a wrong or just a missing IP address, but anyway.

Therefore I am not able to test if your suggestions would help - but after using the code I provided in my first post I never got any complaints again.

With best regards
Ingo

nyambe
Registered User
Posts: 2
Joined: Wed Oct 01, 2008 4:57 am

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by nyambe » Wed Oct 01, 2008 5:11 am

Beutiful MOD!!

Works like a charm, love te instalation.. an include instead of having to mess around with the actual code is a great Idea, as is having a separate config file.

Admin tool? why only that?

We have migrated from yahoogroups and many users where missing the option to get the post directly to their email. I have created a phpbb3 group so that people can sign up to receive all new post, and reply.

hence I have tried to hide the IP/host information, here is my dirty solution, :mrgreen: really dirty. I that going to work?

Code: Select all

// hide IP_HOST
//$message .= "<tr><td>$phrase[ip_hostname]</td><td>: $post_IP / $post_HOST</td></tr>\n";
BTW, u should be able to customize the info of the email, just like you are able to customize the subject. Also I get no space lines between the info and the content, and between the content and the donation message. Maybe is just me.

I have very little knowledge of php, but I might get into it just to contribute. Great work, really! ;)

nyambe
Registered User
Posts: 2
Joined: Wed Oct 01, 2008 4:57 am

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by nyambe » Wed Oct 01, 2008 10:26 am

ups, eversince the modification I am getting mysql errors

Code: Select all

Fatal error: SQL ERROR [ mysqli ]

MySQL server has gone away [2006]

SQL

SELECT s.session_user_id, s.session_ip, s.session_viewonline FROM phpbb_sessions s WHERE s.session_time >= 1222855290 AND s.session_forum_id = 7 AND s.session_user_id <> 1

BACKTRACE


FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/functions.php
LINE: 3204
CALL: dbal_mysqli->sql_query()

FILE: includes/functions.php
LINE: 3385
CALL: obtain_users_online()

FILE: includes/functions.php
LINE: 3084
CALL: page_header()

FILE: 
LINE: 
CALL: msg_handler()

FILE: posting.php
LINE: 1022
CALL: trigger_error()


in .../includes/db/dbal.php on line 602
Is this related or is it just a time out?

joyryde
Registered User
Posts: 13
Joined: Sat Jul 24, 2004 8:33 pm

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by joyryde » Sat Oct 11, 2008 3:40 pm

This is an awesome mod, but I have a problem. Every time I click a link from the email I get:

"No input file specified." instead of the URL I was expecting.

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Fri Oct 17, 2008 12:32 pm

I've just published beta 18 which fixes some problems:
  • Suppression of error messages added if the poster's IP cannot be determinated
  • Fixed incompatibility with PostgrSQL
  • Fixed incompatibility of security fix which was added in beta 17
  • Fixed incompatibility of constants declaration in some environments
Download: http://henmedia.de

Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

User avatar
WizardOfZo
Registered User
Posts: 14
Joined: Wed Oct 08, 2008 5:12 pm

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by WizardOfZo » Mon Oct 20, 2008 5:15 pm

Works well for us.
I would like to avoid attachments sent out in emails.
I could just delete the code for that, but I was wondering if there was a way to simply generate just the attachment file name(s) to be included in the email?

henmedia
Registered User
Posts: 140
Joined: Wed Dec 19, 2007 9:31 am
Location: Germany
Contact:

Re: [BETA] newpost2mail: Send new posts as email to admin

Post by henmedia » Mon Oct 20, 2008 5:45 pm

There are no attachments included, just links to the original attachments.

Stefan
Get the latest version of newpost2mail for phpBB3 at http://henmedia.de | [donate USD] [donate EUR]

Locked

Return to “[3.0.x] Abandoned MODs”