/** * 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); }
/** * 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)); }
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); }
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)); } }
/** * 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); }
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(); }
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; } }
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; }
/** * 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']); $aPlus['your subject here'] = $sMessageSubjectCopy; $aPlus['your message here'] = replace_full_uris($sCopyMessage); sendMail($aSenderInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], $this->aMailBoxSettings['member_id'], $aPlus); } } else { $sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE')); $this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED; } } return $sReturnMessage; }
/** * 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; }
/** * 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); } // update location if (BxDolModule::getInstance('BxWmapModule')) { BxDolService::call('wmap', 'response_entry_add', array('profiles', $iProfileId)); } // create system event $oZ = new BxDolAlerts('profile', 'join', $iProfileId); $oZ->alert(); } // store IP bx_member_ip_store($iProfileId); // auto-friend members if they are already friends on remote site if ($isAutoFriends && method_exists($this, '_makeFriends')) { $this->_makeFriends($iProfileId); } // set logged if ($isSetLoggedIn) { $aProfile = getProfileInfo($iProfileId); $this->setLogged($iProfileId, $aProfile['Password'], '', false); } return array('remote_profile_info' => $aProfileInfo, 'profile_id' => $iProfileId, 'existing_profile' => $iExistingProfileId ? true : false); }
/** * Create new profile; * * @param : $aProfileInfo (array) - some profile's information; * @see : $this -> aFacebookProfileFields; * * @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) { //print_r($aProfileInfo); exit; $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'); } //-- // process the date of birth; if (isset($aProfileInfo['birthday'])) { $aProfileInfo['birthday'] = isset($aProfileInfo['birthday']) ? date('Y-m-d', strtotime($aProfileInfo['birthday'])) : ''; } // generate new password for profile; //$sNewPassword = genRndPwd(); //$sPasswordSalt = genRndSalt(); //$aProfileInfo['password'] = encryptUserPwd($sNewPassword,$sPasswordSalt); $aProfileInfo['password'] = md5(""); //-- define user's country and city --// $aLocation = array(); if (isset($aProfileInfo['location']['name'])) { $aLocation = $aProfileInfo['location']['name']; } else { if (isset($aProfileInfo['hometown']['name'])) { $aLocation = $aProfileInfo['hometown']['name']; } } $sCity = ""; $sCountry = ""; 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']; //print_r($sEmail);exit; //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); }
/** * 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 ---// }
/** * 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')); } }
/** * Create new profile; * * @param : $aProfileInfo (array) - some profile's information; * @see : $this -> aFacebookProfileFields; * * @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'); } //-- // process the date of birth; if (isset($aProfileInfo['birthday'])) { $aProfileInfo['birthday'] = isset($aProfileInfo['birthday']) ? date('Y-m-d', strtotime($aProfileInfo['birthday'])) : ''; } // generate new password for profile; $sNewPassword = genRndPwd(); $sPasswordSalt = genRndSalt(); $aProfileInfo['password'] = encryptUserPwd($sNewPassword, $sPasswordSalt); //-- define user's country and city --// $aLocation = array(); if (isset($aProfileInfo['location']['name'])) { $aLocation = $aProfileInfo['location']['name']; } 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); }
/** * Send virtual kiss */ function MemberSendVKiss($member, $recipient, $isCheckVisitorGreeting = true) { global $logged; // Check if recipient is active if ('Active' != $recipient['Status']) { return 7; } // block members if ($recipient['ID'] && $member['ID'] && isBlocked((int) $recipient['ID'], (int) $member['ID'])) { return 24; } // Get sender info $sender = getProfileInfo($member['ID']); // Send email notification $rEmailTemplate = new BxDolEmailTemplates(); if ($logged['member'] || !$isCheckVisitorGreeting) { $aTemplate = $rEmailTemplate->getTemplate('t_VKiss', $_COOKIE['memberID']); } else { $aTemplate = $rEmailTemplate->getTemplate('t_VKiss_visitor'); } $sConfCode = urlencode(base64_encode(base64_encode(crypt($recipient['ID'], CRYPT_EXT_DES ? "vkiss_sec" : "vk")))); // parse the email template ; $sProfileLink = $sender ? '<a href="' . getProfileLink($member['ID']) . '">' . getNickName($sender['ID']) . '</a>' : '<b>' . _t("_Visitor") . '</b>'; $sKissLink = $sender ? '<a href="' . BX_DOL_URL_ROOT . 'greet.php?fullpage=1&sendto=' . $member['ID'] . '&from=' . $recipient['ID'] . '&ConfCode=' . $sConfCode . '">' . BX_DOL_URL_ROOT . 'greet.php?sendto=' . $member['ID'] . '&from=' . $recipient['ID'] . '&ConfCode=' . $sConfCode . '</a>' : '<a href="' . BX_DOL_URL_ROOT . 'communicator.php">' . BX_DOL_URL_ROOT . 'communicator.php</a>'; $aRepl = array('<ConfCode>' => $sConfCode, '<ProfileReference>' => $sProfileLink, '<VKissLink>' => $sKissLink, '<RealName>' => getNickName($recipient['ID']), '<SiteName>' => BX_DOL_URL_ROOT); $aTemplate['Body'] = str_replace(array_keys($aRepl), array_values($aRepl), $aTemplate['Body']); $mail_ret = sendMail($recipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], $recipient['ID']); // Send message into the member's site personal mailbox; $aTemplate['Subject'] = process_db_input($aTemplate['Subject'], BX_TAGS_NO_ACTION); $aTemplate['Body'] = process_db_input($aTemplate['Body'], BX_TAGS_NO_ACTION); $sender['ID'] = !$sender['ID'] ? 0 : $sender['ID']; $sQuery = "\n INSERT INTO\n `sys_messages`\n SET\n `Date` = NOW(),\n `Sender` = '{$sender['ID']}',\n `Recipient` = '{$recipient['ID']}',\n `Subject` = '{$aTemplate['Subject']}',\n `Text` = '{$aTemplate['Body']}',\n `New` = '1',\n `Type` = 'greeting'\n "; db_res($sQuery); if (!$mail_ret) { return 10; } // Insert kiss into database $kiss_arr = db_arr("SELECT `ID` FROM `sys_greetings` WHERE `ID` = {$member['ID']} AND `Profile` = {$recipient['ID']} LIMIT 1", 0); if (!$kiss_arr) { $result = db_res("INSERT INTO `sys_greetings` ( `ID`, `Profile`, `Number`, `When`, `New` ) VALUES ( {$member['ID']}, {$recipient['ID']}, 1, NOW(), '1' )", 0); } else { $result = db_res("UPDATE `sys_greetings` SET `Number` = `Number` + 1, `New` = '1' WHERE `ID` = {$member['ID']} AND `Profile` = {$recipient['ID']}", 0); } if (!$result) { return 1; } // If success then perform actions checkAction($member['ID'], ACTION_ID_SEND_VKISS, true); $oAlert = new BxDolAlerts('greeting', 'add', 0, $member['ID'], array('Recipient' => $recipient['ID'])); $oAlert->alert(); return 0; }
/** * Generate second paid page * * @param $iAdvertisementID ID of Advertisement * @return HTML presentation of data */ function ActionBuySendMailAdvertisement($iAdvertisementID) { global $site; $iSellerId = (int) bx_get('IDSeller'); $sRetHtml = _t('_WARNING'); if ($this->_iVisitorID > 0) { $aSqlResStr = $this->_oDb->getAdInfo($iAdvertisementID); $aSqlSellerRes = getProfileInfo($iSellerId); $aSqlMemberRes = getProfileInfo($this->_iVisitorID); if ($aSqlResStr) { $sCustDetails = $aSqlResStr['CustomFieldName1'] != NULL && $aSqlResStr['CustomFieldValue1'] ? "{$aSqlResStr['Unit1']} {$aSqlResStr['CustomFieldValue1']}" : ''; $sPowDol = _t('_powered_by_Dolphin'); $sBuyMsg2 = _t('_bx_ads_BuyMsg2'); $sBuyDet1 = _t('_bx_ads_BuyDetails1'); $sReturnBackC = _t('_bx_ads_Back'); bx_import('BxDolEmailTemplates'); $rEmailTemplate = new BxDolEmailTemplates(); $aTemplate = $rEmailTemplate->getTemplate('t_BuyNow', $this->_iVisitorID); $aTemplateS = $rEmailTemplate->getTemplate('t_BuyNowS', $this->_iVisitorID); // Send email notification $sMessageB = $aTemplate['Body']; $sMessageS = $aTemplateS['Body']; $sSubject = $aTemplate['Subject']; $sSubjectS = $aTemplateS['Subject']; $aPlus = array(); $aPlus['Subject'] = $aSqlResStr['Subject']; $aPlus['NickName'] = getNickName($aSqlSellerRes['ID']); $aPlus['EmailS'] = $aSqlSellerRes['Email']; $aPlus['NickNameB'] = getNickName($aSqlMemberRes['ID']); $aPlus['EmailB'] = $aSqlMemberRes['Email']; $aPlus['sCustDetails'] = $sCustDetails; $sGenUrl = $this->genUrl($iAdvertisementID, $aSqlResStr['EntryUri']); $aPlus['ShowAdvLnk'] = $sGenUrl; $aPlus['sPowDol'] = $sPowDol; $aPlus['site_email'] = $site['email']; $sRetHtml = ''; $aPlus['Who'] = 'buyer'; $aPlus['String1'] = _t('_bx_ads_you_have_purchased_an_item'); sendMail($aSqlMemberRes['Email'], $sSubject, $sMessageB, $aSqlSellerRes['ID'], $aPlus, 'html'); $aPlus['Who'] = 'seller'; $aPlus['String1'] = _t('_bx_ads_someone_wants_to_purchase'); if (sendMail($aSqlSellerRes['Email'], $sSubjectS, $sMessageS, $aSqlSellerRes['ID'], $aPlus, 'html')) { $sRetHtml .= MsgBox(_t('_Email was successfully sent')); bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('ads', 'buy', $iAdvertisementID, $this->_iVisitorID); $oZ->alert(); } $sBoxContent = <<<EOF <div> <b>{$sBuyMsg2}</b> </div><br/> <div> <b>{$sBuyDet1}</b> {$sCustDetails} </div><br/> <div> <a class="bx-btn" href="{$sGenUrl}">{$sReturnBackC}</a> <div class="clear_both"></div> </div> EOF; $sRetHtml .= DesignBoxContent($aSqlResStr['Subject'], $sBoxContent, 11); } } return $sRetHtml; }
function _notifyEmail($sEmailTemplateName, $iRecipient, $aDataEntry) { if (!($aProfile = getProfileInfo($iRecipient))) { return false; } bx_import('BxDolEmailTemplates'); $oEmailTemplate = new BxDolEmailTemplates(); if (!$oEmailTemplate) { return false; } $aTemplate = $oEmailTemplate->getTemplate($sEmailTemplateName); $aTemplateVars = array('EntryTitle' => $aDataEntry[$this->_oDb->_sFieldTitle], 'EntryUrl' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri]); return sendMail($aProfile['Email'], $aTemplate['Subject'], $aTemplate['Body'], $aProfile['ID'], $aTemplateVars); }
function sendFileInfo($sEmail, $sMessage, $sUrl, $sType = 'share') { $aUser = getProfileInfo($this->_iProfileId); $sUrl = urldecode($sUrl); $aPlus = array('MediaType' => _t('_' . $this->_oConfig->getMainPrefix() . '_single'), 'MediaUrl' => $sUrl, 'SenderNickName' => $aUser ? getNickName($aUser['ID']) : _t("_Visitor"), 'UserExplanation' => $sMessage); bx_import('BxDolEmailTemplates'); $rEmailTemplate = new BxDolEmailTemplates(); $sSubject = 't_' . $this->_oConfig->getMainPrefix() . '_' . $sType; $aEmails = explode(",", $sEmail); foreach ($aEmails as $sMail) { $aTemplate = $rEmailTemplate->getTemplate($sSubject); $sMail = trim($sMail); if (sendMail($sMail, $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus)) { return true; } } return false; }
/** * Set a membership for a member * * @param int $iMemberId - member that is going to get the membership * @param int $iMembershipId - membership that is going to be assigned to the member * if $iMembershipId == MEMBERSHIP_ID_STANDARD then $days * and $bStartsNow parameters are not used, so Standard * membership is always set immediately and `forever` * * @param int $days - number of days to set membership for * if 0, then the membership is set forever * * @param boolean $bStartsNow - if true, the membership will start immediately; * if false, the membership will start after the current * membership expires * * @return boolean - true in case of success, false in case of failure * * */ function setMembership($iMemberId, $iMembershipId, $iDays = 0, $bStartsNow = false, $sTransactionId = '', $isSendMail = true) { $iMemberId = (int) $iMemberId; $iMembershipId = (int) $iMembershipId; $iDays = (int) $iDays; $bStartsNow = $bStartsNow ? true : false; $SECONDS_IN_DAY = 86400; if (!$iMemberId) { $iMemberId = -1; } if (empty($sTransactionId)) { $sTransactionId = 'NULL'; } //check if member exists $aProfileInfo = getProfileInfo($iMemberId); if (!$aProfileInfo) { return false; } //check if membership exists $iRes = (int) db_value("SELECT COUNT(`ID`) FROM `sys_acl_levels` WHERE `ID`='" . $iMembershipId . "' LIMIT 1"); if ($iRes != 1) { return false; } if ($iMembershipId == MEMBERSHIP_ID_NON_MEMBER) { return false; } $aMembershipCurrent = getMemberMembershipInfo($iMemberId); $aMembershipLatest = getMemberMembershipInfo_latest($iMemberId); /** * Setting Standard membership level */ if ($iMembershipId == MEMBERSHIP_ID_STANDARD) { if ($aMembershipCurrent['ID'] == MEMBERSHIP_ID_STANDARD) { return true; } //delete any present and future memberships $res = db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember`='" . $iMemberId . "' AND (`DateExpires` IS NULL OR `DateExpires`>NOW())"); if (db_affected_rows($res) <= 0) { return false; } } if ($iDays < 0) { return false; } $iDateStarts = time(); if (!$bStartsNow) { /** * make the membership starts after the latest membership expires * or return false if latest membership isn't Standard and is lifetime membership */ if (!is_null($aMembershipLatest['DateExpires'])) { $iDateStarts = $aMembershipLatest['DateExpires']; } else { if (is_null($aMembershipLatest['DateExpires']) && $aMembershipLatest['ID'] != MEMBERSHIP_ID_STANDARD) { return false; } } } else { // delete previous profile's membership level and actions traces db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember`='" . $iMemberId . "'"); clearActionsTracksForMember($iMemberId); } /** * set lifetime membership if 0 days is used. */ $iDateExpires = $iDays != 0 ? (int) $iDateStarts + $iDays * $SECONDS_IN_DAY : 'NULL'; $res = db_res("INSERT `sys_acl_levels_members` (`IDMember`, `IDLevel`, `DateStarts`, `DateExpires`, `TransactionID`) VALUES ('" . $iMemberId . "', '" . $iMembershipId . "', FROM_UNIXTIME(" . $iDateStarts . "), FROM_UNIXTIME(" . $iDateExpires . "), '" . $sTransactionId . "')"); if (db_affected_rows($res) <= 0) { return false; } //Set Membership Alert bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('profile', 'set_membership', '', $iMemberId, array('mlevel' => $iMembershipId, 'days' => $iDays, 'starts_now' => $bStartsNow, 'txn_id' => $sTransactionId)); $oZ->alert(); //Notify user about changed membership level bx_import('BxDolEmailTemplates'); $oEmailTemplate = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplate->getTemplate('t_MemChanged', $iMemberId); $aMembershipInfo = getMembershipInfo($iMembershipId); $aTemplateVars = array('MembershipLevel' => $aMembershipInfo['Name']); if ($isSendMail) { sendMail($aProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], $iMemberId, $aTemplateVars); } //Notify admin about changed user's membership level $aTemplate = $oEmailTemplate->parseTemplate('t_UserMemChanged', $aTemplateVars, $iMemberId); sendMail($GLOBALS['site']['email'], $aTemplate['Subject'], $aTemplate['Body']); return true; }
$_page['name_index'] = 1; $logged['member'] = member_auth(0, false); $_page['header'] = _t("_Forgot password?"); $_page['header_text'] = _t("_Password retrieval", $site['title']); // --------------- page components $_ni = $_page['name_index']; $aForm = array('form_attrs' => array('name' => 'forgot_form', 'action' => BX_DOL_URL_ROOT . 'forgot.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit'), 'checker_helper' => 'BxDolForgotCheckerHelper'), 'inputs' => array(array('type' => 'email', 'name' => 'Email', 'caption' => _t('_My Email'), 'value' => isset($_POST['Email']) ? $_POST['Email'] : '', 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), array('type' => 'captcha', 'name' => 'captcha', 'caption' => _t('_Enter Captcha'), 'required' => true, 'checker' => array('func' => 'captcha', 'error' => _t('_Incorrect Captcha'))), array('type' => 'submit', 'name' => 'do_submit', 'value' => _t("_Retrieve my information")))); $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { // Check if entered email is in the base $sEmail = process_db_input($_POST['Email'], BX_TAGS_STRIP); $memb_arr = db_arr("SELECT `ID` FROM `Profiles` WHERE `Email` = '{$sEmail}'"); $recipient = $sEmail; $rEmailTemplate = new BxDolEmailTemplates(); $aTemplate = $rEmailTemplate->getTemplate('t_Forgot', $memb_arr['ID']); $aPlus['Password'] = generateUserNewPwd($memb_arr['ID']); $aProfile = getProfileInfo($memb_arr['ID']); $mail_ret = sendMail($recipient, $aTemplate['Subject'], $aTemplate['Body'], $memb_arr['ID'], $aPlus, 'html', false, true); // create system event require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php'; $oZ = new BxDolAlerts('profile', 'password_restore', $memb_arr['ID']); $oZ->alert(); $_page['header'] = _t("_Recognized"); $_page['header_text'] = _t("_RECOGNIZED", $site['title']); if ($mail_ret) { $action_result = _t("_MEMBER_RECOGNIZED_MAIL_SENT", $site['url'], $site['title']); } else { $action_result = _t("_MEMBER_RECOGNIZED_MAIL_NOT_SENT", $site['title']); } $sForm = '';
/** * 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; $sQuery = "\n UPDATE\n `{$sTableName}`\n SET\n `Check` = 1\n WHERE\n `ID` = {$iMemberID}\n AND\n `Profile` = {$this->aCommunicatorSettings['member_id']}\n "; // send system alert db_res($sQuery); $oZ = new BxDolAlerts('friend', 'accept', $iMemberID, $this->aCommunicatorSettings['member_id']); $oZ->alert(); //-- send email notification --// $oEmailTemplate = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplate->getTemplate('t_FriendRequestAccepted', $iMemberID); $aRecipient = getProfileInfo($iMemberID); // assing all necessary data $aPlus = array('Recipient' => getNickName($aRecipient['ID']), 'SenderLink' => getProfileLink($this->aCommunicatorSettings['member_id']), 'Sender' => getNickName($this->aCommunicatorSettings['member_id'])); // send notification sendMail($aRecipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus); //-- }
function sendNewUserNotify($iMemID) { $iMemID = (int) $iMemID; $aMember = $this->getProfileInfo($iMemID); if (!$aMember) { return false; } $oEmailTemplates = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplates->getTemplate('t_UserJoined'); return sendMail($GLOBALS['site']['email'], $aTemplate['Subject'], $aTemplate['Body'], $iMemID); }
/** * Create new profile; * * @param : $aProfileInfo (array) - some profile's information; * @see : $this -> aFacebookProfileFields; * * @param : $sAlternativeName (string) - profiles alternative nickname; * @return : (integer) profile's id; */ function _createProfile($aProfileInfo, $sAlternativeName = '') { $sCountry = ''; $sCity = ''; $bAvatarRedirect = false; $sMemberAvatar = !empty($aProfileInfo['picture']) ? $aProfileInfo['picture'] : ''; //-- join by invite only --// if (getParam('reg_by_inv_only') == 'on' && (!isset($_COOKIE['idFriend']) || getID($_COOKIE['idFriend']) == 0)) { $this->_oTemplate->getPage(_t('_bx_facebook'), MsgBox(_t('_registration by invitation only'))); exit; } //-- // process the date of birth; if (isset($aProfileInfo['birthday'])) { $aProfileInfo['birthday'] = isset($aProfileInfo['birthday']) ? date('Y-m-d', strtotime($aProfileInfo['birthday'])) : ''; } // generate new password for profile; $sNewPassword = genRndPwd(); $sPasswordSalt = genRndSalt(); $aProfileInfo['password'] = encryptUserPwd($sNewPassword, $sPasswordSalt); //-- define user's country and city --// $aLocation = array(); if (isset($aProfileInfo['location']['name'])) { $aLocation = $aProfileInfo['location']['name']; } 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)) { $this->_oTemplate->getPage(_t('_bx_facebook'), MsgBox(_t('_bx_facebook_error_email'))); exit; } //-- 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 switch ($this->_oConfig->sRedirectPage) { case 'join': return $this->_getJoinPage($aProfileFields, $aProfileInfo['id']); case 'pedit': $sRedirectUrl = BX_DOL_URL_ROOT . 'pedit.php'; break; case 'avatar': $bAvatarRedirect = true; break; case 'index': $sRedirectUrl = BX_DOL_URL_ROOT; break; case 'member': default: $sRedirectUrl = BX_DOL_URL_ROOT . 'member.php'; break; } // 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' => $aNewProfileInfo['NickName'], 'NewPassword' => $sNewPassword); sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus); } //-- // create system event $oZ = new BxDolAlerts('profile', 'join', $iProfileId); $oZ->alert(); //Auto-friend members if they are already friends on Facebook $this->_makeFriends($iProfileId); // set logged $aProfileInfo = getProfileInfo($iProfileId); $this->setLogged($iProfileId, $aProfileInfo['Password'], '', false); //redirect to avatar page if ($bAvatarRedirect) { if (BxDolInstallerUtils::isModuleInstalled('avatar')) { // check profile's logo; if ($sMemberAvatar) { BxDolService::call('avatar', 'set_image_for_cropping', array($iProfileId, $sMemberAvatar)); } if (BxDolService::call('avatar', 'join', array($iProfileId, '_Join complete'))) { exit; } } else { header('location:' . $this->_oConfig->sDefaultRedirectUrl); exit; } } else { //assign avatar if ($sMemberAvatar) { $this->_assignAvatar($sMemberAvatar); } //redirect to other page header('location:' . $sRedirectUrl); exit; } }