<div class="form-controls"> <div class="form-label-checkbox"> <label> <input type="checkbox" <?php echo osc_notify_new_item() ? 'checked="checked"' : ''; ?> name="notify_new_item" value="1" /> <?php _e('Notify admin when a new listing is added'); ?> </label> </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');
function fn_email_new_comment_admin($aItem) { $authorName = trim($aItem['authorName']); $authorName = strip_tags($authorName); $authorEmail = trim($aItem['authorEmail']); $authorEmail = strip_tags($authorEmail); $body = trim($aItem['body']); $body = strip_tags($body); $title = $aItem['title']; $itemId = $aItem['id']; $userId = $aItem['userId']; $admin_email = osc_contact_email(); $prefLocale = osc_language(); $item = Item::newInstance()->findByPrimaryKey($itemId); View::newInstance()->_exportVariableToView('item', $item); $itemURL = osc_item_url(); $itemURL = '<a href="' . $itemURL . '" >' . $itemURL . '</a>'; $mPages = new Page(); $aPage = $mPages->findByInternalName('email_new_comment_admin'); $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('{COMMENT_AUTHOR}', '{COMMENT_EMAIL}', '{COMMENT_TITLE}', '{COMMENT_TEXT}', '{ITEM_TITLE}', '{ITEM_ID}', '{ITEM_URL}'); $words[] = array($authorName, $authorEmail, $title, $body, $item['s_title'], $itemId, $itemURL); $title_email = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_new_comment_admin_title', $content['s_title'])), $words); $body_email = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_new_comment_admin_description', $content['s_text'])), $words); $from = osc_contact_email(); $from_name = osc_page_title(); if (osc_notify_contact_item()) { $add_bbc = osc_contact_email(); } $emailParams = array('from' => $admin_email, 'from_name' => __('Admin mail system'), 'subject' => $title_email, 'to' => $admin_email, 'to_name' => __('Admin mail system'), 'body' => $body_email, 'alt_body' => $body_email); osc_sendMail($emailParams); }
function fn_email_contact_user($id, $yourEmail, $yourName, $phoneNumber, $message) { $mPages = new Page(); $aPage = $mPages->findByInternalName('email_contact_user'); $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('{CONTACT_NAME}', '{USER_NAME}', '{USER_EMAIL}', '{USER_PHONE}', '{WEB_URL}', '{COMMENT}'); $words[] = array(osc_user_name(), $yourName, $yourEmail, $phoneNumber, '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $message); $title = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_item_inquiry_title', $content['s_title'])), $words); $body = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_item_inquiry_description', $content['s_text'])), $words); $from = osc_contact_email(); $from_name = osc_page_title(); $add_bcc = ''; if (osc_notify_contact_item()) { $add_bcc = osc_contact_email(); } $emailParams = array('add_bcc' => $add_bcc, 'from' => $from, 'from_name' => $from_name, 'subject' => $title, 'to' => osc_user_email(), 'to_name' => osc_user_name(), 'body' => $body, 'alt_body' => $body, 'reply_to' => $yourEmail); osc_sendMail($emailParams); @unlink($path); }
function fn_email_contact_user($id, $yourEmail, $yourName, $phoneNumber, $message) { $mPages = new Page(); $aPage = $mPages->findByInternalName('email_contact_user'); $locale = osc_current_user_locale(); if(isset($aPage['locale'][$locale]['s_title'])) { $content = $aPage['locale'][$locale]; } else { $content = current($aPage['locale']); } $words = array(); $words[] = array( '{CONTACT_NAME}', '{USER_NAME}', '{USER_EMAIL}', '{USER_PHONE}', '{COMMENT}' ); $words[] = array( osc_user_name(), $yourName, $yourEmail, $phoneNumber, $message ); $title = osc_apply_filter('email_item_inquiry_title_after', osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_item_inquiry_title', $content['s_title'], $id, $yourEmail, $yourName, $phoneNumber, $message)), $words), $id, $yourEmail, $yourName, $phoneNumber, $message); $body = osc_apply_filter('email_item_inquiry_description_after', osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_item_inquiry_description', $content['s_text'], $id, $yourEmail, $yourName, $phoneNumber, $message)), $words), $id, $yourEmail, $yourName, $phoneNumber, $message); $emailParams = array ( 'from' => osc_contact_email(), 'subject' => $title, 'to' => osc_user_email(), 'to_name' => osc_user_name(), 'body' => $body, 'alt_body' => $body, 'reply_to' => $yourEmail ); if( osc_notify_contact_item() ) { $emailParams['add_bcc'] = osc_contact_email(); } osc_sendMail($emailParams); }
public function add_comment() { $aItem = $this->prepareDataForFunction('add_comment'); $authorName = trim($aItem['authorName']); $authorName = strip_tags($authorName); $authorEmail = trim($aItem['authorEmail']); $authorEmail = strip_tags($authorEmail); $body = trim($aItem['body']); $body = strip_tags($body); $title = $aItem['title']; $itemId = $aItem['id']; $userId = $aItem['userId']; $status_num = -1; $item = $this->manager->findByPrimaryKey($itemId); $itemURL = osc_item_url(); Params::setParam('itemURL', $itemURL); if ($authorName == '' || !preg_match('|^.*?@.{2,}\\..{2,3}$|', $authorEmail)) { return 3; } if ($body == '') { return 4; } $num_moderate_comments = osc_moderate_comments(); if ($userId == null) { $num_comments = 0; } else { $num_comments = count(ItemComment::newInstance()->findByAuthorID($userId)); } if ($num_moderate_comments == -1 || $num_moderate_comments != 0 && $num_comments >= $num_moderate_comments) { $status = 'ACTIVE'; $status_num = 2; } else { $status = 'INACTIVE'; $status_num = 1; } if (osc_akismet_key()) { require_once LIB_PATH . 'Akismet.class.php'; $akismet = new Akismet(osc_base_url(), osc_akismet_key()); $akismet->setCommentAuthor($authorName); $akismet->setCommentAuthorEmail($authorEmail); $akismet->setCommentContent($body); $akismet->setPermalink($itemURL); $status = $akismet->isCommentSpam() ? 'SPAM' : $status; if ($status == 'SPAM') { $status_num = 5; } } $mComments = ItemComment::newInstance(); $aComment = array('dt_pub_date' => DB_FUNC_NOW, 'fk_i_item_id' => $itemId, 's_author_name' => $authorName, 's_author_email' => $authorEmail, 's_title' => $title, 's_body' => $body, 'e_status' => $status, 'fk_i_user_id' => $userId); if ($mComments->insert($aComment)) { $notify = osc_notify_new_comment(); $admin_email = osc_contact_email(); $prefLocale = osc_language(); //Notify admin if ($notify) { $mPages = new Page(); $aPage = $mPages->findByInternalName('email_new_comment_admin'); $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('{COMMENT_AUTHOR}', '{COMMENT_EMAIL}', '{COMMENT_TITLE}', '{COMMENT_TEXT}', '{ITEM_TITLE}', '{ITEM_ID}', '{ITEM_URL}'); $words[] = array($authorName, $authorEmail, $title, $body, $item['s_title'], $itemId, $itemURL); $title_email = osc_mailBeauty($content['s_title'], $words); $body_email = osc_mailBeauty($content['s_text'], $words); $from = osc_contact_email(); $from_name = osc_page_title(); if (osc_notify_contact_item()) { $add_bbc = osc_contact_email(); } $emailParams = array('from' => $admin_email, 'from_name' => __('Admin mail system'), 'subject' => $title_email, 'to' => $admin_email, 'to_name' => __('Admin mail system'), 'body' => $body_email, 'alt_body' => $body_email); osc_sendMail($emailParams); } osc_run_hook('add_comment', $item); return $status_num; } return -1; }