| @@ -94,10 +94,9 @@ | ||
| 94 | 94 | $feedback = sanitize_text_field(wp_unslash($_POST['feedback'])); // "like" or "dislike" |
| 95 | 95 | $meta_info = sanitize_textarea_field(wp_unslash($_POST['meta_info'])); |
| 96 | 96 | $date = current_time('mysql'); |
| 97 | 97 | |
| 98 | - $inserted = $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery | |
| 99 | - $table, array( | |
| 98 | + $inserted = $wpdb->insert($table, array( | |
| 100 | 99 | 'user_id' => $user_id, |
| 101 | 100 | 'conversation_id'=> $conversation_id, |
| 102 | 101 | 'message' => $message, |
| 103 | 102 | 'feedback' => $feedback, |
| @@ -126,9 +125,9 @@ | ||
| 126 | 125 | $email = sanitize_email(wp_unslash($_POST['email'])); |
| 127 | 126 | $message = sanitize_textarea_field(wp_unslash($_POST['message'])); |
| 128 | 127 | $report_text = sanitize_textarea_field(wp_unslash($_POST['report_text'])); |
| 129 | 128 | |
| 130 | - $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery | |
| 129 | + $wpdb->insert( | |
| 131 | 130 | $table_report, |
| 132 | 131 | [ |
| 133 | 132 | 'user_id' => get_current_user_id(), // or match from wpbot_user. |
| 134 | 133 | 'message' => $message, |
| @@ -227,22 +226,15 @@ | ||
| 227 | 226 | ); |
| 228 | 227 | if (get_option('is_stream_enabled') == 1) { |
| 229 | 228 | $response = array( |
| 230 | 229 | 'status' => 'error', |
| 231 | - 'message' => esc_html( | |
| 232 | - ( is_array( $qlcd_wp_chatbot_ai_rate_limiting_message ) && ! empty( $qlcd_wp_chatbot_ai_rate_limiting_message[0] ) ) | |
| 233 | - ? $qlcd_wp_chatbot_ai_rate_limiting_message[0] | |
| 234 | - : __( 'Rate limit exceeded. Please try again later.', 'chatbot' ) | |
| 235 | - ), | |
| 230 | + 'message' => esc_html__((is_array($qlcd_wp_chatbot_ai_rate_limiting_message) && !empty($qlcd_wp_chatbot_ai_rate_limiting_message[0]) ? $qlcd_wp_chatbot_ai_rate_limiting_message[0] : 'Rate limit exceeded. Please try again later.'), 'chatbot'), | |
| 231 | + | |
| 236 | 232 | ); |
| 237 | 233 | } else { |
| 238 | 234 | $response = array( |
| 239 | 235 | 'status' => 'success', |
| 240 | - 'message' => esc_html( | |
| 241 | - ( is_array( $qlcd_wp_chatbot_ai_rate_limiting_message ) && ! empty( $qlcd_wp_chatbot_ai_rate_limiting_message[0] ) ) | |
| 242 | - ? $qlcd_wp_chatbot_ai_rate_limiting_message[0] | |
| 243 | - : __( 'Rate limit exceeded. Please try again later.', 'chatbot' ) | |
| 244 | - ), | |
| 236 | + 'message' => esc_html__((is_array($qlcd_wp_chatbot_ai_rate_limiting_message) && !empty($qlcd_wp_chatbot_ai_rate_limiting_message[0]) ? $qlcd_wp_chatbot_ai_rate_limiting_message[0] : 'Rate limit exceeded. Please try again later.'), 'chatbot'), | |
| 245 | 237 | ); |
| 246 | 238 | } |
| 247 | 239 | if (is_user_logged_in()) { |
| 248 | 240 | $user = wp_get_current_user(); |