PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.3.8
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.3.8
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 | qcld-wpwbot.php +73 -100 8.5.58.3.8 View file →
@@ -3,9 +3,9 @@
3 3 * Plugin Name: AI ChatBot - WPBot
4 4 * Plugin URI: https://wordpress.org/plugins/chatbot/
5 5 * Description: ChatBot is a native WordPress ChatBot plugin to provide live chat support and lead generation
6 6 * Donate link: https://www.wpbot.pro/
7 - * Version: 8.5.5
7 + * Version: 8.3.8
8 8 * @author QuantumCloud
9 9 * Author: ChatBot for WordPress - WPBot
10 10 * Author URI: https://www.wpbot.pro/
11 11 * Requires at least: 4.6
@@ -18,39 +18,31 @@
18 18
19 19
20 20 if (!defined('ABSPATH')) exit; // Exit if accessed directly.
21 21
22 +add_action( 'plugins_loaded', 'qcld_chatbot_existing_plugin_activate_check_callback' );
23 +if( !function_exists('qcld_chatbot_existing_plugin_activate_check_callback') ){
24 + function qcld_chatbot_existing_plugin_activate_check_callback(){
22 25
23 -// Abort execution if Pro version is active to prevent conflicts
24 -if ( ! function_exists( 'is_plugin_active' ) ) {
25 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
26 -}
26 + $check_existing_plugin = get_option('qcld_chatbot_existing_plugin_activate_check');
27 27
28 -$active_plugins = (array) get_option( 'active_plugins', array() );
29 -if ( is_multisite() ) {
30 - $active_plugins = array_merge( $active_plugins, array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) ) );
31 -}
32 28
33 -$current_plugin = plugin_basename( __FILE__ );
34 -
35 -foreach ( $active_plugins as $plugin ) {
36 - if ( $plugin !== $current_plugin && basename( $plugin ) === 'qcld-wpwbot.php' ) {
37 - return;
29 + if ( class_exists( 'qcld_wb_Chatbot' ) && isset($check_existing_plugin) && ($check_existing_plugin !== 'yes') ) {
30 + update_option('qcld_chatbot_existing_plugin_activate_check', 'yes');
31 + }else if ( ! class_exists( 'qcld_wb_Chatbot' ) ) {
32 + delete_option('qcld_chatbot_existing_plugin_activate_check');
33 + }
34 +
38 35 }
39 36 }
40 37
41 -// Also abort if we are currently activating the Pro plugin
42 -if ( isset($_REQUEST['action']) ) {
43 - if ( $_REQUEST['action'] == 'activate' && isset($_REQUEST['plugin']) && ( ( strpos($_REQUEST['plugin'], 'wpbot-pro-master') !== false ) || ( strpos($_REQUEST['plugin'], 'wpbot-pro-professional') !== false ) || ( strpos($_REQUEST['plugin'], 'wpbot-pro-professional') !== false ) || ( strpos($_REQUEST['plugin'], 'wpbot-pro-starter') !== false ) ) ) {
44 - return;
45 - }
46 - if ( $_REQUEST['action'] == 'activate-selected' && isset($_POST['checked']) && ( in_array('wpbot-pro-master/qcld-wpwbot.php', $_POST['checked']) || in_array('wpbot-pro-professional/qcld-wpwbot.php', $_POST['checked']) || in_array('wpbot-pro-starter/qcld-wpwbot.php', $_POST['checked']) ) ) {
47 - return;
48 - }
38 +$check_existing_plugin = get_option('qcld_chatbot_existing_plugin_activate_check');
39 +if ( isset($check_existing_plugin) && ($check_existing_plugin == 'yes') || class_exists( 'qcld_wb_Chatbot' ) ) {
40 + return;
49 41 }
50 42
51 43 if ( ! defined( 'QCLD_wpCHATBOT_VERSION' ) ) {
52 - define('QCLD_wpCHATBOT_VERSION', '8.5.5');
44 + define('QCLD_wpCHATBOT_VERSION', '8.3.8');
53 45 }
54 46 if ( ! defined( 'QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION' ) ) {
55 47 define('QCLD_wpCHATBOT_REQUIRED_wpCOMMERCE_VERSION', 2.2);
56 48 }
@@ -103,12 +95,8 @@
103 95 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld-floating-openai-style-filter.php' );
104 96 // require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/inc/qcld_openai_floating_content.php' );
105 97 // }
106 98
107 -// Built-in Chat Sessions & Analytics module.
108 -// Defers to the Pro addon automatically when it's active.
109 -require_once( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/chat-sessions/wpbot-chat-sessions.php' );
110 -
111 99 /**
112 100 * Main Class.
113 101 */
114 102
@@ -248,9 +236,9 @@
248 236 $capability = 'publish_posts';
249 237 }else{
250 238 $capability = 'manage_options';
251 239 }
252 - add_menu_page( esc_html('WPBot - ChatBot Lite'), esc_html('WPBot - ChatBot Lite'), 'manage_options','wpbot-panel', array($this, 'qcld_wb_chatbot_admin_page'),'dashicons-format-status', 6 );
240 + add_menu_page( esc_html('ChatBot WPBot Lite'), esc_html('ChatBot WPBot Lite'), 'manage_options','wpbot-panel', array($this, 'qcld_wb_chatbot_admin_page'),'dashicons-format-status', 6 );
253 241
254 242 add_submenu_page( 'wpbot-panel', esc_html('Settings'), esc_html('Settings'), 'manage_options','wpbot', array($this, 'qcld_wb_chatbot_admin_page_settings') );
255 243
256 244 add_submenu_page( 'wpbot-panel', esc_html('AI Settings'), esc_html('AI Settings'), 'manage_options','wpbot_openAi', 'wpbot_openAi_setting_func' );
@@ -260,9 +248,9 @@
260 248 add_action( "load-$hook", [ $this, 'screen_option' ] );
261 249
262 250 // add_submenu_page( 'wpbot-panel', esc_html('Conversational Form '), esc_html('Conversational Form'), 'manage_options','wpbots', [$this, 'qcld_wb_chatbot_admin_conversational_settings'] );
263 251
264 - add_submenu_page( 'wpbot-panel', esc_html('Get Support'), esc_html('Get Support'), 'manage_options','wpbot_support_page', 'qcpromo_wpbot_free_support_page_callback_func' );
252 + add_submenu_page( 'wpbot-panel', esc_html('Support'), esc_html('Support'), 'manage_options','wpbot_support_page', 'qcpromo_wpbot_free_support_page_callback_func' );
265 253
266 254 add_submenu_page( 'wpbot-panel', esc_html('Help and Debugging'), esc_html('Help and Debugging'), 'manage_options','wpbot_help_page', 'wpbot_help_page_callback_func' );
267 255
268 256
@@ -369,9 +357,9 @@
369 357 public function qcld_get_formbuilder_forms(){
370 358 global $wpdb;
371 359 $forms = array();
372 360 if(class_exists('Qcformbuilder_Forms_Admin')){
373 - $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
361 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
374 362 if(!empty($results)){
375 363 foreach($results as $result){
376 364 $form = maybe_unserialize($result->config);
377 365 $forms[] = trim($form['name']);
@@ -386,9 +374,9 @@
386 374 }
387 375 public function qcld_wpbot_simple_response_intent(){
388 376 global $wpdb;
389 377 $table = $wpdb->prefix.'wpbot_response';
390 - $results = $wpdb->get_results("SELECT `intent` FROM `{$table}` WHERE 1 and `intent` !=''"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
378 + $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''"); //DB Call OK, No Caching OK
391 379 $response = array();
392 380 if(!empty($results)){
393 381 foreach($results as $result){
394 382 $response[] = $result->intent;
@@ -400,9 +388,9 @@
400 388 global $wpdb;
401 389 $command = array();
402 390 if(class_exists('Qcformbuilder_Forms_Admin')){
403 391 $primary = 'primary';
404 - $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type = %s", $primary)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
392 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type = %s", $primary)); //DB Call OK, No Caching OK
405 393
406 394 if(!empty($results)){
407 395 foreach($results as $result){
408 396 $form = maybe_unserialize($result->config);
@@ -440,9 +428,9 @@
440 428 public function qcld_get_formbuilder_form_ids(){
441 429 global $wpdb;
442 430 $forms = array();
443 431 if(class_exists('Qcformbuilder_Forms_Admin')){
444 - $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
432 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
445 433
446 434 if(!empty($results)){
447 435 foreach($results as $result){
448 436 $form = maybe_unserialize($result->config);
@@ -476,9 +464,9 @@
476 464 $conversation_form_ids = array();
477 465 $conversation_form_names = array();
478 466
479 467 if(class_exists('Qcformbuilder_Forms_Admin')){
480 - $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
468 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type=%s", 'primary')); //DB Call OK, No Caching OK
481 469 if(!empty($results)){
482 470
483 471 foreach($results as $result){
484 472 $form = maybe_unserialize($result->config);
@@ -504,12 +492,12 @@
504 492 'yes' => str_replace('\\', '',get_option('qlcd_wp_chatbot_yes')),
505 493 'no' => str_replace('\\', '',get_option('qlcd_wp_chatbot_no')),
506 494 'or' => str_replace('\\', '',get_option('qlcd_wp_chatbot_or')),
507 495 'host' => str_replace('\\', '',get_option('qlcd_wp_chatbot_host')),
508 - 'agent' => str_replace(['\\','<','>'], '',esc_html(is_array(maybe_unserialize(get_option('qlcd_wp_chatbot_agent'))) ? current(maybe_unserialize(get_option('qlcd_wp_chatbot_agent'))) : get_option('qlcd_wp_chatbot_agent'))),
496 + 'agent' => str_replace(['\\','<','>'], '',esc_html(get_option('qlcd_wp_chatbot_agent'))),
509 497 'agent_image' => get_option('wp_chatbot_agent_image'),
510 498 'agent_image_path' => esc_url((!empty(get_option('wp_chatbot_custom_icon_path')) && !is_404(get_option('wp_chatbot_custom_icon_path'))) ? $this->qcld_wb_chatbot_agent_icon() : QCLD_wpCHATBOT_IMG_URL . 'icon-1.png'),
511 - 'shopper_demo_name' => str_replace('\\', '', is_array(maybe_unserialize(get_option('qlcd_wp_chatbot_shopper_demo_name'))) ? current(maybe_unserialize(get_option('qlcd_wp_chatbot_shopper_demo_name'))) : get_option('qlcd_wp_chatbot_shopper_demo_name')),
499 + 'shopper_demo_name' => str_replace('\\', '',get_option('qlcd_wp_chatbot_shopper_demo_name')),
512 500 'agent_join' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_agent_join'))),
513 501 'welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome'))),
514 502 'welcome_back' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome_back'))),
515 503 'hi_there' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_hi_there'))),
@@ -535,54 +523,54 @@
535 523 'sys_key_order' => get_option('qlcd_wp_chatbot_sys_key_order'),
536 524 'sys_key_support' => get_option('qlcd_wp_chatbot_sys_key_support'),
537 525 'sys_key_reset' => get_option('qlcd_wp_chatbot_sys_key_reset'),
538 526 'sys_key_email' => get_option('qlcd_wp_chatbot_sys_key_email'),
539 - 'help_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
540 - 'back_to_start' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
541 - 'help_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
542 - 'reset' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_reset'))),
543 - 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
544 - 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
545 - 'featured_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
546 - 'sale_products' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
547 - 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
527 + 'help_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_welcome'))),
528 + 'back_to_start' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_back_to_start'))),
529 + 'help_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_help_msg'))),
530 + 'reset' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_reset'))),
531 + 'wildcard_product' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_product'))),
532 + 'wildcard_catalog' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_catalog'))),
533 + 'featured_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_featured_products'))),
534 + 'sale_products' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_sale_products'))),
535 + 'wildcard_order' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_wildcard_order'))),
548 536 'wildcard_support' => get_option('qlcd_wp_chatbot_wildcard_support'),
549 - 'product_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
550 - 'product_suggest' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
551 - 'product_infinite' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
552 - 'product_success' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_success'))),
553 - 'product_fail' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
554 - 'support_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
537 + 'product_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_asking'))),
538 + 'product_suggest' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_suggest'))),
539 + 'product_infinite' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_infinite'))),
540 + 'product_success' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_success'))),
541 + 'product_fail' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_product_fail'))),
542 + 'support_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_welcome'))),
555 543 'support_email' => get_option('qlcd_wp_chatbot_support_email'),
556 - 'support_option_again' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
557 - 'asking_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
558 - 'asking_msg' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
559 - 'no_result' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_no_result'))),
544 + 'support_option_again' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_support_option_again'))),
545 + 'asking_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_email'))),
546 + 'asking_msg' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_msg'))),
547 + 'no_result' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_no_result'))),
560 548 'support_phone' => get_option('qlcd_wp_chatbot_support_phone'),
561 - 'asking_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
562 - 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
563 - 'support_query' => ((gettype(get_option('support_query')) == 'string') ? $this->qcld_wb_chatbot_str_replace(maybe_unserialize( get_option('support_query'))) : $this->qcld_wb_chatbot_str_replace(( get_option('support_query')))),
564 - 'support_ans' => (gettype(get_option('support_ans')) == 'string') ? $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('support_ans'))) : $this->qcld_wb_chatbot_str_replace((get_option('support_ans'))),
549 + 'asking_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_asking_phone'))),
550 + 'thank_for_phone' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_thank_for_phone'))),
551 + 'support_query' => ((gettype(get_option('support_query')) == 'string') ? $this->qcld_wb_chatbot_str_replace(unserialize( get_option('support_query'))) : $this->qcld_wb_chatbot_str_replace(( get_option('support_query')))),
552 + 'support_ans' => (gettype(get_option('support_ans')) == 'string') ? $this->qcld_wb_chatbot_str_replace(unserialize(get_option('support_ans'))) : $this->qcld_wb_chatbot_str_replace((get_option('support_ans'))),
565 553 'notification_interval' => get_option('qlcd_wp_chatbot_notification_interval'),
566 - 'notifications' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_notifications'))),
567 - 'order_welcome' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
568 - 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
569 - 'order_username_password' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
554 + 'notifications' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_notifications'))),
555 + 'order_welcome' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_welcome'))),
556 + 'order_username_asking' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_asking'))),
557 + 'order_username_password' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_username_password'))),
570 558 'order_user' => get_option('qlcd_wp_chatbot_order_user'),
571 559 'order_login' => is_user_logged_in(),
572 560 'is_chat_session_active' => qcld_wpbot_is_active_chat_history(),
573 561 'order_nonce' => wp_create_nonce("wpwbot-order-nonce"),
574 - 'order_email_support' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
562 + 'order_email_support' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_order_email_support'))),
575 563 'email_fail' => str_replace('\\', '', get_option('qlcd_wp_chatbot_email_fail')),
576 - 'invalid_email' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
564 + 'invalid_email' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_invalid_email'))),
577 565 'stop_words' => str_replace('\\', '', get_option('qlcd_wp_chatbot_stop_words')),
578 566 'currency_symbol' => '',
579 567 'enable_messenger' => get_option('enable_wp_chatbot_messenger'),
580 - 'messenger_label' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
568 + 'messenger_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_messenger_label'))),
581 569 'fb_page_id' => get_option('qlcd_wp_chatbot_fb_page_id'),
582 570 'enable_skype' => get_option('enable_wp_chatbot_skype'),
583 571 'enable_whats' => get_option('enable_wp_chatbot_whats'),
584 - 'whats_label' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
572 + 'whats_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_whats_label'))),
585 573 'whats_num' => get_option('qlcd_wp_chatbot_whats_num'),
586 574 'ret_greet' => get_option('qlcd_wp_chatbot_ret_greet'),
587 575 'enable_exit_intent' => get_option('enable_wp_chatbot_exit_intent'),
588 576 'exit_intent_msg' => str_replace('\\', '', get_option('wp_chatbot_exit_intent_msg')),
@@ -597,9 +585,9 @@
597 585 'auto_open_once' => get_option('wp_chatbot_auto_open_once'),
598 586 'proactive_bg_color' => get_option('wp_chatbot_proactive_bg_color'),
599 587 'disable_feedback' => get_option('disable_wp_chatbot_feedback'),
600 588 'disable_faq' => get_option('disable_wp_chatbot_faq'),
601 - 'feedback_label' => $this->qcld_wb_chatbot_str_replace(maybe_unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
589 + 'feedback_label' => $this->qcld_wb_chatbot_str_replace(unserialize(get_option('qlcd_wp_chatbot_feedback_label'))),
602 590 'enable_meta_title' =>get_option('enable_wp_chatbot_meta_title'),
603 591 'meta_label' =>str_replace('\\', '', get_option('qlcd_wp_chatbot_meta_label')),
604 592 'phone_number' => get_option('qlcd_wp_chatbot_phone'),
605 593 'disable_site_search' => get_option('disable_wp_chatbot_site_search'),
@@ -2473,15 +2461,13 @@
2473 2461
2474 2462 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
2475 2463 dbDelta( $sql_sliders_Table1 );
2476 2464
2477 -
2478 2465 //Bot Response Table
2479 2466 $table_rag_documents = $wpdb->prefix . "rag_documents";
2480 2467
2481 2468 $charset = $wpdb->get_charset_collate();
2482 - if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($table_rag_documents))) != $table_rag_documents) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
2483 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2469 + if ($wpdb->get_var("SHOW TABLES LIKE '$table_rag_documents'") != $table_rag_documents) {
2484 2470 $sql_rag_documents = "CREATE TABLE $table_rag_documents (
2485 2471 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
2486 2472 doc_id VARCHAR(100) DEFAULT NULL,
2487 2473 title VARCHAR(255) NOT NULL,
@@ -2495,14 +2481,12 @@
2495 2481 created_at DATETIME DEFAULT CURRENT_TIMESTAMP
2496 2482 ) $charset;";
2497 2483 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2498 2484 dbDelta($sql_rag_documents);
2499 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2500 2485 }
2501 2486 $table_report = $wpdb->prefix . 'wpbot_chat_report';
2502 2487
2503 - 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
2504 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
2488 + if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_report'" ) != $table_report ) {
2505 2489 $sql_report = "
2506 2490 CREATE TABLE `$table_report` (
2507 2491 `id` int(11) NOT NULL AUTO_INCREMENT,
2508 2492 `user_id` int(11) NOT NULL,
@@ -2516,12 +2500,11 @@
2516 2500 ";
2517 2501
2518 2502 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2519 2503 dbDelta( $sql_report );
2520 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.SchemaChange
2521 2504 }
2522 2505
2523 - $sqlqry = $wpdb->get_results($wpdb->prepare("select * from {$table1} where id = %d", 1)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
2506 + $sqlqry = $wpdb->get_results($wpdb->prepare("select * from $table1 where id = %d", 1)); //DB Call OK, No Caching OK
2524 2507 if(empty($sqlqry)){
2525 2508
2526 2509 $query = 'What Can WPBot do for you?';
2527 2510 $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
@@ -2527,9 +2510,9 @@
2527 2510 $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
2528 2511
2529 2512 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
2530 2513 $format = array('%s','%s', '%s', '%s');
2531 - $wpdb->insert($table1,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter
2514 + $wpdb->insert($table1,$data,$format); //DB Call OK, No Caching OK
2532 2515 }
2533 2516
2534 2517 $url = get_site_url();
2535 2518 $url = wp_parse_url($url);
@@ -3493,9 +3476,9 @@
3493 3476 <div class="wrap qcld-main-wrapper">
3494 3477 <div class="qcld-wp-chatbot-wrap-header">
3495 3478
3496 3479 <div class="qcld-wp-chatbot-wrap-header-logo"><a href="#" class="qcld-wp-chatbot-wrap-site__logo"><img style="width:100%" src="<?php echo esc_url( QCLD_wpCHATBOT_IMG_URL . '/chatbot.png' ); ?>" alt="Dialogflow CX"> WPBot Control Panel </a>
3497 - <p><strong>Core Version:</strong> v<?php echo esc_html( QCLD_wpCHATBOT_VERSION ); ?></p>
3480 + <p><strong>Core Version:</strong> v<?php echo QCLD_wpCHATBOT_VERSION; ?></p>
3498 3481 </div>
3499 3482 <ul class="qcld-wp-chatbot-wrap-version-wrapper">
3500 3483 <li>
3501 3484 <a class="wpchatbot-Upgrade" href="https://www.wpbot.pro/" target="_blank">Upgrade To Pro</a>
@@ -4095,9 +4078,9 @@
4095 4078 if(!get_option('qlcd_wp_chatbot_did_you_mean')) {
4096 4079 update_option('qlcd_wp_chatbot_did_you_mean', maybe_serialize(array('Did you mean?')));
4097 4080 }
4098 4081
4099 - $sqlqry = $wpdb->get_results( $wpdb->prepare( "select * from {$table1} where id = %d", 1 ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
4082 + $sqlqry = $wpdb->get_results( $wpdb->prepare( "select * from $table1 where id = %d", 1 ) ); //DB Call OK, No Caching OK
4100 4083 if(empty($sqlqry)){
4101 4084
4102 4085 $query = 'What Can WPBot do for you?';
4103 4086 $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
@@ -4103,9 +4086,9 @@
4103 4086 $response = 'WPBot can converse fluidly with users on website and FB messenger. It can search your website, send/collect eMails, user feedback & phone numbers . You can create Custom Intents from DialogFlow with Rich Messages & Card responses!';
4104 4087
4105 4088 $data = array('query' => $query, 'keyword' => '', 'response'=> $response, 'intent'=> '');
4106 4089 $format = array('%s','%s', '%s', '%s');
4107 - $wpdb->insert($table1,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter
4090 + $wpdb->insert($table1,$data,$format); //DB Call OK, No Caching OK
4108 4091 }
4109 4092
4110 4093 update_option('qc_wpb_simple_response_db_upgrade_free2', 'done');
4111 4094
@@ -4151,11 +4134,11 @@
4151 4134 if(isset($_POST['qc_bot_str_id']) && wp_unslash($_POST['qc_bot_str_id'])!=''){
4152 4135 $id = sanitize_text_field(wp_unslash($_POST['qc_bot_str_id']));
4153 4136 $where = array('id'=>$id);
4154 4137 $whereformat = array('%d');
4155 - $wpdb->update( $table, $data, $where, $format, $whereformat ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4138 + $wpdb->update( $table, $data, $where, $format, $whereformat ); //DB Call OK, No Caching OK
4156 4139 }else{
4157 - $wpdb->insert($table,$data,$format); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
4140 + $wpdb->insert($table,$data,$format); //DB Call OK, No Caching OK
4158 4141 }
4159 4142
4160 4143 qcld_mysql_remove_existing_indexes();
4161 4144
@@ -4161,9 +4144,9 @@
4161 4144
4162 4145 // phpcs:ignore
4163 4146 $wpdb->query("ALTER TABLE $table ADD FULLTEXT(`query`, `keyword`, `response`)");
4164 4147
4165 - wp_safe_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4148 + wp_redirect(admin_url('admin.php?page=simple-text-response'));exit;
4166 4149
4167 4150 }
4168 4151 $table = $wpdb->prefix.'wpbot_response';
4169 4152
@@ -4194,27 +4177,15 @@
4194 4177 }
4195 4178 if(isset($_POST['qc_bot_str_fields']) && !empty($_POST['qc_bot_str_fields'])){
4196 4179 $table = $wpdb->prefix.'wpbot_response';
4197 4180 $fields = rest_sanitize_array(wp_unslash($_POST['qc_bot_str_fields']));
4198 -
4199 - $allowed_fields = array('query', 'keyword', 'response');
4200 - $valid_fields = array();
4201 - if(is_array($fields)){
4202 - foreach($fields as $field){
4203 - if(in_array($field, $allowed_fields)){
4204 - $valid_fields[] = $field;
4205 - }
4206 - }
4207 - }
4208 - $fields = $valid_fields;
4209 -
4210 4181 update_option('qc_bot_str_fields', $fields);
4211 4182 qcld_mysql_remove_existing_indexes();
4212 4183
4213 4184 if($fields && !empty($fields)){
4214 - $safe_fields = array_map(function($f) { return '`' . $f . '`'; }, $fields);
4185 +
4215 4186 // phpcs:ignore
4216 - $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $safe_fields).")");
4187 + $wpdb->query("ALTER TABLE $table ADD FULLTEXT(".implode(', ', $fields).")");
4217 4188
4218 4189 }
4219 4190 }
4220 4191
@@ -4238,9 +4209,9 @@
4238 4209 if( !function_exists('qcld_wpbot_simple_response_intent') ){
4239 4210 function qcld_wpbot_simple_response_intent(){
4240 4211 global $wpdb;
4241 4212 $table = $wpdb->prefix.'wpbot_response';
4242 - $results = $wpdb->get_results("SELECT `intent` FROM `{$table}` WHERE 1 and `intent` !=''"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
4213 + $results = $wpdb->get_results("SELECT `intent` FROM `$table` WHERE 1 and `intent` !=''"); //DB Call OK, No Caching OK
4243 4214 $response = array();
4244 4215 if(!empty($results)){
4245 4216 foreach($results as $result){
4246 4217 $response[] = $result->intent;
@@ -4253,9 +4224,9 @@
4253 4224 function qcld_mysql_remove_existing_indexes(){
4254 4225 global $wpdb;
4255 4226 $table = $wpdb->prefix.'wpbot_response';
4256 4227
4257 - $results = $wpdb->get_results("SHOW INDEX FROM {$table}"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
4228 + $results = $wpdb->get_results("SHOW INDEX FROM $table"); //DB Call OK, No Caching OK
4258 4229 $indexes = array();
4259 4230 foreach($results as $result){
4260 4231
4261 4232
@@ -4282,5 +4253,7 @@
4282 4253 exit( wp_redirect( esc_url( admin_url('admin.php?page=wpbot') ) ) );
4283 4254 }
4284 4255 }
4285 4256 }
4286 -}
4257 +}
4258 +
4259 +