protected function isValidFilename($filename)
    {
        $extension = strtolower(File::get_file_extension($filename));

        // Validate true if within the list of allowed extensions
        $allowed = $this->getAllowedExtensions();
        if ($allowed) {
            return in_array($extension, $allowed);
        }

        // If no extensions are configured, fallback to global list
        $globalList = File::getAllowedExtensions();
        if (in_array($extension, $globalList)) {
            return true;
        }

        // Only admins can bypass global rules
        return !File::config()->apply_restrictions_to_admin && Permission::check('ADMIN');
    }
protected function isValidFilename($filename)
    {
        $extension = strtolower(File::get_file_extension($filename));

        // Validate true if within the list of allowed extensions
        $allowed = $this->getAllowedExtensions();
        if ($allowed) {
            return in_array($extension, $allowed);
        }

        // If no extensions are configured, fallback to global list
        $globalList = File::getAllowedExtensions();
        if (in_array($extension, $globalList)) {
            return true;
        }

        // Only admins can bypass global rules
        return !File::config()->apply_restrictions_to_admin && Permission::check('ADMIN');
    }
protected function isValidFilename ( $ filename ) { $ extension = strtolower ( File :: get_file_extension ( $ filename ) ) ; // Validate true if within the list of allowed extensions $ allowed = $ this -> getAllowedExtensions ( ) ; if ( $ allowed ) { return in_array ( $ extension , $ allowed ) ; } // If no extensions are configured, fallback to global list $ globalList = File :: getAllowedExtensions ( ) ; if ( in_array ( $ extension , $ globalList ) ) { return true ; } // Only admins can bypass global rules return ! File :: config ( ) -> apply_restrictions_to_admin && Permission :: check ( 'ADMIN' ) ; }
Validate that this DBFile accepts this filename as valid

@param string $filename
@throws ValidationException
@return bool
Validate that this DBFile accepts this filename as valid