get($S->val['send_friend_template'], "global"), T_BYVAR); $tpl->assignInclude("BODY", $T->get($S->val['send_friend_template'], "sendfriend"), T_BYVAR); $tpl->assignInclude("MENU", $T->get($S->val['send_friend_template'], "menu"), T_BYVAR); $tpl->assignInclude("ARTICLES_PREVIEW", $T->get($S->val['send_friend_template'], "articles_preview"), T_BYVAR); $tpl->assignInclude("ITEMS_PREVIEW", $T->get($S->val['send_friend_template'], "items_preview"), T_BYVAR); $tpl->assignInclude("ARTICLE_RANDOM", $T->get($S->val['send_friend_template'], "article_random"), T_BYVAR); $tpl->assignInclude("ITEM_RANDOM", $T->get($S->val['send_friend_template'], "item_random"), T_BYVAR); $tpl->prepare(); $tpl->assign("Stylesheet", $T->get($S->val['send_friend_template'], "stylesheet")); $tpl->assign("Site_Name", $S->val['site_name']); $tpl->assign("Page_Title", "Send to friend"); $tpl->assign("Date", date($S->val['date_format'])); $HTML->make_menu_site($S->val['send_friend_template'], $tpl, $S, $C, $T); $HTML->make_preview_articles($tpl, $S, $C); $HTML->make_preview_items($tpl, $S, $C); $HTML->make_random_article($tpl, $S, $C); $HTML->make_random_item($tpl, $S, $C); if ( empty($_POST['action']) ) { $tpl->newBlock("email"); $tpl->assign("ref", $C->url . "/" . $_GET['from']); } if ( isset($_GET['error']) ) { $say = urldecode($_GET['error']); $tpl->newBlock("email2"); $tpl->assign("msg", $say); } //echo "
" . $_GET['from']; if ( !empty($_POST['action']) && $_POST['action'] == 'send' ) { if ( strpos($_SERVER['HTTP_REFERER'], $_SERVER['PHP_SELF']) > 0 ) { // captcha validation: session_start(); require_once "control/modules/captcha/class.Captcha.php"; $captcha = new Captcha(); if ( empty($_POST['captcha']) || !$captcha->validate_code($_POST['captcha']) ) { header("Location: sendemail.php?error=Send Failed!"); exit(); } $to = $_POST['email']; $return = $_POST['returnemail']; $text = "Your Colleague, " . $_POST['name'] . ", requested that we email you this information. \n\nThey say: \"" . $_POST['comment'] . "\"\n\nClick on this link: " . $_POST['url']; $subject = "Read this article at " . $S->val['site_name']; $headers = "From: ".$return . "\r\n" . "Reply-To: " . $return; $check = mail($to, $subject, $text, $headers); if (!$check) { $say = "There was an error sending the email. The email as not been sent."; } else { $say = "Your E-mail has been sent to $email"; } $tpl->newBlock("email2"); $tpl->assign("msg", $say); } else { $FV->error("Invalid Server Request From '" . $_SERVER['HTTP_REFERER'] . "'", $C); } } $end = benchit(); $tpl->assignGlobal("C_Time", round($end - $start, 3)); $tpl->assignGlobal("S_Time", date("H:i:s")); $tpl->assignGlobal("Q_Count", $DB->num_queries['total']); $tpl->printToScreen(); ?>