function fn_email_send_friend($aItem) { $item_url = osc_item_url(); $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>'; $mPages = new Page(); $aPage = $mPages->findByInternalName('email_send_friend'); $locale = osc_current_user_locale(); $content = array(); if (isset($aPage['locale'][$locale]['s_title'])) { $content = $aPage['locale'][$locale]; } else { $content = current($aPage['locale']); } $words = array(); $words[] = array('{FRIEND_NAME}', '{USER_NAME}', '{USER_EMAIL}', '{FRIEND_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{COMMENT}', '{ITEM_URL}', '{WEB_TITLE}'); $words[] = array($aItem['friendName'], $aItem['yourName'], $aItem['yourEmail'], $aItem['friendEmail'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $aItem['s_title'], $aItem['message'], $item_url, osc_page_title()); $title = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_send_friend_title', $content['s_title'])), $words); $body = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_send_friend_description', $content['s_text'])), $words); if (osc_notify_contact_friends()) { $add_bbc = osc_contact_email(); } $params = array('add_bcc' => $add_bbc, 'from' => $aItem['yourEmail'], 'from_name' => $aItem['yourName'], 'subject' => $title, 'to' => $aItem['friendEmail'], 'to_name' => $aItem['friendName'], 'body' => $body, 'alt_body' => $body); osc_sendMail($params); }
</div> <div class="separate-top-medium"> <label> <input type="checkbox" <?php echo osc_notify_contact_item() ? 'checked="checked"' : ''; ?> name="notify_contact_item" value="1" /> <?php _e('Send admin a copy of the "contact publisher" email'); ?> </label> </div> <div class="separate-top-medium"> <label> <input type="checkbox" <?php echo osc_notify_contact_friends() ? 'checked="checked"' : ''; ?> name="notify_contact_friends" value="1" /> <?php _e('Send admin a copy to "share listing" email'); ?> </label> </div> </div> </div> <div class="form-row"> <div class="form-label"><?php _e('Warn about expiration'); ?> </div> <div class="form-controls">
public function send_friend() { // get data for this function $aItem = $this->prepareDataForFunction('send_friend'); $item = $aItem['item']; $s_title = $aItem['s_title']; View::newInstance()->_exportVariableToView('item', $item); $item_url = osc_item_url(); $mPages = new Page(); $aPage = $mPages->findByInternalName('email_send_friend'); $locale = osc_current_user_locale(); $content = array(); if (isset($aPage['locale'][$locale]['s_title'])) { $content = $aPage['locale'][$locale]; } else { $content = current($aPage['locale']); } $words = array(); $words[] = array('{FRIEND_NAME}', '{USER_NAME}', '{USER_EMAIL}', '{FRIEND_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{COMMENT}', '{ITEM_URL}', '{WEB_TITLE}'); $words[] = array($aItem['friendName'], $aItem['yourName'], $aItem['yourEmail'], $aItem['friendEmail'], osc_base_url(), $aItem['s_title'], $aItem['message'], $item_url, osc_page_title()); $title = osc_mailBeauty($content['s_title'], $words); $body = osc_mailBeauty($content['s_text'], $words); $add_bbc = ''; if (osc_notify_contact_friends()) { $add_bbc = osc_contact_email(); } $params = array('add_bcc' => $add_bbc, 'from' => $aItem['yourEmail'], 'from_name' => $aItem['yourName'], 'subject' => $title, 'to' => $aItem['friendEmail'], 'to_name' => $aItem['friendName'], 'body' => $body, 'alt_body' => $body); Params::setParam('item_url', $item_url); if (osc_sendMail($params)) { osc_add_flash_message(sprintf(_m('We just send your message to %s'), $aItem['friendName'])); } else { osc_add_flash_message(_m('We are very sorry but we could not deliver your message to your friend. Try again later')); } }