Source for file download_file.php
Documentation is available at download_file.php
* @author xing <xing@synapse.plus.com>
* @copyright 2003-2006 bitweaver
* @license LGPL {@link http://www.gnu.org/licenses/lgpl.html}
require_once( '../kernel/setup_inc.php' );
require_once( LIBERTY_PKG_PATH. 'LibertyMime.php' );
// fetch the attachment details
if( @!BitBase::verifyId( $_REQUEST['attachment_id'] ) || !( $attachment = LibertyMime::loadAttachment( $_REQUEST['attachment_id'], $_REQUEST ))) {
$gBitSystem->fatalError( tra( "The Attachment ID given is not valid" ));
$gBitSmarty->assign( 'attachment', $attachment );
// first we need to check the permissions of the content the attachment belongs to since they inherit them
$gContent->verifyViewPermission();
$gBitSmarty->assign( 'gContent', $gContent );
if( $download_function = $gLibertySystem->getPluginFunction( $attachment['attachment_plugin_guid'], 'download_function', 'mime' )) {
if( $download_function( $attachment )) {
if( !empty( $attachment['errors'] )) {
foreach( $attachment['errors'] as $error ) {
$gBitSystem->fatalError( tra( $msg ));
$gBitSystem->fatalError( tra( 'There was an undetermined problem trying to prepare the file for download.' ));
$gBitSystem->fatalError( tra( "No suitable download function found." ));
$gBitSystem->fatalError( tra( "Object not found." ), NULL, NULL, 404 );
|