Ejemplo n.º 1
0
function fn_email_admin_new_item($item)
{
    View::newInstance()->_exportVariableToView('item', $item);
    $title = osc_item_title();
    $contactEmail = $item['s_contact_email'];
    $contactName = $item['s_contact_name'];
    $mPages = new Page();
    $locale = osc_current_user_locale();
    $aPage = $mPages->findByInternalName('email_admin_new_item');
    $content = array();
    if (isset($aPage['locale'][$locale]['s_title'])) {
        $content = $aPage['locale'][$locale];
    } else {
        $content = current($aPage['locale']);
    }
    $item_url = osc_item_url();
    $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
    $all = '';
    if (isset($item['locale'])) {
        foreach ($item['locale'] as $locale => $data) {
            $locale_name = OSCLocale::newInstance()->listWhere("pk_c_code = '" . $locale . "'");
            $all .= '<br/>';
            if (isset($locale_name[0]) && isset($locale_name[0]['s_name'])) {
                $all .= __('Language') . ': ' . $locale_name[0]['s_name'] . '<br/>';
            } else {
                $all .= __('Language') . ': ' . $locale . '<br/>';
            }
            $all .= __('Title') . ': ' . $data['s_title'] . '<br/>';
            $all .= __('Description') . ': ' . $data['s_description'] . '<br/>';
            $all .= '<br/>';
        }
    } else {
        $all .= __('Title') . ': ' . $item['s_title'] . '<br/>';
        $all .= __('Description') . ': ' . $item['s_description'] . '<br/>';
    }
    // Format activation URL
    $validation_url = osc_item_activate_url($item['s_secret'], $item['pk_i_id']);
    // Format admin edit URL
    $admin_edit_url = osc_item_admin_edit_url($item['pk_i_id']);
    $words = array();
    $words[] = array('{EDIT_LINK}', '{EDIT_URL}', '{ITEM_DESCRIPTION_ALL_LANGUAGES}', '{ITEM_DESCRIPTION}', '{ITEM_COUNTRY}', '{ITEM_PRICE}', '{ITEM_REGION}', '{ITEM_CITY}', '{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{VALIDATION_LINK}', '{VALIDATION_URL}');
    $words[] = array('<a href="' . $admin_edit_url . '" >' . $admin_edit_url . '</a>', $admin_edit_url, $all, $item['s_description'], $item['s_country'], osc_prepare_price($item['s_price']), $item['s_region'], $item['s_city'], $item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $item['s_title'], $item_url, osc_page_title(), '<a href="' . $validation_url . '" >' . $validation_url . '</a>', $validation_url);
    $title = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_admin_new_item_title', $content['s_title'])), $words);
    $body = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_admin_new_item_description', $content['s_text'])), $words);
    $emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
    osc_sendMail($emailParams);
}
Ejemplo n.º 2
0
function moreedit_moderate_edit($item_)
{
    $cat_id = $item_['fk_i_category_id'];
    $item_id = $item_['pk_i_id'];
    if (osc_get_preference('notify_edit', 'moreedit') == '1') {
        $aPage = Page::newInstance()->findByInternalName('email_moreedit_notify_edit');
        $content = array();
        $locale = osc_current_user_locale();
        if (isset($aPage['locale'][$locale]['s_title'])) {
            $content = $aPage['locale'][$locale];
        } else {
            $content = current($aPage['locale']);
        }
        $item = Item::newInstance()->findByPrimaryKey($item_id);
        View::newInstance()->_exportVariableToView('item', $item);
        $item_url = osc_item_url();
        $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
        $admin_edit_url = osc_item_admin_edit_url($item['pk_i_id']);
        $words = array();
        $words[] = array('{EDIT_LINK}', '{EDIT_URL}', '{ITEM_DESCRIPTION}', '{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}');
        $words[] = array('<a href="' . $admin_edit_url . '" >' . $admin_edit_url . '</a>', $admin_edit_url, $item['s_description'], $item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $item['s_title'], $item_url, osc_page_title());
        $title = osc_mailBeauty($content['s_title'], $words);
        $body = osc_mailBeauty($content['s_text'], $words);
        $emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
        osc_sendMail($emailParams);
    }
    if (osc_get_preference('moderate_edit', 'moreedit') == '1') {
        Item::newInstance()->update(array('b_enabled' => 0), array('pk_i_id' => $item_id));
    }
}