예제 #1
0
    }
    $nbr = $Sql->count_table("newsletter", __LINE__, __FILE__);
    $Template->assign_block_vars('write', array('TYPE' => $type, 'SUBSCRIBE_LINK' => $type == 'html' ? $LANG['newsletter_subscribe_link'] : '', 'NBR_SUBSCRIBERS' => $nbr, 'MESSAGE' => stripslashes($mail_contents), 'TITLE' => $mail_object, 'PREVIEW_BUTTON' => $type == 'bbcode' ? '<input value="' . $LANG['preview'] . '" onclick="XMLHttpRequest_preview();" class="submit" type="button">' : ''));
    $Template->assign_vars(array('L_WRITE_TYPE' => $LANG['newsletter_write_type'], 'L_TITLE' => $LANG['title'], 'L_MESSAGE' => $LANG['message'], 'L_SEND' => $LANG['newsletter_send'], 'L_NEWSLETTER_TEST' => $LANG['newsletter_test'], 'L_NBR_SUBSCRIBERS' => $LANG['newsletter_nbr_subscribers']));
    if ($type == 'bbcode') {
        $Template->assign_block_vars('write.bbcode_explain', array('L_WARNING' => $LANG['newsletter_bbcode_warning']));
    }
    if (empty($mail_object) && $send_test) {
        $Errorh->handler($LANG['require_title'], E_USER_WARNING);
    } elseif (empty($mail_contents) && $send_test) {
        $Errorh->handler($LANG['require_text'], E_USER_WARNING);
    } elseif ($send_test) {
        switch ($type) {
            case 'html':
                NewsletterService::send_html($mail_object, $mail_contents, $User->get_attribute('user_mail'));
                break;
            case 'bbcode':
                NewsletterService::send_bbcode($mail_object, $mail_contents, $User->get_attribute('user_mail'));
                break;
            default:
                NewsletterService::send_text($mail_object, $mail_contents, $User->get_attribute('user_mail'));
                break;
        }
        $Errorh->handler(sprintf($LANG['newsletter_test_sent'], $User->get_attribute('user_mail')), E_USER_NOTICE);
    }
} else {
    $Template->assign_block_vars('select_type', array('L_SELECT_TYPE' => $LANG['newsletter_select_type'], 'L_SELECT_TYPE_TEXT' => $LANG['newsletter_select_type_text'], 'L_SELECT_TYPE_EXPLAIN_TEXT' => $LANG['newsletter_select_type_text_explain'], 'L_SELECT_TYPE_BBCODE' => $LANG['select_type_bbcode'], 'L_SELECT_TYPE_EXPLAIN_BBCODE' => $LANG['newsletter_select_type_bbcode_explain'], 'L_SELECT_TYPE_HTML' => $LANG['select_type_html'], 'L_SELECT_TYPE_EXPLAIN_HTML' => $LANG['newsletter_select_type_html_explain'], 'L_NEXT' => $LANG['next']));
}
$Template->assign_vars(array('L_REQUIRE_TITLE' => $LANG['require_title'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_REQUIRE_MAIL' => $LANG['require_mail'], 'L_CONFIRM_DELETE' => addslashes($LANG['newsletter_confirm_delete_user']), 'L_MAIL' => $LANG['newsletter_email_address'], 'L_DELETE' => $LANG['delete']));
$Template->pparse('admin_newsletter');
require_once '../admin/admin_footer.php';