Новое представление емейлов (от кого кому); исправлено уведомление об отслеживаемых темах; -1 запрос в топике; фиксы багрепортов от пользователей. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@579 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
pherum83@gmail.com 2014-02-02 15:02:13 +00:00
commit 0865fbbd29
28 changed files with 408 additions and 643 deletions

View file

@ -552,7 +552,6 @@ INSERT INTO `bb_config` VALUES ('bt_show_peers_mode', '1');
INSERT INTO `bb_config` VALUES ('bt_show_port_only_moder', '1'); INSERT INTO `bb_config` VALUES ('bt_show_port_only_moder', '1');
INSERT INTO `bb_config` VALUES ('bt_tor_browse_only_reg', '0'); INSERT INTO `bb_config` VALUES ('bt_tor_browse_only_reg', '0');
INSERT INTO `bb_config` VALUES ('bt_unset_dltype_on_tor_unreg', '1'); INSERT INTO `bb_config` VALUES ('bt_unset_dltype_on_tor_unreg', '1');
INSERT INTO `bb_config` VALUES ('config_id', '1');
INSERT INTO `bb_config` VALUES ('cron_last_check', '1211477514'); INSERT INTO `bb_config` VALUES ('cron_last_check', '1211477514');
INSERT INTO `bb_config` VALUES ('default_dateformat', 'Y-m-d H:i'); INSERT INTO `bb_config` VALUES ('default_dateformat', 'Y-m-d H:i');
INSERT INTO `bb_config` VALUES ('default_lang', 'russian'); INSERT INTO `bb_config` VALUES ('default_lang', 'russian');
@ -568,7 +567,6 @@ INSERT INTO `bb_config` VALUES ('prune_enable', '1');
INSERT INTO `bb_config` VALUES ('record_online_date', '1211477508'); INSERT INTO `bb_config` VALUES ('record_online_date', '1211477508');
INSERT INTO `bb_config` VALUES ('record_online_users', '2'); INSERT INTO `bb_config` VALUES ('record_online_users', '2');
INSERT INTO `bb_config` VALUES ('require_activation', '0'); INSERT INTO `bb_config` VALUES ('require_activation', '0');
INSERT INTO `bb_config` VALUES ('sendmail_fix', '0');
INSERT INTO `bb_config` VALUES ('seed_bonus_enabled', '1'); INSERT INTO `bb_config` VALUES ('seed_bonus_enabled', '1');
INSERT INTO `bb_config` VALUES ('seed_bonus_release', ''); INSERT INTO `bb_config` VALUES ('seed_bonus_release', '');
INSERT INTO `bb_config` VALUES ('seed_bonus_points', ''); INSERT INTO `bb_config` VALUES ('seed_bonus_points', '');
@ -578,15 +576,7 @@ INSERT INTO `bb_config` VALUES ('site_desc', 'A little text to describe your for
INSERT INTO `bb_config` VALUES ('sitename', 'TorrentPier II - Torrent Tracker'); INSERT INTO `bb_config` VALUES ('sitename', 'TorrentPier II - Torrent Tracker');
INSERT INTO `bb_config` VALUES ('smilies_path', 'images/smiles'); INSERT INTO `bb_config` VALUES ('smilies_path', 'images/smiles');
INSERT INTO `bb_config` VALUES ('topics_per_page', '50'); INSERT INTO `bb_config` VALUES ('topics_per_page', '50');
INSERT INTO `bb_config` VALUES ('version', '.0.22');
INSERT INTO `bb_config` VALUES ('xs_add_comments', '0');
INSERT INTO `bb_config` VALUES ('xs_auto_compile', '1');
INSERT INTO `bb_config` VALUES ('xs_auto_recompile', '1');
INSERT INTO `bb_config` VALUES ('xs_php', 'php');
INSERT INTO `bb_config` VALUES ('xs_shownav', '17');
INSERT INTO `bb_config` VALUES ('xs_template_time', '0');
INSERT INTO `bb_config` VALUES ('xs_use_cache', '1'); INSERT INTO `bb_config` VALUES ('xs_use_cache', '1');
INSERT INTO `bb_config` VALUES ('xs_version', '8');
INSERT INTO `bb_config` VALUES ('active_ads', ''); INSERT INTO `bb_config` VALUES ('active_ads', '');
INSERT INTO `bb_config` VALUES ('report_subject_auth', '1'); INSERT INTO `bb_config` VALUES ('report_subject_auth', '1');
INSERT INTO `bb_config` VALUES ('report_modules_cache', '1'); INSERT INTO `bb_config` VALUES ('report_modules_cache', '1');
@ -648,27 +638,27 @@ CREATE TABLE IF NOT EXISTS `bb_cron` (
-- Дамп данных таблицы `bb_cron` -- Дамп данных таблицы `bb_cron`
-- --
INSERT INTO `bb_cron` VALUES (1, 0, 'Site backup', 'site_backup.php', 'daily', '1', '05:00:00', 10, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 0, 'Site backup', 'site_backup.php', 'daily', '1', '05:00:00', 10, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (2, 0, 'DB backup', 'db_backup.php', 'daily', '1', '05:00:00', 20, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 0, 'DB backup', 'db_backup.php', 'daily', '1', '05:00:00', 20, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (3, 1, 'Avatars cleanup', 'avatars_cleanup.php', 'weekly', '1', '05:00:00', 30, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Avatars cleanup', 'avatars_cleanup.php', 'weekly', '1', '05:00:00', 30, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (4, 1, 'Board maintenance', 'bb_maintenance.php', 'daily', NULL, '05:00:00', 40, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Board maintenance', 'bb_maintenance.php', 'daily', NULL, '05:00:00', 40, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (5, 1, 'Prune forums', 'prune_forums.php', 'daily', NULL, '05:00:00', 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Prune forums', 'prune_forums.php', 'daily', NULL, '05:00:00', 50, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (6, 1, 'Prune topic moved stubs', 'prune_topic_moved.php', 'daily', NULL, '05:00:00', 60, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Prune topic moved stubs', 'prune_topic_moved.php', 'daily', NULL, '05:00:00', 60, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (7, 1, 'Logs cleanup', 'clean_log.php', 'daily', NULL, '05:00:00', 70, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Logs cleanup', 'clean_log.php', 'daily', NULL, '05:00:00', 70, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (8, 1, 'Tracker maintenance', 'tr_maintenance.php', 'daily', NULL, '05:00:00', 90, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Tracker maintenance', 'tr_maintenance.php', 'daily', NULL, '05:00:00', 90, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (9, 1, 'Clean dlstat', 'clean_dlstat.php', 'daily', NULL, '05:00:00', 100, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Clean dlstat', 'clean_dlstat.php', 'daily', NULL, '05:00:00', 100, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (10, 1, 'Prune inactive users', 'prune_inactive_users.php', 'daily', NULL, '05:00:00', 110, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 1, '', 0, 1, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Prune inactive users', 'prune_inactive_users.php', 'daily', NULL, '05:00:00', 110, '', '', NULL, 1, '', 0, 1, 0);
INSERT INTO `bb_cron` VALUES (11, 1, 'Sessions cleanup', 'sessions_cleanup.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:03:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Sessions cleanup', 'sessions_cleanup.php', 'interval', NULL, NULL, 255, '', '', '00:03:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (12, 1, 'DS update ''cat_forums''', 'ds_update_cat_forums.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:05:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'DS update ''cat_forums''', 'ds_update_cat_forums.php', 'interval', NULL, NULL, 255, '', '', '00:05:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (13, 1, 'DS update ''stats''', 'ds_update_stats.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:10:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'DS update ''stats''', 'ds_update_stats.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (14, 1, 'Flash topic view', 'flash_topic_view.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:10:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Flash topic view', 'flash_topic_view.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (15, 1, 'Clean search results', 'clean_search_results.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:10:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Clean search results', 'clean_search_results.php', 'interval', NULL, NULL, 255, '', '', '00:10:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (16, 1, 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', NULL, NULL, 20, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:15:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Tracker cleanup and dlstat', 'tr_cleanup_and_dlstat.php', 'interval', NULL, NULL, 20, '', '', '00:15:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (17, 1, 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', NULL, NULL, 10, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:10:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', NULL, NULL, 10, '', '', '00:10:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (18, 1, 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '01:00:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Seeder last seen', 'tr_update_seeder_last_seen.php', 'interval', NULL, NULL, 255, '', '', '01:00:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (19, 1, 'Captcha', 'captcha_gen_gc.php', 'daily', NULL, '05:00:00', 120, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Captcha', 'captcha_gen_gc.php', 'daily', NULL, '05:00:00', 120, '', '', NULL, 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (20, 1, 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '06:00:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Tracker dl-complete count', 'tr_complete_count.php', 'interval', NULL, NULL, 255, '', '', '06:00:00', 0, '', 0, 0, 0);
INSERT INTO `bb_cron` VALUES (21, 1, 'Cache garbage collector', 'cache_gc.php', 'interval', NULL, NULL, 255, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:05:00', 0, '', 0, 0, 0); INSERT INTO `bb_cron` VALUES ('', 1, 'Cache garbage collector', 'cache_gc.php', 'interval', NULL, NULL, 255, '', '', '00:05:00', 0, '', 0, 0, 0);
-- -------------------------------------------------------- -- --------------------------------------------------------

View file

@ -61,6 +61,7 @@ switch($mode)
{ {
$template->assign_block_vars('list', array( $template->assign_block_vars('list', array(
'ROW_CLASS' => !($i % 2) ? 'row2' : 'row1', 'ROW_CLASS' => !($i % 2) ? 'row2' : 'row1',
'JOB_ID' => $i + 1,
'CRON_ID' => $row['cron_id'], 'CRON_ID' => $row['cron_id'],
'CRON_ACTIVE' => $row['cron_active'] ? '<img src="../images/icon_run.gif" alt="'. $lang['YES'] .'" />' : '<img src="../images/icon_delete.gif" alt="'. $lang['NO'] .'" />', 'CRON_ACTIVE' => $row['cron_active'] ? '<img src="../images/icon_run.gif" alt="'. $lang['YES'] .'" />' : '<img src="../images/icon_delete.gif" alt="'. $lang['NO'] .'" />',
'CRON_TITLE' => $row['cron_title'], 'CRON_TITLE' => $row['cron_title'],

View file

@ -3,7 +3,7 @@
// ACP Header - START // ACP Header - START
if (!empty($setmodules)) if (!empty($setmodules))
{ {
$module['General']['Mass_Email'] = basename(__FILE__); $module['Mods']['Mass_Email'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require('./pagestart.php');
@ -11,150 +11,97 @@ require('./pagestart.php');
@set_time_limit(1200); @set_time_limit(1200);
$message = ''; $subject = (string) trim(request_var('subject', ''));
$subject = ''; $message = (string) request_var('message', '');
$group_id = (int) request_var(POST_GROUPS_URL, 0);
$errors = $user_id_sql = array();
//
// Do the job ...
//
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$subject = stripslashes(trim($_POST['subject'])); if(!$subject) $errors[] = $lang['EMPTY_SUBJECT'];
$message = stripslashes(trim($_POST['message'])); if(!$message) $errors[] = $lang['EMPTY_MESSAGE'];
if(!$group_id) $errors[] = $lang['GROUP_NOT_EXIST'];
$error = FALSE; if(!$errors)
$error_msg = '';
if ( empty($subject) )
{ {
$error = true; $sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['EMPTY_SUBJECT'] : $lang['EMPTY_SUBJECT'];
foreach ($sql as $row)
{
$user_id_sql[] = ','. $row['ban_userid'];
} }
$user_id_sql = join('', $user_id_sql);
if ( empty($message) ) if ($group_id != -1)
{ {
$error = true; $user_list = DB()->fetch_rowset("
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['EMPTY_MESSAGE'] : $lang['EMPTY_MESSAGE']; SELECT u.username, u.user_email, u.user_lang
} FROM ". BB_USERS ." u, ". BB_USER_GROUP ." ug
WHERE ug.group_id = $group_id
$group_id = intval($_POST[POST_GROUPS_URL]); AND ug.user_pending = 0
AND u.user_id = ug.user_id
$sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . BB_USERS . " u, " . BB_USER_GROUP . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> 1 AND u.user_id = ug.user_id" : "SELECT user_email FROM " . BB_USERS; AND u.user_active = 1
if ( !($result = DB()->sql_query($sql)) ) AND u.user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
{ ");
message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql);
}
if ( $row = DB()->sql_fetchrow($result) )
{
$bcc_list = array();
do
{
$bcc_list[] = $row['user_email'];
}
while ( $row = DB()->sql_fetchrow($result) );
DB()->sql_freeresult($result);
} }
else else
{ {
$message = ( $group_id != -1 ) ? $lang['GROUP_NOT_EXIST'] : $lang['NO_SUCH_USER']; $user_list = DB()->fetch_rowset("
SELECT username, user_email, user_lang
$error = true; FROM ". BB_USERS ."
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $message : $message; WHERE user_active = 1
AND user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
");
} }
if ( !$error ) require(INC_DIR .'emailer.class.php');
foreach ($user_list as $i => $row)
{ {
include(INC_DIR . 'emailer.class.php');
//
// 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')) && !$bb_cfg['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
$bb_cfg['smtp_delivery'] = 1;
$bb_cfg['smtp_host'] = @$ini_val('SMTP');
}
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->email_address($row['username'] ." <{$row['user_email']}>");
for ($i = 0; $i < count($bcc_list); $i++)
{
$emailer->bcc($bcc_list[$i]);
}
$email_headers = 'X-AntiAbuse: Board servername - ' . $bb_cfg['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 - ' . CLIENT_IP . "\n";
$emailer->use_template('admin_send_email'); $emailer->use_template('admin_send_email');
$emailer->email_address($bb_cfg['board_email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SUBJECT' => html_entity_decode($subject),
'BOARD_EMAIL' => $bb_cfg['board_email'], 'MESSAGE' => html_entity_decode($message),
'MESSAGE' => $message) ));
);
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
}
message_die(GENERAL_MESSAGE, $lang['EMAIL_SENT'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
} }
} }
if ( @$error )
{
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
}
//
// Initial selection
//
$sql = "SELECT group_id, group_name
FROM ".BB_GROUPS . "
WHERE group_single_user <> 1";
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain list of groups', '', __LINE__, __FILE__, $sql);
}
$select_list = '<select name = "' . POST_GROUPS_URL . '"><option value = "-1">' . $lang['ALL_USERS'] . '</option>';
if ( $row = DB()->sql_fetchrow($result) )
{
do
{
$select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
while ( $row = DB()->sql_fetchrow($result) );
}
$select_list .= '</select>';
// //
// Generate page // Generate page
// //
require(PAGE_HEADER);
$sql = "SELECT group_id, group_name
FROM ". BB_GROUPS ."
WHERE group_single_user = 0
ORDER BY group_name
";
$groups = array('-- '. $lang['ALL_USERS'] .' --' => -1);
foreach (DB()->fetch_rowset($sql) as $row)
{
$groups[$row['group_name']] = $row['group_id'];
}
$template->assign_vars(array( $template->assign_vars(array(
'MESSAGE' => $message, 'MESSAGE' => $message,
'SUBJECT' => $subject, 'SUBJECT' => $subject,
'L_NOTICE' => @$notice, 'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
'S_USER_ACTION' => 'admin_mass_email.php', 'S_USER_ACTION' => 'admin_mass_email.php',
'S_GROUP_SELECT' => $select_list) 'S_GROUP_SELECT' => build_select(POST_GROUPS_URL, $groups),
); ));
print_page('admin_mass_email.tpl', 'admin'); print_page('admin_mass_email.tpl', 'admin');

View file

@ -10,12 +10,14 @@ require('./common.php');
$ajax->init(); $ajax->init();
// Handle "board disabled via ON/OFF trigger" // Handle "board disabled via ON/OFF trigger"
if (file_exists(BB_DISABLED)) { if (file_exists(BB_DISABLED))
{
$ajax->ajax_die($bb_cfg['board_disabled_msg']); $ajax->ajax_die($bb_cfg['board_disabled_msg']);
} }
// Load actions required modules // Load actions required modules
switch ($ajax->action) { switch ($ajax->action)
{
case 'view_post': case 'view_post':
require(INC_DIR . 'bbcode.php'); require(INC_DIR . 'bbcode.php');
break; break;
@ -110,35 +112,42 @@ class ajax_common
global $lang; global $lang;
// Exit if we already have errors // Exit if we already have errors
if (!empty($this->response['error_code'])) { if (!empty($this->response['error_code']))
{
$this->send(); $this->send();
} }
// Check that requested action is valid // Check that requested action is valid
$action = $this->action; $action = $this->action;
if (!$action || !is_string($action)) { if (!$action || !is_string($action))
{
$this->ajax_die('no action specified'); $this->ajax_die('no action specified');
} elseif (!$action_params =& $this->valid_actions[$action]) { }
elseif (!$action_params =& $this->valid_actions[$action])
{
$this->ajax_die('invalid action: ' . $action); $this->ajax_die('invalid action: ' . $action);
} }
// Auth check // Auth check
switch ($action_params[AJAX_AUTH]) { switch ($action_params[AJAX_AUTH])
{
// GUEST // GUEST
case 'guest': case 'guest':
break; break;
// USER // USER
case 'user': case 'user':
if (IS_GUEST) { if (IS_GUEST)
{
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']); $this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
} }
break; break;
// MOD // MOD
case 'mod': case 'mod':
if (!IS_AM) { if (!IS_AM)
{
$this->ajax_die($lang['ONLY_FOR_MOD']); $this->ajax_die($lang['ONLY_FOR_MOD']);
} }
$this->check_admin_session(); $this->check_admin_session();
@ -146,7 +155,8 @@ class ajax_common
// ADMIN // ADMIN
case 'admin': case 'admin':
if (!IS_ADMIN) { if (!IS_ADMIN)
{
$this->ajax_die($lang['ONLY_FOR_ADMIN']); $this->ajax_die($lang['ONLY_FOR_ADMIN']);
} }
$this->check_admin_session(); $this->check_admin_session();
@ -154,7 +164,8 @@ class ajax_common
// SUPER_ADMIN // SUPER_ADMIN
case 'super_admin': case 'super_admin':
if (!IS_SUPER_ADMIN) { if (!IS_SUPER_ADMIN)
{
$this->ajax_die($lang['ONLY_FOR_SUPER_ADMIN']); $this->ajax_die($lang['ONLY_FOR_SUPER_ADMIN']);
} }
$this->check_admin_session(); $this->check_admin_session();
@ -198,7 +209,8 @@ class ajax_common
{ {
$this->response['action'] = $this->action; $this->response['action'] = $this->action;
if (DBG_USER && SQL_DEBUG && !empty($_COOKIE['sql_log'])) { if (DBG_USER && SQL_DEBUG && !empty($_COOKIE['sql_log']))
{
$this->response['sql_log'] = get_sql_log(); $this->response['sql_log'] = get_sql_log();
} }
@ -211,16 +223,20 @@ class ajax_common
*/ */
function ob_handler($contents) function ob_handler($contents)
{ {
if (DBG_USER) { if (DBG_USER)
if ($contents) { {
if ($contents)
{
$this->response['raw_output'] = $contents; $this->response['raw_output'] = $contents;
} }
} }
$response_js = bb_json_encode($this->response); $response_js = bb_json_encode($this->response);
if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) { if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))
if (UA_GZIP_SUPPORTED && strlen($response_js) > 2000) { {
if (UA_GZIP_SUPPORTED && strlen($response_js) > 2000)
{
header('Content-Encoding: gzip'); header('Content-Encoding: gzip');
$response_js = gzencode($response_js, 1); $response_js = gzencode($response_js, 1);
} }
@ -236,15 +252,20 @@ class ajax_common
{ {
global $user; global $user;
if (!$user->data['session_admin']) { if (!$user->data['session_admin'])
if (empty($this->request['user_password'])) { {
if (empty($this->request['user_password']))
{
$this->prompt_for_password(); $this->prompt_for_password();
} else { }
else
{
$login_args = array( $login_args = array(
'login_username' => $user->data['username'], 'login_username' => $user->data['username'],
'login_password' => $_POST['user_password'], 'login_password' => $_POST['user_password'],
); );
if (!$user->login($login_args, true)) { if (!$user->login($login_args, true))
{
$this->ajax_die('Wrong password'); $this->ajax_die('Wrong password');
} }
} }
@ -281,7 +302,8 @@ class ajax_common
$is_auth = auth(AUTH_MOD, $forum_id, $userdata); $is_auth = auth(AUTH_MOD, $forum_id, $userdata);
if (!$is_auth['auth_mod']) { if (!$is_auth['auth_mod'])
{
$this->ajax_die($lang['ONLY_FOR_MOD']); $this->ajax_die($lang['ONLY_FOR_MOD']);
} }
} }

View file

@ -78,7 +78,7 @@ switch($this->request['type'])
// Use trim to get rid of spaces placed there by MS-SQL 2000 // Use trim to get rid of spaces placed there by MS-SQL 2000
$quote_username = (trim($post['post_username']) != '') ? $post['post_username'] : get_username($post['poster_id']); $quote_username = (trim($post['post_username']) != '') ? $post['post_username'] : get_username($post['poster_id']);
$message = "[quote=\"". $quote_username ."\"][qpost=". $post['post_id'] ."]". $post['post_text'] ."[/quote]\n"; $message = "[quote=\"". $quote_username ."\"][qpost=". $post['post_id'] ."]". $post['post_text'] ."[/quote]\r";
// hide user passkey // hide user passkey
$message = preg_replace('#(?<=\?uk=)[a-zA-Z0-9]{10}(?=&)#', 'passkey', $message); $message = preg_replace('#(?<=\?uk=)[a-zA-Z0-9]{10}(?=&)#', 'passkey', $message);
// hide sid // hide sid
@ -91,7 +91,7 @@ switch($this->request['type'])
if ($post['post_id'] == $post['topic_first_post_id']) if ($post['post_id'] == $post['topic_first_post_id'])
{ {
$message = "[quote]". $post['topic_title'] ."[/quote]\n"; $message = "[quote]". $post['topic_title'] ."[/quote]\r";
} }
if (mb_strlen($message, 'UTF-8') > 1000) if (mb_strlen($message, 'UTF-8') > 1000)
{ {
@ -138,7 +138,7 @@ switch($this->request['type'])
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies'])); $this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
} }
} }
DB()->query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($text) ."' WHERE post_id = $post_id LIMIT 1"); DB()->query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($text) ."' WHERE post_id = $post_id");
if ($post['topic_last_post_id'] != $post['post_id'] && $userdata['user_id'] == $post['poster_id']) if ($post['topic_last_post_id'] != $post['post_id'] && $userdata['user_id'] == $post['poster_id'])
{ {
DB()->query("UPDATE ". BB_POSTS ." SET post_edit_time = '". TIMENOW ."', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id LIMIT 1"); DB()->query("UPDATE ". BB_POSTS ." SET post_edit_time = '". TIMENOW ."', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id LIMIT 1");
@ -299,7 +299,13 @@ switch($this->request['type'])
'post_text' => $message, 'post_text' => $message,
)); ));
$this->response['redirect'] = make_url(POST_URL . $post_id .'#'. $post_id); if ($bb_cfg['topic_notify_enabled'])
{
$notify = !empty($this->request['notify']);
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
}
$this->response['redirect'] = make_url(POST_URL ."$post_id#$post_id");
break; break;
default: default:

View file

@ -55,8 +55,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update // Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 (unstable)'; $bb_cfg['tp_version'] = '2.5 (unstable)';
$bb_cfg['tp_release_date'] = '01-02-2014'; $bb_cfg['tp_release_date'] = '02-02-2014';
$bb_cfg['tp_release_state'] = 'R578'; $bb_cfg['tp_release_state'] = 'R579';
// Database // Database
$charset = 'utf8'; $charset = 'utf8';

View file

@ -243,21 +243,18 @@ else if (@$_POST['joingroup'])
if ($bb_cfg['groupcp_send_email']) if ($bb_cfg['groupcp_send_email'])
{ {
include(INC_DIR .'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->email_address($moderator['username'] ." <{$moderator['user_email']}>");
$emailer->use_template('group_request', $moderator['user_lang']); $emailer->use_template('group_request', $moderator['user_lang']);
$emailer->email_address($moderator['user_email']);
$emailer->set_subject($lang['GROUP_REQUEST']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'USER' => $userdata['username'], 'USER' => $userdata['username'],
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'GROUP_MODERATOR' => $moderator['username'], 'GROUP_MODERATOR' => $moderator['username'],
'EMAIL_SIG' => ($bb_cfg['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '',
'U_GROUPCP' => make_url(GROUP_URL . $group_id), 'U_GROUPCP' => make_url(GROUP_URL . $group_id),
)); ));
$emailer->send(); $emailer->send();
@ -306,19 +303,17 @@ else
require(INC_DIR .'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->email_address($row['username'] ." <{$row['user_email']}>");
$emailer->use_template('group_added', $row['user_lang']); $emailer->use_template('group_added', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject($lang['GROUP_ADDED']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'GROUP_NAME' => $group_info['group_name'], 'GROUP_NAME' => $group_info['group_name'],
'EMAIL_SIG' => ($bb_cfg['board_email_sig']) ? str_replace('<br />', "\n", "-- \n". $bb_cfg['board_email_sig']) : '',
'U_GROUPCP' => make_url(GROUP_URL . $group_id), 'U_GROUPCP' => make_url(GROUP_URL . $group_id),
)); ));
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
} }
@ -366,43 +361,32 @@ else
// Email users when they are approved // Email users when they are approved
if (!empty($_POST['approve']) && $bb_cfg['groupcp_send_email']) if (!empty($_POST['approve']) && $bb_cfg['groupcp_send_email'])
{ {
$sql_select = "SELECT user_email $sql_select = "SELECT username, user_email, user_lang
FROM ". BB_USERS ." FROM ". BB_USERS ."
WHERE user_id IN($sql_in)"; WHERE user_id IN($sql_in)";
if (!$result = DB()->sql_query($sql_select)) if (!$result = DB()->sql_query($sql_select))
{ {
message_die(GENERAL_ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql_select);
} }
$bcc_list = array();
while ($row = DB()->sql_fetchrow($result))
{
$bcc_list[] = $row['user_email'];
}
$group_name = $group_info['group_name'];
require(INC_DIR .'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']);
for ($i=0, $cnt=count($bcc_list); $i < $cnt; $i++) foreach (DB()->fetch_rowset($sql_select) as $row)
{ {
$emailer->bcc($bcc_list[$i]); $emailer->use_template('group_approved', $row['user_lang']);
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
} }
$emailer->use_template('group_approved');
$emailer->set_subject($lang['GROUP_APPROVED']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'GROUP_NAME' => $group_name, 'GROUP_NAME' => $group_info['group_name'],
'EMAIL_SIG' => ($bb_cfg['board_email_sig']) ? str_replace('<br />', "\n", "-- \n". $bb_cfg['board_email_sig']) : '',
'U_GROUPCP' => make_url(GROUP_URL . $group_id), 'U_GROUPCP' => make_url(GROUP_URL . $group_id),
)); ));
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
} }

View file

@ -18,8 +18,8 @@ if ($exec_return_status && !$bb_cfg['emailer_disabled'] && $bb_cfg['tech_admin_e
require_once(INC_DIR .'emailer.class.php'); require_once(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank'); $emailer->use_template('blank');
$emailer->email_address($bb_cfg['tech_admin_email']); $emailer->email_address($bb_cfg['tech_admin_email']);

View file

@ -16,8 +16,8 @@ if ($exec_return_status && !$bb_cfg['emailer_disabled'] && $bb_cfg['tech_admin_e
require_once(INC_DIR .'emailer.class.php'); require_once(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank'); $emailer->use_template('blank');
$emailer->email_address($bb_cfg['tech_admin_email']); $emailer->email_address($bb_cfg['tech_admin_email']);

View file

@ -48,7 +48,7 @@ function get_sql_log_html ($db_obj, $log_name)
$id = "sql_{$i}_". mt_rand(); $id = "sql_{$i}_". mt_rand();
$sql = short_query($dbg['sql'], true); $sql = short_query($dbg['sql'], true);
$time = sprintf('%.4f', $dbg['time']); $time = sprintf('%.4f', $dbg['time']);
$perc = sprintf('[%2d]', $dbg['time']*100/$db_obj->sql_timetotal); $perc = @sprintf('[%2d]', $dbg['time']*100/$db_obj->sql_timetotal);
$info = !empty($dbg['info']) ? $dbg['info'] .' ['. $dbg['src'] .']' : $dbg['src']; $info = !empty($dbg['info']) ? $dbg['info'] .' ['. $dbg['src'] .']' : $dbg['src'];
$file = addslashes($dbg['file']); $file = addslashes($dbg['file']);
$line = $dbg['line']; $line = $dbg['line'];

View file

@ -330,163 +330,101 @@ function delete_post($mode, $post_data, &$message, &$meta, $forum_id, $topic_id,
// //
// Handle user notification on new post // Handle user notification on new post
// //
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user) function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$notify_user)
{ {
global $bb_cfg, $lang, $user, $userdata; global $bb_cfg, $lang, $userdata;
if (!$bb_cfg['topic_notify_enabled']) if (!$bb_cfg['topic_notify_enabled'])
{ {
return; return;
} }
$current_time = TIMENOW;
if ($mode != 'delete') if ($mode != 'delete')
{ {
if ($mode == 'reply') if ($mode == 'reply')
{ {
$sql = "SELECT ban_userid $update_watched_sql = $user_id_sql = array();
FROM " . BB_BANLIST;
if (!($result = DB()->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
}
$user_id_sql = ''; $sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
while ($row = DB()->sql_fetchrow($result))
{
if (isset($row['ban_userid']) && !empty($row['ban_userid']))
{
$user_id_sql .= ', ' . $row['ban_userid'];
}
}
$sql = "SELECT u.user_id, u.user_email, u.user_lang foreach ($sql as $row)
{
$user_id_sql[] = ','. $row['ban_userid'];
}
$user_id_sql = join('', $user_id_sql);
$watch_list = DB()->fetch_rowset("SELECT u.username, u.user_id, u.user_email, u.user_lang
FROM " . BB_TOPICS_WATCH . " tw, " . BB_USERS . " u FROM " . BB_TOPICS_WATCH . " tw, " . BB_USERS . " u
WHERE tw.topic_id = $topic_id WHERE tw.topic_id = $topic_id
AND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . BOT_UID . ", " . GUEST_UID . $user_id_sql . ") AND tw.user_id NOT IN (". $userdata['user_id'] .", ". EXCLUDED_USERS_CSV . $user_id_sql .")
AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " AND tw.notify_status = ". TOPIC_WATCH_NOTIFIED ."
AND u.user_id = tw.user_id"; AND u.user_id = tw.user_id
if (!($result = DB()->sql_query($sql))) ");
{
message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
}
$update_watched_sql = ''; if ($watch_list)
$bcc_list_ary = array();
if ($row = DB()->sql_fetchrow($result))
{ {
// Sixty second limit require(INC_DIR .'emailer.class.php');
@set_time_limit(60);
do
{
if ($row['user_email'] != '')
{
$bcc_list_ary[$row['user_lang']][] = $row['user_email'];
}
$update_watched_sql .= ($update_watched_sql != '') ? ', ' . $row['user_id'] : $row['user_id'];
}
while ($row = DB()->sql_fetchrow($result));
if (sizeof($bcc_list_ary))
{
include(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($bb_cfg['script_path'])); $orig_word = $replacement_word = array();
$script_name = ($script_name != '') ? $script_name . '/viewtopic.php' : 'viewtopic.php';
$server_name = trim($bb_cfg['server_name']);
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
$server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) . '/' : '/';
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word); obtain_word_list($orig_word, $replacement_word);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
if (count($orig_word)) if (count($orig_word))
{ {
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title); $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
} }
@reset($bcc_list_ary); $u_topic = make_url(TOPIC_URL . $topic_id .'&view=newest#newest');
while (list($user_lang, $bcc_list) = each($bcc_list_ary)) $unwatch_topic = make_url(TOPIC_URL ."$topic_id&unwatch=topic");
foreach ($watch_list as $row)
{ {
$emailer->use_template('topic_notify', $user_lang); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
for ($i = 0; $i < count($bcc_list); $i++) $emailer->use_template('topic_notify', $row['user_lang']);
{
$emailer->bcc($bcc_list[$i]);
}
// The Topic_reply_notification lang string below will be used
// if for some reason the mail template subject cannot be read
// ... note it will not necessarily be in the posters own language!
$emailer->set_subject($lang['TOPIC_REPLY_NOTIFICATION']);
// This is a nasty kludge to remove the username var ... till (if?)
// translators update their templates
$emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'TOPIC_TITLE' => $topic_title, 'TOPIC_TITLE' => html_entity_decode($topic_title),
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $user->name, 'USERNAME' => $row['username'],
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '', 'U_TOPIC' => $u_topic,
'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "=$post_id#$post_id", 'U_STOP_WATCHING_TOPIC' => $unwatch_topic,
'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "=$topic_id&unwatch=topic") ));
);
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
}
}
}
DB()->sql_freeresult($result);
if ($update_watched_sql != '') $update_watched_sql[] = $row['user_id'];
}
$update_watched_sql = join(',', $update_watched_sql);
}
if ($update_watched_sql)
{ {
$sql = "UPDATE " . BB_TOPICS_WATCH . " DB()->query("UPDATE ". BB_TOPICS_WATCH ."
SET notify_status = " . TOPIC_WATCH_NOTIFIED . " SET notify_status = ". TOPIC_WATCH_UN_NOTIFIED ."
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id IN ($update_watched_sql)"; AND user_id IN ($update_watched_sql)
DB()->sql_query($sql); ");
} }
} }
$sql = "SELECT topic_id $topic_watch = DB()->fetch_row("SELECT topic_id
FROM ". BB_TOPICS_WATCH ." FROM ". BB_TOPICS_WATCH ."
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id']; AND user_id = {$userdata['user_id']}
if (!($result = DB()->sql_query($sql))) ", 'topic_id');
{
message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
}
$row = DB()->sql_fetchrow($result); if (!$notify_user && !empty($topic_watch))
if (!$notify_user && !empty($row['topic_id']))
{ {
$sql = "DELETE FROM " . BB_TOPICS_WATCH . " DB()->query("DELETE FROM ". BB_TOPICS_WATCH ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']}");
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if (!DB()->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql);
} }
} else if ($notify_user && empty($topic_watch))
else if ($notify_user && empty($row['topic_id']))
{ {
$sql = "INSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status) DB()->query("
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; INSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status)
if (!DB()->sql_query($sql)) VALUES (". $userdata['user_id'] .", $topic_id, ". TOPIC_WATCH_NOTIFIED .")
{ ");
message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql);
}
} }
} }
} }
@ -495,8 +433,6 @@ function insert_post ($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new
{ {
global $userdata, $lang; global $userdata, $lang;
require(DEFAULT_LANG_DIR .'lang_bot.php');
if (!$topic_id) return; if (!$topic_id) return;
$post_username = $post_subject = $post_text = $poster_ip = ''; $post_username = $post_subject = $post_text = $poster_ip = '';

View file

@ -341,7 +341,7 @@ function report_notify($mode)
// Obtain notification users // Obtain notification users
$user_level_sql = ($bb_cfg['report_list_admin']) ? '= ' . ADMIN : 'IN(' . ADMIN . ', ' . MOD . ')'; $user_level_sql = ($bb_cfg['report_list_admin']) ? '= ' . ADMIN : 'IN(' . ADMIN . ', ' . MOD . ')';
$sql = 'SELECT user_id, user_level, user_email, user_lang $sql = 'SELECT username, user_id, user_level, user_email, user_lang
FROM ' . BB_USERS . ' FROM ' . BB_USERS . '
WHERE user_active = 1 WHERE user_active = 1
AND user_level ' . $user_level_sql . ' AND user_level ' . $user_level_sql . '
@ -494,26 +494,10 @@ function report_notify($mode)
return true; return true;
} }
require(INC_DIR .'emailer.class.php');
if (preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$bb_cfg['smtp_delivery'])
{
$ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var';
$bb_cfg['smtp_delivery'] = 1;
$bb_cfg['smtp_host'] = @$ini_val('SMTP');
}
include(INC_DIR . "emailer.class.php");
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$server_name = trim($bb_cfg['server_name']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
$server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) . '/' : '/';
$script_path = preg_replace('#^/?(.*?)/?$#', '$1', trim($bb_cfg['script_path']));
$script_path .= ($script_path != '') ? '/' : '';
$server_full = $server_protocol . $server_name . $server_port . $script_path;
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
// Send emails // Send emails
foreach ($notify_users as $report_id => $report_notify_users) foreach ($notify_users as $report_id => $report_notify_users)
@ -522,20 +506,20 @@ function report_notify($mode)
foreach ($report_notify_users as $user_info) foreach ($report_notify_users as $user_info)
{ {
$emailer->use_template($email_template, $user_info['user_lang']); $emailer->use_template($email_template, $user_info['user_lang']);
$emailer->email_address($user_info['user_email']); $emailer->email_address($user_info['username'] ." <{$user_info['user_email']}>");
// Get language variables // Get language variables
$lang =& report_notify_lang($user_info['user_lang']); $lang =& report_notify_lang($user_info['user_lang']);
// Set email variables, we use $vars here because of an emailer bug // Set email variables, we use $vars here because of an emailer bug
$vars = array( $vars = array(
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '',
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'REPORT_TITLE' => $report['report_title'], 'REPORT_TITLE' => $report['report_title'],
'REPORT_TEXT' => $report['report_desc'], 'REPORT_TEXT' => $report['report_desc'],
'U_REPORT_VIEW' => $server_full . "report.php?" . POST_REPORT_URL . "=$report_id"); 'U_REPORT_VIEW' => make_url("report.php?" . POST_REPORT_URL . "=$report_id"),
);
switch ($mode) switch ($mode)
{ {
@ -550,19 +534,19 @@ function report_notify($mode)
} }
$vars = array_merge($vars, array( $vars = array_merge($vars, array(
'REPORT_AUTHOR' => $user->name, 'REPORT_AUTHOR' => $userdata['username'],
'REPORT_TIME' => bb_date($report['report_time']), 'REPORT_TIME' => bb_date($report['report_time'], $bb_cfg['last_post_date_format']),
'REPORT_REASON' => $report_reason) 'REPORT_REASON' => $report_reason,
); ));
break; break;
case 'change': case 'change':
$vars = array_merge($vars, array( $vars = array_merge($vars, array(
'REPORT_CHANGE_AUTHOR' => $report['username'], 'REPORT_CHANGE_AUTHOR' => $report['username'],
'REPORT_CHANGE_TIME' => bb_date($report['report_change_time']), 'REPORT_CHANGE_TIME' => bb_date($report['report_change_time'], $bb_cfg['last_post_date_format']),
'REPORT_CHANGE_STATUS' => $lang['REPORT_STATUS'][$status], 'REPORT_CHANGE_STATUS' => $lang['REPORT_STATUS'][$status],
'REPORT_CHANGE_COMMENT' => str_replace(array("\r\n", "\r", "\n"), ' ', $report['report_change_comment'])) 'REPORT_CHANGE_COMMENT' => str_replace(array("\r\n", "\r", "\n"), ' ', $report['report_change_comment']),
); ));
break; break;
} }

View file

@ -41,7 +41,8 @@ define('XS_TAG_ENDIF', 8);
define('XS_TAG_BEGINELSE', 11); define('XS_TAG_BEGINELSE', 11);
class Template { class Template
{
var $classname = "Template"; var $classname = "Template";
// variable that holds all the data we'll be substituting into // variable that holds all the data we'll be substituting into
@ -251,7 +252,7 @@ class Template {
{ {
$this->cur_tpl = $filename; $this->cur_tpl = $filename;
global $lang, $bb_cfg, $user; global $lang, $bb_cfg, $user, $tr_cfg;
$L =& $lang; $L =& $lang;
$V =& $this->vars; $V =& $this->vars;

View file

@ -47,22 +47,19 @@ if ( $row = DB()->sql_fetchrow($result) )
if ( intval($bb_cfg['require_activation']) == USER_ACTIVATION_ADMIN && $sql_update_pass == '' ) if ( intval($bb_cfg['require_activation']) == USER_ACTIVATION_ADMIN && $sql_update_pass == '' )
{ {
include(INC_DIR . 'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->email_address($row['username'] ." <{$row['user_email']}>");
$emailer->use_template('admin_welcome_activated', $row['user_lang']); $emailer->use_template('admin_welcome_activated', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject($lang['ACCOUNT_ACTIVATED_SUBJECT']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $row['username'], 'USERNAME' => $row['username'],
'PASSWORD' => $row['user_newpasswd'], 'PASSWORD' => $row['user_newpasswd'],
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '') ));
);
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();

View file

@ -8,13 +8,15 @@ if (!$bb_cfg['board_email_form'])
redirect("index.php"); redirect("index.php");
} }
set_die_append_msg();
if ( !empty($_GET[POST_USERS_URL]) || !empty($_POST[POST_USERS_URL]) ) if ( !empty($_GET[POST_USERS_URL]) || !empty($_POST[POST_USERS_URL]) )
{ {
$user_id = ( !empty($_GET[POST_USERS_URL]) ) ? intval($_GET[POST_USERS_URL]) : intval($_POST[POST_USERS_URL]); $user_id = ( !empty($_GET[POST_USERS_URL]) ) ? intval($_GET[POST_USERS_URL]) : intval($_POST[POST_USERS_URL]);
} }
else else
{ {
message_die(GENERAL_MESSAGE, $lang['NO_USER_SPECIFIED']); bb_die($lang['NO_USER_SPECIFIED']);
} }
if ( !$userdata['session_logged_in'] ) if ( !$userdata['session_logged_in'] )
@ -22,7 +24,13 @@ if ( !$userdata['session_logged_in'] )
redirect(LOGIN_URL . "?redirect=profile.php&mode=email&" . POST_USERS_URL . "=$user_id"); redirect(LOGIN_URL . "?redirect=profile.php&mode=email&" . POST_USERS_URL . "=$user_id");
} }
$sql = "SELECT username, user_email, user_lang FROM " . BB_USERS . " WHERE user_id = $user_id"; $errors = array();
$sql = "SELECT username, user_id, user_rank, user_email, user_lang
FROM " . BB_USERS . "
WHERE user_id = $user_id
";
if ($row = DB()->fetch_row($sql)) if ($row = DB()->fetch_row($sql))
{ {
$username = $row['username']; $username = $row['username'];
@ -33,100 +41,51 @@ if ( $row = DB()->fetch_row($sql) )
{ {
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$error = FALSE; $subject = trim(html_entity_decode($_POST['subject']));
$message = trim(html_entity_decode($_POST['message']));
if ( !empty($_POST['subject']) ) if(!$subject) $errors[] = $lang['EMPTY_SUBJECT_EMAIL'];
{ if(!$message) $errors[] = $lang['EMPTY_MESSAGE_EMAIL'];
$subject = trim(stripslashes($_POST['subject']));
}
else
{
$error = TRUE;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['EMPTY_SUBJECT_EMAIL'] : $lang['EMPTY_SUBJECT_EMAIL'];
}
if ( !empty($_POST['message']) ) if (!$errors)
{
$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 )
{ {
require(INC_DIR .'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($userdata['user_email']); $emailer->from($userdata['username'] ." <{$userdata['user_email']}>");
$emailer->replyto($userdata['user_email']); $emailer->email_address($username ." <$user_email>");
$email_headers = 'X-AntiAbuse: Board servername - ' . $bb_cfg['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 - ' . CLIENT_IP . "\n";
$emailer->use_template('profile_send_email', $user_lang); $emailer->use_template('profile_send_email', $user_lang);
$emailer->email_address($user_email);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'BOARD_EMAIL' => $bb_cfg['board_email'],
'FROM_USERNAME' => $userdata['username'],
'TO_USERNAME' => $username,
'MESSAGE' => $message)
);
$emailer->send();
$emailer->reset();
if ( !empty($_POST['cc_email']) )
{
$emailer->from($userdata['user_email']);
$emailer->replyto($userdata['user_email']);
$emailer->use_template('profile_send_email');
$emailer->email_address($userdata['user_email']);
$emailer->set_subject($subject); $emailer->set_subject($subject);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'BOARD_EMAIL' => $bb_cfg['board_email'],
'FROM_USERNAME' => $userdata['username'], 'FROM_USERNAME' => $userdata['username'],
'TO_USERNAME' => $username, 'TO_USERNAME' => $username,
'MESSAGE' => $message) 'MESSAGE' => $message,
); ));
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
}
sleep(7); bb_die($lang['EMAIL_SENT']);
$message = $lang['EMAIL_SENT'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>');
message_die(GENERAL_MESSAGE, $message);
} }
} }
if (!empty($error))
{
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
}
$template->assign_vars(array( $template->assign_vars(array(
'USERNAME' => $username, 'USERNAME' => profile_url($row),
'S_HIDDEN_FIELDS' => '', 'S_HIDDEN_FIELDS' => '',
'S_POST_ACTION' => "profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id", 'S_POST_ACTION' => "profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id",
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
)); ));
print_page('usercp_email.tpl'); print_page('usercp_email.tpl');
} }
else else
{ {
message_die(GENERAL_MESSAGE, $lang['USER_PREVENT_EMAIL']); bb_die($lang['USER_PREVENT_EMAIL']);
} }
} }
else else
{ {
message_die(GENERAL_MESSAGE, $lang['USER_NOT_EXIST']); bb_die($lang['USER_NOT_EXIST']);
} }

View file

@ -137,6 +137,7 @@ switch ($mode)
user_rank, user_rank,
user_level, user_level,
user_avatar, user_avatar,
user_email,
$profile_fields_sql $profile_fields_sql
FROM ". BB_USERS ." FROM ". BB_USERS ."
WHERE user_id = $pr_user_id WHERE user_id = $pr_user_id
@ -812,22 +813,19 @@ if ($submit && !$errors)
$email_template = 'user_welcome'; $email_template = 'user_welcome';
} }
include(INC_DIR . 'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->email_address("$username <$email>");
$emailer->use_template($email_template, $user_lang); $emailer->use_template($email_template, $user_lang);
$emailer->email_address($email);
$emailer->set_subject(sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']));
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']), 'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']),
'USERNAME' => html_entity_decode($username), 'USERNAME' => html_entity_decode($username),
'PASSWORD' => $new_pass, 'PASSWORD' => $new_pass,
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']),
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey']) 'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
)); ));
@ -837,30 +835,16 @@ if ($submit && !$errors)
if ($bb_cfg['require_activation'] == USER_ACTIVATION_ADMIN) if ($bb_cfg['require_activation'] == USER_ACTIVATION_ADMIN)
{ {
$sql = "SELECT user_email, user_lang, user_opt FROM ". BB_USERS ." WHERE user_level = " . ADMIN; $sql = "SELECT username, user_email, user_lang FROM ". BB_USERS ." WHERE user_level = ". ADMIN;
if (!($result = DB()->sql_query($sql))) foreach (DB()->fetch_rowset($sql) as $row)
{ {
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
} $emailer->email_address($row['username'] ." <{$row['user_email']}>");
while ($row = DB()->sql_fetchrow($result))
{
if(bf($to_userdata['user_opt'], 'user_opt', 'notify_pm'))
{
$active_admin = true;
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->email_address(trim($row['user_email']));
$emailer->use_template("admin_activate", $row['user_lang']); $emailer->use_template("admin_activate", $row['user_lang']);
$emailer->set_subject($lang['NEW_ACCOUNT_SUBJECT']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'USERNAME' => html_entity_decode($username), 'USERNAME' => html_entity_decode($username),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']),
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey']) 'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
)); ));
@ -868,29 +852,6 @@ if ($submit && !$errors)
$emailer->reset(); $emailer->reset();
} }
} }
if (empty($active_admin))
{
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->email_address($bb_cfg['board_email']);
$emailer->use_template("admin_activate", $row['user_lang']);
$emailer->set_subject($lang['NEW_ACCOUNT_SUBJECT']);
$emailer->assign_vars(array(
'USERNAME' => html_entity_decode($username),
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']),
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
));
$emailer->send();
$emailer->reset();
}
DB()->sql_freeresult($result);
}
} }
bb_die($message); bb_die($message);
@ -910,11 +871,10 @@ if ($submit && !$errors)
$pr_data['user_actkey'] = $user_actkey; $pr_data['user_actkey'] = $user_actkey;
$db_data['user_actkey'] = $user_actkey; $db_data['user_actkey'] = $user_actkey;
include(INC_DIR . 'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']);
if($bb_cfg['require_activation'] == USER_ACTIVATION_ADMIN) if($bb_cfg['require_activation'] == USER_ACTIVATION_ADMIN)
{ {
@ -924,14 +884,11 @@ if ($submit && !$errors)
{ {
$emailer->use_template('user_activate', $pr_data['user_lang']); $emailer->use_template('user_activate', $pr_data['user_lang']);
} }
$emailer->email_address($email); $emailer->email_address("$username <$email>");
$emailer->set_subject($lang['REACTIVATE']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => html_entity_decode($username), 'USERNAME' => html_entity_decode($username),
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '',
'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"), 'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"),
)); ));
$emailer->send(); $emailer->send();
@ -948,7 +905,7 @@ if ($submit && !$errors)
$sql_args = DB()->build_array('UPDATE', $db_data); $sql_args = DB()->build_array('UPDATE', $db_data);
DB()->query("UPDATE ". BB_USERS ." SET $sql_args WHERE user_id = {$pr_data['user_id']} LIMIT 1"); DB()->query("UPDATE ". BB_USERS ." SET $sql_args WHERE user_id = {$pr_data['user_id']}");
if ($pr_data['user_id'] != $userdata['user_id']) if ($pr_data['user_id'] != $userdata['user_id'])
{ {

View file

@ -2,6 +2,8 @@
if (!defined('IN_FORUM')) die("Hacking attempt"); if (!defined('IN_FORUM')) die("Hacking attempt");
set_die_append_msg();
if ($bb_cfg['emailer_disabled']) bb_die($lang['EMAILER_DISABLED']); if ($bb_cfg['emailer_disabled']) bb_die($lang['EMAILER_DISABLED']);
$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN); $need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN);
@ -40,34 +42,28 @@ if ( isset($_POST['submit']) )
message_die(GENERAL_ERROR, 'Could not update new password information', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update new password information', '', __LINE__, __FILE__, $sql);
} }
include(INC_DIR . 'emailer.class.php'); require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->email_address("$username <{$row['user_email']}>");
$emailer->use_template('user_activate_passwd', $row['user_lang']); $emailer->use_template('user_activate_passwd', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject($lang['NEW_PASSWORD_ACTIVATION']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $username, 'USERNAME' => $username,
'PASSWORD' => $user_password, 'PASSWORD' => $user_password,
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '',
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey) 'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
)); ));
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
$message = $lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>'); bb_die($lang['PASSWORD_UPDATED']);
message_die(GENERAL_MESSAGE, $message);
} }
else else
{ {
message_die(GENERAL_MESSAGE, $lang['NO_EMAIL_MATCH']); bb_die($lang['NO_EMAIL_MATCH']);
} }
} }
else else
@ -85,7 +81,7 @@ $template->assign_vars(array(
'EMAIL' => $email, 'EMAIL' => $email,
'CAPTCHA_HTML' => ($need_captcha) ? CAPTCHA()->get_html() : '', 'CAPTCHA_HTML' => ($need_captcha) ? CAPTCHA()->get_html() : '',
'S_HIDDEN_FIELDS' => '', 'S_HIDDEN_FIELDS' => '',
'S_PROFILE_ACTION' => "profile.php?mode=sendpassword") 'S_PROFILE_ACTION' => "profile.php?mode=sendpassword",
); ));
print_page('usercp_sendpasswd.tpl'); print_page('usercp_sendpasswd.tpl');

