validate_file [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
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.
Source
<?php
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;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- WordPress › Support » Cannot redeclare validate_file()?
Fatal error: Cannot redeclare validate_file() (previously declared in /home/ cmwong/domains/wetcalamari.net/public_html/wp-includes/functions.php:2238) in ...
wordpress.org - Data Validation « WordPress Codex
validate_file( (string) $filename, (array) $allowed_files = "" ): Used to prevent directory traversal attacks, or to test a filename against a whitelist. Returns 0 if ...
codex.wordpress.org - ValidateFile Method (C++)
Public Function ValidateFile( _ ByVal pIVCProject As Object, _ ByVal bstrName As String, _ Optional ByVal eFileType As vsCMValidateFileExtention ...
msdn.microsoft.com - Class: Nokogiri::XML::Schema — Documentation for tenderlove ...
(Object) validate_file(filename) ... thing) validate_file(thing) else raise ArgumentError, "Must provide Nokogiri::Xml::Document or the name of an existing file" end ...
rdoc.info