PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
← All changes | core/admin/wpbc-settings-functions.php +53 -38 10.1.311.8.4 View file →
@@ -1,4 +1,4 @@
1 1 <?php /**
2 2 * @version 1.0
3 3 * @package Booking Calendar
4 4 * @category Support functions for Settings page
@@ -17,12 +17,13 @@
17 17 * Check if show "Settings General" page OR "System Info"
18 18 *
19 19 * @return bool
20 20 */
21 -function wpbc_is_show_general_setting_options(){ //FixIn: 8.9.4.11
21 +function wpbc_is_show_general_setting_options(){ // FixIn: 8.9.4.11.
22 22
23 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
23 24 if ( ( isset( $_GET['system_info'] ) ) && ( $_GET['system_info'] == 'show' ) ) {
24 - $nonce_gen_time = check_admin_referer( 'wpbc_settings_url_nonce' ); //FixIn: 9.2.2.1
25 + $nonce_gen_time = check_admin_referer( 'wpbc_settings_url_nonce' ); // FixIn: 9.2.2.1.
25 26 return false;
26 27 }
27 28 return true;
28 29 }
@@ -75,15 +76,18 @@
75 76
76 77 if ( ! current_user_can( 'activate_plugins' ) ) {
77 78 return;
78 79 }
80 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
81 + if ( ( isset( $_GET['reset'] ) ) && ( 'custom_forms' == $_GET['reset'] ) ) { // FixIn: 8.1.3.21.
79 82
80 - if ( ( isset( $_GET['reset'] ) ) && ( 'custom_forms' == $_GET['reset'] ) ) { //FixIn: 8.1.3.21
81 -
82 83 wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' );
83 84
84 - // Reset Custom Booking Forms to NONE
85 - update_bk_option( 'booking_forms_extended', serialize( array() ) );
85 + global $wpdb;
86 + if ( function_exists( 'wpbc_is_table_exists' ) && wpbc_is_table_exists( 'booking_form_structures' ) ) {
87 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
88 + $wpdb->query( "DELETE FROM {$wpdb->prefix}booking_form_structures WHERE form_slug <> 'standard'" );
89 + }
86 90
87 91 wpbc_show_message_in_settings( '<strong>Custom forms</strong> has been reseted!', 'info' );
88 92
89 93 wpbc_close_meta_box_section();
@@ -103,16 +107,19 @@
103 107 if ( ! current_user_can( 'activate_plugins' ) ) {
104 108 return;
105 109 }
106 110
107 - if ( ! empty( $_GET['pot'] ) ) { //FixIn: 8.1.3.21
111 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
112 + if ( ! empty( $_GET['pot'] ) ) { // FixIn: 8.1.3.21.
108 113
109 114 wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' );
110 115
116 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
111 117 if ( '1' == $_GET['pot'] ) {
112 118 wpbc_pot_to_php();
113 119 }
114 120
121 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
115 122 if ( 'erase__wpbc_all_translations' == $_GET['pot'] ) {
116 123 wpbc_delete_translation_php_files();
117 124 }
118 125
@@ -132,9 +139,10 @@
132 139 if ( ! current_user_can( 'activate_plugins' ) ) {
133 140 return;
134 141 }
135 142
136 - if ( ( isset( $_GET['update_translations'] ) ) && ( '1' == $_GET['update_translations'] ) ) { //FixIn: 8.1.3.21
143 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
144 + if ( ( isset( $_GET['update_translations'] ) ) && ( '1' == $_GET['update_translations'] ) ) { // FixIn: 8.1.3.21.
137 145
138 146 wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' );
139 147
140 148 wpbc_update_translations__from_wp();
@@ -155,18 +163,21 @@
155 163 if ( ! current_user_can( 'activate_plugins' ) ) {
156 164 return;
157 165 }
158 166
159 - if ( isset( $_GET['show_translation_status'] ) ) { //FixIn: 8.1.3.21
167 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
168 + if ( isset( $_GET['show_translation_status'] ) ) { // FixIn: 8.1.3.21.
160 169
161 170 wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' );
162 -
171 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
163 172 if ( '1' == $_GET['show_translation_status'] ){
164 173 wpbc_show_translation_status_compare_wpbc_wp();
165 174 }
175 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
166 176 if ( '2' == $_GET['show_translation_status'] ){
167 177 wpbc_show_translation_status_from_wp();
168 178 }
179 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
169 180 if ( '3' == $_GET['show_translation_status'] ){
170 181 wpbc_show_translation_status_from_wpbc();
171 182 }
172 183
@@ -181,8 +192,9 @@
181 192 * Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' #wpbc_general_settings_system_info_metabox
182 193 */
183 194 function wpbc_settings__system_info__show_system_info(){
184 195
196 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
185 197 if ( ( isset( $_GET['booking_system_info'] ) ) && ( $_GET['booking_system_info'] == 'show' ) ) { ?>
186 198
187 199 <?php wpbc_open_meta_box_section( 'wpbc_general_settings_system_info', 'System Info' ); ?>
188 200
@@ -200,17 +212,19 @@
200 212 *
201 213 */
202 214 function wpbc_settings__system_info__restore_dismissed_windows(){
203 215
204 - if ( ( isset( $_GET['restore_dismissed'] ) ) && ( $_GET['restore_dismissed'] == 'On' ) ) { //FixIn: 8.1.3.10
216 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
217 + if ( ( isset( $_GET['restore_dismissed'] ) ) && ( $_GET['restore_dismissed'] == 'On' ) ) { // FixIn: 8.1.3.10.
205 218
206 219 update_bk_option( 'booking_is_show_powered_by_notice', 'On' );
207 -
208 220 update_bk_option( 'booking_wpdev_copyright_adminpanel', 'On' );
221 + update_bk_option( 'booking_menu_go_pro', 'show' );
209 222
210 223 global $wpdb;
211 - // Delete all users booking windows states
212 - if ( false === $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%booking_win_%'" ) ) { // All users data
224 +
225 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
226 + if ( false === $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%booking_win_%'" ) ) { // Delete all users booking windows states.
213 227 debuge_error( 'Error during deleting user meta at DB', __FILE__, __LINE__ );
214 228 die();
215 229 } else {
216 230
@@ -217,11 +231,9 @@
217 231 wpbc_open_meta_box_section( 'wpbc_general_settings_restore_dismissed', 'Info' );
218 232
219 233 ?><h2>All dismissed windows has been restored.</h2><?php
220 234
221 - echo '<div class="clear"></div><hr/><center><a class="button button" href="' . wpbc_get_settings_url() . '">'
222 - . 'Reload Page'
223 - . '</a></center>';
235 + echo '<div class="clear"></div><hr/><center><a class="button button" href="' . esc_url( wpbc_get_settings_url() ) . '">Reload Page</a></center>';
224 236
225 237 wpbc_close_meta_box_section();
226 238 }
227 239 }
@@ -234,23 +246,21 @@
234 246 *
235 247 */
236 248 function wpbc_system_info() {
237 249
250 + if ( current_user_can( 'activate_plugins' ) ) { // Only for Administrator or Super admin. More here: https://codex.wordpress.org/Roles_and_Capabilities .
238 251
239 -
240 - if ( current_user_can( 'activate_plugins' ) ) { // Only for Administrator or Super admin. More here: https://codex.wordpress.org/Roles_and_Capabilities
241 -
242 -
243 252 global $wpdb, $wp_version;
244 253
245 - $all_plugins = get_plugins();
254 + $all_plugins = get_plugins();
246 255 $active_plugins = get_option( 'active_plugins' );
256 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
257 + $mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
247 258
248 - $mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
249 259 if ( is_array( $mysql_info ) ) $sql_mode = $mysql_info[0]->Value;
250 260 if ( empty( $sql_mode ) ) $sql_mode = 'Not set';
251 261
252 - //FixIn: 8.4.7.24
262 + // FixIn: 8.4.7.24.
253 263 $allow_url_fopen = ( ini_get( 'allow_url_fopen' ) ) ? 'On' : 'Off';
254 264 $upload_max_filesize = ( ini_get( 'upload_max_filesize' ) ) ? ini_get( 'upload_max_filesize' ) : 'N/A';
255 265 $post_max_size = ( ini_get( 'post_max_size' ) ) ? ini_get( 'post_max_size' ) : 'N/A';
256 266 $max_execution_time = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : 'N/A';
@@ -258,9 +268,9 @@
258 268 $memory_usage = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . ' Mb' : 'N/A';
259 269 $exif_read_data = ( is_callable( 'exif_read_data' ) ) ? 'Yes' . " ( V" . substr( phpversion( 'exif' ), 0, 4 ) . ")" : 'No';
260 270 $iptcparse = ( is_callable( 'iptcparse' ) ) ? 'Yes' : 'No';
261 271 $xml_parser_create = ( is_callable( 'xml_parser_create' ) ) ? 'Yes' : 'No';
262 - $theme = ( function_exists( 'wp_get_theme' ) ) ? wp_get_theme() : get_theme( get_current_theme() );
272 + $theme = wp_get_theme();
263 273
264 274 if ( function_exists( 'is_multisite' ) ) {
265 275 if ( is_multisite() ) $multisite = 'Yes';
266 276 else $multisite = 'No';
@@ -269,19 +279,22 @@
269 279
270 280 $system_info = array(
271 281 'system_info' => '',
272 282 'php_info' => '',
273 - 'active_plugins' => array(), //FixIn: 8.4.4.1
274 - 'inactive_plugins' => array() //FixIn: 8.4.4.1
283 + 'active_plugins' => array(), // FixIn: 8.4.4.1.
284 + 'inactive_plugins' => array() // FixIn: 8.4.4.1.
275 285 );
276 286
277 287 $ver_small_name = wpbc_get_plugin_version_type();
278 288 if ( class_exists( 'wpdev_bk_multiuser' ) ) $ver_small_name = 'multiuser';
279 289
290 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
291 + $mysql_version = $wpdb->get_var( 'SELECT VERSION() AS version' );
292 +
280 293 $system_info['system_info'] = array(
281 294 'Plugin Update' => ( defined( 'WPDEV_BK_VERSION' ) ) ? WPDEV_BK_VERSION : 'N/A',
282 295 'Plugin Version' => ucwords( $ver_small_name ),
283 - 'Plugin Update Date' => date( "Y-m-d", filemtime( WPBC_FILE ) ),
296 + 'Plugin Update Date' => gmdate( "Y-m-d", filemtime( WPBC_FILE ) ),
284 297
285 298 'Server Default Timezone' => date_default_timezone_get(),
286 299 'WordPress Timezone' => wp_timezone()->getName(),
287 300
@@ -288,17 +301,17 @@
288 301 'WP Version' => $wp_version,
289 302 'WP DEBUG' => ( ( defined('WP_DEBUG') ) && ( WP_DEBUG ) ) ? 'On' : 'Off',
290 303 'WP DB Version' => get_option( 'db_version' ),
291 304 'Operating System' => PHP_OS,
292 - 'Server' => $_SERVER["SERVER_SOFTWARE"],
305 + 'Server' => isset( $_SERVER["SERVER_SOFTWARE"] ) ? sanitize_text_field( wp_unslash( $_SERVER["SERVER_SOFTWARE"] ) ) : 'N/A',
293 306 'PHP Version' => PHP_VERSION,
294 - 'MYSQL Version' => $wpdb->get_var( "SELECT VERSION() AS version" ),
307 + 'MYSQL Version' => $mysql_version,
295 308 'SQL Mode' => $sql_mode,
296 309 'Memory usage' => $memory_usage,
297 310 'Site URL' => get_option( 'siteurl' ),
298 311 'Home URL' => home_url(),
299 - 'SERVER[HTTP_HOST]' => $_SERVER['HTTP_HOST'],
300 - 'SERVER[SERVER_NAME]' => $_SERVER['SERVER_NAME'],
312 + 'SERVER[HTTP_HOST]' => isset( $_SERVER["HTTP_HOST"] ) ? sanitize_text_field( wp_unslash( $_SERVER["HTTP_HOST"] ) ) : 'N/A',
313 + 'SERVER[SERVER_NAME]' => isset( $_SERVER["SERVER_NAME"] ) ? sanitize_text_field( wp_unslash( $_SERVER["SERVER_NAME"] ) ) : 'N/A',
301 314 'Multisite' => $multisite,
302 315 'Active Theme' => $theme['Name'] . ' ' . $theme['Version']
303 316 );
304 317
@@ -349,9 +362,9 @@
349 362 $gd_info = gd_info();
350 363 if ( isset( $gd_info['GD Version'] ) )
351 364 $gd_info = $gd_info['GD Version'];
352 365 else
353 - $gd_info = json_encode( $gd_info );
366 + $gd_info = wp_json_encode( $gd_info );
354 367 } else {
355 368 $gd_info = 'Off';
356 369 }
357 370 $system_info['php_info']['PHP GD'] = $gd_info;
@@ -359,12 +372,14 @@
359 372 // More here https://docs.woocommerce.com/document/problems-with-large-amounts-of-data-not-saving-variations-rates-etc/
360 373
361 374
362 375 foreach ( $all_plugins as $path => $plugin ) {
363 - if ( is_plugin_active( $path ) ) {
376 + if ( ( ! empty( $plugin['Name'] ) ) && ( ! empty( $plugin['Version'] ) ) ) {
377 + if ( is_plugin_active( $path ) ) {
364 378 $system_info['active_plugins'][ $plugin['Name'] ] = $plugin['Version'];
365 - } else {
379 + } else {
366 380 $system_info['inactive_plugins'][ $plugin['Name'] ] = $plugin['Version'];
381 + }
367 382 }
368 383 }
369 384
370 385 // Showing
@@ -371,9 +386,9 @@
371 386 foreach ( $system_info as $section_name => $section_values ) {
372 387 ?>
373 388 <span class="wpdevelop">
374 389 <table class="table table-striped table-bordered">
375 - <thead><tr><th colspan="2" style="border-bottom: 1px solid #eeeeee;padding: 10px;"><?php echo strtoupper( $section_name ); ?></th></tr></thead>
390 + <thead><tr><th colspan="2" style="border-bottom: 1px solid #eeeeee;padding: 10px;"><?php echo esc_html( strtoupper( $section_name ) ); ?></th></tr></thead>
376 391 <tbody>
377 392 <?php
378 393 if ( !empty( $section_values ) ) {
379 394 foreach ( $section_values as $key => $value ) {
@@ -378,10 +393,10 @@
378 393 if ( !empty( $section_values ) ) {
379 394 foreach ( $section_values as $key => $value ) {
380 395 ?>
381 396 <tr>
382 - <td scope="row" style="width:18em;padding:4px 8px;"><?php echo $key; ?></td>
383 - <td scope="row" style="padding:4px 8px;"><?php echo $value; ?></td>
397 + <td scope="row" style="width:18em;padding:4px 8px;"><?php echo esc_html( $key ); ?></td>
398 + <td scope="row" style="padding:4px 8px;"><?php echo esc_html( $value ); ?></td>
384 399 </tr>
385 400 <?php
386 401 }
387 402 }