Ejemplo n.º 1
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
if ($controls->is_action('feed_enable')) {
    delete_option('newsletter_feed_demo_disable');
    $controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
}
if ($controls->is_action('feed_disable')) {
    update_option('newsletter_feed_demo_disable', 1);
    $controls->messages = 'Feed by Mail demo panel disabled. On next page reload it will disappear.';
}
?>
<div class="wrap main-index">


    <?php 
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter';
?>
    <?php 
include NEWSLETTER_DIR . '/header-new.php';
?>

    <div id="newsletter-title">
        <h2>Welcome and Support</h2>
        <p>
            With my horrible English, everything can be found starting from <a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">Newsletter Official page</a>
            and every configuration panel has some included documentation just to avoid the most common mistakes.
        </p>
    </div>
    <div class="newsletter-separator"></div>
Ejemplo n.º 2
0
<?php

require_once dirname(__FILE__) . '/controls.php';
$module = NewsletterGrabber::$instance;
$controls = new NewsletterControls();
if (!$controls->is_action()) {
    $controls->data = $module->options;
} else {
    if ($controls->is_action('save')) {
        $module->save_options($controls->data);
        $controls->messages = 'Saved.';
    }
    if ($controls->is_action('refresh')) {
    }
    if ($controls->is_action('empty')) {
        update_option($module->prefix . '_record', array());
    }
}
?>

<div class="wrap">


    <h2>Newsletter Grabber Extension</h2>

    <?php 
$controls->show();
?>

        <p>
Ejemplo n.º 3
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'] . "'";
                }
