UM_ADDON_system_info

The Ultimate Member UM ADDON system info class.

Defined (1)

The class is defined in the following location(s).

/addons/system_info.php  
  1. class UM_ADDON_system_info { 
  2.  
  3. function __construct() { 
  4.  
  5. add_action('admin_menu', array(&$this, 'admin_menu'), 1001); 
  6.  
  7. add_action('admin_init', array(&$this, 'admin_init'), 1); 
  8.  
  9. add_action('um_admin_addon_hook', array(&$this, 'um_admin_addon_hook') ); 
  10.  
  11.  
  12.  
  13. function admin_menu() { 
  14.  
  15. global $ultimatemember; 
  16. $this->addon = $ultimatemember->addons['system_info']; 
  17. add_submenu_page('ultimatemember', "System Info", "System Info", 'manage_options', 'um_system_info', array(&$this, 'content') ); 
  18.  
  19.  
  20. function um_admin_addon_hook( $hook ) { 
  21. global $ultimatemember; 
  22.  
  23. switch ( $hook ) { 
  24.  
  25. case 'download_system_info': 
  26.  
  27. nocache_headers(); 
  28.  
  29. header( "Content-type: text/plain" ); 
  30. header( 'Content-Disposition: attachment; filename="ultimatemember-system-info.txt"' ); 
  31.  
  32. echo wp_strip_all_tags( $_POST['um-sysinfo'] ); 
  33. exit; 
  34.  
  35. break; 
  36.  
  37. default: 
  38.  
  39. break; 
  40.  
  41.  
  42. function admin_init() { 
  43. if ( isset( $_REQUEST['um-addon-hook'] ) ) { 
  44. $hook = $_REQUEST['um-addon-hook']; 
  45. do_action("um_admin_addon_hook", $hook ); 
  46.  
  47. function content() { 
  48. global $wpdb, $ultimatemember; 
  49.  
  50. if( !class_exists( 'Browser' ) ) 
  51. require_once um_path . 'core/lib/browser.php'; 
  52.  
  53. // Detect browser  
  54. $browser = new Browser(); 
  55.  
  56. // Get theme info 
  57. $theme_data = wp_get_theme(); 
  58. $theme = $theme_data->Name . ' ' . $theme_data->Version; 
  59.  
  60. // Identify Hosting Provider 
  61. $host = um_get_host(); 
  62.  
  63. um_fetch_user( get_current_user_id() ); 
  64. ?> 
  65.  
  66. <div class="wrap"> 
  67.  
  68. <h2>Ultimate Member</h2> 
  69.  
  70. <h3><?php echo $this->addon[0]; ?></h3> 
  71.  
  72. <?php if ( isset( $this->content ) ) {  
  73. echo $this->content; 
  74. } else { ?> 
  75.  
  76. <form action="<?php echo esc_url( admin_url( 'admin.php?page=um_system_info' ) ); ?>" method="post" dir="ltr"> 
  77. <textarea style="width:100%; height:400px;" readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="um-sysinfo" title="<?php _e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd' ); ?>"> 
  78. ### Begin System Info ### 
  79.  
  80. ## Please include this information when posting support requests ## 
  81.  
  82. <?php do_action( 'um_system_info_before' ); ?> 
  83.  
  84. --- Site Info --- 
  85.  
  86. Site URL: <?php echo site_url() . "\n"; ?> 
  87. Home URL: <?php echo home_url() . "\n"; ?> 
  88. Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> 
  89.  
  90. --- Hosting Provider --- 
  91.  
  92. <?php if( $host ) : ?> 
  93. Host: <?php echo $host . "\n"; ?> 
  94. <?php endif; ?> 
  95.  
  96. --- User Browser --- 
  97.  
  98. <?php echo $browser ; ?> 
  99.  
  100. ---- Current User Details -- 
  101.  
  102. <?php $user = wp_get_current_user(); ?> 
  103. UM Role: <?php echo um_user('role'). "\n"; ?> 
  104. WP Role: <?php echo $user->roles ? $user->roles[0] : false; echo "\n"; ?> 
  105.  
  106. --- WordPress Configurations --- 
  107.  
  108. Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> 
  109. Language: <?php echo get_locale()."\n"; ?> 
  110. Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?> 
  111. Active Theme: <?php echo $theme . "\n"; ?> 
  112. <?php $show_on_front = get_option( 'show_on_front' ); ?> 
  113. <?php if( $show_on_front == "posts" ): ?> 
  114. Show On Front: <?php echo get_option( 'show_on_front' ) . "/static\n" ?> 
  115. <?php elseif( $show_on_front == "page" ): ?> 
  116. Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?> 
  117. Page For Posts: <?php $id = get_option( 'page_for_posts' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?> 
  118. <?php endif; ?> 
  119. ABSPATH: <?php echo ABSPATH."\n"; ?> 
  120. <?php $wp_count_posts = wp_count_posts(); ?> 
  121. All Posts/Pages: <?php echo array_sum((array)$wp_count_posts)."\n";?> 
  122. <?php 
  123. $request['cmd'] = '_notify-validate'; 
  124.  
  125. $params = array( 
  126. 'sslverify' => false,  
  127. 'timeout' => 60,  
  128. 'user-agent' => 'UltimateMember/' . ultimatemember_version,  
  129. 'body' => $request 
  130. ); 
  131.  
  132. $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); 
  133.  
  134. if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { 
  135. $WP_REMOTE_POST = 'wp_remote_post() works' . "\n"; 
  136. } else { 
  137. $WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n"; 
  138. ?> 
  139. WP Remote Post: <?php echo $WP_REMOTE_POST; ?> 
  140. WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> 
  141. WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo ", Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?> 
  142. Memory Limit: <?php echo ( um_let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB"; ?><?php echo "\n"; ?> 
  143.  
  144. --- UM Configurations --- 
  145.  
  146. Version: <?php echo ultimatemember_version . "\n"; ?> 
  147. Upgraded From: <?php echo get_option( 'um_version_upgraded_from', 'None' ) . "\n"; ?> 
  148. Current URL Method: <?php echo um_get_option( 'current_url_method' ). "\n"; ?> 
  149. Cache User Profile: <?php if( um_get_option( 'um_profile_object_cache_stop' ) == 1 ) { echo "No"; }else{ echo "Yes"; } echo "\n"; ?> 
  150. Generate Slugs on Directories: <?php if( um_get_option( 'um_generate_slug_in_directory' ) == 1 ) { echo "No"; }else{ echo "Yes"; } echo "\n"; ?> 
  151. Rewrite Rules: <?php if( um_get_option( 'um_flush_stop' ) == 1 ) { echo "No"; }else{ echo "Yes"; } echo "\n"; ?> 
  152. Force UTF-8 Encoding: <?php if( um_get_option( 'um_force_utf8_strings' ) == 1 ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?> 
  153. Time Check Security: <?php if( um_get_option( 'enable_timebot' ) == 1 ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?> 
  154. JS/CSS Compression: <?php if( um_get_option( 'disable_minify' ) == 0 ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?> 
  155. <?php if( is_multisite() ): ?> 
  156. Network Structure: <?php echo um_get_option( 'network_permalink_structure' ). "\n"; ?> 
  157. <?php endif; ?> 
  158. Nav Menu Settings: <?php if( um_get_option( 'disable_menu' ) == 0 ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?> 
  159. Port Forwarding in URL: <?php if( um_get_option( 'um_port_forwarding_url' ) == 1 ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?> 
  160. Exclude CSS/JS on Home: <?php if( um_get_option( 'js_css_exlcude_home' ) == 1 ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?> 
  161.  
  162. --- UM Pages Configuration --- 
  163.  
  164. <?php do_action("um_system_info_before_page_config") ?> 
  165. User: <?php echo get_permalink( um_get_option('core_user') ) . "\n"; ?> 
  166. Account: <?php echo get_permalink( um_get_option('core_account') ) . "\n"; ?> 
  167. Members: <?php echo get_permalink( um_get_option('core_members') ) . "\n"; ?> 
  168. Register: <?php echo get_permalink( um_get_option('core_register') ) . "\n"; ?> 
  169. Login: <?php echo get_permalink( um_get_option('core_login') ) . "\n"; ?> 
  170. Logout: <?php echo get_permalink( um_get_option('core_logout') ) . "\n"; ?> 
  171. Password Reset: <?php echo get_permalink( um_get_option('core_password-reset') ) . "\n"; ?> 
  172. <?php do_action("um_system_info_after_page_config") ?> 
  173.  
  174. -- UM Users Configuration --- 
  175.  
  176. Default New User Role: <?php echo um_get_option('default_role') . "\n"; ?> 
  177. Profile Permalink Base: <?php echo um_get_option('permalink_base') . "\n"; ?> 
  178. User Display Name: <?php echo um_get_option('display_name') . "\n"; ?> 
  179. Force Name to Uppercase: <?php echo $this->value( um_get_option('force_display_name_capitlized'), 'yesno', true ); ?> 
  180. Redirect author to profile: <?php echo $this->value( um_get_option('author_redirect'), 'yesno', true ); ?> 
  181. Enable Members Directory: <?php echo $this->value( um_get_option('members_page'), 'yesno', true ); ?> 
  182. Use Gravatars: <?php echo $this->value( um_get_option('use_gravatars'), 'yesno', true ); ?> 
  183. <?php if( um_get_option('use_gravatars') ): ?>Gravatar builtin image: <?php echo um_get_option('use_um_gravatar_default_builtin_image') . "\n"; ?> 
  184. UM Avatar as blank Gravatar: <?php echo $this->value( um_get_option('use_um_gravatar_default_image'), 'yesno', true ); ?><?php endif; ?> 
  185. Require a strong password: <?php echo $this->value( um_get_option('reset_require_strongpass'), 'onoff', true ); ?> 
  186. Editable primary email field in profile view: <?php echo $this->value( um_get_option('editable_primary_email_in_profile'), 'onoff', true ); ?>  
  187.  
  188. -- UM Access Configuration --- 
  189.  
  190. Panic Key: <?php echo um_get_option('panic_key') . "\n"; ?> 
  191. Global Site Access: <?php $arr = array('Site accessible to Everyone', '', 'Site accessible to Logged In Users'); echo $arr[ intval( um_get_option('accessible') ) ] . "\n"; ?> 
  192. <?php if( um_get_option('accessible') == 2 ):?> 
  193. Custom Redirect URL: <?php echo um_get_option('access_redirect')."\n";?> 
  194. Exclude the following URLs:<?php echo "\t\t\t\t".implode("\t\n\t\t\t\t\t\t\t\t\t\t", um_get_option('access_exclude_uris') )."\n";?><?php endif;?> 
  195. Backend Login Screen for Guests: <?php echo $this->value( um_get_option('wpadmin_login'), 'yesno', true ); ?> 
  196. <?php if( ! um_get_option('wpadmin_login') ):?>Redirect to alternative login page: <?php if( um_get_option('wpadmin_login_redirect') == 'um_login_page' ) { echo um_get_core_page('login')."\n"; }else{ echo um_get_option('wpadmin_login_redirect_url')."\n"; }?><?php endif; ?> 
  197. Backend Register Screen for Guests: <?php echo $this->value( um_get_option('wpadmin_register'), 'yesno', true ); ?> 
  198. <?php if( ! um_get_option('wpadmin_register') ):?>Redirect to alternative register page: <?php if( um_get_option('wpadmin_register_redirect') == 'um_register_page' ) { echo um_get_core_page('register')."\n"; }else{ echo um_get_option('wpadmin_register_redirect_url')."\n"; }?><?php endif; ?> 
  199. Access Control widget for Admins only: <?php echo $this->value( um_get_option('access_widget_admin_only'), 'yesno', true ); ?> 
  200. Enable the Reset Password Limit: <?php echo $this->value( um_get_option('enable_reset_password_limit'), 'yesno', true ); ?> 
  201. <?php if( um_get_option('enable_reset_password_limit') ) {  
  202. echo "Reset Password Limit:\t\t\t\t\t\t".um_get_option('reset_password_limit_number')."\n";  
  203. echo "Disable Reset Password Limit for Admins:\t".$this->value( um_get_option('disable_admin_reset_password_limit'), 'yesno', true );  
  204. } ?> 
  205. <?php $wpadmin_allow_ips = um_get_option('wpadmin_allow_ips'); if( ! empty( $wpadmin_allow_ips ) ) { ?> 
  206. Whitelisted Backend IPs: <?php echo count( explode("\n", trim(um_get_option('wpadmin_allow_ips') ) ) )."\n"; ?> 
  207. <?php }?> 
  208. <?php $blocked_ips = um_get_option('blocked_ips'); if( ! empty( $blocked_ips ) ) { ?> 
  209. Blocked IP Addresses: <?php echo count( explode("\n", um_get_option('blocked_ips') ) )."\n"; ?> 
  210. <?php }?> 
  211. <?php $blocked_emails = um_get_option('blocked_emails'); if( ! empty( $blocked_emails ) ) { ?> 
  212. Blocked Email Addresses: <?php echo count( explode("\n", um_get_option('blocked_emails') ) )."\n"; ?> 
  213. <?php }?> 
  214. <?php $blocked_words = um_get_option('blocked_words'); if( ! empty( $blocked_words ) ) { ?> 
  215. Blacklist Words: <?php echo count( explode("\n", um_get_option('blocked_words') ) )."\n"; ?> 
  216. <?php }?> 
  217.  
  218.  
  219. --- UM Email Configurations -- 
  220.  
  221. Mail appears from: <?php $mail_from = um_get_option('mail_from'); if( ! empty( $mail_from ) ) {echo um_get_option('mail_from');}else{echo "-";}; echo "\n";?> 
  222. Mail appears from address: <?php $mail_from_addr = um_get_option('mail_from_addr'); if( ! empty( $mail_from_addr ) ) {echo um_get_option('mail_from_addr');}else{echo "-";}; echo "\n";?> 
  223. Use HTML for E-mails: <?php echo $this->value( um_get_option('email_html'), 'yesno', true ); ?> 
  224. Account Welcome Email: <?php echo $this->value( um_get_option('welcome_email_on'), 'yesno', true ); ?> 
  225. Account Activation Email: <?php echo $this->value( um_get_option('checkmail_email_on'), 'yesno', true ); ?> 
  226. Pending Review Email: <?php echo $this->value( um_get_option('pending_email_on'), 'yesno', true ); ?> 
  227. Account Approved Email: <?php echo $this->value( um_get_option('approved_email_on'), 'yesno', true ); ?> 
  228. Account Rejected Email: <?php echo $this->value( um_get_option('rejected_email_on'), 'yesno', true ); ?> 
  229. Account Deactivated Email: <?php echo $this->value( um_get_option('inactive_email_on'), 'yesno', true ); ?> 
  230. Account Deleted Email: <?php echo $this->value( um_get_option('deletion_email_on'), 'yesno', true ); ?> 
  231. Password Reset Email: <?php echo $this->value( um_get_option('resetpw_email_on'), 'yesno', true ); ?> 
  232. Password Changed Email: <?php echo $this->value( um_get_option('changedpw_email_on'), 'yesno', true ); ?> 
  233.  
  234.  
  235. --- UM Total Users --- 
  236.  
  237. <?php  
  238.  
  239. $result = count_users(); 
  240. echo 'All Users('.$result['total_users'].")\n"; 
  241. foreach($result['avail_roles'] as $role => $count) { 
  242. echo $role."(".$count.")\n"; 
  243. ?> 
  244.  
  245.  
  246. --- UM Roles --- 
  247.  
  248. <?php  
  249.  
  250. foreach( $ultimatemember->query->get_roles() as $role_id => $role ) { 
  251. echo $role." ({$role_id})\n"; 
  252.  
  253. ?> 
  254.  
  255.  
  256. --- UM Custom Templates --- 
  257.  
  258. <?php 
  259. // Show templates that have been copied to the theme's edd_templates dir 
  260.  
  261. $dir = get_stylesheet_directory() . '/ultimate-member/templates/*.php'; 
  262. if ( ! empty( $dir ) ) { 
  263. $found = glob( $dir ); 
  264. if( ! empty( $found ) ) { 
  265. foreach ( glob( $dir ) as $file ) { 
  266. echo "File: " . $file . "\n"; 
  267. }else { 
  268. echo 'N/A'."\n"; 
  269. echo "\n\n"; 
  270.  
  271. $dir = get_stylesheet_directory() . '/ultimate-member/templates/emails/*.html'; 
  272. echo "-- UM Email HTML Templates -- \n\n"; 
  273.  
  274. if ( ! empty( $dir ) ) { 
  275. $found = glob( $dir ); 
  276. if( ! empty( $found ) ) { 
  277. foreach ( glob( $dir ) as $file ) { 
  278. echo "File: ". $file . "\n"; 
  279. }else { 
  280. echo 'N/A'."\n"; 
  281.  
  282. ?> 
  283.  
  284. --- Web Server Configurations --- 
  285.  
  286. PHP Version: <?php echo PHP_VERSION . "\n"; ?> 
  287. MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> 
  288. Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> 
  289.  
  290. --- PHP Configurations -- 
  291.  
  292. PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> 
  293. PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> 
  294. PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> 
  295. PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> 
  296. PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> 
  297. PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?> 
  298. PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?> 
  299. PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes\n" : "No\n"; ?> 
  300.  
  301.  
  302. --- Web Server Extensions/Modules --- 
  303.  
  304. DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> 
  305. FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?> 
  306. cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?> 
  307. SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?> 
  308. SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?> 
  309. GD Library: <?php echo ( extension_loaded( 'gd' ) && function_exists('gd_info') ) ? 'PHP GD library is installed on your web server.' : 'PHP GD library is NOT installed on your web server.'; ?><?php echo "\n"; ?> 
  310. Mail: <?php echo ( function_exists('mail') ) ? 'PHP mail function exist on your web server.' : 'PHP mail function doesn\'t exist on your web server.'; ?><?php echo "\n"; ?> 
  311.  
  312.  
  313. --- Session Configurations --- 
  314.  
  315. Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> 
  316. Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?> 
  317. Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?> 
  318. Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?> 
  319. Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> 
  320. Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> 
  321.  
  322.  
  323.  
  324. --- WordPress Active Plugins --- 
  325.  
  326. <?php 
  327. $plugins = get_plugins(); 
  328. $active_plugins = get_option( 'active_plugins', array() ); 
  329.  
  330. foreach ( $plugins as $plugin_path => $plugin ) { 
  331. // If the plugin isn't active, don't show it. 
  332. if ( ! in_array( $plugin_path, $active_plugins ) ) 
  333. continue; 
  334.  
  335. echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n"; 
  336.  
  337. if ( is_multisite() ) : 
  338. ?> 
  339.  
  340. --- WordPress Network Active Plugins --- 
  341.  
  342. <?php 
  343. $plugins = wp_get_active_network_plugins(); 
  344. $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); 
  345.  
  346. foreach ( $plugins as $plugin_path ) { 
  347. $plugin_base = plugin_basename( $plugin_path ); 
  348.  
  349. // If the plugin isn't active, don't show it. 
  350. if ( ! array_key_exists( $plugin_base, $active_plugins ) ) 
  351. continue; 
  352.  
  353. $plugin = get_plugin_data( $plugin_path ); 
  354.  
  355. echo $plugin['Name'] . ' :' . $plugin['Version'] ."\n"; 
  356.  
  357. endif; 
  358. ?> 
  359. <?php  
  360. do_action( 'um_system_info_after' ); 
  361. ?> 
  362.  
  363.  
  364.  
  365.  
  366. ### End System Info ###</textarea> 
  367. <p class="submit"> 
  368. <input type="hidden" name="um-addon-hook" value="download_system_info" /> 
  369. <?php submit_button( 'Download System Info File', 'primary', 'download_system_info', false ); ?> 
  370. </p> 
  371. </form>  
  372.  
  373. <?php } ?> 
  374.  
  375. <?php 
  376.  
  377.  
  378. function value( $raw_value = '', $type = 'yesno', $default = '', $default_negate = '' ) { 
  379.  
  380. if( $type == 'yesno' ) { 
  381. if( $default == $raw_value ) { 
  382. $raw_value = "Yes"; 
  383. }else{ 
  384. $raw_value = "No"; 
  385. }else if( $type == 'onoff' ) { 
  386. if( $default == $raw_value ) { 
  387. $raw_value = "On"; 
  388. }else{ 
  389. $raw_value = "Off"; 
  390.  
  391. return $raw_value."\n"; 
  392.