View file

@ -662,7 +662,6 @@ $lang['SEND_EMAIL_MSG'] = 'Send an e-mail message';
$lang['NO_USER_SPECIFIED'] = 'No user was specified'; $lang['NO_USER_SPECIFIED'] = 'No user was specified';
$lang['USER_PREVENT_EMAIL'] = 'This user does not wish to receive e-mail. Try sending them a private message.'; $lang['USER_PREVENT_EMAIL'] = 'This user does not wish to receive e-mail. Try sending them a private message.';
$lang['USER_NOT_EXIST'] = 'That user does not exist'; $lang['USER_NOT_EXIST'] = 'That user does not exist';
$lang['CC_EMAIL'] = 'Send a copy of this e-mail to yourself';
$lang['EMAIL_MESSAGE_DESC'] = 'This message will be sent as plain text, so do not include any HTML or BBCode. The return address for this message will be set to your e-mail address.'; $lang['EMAIL_MESSAGE_DESC'] = 'This message will be sent as plain text, so do not include any HTML or BBCode. The return address for this message will be set to your e-mail address.';
$lang['FLOOD_EMAIL_LIMIT'] = 'You cannot send another e-mail at this time. Try again later.'; $lang['FLOOD_EMAIL_LIMIT'] = 'You cannot send another e-mail at this time. Try again later.';
$lang['RECIPIENT'] = 'Recipient'; $lang['RECIPIENT'] = 'Recipient';

