WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/12/2008 11:51:54 PM (14 years ago)
Author:
ryan
Message:

Add some page template validation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r7884 r7921  
    17501750}
    17511751
     1752function validate_file( $file, $allowed_files = '' ) {
     1753    if ( false !== strpos( $file, '..' ))
     1754        return 1;
     1755
     1756    if ( false !== strpos( $file, './' ))
     1757        return 1;
     1758
     1759    if (':' == substr( $file, 1, 1 ))
     1760        return 2;
     1761
     1762    if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
     1763        return 3;
     1764
     1765    return 0;
     1766}
     1767
    17521768?>
Note: See TracChangeset for help on using the changeset viewer.