function notification($sender_id, $recipient_id, $recipient_email, $email_subject, $email_text, $use_bcc = false, $pm_subject = '', $recipient_username = '', $recipient_lang = '', $emty_email_template = false) { global $db, $config, $user, $lang; require IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $recipient_lang = empty($recipient_lang) ? $config['default_lang'] : $recipient_lang; // 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')) && !$config['smtp_delivery']) { // We are running on windows, force delivery to use our smtp functions since php's are broken by default $config['smtp_delivery'] = 1; $config['smtp_host'] = @ini_get('SMTP'); } $emailer = new emailer(); $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name'])); $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']); $emailer->headers('X-AntiAbuse: User IP - ' . $user->ip); if ($use_bcc) { $emailer->to($config['board_email']); $emailer->bcc($recipient_email); } else { $emailer->to($recipient_email); } $emailer->set_subject($email_subject); if ($emty_email_template) { $emailer->use_template('admin_send_email', $recipient_lang); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'MESSAGE' => $email_text)); } else { $server_url = create_server_url(); $privmsg_url = $server_url . CMS_PAGE_PRIVMSG; $recipient_username = empty($recipient_username) ? $lang['User'] : $recipient_username; $email_sig = create_signature($config['board_email_sig']); $emailer->use_template('privmsg_notify', $recipient_lang); $emailer->assign_vars(array('USERNAME' => $recipient_username, 'SITENAME' => $config['sitename'], 'EMAIL_SIG' => $email_sig, 'FROM' => $user->data['username'], 'DATE' => create_date($config['default_dateformat'], time(), $config['board_timezone']), 'SUBJECT' => $pm_subject, 'PRIV_MSG_TEXT' => $email_text, 'FROM_USERNAME' => $user->data['username'], 'U_INBOX' => $privmsg_url . '?folder=inbox')); } $emailer->send(); $emailer->reset(); return true; }
function main($action) { global $db, $config, $template, $images, $user, $lang; global $pafiledb_config, $debug; $file_id = request_var('file_id', 0); if (empty($file_id)) { message_die(GENERAL_MESSAGE, $lang['File_not_exist']); } $sql = 'SELECT file_catid, file_name FROM ' . PA_FILES_TABLE . "\n\t\t\tWHERE file_id = {$file_id}"; $result = $db->sql_query($sql); if (!($file_data = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, $lang['File_not_exist']); } $db->sql_freeresult($result); if (!$this->auth[$file_data['file_catid']]['auth_email']) { if (!$user->data['session_logged_in']) { redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=email&file_id=' . $file_id, true)); } $message = sprintf($lang['Sorry_auth_email'], $this->auth[$file_data['file_catid']]['auth_email_type']); message_die(GENERAL_MESSAGE, $message); } if (isset($_POST['submit'])) { // session id check $sid = request_post_var('sid', ''); if (empty($sid) || $sid != $user->data['session_id']) { message_die(GENERAL_ERROR, 'INVALID_SESSION'); } $error = false; $femail = request_var('femail', ''); if (!empty($femail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) { $user_email = $femail; } else { $error = true; $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid']; } $username = request_var('fname', '', true); $sender_name = request_var('sname', '', true); //if (!$user->data['session_logged_in'] || ($user->data['session_logged_in'] && ($sender_name != $user->data['username']))) if (!$user->data['session_logged_in']) { // Mighty Gorgon: is this really needed? /* include(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT); $result = validate_username($sender_name); if ($result['error']) { $error = true; $error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg']; } */ } else { $sender_name = $user->data['username']; } if (!$user->data['session_logged_in']) { $semail = request_var('semail', ''); if (!empty($semail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) { $sender_email = $semail; } else { $error = true; $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid']; } } else { $sender_email = $user->data['user_email']; } $subject = request_var('subject', '', true); $subject = htmlspecialchars_decode($subject, ENT_COMPAT); if (empty($subject)) { $error = true; $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email']; } $message = request_var('message', '', true); // We need to check if HTML emails are enabled so we can correctly escape content and linebreaks $message = !empty($config['html_email']) ? nl2br($message) : htmlspecialchars_decode($message, ENT_COMPAT); if (empty($message)) { $error = true; $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email']; } if (!$error) { include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name'])); $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']); $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip); $emailer->use_template('profile_send_email', $user_lang); $emailer->to($user_email); $emailer->from($sender_email); $emailer->replyto($sender_email); $emailer->set_subject($subject); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'FROM_USERNAME' => $sender_name, 'TO_USERNAME' => $username, 'MESSAGE' => $message)); $emailer->send(); $emailer->reset(); $message = $lang['Econf'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(CMS_PAGE_HOME) . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } if ($error) { message_die(GENERAL_MESSAGE, $error_msg); } } $this->generate_category_nav($file_data['file_catid']); $template->assign_vars(array('USER_LOGGED' => !$user->data['session_logged_in'] ? true : false, 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'S_EMAIL_ACTION' => append_sid('dload.' . PHP_EXT), 'S_HIDDEN_FIELDS' => '<input type="hidden" name="sid" value="' . $user->data['session_id'] . '" />', 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_EMAIL' => $lang['Semail'], 'L_EMAIL' => $lang['Emailfile'], 'L_EMAILINFO' => $lang['Emailinfo'], 'L_YNAME' => $lang['Yname'], 'L_YEMAIL' => $lang['Yemail'], 'L_FNAME' => $lang['Fname'], 'L_FEMAIL' => $lang['Femail'], 'L_ETEXT' => $lang['Etext'], 'L_DEFAULTMAIL' => $lang['Defaultmail'], 'L_SEMAIL' => $lang['Semail'], 'L_ESUB' => $lang['Esub'], 'L_EMPTY_SUBJECT_EMAIL' => $lang['Empty_subject_email'], 'L_EMPTY_MESSAGE_EMAIL' => $lang['Empty_message_email'], 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD_HOME' => append_sid('dload.' . PHP_EXT), 'U_FILE_NAME' => append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_id), 'FILE_NAME' => $file_data['file_name'], 'SNAME' => $user->data['username'], 'SEMAIL' => $user->data['user_email'], 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'FILE_URL' => create_server_url() . 'dload.' . PHP_EXT . '?action=file&file_id=' . $file_id, 'ID' => $file_id)); $this->display($lang['Download'], 'pa_email_body.tpl'); }
$stylesheet = 'templates/' . $row2['style_name'] . '/' . $row2['head_stylesheet']; $db->sql_freeresult($result2); } if ($stylesheet <> '') { $link_tag = '<link rel="stylesheet" type="text/css" href="' . DIGEST_SITE_URL . $stylesheet . '" />'; } $link_tag_unset = false; } */ } $encoding_charset = !empty($lang['ENCODING']) ? $lang['ENCODING'] : 'UTF-8'; $config['html_email'] = $html; $emailer->from = $lang['digest_from_text_name'] . ' <' . $lang['digest_from_email_address'] . '>'; $emailer->to($to); $emailer->set_subject($lang['digest_subject_line']); $emailer->assign_vars(array( 'BOARD_URL' => DIGEST_SITE_URL, 'LINK' => $link_tag, 'L_SITENAME' => $config['sitename'], 'L_SALUTATION' => $lang['digest_salutation'], 'SALUTATION' => $row['username'], 'L_DIGEST_OPTIONS' => $lang['digest_your_digest_options'], 'L_INTRODUCTION' => $lang['digest_introduction'], 'L_FORMAT' => $lang['digest_format_short'], 'FORMAT' => $row['format'], 'L_MESSAGE_TEXT' => $lang['digest_show_message_text'], 'MESSAGE_TEXT' => $row['show_text'], 'L_MY_MESSAGES' => $lang['digest_show_my_messages'],
} if ($row['user_level'] != ADMIN && $row['user_level'] != MOD && $group_info['auth_mod']) { $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\t\tSET user_level = " . MOD . "\n\t\t\t\t\t\t\tWHERE user_id = " . $row['user_id']; $db->sql_query($sql); } $db->clear_cache(); // Get the group name $group_sql = "SELECT group_name\n\t\t\t\t\t\tFROM " . GROUPS_TABLE . "\n\t\t\t\t\t\tWHERE group_id = {$group_id}"; $result = $db->sql_query($group_sql); $group_name_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $group_name = $group_name_row['group_name']; include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $emailer->use_template('group_added', $row['user_lang']); $emailer->to($row['user_email']); $emailer->set_subject($lang['Group_added']); $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'GROUP_NAME' => $group_name, 'EMAIL_SIG' => $email_sig, 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . '=' . $group_id)); $emailer->send(); $emailer->reset(); } else { $redirect_url = append_sid(CMS_PAGE_GROUP_CP . '?' . POST_GROUPS_URL . '=' . $group_id); meta_refresh(3, $redirect_url); $message = $lang['User_is_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid(CMS_PAGE_GROUP_CP . '?' . POST_GROUPS_URL . '=' . $group_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(CMS_PAGE_FORUM) . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } } else { if ((isset($_POST['approve']) || isset($_POST['deny'])) && isset($_POST['pending_members']) || isset($_POST['remove']) && isset($_POST['members']) || isset($_POST['mass_colorize']) && isset($_POST['members'])) { $members = isset($_POST['approve']) || isset($_POST['deny']) ? $_POST['pending_members'] : $_POST['members']; $sql_in = '';
if ($no_error) { $sql = 'SELECT username, user_warnings, user_email, user_lang FROM ' . USERS_TABLE . ' WHERE user_id = "' . $poster_id . '"'; $result = $db->sql_query($sql); $warning_data = $db->sql_fetchrow($result); if (!empty($warning_data['user_email'])) { $server_url = create_server_url(); $viewtopic_server_url = $server_url . CMS_PAGE_VIEWTOPIC; $from_email = $user->data['user_email'] && $user->data['user_allow_viewemail'] ? $user->data['user_email'] : $config['board_email']; include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name'])); $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']); $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip); $emailer->use_template($e_temp, $warning_data['user_lang']); $emailer->to($warning_data['user_email']); $emailer->from($from_email); $emailer->replyto($from_email); //$emailer->set_subject($e_subj); $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'WARNINGS' => $warning_data['user_warnings'], 'TOTAL_WARN' => $config['max_user_bancard'], 'POST_URL' => $viewtopic_server_url . '?' . $forum_id_append . $topic_id_append . POST_POST_URL . '=' . $post_id . '#p' . $post_id, 'EMAIL_SIG' => $email_sig, 'WARNER' => $user->data['username'], 'BLOCK_TIME' => $block_time, 'WARNED_POSTER' => $warning_data['username'])); $emailer->send(); $emailer->reset(); } else { $message .= '<br /><br />' . $lang['user_no_email']; } } elseif ($already_banned) { $message = $lang['user_already_banned']; } else { $message = 'Error in card.' . PHP_EXT; }
} else { $message = $lang['Account_added']; $email_template = 'user_welcome'; } $sql = "SELECT ug.user_id, g.group_id as g_id, g.group_name , u.user_posts, g.group_count FROM (" . GROUPS_TABLE . " g, " . USERS_TABLE . " u)\n\t\t\t\t\tLEFT JOIN " . USER_GROUP_TABLE . " ug ON g.group_id = ug.group_id AND ug.user_id = '" . $user_id . "'\n\t\t\t\t\tWHERE u.user_id = {$user_id}\n\t\t\t\t\t\t AND ug.user_id is NULL\n\t\t\t\t\t\t AND g.group_count = 0\n\t\t\t\t\t\t AND g.group_single_user = 0\n\t\t\t\t\t\t AND g.group_moderator <> {$user_id}"; $result = $db->sql_query($sql); clear_user_color_cache($user_id); while ($group_data = $db->sql_fetchrow($result)) { //user join a autogroup $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)\n\t\t\t\t\tVALUES (" . $group_data['g_id'] . ", {$user_id}, 0)"; $db->sql_query($sql); } include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $emailer->use_template($email_template, stripslashes($user_lang)); $emailer->to($email); $emailer->set_subject(sprintf($lang['Welcome_subject'], $config['sitename'])); if ($coppa) { $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => $email_sig, 'FAX_INFO' => $config['coppa_fax'], 'MAIL_INFO' => $config['coppa_mail'], 'EMAIL_ADDRESS' => $email, 'ICQ' => $icq, 'AIM' => $aim, 'YIM' => $yim, 'SKYPE' => $skype, 'MSN' => $msn, 'WEB_SITE' => $website, 'FROM' => $location, 'OCC' => $occupation, 'INTERESTS' => $interests, 'SITENAME' => $config['sitename'])); } else { $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $config['sitename']), 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => $email_sig, 'U_ACTIVATE' => $profile_server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)); } $emailer->send(); $emailer->reset(); if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { $sql = "SELECT user_email, user_lang\n\t\t\t\t\tFROM " . USERS_TABLE . "\n\t\t\t\t\tWHERE user_level = " . ADMIN; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $emailer->from($config['board_email']);
$sql_full = "SELECT user_id , username, user_email, user_lang\n\t\t\t\t\t\t\t" . $sql . "\n\t\t\t\t\t\t\tORDER BY username\n\t\t\t\t\t\t\tLIMIT 0, " . $users_number; } else { $sql_full = "SELECT user_id , username, user_email, user_lang\n\t\t\t\t\t\t\t" . $sql . "\n\t\t\t\t\t\t\tORDER BY username\n\t\t\t\t\t\t\tLIMIT 800"; } $result = $db->sql_query($sql_full); $users_list = $db->sql_fetchrowset($result); $i = 0; $name_list = ''; $server_url = create_server_url(); $profile_server_url = $server_url . CMS_PAGE_PROFILE . '?mode=register'; while (isset($users_list[$i]['user_id'])) { $user_id = $users_list[$i]['user_id']; $username = str_replace("'", "\\'", $users_list[$i]['username']); $user_email = $users_list[$i]['user_email']; $user_lang = $users_list[$i]['user_lang']; $killed = ip_user_kill($user_id); if (NOTIFY_USERS && !empty($user_email)) { $emailer = new emailer(); $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name'])); $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']); $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip); $emailer->use_template('delete_users', file_exists(IP_ROOT_PATH . 'language/lang_' . $user_lang . '/email/delete_users.tpl') ? $user_lang : 'english'); $emailer->to($user_email); $emailer->assign_vars(array('U_REGISTER' => $profile_server_url, 'USER' => $user->data['username'], 'USERNAME' => $username, 'SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'])); $emailer->send(); $emailer->reset(); } $name_list .= (!empty($name_list) ? ', ' : '<br />') . $username; $i++; }
} if (empty($row['user_actkey'])) { // No activation key message_die(GENERAL_ERROR, 'No_actkey'); } $current_time = time(); if (intval($row['user_last_login_attempt']) > 0 && $current_time - intval($row['user_last_login_attempt']) < $config['login_reset_time']) { // Request flood message_die(GENERAL_ERROR, 'Send_actmail_flood_error'); } // Start the email process $unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#'); $unhtml_specialchars_replace = array('>', '<', '"', '&'); include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $emailer->to(trim($row['user_email'])); $emailer->use_template('user_welcome_inactive', $row['user_lang']); $emailer->set_subject($lang['Resend_activation_email']); $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr($username, 0, 25)), 'PASSWORD' => '', 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $config['sitename']), 'EMAIL_SIG' => $email_sig, 'U_ACTIVATE' => $profile_server_url . '?mode=activate&' . POST_USERS_URL . '=' . $row['user_id'] . '&act_key=' . $row['user_actkey'])); $emailer->send(); $emailer->reset(); // Update last activation sent time $sql = "UPDATE " . USERS_TABLE . "\n\t\tSET user_last_login_attempt = {$current_time}\n\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $result = $db->sql_query($sql); message_die(GENERAL_MESSAGE, 'Resend_activation_email_done'); } else { $link_name = $lang['Resend_activation_email']; $nav_server_url = create_server_url(); $breadcrumbs['address'] = $lang['Nav_Separator'] . '<a href="' . $nav_server_url . append_sid(CMS_PAGE_PROFILE_MAIN) . '"' . (!empty($link_name) ? '' : ' class="nav-current"') . '>' . $lang['Profile'] . '</a>' . (!empty($link_name) ? $lang['Nav_Separator'] . '<a class="nav-current" href="#">' . $link_name . '</a>' : ''); $template->assign_vars(array('L_SEND_PASSWORD' => $lang['Resend_activation_email'], 'L_ITEMS_REQUIRED' => $lang['Items_required'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'S_PROFILE_ACTION' => append_sid(CMS_PAGE_PROFILE . '?mode=resend'), 'S_HIDDEN_FIELDS' => ''));
} } } // TICKETS - END if (!$error) { update_flood_time_email(); include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name'])); $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']); $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip); $email_subject = $subject; $email_message = $message; $emailer->use_template('empty_email', $user_lang); $emailer->to($config['board_email']); $emailer->from($sender); foreach ($bcc_emails as $bcc_address) { if (!empty($bcc_address)) { $emailer->bcc($bcc_address); } } // Send also to sender in BCC if needed... if (!empty($_POST['cc_email'])) { $emailer->bcc($sender); } $emailer->replyto($sender); $emailer->set_subject($email_subject); $emailer->assign_vars(array('MESSAGE' => $email_message)); $emailer->send(); $emailer->reset();
{ // Add to the users new pm counter $sql = "UPDATE " . USERS_TABLE . " SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " WHERE user_id = " . $to_userdata['user_id']; $status = $db->sql_query($sql); if ($to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active']) { $server_url = create_server_url(); $privmsg_url = $server_url . CMS_PAGE_PRIVMSG; include(IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT); $emailer = new emailer(); $emailer->use_template('privmsg_notify', $to_userdata['user_lang']); $emailer->to($to_userdata['user_email']); $emailer->set_subject($lang['Notification_subject']); if (!empty($config['html_email'])) { //HTML Message $bbcode->allow_html = ($html_on ? true : false); $bbcode->allow_bbcode = ($bbcode_on ? true : false); $bbcode->allow_smilies = ($smilies_on ? true : false); $message = $bbcode->parse($privmsg_message); $message = $message; //HTML Message } else { $message = $bbcode->bbcode_killer($privmsg_message, '');
$error = true; $error_msg = $lang['TELL_FRIEND_WRONG_EMAIL']; } if (!$error) { include(IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT); $emailer = new emailer(); $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name'])); $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']); $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip); $emailer->use_template('tellafriend_email', $user_lang); $emailer->to($friendemail, $friendname); $emailer->from($user->data['user_email']); $emailer->replyto($user->data['user_email']); $emailer->set_subject($topic_title); $emailer->assign_vars(array( 'SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'FROM_USERNAME' => $user->data['username'], 'TO_USERNAME' => $friendname, 'MESSAGE' => $message ) ); $emailer->send(); $emailer->reset();
$email_id .= ($email_id != '' ? ', ' : '') . intval($mark_list[$i]); } $sql_mail = "SELECT username, user_email, user_lang, user_active FROM " . USERS_TABLE . " WHERE user_id IN ({$email_id})"; $result_mail = $db->sql_query($sql_mail); while ($mail = $db->sql_fetchrow($result_mail)) { if ($delete) { $subject = $lang['Account_deleted']; $text = $lang['Account_deleted_text']; } elseif ($activate) { $subject = $mail['user_active'] == '0' ? $lang['Account_activated'] : $lang['Account_deactivated']; $text = $mail['user_active'] == '0' ? $lang['Account_activated_text'] : $lang['Account_deactivated_text']; } include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); $emailer->use_template('admin_account_action', stripslashes($mail['user_lang'])); $emailer->to($mail['user_email']); $emailer->set_subject($subject); $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SUBJECT' => $subject, 'TEXT' => sprintf($text, $config['sitename']), 'USERNAME' => $mail['username'], 'EMAIL_SIG' => $email_sig)); $emailer->send(); $emailer->reset(); } $db->sql_freeresult($result_mail); } } if ($delete && $mark_list) { if (isset($mark_list) && !is_array($mark_list)) { $mark_list = array(); } if (!$confirm) { $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
} // Mighty Gorgon - Send email to admin for notification/approval - BEGIN if ($album_config['email_notification']) { $sql = "SELECT pic_id FROM " . ALBUM_TABLE . "\n\t\t\t\t\t\t\tWHERE pic_filename = '" . $pic_extra_path . $pic_filename . "'\n\t\t\t\t\t\t\tAND pic_time = '" . $pic_time . "'\n\t\t\t\t\t\t\tLIMIT 1"; $result = $db->sql_query($sql); $new_pic_id = $db->sql_fetchrow($result); $db->sql_freeresult($result); include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $server_url = create_server_url(); $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active, username, user_level\n\t\t\t\tFROM " . USERS_TABLE . " AS u\n\t\t\t\tWHERE u.user_level = " . ADMIN . "\n\t\t\t\tAND u.user_id <> " . ANONYMOUS . "\n\t\t\t\tORDER BY u.username ASC"; $result = $db->sql_query($sql); while ($to_users = $db->sql_fetchrow($result)) { if ($to_users['user_notify_pm'] && !empty($to_users['user_email']) && $to_users['user_active']) { $emailer = new emailer(); $emailer->use_template('album_notify', $to_users['user_lang']); $emailer->to($to_users['user_email']); $emailer->set_subject(); //$lang['Notification_subject'] $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('USERNAME' => $to_users['username'], 'SITENAME' => $config['sitename'], 'EMAIL_SIG' => $email_sig, 'FROM' => $user->data['username'], 'PIC_TITLE' => $pic_title, 'PIC_ID' => $new_pic_id['pic_id'], 'PIC_APPROVAL' => $pic_approval ? $lang['Approvation_OK'] : $lang['Approvation_NO'], 'DATE' => create_date($config['default_dateformat'], time(), $config['board_timezone']), 'SUBJECT' => $lang['Email_Notification'], 'U_PIC' => $server_url . 'album_showpage.' . PHP_EXT . '?pic_id=' . $new_pic_id['pic_id'])); $emailer->send(); $emailer->reset(); } } $db->sql_freeresult($result); } // Mighty Gorgon - Send email to admin for notification/approval - END // Watch pic for comments - BEGIN if (isset($_POST['comment_watch'])) { if ($_POST['comment_watch'] == 0) { //Get the pic id for this pic
/** * Sends a birthday Email */ function birthday_email_send() { global $db, $cache, $config, $lang; if (!class_exists('emailer')) { @(include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT); } $server_url = create_server_url(); $birthdays_list = get_birthdays_list_email(); foreach ($birthdays_list as $k => $v) { // Birthday - BEGIN // Check if the user has or have had birthday, also see if greetings are enabled if (!empty($config['birthday_greeting'])) { // Birthday Email - BEGIN setup_extra_lang(array('lang_cron_vars'), '', $v['user_lang']); $year = create_date('Y', time(), $v['user_timezone']); $date_today = create_date('Ymd', time(), $v['user_timezone']); $user_birthday = realdate('md', $v['user_birthday']); $user_birthday2 = ($year . $user_birthday < $date_today ? $year + 1 : $year) . $user_birthday; $user_age = create_date('Y', time(), $v['user_timezone']) - realdate('Y', $v['user_birthday']); if (create_date('md', time(), $v['user_timezone']) < realdate('md', $v['user_birthday'])) { $user_age--; } $email_subject = sprintf($lang['BIRTHDAY_GREETING_EMAIL_SUBJECT'], $config['sitename']); //$email_text = sprintf($lang['BIRTHDAY_GREETING_EMAIL_CONTENT_AGE'], $user_age); $email_text = sprintf($lang['BIRTHDAY_GREETING_EMAIL_CONTENT'], $config['sitename']); // Send the email! $emailer = new emailer(); $emailer->use_template('birthday_greeting', $v['user_lang']); $emailer->to($v['user_email']); // 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($email_subject); $v['username'] = !empty($v['user_first_name']) ? $v['user_first_name'] : $v['username']; // This is a nasty kludge to remove the username var ... till (if?) translators update their templates $emailer->msg = preg_replace('#[ ]?{USERNAME}#', $v['username'], $emailer->msg); $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('USERNAME' => !empty($config['html_email']) ? htmlspecialchars($v['username']) : $v['username'], 'USER_AGE' => $user_age, 'EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'SITE_URL' => $server_url)); $emailer->send(); $emailer->reset(); // Birthday Email - END $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\tSET user_next_birthday_greeting = " . (create_date('Y', time(), $v['user_timezone']) + 1) . "\n\t\t\t\tWHERE user_id = " . $v['user_id']; $status = $db->sql_query($sql); } // Birthday - END } // We reset the lang again for default lang... setup_extra_lang(array('lang_cron_vars')); }