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;
|
||||
|
@ -29,7 +29,7 @@ class Input {
|
||||
} elseif ( self::file( $data ) ) {
|
||||
return true;
|
||||
} else {
|
||||
Debug::info( 'Input::exists: No input Found: '. $data );
|
||||
Debug::log( 'Input::exists: No input Found: '. $data );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -43,11 +43,11 @@ class Input {
|
||||
*/
|
||||
public static function file( $data ) {
|
||||
if ( !isset( $_FILES[$data] ) ) {
|
||||
Debug::debug( "Input - file : $data not found." );
|
||||
Debug::log( "Input - file : $data not found." );
|
||||
return false;
|
||||
}
|
||||
if ( $_FILES[$data]['tmp_name'] == '' ) {
|
||||
Debug::debug( "Input - file : $data empty." );
|
||||
Debug::log( "Input - file : $data empty." );
|
||||
return false;
|
||||
}
|
||||
return $_FILES[$data];
|
||||
|
@ -31,7 +31,7 @@ class Session {
|
||||
if ( isset( $_SESSION[ $sessionName ] ) ) {
|
||||
return true;
|
||||
}
|
||||
Debug::info( "Session::exists - Session not found: $sessionName" );
|
||||
Debug::log( "Session::exists - Session not found: $sessionName" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class Session {
|
||||
if ( self::exists( $name ) ) {
|
||||
return $_SESSION[ $sessionName ];
|
||||
}
|
||||
Debug::info( "Session::get - Session not found: $sessionName" );
|
||||
Debug::log( "Session::get - Session not found: $sessionName" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ class Session {
|
||||
}
|
||||
$sessionName = DEFAULT_SESSION_PREFIX . $name;
|
||||
$_SESSION[ $sessionName ] = $data;
|
||||
Debug::info( "Session::get - Created/Updated: $sessionName" );
|
||||
Debug::log( "Session::get - Created/Updated: $sessionName" );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ class Session {
|
||||
return false;
|
||||
}
|
||||
if ( self::exists( $name ) ) {
|
||||
Debug::info("Session::flash - Exists");
|
||||
Debug::log("Session::flash - Exists");
|
||||
$session = self::get( $name );
|
||||
self::delete( $name );
|
||||
return $session;
|
||||
@ -121,11 +121,11 @@ class Session {
|
||||
}
|
||||
if ( ! empty( $data ) ) {
|
||||
self::put( $name, $data );
|
||||
Debug::info("Session::flash - Session created.");
|
||||
Debug::log("Session::flash - Session created.");
|
||||
return true;
|
||||
}
|
||||
if ( self::exists( $name ) ) {
|
||||
Debug::info("Session::flash - Exists");
|
||||
Debug::log("Session::flash - Exists");
|
||||
$session = self::get( $name );
|
||||
self::delete( $name );
|
||||
return $session;
|
||||
|
Reference in New Issue
Block a user