PluginProbe
WPPizza – A Restaurant Plugin / 3.20
WPPizza – A Restaurant Plugin v3.20
trunk 2.16.11.28 3.19 3.19.1 3.19.2 3.19.3 3.19.4 3.19.5 3.19.6 3.19.7 3.19.7.1 3.19.7.2 3.19.7.3 3.19.7.4 3.19.8 3.19.8.1 3.19.8.2 3.19.8.3 3.19.9 3.20 3.20.1
wppizza / classes / modules / mod.tools.sysinfo.overview.php

mod.tools.sysinfo.overview.php in WPPizza – A Restaurant Plugin 3.20, at classes/modules/mod.tools.sysinfo.overview.php

364 lines 16.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPPIZZA_MODULE_TOOLS_SYSINFO_OVERVIEW Class
4 *
5 * @package WPPIZZA
6 * @subpackage WPPIZZA_MODULE_TOOLS_SYSINFO_OVERVIEW
7 * @copyright Copyright (c) 2015, Oliver Bach
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 3.0
10 *
11 */
12 if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/
13
14
15 /************************************************************************************************************************
16 *
17 *
18 *
19 *
20 *
21 *
22 ************************************************************************************************************************/
23 class WPPIZZA_MODULE_TOOLS_SYSINFO_OVERVIEW{
24
25 private $settings_page = 'tools';/* which admin subpage (identified there by this->class_key) are we adding this to */
26 private $tab_key = 'sysinfo';/* must be unique within this admin page*/
27 private $section_key = 'system_info';
28
29 function __construct() {
30 /**********************************************************
31 [add settings to admin]
32 ***********************************************************/
33 if(is_admin()){
34 /*** add to a specific tab ***/
35 add_filter('wppizza_filter_admin_tabs_'.$this->settings_page.'', array($this, 'admin_tabs'), 10);
36 /* add admin options settings page*/
37 add_filter('wppizza_filter_settings_sections_'.$this->settings_page.'', array($this, 'admin_options_settings'), 10, 5);
38 /* add admin options settings page fields */
39 add_action('wppizza_admin_settings_section_fields_'.$this->settings_page.'', array($this, 'admin_options_fields_settings'), 10, 5);
40 }
41 }
42
43
44 /*********************************************************
45 [add section to a particular tab]
46 *********************************************************/
47 function admin_tabs($tabs){
48 $tabs['tab'][$this->tab_key]['sections'][] = $this->section_key;
49 return $tabs;
50 }
51 /*------------------------------------------------------------------------------
52 # [settings section - setting page]
53 # @since 3.0
54 # @return array()
55 ------------------------------------------------------------------------------*/
56 function admin_options_settings($settings, $sections, $fields, $inputs, $help){
57
58 /*section*/
59 if($sections){
60 $settings['sections'][$this->section_key] = __('System Info', 'wppizza-admin');
61 }
62
63 /*help*/
64 if($help){
65 }
66
67 /*fields*/
68 if($fields){
69 $field = 'system_info';
70 $settings['fields'][$this->section_key][$field] = array('' , array(
71 'value_key'=>$field,
72 'option_key'=>$this->settings_page,
73 'label'=>'',
74 'description'=>array()
75 ));
76 }
77 return $settings;
78 }
79 /*------------------------------------------------------------------------------
80 # [output option fields - setting page]
81 # @since 3.0
82 # @return array()
83 ------------------------------------------------------------------------------*/
84 function admin_options_fields_settings($wppizza_options, $options_key, $field, $label, $description){
85
86 if($field=='system_info' ){
87 ob_start();
88 $sysinfo = $this->wppizza_system_info();
89 echo $sysinfo ;
90 }
91 }
92
93 /*********************************************************
94 *
95 * [get system info]
96 * @since 3.0
97 *
98 *********************************************************/
99 function wppizza_system_info(){
100
101 global $wpdb, $wppizza_options;
102
103 /*get mysql info**/
104 $mysql_info=wppizza_get_mysql_version();
105
106 /*theme**/
107 if ( get_bloginfo( 'version' ) < '3.4' ) {
108 $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
109 $theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
110 } else {
111 $theme_data = wp_get_theme();
112 $theme = $theme_data->Name . ' ' . $theme_data->Version;
113 }
114 /**remote post**/
115 $params = array(
116 'sslverify' => false,
117 'timeout' => 60,
118 'user-agent' => 'WPPIZZA-SYSINFO/' . WPPIZZA_VERSION,
119 );
120
121 $response = wp_remote_post( 'https://www.wp-pizza.com', $params );
122
123 if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
124 $WP_REMOTE_POST = 'wp_remote_post() works' . "\n";
125 } else {
126 $WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
127 }
128
129 /** order table structure **/
130 $table_name = $wpdb->prefix . WPPIZZA_TABLE_ORDERS;
131 $tbl_columns = array();
132 $qtbl = $wpdb->get_results( "SHOW FULL COLUMNS FROM ".$table_name."" );
133 foreach($qtbl as $i=> $colObj){
134 $tbl_columns[$i] = $colObj->Field ;
135 //some columns removed in 3.19.3
136 $column_array = array('customer_details','customer_ini','order_details','order_ini','order_taxes_included','order_self_pickup','order_status','order_status_user_defined','hash','payment_status','transaction_id','transaction_details','transaction_errors','display_errors','initiator','mail_sent','mail_error','notes','session_id','ip_address','user_data');
137 if(in_array($colObj->Field, $column_array ) && substr($colObj->Collation,0, 7) != strtolower('utf8mb4')){
138 $tbl_columns[$i] .= ' CHECK COLLATION ['.$colObj->Collation.']';
139 }
140 }
141
142 $table_columns = implode(' | ', $tbl_columns);
143
144 /** check if order meta table exists **/
145 $table_meta_name = $wpdb->prefix . WPPIZZA_TABLE_ORDERS_META;
146 $table_meta = $wpdb->get_results( "SHOW FULL COLUMNS FROM ".$table_meta_name."" );
147
148 ?>
149 <textarea readonly="readonly" onclick="this.focus();this.select();" style="width:100%;height:400px;overflow:auto; background:#EFEFEF">
150 ###### SYSTEM INFO ######
151
152 Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
153
154 SITE_URL: <?php echo site_url() . "\n"; ?>
155 HOME_URL: <?php echo home_url() . "\n"; ?>
156
157 WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
158 Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?>
159 Active Theme: <?php echo $theme . "\n"; ?>
160
161 PHP Version: <?php echo PHP_VERSION . "\n"; ?>
162 MySQL Version: <?php echo "" . print_r($mysql_info['info'],true) . " [" . print_r($mysql_info['extension'],true) . "]\n"; ?>
163 Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
164
165
166 PHP Date / Timezone: <?php echo ini_get( 'date.timezone' ) . "\n"; ?>
167 PHP Latitude: <?php echo ini_get( 'date.default_latitude' ) . "\n"; ?>
168 PHP Longitude: <?php echo ini_get( 'date.default_longitude' ) . "\n"; ?>
169 PHP Safe Mode: <?php echo ini_get( 'safe_mode' ) ? "Yes\n" : "No\n"; ?>
170 PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
171 PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
172 PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
173 PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
174 PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
175 PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?>
176 PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?>
177 PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes\n" : "No\n"; ?>
178 PHP Disabled Functions: <?php echo (ini_get('disable_functions')!='') ? "".ini_get('disable_functions')."\n" : "---\n"; ?>
179
180 <?php
181 /**session_save_path**/
182 $session_save_path=ini_get( 'session.save_path' );
183 $session_save_path=explode(';',$session_save_path);
184 /*session_save_path directory space left**/
185 $session_save_path_space_remaining=0;
186 if(!empty($session_save_path) && is_array($session_save_path) && function_exists('disk_free_space')){
187 $session_save_path_space_remaining='';
188 foreach($session_save_path as $ssp){
189 if(!empty($ssp)){
190 $writable = is_writable($ssp);
191 $writable = empty($writable) ? '0' : '1' ;
192 $session_save_path_space_remaining .= ''.wppizza_convert_bytes(disk_free_space($ssp)).' [writable: '.$writable.'] ';
193 }
194 }
195 }
196 if(!function_exists('disk_free_space')){
197 $session_save_path_space_remaining = 'unknown [disk_free_space function not available or no session save path defined]' ;
198 }
199 ?>
200 Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
201 Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
202 Session Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
203 Session Save Path: <?php echo esc_html( implode(' | ',$session_save_path) ); ?><?php echo "\n"; ?>
204 Session Space Left: <?php echo $session_save_path_space_remaining; ?><?php echo "\n"; ?>
205 Session Save Handler: <?php echo esc_html( ini_get( 'session.save_handler' ) ); ?><?php echo "\n"; ?>
206 Session Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
207 Session Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
208
209
210
211 WP Memory Limit: <?php echo WP_MEMORY_LIMIT; ?><?php echo "\n"; ?>
212 WP Remote Post: <?php echo $WP_REMOTE_POST; ?>
213 WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
214 WP_DEBUG_LOG: <?php echo defined( 'WP_DEBUG_LOG' ) ? WP_DEBUG_LOG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
215 WP_DEBUG_DISPLAY: <?php echo defined( 'WP_DEBUG_DISPLAY' ) ? WP_DEBUG_DISPLAY ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
216
217 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"; ?>
218
219 Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?>
220 Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
221 Page For Posts: <?php $id = get_option( 'page_for_posts' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
222
223 DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
224 FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'fsockopen supported.' : 'fsockopen NOT supported.'; ?><?php echo "\n"; ?>
225 cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'cURL supported.' : 'cURL NOT supported.'; ?><?php echo "\n"; ?>
226 iConv: <?php echo ( function_exists( 'iconv' ) ) ? 'iConv installed.' : 'iConv NOT installed.'; ?><?php echo "\n"; ?>
227 SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'SOAP Client enabled.' : 'SOAP Client NOT enabled.'; ?><?php echo "\n"; ?>
228 SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'SUHOSIN installed.' : 'SUHOSIN NOT installed.'; ?><?php echo "\n"; ?>
229 <?php if(extension_loaded( 'suhosin' )){ ?>
230 suhosin.post.max_vars: <?php echo esc_html( ini_get( 'suhosin.post.max_vars' ) ); ?><?php echo "\n"; ?>
231 suhosin.request.max_vars: <?php echo esc_html( ini_get( 'suhosin.request.max_vars' ) ); ?><?php echo "\n"; ?>
232 <?php } ?>
233
234
235 ###### ACTIVE PLUGINS ######
236
237 <?php
238 $plugins = get_plugins();
239 $active_plugins = get_option( 'active_plugins', array() );
240
241 foreach ( $plugins as $plugin_path => $plugin ) {
242 // only show active plugins
243 if ( ! in_array( $plugin_path, $active_plugins ) )
244 continue;
245
246 echo $plugin['Name'] . ': ' . $plugin['Version'] . PHP_EOL;
247 }
248
249 if ( is_multisite() ) {
250 ?>
251
252 ###### NETWORK ACTIVE PLUGINS ######
253
254 <?php
255 $plugins = wp_get_active_network_plugins();
256 $active_plugins = get_site_option( 'active_sitewide_plugins', array() );
257
258 foreach ( $plugins as $plugin_path ) {
259 $plugin_base = plugin_basename( $plugin_path );
260
261 // only show active plugins
262 if ( ! array_key_exists( $plugin_base, $active_plugins ) )
263 continue;
264
265 $plugin = get_plugin_data( $plugin_path );
266
267 echo $plugin['Name'] . ' :' . $plugin['Version'] . PHP_EOL;
268 }
269 ?>
270 <?php } ?>
271
272
273 ###### WPPIZZA VARIABLES ######
274
275 Order Page: <?php echo !empty( $wppizza_options['order_settings']['orderpage'] ) ? get_permalink( $wppizza_options['order_settings']['orderpage'] ) . "\n" : "\n" ?>
276 Emails Disabled: <?php echo !empty( $wppizza_options['tools']['disable_emails']) ? 'Yes'. PHP_EOL :'No' . PHP_EOL ?>
277 Using Cache: <?php echo !empty( $wppizza_options['settings']['using_cache_plugin']) ? 'Yes'. PHP_EOL:'No' . PHP_EOL ?>
278 Dequeue scripts: <?php echo !empty( $wppizza_options['settings']['dequeue_scripts']) ? $wppizza_options['plugin_data']['dequeue_scripts'] . PHP_EOL : '---' . PHP_EOL ?>
279 Style: <?php echo $wppizza_options['layout']['style'] . PHP_EOL ?>
280 Style Enabled: <?php echo !empty( $wppizza_options['layout']['include_css']) ? 'Yes'. PHP_EOL :'No' . PHP_EOL ?>
281 Confirmation Form: <?php echo !empty( $wppizza_options['confirmation_form']['confirmation_form_enabled']) ? 'Yes' . PHP_EOL :'No' . PHP_EOL ?>
282 Multisite Session: <?php echo !empty( $wppizza_options['settings']['wp_multisite_session_per_site']) ? 'Yes (Default)'. PHP_EOL :'No' . PHP_EOL ?>
283 Multisite Reports: <?php echo !empty( $wppizza_options['settings']['wp_multisite_reports_all_sites']) ? 'Yes'. PHP_EOL :'No (Default)' . PHP_EOL ?>
284 Multisite History: <?php echo !empty( $wppizza_options['settings']['wp_multisite_order_history_all_sites']) ? 'Yes'. PHP_EOL :'No (Default)' . PHP_EOL ?>
285 Order Table Columns: <?php echo !empty($table_columns) ? $table_columns . PHP_EOL : '--' . PHP_EOL ?>
286 Order Meta Table Exists: <?php echo !empty( $table_meta) ? 'Yes'. PHP_EOL :'-- (ERROR)' . PHP_EOL ?>
287
288
289 WPPIZZA CONSTANTS
290 <?php
291 $constants = get_defined_constants(true);
292 $constants = $constants['user'];
293 /* allow filtering to exclude some constants if needed (simply use unset($constants[WPPIZZA_{key}]) )*/
294 $constants = apply_filters('wppizza_filter_sysinfo_constants', $constants);
295 foreach($constants as $constant => $value){
296 if(substr($constant,0,7) == 'WPPIZZA' && $constant !='WPPIZZA_CRYPT_KEY'){// do not display encryption key
297
298 $val = (is_bool($value)) ? (!empty($value) ? 'true' : 'false' ) : $value;
299
300
301 echo ' ' . $constant . ': '. $val . PHP_EOL .'';
302 }
303 }
304 ?>
305
306 WPPIZZA TEMPLATES
307 Single Item Tpl: <?php echo !empty( $wppizza_options['plugin_data']['post_single_template']) ? $wppizza_options['plugin_data']['post_single_template']. PHP_EOL :'--' . PHP_EOL ?>
308 Single Item Permalink: <?php echo $wppizza_options['settings']['single_item_permalink_rewrite'] . PHP_EOL ?>
309
310
311 WPPIZZA CUSTOMISED TEMPLATES (IF ANY):
312 <?php
313 // Show templates that have been customised in their own directory
314 $tplDir = get_stylesheet_directory() . DIRECTORY_SEPARATOR.WPPIZZA_SLUG;
315 if(is_dir($tplDir)){
316 echo "Directory: " .$tplDir . PHP_EOL . ' ';
317 $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tplDir));
318 $path = array();
319 foreach ($iterator as $file) {
320 if ($file->isDir()) continue;
321 echo "Filename: " .str_replace($tplDir,'',$file->getPathname()).PHP_EOL.' ';
322 }
323 }
324 ?>
325 </textarea>
326 <?php /**check if sessions really work here **/
327 $wppizza_sess_check_val='not tested';
328 if (!session_id()) {session_start();}
329
330 if(!isset($_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK']) && isset($_GET['session_test']) ){
331 $_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK']=0;
332 $wppizza_sess_check_val=$_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK'];
333 }
334
335 if(isset($_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK']) && isset($_GET['session_test'])){
336 $_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK']++;
337 $wppizza_sess_check_val=$_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK'];
338 }
339
340 if(isset($_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK']) && isset($_GET['session_reset'])){
341 unset($_SESSION['WP_PIZZA_ADMIN_SYSTEN_SESSION_CHECK']);
342 $wppizza_sess_check_val='reset';
343 }
344
345
346
347 ?>
348 <div>
349 BASIC SESSIONS TEST :
350 Session Write Value: <b> - <?php echo $wppizza_sess_check_val ?> - </b> <?php echo"<a href='".htmlspecialchars($_SERVER['PHP_SELF'])."?post_type=".WPPIZZA_POST_TYPE."&page=tools&tab=sysinfo&session_test'>test</a> | <a href='".htmlspecialchars($_SERVER['PHP_SELF'])."?post_type=wppizza&page=tools&tab=sysinfo&session_reset'>reset</a>"; ?><?php echo "\n"; ?>
351 Value must increase <b>every time</b> you click on "test" or your sessions are NOT working/setup correctly. click "test" at least 2x to check, "reset" to clear.
352 </div>
353 <?php
354 }
355
356
357 }
358 /***************************************************************
359 *
360 * [ini]
361 *
362 ***************************************************************/
363 $WPPIZZA_MODULE_TOOLS_SYSINFO_OVERVIEW = new WPPIZZA_MODULE_TOOLS_SYSINFO_OVERVIEW();
364 ?>