예제 #1
0
<?php

@(include_once 'commons.php');
$nc = new NewsletterControls();
if (isset($_GET['id'])) {
    $nc->load($wpdb->prefix . 'newsletter_emails', $_GET['id']);
    if (empty($nc->data['id'])) {
        $nc->data['status'] = 'new';
        $nc->data['subject'] = 'Here the email subject';
        $nc->data['message'] = '<p>An empty email to start.</p>';
        $nc->data['theme'] = 'blank';
    }
} else {
    if ($nc->is_action('save') || $nc->is_action('send')) {
        $nc->save($wpdb->prefix . 'newsletter_emails');
    }
    if ($nc->is_action('send')) {
        // Fake value representing the WordPress users as target
        if ($nc->data['list'] == -1) {
            $query = "select count(*) from " . $wpdb->prefix . "users " . $nc->data['query'];
        } else {
            if (!empty($nc->data['query'])) {
                $query = "select count(*) from " . $wpdb->prefix . "newsletter " . $nc->data['query'];
            } else {
                $query = "select count(*) from " . $wpdb->prefix . "newsletter where status='C'";
                if ($nc->data['list'] != 0) {
                    $query .= " and list_" . $nc->data['list'] . "=1";
                }
                if (!empty($nc->data['sex'])) {
                    $query .= " and sex='" . $nc->data['sex'] . "'";
                }
예제 #2
0
<?php

@(include_once 'commons.php');
$nc = new NewsletterControls();
if (isset($_GET['id'])) {
    $nc->load($wpdb->prefix . 'newsletter', $_GET['id']);
    if (empty($nc->data['id'])) {
        $nc->data['status'] = 'C';
        $nc->data['token'] = md5(rand());
    }
} else {
    if ($nc->is_action('save')) {
        for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
            if (!isset($nc->data['list_' . $i])) {
                $nc->data['list_' . $i] = 0;
            }
        }
        $nc->save($wpdb->prefix . 'newsletter');
    }
}
$nc->errors($errors);
$nc->messages($messages);
$options_profile = get_option('newsletter_profile');
?>
<div class="wrap">
    <h2>Newsletter Subscriber Editing</h2>
    <p><a href="admin.php?page=newsletter/users.php">Back to the list</a></p>
    <form method="post" action="admin.php?page=newsletter/users-edit.php">
        <?php 
$nc->init();
?>