- fixed vulnerabilities reported by Sucuri;

This commit is contained in:
nikitasinelnikov
2019-05-08 12:51:55 +03:00
parent 96c6937775
commit f5752e9248
5 changed files with 40 additions and 8 deletions
+23
View File
@@ -20,6 +20,29 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
function __construct() {
$this->regex_safe = '/\A[\w\-\.]+\z/';
$this->regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
add_filter( 'um_user_pre_updating_files_array', array( $this, 'validate_files' ) );
}
/**
* Validate files before upload
*
* @param $files
*
* @return mixed
*/
function validate_files( $files ) {
if ( ! empty( $files ) ) {
foreach ( $files as $key => $filename ) {
if ( validate_file( $filename ) !== 0 ) {
unset( $files[ $key ] );
}
}
}
return $files;
}