if (strlen($msg) == 0) { $ok = false; $errors['msg'] = $MESSAGES['ecard']['empty_message']; } $smarty->assign_by_ref('errors', $errors); $smarty->assign_by_ref('msg', html_entity_decode($msg)); //will be re-htmlentities'ed when output $smarty->assign_by_ref('charset', $CONF['mail_charset']); $smarty->assign_by_ref('contactmail', $CONF['abuse_email']); $enc_from_name = mb_encode_mimeheader($from_name, $CONF['mail_charset'], $CONF['mail_transferencoding']); $enc_to_name = mb_encode_mimeheader($to_name, $CONF['mail_charset'], $CONF['mail_transferencoding']); //still ok? if ($ok && !isset($_POST['edit'])) { //build message and send it... $smarty->assign_by_ref('htmlmsg', nl2br($msg)); $body = $smarty->fetch('email_ecard.tpl'); $subject = sprintf($MESSAGES['ecard']['mail_subject'], $from_name); $encsubject = mb_encode_mimeheader($CONF['mail_subjectprefix'] . $subject, $CONF['mail_charset'], $CONF['mail_transferencoding']); if (isset($_POST['preview'])) { preg_match_all('/(<!DOCTYPE.*<\\/HTML>)/s', $body, $matches); print $MESSAGES['ecard']['preview_title']; print "<form method=\"post\">"; foreach ($_POST as $name => $value) { if ($name != 'preview') { print "<input type=\"hidden\" name=\"{$name}\" value=\"" . htmlentities($value) . "\">"; } } printf($MESSAGES['ecard']['preview_html'], $to_email, $subject); $html = preg_replace("/=[\n\r]+/s", "\n", $matches[1][0]); $html = preg_replace("/=(\\w{2})/e", 'chr(hexdec("$1"))', $html); print $html;
if (strlen($msg) == 0) { $ok = false; $errors['msg'] = "Please enter a message to send"; } if (isSpam($msg)) { $ok = false; $errors['msg'] = "Sorry, this looks like spam"; } if (!$ok) { die("ERROR: " . implode('. ', $errors)); } $smarty->assign_by_ref('msg', $msg); $smarty->assign_by_ref('contactmail', $CONF['abuse_email']); $enc_from_name = mb_encode_mimeheader($from_name, $CONF['mail_charset'], $CONF['mail_transferencoding']); $smarty->assign('http_host', "{$_SERVER['HTTP_HOST']} on behalf of {$domain}"); $body = $smarty->fetch('email_usermsg.tpl'); $subject = "{$from_name} contacting you via {$domain}"; $encsubject = mb_encode_mimeheader($CONF['mail_subjectprefix'] . $subject, $CONF['mail_charset'], $CONF['mail_transferencoding']); $ip = getRemoteIP(); $hostname = trim(`hostname -f`); $received = "Received: from [{$ip}]" . " by {$hostname} " . "with HTTP;" . strftime("%d %b %Y %H:%M:%S -0000", time()) . "\n"; if (!empty($_REQUEST['client_ip']) && preg_match("/^[\\w\\.]+\$/", $_REQUEST['client_ip'])) { $received .= "Received: from [{$_REQUEST['client_ip']}]" . " by [{$id}] " . "with HTTP;" . strftime("%d %b %Y %H:%M:%S -0000", empty($_REQUEST['timestamp']) ? time() : intval($_REQUEST['timestamp'])) . "\n"; } $mime = "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset={$CONF['mail_charset']}\n" . "Content-Disposition: inline\n" . "Content-Transfer-Encoding: 8bit"; $from = "From: {$enc_from_name} <{$from_email}>\n"; $geofrom = "From: Geograph <{$CONF['mail_from']}>\n"; $envfrom = is_null($CONF['mail_envelopefrom']) ? null : "-f {$CONF['mail_envelopefrom']}"; if (preg_match('/(DORMANT|geograph\\.org\\.uk|geograph\\.co\\.uk|dev\\.null|deleted|localhost|127\\.0\\.0\\.1)/', $recipient->email)) { $email = $CONF['contact_email']; $body = "Sent as Geograph doesn't hold email address for this user [id {$recipient->user_id}]\n\n--\n\n" . $body;
$square = new GridSquare(); $grid_ok = $square->setGridRef($gridref); if ($grid_ok) { //find a possible place within 25km $smarty->assign('place', $square->findNearestPlace(75000)); if ($square->imagecount) { //todo use smarty caching //what style should we use? $style = $USER->getStyle(); $smarty->assign('maincontentclass', 'content_photo' . $style); $smarty->assign('backgroundcolor', $style); $images = $square->getImages(); $smarty->assign_by_ref('images', $images); } $smarty->assign('gridref', $gridref); $gridThumbs = $smarty->fetch("_discuss_gridref_cell.tpl"); } } } $numRows = $topicData[5]; $topicDesc = 0; $topic_reverse = ''; $srt = 'ASC'; if (isset($themeDesc) and in_array($topic, $themeDesc)) { $topicDesc = 1; $topic_reverse = "<img src=\"{$static_url}/img/topic_reverse.gif\" align=middle border=0 alt=\"\"> "; $srt = 'DESC'; } if ($page == -1 and $topicDesc == 0) { $page = pageChk($page, $numRows, $viewmaxreplys); } elseif ($page == -1 and $topicDesc == 1) {