View file

@ -664,7 +664,6 @@ $lang['SEND_EMAIL_MSG'] = 'Отправить e-mail';
$lang['NO_USER_SPECIFIED'] = 'Пользователь не был выбран'; $lang['NO_USER_SPECIFIED'] = 'Пользователь не был выбран';
$lang['USER_PREVENT_EMAIL'] = 'Пользователь не желает получать e-mail. Попробуйте отправить ему/ей личное сообщение'; $lang['USER_PREVENT_EMAIL'] = 'Пользователь не желает получать e-mail. Попробуйте отправить ему/ей личное сообщение';
$lang['USER_NOT_EXIST'] = 'Пользователя не существует'; $lang['USER_NOT_EXIST'] = 'Пользователя не существует';
$lang['CC_EMAIL'] = 'Отправить копию сообщения самому себе';
$lang['EMAIL_MESSAGE_DESC'] = 'Сообщение будет отправлено в виде простого текста, не включайте в него HTML или BBCode. В качестве обратного адреса будет показываться ваш e-mail адрес.'; $lang['EMAIL_MESSAGE_DESC'] = 'Сообщение будет отправлено в виде простого текста, не включайте в него HTML или BBCode. В качестве обратного адреса будет показываться ваш e-mail адрес.';
$lang['FLOOD_EMAIL_LIMIT'] = 'Вы не можете отправить ещё один e-mail сразу после предыдущего, повторите запрос позднее.'; $lang['FLOOD_EMAIL_LIMIT'] = 'Вы не можете отправить ещё один e-mail сразу после предыдущего, повторите запрос позднее.';
$lang['RECIPIENT'] = 'Получатель'; $lang['RECIPIENT'] = 'Получатель';

