C:\xampp\htdocs\landing\wp-content\plugins\better-wp-security\core\modules\privacy\util.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?php

final class ITSEC_Privacy_Util {
    public static function 
get_privacy_policy_content() {
        
ITSEC_Modules::load_module_file'privacy.php'':active' );


        
$sections = array(
            
'collection'        => array(
                
'heading'     => __'What personal data we collect and why we collect it' ),
                
'subheadings' => array(
                    
'comments'      => __'Comments' ),
                    
'media'         => __'Media' ),
                    
'contact_forms' => __'Contact Forms' ),
                    
'cookies'       => __'Cookies' ),
                    
'embeds'        => __'Embedded content from other websites' ),
                    
'analytics'     => __'Analytics' ),
                    
'security_logs' => __'Security Logs' ),
                ),
            ),
            
'sharing'           => __'Who we share your data with' ),
            
'retention'         => __'How long we retain your data' ),
            
'rights'            => __'What rights you have over your data' ),
            
'sending'           => __'Where we send your data' ),
            
'additional'        => __'Additional information' ),
            
'protection'        => __'How we protect your data' ),
            
'breach_procedures' => __'What data breach procedures we have in place' ),
            
'third_parties'     => __'What third parties we receive data from' ),
            
'profiling'         => __'What automated decision making and/or profiling we do with user data' ),
        );

        
$sections apply_filters'itsec_get_privacy_policy_sections'$sections );


        
$policy '';

        foreach ( 
$sections as $section => $details ) {
            
$section_text apply_filters"itsec_get_privacy_policy_for_$section"'' );

            if ( 
is_string$details ) ) {
                
$section_heading $details;
            } else {
                
$section_heading $details['heading'];

                foreach ( 
$details['subheadings'] as $id => $heading ) {
                    
$text apply_filters"itsec_get_privacy_policy_for_$id"'' );

                    if ( ! empty( 
$text ) ) {
                        
$section_text .= "<h3>$heading</h3>\n$text\n";
                    }
                }
            }

            if ( ! empty( 
$section_text ) ) {
                
$policy .= "<h2>$section_heading</h2>\n$section_text\n";
            }
        }

        if ( ! empty( 
$policy ) ) {
            
$policy "<div class=\"wp-suggested-text\">\n$policy\n</div>\n";
        }

        return 
$policy;
    }

    public static function 
export$email$page ) {
        global 
$wpdb;

        
$limit 500;
        
$offset = ( $page ) * $limit;

        
$user get_user_by'email'$email );
        
$user_id false === $user false $user->ID;
        
$escaped_email '%%' $wpdb->esc_like$email ) . '%%';

        if ( 
false === $user ) {
            
$query "SELECT id, module, code, type, timestamp, user_id, url FROM {$wpdb->base_prefix}itsec_logs WHERE data LIKE %s OR url LIKE %s LIMIT $offset,$limit";
            
$query $wpdb->prepare$query$escaped_email$escaped_email );
        } else {
            
$query "SELECT id, module, code, type, timestamp, user_id, url FROM {$wpdb->base_prefix}itsec_logs WHERE data LIKE %s OR url LIKE %s OR user_id=%d LIMIT $offset,$limit";
            
$query $wpdb->prepare$query$escaped_email$escaped_email$user_id );
        }

        
$logs $wpdb->get_results$queryARRAY_A );
        
$export_items = array();

        foreach ( (array) 
$logs as $log ) {
            
$group_id 'security-logs';
            
$group_label __'Security Logs''better-wp-security' );
            
$item_id "security-log-{$log['id']}";

            
$data self::get_data_from_log_entry$log$email$user_id );

            
$export_items[] = compact'group_id''group_label''item_id''data' );
        }


        
$done count$logs ) < $limit;

        return array(
            
'data' => $export_items,
            
'done' => $done,
        );
    }

    public static function 
erase$email$page ) {
        global 
$wpdb;

        
$limit 500;
        
$offset = ( $page ) * $limit;

        
$user get_user_by'email'$email );
        
$user_id false === $user false $user->ID;
        
$escaped_email '%%' $wpdb->esc_like$email ) . '%%';

        if ( 
false === $user ) {
            
$query "SELECT COUNT(id) AS count FROM {$wpdb->base_prefix}itsec_logs WHERE data LIKE %s OR url LIKE %s LIMIT $offset,$limit";
            
$query $wpdb->prepare$query$escaped_email$escaped_email );
        } else {
            
$query "SELECT COUNT(id) AS count FROM {$wpdb->base_prefix}itsec_logs WHERE data LIKE %s OR url LIKE %s OR user_id=%d LIMIT $offset,$limit";
            
$query $wpdb->prepare$query$escaped_email$escaped_email$user_id );
        }

        
$count = (int) $wpdb->get_var$query );
        
$done $count $limit;

        return array(
            
'items_removed'  => false,
            
'items_retained' => true,
            
'messages'       => array(
                
__'The security logs are retained since they may be required as part of analysis of a site compromise.''better-wp-security' ),
            ),
            
'done'           => $done,
        );
    }

    private static function 
get_data_from_log_entry$log$email$user_id ) {
        
$data = array(
            array(
                
'name'  => __'Timestamp''better-wp-security' ),
                
'value' => $log['timestamp'],
            ),
        );

        if ( 
false === strpos$log['code'], '::' ) ) {
            
$code $log['code'];
        } else {
            list( 
$code$junk ) = explode'::'$log['code'], );
        }

        if ( 
'lockout' === $log['module'] ) {
            
$event __'Failed login''better-wp-security' );
        } else if ( 
'four_oh_four' === $log['module'] ) {
            
$event __'Requested suspicious URL''better-wp-security' );
        } else if ( 
'ipcheck' === $log['module'] ) {
            
$event __'Failed check by network brute force protection''better-wp-security' );
        } else if ( 
'brute_force' === $log['module'] ) {
            if ( 
'auto-ban-admin-username' === $code ) {
                
$event __'Attempted to log in as admin''better-wp-security' );
            } else {
                
$event __'Failed login''better-wp-security' );
            }
        } else if ( 
'away_mode' === $log['module'] ) {
            
$event __'Access while site in away mode''better-wp-security' );
        } else if ( 
'recaptcha' === $log['module'] ) {
            
$event __'Failed reCAPTCHA validation''better-wp-security' );
        } else if ( 
'two_factor' === $log['module'] ) {
            if ( 
'failed_authentication' === $code ) {
                
$event __'Failed two-factor authentication validation''better-wp-security' );
            } else if ( 
'successful_authentication' === $code ) {
                
$event __'Two-factor authentication validated successfully''better-wp-security' );
            } else if ( 
'sync_override' === $code ) {
                
$event __'Overrode two-factor authentication using iThemes Sync''better-wp-security' );
            }
        } else if ( 
'user_logging' === $log['module'] ) {
            if ( 
'post-status-changed' === $code ) {
                
$event __'Changed content''better-wp-security' );
            } else if ( 
'user-logged-in' === $code ) {
                
$event __'Logged in''better-wp-security' );
            } else if ( 
'user-logged-out' === $code ) {
                
$event __'Logged out''better-wp-security' );
            }
        }

        if ( empty( 
$event ) ) {
            
$event __'Unknown event or action''better-wp-security' );
        }

        
$data[] = array(
            
'name'  => __'Event''better-wp-security' ),
            
'value' => $event,
        );

        return 
$data;
    }
}
x

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