Skip to content

Commit

Permalink
Escape hyphen in regex. Props chrisbliss18. fixes #8548 #9244 for 2.7
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/branches/2.7@10677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Mar 1, 2009
1 parent b872682 commit 49d30a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wp-includes/theme.php
Expand Up @@ -849,15 +849,15 @@ function preview_theme() {
if ( !current_user_can( 'switch_themes' ) )
return;

$_GET['template'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['template']);
$_GET['template'] = preg_replace('|[^a-z0-9_.\-/]|i', '', $_GET['template']);

if ( validate_file($_GET['template']) )
return;

add_filter('template', create_function('', "return '{$_GET['template']}';") );

if ( isset($_GET['stylesheet']) ) {
$_GET['stylesheet'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['stylesheet']);
$_GET['stylesheet'] = preg_replace('|[^a-z0-9_.\-/]|i', '', $_GET['stylesheet']);
if ( validate_file($_GET['stylesheet']) )
return;
add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
Expand Down

0 comments on commit 49d30a5

Please sign in to comment.