public function runGetFile(framework\Request $request) { $file = new entities\File((int) $request['id']); if ($file instanceof entities\File) { if ($file->hasAccess()) { $disableCache = true; $isFile = false; $this->getResponse()->cleanBuffer(); $this->getResponse()->clearHeaders(); $this->getResponse()->setDecoration(\thebuggenie\core\framework\Response::DECORATE_NONE); if ($file->isImage() && \thebuggenie\core\framework\Settings::isUploadsImageCachingEnabled()) { $this->getResponse()->addHeader('Pragma: public'); $this->getResponse()->addHeader('Cache-Control: public, max-age: 15768000'); $this->getResponse()->addHeader("Expires: " . gmdate('D, d M Y H:i:s', time() + 15768000) . " GMT"); $disableCache = false; } $this->getResponse()->addHeader('Content-disposition: ' . ($request['mode'] == 'download' ? 'attachment' : 'inline') . '; filename="' . $file->getOriginalFilename() . '"'); $this->getResponse()->setContentType($file->getContentType()); if (framework\Settings::getUploadStorage() == 'files') { $fh = fopen(framework\Settings::getUploadsLocalpath() . $file->getRealFilename(), 'r'); $isFile = true; } else { $fh = $file->getContent(); } if (is_resource($fh)) { if ($isFile && \thebuggenie\core\framework\Settings::isUploadsDeliveryUseXsend()) { $this->getResponse()->addHeader('X-Sendfile: ' . framework\Settings::getUploadsLocalpath() . $file->getRealFilename()); $this->getResponse()->addHeader('X-Accel-Redirect: /files/' . $file->getRealFilename()); $this->getResponse()->renderHeaders($disableCache); } else { $this->getResponse()->renderHeaders($disableCache); fpassthru($fh); } } else { $this->getResponse()->renderHeaders($disableCache); echo $fh; } exit; } } $this->return404(framework\Context::getI18n()->__('This file does not exist')); }
<td style="width: auto;"> <?php if ($access_level == \thebuggenie\core\framework\Settings::ACCESS_FULL) { ?> <input type="radio" name="upload_allow_image_caching" value="1" id="upload_allow_image_caching_yes"<?php if (\thebuggenie\core\framework\Settings::isUploadsImageCachingEnabled()) { ?> checked<?php } ?> onclick="toggleSettings();"><label for="upload_allow_image_caching_yes"><?php echo __('Yes'); ?> </label> <input type="radio" name="upload_allow_image_caching" value="0" id="upload_allow_image_caching_no"<?php if (!\thebuggenie\core\framework\Settings::isUploadsImageCachingEnabled()) { ?> checked<?php } ?> onclick="toggleSettings();"><label for="upload_allow_image_caching_no"><?php echo __('No'); ?> </label> <?php } ?> </td> </tr> <tr> <td class="config_explanation" colspan="2"><?php