PhpBB Admin Mass Email Timezone Issue

A

Anonymous

Guest
A friend was having an issue with his phpbb forum and the mass email. He sends stock information through the mass email to his select groups. Since his host was not in the same timezone, the emails did not reflect the accurate sending time. He asked me to make a timestamp and a footer for his emails.

What I came up with was to modify the admin/admin_mass_email.php file.
Find:
Code:
//
// Do the job ...
//
if ( isset($HTTP_POST_VARS['submit']) )
{
	$subject = stripslashes(trim($HTTP_POST_VARS['subject']));
	$message = stripslashes(trim($HTTP_POST_VARS['message']));

	$error = FALSE;
	$error_msg = '';

Make that section look like this:
Code:
//
// Do the job ...
//
if ( isset($HTTP_POST_VARS['submit']) )
{
	$subject = stripslashes(trim($HTTP_POST_VARS['subject']));
	$message = stripslashes(trim($HTTP_POST_VARS['message']));

	$sql = "SELECT *
		FROM " . CONFIG_TABLE ." WHERE config_name='board_timezone'";
	if(!$result = $db->sql_query($sql))
	{
		message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
	}
	$row = mysql_fetch_array($result);
	$offset = $row[config_value];
	$stt = strtotime($offset." hours");
	$sft = gmstrftime("%m-%d-%Y %H:%M",$stt);
	$message .= "
Alert generated: $sft
- - - - - - - - - - 
Footer message goes here.
";
	
	$error = FALSE;
	$error_msg = '';

The code pulls the timezone offset from the board settings and adjusts it from GMT time, then appends the $message varriable with whatever footer you like.
 
Sorry Swirly. The code works fine, I was wondering if anyone had a better idea on how to do this more effectivly. I guess I forgot to ask that part.

Some changes I have made so far already:
1. I changed the $sft = gmstrftime... to $sft = date('r',$stt); to get rfc standard.
2. I moved this code from a footer in the $message var in admin_mass_email.php to the header in the emailer.php file.

All this code is specific to phpbb forums, but the date manipulation is where I may be able to trim things down. Any ideas?

Thanks!
 
Back
Top