From 8accd7728a8938333de6a182f9a41ffeeb38a39e Mon Sep 17 00:00:00 2001 From: stodorovic Date: Fri, 8 Dec 2017 22:39:41 +0100 Subject: [PATCH 1/3] Improve wp-cache config functions --- wp-cache-config-sample.php | 32 ++++++++++++++++---------------- wp-cache-phase2.php | 19 ++++++++++++++----- wp-cache.php | 13 +++++++------ 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/wp-cache-config-sample.php b/wp-cache-config-sample.php index f943169c..bb8802a7 100644 --- a/wp-cache-config-sample.php +++ b/wp-cache-config-sample.php @@ -5,13 +5,14 @@ See wp-cache.php for author details. */ -if ( ! defined('WPCACHEHOME') ) +if ( ! defined( 'WPCACHEHOME' ) ) { define( 'WPCACHEHOME', WP_PLUGIN_DIR . '/wp-super-cache/' ); +} $cache_compression = 0; // Super cache compression $cache_enabled = false; $super_cache_enabled = true; -$cache_max_time = 3600; //in seconds +$cache_max_time = 3600; // in seconds //$use_flock = true; // Set it true or false if you know what to use $cache_path = WP_CONTENT_DIR . '/cache/'; $file_prefix = 'wp-cache-'; @@ -20,8 +21,8 @@ // Array of files that have 'wp-' but should still be cached $cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' ); -$cache_rejected_uri = array('wp-.*\\.php', 'index\\.php'); -$cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider', 5 => 'Yandex' ); +$cache_rejected_uri = array( 0 => 'wp-.*\\.php', 1 => 'index\\.php' ); +$cache_rejected_user_agent = array( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider', 5 => 'Yandex' ); $cache_rebuild_files = 1; @@ -33,7 +34,7 @@ // Just modify it if you have conflicts with semaphores $sem_id = 5419; -if ( '/' != substr($cache_path, -1)) { +if ( '/' != substr( $cache_path, -1 ) ) { $cache_path .= '/'; } @@ -63,16 +64,16 @@ $wp_cache_debug_ip = ''; $wp_cache_debug_log = ''; $wp_cache_debug_email = ''; -$wp_cache_pages[ "search" ] = 0; -$wp_cache_pages[ "feed" ] = 0; -$wp_cache_pages[ "category" ] = 0; -$wp_cache_pages[ "home" ] = 0; -$wp_cache_pages[ "frontpage" ] = 0; -$wp_cache_pages[ "tag" ] = 0; -$wp_cache_pages[ "archives" ] = 0; -$wp_cache_pages[ "pages" ] = 0; -$wp_cache_pages[ "single" ] = 0; -$wp_cache_pages[ "author" ] = 0; +$wp_cache_pages['search'] = 0; +$wp_cache_pages['feed'] = 0; +$wp_cache_pages['category'] = 0; +$wp_cache_pages['home'] = 0; +$wp_cache_pages['frontpage'] = 0; +$wp_cache_pages['tag'] = 0; +$wp_cache_pages['archives'] = 0; +$wp_cache_pages['pages'] = 0; +$wp_cache_pages['single'] = 0; +$wp_cache_pages['author'] = 0; $wp_cache_hide_donation = 0; $wp_cache_not_logged_in = 0; $wp_cache_clear_on_post_edit = 0; @@ -102,4 +103,3 @@ $wpsc_save_headers = 0; $cache_schedule_interval = 'daily'; $wp_super_cache_comments = 1; -?> diff --git a/wp-cache-phase2.php b/wp-cache-phase2.php index da6b2696..5972c0fc 100644 --- a/wp-cache-phase2.php +++ b/wp-cache-phase2.php @@ -1081,15 +1081,24 @@ function wp_cache_replace_line( $old, $new, $my_file ) { } } } else { - $done = false; + $done = false; + $state = false; foreach( (array) $lines as $line ) { - if ( $done || ! preg_match( '/^(if\ \(\ \!\ )?define|\$|\?>/', $line ) ) { - fputs($fd, $line); - } else { + + if ( false !== strpos( $line, '{' ) ) { + $state = true; + } + + // Insert new line before first variable. + if ( ! $done && ! $state && preg_match( '/^\s*\$/', $line ) ) { fputs($fd, "$new\n"); - fputs($fd, $line); $done = true; } + fputs($fd, $line); + + if ( false !== strpos( $line, '}' ) ) { + $state = false; + } } } fclose( $fd ); diff --git a/wp-cache.php b/wp-cache.php index 034927a4..914245c2 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -1850,14 +1850,15 @@ function wp_cache_update_rejected_pages() { global $wp_cache_config_file, $valid_nonce, $wp_cache_pages; if ( isset( $_POST[ 'wp_edit_rejected_pages' ] ) && $valid_nonce ) { + $pages = array( 'single', 'pages', 'archives', 'tag', 'frontpage', 'home', 'category', 'feed', 'author', 'search' ); foreach( $pages as $page ) { - if ( isset( $_POST[ 'wp_cache_pages' ][ $page ] ) ) { - $value = 1; - } else { - $value = 0; - } - wp_cache_replace_line('^ *\$wp_cache_pages\[ "' . $page . '" \]', "\$wp_cache_pages[ \"{$page}\" ] = $value;", $wp_cache_config_file); + $value = empty( $_POST['wp_cache_pages'][ $page ] ) ? 0 : 1; + + $page_regexp = '\s*(' . preg_quote( "'" . $page . "'" ) . '|' . preg_quote( '"' . $page . '"' ) . ')\s*'; + $line_regexp = '^\s*' . preg_quote( '$wp_cache_pages[' ) . $page_regexp . preg_quote( ']' ); + wp_cache_replace_line( $line_regexp, '$wp_cache_pages[\''.$page.'\'] = ' . $value . ';', $wp_cache_config_file ); + $wp_cache_pages[ $page ] = $value; } } From 30cc2689ae09af1ed6f1a0360d3f8222ae318fe6 Mon Sep 17 00:00:00 2001 From: stodorovic Date: Sat, 9 Dec 2017 15:47:13 +0100 Subject: [PATCH 2/3] Introduce wpsc_var_dump, improve arrays in config file --- wp-cache-config-sample.php | 4 ++-- wp-cache-phase2.php | 48 +++++++++++++++++++++++++++++--------- wp-cache.php | 46 +++++++++++++++++++----------------- 3 files changed, 63 insertions(+), 35 deletions(-) diff --git a/wp-cache-config-sample.php b/wp-cache-config-sample.php index bb8802a7..53862716 100644 --- a/wp-cache-config-sample.php +++ b/wp-cache-config-sample.php @@ -21,8 +21,8 @@ // Array of files that have 'wp-' but should still be cached $cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' ); -$cache_rejected_uri = array( 0 => 'wp-.*\\.php', 1 => 'index\\.php' ); -$cache_rejected_user_agent = array( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider', 5 => 'Yandex' ); +$cache_rejected_uri = array( 'wp-.*\\.php', 'index\\.php' ); +$cache_rejected_user_agent = array( 'bot', 'ia_archive', 'slurp', 'crawl', 'spider', 'Yandex' ); $cache_rebuild_files = 1; diff --git a/wp-cache-phase2.php b/wp-cache-phase2.php index 5972c0fc..112678c3 100644 --- a/wp-cache-phase2.php +++ b/wp-cache-phase2.php @@ -1019,18 +1019,37 @@ function is_writeable_ACLSafe( $path ) { return true; } +function wpsc_var_dump( $var ) { + + switch ( gettype( $var ) ) { + case 'boolean': + $output = $var ? 'true' : 'false'; + break; + case 'double': + case 'integer': + $output = strval( $var ); + break; + case 'string': + $output = "'" . addslashes($var) . "'"; + break; + case 'array': + $output = implode( ', ', array_map( 'wpsc_var_dump', $var ) ); + $output = empty( $output ) ? 'array()' : 'array( ' . $output . ' )'; + break; + default: + $output = str_replace( PHP_EOL, ' ', var_export( $var, true ) ); + } + + return $output; +} + function wp_cache_setting( $field, $value ) { global $wp_cache_config_file; - $GLOBALS[ $field ] = $value; - if ( is_numeric( $value ) ) { - wp_cache_replace_line( '^ *\$' . $field, "\$$field = $value;", $wp_cache_config_file ); - } elseif ( is_object( $value ) || is_array( $value ) ) { - $text = var_export( $value, true ); - $text = preg_replace( '/[\s]+/', ' ', $text ); - wp_cache_replace_line( '^ *\$' . $field, "\$$field = $text;", $wp_cache_config_file ); - } else { - wp_cache_replace_line( '^ *\$' . $field, "\$$field = '$value';", $wp_cache_config_file ); + if ( $value !== $GLOBALS[ $field ] ) { + $new_value = '$' . $field . ' = ' . wpsc_var_dump( $value ) . ';'; + wp_cache_replace_line( '^\s*\$' . $field, $new_value , $wp_cache_config_file ); + $GLOBALS[ $field ] = $value; } } @@ -1081,6 +1100,13 @@ function wp_cache_replace_line( $old, $new, $my_file ) { } } } else { + $reg_exps = array( '/^\s*define\s*\(/', '/^\s*\$/' ); + foreach( $reg_exps as $reg_exp ) { + if ( preg_match( $reg_exp, $new ) ) { + break; + } + } + $done = false; $state = false; foreach( (array) $lines as $line ) { @@ -1089,8 +1115,8 @@ function wp_cache_replace_line( $old, $new, $my_file ) { $state = true; } - // Insert new line before first variable. - if ( ! $done && ! $state && preg_match( '/^\s*\$/', $line ) ) { + // Insert new line before first variable/constant. + if ( ! $done && ! $state && preg_match( $reg_exp, $line ) ) { fputs($fd, "$new\n"); $done = true; } diff --git a/wp-cache.php b/wp-cache.php index 914245c2..f03b2256 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -1810,18 +1810,14 @@ function apache_request_headers() { } function wp_cache_update_rejected_ua() { - global $cache_rejected_user_agent, $wp_cache_config_file, $valid_nonce; if ( !function_exists( 'apache_request_headers' ) ) return; - if ( isset( $_POST[ 'wp_rejected_user_agent' ] ) && $valid_nonce ) { - $_POST[ 'wp_rejected_user_agent' ] = str_replace( ' ', '___', $_POST[ 'wp_rejected_user_agent' ] ); - $text = str_replace( '___', ' ', wp_cache_sanitize_value( $_POST[ 'wp_rejected_user_agent' ], $cache_rejected_user_agent ) ); - wp_cache_replace_line( '^ *\$cache_rejected_user_agent', "\$cache_rejected_user_agent = $text;", $wp_cache_config_file ); - foreach( $cache_rejected_user_agent as $k => $ua ) { - $cache_rejected_user_agent[ $k ] = str_replace( '___', ' ', $ua ); - } - reset( $cache_rejected_user_agent ); + if ( isset( $_POST['wp_rejected_user_agent'] ) ) { + check_admin_referer( 'wp-cache' ); + + $array = array_filter( preg_split( "/[\r\n,]+/", stripslashes( $_POST['wp_rejected_user_agent'] ) ) ); + wp_cache_setting( 'cache_rejected_user_agent', $array ); } } @@ -1837,7 +1833,7 @@ function wp_cache_edit_rejected_ua() { echo '
'; echo ' '; echo '
'; @@ -1853,11 +1849,15 @@ function wp_cache_update_rejected_pages() { $pages = array( 'single', 'pages', 'archives', 'tag', 'frontpage', 'home', 'category', 'feed', 'author', 'search' ); foreach( $pages as $page ) { + $value = empty( $_POST['wp_cache_pages'][ $page ] ) ? 0 : 1; + if ( $value === $wp_cache_pages[ $page ] ) { + continue; + } $page_regexp = '\s*(' . preg_quote( "'" . $page . "'" ) . '|' . preg_quote( '"' . $page . '"' ) . ')\s*'; - $line_regexp = '^\s*' . preg_quote( '$wp_cache_pages[' ) . $page_regexp . preg_quote( ']' ); - wp_cache_replace_line( $line_regexp, '$wp_cache_pages[\''.$page.'\'] = ' . $value . ';', $wp_cache_config_file ); + $new_value = '$wp_cache_pages[' . wpsc_var_dump( $page ) . '] = ' . wpsc_var_dump( $value ) . ';'; + wp_cache_replace_line( '^\s*\$wp_cache_pages\[' . $page_regexp . '\]', $new_value, $wp_cache_config_file ); $wp_cache_pages[ $page ] = $value; } @@ -1891,11 +1891,12 @@ function wp_cache_edit_rejected_pages() { } function wp_cache_update_rejected_strings() { - global $cache_rejected_uri, $wp_cache_config_file, $valid_nonce; - if ( isset($_REQUEST['wp_rejected_uri']) && $valid_nonce ) { - $text = wp_cache_sanitize_value( str_replace( '\\\\', '\\', $_REQUEST['wp_rejected_uri'] ), $cache_rejected_uri ); - wp_cache_replace_line('^ *\$cache_rejected_uri', "\$cache_rejected_uri = $text;", $wp_cache_config_file); + if ( isset( $_POST['wp_rejected_uri'] ) ) { + check_admin_referer( 'wp-cache' ); + + $array = array_filter( preg_split( '/[\s,]+/', stripslashes( $_POST['wp_rejected_uri'] ) ) ); + wp_cache_setting( 'cache_rejected_uri', $array ); } } @@ -1910,7 +1911,7 @@ function wp_cache_edit_rejected() { echo "

" . __( 'Add here strings (not a filename) that forces a page not to be cached. For example, if your URLs include year and you dont want to cache last year posts, it’s enough to specify the year, i.e. ’/2004/’. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.', 'wp-super-cache' ) . "

\n"; echo ' '; echo '
'; @@ -1919,11 +1920,12 @@ function wp_cache_edit_rejected() { } function wp_cache_update_accepted_strings() { - global $cache_acceptable_files, $wp_cache_config_file, $valid_nonce; - if ( isset( $_REQUEST[ 'wp_accepted_files' ] ) && $valid_nonce ) { - $text = wp_cache_sanitize_value( $_REQUEST[ 'wp_accepted_files' ], $cache_acceptable_files ); - wp_cache_replace_line( '^ *\$cache_acceptable_files', "\$cache_acceptable_files = $text;", $wp_cache_config_file ); + if ( isset( $_POST['wp_accepted_files'] ) ) { + check_admin_referer( 'wp-cache' ); + + $array = array_filter( preg_split( '/[\s,]+/', stripslashes( $_POST['wp_accepted_files'] ) ) ); + wp_cache_setting( 'cache_acceptable_files', $array ); } } @@ -1937,7 +1939,7 @@ function wp_cache_edit_accepted() { echo "

" . __( 'Add here those filenames that can be cached, even if they match one of the rejected substring specified above.', 'wp-super-cache' ) . "

\n"; echo ' '; echo '
'; From 883b38336d207ef275e29ececbeeb7bae205a65e Mon Sep 17 00:00:00 2001 From: stodorovic Date: Mon, 11 Dec 2017 16:23:10 +0100 Subject: [PATCH 3/3] Optimize wpsc_var_export, some fixes --- wp-cache-phase2.php | 35 +++++++++++----------------- wp-cache.php | 56 ++++++++++++++++++++++++--------------------- 2 files changed, 43 insertions(+), 48 deletions(-) diff --git a/wp-cache-phase2.php b/wp-cache-phase2.php index 112678c3..cdc1eda1 100644 --- a/wp-cache-phase2.php +++ b/wp-cache-phase2.php @@ -1019,36 +1019,27 @@ function is_writeable_ACLSafe( $path ) { return true; } -function wpsc_var_dump( $var ) { +function wpsc_var_export( $var ) { - switch ( gettype( $var ) ) { - case 'boolean': - $output = $var ? 'true' : 'false'; - break; - case 'double': - case 'integer': - $output = strval( $var ); - break; - case 'string': - $output = "'" . addslashes($var) . "'"; - break; - case 'array': - $output = implode( ', ', array_map( 'wpsc_var_dump', $var ) ); - $output = empty( $output ) ? 'array()' : 'array( ' . $output . ' )'; - break; - default: - $output = str_replace( PHP_EOL, ' ', var_export( $var, true ) ); + if ( is_string( $var ) ) { + return "'" . addslashes($var) . "'"; + } + elseif ( is_numeric( $var ) ) { + return strval( $var ); + } + elseif ( is_array( $var ) ) { + $str = implode( ', ', array_map( 'wpsc_var_export', $var ) ); + return empty( $str ) ? 'array()' : 'array( ' . $str . ' )'; } - return $output; + return str_replace( PHP_EOL, ' ', var_export( $var, true ) ); } function wp_cache_setting( $field, $value ) { - global $wp_cache_config_file; if ( $value !== $GLOBALS[ $field ] ) { - $new_value = '$' . $field . ' = ' . wpsc_var_dump( $value ) . ';'; - wp_cache_replace_line( '^\s*\$' . $field, $new_value , $wp_cache_config_file ); + $new_value = '$' . $field . ' = ' . wpsc_var_export( $value ) . ';'; + wp_cache_replace_line( '^\s*\$' . $field . '\s*=', $new_value , $GLOBALS['wp_cache_config_file'] ); $GLOBALS[ $field ] = $value; } } diff --git a/wp-cache.php b/wp-cache.php index f03b2256..4f43286a 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -1443,7 +1443,7 @@ function wp_update_lock_down() { if ( isset( $_POST[ 'wp_lock_down' ] ) && $valid_nonce ) { $wp_lock_down = $_POST[ 'wp_lock_down' ] == '1' ? '1' : '0'; - wp_cache_replace_line( '^.*WPLOCKDOWN', "if ( ! defined( 'WPLOCKDOWN' ) ) define( 'WPLOCKDOWN', '$wp_lock_down' );", $wp_cache_config_file ); + wp_cache_replace_line( '^.*WPLOCKDOWN', "defined( 'WPLOCKDOWN' ) && define( 'WPLOCKDOWN', '$wp_lock_down' );", $wp_cache_config_file ); if ( false == defined( 'WPLOCKDOWN' ) ) define( 'WPLOCKDOWN', $wp_lock_down ); if ( $wp_lock_down == '0' && function_exists( 'prune_super_cache' ) ) @@ -1707,7 +1707,7 @@ function wp_cache_time_update() { } function wp_cache_edit_max_time() { - global $cache_max_time, $wp_cache_config_file, $valid_nonce, $super_cache_enabled, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me, $wp_cache_preload_on; + global $cache_max_time, $super_cache_enabled, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me, $wp_cache_preload_on; $timezone_format = _x('Y-m-d G:i:s', 'timezone date format'); @@ -1787,6 +1787,11 @@ function wp_cache_edit_max_time() { } function wp_cache_sanitize_value($text, & $array) { + + if ( function_exists( '_deprecated_function' ) ) { + _deprecated_function( __FUNCTION__, 'WP Super Cache 1.5.9' ); + } + $text = esc_html(strip_tags($text)); $array = preg_split("/[\s,]+/", chop($text)); $text = var_export($array, true); @@ -1813,16 +1818,16 @@ function wp_cache_update_rejected_ua() { if ( !function_exists( 'apache_request_headers' ) ) return; - if ( isset( $_POST['wp_rejected_user_agent'] ) ) { - check_admin_referer( 'wp-cache' ); - - $array = array_filter( preg_split( "/[\r\n,]+/", stripslashes( $_POST['wp_rejected_user_agent'] ) ) ); + if ( isset( $_POST['wp_rejected_user_agent'], $_POST['_wpnonce'] ) + && wp_verify_nonce( $_POST['_wpnonce'], 'wp-cache' ) + ) { + $array = preg_split( "/[\r\n,]+/", stripslashes( $_POST['wp_rejected_user_agent'] ) ); + $array = array_map( 'trim', array_filter( $array ) ); wp_cache_setting( 'cache_rejected_user_agent', $array ); } } function wp_cache_edit_rejected_ua() { - global $cache_rejected_user_agent, $wp_cache_config_file, $valid_nonce; if ( !function_exists( 'apache_request_headers' ) ) return; @@ -1832,7 +1837,7 @@ function wp_cache_edit_rejected_ua() { echo "

" . __( 'Strings in the HTTP ’User Agent’ header that prevent WP-Cache from caching bot, spiders, and crawlers’ requests. Note that super cached files are still sent to these agents if they already exists.', 'wp-super-cache' ) . "

\n"; echo ''; echo ' '; @@ -1843,29 +1848,29 @@ function wp_cache_edit_rejected_ua() { } function wp_cache_update_rejected_pages() { - global $wp_cache_config_file, $valid_nonce, $wp_cache_pages; - - if ( isset( $_POST[ 'wp_edit_rejected_pages' ] ) && $valid_nonce ) { + if ( isset( $_POST['wp_edit_rejected_pages'], $_POST['_wpnonce'] ) + && wp_verify_nonce( $_POST['_wpnonce'], 'wp-cache' ) + ) { $pages = array( 'single', 'pages', 'archives', 'tag', 'frontpage', 'home', 'category', 'feed', 'author', 'search' ); foreach( $pages as $page ) { $value = empty( $_POST['wp_cache_pages'][ $page ] ) ? 0 : 1; - if ( $value === $wp_cache_pages[ $page ] ) { + if ( $value === $GLOBALS['wp_cache_pages'][ $page ] ) { continue; } $page_regexp = '\s*(' . preg_quote( "'" . $page . "'" ) . '|' . preg_quote( '"' . $page . '"' ) . ')\s*'; - $new_value = '$wp_cache_pages[' . wpsc_var_dump( $page ) . '] = ' . wpsc_var_dump( $value ) . ';'; - wp_cache_replace_line( '^\s*\$wp_cache_pages\[' . $page_regexp . '\]', $new_value, $wp_cache_config_file ); + $new_value = '$wp_cache_pages[' . wpsc_var_export( $page ) . '] = ' . wpsc_var_export( $value ) . ';'; + wp_cache_replace_line( '^\s*\$wp_cache_pages\[' . $page_regexp . '\]', $new_value, $GLOBALS['wp_cache_config_file'] ); - $wp_cache_pages[ $page ] = $value; + $GLOBALS['wp_cache_pages'][ $page ] = $value; } } } function wp_cache_edit_rejected_pages() { - global $wp_cache_config_file, $valid_nonce, $wp_cache_pages; + global $wp_cache_pages; wp_cache_update_rejected_pages(); @@ -1892,9 +1897,9 @@ function wp_cache_edit_rejected_pages() { function wp_cache_update_rejected_strings() { - if ( isset( $_POST['wp_rejected_uri'] ) ) { - check_admin_referer( 'wp-cache' ); - + if ( isset( $_POST['wp_rejected_uri'], $_POST['_wpnonce'] ) + && wp_verify_nonce( $_POST['_wpnonce'], 'wp-cache' ) + ) { $array = array_filter( preg_split( '/[\s,]+/', stripslashes( $_POST['wp_rejected_uri'] ) ) ); wp_cache_setting( 'cache_rejected_uri', $array ); } @@ -1902,7 +1907,6 @@ function wp_cache_update_rejected_strings() { } function wp_cache_edit_rejected() { - global $cache_rejected_uri; wp_cache_update_rejected_strings(); @@ -1910,7 +1914,7 @@ function wp_cache_edit_rejected() { echo ''; echo "

" . __( 'Add here strings (not a filename) that forces a page not to be cached. For example, if your URLs include year and you dont want to cache last year posts, it’s enough to specify the year, i.e. ’/2004/’. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.', 'wp-super-cache' ) . "

\n"; echo ' '; @@ -1921,9 +1925,9 @@ function wp_cache_edit_rejected() { function wp_cache_update_accepted_strings() { - if ( isset( $_POST['wp_accepted_files'] ) ) { - check_admin_referer( 'wp-cache' ); - + if ( isset( $_POST['wp_accepted_files'], $_POST['_wpnonce'] ) + && wp_verify_nonce( $_POST['_wpnonce'], 'wp-cache' ) + ) { $array = array_filter( preg_split( '/[\s,]+/', stripslashes( $_POST['wp_accepted_files'] ) ) ); wp_cache_setting( 'cache_acceptable_files', $array ); } @@ -1948,7 +1952,7 @@ function wp_cache_edit_accepted() { } function wpsc_update_debug_settings() { - global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments; + global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_super_cache_comments; global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug; global $wp_cache_debug_username; @@ -2021,7 +2025,7 @@ function wpsc_update_debug_settings() { } function wp_cache_debug_settings() { - global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments; + global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $wp_super_cache_comments; global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug; global $wp_cache_debug_username;