PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.3.0
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.3.0
8.7.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 All 534 releases
← All changes | functions.php +21 -41 8.6.68.3.0 View file →
@@ -14,9 +14,9 @@
14 14 $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . get_option('wp_chatbot_agent_image');
15 15 } else {
16 16 $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . 'custom-agent.png';
17 17 }
18 - $hidden_field = '<a class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important;position: absolute;top: -9px;right: -60px;"><img src="'. esc_url($wp_chatbot_custom_agent_path) .'" alt=""></a>';
18 + $hidden_field = '<a class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important;position: absolute;top: -9px;right: -60px;"><img src="'. esc_attr($wp_chatbot_custom_agent_path) .'" alt=""></a>';
19 19 $block_content = str_replace( '</form>', $hidden_field . '</form>', $form );
20 20 return $block_content;
21 21 }
22 22 if(get_option('wpbot_enable_on_search') == 1 && (get_option('disable_floating_button') != '1') && get_option('disable_wp_chatbot') != 1 ){
@@ -33,9 +33,9 @@
33 33 $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . get_option('wp_chatbot_agent_image');
34 34 } else {
35 35 $wp_chatbot_custom_agent_path = QCLD_wpCHATBOT_IMG_URL . 'custom-agent.png';
36 36 }
37 - $hidden_field = '<button type="button" class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important"><img src="'. esc_url($wp_chatbot_custom_agent_path) .'" alt=""></button>';
37 + $hidden_field = '<button type="button" class="wp-chatbot qc_wpbot_chat_link" id="wp-chatbot-search-btn" data-search-type="product" data-search-term="" style="max-height: 50px; margin-left: 10px;padding: 0 !important"><img src="'. esc_attr($wp_chatbot_custom_agent_path) .'" alt=""></button>';
38 38 // Inject the hidden field before the closing </form> tag
39 39 $block_content = str_replace( '</div></form>', $hidden_field . '</div></form>', $block_content );
40 40 return $block_content;
41 41 }
@@ -65,9 +65,9 @@
65 65 ?>
66 66 <style>
67 67 <?php if(get_option('wp_chatbot_custom_css')!="") {
68 68
69 - echo wp_strip_all_tags( get_option('wp_chatbot_custom_css') );// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
69 + echo wp_strip_all_tags( get_option('wp_chatbot_custom_css') );
70 70 }
71 71 ?>
72 72 </style>
73 73
@@ -155,9 +155,9 @@
155 155 }
156 156 ?>
157 157 <div class="wp-chatbot-notification-agent-profile">
158 158 <div class="wp-chatbot-notification-widget-avatar" ><img
159 - src="<?php echo esc_url($wp_chatbot_custom_agent_path); ?>" alt=""></div>
159 + src="<?php echo esc_attr($wp_chatbot_custom_agent_path); ?>" alt=""></div>
160 160 <div class="wp-chatbot-notification-welcome"><?php echo wp_kses_post(wpb_randmom_message_handle(maybe_unserialize(get_option('qlcd_wp_chatbot_welcome')))) . ' <strong>' . esc_html(get_option('qlcd_wp_chatbot_host')) . '</strong>'; ?></div>
161 161 </div>
162 162 <?php
163 163 //update_option('qlcd_wp_chatbot_notifications','Welcome to WpBot');
@@ -338,15 +338,8 @@
338 338 */
339 339 add_action('wp_ajax_qcld_wb_chatbot_keyword', 'qcld_wb_chatbot_keyword');
340 340 add_action('wp_ajax_nopriv_qcld_wb_chatbot_keyword', 'qcld_wb_chatbot_keyword');
341 341 function qcld_wb_chatbot_keyword(){
342 - // Verify nonce for security
343 - $nonce = isset($_POST['security']) ? sanitize_text_field(wp_unslash($_POST['security'])) : (isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : '');
344 - if ( ! wp_verify_nonce( $nonce, 'wp_chatbot' ) && ! wp_verify_nonce( $nonce, 'qcsecretbotnonceval123qc' ) ) {
345 - wp_send_json_error( array( 'status' => 'fail', 'message' => 'Security check failed.' ) );
346 - wp_die();
347 - }
348 -
349 342 $keyword = sanitize_text_field(wp_unslash($_POST['keyword']));
350 343 $product_per_page = get_option('qlcd_wp_chatbot_ppp') != '' ? get_option('qlcd_wp_chatbot_ppp') : 10;
351 344 if (get_option('qlcd_wp_chatbot_search_option') == 'standard') {
352 345 $product_orderby = sanitize_text_field(get_option('qlcd_wp_chatbot_product_orderby') != '' ? get_option('qlcd_wp_chatbot_product_orderby') : 'title');
@@ -393,9 +386,9 @@
393 386 endwhile;
394 387 wp_reset_postdata();
395 388 $html .= '</ul>';
396 389 if ($total_product_num > $product_per_page && $product_per_page > 0 ) {
397 - $html .= '<p style="text-align: center"><button type="button" id="wp-chatbot-loadmore" data-offset="' . $product_per_page . '" data-search-type="product" data-search-term="' . esc_attr($keyword) . '" >' . wp_kses_post(wpb_randmom_message_handle(unserialize(get_option('qlcd_wp_chatbot_load_more')))) . ' <span id="wp-chatbot-loadmore-loader"></span></button> </p>';
390 + $html .= '<p style="text-align: center"><button type="button" id="wp-chatbot-loadmore" data-offset="' . $product_per_page . '" data-search-type="product" data-search-term="' . $keyword . '" >' . wp_kses_post(wpb_randmom_message_handle(unserialize(get_option('qlcd_wp_chatbot_load_more')))) . ' <span id="wp-chatbot-loadmore-loader"></span></button> </p>';
398 391 }
399 392 }
400 393 $html .= '</div>';
401 394 } else if (get_option('qlcd_wp_chatbot_search_option') == 'advanced') {
@@ -423,9 +416,9 @@
423 416 }
424 417 }
425 418 $html .= '</ul>';
426 419 if ($total_product_num > $product_per_page && $product_per_page > 0) {
427 - $html .= '<p style="text-align: center"><button type="button" id="wp-chatbot-loadmore" data-offset="' . $product_per_page . '" data-search-type="product" data-search-term="' . esc_attr($more_product_ids) . '" >' . wp_kses_post(wpb_randmom_message_handle(unserialize(get_option('qlcd_wp_chatbot_load_more')))) . ' <span id="wp-chatbot-loadmore-loader"></span></button> </p>';
420 + $html .= '<p style="text-align: center"><button type="button" id="wp-chatbot-loadmore" data-offset="' . $product_per_page . '" data-search-type="product" data-search-term="' . $more_product_ids . '" >' . wp_kses_post(wpb_randmom_message_handle(unserialize(get_option('qlcd_wp_chatbot_load_more')))) . ' <span id="wp-chatbot-loadmore-loader"></span></button> </p>';
428 421 }
429 422 }
430 423 $html .= '</div>';
431 424 }
@@ -1273,9 +1266,9 @@
1273 1266 $html .= get_the_post_thumbnail(get_the_ID(), 'shop_catalog') . '
1274 1267 <div class="wp-chatbot-product-summary">
1275 1268 <div class="wp-chatbot-product-table">
1276 1269 <div class="wp-chatbot-product-table-cell">
1277 - <h3 class="wp-chatbot-product-title">' . esc_html($product->post->post_title) . '</h3>
1270 + <h3 class="wp-chatbot-product-title">' . $product->post->post_title . '</h3>
1278 1271 <div class="price">' . $product->get_price_html() . '</div>';
1279 1272 $html .= ' </div>
1280 1273 </div>
1281 1274 </div></a>
@@ -1344,9 +1337,9 @@
1344 1337 $html .= get_the_post_thumbnail(get_the_ID(), 'shop_catalog') . '
1345 1338 <div class="wp-chatbot-product-summary">
1346 1339 <div class="wp-chatbot-product-table">
1347 1340 <div class="wp-chatbot-product-table-cell">
1348 - <h3 class="wp-chatbot-product-title">' . esc_html($product->post->post_title) . '</h3>
1341 + <h3 class="wp-chatbot-product-title">' . $product->post->post_title . '</h3>
1349 1342 <div class="price">' . $product->get_price_html() . '</div>';
1350 1343 $html .= ' </div>
1351 1344 </div>
1352 1345 </div></a>
@@ -1520,9 +1513,8 @@
1520 1513 //Updating the cart items.
1521 1514 add_action('wp_ajax_qcld_wb_chatbot_update_cart_item_number', 'qcld_wb_chatbot_update_cart_item_number');
1522 1515 add_action('wp_ajax_nopriv_qcld_wb_chatbot_update_cart_item_number', 'qcld_wb_chatbot_update_cart_item_number');
1523 1516 function qcld_wb_chatbot_update_cart_item_number(){
1524 - check_ajax_referer( 'wp_chatbot', 'nonce' );
1525 1517 //getting cart items n
1526 1518 $cart_item_key = sanitize_text_field(wp_unslash($_POST['cart_item_key']));
1527 1519 $qnty = sanitize_text_field(wp_unslash($_POST['qnty']));
1528 1520 global $wpcommerce;
@@ -1532,9 +1524,8 @@
1532 1524 //Show item after removing from cart page.
1533 1525 add_action('wp_ajax_qcld_wb_chatbot_cart_item_remove', 'qcld_wb_chatbot_cart_item_remove');
1534 1526 add_action('wp_ajax_nopriv_qcld_wb_chatbot_cart_item_remove', 'qcld_wb_chatbot_cart_item_remove');
1535 1527 function qcld_wb_chatbot_cart_item_remove(){
1536 - check_ajax_referer( 'wp_chatbot', 'nonce' );
1537 1528 //getting cart items n
1538 1529 $cart_item_key = sanitize_text_field(wp_unslash($_POST['cart_item']));
1539 1530 global $wpcommerce;
1540 1531 $result = $wpcommerce->cart->remove_cart_item($cart_item_key);
@@ -1592,9 +1583,9 @@
1592 1583
1593 1584 if(class_exists('Qcformbuilder_Forms_Admin')){
1594 1585
1595 1586
1596 - $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
1587 + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ". $wpdb->prefix."wfb_forms WHERE type= %s",'primary')); //DB Call OK, No Caching OK
1597 1588
1598 1589 if(!empty($results)){
1599 1590
1600 1591 foreach($results as $result){
@@ -1747,12 +1738,9 @@
1747 1738 }
1748 1739 }
1749 1740
1750 1741 function qcld_choose_random($array){
1751 - if (is_array($array) && !empty($array)) {
1752 - return $array[array_rand($array)];
1753 - }
1754 - return $array;
1742 + return $array[array_rand($array)];
1755 1743 }
1756 1744
1757 1745 //User session count
1758 1746 add_action('wp_ajax_qcld_wb_chatbot_session_count', 'qcld_wb_chatbot_session_count');
@@ -1765,22 +1753,22 @@
1765 1753 $tableuser = $wpdb->prefix.'wpbot_sessions';
1766 1754 $response = array();
1767 1755
1768 1756
1769 - $session_exists = $wpdb->get_row($wpdb->prepare("select * from {$tableuser} where 1 and id = %d",1)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
1757 + $session_exists = $wpdb->get_row($wpdb->prepare("select * from $tableuser where 1 and id = %d",1)); //DB Call OK, No Caching OK
1770 1758
1771 1759 if(empty($session_exists)){
1772 - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
1760 + $wpdb->insert(
1773 1761 $tableuser,
1774 1762 array(
1775 1763 'session' => 1,
1776 1764 )
1777 - );
1765 + ); //DB Call OK, No Caching OK
1778 1766 }else{
1779 1767
1780 1768 $session_id = $session_exists->id;
1781 1769
1782 - $wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
1770 + $wpdb->update(
1783 1771 $tableuser,
1784 1772 array(
1785 1773 'session'=>($session_exists->session+1),
1786 1774 ),
@@ -1788,9 +1776,9 @@
1788 1776 array(
1789 1777 '%d',
1790 1778 ),
1791 1779 array('%d')
1792 - );
1780 + ); //DB Call OK, No Caching OK
1793 1781
1794 1782 }
1795 1783
1796 1784 wp_send_json($response);
@@ -1798,9 +1786,9 @@
1798 1786
1799 1787 /* WPBot Chat History Addon check */
1800 1788 function qcld_wpbot_is_active_chat_history(){
1801 1789
1802 - if(function_exists('qcwp_chat_session_menu_fnc') || function_exists('qcwp_chat_session_menu_fnc_free') || function_exists( 'qcpdcs_chat_session_menu_fnc' ) ){
1790 + if(function_exists('qcwp_chat_session_menu_fnc') || function_exists( 'qcpdcs_chat_session_menu_fnc' ) ){
1803 1791 return 1;
1804 1792 }else{
1805 1793 return 0;
1806 1794 }
@@ -1815,11 +1803,9 @@
1815 1803 return $data;
1816 1804 }
1817 1805 add_action('wp_ajax_qcld_small_talk_import', 'qcld_small_talk_import');
1818 1806 function qcld_small_talk_import(){
1819 - if ( ! current_user_can( 'manage_options' ) ) {
1820 - wp_die();
1821 - }
1807 +
1822 1808 global $wpdb;
1823 1809
1824 1810 $table = $wpdb->prefix.'wpbot_response';
1825 1811
@@ -1826,10 +1812,9 @@
1826 1812 $csvFile = file(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'small_talk.csv');
1827 1813
1828 1814 foreach ($csvFile as $line) {
1829 1815 $line = str_getcsv($line, ',', '"');
1830 - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
1831 - $table, array(
1816 + $wpdb->insert($table, array(
1832 1817 'query' => $line[0],
1833 1818 'keyword' => $line[1],
1834 1819 'response' => $line[2],
1835 1820 'category'=> $line[3],
@@ -1834,17 +1819,16 @@
1834 1819 'response' => $line[2],
1835 1820 'category'=> $line[3],
1836 1821 'intent'=> '',
1837 1822 //'lang'=> 'en_US',
1838 - ));
1823 + )); //DB Call OK, No Caching OK
1839 1824 }
1840 1825
1841 1826 $table2 = $wpdb->prefix.'wpbot_response_category';
1842 1827
1843 - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
1844 - $table2, array(
1828 + $wpdb->insert($table2, array(
1845 1829 'name' => 'smalltalk',
1846 - ));
1830 + )); //DB Call OK, No Caching OK
1847 1831
1848 1832 update_option( 'qcld_small_talk_imported', 'yes' );
1849 1833
1850 1834 }
@@ -1871,12 +1855,8 @@
1871 1855 add_action( 'wp_ajax_nopriv_qcld_change_language_from_center', 'qcld_change_language_from_center' );
1872 1856 function qcld_change_language_from_center() {
1873 1857 if ( ! current_user_can( 'manage_options' ) ) {
1874 1858 wp_send_json_error( array( 'message' => 'Unauthorized.' ) );
1875 - }
1876 - $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
1877 - if ( ! wp_verify_nonce( $nonce, 'wp_chatbot' ) ) {
1878 - wp_send_json_error( array( 'message' => 'Invalid nonce.' ) );
1879 1859 }
1880 1860 $plugin_path = plugin_dir_path( __FILE__ );
1881 1861 include $plugin_path . 'includes/admin/settings-fields.php';
1882 1862 $json_file_path = $plugin_path . 'includes/language-center.json';