| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
class FV_Player_System_Info { |
| 8 |
|
| 9 |
public function __construct() { |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
add_action( 'admin_init', array($this, 'admin__add_meta_boxes') ); |
| 16 |
add_action('admin_init', array( $this, 'export' ) ); |
| 17 |
} |
| 18 |
|
| 19 |
public function admin__add_meta_boxes() { |
| 20 |
add_meta_box('fv_flowplayer_system_information', __( 'System Info', 'fv-player' ), array($this, 'settings_box'), 'fv_flowplayer_settings_tools', 'normal'); |
| 21 |
} |
| 22 |
|
| 23 |
public function export() { |
| 24 |
if( current_user_can('install_plugins') && isset($_GET['action']) && sanitize_key( $_GET['action'] ) == 'fv-player-system-info' && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'fv-player-system-info' ) ) { |
| 25 |
ob_start(); |
| 26 |
$this->settings_box(); |
| 27 |
$html = ob_get_clean(); |
| 28 |
if( preg_match( '~<textarea.*?>([\s\S]*?)</textarea>~', $html, $match ) ) { |
| 29 |
header("Content-type: text/csv"); |
| 30 |
header("Content-Disposition: attachment; filename=".sanitize_title( get_bloginfo('name').' FV Player debug info.txt' ) ); |
| 31 |
header("Pragma: no-cache"); |
| 32 |
header("Expires: 0"); |
| 33 |
echo esc_html( $match[1] ); |
| 34 |
die(); |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
public function settings_box () { |
| 40 |
global $wpdb, $fv_wp_flowplayer_ver, $fv_wp_flowplayer_core_ver, $FV_Player_Pro, $FV_Player_VAST, $FV_Player_PayPerView; |
| 41 |
|
| 42 |
$theme_data = wp_get_theme(); |
| 43 |
$theme = $theme_data->Name . ' ' . $theme_data->Version; |
| 44 |
|
| 45 |
// Try to identifty the hosting provider |
| 46 |
$host = false; |
| 47 |
if( defined( 'WPE_APIKEY' ) ) { |
| 48 |
$host = 'WP Engine'; |
| 49 |
} elseif( defined( 'PAGELYBIN' ) ) { |
| 50 |
$host = 'Pagely'; |
| 51 |
} |
| 52 |
?> |
| 53 |
<textarea readonly="readonly" rows="10" id="fv-player-system-info-textarea"> |
| 54 |
### Begin System Info ### |
| 55 |
|
| 56 |
## Please include this information when posting support requests ## |
| 57 |
|
| 58 |
Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> |
| 59 |
|
| 60 |
SITE_URL: <?php echo site_url() . "\n"; ?> |
| 61 |
HOME_URL: <?php echo home_url() . "\n"; ?> |
| 62 |
Plugin URL: <?php echo flowplayer::get_plugin_url() . "\n"; ?> |
| 63 |
|
| 64 |
FV Player version: <?php echo esc_attr( $fv_wp_flowplayer_ver ) . "\n"; ?> |
| 65 |
FV Player core version: <?php echo esc_attr( $fv_wp_flowplayer_core_ver ) . "\n"; ?> |
| 66 |
|
| 67 |
<?php if( isset($FV_Player_Pro) ) : ?> |
| 68 |
FV Player Pro version: <?php if( isset($FV_Player_Pro->version) ) echo esc_attr( $FV_Player_Pro->version ) . "\n"; ?> |
| 69 |
FV Player Pro license: <?php $license = get_transient('fv-player-pro_license'); if( $license && isset($license->valid) && $license->valid ) echo "Valid (next check ".gmdate("Y-m-d H:i:s",get_option('_transient_timeout_fv-player-pro_license'))." GMT)\n"; ?> |
| 70 |
<?php endif; ?> |
| 71 |
<?php if( isset($FV_Player_VAST) ) : ?> |
| 72 |
FV Player VAST version: <?php if( isset($FV_Player_VAST->version) ) echo esc_attr( $FV_Player_VAST->version ) . "\n"; ?> |
| 73 |
FV Player VAST license: <?php $license = get_transient('fv-player-vast_license'); if( $license && isset($license->valid) && $license->valid ) echo "Valid (next check ".gmdate("Y-m-d H:i:s",get_option('_transient_timeout_fv-player-vast_license'))." GMT)\n"; ?> |
| 74 |
<?php endif; ?> |
| 75 |
<?php if( isset($FV_Player_PayPerView) ) : ?> |
| 76 |
FV Player PPV version: <?php if( isset($FV_Player_PayPerView->version) ) echo esc_attr( $FV_Player_PayPerView->version ) . "\n"; ?> |
| 77 |
FV Player PPV license: <?php $license = get_transient('fv-player-pay-per-view_license'); if( $license && isset($license->valid) && $license->valid ) echo "Valid (next check ".gmdate("Y-m-d H:i:s",get_option('_transient_timeout_fv-player-pay-per-view_license'))." GMT)\n"; ?> |
| 78 |
<?php endif; ?> |
| 79 |
|
| 80 |
WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> |
| 81 |
Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?> |
| 82 |
Active Theme: <?php echo esc_attr( $theme ) . "\n"; ?> |
| 83 |
<?php if( $host ) : ?> |
| 84 |
Host: <?php echo esc_attr( $host ) . "\n"; ?> |
| 85 |
<?php endif; ?> |
| 86 |
|
| 87 |
Browser: <?php echo isset($_SERVER['HTTP_USER_AGENT']) ? esc_attr( sanitize_textarea_field( $_SERVER['HTTP_USER_AGENT'] ) ) : 'none'; ?> |
| 88 |
|
| 89 |
PHP Version: <?php echo PHP_VERSION . "\n"; ?> |
| 90 |
MySQL Version: <?php echo esc_attr( $wpdb->db_version() ) . "\n"; ?> |
| 91 |
Web Server Info: <?php echo esc_attr( sanitize_textarea_field( $_SERVER['SERVER_SOFTWARE'] ) ) . "\n"; ?> |
| 92 |
|
| 93 |
WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT."\n"; ?> |
| 94 |
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> |
| 95 |
PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> |
| 96 |
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> |
| 97 |
PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> |
| 98 |
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> |
| 99 |
PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?> |
| 100 |
PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?> |
| 101 |
PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes" : "No\n"; ?> |
| 102 |
|
| 103 |
PHP Extensions Installed: <?php print_r(get_loaded_extensions()) . "\n"; ?> |
| 104 |
PHP MBString: <?php echo ( extension_loaded('mbstring') ) ? 'MB String extension is installed on server.' : 'MBString extension is not installed on server.'; ?><?php echo "\n"; ?> |
| 105 |
|
| 106 |
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
| 107 |
|
| 108 |
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> |
| 109 |
cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?> |
| 110 |
|
| 111 |
ACTIVE PLUGINS: |
| 112 |
|
| 113 |
<?php |
| 114 |
$plugins = get_plugins(); |
| 115 |
$active_plugins = get_option( 'active_plugins', array() ); |
| 116 |
|
| 117 |
foreach ( $plugins as $plugin_path => $plugin ) { |
| 118 |
// If the plugin isn't active, don't show it. |
| 119 |
if ( ! in_array( $plugin_path, $active_plugins ) ) |
| 120 |
continue; |
| 121 |
|
| 122 |
echo esc_attr( $plugin['Name'] ) . ': ' . esc_attr( $plugin['Version'] ) ."\n"; |
| 123 |
} |
| 124 |
|
| 125 |
if ( is_multisite() ) : |
| 126 |
?> |
| 127 |
|
| 128 |
NETWORK ACTIVE PLUGINS: |
| 129 |
|
| 130 |
<?php |
| 131 |
$plugins = wp_get_active_network_plugins(); |
| 132 |
$active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
| 133 |
|
| 134 |
foreach ( $plugins as $plugin_path ) { |
| 135 |
$plugin_base = plugin_basename( $plugin_path ); |
| 136 |
|
| 137 |
// If the plugin isn't active, don't show it. |
| 138 |
if ( ! array_key_exists( $plugin_base, $active_plugins ) ) |
| 139 |
continue; |
| 140 |
|
| 141 |
$plugin = get_plugin_data( $plugin_path ); |
| 142 |
|
| 143 |
echo esc_attr( $plugin['Name'] ) . ' :' . esc_attr( $plugin['Version'] ) ."\n"; |
| 144 |
} |
| 145 |
|
| 146 |
endif; |
| 147 |
|
| 148 |
?> |
| 149 |
|
| 150 |
SETTINGS |
| 151 |
|
| 152 |
<?php |
| 153 |
$conf = get_option('fvwpflowplayer'); |
| 154 |
foreach( $conf AS $k => $v ) { |
| 155 |
if( stripos($k,'nonce') !== false ) unset($conf[$k]); |
| 156 |
} |
| 157 |
unset($conf['_wp_http_referer']); |
| 158 |
|
| 159 |
if( !empty($conf['key']) ) $conf['key'] = '(redacted)'; |
| 160 |
|
| 161 |
if( !empty($conf['googleanalytics']) ) $conf['googleanalytics'] = '(redacted)'; |
| 162 |
|
| 163 |
if( isset($conf['amazon_key']) && count($conf['amazon_key']) > 0 ) $conf['amazon_key'] = '(redacted, '.count($conf['amazon_key']).')'; |
| 164 |
if( isset($conf['amazon_secret']) && count($conf['amazon_secret']) > 0 ) $conf['amazon_secret'] = '(redacted, '. count($conf['amazon_secret']).')'; |
| 165 |
|
| 166 |
if( isset($conf['pro']) ) { |
| 167 |
if( !empty($conf['pro']['vimeo_at']) ) $conf['pro']['vimeo_at'] = '(redacted)'; |
| 168 |
if( !empty($conf['pro']['youtube_key']) ) $conf['pro']['youtube_key'] = '(redacted)'; |
| 169 |
|
| 170 |
if( !empty($conf['pro']['cf_key_id']) ) $conf['pro']['cf_key_id'] = '(redacted)'; |
| 171 |
if( !empty($conf['pro']['cf_pk']) ) $conf['pro']['cf_pk'] = '(redacted)'; |
| 172 |
|
| 173 |
if( !empty($conf['pro']['elastic_key']) ) $conf['pro']['elastic_key'] = '(redacted)'; |
| 174 |
if( !empty($conf['pro']['elastic_secret']) ) $conf['pro']['elastic_secret'] = '(redacted)'; |
| 175 |
|
| 176 |
foreach( $conf['pro'] AS $k => $v ) { |
| 177 |
if( stripos($k,'secure_token') !== false ) $conf['pro'][$k] = '(redacted)'; |
| 178 |
} |
| 179 |
|
| 180 |
} |
| 181 |
|
| 182 |
function fv_player_system_info_hide_private_info(&$item, $key) { |
| 183 |
// if the value is not empty and it's not already redacted |
| 184 |
// and the key is ending with key or secret |
| 185 |
if( !empty($item) && stripos($item,'(redacted') !== 0 && preg_match('~(key|secret)$~',$key) ) { |
| 186 |
$item = '(redacted)'; |
| 187 |
} |
| 188 |
} |
| 189 |
|
| 190 |
array_walk_recursive( $conf, 'fv_player_system_info_hide_private_info' ); |
| 191 |
|
| 192 |
print_r( $conf ); |
| 193 |
?> |
| 194 |
|
| 195 |
DATABASE |
| 196 |
|
| 197 |
<?php |
| 198 |
foreach( array( 'fv_player_players', 'fv_player_playermeta', 'fv_player_videos', 'fv_player_videometa', 'fv_player_encoding_jobs', 'fv_player_stats', 'fv_player_stream_loader_cache', 'fv_player_user_playlist_positions', 'fv_player_user_video_positions' ) AS $table) { |
| 199 |
$found = false; |
| 200 |
$table_name = $wpdb->prefix.$table; |
| 201 |
if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) ) ) == $table_name ) { |
| 202 |
$res = $wpdb->get_row( "SHOW CREATE TABLE {$table_name}", ARRAY_A ); |
| 203 |
if( $res && $res['Create Table'] ) { |
| 204 |
$found = $res['Create Table']; |
| 205 |
} |
| 206 |
} |
| 207 |
if( $found ) { |
| 208 |
echo esc_attr( $found ) ."\n\n"; |
| 209 |
} else { |
| 210 |
echo "Database table " . esc_attr( $table_name ) ." not found!\n\n"; |
| 211 |
} |
| 212 |
} |
| 213 |
?> |
| 214 |
|
| 215 |
### End System Info ### |
| 216 |
</textarea> |
| 217 |
<a class="button" href="<?php echo wp_nonce_url( admin_url('admin.php?page=fvplayer&action=fv-player-system-info'), 'fv-player-system-info' ); ?>"><?php esc_html_e( 'Export', 'fv-player' ); ?></a> |
| 218 |
<?php |
| 219 |
} |
| 220 |
|
| 221 |
} |
| 222 |
|
| 223 |
global $FV_Player_System_Info; |
| 224 |
$FV_Player_System_Info = new FV_Player_System_Info(); |
| 225 |
|