$logged['member'] = member_auth(0, false); $_page['header'] = _t("_Tell a friend"); $_page['header_text'] = _t("_Tell a friend"); $profileID = (int) ($_GET['ID'] ? $_GET['ID'] : $_POST['ID']); if ($profileID > 0) { $yourID = (int) $_COOKIE['memberID']; if ($yourID > 0) { $your_arr = getProfileInfo($yourID); //db_arr("SELECT `NickName`, `Email` FROM `Profiles` WHERE `ID` = $yourID", 0); $yourName = $your_arr['NickName']; $yourEmail = $your_arr['Email']; } } // --------------- GET/POST actions if ($_POST['submit']) { if (SendTellFriend()) { $tell_friend_text = "<b>" . _t("_Email was successfully sent") . "</b>"; } else { $tell_friend_text = "<b style=\"color:red;\">" . _t("_Email sent failed") . "</b>"; } } else { if ($profileID > 0) { $tell_friend_text = _t("_TELLAFRIEND2", $site['title']); } else { $tell_friend_text = ''; } //_t("_TELLAFRIEND", $site['title']); } // --------------- page components $_ni = $_page['name_index']; $_page_cont[$_ni]['invite_friend_text'] = $tell_friend_text;
$profileID = (int) $_GET['ID']; } else { if (isset($_POST['ID'])) { $profileID = (int) $_POST['ID']; } } $iSenderID = getLoggedId(); $aSenderInfo = getProfileInfo($iSenderID); // --------------- page components $sCaption = $profileID ? _t('_TELLAFRIEND2', $site['title']) : _t('_TELLAFRIEND', $site['title']); $aForm = array('form_attrs' => array('id' => 'invite_friend', 'name' => 'invite_friend', 'action' => BX_DOL_URL_ROOT . 'tellfriend.php', 'method' => 'post', 'onsubmit' => "return bx_ajax_form_check(this)"), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sCaption), 'do_submit' => array('type' => 'hidden', 'name' => 'do_submit', 'value' => 1), 'id' => array('type' => 'hidden', 'name' => 'ID', 'value' => $profileID), 'sender_name' => array('type' => 'text', 'name' => 'sender_name', 'caption' => _t("_Your name"), 'value' => getNickName($aSenderInfo['ID'])), 'sender_email' => array('type' => 'text', 'name' => 'sender_email', 'caption' => _t("_Your email"), 'value' => $aSenderInfo['Email'], 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'recipient_email' => array('type' => 'text', 'name' => 'recipient_email', 'caption' => _t("_Friend email"), 'value' => '', 'checker' => array('func' => 'email', 'error' => _t('_sys_adm_form_err_required_field'))), 'submit_send' => array('type' => 'submit', 'name' => 'submit_send', 'value' => _t("_Send Letter")))); // generate form or form result content $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $s = SendTellFriend($iSenderID) ? "_Email was successfully sent" : "_Email sent failed"; $sPageCode = MsgBox(_t($s)); } else { $sPageCode = $oForm->getCode(); } // output AJAX form submission result if (bx_get('BxAjaxSubmit')) { header('Content-type:text/html;charset=utf-8'); echo $sPageCode; exit; } $sPageCode = $GLOBALS['oSysTemplate']->parseHtmlByName('default_margin.html', array('content' => $sPageCode)); // output ajax popup if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { $aVarsPopup = array('title' => $_page['header'], 'content' => $sPageCode); header('Content-type:text/html;charset=utf-8');