| @@ -14,10 +14,10 @@ | ||
| 14 | 14 | add_action('wp_ajax_loginizer_export', 'loginizer_export'); |
| 15 | 15 | add_action('wp_ajax_loginizer_social_order', 'loginizer_social_order'); |
| 16 | 16 | add_action('wp_ajax_loginizer_dismiss_license_alert', 'loginizer_dismiss_license_alert'); |
| 17 | 17 | add_action('wp_ajax_loginizer_dismiss_softwp_alert', 'loginizer_dismiss_softwp_alert'); |
| 18 | +add_action('wp_ajax_loginizer_close_update_notice', 'loginizer_close_update_notice'); | |
| 18 | 19 | |
| 19 | - | |
| 20 | 20 | // ----- FUNCTIONS ------// |
| 21 | 21 | |
| 22 | 22 | function loginizer_dismiss_csrf(){ |
| 23 | 23 | |
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | function loginizer_dismiss_social_alert(){ |
| 37 | 37 | |
| 38 | 38 | // Some AJAX security |
| 39 | 39 | check_ajax_referer('loginizer_admin_ajax', 'nonce'); |
| 40 | - | |
| 40 | + | |
| 41 | 41 | if(!current_user_can('manage_options')){ |
| 42 | 42 | wp_send_json_error('Sorry, but you do not have permissions to change settings.'); |
| 43 | 43 | } |
| 44 | 44 | |
| @@ -50,9 +50,9 @@ | ||
| 50 | 50 | function loginizer_dismiss_backuply(){ |
| 51 | 51 | |
| 52 | 52 | // Some AJAX security |
| 53 | 53 | check_ajax_referer('loginizer_admin_ajax', 'nonce'); |
| 54 | - | |
| 54 | + | |
| 55 | 55 | if(!current_user_can('manage_options')){ |
| 56 | 56 | wp_die('Sorry, but you do not have permissions to change settings.'); |
| 57 | 57 | } |
| 58 | 58 | |
| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | function loginizer_dismiss_newsletter(){ |
| 65 | 65 | |
| 66 | 66 | // Some AJAX security |
| 67 | 67 | check_ajax_referer('loginizer_admin_ajax', 'nonce'); |
| 68 | - | |
| 68 | + | |
| 69 | 69 | if(!current_user_can('manage_options')){ |
| 70 | 70 | wp_die('Sorry, but you do not have permissions to change settings.'); |
| 71 | 71 | } |
| 72 | 72 | |
| @@ -105,9 +105,9 @@ | ||
| 105 | 105 | fputcsv($file, array_values($allowed_fields)); |
| 106 | 106 | |
| 107 | 107 | foreach($csv_array as $failed_attempts){ |
| 108 | 108 | |
| 109 | - $row = array($failed_attempts['ip'], $failed_attempts['username'], date('d/M/Y H:i:s P', $failed_attempts['time']), $failed_attempts['count'], $failed_attempts['lockout'], $failed_attempts['url']); | |
| 109 | + $row = array($failed_attempts['ip'], sanitize_user($failed_attempts['username'], true), date('d/M/Y H:i:s P', $failed_attempts['time']), $failed_attempts['count'], $failed_attempts['lockout'], $failed_attempts['url']); | |
| 110 | 110 | fputcsv($file, $row); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
| @@ -214,5 +214,32 @@ | ||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | update_option('loginizer_softwp_upgrade', (0 - time()), false); |
| 217 | 217 | die('DONE'); |
| 218 | +} | |
| 219 | + | |
| 220 | +function loginizer_close_update_notice(){ | |
| 221 | + | |
| 222 | + if(!wp_verify_nonce($_GET['security'], 'loginizer_promo_nonce')){ | |
| 223 | + wp_send_json_error('Security Check failed!'); | |
| 224 | + } | |
| 225 | + | |
| 226 | + if(!current_user_can('manage_options')){ | |
| 227 | + wp_send_json_error('You don\'t have privilege to close this notice!'); | |
| 228 | + } | |
| 229 | + | |
| 230 | + $plugin_update_notice = get_option('softaculous_plugin_update_notice', []); | |
| 231 | + $available_update_list = get_site_transient('update_plugins'); | |
| 232 | + $to_update_plugins = apply_filters('softaculous_plugin_update_notice', []); | |
| 233 | + | |
| 234 | + if(empty($available_update_list) || empty($available_update_list->response)){ | |
| 235 | + return; | |
| 236 | + } | |
| 237 | + | |
| 238 | + foreach($to_update_plugins as $plugin_path => $plugin_name){ | |
| 239 | + if(isset($available_update_list->response[$plugin_path])){ | |
| 240 | + $plugin_update_notice[$plugin_path] = $available_update_list->response[$plugin_path]->new_version; | |
| 241 | + } | |
| 242 | + } | |
| 243 | + | |
| 244 | + update_option('softaculous_plugin_update_notice', $plugin_update_notice); | |
| 218 | 245 | } |