Adjusted log severity
Improved error reporting
Improved token handling
Improved Config Form handling
This commit is contained in:
Joey Kimsey
2025-01-21 20:35:24 -05:00
parent 42ade08306
commit 3152d180c0
7 changed files with 93 additions and 65 deletions

View File

@ -100,24 +100,24 @@ class Check {
*/
public static function imageUpload( $imageName ) {
if ( !Config::getValue( 'uploads/images' ) ) {
self::addError( 'Image uploads are disabled.' );
self::addUserError( 'Image uploads are disabled.' );
return false;
}
if ( !isset( $_FILES[$imageName] ) ) {
self::addError( 'File not found.', $imageName );
self::addUserError( 'File not found.', $imageName );
return false;
}
if ( $_FILES[$imageName]['error'] != 0 ) {
self::addError( 'File error:' . $_FILES[$imageName]['error'] );
self::addUserError( 'File error:' . $_FILES[$imageName]['error'] );
return false;
}
if ( $_FILES[$imageName]['size'] > Config::getValue( 'uploads/maxImageSize' ) ) {
self::addError( 'Image is too large.' );
self::addUserError( 'Image is too large.' );
return false;
}
$fileType = strrchr( $_FILES[$imageName]['name'], '.' );
if ( !( in_array( $fileType, ALLOWED_IMAGE_UPLOAD_EXTENTIONS ) ) ) {
self::addError( 'Invalid image type', $fileType );
self::addUserError( 'Invalid image type', $fileType );
return false;
}
return true;