C:\xampp\htdocs\landing\wp-content\plugins\better-wp-security\core\admin-pages\page-debug.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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
<?php

final class ITSEC_Debug_Page {

    
/** @var string */
    
private $self_url;

    public function 
__construct() {
        
add_action'itsec-page-show', array( $this'handle_page_load' ) );
        
add_action'itsec-page-ajax', array( $this'handle_ajax_request' ) );
        
add_action'admin_print_scripts', array( $this'add_scripts' ) );
        
add_action'admin_print_styles', array( $this'add_styles' ) );

        
ITSEC_Modules::load_module_file'debug.php'':active' );
    }

    public function 
handle_page_load$self_url ) {
        
$this->self_url $self_url;

        
$this->show_settings_page();
    }

    public function 
add_scripts() {

        
$deps = array( 'itsec-util' );

        if ( 
function_exists'wp_enqueue_code_editor' ) ) {
            
$deps[] = 'code-editor';
            
wp_enqueue_code_editor( array(
                
'type' => 'application/json'
            
) );
        }

        
ITSEC_Lib::enqueue_util( array( 'action' => 'itsec_debug_page''nonce' => 'itsec-debug-page' ) );
        
wp_enqueue_script'itsec-debug'plugins_url'js/debug.js'__FILE__ ), $depsITSEC_Core::get_plugin_build() );

        
do_action'itsec_debug_page_enqueue' );
    }

    public function 
add_styles() {
        
wp_enqueue_style'itsec-debug-page-style'plugins_url'css/style.css'__FILE__ ), array(), ITSEC_Core::get_plugin_build() );
    }

    public function 
handle_ajax_request() {
        if ( 
WP_DEBUG ) {
            
ini_set'display_errors');
        }

        
ITSEC_Core::set_interactivetrue );

        
$method = ( isset( $_POST['method'] ) && is_string$_POST['method'] ) ) ? $_POST['method'] : '';
        
$module = ( isset( $_POST['module'] ) && is_string$_POST['module'] ) ) ? $_POST['module'] : '';

        if ( empty( 
$GLOBALS['hook_suffix'] ) ) {
            
$GLOBALS['hook_suffix'] = 'security_page_itsec-debug';
        }

        if ( 
false === check_ajax_referer'itsec-debug-page''nonce'false ) ) {
            
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-failed-nonce'__'A nonce security check failed, preventing the request from completing as expected. Please try reloading the page and trying again.''better-wp-security' ) ) );
        } elseif ( ! 
ITSEC_Core::current_user_can_manage() ) {
            
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-insufficient-privileges'__'A permissions security check failed, preventing the request from completing as expected. The currently logged in user does not have sufficient permissions to make this request. Please try reloading the page and trying again.''better-wp-security' ) ) );
        } elseif ( empty( 
$method ) ) {
            
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-missing-method'__'The server did not receive a valid request. The required "method" argument is missing. Please try again.''better-wp-security' ) ) );
        } elseif ( 
'handle_module_request' === $method && empty( $module ) ) {
            
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-missing-module'__'The server did not receive a valid request. The required "module" argument is missing. Please try again.''better-wp-security' ) ) );
        } elseif ( 
'handle_module_request' === $method ) {
            if ( isset( 
$_POST['data'] ) ) {
                
ITSEC_Modules::load_module_file'debug.php'':active' );
                
/**
                 * Fires when an ajax request is being made to a module.
                 *
                 * At some point this will probably be replaced by a more thought-out framework, but this hook will probably power it.
                 *
                 * The dynamic portion of this hook, {$module}, refers to the module name. For example, 'notification-center'.
                 *
                 * @param array $data
                 */
                
do_action"itsec_debug_module_request_{$module}"$_POST['data'] );
            } else {
                
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-module-request-missing-data'__'The server did not receive a valid request. The required "data" argument for the module is missing. Please try again.''better-wp-security' ) ) );
            }
        } elseif ( 
'reset_scheduler' === $method ) {
            
ITSEC_Core::get_scheduler()->reset();
            
ITSEC_Response::set_response$this->get_events_table() );
            
