email topic, minor other changes, removed updating of parent forums upon posting (handled by functions_display)

git-svn-id: file:///svn/phpbb/trunk@3980 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-05-05 22:48:17 +00:00
parent becf5f5199
commit 9551bfbc52
10 changed files with 210 additions and 166 deletions

View file

@ -964,6 +964,11 @@ function login_forum_box(&$forum_data)
{ {
global $db, $config, $user, $template, $phpEx; global $db, $config, $user, $template, $phpEx;
//TODO
if ($forum_data['parent_id'])
{
}
$sql = 'SELECT * $sql = 'SELECT *
FROM phpbb_forum_access FROM phpbb_forum_access
WHERE forum_id = ' . $forum_data['forum_id'] . ' WHERE forum_id = ' . $forum_data['forum_id'] . '
@ -1008,16 +1013,10 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
switch ($errno) switch ($errno)
{ {
case E_WARNING: case E_WARNING:
if (defined('DEBUG_EXTRA'))
{
// echo "PHP Warning on line <b>$errline</b> in <b>$errfile</b> :: <b>$msg_text</b><br />";
}
break;
case E_NOTICE: case E_NOTICE:
if (defined('DEBUG_EXTRA')) if (defined('DEBUG_EXTRA'))
{ {
echo "PHP Notice on line <b>$errline</b> in <b>$errfile</b> :: <b>$msg_text</b><br />"; // echo "PHP Notice on line <b>$errline</b> in <b>$errfile</b> :: <b>$msg_text</b><br />";
} }
break; break;

View file

@ -197,16 +197,15 @@ function update_last_post_information($type, $id)
{ {
case 'forum': case 'forum':
$sql_select_add = ', f.forum_parents'; $sql_select_add = ', f.forum_parents';
// $sql_select_add = ', f.left_id';
$sql_table_add = ', ' . FORUMS_TABLE . ' f'; $sql_table_add = ', ' . FORUMS_TABLE . ' f';
$sql_where_add = 'AND (t.forum_id = f.forum_id) AND (f.forum_id = ' . $id . ')'; $sql_where_add = 'AND t.forum_id = f.forum_id AND f.forum_id = ' . $id;
$sql_update_table = FORUMS_TABLE; $sql_update_table = FORUMS_TABLE;
break; break;
case 'topic': case 'topic':
$sql_select_add = ''; $sql_select_add = '';
$sql_table_add = ''; $sql_table_add = '';
$sql_where_add = 'AND (t.topic_id = ' . $id . ')'; $sql_where_add = 'AND t.topic_id = ' . $id;
$sql_update_table = TOPICS_TABLE; $sql_update_table = TOPICS_TABLE;
break; break;
default: default:
@ -226,36 +225,16 @@ function update_last_post_information($type, $id)
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
switch ($type)
{
case 'forum':
// Update forums: last post info, topics, posts ... we need to update
// each parent too ...
$forum_ids = $id;
$forum_parents = get_forum_parents($row);
foreach ($forum_parents as $parent_forum_id => $parent_name)
{
$forum_ids .= ', ' . $parent_forum_id;
}
$where_clause = 'forum_id IN (' . $forum_ids . ')';
break;
case 'topic':
$where_clause = 'topic_id = ' . $id;
break;
}
$update_sql = array( $update_sql = array(
$type . '_last_post_id' => intval($row['post_id']), $type . '_last_post_id' => (int) $row['post_id'],
$type . '_last_post_time' => intval($row['post_time']), $type . '_last_post_time' => (int) $row['post_time'],
$type . '_last_poster_id' => intval($row['poster_id']), $type . '_last_poster_id' => (int) $row['poster_id'],
$type . '_last_poster_name' => (intval($row['poster_id']) == ANONYMOUS) ? trim($row['post_username']) : trim($row['username']) $type . '_last_poster_name' => (string) ($row['poster_id'] == ANONYMOUS) ? trim($row['post_username']) : trim($row['username'])
); );
$sql = 'UPDATE ' . $sql_update_table . ' SET ' . $db->sql_build_array('UPDATE', $update_sql) . ' WHERE ' . $where_clause; $sql = 'UPDATE ' . $sql_update_table . '
SET ' . $db->sql_build_array('UPDATE', $update_sql) . '
WHERE ' . (($type == 'forum') ? "forum_id = $id" : "topic_id = $id");
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -1107,7 +1086,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
} }
// Fulltext parse // Fulltext parse
if ($mode != 'edit' || $post_data['message_md5'] != $post_data['post_checksum']) if ($post_data['message_md5'] != $post_data['post_checksum'])
{ {
$result = $search->add($mode, $post_data['post_id'], $message, $subject); $result = $search->add($mode, $post_data['post_id'], $message, $subject);
} }
@ -1115,15 +1094,6 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
// Sync forums, topics and users ... // Sync forums, topics and users ...
if ($mode != 'edit') if ($mode != 'edit')
{ {
// Update forums: last post info, topics, posts ... we need to update
// each parent too ...
$forum_ids = $post_data['forum_id'];
$forum_parents = get_forum_parents($post_data);
foreach ($forum_parents as $parent_forum_id => $parent_name)
{
$forum_ids .= ', ' . $parent_forum_id;
}
$forum_topics_sql = ($mode == 'post') ? ', forum_topics = forum_topics + 1, forum_topics_real = forum_topics_real + 1' : ''; $forum_topics_sql = ($mode == 'post') ? ', forum_topics = forum_topics + 1, forum_topics_real = forum_topics_real + 1' : '';
$forum_sql = array( $forum_sql = array(
'forum_last_post_id' => $post_data['post_id'], 'forum_last_post_id' => $post_data['post_id'],
@ -1132,7 +1102,9 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
'forum_last_poster_name'=> ($user->data['user_id'] == ANONYMOUS) ? stripslashes($username) : $user->data['username'], 'forum_last_poster_name'=> ($user->data['user_id'] == ANONYMOUS) ? stripslashes($username) : $user->data['username'],
); );
$sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $forum_sql) . ', forum_posts = forum_posts + 1' . $forum_topics_sql . ' WHERE forum_id IN (' . $forum_ids . ')'; $sql = 'UPDATE ' . FORUMS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $forum_sql) . ', forum_posts = forum_posts + 1' . $forum_topics_sql . '
WHERE forum_id = ' . $post_data['forum_id'];
$db->sql_query($sql); $db->sql_query($sql);
// Update topic: first/last post info, replies // Update topic: first/last post info, replies
@ -1151,7 +1123,9 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
} }
$topic_replies_sql = ($mode == 'reply' || $mode == 'quote') ? ', topic_replies = topic_replies + 1, topic_replies_real = topic_replies_real + 1' : ''; $topic_replies_sql = ($mode == 'reply' || $mode == 'quote') ? ', topic_replies = topic_replies + 1, topic_replies_real = topic_replies_real + 1' : '';
$sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $topic_sql) . $topic_replies_sql . ' WHERE topic_id = ' . $post_data['topic_id']; $sql = 'UPDATE ' . TOPICS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $topic_sql) . $topic_replies_sql . '
WHERE topic_id = ' . $post_data['topic_id'];
$db->sql_query($sql); $db->sql_query($sql);
// Update user post count ... if appropriate // Update user post count ... if appropriate
@ -1173,13 +1147,13 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
} }
// Topic Notification // Topic Notification
if ((!$post_data['notify_set']) && ($post_data['notify'])) if (!$post_data['notify_set'] && $post_data['notify'])
{ {
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id) $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id)
VALUES (" . $user->data['user_id'] . ", " . $post_data['topic_id'] . ")"; VALUES (" . $user->data['user_id'] . ", " . $post_data['topic_id'] . ")";
$db->sql_query($sql); $db->sql_query($sql);
} }
else if (($post_data['notify_set']) && (!$post_data['notify'])) else if ($post_data['notify_set'] && !$post_data['notify'])
{ {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE user_id = " . $user->data['user_id'] . " WHERE user_id = " . $user->data['user_id'] . "
@ -1194,14 +1168,12 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
$db->sql_transaction('commit'); $db->sql_transaction('commit');
// Send Notifications // Send Notifications
if (($mode != 'edit') && ($mode != 'delete')) if ($mode != 'edit' && $mode != 'delete')
{ {
user_notification($mode, stripslashes($post_data['subject']), $post_data['forum_id'], $post_data['topic_id'], $post_data['post_id']); user_notification($mode, stripslashes($post_data['subject']), $post_data['forum_id'], $post_data['topic_id'], $post_data['post_id']);
} }
$template->assign_vars(array( meta_refresh(3, "viewtopic.$phpEx$SID&amp;f=" . $post_data['forum_id'] . '&amp;p=' . $post_data['post_id'] . '#' . $post_data['post_id']);
'META' => '<meta http-equiv="refresh" content="5; url=viewtopic.' . $phpEx . $SID . '&amp;f=' . $post_data['forum_id'] . '&amp;p=' . $post_data['post_id'] . '#' . $post_data['post_id'] . '">')
);
$message = ($auth->acl_get('f_moderate', $post_data['forum_id']) && !$auth->acl_get('f_ignorequeue', $post_data['forum_id'])) ? 'POST_STORED_MOD' : 'POST_STORED'; $message = ($auth->acl_get('f_moderate', $post_data['forum_id']) && !$auth->acl_get('f_ignorequeue', $post_data['forum_id'])) ? 'POST_STORED_MOD' : 'POST_STORED';
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="viewtopic.' . $phpEx . $SID .'&p=' . $post_data['post_id'] . '#' . $post_data['post_id'] . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID .'&amp;f=' . $post_data['forum_id'] . '">', '</a>'); $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="viewtopic.' . $phpEx . $SID .'&p=' . $post_data['post_id'] . '#' . $post_data['post_id'] . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID .'&amp;f=' . $post_data['forum_id'] . '">', '</a>');

View file

@ -84,7 +84,7 @@ class parse_message
} }
// Smiley check // Smiley check
if (intval($config['max_post_smilies']) && $smilies ) if (intval($config['max_post_smilies']) && $smilies)
{ {
$sql = "SELECT code $sql = "SELECT code
FROM " . SMILIES_TABLE; FROM " . SMILIES_TABLE;
@ -304,7 +304,7 @@ class parse_message
$str_to = array('&#91;', '&#93;', '&#46;'); $str_to = array('&#91;', '&#93;', '&#46;');
$out .= "[code=$stx:" . $this->bbcode_uid . ']' . str_replace($str_from, $str_to, $code) . '[/code:' . $this->bbcode_uid . ']'; $out .= "[code=$stx:" . $this->bbcode_uid . ']' . str_replace($str_from, $str_to, $code) . '[/code:' . $this->bbcode_uid . ']';
break; break;
default: default:
$str_from = array('<', '>', '[', ']', '.'); $str_from = array('<', '>', '[', ']', '.');
@ -361,7 +361,7 @@ class parse_message
$out .= $tag . ']'; $out .= $tag . ']';
$tok = '['; $tok = '[';
} }
elseif (preg_match('/list(=?(?:[0-9]|[a-z]|))/i', $buffer, $m)) elseif (preg_match('#list(=?(?:[0-9]|[a-z]|))#i', $buffer, $m))
{ {
// sub-list, add a closing tag // sub-list, add a closing tag
array_push($close_tags, (($m[1]) ? '/list:o:' . $this->bbcode_uid : '/list:u:' . $this->bbcode_uid)); array_push($close_tags, (($m[1]) ? '/list:o:' . $this->bbcode_uid : '/list:u:' . $this->bbcode_uid));
@ -820,7 +820,7 @@ class fulltext_search
$words = array(); $words = array();
if ($mode == 'edit') if ($mode == 'edit')
{ {
$sql = "SELECT w.word_id, w.word_text, m.title_match echo $sql = "SELECT w.word_id, w.word_text, m.title_match
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
WHERE m.post_id = " . intval($post_id) . " WHERE m.post_id = " . intval($post_id) . "
AND w.word_id = m.word_id"; AND w.word_id = m.word_id";

View file

@ -70,8 +70,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes','4')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','address@yourdomain.com'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','address@yourdomain.tld');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact','contact@yourdomain.com'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact','contact@yourdomain.tld');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_port','25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_port','25');

View file

@ -1,9 +1,9 @@
Subject: {SITENAME} - Email a friend Subject: {SITENAME} - Email a friend
Charset: iso-8859-1 Charset: iso-8859-1
Hello, Hello {TO_USERNAME},
This email was sent from "{SITENAME}" by {USERNAME} who thought you may be interested in the following topic. This email was sent from "{SITENAME}" by {FROM_USERNAME} who thought you may be interested in the following topic:
{TOPIC_NAME} {TOPIC_NAME}

View file

@ -360,11 +360,11 @@ $lang = array(
'ALL_TOPICS' => 'All Topics', 'ALL_TOPICS' => 'All Topics',
'VIEW_TOPIC_ANNOUNCEMENT'=> 'Announcement', 'VIEW_TOPIC_ANNOUNCEMENT'=> 'Announcement: ',
'VIEW_TOPIC_STICKY' => 'Sticky', 'VIEW_TOPIC_STICKY' => 'Sticky: ',
'VIEW_TOPIC_MOVED' => 'Moved', 'VIEW_TOPIC_MOVED' => 'Moved: ',
'VIEW_TOPIC_POLL' => 'Poll', 'VIEW_TOPIC_POLL' => 'Poll: ',
'VIEW_TOPIC_LOCKED' => 'Locked', 'VIEW_TOPIC_LOCKED' => 'Locked: ',
'MARK_TOPICS_READ' => 'Mark all topics read', 'MARK_TOPICS_READ' => 'Mark all topics read',
'TOPICS_MARKED' => 'The topics for this forum have now been marked read', 'TOPICS_MARKED' => 'The topics for this forum have now been marked read',
@ -837,12 +837,19 @@ $lang = array(
'SEND_EMAIL' => 'Send Email', 'SEND_EMAIL' => 'Send Email',
'NO_EMAIL' => 'You are not permitted to send email to this user.', 'NO_EMAIL' => 'You are not permitted to send email to this user.',
'CC_EMAIL' => 'Send a copy of this email to yourself', 'CC_EMAIL' => 'Send a copy of this email to yourself',
'RECIPIENT' => 'Recipient', 'RECIPIENT' => 'Recipient',
'EMAIL_SENT' => 'The email has been sent.', 'EMAIL_SENT' => 'The email has been sent.',
'EMAIL_BODY_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.', 'EMAIL_BODY_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.',
'EMAIL_TOPIC_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. Please note that the topic information is already included in the message. The return address for this message will be set to your email address.',
'REAL_NAME' => 'Recipient Name',
'DEST_LANG' => 'Language',
'DEST_LANG_EXPLAIN' => 'Select an appropriate language (if available) for the recipient of this message.',
'FLOOD_EMAIL_LIMIT' => 'You cannot send another email at this time. Please try again later.', 'FLOOD_EMAIL_LIMIT' => 'You cannot send another email at this time. Please try again later.',
'EMPTY_SUBJECT_EMAIL' => 'You must specify a subject for the email.', 'EMPTY_SUBJECT_EMAIL' => 'You must specify a subject for the email.',
'EMPTY_MESSAGE_EMAIL' => 'You must enter a message to be emailed.', 'EMPTY_MESSAGE_EMAIL' => 'You must enter a message to be emailed.',
'EMPTY_ADDRESS_EMAIL' => 'You must provide a valid email address for the recipient.',
'EMPTY_NAME_EMAIL' => 'You must enter the real name of the recipient.',
'NO_VIEW_USERS' => 'You are not authorised to view the member list or profiles.', 'NO_VIEW_USERS' => 'You are not authorised to view the member list or profiles.',
'VIEWING_PROFILE' => 'Profile view', 'VIEWING_PROFILE' => 'Profile view',

View file

@ -34,6 +34,7 @@ $auth->acl($user->data);
// Grab data // Grab data
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : ''; $mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
$user_id = (isset($_GET['u'])) ? intval($_GET['u']) : ANONYMOUS; $user_id = (isset($_GET['u'])) ? intval($_GET['u']) : ANONYMOUS;
$topic_id = (isset($_GET['t'])) ? intval($_GET['t']) : 0;
switch ($mode) switch ($mode)
@ -253,31 +254,12 @@ switch ($mode)
$page_title = $user->lang['SEND_EMAIL']; $page_title = $user->lang['SEND_EMAIL'];
$template_html = 'memberlist_email.html'; $template_html = 'memberlist_email.html';
if ($user_id == ANONYMOUS) if ($user_id == ANONYMOUS && !$topic_id)
{
trigger_error($user->lang['NO_USER']);
}
if (empty($config['board_email_form']) || empty($config['email_enable']) || !$auth->acl_gets('u_sendemail', 'a_user'))
{ {
trigger_error($user->lang['NO_EMAIL']); trigger_error($user->lang['NO_EMAIL']);
} }
// Get the appropriate username, etc. if (empty($config['board_email_form']) || empty($config['email_enable']) || !$auth->acl_get('u_sendemail'))
$sql = "SELECT username, user_email, user_viewemail, user_lang
FROM " . USERS_TABLE . "
WHERE user_id = $user_id
AND user_active = 1";
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error($$user->lang['NO_USER']);
}
$db->sql_freeresult($result);
// Can we send email to this user?
if (empty($row['user_viewemail']) && !$auth->acl_get('a_user'))
{ {
trigger_error($user->lang['NO_EMAIL']); trigger_error($user->lang['NO_EMAIL']);
} }
@ -288,32 +270,89 @@ switch ($mode)
trigger_error($lang['FLOOD_EMAIL_LIMIT']); trigger_error($lang['FLOOD_EMAIL_LIMIT']);
} }
$email_lang = (!empty($_POST['lang'])) ? htmlspecialchars($_POST['lang']) : '';
$name = (!empty($_POST['name'])) ? trim(strip_tags($_POST['name'])) : '';
$email = (!empty($_POST['email'])) ? trim(strip_tags($_POST['email'])) : '';
$subject = (!empty($_POST['subject'])) ? trim(stripslashes($_POST['subject'])) : '';
$message = (!empty($_POST['message'])) ? trim(stripslashes($_POST['message'])) : '';
// Are we sending an email to a user on this board? Or are we sending a
// topic heads-up message?
if (!$topic_id)
{
// Get the appropriate username, etc.
$sql = "SELECT username, user_email, user_viewemail, user_lang
FROM " . USERS_TABLE . "
WHERE user_id = $user_id
AND user_active = 1";
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_USER']);
}
$db->sql_freeresult($result);
// Can we send email to this user?
if (empty($row['user_viewemail']) && !$auth->acl_get('a_user'))
{
trigger_error($user->lang['NO_EMAIL']);
}
}
else
{
$sql = "SELECT forum_id, topic_title
FROM " . TOPICS_TABLE . "
WHERE topic_id = $topic_id";
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_TOPIC']);
}
$db->sql_freeresult($result);
if (!$auth->acl_get('f_read', $row['forum_id']))
{
trigger_error($user->lang['NO_FORUM_READ']);
}
if (!$auth->acl_get('f_email', $row['forum_id']))
{
trigger_error($user->lang['NO_EMAIL']);
}
}
// User has submitted a message, handle it // User has submitted a message, handle it
$error = array();
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$error = FALSE; if (!$topic_id)
if (isset($_POST['subject']) && trim($_POST['subject']) != '')
{ {
$subject = trim(stripslashes($_POST['subject'])); if ($subject == '')
{
$error[] = $user->lang['EMPTY_SUBJECT_EMAIL'];
}
if ($message == '')
{
$error[] = $user->lang['EMPTY_MESSAGE_EMAIL'];
}
} }
else else
{ {
$error = TRUE; if ($email == '' || !preg_match('#^.*?@(.*?\.)?[a-z0-9\-]+\.[a-z]{2,4}$#i', $email))
$error_msg = (!empty($error_msg)) ? $error_msg . '<br />' . $lang['EMPTY_SUBJECT_EMAIL'] : $lang['EMPTY_SUBJECT_EMAIL']; {
$error[] = $user->lang['EMPTY_ADDRESS_EMAIL'];
}
if ($name == '')
{
$error[] = $user->lang['EMPTY_NAME_EMAIL'];
}
} }
if (isset($_POST['message']) && trim($_POST['message']) != '') if (!sizeof($error))
{
$message = trim(stripslashes($_POST['message']));
}
else
{
$error = TRUE;
$error_msg = (!empty($error_msg)) ? $error_msg . '<br />' . $lang['EMPTY_MESSAGE_EMAIL'] : $lang['EMPTY_MESSAGE_EMAIL'];
}
if (!$error)
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_emailtime = " . time() . " SET user_emailtime = " . time() . "
@ -323,17 +362,27 @@ switch ($mode)
include($phpbb_root_path . 'includes/emailer.'.$phpEx); include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer(); $emailer = new emailer();
$emailer->template('profile_send_email', $row['user_lang']); $email_tpl = (!$topic_id) ? 'profile_send_email' : 'email_notify';
$email_lang = (!$topic_id) ? $row['user_lang'] : $email_lang;
$emailer->template($email_tpl, $email_lang);
$emailer->subject($subject); $emailer->subject($subject);
$emailer->replyto($user->data['user_email']); $emailer->replyto($user->data['user_email']);
$emailer->to($row['user_email'], $row['username']); if (!$topic_id)
{
$emailer->to($row['user_email'], $row['username']);
}
else
{
$emailer->to($email, $name);
}
if (!empty($_POST['cc_email'])) if (!empty($_POST['cc_email']))
{ {
$emailer->cc($user->data['user_email'], $user->data['username']); $emailer->cc($user->data['user_email'], $user->data['username']);
} }
$emailer->headers('X-AntiAbuse: Board servername - ' . $server_name); $emailer->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']); $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user->ip); $emailer->headers('X-AntiAbuse: User IP - ' . $user->ip);
@ -342,26 +391,42 @@ switch ($mode)
'SITENAME' => $config['sitename'], 'SITENAME' => $config['sitename'],
'BOARD_EMAIL' => $config['board_contact'], 'BOARD_EMAIL' => $config['board_contact'],
'FROM_USERNAME' => $user->data['username'], 'FROM_USERNAME' => $user->data['username'],
'TO_USERNAME' => $row['username'], 'TO_USERNAME' => ($topic_id) ? $name : $row['username'],
'MESSAGE' => $message) 'MESSAGE' => $message,
'TOPIC_NAME' => ($topic_id) ? strtr($row['topic_title'], array_flip(get_html_translation_table(HTML_ENTITIES))) : '',
'U_TOPIC' => ($topic_id) ? generate_board_url() . "/viewtopic.$phpEx?f=" . $row['forum_id'] . "&t=topic_id" : '')
); );
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
$template->assign_vars(array( meta_refresh(3, "index.$phpEx$SID");
'META' => '<meta http-equiv="refresh" content="3;url=' . "index.$phpEx$SID" . '">') $message = (!$topic_id) ? sprintf($user->lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a>') : sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=" . $row['topic_id'] . '">', '</a>');
); trigger_error($user->lang['EMAIL_SENT'] . '<br /><br />' . $message);
trigger_error($lang['EMAIL_SENT'] . '<br /><br />' . sprintf($lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a>'));
} }
} }
$template->assign_vars(array( if ($topic_id)
'USERNAME' => addslashes($row['username']), {
'ERROR_MESSAGE' => (!empty($error_msg)) ? $error_msg : '', $template->assign_vars(array(
'EMAIL' => htmlspecialchars($email),
'NAME' => htmlspecialchars($name),
'TOPIC_TITLE' => $row['topic_title'],
'S_POST_ACTION' => "memberlist.$phpEx$SID&amp;mode=email&amp;u=$user_id") 'U_TOPIC' => "viewtopic.$phpEx$SID&amp;f=" . $row['forum_id'] . "&amp;t=topic_id",
'S_LANG_OPTIONS'=> ($topic_id) ? language_select($email_lang) : '')
);
}
$template->assign_vars(array(
'USERNAME' => (!$topic_id) ? addslashes($row['username']) : '',
'ERROR_MESSAGE' => (sizeof($error)) ? implode('<br />', $error) : '',
'L_EMAIL_BODY_EXPLAIN' => (!$topic_id) ? $user->lang['EMAIL_BODY_EXPLAIN'] : $user->lang['EMAIL_TOPIC_EXPLAIN'],
'S_POST_ACTION' => (!$topic_id) ? "memberlist.$phpEx$SID&amp;mode=email&amp;u=$user_id" : "memberlist.$phpEx$SID&amp;mode=email&amp;f=$forum_id&amp;t=$topic_id",
'S_SEND_USER' => (!$topic_id) ? true : false)
); );
break; break;

