Updates
Adjusted log severity Improved error reporting Improved token handling Improved Config Form handling
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user