These are sql queries that are used to modify the database. For the mod to work some of the database tables need to be revised.#-----[ BEGIN SQL LIST ]--------------------------------------
#
INSERT into phpbb_config(config_name, config_value) VALUES ('topic_notification_enable', '0')
#
ALTER TABLE phpbb_users ADD user_notify_topic tinyint(1) DEFAULT 1 NOT NULL
#
ALTER TABLE phpbb_forums ADD topic_notify_enable tinyint(1) DEFAULT 0 NOT NULL
#
#-----[ END SQL LIST ]----------------------------------------
Please help.General Error
Could not query topic notification user information
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('(MOD) New Topic Notification', 2, 1195782124, 8, 0, 0, 0)
Line : 239
File : functions_post.php
Code: Select all
#-----[OPEN]--------------------------------------------------
#
/includes/functions_post.php
#
#-----[FIND]--------------------------------------------------
#
$topic_id = $db->sql_nextid();
#
#-----[AFTER, ADD]--------------------------------------------
#
//begin kk topic notification mod
//determine if notification if auto new topic notification is enabled for this forum
$sql_query = 'SELECT topic_notify_enable FROM ' . FORUMS_TABLE . ' WHERE forum_id = "' . $forum_id . '")';
if (!$result_topic_notification = $db->sql_query($sql_query) )
{
message_die(GENERAL_ERROR, 'Could not query topic notification user information', '', __LINE__, __FILE__, $sql);
}
$auto_enable_status = $db->sql_fetchrow($result_topic_notification);
//send new topic notification of enabled for this forum
if ( $auto_enable_status['topic_notify_enable'])
{
$sql_query = 'SELECT user_email
FROM ' . USERS_TABLE . '
JOIN ' . BANLIST_TABLE . ' ON user_id != ' . BANLIST_TABLE . '.ban_userid
WHERE user_active = "1" AND user_notify_topic = "1" AND user_id != "-1"';
if ( !$result_topic_notification = $db->sql_query($sql_query) )
{
message_die(CRITICAL_ERROR, "Could not query topic notification user information", "", __LINE__, __FILE__, $sql);
}
//evaluate the number users found
$numRows_user_data = $db->sql_numrows($result_user_data);
//if one or more users are found send topic notification email
if ( $numRows_user_data > 0)
{
//place user names and email addresses into arrays
$bcc_list = array();
$i = 0;
while ($row_user_data = $db->sql_fetchrow($result_user_data))
{
$bcc_list[$i] = $row_user_data['user_email'];
$i = $i + 1;
}
//send new topic notification posts
//the following code is taken from the phpbb program admin_mass_email.php and adapted for use with this mod
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
{
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
for ($i = 0; $i < count($bcc_list); $i++)
{
$emailer->bcc($bcc_list[$i]);
}
//create anti-abuse headers
$email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
$emailer->use_template('admin_send_email');
$emailer->email_address('Undisclosed-recipients:;');
$emailer->set_subject($lang['notification_title']);
$emailer->extra_headers($email_headers);
//email batch size - the number of receipients assigned to email
$emailer->loop_counter('10');
//number of email addresses recovered
$emailer->email_recipients($numRows_user_data);
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
$server_name = trim($board_config['server_name']) . '/';
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';
$sql_query = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = "' . $forum_id . '"';
if ( !$result_forum_name = $db->sql_query($sql_query) )
{
message_die(CRITICAL_ERROR, "Could not query topic notification user information", "", __LINE__, __FILE__, $sql);
}
$forum_name = $db->sql_fetchrow($result_forum_name);
$mailBody = $lang['notification_text_1'] . $forum_name['forum_name'] . $lang['notification_text_2'] . "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_3'] . $post_subject . '.' . "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_4'] . "\r\n" . "\r\n";
$mailBody .= $server_protocol . $server_name . 'forum/viewtopic.php?' . POST_FORUM_URL . '=' . $forum_id . '&' . POST_TOPIC_URL . '=' . $topic_id;
$mailBody .= "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_5'] . "\r\n" . "\r\n";
$mailBody .= $server_protocol . $server_name . 'forum/viewforum.php?' . POST_FORUM_URL . '=' . $forum_id;
$mailBody .= "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_6'] . "\r\n" . "\r\n";
$mailBody .= $server_protocol . $server_name . "forum/profile.php?mode=editprofile";
$mailBody .= "\r\n" . "\r\n";
$mailBody .= $lang['notification_disclaimer_1'] . $board_config['sitename'] . "\r\n" . "\r\n" . $lang['notification_disclaimer_2'] . $board_config['board_email'] . $lang['notification_disclaimer_3'] . "\r\n" . "\r\n";
$mailBody .= $lang['notification_disclaimer_4'];
//send email notification to forum users
$emailer->set_text($mailBody);
$emailer->mass_send();
$emailer->reset();
}
}
//end kk topic notification mod
Code: Select all
#-----[OPEN]--------------------------------------------------
#
/includes/functions_post.php
#
#-----[FIND]--------------------------------------------------
#
$topic_id = $db->sql_nextid();
#
#-----[AFTER, ADD]--------------------------------------------
#
//begin kk topic notification mod
//determine if notification if auto new topic notification is enabled for this forum
$sql_query = 'SELECT topic_notify_enable FROM ' . FORUMS_TABLE . ' WHERE forum_id = "' . $forum_id . '"';
if (!$result_topic_notification = $db->sql_query($sql_query) )
{
message_die(GENERAL_ERROR, 'Could not query topic notification user information', '', __LINE__, __FILE__, $sql_query);
}
$auto_enable_status = $db->sql_fetchrow($result_topic_notification);
//send new topic notification of enabled for this forum
if ( $auto_enable_status['topic_notify_enable'])
{
$sql_query = 'SELECT user_email
FROM ' . USERS_TABLE . '
JOIN ' . BANLIST_TABLE . ' ON user_id != ' . BANLIST_TABLE . '.ban_userid
WHERE user_active = "1" AND user_notify_topic = "1" AND user_id != "-1"';
if ( !$result_topic_notification = $db->sql_query($sql_query) )
{
message_die(CRITICAL_ERROR, "Could not query topic notification user information", "", __LINE__, __FILE__, $sql);
}
//evaluate the number users found
$numRows_user_data = $db->sql_numrows($result_user_data);
//if one or more users are found send topic notification email
if ( $numRows_user_data > 0)
{
//place user names and email addresses into arrays
$bcc_list = array();
$i = 0;
while ($row_user_data = $db->sql_fetchrow($result_user_data))
{
$bcc_list[$i] = $row_user_data['user_email'];
$i = $i + 1;
}
//send new topic notification posts
//the following code is taken from the phpbb program admin_mass_email.php and adapted for use with this mod
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
{
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
for ($i = 0; $i < count($bcc_list); $i++)
{
$emailer->bcc($bcc_list[$i]);
}
//create anti-abuse headers
$email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
$emailer->use_template('admin_send_email');
$emailer->email_address('Undisclosed-recipients:;');
$emailer->set_subject($lang['notification_title']);
$emailer->extra_headers($email_headers);
//email batch size - the number of receipients assigned to email
$emailer->loop_counter('10');
//number of email addresses recovered
$emailer->email_recipients($numRows_user_data);
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
$server_name = trim($board_config['server_name']) . '/';
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';
$sql_query = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = "' . $forum_id . '"';
if ( !$result_forum_name = $db->sql_query($sql_query) )
{
message_die(CRITICAL_ERROR, "Could not query topic notification user information", "", __LINE__, __FILE__, $sql);
}
$forum_name = $db->sql_fetchrow($result_forum_name);
$mailBody = $lang['notification_text_1'] . $forum_name['forum_name'] . $lang['notification_text_2'] . "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_3'] . $post_subject . '.' . "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_4'] . "\r\n" . "\r\n";
$mailBody .= $server_protocol . $server_name . 'forum/viewtopic.php?' . POST_FORUM_URL . '=' . $forum_id . '&' . POST_TOPIC_URL . '=' . $topic_id;
$mailBody .= "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_5'] . "\r\n" . "\r\n";
$mailBody .= $server_protocol . $server_name . 'forum/viewforum.php?' . POST_FORUM_URL . '=' . $forum_id;
$mailBody .= "\r\n" . "\r\n";
$mailBody .= $lang['notification_text_6'] . "\r\n" . "\r\n";
$mailBody .= $server_protocol . $server_name . "forum/profile.php?mode=editprofile";
$mailBody .= "\r\n" . "\r\n";
$mailBody .= $lang['notification_disclaimer_1'] . $board_config['sitename'] . "\r\n" . "\r\n" . $lang['notification_disclaimer_2'] . $board_config['board_email'] . $lang['notification_disclaimer_3'] . "\r\n" . "\r\n";
$mailBody .= $lang['notification_disclaimer_4'];
//send email notification to forum users
$emailer->set_text($mailBody);
$emailer->mass_send();
$emailer->reset();
}
}
//end kk topic notification mod
Warning: reset(): Passed variable is not an array or object in C:\Domains\mydomain\wwwroot\forum\includes\emailer.php on line 269
Warning: Variable passed to each() is not an array or object in C:\Domains\mydomain\wwwroot\forum\includes\emailer.php on line 270
Warning: reset(): Passed variable is not an array or object in C:\Domains\mydomain\wwwroot\forum\includes\emailer.php on line 276
Warning: Variable passed to each() is not an array or object in C:\Domains\mydomain\wwwroot\forum\includes\emailer.php on line 277
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Domains\mydomain\wwwroot\forum\includes\smtp.php on line 34