Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -11,6 +11,7 @@
|
||||
use IPS\Application;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher\External;
|
||||
use IPS\Events\Event;
|
||||
use IPS\File;
|
||||
use IPS\Login;
|
||||
use IPS\Member;
|
||||
@@ -30,6 +31,8 @@ try
|
||||
/* Init */
|
||||
$permission = FALSE;
|
||||
$loadedExtensions = array();
|
||||
$relatedItem = null;
|
||||
$extra = array();
|
||||
|
||||
/* Get attachment */
|
||||
$attachment = Db::i()->select( '*', 'core_attachments', array( 'attach_id=?', Request::i()->id ) )->first();
|
||||
@@ -55,36 +58,36 @@ try
|
||||
}
|
||||
}
|
||||
|
||||
if( $permission !== TRUE )
|
||||
foreach ( Db::i()->select( '*', 'core_attachments_map', array( 'attachment_id=?', $attachment['attach_id'] ) ) as $map )
|
||||
{
|
||||
foreach ( Db::i()->select( '*', 'core_attachments_map', array( 'attachment_id=?', $attachment['attach_id'] ) ) as $map )
|
||||
$extra = [ 'id1' => $map['id1'], 'id2' => $map['id2'], 'id3' => $map['id3'] ];
|
||||
|
||||
if ( !isset( $loadedExtensions[ $map['location_key'] ] ) )
|
||||
{
|
||||
if ( !isset( $loadedExtensions[ $map['location_key'] ] ) )
|
||||
$exploded = explode( '_', $map['location_key'] );
|
||||
try
|
||||
{
|
||||
$exploded = explode( '_', $map['location_key'] );
|
||||
try
|
||||
$extensions = Application::load( $exploded[0] )->extensions( 'core', 'EditorLocations' );
|
||||
if ( isset( $extensions[ $exploded[1] ] ) )
|
||||
{
|
||||
$extensions = Application::load( $exploded[0] )->extensions( 'core', 'EditorLocations' );
|
||||
if ( isset( $extensions[ $exploded[1] ] ) )
|
||||
{
|
||||
$loadedExtensions[ $map['location_key'] ] = $extensions[ $exploded[1] ];
|
||||
}
|
||||
$loadedExtensions[ $map['location_key'] ] = $extensions[ $exploded[1] ];
|
||||
}
|
||||
catch (OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
if ( isset( $loadedExtensions[ $map['location_key'] ] ) )
|
||||
catch (OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
if ( isset( $loadedExtensions[ $map['location_key'] ] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
$relatedItem = $loadedExtensions[ $map['location_key'] ]->attachmentLookup( $map['id1'], $map['id2'], $map['id3'] );
|
||||
if ( !$permission and $loadedExtensions[ $map['location_key'] ]->attachmentPermissionCheck( $member, $map['id1'], $map['id2'], $map['id3'], $attachment ) )
|
||||
{
|
||||
if ( $loadedExtensions[ $map['location_key'] ]->attachmentPermissionCheck( $member, $map['id1'], $map['id2'], $map['id3'], $attachment ) )
|
||||
{
|
||||
$permission = TRUE;
|
||||
break;
|
||||
}
|
||||
$permission = TRUE;
|
||||
}
|
||||
catch (OutOfRangeException $e ) { }
|
||||
}
|
||||
catch ( OutOfRangeException | LogicException $e ) { }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +104,9 @@ try
|
||||
|
||||
/* Update download counter */
|
||||
Db::i()->update( 'core_attachments', "attach_hits=attach_hits+1", array( 'attach_id=?', $attachment['attach_id'] ) );
|
||||
|
||||
/* Fire an event */
|
||||
Event::fire( 'onDownload', $file, [ $relatedItem, $extra ] );
|
||||
|
||||
/* If it's an AWS file just redirect to it */
|
||||
$file->originalFilename = $attachment['attach_file'];
|
||||
@@ -125,7 +131,7 @@ try
|
||||
$file->printFile();
|
||||
exit;
|
||||
}
|
||||
catch (UnexpectedValueException | UnderflowException | ErrorException $e )
|
||||
catch ( UnexpectedValueException | UnderflowException | ErrorException $e )
|
||||
{
|
||||
switch( get_class( $e ) )
|
||||
{
|
||||
@@ -138,6 +144,7 @@ catch (UnexpectedValueException | UnderflowException | ErrorException $e )
|
||||
break;
|
||||
|
||||
case 'ErrorException':
|
||||
default:
|
||||
$code = '2C327/1';
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user