| @@ -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, |
| @@ -146,15 +145,14 @@ | ||
| 146 | 145 | wp_send_json_success(); |
| 147 | 146 | } |
| 148 | 147 | public function rate_limit_settings_option_callback() |
| 149 | 148 | { |
| 150 | - | |
| 151 | 149 | // Check is admin and verify nonce |
| 152 | 150 | if (! current_user_can('manage_options')) { |
| 153 | 151 | wp_send_json_error('Unauthorized'); |
| 154 | 152 | wp_die(); |
| 155 | 153 | } |
| 156 | - check_ajax_referer( 'wp_chatbot', 'nonce' ); | |
| 154 | + check_ajax_referer( 'wp_chatbot_admin', 'nonce' ); | |
| 157 | 155 | // Save the rate limiting enabled/disabled setting |
| 158 | 156 | if (isset($_POST['is_rate_limiting_enabled'])) { |
| 159 | 157 | $is_rate_limiting_enabled = intval( wp_unslash( $_POST['is_rate_limiting_enabled'] ) ); |
| 160 | 158 | update_option('is_rate_limiting_enabled', $is_rate_limiting_enabled); |
| @@ -227,22 +225,15 @@ | ||
| 227 | 225 | ); |
| 228 | 226 | if (get_option('is_stream_enabled') == 1) { |
| 229 | 227 | $response = array( |
| 230 | 228 | '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 | - ), | |
| 229 | + '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'), | |
| 230 | + | |
| 236 | 231 | ); |
| 237 | 232 | } else { |
| 238 | 233 | $response = array( |
| 239 | 234 | '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 | - ), | |
| 235 | + '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 | 236 | ); |
| 246 | 237 | } |
| 247 | 238 | if (is_user_logged_in()) { |
| 248 | 239 | $user = wp_get_current_user(); |