Kod: Tümünü seç
##############################################################
## MOD Title: Moved_Topic_Mail
## MOD Author: Wicher <N/A> (N/A) http://www.detecties.com/phpbb2018
## MOD Description: This mod will send an e-mail to the topicstarter when an admin or moderater
## moves his topic to another location on the board.
## The mail contains the topic title, the old forum where it was and the
## new forum where it went.
## Also the mail contains a link to the users profile so they can set the preferences
## for this mail.
##
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 10 Minutes ( 1 minute with easymod)
##
## Files To Edit: modcp.php
## language/lang_main.php
## includes/usercp_register.php
## templates/subSilver/profile_add_body.tpl
##
## Included Files: topic_moved.tpl
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## This mod has been tested on phpbb 2.0.21
##
##############################################################
## MOD History:
##
## Submitted to phpbb 1.0.0 09-26-2006
##
## DEVelopment state 0.0.1 09-12-2006
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#
If you want a dutch version of topic_moved.tpl look in the install folder, you will find it in the directory language/lang_dutch/email
Copy it to language/lang_dutch/email/topic_moved.tpl
#
#-----[ SQL ]------------------------------------------
#
# change phpbb_ to the database prefix you use
#
ALTER TABLE phpbb_users ADD user_topic_move_mail TINYINT(1) DEFAULT '1';
#
#-----[ COPY ]------------------------------------------
#
copy language/lang_english/email/topic_moved.tpl to language/lang_english/email/topic_moved.tpl
#
#-----[ OPEN ]------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------
#
// Sync the forum indexes
sync('forum', $new_forum_id);
sync('forum', $old_forum_id);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// begin topic moved mailer by Wicher
// making sure there is an end /
if ($userdata['user_topic_move_mail'] == '1')
{
$bcsp = rtrim($board_config['script_path'], '/');
$bcsp = $bcsp . '/';
// old forumname
$sql = "SELECT f.forum_name, c.cat_title
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE f.forum_id = $old_forum_id
AND c.cat_id = f.cat_id";
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not select from forums or catagory table', '', __LINE__, __FILE__, $sql);
}
if ($oldnamerow = $db->sql_fetchrow($result))
{
$oldcatname = $oldnamerow['cat_title'];
$oldforumname = $oldnamerow['forum_name'];
}
$db->sql_freeresult($result);
// new forumname
$sql = "SELECT f.forum_name, c.cat_title
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE f.forum_id = $new_forum_id
AND c.cat_id = f.cat_id";
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not select from forums or catagory table', '', __LINE__, __FILE__, $sql);
}
if ($newnamerow = $db->sql_fetchrow($result))
{
$newcatname = $newnamerow['cat_title'];
$newforumname = $newnamerow['forum_name'];
}
$db->sql_freeresult($result);
// topictitle, username, useremail
$sql = "SELECT t.topic_id, t.topic_title, u.username, u.user_email, u.user_lang
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
WHERE t.topic_id IN ($topic_list)
AND t.topic_poster = u.user_id";
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not select from topic or users table', '', __LINE__, __FILE__, $sql);
}
$mailrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
for($i = 0; $i < count($mailrow); $i++)
{
//emailer
include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('topic_moved', $mailrow[$i]['user_lang']);
$emailer->email_address($mailrow[$i]['user_email']);
$emailer->set_subject($lang['topic_moved']);
$emailer->assign_vars(array(
'SUBJECT' => $lang['topic_moved'],
'SITENAME' => $board_config['sitename'],
'BOARD_URL' => 'http://'.$board_config['server_name'].$board_config['script_path'],
'TOPICPOSTER' => $mailrow[$i]['username'],
'TOPICTITLE' => $mailrow[$i]['topic_title'],
'OLD_CATAGORIE_NAME' => $oldcatname,
'OLD_FORUM_NAME' => $oldforumname,
'NEW_CATAGORIE_NAME' => $newcatname,
'NEW_FORUM_NAME' => $newforumname,
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
'MOVED_URL' => 'http://'.$board_config['server_name'].$bcsp.'viewtopic.'.$phpEx.'?'.POST_TOPIC_URL.'='.$mailrow[$i]['topic_id'],
'PROFILE_LINK' => 'http://'.$board_config['server_name'].$bcsp.'profile.'.$phpEx.'?mode=editprofile')
);
$emailer->send();
$emailer->reset();
}
}
// end topic moved mailer by Wicher
#
#-----[ FIND ]------------------------------------------
#
$message = $lang['Topics_Moved'] . '<br /><br />';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'<br /><br />'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
. $lang['mail_send'] . '<br /><br />'
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
if ( $mode == 'register' )
{
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$mail_on_topic_move = ( isset($HTTP_POST_VARS['topic_move_mail']) ) ? ( ($HTTP_POST_VARS['topic_move_mail']) ? TRUE : 0 ) : TRUE;
#
#-----[ FIND ]------------------------------------------
#
$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$mail_on_topic_move = ( isset($HTTP_POST_VARS['topic_move_mail']) ) ? ( ($HTTP_POST_VARS['topic_move_mail']) ? TRUE : 0 ) : $userdata['user_topic_move_mail'];
#
#-----[ FIND ]------------------------------------------
# note: this is a partal search, the full line is longer.
SET " . $username_sql . $passwd_sql . "user_email = '"
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_email = '" . str_replace("\'", "''", $email) ."'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_topic_move_mail = $mail_on_topic_move
#
#-----[ FIND ]------------------------------------------
# note: this is a partal search, the full line is longer.
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, user_email
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_topic_move_mail
#
#-----[ FIND ]------------------------------------------
# note: this is a partal search, the full line is longer.
VALUES ($user_id, '" . str_replace("\'", "''", $username
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, '" . str_replace("\'", "''", $email) . "'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $mail_on_topic_move
#
#-----[ FIND ]------------------------------------------
#
$allowsmilies = $userdata['user_allowsmile'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$mail_on_topic_move = $userdata['user_topic_move_mail'];
#
#-----[ FIND ]------------------------------------------
#
'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'TOPIC_MOVE_YES' => ( $mail_on_topic_move ) ? 'checked="checked"' : '',
'TOPIC_MOVE_NO' => ( !$mail_on_topic_move ) ? 'checked="checked"' : '',
#
#-----[ FIND ]------------------------------------------
#
'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_TOPIC_MOVE' => $lang['topic_move'],
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<input type="radio" name="allowsmilies" value="0" {ALWAYS_ALLOW_SMILIES_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_TOPIC_MOVE}:</span></td>
<td class="row2">
<input type="radio" name="topic_move_mail" value="1" {TOPIC_MOVE_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="topic_move_mail" value="0" {TOPIC_MOVE_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Total_votes'] = 'Total Votes';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// topic moved mailer by Wicher
$lang['topic_moved'] = 'A topic you created has been moved.';
$lang['mail_send'] = 'The topicstarter(s) has been / are notified trough e-mail .';
$lang['topic_move'] = 'Mail me when a topic, started by me, has been moved';
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM