Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -60,12 +60,12 @@ abstract class _File
|
||||
/**
|
||||
* Get class
|
||||
*
|
||||
* @param string|int $storageExtension Storage extension or configuration ID
|
||||
* @param string|\IPS\Http\Url|NULL $url URL to validate storage configs with
|
||||
* @param string|int $storageExtension Storage extension or configuration ID
|
||||
* @param bool $tryOldFirst Whether to try the old file storage config first or not
|
||||
* @throws \RuntimeException
|
||||
* @return \IPS\File
|
||||
*/
|
||||
public static function getClass( $storageExtension, $url=NULL )
|
||||
public static function getClass( $storageExtension, $tryOldFirst=FALSE )
|
||||
{
|
||||
static::getConfigurations();
|
||||
|
||||
@@ -114,8 +114,8 @@ abstract class _File
|
||||
/* We have an array of IDs when a move is in progress, the first ID is the new storage method, the second ID is the old */
|
||||
if ( is_array( $settings[ "filestorage__{$storageExtension}" ] ) )
|
||||
{
|
||||
/* Do we have a URL to check? */
|
||||
if ( $url )
|
||||
/* Do we want to use the old storage config if available? */
|
||||
if ( $tryOldFirst === TRUE )
|
||||
{
|
||||
/* We want the old storage method as we know the file is on the old server, but may not have moved to the new yet */
|
||||
$copyOfSettings = $settings["filestorage__{$storageExtension}"];
|
||||
@@ -522,13 +522,12 @@ abstract class _File
|
||||
*/
|
||||
public static function get( $storageExtension, $url )
|
||||
{
|
||||
/* Don't allow something/../../../../etc/passwd */
|
||||
if( mb_strpos( rawurldecode( $url ), '../' ) !== FALSE )
|
||||
{
|
||||
throw new \OutOfRangeException( 'INVALID_PATH' );
|
||||
}
|
||||
|
||||
$class = static::getClass( $storageExtension, $url );
|
||||
$class = static::getClass( $storageExtension, TRUE );
|
||||
$class->storageExtension = $storageExtension;
|
||||
$class->url = $url;
|
||||
$class->load();
|
||||
|
||||
Reference in new issue
Block a user