ITSEC_Response::set_successtrue );
            
ITSEC_Response::add_message__'Scheduler reset.''better-wp-security' ) );
        } elseif ( 
'run_event' === $method ) {
            if ( empty( 
$_POST['data']['id'] ) ) {
                
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-run-event-missing-id'__'The server did not receive a valid request. The required "data.id" argument for the "run_event" method is missing.''better-wp-security' ) ) );
            } elseif ( ! empty( 
$_POST['data']['data'] ) ) {
                
$hash $_POST['data']['data'];

                if ( ! 
is_string$hash ) ) {
                    
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-run-event-invalid-data'__'The server did not receive a valid request. The "data.data" argument for the "run_event" method is an invalid string.''better-wp-security' ) ) );
                } else {
                    
ITSEC_Core::get_scheduler()->run_single_event_by_hash$_POST['data']['id'], $hash );
                    
ITSEC_Response::set_response$this->get_events_table() );
                    
ITSEC_Response::set_successtrue );
                    
ITSEC_Response::add_message__'Event successfully run.''better-wp-security' ) );
                }
            } else {
                
ITSEC_Core::get_scheduler()->run_recurring_event$_POST['data']['id'] );
                
ITSEC_Response::set_response$this->get_events_table() );
                
ITSEC_Response::set_successtrue );
                
ITSEC_Response::add_message__'Event successfully run.''better-wp-security' ) );
            }
        } elseif ( 
'load_settings' === $method ) {
            
ITSEC_Response::set_responseITSEC_Modules::get_settings$module ) );
        } elseif ( 
'save_settings' === $method ) {
            
$data json_decodewp_unslash$_POST['data'] ), true );

            if ( ! 
is_array$data ) ) {
                
ITSEC_Response::set_successfalse );
                
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-run-event-invalid-data'__'The server did not receive a valid request. The "data" argument for the "save_settings" method is invalid.''better-wp-security' ) ) );
            } else {
                
$result ITSEC_Modules::set_settings$module$data );

                if ( 
is_wp_error$result ) ) {
                    
ITSEC_Response::set_successfalse );
                    
ITSEC_Response::add_error$result );
                } else {
                    
ITSEC_Response::set_responseITSEC_Modules::get_settings$module ) );

                    if ( 
$result['saved'] ) {
                        
ITSEC_Response::add_messageesc_html__'Module settings updated.''better-wp-security' ) );
                    }
                }
            }
        } else {
            
ITSEC_Response::add_error( new WP_Error'itsec-debug-page-unknown-method'__'The server did not receive a valid request. An unknown "method" argument was supplied. Please try again.''better-wp-security' ) ) );
        }

        
ITSEC_Response::send_json();
    }

    private function 
show_settings_page() {

        
$sysinfo $this->get_sysinfo();

        
$out '';

        foreach ( 
$sysinfo as $category => $info ) {
            if ( 
$out ) {
                
$out .= "\r\n";
            }

            
$out .= "### {$category} ###\r\n";

            foreach ( 
$info as $label => $value ) {
                
$out .= "{$label}{$value}\r\n";
            }
        }

        
$out rtrim$out );

        
$scheduler ITSEC_Core::get_scheduler();

        
$modules = array();

        foreach ( 
ITSEC_Modules::get_available_modules() as $module ) {
            if ( 
ITSEC_Modules::get_settings_obj$module ) ) {
                
$modules$module ] = $module;
            }
        }

        
sort$modules );
        