View file

@ -177,7 +177,6 @@ if ($result = DB()->fetch_rowset($sql))
{ {
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&amp;". POST_USERS_URL ."=$user_id") : 'mailto:'. $row['user_email']; $email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&amp;". POST_USERS_URL ."=$user_id") : 'mailto:'. $row['user_email'];
$email = '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>'; $email = '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>';
//$email = ($bb_cfg['text_buttons']) ? '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>' : '<a href="' . $email_uri .'"><img src="' . $images['icon_email'] . '" alt="' . $lang['SEND_EMAIL_MSG'] . '" title="' . $lang['SEND_EMAIL_MSG'] . '" border="0" /></a>';
} }
else else

View file

@ -13,13 +13,7 @@ $vote_id = (int) @$_POST['vote_id'];
$return_topic_url = TOPIC_URL . $topic_id; $return_topic_url = TOPIC_URL . $topic_id;
$return_topic_url .= !empty($_POST['start']) ? "&amp;start=". intval($_POST['start']) : ''; $return_topic_url .= !empty($_POST['start']) ? "&amp;start=". intval($_POST['start']) : '';
$template->assign_var('BB_DIE_APPEND_MSG', ' set_die_append_msg($forum_id, $topic_id);
<a href="'. $return_topic_url .'">Вернуться в тему</a>
<br /><br />
<a href="viewforum.php?f='. $forum_id .'">Вернуться в раздел</a>
<br /><br />
<a href="index.php">Вернуться на главную страницу</a>
');
$poll = new bb_poll(); $poll = new bb_poll();

View file

@ -404,7 +404,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
if (!$error_msg) if (!$error_msg)
{ {
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user); user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $notify_user);
} }
if ($mode == 'newtopic' || $mode == 'reply') if ($mode == 'newtopic' || $mode == 'reply')

