attachment_download.php 860 B

1234567891011121314151617181920212223242526
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. /**
  4. * Download notice attachment
  5. *
  6. * @category Personal
  7. * @package GNUsocial
  8. * @author Mikael Nordfeldth <mmn@hethane.se>
  9. * @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  10. * @link https:/gnu.io/social
  11. */
  12. class Attachment_downloadAction extends AttachmentAction
  13. {
  14. public function showPage(): void
  15. {
  16. // Disable errors, to not mess with the file contents (suppress errors in case access to this
  17. // function is blocked, like in some shared hosts). Automatically reset at the end of the
  18. // script execution, and we don't want to have any more errors until then, so don't reset it
  19. @ini_set('display_errors', 0);
  20. common_send_file($this->filepath, $this->mimetype, $this->filename, 'attachment');
  21. }
  22. }