?>
        <div class="wrap">
            <h1>
                <?php _e'iThemes Security''better-wp-security' ); ?>
                <a href="<?php echo esc_urlITSEC_Core::get_settings_page_url() ); ?>" class="page-title-action"><?php _e'Manage Settings''better-wp-security' ); ?></a>
                <a href="<?php echo esc_urlapply_filters'itsec_support_url''https://wordpress.org/support/plugin/better-wp-security' ) ); ?>" class="page-title-action">
                    <?php _e'Support''better-wp-security' ); ?>
                </a>
            </h1>

            <div id="itsec-messages"></div>

            <div>
                <h2><?php esc_html_e'System Info''better-wp-security' ); ?></h2>
                <label for="itsec-system-info"><?php esc_html__'System Info Summary''better-wp-security' ); ?></label>
                <textarea readonly id="itsec-system-info"><?php echo esc_textarea$out ); ?></textarea>
            </div>

            <div>
                <h2><?php esc_html_e'Settings''better-wp-security' ); ?></h2>
                <p>
                    <label for="itsec-settings-module" class="screen-reader-text"><?php esc_html_e'Module''better-wp-security' ); ?></label>
                    <select id="itsec-settings-module">
                        <?php foreach ( $modules as $module ) : ?>
                            <option value="<?php echo esc_attr$module ); ?>"><?php echo esc_html$module ); ?></option>
                        <?php endforeach; ?>
                    </select>
                    <button class="button" id="itsec-settings-load"><?php esc_html_e'Load''better-wp-security' ); ?></button>
                    <button class="button" id="itsec-settings-save" disabled><?php esc_html_e'Save''better-wp-security' ?></button>
                </p>
                <label for="itsec-settings-editor" class="screen-reader-text"><?php esc_html_e'Edit Settings''better-wp-security' ); ?></label>
                <textarea id="itsec-settings-editor"></textarea>
            </div>

            <div id="itsec-scheduler-events">
                <h2><?php esc_html_e'Scheduler''better-wp-security' ); ?></h2>
                <?php echo $this->get_events_table(); ?>
                <p style="text-align: right;">
                    <code><?php echo get_class$scheduler ); ?></code>
                    <button class="button" id="itsec-scheduler-reset"><?php esc_html_e'Reset''better-wp-security' ?></button>
                </p>
            </div>

            <?php do_action'itsec_debug_page' ); ?>
        </div>
        <?php
    
}

    private function 
get_events_table() {
        
$scheduler ITSEC_Core::get_scheduler();
        
ob_start();

        
?>

        <table class="widefat striped">
            <thead>
            <tr>
                <th><?php esc_html_e'ID''better-wp-security' ?></th>
                <th><?php esc_html_e'Fire At''better-wp-security' ?></th>
                <th><?php esc_html_e'Schedule''better-wp-security' ?></th>
                <th>
                    <button class="button-link" id="itsec-events-data-toggle"><?php esc_html_e'Data''better-wp-security' ?></button>
                </th>
                <th></th>
            </tr>
            </thead>
            <tbody>
            <?php foreach ( array_merge$scheduler->get_recurring_events(), $scheduler->get_single_events() ) as $event ) : ?>
                <tr>
                    <td><?php echo esc_html$event['id'] ); ?></td>
                    <td><?php echo date'Y-m-d H:i:s'$event['fire_at'] ); ?> (<?php echo esc_htmlhuman_time_diff$event['fire_at'] ) ) ?>)</td>
                    <td><?php echo isset( $event['schedule'] ) ? $event['schedule'] : '–'?></td>
                    <td>
                        <div class="hidden itsec-events-data"><?php $event['data'] ? ITSEC_Lib::print_r$event['data'] ) : print( '–' ); ?></div>
                    </td>
                    <td>
                        <button class="button" data-id="<?php echo esc_attr$event['id'] ); ?>"
                                data-data="<?php echo isset( $event['schedule'] ) ? '' esc_attr$event['hash'] ); ?>">
                            <?php esc_html_e'Run''better-wp-security' ?>
                        </button>
                    </td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>

        <?php

        
return ob_get_clean();
    }

    private function 
get_sysinfo() {

        
/** @var $wpdb wpdb */
        
global $wpdb;

        
$info = array();

        
$info['Site Info'] = array(
            
'Site URL'  => site_url(),
            
'Home URL'  => home_url(),
            
'Multisite' => is_multisite() ? 'Yes' 'No'
        
);

        
$wp_config = array(
            
'Version'       => get_bloginfo'version' ),
            
'Language'      => defined'WPLANG' ) && WPLANG WPLANG 'en_US',
            
'Permalink'     => get_option'permalink_structure' ) ?: 'Default',
            
'Theme'         => wp_get_theme()->Name ' ' wp_get_theme()->Version,
            
