本文整理汇总了PHP中loadMessageData函数的典型用法代码示例。如果您正苦于以下问题:PHP loadMessageData函数的具体用法?PHP loadMessageData怎么用?PHP loadMessageData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadMessageData函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PageLinkButton
print '<p>' . PageLinkButton('mviews&dl=true', $GLOBALS['I18N']->get('Download as CSV file')) . '</p>';
# print '<p>'.$GLOBALS['I18N']->get('Select Message to view').'</p>';
$timerange = ' and msg.entered > date_sub(now(),interval 12 month)';
$timerange = '';
$limit = 'limit 10';
$req = Sql_Query(sprintf('select msg.id as messageid,count(um.viewed) as views, count(um.status) as total,
subject,date_format(sent,"%%e %%b %%Y") as sent,bouncecount as bounced from %s um,%s msg
where um.messageid = msg.id and um.status = "sent" %s %s
group by msg.id order by msg.entered desc limit 50', $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['message'], $subselect, $timerange));
if (!Sql_Affected_Rows()) {
print '<p class="information">' . $GLOBALS['I18N']->get('There are currently no messages to view') . '</p>';
}
$ls = new WebblerListing($GLOBALS['I18N']->get('Available Messages'));
while ($row = Sql_Fetch_Array($req)) {
# $element = $row['messageid'].' '.substr($row['subject'],0,50);
$messagedata = loadMessageData($row['messageid']);
if (!$download) {
if ($messagedata['subject'] != $messagedata['campaigntitle']) {
$element = '<!--' . $row['messageid'] . '-->' . stripslashes($messagedata["campaigntitle"]) . '<br/><strong>' . shortenTextDisplay($messagedata["subject"], 30) . '</strong>';
} else {
$element = '<!--' . $row['messageid'] . '-->' . shortenTextDisplay($messagedata["subject"], 30);
}
} else {
$element = $messagedata['subject'];
}
$ls->addElement($element, PageUrl2('mviews&id=' . $row['messageid']));
$ls->setClass($element, 'row1');
if (!empty($row['sent'])) {
$ls->addRow($element, '<div class="listingsmall gray">' . $GLOBALS['I18N']->get('date') . ': ' . $row['sent'] . '</div>', '');
} else {
$ls->addRow($element, '<div class="listingsmall gray">' . $GLOBALS['I18N']->get('date') . ': ' . $GLOBALS['I18N']->get('in progress') . '</div>', '');
示例2: simplePaging
$offset = $start;
} else {
$start = 0;
}
$paging = '';
if ($total > $_SESSION['messagenumpp']) {
$paging = simplePaging("messages{$url_keep}", $start, $total, $_SESSION['messagenumpp'], $GLOBALS['I18N']->get('Campaigns'));
}
$ls = new WebblerListing(s('Campaigns'));
$ls->usePanel($paging);
## messages table
if ($total) {
$result = Sql_query('SELECT * FROM ' . $tables['message'] . " {$whereClause} {$sortBySql} limit {$limit} offset {$offset}");
while ($msg = Sql_fetch_array($result)) {
$editlink = '';
$messagedata = loadMessageData($msg['id']);
if ($messagedata['subject'] != $messagedata['campaigntitle']) {
$listingelement = '<!--' . $msg['id'] . '-->' . stripslashes($messagedata['campaigntitle']) . '<br/><strong>' . stripslashes($messagedata['subject']) . '</strong>';
} else {
$listingelement = '<!--' . $msg['id'] . '-->' . stripslashes($messagedata['subject']);
}
# $listingelement = '<!--'.$msg['id'].'-->'.stripslashes($messagedata["campaigntitle"]);
if ($msg['status'] == 'draft') {
$editlink = PageUrl2('send&id=' . $msg['id']);
}
$ls->addElement($listingelement, $editlink);
$ls->setClass($listingelement, 'row1');
$uniqueviews = Sql_Fetch_Row_Query("select count(userid) from {$tables['usermessage']} where viewed is not null and status = 'sent' and messageid = " . $msg['id']);
$clicks = Sql_Fetch_Row_Query("select sum(clicked) from {$tables['linktrack_ml']} where messageid = " . $msg['id']);
# $clicks = array(0);
/*
示例3: explode
$addlists = explode(',', $_GET['list']);
}
$addlists = cleanArray($addlists);
foreach ($addlists as $listid) {
$query = sprintf('replace into %s (messageid,listid,entered) values(%d,%d,now())', $GLOBALS['tables']['listmessage'], $id, $listid);
Sql_Query($query);
}
}
# 0008720: Using -p send from the commandline doesn't seem to work
if (!$GLOBALS['commandline']) {
Redirect($_GET['page'] . '&id=' . $id);
exit;
}
}
# load all message data
$messagedata = loadMessageData($id);
## auto generate the text version if empty
## hmm, might want this as config
/*
if (empty($messagedata['textmessage'])) {
include 'actions/generatetext.php';
}
*/
#var_dump($messagedata);
#exit;
#print '<h3>'.$messagedata['status'].'</h3>';
if (!empty($_GET['deletecriterion'])) {
include dirname(__FILE__) . '/actions/deletecriterion.php';
Redirect($_GET['page'] . '&id=' . $id . '&tab=' . $_GET['tab']);
}
ob_end_flush();
示例4: repeatMessage
function repeatMessage($msgid)
{
# if (!USE_REPETITION && !USE_rss) return;
$data = loadMessageData($msgid);
## do not repeat when it has already been done
if ($data['repeatinterval'] == 0 || !empty($data['repeatedid'])) {
return;
}
# calculate the future embargo, a multiple of repeatinterval minutes after the current embargo
$msgdata = Sql_Fetch_Array_Query(sprintf('SELECT *,
embargo +
INTERVAL (FLOOR(TIMESTAMPDIFF(MINUTE, embargo, GREATEST(embargo, NOW())) / repeatinterval) + 1) * repeatinterval MINUTE AS newembargo
FROM %s
WHERE id = %d AND now() < repeatuntil', $GLOBALS['tables']['message'], $msgid));
if (!$msgdata) {
logEvent("Message {$msgid} not repeated due to reaching the repeatuntil date");
return;
}
# check whether the new embargo is not on an exclusion
if (isset($GLOBALS['repeat_exclude']) && is_array($GLOBALS['repeat_exclude'])) {
$loopcnt = 0;
while (excludedDateForRepetition($msgdata['newembargo'])) {
if (++$loopcnt > 15) {
logEvent("Unable to find new embargo date too many exclusions? for message {$msgid}");
return;
}
$result = Sql_Fetch_Array_Query(sprintf("SELECT '%s' + INTERVAL repeatinterval MINUTE AS newembargo\n FROM %s\n WHERE id = %d", $msgdata['newembargo'], $GLOBALS['tables']['message'], $msgid));
$msgdata['newembargo'] = $result['newembargo'];
}
}
# copy the new message
Sql_Query(sprintf('
insert into %s (entered) values(now())', $GLOBALS['tables']['message']));
$newid = Sql_Insert_id();
require dirname(__FILE__) . '/structure.php';
if (!is_array($DBstruct['message'])) {
logEvent("Error including structure when trying to duplicate message {$msgid}");
return;
}
foreach ($DBstruct['message'] as $column => $rec) {
if ($column != 'id' && $column != 'entered' && $column != 'sendstart') {
Sql_Query(sprintf('update %s set %s = "%s" where id = %d', $GLOBALS['tables']['message'], $column, addslashes($msgdata[$column]), $newid));
}
}
$req = Sql_Query(sprintf("SELECT *\n FROM %s\n WHERE id = %d AND name NOT IN ('id')", $GLOBALS['tables']['messagedata'], $msgid));
while ($row = Sql_Fetch_Array($req)) {
setMessageData($newid, $row['name'], $row['data']);
}
Sql_Query(sprintf('update %s set embargo = "%s",status = "submitted",sent = "" where id = %d', $GLOBALS['tables']['message'], $msgdata['newembargo'], $newid));
list($e['year'], $e['month'], $e['day'], $e['hour'], $e['minute'], $e['second']) = sscanf($msgdata['newembargo'], '%04d-%02d-%02d %02d:%02d:%02d');
unset($e['second']);
setMessageData($newid, 'embargo', $e);
foreach (array('processed', 'astext', 'ashtml', 'astextandhtml', 'aspdf', 'astextandpdf', 'viewed', 'bouncecount') as $item) {
Sql_Query(sprintf('update %s set %s = 0 where id = %d', $GLOBALS['tables']['message'], $item, $newid));
}
# lists
$req = Sql_Query(sprintf('select listid from %s where messageid = %d', $GLOBALS['tables']['listmessage'], $msgid));
while ($row = Sql_Fetch_Row($req)) {
Sql_Query(sprintf('insert into %s (messageid,listid,entered) values(%d,%d,now())', $GLOBALS['tables']['listmessage'], $newid, $row[0]));
}
# attachments
$req = Sql_Query(sprintf('select * from %s,%s where %s.messageid = %d and %s.attachmentid = %s.id', $GLOBALS['tables']['message_attachment'], $GLOBALS['tables']['attachment'], $GLOBALS['tables']['message_attachment'], $msgid, $GLOBALS['tables']['message_attachment'], $GLOBALS['tables']['attachment']));
while ($row = Sql_Fetch_Array($req)) {
if (is_file($row['remotefile'])) {
# if the "remote file" is actually local, we want to refresh the attachment, so we set
# filename to nothing
$row['filename'] = '';
}
Sql_Query(sprintf('insert into %s (filename,remotefile,mimetype,description,size)
values("%s","%s","%s","%s",%d)', $GLOBALS['tables']['attachment'], addslashes($row['filename']), addslashes($row['remotefile']), addslashes($row['mimetype']), addslashes($row['description']), $row['size']));
$attid = Sql_Insert_id();
Sql_Query(sprintf('insert into %s (messageid,attachmentid) values(%d,%d)', $GLOBALS['tables']['message_attachment'], $newid, $attid));
}
logEvent("Message {$msgid} was successfully rescheduled as message {$newid}");
## remember we duplicated, in order to avoid doing it again (eg when requeuing)
setMessageData($msgid, 'repeatedid', $newid);
if (getConfig('pqchoice') == 'phplistdotcom') {
activateRemoteQueue();
}
}
示例5: precacheMessage
function precacheMessage($messageid, $forwardContent = 0)
{
global $cached;
$domain = getConfig('domain');
# $message = Sql_query("select * from {$GLOBALS["tables"]["message"]} where id = $messageid");
# $cached[$messageid] = array();
# $message = Sql_fetch_array($message);
$message = loadMessageData($messageid);
## the reply to is actually not in use
if (preg_match("/([^ ]+@[^ ]+)/", $message["replyto"], $regs)) {
# if there is an email in the from, rewrite it as "name <email>"
$message["replyto"] = str_replace($regs[0], "", $message["replyto"]);
$cached[$messageid]["replytoemail"] = $regs[0];
# if the email has < and > take them out here
$cached[$messageid]["replytoemail"] = str_replace("<", "", $cached[$messageid]["replytoemail"]);
$cached[$messageid]["replytoemail"] = str_replace(">", "", $cached[$messageid]["replytoemail"]);
# make sure there are no quotes around the name
$cached[$messageid]["replytoname"] = str_replace('"', "", ltrim(rtrim($message["replyto"])));
} elseif (strpos($message["replyto"], " ")) {
# if there is a space, we need to add the email
$cached[$messageid]["replytoname"] = $message["replyto"];
$cached[$messageid]["replytoemail"] = "listmaster@{$domain}";
} else {
if (!empty($message["replyto"])) {
$cached[$messageid]["replytoemail"] = $message["replyto"] . "@{$domain}";
## makes more sense not to add the domain to the word, but the help says it does
## so let's keep it for now
$cached[$messageid]["replytoname"] = $message["replyto"] . "@{$domain}";
}
}
$cached[$messageid]["fromname"] = $message["fromname"];
$cached[$messageid]["fromemail"] = $message["fromemail"];
$cached[$messageid]["to"] = $message["tofield"];
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]["subject"] = $forwardContent ? stripslashes($message["forwardsubject"]) : $message["subject"];
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]["content"] = $forwardContent ? stripslashes($message["forwardmessage"]) : $message["message"];
if (USE_MANUAL_TEXT_PART && !$forwardContent) {
$cached[$messageid]["textcontent"] = $message["textmessage"];
} else {
$cached[$messageid]["textcontent"] = '';
}
# var_dump($cached);exit;
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]["footer"] = $forwardContent ? stripslashes($message["forwardfooter"]) : $message["footer"];
if (strip_tags($cached[$messageid]["footer"]) != $cached[$messageid]["footer"]) {
$cached[$messageid]["textfooter"] = HTML2Text($cached[$messageid]["footer"]);
$cached[$messageid]["htmlfooter"] = $cached[$messageid]["footer"];
} else {
$cached[$messageid]["textfooter"] = $cached[$messageid]["footer"];
$cached[$messageid]["htmlfooter"] = parseText($cached[$messageid]["footer"]);
}
$cached[$messageid]["htmlformatted"] = strip_tags($cached[$messageid]["content"]) != $cached[$messageid]["content"];
$cached[$messageid]["sendformat"] = $message["sendformat"];
if ($message["template"]) {
$req = Sql_Fetch_Row_Query("select template from {$GLOBALS["tables"]["template"]} where id = {$message["template"]}");
$cached[$messageid]["template"] = stripslashes($req[0]);
$cached[$messageid]["templateid"] = $message["template"];
# dbg("TEMPLATE: ".$req[0]);
} else {
$cached[$messageid]["template"] = '';
$cached[$messageid]["templateid"] = 0;
}
## @@ put this here, so it can become editable per email sent out at a later stage
$cached[$messageid]["html_charset"] = 'UTF-8';
#getConfig("html_charset");
## @@ need to check on validity of charset
if (!$cached[$messageid]["html_charset"]) {
$cached[$messageid]["html_charset"] = 'UTF-8';
#'iso-8859-1';
}
$cached[$messageid]["text_charset"] = 'UTF-8';
#getConfig("text_charset");
if (!$cached[$messageid]["text_charset"]) {
$cached[$messageid]["text_charset"] = 'UTF-8';
#'iso-8859-1';
}
## if we are sending a URL that contains user attributes, we cannot pre-parse the message here
## but that has quite some impact on speed. So check if that's the case and apply
$cached[$messageid]['userspecific_url'] = preg_match('/\\[.+\\]/', $message['sendurl']);
if (!$cached[$messageid]['userspecific_url']) {
## Fetch external content here, because URL does not contain placeholders
if ($GLOBALS["can_fetchUrl"] && preg_match("/\\[URL:([^\\s]+)\\]/i", $cached[$messageid]["content"], $regs)) {
$remote_content = fetchUrl($regs[1], array());
# $remote_content = fetchUrl($message['sendurl'],array());
# @@ don't use this
# $remote_content = includeStyles($remote_content);
if ($remote_content) {
$cached[$messageid]['content'] = str_replace($regs[0], $remote_content, $cached[$messageid]['content']);
# $cached[$messageid]['content'] = $remote_content;
$cached[$messageid]["htmlformatted"] = strip_tags($remote_content) != $remote_content;
## 17086 - disregard any template settings when we have a valid remote URL
$cached[$messageid]["template"] = NULL;
$cached[$messageid]["templateid"] = NULL;
} else {
#print Error(s('unable to fetch web page for sending'));
logEvent("Error fetching URL: " . $message['sendurl'] . ' cannot proceed');
return false;
}
}
//.........这里部分代码省略.........
示例6: Sql_query
}
}
Sql_query("SET SQL_BIG_TABLES=1");
$script_stage = 2;
# we know the messages to process
include_once "footer.inc";
if (!$num_per_batch) {
$num_per_batch = 1000000;
}
while ($message = Sql_fetch_array($messages)) {
$failed_sent = 0;
$throttlecount = 0;
$messageid = $message["id"];
$userselection = $message["userselection"];
$rssmessage = $message["rsstemplate"];
$msgdata = loadMessageData($messageid);
if (!empty($msgdata['notify_start']) && !isset($msgdata['start_notified'])) {
$notifications = explode(',', $msgdata['notify_start']);
foreach ($notifications as $notification) {
sendMail($notification, $GLOBALS['I18N']->get('Message Sending has started'), sprintf($GLOBALS['I18N']->get('phplist has started sending the message with subject %s'), $message['subject'] . "\n" . sprintf($GLOBALS['I18N']->get('to view the progress of this message, go to %s'), getConfig('website') . $GLOBALS['adminpages'] . '/?page=messages&type=sent')));
}
Sql_Query(sprintf('insert ignore into %s (name,id,data) values("start_notified",%d,now())', $GLOBALS['tables']['messagedata'], $messageid));
}
output($GLOBALS['I18N']->get('Processing message') . ' ' . $messageid);
if (ENABLE_RSS && $message["rsstemplate"]) {
$processrss = 1;
output($GLOBALS['I18N']->get('Message') . ' ' . $messageid . ' ' . $GLOBALS['I18N']->get('is an RSS feed for') . ' ' . $GLOBALS['I18N']->get($rssmessage));
} else {
$processrss = 0;
}
flush();
示例7: forwardPage
function forwardPage($id)
{
global $tables;
$ok = true;
$subtitle = '';
$info = '';
$html = '';
$form = '';
$personalNote = '';
## Check requirements
# message
$mid = 0;
if (isset($_REQUEST['mid'])) {
$mid = sprintf('%d', $_REQUEST['mid']);
$messagedata = loadMessageData($mid);
$mid = $messagedata['id'];
if ($mid) {
$subtitle = $GLOBALS['strForwardSubtitle'] . ' ' . stripslashes($messagedata['subject']);
}
}
#mid set
# user
if (!isset($_REQUEST['uid']) || !$_REQUEST['uid']) {
FileNotFound();
}
## get userdata
$req = Sql_Query(sprintf('select * from %s where uniqid = "%s"', $tables['user'], sql_escape($_REQUEST['uid'])));
$userdata = Sql_Fetch_Array($req);
## verify that this subscriber actually received this message to forward, otherwise they're not allowed
$allowed = Sql_Fetch_Row_Query(sprintf('select userid from %s where userid = %d and messageid = %d', $GLOBALS['tables']['usermessage'], $userdata['id'], $mid));
if (empty($userdata['id']) || $allowed[0] != $userdata['id']) {
## when sending a test email as an admin, the entry isn't there yet
if (empty($_SESSION['adminloggedin']) || $_SESSION['adminloggedin'] != $_SERVER['REMOTE_ADDR']) {
FileNotFound('<br/><i>' . $GLOBALS['I18N']->get('When testing the phpList forward functionality, you need to be logged in as an administrator.') . '</i><br/>');
}
}
$firstpage = 1;
## is this the initial page or a followup
# forward addresses
$forwardemail = '';
if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
$firstpage = 0;
$forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(user) from %s where date_add(time,interval %s) >= now() and user = %d and status ="sent" ', $tables['user_message_forward'], FORWARD_EMAIL_PERIOD, $userdata['id']));
$forwardemail = stripslashes($_REQUEST['email']);
$emails = explode("\n", $forwardemail);
$emails = trimArray($emails);
$forwardemail = implode("\n", $emails);
#0011860: forward to friend, multiple emails
$emailCount = $forwardPeriodCount[0];
foreach ($emails as $index => $email) {
$emails[$index] = trim($email);
if (is_email($email)) {
++$emailCount;
} else {
$info .= sprintf('<br />' . $GLOBALS['strForwardInvalidEmail'], $email);
$ok = false;
}
}
if ($emailCount > FORWARD_EMAIL_COUNT) {
$info .= '<br />' . $GLOBALS['strForwardCountReached'];
$ok = false;
}
} else {
$ok = false;
}
#0011996: forward to friend - personal message
# text cannot be longer than max, to prevent very long text with only linefeeds total cannot be longer than twice max
if (FORWARD_PERSONAL_NOTE_SIZE && isset($_REQUEST['personalNote'])) {
if (strlen(strip_newlines($_REQUEST['personalNote'])) > FORWARD_PERSONAL_NOTE_SIZE || strlen($_REQUEST['personalNote']) > FORWARD_PERSONAL_NOTE_SIZE * 2) {
$info .= '<BR />' . $GLOBALS['strForwardNoteLimitReached'];
$ok = false;
}
$personalNote = strip_tags(htmlspecialchars_decode(stripslashes($_REQUEST['personalNote'])));
$userdata['personalNote'] = $personalNote;
}
if ($userdata['id'] && $mid) {
if ($ok && count($emails)) {
## All is well, send it
require_once 'admin/sendemaillib.php';
#0013845 Lead Ref Scheme
if (FORWARD_FRIEND_COUNT_ATTRIBUTE) {
$iCountFriends = FORWARD_FRIEND_COUNT_ATTRIBUTE;
} else {
$iCountFriends = 0;
}
if ($iCountFriends) {
$nFriends = intval(UserAttributeValue($userdata['id'], $iCountFriends));
}
## remember the lists for this message in order to notify only those admins
## that own them
$messagelists = array();
$messagelistsreq = Sql_Query(sprintf('select listid from %s where messageid = %d', $GLOBALS['tables']['listmessage'], $mid));
while ($row = Sql_Fetch_Row($messagelistsreq)) {
array_push($messagelists, $row[0]);
}
foreach ($emails as $index => $email) {
#0011860: forward to friend, multiple emails
$done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d', $tables['user_message_forward'], $email, $mid));
$info .= '<br />' . $email . ': ';
if ($done['status'] === 'sent') {
//.........这里部分代码省略.........
示例8: mktime
$finishSending = mktime($messagedata['finishsending']['hour'], $messagedata['finishsending']['minute'], 0, $messagedata['finishsending']['month'], $messagedata['finishsending']['day'], $messagedata['finishsending']['year']);
if ($finishSending < time()) {
$_SESSION['action_result'] .= '<br />' . s('This campaign is scheduled to stop sending in the past. No mails will be sent.');
$_SESSION['action_result'] .= '<br />' . PageLinkButton('send&id=' . $messagedata['id'] . '&tab=Scheduling', s('Review Scheduling'));
}
Redirect('messages&tab=active');
exit;
}
require_once $coderoot . 'structure.php';
$result = Sql_Fetch_Assoc_query(sprintf('select id, subject from %s where id = %d %s', $tables['message'], $id, $owner_select_and));
if (empty($result['id'])) {
print $GLOBALS['I18N']->get('No such campaign');
return;
}
$campaignTitle = $result['subject'];
$msgdata = loadMessageData($id);
if ($msgdata['status'] == 'draft' || $msgdata['status'] == 'suspended') {
print '<div class="actions">';
print '<p>' . PageLinkButton('send&id=' . $id, $GLOBALS['I18N']->get('Edit this message')) . '</p>';
print '</div>';
} else {
print '<div class="actions">';
$editbutton = new ConfirmButton(s('Editing an active or finished campaign will place it back in the draft queue, continue?'), PageURL2('send&id=' . $id), s('Edit campaign'));
print $editbutton->show();
print '</div>';
}
$content = '<table class="messageView">';
$format = '<tr><td valign="top" class="dataname">%s</td><td valign="top">%s</td></tr>';
$content .= sprintf($format, s('entered'), stripslashes($msgdata['entered']));
$content .= sprintf($format, s('fromfield'), stripslashes($msgdata['fromfield']));
$content .= sprintf($format, s('message'), stripslashes($msgdata['message']));
示例9: sendEmail
function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array(), $forwardedby = array())
{
global $strThisLink, $PoweredByImage, $PoweredByText, $cached, $website;
if ($email == "") {
return 0;
}
#0013076: different content when forwarding 'to a friend'
if (FORWARD_ALTERNATIVE_CONTENT) {
$forwardContent = sizeof($forwardedby) > 0;
$messagedata = loadMessageData($messageid);
} else {
$forwardContent = 0;
}
if (empty($cached[$messageid])) {
$domain = getConfig("domain");
$message = Sql_query("select * from {$GLOBALS["tables"]["message"]} where id = {$messageid}");
$cached[$messageid] = array();
$message = Sql_fetch_array($message);
if (ereg("([^ ]+@[^ ]+)", $message["fromfield"], $regs)) {
# if there is an email in the from, rewrite it as "name <email>"
$message["fromfield"] = ereg_replace($regs[0], "", $message["fromfield"]);
$cached[$messageid]["fromemail"] = $regs[0];
# if the email has < and > take them out here
$cached[$messageid]["fromemail"] = ereg_replace("<", "", $cached[$messageid]["fromemail"]);
$cached[$messageid]["fromemail"] = ereg_replace(">", "", $cached[$messageid]["fromemail"]);
# make sure there are no quotes around the name
$cached[$messageid]["fromname"] = ereg_replace('"', "", ltrim(rtrim($message["fromfield"])));
} elseif (ereg(" ", $message["fromfield"], $regs)) {
# if there is a space, we need to add the email
$cached[$messageid]["fromname"] = $message["fromfield"];
$cached[$messageid]["fromemail"] = "listmaster@{$domain}";
} else {
$cached[$messageid]["fromemail"] = $message["fromfield"] . "@{$domain}";
## makes more sense not to add the domain to the word, but the help says it does
## so let's keep it for now
$cached[$messageid]["fromname"] = $message["fromfield"] . "@{$domain}";
}
# erase double spacing
while (ereg(" ", $cached[$messageid]["fromname"])) {
$cached[$messageid]["fromname"] = eregi_replace(" ", " ", $cached[$messageid]["fromname"]);
}
## this has weird effects when used with only one word, so take it out for now
# $cached[$messageid]["fromname"] = eregi_replace("@","",$cached[$messageid]["fromname"]);
$cached[$messageid]["fromname"] = trim($cached[$messageid]["fromname"]);
$cached[$messageid]["to"] = $message["tofield"];
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]["subject"] = $forwardContent ? stripslashes($messagedata["forwardsubject"]) : $message["subject"];
$cached[$messageid]["replyto"] = $message["replyto"];
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]["content"] = $forwardContent ? stripslashes($messagedata["forwardmessage"]) : $message["message"];
if (USE_MANUAL_TEXT_PART && !$forwardContent) {
$cached[$messageid]["textcontent"] = $message["textmessage"];
} else {
$cached[$messageid]["textcontent"] = '';
}
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]["footer"] = $forwardContent ? stripslashes($messagedata["forwardfooter"]) : $message["footer"];
$cached[$messageid]["htmlformatted"] = $message["htmlformatted"];
$cached[$messageid]["sendformat"] = $message["sendformat"];
if ($message["template"]) {
$req = Sql_Fetch_Row_Query("select template from {$GLOBALS["tables"]["template"]} where id = {$message["template"]}");
$cached[$messageid]["template"] = stripslashes($req[0]);
$cached[$messageid]["templateid"] = $message["template"];
# dbg("TEMPLATE: ".$req[0]);
} else {
$cached[$messageid]["template"] = '';
$cached[$messageid]["templateid"] = 0;
}
## @@ put this here, so it can become editable per email sent out at a later stage
$cached[$messageid]["html_charset"] = getConfig("html_charset");
## @@ need to check on validity of charset
if (!$cached[$messageid]["html_charset"]) {
$cached[$messageid]["html_charset"] = 'iso-8859-1';
}
$cached[$messageid]["text_charset"] = getConfig("text_charset");
if (!$cached[$messageid]["text_charset"]) {
$cached[$messageid]["text_charset"] = 'iso-8859-1';
}
}
# else
# dbg("Using cached {$cached[$messageid]["fromemail"]}");
if (VERBOSE) {
output($GLOBALS['I18N']->get('sendingmessage') . ' ' . $messageid . ' ' . $GLOBALS['I18N']->get('withsubject') . ' ' . $cached[$messageid]["subject"] . ' ' . $GLOBALS['I18N']->get('to') . ' ' . $email);
}
# erase any placeholders that were not found
# $msg = ereg_replace("\[[A-Z ]+\]","",$msg);
#0011857: forward to friend, retain attributes
if ($hash == 'forwarded' && defined('KEEPFORWARDERATTRIBUTES') && KEEPFORWARDERATTRIBUTES) {
$user_att_values = getUserAttributeValues($forwardedby['email']);
} else {
$user_att_values = getUserAttributeValues($email);
}
$userdata = Sql_Fetch_Assoc_Query(sprintf('select * from %s where email = "%s"', $GLOBALS["tables"]["user"], $email));
$url = getConfig("unsubscribeurl");
$sep = ereg('\\?', $url) ? '&' : '?';
$html["unsubscribe"] = sprintf('<a href="%s%suid=%s">%s</a>', $url, $sep, $hash, $strThisLink);
$text["unsubscribe"] = sprintf('%s%suid=%s', $url, $sep, $hash);
$html["unsubscribeurl"] = sprintf('%s%suid=%s', $url, $sep, $hash);
$text["unsubscribeurl"] = sprintf('%s%suid=%s', $url, $sep, $hash);
#0013076: Blacklisting posibility for unknown users
//.........这里部分代码省略.........
示例10: repeatMessage
function repeatMessage($msgid)
{
# if (!USE_REPETITION && !USE_rss) return;
$data = loadMessageData($msgid);
## do not repeat when it has already been done
if (!empty($data['repeatedid'])) {
return;
}
# get the future embargo, either "repeat" minutes after the old embargo
# or "repeat" after this very moment to make sure that we're not sending the
# message every time running the queue when there's no embargo set.
$msgdata = Sql_Fetch_Array_Query(sprintf('select *,date_add(embargo,interval repeatinterval minute) as newembargo,
date_add(now(),interval repeatinterval minute) as newembargo2, date_add(embargo,interval repeatinterval minute) > now() as isfuture
from %s where id = %d and repeatuntil > now()', $GLOBALS["tables"]["message"], $msgid));
if (!$msgdata["id"] || !$msgdata["repeatinterval"]) {
return;
}
# copy the new message
$query = ' insert into ' . $GLOBALS['tables']['message'] . ' (entered)' . ' values' . ' (current_timestamp)';
Sql_Query($query);
$newid = Sql_Insert_Id($GLOBALS['tables']['message'], 'id');
require dirname(__FILE__) . '/structure.php';
if (!is_array($DBstruct["message"])) {
logEvent("Error including structure when trying to duplicate message {$msgid}");
return;
}
foreach ($DBstruct["message"] as $column => $rec) {
if ($column != "id" && $column != "entered" && $column != "sendstart") {
Sql_Query(sprintf('update %s set %s = "%s" where id = %d', $GLOBALS["tables"]["message"], $column, addslashes($msgdata[$column]), $newid));
}
}
$req = Sql_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['messagedata'], $msgid));
while ($row = Sql_Fetch_Array($req)) {
setMessageData($newid, $row['name'], $row['data']);
}
# check whether the new embargo is not on an exclusion
if (isset($GLOBALS["repeat_exclude"]) && is_array($GLOBALS["repeat_exclude"])) {
$repeatinterval = $msgdata["repeatinterval"];
$loopcnt = 0;
while (excludedDateForRepetition($msgdata["newembargo"])) {
$repeat += $msgdata["repeatinterval"];
$loopcnt++;
$msgdata = Sql_Fetch_Array_Query(sprintf('select *,date_add(embargo,interval %d minute) as newembargo,
date_add(current_timestamp,interval %d minute) as newembargo2, date_add(embargo,interval %d minute) > current_timestamp as isfuture
from %s where id = %d and repeatuntil > current_timestamp', $repeatinterval, $repeatinterval, $repeatinterval, $GLOBALS["tables"]["message"], $msgid));
if ($loopcnt > 15) {
logEvent("Unable to find new embargo date too many exclusions? for message {$msgid}");
return;
}
}
}
# correct some values
if (!$msgdata["isfuture"]) {
$msgdata["newembargo"] = $msgdata["newembargo2"];
}
Sql_Query(sprintf('update %s set embargo = "%s",status = "submitted",sent = "" where id = %d', $GLOBALS["tables"]["message"], $msgdata["newembargo"], $newid));
list($e['year'], $e['month'], $e['day'], $e['hour'], $e['minute'], $e['second']) = sscanf($msgdata["newembargo"], '%04d-%02d-%02d %02d:%02d:%02d');
unset($e['second']);
setMessageData($newid, 'embargo', $e);
foreach (array("processed", "astext", "ashtml", "astextandhtml", "aspdf", "astextandpdf", "viewed", "bouncecount") as $item) {
Sql_Query(sprintf('update %s set %s = 0 where id = %d', $GLOBALS["tables"]["message"], $item, $newid));
}
# lists
$req = Sql_Query(sprintf('select listid from %s where messageid = %d', $GLOBALS["tables"]["listmessage"], $msgid));
while ($row = Sql_Fetch_Row($req)) {
Sql_Query(sprintf('insert into %s (messageid,listid,entered) values(%d,%d,current_timestamp)', $GLOBALS["tables"]["listmessage"], $newid, $row[0]));
}
# attachments
$req = Sql_Query(sprintf('select * from %s,%s where %s.messageid = %d and %s.attachmentid = %s.id', $GLOBALS["tables"]["message_attachment"], $GLOBALS["tables"]["attachment"], $GLOBALS["tables"]["message_attachment"], $msgid, $GLOBALS["tables"]["message_attachment"], $GLOBALS["tables"]["attachment"]));
while ($row = Sql_Fetch_Array($req)) {
if (is_file($row["remotefile"])) {
# if the "remote file" is actually local, we want to refresh the attachment, so we set
# filename to nothing
$row["filename"] = "";
}
Sql_Query(sprintf('insert into %s (filename,remotefile,mimetype,description,size)
values("%s","%s","%s","%s",%d)', $GLOBALS["tables"]["attachment"], addslashes($row["filename"]), addslashes($row["remotefile"]), addslashes($row["mimetype"]), addslashes($row["description"]), $row["size"]));
$attid = Sql_Insert_Id($GLOBALS['tables']['attachment'], 'id');
Sql_Query(sprintf('insert into %s (messageid,attachmentid) values(%d,%d)', $GLOBALS["tables"]["message_attachment"], $newid, $attid));
}
logEvent("Message {$msgid} was successfully rescheduled as message {$newid}");
## remember we duplicated, in order to avoid doing it again (eg when requeuing)
setMessageData($msgid, 'repeatedid', $newid);
}
示例11: verifyCsrfGetToken
<?php
verifyCsrfGetToken();
# generate text content
$msgid = sprintf('%d', $_GET['id']);
$messagedata = loadMessageData($msgid);
//sleep(10); // to test the busy image
if (preg_match('/\\[URL:(.+)\\]/', $messagedata['message'], $regs)) {
$content = fetchUrl($regs[1]);
# $textversion = 'Fetched '.$regs[1];
$textversion = HTML2Text($content);
} else {
$textversion = HTML2Text($messagedata['message']);
}
setMessageData($msgid, 'textmessage', $textversion);
## convert to feedback in the textarea
## @@FIXME this fails when the text is large, or contains £
$textversion = trim($textversion);
$textversion = preg_replace("/\n/", '\\n', $textversion);
$textversion = preg_replace("/\r/", '', $textversion);
$textversion = htmlentities($textversion, ENT_IGNORE, 'UTF-8', true);
$status = '<script type="text/javascript">
$("#textmessage").html("' . str_replace('"', '"', $textversion) . '");
//$("#textmessage").load("./?page=pageaction&action=messagedata&field=textmessage&id=' . $msgid . '");
$("#generatetextversion").hide();
</script>
';
示例12: precacheMessage
function precacheMessage($messageid, $forwardContent = 0)
{
global $cached, $tables;
$domain = getConfig('domain');
# $message = Sql_query("select * from {$GLOBALS["tables"]["message"]} where id = $messageid");
# $cached[$messageid] = array();
# $message = Sql_fetch_array($message);
$message = loadMessageData($messageid);
## the reply to is actually not in use
if (preg_match('/([^ ]+@[^ ]+)/', $message['replyto'], $regs)) {
# if there is an email in the from, rewrite it as "name <email>"
$message['replyto'] = str_replace($regs[0], '', $message['replyto']);
$cached[$messageid]['replytoemail'] = $regs[0];
# if the email has < and > take them out here
$cached[$messageid]['replytoemail'] = str_replace('<', '', $cached[$messageid]['replytoemail']);
$cached[$messageid]['replytoemail'] = str_replace('>', '', $cached[$messageid]['replytoemail']);
# make sure there are no quotes around the name
$cached[$messageid]['replytoname'] = str_replace('"', '', ltrim(rtrim($message['replyto'])));
} elseif (strpos($message['replyto'], ' ')) {
# if there is a space, we need to add the email
$cached[$messageid]['replytoname'] = $message['replyto'];
$cached[$messageid]['replytoemail'] = "listmaster@{$domain}";
} else {
if (!empty($message['replyto'])) {
$cached[$messageid]['replytoemail'] = $message['replyto'] . "@{$domain}";
## makes more sense not to add the domain to the word, but the help says it does
## so let's keep it for now
$cached[$messageid]['replytoname'] = $message['replyto'] . "@{$domain}";
}
}
$cached[$messageid]['fromname'] = $message['fromname'];
$cached[$messageid]['fromemail'] = $message['fromemail'];
$cached[$messageid]['to'] = $message['tofield'];
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]['subject'] = $forwardContent ? stripslashes($message['forwardsubject']) : $message['subject'];
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]['content'] = $forwardContent ? stripslashes($message['forwardmessage']) : $message['message'];
if (USE_MANUAL_TEXT_PART && !$forwardContent) {
$cached[$messageid]['textcontent'] = $message['textmessage'];
} else {
$cached[$messageid]['textcontent'] = '';
}
# var_dump($cached);exit;
#0013076: different content when forwarding 'to a friend'
$cached[$messageid]['footer'] = $forwardContent ? stripslashes($message['forwardfooter']) : $message['footer'];
if (strip_tags($cached[$messageid]['footer']) != $cached[$messageid]['footer']) {
$cached[$messageid]['textfooter'] = HTML2Text($cached[$messageid]['footer']);
$cached[$messageid]['htmlfooter'] = $cached[$messageid]['footer'];
} else {
$cached[$messageid]['textfooter'] = $cached[$messageid]['footer'];
$cached[$messageid]['htmlfooter'] = parseText($cached[$messageid]['footer']);
}
$cached[$messageid]['htmlformatted'] = strip_tags($cached[$messageid]['content']) != $cached[$messageid]['content'];
$cached[$messageid]['sendformat'] = $message['sendformat'];
if ($message['template']) {
$req = Sql_Fetch_Row_Query("select template from {$GLOBALS['tables']['template']} where id = {$message['template']}");
$cached[$messageid]['template'] = stripslashes($req[0]);
$cached[$messageid]['templateid'] = $message['template'];
# dbg("TEMPLATE: ".$req[0]);
} else {
$cached[$messageid]['template'] = '';
$cached[$messageid]['templateid'] = 0;
}
## @@ put this here, so it can become editable per email sent out at a later stage
$cached[$messageid]['html_charset'] = 'UTF-8';
#getConfig("html_charset");
## @@ need to check on validity of charset
if (!$cached[$messageid]['html_charset']) {
$cached[$messageid]['html_charset'] = 'UTF-8';
#'iso-8859-1';
}
$cached[$messageid]['text_charset'] = 'UTF-8';
#getConfig("text_charset");
if (!$cached[$messageid]['text_charset']) {
$cached[$messageid]['text_charset'] = 'UTF-8';
#'iso-8859-1';
}
## if we are sending a URL that contains user attributes, we cannot pre-parse the message here
## but that has quite some impact on speed. So check if that's the case and apply
$cached[$messageid]['userspecific_url'] = preg_match('/\\[.+\\]/', $message['sendurl']);
if (!$cached[$messageid]['userspecific_url']) {
## Fetch external content here, because URL does not contain placeholders
if ($GLOBALS['can_fetchUrl'] && preg_match("/\\[URL:([^\\s]+)\\]/i", $cached[$messageid]['content'], $regs)) {
$remote_content = fetchUrl($regs[1], array());
# $remote_content = fetchUrl($message['sendurl'],array());
# @@ don't use this
# $remote_content = includeStyles($remote_content);
if ($remote_content) {
$cached[$messageid]['content'] = str_replace($regs[0], $remote_content, $cached[$messageid]['content']);
# $cached[$messageid]['content'] = $remote_content;
$cached[$messageid]['htmlformatted'] = strip_tags($remote_content) != $remote_content;
## 17086 - disregard any template settings when we have a valid remote URL
$cached[$messageid]['template'] = null;
$cached[$messageid]['templateid'] = null;
} else {
#print Error(s('unable to fetch web page for sending'));
logEvent('Error fetching URL: ' . $message['sendurl'] . ' cannot proceed');
return false;
}
}
//.........这里部分代码省略.........
示例13: loadMessageData
public function loadMessageData($mid)
{
return loadMessageData($mid);
}
示例14: parseOutgoingHTMLMessage
function parseOutgoingHTMLMessage($messageid, $content, $destination, $userdata = null)
{
if (!$this->processing_queue && !$this->test_message) {
// Cannot get here unless processing queue, sending a test message or forwarding a message
$this->forwarding_message = true;
// Have to make sure that we have cached data to deal with the message
if (!$this->curid) {
// We may be forwarding the message to a further address after the first
$this->messageQueued($messageid);
// Make sure that we still have the image files in
// the plugin image subdirectory
$msgdata = loadMessageData($messageid);
$this->loadImageCache($msgdata);
}
}
// Replace all the image tags for inline images with tags pointing to the attached files
$n = count($this->cache[$messageid]);
for ($i = 0; $i < $n; $i++) {
// And replace them
$content = str_replace($this->cache[$messageid][$i]['original'], $this->cache[$messageid][$i]['imagetag'], $content);
}
return $content;
}