本文整理汇总了PHP中pun_linebreaks函数的典型用法代码示例。如果您正苦于以下问题:PHP pun_linebreaks函数的具体用法?PHP pun_linebreaks怎么用?PHP pun_linebreaks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pun_linebreaks函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pun_mail
function pun_mail($to, $subject, $message, $from = '')
{
global $pun_config, $lang_common;
$sender = str_replace('"', '', $pun_config['o_board_title'] . ' ' . $lang_common['Mailer']);
// Default sender/return address
if (!$from) {
$from = '"=?UTF-8?B?' . base64_encode($sender) . '?=" <' . $pun_config['o_webmaster_email'] . '>';
}
// Do a little spring cleaning
$to = trim(preg_replace('#[\\n\\r]+#s', '', $to));
$subject = trim(preg_replace('#[\\n\\r]+#s', '', $subject));
$from = trim(preg_replace('#[\\n\\r:]+#s', '', $from));
$subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
$headers = 'From: ' . $from . "\r\n" . 'Date: ' . date('r') . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-transfer-encoding: 8bit' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n" . 'X-Mailer: PunBB Mailer';
// Make sure all linebreaks are CRLF in message (and strip out any NULL bytes)
$message = str_replace(array("\n", ""), array("\r\n", ''), pun_linebreaks($message));
if ($pun_config['o_smtp_host']) {
return smtp_mail($to, $subject, $message, $headers);
} else {
// Change the linebreaks used in the headers according to OS
if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') {
$headers = str_replace("\r\n", "\r", $headers);
} else {
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
$headers = str_replace("\r\n", "\n", $headers);
}
}
return mail($to, $subject, $message, $headers);
}
}
示例2: pun_mail
function pun_mail($to, $subject, $message, $from = '')
{
global $pun_config, $lang_common;
// Default sender/return address
if (!$from) {
$from = '"' . str_replace('"', '', $pun_config['o_board_title'] . ' ' . $lang_common['Mailer']) . '" <' . $pun_config['o_webmaster_email'] . '>';
}
// Do a little spring cleaning
$to = trim(preg_replace('#[\\n\\r]+#s', '', $to));
$subject = trim(preg_replace('#[\\n\\r]+#s', '', $subject));
$from = trim(preg_replace('#[\\n\\r:]+#s', '', $from));
// Detect what linebreak we should use for the headers
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
$eol = "\r\n";
} else {
if (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) {
$eol = "\r";
} else {
$eol = "\n";
}
}
$headers = 'From: ' . $from . $eol . 'Date: ' . date('r') . $eol . 'MIME-Version: 1.0' . $eol . 'Content-transfer-encoding: 8bit' . $eol . 'Content-type: text/plain; charset=' . $lang_common['lang_encoding'] . $eol . 'X-Mailer: PunBB Mailer';
// Make sure all linebreaks are CRLF in message
$message = str_replace("\n", "\r\n", pun_linebreaks($message));
if ($pun_config['o_smtp_host'] != '') {
smtp_mail($to, $subject, $message, $headers);
} else {
mail($to, $subject, $message, $headers);
}
}
示例3: pun_mail
function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '')
{
global $pun_config, $lang_common;
// Default sender/return address
$from_name = str_replace('"', '', $pun_config['o_board_title'] . ' ' . $lang_common['Mailer']);
$from_email = $pun_config['o_webmaster_email'];
// Do a little spring cleaning
$to = pun_trim(preg_replace('#[\\n\\r]+#s', '', $to));
$subject = pun_trim(preg_replace('#[\\n\\r]+#s', '', $subject));
$from_email = pun_trim(preg_replace('#[\\n\\r:]+#s', '', $from_email));
$from_name = pun_trim(preg_replace('#[\\n\\r:]+#s', '', str_replace('"', '', $from_name)));
$reply_to_email = pun_trim(preg_replace('#[\\n\\r:]+#s', '', $reply_to_email));
$reply_to_name = pun_trim(preg_replace('#[\\n\\r:]+#s', '', str_replace('"', '', $reply_to_name)));
// Set up some headers to take advantage of UTF-8
$from = "=?UTF-8?B?" . base64_encode($from_name) . "?=" . ' <' . $from_email . '>';
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
$headers = 'From: ' . $from . "\r\n" . 'Date: ' . gmdate('r') . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-transfer-encoding: 8bit' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n" . 'X-Mailer: FluxBB Mailer';
// If we specified a reply-to email, we deal with it here
if (!empty($reply_to_email)) {
$reply_to = "=?UTF-8?B?" . base64_encode($reply_to_name) . "?=" . ' <' . $reply_to_email . '>';
$headers .= "\r\n" . 'Reply-To: ' . $reply_to;
}
// Make sure all linebreaks are CRLF in message (and strip out any NULL bytes)
$message = str_replace(array("\n", ""), array("\r\n", ''), pun_linebreaks($message));
if ($pun_config['o_smtp_host'] != '') {
smtp_mail($to, $subject, $message, $headers);
} else {
// Change the linebreaks used in the headers according to OS
if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') {
$headers = str_replace("\r\n", "\r", $headers);
} else {
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
$headers = str_replace("\r\n", "\n", $headers);
}
}
mail($to, $subject, $message, $headers);
}
}
示例4: pun_mail
function pun_mail($to, $subject, $message, $from = '')
{
global $pun_config, $lang_common;
// Default sender/return address
if (!$from) {
$from = '"' . str_replace('"', '', $pun_config['o_board_title'] . ' ' . $lang_common['Mailer']) . '" <' . $pun_config['o_webmaster_email'] . '>';
}
// Do a little spring cleaning
$to = trim(preg_replace('#[\\n\\r]+#s', '', $to));
$subject = trim(preg_replace('#[\\n\\r]+#s', '', $subject));
$from = trim(preg_replace('#[\\n\\r:]+#s', '', $from));
$headers = 'From: ' . $from . "\r\n" . 'Date: ' . date('r') . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-transfer-encoding: ' . $lang_common['mail_transfer_encoding'] . "\r\n" . 'Content-type: text/plain; charset=' . $lang_common['mail_encoding'] . "\r\n" . 'X-Mailer: PunBB Mailer';
// 'mail_encoding' => 'UTF-8',
// 'mail_transfer_encoding' => '7bit',
// Make sure all linebreaks are CRLF in message (and strip out any NULL bytes)
$message = str_replace(array("\n", ""), array("\r\n", ''), pun_linebreaks($message));
//$message = str_replace("\n", "\r\n", pun_linebreaks($message)); // old
if ($pun_config['o_smtp_host'] != '') {
smtp_mail($to, $subject, $message, $headers);
} else {
// Change the linebreaks used in the headers according to OS
if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') {
$headers = str_replace("\r\n", "\r", $headers);
} else {
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
$headers = str_replace("\r\n", "\n", $headers);
}
}
//adding 5th parmeter to email function for correct returnpath
if (ini_get('safe_mode')) {
// Do it the safe mode way
mail($to, $subject, $message, $headers);
} else {
// Do it the regular way
mail($to, $subject, $message, $headers, "-r" . $pun_config['o_webmaster_email']);
}
}
}
示例5: seconds_st
$_POST['merge'] = 1;
} else {
$_POST['merge'] = 0;
}
if (!$pun_user['is_guest'] && !$fid && (($is_admmod && $_POST['merge']) == 1 || !$is_admmod) && $cur_posting['poster_id'] && $cur_posting['message'] && $_SERVER['REQUEST_TIME'] - $cur_posting['posted'] < $pun_config['o_timeout_merge']) {
// Preparing separator
$merged_after = $_SERVER['REQUEST_TIME'] - $cur_posting['posted'];
$merged_sec = $merged_after % 60;
$merged_min = $merged_after / 60 % 60;
$merged_hours = $merged_after / 3600 % 24;
$merged_days = $merged_after / 86400 % 31;
$s_st = $merged_sec ? seconds_st($merged_sec) : '';
$m_st = $merged_min ? minutes_st($merged_min) : '';
$h_st = $merged_hours ? hours_st($merged_hours) : '';
$d_st = $merged_days ? days_st($merged_days) : '';
$message = pun_linebreaks(pun_trim('[color=#bbb][i]' . $lang_post['Added'] . $d_st . ' ' . $h_st . ' ' . $m_st . ' ' . $s_st . ': [/i][/color]')) . "\n" . $message;
$merged = true;
}
// MERGE POSTS END
// If it's a reply
if ($tid) {
if (!$pun_user['is_guest']) {
// Insert the new post
if ($merged) {
$message = $cur_posting['message'] . "\n" . $message;
$db->query('UPDATE ' . $db->prefix . 'posts SET message=\'' . $db->escape($message) . '\' WHERE id=' . $cur_posting['post_id']) or error('Unable to merge post', __FILE__, __LINE__, $db->error());
$new_pid = $cur_posting['post_id'];
} else {
// Insert the new post
$db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', ' . $pun_user['id'] . ', \'' . get_remote_address() . '\', \'' . $db->escape($message) . '\', \'' . $hide_smilies . '\', ' . $_SERVER['REQUEST_TIME'] . ', ' . $tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();
示例6: array
}
}
}
break;
case 'messaging':
$form = array('jabber' => pun_trim($_POST['form']['jabber']), 'icq' => pun_trim($_POST['form']['icq']), 'msn' => pun_trim($_POST['form']['msn']), 'aim' => pun_trim($_POST['form']['aim']), 'yahoo' => pun_trim($_POST['form']['yahoo']));
// If the ICQ UIN contains anything other than digits it's invalid
if (preg_match('/[^0-9]/', $form['icq'])) {
message($lang_prof_reg['Bad ICQ']);
}
break;
case 'personality':
$form = array();
// Clean up signature from POST
if ($pun_config['o_signatures'] == '1') {
$form['signature'] = pun_linebreaks(pun_trim($_POST['signature']));
// Validate signature
if (pun_strlen($form['signature']) > $pun_config['p_sig_length']) {
message(sprintf($lang_prof_reg['Sig too long'], $pun_config['p_sig_length'], pun_strlen($form['signature']) - $pun_config['p_sig_length']));
} else {
if (substr_count($form['signature'], "\n") > $pun_config['p_sig_lines'] - 1) {
message(sprintf($lang_prof_reg['Sig too many lines'], $pun_config['p_sig_lines']));
} else {
if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && is_all_uppercase($form['signature']) && !$pun_user['is_admmod']) {
$form['signature'] = utf8_ucwords(utf8_strtolower($form['signature']));
}
}
}
// Validate BBCode syntax
if ($pun_config['p_sig_bbcode'] == '1') {
require PUN_ROOT . 'include/parser.php';
示例7: pun_trim
}
// Check subject
$subject = pun_trim($_POST['req_subject']);
if (!$subject) {
wap_message($lang_post['No subject']);
} else {
if (mb_strlen($subject) > 70) {
wap_message($lang_post['Too long subject']);
} else {
if (!$pun_config['p_subject_all_caps'] && mb_strtoupper($subject) == $subject && $pun_user['g_id'] > PUN_GUEST) {
$subject = ucwords(mb_strtolower($subject));
}
}
}
// Clean up message from POST
$message = pun_linebreaks(pun_trim($_POST['req_message']));
// Check message
if (!$message) {
wap_message($lang_post['No message']);
} else {
if (mb_strlen($message) > 65535) {
wap_message($lang_post['Too long message']);
} else {
if (!$pun_config['p_message_all_caps'] && mb_strtoupper($message) == $message && $pun_user['g_id'] > PUN_GUEST) {
$message = ucwords(strtolower($message));
}
}
}
// Validate BBCode syntax
if ($pun_config['p_message_bbcode'] == 1 && strpos($message, '[') !== false && strpos($message, ']') !== false) {
include_once PUN_ROOT . 'include/parser.php';
示例8: message
</div>
</div>
<?php
require PUN_ROOT . 'footer.php';
} else {
if (isset($_GET['report'])) {
if ($pun_user['is_guest']) {
message($lang_common['No permission']);
}
$post_id = intval($_GET['report']);
if ($post_id < 1) {
message($lang_common['Bad request']);
}
if (isset($_POST['form_sent'])) {
// Clean up reason from POST
$reason = pun_linebreaks(pun_trim($_POST['req_reason']));
if ($reason == '') {
message($lang_misc['No reason']);
}
// Get the topic ID
$result = $db->query('SELECT topic_id FROM ' . $db->prefix . 'posts WHERE id=' . $post_id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result)) {
message($lang_common['Bad request']);
}
$topic_id = $db->result($result);
// Get the subject and forum ID
$result = $db->query('SELECT subject, forum_id FROM ' . $db->prefix . 'topics WHERE id=' . $topic_id) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result)) {
message($lang_common['Bad request']);
}
list($subject, $forum_id) = $db->fetch_row($result);
示例9: pun_linebreaks
}
}
if ($form['announcement_message'] != '') {
$form['announcement_message'] = pun_linebreaks($form['announcement_message']);
} else {
$form['announcement_message'] = $lang->t('Enter announcement here');
$form['announcement'] = '0';
}
if ($form['rules_message'] != '') {
$form['rules_message'] = pun_linebreaks($form['rules_message']);
} else {
$form['rules_message'] = $lang->t('Enter rules here');
$form['rules'] = '0';
}
if ($form['maintenance_message'] != '') {
$form['maintenance_message'] = pun_linebreaks($form['maintenance_message']);
} else {
$form['maintenance_message'] = $lang->t('Default maintenance message');
$form['maintenance'] = '0';
}
// Make sure the number of displayed topics and posts is between 3 and 75
if ($form['disp_topics_default'] < 3) {
$form['disp_topics_default'] = 3;
} else {
if ($form['disp_topics_default'] > 75) {
$form['disp_topics_default'] = 75;
}
}
if ($form['disp_posts_default'] < 3) {
$form['disp_posts_default'] = 3;
} else {
示例10: ucwords
$form['signature'] = ucwords(strtolower($form['signature']));
}
}
}
// Validate BBCode syntax
if ($pun_config['p_sig_bbcode'] == '1' && strpos($form['signature'], '[') !== false && strpos($form['signature'], ']') !== false) {
require PUN_ROOT . 'include/parser.php';
$form['signature'] = preparse_bbcode($form['signature'], $foo, true);
}
if (!isset($form['use_avatar']) || $form['use_avatar'] != '1') {
$form['use_avatar'] = '0';
}
break;
case 'display':
$form = extract_elements(array('disp_topics', 'disp_posts', 'show_smilies', 'show_img', 'show_img_sig', 'show_avatars', 'show_sig', 'style'));
$form['reputation_enable'] = pun_linebreaks(trim($_POST['reputation_enable']));
if (!isset($form['reputation_enable']) || $form['reputation_enable'] != '1') {
$form['reputation_enable'] = '0';
}
if ($form['disp_topics'] != '' && intval($form['disp_topics']) < 3) {
$form['disp_topics'] = 3;
}
if ($form['disp_topics'] != '' && intval($form['disp_topics']) > 75) {
$form['disp_topics'] = 75;
}
if ($form['disp_posts'] != '' && intval($form['disp_posts']) < 3) {
$form['disp_posts'] = 3;
}
if ($form['disp_posts'] != '' && intval($form['disp_posts']) > 75) {
$form['disp_posts'] = 75;
}
示例11: setMessage
/**
* setMessage
*
* @param array $args
* @return array
* @throws Exception
*/
public function setMessage($args)
{
$message = $args['message'];
$topicId = $args['topicId'];
$hideSmiles = $args['hideSmiles'];
$topicId = intval($topicId);
if ($topicId <= 0) {
throw new Exception($this->_lang['Bad request']);
}
if ($this->_pun_user['is_guest']) {
throw new Exception($this->_lang['Bad request']);
}
if ($this->_pun_user['last_post'] && $_SERVER['REQUEST_TIME'] - $this->_pun_user['last_post'] < $this->_pun_user['g_post_flood']) {
throw new Exception($this->_lang['Bad request']);
}
// Clean up message
$message = pun_linebreaks(pun_trim($message));
if (!$message) {
throw new Exception($this->_lang['Bad request']);
} else {
if (mb_strlen($message) > 65535) {
throw new Exception($this->_lang['Bad request']);
} else {
if (!$this->_pun_config['p_message_all_caps'] && mb_strtoupper($message) == $message && $this->_pun_user['g_id'] > PUN_MOD) {
$message = ucwords(mb_strtolower($message));
}
}
}
convert_forum_url($message);
// Insert the new post
$r = $this->_db->query('
INSERT INTO ' . $this->_db->prefix . 'posts (
poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id
) VALUES (
\'' . $this->_db->escape($this->_pun_user['username']) . '\',
' . $this->_pun_user['id'] . ',
\'' . get_remote_address() . '\',
\'' . $this->_db->escape($message) . '\',
\'' . intval($hideSmiles) . '\',
' . $_SERVER['REQUEST_TIME'] . ',
' . $topicId . '
)
');
if (!$r) {
throw new Exception($this->_db->error());
}
if (!$this->_db->affected_rows()) {
throw new Exception($this->_lang['Bad request']);
}
$id = $this->_db->insert_id();
// Count number of replies in the topic
$result = $this->_db->query('
SELECT COUNT(1)
FROM ' . $this->_db->prefix . 'posts
WHERE topic_id=' . $topicId);
$num_replies = $this->_db->result($result, 0) - 1;
// Update topic
$this->_db->query('
UPDATE ' . $this->_db->prefix . 'topics
SET num_replies=' . $num_replies . ',
last_post=' . $_SERVER['REQUEST_TIME'] . ',
last_post_id=' . $id . ',
last_poster=\'' . $this->_db->escape($this->_pun_user['username']) . '\'
WHERE id=' . $topicId);
//update_search_index('post', $id, $message);
$result = $this->_db->query('
SELECT f.id
FROM ' . $this->_db->prefix . 'topics AS t
INNER JOIN ' . $this->_db->prefix . 'forums AS f ON f.id=t.forum_id
LEFT JOIN ' . $this->_db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $this->_pun_user['g_id'] . ')
WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=' . $topicId);
$forumId = $this->_db->result($result, 0);
update_forum($forumId);
generate_rss();
return array('message' => $this->_parseMessage($message, $hideSmiles), 'poster' => $this->_pun_user['username'], 'posted' => $_SERVER['REQUEST_TIME']);
}
示例12: get_remote_address
$new_tid = $db->insert_id();
$db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id)
VALUES(\'' . $db->escape($pun_user['username']) . '\', ' . $pun_user['id'] . ', \'' . get_remote_address() . '\',
\'' . $db->escape($_POST['message']) . '\', \'0\', ' . $now . ', ' . $new_tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();
$db->query('UPDATE ' . $db->prefix . 'topics SET last_post_id=' . $new_pid . ' WHERE id=' . $new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
update_search_index('post', $new_pid, $_POST['message'], $_POST['subject']);
update_forum($_POST['forums'][$i]);
$i++;
}
redirect('admin_loader.php?plugin=AMP_Global_topic.php', 'Topic(s) Added');
} elseif (isset($_POST['update'])) {
if (empty($_POST['subject']) || empty($_POST['message'])) {
message('Missing Fields');
}
$_POST['message'] = pun_linebreaks(pun_trim($_POST['message']));
$db->query('UPDATE ' . $db->prefix . 'topics SET subject=\'' . $db->escape($_POST['subject']) . '\'
WHERE subject=\'' . $db->escape($_POST['old_subject']) . '\' AND posted=' . $db->escape($_POST['old_posted'])) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
$result = $db->query('SELECT p.id FROM ' . $db->prefix . 'posts as p LEFT JOIN ' . $db->prefix . 'topics as t ON t.id=p.topic_id
WHERE t.subject=\'' . $db->escape($_POST['subject']) . '\' AND t.posted=' . $db->escape($_POST['old_posted'])) or error('Unable to get post ids', __FILE__, __LINE__, $db->error());
while ($cur_post = $db->fetch_assoc($result)) {
$db->query('UPDATE ' . $db->prefix . 'posts SET message=\'' . $db->escape($_POST['message']) . '\' WHERE id=' . $cur_post['id']) or error('Unable to update post', __FILE__, __LINE__, $db->error());
}
redirect('admin_loader.php?plugin=AMP_Global_topic.php', 'Topic(s) Updated');
} elseif (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'delete':
$db->query('DELETE FROM ' . $db->prefix . 'topics WHERE subject=\'' . $db->escape($_GET['subject']) . '\' AND posted=\'' . $db->escape($_GET['posted']) . '\'') or error('Unable to delete topic', __FILE__, __LINE__, $db->error());
redirect('admin_loader.php?plugin=AMP_Global_topic.php', 'Topic(s) Removed');
break;
case 'stick':
示例13: pun_mail
function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '')
{
global $pun_config, $lang_common;
// Use \r\n for SMTP servers, the system's line ending for local mailers
$smtp = $pun_config['o_smtp_host'] != '';
$EOL = $smtp ? "\r\n" : FORUM_EOL;
// Default sender/return address
$from_name = sprintf($lang_common['Mailer'], $pun_config['o_board_title']);
$from_email = $pun_config['o_webmaster_email'];
// Do a little spring cleaning
$to = pun_trim(preg_replace('%[\\n\\r]+%s', '', $to));
$subject = pun_trim(preg_replace('%[\\n\\r]+%s', '', $subject));
$from_email = pun_trim(preg_replace('%[\\n\\r:]+%s', '', $from_email));
$from_name = pun_trim(preg_replace('%[\\n\\r:]+%s', '', str_replace('"', '', $from_name)));
$reply_to_email = pun_trim(preg_replace('%[\\n\\r:]+%s', '', $reply_to_email));
$reply_to_name = pun_trim(preg_replace('%[\\n\\r:]+%s', '', str_replace('"', '', $reply_to_name)));
// Set up some headers to take advantage of UTF-8
$from = '"' . encode_mail_text($from_name) . '" <' . $from_email . '>';
$subject = encode_mail_text($subject);
$headers = 'From: ' . $from . $EOL . 'Date: ' . gmdate('r') . $EOL . 'MIME-Version: 1.0' . $EOL . 'Content-transfer-encoding: 8bit' . $EOL . 'Content-type: text/plain; charset=utf-8' . $EOL . 'X-Mailer: FluxBB Mailer';
// If we specified a reply-to email, we deal with it here
if (!empty($reply_to_email)) {
$reply_to = '"' . encode_mail_text($reply_to_name) . '" <' . $reply_to_email . '>';
$headers .= $EOL . 'Reply-To: ' . $reply_to;
}
// Make sure all linebreaks are LF in message (and strip out any NULL bytes)
$message = str_replace("", '', pun_linebreaks($message));
$message = str_replace("\n", $EOL, $message);
$mailer = $smtp ? 'smtp_mail' : 'mail';
$mailer($to, $subject, $message, $headers);
}
示例14: define
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN')) {
exit;
}
// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);
define('PLUGIN_URL', 'admin_loader.php?plugin=AP_MP_de_Bienvenue.php');
if (isset($_POST['form_sent'])) {
$form = array_map('trim', $_POST['form']);
$errors = array();
$message = pun_linebreaks(pun_trim($form['welcome_message_mp']));
if ($message == '') {
$message = 'Bienvenue %user%';
} else {
if (strlen($message) > 65535) {
$errors[] = 'Le message est trop long.';
}
}
// Validate BBCode syntax
if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false) {
require_once PUN_ROOT . 'include/parser.php';
$message = preparse_bbcode($message, $errors);
}
if (!empty($errors)) {
message(implode('<br />', $errors));
}
示例15: pun_mail
function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '')
{
global $pun_config, $lang;
// Default sender/return address
$from_name = $lang->t('Mailer', $pun_config['o_board_title']);
$from_email = $pun_config['o_webmaster_email'];
// Do a little spring cleaning
$to = pun_trim(preg_replace('%[\\n\\r]+%s', '', $to));
$subject = pun_trim(preg_replace('%[\\n\\r]+%s', '', $subject));
$from_email = pun_trim(preg_replace('%[\\n\\r:]+%s', '', $from_email));
$from_name = pun_trim(preg_replace('%[\\n\\r:]+%s', '', str_replace('"', '', $from_name)));
$reply_to_email = pun_trim(preg_replace('%[\\n\\r:]+%s', '', $reply_to_email));
$reply_to_name = pun_trim(preg_replace('%[\\n\\r:]+%s', '', str_replace('"', '', $reply_to_name)));
// Set up some headers to take advantage of UTF-8
$from = '"' . encode_mail_text($from_name) . '" <' . $from_email . '>';
$subject = encode_mail_text($subject);
$headers = 'From: ' . $from . "\r\n" . 'Date: ' . gmdate('r') . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-transfer-encoding: 8bit' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n" . 'X-Mailer: FluxBB Mailer';
// If we specified a reply-to email, we deal with it here
if (!empty($reply_to_email)) {
$reply_to = '"' . encode_mail_text($reply_to_name) . '" <' . $reply_to_email . '>';
$headers .= "\r\n" . 'Reply-To: ' . $reply_to;
}
// Make sure all linebreaks are LF in message (and strip out any NULL bytes)
$message = str_replace("", '', pun_linebreaks($message));
if ($pun_config['o_smtp_host'] != '') {
// Headers should be \r\n
// Message should be ??
$message = str_replace("\n", "\r\n", $message);
smtp_mail($to, $subject, $message, $headers);
} else {
// Headers should be \r\n
// Message should be \n
mail($to, $subject, $message, $headers);
}
}