'Show on Front' => get_option'show_on_front' )
        );

        if ( 
get_option'show_on_front' ) === 'page' ) {
            
$front_page_id get_option'page_on_front' );
            
$blog_page_id  get_option'page_for_posts' );

            
$wp_config['Page On Front']  = $front_page_id get_the_title$front_page_id ) . " (#$front_page_id)" 'Unset';
            
$wp_config['Page For Posts'] = $blog_page_id get_the_title$blog_page_id ) . " (#$blog_page_id)" 'Unset';
        }

        
$wp_config['ABSPATH']            = ABSPATH;
        
$wp_config['Table Prefix']       = 'Length: ' strlen$wpdb->prefix ) . ' Status: ' . ( strlen$wpdb->prefix ) > 16 'Too long' 'Acceptable' );
        
$wp_config['WP_DEBUG']           = defined'WP_DEBUG' ) ? ( WP_DEBUG 'Enabled' 'Disabled' ) : 'Not set';
        
$wp_config['WP_DEBUG_LOG']       = defined'WP_DEBUG_LOG' ) ? ( WP_DEBUG_LOG 'Enabled' 'Disabled' ) : 'Not set';
        
$wp_config['SCRIPT_DEBUG']       = defined'SCRIPT_DEBUG' ) ? ( SCRIPT_DEBUG 'Enabled' 'Disabled' ) : 'Not set';
        
$wp_config['Object Cache']       = wp_using_ext_object_cache() ? 'Yes' 'No';
        
$wp_config['Memory Limit']       = WP_MEMORY_LIMIT;
        
$info['WordPress Configuration'] = $wp_config;

        
$defines = array(
            
'ITSEC_USE_CRON',
            
'ITSEC_DISABLE_PASSWORD_REQUIREMENTS',
            
'ITSEC_DEVELOPMENT',
            
'ITSEC_DISABLE_MODULES',
            
'ITSEC_DISABLE_TWO_FACTOR',
            
'ITSEC_DISABLE_CRON_TEST',
            
'ITSEC_SERVER_OVERRIDE',
            
'ITSEC_DOING_FILE_CHECK',
            
'ITSEC_TEST_MALWARE_SCAN_SKIP_CACHE',
            
'ITSEC_TEST_MALWARE_SCAN_SITE_URL',
            
'ITSEC_TEST_MALWARE_SCAN_DISABLE_SSL_VERIFY',
            
'ITSEC_SUCURI_KEY',
            
'ITSEC_NOTIFY_USE_CRON',
            
'ITSEC_DISABLE_SECURITY_CHECK_PRO',
            
'ITSEC_DISABLE_AUTOMATIC_REMOTE_IP_DETECTION',
            
'ITSEC_DISABLE_PASSWORD_STRENGTH',
            
'ITSEC_DISABLE_INACTIVE_USER_CHECK',
            
'ITSEC_SHOW_FEATURE_FLAGS',
        );

        
ITSEC_Lib::load'feature-flags' );

        
$info['iThemes Security'] = array(
            
'Build'       => ITSEC_Core::get_plugin_build(),
            
'Pro'         => ITSEC_Core::is_pro(),
            
'Modules'     => wp_sprintf'%l'ITSEC_Modules::get_active_modules() ),
            
'Cron'        => ITSEC_Lib::use_cron(),
            
'Cron Status' => ITSEC_Lib::is_cron_working(),
            
'Scheduler'   => get_classITSEC_Core::get_scheduler() ),
            
'Features'    => wp_sprintf'%l'ITSEC_Lib_Feature_Flags::get_enabled() ),
        );

        foreach ( 
$defines as $define ) {
            if ( 
defined$define ) ) {
                
$value constant$define );

                if ( 
true === $value ) {
                    
$value 'Enabled';
                } elseif ( 
false === $value ) {
                    
$value 'Disabled';
                }

                
$info['iThemes Security'][ $define ] = $value;
            }
        }

        
$plugins        get_plugins();
        
