summaryrefslogtreecommitdiff
path: root/download_file.php
diff options
context:
space:
mode:
authorspiderr <spider@viovio.com>2013-06-02 23:53:49 -0400
committerspiderr <spider@viovio.com>2013-06-02 23:53:49 -0400
commit57f5a3046e6dc63fd100983a19148cbc15af7bba (patch)
tree09fe55711de5c6703dff11d95e28a179d736ad0b /download_file.php
parent4bf070c4a31bcecbc45491051eebfd61e4c0ef8d (diff)
downloadliberty-57f5a3046e6dc63fd100983a19148cbc15af7bba.tar.gz
liberty-57f5a3046e6dc63fd100983a19148cbc15af7bba.tar.bz2
liberty-57f5a3046e6dc63fd100983a19148cbc15af7bba.zip
remove PEAR download for liberty download_file.php
Diffstat (limited to 'download_file.php')
-rw-r--r--download_file.php36
1 files changed, 19 insertions, 17 deletions
diff --git a/download_file.php b/download_file.php
index 6fda549..817a3a3 100644
--- a/download_file.php
+++ b/download_file.php
@@ -22,26 +22,28 @@ if( @!BitBase::verifyId( $_REQUEST['attachment_id'] ) || !( $attachment = Libert
$gBitSmarty->assign( 'attachment', $attachment );
// first we need to check the permissions of the content the attachment belongs to since they inherit them
-$gContent = LibertyBase::getLibertyObject( $attachment['content_id'] );
-$gContent->verifyViewPermission();
-$gBitSmarty->assign( 'gContent', $gContent );
+if( $gContent = LibertyBase::getLibertyObject( $attachment['content_id'] ) ) {
+ $gContent->verifyViewPermission();
+ $gBitSmarty->assign( 'gContent', $gContent );
-if( $download_function = $gLibertySystem->getPluginFunction( $attachment['attachment_plugin_guid'], 'download_function', 'mime' )) {
- if( $download_function( $attachment )) {
- LibertyMime::addDownloadHit( $attachment['attachment_id'] );
- die;
- } else {
- if( !empty( $attachment['errors'] )) {
- $msg = '';
- foreach( $attachment['errors'] as $error ) {
- $msg .= $error.'<br />';
- }
- $gBitSystem->fatalError( tra( $msg ));
+ if( $download_function = $gLibertySystem->getPluginFunction( $attachment['attachment_plugin_guid'], 'download_function', 'mime' )) {
+ if( $download_function( $attachment )) {
+ LibertyMime::addDownloadHit( $attachment['attachment_id'] );
+ die;
} else {
- $gBitSystem->fatalError( tra( 'There was an undetermined problem trying to prepare the file for download.' ));
+ if( !empty( $attachment['errors'] )) {
+ $msg = '';
+ foreach( $attachment['errors'] as $error ) {
+ $msg .= $error.'<br />';
+ }
+ $gBitSystem->fatalError( tra( $msg ));
+ } else {
+ $gBitSystem->fatalError( tra( 'There was an undetermined problem trying to prepare the file for download.' ));
+ }
}
+ } else {
+ $gBitSystem->fatalError( tra( "No suitable download function found." ));
}
} else {
- $gBitSystem->fatalError( tra( "No suitable download function found." ));
+ $gBitSystem->fatalError( tra( "Object not found." ), NULL, NULL, 404 );
}
-?>