diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql
index f33f8e086..5ca7e9403 100644
--- a/install/sql/mysql.sql
+++ b/install/sql/mysql.sql
@@ -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);
-- --------------------------------------------------------
diff --git a/upload/admin/admin_cron.php b/upload/admin/admin_cron.php
index d9b177276..246eb6e3a 100644
--- a/upload/admin/admin_cron.php
+++ b/upload/admin/admin_cron.php
@@ -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'] ? '' : '
',
'CRON_TITLE' => $row['cron_title'],
diff --git a/upload/admin/admin_mass_email.php b/upload/admin/admin_mass_email.php
index 58f6f61ee..c509e0f96 100644
--- a/upload/admin/admin_mass_email.php
+++ b/upload/admin/admin_mass_email.php
@@ -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) ) ? '
' . $lang['EMPTY_SUBJECT'] : $lang['EMPTY_SUBJECT'];
- }
-
- if ( empty($message) )
- {
- $error = true;
- $error_msg .= ( !empty($error_msg) ) ? '
' . $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) ) ? '
' . $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'] . '
' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '', ''));
+ $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 = '';
//
// 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('
', 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');
\ No newline at end of file
+print_page('admin_mass_email.tpl', 'admin');
diff --git a/upload/ajax.php b/upload/ajax.php
index 994edae67..8210c68fc 100644
--- a/upload/ajax.php
+++ b/upload/ajax.php
@@ -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']);
}
}
diff --git a/upload/ajax/posts.php b/upload/ajax/posts.php
index 34a227495..9e11c12a1 100644
--- a/upload/ajax/posts.php
+++ b/upload/ajax/posts.php
@@ -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:
diff --git a/upload/config.php b/upload/config.php
index 156ffd304..f91e97552 100644
--- a/upload/config.php
+++ b/upload/config.php
@@ -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';
diff --git a/upload/groupcp.php b/upload/groupcp.php
index 8a80c87a8..04d30278e 100644
--- a/upload/groupcp.php
+++ b/upload/groupcp.php
@@ -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('
', "\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('
', "\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('
', "\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();
}
diff --git a/upload/includes/cron/jobs/db_backup.php b/upload/includes/cron/jobs/db_backup.php
index 3efbfa8c2..fa8eb4267 100644
--- a/upload/includes/cron/jobs/db_backup.php
+++ b/upload/includes/cron/jobs/db_backup.php
@@ -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']);
diff --git a/upload/includes/cron/jobs/site_backup.php b/upload/includes/cron/jobs/site_backup.php
index 54da83fad..836645619 100644
--- a/upload/includes/cron/jobs/site_backup.php
+++ b/upload/includes/cron/jobs/site_backup.php
@@ -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']);
diff --git a/upload/includes/functions_dev.php b/upload/includes/functions_dev.php
index c2e293cc7..e9299f648 100644
--- a/upload/includes/functions_dev.php
+++ b/upload/includes/functions_dev.php
@@ -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'];
diff --git a/upload/includes/functions_post.php b/upload/includes/functions_post.php
index 4e053f26e..fa5b78eb7 100644
--- a/upload/includes/functions_post.php
+++ b/upload/includes/functions_post.php
@@ -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('
', "\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 = '';
diff --git a/upload/includes/functions_report.php b/upload/includes/functions_report.php
index 1970611cc..8cb7f173d 100644
--- a/upload/includes/functions_report.php
+++ b/upload/includes/functions_report.php
@@ -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('
', "\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;
}
diff --git a/upload/includes/template.php b/upload/includes/template.php
index 66547ade7..65c0f34d3 100644
--- a/upload/includes/template.php
+++ b/upload/includes/template.php
@@ -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;
diff --git a/upload/includes/ucp/usercp_activate.php b/upload/includes/ucp/usercp_activate.php
index c2aaa5138..4f379a982 100644
--- a/upload/includes/ucp/usercp_activate.php
+++ b/upload/includes/ucp/usercp_activate.php
@@ -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('
', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '')
- );
+ ));
$emailer->send();
$emailer->reset();
diff --git a/upload/includes/ucp/usercp_email.php b/upload/includes/ucp/usercp_email.php
index 05ffb6f01..a1f1a7908 100644
--- a/upload/includes/ucp/usercp_email.php
+++ b/upload/includes/ucp/usercp_email.php
@@ -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 . '
' . $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 . '
' . $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'] . '
' . sprintf($lang['CLICK_RETURN_INDEX'], '', '');
- 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&" . POST_USERS_URL . "=$user_id",
+ 'ERROR_MESSAGE' => ($errors) ? join('
', 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']);
}
\ No newline at end of file
diff --git a/upload/includes/ucp/usercp_register.php b/upload/includes/ucp/usercp_register.php
index 85e77d8da..6091af81b 100644
--- a/upload/includes/ucp/usercp_register.php
+++ b/upload/includes/ucp/usercp_register.php
@@ -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('
', "\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('
', "\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('
', "\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('
', "\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'])
{
diff --git a/upload/includes/ucp/usercp_sendpasswd.php b/upload/includes/ucp/usercp_sendpasswd.php
index 3843b8323..180c62056 100644
--- a/upload/includes/ucp/usercp_sendpasswd.php
+++ b/upload/includes/ucp/usercp_sendpasswd.php
@@ -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('
', "\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'] . '
' . sprintf($lang['CLICK_RETURN_INDEX'], '', '');
-
- 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');
\ No newline at end of file
diff --git a/upload/language/lang_english/lang_main.php b/upload/language/lang_english/lang_main.php
index b00acc8c2..cc8572d44 100644
--- a/upload/language/lang_english/lang_main.php
+++ b/upload/language/lang_english/lang_main.php
@@ -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';
diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php
index b472e78e4..925fd6649 100644
--- a/upload/language/lang_russian/lang_main.php
+++ b/upload/language/lang_russian/lang_main.php
@@ -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'] = 'Получатель';
diff --git a/upload/memberlist.php b/upload/memberlist.php
index 20330825b..6d0e51b88 100644
--- a/upload/memberlist.php
+++ b/upload/memberlist.php
@@ -177,7 +177,6 @@ if ($result = DB()->fetch_rowset($sql))
{
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&". POST_USERS_URL ."=$user_id") : 'mailto:'. $row['user_email'];
$email = ''. $row['user_email'] .'';
- //$email = ($bb_cfg['text_buttons']) ? ''. $row['user_email'] .'' : '';
}
else
diff --git a/upload/poll.php b/upload/poll.php
index a5c8ec7af..7179fbc86 100644
--- a/upload/poll.php
+++ b/upload/poll.php
@@ -13,13 +13,7 @@ $vote_id = (int) @$_POST['vote_id'];
$return_topic_url = TOPIC_URL . $topic_id;
$return_topic_url .= !empty($_POST['start']) ? "&start=". intval($_POST['start']) : '';
-$template->assign_var('BB_DIE_APPEND_MSG', '
- Вернуться в тему
-
- Вернуться в раздел
-
- Вернуться на главную страницу
-');
+set_die_append_msg($forum_id, $topic_id);
$poll = new bb_poll();
diff --git a/upload/posting.php b/upload/posting.php
index cdf1bf45a..0b470855a 100644
--- a/upload/posting.php
+++ b/upload/posting.php
@@ -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')
diff --git a/upload/privmsg.php b/upload/privmsg.php
index c83b06a71..e09139d7b 100644
--- a/upload/privmsg.php
+++ b/upload/privmsg.php
@@ -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('
', "\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();
diff --git a/upload/templates/admin/admin_cron.tpl b/upload/templates/admin/admin_cron.tpl
index e1b685770..43b72d87d 100644
--- a/upload/templates/admin/admin_cron.tpl
+++ b/upload/templates/admin/admin_cron.tpl
@@ -83,7 +83,7 @@ tr.hl-tr:hover td { background-color: #CFC !important; }
{L_MASS_EMAIL_EXPLAIN}