C:\xampp\htdocs\landing\wp-content\plugins\better-wp-security\core\modules\salts\validator.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php

class ITSEC_WordPress_Salts_Validator extends ITSEC_Validator {
    public function 
get_id() {
        return 
'wordpress-salts';
    }
    
    protected function 
sanitize_settings() {
        
$previous_settings ITSEC_Modules::get_settings$this->get_id() );
        
        if ( ! isset( 
$this->settings['last_generated'] ) ) {
            
$this->settings['last_generated'] = $previous_settings['last_generated'];
        }
        
        
$this->sanitize_setting'bool''regenerate'__'Change WordPress Salts''better-wp-security' ), false );
        
$this->sanitize_setting'positive-int''last_generated'__'Last Generated''better-wp-security' ), false );
        
        
$this->vars_to_skip_validate_matching_fields[] = 'regenerate';
    }
    
    protected function 
validate_settings() {
        if ( ! 
$this->can_save() ) {
            return;
        }
        
        if ( ! 
$this->settings['regenerate'] ) {
            unset( 
$this->settings['regenerate'] );
            
            if ( 
defined'DOING_AJAX' ) && DOING_AJAX && ! empty( $_POST['module'] ) && $this->get_id() === $_POST['module'] ) {
                
// Request to modify just this module.
                
                
$this->set_can_savefalse );
                
                if ( 
ITSEC_Modules::get_setting'global''write_files' ) ) {
                    
$this->add_error( new WP_Error'itsec-wordpress-salts-skipping-regeneration-empty-checkbox'__'You must check the Change WordPress Salts checkbox in order to change the WordPress salts.''better-wp-security' ) ) );
                } else {
                    
$this->add_error( new WP_Error'itsec-wordpress-salts-skipping-regeneration-write-files-disabled'__'The "Write to Files" setting is disabled in Global Settings. In order to use this feature, you must enable the "Write to Files" setting.''better-wp-security' ) ) );
                }
            }
            
            return;
        }
        
        
        unset( 
$this->settings['regenerate'] );
        
        require_once( 
dirname__FILE__ ) . '/utilities.php' );
        
        
$result ITSEC_WordPress_Salts_Utilities::generate_new_salts();
        
        if ( 
is_wp_error$result ) ) {
            
$this->add_error$result );
            
$this->set_can_savefalse );
        } else {
            
$this->add_message__'The WordPress salts were successfully regenerated.''better-wp-security' ) );
            
$this->settings['last_generated'] = ITSEC_Core::get_current_time_gmt();
            
            
ITSEC_Response::force_logout();
        }
    }
}

ITSEC_Modules::register_validator( new ITSEC_WordPress_Salts_Validator() );
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586