PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 6.6.0
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v6.6.0
8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
← All changes | includes/class-wpwbot-table.php +10 -32 8.7.36.6.0 View file →
@@ -33,11 +33,11 @@
33 33 /*
34 34 * Reindex plugin table
35 35 */
36 36 public function reindex_table( $return) {
37 - $nonce = sanitize_text_field(wp_unslash($_POST['nonce']));
38 - if (! wp_verify_nonce($nonce,'wp_chatbot') || ! current_user_can('manage_options')) {
39 - wp_send_json(array('success' => false, 'msg' => esc_html__('Failed in Security check', 'chatbot')));
37 + $nonce = sanitize_text_field($_POST['nonce']);
38 + if (! wp_verify_nonce($nonce,'wp_chatbot')) {
39 + wp_send_json(array('success' => false, 'msg' => esc_html__('Failed in Security check', 'sm')));
40 40 wp_die();
41 41
42 42 }else{
43 43 global $wpdb;
@@ -135,9 +135,9 @@
135 135 * Check if index table exist
136 136 */
137 137 private function is_table_not_exist() {
138 138 global $wpdb;
139 - return ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $this->table_name ) ) ) != $this->table_name ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
139 + return ( $wpdb->get_var( "SHOW TABLES LIKE '{$this->table_name}'" ) != $this->table_name ); //DB Call OK, No Caching OK
140 140 }
141 141 /*
142 142 * Create index table
143 143 */
@@ -155,30 +155,8 @@
155 155 lang VARCHAR(20) NOT NULL DEFAULT 0
156 156 ) $charset_collate;";
157 157 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
158 158 dbDelta( $sql );
159 -
160 - $table_report = $wpdb->prefix . 'wpbot_chat_report';
161 -
162 - if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $table_report ) ) ) != $table_report ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
163 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
164 - $sql_report = "
165 - CREATE TABLE `$table_report` (
166 - `id` int(11) NOT NULL AUTO_INCREMENT,
167 - `user_id` int(11) NOT NULL,
168 - `conversation_id` int(11) DEFAULT NULL,
169 - `message` longtext NOT NULL,
170 - `feedback` varchar(20) DEFAULT NULL,
171 - `meta_info` text DEFAULT NULL,
172 - `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
173 - PRIMARY KEY (`id`)
174 - ) $charset_collate AUTO_INCREMENT=1;
175 - ";
176 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
177 -
178 - require_once ABSPATH . 'wp-admin/includes/upgrade.php';
179 - dbDelta( $sql_report );
180 - }
181 159 }
182 160 /*
183 161 * Insert data into the index table
184 162 */
@@ -208,9 +186,9 @@
208 186 $query = "INSERT IGNORE INTO {$this->table_name}
209 187 (`id`, `term`, `term_source`, `type`, `count`, `in_stock`, `visibility`, `lang`)
210 188 VALUES $values
211 189 ";
212 - $wpdb->query( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
190 + $wpdb->query( $query ); //DB Call OK, No Caching OK
213 191 }
214 192 }
215 193 /*
216 194 * Update index table
@@ -223,9 +201,9 @@
223 201 $slug = 'product';
224 202 if ( $slug != $post->post_type ) {
225 203 return;
226 204 }
227 - $wpdb->delete( $this->table_name, array( 'id' => $post_id ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
205 + $wpdb->delete( $this->table_name, array( 'id' => $post_id ) ); //DB Call OK, No Caching OK
228 206 $posts = get_posts( array(
229 207 'posts_per_page' => -1,
230 208 'fields' => 'ids',
231 209 'post_type' => 'product',
@@ -259,9 +237,9 @@
259 237 } else {
260 238 $product_id = $product;
261 239 }
262 240
263 - $wpdb->delete( $this->table_name, array( 'id' => $product_id ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
241 + $wpdb->delete( $this->table_name, array( 'id' => $product_id ) ); //DB Call OK, No Caching OK
264 242
265 243 $posts = get_posts( array(
266 244 'posts_per_page' => -1,
267 245 'fields' => 'ids',
@@ -276,11 +254,11 @@
276 254 /*
277 255 * Cancel index
278 256 */
279 257 public function cancel_reindex() {
280 - $nonce = sanitize_text_field(wp_unslash($_POST['nonce']));
281 - if (! wp_verify_nonce($nonce,'wp_chatbot') || ! current_user_can('manage_options')) {
282 - wp_send_json(array('success' => false, 'msg' => esc_html__('Failed in Security check', 'chatbot')));
258 + $nonce = sanitize_text_field($_POST['nonce']);
259 + if (! wp_verify_nonce($nonce,'wp_chatbot')) {
260 + wp_send_json(array('success' => false, 'msg' => esc_html__('Failed in Security check', 'sm')));
283 261 wp_die();
284 262
285 263 }else{
286 264 delete_option( 'wp_chatbot_index_meta' );