View file

@ -1104,31 +1104,21 @@ else if ( $submit || $refresh || $mode != '' )
if ( bf($to_userdata['user_opt'], 'user_opt', 'notify_pm') && !empty($to_userdata['user_email']) && $to_userdata['user_active'] && $bb_cfg['pm_notify_enabled'] ) if ( bf($to_userdata['user_opt'], 'user_opt', 'notify_pm') && !empty($to_userdata['user_email']) && $to_userdata['user_active'] && $bb_cfg['pm_notify_enabled'] )
{ {
$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($bb_cfg['script_path'])); require(INC_DIR .'emailer.class.php');
$script_name = ( $script_name != '' ) ? $script_name . '/'. PM_URL : PM_URL;
$server_name = trim($bb_cfg['server_name']);
$server_protocol = ( $bb_cfg['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $bb_cfg['server_port'] <> 80 ) ? ':' . trim($bb_cfg['server_port']) . '/' : '/';
include(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']); $emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']); $emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['board_email']); $emailer->email_address($to_userdata['username'] ." <{$to_userdata['user_email']}>");
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']); $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
$emailer->email_address($to_userdata['user_email']);
$emailer->set_subject($lang['NOTIFICATION_SUBJECT']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'USERNAME' => stripslashes($to_username), 'USERNAME' => html_entity_decode($to_username),
'NAME_FROM' => $userdata['username'], 'NAME_FROM' => $userdata['username'],
'MSG_SUBJECT' => stripslashes($privmsg_subject), 'MSG_SUBJECT' => html_entity_decode($privmsg_subject),
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => $bb_cfg['sitename'],
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '', 'U_INBOX' => make_url(PM_URL ."?folder=inbox$pm&mode=read&p=". $privmsg_sent_id),
));
'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox&mode=read&p=' . $privmsg_sent_id)
);
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();

