Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -101,6 +101,24 @@ class _Database extends \IPS\File
|
||||
$this->filename = urldecode( $this->filename );
|
||||
$this->container = urldecode( $this->container );
|
||||
$this->originalFilename = urldecode( $this->originalFilename );
|
||||
|
||||
/* The URL may have been stored as //site.com/applications/core/interface/file/index.php?id=1&salt=1111 in which case the previous load()
|
||||
call wouldn't have loaded the data correctly, so we need to do it here now */
|
||||
if( isset( $this->url->queryString['id'] ) AND isset( $this->url->queryString['salt'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$record = \IPS\Db::i()->select( '*', 'core_files', array( 'id=? AND salt=?', $this->url->queryString['id'], $this->url->queryString['salt'] ) )->first();
|
||||
$this->contents = $record['contents'];
|
||||
$this->filename = $record['filename'];
|
||||
$this->originalFilename = $this->unObscureFilename( $this->filename );
|
||||
$this->container = $record['container'];
|
||||
}
|
||||
catch( \UnderflowException $ex )
|
||||
{
|
||||
throw new \RuntimeException( 'FILE_DOES_NOT_EXIST' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,12 +153,6 @@ class _Database extends \IPS\File
|
||||
{
|
||||
$salt = md5( uniqid() );
|
||||
|
||||
/* Make sure name doesn't have anything that may break URLs */
|
||||
if ( preg_match( '#[^a-zA-Z0-9!\-_\.\*\(\)]#', $this->filename ) )
|
||||
{
|
||||
$this->filename = uniqid() . '_' . preg_replace( '#[^a-zA-Z0-9!\-_\.\*\(\)]#', '', $this->filename );
|
||||
}
|
||||
|
||||
$id = \IPS\Db::i()->insert( 'core_files', array(
|
||||
'filename' => $this->filename,
|
||||
'salt' => $salt,
|
||||
|
||||
Reference in new issue
Block a user