Changeset 1294

Show
Ignore:
Timestamp:
05/16/08 12:33:45 (7 months ago)
Author:
donncha
Message:

WP Merge, page template validation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/includes/file.php

    r1260 r1294  
    5555 
    5656        return '/tmp/'; 
    57 } 
    58  
    59 function validate_file( $file, $allowed_files = '' ) { 
    60         if ( false !== strpos( $file, '..' )) 
    61                 return 1; 
    62  
    63         if ( false !== strpos( $file, './' )) 
    64                 return 1; 
    65  
    66         if (':' == substr( $file, 1, 1 )) 
    67                 return 2; 
    68  
    69         if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) ) 
    70                 return 3; 
    71  
    72         return 0; 
    7357} 
    7458 
  • trunk/wp-includes/functions.php

    r1280 r1294  
    17631763} 
    17641764 
     1765function validate_file( $file, $allowed_files = '' ) { 
     1766        if ( false !== strpos( $file, '..' )) 
     1767                return 1; 
     1768 
     1769        if ( false !== strpos( $file, './' )) 
     1770                return 1; 
     1771 
     1772        if (':' == substr( $file, 1, 1 )) 
     1773                return 2; 
     1774 
     1775        if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) ) 
     1776                return 3; 
     1777 
     1778        return 0; 
     1779} 
     1780 
    17651781?> 
  • trunk/wp-includes/theme.php

    r1260 r1294  
    420420                $template = ''; 
    421421 
    422         if ( !empty($template) && file_exists(TEMPLATEPATH . "/$template") ) 
     422        if ( !empty($template) && !validate_file($template) && file_exists(TEMPLATEPATH . "/$template") ) 
    423423                $template = TEMPLATEPATH . "/$template"; 
    424424        elseif ( file_exists(TEMPLATEPATH . "/page.php") )