View file

@ -83,7 +83,7 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
<!-- BEGIN list --> <!-- BEGIN list -->
<tr class="{list.ROW_CLASS} hl-tr"> <tr class="{list.ROW_CLASS} hl-tr">
<td align="center"><input type="checkbox" name="select[]" class="checkbox" value="{list.CRON_ID}"></td> <td align="center"><input type="checkbox" name="select[]" class="checkbox" value="{list.CRON_ID}"></td>
<td nowrap="nowrap" align="center">{list.CRON_ID}</td> <td nowrap="nowrap" align="center">{list.JOB_ID}</td>
<td nowrap="nowrap" align="center">{list.CRON_ACTIVE}</td> <td nowrap="nowrap" align="center">{list.CRON_ACTIVE}</td>
<td nowrap="nowrap" align="left">{list.CRON_TITLE}</td> <td nowrap="nowrap" align="left">{list.CRON_TITLE}</td>
<td nowrap="nowrap" align="left">{list.CRON_SCRIPT}</td> <td nowrap="nowrap" align="left">{list.CRON_SCRIPT}</td>
@ -92,9 +92,9 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
<td nowrap="nowrap" align="center">{list.NEXT_RUN}</td> <td nowrap="nowrap" align="center">{list.NEXT_RUN}</td>
<td nowrap="nowrap" align="center"><font color="#505050"><b><span class="leechmed">{list.RUN_COUNT}</span></b></font></td> <td nowrap="nowrap" align="center"><font color="#505050"><b><span class="leechmed">{list.RUN_COUNT}</span></b></font></td>
<td nowrap="nowrap" align="center"> <td nowrap="nowrap" align="center">
<a href="admin_cron.php?mode=run&id={list.CRON_ID}"><img src="../images/icon_sync.gif" alt="[Run]" title="{L_CRON_RUN}" /></a> <a href="admin_cron.php?mode=run&id={list.CRON_ID}"><img src="{SITE_URL}images/icon_sync.gif" alt="[Run]" title="{L_CRON_RUN}" /></a>
<a href="admin_cron.php?mode=edit&id={list.CRON_ID}"><img src="../images/icon_edit.gif" alt="[Edit]" title="{L_CRON_EDIT_HEAD_EDIT}" /></a> <a href="admin_cron.php?mode=edit&id={list.CRON_ID}"><img src="{SITE_URL}images/icon_edit.gif" alt="[Edit]" title="{L_CRON_EDIT_HEAD_EDIT}" /></a>
<a href="admin_cron.php?mode=delete&id={list.CRON_ID}"><img src="../images/icon_delete.gif" alt="[Del]" title="{L_CRON_DEL}" onclick="return cfm('Вы действительно хотите удалить крон задачу?');" /></a> <a href="admin_cron.php?mode=delete&id={list.CRON_ID}"><img src="{SITE_URL}images/icon_delete.gif" alt="[Del]" title="{L_CRON_DEL}" onclick="return cfm('Вы действительно хотите удалить крон задачу?');" /></a>
</td> </td>
</tr> </tr>
<!-- END list --> <!-- END list -->

