PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.3.2
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.3.2
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 +20 -37 8.5.58.3.2 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){
@@ -1762,22 +1753,22 @@
1762 1753 $tableuser = $wpdb->prefix.'wpbot_sessions';
1763 1754 $response = array();
1764 1755
1765 1756
1766 - $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
1767 1758
1768 1759 if(empty($session_exists)){
1769 - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
1760 + $wpdb->insert(
1770 1761 $tableuser,
1771 1762 array(
1772 1763 'session' => 1,
1773 1764 )
1774 - );
1765 + ); //DB Call OK, No Caching OK
1775 1766 }else{
1776 1767
1777 1768 $session_id = $session_exists->id;
1778 1769
1779 - $wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
1770 + $wpdb->update(
1780 1771 $tableuser,
1781 1772 array(
1782 1773 'session'=>($session_exists->session+1),
1783 1774 ),
@@ -1785,9 +1776,9 @@
1785 1776 array(
1786 1777 '%d',
1787 1778 ),
1788 1779 array('%d')
1789 - );
1780 + ); //DB Call OK, No Caching OK
1790 1781
1791 1782 }
1792 1783
1793 1784 wp_send_json($response);
@@ -1795,9 +1786,9 @@
1795 1786
1796 1787 /* WPBot Chat History Addon check */
1797 1788 function qcld_wpbot_is_active_chat_history(){
1798 1789
1799 - 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' ) ){
1800 1791 return 1;
1801 1792 }else{
1802 1793 return 0;
1803 1794 }
@@ -1812,11 +1803,9 @@
1812 1803 return $data;
1813 1804 }
1814 1805 add_action('wp_ajax_qcld_small_talk_import', 'qcld_small_talk_import');
1815 1806 function qcld_small_talk_import(){
1816 - if ( ! current_user_can( 'manage_options' ) ) {
1817 - wp_die();
1818 - }
1807 +
1819 1808 global $wpdb;
1820 1809
1821 1810 $table = $wpdb->prefix.'wpbot_response';
1822 1811
@@ -1823,10 +1812,9 @@
1823 1812 $csvFile = file(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'small_talk.csv');
1824 1813
1825 1814 foreach ($csvFile as $line) {
1826 1815 $line = str_getcsv($line, ',', '"');
1827 - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
1828 - $table, array(
1816 + $wpdb->insert($table, array(
1829 1817 'query' => $line[0],
1830 1818 'keyword' => $line[1],
1831 1819 'response' => $line[2],
1832 1820 'category'=> $line[3],
@@ -1831,17 +1819,16 @@
1831 1819 'response' => $line[2],
1832 1820 'category'=> $line[3],
1833 1821 'intent'=> '',
1834 1822 //'lang'=> 'en_US',
1835 - ));
1823 + )); //DB Call OK, No Caching OK
1836 1824 }
1837 1825
1838 1826 $table2 = $wpdb->prefix.'wpbot_response_category';
1839 1827
1840 - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
1841 - $table2, array(
1828 + $wpdb->insert($table2, array(
1842 1829 'name' => 'smalltalk',
1843 - ));
1830 + )); //DB Call OK, No Caching OK
1844 1831
1845 1832 update_option( 'qcld_small_talk_imported', 'yes' );
1846 1833
1847 1834 }
@@ -1868,12 +1855,8 @@
1868 1855 add_action( 'wp_ajax_nopriv_qcld_change_language_from_center', 'qcld_change_language_from_center' );
1869 1856 function qcld_change_language_from_center() {
1870 1857 if ( ! current_user_can( 'manage_options' ) ) {
1871 1858 wp_send_json_error( array( 'message' => 'Unauthorized.' ) );
1872 - }
1873 - $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
1874 - if ( ! wp_verify_nonce( $nonce, 'wp_chatbot' ) ) {
1875 - wp_send_json_error( array( 'message' => 'Invalid nonce.' ) );
1876 1859 }
1877 1860 $plugin_path = plugin_dir_path( __FILE__ );
1878 1861 include $plugin_path . 'includes/admin/settings-fields.php';
1879 1862 $json_file_path = $plugin_path . 'includes/language-center.json';