$active_plugins get_option'active_plugins', array() );

        foreach ( 
$plugins as $plugin_path => $plugin ) {

            if ( ! 
in_array$plugin_path$active_pluginstrue ) ) {
                continue;
            }

            
$info['Active Plugins'][ $plugin['Name'] ] = $plugin['Version'];
        }

        foreach ( 
get_mu_plugins() as $plugin ) {
            
$info['MU Plugins'][ $plugin['Name'] ] = $plugin['Version'];
        }

        if ( 
is_multisite() ) {
            
$plugins        wp_get_active_network_plugins();
            
$active_plugins get_site_option'active_sitewide_plugins', array() );

            foreach ( 
$plugins as $plugin_path ) {

                
$plugin_base plugin_basename$plugin_path );

                if ( ! 
array_key_exists$plugin_base$active_plugins ) ) {
                    continue;
                }

                
$plugin get_plugin_data$plugin_path );

                
$info['Network Active Plugins'][ $plugin['Name'] ] = $plugin['Version'];
            }
        }

        
$info['Webserver Configuration'] = array(
            
'PHP Version'    => PHP_VERSION,
            
'MySQL Version'  => $wpdb->db_version(),
            
'Use MySQLi'     => $wpdb->use_mysqli 'Yes' 'No',
            
'Webserver Info' => ITSEC_Lib::get_server(),
            
'Host'           => $this->get_host(),
        );

        
$info['PHP Configuration'] = array(
            
'Safe Mode'           => ini_get'safe_mode' ) ? 'Enabled' 'Disabled',
            
'Memory Limit'        => ini_get'memory_limit' ),
            
'Upload Max Size'     => ini_get'upload_max_filesize' ),
            
'Post Max Size'       => ini_get'post_max_size' ),
            
'Upload Max Filesize' => ini_get'upload_max_filesize' ),
            
'Time Limit'          => ini_get'max_execution_time' ),
            
'Max Input Vars'      => ini_get'max_input_vars' ),
            
'Display Errors'      => ini_get'display_errors' ) ? 'On (' ini_get'display_errors' ) . ')' 'N/A'
        
);

        
$info['PHP Extensions'] = array(
            
'cURL'        => function_exists'curl_init' ) ? 'Supported' 'Not Supported',
            
'fsockopen'   => function_exists'fsockopen' ) ? 'Supported' 'Not Supported',
            
'SOAP Client' => class_exists'SoapClient' ) ? 'Installed' 'Not Installed',
            
'Suhosin'     => extension_loaded'suhosin' ) ? 'Installed' 'Not Installed'
        
);

        return 
$info;
    }

    private function 
get_host() {

        if ( 
defined'WPE_APIKEY' ) ) {
            
$host 'WP Engine';
        } elseif ( 
defined'PAGELYBIN' ) ) {
            
$host 'Pagely';
        } elseif ( 
DB_HOST === 'localhost:/tmp/mysql5.sock' ) {
            
$host 'ICDSoft';
        } elseif ( 
DB_HOST === 'mysqlv5' ) {
            
$host 'NetworkSolutions';
        } elseif ( 
strposDB_HOST'ipagemysql.com' ) !== false ) {
            
$host 'iPage';
        } elseif ( 
strposDB_HOST'ipowermysql.com' ) !== false ) {
            
$host 'IPower';
        } elseif ( 
strposDB_HOST'.gridserver.com' ) !== false ) {
            
$host 'MediaTemple Grid';
        } elseif ( 
strposDB_HOST'.pair.com' ) !== false ) {
            
$host 'pair Networks';
        } elseif ( 
strposDB_HOST'.stabletransit.com' ) !== false ) {
            
$host 'Rackspace Cloud';
        } elseif ( 
strposDB_HOST'.sysfix.eu' ) !== false ) {
            
$host 'SysFix.eu Power Hosting';
        } elseif ( isset( 
$_SERVER['SERVER_NAME'] ) && strpos$_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
            
$host 'Flywheel';
        } else {
            
// Adding a general fallback for data gathering
            
$host 'DBH/' DB_HOST ', SRV/' . ( isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : '' );
        }

        return 
$host;
    }
}

new 
ITSEC_Debug_Page();
x

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