Ejemplo n.º 4
0
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
$options = stripslashes_deep($_POST['options']);
$options_lists = get_option('newsletter_profile');
$options_profile = get_option('newsletter_profile');
$options_main = get_option('newsletter_main');
$lists = array('' => 'Any');
for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
    if (empty($options_lists['list_' . $i])) {
        continue;
    }
    $lists['' . $i] = '(' . $i . ') ' . $options_lists['list_' . $i];
}
if ($controls->is_action('resend')) {
    $user = NewsletterUsers::instance()->get_user($controls->button_data);
    $opts = get_option('newsletter');
    $newsletter->mail($user->email, $newsletter->replace($opts['confirmation_subject'], $user), $newsletter->replace($opts['confirmation_message'], $user));
    $controls->messages = 'Activation email resent to ' . $user->email;
}
if ($controls->is_action('resend_welcome')) {
    $user = NewsletterUsers::instance()->get_user($controls->button_data);
    $opts = get_option('newsletter');
    $newsletter->mail($user->email, $newsletter->replace($opts['confirmed_subject'], $user), $newsletter->replace($opts['confirmed_message'], $user));
    $controls->messages = 'Welcome email resent.';
}
if ($controls->is_action('remove')) {
    $wpdb->query($wpdb->prepare("delete from " . $wpdb->prefix . "newsletter where id=%d", $controls->button_data));
    unset($controls->data['subscriber_id']);
}
Ejemplo n.º 5
0
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
// Always required
$email_id = $_GET['id'];
$email = Newsletter::instance()->get_email($email_id, ARRAY_A);
// If there is no action we assume we are enter the first time so we populate the
// $nc->data with the editable email fields
if (!$controls->is_action()) {
    $controls->data = $email;
    if (!empty($email['preferences'])) {
        $controls->data['preferences'] = explode(',', $email['preferences']);
    }
    if (!empty($email['sex'])) {
        $controls->data['sex'] = explode(',', $email['sex']);
    }
    $email_options = unserialize($email['options']);
    if (is_array($email_options)) {
        $controls->data = array_merge($controls->data, $email_options);
    }
}
if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('editor')) {
    // If we were editing with visual editor (==0), we must read the extra <body> content
    if ($email['editor'] == 0) {
        $x = strpos($email['message'], '<body');
        if ($x !== false) {
            $x = strpos($email['message'], '>', $x);
            $email['message'] = substr($email['message'], 0, $x + 1) . $controls->data['message'] . '</body></html>';
        } else {
Ejemplo n.º 6
0
// Stops WP Super Cache which removes the logged_in cookie
$_GET['preview'] = 'true';
require_once '../../../../wp-load.php';
if (!is_user_logged_in()) {
    die('No logged in user found. A plugin is almost surely removing the authentication cookies, usually a cache plugin. Try to report the issue on http://www.thenewsletterplugin.com forum.');
}
if (!current_user_can('manage_categories')) {
    die('Not enough privileges');
}
if (Newsletter::instance()->options['editor'] != 1 && !current_user_can('manage_options')) {
    die('Not enough privileges');
}
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
if ($controls->is_action('create')) {
    $module->save_options($controls->data);
    $email = array();
    $email['status'] = 'new';
    $email['subject'] = '';
    //__('Here the email subject', 'newsletter-emails');
    $email['track'] = 1;
    $theme_options = $module->get_current_theme_options();
    $theme_url = $module->get_current_theme_url();
    $theme_subject = '';
    ob_start();
    include $module->get_current_theme_file_path('theme.php');
    $email['message'] = ob_get_clean();
    if (!empty($theme_subject)) {
        $email['subject'] = $theme_subject;
    }
Ejemplo n.º 7
0
<?php

if (function_exists('load_plugin_textdomain')) {
    load_plugin_textdomain('newsletter-emails', false, 'newsletter/emails/languages');
    load_plugin_textdomain('newsletter', false, 'newsletter/languages');
}
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
if ($controls->is_action('theme')) {
    $controls->merge($module->themes->get_options($controls->data['theme']));
    $module->save_options($controls->data);
    // If this theme has no intermediate options...
    if (!file_exists($module->get_current_theme_file_path('theme-options.php'))) {
        $email = array();
        $email['status'] = 'new';
        $email['subject'] = __('Here the email subject', 'newsletter-emails');
        $email['track'] = 1;
        $theme_options = $module->get_current_theme_options();
        $theme_url = $module->get_current_theme_url();
        $theme_subject = '';
        ob_start();
        include $module->get_current_theme_file_path('theme.php');
        $email['message'] = ob_get_clean();
        if (!empty($theme_subject)) {
            $email['subject'] = $theme_subject;
        }
        ob_start();
        include $module->get_current_theme_file_path('theme-text.php');
        $email['message_text'] = ob_get_clean();
        $email['type'] = 'message';
Ejemplo n.º 8
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();
?>
Ejemplo n.º 9
0
<?php

require_once '../../../../wordpress/wp-load.php';
$newsletter = Newsletter::instance();
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
// TODO: Check the user capabilities
if (current_user_can('manage_options') || $newsletter->options['editor'] == 1 && current_user_can('manage_categories')) {
    $controls = new NewsletterControls();
    if ($controls->is_action('export')) {
        NewsletterUsers::instance()->export($controls->data);
    }
} else {
    die('Not allowed.');
}
Ejemplo n.º 10
0
<?php

require_once dirname(__FILE__) . '/controls.php';
$module = NewsletterMandrill::$instance;
$controls = new NewsletterControls();
if (!$controls->is_action()) {
    $controls->data = $module->options;
} else {
    if ($controls->is_action('save')) {
        $module->save_options($controls->data);
        $controls->messages = 'Saved.';
    }
    if ($controls->is_action('trigger')) {
        $res = $module->bounce();
        if (!empty($module->mandrill_result)) {
            $controls->errors = $module->mandrill_result;
        } else {
            $controls->messages = $module->bounce_result;
        }
    }
    if ($controls->is_action('reset')) {
        $module->save_last_run(0);
        $controls->messages = 'Done.';
    }
    if ($controls->is_action('smtp_test')) {
        $message['html'] = "<!DOCTYPE html>\n";
        $message['html'] .= "This is the rich text (HTML) version of a test message sent via Mandrill.</p>\n";
        $message['html'] .= "This is a <strong>bold text</strong></p>\n";
        $message['html'] .= "This is a <a href='http://www.satollo.net'>link to www.satollo.net</a></p>\n";
        $message['text'] = 'This is the TEXT version of a test message sent via Mandrill. You should see this message only if you email client does not support the rich text (HTML) version.';
        if ($controls->data['api'] == 1) {
Ejemplo n.º 11
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
if (!$controls->is_action()) {
    $controls->data = get_option('newsletter_main');
} else {
    if ($controls->is_action('remove')) {
        $wpdb->query("delete from " . $wpdb->prefix . "options where option_name like 'newsletter%'");
        $wpdb->query("drop table " . $wpdb->prefix . "newsletter, " . $wpdb->prefix . "newsletter_stats, " . $wpdb->prefix . "newsletter_emails, " . $wpdb->prefix . "newsletter_work");
        echo 'Newsletter plugin destroyed. Please, deactivate it now.';
        return;
    }
    if ($controls->is_action('save')) {
        $errors = null;
        // Validation
        $controls->data['sender_email'] = $newsletter->normalize_email($controls->data['sender_email']);
        if (!$newsletter->is_email($controls->data['sender_email'])) {
            $controls->errors .= 'The sender email address is not correct.<br>';
        }
        $controls->data['return_path'] = $newsletter->normalize_email($controls->data['return_path']);
        if (!$newsletter->is_email($controls->data['return_path'], true)) {
            $controls->errors .= 'Return path email is not correct.<br>';
        }
        $controls->data['php_time_limit'] = (int) $controls->data['php_time_limit'];
        if ($controls->data['php_time_limit'] == 0) {
            unset($controls->data['php_time_limit']);
        }
        //$controls->data['test_email'] = $newsletter->normalize_email($controls->data['test_email']);
        //if (!$newsletter->is_email($controls->data['test_email'], true)) {
        //    $controls->errors .= 'Test email is not correct.<br />';
Ejemplo n.º 12
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterWp::instance();
if (!$controls->is_action()) {
    $controls->data = $module->options;
} else {
    if ($controls->is_action('save')) {
        //$module->merge_options($controls->data);
        unset($controls->data['align_wp_users_status']);
        $module->save_options($controls->data);
        $controls->add_message_saved();
    }
    if ($controls->is_action('align_wp_users')) {
        ignore_user_abort(true);
        set_time_limit(0);
        // TODO: check if the user is already there
        $wp_users = $wpdb->get_results("select id, user_email, user_login from {$wpdb->users}");
        $count = 0;
        foreach ($wp_users as &$wp_user) {
            // A subscriber is already there with the same wp_user_id? Do Nothing.
            $nl_user = $module->get_user_by_wp_user_id($wp_user->id);
            if (!empty($nl_user)) {
                continue;
            }
            // A subscriber has the same email? Align them if not already associated to another wordpress user
            $nl_user = $module->get_user($module->normalize_email($wp_user->user_email));
            if (!empty($nl_user)) {
                if (empty($nl_user->wp_user_id)) {
                    //$module->logger->info('Linked');
Ejemplo n.º 13
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = Newsletter::instance();
if (!$controls->is_action()) {
    $controls->data = get_option('newsletter_main');
} else {
    if ($controls->is_action('remove')) {
    }
}
?>


<div class="wrap" id="tnp-wrap">

    <?php 
include NEWSLETTER_DIR . '/tnp-header.php';
?>

    <div id="tnp-heading">

        <h2><?php 
_e('General Settings', 'newsletter');
?>
</h2>

    </div>

    <div id="tnp-body">
Ejemplo n.º 14
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
// TODO: Remove and use the $module->options.
$options = get_option('newsletter', array());
if ($controls->is_action()) {
    if ($controls->is_action('save')) {
        $defaults = $module->get_default_options();
        if (empty($controls->data['profile_text'])) {
            $controls->data['profile_text'] = $defaults['profile_text'];
        }
        // Without the last curly bracket since there can be a form number apended
        if (empty($controls->data['subscription_text'])) {
            $controls->data['subscription_text'] = $defaults['subscription_text'];
        }
        if (empty($controls->data['confirmation_text'])) {
            $controls->data['confirmation_text'] = $defaults['confirmation_text'];
        }
        if (empty($controls->data['confirmation_subject'])) {
            $controls->data['confirmation_subject'] = $defaults['confirmation_subject'];
        }
        if (empty($controls->data['confirmation_message'])) {
            $controls->data['confirmation_message'] = $defaults['confirmation_message'];
        }
        if (empty($controls->data['confirmed_text'])) {
            $controls->data['confirmed_text'] = $defaults['confirmed_text'];
        }
        if (empty($controls->data['confirmed_subject'])) {
            $controls->data['confirmed_subject'] = $defaults['confirmed_subject'];
Ejemplo n.º 15
0
<?php

@(include_once 'commons.php');
$nc = new NewsletterControls();
if (!$nc->is_action()) {
    $nc->data = get_option('newsletter_main');
} else {
    if ($nc->is_action('remove')) {
        $wpdb->query("delete from " . $wpdb->prefix . "options where option_name like 'newsletter%'");
        $wpdb->query("drop table " . $wpdb->prefix . "newsletter, " . $wpdb->prefix . "newsletter_stats, " . $wpdb->prefix . "newsletter_emails, " . $wpdb->prefix . "newsletter_profiles, " . $wpdb->prefix . "newsletter_work");
        echo 'Newsletter plugin destroyed. Please, deactivate it now.';
        return;
    }
    if ($nc->is_action('save')) {
        $errors = null;
        // Validation
        $nc->data['sender_email'] = $newsletter->normalize_email($nc->data['sender_email']);
        if (!$newsletter->is_email($nc->data['sender_email'])) {
            $errors = __('Sender email is not correct');
        }
        $nc->data['return_path'] = $newsletter->normalize_email($nc->data['return_path']);
        if (!$newsletter->is_email($nc->data['return_path'], true)) {
            $errors = __('Return path email is not correct');
        }
        // With some providers the return path must be left empty
        //if (empty($options['return_path'])) $options['return_path'] = $options['sender_email'];
        $nc->data['test_email'] = $newsletter->normalize_email($nc->data['test_email']);
        if (!$newsletter->is_email($nc->data['test_email'], true)) {
            $errors = __('Test email is not correct');
        }
        $nc->data['reply_to'] = $newsletter->normalize_email($nc->data['reply_to']);
Ejemplo n.º 16
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
if (!$controls->is_action()) {
    $controls->data = get_option('newsletter_profile');
} else {
    if ($controls->is_action('save')) {
        update_option('newsletter_profile', $controls->data);
    }
    if ($controls->is_action('reset')) {
        // TODO: Move this inside the module
        @(include NEWSLETTER_DIR . '/subscription/languages/profile-en_US.php');
        @(include NEWSLETTER_DIR . '/subscription/languages/profile-' . WPLANG . '.php');
        update_option('newsletter_profile', array_merge(get_option('newsletter_profile', array()), $options));
        $controls->data = get_option('newsletter_profile');
    }
}
$status = array(0 => 'Disabled/Private use', 1 => 'Only on profile page', 2 => 'Even on subscription forms');
$rules = array(0 => 'Optional', 1 => 'Required');
?>

<div class="wrap">
    <?php 
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/subscription-module';
?>
    <?php 
include NEWSLETTER_DIR . '/header-new.php';
?>
Ejemplo n.º 17
0
<?php

/* @var $wpdb wpdb */
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
// Always required
$email = Newsletter::instance()->get_email((int) $_GET['id'], ARRAY_A);
if (empty($email)) {
    echo 'Wrong email identifier';
    return;
}
$email_id = $email['id'];
// If there is no action we assume we are enter the first time so we populate the
// $nc->data with the editable email fields
if (!$controls->is_action()) {
    $controls->data = $email;
    if (!empty($email['preferences'])) {
        $controls->data['preferences'] = explode(',', $email['preferences']);
    }
    if (!empty($email['sex'])) {
        $controls->data['sex'] = explode(',', $email['sex']);
    }
    $email_options = unserialize($email['options']);
    if (is_array($email_options)) {
        $controls->data = array_merge($controls->data, $email_options);
    }
}
if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('editor')) {
    // If we were editing with visual editor (==0), we must read the extra <body> content
    if ($email['editor'] == 0) {
Ejemplo n.º 18
0
<?php

@(include_once 'commons.php');
$nc = new NewsletterControls();
if (!$nc->is_action()) {
    $nc->data = get_option('newsletter_profile');
} else {
    if ($nc->is_action('save')) {
        update_option('newsletter_profile', $nc->data);
    }
    if ($nc->is_action('reset')) {
        include dirname(__FILE__) . '/languages/en_US.php';
        @(include dirname(__FILE__) . '/languages/' . WPLANG . '.php');
        update_option('newsletter_profile', $defaults_profile);
        $nc->data = $defaults_profile;
    }
}
$nc->errors($errors);
$nc->messages($messages);
$status = array(0 => 'Disabled', 1 => 'Only on profile page', 2 => 'Even on subscription page');
?>
<script type="text/javascript" src="<?php 
echo get_option('siteurl');
?>
/wp-content/plugins/newsletter/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
    tinyMCE.init({
        mode : "specific_textareas",
        editor_selector : "visual",
        theme : "advanced",
        theme_advanced_disable : "styleselect",
Ejemplo n.º 19
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
if ($controls->is_action('save')) {
    update_option('newsletter_log_level', $controls->data['log_level']);
    update_option('newsletter_diagnostic', $controls->data);
    $controls->messages = 'Loggin levels saved.';
}
if ($controls->is_action('reset_cron_calls')) {
    update_option($module->prefix . '_cron_calls', false);
    $controls->messages = 'Reset.';
}
if ($controls->is_action('check-versions')) {
    $newsletter->hook_newsletter_extension_versions(true);
    $controls->messages = 'Extensions data updated. Go to the plugins panel to see if there are updates available.';
}
if ($controls->is_action('trigger')) {
    $newsletter->hook_newsletter();
    $controls->messages = 'Delivery engine triggered.';
}
if ($controls->is_action('undismiss')) {
    update_option('newsletter_dismissed', array());
    $controls->messages = 'Notices restored.';
}
if ($controls->is_action('trigger_followup')) {
    NewsletterFollowup::instance()->send();
    $controls->messages = 'Follow up delivery engine triggered.';
}
if ($controls->is_action('engine_on')) {
    wp_clear_scheduled_hook('newsletter');
Ejemplo n.º 20
0
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
$id = (int) $_GET['id'];
if ($controls->is_action('save')) {
    // For unselected preferences, force the zero value
    for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
        if (!isset($controls->data['list_' . $i])) {
            $controls->data['list_' . $i] = 0;
        }
    }
    $controls->data['id'] = $id;
    $r = $module->save_user($controls->data);
    if ($r === false) {
        $controls->errors = 'Unable to update, may be the email (if changed) is duplicated.';
    } else {
        $controls->messages = 'Updated.';
        $controls->data = $module->get_user($id, ARRAY_A);
    }
}
if ($controls->is_action('delete')) {
    $module->delete_user($id);
    $controls->js_redirect($module->get_admin_page_url('index'));
    return;
}
if (!$controls->is_action()) {
    $controls->data = $module->get_user($id, ARRAY_A);
}
$options_profile = get_option('newsletter_profile');
Ejemplo n.º 21
0
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
$options = $controls->data;
$options_lists = get_option('newsletter_profile');
$options_profile = get_option('newsletter_profile');
$options_main = get_option('newsletter_main');
// Move to base zero
if ($controls->is_action()) {
    $controls->data['search_page'] = (int) $controls->data['search_page'] - 1;
    $module->save_options($controls->data, 'search');
} else {
    $controls->data = $module->get_options('search');
    if (empty($controls->data['search_page'])) {
        $controls->data['search_page'] = 0;
    }
}
$lists = array('' => 'Any');
for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
    if (empty($options_lists['list_' . $i])) {
        continue;
    }
    $lists['' . $i] = '(' . $i . ') ' . $options_lists['list_' . $i];
}
if ($controls->is_action('resend')) {
    $user = NewsletterUsers::instance()->get_user($controls->button_data);
    $opts = get_option('newsletter');
    NewsletterSubscription::instance()->mail($user->email, $newsletter->replace($opts['confirmation_subject'], $user), $newsletter->replace($opts['confirmation_message'], $user));
    $controls->messages = 'Activation email resent to ' . $user->email;
Ejemplo n.º 22
0
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
$options_profile = get_option('newsletter_profile');
if ($controls->is_action('import')) {
    $mode = $controls->data['mode'];
    // TODO: to be removed, it's not safe
    @set_time_limit(100000);
    $results = '';
    if (is_uploaded_file($_FILES['csv_file']['tmp_name'])) {
        $lines = file($_FILES['csv_file']['tmp_name']);
    } else {
        $csv = stripslashes($controls->data['csv']);
        $lines = explode("\n", $csv);
    }
    // Set the selected preferences inside the
    if (!is_array($controls->data['preferences'])) {
        $controls->data['preferences'] = array();
    }
    //    if ($options['followup'] == 'activate') {
    //        $subscriber['followup'] = 1;
    //    }
    $error_count = 0;
    $added_count = 0;
    $updated_count = 0;
    $skipped_count = 0;
    foreach ($lines as &$line) {
        // Parse the CSV line
        $line = trim($line);
Ejemplo n.º 23
0
<?php

@(include_once 'commons.php');
$nc = new NewsletterControls();
$emails = $wpdb->get_results("select * from " . $wpdb->prefix . "newsletter_emails where type='email' order by id desc");
if ($nc->is_action('send')) {
    $newsletter->hook_newsletter();
}
?>

<div class="wrap">

<h2>Messages</h2>

<?php 
include dirname(__FILE__) . '/header.php';
?>

<form method="post" action="admin.php?page=newsletter/emails.php">
    <?php 
$nc->init();
?>

<p><a href="admin.php?page=newsletter/emails-edit.php&amp;id=0" class="button">New message</a></p>
<p>
    Delivery engine next run: <?php 
echo wp_next_scheduled('newsletter') - time();
?>
 seconds
    <?php 
$nc->button('send', 'Trigger now');
Ejemplo n.º 24
0
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
if ($controls->is_action('convert')) {
    $module->convert_old_emails();
    $controls->messages = 'Converted!';
}
if ($controls->is_action('unconvert')) {
    $wpdb->query("update wp_newsletter_emails set type='email' where type='message'");
    $controls->messages = 'Unconverted!';
}
if ($controls->is_action('send')) {
    $newsletter->hook_newsletter();
    $controls->messages .= __('Delivery engine triggered.', 'newsletter');
}
if ($controls->is_action('copy')) {
    $original = Newsletter::instance()->get_email($_POST['btn']);
    $email = array();
    $email['subject'] = $original->subject;
    $email['message'] = $original->message;
    $email['message_text'] = $original->message_text;
    $email['send_on'] = time();
    $email['type'] = 'message';
    $email['editor'] = $original->editor;
    $email['track'] = $original->track;
    Newsletter::instance()->save_email($email);
    $controls->messages .= __('Message duplicated.', 'newsletter');
}
if ($controls->is_action('delete')) {
Ejemplo n.º 25
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$module = Newsletter::instance();
$controls = new NewsletterControls();
if (!$controls->is_action()) {
    $controls->data = $module->get_options('smtp');
} else {
    if ($controls->is_action('save')) {
        if ($controls->data['enabled'] && empty($controls->data['host'])) {
            $controls->errors = 'The host must be set to enable the SMTP';
        }
        if (empty($controls->errors)) {
            $module->save_options($controls->data, 'smtp');
            $controls->messages .= __('Saved. Remember to test your changes right now!', 'newsletter');
        }
    }
    if ($controls->is_action('test')) {
        require_once ABSPATH . WPINC . '/class-phpmailer.php';
        require_once ABSPATH . WPINC . '/class-smtp.php';
        $mail = new PHPMailer();
        ob_start();
        $mail->IsSMTP();
        $mail->SMTPDebug = true;
        $mail->CharSet = 'UTF-8';
        $message = 'This Email is sent by PHPMailer of WordPress';
        $mail->IsHTML(false);
        $mail->Body = $message;
        $mail->From = $module->options['sender_email'];
        $mail->FromName = $module->options['sender_name'];
        if (!empty($module->options['return_path'])) {
Ejemplo n.º 26
0
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$module = NewsletterStatistics::instance();
$controls = new NewsletterControls();
$emails = Newsletter::instance()->get_emails();
if ($controls->is_action('save')) {
    $module->save_options($controls->data);
    $controls->messages = 'Saved.';
}
?>

<div class="wrap">
    <?php 
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/statistics-module';
?>

    <?php 
include NEWSLETTER_DIR . '/header-new.php';
?>

    <div id="newsletter-title">
        <h2>Configuration and Email List</h2>

        <p>
            This module is a core part of Newsletter that collects statistics about sent emails: how many have
            been read, how many have been clicked and so on.
        </p>
        <p>
            To see the statistics of each single email, you should click the "statistics" button
            you will find near each message where they are listed (like on Newsletters panel). For your
Ejemplo n.º 27
0
<?php

@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
$options_profile = get_option('newsletter_profile');
$lists = array();
for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
    if (!isset($options_profile['list_' . $i])) {
        $options_profile['list_' . $i] = '';
    }
    $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
}
if ($controls->is_action('remove_unconfirmed')) {
    $r = $wpdb->query("delete from " . NEWSLETTER_USERS_TABLE . " where status='S'");
    $controls->messages = __('Subscribers not confirmed deleted: ', 'newsletter') . $r . '.';
}
if ($controls->is_action('remove_unsubscribed')) {
    $r = $wpdb->query("delete from " . NEWSLETTER_USERS_TABLE . " where status='U'");
    $controls->messages = __('Subscribers unsubscribed deleted: ', 'newsletter') . $r . '.';
}
if ($controls->is_action('remove_bounced')) {
    $r = $wpdb->query("delete from " . NEWSLETTER_USERS_TABLE . " where status='B'");
    $controls->messages = __('Subscribers bounced deleted: ', 'newsletter') . $r . '.';
}
if ($controls->is_action('unconfirm_all')) {
    $r = $wpdb->query("update " . NEWSLETTER_USERS_TABLE . " set status='S' where status='C'");
    $controls->messages = __('Subscribers changed to not confirmed: ', 'newsletter') . $r . '.';
}
if ($controls->is_action('confirm_all')) {
    $r = $wpdb->query("update " . NEWSLETTER_USERS_TABLE . " set status='C' where status='S'");
Ejemplo n.º 28
0
Archivo: theme.php Proyecto: jekv/devia
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
if ($controls->is_action('theme')) {
    $controls->merge($module->themes->get_options($controls->data['theme']));
    $module->save_options($controls->data);
}
if ($controls->data == null) {
    $controls->data = $module->get_options();
}
function newsletter_emails_update_options($options)
{
    add_option('newsletter_emails', '', null, 'no');
    update_option('newsletter_emails', $options);
}
function newsletter_emails_update_theme_options($theme, $options)
{
    $x = strrpos($theme, '/');
    if ($x !== false) {
        $theme = substr($theme, $x + 1);
    }
    add_option('newsletter_emails_' . $theme, '', null, 'no');
    update_option('newsletter_emails_' . $theme, $options);
}
function newsletter_emails_get_options()
{
    $options = get_option('newsletter_emails', array());
    return $options;
}
Ejemplo n.º 29
0
<?php

/* @var $wpdb wpdb */
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$module = NewsletterStatistics::instance();
$controls = new NewsletterControls();
if ($controls->is_action('country')) {
    $module->country();
    $controls->messages = $module->country_result;
}
if ($controls->is_action('import')) {
    $wpdb->query("insert ignore into " . $wpdb->prefix . "newsletter_sent (user_id, email_id, time) select user_id, email_id, UNIX_TIMESTAMP(created) from " . NEWSLETTER_STATS_TABLE);
    $controls->messages = 'Done!';
}
$types = $wpdb->get_results("select distinct type from " . NEWSLETTER_EMAILS_TABLE);
$type_options = array();
foreach ($types as $type) {
    if ($type->type == 'followup') {
        continue;
    }
    if ($type->type == 'message') {
        $type_options[$type->type] = 'Standard Newsletter';
    } else {
        if ($type->type == 'feed') {
            $type_options[$type->type] = 'Feed by Mail';
        } else {
            if (strpos($type->type, 'automated') === 0) {
                list($a, $id) = explode('_', $type->type);
                $type_options[$type->type] = 'Automated Channel ' . $id;
            } else {
                $type_options[$type->type] = $type->type;