View file

@ -4,7 +4,7 @@
<p>{L_MASS_EMAIL_EXPLAIN}</p> <p>{L_MASS_EMAIL_EXPLAIN}</p>
<br /> <br />
<form method="post" action="{S_USER_ACTION}"> <form method="post" action="{S_USER_ACTION}" onSubmit="return checkForm(this);">
<table class="forumline"> <table class="forumline">
<tr> <tr>
@ -16,15 +16,35 @@
</tr> </tr>
<tr> <tr>
<td class="row1" align="right"><b>{L_SUBJECT}</b></td> <td class="row1" align="right"><b>{L_SUBJECT}</b></td>
<td class="row2"><span class="gen"><input class="post" type="text" name="subject" size="45" maxlength="100" tabindex="2" class="post" value="{SUBJECT}" /></span></td> <td class="row2"><input class="post" type="text" name="subject" size="45" maxlength="100" style="width:98%" tabindex="2" class="post" value="{SUBJECT}" /></td>
</tr> </tr>
<tr> <tr>
<td class="row1" align="right" valign="top"> <span class="gen"><b>{L_MESSAGE}</b></span></td> <td class="row1" align="right" valign="top"> <span class="gen"><b>{L_MESSAGE}</b></span></td>
<td class="row2"><span class="gen"> <textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post">{MESSAGE}</textarea></span></td> <td class="row2"><textarea name="message" rows="15" cols="35" wrap="virtual" style="width:98%" tabindex="3" class="post">{MESSAGE}</textarea></td>
</tr> </tr>
<tr> <tr>
<td class="catBottom" colspan="2"><input type="submit" value="{L_EMAIL}" name="submit" class="mainoption" /></td> <td class="catBottom" colspan="2"><input type="submit" value="{L_SEND_EMAIL}" name="submit" class="mainoption" /></td>
</tr> </tr>
</table> </table>
</form> </form>
<script type="text/javascript">
function checkForm(formObj)
{
formErrors = false;
if (formObj.message.value.length < 2) {
formErrors = "{L_EMPTY_MESSAGE_EMAIL}";
}
else if ( formObj.subject.value.length < 2)
{
formErrors = "{L_EMPTY_SUBJECT_EMAIL}";
}
if (formErrors) {
alert(formErrors);
return false;
}
}
</script>

