Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -8,33 +8,38 @@
|
||||
* @since 07 May 2013
|
||||
*/
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\File;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
|
||||
define('REPORT_EXCEPTIONS', TRUE);
|
||||
require_once str_replace( 'applications/core/interface/file/index.php', '', str_replace( '\\', '/', __FILE__ ) ) . 'init.php';
|
||||
|
||||
try
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->id ) and isset( \IPS\Request::i()->salt ) )
|
||||
if ( isset( Request::i()->id ) and isset( Request::i()->salt ) )
|
||||
{
|
||||
$where = array( 'id=? AND salt=?', \IPS\Request::i()->id, \IPS\Request::i()->salt );
|
||||
$where = array( 'id=? AND salt=?', Request::i()->id, Request::i()->salt );
|
||||
}
|
||||
else
|
||||
{
|
||||
$exploded = explode( '/', trim( urldecode( \IPS\Request::i()->file ), '/' ) );
|
||||
$exploded = explode( '/', trim( urldecode( Request::i()->file ), '/' ) );
|
||||
$filename = array_pop( $exploded );
|
||||
$container = implode( '/', $exploded );
|
||||
|
||||
$where = array( 'container=? AND filename=?', $container, $filename );
|
||||
}
|
||||
|
||||
$file = \IPS\Db::i()->select( '*', 'core_files', $where )->first();
|
||||
$file = Db::i()->select( '*', 'core_files', $where )->first();
|
||||
|
||||
if ( $file['id'] )
|
||||
{
|
||||
$headers = array_merge( \IPS\Output::getCacheHeaders( time(), 360 ), array( "Content-Disposition" => \IPS\Output::getContentDisposition( 'inline', $file['filename'] ), "X-Content-Type-Options" => "nosniff" ) );
|
||||
\IPS\Output::i()->sendOutput( $file['contents'], 200, \IPS\File::getMimeType( $file['filename'] ), $headers );
|
||||
$headers = array_merge( Output::getCacheHeaders( time(), 360 ), array( "Content-Disposition" => Output::getContentDisposition( 'inline', $file['filename'] ), "X-Content-Type-Options" => "nosniff" ) );
|
||||
Output::i()->sendOutput( $file['contents'], 200, File::getMimeType( $file['filename'] ), $headers );
|
||||
}
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
catch (UnderflowException $e )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( '', 404 );
|
||||
Output::i()->sendOutput( '', 404 );
|
||||
}
|
||||
Reference in new issue
Block a user