C:\xampp\htdocs\landing\wp-content\plugins\better-wp-security\core\modules\system-tweaks\setup.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php

if ( ! class_exists'ITSEC_System_Tweaks_Setup' ) ) {

    class 
ITSEC_System_Tweaks_Setup {

        private
            
$defaults;

        public function 
__construct() {

            
add_action'itsec_modules_do_plugin_activation',   array( $this'execute_activate'   )          );
            
add_action'itsec_modules_do_plugin_deactivation', array( $this'execute_deactivate' )          );
            
add_action'itsec_modules_do_plugin_uninstall',    array( $this'execute_uninstall'  )          );
            
add_action'itsec_modules_do_plugin_upgrade',      array( $this'execute_upgrade'    ), null);

        }

        
/**
         * Execute module activation.
         *
         * @since 4.0
         *
         * @return void
         */
        
public function execute_activate() {
        }

        
/**
         * Execute module deactivation
         *
         * @return void
         */
        
public function execute_deactivate() {

            
//Reset recommended file permissions
            
@chmodITSEC_Lib::get_htaccess(), 0644 );
            @
chmodITSEC_Lib::get_config(), 0644 );

        }

        
/**
         * Execute module uninstall
         *
         * @return void
         */
        
public function execute_uninstall() {

            
$this->execute_deactivate();

            
delete_site_option'itsec_tweaks' );

        }

        
/**
         * Execute module upgrade
         *
         * @since 4.0
         *
         * @return void
         */
        
public function execute_upgrade$itsec_old_version ) {

            if ( 
$itsec_old_version 4000 ) {

                global 
$itsec_bwps_options;

                
ITSEC_Lib::create_database_tables();

                
$current_options get_site_option'itsec_tweaks' );

                
// Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
                
if ( false !== $current_options ) {

                    
$current_options['protect_files']            = isset( $itsec_bwps_options['st_ht_files'] ) && $itsec_bwps_options['st_ht_files'] == true false;
                    
$current_options['directory_browsing']       = isset( $itsec_bwps_options['st_ht_browsing'] ) && $itsec_bwps_options['st_ht_browsing'] == true false;
                    
$current_options['request_methods']          = isset( $itsec_bwps_options['st_ht_request'] ) && $itsec_bwps_options['st_ht_request'] == true false;
                    
$current_options['suspicious_query_strings'] = isset( $itsec_bwps_options['st_ht_query'] ) && $itsec_bwps_options['st_ht_query'] == true false;
                    
$current_options['non_english_characters']   = isset( $itsec_bwps_options['st_ht_foreign'] ) && $itsec_bwps_options['st_ht_foreign'] == true false;
                    
$current_options['long_url_strings']         = isset( $itsec_bwps_options['st_longurl'] ) && $itsec_bwps_options['st_longurl'] == true false;
                    
$current_options['write_permissions']        = isset( $itsec_bwps_options['st_fileperm'] ) && $itsec_bwps_options['st_fileperm'] == true false;

                    
update_site_option'itsec_tweaks'$current_options );
                    
ITSEC_Response::regenerate_wp_config();
                }

            }

            if ( 
$itsec_old_version 4041 ) {
                
$current_options get_site_option'itsec_tweaks' );

                
// If there are no current options, go with the new defaults by not saving anything
                
if ( is_array$current_options ) ) {
                    
$new_module_settings ITSEC_Modules::get_settings'system-tweaks' );

                    
// Reduce to only settings in new module
                    
$current_options array_intersect_key$current_options$new_module_settings );

                    
// Use new module settings as defaults for any missing settings
                    
$current_options array_merge$new_module_settings$current_options );

                    
// If anything in this module is being used activate it, otherwise deactivate it
                    
$activate false;
                    foreach ( 
$current_options as $on ) {
                        if ( 
$on ) {
                            
$activate true;
                            break;
                        }
                    }
                    if ( 
$activate ) {
                        
ITSEC_Modules::activate'system-tweaks' );
                    } else {
                        
ITSEC_Modules::deactivate'system-tweaks' );
                    }

                    
ITSEC_Modules::set_settings'system-tweaks'$current_options );
                }
            }

            if ( 
$itsec_old_version 4095 ) {
                
ITSEC_Response::regenerate_server_config();
            }
        }

    }

}

new 
ITSEC_System_Tweaks_Setup();
x

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