本文整理汇总了PHP中BxDolEmailTemplates::getTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolEmailTemplates::getTemplate方法的具体用法?PHP BxDolEmailTemplates::getTemplate怎么用?PHP BxDolEmailTemplates::getTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolEmailTemplates
的用法示例。
在下文中一共展示了BxDolEmailTemplates::getTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendTellFriend
/**
* send "tell a friend" email
*/
function SendTellFriend($iSenderID = 0)
{
global $profileID;
$sRecipient = clear_xss($_POST['friends_emails']);
$sSenderName = clear_xss($_POST['name']);
$sSenderEmail = clear_xss($_POST['email']);
if (strlen(trim($sRecipient)) <= 0) {
return 0;
}
if (strlen(trim($sSenderEmail)) <= 0) {
return 0;
}
$sLinkAdd = $iSenderID > 0 ? 'idFriend=' . $iSenderID : '';
$rEmailTemplate = new BxDolEmailTemplates();
if ($profileID) {
$aTemplate = $rEmailTemplate->getTemplate('t_TellFriendProfile', $profileID);
$Link = getProfileLink($profileID, $sLinkAdd);
} else {
$aTemplate = $rEmailTemplate->getTemplate('t_TellFriend');
$Link = BX_DOL_URL_ROOT;
if (strlen($sLinkAdd) > 0) {
$Link .= '?' . $sLinkAdd;
}
}
$aPlus = array('Link' => $Link, 'FromName' => $sSenderName);
return sendMail($sRecipient, $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
示例2: SendTellFriend
/**
* send "tell a friend" email
*/
function SendTellFriend($iSenderID = 0)
{
global $profileID;
$sSenderEmail = clear_xss(bx_get('sender_email'));
if (strlen(trim($sSenderEmail)) <= 0) {
return 0;
}
$sSenderName = clear_xss(bx_get('sender_name'));
$sSenderLink = $iSenderID != 0 ? getProfileLink($iSenderID) : BX_DOL_URL_ROOT;
$sRecipientEmail = clear_xss(bx_get('recipient_email'));
if (strlen(trim($sRecipientEmail)) <= 0) {
return 0;
}
$sLinkAdd = $iSenderID > 0 ? 'idFriend=' . $iSenderID : '';
$rEmailTemplate = new BxDolEmailTemplates();
if ($profileID) {
$aTemplate = $rEmailTemplate->getTemplate('t_TellFriendProfile', getLoggedId());
$Link = getProfileLink($profileID, $sLinkAdd);
} else {
$aTemplate = $rEmailTemplate->getTemplate('t_TellFriend', getLoggedId());
$Link = BX_DOL_URL_ROOT;
if (strlen($sLinkAdd) > 0) {
$Link .= '?' . $sLinkAdd;
}
}
return sendMail($sRecipientEmail, $aTemplate['Subject'], $aTemplate['Body'], '', array('Link' => $Link, 'SenderName' => $sSenderName, 'SenderLink' => $sSenderLink));
}
示例3: onPostReply
function onPostReply($aTopic, $sPostText, $sUser)
{
$oProfile = new BxDolProfile($sUser);
$iProfileId = $oProfile->getID();
if (BX_ORCA_INTEGRATION == 'dolphin' && !isAdmin($iProfileId)) {
defineForumActions();
$iActionId = BX_FORUM_PUBLIC_POST;
if (isset($aTopic['forum_type']) && 'private' == $aTopic['forum_type']) {
$iActionId = BX_FORUM_PRIVATE_POST;
}
checkAction($iProfileId, $iActionId, true);
// perform action
}
$aPlusOriginal = array('PosterUrl' => $iProfileId ? getProfileLink($iProfileId) : 'javascript:void(0);', 'PosterNickName' => $iProfileId ? getNickName($iProfileId) : $sUser, 'TopicTitle' => $aTopic['topic_title'], 'ReplyText' => $sPostText);
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate->getTemplate('bx_forum_notifier');
$fdb = new DbForum();
$a = $fdb->getSubscribersToTopic($aTopic['topic_id']);
foreach ($a as $r) {
if ($r['user'] == $sUser) {
continue;
}
$oRecipient = new BxDolProfile($r['user']);
$aRecipient = getProfileInfo($oRecipient->_iProfileID);
$aPlus = array_merge(array('Recipient' => ' ' . getNickName($aRecipient['ID'])), $aPlusOriginal);
sendMail(trim($aRecipient['Email']), $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
forumAlert('reply', $aTopic['topic_id'], $iProfileId);
}
示例4: processing
function processing()
{
$oModules = new BxDolModuleDb();
$aModules = $oModules->getModules();
$aResult = array();
foreach ($aModules as $aModule) {
$aCheckInfo = BxDolInstallerUi::checkForUpdates($aModule);
if (isset($aCheckInfo['version'])) {
$aResult[] = _t('_adm_txt_modules_update_text_ext', $aModule['title'], $aCheckInfo['version']);
}
}
if (empty($aResult)) {
return;
}
$aAdmins = $GLOBALS['MySQL']->getAll("SELECT * FROM `Profiles` WHERE `Role`&" . BX_DOL_ROLE_ADMIN . "<>0 AND `EmailNotify`='1'");
if (empty($aAdmins)) {
return;
}
$oEmailTemplate = new BxDolEmailTemplates();
$sMessage = implode('<br />', $aResult);
foreach ($aAdmins as $aAdmin) {
$aTemplate = $oEmailTemplate->getTemplate('t_ModulesUpdates', $aAdmin['ID']);
sendMail($aAdmin['Email'], $aTemplate['Subject'], $aTemplate['Body'], $aAdmin['ID'], array('MessageText' => $sMessage));
}
}
示例5: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode($iID, $sConfCode)
{
global $site;
$ID = (int) $iID;
$ConfCode = clear_xss($sConfCode);
$p_arr = getProfileInfo($ID);
if (!$p_arr) {
$_page['header'] = _t("_Error");
$_page['header_text'] = _t("_Profile Not found");
return MsgBox(_t('_Profile Not found Ex'));
}
$aCode = array('message_status' => '', 'message_info' => '', 'bx_if:form' => array('condition' => false, 'content' => array('form' => '')), 'bx_if:next' => array('condtion' => false, 'content' => array('next_url' => '')));
if ($p_arr['Status'] == 'Unconfirmed') {
$ConfCodeReal = base64_encode(base64_encode(crypt($p_arr[Email], CRYPT_EXT_DES ? "secret_co" : "se")));
if (strcmp($ConfCode, $ConfCodeReal) != 0) {
$aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'profile_activate.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('conf_id' => array('type' => 'hidden', 'name' => 'ConfID', 'value' => $ID), 'conf_code' => array('type' => 'text', 'name' => 'ConfCode', 'value' => '', 'caption' => _t("_Confirmation code")), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Submit"))));
$oForm = new BxTemplFormView($aForm);
$aCode['message_status'] = _t("_Profile activation failed");
$aCode['message_info'] = _t("_EMAIL_CONF_FAILED_EX");
$aCode['bx_if:form']['condition'] = true;
$aCode['bx_if:form']['content']['form'] = $oForm->getCode();
} else {
$aCode['bx_if:next']['condition'] = true;
$aCode['bx_if:next']['content']['next_url'] = BX_DOL_URL_ROOT . 'member.php';
$send_act_mail = false;
if (getParam('autoApproval_ifJoin') == 'on' && !(getParam('sys_dnsbl_enable') && 'approval' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join'))) {
$status = 'Active';
$send_act_mail = true;
$aCode['message_info'] = _t("_PROFILE_CONFIRM");
} else {
$status = 'Approval';
$aCode['message_info'] = _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
}
$update = bx_admin_profile_change_status($ID, $status, $send_act_mail);
// Promotional membership
if (getParam('enable_promotion_membership') == 'on') {
$memership_days = getParam('promotion_membership_days');
setMembership($p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
}
// check couple profile;
if ($p_arr['Couple']) {
$update = bx_admin_profile_change_status($p_arr['Couple'], $status);
//Promotional membership
if (getParam('enable_promotion_membership') == 'on') {
$memership_days = getParam('promotion_membership_days');
setMembership($p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
}
}
if (getParam('newusernotify')) {
$oEmailTemplates = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed', $p_arr['ID']);
sendMail($site['email_notify'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']);
}
}
} else {
$aCode['message_info'] = _t('_ALREADY_ACTIVATED');
}
return $GLOBALS['oSysTemplate']->parseHtmlByName('profile_activate.html', $aCode);
}
示例6: onPostReply
function onPostReply($aTopic, $sPostText, $sUser)
{
$oProfile = new BxDolProfile($sUser);
$aPlusOriginal = array('PosterUrl' => $oProfile->_iProfileID ? getProfileLink($oProfile->_iProfileID) : 'javascript:void(0);', 'PosterNickName' => $sUser, 'TopicTitle' => $aTopic['topic_title'], 'ReplyText' => $sPostText);
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate->getTemplate('bx_forum_notifier');
$fdb = new DbForum();
$a = $fdb->getSubscribersToTopic($aTopic['topic_id']);
foreach ($a as $r) {
if ($r['user'] == $sUser) {
continue;
}
$oRecipient = new BxDolProfile($r['user']);
$aRecipient = getProfileInfo($oRecipient->_iProfileID);
$aPlus = array_merge(array('Recipient' => ' ' . $aRecipient['NickName']), $aPlusOriginal);
sendMail(trim($aRecipient['Email']), $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
$oAlert = new BxDolAlerts('bx_forum', 'reply', $aTopic['topic_id']);
$oAlert->alert();
}
示例7: mem_expiration_letter
function mem_expiration_letter($ID, $membership_name, $expire_days)
{
$ID = (int) $ID;
if (!$ID) {
return false;
}
$p_arr = db_arr("SELECT `Email` FROM `Profiles` WHERE `ID` = {$ID}", 0);
if (!$p_arr) {
return false;
}
bx_import('BxDolEmailTemplates');
$rEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $rEmailTemplate->getTemplate('t_MemExpiration', $ID);
$recipient = $p_arr['Email'];
$aPlus = array();
$aPlus['MembershipName'] = $membership_name;
$aPlus['ExpireDays'] = $expire_days;
$mail_ret = sendMail($recipient, $aTemplate['Subject'], $aTemplate['Body'], $ID, $aPlus);
if ($mail_ret) {
return true;
} else {
return false;
}
}
示例8: MemberFreeEmail
function MemberFreeEmail($recipientID, $profile)
{
global $site;
$anon_mode = getParam('anon_mode');
$recipientID = (int) $recipientID;
$aRecipientArr = db_arr("SELECT `Email` FROM `Profiles` WHERE `ID` = '{$recipientID}' AND `Status` = 'Active'", 0);
if (isBlocked($profile['ID'], $recipientID)) {
return 25;
}
if (!db_arr("SELECT `ID` FROM `Profiles` WHERE `ID` = '{$profile['ID']}' AND `Status` = 'Active'", 0)) {
return 7;
}
if ($anon_mode) {
return 20;
}
$rEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $rEmailTemplate->getTemplate('t_FreeEmail', $recipientID);
if ($recipientID) {
$recipient = $aRecipientArr['Email'];
} else {
if ($_GET['Email']) {
$recipient = $_GET['Email'];
} else {
return 45;
}
}
$contact_info = "Email: {$profile['Email']}";
if (strlen($profile['Phone'])) {
$contact_info .= "\nPhone: {$profile['Phone']}";
}
if (strlen($profile['HomeAddress'])) {
$contact_info .= "\nHomeAddress: {$profile['HomeAddress']}";
}
if (strlen($profile['HomePage'])) {
$contact_info .= "\nHomePage: {$profile['HomePage']}";
}
if (strlen($profile['IcqUIN'])) {
$contact_info .= "\nICQ: {$profile['IcqUIN']}";
}
$aPlus = array();
$aPlus['profileContactInfo'] = $contact_info;
$aPlus['profileNickName'] = getNickName($profile['ID']);
$aPlus['profileID'] = $profile['ID'];
$mail_ret = sendMail($aRecipientArr['Email'], $aTemplate['Subject'], $aTemplate['Body'], $recipientID, $aPlus, 'html', false, true);
if ($mail_ret) {
checkAction($memberID, ACTION_ID_GET_EMAIL, true);
} else {
return 10;
}
return 0;
}
示例9: sendMessage
/**
* Function will send the compose message ;
*
* @param : $sMessageSubject (string) - message's subject ;
* @param : $sMessageBody (string) - message's body ;
* @param : $vRecipientID (variant)- message's recipient ID or NickName;
* @param : $aComposeSettings (array) - contain all needed settings for compose message ;
* [ send_copy ] (bolean) - allow to send message to phisical recipient's email ;
* [ notification ] (boolean) - allow to send notification to the recipient's email ;
* [ send_copy_to_me ] (boolean) - allow to send message to phisical sender's email ;
* @return : signaling information with Html ;
*/
function sendMessage($sMessageSubject, $sMessageBody, $vRecipientID, &$aComposeSettings, $isSimulateSending = false)
{
$sMessageSubject = process_db_input($sMessageSubject, BX_TAGS_STRIP);
$sMessageSubjectCopy = $GLOBALS['MySQL']->unescape($sMessageSubject);
$sMessageBody = process_db_input($sMessageBody, BX_TAGS_VALIDATE);
$sCopyMessage = $GLOBALS['MySQL']->unescape($sMessageBody);
if (!$isSimulateSending && (!$sMessageSubject || !$sMessageBody)) {
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED;
return MsgBox(_t('_please_fill_next_fields_first'));
}
// init some needed variables ;
$sReturnMessage = null;
$sComposeUrl = BX_DOL_URL_ROOT . 'mail.php?mode=compose';
// try to define member's ID ;
$iRecipientID = (int) getId($vRecipientID);
if (!$iRecipientID) {
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_UNKNOWN_RECIPIENT;
return MsgBox(_t('_Profile not found'));
}
$aRecipientInfo = getProfileInfo($iRecipientID);
$oEmailTemplate = new BxDolEmailTemplates();
$bAllowToSend = true;
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED;
// ** check permission for recipient member ;
// Check if member is blocked ;
$sQuery = "\n SELECT\n `ID`, `Profile`\n FROM\n `sys_block_list`\n WHERE\n `Profile` = {$this->aMailBoxSettings['member_id']}\n AND\n `ID` = '{$iRecipientID}'\n ";
if (!isAdmin($this->aMailBoxSettings['member_id']) && db_arr($sQuery)) {
$sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE_BLOCK'));
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_BLOCKED;
$bAllowToSend = false;
}
// antispam check ;
$sQuery = "\n SELECT\n `ID`\n FROM\n `sys_messages`\n WHERE\n `Sender` = {$this->aMailBoxSettings['member_id']}\n AND\n date_add(`Date`, INTERVAL {$this->iWaitMinutes} MINUTE) > Now()\n ";
if (db_arr($sQuery)) {
$sReturnMessage = MsgBox(_t('_You have to wait for PERIOD minutes before you can write another message!', $this->iWaitMinutes, $sComposeUrl));
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_WAIT;
$bAllowToSend = false;
}
// additional antispam check ;
if (bx_is_spam($sCopyMessage)) {
$sReturnMessage = MsgBox(sprintf(_t("_sys_spam_detected"), BX_DOL_URL_ROOT . 'contact.php'));
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED;
$bAllowToSend = false;
}
// check if member not active ;
if ($aRecipientInfo['Status'] != 'Active') {
$sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE_NOT_ACTIVE', $sComposeUrl));
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_RECIPIENT_NOT_ACTIVE;
$bAllowToSend = false;
}
// chek membership level;
if (!$this->isSendMessageAlowed($this->aMailBoxSettings['member_id'], $isSimulateSending ? false : true)) {
$sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE_MEMBERSHIP_DISALLOW'));
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED_MEMBERSHIP_DISALLOW;
$bAllowToSend = false;
}
// ** allow to send message ;
if (!$isSimulateSending && $bAllowToSend) {
$sQuery = "\n INSERT INTO\n `sys_messages`\n SET\n `Sender` = {$this->aMailBoxSettings['member_id']},\n `Recipient` = {$iRecipientID},\n `Subject` = '{$sMessageSubject}',\n `Text` = '{$sMessageBody}',\n `Date` = NOW(),\n `New` = '1',\n `Type` = 'letter'\n ";
if (db_res($sQuery)) {
$sReturnMessage = MsgBox(_t('_MESSAGE_SENT', $sComposeUrl, getProfileLink($iRecipientID), $aRecipientInfo['NickName']));
$this->iSendMessageStatusCode = BX_MAILBOX_SEND_SUCCESS;
//--- create system event
bx_import('BxDolAlerts');
$aAlertData = array('msg_id' => db_last_id(), 'subject' => $sMessageSubjectCopy, 'body' => $sCopyMessage, 'send_copy' => $aComposeSettings['send_copy'], 'notification' => $aComposeSettings['notification'], 'send_copy_to_me' => $aComposeSettings['send_copy_to_me']);
$oZ = new BxDolAlerts('profile', 'send_mail_internal', $this->aMailBoxSettings['member_id'], $iRecipientID, $aAlertData);
$oZ->alert();
// ** check the additional parameters ;
// send message to phisical recipient's email ;
if ($aComposeSettings['send_copy']) {
$aTemplate = $oEmailTemplate->getTemplate('t_Message', $iRecipientID);
$aPlus = array();
$aPlus['MessageText'] = replace_full_uris($sCopyMessage);
$aPlus['ProfileReference'] = getNickName($this->aMailBoxSettings['member_id']);
$aPlus['ProfileUrl'] = getProfileLink($this->aMailBoxSettings['member_id']);
sendMail($aRecipientInfo['Email'], $sMessageSubjectCopy, $aTemplate['Body'], $iRecipientID, $aPlus);
}
// send notification to the recipient's email ;
if ($aComposeSettings['notification']) {
$aTemplate = $oEmailTemplate->getTemplate('t_Compose', $iRecipientID);
$aPlus['ProfileReference'] = getNickName($this->aMailBoxSettings['member_id']);
$aPlus['ProfileUrl'] = getProfileLink($this->aMailBoxSettings['member_id']);
sendMail($aRecipientInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], $iRecipientID, $aPlus);
}
// allow to send message to phisical sender's email;
if ($aComposeSettings['send_copy_to_me']) {
$aSenderInfo = getProfileInfo($this->aMailBoxSettings['member_id']);
$aTemplate = $oEmailTemplate->getTemplate('t_MessageCopy', $this->aMailBoxSettings['member_id']);
//.........这里部分代码省略.........
示例10: bx_is_spam
/**
* spam checking function
* @param $s content to check for spam
* @param $isStripSlashes slashes parameter:
* BX_SLASHES_AUTO - automatically detect magic_quotes_gpc setting
* BX_SLASHES_NO_ACTION - do not perform any action with slashes
* @return true if spam detected
*/
function bx_is_spam($val, $isStripSlashes = BX_SLASHES_AUTO)
{
if (defined('BX_DOL_CRON_EXECUTE')) {
return false;
}
if (isAdmin()) {
return false;
}
if (bx_is_ip_whitelisted()) {
return false;
}
if (get_magic_quotes_gpc() && $isStripSlashes == BX_SLASHES_AUTO) {
$val = stripslashes($val);
}
$bRet = false;
if ('on' == getParam('sys_uridnsbl_enable')) {
$oBxDolDNSURIBlacklists = bx_instance('BxDolDNSURIBlacklists');
if ($oBxDolDNSURIBlacklists->isSpam($val)) {
$oBxDolDNSURIBlacklists->onPositiveDetection($val);
$bRet = true;
}
}
if ('on' == getParam('sys_akismet_enable')) {
$oBxDolAkismet = bx_instance('BxDolAkismet');
if ($oBxDolAkismet->isSpam($val)) {
$oBxDolAkismet->onPositiveDetection($val);
$bRet = true;
}
}
if ($bRet && 'on' == getParam('sys_antispam_report')) {
bx_import('BxDolEmailTemplates');
$oEmailTemplates = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplates->getTemplate('t_SpamReportAuto', 0);
$iProfileId = getLoggedId();
$aPlus = array('SpammerUrl' => getProfileLink($iProfileId), 'SpammerNickName' => getNickName($iProfileId), 'Page' => htmlspecialchars_adv($_SERVER['PHP_SELF']), 'Get' => print_r($_GET, true), 'SpamContent' => htmlspecialchars_adv($val));
sendMail($GLOBALS['site']['email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
if ($bRet && 'on' == getParam('sys_antispam_block')) {
return true;
}
return false;
}
示例11: BxDolStopForumSpam
/**
* Create new profile;
*
* @param : $aProfileInfo (array) - remote profile's information;
*
* @param : $sAlternativeName (string) - profiles alternative nickname;
* @return : error string or error or profile info array on success
*/
function _createProfileRaw($aProfileInfo, $sAlternativeName = '', $isAutoFriends = true, $isSetLoggedIn = true)
{
$sCountry = '';
$sCity = '';
// join by invite only
if (getParam('reg_by_inv_only') == 'on' && (!isset($_COOKIE['idFriend']) || getID($_COOKIE['idFriend']) == 0)) {
return _t('_registration by invitation only');
}
// convert fields
$aProfileFields = $this->_convertRemoteFields($aProfileInfo, $sAlternativeName);
if (empty($aProfileFields['Email'])) {
return _t('_Incorrect Email');
}
// antispam check
bx_import('BxDolStopForumSpam');
$oBxDolStopForumSpam = new BxDolStopForumSpam();
if (2 == getParam('ipBlacklistMode') && bx_is_ip_blocked()) {
return _t('_Sorry, your IP been banned');
} elseif ('on' == getParam('sys_dnsbl_enable') && 'block' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join oauth') || $oBxDolStopForumSpam->isSpammer(array('email' => $aProfileFields['Email'], 'ip' => getVisitorIP(false)), 'join oauth')) {
return sprintf(_t('_sys_spam_detected'), BX_DOL_URL_ROOT . 'contact.php');
}
// check fields existence;
foreach ($aProfileFields as $sKey => $mValue) {
if (!$this->_oDb->isFieldExist($sKey)) {
// (field not existence) remove from array;
unset($aProfileFields[$sKey]);
}
}
// add some system values
$sNewPassword = genRndPwd();
$sPasswordSalt = genRndSalt();
$aProfileFields['Password'] = encryptUserPwd($sNewPassword, $sPasswordSalt);
$aProfileFields['Role'] = BX_DOL_ROLE_MEMBER;
$aProfileFields['DateReg'] = date('Y-m-d H:i:s');
// set current date;
$aProfileFields['Salt'] = $sPasswordSalt;
// set default privacy
bx_import('BxDolPrivacyQuery');
$oPrivacy = new BxDolPrivacyQuery();
$aProfileFields['allow_view_to'] = $oPrivacy->getDefaultValueModule('profile', 'view_block');
// check if user with the same email already exists
$iExistingProfileId = $this->_oDb->isEmailExisting($aProfileFields['Email']);
// check redirect page
if ('join' == $this->_oConfig->sRedirectPage && !$iExistingProfileId) {
return array('remote_profile_info' => $aProfileInfo, 'profile_fields' => $aProfileFields, 'join_page_redirect' => true);
}
// create new profile
if ($iExistingProfileId) {
$iProfileId = $iExistingProfileId;
} else {
$iProfileId = $this->_oDb->createProfile($aProfileFields);
}
$oProfileFields = new BxDolProfilesController();
// remember remote profile id for created member
$this->_oDb->saveRemoteId($iProfileId, $aProfileInfo['id']);
// check profile status;
if (!$iExistingProfileId) {
if (getParam('autoApproval_ifNoConfEmail') == 'on') {
if (getParam('autoApproval_ifJoin') == 'on') {
$sProfileStatus = 'Active';
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendActivationMail($iProfileId);
}
} else {
$sProfileStatus = 'Approval';
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendApprovalMail($iProfileId);
}
}
} else {
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendConfMail($iProfileId);
$sProfileStatus = 'Unconfirmed';
} else {
if (getParam('autoApproval_ifJoin') == 'on') {
$sProfileStatus = 'Active';
} else {
$sProfileStatus = 'Approval';
}
}
}
// update profile's status;
$this->_oDb->updateProfileStatus($iProfileId, $sProfileStatus);
$oProfileFields->createProfileCache($iProfileId);
// send email notification
if (!empty($aProfileInfo['email'])) {
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate->getTemplate($this->_oConfig->sEmailTemplatePasswordGenerated, $iProfileId);
$aNewProfileInfo = getProfileInfo($iProfileId);
$aPlus = array('NickName' => getNickName($aNewProfileInfo['ID']), 'NewPassword' => $sNewPassword);
sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
//.........这里部分代码省略.........
示例12: isset
//.........这里部分代码省略.........
//check email
if ($this->_oDb->isEmailExisting($sEmail)) {
return _t('_bx_facebook_error_email');
}
//ini_set("display_errors", "1");
//print_r($aProfileInfo); exit;
//-- fill array with all needed values --//
$aProfileFields = array('FacebookProfile' => $aProfileInfo['id'], 'NickName' => $aProfileInfo['nick_name'] . $sAlternativeName, 'Email' => $sEmail, 'Sex' => isset($aProfileInfo['gender']) ? $aProfileInfo['gender'] : '', 'DateOfBirth' => isset($aProfileInfo['birthday']) ? $aProfileInfo['birthday'] : '', 'Password' => isset($aProfileInfo['password']) ? $aProfileInfo['password'] : '', 'FirstName' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'LastName' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'DescriptionMe' => isset($aProfileInfo['bio']) ? $aProfileInfo['bio'] : '', 'Interests' => isset($aProfileInfo['interests']) ? $aProfileInfo['interests'] : '', 'Religion' => isset($aProfileInfo['religion']) ? $aProfileInfo['religion'] : '', 'Country' => $sCountry, 'City' => $sCity);
//--
$aEdirectoryProfileFields = array('facebook_uid' => $aProfileInfo['id'], 'nickname' => $aProfileInfo['nick_name'] . $sAlternativeName, 'personal_message' => isset($aProfileInfo['bio']) ? $aProfileInfo['bio'] : '', 'facebook_image' => isset($aProfileInfo['picture']) ? $aProfileInfo['picture'] : '', 'facebook_image_width' => '100', 'facebook_image_height' => '100', 'location' => $sCity);
$thisusername = $aProfileInfo['first_name'] . $aProfileInfo['last_name'];
//$thisusername = utf8_encode ( $thisusername );
$aAccountFields = array('facebook_username' => "facebook::" . $thisusername . "_" . $aProfileInfo['id'], 'username' => "facebook::" . $thisusername . "_" . $aProfileInfo['id'], 'has_profile' => 'y', 'active' => 'y', 'foreignaccount' => 'y', 'foreignaccount_done' => 'y', 'password' => isset($aProfileInfo['password']) ? $aProfileInfo['password'] : '', 'updated' => date('Y-m-d H:i:s'), 'entered' => date('Y-m-d H:i:s'), 'agree_tou' => '1');
$aAccountProfileContactFields = array('username' => "facebook::" . $thisusername . "_" . $aProfileInfo['id'], 'has_profile' => 'y', 'nickname' => $aProfileInfo['first_name'] . " " . $aProfileInfo['last_name'], 'first_name' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'last_name' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'facebook_image_width' => '100', 'facebook_image_height' => '100');
$aContactFields = array('email' => $sEmail, 'first_name' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'last_name' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'country' => $sCountry, 'city' => $sCity);
bx_import('BxDolStopForumSpam');
$oBxDolStopForumSpam = new BxDolStopForumSpam();
if (2 == getParam('ipBlacklistMode') && bx_is_ip_blocked()) {
return _t('_Sorry, your IP been banned');
} elseif ('on' == getParam('sys_dnsbl_enable') && 'block' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join facebook') || $oBxDolStopForumSpam->isSpammer(array('email' => $aProfileFields['Email'], 'ip' => getVisitorIP(false)), 'join facebook')) {
return sprintf(_t('_sys_spam_detected'), BX_DOL_URL_ROOT . 'contact.php');
}
// check fields existence;
foreach ($aProfileFields as $sKey => $mValue) {
if (!$this->_oDb->isFieldExist($sKey)) {
// (field not existence) remove from array;
unset($aProfileFields[$sKey]);
}
}
//-- add some system values --//
$aProfileFields['Role'] = BX_DOL_ROLE_MEMBER;
$aProfileFields['DateReg'] = date('Y-m-d H:i:s');
// set current date;
$aProfileFields['Salt'] = $sPasswordSalt;
//--
//check redirect page
if ('join' == $this->_oConfig->sRedirectPage) {
return array('profile_info_fb' => $aProfileInfo, 'profile_fields' => $aProfileFields, 'join_page_redirect' => true);
}
// create new profile;
$iProfileId = $this->_oDb->createProfile($aProfileFields);
$this->_oDb->EdirctorycreateProfile($aAccountFields, $aEdirectoryProfileFields, $aContactFields, $aAccountProfileContactFields);
$oProfileFields = new BxDolProfilesController();
//remember FB uid for created member
$this->_oDb->saveFbUid($iProfileId, $aProfileInfo['id']);
// check profile status;
if (getParam('autoApproval_ifNoConfEmail') == 'on') {
if (getParam('autoApproval_ifJoin') == 'on') {
$sProfileStatus = 'Active';
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendActivationMail($iProfileId);
}
} else {
$sProfileStatus = 'Approval';
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendApprovalMail($iProfileId);
}
}
} else {
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendConfMail($iProfileId);
$sProfileStatus = 'Unconfirmed';
} else {
if (getParam('autoApproval_ifJoin') == 'on') {
$sProfileStatus = 'Active';
} else {
$sProfileStatus = 'Approval';
}
}
}
// update profile's status;
$this->_oDb->updateProfileStatus($iProfileId, $sProfileStatus);
$oProfileFields->createProfileCache($iProfileId);
if (!empty($aProfileInfo['email'])) {
//-- send email notification --//
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate->getTemplate('t_fb_connect_password_generated');
$aNewProfileInfo = getProfileInfo($iProfileId);
$aPlus = array('NickName' => getNickName($aNewProfileInfo['ID']), 'NewPassword' => $sNewPassword);
sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
//--
bx_member_ip_store($iProfileId);
if (BxDolModule::getInstance('BxWmapModule')) {
BxDolService::call('wmap', 'response_entry_add', array('profiles', $iProfileId));
}
// create system event
$oZ = new BxDolAlerts('profile', 'join', $iProfileId);
$oZ->alert();
// auto-friend members if they are already friends on Facebook
if ($isAutoFriends) {
$this->_makeFriends($iProfileId);
}
// set logged
if ($isSetLoggedIn) {
$aProfile = getProfileInfo($iProfileId);
$this->setLogged($iProfileId, $aProfile['Password'], '', false);
}
return array('profile_info_fb' => $aProfileInfo, 'profile_id' => $iProfileId);
}
示例13: BxDolAlerts
/**
* Function will set status as `accepted` for friend request ;
*
* @param : $sTableName (string) - DB table's name ;
* @param : $iMemberID (integer) - member's ID ;
*/
function _acceptFriendInvite($sTableName, $iMemberID)
{
$sTableName = process_db_input($sTableName, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION);
$iMemberID = (int) $iMemberID;
$iAccepted = (int) db_value("SELECT `Check` FROM `{$sTableName}` WHERE `ID`={$iMemberID} AND `Profile`={$this->aCommunicatorSettings['member_id']} LIMIT 1");
if ($iAccepted == 1) {
return;
}
db_res("UPDATE `{$sTableName}` SET `Check`=1 WHERE `ID`={$iMemberID} AND `Profile`={$this->aCommunicatorSettings['member_id']}");
//--- Friend -> Accept for Alerts Engine --//
$oZ = new BxDolAlerts('friend', 'accept', $iMemberID, $this->aCommunicatorSettings['member_id']);
$oZ->alert();
//--- Friend -> Accept for Alerts Engine --//
//--- Send email notification ---//
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate->getTemplate('t_FriendRequestAccepted', $iMemberID);
$aRecipient = getProfileInfo($iMemberID);
sendMail($aRecipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', array('Recipient' => getNickName($aRecipient['ID']), 'SenderLink' => getProfileLink($this->aCommunicatorSettings['member_id']), 'Sender' => getNickName($this->aCommunicatorSettings['member_id'])));
//--- Send email notification ---//
}
示例14: _sendSpamReport
/**
* Send spam report
*
* @param $iProfileId integer
* @param $iMemberId integer
* @return text - error message
*/
function _sendSpamReport($iProfileId, $iMemberId)
{
global $site;
$iProfileId = (int) $iProfileId;
$iMemberId = $iMemberId ? (int) $iMemberId : -1;
if (!$iMemberId || !getProfileInfo($iMemberId)) {
return MsgBox(_t('_Failed to apply changes'));
}
//get email template
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate->getTemplate('t_SpamReport');
//-- get reporter information --//
$aReporter = getProfileInfo($iProfileId);
$aPlus = array();
$aPlus['reporterID'] = $iProfileId;
$aPlus['reporterNick'] = getNickName($aReporter['ID']);
//--
//-- get spamer info --//
$aSpamerInfo = getProfileInfo($iMemberId);
$aPlus['spamerID'] = $iMemberId;
$aPlus['spamerNick'] = getNickName($aSpamerInfo['ID']);
//--
//send message about spam
if (!sendMail($site['email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus)) {
return MsgBox(_t('_Report about spam failed to sent'));
}
}
示例15: isset
//.........这里部分代码省略.........
} else {
if (isset($aProfileInfo['hometown']['name'])) {
$aLocation = $aProfileInfo['hometown']['name'];
}
}
if ($aLocation) {
$aCountryInfo = explode(',', $aLocation);
$sCountry = $this->_oDb->getCountryCode(trim($aCountryInfo[1]));
$sCity = trim($aCountryInfo[0]);
//set default country name, especially for American brothers
if ($sCity && !$sCountry) {
$sCountry = $this->_oConfig->sDefaultCountryCode;
}
}
//--
//try define the user's email
$sEmail = !empty($aProfileInfo['email']) ? $aProfileInfo['email'] : $aProfileInfo['proxied_email'];
//check email
if ($this->_oDb->isEmailExisting($sEmail)) {
return _t('_bx_facebook_error_email');
}
//-- fill array with all needed values --//
$aProfileFields = array('NickName' => $aProfileInfo['nick_name'] . $sAlternativeName, 'Email' => $sEmail, 'Sex' => isset($aProfileInfo['gender']) ? $aProfileInfo['gender'] : '', 'DateOfBirth' => $aProfileInfo['birthday'], 'Password' => $aProfileInfo['password'], 'FirstName' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'LastName' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'DescriptionMe' => isset($aProfileInfo['bio']) ? $aProfileInfo['bio'] : '', 'Interests' => isset($aProfileInfo['interests']) ? $aProfileInfo['interests'] : '', 'Religion' => isset($aProfileInfo['religion']) ? $aProfileInfo['religion'] : '', 'Country' => $sCountry, 'City' => $sCity);
//--
// check fields existence;
foreach ($aProfileFields as $sKey => $mValue) {
if (!$this->_oDb->isFieldExist($sKey)) {
// (field not existence) remove from array;
unset($aProfileFields[$sKey]);
}
}
//-- add some system values --//
$aProfileFields['Role'] = BX_DOL_ROLE_MEMBER;
$aProfileFields['DateReg'] = date('Y-m-d H:i:s');
// set current date;
$aProfileFields['Salt'] = $sPasswordSalt;
//--
//check redirect page
if ('join' == $this->_oConfig->sRedirectPage) {
return array('profile_info_fb' => $aProfileInfo, 'profile_fields' => $aProfileFields, 'join_page_redirect' => true);
}
// create new profile;
$iProfileId = $this->_oDb->createProfile($aProfileFields);
$oProfileFields = new BxDolProfilesController();
//remember FB uid for created member
$this->_oDb->saveFbUid($iProfileId, $aProfileInfo['id']);
// check profile status;
if (getParam('autoApproval_ifNoConfEmail') == 'on') {
if (getParam('autoApproval_ifJoin') == 'on') {
$sProfileStatus = 'Active';
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendActivationMail($iProfileId);
}
} else {
$sProfileStatus = 'Approval';
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendApprovalMail($iProfileId);
}
}
} else {
if (!empty($aProfileInfo['email'])) {
$oProfileFields->sendConfMail($iProfileId);
$sProfileStatus = 'Unconfirmed';
} else {
if (getParam('autoApproval_ifJoin') == 'on') {
$sProfileStatus = 'Active';
} else {
$sProfileStatus = 'Approval';
}
}
}
// update profile's status;
$this->_oDb->updateProfileStatus($iProfileId, $sProfileStatus);
$oProfileFields->createProfileCache($iProfileId);
if (!empty($aProfileInfo['email'])) {
//-- send email notification --//
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate->getTemplate('t_fb_connect_password_generated');
$aNewProfileInfo = getProfileInfo($iProfileId);
$aPlus = array('NickName' => getNickName($aNewProfileInfo['ID']), 'NewPassword' => $sNewPassword);
sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
}
//--
if (BxDolModule::getInstance('BxWmapModule')) {
BxDolService::call('wmap', 'response_entry_add', array('profiles', $iProfileId));
}
// create system event
$oZ = new BxDolAlerts('profile', 'join', $iProfileId);
$oZ->alert();
// auto-friend members if they are already friends on Facebook
if ($isAutoFriends) {
$this->_makeFriends($iProfileId);
}
// set logged
if ($isSetLoggedIn) {
$aProfile = getProfileInfo($iProfileId);
$this->setLogged($iProfileId, $aProfile['Password'], '', false);
}
return array('profile_info_fb' => $aProfileInfo, 'profile_id' => $iProfileId);
}