View file

@ -110,8 +110,7 @@ switch ($mode)
WHERE t.topic_id = " . $topic_id . " WHERE t.topic_id = " . $topic_id . "
AND f.forum_id = t.forum_id"; AND f.forum_id = t.forum_id";
$forum_validate = true; $forum_validate = $topic_validate = true;
$topic_validate = true;
break; break;
case 'quote': case 'quote':
@ -128,9 +127,7 @@ switch ($mode)
AND t.topic_id = p.topic_id AND t.topic_id = p.topic_id
AND u.user_id = p.poster_id AND u.user_id = p.poster_id
AND f.forum_id = t.forum_id"; AND f.forum_id = t.forum_id";
$forum_validate = true; $forum_validate = $topic_validate = $post_validate = true;
$topic_validate = true;
$post_validate = true;
break; break;
case 'topicreview': case 'topicreview':
@ -361,8 +358,7 @@ if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
$topic_sql = array(); $topic_sql = array();
$forum_update_sql = ''; $forum_update_sql = $user_update_sql = '';
$user_update_sql = '';
$topic_update_sql = 'topic_replies = topic_replies - 1, topic_replies_real = topic_replies_real - 1'; $topic_update_sql = 'topic_replies = topic_replies - 1, topic_replies_real = topic_replies_real - 1';
// User tries to delete the post twice ? Exit... we do not want the topics table screwed up. // User tries to delete the post twice ? Exit... we do not want the topics table screwed up.
@ -379,10 +375,6 @@ if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['
$forum_update_sql .= 'forum_topics = forum_topics - 1, forum_topics_real = forum_topics_real - 1'; $forum_update_sql .= 'forum_topics = forum_topics - 1, forum_topics_real = forum_topics_real - 1';
} }
// TODO: delete common words... maybe just call search_tidy ? <- No, search tidy is intensive and should be
// called irregularly (at present).
// $search->del_words($post_id);
// Sync last post informations // Sync last post informations
$db->sql_transaction(); $db->sql_transaction();
@ -446,25 +438,22 @@ if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['
update_last_post_information('topic', $topic_id); update_last_post_information('topic', $topic_id);
} }
update_last_post_information('forum', $forum_id); update_last_post_information('forum', $forum_id);
$db->sql_transaction('commit'); $db->sql_transaction('commit');
if ($post_data['topic_first_post_id'] == $post_data['topic_last_post_id']) if ($post_data['topic_first_post_id'] == $post_data['topic_last_post_id'])
{ {
$meta_info = '<meta http-equiv="refresh" content="5; url=viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">'; $meta_info = "viewforum.$phpEx$SID&amp;f=$forum_id";
$message = $user->lang['DELETED']; $message = $user->lang['DELETED'];
} }
else else
{ {
$meta_info = '<meta http-equiv="refresh" content="5; url=viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">'; $meta_info = "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;p=" . $post_data['next_post_id'] . '#' . $post_data['next_post_id'];
$message = $user->lang['DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;p=" . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">', '</a>');
$message = $user->lang['DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">', '</a>');
} }
meta_refresh(4, $meta_info); meta_refresh(3, $meta_info);
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>'); $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&amp;f=$forum_id\">", '</a>');
trigger_error($message); trigger_error($message);
} }
else else
@ -509,7 +498,7 @@ if ($submit || $preview || $refresh)
$topic_cur_post_id = (isset($_POST['topic_cur_post_id'])) ? intval($_POST['topic_cur_post_id']) : false; $topic_cur_post_id = (isset($_POST['topic_cur_post_id'])) ? intval($_POST['topic_cur_post_id']) : false;
$subject = (!empty($_POST['subject'])) ? trim(htmlspecialchars(strip_tags($_POST['subject']))) : ''; $subject = (!empty($_POST['subject'])) ? trim(htmlspecialchars(strip_tags($_POST['subject']))) : '';
if ((strcmp($subject, strtoupper($subject)) == 0) && ($subject != '')) if (strcmp($subject, strtoupper($subject)) == 0 && $subject != '')
{ {
$subject = phpbb_strtolower($subject); $subject = phpbb_strtolower($subject);
} }
@ -526,11 +515,11 @@ if ($submit || $preview || $refresh)
$enable_smilies = ($config['allow_smilies'] && empty($_POST['disable_smilies']) && $auth->acl_get('f_smilies', $forum_id)) ? TRUE : FALSE; $enable_smilies = ($config['allow_smilies'] && empty($_POST['disable_smilies']) && $auth->acl_get('f_smilies', $forum_id)) ? TRUE : FALSE;
$enable_sig = ($config['allow_sig'] && !empty($_POST['attach_sig']) && $auth->acl_get('f_sigs', $forum_id)) ? TRUE : FALSE; $enable_sig = ($config['allow_sig'] && !empty($_POST['attach_sig']) && $auth->acl_get('f_sigs', $forum_id)) ? TRUE : FALSE;
*/ */
$enable_html = (!intval($config['allow_html'])) ? 0 : ((!empty($_POST['disable_html'])) ? 0 : 1); $enable_html = (!$config['allow_html']) ? 0 : ((!empty($_POST['disable_html'])) ? 0 : 1);
$enable_bbcode = (!intval($config['allow_bbcode'])) ? 0 : ((!empty($_POST['disable_bbcode'])) ? 0 : 1); $enable_bbcode = (!$config['allow_bbcode']) ? 0 : ((!empty($_POST['disable_bbcode'])) ? 0 : 1);
$enable_smilies = (!intval($config['allow_smilies'])) ? 0 : ((!empty($_POST['disable_smilies'])) ? 0 : 1); $enable_smilies = (!$config['allow_smilies']) ? 0 : ((!empty($_POST['disable_smilies'])) ? 0 : 1);
$enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1; $enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1;
$enable_sig = (!intval($config['allow_sig'])) ? false : ((!empty($_POST['attach_sig'])) ? true : false); $enable_sig = (!$config['allow_sig']) ? false : ((!empty($_POST['attach_sig'])) ? true : false);
$notify = (!empty($_POST['notify'])) ? true : false; $notify = (!empty($_POST['notify'])) ? true : false;
$topic_lock = (isset($_POST['lock_topic'])) ? true : false; $topic_lock = (isset($_POST['lock_topic'])) ? true : false;
@ -562,10 +551,7 @@ if ($submit || $preview || $refresh)
WHERE topic_id = ' . $topic_id; WHERE topic_id = ' . $topic_id;
$db->sql_query($sql); $db->sql_query($sql);
$poll_title = ''; $poll_title = $poll_length = $poll_option_text = $poll_max_options = '';
$poll_length = '';
$poll_option_text = '';
$poll_max_options = '';
} }
else else
{ {
@ -733,8 +719,8 @@ if ($submit || $preview || $refresh)
$auth_option = ''; $auth_option = '';
switch ($topic_type) switch ($topic_type)
{ {
case POST_NEWS: case POST_GLOBAL:
$auth_option = 'news'; $auth_option = 'global';
break; break;
case POST_ANNOUNCE: case POST_ANNOUNCE:
$auth_option = 'announce'; $auth_option = 'announce';
@ -846,7 +832,7 @@ if ($preview)
$template->assign_vars(array( $template->assign_vars(array(
'S_HAS_POLL_OPTIONS' => (sizeof($poll_options)) ? true : false, 'S_HAS_POLL_OPTIONS' => (sizeof($poll_options)) ? true : false,
'POLL_QUESTION' => $preview_poll_title) 'POLL_QUESTION' => $preview_poll_title)
); );
foreach ($poll_options as $option) foreach ($poll_options as $option)

View file

@ -34,20 +34,35 @@ return;
</tr> </tr>
<!-- IF ERROR_MESSAGE neq '' --> <!-- IF ERROR_MESSAGE neq '' -->
<tr> <tr>
<td class="row3" colspan="2"><span style="color:red">{ERROR_MESSAGE}</span></td> <td class="row3" colspan="2" align="center"><span class="gen" style="color:red">{ERROR_MESSAGE}</span></td>
</tr>
<!-- ENDIF -->
<!-- IF S_SEND_USER -->
<tr>
<td class="row1" width="35%"><b class="gen">{L_RECIPIENT}</b></td>
<td class="row2" width="65%"><b class="gen">{USERNAME}</b></td>
</tr>
<tr>
<td class="row1" width="35%"><b class="gen">{L_SUBJECT}</b></td>
<td class="row2"><input class="post" type="text" name="subject" size="50" maxlength="100" tabindex="2" value="{SUBJECT}" /></td>
</tr>
<!-- ELSE --->
<tr>
<td class="row1" width="35%"><b class="gen">{L_EMAIL_ADDRESS}</b></td>
<td class="row2"><input class="post" type="text" name="email" size="50" maxlength="100" value="{EMAIL}" /></td>
</tr>
<tr>
<td class="row1" width="35%"><b class="gen">{L_REAL_NAME}</b></td>
<td class="row2"><input class="post" type="text" name="name" size="50" maxlength="100" value="{NAME}" /></td>
</tr>
<tr>
<td class="row1" width="35%"><b class="gen">{L_DEST_LANG}</b><br /><span class="gensmall">{L_DEST_LANG_EXPLAIN}</span></td>
<td class="row2"><select name="lang">{S_LANG_OPTIONS}</select></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<tr>
<td class="row1" width="22%"><b class="gen">{L_RECIPIENT}</b></td>
<td class="row2" width="78%"><b class="gen">{USERNAME}</b></td>
</tr>
<tr>
<td class="row1"><b class="gen">{L_SUBJECT}</b></td>
<td class="row2"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="100" tabindex="2" value="{SUBJECT}" /></td>
</tr>
<tr> <tr>
<td class="row1" valign="top"><b class="gen">{L_MESSAGE_BODY}</b><br /><span class="gensmall">{L_EMAIL_BODY_EXPLAIN}</span></td> <td class="row1" valign="top"><b class="gen">{L_MESSAGE_BODY}</b><br /><span class="gensmall">{L_EMAIL_BODY_EXPLAIN}</span></td>
<td class="row2"><textarea class="post" style="width:500px" name="message" rows="25" cols="40" tabindex="3">{MESSAGE}</textarea></td> <td class="row2"><textarea class="post" name="message" rows="15" cols="76" tabindex="3">{MESSAGE}</textarea></td>
</tr> </tr>
<tr> <tr>
<td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span></td> <td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span></td>

View file

@ -453,7 +453,7 @@ $template->assign_vars(array(
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url, 'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url, 'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;$u_sort_param&amp;view=print", 'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;$u_sort_param&amp;view=print",
'U_EMAIL_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;view=email", 'U_EMAIL_TOPIC' => "memberlist.$phpEx$SID&amp;mode=email&amp;t=$topic_id",
'U_POST_NEW_TOPIC' => $new_topic_url, 'U_POST_NEW_TOPIC' => $new_topic_url,
'U_POST_REPLY_TOPIC' => $reply_topic_url) 'U_POST_REPLY_TOPIC' => $reply_topic_url)
@ -802,9 +802,9 @@ do
} }
} }
if (!empty($row['user_viewemail']) || $auth->acl_gets('m_', 'a_', $forum_id)) if ((!empty($row['user_viewemail']) || $auth->acl_get('m_', $forum_id)) && $config['email_enable'])
{ {
$email_url = ($config['board_email_form'] && $config['email_enable']) ? "ucp.$phpEx$SID&amp;mode=email&amp;u=" . $poster_id : 'mailto:' . $row['user_email']; $email_url = ($config['board_email_form']) ? "memberlist.$phpEx$SID&amp;mode=email&amp;u=" . $poster_id : 'mailto:' . $row['user_email'];
$user_cache[$poster_id]['email_img'] = '<a href="' . $email_url . '">' . $user->img('btn_email', $user->lang['SEND_EMAIL']) . '</a>'; $user_cache[$poster_id]['email_img'] = '<a href="' . $email_url . '">' . $user->img('btn_email', $user->lang['SEND_EMAIL']) . '</a>';
$user_cache[$poster_id]['email'] = '<a href="' . $email_url . '">' . $user->lang['SEND_EMAIL'] . '</a>'; $user_cache[$poster_id]['email'] = '<a href="' . $email_url . '">' . $user->lang['SEND_EMAIL'] . '</a>';
} }