View file

@ -201,11 +201,16 @@ function checkForm(form) {
if(form.message.value.length < 100 && submitted) if(form.message.value.length < 100 && submitted)
{ {
setTimeout(function() { setTimeout(function() {
if ($('input[name="notify"]').attr('checked') == 'checked') {
var notify = 1;
}
ajax.exec({ ajax.exec({
action : 'posts', action : 'posts',
type : 'add', type : 'add',
message : $('textarea#message').val(), message : $('textarea#message').val(),
topic_id: {TOPIC_ID} topic_id : {TOPIC_ID},
notify : notify,
}); });
}, 100); }, 100);
return false; return false;

View file

@ -24,10 +24,6 @@
<td valign="top"><b>{L_MESSAGE}</b><p class="small pad_6">{L_EMAIL_MESSAGE_DESC}</p></td> <td valign="top"><b>{L_MESSAGE}</b><p class="small pad_6">{L_EMAIL_MESSAGE_DESC}</p></td>
<td><textarea name="message" rows="25" cols="80">{MESSAGE}</textarea></td> <td><textarea name="message" rows="25" cols="80">{MESSAGE}</textarea></td>
</tr> </tr>
<tr>
<td valign="top"><b>{L_OPTIONS}</b></td>
<td><label><input type="checkbox" name="cc_email" value="1" /> {L_CC_EMAIL}</label></td>
</tr>
<tr> <tr>
<td colspan="2" class="catBottom"> <td colspan="2" class="catBottom">
<input type="submit" name="submit" class="main" value="{L_SEND_EMAIL}" /> <input type="submit" name="submit" class="main" value="{L_SEND_EMAIL}" />

View file

@ -90,20 +90,22 @@ if ($topic_id && isset($_GET['view']) && ($_GET['view'] == 'next' || $_GET['view
// Get forum/topic data // Get forum/topic data
if ($topic_id) if ($topic_id)
{ {
$sql = "SELECT t.*, f.* $sql = "SELECT t.*, f.*, tw.notify_status
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f FROM ". BB_TOPICS ." t
LEFT JOIN ". BB_FORUMS ." f USING(forum_id)
LEFT JOIN ". BB_TOPICS_WATCH ." tw ON(tw.topic_id = t.topic_id AND user_id = {$userdata['user_id']})
WHERE t.topic_id = $topic_id WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id ";
LIMIT 1";
} }
elseif ($post_id) elseif ($post_id)
{ {
$sql = "SELECT t.*, f.*, p.post_time $sql = "SELECT t.*, f.*, p.post_time, tw.notify_status
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f, ". BB_POSTS ." p FROM ". BB_TOPICS ." t
LEFT JOIN ". BB_FORUMS ." f USING(forum_id)
LEFT JOIN ". BB_POSTS ." p USING(topic_id)
LEFT JOIN ". BB_TOPICS_WATCH ." tw ON(tw.topic_id = t.topic_id AND user_id = {$userdata['user_id']})
WHERE p.post_id = $post_id WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id ";
AND f.forum_id = t.forum_id
LIMIT 1";
} }
else else
{ {
@ -258,12 +260,7 @@ if ($bb_cfg['topic_notify_enabled'])
{ {
$can_watch_topic = TRUE; $can_watch_topic = TRUE;
$sql = "SELECT SQL_CACHE notify_status if (!empty($t_data['notify_status']) && $t_data['notify_status'])
FROM " . BB_TOPICS_WATCH . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ($row = DB()->fetch_row($sql))
{ {
if (isset($_GET['unwatch'])) if (isset($_GET['unwatch']))
{ {
@ -271,13 +268,7 @@ if ($bb_cfg['topic_notify_enabled'])
{ {
$is_watching_topic = 0; $is_watching_topic = 0;
$sql = "DELETE FROM " . BB_TOPICS_WATCH . " DB()->query("DELETE FROM ". BB_TOPICS_WATCH ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']}");
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if (!($result = DB()->sql_query($sql)))
{
message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql);
}
} }
set_die_append_msg($forum_id, $topic_id); set_die_append_msg($forum_id, $topic_id);
@ -288,16 +279,9 @@ if ($bb_cfg['topic_notify_enabled'])
{ {
$is_watching_topic = TRUE; $is_watching_topic = TRUE;
if ($row['notify_status']) if (!$t_data['notify_status'])
{ {
$sql = "UPDATE " . BB_TOPICS_WATCH . " DB()->query("UPDATE ". BB_TOPICS_WATCH ." SET notify_status = ". TOPIC_WATCH_NOTIFIED ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']}");
SET notify_status = 0
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if (!($result = DB()->sql_query($sql)))
{
message_die(GENERAL_ERROR, "Could not update topic watch information", '', __LINE__, __FILE__, $sql);
}
} }
} }
} }
@ -309,12 +293,10 @@ if ($bb_cfg['topic_notify_enabled'])
{ {
$is_watching_topic = TRUE; $is_watching_topic = TRUE;
$sql = "INSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status) DB()->query("
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; INSERT INTO ". BB_TOPICS_WATCH ." (user_id, topic_id, notify_status)
if (!($result = DB()->sql_query($sql))) VALUES (". $userdata['user_id'] .", $topic_id, ". TOPIC_WATCH_NOTIFIED .")
{ ");
message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql);
}
} }
set_die_append_msg($forum_id, $topic_id); set_die_append_msg($forum_id, $topic_id);
@ -438,8 +420,7 @@ if (!$ranks = $datastore->get('ranks'))
// //
// Define censored word matches // Define censored word matches
// //
$orig_word = array(); $orig_word = $replacement_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word); obtain_word_list($orig_word, $replacement_word);
// //
@ -684,7 +665,6 @@ if ($topic_has_poll)
$template->assign_vars(array( $template->assign_vars(array(
'TOPIC_HAS_POLL' => false, 'TOPIC_HAS_POLL' => false,
)); ));
bb_log(join("\t", array(date('m-d H:i:s'), $topic_id, "\n")), 'poll_err');
} }
else else
{ {
@ -936,10 +916,13 @@ if ($bb_cfg['show_quick_reply'])
'QR_TOPIC_ID' => $topic_id, 'QR_TOPIC_ID' => $topic_id,
'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '', 'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '',
)); ));
if (!IS_GUEST) if (!IS_GUEST)
{ {
$notify_user = bf($userdata['user_opt'], 'user_opt', 'notify');
$template->assign_vars(array( $template->assign_vars(array(
'QR_NOTIFY_CHECKED' => (bf($userdata['user_opt'], 'user_opt', 'notify') || $is_watching_topic), 'QR_NOTIFY_CHECKED' => ($notify_user) ? $notify_user && $is_watching_topic : $is_watching_topic,
)); ));
} }
} }