Новое представление емейлов (от кого кому); исправлено уведомление об отслеживаемых темах; -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_tor_browse_only_reg', '0');
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 ('default_dateformat', 'Y-m-d H:i');
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_users', '2');
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_release', '');
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 ('smilies_path', 'images/smiles');
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_version', '8');
INSERT INTO `bb_config` VALUES ('active_ads', '');
INSERT INTO `bb_config` VALUES ('report_subject_auth', '1');
INSERT INTO `bb_config` VALUES ('report_modules_cache', '1');
@ -648,27 +638,27 @@ CREATE TABLE IF NOT EXISTS `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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 ('', 0, 'Site backup', 'site_backup.php', 'daily', '1', '05:00:00', 10, '', '', 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 ('', 1, 'Avatars cleanup', 'avatars_cleanup.php', 'weekly', '1', '05:00:00', 30, '', '', 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 ('', 1, 'Prune forums', 'prune_forums.php', 'daily', NULL, '05:00:00', 50, '', '', 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 ('', 1, 'Logs cleanup', 'clean_log.php', 'daily', NULL, '05:00:00', 70, '', '', 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 ('', 1, 'Clean dlstat', 'clean_dlstat.php', 'daily', NULL, '05:00:00', 100, '', '', 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 ('', 1, 'Sessions cleanup', 'sessions_cleanup.php', 'interval', NULL, NULL, 255, '', '', '00:03: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 ('', 1, 'DS update ''stats''', 'ds_update_stats.php', 'interval', NULL, NULL, 255, '', '', '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 ('', 1, 'Clean search results', 'clean_search_results.php', 'interval', NULL, NULL, 255, '', '', '00:10: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 ('', 1, 'Make tracker snapshot', 'tr_make_snapshot.php', 'interval', NULL, NULL, 10, '', '', '00:10: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 ('', 1, 'Captcha', 'captcha_gen_gc.php', 'daily', NULL, '05:00:00', 120, '', '', NULL, 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 ('', 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(
'ROW_CLASS' => !($i % 2) ? 'row2' : 'row1',
'JOB_ID' => $i + 1,
'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_TITLE' => $row['cron_title'],

View file

@ -3,7 +3,7 @@
// ACP Header - START
if (!empty($setmodules))
{
$module['General']['Mass_Email'] = basename(__FILE__);
$module['Mods']['Mass_Email'] = basename(__FILE__);
return;
}
require('./pagestart.php');
@ -11,150 +11,97 @@ require('./pagestart.php');
@set_time_limit(1200);
$message = '';
$subject = '';
$subject = (string) trim(request_var('subject', ''));
$message = (string) request_var('message', '');
$group_id = (int) request_var(POST_GROUPS_URL, 0);
//
// Do the job ...
//
if ( isset($_POST['submit']) )
$errors = $user_id_sql = array();
if (isset($_POST['submit']))
{
$subject = stripslashes(trim($_POST['subject']));
$message = stripslashes(trim($_POST['message']));
$error = FALSE;
$error_msg = '';
if ( empty($subject) )
if(!$subject) $errors[] = $lang['EMPTY_SUBJECT'];
if(!$message) $errors[] = $lang['EMPTY_MESSAGE'];
if(!$group_id) $errors[] = $lang['GROUP_NOT_EXIST'];
if(!$errors)
{
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['EMPTY_SUBJECT'] : $lang['EMPTY_SUBJECT'];
}
if ( empty($message) )
{
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['EMPTY_MESSAGE'] : $lang['EMPTY_MESSAGE'];
}
$group_id = intval($_POST[POST_GROUPS_URL]);
$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;
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql);
}
if ( $row = DB()->sql_fetchrow($result) )
{
$bcc_list = array();
do
$sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
foreach ($sql as $row)
{
$bcc_list[] = $row['user_email'];
$user_id_sql[] = ','. $row['ban_userid'];
}
while ( $row = DB()->sql_fetchrow($result) );
DB()->sql_freeresult($result);
}
else
{
$message = ( $group_id != -1 ) ? $lang['GROUP_NOT_EXIST'] : $lang['NO_SUCH_USER'];
$error = true;
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $message : $message;
}
if ( !$error )
{
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'])
$user_id_sql = join('', $user_id_sql);
if ($group_id != -1)
{
$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');
$user_list = DB()->fetch_rowset("
SELECT u.username, u.user_email, u.user_lang
FROM ". BB_USERS ." u, ". BB_USER_GROUP ." ug
WHERE ug.group_id = $group_id
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_active = 1
AND u.user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
");
}
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
for ($i = 0; $i < count($bcc_list); $i++)
else
{
$emailer->bcc($bcc_list[$i]);
$user_list = DB()->fetch_rowset("
SELECT username, user_email, user_lang
FROM ". BB_USERS ."
WHERE user_active = 1
AND user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
");
}
require(INC_DIR .'emailer.class.php');
foreach ($user_list as $i => $row)
{
$emailer = new emailer($bb_cfg['smtp_delivery']);
$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->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
$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(
'SUBJECT' => html_entity_decode($subject),
'MESSAGE' => html_entity_decode($message),
));
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'BOARD_EMAIL' => $bb_cfg['board_email'],
'MESSAGE' => $message)
);
$emailer->send();
$emailer->reset();
message_die(GENERAL_MESSAGE, $lang['EMAIL_SENT'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
$emailer->send();
$emailer->reset();
}
}
}
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
//
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(
'MESSAGE' => $message,
'SUBJECT' => $subject,
'L_NOTICE' => @$notice,
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
'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();
// 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']);
}
// Load actions required modules
switch ($ajax->action) {
switch ($ajax->action)
{
case 'view_post':
require(INC_DIR . 'bbcode.php');
break;
@ -110,35 +112,42 @@ class ajax_common
global $lang;
// Exit if we already have errors
if (!empty($this->response['error_code'])) {
if (!empty($this->response['error_code']))
{
$this->send();
}
// Check that requested action is valid
$action = $this->action;
if (!$action || !is_string($action)) {
if (!$action || !is_string($action))
{
$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);
}
// Auth check
switch ($action_params[AJAX_AUTH]) {
switch ($action_params[AJAX_AUTH])
{
// GUEST
case 'guest':
break;
// USER
case 'user':
if (IS_GUEST) {
if (IS_GUEST)
{
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
break;
// MOD
case 'mod':
if (!IS_AM) {
if (!IS_AM)
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
$this->check_admin_session();
@ -146,7 +155,8 @@ class ajax_common
// ADMIN
case 'admin':
if (!IS_ADMIN) {
if (!IS_ADMIN)
{
$this->ajax_die($lang['ONLY_FOR_ADMIN']);
}
$this->check_admin_session();
@ -154,7 +164,8 @@ class ajax_common
// SUPER_ADMIN
case 'super_admin':
if (!IS_SUPER_ADMIN) {
if (!IS_SUPER_ADMIN)
{
$this->ajax_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$this->check_admin_session();
@ -198,7 +209,8 @@ class ajax_common
{
$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();
}
@ -211,16 +223,20 @@ class ajax_common
*/
function ob_handler($contents)
{
if (DBG_USER) {
if ($contents) {
if (DBG_USER)
{
if ($contents)
{
$this->response['raw_output'] = $contents;
}
}
$response_js = bb_json_encode($this->response);
if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
if (UA_GZIP_SUPPORTED && strlen($response_js) > 2000) {
if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))
{
if (UA_GZIP_SUPPORTED && strlen($response_js) > 2000)
{
header('Content-Encoding: gzip');
$response_js = gzencode($response_js, 1);
}
@ -236,15 +252,20 @@ class ajax_common
{
global $user;
if (!$user->data['session_admin']) {
if (empty($this->request['user_password'])) {
if (!$user->data['session_admin'])
{
if (empty($this->request['user_password']))
{
$this->prompt_for_password();
} else {
}
else
{
$login_args = array(
'login_username' => $user->data['username'],
'login_password' => $_POST['user_password'],
);
if (!$user->login($login_args, true)) {
if (!$user->login($login_args, true))
{
$this->ajax_die('Wrong password');
}
}
@ -281,7 +302,8 @@ class ajax_common
$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']);
}
}

View file

@ -78,7 +78,7 @@ switch($this->request['type'])
// 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']);
$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
$message = preg_replace('#(?<=\?uk=)[a-zA-Z0-9]{10}(?=&)#', 'passkey', $message);
// hide sid
@ -91,7 +91,7 @@ switch($this->request['type'])
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)
{
@ -138,7 +138,7 @@ switch($this->request['type'])
$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'])
{
DB()->query("UPDATE ". BB_POSTS ." SET post_edit_time = '". TIMENOW ."', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id LIMIT 1");
@ -298,8 +298,14 @@ switch($this->request['type'])
'post_id' => $post_id,
'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;
default:

View file

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

View file

@ -243,21 +243,18 @@ else if (@$_POST['joingroup'])
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->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($moderator['username'] ." <{$moderator['user_email']}>");
$emailer->use_template('group_request', $moderator['user_lang']);
$emailer->email_address($moderator['user_email']);
$emailer->set_subject($lang['GROUP_REQUEST']);
$emailer->assign_vars(array(
'USER' => $userdata['username'],
'SITENAME' => $bb_cfg['sitename'],
'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),
));
$emailer->send();
@ -306,19 +303,17 @@ else
require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
$emailer->use_template('group_added', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject($lang['GROUP_ADDED']);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'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),
));
$emailer->send();
$emailer->reset();
}
@ -366,43 +361,32 @@ else
// Email users when they are approved
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 ."
WHERE user_id IN($sql_in)";
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');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$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(
'SITENAME' => $bb_cfg['sitename'],
'GROUP_NAME' => $group_name,
'EMAIL_SIG' => ($bb_cfg['board_email_sig']) ? str_replace('<br />', "\n", "-- \n". $bb_cfg['board_email_sig']) : '',
'GROUP_NAME' => $group_info['group_name'],
'U_GROUPCP' => make_url(GROUP_URL . $group_id),
));
$emailer->send();
$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');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank');
$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');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->use_template('blank');
$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();
$sql = short_query($dbg['sql'], true);
$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'];
$file = addslashes($dbg['file']);
$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
//
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'])
{
return;
}
$current_time = TIMENOW;
if ($mode != 'delete')
{
if ($mode == 'reply')
{
$sql = "SELECT ban_userid
FROM " . BB_BANLIST;
if (!($result = DB()->sql_query($sql)))
$update_watched_sql = $user_id_sql = array();
$sql = DB()->fetch_rowset("SELECT ban_userid FROM ". BB_BANLIST ." WHERE ban_userid != 0");
foreach ($sql as $row)
{
message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
$user_id_sql[] = ','. $row['ban_userid'];
}
$user_id_sql = join('', $user_id_sql);
$user_id_sql = '';
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
$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
WHERE tw.topic_id = $topic_id
AND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . BOT_UID . ", " . GUEST_UID . $user_id_sql . ")
AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
AND u.user_id = tw.user_id";
if (!($result = DB()->sql_query($sql)))
AND tw.user_id NOT IN (". $userdata['user_id'] .", ". EXCLUDED_USERS_CSV . $user_id_sql .")
AND tw.notify_status = ". TOPIC_WATCH_NOTIFIED ."
AND u.user_id = tw.user_id
");
if ($watch_list)
{
message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$orig_word = $replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
if (count($orig_word))
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
$u_topic = make_url(TOPIC_URL . $topic_id .'&view=newest#newest');
$unwatch_topic = make_url(TOPIC_URL ."$topic_id&unwatch=topic");
foreach ($watch_list as $row)
{
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
$emailer->use_template('topic_notify', $row['user_lang']);
$emailer->assign_vars(array(
'TOPIC_TITLE' => html_entity_decode($topic_title),
'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $row['username'],
'U_TOPIC' => $u_topic,
'U_STOP_WATCHING_TOPIC' => $unwatch_topic,
));
$emailer->send();
$emailer->reset();
$update_watched_sql[] = $row['user_id'];
}
$update_watched_sql = join(',', $update_watched_sql);
}
$update_watched_sql = '';
$bcc_list_ary = array();
if ($row = DB()->sql_fetchrow($result))
if ($update_watched_sql)
{
// Sixty second limit
@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']);
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($bb_cfg['script_path']));
$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);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
if (count($orig_word))
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
@reset($bcc_list_ary);
while (list($user_lang, $bcc_list) = each($bcc_list_ary))
{
$emailer->use_template('topic_notify', $user_lang);
for ($i = 0; $i < count($bcc_list); $i++)
{
$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(
'TOPIC_TITLE' => $topic_title,
'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $user->name,
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '',
'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "=$post_id#$post_id",
'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
);
$emailer->send();
$emailer->reset();
}
}
}
DB()->sql_freeresult($result);
if ($update_watched_sql != '')
{
$sql = "UPDATE " . BB_TOPICS_WATCH . "
SET notify_status = " . TOPIC_WATCH_NOTIFIED . "
DB()->query("UPDATE ". BB_TOPICS_WATCH ."
SET notify_status = ". TOPIC_WATCH_UN_NOTIFIED ."
WHERE topic_id = $topic_id
AND user_id IN ($update_watched_sql)";
DB()->sql_query($sql);
AND user_id IN ($update_watched_sql)
");
}
}
$sql = "SELECT topic_id
FROM " . BB_TOPICS_WATCH . "
$topic_watch = DB()->fetch_row("SELECT topic_id
FROM ". BB_TOPICS_WATCH ."
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if (!($result = DB()->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
}
AND user_id = {$userdata['user_id']}
", 'topic_id');
$row = DB()->sql_fetchrow($result);
if (!$notify_user && !empty($row['topic_id']))
if (!$notify_user && !empty($topic_watch))
{
$sql = "DELETE FROM " . BB_TOPICS_WATCH . "
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);
}
DB()->query("DELETE FROM ". BB_TOPICS_WATCH ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']}");
}
else if ($notify_user && empty($row['topic_id']))
else if ($notify_user && empty($topic_watch))
{
$sql = "INSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
if (!DB()->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql);
}
DB()->query("
INSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status)
VALUES (". $userdata['user_id'] .", $topic_id, ". TOPIC_WATCH_NOTIFIED .")
");
}
}
}
@ -495,8 +433,6 @@ function insert_post ($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new
{
global $userdata, $lang;
require(DEFAULT_LANG_DIR .'lang_bot.php');
if (!$topic_id) return;
$post_username = $post_subject = $post_text = $poster_ip = '';

View file

@ -341,7 +341,7 @@ function report_notify($mode)
// Obtain notification users
$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 . '
WHERE user_active = 1
AND user_level ' . $user_level_sql . '
@ -494,26 +494,10 @@ function report_notify($mode)
return true;
}
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");
require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$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']) . '/' : '/';
$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']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
// Send emails
foreach ($notify_users as $report_id => $report_notify_users)
@ -522,20 +506,20 @@ function report_notify($mode)
foreach ($report_notify_users as $user_info)
{
$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
$lang =& report_notify_lang($user_info['user_lang']);
// Set email variables, we use $vars here because of an emailer bug
$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_TEXT' => $report['report_desc'],
'REPORT_TITLE' => $report['report_title'],
'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)
{
@ -550,19 +534,19 @@ function report_notify($mode)
}
$vars = array_merge($vars, array(
'REPORT_AUTHOR' => $user->name,
'REPORT_TIME' => bb_date($report['report_time']),
'REPORT_REASON' => $report_reason)
);
'REPORT_AUTHOR' => $userdata['username'],
'REPORT_TIME' => bb_date($report['report_time'], $bb_cfg['last_post_date_format']),
'REPORT_REASON' => $report_reason,
));
break;
case 'change':
$vars = array_merge($vars, array(
'REPORT_CHANGE_AUTHOR' => $report['username'],
'REPORT_CHANGE_TIME' => bb_date($report['report_change_time']),
'REPORT_CHANGE_STATUS' => $lang['REPORT_STATUS'][$status],
'REPORT_CHANGE_COMMENT' => str_replace(array("\r\n", "\r", "\n"), ' ', $report['report_change_comment']))
);
'REPORT_CHANGE_AUTHOR' => $report['username'],
'REPORT_CHANGE_TIME' => bb_date($report['report_change_time'], $bb_cfg['last_post_date_format']),
'REPORT_CHANGE_STATUS' => $lang['REPORT_STATUS'][$status],
'REPORT_CHANGE_COMMENT' => str_replace(array("\r\n", "\r", "\n"), ' ', $report['report_change_comment']),
));
break;
}

View file

@ -41,7 +41,8 @@ define('XS_TAG_ENDIF', 8);
define('XS_TAG_BEGINELSE', 11);
class Template {
class Template
{
var $classname = "Template";
// variable that holds all the data we'll be substituting into
@ -251,7 +252,7 @@ class Template {
{
$this->cur_tpl = $filename;
global $lang, $bb_cfg, $user;
global $lang, $bb_cfg, $user, $tr_cfg;
$L =& $lang;
$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 == '' )
{
include(INC_DIR . 'emailer.class.php');
require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
$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(
'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $row['username'],
'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->reset();

View file

@ -8,13 +8,15 @@ if (!$bb_cfg['board_email_form'])
redirect("index.php");
}
set_die_append_msg();
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]);
}
else
{
message_die(GENERAL_MESSAGE, $lang['NO_USER_SPECIFIED']);
bb_die($lang['NO_USER_SPECIFIED']);
}
if ( !$userdata['session_logged_in'] )
@ -22,111 +24,68 @@ if ( !$userdata['session_logged_in'] )
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";
if ( $row = DB()->fetch_row($sql) )
$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))
{
$username = $row['username'];
$username = $row['username'];
$user_email = $row['user_email'];
$user_lang = $row['user_lang'];
$user_lang = $row['user_lang'];
if ( true || IS_ADMIN ) // TRUE instead of missing user_opt "prevent_email"
{
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(!$subject) $errors[] = $lang['EMPTY_SUBJECT_EMAIL'];
if(!$message) $errors[] = $lang['EMPTY_MESSAGE_EMAIL'];
if ( !empty($_POST['subject']) )
if (!$errors)
{
$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']) )
{
$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->from($userdata['user_email']);
$emailer->replyto($userdata['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->from($userdata['username'] ." <{$userdata['user_email']}>");
$emailer->email_address($username ." <$user_email>");
$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'],
'SITENAME' => $bb_cfg['sitename'],
'FROM_USERNAME' => $userdata['username'],
'TO_USERNAME' => $username,
'MESSAGE' => $message)
);
'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->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();
}
sleep(7);
$message = $lang['EMAIL_SENT'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>');
message_die(GENERAL_MESSAGE, $message);
bb_die($lang['EMAIL_SENT']);
}
}
if (!empty($error))
{
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
}
$template->assign_vars(array(
'USERNAME' => $username,
'USERNAME' => profile_url($row),
'S_HIDDEN_FIELDS' => '',
'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');
}
else
{
message_die(GENERAL_MESSAGE, $lang['USER_PREVENT_EMAIL']);
bb_die($lang['USER_PREVENT_EMAIL']);
}
}
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_level,
user_avatar,
user_email,
$profile_fields_sql
FROM ". BB_USERS ."
WHERE user_id = $pr_user_id
@ -812,22 +813,19 @@ if ($submit && !$errors)
$email_template = 'user_welcome';
}
include(INC_DIR . 'emailer.class.php');
require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address("$username <$email>");
$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(
'SITENAME' => $bb_cfg['sitename'],
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']),
'USERNAME' => html_entity_decode($username),
'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'])
));
@ -837,59 +835,22 @@ if ($submit && !$errors)
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);
}
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->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();
}
}
if (empty($active_admin))
{
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->email_address($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] ." <{$row['user_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);
}
}
@ -910,11 +871,10 @@ if ($submit && !$errors)
$pr_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->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
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->email_address($email);
$emailer->set_subject($lang['REACTIVATE']);
$emailer->email_address("$username <$email>");
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'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"),
));
$emailer->send();
@ -948,7 +905,7 @@ if ($submit && !$errors)
$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'])
{

View file

@ -2,6 +2,8 @@
if (!defined('IN_FORUM')) die("Hacking attempt");
set_die_append_msg();
if ($bb_cfg['emailer_disabled']) bb_die($lang['EMAILER_DISABLED']);
$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);
}
include(INC_DIR . 'emailer.class.php');
require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address("$username <{$row['user_email']}>");
$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(
'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $username,
'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)
));
$emailer->send();
$emailer->reset();
$message = $lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_INDEX'], '<a href="index.php">', '</a>');
message_die(GENERAL_MESSAGE, $message);
bb_die($lang['PASSWORD_UPDATED']);
}
else
{
message_die(GENERAL_MESSAGE, $lang['NO_EMAIL_MATCH']);
bb_die($lang['NO_EMAIL_MATCH']);
}
}
else
@ -85,7 +81,7 @@ $template->assign_vars(array(
'EMAIL' => $email,
'CAPTCHA_HTML' => ($need_captcha) ? CAPTCHA()->get_html() : '',
'S_HIDDEN_FIELDS' => '',
'S_PROFILE_ACTION' => "profile.php?mode=sendpassword")
);
'S_PROFILE_ACTION' => "profile.php?mode=sendpassword",
));
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['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['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['FLOOD_EMAIL_LIMIT'] = 'You cannot send another e-mail at this time. Try again later.';
$lang['RECIPIENT'] = 'Recipient';

View file

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

View file

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

View file

@ -404,7 +404,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
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')

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'] )
{
$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($bb_cfg['script_path']));
$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');
require(INC_DIR .'emailer.class.php');
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['board_email']);
$emailer->replyto($bb_cfg['board_email']);
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($to_userdata['username'] ." <{$to_userdata['user_email']}>");
$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(
'USERNAME' => stripslashes($to_username),
'NAME_FROM' => $userdata['username'],
'MSG_SUBJECT' => stripslashes($privmsg_subject),
'SITENAME' => $bb_cfg['sitename'],
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '',
'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox&mode=read&p=' . $privmsg_sent_id)
);
'USERNAME' => html_entity_decode($to_username),
'NAME_FROM' => $userdata['username'],
'MSG_SUBJECT' => html_entity_decode($privmsg_subject),
'SITENAME' => $bb_cfg['sitename'],
'U_INBOX' => make_url(PM_URL ."?folder=inbox$pm&mode=read&p=". $privmsg_sent_id),
));
$emailer->send();
$emailer->reset();

View file

@ -83,7 +83,7 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
<!-- BEGIN list -->
<tr class="{list.ROW_CLASS} hl-tr">
<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="left">{list.CRON_TITLE}</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"><font color="#505050"><b><span class="leechmed">{list.RUN_COUNT}</span></b></font></td>
<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=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=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=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="{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="{SITE_URL}images/icon_delete.gif" alt="[Del]" title="{L_CRON_DEL}" onclick="return cfm('Вы действительно хотите удалить крон задачу?');" /></a>
</td>
</tr>
<!-- END list -->

View file

@ -4,27 +4,47 @@
<p>{L_MASS_EMAIL_EXPLAIN}</p>
<br />
<form method="post" action="{S_USER_ACTION}">
<form method="post" action="{S_USER_ACTION}" onSubmit="return checkForm(this);">
<table class="forumline">
<tr>
<th colspan="2">{L_COMPOSE}</th>
</tr>
<tr>
<td class="row1" align="right"><b>{L_RECIPIENTS}</b></td>
<td class="row2">{S_GROUP_SELECT}</td>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<td class="catBottom" colspan="2"><input type="submit" value="{L_EMAIL}" name="submit" class="mainoption" /></td>
</tr>
<tr>
<th colspan="2">{L_COMPOSE}</th>
</tr>
<tr>
<td class="row1" align="right"><b>{L_RECIPIENTS}</b></td>
<td class="row2">{S_GROUP_SELECT}</td>
</tr>
<tr>
<td class="row1" align="right"><b>{L_SUBJECT}</b></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>
<td class="row1" align="right" valign="top"> <span class="gen"><b>{L_MESSAGE}</b></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>
<td class="catBottom" colspan="2"><input type="submit" value="{L_SEND_EMAIL}" name="submit" class="mainoption" /></td>
</tr>
</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

@ -105,7 +105,7 @@ ajax.callback.posts = function(data){
onkeyup = "storeCaret(this);"
>{MESSAGE}</textarea>
<!-- IF USER_RUS -->
<!-- IF USER_RUS -->
<div id="translit_opt" class="mrg_4" style="display: none;">
<table cellspacing="0" class="translit_expl borderless bCenter">
<tr>
@ -180,7 +180,7 @@ $('#post-submit-btn').click(function(event){
});
$('#post-js-warn').hide();
$('#post-buttons-block').show();
$('#post-submit-btn').removeAttr('disabled');
$('#post-submit-btn').removeAttr('disabled');
// Called before form submitting.
var submitted = false;
@ -201,11 +201,16 @@ function checkForm(form) {
if(form.message.value.length < 100 && submitted)
{
setTimeout(function() {
if ($('input[name="notify"]').attr('checked') == 'checked') {
var notify = 1;
}
ajax.exec({
action: 'posts',
type: 'add',
message: $('textarea#message').val(),
topic_id: {TOPIC_ID}
action : 'posts',
type : 'add',
message : $('textarea#message').val(),
topic_id : {TOPIC_ID},
notify : notify,
});
}, 100);
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><textarea name="message" rows="25" cols="80">{MESSAGE}</textarea></td>
</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>
<td colspan="2" class="catBottom">
<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
if ($topic_id)
{
$sql = "SELECT t.*, f.*
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f
$sql = "SELECT t.*, f.*, tw.notify_status
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
AND f.forum_id = t.forum_id
LIMIT 1";
";
}
elseif ($post_id)
{
$sql = "SELECT t.*, f.*, p.post_time
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f, ". BB_POSTS ." p
$sql = "SELECT t.*, f.*, p.post_time, tw.notify_status
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
AND t.topic_id = p.topic_id
AND f.forum_id = t.forum_id
LIMIT 1";
";
}
else
{
@ -258,12 +260,7 @@ if ($bb_cfg['topic_notify_enabled'])
{
$can_watch_topic = TRUE;
$sql = "SELECT SQL_CACHE notify_status
FROM " . BB_TOPICS_WATCH . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ($row = DB()->fetch_row($sql))
if (!empty($t_data['notify_status']) && $t_data['notify_status'])
{
if (isset($_GET['unwatch']))
{
@ -271,13 +268,7 @@ if ($bb_cfg['topic_notify_enabled'])
{
$is_watching_topic = 0;
$sql = "DELETE FROM " . BB_TOPICS_WATCH . "
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);
}
DB()->query("DELETE FROM ". BB_TOPICS_WATCH ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']}");
}
set_die_append_msg($forum_id, $topic_id);
@ -288,16 +279,9 @@ if ($bb_cfg['topic_notify_enabled'])
{
$is_watching_topic = TRUE;
if ($row['notify_status'])
if (!$t_data['notify_status'])
{
$sql = "UPDATE " . BB_TOPICS_WATCH . "
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);
}
DB()->query("UPDATE ". BB_TOPICS_WATCH ." SET notify_status = ". TOPIC_WATCH_NOTIFIED ." WHERE topic_id = $topic_id AND user_id = {$userdata['user_id']}");
}
}
}
@ -309,12 +293,10 @@ if ($bb_cfg['topic_notify_enabled'])
{
$is_watching_topic = TRUE;
$sql = "INSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
if (!($result = DB()->sql_query($sql)))
{
message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql);
}
DB()->query("
INSERT INTO ". BB_TOPICS_WATCH ." (user_id, topic_id, notify_status)
VALUES (". $userdata['user_id'] .", $topic_id, ". TOPIC_WATCH_NOTIFIED .")
");
}
set_die_append_msg($forum_id, $topic_id);
@ -438,8 +420,7 @@ if (!$ranks = $datastore->get('ranks'))
//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
$orig_word = $replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
//
@ -684,7 +665,6 @@ if ($topic_has_poll)
$template->assign_vars(array(
'TOPIC_HAS_POLL' => false,
));
bb_log(join("\t", array(date('m-d H:i:s'), $topic_id, "\n")), 'poll_err');
}
else
{
@ -936,10 +916,13 @@ if ($bb_cfg['show_quick_reply'])
'QR_TOPIC_ID' => $topic_id,
'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '',
));
if (!IS_GUEST)
{
$notify_user = bf($userdata['user_opt'], 'user_opt', 'notify');
$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,
));
}
}