TimeTrex/interface/send_file.php

529 lines
43 KiB
PHP

<?php
/*********************************************************************************
*
* TimeTrex is a Workforce Management program developed by
* TimeTrex Software Inc. Copyright (C) 2003 - 2021 TimeTrex Software Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by
* the Free Software Foundation with the addition of the following permission
* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
* WORK IN WHICH THE COPYRIGHT IS OWNED BY TIMETREX, TIMETREX DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
*
* You should have received a copy of the GNU Affero General Public License along
* with this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
*
* You can contact TimeTrex headquarters at Unit 22 - 2475 Dobbin Rd. Suite
* #292 West Kelowna, BC V4T 2E9, Canada or at email address info@timetrex.com.
*
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Powered by TimeTrex" logo. If the display of the logo is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Powered by TimeTrex".
*
********************************************************************************/
if ( isset( $_GET['disable_db'] ) && $_GET['disable_db'] == 1 ) {
$disable_database_connection = true;
}
require_once( '../includes/global.inc.php' );
require_once( 'PEAR.php' );
require_once( 'HTTP/Download.php' );
extract( FormVariables::GetVariables(
[
'action',
'api', //Called from JS
'object_type',
'parent_object_type_id',
'object_id',
'parent_id',
'mode',
] ) );
function getSendFileDownloadMode( $mode, $default_mode = null ) {
$mode = trim( strtolower( (string)$mode ) );
if ( $mode == '' && $default_mode != '' ) {
return $default_mode;
}
if ( $mode == 'inline' ) {
return HTTP_DOWNLOAD_INLINE;
} elseif ( $mode == 'download' ) {
return HTTP_DOWNLOAD_ATTACHMENT;
}
return HTTP_DOWNLOAD_ATTACHMENT;
}
//sendFormIFrameCall (js) passes json data
//Make sure we accept it here GovernmentDocument uses this
if ( isset( $_POST['json'] ) && $_POST['json'] != '' ) {
$json_arguments = json_decode( $_POST['json'], true );
if ( isset( $json_arguments['object_id'] ) ) {
Debug::Text( 'JSON overriding object_id...', __FILE__, __LINE__, __METHOD__, 10 );
$object_id = $json_arguments['object_id'];
}
}
if ( isset( $api ) && $api == true ) {
require_once( '../includes/API.inc.php' );
}
$object_type = strtolower( $object_type );
if ( !in_array( $object_type, [ 'primary_company_logo', 'company_logo', 'legal_entity_logo', 'invoice_config', 'copyright', 'smcopyright', 'copyright_wide' ] ) ) {
$skip_message_check = true;
require_once( Environment::getBasePath() . 'includes/Interface.inc.php' );
if ( $authentication->checkValidCSRFToken() == false ) { //Help prevent CSRF attacks with this, run this check during and before the user is logged in.
echo TTi18n::getText( 'Invalid CSRF token!' );
//Debug::writeToLog(); //Handled in TTShutdown now.
exit;
}
} elseif ( in_array( $object_type, [ 'company_logo', 'invoice_config' ] ) ) { //These require $current_user or $current_company variables to exist.
require_once( Environment::getBasePath() . 'includes/Interface.inc.php' );
}
switch ( $object_type ) {
case 'document':
Debug::Text( 'Document...', __FILE__, __LINE__, __METHOD__, 10 );
//RateLimit failed download attempts to prevent brute force.
$rl = TTNew( 'RateLimit' ); /** @var RateLimit $rl */
$rl->setID( 'document_' . Misc::getRemoteIPAddress() );
$rl->setAllowedCalls( 25 );
$rl->setTimeFrame( 900 ); //15 minutes
if ( $rl->check() == false ) {
Debug::Text( 'Excessive document download attempts... Preventing downloads from: ' . Misc::getRemoteIPAddress() . ' for up to 15 minutes...', __FILE__, __LINE__, __METHOD__, 10 );
sleep( 5 ); //Excessive download attempts, sleep longer.
} else {
if ( ( $permission->Check( 'document', 'view' ) || $permission->Check( 'document', 'view_own' ) || $permission->Check( 'document', 'view_child' ) || $permission->Check( 'document', 'view_private' ) )
|| ( isset( $parent_object_type_id ) && $parent_object_type_id == 400 //400=Expense
&& ( $permission->Check( 'expense', 'view_own' ) || $permission->Check( 'expense', 'view_child' ) || $permission->Check( 'expense', 'view' ) ) )
) {
$filter_data = [ 'filter_data' => [ 'id' => $parent_id, 'filter_items_per_page' => 1, 'filter_columns' => [ 'id' => true ] ] ];
//Don't need to pass in object_type_id filter anymore as APIDocument->getDocument() now grabs the object_type and does its own permission checks there.
//if ( isset( $parent_object_type_id ) && $parent_object_type_id != '' ) {
// $filter_data['filter_data']['object_type_id'] = $parent_object_type_id;
//}
//Make sure user has access to this document first, before checking for any revisions.
$api_f = TTNew( 'APIDocument' ); /** @var APIDocument $api_f */
$result = $api_f->stripReturnHandler( $api_f->getDocument( $filter_data ) );
if ( isset( $result[0] ) && count( $result[0] ) > 0 ) {
$document_id = TTUUID::castUUID( $result[0]['id'] );
// The attached documents to expenses all be marked as 'Private', and the regular employee no have the 'view_private' permission, so need to set the view_private to TRUE.
if ( isset( $parent_object_type_id ) && $parent_object_type_id == 400 ) {
$private_allowed = true;
} else {
$private_allowed = $permission->Check( 'document', 'view_private' );
}
$drlf = TTnew( 'DocumentRevisionListFactory' ); /** @var DocumentRevisionListFactory $drlf */
$drlf->getByCompanyIdAndIdAndDocumentIdAndPrivateAllowed( $current_company->getId(), $object_id, $document_id, $private_allowed );
Debug::Text( 'Record Count: ' . $drlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10 );
if ( $drlf->getRecordCount() == 1 ) {
$dr_obj = $drlf->getCurrent();
$file_name = $dr_obj->getStoragePath() . $dr_obj->getLocalFileName();
Debug::Text( 'File Name: ' . $file_name . ' Mime: ' . $dr_obj->getMimeType(), __FILE__, __LINE__, __METHOD__, 10 );
if ( file_exists( $file_name ) ) {
$rl->delete(); //Clear download rate limit upon successful download.
//Log document downloads in audit report, just so people can see who has viewed which revision.
//Make sure we link this to the main document_id so its viewed in the main document audit tab.
TTLog::addEntry( $document_id, 5, TTi18n::getText( 'Downloaded Revision: %1', [ $dr_obj->getRevision() ] ), null, $dr_obj->getTable(), $dr_obj );
$params['file'] = $file_name;
$params['ContentType'] = $dr_obj->getMimeType();
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_ATTACHMENT ), basename( $dr_obj->getRemoteFileName() ) ];
$params['cache'] = false;
} else {
Debug::Text( 'File does not exist... File Name: ' . $file_name . ' Mime: ' . $dr_obj->getMimeType(), __FILE__, __LINE__, __METHOD__, 10 );
}
} else {
Debug::text( 'Document Downloads Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
} else {
Debug::text( 'ERROR: User does not have access to document! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
} else {
Debug::text( 'Permissions failed!', __FILE__, __LINE__, __METHOD__, 10 );
}
}
//Debug::writeToLog(); //Write to log when downloading documents. //Handled in TTShutdown now.
break;
case 'client_payment_signature':
Debug::Text( 'Client Payment Signature...', __FILE__, __LINE__, __METHOD__, 10 );
//RateLimit failed download attempts to prevent brute force.
$rl = TTNew( 'RateLimit' ); /** @var RateLimit $rl */
$rl->setID( 'document_' . Misc::getRemoteIPAddress() );
$rl->setAllowedCalls( 25 );
$rl->setTimeFrame( 900 ); //15 minutes
if ( $rl->check() == false ) {
Debug::Text( 'Excessive document download attempts... Preventing downloads from: ' . Misc::getRemoteIPAddress() . ' for up to 15 minutes...', __FILE__, __LINE__, __METHOD__, 10 );
sleep( 5 ); //Excessive download attempts, sleep longer.
} else {
$cplf = TTnew( 'ClientPaymentListFactory' ); /** @var ClientPaymentListFactory $cplf */
$cplf->getByIdAndClientId( $object_id, $parent_id );
if ( $cplf->getRecordCount() == 1 ) {
//echo "File Name: $file_name<br>\n";
$cp_obj = $cplf->getCurrent();
$file_name = $cp_obj->getSignatureFileName();
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( file_exists( $file_name ) ) {
$rl->delete(); //Clear download rate limit upon successful download.
$params['file'] = $file_name;
$params['ContentType'] = 'image/png';
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_ATTACHMENT ), 'signature.png' ];
$params['cache'] = false;
} else {
Debug::text( 'Document Downloads Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
}
}
break;
case 'invoice_config':
Debug::Text( 'Invoice Config...', __FILE__, __LINE__, __METHOD__, 10 );
if ( isset( $current_company ) && is_object( $current_company ) ) {
$icf = TTNew( 'InvoiceConfigFactory' ); /** @var InvoiceConfigFactory $icf */
$file_name = $icf->getLogoFileName( $current_company->getId() );
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( file_exists( $file_name ) ) {
$params['file'] = $file_name;
$params['ContentType'] = Misc::getMimeType( $file_name );
//$params['ContentType'] = 'image/'. strtolower( pathinfo($file_name, PATHINFO_EXTENSION) );
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_INLINE ), basename( $file_name ) ];
$params['cache'] = true;
}
} else {
Debug::Text( 'WARNING: current_company object does not exist! Interface.inc.php not included or user is not logged in...', __FILE__, __LINE__, __METHOD__, 10 );
}
break;
case 'company_logo':
Debug::Text( 'Company Logo...', __FILE__, __LINE__, __METHOD__, 10 );
header_remove( 'Expires' ); //Allow caching.
if ( isset( $current_company ) && is_object( $current_company ) ) {
$cf = TTnew( 'CompanyFactory' ); /** @var CompanyFactory $cf */
$file_name = $cf->getLogoFileName( $current_company->getId() );
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$params['file'] = $file_name;
$params['ContentType'] = Misc::getMimeType( $file_name );
//$params['ContentType'] = 'image/'. strtolower( pathinfo($file_name, PATHINFO_EXTENSION) );
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_INLINE ), basename( $file_name ) ];
$params['cache'] = true;
}
} else {
Debug::Text( 'WARNING: current_company object does not exist! Interface.inc.php not included or user is not logged in...', __FILE__, __LINE__, __METHOD__, 10 );
}
break;
case 'legal_entity_logo':
Debug::Text( 'Legal Entity Logo [' . $object_id . ']...', __FILE__, __LINE__, __METHOD__, 10 );
header_remove( 'Expires' ); //Allow caching.
$lef = TTnew( 'LegalEntityFactory' ); /** @var LegalEntityFactory $lef */
$file_name = $lef->getLogoFileName( $object_id );
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$params['file'] = $file_name;
$params['ContentType'] = Misc::getMimeType( $file_name );
//$params['ContentType'] = 'image/'. strtolower( pathinfo($file_name, PATHINFO_EXTENSION) );
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_INLINE ), basename( $file_name ) ];
$params['cache'] = true;
}
break;
case 'primary_company_logo':
Debug::Text( 'Primary Company Logo...', __FILE__, __LINE__, __METHOD__, 10 );
header_remove( 'Expires' ); //Allow caching.
$cf = TTnew( 'CompanyFactory' ); /** @var CompanyFactory $cf */
$file_name = $cf->getLogoFileName( PRIMARY_COMPANY_ID, true, true );
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$params['file'] = $file_name;
$params['ContentType'] = Misc::getMimeType( $file_name );
//$params['ContentType'] = 'image/'. strtolower( pathinfo($file_name, PATHINFO_EXTENSION) );
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_INLINE ), basename( $file_name ) ];
$params['cache'] = true;
}
break;
case 'user_photo':
Debug::Text( 'User Photo...', __FILE__, __LINE__, __METHOD__, 10 );
//RateLimit failed download attempts to prevent brute force.
$rl = TTNew( 'RateLimit' ); /** @var RateLimit $rl */
$rl->setID( 'user_photo_' . Misc::getRemoteIPAddress() );
$rl->setAllowedCalls( 25 );
$rl->setTimeFrame( 900 ); //15 minutes
if ( $rl->check() == false ) {
Debug::Text( 'Excessive document download attempts... Preventing downloads from: ' . Misc::getRemoteIPAddress() . ' for up to 15 minutes...', __FILE__, __LINE__, __METHOD__, 10 );
sleep( 5 ); //Excessive download attempts, sleep longer.
} else {
if ( $permission->Check( 'user', 'view' )
|| $permission->Check( 'user', 'view_own' )
|| $permission->Check( 'user', 'view_child' ) ) {
$api_f = TTNew( 'APIUser' ); /** @var APIUser $api_f */
$result = $api_f->stripReturnHandler( $api_f->getUser( [ 'filter_data' => [ 'id' => $object_id ], 'filter_columns' => [ 'id' => true ] ] ) );
if ( isset( $result[0] ) && count( $result[0] ) > 0 ) {
$uf = TTnew( 'UserFactory' ); /** @var UserFactory $uf */
$file_name = $uf->getPhotoFileName( $current_company->getId(), $object_id );
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$rl->delete(); //Clear download rate limit upon successful download.
$params['file'] = $file_name;
$params['ContentType'] = Misc::getMimeType( $file_name );
//$params['ContentType'] = 'image/'. strtolower( pathinfo($file_name, PATHINFO_EXTENSION) );
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_INLINE ), basename( $file_name ) ];
$params['cache'] = true;
} else {
Debug::text( 'aPhoto Download Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
} else {
Debug::text( 'bPhoto Downloads Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
}
}
break;
case 'remittance_source_account':
Debug::Text( 'Remittance Source Account Signature...', __FILE__, __LINE__, __METHOD__, 10 );
//RateLimit failed download attempts to prevent brute force.
$rl = TTNew( 'RateLimit' ); /** @var RateLimit $rl */
$rl->setID( 'remittance_source_account_' . Misc::getRemoteIPAddress() );
$rl->setAllowedCalls( 25 );
$rl->setTimeFrame( 900 ); //15 minutes
if ( $rl->check() == false ) {
Debug::Text( 'Excessive document download attempts... Preventing downloads from: ' . Misc::getRemoteIPAddress() . ' for up to 15 minutes...', __FILE__, __LINE__, __METHOD__, 10 );
sleep( 5 ); //Excessive download attempts, sleep longer.
} else {
if ( $permission->Check( 'remittance_source_account', 'view' )
|| $permission->Check( 'remittance_source_account', 'view_own' )
|| $permission->Check( 'remittance_source_account', 'view_child' ) ) {
$api_f = TTNew( 'APIRemittanceSourceAccount' ); /** @var APIRemittanceSourceAccount $api_f */
$result = $api_f->stripReturnHandler( $api_f->getRemittanceSourceAccount( [ 'filter_data' => [ 'id' => $object_id ] ] ) );
if ( isset( $result[0] ) && count( $result[0] ) > 0 ) {
$rsaf = TTnew( 'RemittanceSourceAccountFactory' ); /** @var RemittanceSourceAccountFactory $rsaf */
$file_name = $rsaf->getSignatureFileName( $current_company->getId(), $object_id );
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$rl->delete(); //Clear download rate limit upon successful download.
$params['file'] = $file_name;
$params['ContentType'] = Misc::getMimeType( $file_name );
//$params['ContentType'] = 'image/'. strtolower( pathinfo($file_name, PATHINFO_EXTENSION) );
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_INLINE ), basename( $file_name ) ];
$params['cache'] = true;
} else {
Debug::text( 'aSignature Download Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
} else {
Debug::text( 'bSignature Downloads Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
}
}
break;
case 'government_document':
Debug::Text( 'Government Document...', __FILE__, __LINE__, __METHOD__, 10 );
//RateLimit failed download attempts to prevent brute force.
$rl = TTNew( 'RateLimit' ); /** @var RateLimit $rl */
$rl->setID( 'document_' . Misc::getRemoteIPAddress() );
$rl->setAllowedCalls( 25 );
$rl->setTimeFrame( 900 ); //15 minutes
if ( $rl->check() == false ) {
Debug::Text( 'Excessive document download attempts... Preventing downloads from: ' . Misc::getRemoteIPAddress() . ' for up to 15 minutes...', __FILE__, __LINE__, __METHOD__, 10 );
sleep( 5 ); //Excessive download attempts, sleep longer.
} else {
if ( $permission->Check( 'government_document', 'view' )
|| $permission->Check( 'government_document', 'view_own' )
|| $permission->Check( 'government_document', 'view_child' ) ) {
$api_f = TTNew( 'APIGovernmentDocument' ); /** @var APIGovernmentDocument $api_f */
$result = $api_f->stripReturnHandler( $api_f->getGovernmentDocument( [ 'filter_data' => [ 'id' => $object_id ] ] ) );
if ( isset( $result ) && is_array( $result ) && count( $result ) > 0 ) {
$rl->delete(); //Clear download rate limit upon successful download.
$files = [];
foreach ( $result as $doc ) {
$gf = TTnew( 'GovernmentDocumentFactory' ); /** @var GovernmentDocumentFactory $gf */
$file_name = $gf->getFileName( $current_company->getId(), $doc['type_id'], $doc['user_id'], $doc['id'] );
if ( $file_name != '' && file_exists( $file_name ) ) {
//Mark notifications as read if the currently logged in user is viewing their own documents one at a time.
if ( count( $result ) == 1 ) {
global $current_user;
if ( is_object( $current_user ) && $current_user->getId() == $doc['user_id'] ) {
NotificationFactory::updateStatusByObjectIdAndObjectTypeId( 60, $doc['id'], $current_user->getId() ); //60=GovernmentDocument, Mark any notifications linked to these exceptions as read.
}
}
$file = [];
$file['file_name'] = $doc['type'] . '_' . TTDate::getYear( TTDate::parseDateTime( $doc['date'] ) ) . '_' . $gf->Validator->stripNonAlphaNumeric( $doc['last_name'] ) . '_' . $gf->Validator->stripNonAlphaNumeric( $doc['first_name'] ) . '.pdf';
$file['data'] = file_get_contents( $file_name );
$file['mime_type'] = 'application/pdf';
$files[] = $file;
}
}
if ( count( $files ) > 0 ) {
$zip_file = Misc::zip( $files, false, true );
$zip_file_name = 'government_documents.zip';
if ( count( $files ) == 1 ) {
$zip_file_name = $zip_file['file_name'];
}
Misc::APIFileDownload( $zip_file_name, $zip_file['mime_type'], $zip_file['data'] );
} else {
Debug::text( 'ERROR: No file to download! File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
}
//Debug::writeToLog(); //Handled in TTShutdown now.
die();
} else {
Debug::text( 'bDocument Downloads Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
}
}
break;
case 'punch_image':
Debug::Text( 'Punch Image...', __FILE__, __LINE__, __METHOD__, 10 );
//RateLimit failed download attempts to prevent brute force.
$rl = TTNew( 'RateLimit' ); /** @var RateLimit $rl */
$rl->setID( 'punch_image_' . Misc::getRemoteIPAddress() );
$rl->setAllowedCalls( 25 );
$rl->setTimeFrame( 900 ); //15 minutes
if ( $rl->check() == false ) {
Debug::Text( 'Excessive document download attempts... Preventing downloads from: ' . Misc::getRemoteIPAddress() . ' for up to 15 minutes...', __FILE__, __LINE__, __METHOD__, 10 );
sleep( 5 ); //Excessive download attempts, sleep longer.
} else {
if ( $permission->Check( 'punch', 'view' )
|| $permission->Check( 'punch', 'view_own' )
|| $permission->Check( 'punch', 'view_child' ) ) {
$api_f = TTNew( 'APIPunch' ); /** @var APIPunch $api_f */
$result = $api_f->stripReturnHandler( $api_f->getPunch( [ 'filter_data' => [ 'id' => $object_id ] ] ) );
if ( isset( $result[0] ) && count( $result[0] ) > 0 ) {
$pf = TTnew( 'PunchFactory' ); /** @var PunchFactory $pf */
$file_name = $pf->getImageFileName( $current_company->getId(), $parent_id, $object_id );
Debug::Text( 'File Name: ' . $file_name . ' Company ID: ' . $current_company->getId() . ' User ID: ' . $parent_id, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$rl->delete(); //Clear download rate limit upon successful download.
$params['file'] = $file_name;
$params['ContentType'] = Misc::getMimeType( $file_name );
//$params['ContentType'] = 'image/'. strtolower( pathinfo($file_name, PATHINFO_EXTENSION) );
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_INLINE ), basename( $file_name ) ];
$params['cache'] = true;
} else {
Debug::text( 'aPunch image Downloads Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
} else {
Debug::text( 'bPunch image Downloads Failed! Attempt: ' . $rl->getAttempts(), __FILE__, __LINE__, __METHOD__, 10 );
sleep( ( $rl->getAttempts() * 0.5 ) );
}
}
}
break;
case 'copyright':
Debug::Text( 'Copyright Logo...', __FILE__, __LINE__, __METHOD__, 10 );
header_remove( 'Expires' ); //Allow caching.
//
//REMOVING OR CHANGING THIS LOGO IS IN STRICT VIOLATION OF THE LICENSE AGREEMENT AND COPYRIGHT LAWS.
//
if ( getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL ) {
$file_name = Environment::getImagesPath() . '/powered_by.jpg';
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$params['file'] = $file_name;
$params['ContentType'] = 'image/jpeg';
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_ATTACHMENT ), 'pro_copyright.jpg' ];
$params['data'] = file_get_contents( $file_name );
$params['cache'] = true;
}
} else {
$params['ContentType'] = 'image/jpeg';
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_ATTACHMENT ), 'copyright.jpg' ];
$params['data'] = base64_decode( '/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAA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MZF+ssn8B7HUMP7+uLTkGascbLiLO5ljxk6+SNpRr9wDSo7qAAfkK7ucHiLy/iyl1bxyZCFNkhHqahJCHshJP30t7DMcF+QVXRpe2W/jXp1WbSTeYaQ1vvOfyrVnKtSqJoSLIVprzmTwiSxyCokYhjJnMQREphAUcXmcrhLg3eIuJbe4LS0uY4glp6g/Efb31pXJYnG5iAWuUgjngDlDXgEAjuPgfsoSUbH/AGt8yjLxEZ/G8Sqgx0msOaXeSQVwobFxZKk98YPq2/fJWAHwQ0gBx9Q3TUImv2DzAN4S9pO85lynISQy3t9cSvt5BJHucoa8dHgdNw7EhR2qPteKccsWSx2dnBGydhY/a1NzD1aT12nuFQ96W42he2jD49Ocf4svFBli9lmCWGezlC3Z8WtSs6m5jniUw9afPBOrJIuIhqJFhP4yAgQoCBSgHSUnK+Ry5Rmbkvbg5aNm1su472tQjaD8EcdPmaUZxrAR412IjtIBjHu3Oj2jaXKCpHx0GvyFFXLLrwzxGlRmc5PpOBUSiwqr5aIq0DplNQh4w8m9WkXwMWqlhVBqm5fOVFTEIIE8ZzCAAIj1G5LJ3+Xu3X+TldNePTc92rigQKe6AAVIWGPssXatssfG2K0aqNb0ClSg7KStZeOmNPK//9k=' );
$params['cache'] = true;
}
break;
case 'copyright_wide':
case 'smcopyright':
Debug::Text( 'Copyright Logo...', __FILE__, __LINE__, __METHOD__, 10 );
header_remove( 'Expires' ); //Allow caching.
//
//REMOVING OR CHANGING THIS LOGO IS IN STRICT VIOLATION OF THE LICENSE AGREEMENT AND COPYRIGHT LAWS.
//
if ( getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL ) {
$file_name = Environment::getImagesPath() . '/powered_by_wide.png';
Debug::Text( 'File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10 );
if ( $file_name != '' && file_exists( $file_name ) ) {
$params['file'] = $file_name;
$params['ContentType'] = 'image/png';
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_ATTACHMENT ), 'pro_copyright_wide.png' ];
$params['data'] = file_get_contents( $file_name );
$params['cache'] = true;
}
} else {
$params['ContentType'] = 'image/png';
$params['ContentDisposition'] = [ getSendFileDownloadMode( $mode, HTTP_DOWNLOAD_ATTACHMENT ), 'copyright_wide.png' ];
$params['data'] = base64_decode( 'iVBORw0KGgoAAAANSUhEUgAAAMwAAAAiCAYAAAFkawaWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAFftJREFUeNpi/P//PwM9ABOxCk3SZ4EoYyBNnstAPqqoqPh/8uRJIPP/mcbGRjAbJAYELk+ePAHRIHVdBw8c+L99+/b/82bPBIsZp838v2DH+f8gOqZ1LZj++PUHmIaJXXvwGqyGERZ0lZWVWB1SV1f3n5OTkxHqo/+pRv8Z/EKiGSSFeRhBfCCeDsSZQBwMxO5AdelnZqaBDb3+8A2DprwIwkfEYKALwcEHZE8jVg8yBgggRnokBhaiE0LGbIZ0o3//pfWdGLzMVRlJsgQYJ2CvtLe3r16/fn3oqVOnUBRERUUx6OrqMoL8/Q+o8uvD8wx9j978Lwq1hFn0HxSULsZKYE5HmsseIAXCLkBxlyBbTQaCCQBo+TQglQXEFp+/fj/uX7eWYV9vDLJPpkETwB5ghLsAIxyUEPYALfgETAi7gWxXoiNv9swZIFqXnIgHCCCqRzw4yTMyMhhL/GeY2ZCWsenozel+1uqM9CxpQME3kwR9u6F0EDbJMzNSu88+Z/h/cP/e6S+vHgB58P/FC+f/I3n4PwyvO3wdJL4bmu9dgFgQxIaVbEBcDlObNWHrfyQ5JSgNB+CYASVmYFoSAtLvhISEGN69e4fhQGBBw/D9+3fktOe6bNmy3cCEvhqoLxTIh4W+64ED+3fdunWLARTp0tLSDG9ePWeYcuo/w6aWSAYpEV5GmIeAaZBx4c4L/+PdDWAOZACK7QE62uXU9acM+/rjGfi42EuhhZcLUK4CSHdsbI1gOAmUB2UeoPxZp8KFxourAxkYyEmbhAo8aLrXBBfVn7/+//v3739q24MNAwQQI71q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/PHoi/j5UyZHDEBc5UBg8f5T85j32ieQp/3ewr/71dk3w8v9qs/HVqPQ7xEAK5H2eM4vhNFH59tpVjbA6jnYDnpoPlkr00xuWSTA6rj2Mjzw6zF87CZ5/HEeZ6Hb0EyP4PuumMm2R54cKrFong1JlhMD2OKL4Z03nRO50xnzUdyfch/AIlrCpt6YNFkAAAAAElFTkSuQmCC' );
$params['cache'] = true;
}
break;
default:
break;
}
//Debug::Arr($params, 'Download Params:', __FILE__, __LINE__, __METHOD__, 10);
if ( isset( $params ) ) {
$retval = HTTP_Download::staticSend( $params );
if ( $retval !== true ) {
Debug::Arr( $params, 'Download Params:', __FILE__, __LINE__, __METHOD__, 10 );
Debug::Text( 'ERROR: Download Failed: ' . $retval->message, __FILE__, __LINE__, __METHOD__, 10 );
//Debug::writeToLog(); //Handled in TTShutdown now.
}
} else {
echo "File does not exist, unable to download!<br>\n";
//Debug::writeToLog(); //Handled in TTShutdown now.
}
?>