Файловый менеджер - Редактировать - /home/bean7936/perfect-community.com/442aa3/users.zip
Назад
PK .��\Nl�� � import.phpnu �[��� <?php /** @var NewsletterUsersAdmin $this */ /** @var NewsletterControls $controls */ /** @var NewsletterLogger $logger */ defined('ABSPATH') || exit; ?> <div class="wrap" id="tnp-wrap"> <?php include NEWSLETTER_ADMIN_HEADER; ?> <div id="tnp-heading"> <?php $controls->title_help('/subscribers-and-management/') ?> <!-- <h2><?php esc_html_e('Subscribers', 'newsletter') ?></h2>--> <?php include __DIR__ . '/nav.php' ?> </div> <div id="tnp-body" class="tnp-users tnp-users-import"> <p> The import and export features have been consolidated in the <strong>free</strong> Import Addon you can find on <a href="?page=<?php echo class_exists('NewsletterExtensions') ? 'newsletter_extensions_index' : 'newsletter_main_extensions' ?>">addons management panel</a>. Please install that addon to have: </p> <ul> <li>File upload or copy and paste of data</li> <li>Background processing for long set of data</li> <li>Quick bounced address import</li> <li>Export with filter by list and status</li> </ul> <p> Documentation about Import Addon can be <a href="https://www.thenewsletterplugin.com/documentation/addons/extended-features/advanced-import/" target="_blank">found here</a>.</p> </p> </div> <?php include NEWSLETTER_ADMIN_FOOTER; ?> </div> PK .��\�R��rU rU statistics.phpnu �[��� <?php /** @var wpdb $wpdb */ /** @var NewsletterUsersAdmin $this */ /** @var NewsletterControls $controls */ /** @var NewsletterLogger $logger */ defined('ABSPATH') || exit; wp_enqueue_script('tnp-chart'); $all_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE); $referres = $wpdb->get_results("select referrer, count(*) as total, SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE . " group by referrer order by confirmed desc"); ?> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load("current", {packages: ['corechart', 'geochart', 'geomap']}); </script> <div class="wrap" id="tnp-wrap"> <?php include NEWSLETTER_ADMIN_HEADER; ?> <div id="tnp-heading"> <?php $controls->title_help('/subscribers-and-management/') ?> <!-- <h2><?php esc_html_e('Subscribers', 'newsletter') ?></h2>--> <?php include __DIR__ . '/nav.php' ?> </div> <div id="tnp-body" class="tnp-users-statistics"> <?php $controls->show(); ?> <?php $controls->init(); ?> <div id="tabs"> <ul> <li><a href="#tabs-overview"><?php esc_html_e('By Status', 'newsletter'); ?></a></li> <li><a href="#tabs-lists"><?php esc_html_e('By Lists', 'newsletter'); ?></a></li> <li><a href="#tabs-language"><?php esc_html_e('By Language', 'newsletter'); ?></a></li> <li><a href="#tabs-countries"><?php esc_html_e('By location', 'newsletter'); ?></a></li> <li><a href="#tabs-referrers"><?php esc_html_e('By Referrer', 'newsletter'); ?></a></li> <li><a href="#tabs-sources"><?php esc_html_e('By URL', 'newsletter'); ?></a></li> <li><a href="#tabs-gender"><?php esc_html_e('By Gender', 'newsletter'); ?></a></li> <li><a href="#tabs-time"><?php esc_html_e('By Time', 'newsletter'); ?></a></li> </ul> <div id="tabs-overview"> <?php $list = $wpdb->get_row("select count(*) as total, SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE); ?> <div class="row"> <div class="col-md-6"> <table class="widefat" style="width: 250px"> <thead> <tr> <th><?php esc_html_e('Status', 'newsletter') ?></th> <th><?php esc_html_e('Total', 'newsletter') ?></th> </tr> </thead> <tbody> <tr> <td><?php esc_html_e('Any', 'newsletter') ?></td> <td> <?php echo (int)$list->total; ?> </td> </tr> <tr> <td><?php esc_html_e('Confirmed', 'newsletter') ?></td> <td> <?php echo (int)$list->confirmed; ?> </td> </tr> <tr> <td><?php esc_html_e('Not confirmed', 'newsletter') ?></td> <td> <?php echo (int)$list->unconfirmed; ?> </td> </tr> <tr> <td><?php esc_html_e('Unsubscribed', 'newsletter') ?></td> <td> <?php echo (int)$list->unsubscribed; ?> </td> </tr> <tr> <td><?php esc_html_e('Bounced', 'newsletter') ?></td> <td> <?php echo (int)$list->bounced; ?> </td> </tr> <tr> <td><?php esc_html_e('Complained', 'newsletter') ?></td> <td> <?php echo (int)$list->complained; ?> </td> </tr> </tbody> </table> </div> <div class="col-md-6"> <div style="height: 250px;"> <canvas id="tnp-users-chart-status"></canvas> </div> <script> const dataStatus = { labels: ['Confirmed', 'Unconfirmed', 'Unsubscribed', 'Bounced', 'Complained'], datasets: [{ label: 'Status', backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"], // borderWidth: 1, data: <?php echo json_encode([(int) $list->confirmed, (int) $list->unconfirmed, (int) $list->unsubscribed, (int) $list->bounced, (int) $list->complained]) ?>, }] }; jQuery(function () { const myChartx = new Chart( document.getElementById('tnp-users-chart-status'), { type: 'doughnut', data: dataStatus, options: { maintainAspectRatio: false, legend: { position: 'right' } } }); }); </script> </div> </div> </div> <div id="tabs-lists"> <table class="widefat" style="width: auto"> <thead> <tr> <th> </th> <th><?php esc_html_e('List', 'newsletter') ?></th> <th style="text-align: right"><?php esc_html_e('Total', 'newsletter') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('C') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('S') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('U') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('B') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('P') ?></th> </tr> </thead> <tbody> <?php $lists = $this->get_lists(); ?> <?php foreach ($lists as $list) { ?> <?php $row = $wpdb->get_row("select count(*) as total, SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE . " where list_" . $list->id . "=1"); ?> <tr> <td><?php echo esc_html($list->id) ?></td> <td><?php echo esc_html($list->name) ?></td> <td style="text-align: right"><?php echo (int) $row->total; ?></td> <td style="text-align: right"><?php echo (int) $row->confirmed; ?></td> <td style="text-align: right"><?php echo (int) $row->unconfirmed; ?></td> <td style="text-align: right"><?php echo (int) $row->unsubscribed; ?></td> <td style="text-align: right"><?php echo (int) $row->bounced; ?></td> <td style="text-align: right"><?php echo (int) $row->complained; ?></td> </tr> <?php } ?> <?php $where = ' 1=1'; for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { $where .= ' and list_' . $i . '=0'; } $row = $wpdb->get_row("select count(*) as total, SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE . " where " . $where); ?> <tr> <td> </td> <td style="font-style: italic"><?php esc_html_e('None', 'newsletter') ?></td> <td style="text-align: right"><?php echo (int)$row->total; ?></td> <td style="text-align: right"><?php echo (int)$row->confirmed; ?></td> <td style="text-align: right"><?php echo (int)$row->unconfirmed; ?></td> <td style="text-align: right"><?php echo (int)$row->unsubscribed; ?></td> <td style="text-align: right"><?php echo (int)$row->bounced; ?></td> <td style="text-align: right"><?php echo (int)$row->complained; ?></td> </tr> </tbody> </table> </div> <div id="tabs-language"> <?php if ($this->is_multilanguage()) { ?> <?php $languages = $this->get_languages(); ?> <table class="widefat" style="width: auto"> <thead> <tr> <th><?php esc_html_e('Status', 'newsletter') ?></th> <th><?php esc_html_e('Total', 'newsletter') ?></th> </tr> <tbody> <?php foreach ($languages as $code => $label) { ?> <tr> <td><?php echo esc_html($label) ?></td> <td> <?php echo (int)$wpdb->get_var($wpdb->prepare("select count(*) from " . NEWSLETTER_USERS_TABLE . " where language=%s", $code)); ?> </td> </tr> <?php } ?> <tr> <td><?php esc_html_e('Without language', 'newsletter') ?></td> <td> <?php echo (int)$wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where language=''"); ?> </td> </tr> </thead> </tbody> </table> <?php } else { ?> <p> This panel is active when a <a href="https://www.thenewsletterplugin.com/documentation/newsletters/multilanguage/" target="_blank">supported multilanguage plugin</a> is installed. </p> <?php } ?> </div> <div id="tabs-countries"> <?php if (!has_action('newsletter_users_statistics_countries')) { include __DIR__ . '/statistics-countries.php'; } else { do_action('newsletter_users_statistics_countries', $controls); } ?> </div> <div id="tabs-referrers"> <table class="widefat" style="width: auto"> <thead> <tr> <th><?php esc_html_e('Referrer', 'newsletter') ?></th> <th style="text-align: right"><?php esc_html_e('Total', 'newsletter') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('C') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('S') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('U') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('B') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('P') ?></th> </tr> </thead> <tbody> <?php foreach ($referres as $row) { ?> <tr> <td><?php echo empty($row->referrer) ? '[not set]' : esc_html($row->referrer) ?></td> <td style="text-align: right"><?php echo (int)$row->total; ?></td> <td style="text-align: right"><?php echo (int)$row->confirmed; ?></td> <td style="text-align: right"><?php echo (int)$row->unconfirmed; ?></td> <td style="text-align: right"><?php echo (int)$row->unsubscribed; ?></td> <td style="text-align: right"><?php echo (int)$row->bounced; ?></td> <td style="text-align: right"><?php echo (int)$row->complained; ?></td> </tr> <?php } ?> </tbody> </table> </div> <div id="tabs-sources"> <?php $list = $wpdb->get_results("select http_referer, count(*) as total, SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE . " group by http_referer order by count(*) desc limit 100"); ?> <table class="widefat" style="width: auto"> <thead> <tr> <th>URL</th> <th style="text-align: right"><?php esc_html_e('Total', 'newsletter') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('C') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('S') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('U') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('B') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('P') ?></th> </tr> </thead> <tbody> <?php foreach ($list as $row) { ?> <tr> <td><?php echo esc_html(empty($row->http_referer) ? '[not set]' : $controls->print_truncated($row->http_referer, 120)); ?></td> <td style="text-align: right"><?php echo (int)$row->total; ?></td> <td style="text-align: right"><?php echo (int)$row->confirmed; ?></td> <td style="text-align: right"><?php echo (int)$row->unconfirmed; ?></td> <td style="text-align: right"><?php echo (int)$row->unsubscribed; ?></td> <td style="text-align: right"><?php echo (int)$row->bounced; ?></td> <td style="text-align: right"><?php echo (int)$row->complained; ?></td> </tr> <?php } ?> </tbody> </table> </div> <div id="tabs-gender"> <?php $male_count = $wpdb->get_row("select SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE . " where sex='m'"); $female_count = $wpdb->get_row("select SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE . " where sex='f'"); $none_count = $wpdb->get_row("select SUM(if(status='C', 1, 0)) as confirmed, SUM(if(status='S', 1, 0)) as unconfirmed, SUM(if(status='B', 1, 0)) as bounced, SUM(if(status='U', 1, 0)) as unsubscribed, SUM(if(status='P', 1, 0)) as complained from " . NEWSLETTER_USERS_TABLE . " where sex='n'"); ?> <table class="widefat" style="width: auto"> <thead> <tr> <th><?php esc_html_e('Gender', 'newsletter') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('C') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('S') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('U') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('B') ?></th> <th style="text-align: right"><?php $this->echo_user_status_label('P') ?></th> </tr> </thead> <tbody> <tr> <td><?php esc_html_e('Female', 'newsletter') ?></td> <td style="text-align: right"><?php echo (int)$female_count->confirmed; ?></td> <td style="text-align: right"><?php echo (int)$female_count->unconfirmed; ?></td> <td style="text-align: right"><?php echo (int)$female_count->unsubscribed; ?></td> <td style="text-align: right"><?php echo (int)$female_count->bounced; ?></td> <td style="text-align: right"><?php echo (int)$female_count->complained; ?></td> </tr> <tr> <td><?php esc_html_e('Male', 'newsletter') ?></td> <td style="text-align: right"><?php echo (int)$male_count->confirmed; ?></td> <td style="text-align: right"><?php echo (int)$male_count->unconfirmed; ?></td> <td style="text-align: right"><?php echo (int)$male_count->unsubscribed; ?></td> <td style="text-align: right"><?php echo (int)$male_count->bounced; ?></td> <td style="text-align: right"><?php echo (int)$male_count->complained; ?></td> </tr> <tr> <td><?php esc_html_e('Not specified', 'newsletter') ?></td> <td style="text-align: right"><?php echo (int)$none_count->confirmed; ?></td> <td style="text-align: right"><?php echo (int)$none_count->unconfirmed; ?></td> <td style="text-align: right"><?php echo (int)$none_count->unsubscribed; ?></td> <td style="text-align: right"><?php echo (int)$none_count->bounced; ?></td> <td style="text-align: right"><?php echo (int)$none_count->complained; ?></td> </tr> </tbody> </table> </div> <div id="tabs-time"> <?php if (!has_action('newsletter_users_statistics_time')) { include __DIR__ . '/statistics-time.php'; } else { do_action('newsletter_users_statistics_time', $controls); } ?> </div> </div> </div> <?php include NEWSLETTER_ADMIN_FOOTER; ?> </div> PK .��\'ܳ�O O statistics-countries.phpnu �[��� <p>The country detection and report can be enabled with the Reports Addon.</p> PK .��\�J�5� � autoresponders.phpnu �[��� <?php /** @var NewsletterUsersAdmin $this */ /** @var NewsletterControls $controls */ /** @var NewsletterLogger $logger */ /** @var wpdb $wpdb */ defined('ABSPATH') || exit; $user = $this->get_user((int) $_GET['id'] ?? -1); if (!$user) { echo 'Subscriber not found.'; return; } do_action('newsletter_users_edit_autoresponders_init', $user, $controls); ?> <div class="wrap tnp-users tnp-users-edit" id="tnp-wrap"> <?php include NEWSLETTER_ADMIN_HEADER; ?> <div id="tnp-heading"> <?php $controls->title_help('/subscribers-and-management/') ?> <h2><?php echo esc_html($user->email) ?></h2> <?php include __DIR__ . '/edit-nav.php' ?> </div> <div id="tnp-body"> <?php $controls->show(); ?> <?php if (!class_exists('NewsletterAutoresponder')) { ?> <div class="tnp-notice"> This panel requires the Autoresponder Addon. </div> <?php } else { ?> <form method="post" action=""> <?php $controls->init(); ?> <?php do_action('newsletter_users_edit_autoresponders', $user, $controls); ?> </form> <?php } ?> </div> <?php include NEWSLETTER_ADMIN_FOOTER; ?> </div> PK .��\P��� � css/users.cssnu �[��� div.tnp-users-search { margin-bottom: 20px; } span.tnp-user-status { display: inline-block; width: 150px; max-width: 100%; text-align: center; } PK .��\��#�� � edit-nav.phpnu �[��� <?php /** @var TNP_User $user */ ?> <ul class="tnp-nav"> <li><a href="?page=newsletter_users_index"><i class="fas fa-chevron-left"></i></a></li> <li class="<?php echo $_GET['page'] === 'newsletter_users_edit'?'active':''?>"><a href="?page=newsletter_users_edit&id=<?php echo $user->id?>"><?php esc_html_e('General', 'newsletter')?></a></li> <li class="<?php echo $_GET['page'] === 'newsletter_users_logs'?'active':''?>"><a href="?page=newsletter_users_logs&id=<?php echo $user->id?>"><?php esc_html_e('Logs', 'newsletter')?></a></li> <li class="<?php echo $_GET['page'] === 'newsletter_users_newsletters'?'active':''?>"><a href="?page=newsletter_users_newsletters&id=<?php echo $user->id?>"><?php esc_html_e('Newsletters', 'newsletter')?></a></li> <li class="<?php echo $_GET['page'] === 'newsletter_users_autoresponders'?'active':''?>"><a href="?page=newsletter_users_autoresponders&id=<?php echo $user->id?>"><?php esc_html_e('Autoresponders', 'newsletter')?></a></li> </ul> PK .��\z}�0� � newsletters.phpnu �[��� <?php /** @var NewsletterUsersAdmin $this */ /** @var NewsletterControls $controls */ /** @var NewsletterLogger $logger */ defined('ABSPATH') || exit; $user = $this->get_user((int) $_GET['id'] ?? -1); if (!$user) { die('User not found'); } ?> <div class="wrap tnp-users tnp-users-edit" id="tnp-wrap"> <?php include NEWSLETTER_ADMIN_HEADER ?> <div id="tnp-heading"> <?php $controls->title_help('/subscribers-and-management/') ?> <h2><?php echo esc_html($user->email) ?></h2> <?php include __DIR__ . '/edit-nav.php' ?> </div> <div id="tnp-body"> <?php $controls->show(); ?> <form method="post" action=""> <?php $controls->init(); ?> <div id="tabs"> <ul> <li><a href="#tabs-newsletters"><?php esc_html_e('Newsletters', 'newsletter') ?></a></li> </ul> <div id="tabs-newsletters" class="tnp-tab"> <?php if (!has_action('newsletter_user_newsletters_tab') && !has_action('newsletter_users_edit_newsletters')) { ?> <p> This panel requires the <a href="https://www.thenewsletterplugin.com/plugins/newsletter/reports-module" target="_blank">Reports Addon</a>. </p> <?php } else { do_action('newsletter_user_newsletters_tab', $user->id); do_action('newsletter_users_edit_newsletters', $user->id); } ?> </div> </div> </form> </div> <?php include NEWSLETTER_ADMIN_FOOTER; ?> </div> PK .��\}��U; U; edit.phpnu �[��� <?php // phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedScript /** @var NewsletterUsersAdmin $this */ /** @var NewsletterControls $controls */ /** @var NewsletterLogger $logger */ defined('ABSPATH') || exit; $user = $this->get_user((int) $_GET['id'] ?? -1); if (!$user) { echo 'Subscriber not found.'; return; } if ($controls->is_action('save')) { $controls->data = wp_kses_post_deep($controls->data); $email = $this->sanitize_email($controls->data['email']); if (empty($email)) { $controls->errors = esc_html__('Wrong email address', 'newsletter'); } else { $controls->data['email'] = $email; } if (empty($controls->errors)) { $u = $this->get_user($controls->data['email']); if ($u && $u->id != $user->id) { $controls->errors = esc_html__('The email address is already in use', 'newsletter'); } } if (empty($controls->errors)) { // 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; } } if (empty($controls->data['token'])) { $controls->data['token'] = $this->get_token(); } $controls->data['id'] = $user->id; // Sanitize $controls->data['name'] = $this->sanitize_name($controls->data['name']); $controls->data['surname'] = $this->sanitize_name($controls->data['surname']); $controls->data['wp_user_id'] = (int) $controls->data['wp_user_id']; for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) { if (isset($controls->data['profile_' . $i])) { $controls->data['profile_' . $i] = $this->sanitize_user_field($controls->data['profile_' . $i]); } } $user = $this->save_user($controls->data); $this->add_user_log($user, 'edit'); //$this->save_user_meta($id, 'ip', $controls->data['ip']); if ($user === false) { $controls->errors = esc_html__('Error. Check the log files.', 'newsletter'); } else { $controls->add_toast_saved(); $controls->data = (array) $user; } } } if ($controls->is_action('delete')) { $this->delete_user($user->id); $controls->js_redirect($this->get_admin_page_url('index')); return; } if (!$controls->is_action()) { $controls->data = (array) $user; } $options_profile = NewsletterSubscription::instance()->get_options('customfields'); function percent($value, $total) { if ($total == 0) { return '-'; } return sprintf("%.2f", $value / $total * 100) . '%'; } function percentValue($value, $total) { if ($total == 0) { return 0; } return round($value / $total * 100); } ?> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages': ['corechart', 'geomap']}); </script> <div class="wrap tnp-users tnp-users-edit" id="tnp-wrap"> <?php include NEWSLETTER_ADMIN_HEADER ?> <div id="tnp-heading"> <?php $controls->title_help('/subscribers-and-management/') ?> <h2><?= esc_html($user->email) ?></h2> <?php include __DIR__ . '/edit-nav.php' ?> </div> <div id="tnp-body"> <?php $controls->show(); ?> <form method="post" action=""> <?php $controls->init(); ?> <div id="tabs"> <ul> <li><a href="#tabs-general"><?php esc_html_e('Main', 'newsletter') ?></a></li> <li><a href="#tabs-preferences"><?php esc_html_e('Lists', 'newsletter') ?></a></li> <li><a href="#tabs-profile"><?php esc_html_e('Custom fields', 'newsletter') ?></a></li> <li class="tnp-tabs-advanced"><a href="#tabs-other"><?php esc_html_e('Advanced', 'newsletter') ?></a></li> <?php if (NEWSLETTER_DEBUG) { ?> <li><a href="#tabs-meta">Meta</a></li> <?php } ?> </ul> <div id="tabs-general" class="tnp-tab"> <?php do_action('newsletter_users_edit_general', $user->id, $controls) ?> <table class="form-table"> <tr> <th><?php esc_html_e('Email', 'newsletter'); ?></th> <td> <?php $controls->text_email('email', 60); ?> </td> </tr> <tr> <th><?php esc_html_e('First name', 'newsletter'); ?></th> <td> <?php $controls->text('name', 50); ?> </td> </tr> <tr> <th><?php esc_html_e('Last name', 'newsletter'); ?></th> <td> <?php $controls->text('surname', 50); ?> </td> </tr> <tr> <th><?php esc_html_e('Gender', 'newsletter'); ?></th> <td> <?php $controls->gender('sex'); ?> </td> </tr> <tr> <th><?php esc_html_e('Status', 'newsletter'); ?></th> <td> <?php $controls->user_status() ?> <span class="description"><a href="?page=newsletter_users_logs&id=<?php echo esc_attr($user->id); ?>">Status change history</a></span> </td> </tr> <tr> <th><?php esc_html_e('Language', 'newsletter'); ?></th> <td> <?php $controls->language('language', __('None', 'newsletter')); ?> </td> </tr> <tr> <th><?php esc_html_e('Test subscriber', 'newsletter'); ?> <br><?php $controls->help('https://www.thenewsletterplugin.com/documentation/subscribers#test-subscribers') ?></th> <td> <?php $controls->yesno('test'); ?> </td> </tr> <?php do_action('newsletter_user_edit_extra', $controls); ?> </table> </div> <div id="tabs-preferences" class="tnp-tab"> <p> <a href="?page=newsletter_subscription_lists" target="_blank"><?php esc_html_e('Configure', 'newsletter') ?></a> </p> <table class="form-table"> <tr> <th> <?php esc_html_e('Lists', 'newsletter') ?> <br> <?php $controls->help('https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-preferences') ?></th> <td> <?php $controls->preferences('list'); ?> </td> </tr> </table> </div> <div id="tabs-profile" class="tnp-tab"> <p> <a href="?page=newsletter_subscription_customfields" target="_blank"><?php esc_html_e('Configure', 'newsletter') ?></a> </p> <table class="widefat"> <thead> <tr> <th>#</th> <th><?php esc_html_e('Name', 'newsletter'); ?></th> <th><?php esc_html_e('Value', 'newsletter'); ?></th> </tr> </thead> <tbody> <?php foreach ($this->get_all_customfields() as $customfield) { echo '<tr><td>'; echo (int) $customfield->id; echo '</td><td>'; echo esc_html($customfield->name); echo '</td><td>'; if ($customfield->is_text()) { $controls->text('profile_' . $customfield->id, 70); } else { $controls->select('profile_' . $customfield->id, $customfield->options); } echo '</td></tr>'; } ?> </tbody> </table> </div> <div id="tabs-other" class="tnp-tab"> <table class="form-table"> <tr> <th>ID</th> <td> <?php $controls->value('id'); ?> </td> </tr> <tr> <th><?php esc_html_e('Created', 'newsletter') ?></th> <td> <?php $controls->echo_date(strtotime($controls->data['created'])); ?> </td> </tr> <tr> <th><?php esc_html_e('Referrer', 'newsletter') ?></th> <td> <?php $controls->value('referrer'); ?> </td> </tr> <tr> <th><?php esc_html_e('HTTP Referrer', 'newsletter') ?></th> <td> <?php $controls->value('http_referer'); ?> </td> </tr> <tr> <th><?php esc_html_e('Last activity', 'newsletter') ?></th> <td> <?php $controls->echo_date($controls->data['last_activity']); ?> </td> </tr> <tr> <th><?php esc_html_e('WP user ID', 'newsletter') ?></th> <td> <?php $controls->text('wp_user_id'); ?> <span class="description">ID of the WP user connected with this subscriber. Install <a href="<?php echo esc_attr(\Newsletter\Integrations::get_addon_url('wpusers')); ?>">WP Users Addon</a> for automated integration.</span> </td> </tr> <tr> <th><?php esc_html_e('IP address', 'newsletter'); ?></th> <td> <?php $controls->value('ip'); ?> </td> </tr> <tr> <th><?php esc_html_e('Secret token', 'newsletter'); ?></th> <td> <?php $controls->text('token', 50); ?> </td> </tr> <tr> <th><?php esc_html_e('Profile URL', 'newsletter'); ?></th> <td> <?php $profile_url = NewsletterProfile::instance()->get_profile_url($user) ?> <a href='<?php echo esc_attr($profile_url) ?>' target="_blank"><?php echo esc_html($profile_url) ?></a> <?php if (NEWSLETTER_DEBUG) { ?> <br> <?php $profile_page_url = NewsletterProfile::instance()->get_profile_page_url($user) ?> <a href='<?php echo esc_attr($profile_page_url) ?>' target="_blank"><?php echo esc_html($profile_page_url) ?></a> <?php } ?> </td> </tr> <tr> <th><?php esc_html_e('Unsubscribe URL', 'newsletter'); ?></th> <td> <?php $unsubscribe_url = NewsletterUnsubscription::instance()->get_unsubscribe_url($user) ?> <a href='<?php echo esc_attr($unsubscribe_url) ?>' target="_blank"><?php echo esc_html($unsubscribe_url) ?></a> </td> </tr> <tr> <th><?php esc_html_e('Resubscribe URL', 'newsletter'); ?></th> <td> <?php $resubscribe_url = NewsletterUnsubscription::instance()->get_reactivate_url($user) ?> <a href='<?php echo esc_attr($resubscribe_url) ?>' target="_blank"><?php echo esc_html($resubscribe_url) ?></a> </td> </tr> </table> </div> <?php if (NEWSLETTER_DEBUG) { ?> <div id="tabs-meta" class="tnp-tab"> <p> Dump of the meta data only for debug. </p> <table class="widefat" style="width: auto"> <thead> <tr> <th><?php esc_html_e('Name', 'newsletter'); ?></th> <th><?php esc_html_e('Value', 'newsletter'); ?></th> </tr> </thead> <tbody> <tr> <td>Welcome email ID</td> <td> <?php echo esc_html($this->get_user_meta($user->id, 'welcome_email_id')); ?> </td> </tr> </tbody> </table> </div> <?php } ?> </div> <p> <?php $controls->button_save(); ?> <?php $controls->button_delete(); ?> </p> </form> </div> <?php include NEWSLETTER_ADMIN_FOOTER ?> </div> PK .��\�QG ) ) index.phpnu �[��� <?php /** @var wpdb $wpdb */ /** @var NewsletterUsersAdmin $this */ /** @var NewsletterControls $controls */ /** @var NewsletterLogger $logger */ /** @var string $is_multilanguage */ defined('ABSPATH') || exit; $controls->data['search_page'] = (int) ($controls->data['search_page'] ?? 1); // Move to base zero if ($controls->is_action()) { if ($controls->is_action('reset')) { $controls->data = ['search_page' => 1]; } $this->save_options($controls->data, 'users_search'); } else { $controls->data = $this->get_main_options('users_search'); } if ($controls->is_action('resend')) { $user = $this->get_user($controls->button_data); $this->delete_user_meta($user->id, 'activation_email_id'); NewsletterSubscription::instance()->send_activation_email($user, true); $controls->messages = __('Activation email sent.', 'newsletter'); } if ($controls->is_action('resend_welcome')) { $user = $this->get_user($controls->button_data); $this->delete_user_meta($user->id, 'welcome_email_id'); $r = NewsletterSubscription::instance()->send_welcome_email($user); if ($r) { $controls->messages = __('Welcome email sent.', 'newsletter'); } else { $controls->errors = __('The welcome email is disabled.', 'newsletter'); } } if ($controls->is_action('delete')) { $this->delete_user($controls->button_data); unset($controls->data['subscriber_id']); } if ($controls->is_action('delete_selected')) { $ids = wp_parse_id_list(wp_unslash($_POST['ids'] ?? [])); $r = Newsletter::instance()->delete_user($ids); $controls->messages .= $r . ' user(s) deleted'; } // We build the query condition $where = 'where 1=1'; $query_args = []; $text = trim($controls->get_value('search_text', '')); if ($text) { $query_args[] = '%' . $text . '%'; $query_args[] = '%' . $text . '%'; $query_args[] = '%' . $text . '%'; $query_args[] = '%' . $text . '%'; $where .= " and (id like %s or email like %s or name like %s or surname like %s)"; } $search_status = $controls->data['search_status'] ?? ''; if ($search_status) { if ('T' === $search_status) { $where .= " and test=1"; } else { $query_args[] = $search_status; $where .= " and status=%s"; } } $search_list = (int) ($controls->data['search_list'] ?? 0); if ($search_list) { if ($search_list === -1) { for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { $where .= ' and list_' . $i . '=0'; } } else { $where .= " and list_" . $search_list . "=1"; } } $filtered = $where != 'where 1=1'; // Total items, total pages $items_per_page = 20; if (!empty($query_args)) { $where = $wpdb->prepare($where, $query_args); } $count = Newsletter::instance()->store->get_count(NEWSLETTER_USERS_TABLE, $where); $last_page = max(1, ceil($count / $items_per_page)); if ($controls->is_action('last')) { $controls->data['search_page'] = $last_page; } if ($controls->is_action('first')) { $controls->data['search_page'] = 1; } if ($controls->is_action('next')) { $controls->data['search_page'] = $controls->data['search_page'] + 1; } if ($controls->is_action('prev')) { $controls->data['search_page'] = $controls->data['search_page'] - 1; } if ($controls->is_action('search')) { $controls->data['search_page'] = 1; } // Eventually fix the page if ($controls->data['search_page'] < 1) $controls->data['search_page'] = 1; if ($controls->data['search_page'] > $last_page) $controls->data['search_page'] = $last_page; $offset = ($controls->data['search_page'] - 1) * $items_per_page; $query = "select *, unix_timestamp(created) created_at from " . NEWSLETTER_USERS_TABLE . ' ' . $where . " order by id desc"; $query .= " limit " . $offset . "," . $items_per_page; $list = $wpdb->get_results($query); $lists = $this->get_lists(); $utc = new DateTimeZone('UTC'); $lists_options = $controls->get_list_options(__('Any list', 'newsletter')); $lists_options['-1'] = __('Without list', 'newsletter'); ?> <style> <?php include __DIR__ . '/css/users.css' ?> </style> <div class="wrap tnp-users tnp-users-index" id="tnp-wrap"> <?php include NEWSLETTER_ADMIN_HEADER; ?> <div id="tnp-heading"> <?php $controls->title_help('/subscribers-and-management/') ?> <!-- <h2><?php esc_html_e('Subscribers', 'newsletter') ?></h2>--> <?php include __DIR__ . '/nav.php' ?> </div> <div id="tnp-body"> <?php $controls->show(); ?> <form id="channel" method="post" action=""> <?php $controls->init(); ?> <div class="tnp-users-search"> <?php $controls->text('search_text', 45, __('Search by ID, email, name', 'newsletter')); ?> <?php $controls->select('search_status', ['' => __('Any status', 'newsletter'), 'T' => __('Test subscribers', 'newsletter'), 'C' => TNP_User::get_status_label('C'), 'S' => TNP_User::get_status_label('S'), 'U' => TNP_User::get_status_label('U'), 'B' => TNP_User::get_status_label('B'), 'P' => TNP_User::get_status_label('P')]); ?> <?php $controls->select('search_list', $lists_options); ?> <?php $controls->button('search', __('Search', 'newsletter')); ?> <?php if ($where != "where 1=1") { ?> <?php $controls->btn('reset', __('Reset Filters', 'newsletter'), ['tertiary' => true]); ?> <?php } ?> </div> <div class="tnp-paginator"> <?php $controls->btn('first', '«', ['tertiary' => true]); ?> <?php $controls->btn('prev', '‹', ['tertiary' => true]); ?> <?php $controls->text('search_page', 3); ?> of <?php echo $last_page; ?> <?php $controls->btn('go', __('Go', 'newsletter'), ['secondary' => true]); ?> <?php $controls->btn('next', '›', ['tertiary' => true]); ?> <?php $controls->btn('last', '»', ['tertiary' => true]); ?> <?php echo (int) $count ?> <?php esc_html_e('subscriber(s) found', 'newsletter') ?> <?php $controls->btn_link('?page=newsletter_users_new', __('Add new', 'newsletter')); ?> <?php $controls->btn('delete_selected', __('Delete selected', 'newsletter'), ['tertiary' => true]); ?> </div> <table class="widefat"> <thead> <tr> <th class="check-column"><input type="checkbox" onchange="jQuery('input.tnp-selector').prop('checked', this.checked)"></th> <th>Id</th> <th><?php esc_html_e('Email', 'newsletter') ?></th> <th><?php esc_html_e('Name', 'newsletter') ?></th> <th><?php esc_html_e('Status', 'newsletter') ?></th> <th><?php esc_html_e('Date') ?></th> <?php if ($is_multilanguage) { ?> <th><i class="fa fa-globe" aria-hidden="true"></i></th> <?php } ?> <th style="white-space: nowrap"><?php $controls->checkbox('show_lists', __('Lists', 'newsletter'), ['onchange' => 'this.form.act.value=\'go\'; this.form.submit()']) ?></th> <th> </th> <th> </th> </tr> </thead> <?php $i = 0; ?> <?php foreach ($list as $s) { ?> <tr> <th scope="row" class="check-column"> <input class="tnp-selector" type="checkbox" name="ids[]" value="<?php echo (int) $s->id; ?>"> </th> <td><?php echo (int) $s->id; ?></td> <td><?php echo esc_html($s->email); ?></td> <td><?php echo esc_html($s->name); ?> <?php echo esc_html($s->surname); ?></td> <td> <?php $this->echo_user_status_label($s); ?> </td> <td> <?php $controls->echo_date($s->created_at); ?> </td> <?php if ($is_multilanguage) { ?> <td> <?php echo esc_html($s->language); ?> </td> <?php } ?> <td> <?php if (!empty($controls->data['show_lists'])) { ?> <small><?php foreach ($lists as $item) { $l = 'list_' . $item->id; if ($s->$l == 1) echo esc_html($item->name) . '<br>'; } ?></small> <?php } ?> </td> <td> <?php $controls->button_icon_edit($this->get_admin_page_url('edit') . '&id=' . ((int) $s->id)) ?> </td> <td style="white-space: nowrap"> <?php if ($s->status == "C") { ?> <?php $controls->btn('resend_welcome', '', ['secondary' => true, 'data' => $s->id, 'icon' => 'fa-redo', 'confirm' => true, 'title' => __('Resend the welcome email', 'newsletter')]); ?> <?php } else { ?> <?php $controls->btn('resend', '', ['secondary' => true, 'data' => $s->id, 'icon' => 'fa-redo', 'confirm' => true, 'title' => __('Resend the confirmation email', 'newsletter')]); ?> <?php } ?> <?php $controls->button_icon_delete($s->id); ?> </td> </tr> <?php } ?> </table> <div class="tnp-paginator"> <?php $controls->btn('first', '«', ['tertiary' => true]); ?> <?php $controls->btn('prev', '‹', ['tertiary' => true]); ?> <?php $controls->btn('next', '›', ['tertiary' => true]); ?> <?php $controls->btn('last', '»', ['tertiary' => true]); ?> </div> </form> </div> <?php include NEWSLETTER_ADMIN_FOOTER; ?> </div> PK .��\�{�o� � logs.phpnu �[��� <?php /** @var NewsletterUsersAdmin $this */ /** @var NewsletterControls $controls */ /** @var NewsletterLogger $logger */ /** @var wpdb $wpdb */ defined('ABSPATH') || exit; $user = $this->get_user((int) ($_GET['id'] ?? -1)); if (!$user) { echo 'Subscriber not found.'; return; } ?> <div class="wrap tnp-users tnp-users-edit" id="tnp-wrap"> <?php include NEWSLETTER_ADMIN_HEADER; ?> <div id="tnp-heading"> <?php $controls->title_help('/subscribers-and-management/') ?> <h2><?= esc_html($user->email) ?></h2> <?php include __DIR__ . '/edit-nav.php' ?> </div> <div id="tnp-body"> <?php $controls->show(); ?> <form method="post" action=""> <?php $controls->init(); ?> <div id="tabs"> <ul> <li><a href="#tabs-history"><?php esc_html_e('Logs', 'newsletter') ?></a></li> </ul> <div id="tabs-history" class="tnp-tab"> <?php $logs = $wpdb->get_results($wpdb->prepare("select * from {$wpdb->prefix}newsletter_user_logs where user_id=%d order by id desc", $user->id)); ?> <?php if (empty($logs)) { ?> <p>No logs available</p> <?php } else { ?> <p>Only public lists are recorded.</p> <table class="widefat" style="width: auto"> <thead> <tr> <th>#</th> <th><?php esc_html_e('Date', 'newsletter'); ?></th> <th><?php esc_html_e('Source', 'newsletter'); ?></th> <th>IP</th> <th><?php esc_html_e('Lists', 'newsletter'); ?></th> </tr> <tbody> <?php foreach ($logs as $log) { ?> <?php $data = json_decode($log->data, ARRAY_A); if (isset($data['new'])) $data = $data['new']; ?> <tr> <td><?php echo esc_html($log->id) ?></td> <td><?php $controls->echo_date($log->created) ?></td> <td><?php echo esc_html($log->source) ?></td> <td><?php echo esc_html($log->ip) ?></td> <td> <?php if (is_array($data)) { foreach ($data as $key => $value) { echo esc_html(str_replace('_', ' ', $key)), ': ', esc_html($value), '<br>'; } } ?> </td> </tr> <?php } ?> </tbody> </table> <?php } ?> </div> </div> </form> </div> <?php include NEWSLETTER_ADMIN_FOOTER; ?> </div> PK .��\9Z�� nav.phpnu �[��� <?php $p = sanitize_key($_GET['page'] ?? ''); ?> <ul class="tnp-nav"> <li class="tnp-nav-title"><?php esc_html_e('Subscribers', 'newsletter'); ?></li> <li class="<?php echo $p === 'newsletter_users_index' ? 'active' : '' ?>"><a href="?page=newsletter_users_index"><?php esc_html_e('Manage', 'newsletter') ?></a></li> <li class="<?php echo $p === 'newsletter_profile_index' ? 'active' : '' ?>"><a href="?page=newsletter_profile_index"><?php esc_html_e('Profile page', 'newsletter') ?></a></li> <li class="<?php echo $p === 'newsletter_unsubscription_index' ? 'active' : '' ?>"><a href="?page=newsletter_unsubscription_index"><?php esc_html_e('Unsubscribe', 'newsletter') ?></a></li> <li class="<?php echo $p === 'newsletter_users_statistics' ? 'active' : '' ?>"><a href="?page=newsletter_users_statistics"><?php esc_html_e('Statistics', 'newsletter') ?></a></li> <li class="<?php echo $p === 'newsletter_users_massive' ? 'active' : '' ?>"><a href="?page=newsletter_users_massive"><?php esc_html_e('Maintenance', 'newsletter') ?></a></li> <?php if (!class_exists('NewsletterImport')) { ?> <li class="<?php echo $p === 'newsletter_users_import' ? 'active' : '' ?>"><a href="?page=newsletter_users_import"><?php esc_html_e('Import/Export', 'newsletter') ?></a></li> <?php } else { ?> <li class="<?php echo $p === 'newsletter_import_index' ? 'active' : '' ?>"><a href="?page=newsletter_import_index"><?php esc_html_e('Import/Export', 'newsletter') ?></a></li> <?php } ?> </ul> <?php unset($p); ?> PK .��\m�j'- - statistics-time.phpnu �[��� <?php global $wpdb; defined('ABSPATH') || exit; ?> <div style="height: 300px;"> <canvas id="tnp-users-chart-days"></canvas> </div> <div style="height: 300px;"> <canvas id="tnp-users-chart-months"></canvas> </div> <div class="row"> <div class="col-md-6"> <?php $dt = new DateTime(); $dt->setTime(12, 0, 0)->setDate((int) date('Y'), (int) date('m'), 1); $i = new DateInterval('P1M'); $months = []; for ($x = 1; $x <= 24; $x++) { $months[] = $dt->format('Y-m'); $dt->sub($i); } $months = array_reverse($months); $list = $wpdb->get_results("select concat(year(created), '-', date_format(created, '%m')) as d, count(*) as c from " . NEWSLETTER_USERS_TABLE . " where status='C' group by concat(year(created), '-', date_format(created, '%m')) order by d desc limit 24", OBJECT_K); $dataMonths = []; foreach ($months as $month) { $dataMonths[] = isset($list[$month]) ? $list[$month]->c : 0; } ?> <?php /* <table class="widefat"> <thead> <tr> <th><?php _e('Year and month', 'newsletter') ?></th> <th><?php _e('Total', 'newsletter') ?></th> </tr> </thead> <?php foreach ($months as $month) { ?> <tr> <td><?php echo $month; ?></td> <td><?php echo isset($list[$month]) ? $list[$month]->c : 0; ?></td> </tr> <?php } ?> </table> */?> </div> <div class="col-md-6"> <?php $dt = new DateTime(); $dt->setTime(12, 0, 0); $i = new DateInterval('P1D'); $days = []; for ($x = 1; $x <= 90; $x++) { $days[] = $dt->format('Y-m-d'); $dt->sub($i); } $days = array_reverse($days); $list = $wpdb->get_results("select date(created) as d, count(*) as c from " . NEWSLETTER_USERS_TABLE . " where status='C' group by date(created) order by d desc limit 90", OBJECT_K); $dataDays = []; foreach ($days as $day) { $dataDays[] = isset($list[$day]) ? $list[$day]->c : 0; } ?> <?php /* <table class="widefat"> <thead> <tr> <th><?php _e('Date', 'newsletter') ?></th> <th><?php _e('Total', 'newsletter') ?></th> </tr> </thead> <?php for ($i = 0; $i < count($days); $i++) { ?> <tr> <td><?php echo $days[$i]; ?></td> <td><?php echo $dataDays[$i] ?></td> </tr> <?php } ?> </table> */?> </div> </div> <script> const dataDays = { labels: <?php echo wp_json_encode($days) ?>, datasets: [{ label: 'By day', borderColor: '#3498DB', borderWidth: 1, data: <?php echo wp_json_encode($dataDays) ?>, }] }; const dataMonths = { labels: <?php echo wp_json_encode($months) ?>, datasets: [{ label: 'By month', borderColor: '#3498DB', borderWidth: 1, data: <?php echo wp_json_encode($dataMonths) ?>, }] }; jQuery(function () { const myChart = new Chart( document.getElementById('tnp-users-chart-days'), { type: 'line', data: dataDays, options: { maintainAspectRatio: false, scales: { yAxes: [{ ticks: { beginAtZero: true } }] } } } ); const myChartMonths = new Chart( document.getElementById('tnp-users-chart-months'), { type: 'line', data: dataMonths, options: { maintainAspectRatio: false, scales: { yAxes: [{ ticks: { beginAtZero: true } }] } } } ); }); </script> PK .��\l����<