diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 5b296a7a6..d6c7931cd 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -8533,54 +8533,61 @@ class Actions $self->cacheByKey($sRawKey); - $bDone = false; - if ($bThumbnail && !$bDownload) + $sLoadedData = null; + $bDetectImageOrientation = false; + if (!$bDownload) { - try + if ($bThumbnail) { - $oImagine = new \Imagine\Gd\Imagine(); + try + { + $oImagine = new \Imagine\Gd\Imagine(); - $bDone = true; - $oImage = $oImagine->load(\stream_get_contents($rResource)); + $oImage = $oImagine->load(\stream_get_contents($rResource)); - $oImage = $this->correctImageOrientation($oImage, $bDetectImageOrientation, 60); + $oImage = $this->correctImageOrientation($oImage, $bDetectImageOrientation, 60); - \header('Content-Disposition: inline; '. - \trim(\MailSo\Base\Utils::EncodeHeaderUtf8AttributeValue('filename', $sFileNameOut.'_thumb60x60.png')), true); + \header('Content-Disposition: inline; '. + \trim(\MailSo\Base\Utils::EncodeHeaderUtf8AttributeValue('filename', $sFileNameOut.'_thumb60x60.png')), true); - $oImage->show('png'); + $oImage->show('png'); + } + catch (\Exception $oException) + { + $self->Logger()->WriteExceptionShort($oException); + } } - catch (\Exception $oException) + else if ($bDetectImageOrientation && + \in_array($sContentTypeOut, array('image/png', 'image/jpeg', 'image/jpg')) && + \MailSo\Base\Utils::FunctionExistsAndEnabled('gd_info')) { - $self->Logger()->WriteExceptionShort($oException); + try + { + $oImagine = new \Imagine\Gd\Imagine(); + + $sLoadedData = \stream_get_contents($rResource); + + $oImage = $oImagine->load($sLoadedData); + + $oImage = $this->correctImageOrientation($oImage, $bDetectImageOrientation); + + \header('Content-Disposition: inline; '. + \trim(\MailSo\Base\Utils::EncodeHeaderUtf8AttributeValue('filename', $sFileNameOut)), true); + + $oImage->show($sContentTypeOut === 'image/png' ? 'png' : 'jpg'); + } + catch (\Exception $oException) + { + $self->Logger()->WriteExceptionShort($oException); + } + } + else + { + $sLoadedData = \stream_get_contents($rResource); } } - if (!$bDone && !$bDownload && $bDetectImageOrientation && - \in_array($sContentTypeOut, array('image/png', 'image/jpeg', 'image/jpg')) && - \MailSo\Base\Utils::FunctionExistsAndEnabled('gd_info')) - { - try - { - $oImagine = new \Imagine\Gd\Imagine(); - - $bDone = true; - $oImage = $oImagine->load(\stream_get_contents($rResource)); - - $oImage = $this->correctImageOrientation($oImage, $bDetectImageOrientation); - - \header('Content-Disposition: inline; '. - \trim(\MailSo\Base\Utils::EncodeHeaderUtf8AttributeValue('filename', $sFileNameOut)), true); - - $oImage->show($sContentTypeOut === 'image/png' ? 'png' : 'jpg'); - } - catch (\Exception $oException) - { - $self->Logger()->WriteExceptionShort($oException); - } - } - - if (!$bDone) + if ($bDownload || $sLoadedData) { \header('Content-Type: '.$sContentTypeOut); \header('Content-Disposition: '.($bDownload ? 'attachment' : 'inline').'; '. @@ -8589,7 +8596,15 @@ class Actions \header('Accept-Ranges: none', true); \header('Content-Transfer-Encoding: binary'); - \MailSo\Base\Utils::FpassthruWithTimeLimitReset($rResource); + if (!$bDownload && $sLoadedData) + { + echo $sLoadedData; + unset($sLoadedData); + } + else + { + \MailSo\Base\Utils::FpassthruWithTimeLimitReset($rResource); + } } } }, $sFolder, $iUid, true, $sMimeIndex); diff --git a/rainloop/v/0.0.0/include.php b/rainloop/v/0.0.0/include.php index 1d438b2e2..c33adf6fc 100644 --- a/rainloop/v/0.0.0/include.php +++ b/rainloop/v/0.0.0/include.php @@ -11,16 +11,12 @@ @ini_set('magic_quotes_gpc', 0); @ini_set('magic_quotes_runtime', 0); - define('APP_DEFAULT_DENY_ALL_HTACCESS', 'Deny from all - -Options -Indexes -'); - define('APP_START_TIME', time()); define('APP_REQUEST_RND', md5(APP_START.rand(10000, 99999).APP_START)); define('APP_VERSION_ROOT_PATH', APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/'); define('APP_USE_APC_CACHE', true); + define('APP_DEFAULT_DENY_ALL_HTACCESS', "Deny from all\n\nOptions -Indexes\n"); if (function_exists('date_default_timezone_set')) {