[ SYSTEM ]: Linux wordpress 6.1.0-44-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
[ SERVER ]: Apache/2.4.66 (Debian) | PHP: 8.2.30
[ USER ]: www-data | IP: 172.19.30.54
GEFORCE FILE MANAGER
/
var
/
www
/
html
/
wordpress
/
wp-content
/
plugins
/
wp-optimize
/
vendor
/
rosell-dk
/
webp-convert
/
src
/
Helpers
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
π InputValidator.php
1,788 B
SET
[ EDIT ]
|
[ DEL ]
π MimeType.php
1,249 B
SET
[ EDIT ]
|
[ DEL ]
π PathChecker.php
4,040 B
SET
[ EDIT ]
|
[ DEL ]
π Sanitize.php
715 B
SET
[ EDIT ]
|
[ DEL ]
π SanityCheck.txt
7,589 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: InputValidator.php
<?php namespace WebPConvert\Helpers; use WebPConvert\Helpers\MimeType; use WebPConvert\Helpers\PathChecker; use WebPConvert\Exceptions\InvalidInputException; use WebPConvert\Exceptions\InvalidInput\InvalidImageTypeException; /** * Functions for sanitizing. * * @package WebPConvert * @author BjΓΈrn Rosell <it@rosell.dk> * @since Class available since Release 2.0.6 */ class InputValidator { private static $allowedMimeTypes = [ 'image/jpeg', 'image/png' ]; /** * Check mimetype and if file path is ok and exists */ public static function checkMimeType($filePath, $allowedMimeTypes = null) { if (is_null($allowedMimeTypes)) { $allowedMimeTypes = self::$allowedMimeTypes; } // the following also tests that file path is ok and file exists $fileMimeType = MimeType::getMimeTypeDetectionResult($filePath); if (is_null($fileMimeType)) { throw new InvalidImageTypeException('Image type could not be detected'); } elseif ($fileMimeType === false) { throw new InvalidImageTypeException('File seems not to be an image.'); } elseif (!in_array($fileMimeType, $allowedMimeTypes)) { throw new InvalidImageTypeException('Unsupported mime type: ' . $fileMimeType); } } public static function checkSource($source) { PathChecker::checkSourcePath($source); self::checkMimeType($source); } public static function checkDestination($destination) { PathChecker::checkDestinationPath($destination); } public static function checkSourceAndDestination($source, $destination) { self::checkSource($source); self::checkDestination($destination); } }