Check Email - Version 1.0.3

Version Description

Download this release

Release Info

Developer giucu91
Plugin Icon wp plugin Check Email
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.2 to 1.0.3

changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  == Changelog ==
2
 
 
 
 
3
  = v1.0.2 - 16/06/2021 =
4
  - Added: Translation for roles and notices. ( https://github.com/WPChill/check-email/issues/10 )
5
  - Added: Headers of the emails in the view log tab. ( https://github.com/WPChill/check-email/issues/12 )
1
  == Changelog ==
2
 
3
+ = v1.0.3 - 24/09/2021 =
4
+ - Fixed: Secutiry issue
5
+
6
  = v1.0.2 - 16/06/2021 =
7
  - Added: Translation for roles and notices. ( https://github.com/WPChill/check-email/issues/10 )
8
  - Added: Headers of the emails in the view log tab. ( https://github.com/WPChill/check-email/issues/12 )
check-email.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Check & Log Email
4
  * Description: Check & Log email allows you to test if your WordPress installation is sending emails correctly and logs every email.
5
  * Author: WPChill
6
- * Version: 1.0.2
7
  * Author URI: https://wpchill.com/
8
  * License: GPLv3 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
3
  * Plugin Name: Check & Log Email
4
  * Description: Check & Log email allows you to test if your WordPress installation is sending emails correctly and logs every email.
5
  * Author: WPChill
6
+ * Version: 1.0.3
7
  * Author URI: https://wpchill.com/
8
  * License: GPLv3 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
include/Core/DB/Check_Email_Table_Manager.php CHANGED
@@ -225,8 +225,13 @@ class Check_Email_Table_Manager implements Loadie {
225
  }
226
 
227
  // Ordering parameters.
228
- $orderby = ! empty( $request['orderby'] ) ? esc_sql( $request['orderby'] ) : 'sent_date';
229
- $order = ! empty( $request['order'] ) ? esc_sql( $request['order'] ) : 'DESC';
 
 
 
 
 
230
 
231
  if ( ! empty( $orderby ) & ! empty( $order ) ) {
232
  $query_cond .= ' ORDER BY ' . $orderby . ' ' . $order;
225
  }
226
 
227
  // Ordering parameters.
228
+ $orderby = ! empty( $request['orderby'] ) ? sanitize_sql_orderby( $request['orderby'] ) : 'sent_date';
229
+ if ( isset( $request['order'] ) ) {
230
+ $order = in_array( strtoupper($request['order']), array( 'DESC', 'ASC' ) ) ? esc_sql( $request['order'] ) : 'DESC';
231
+ }else{
232
+ $order = 'DESC';
233
+ }
234
+
235
 
236
  if ( ! empty( $orderby ) & ! empty( $order ) ) {
237
  $query_cond .= ' ORDER BY ' . $orderby . ' ' . $order;
include/class-check-email-log-list-table.php DELETED
@@ -1,207 +0,0 @@
1
- <?php namespace CheckEmail;
2
- /**
3
- * Table to display Check Email Logs.
4
- */
5
- class Check_Email_Log_List_Table extends WP_List_Table {
6
-
7
- public function __construct() {
8
- parent::__construct( array(
9
- 'singular' => 'check-email-log', //singular name of the listed records
10
- 'plural' => 'check-email-logs', //plural name of the listed records
11
- 'ajax' => false, //does this table support ajax?
12
- ) );
13
- }
14
-
15
- public function get_columns() {
16
- $columns = array(
17
- 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
18
- 'sent_date' => __( 'Sent at', 'check-email' ),
19
- 'to' => __( 'To', 'check-email' ),
20
- 'subject' => __( 'Subject', 'check-email' ),
21
- );
22
-
23
- return apply_filters( CheckEmailLog::HOOK_LOG_COLUMNS, $columns );
24
- }
25
-
26
- protected function get_sortable_columns() {
27
- $sortable_columns = array(
28
- 'sent_date' => array( 'sent_date', true ), //true means it's already sorted
29
- 'to' => array( 'to_email', false ),
30
- 'subject' => array( 'subject', false ),
31
- );
32
- return $sortable_columns;
33
- }
34
-
35
- protected function column_default( $item, $column_name ) {
36
- do_action( CheckEmailLog::HOOK_LOG_DISPLAY_COLUMNS, $column_name, $item );
37
- }
38
-
39
- protected function column_sent_date( $item ) {
40
- $email_date = mysql2date(
41
- sprintf( __( '%s @ %s', 'check-email' ), get_option( 'date_format', 'F j, Y' ), get_option( 'time_format', 'g:i A' ) ),
42
- $item->sent_date
43
- );
44
-
45
- $actions = array();
46
-
47
- $content_ajax_url = add_query_arg(
48
- array(
49
- 'action' => 'display_content',
50
- 'email_id' => $item->id,
51
- 'TB_iframe' => 'true',
52
- 'width' => '600',
53
- 'height' => '550',
54
- ),
55
- 'admin-ajax.php'
56
- );
57
-
58
- $actions['view-content'] = sprintf( '<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>',
59
- esc_url( $content_ajax_url ),
60
- __( 'Email Content', 'check-email' ),
61
- __( 'View Content', 'check-email' )
62
- );
63
-
64
- $delete_url = add_query_arg(
65
- array(
66
- 'page' => $_REQUEST['page'],
67
- 'action' => 'delete',
68
- $this->_args['singular'] => $item->id,
69
- CheckEmailLog::DELETE_LOG_NONCE_FIELD => wp_create_nonce( CheckEmailLog::DELETE_LOG_ACTION ),
70
- )
71
- );
72
-
73
- $actions['delete'] = sprintf( '<a href="%s">%s</a>',
74
- esc_url( $delete_url ),
75
- __( 'Delete', 'check-email' )
76
- );
77
-
78
- $actions = apply_filters( 'check_email_row_actions', $actions, $item );
79
-
80
- return sprintf( '%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
81
- /*$1%s*/ $email_date,
82
- /*$2%s*/ $item->id,
83
- /*$3%s*/ $this->row_actions( $actions )
84
- );
85
- }
86
-
87
- protected function column_to( $item ) {
88
- return esc_html( $item->to_email );
89
- }
90
-
91
- protected function column_subject( $item ) {
92
- return esc_html( $item->subject );
93
- }
94
-
95
- protected function column_cb( $item ) {
96
- return sprintf(
97
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
98
- /*$1%s*/ $this->_args['singular'],
99
- /*$2%s*/ $item->id
100
- );
101
- }
102
-
103
- protected function get_bulk_actions() {
104
- $actions = array(
105
- 'delete' => __( 'Delete', 'check-email' ),
106
- 'delete-all' => __( 'Delete All Logs', 'check-email' ),
107
- );
108
- return $actions;
109
- }
110
-
111
- public function process_bulk_action() {
112
- global $wpdb;
113
- global $CheckEmailLog; //@codingStandardsIgnoreLine
114
-
115
- if ( 'delete' === $this->current_action() ) {
116
- // Delete a list of logs by id.
117
-
118
- $nonce = $_REQUEST[ Check_Email_Log::DELETE_LOG_NONCE_FIELD ];
119
- if ( wp_verify_nonce( $nonce, Check_Email_Log::DELETE_LOG_ACTION ) ) {
120
-
121
- $ids = $_GET[ $this->_args['singular'] ];
122
-
123
- if ( is_array( $ids ) ) {
124
- $selected_ids = implode( ',', $ids );
125
- } else {
126
- $selected_ids = $ids;
127
- }
128
-
129
- $selected_ids = esc_sql( $selected_ids );
130
-
131
- $table_name = $wpdb->prefix . Check_Email_Log::TABLE_NAME;
132
- $CheckEmailLog->logs_deleted = $wpdb->query( "DELETE FROM $table_name where id IN ( $selected_ids )" ); //@codingStandardsIgnoreLine
133
- } else {
134
- wp_die( 'Cheating, Huh? ' );
135
- }
136
- } elseif ( 'delete-all' === $this->current_action() ) {
137
- // Delete all logs.
138
- $nonce = $_REQUEST[ Check_Email_Log::DELETE_LOG_NONCE_FIELD ];
139
- if ( wp_verify_nonce( $nonce, Check_Email_Log::DELETE_LOG_ACTION ) ) {
140
- $table_name = $wpdb->prefix . Check_Email_Log::TABLE_NAME;
141
- $CheckEmailLog->logs_deleted = $wpdb->query( "DELETE FROM $table_name" ); //@codingStandardsIgnoreLine
142
- } else {
143
- wp_die( 'Cheating, Huh? ' );
144
- }
145
- }
146
- }
147
-
148
- public function prepare_items() {
149
- global $wpdb;
150
-
151
- $table_name = $wpdb->prefix . Check_Email_Log::TABLE_NAME;
152
- $this->_column_headers = $this->get_column_info();
153
-
154
- // Handle bulk actions.
155
- $this->process_bulk_action();
156
-
157
- // Get current page number.
158
- $current_page = $this->get_pagenum();
159
-
160
- $query = 'SELECT * FROM ' . $table_name;
161
- $count_query = 'SELECT count(*) FROM ' . $table_name;
162
- $query_cond = '';
163
-
164
- if ( isset( $_GET['s'] ) ) {
165
- $search_term = trim( esc_sql( $_GET['s'] ) );
166
- $query_cond .= " WHERE to_email LIKE '%$search_term%' OR subject LIKE '%$search_term%' ";
167
- }
168
-
169
- // Ordering parameters.
170
- $orderby = ! empty( $_GET['orderby'] ) ? esc_sql( $_GET['orderby'] ) : 'sent_date';
171
- $order = ! empty( $_GET['order'] ) ? esc_sql( $_GET['order'] ) : 'DESC';
172
-
173
- if ( ! empty( $orderby ) & ! empty( $order ) ) {
174
- $query_cond .= ' ORDER BY ' . $orderby . ' ' . $order;
175
- }
176
-
177
- // Find total number of items.
178
- $count_query = $count_query . $query_cond;
179
- $total_items = $wpdb->get_var( $count_query );
180
-
181
- // Adjust the query to take pagination into account.
182
- $per_page = Check_Email_Log::get_per_page();
183
- if ( ! empty( $current_page ) && ! empty( $per_page ) ) {
184
- $offset = ( $current_page - 1 ) * $per_page;
185
- $query_cond .= ' LIMIT ' . (int) $offset . ',' . (int) $per_page;
186
- }
187
-
188
- // Fetch the items.
189
- $query = $query . $query_cond;
190
- $this->items = $wpdb->get_results( $query );
191
-
192
- // Register pagination options & calculations.
193
- $this->set_pagination_args( array(
194
- 'total_items' => $total_items,
195
- 'per_page' => $per_page,
196
- 'total_pages' => ceil( $total_items / $per_page ),
197
- ) );
198
- }
199
-
200
- /**
201
- * Displays default message when no items are found.
202
- */
203
- public function no_items() {
204
- _e( 'Your email log is empty', 'check-email' );
205
- }
206
- }
207
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: wpchill, silkalns, giucu91
3
  Tags: check, test, email, smtp, pop, send, delivery
4
  Requires at least: 5.0
5
- Tested up to: 5.8
6
- Stable tag: 1.0.2
7
 
8
  Check & Log email allows you to test if your WordPress installation is sending emails correctly by sending a test email to an address of your choice. Allows overriding of email headers and carbon copying to another address.
9
 
2
  Contributors: wpchill, silkalns, giucu91
3
  Tags: check, test, email, smtp, pop, send, delivery
4
  Requires at least: 5.0
5
+ Tested up to: 5.7
6
+ Stable tag: 1.0.3
7
 
8
  Check & Log email allows you to test if your WordPress installation is sending emails correctly by sending a test email to an address of your choice. Allows overriding of email headers and carbon copying to another address.
9