Add some page template validation
git-svn-id: http://svn.automattic.com/wordpress/trunk@7921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1749,4 +1749,20 @@ function apache_mod_loaded($mod, $default = false) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
function validate_file( $file, $allowed_files = '' ) {
|
||||
if ( false !== strpos( $file, '..' ))
|
||||
return 1;
|
||||
|
||||
if ( false !== strpos( $file, './' ))
|
||||
return 1;
|
||||
|
||||
if (':' == substr( $file, 1, 1 ))
|
||||
return 2;
|
||||
|
||||
if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user