Ticket #9244: theme-preview-bug.diff

File theme-preview-bug.diff, 927 bytes (added by chrisbliss18, 4 years ago)
Line 
1Index: wp-includes/theme.php
2===================================================================
3--- wp-includes/theme.php       (revision 10669)
4+++ wp-includes/theme.php       (working copy)
5@@ -849,7 +849,7 @@
6        if ( !current_user_can( 'switch_themes' ) )
7                return;
8 
9-       $_GET['template'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['template']);
10+       $_GET['template'] = preg_replace('|[^a-z0-9_.\-/]|i', '', $_GET['template']);
11 
12        if ( validate_file($_GET['template']) )
13                return;
14@@ -857,7 +857,7 @@
15        add_filter('template', create_function('', "return '{$_GET['template']}';") );
16 
17        if ( isset($_GET['stylesheet']) ) {
18-               $_GET['stylesheet'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['stylesheet']);
19+               $_GET['stylesheet'] = preg_replace('|[^a-z0-9_.\-/]|i', '', $_GET['stylesheet']);
20                if ( validate_file($_GET['stylesheet']) )
21                        return;
22                add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );