-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsysinfo.php
More file actions
executable file
·257 lines (195 loc) · 11.8 KB
/
sysinfo.php
File metadata and controls
executable file
·257 lines (195 loc) · 11.8 KB
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
<?php
/**
* Simple System Info
*
* @package Simple System Info
* @author Daniel J Griffiths
* @since 1.0.0
*/
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;
// We need to make sure plugin.php is loaded!
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if( !class_exists( 'Simple_System_Info' ) ) {
/**
* Main System Info class
*
* @author Daniel J Griffiths
* @since 1.0.0
*/
class Simple_System_Info {
/**
* Get system info
*
* Returns the system info for a WordPress instance
*
* @access public
* @author Daniel J Griffiths
* @since 1.0.0
* @global $wpdb
* @global object $wpdb Used to query the database
* @param bool $show_inactive Whether or not to show inactive plugins
* @param string $id The ID to assign to the returned textarea (Default: system-info-box)
* @param string $class The class to assign to the returned textarea (Default: none)
* @return string $return A string containing all system info
*/
public function get( $show_inactive = false, $id = 'system-info-box', $class = null ) {
global $wpdb;
if( !defined( 'SSINFO_VERSION' ) )
define( 'SSINFO_VERSION', '1.0.0' );
// We need the Browser class!
if( !class_exists( 'Browser' ) )
require_once 'browser.php';
$browser = new Browser();
// Get theme info for this WordPress version
if( get_bloginfo( 'version' ) < '3.4' ) {
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
$theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
} else {
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version;
}
$return = '<textarea readonly="readonly" onclick="this.focus(); this.select()" id="' . $id . '"' . ( $class != null ? ' class="' . $class . '"' : '' ) . ' title="To copy the system info, click below and press Ctrl+C (PC) or Cmd+C (Mac).">';
$return .= '### Begin System Info ###' . "\n\n";
do_action( 'simple_system_info_before' );
// Start with the basice...
$return .= '-- Site Info' . "\n\n";
$return .= 'Site URL: ' . site_url() . "\n";
$return .= 'Home URL: ' . home_url() . "\n";
$return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n";
if( has_filter( 'ssi_after_site_info' ) )
$return .= apply_filters( 'ssi_after_site_info', $return );
// The local users' browser information, handled by the Browser class
$return .= "\n" . '-- User Browser' . "\n\n";
$return .= $browser;
if( has_filter( 'ssi_after_user_browser' ) )
$return .= apply_filters( 'ssi_after_user_browser', $return );
// WordPress configuration
$return .= "\n" . '-- WordPress Configuration' . "\n\n";
$return .= 'Version: ' . get_bloginfo( 'version' ) . "\n";
$return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n";
$return .= 'Active Theme: ' . $theme . "\n";
$return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n";
// Only show page specs if frontpage is set to 'page'
if( get_option( 'show_on_front' ) == 'page' ) {
$front_page_id = get_option( 'page_on_front' );
$blog_page_id = get_option( 'page_for_posts' );
$return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n";
$return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n";
}
// Make sure wp_remote_post() is working
$request['cmd'] = '_notify-validate';
$params = array(
'sslverify' => false,
'timeout' => 60,
'user-agent' => 'SSInfo/' . SSINFO_VERSION,
'body' => $request
);
$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
if( !is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
$WP_REMOTE_POST = 'wp_remote_post() works';
} else {
$WP_REMOTE_POST = 'wp_remote_post() does not work';
}
$return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n";
$return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n";
$return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n";
$return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n";
if( has_filter( 'ssi_after_wordpress_config' ) )
$return .= apply_filters( 'ssi_after_wordpress_config', $return );
// WordPress active plugins
$return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
$plugins = get_plugins();
$active_plugins = get_option( 'active_plugins', array() );
foreach( $plugins as $plugin_path => $plugin ) {
if( !in_array( $plugin_path, $active_plugins ) )
continue;
//if( $plugin['Name'] !== 'Redux Framework' ) continue;
$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
if( has_filter( 'ssi_after_wordpress_plugins' ) )
$return .= apply_filters( 'ssi_after_wordpress_plugins', $return );
// WordPress inactive plugins
if( $show_inactive == true ) {
$return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n";
foreach( $plugins as $plugin_path => $plugin ) {
if( in_array( $plugin_path, $active_plugins ) )
continue;
$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
}
if( has_filter( 'ssi_after_wordpress_plugins_inactive' ) )
$return .= apply_filters( 'ssi_after_wordpress_plugins_inactive', $return );
// WordPress Multisite active plugins
if( is_multisite() ) {
$return .= "\n" . '-- Network Active Plugins' . "\n\n";
$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;
$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
if( has_filter( 'ssi_after_wordpress_ms_plugins' ) )
$return .= apply_filters( 'ssi_after_wordpress_ms_plugins', $return );
// WordPress Multisite inactive plugins
if( $show_inactive == true ) {
$return .= "\n" . '-- Network Inactive Plugins' . "\n\n";
foreach( $plugins as $plugin_path ) {
$plugin_base = plugin_basename( $plugin_path );
if( array_key_exists( $plugin_base, $active_plugins ) )
continue;
$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
}
}
if( has_filter( 'ssi_after_wordpress_ms_plugins_inactive' ) )
$return .= apply_filters( 'ssi_after_wordpress_ms_plugins_inactive', $return );
// Server configuration (really just versioning)
$return .= "\n" . '-- Webserver Configuration' . "\n\n";
$return .= 'PHP Version: ' . PHP_VERSION . "\n";
$return .= 'MySQL Version: ' . mysql_get_server_info() . "\n";
$return .= 'Webserver Info: ' . esc_html($_SERVER['SERVER_SOFTWARE']) . "\n";
if( has_filter( 'ssi_after_webserver_config' ) )
$return .= apply_filters( 'ssi_after_webserver_config', $return );
// PHP configs... now we're getting to the important stuff
$return .= "\n" . '-- PHP Configuration' . "\n\n";
$return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Yes' : 'No' ) . "\n";
$return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n";
$return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n";
$return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n";
$return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n";
$return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n";
$return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n";
$return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n";
if( has_filter( 'ssi_after_php_config' ) )
$return .= apply_filters( 'ssi_after_php_config', $return );
// PHP extensions and such
$return .= "\n" . '-- PHP Extensions' . "\n\n";
$return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n";
$return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n";
$return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n";
$return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n";
if( has_filter( 'ssi_after_php_ext' ) )
$return .= apply_filters( 'ssi_after_php_ext', $return );
// Session stuff
$return .= "\n" . '-- Session Configuration' . "\n\n";
$return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n";
// The rest of this is only relevant is session is enabled
if( isset( $_SESSION ) ) {
$return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n";
$return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n";
$return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n";
$return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n";
$return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n";
}
if( has_filter( 'ssi_after_session_config' ) )
$return .= apply_filters( 'ssi_after_session_config', $return );
do_action( 'ssi_after' );
$return .= "\n" . '### End System Info ###';
$return .= '</textarea>';
return $return;
}
}
}