| @@ -29,9 +29,8 @@ | ||
| 29 | 29 | class Logtivity_Log_Index_Controller |
| 30 | 30 | { |
| 31 | 31 | public function __construct() |
| 32 | 32 | { |
| 33 | - add_action('wp_ajax_nopriv_logtivity_log_index_filter', [$this, 'search']); | |
| 34 | 33 | add_action('wp_ajax_logtivity_log_index_filter', [$this, 'search']); |
| 35 | 34 | } |
| 36 | 35 | |
| 37 | 36 | /** |
| @@ -46,8 +45,10 @@ | ||
| 46 | 45 | * @return void |
| 47 | 46 | */ |
| 48 | 47 | public function search(): void |
| 49 | 48 | { |
| 49 | + check_ajax_referer('logtivity_log_index_filter', 'logtivity_log_index_nonce'); | |
| 50 | + | |
| 50 | 51 | if (current_user_can(Logtivity::ACCESS_LOGS)) { |
| 51 | 52 | $api = Logtivity::log(); |
| 52 | 53 | |
| 53 | 54 | if ($api->getOption()->getApiKey()) { |
| @@ -89,9 +90,11 @@ | ||
| 89 | 90 | * @return ?string |
| 90 | 91 | */ |
| 91 | 92 | protected function getInput(string $field): ?string |
| 92 | 93 | { |
| 93 | - return sanitize_text_field($_GET[$field] ?? null); | |
| 94 | + return isset($_GET[$field]) | |
| 95 | + ? sanitize_text_field(wp_unslash($_GET[$field])) | |
| 96 | + : null; | |
| 94 | 97 | } |
| 95 | 98 | |
| 96 | 99 | /** |
| 97 | 100 | * @param string|array $response |