関数 validate_file()
定義ファイル :/blog/wp-includes/functions.php 17
validate_file()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /** * File validates against allowed set of defined rules. * * A return value of '1' means that the $file contains either '..' or './'. A * return value of '2' means that the $file contains ':' after the first * character. A return value of '3' means that the file is not in the allowed * files list. * * @since 1.2.0 * * @param string $file File path. * @param array $allowed_files List of allowed files. * @return int 0 means nothing is wrong, greater than 0 means something was wrong. */ function validate_file( $file, $allowed_files = '' ) { if ( false !== strpos( $file, '..' ) ) return 1; if ( false !== strpos( $file, './' ) ) return 1; if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) ) return 3; if (':' == substr( $file, 1, 1 ) ) return 2; return 0; } |