Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions controller/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace phpbbde\pastebin\controller;

use Symfony\Component\HttpFoundation\Response;

class main
{
const CONFIRM_PASTEBIN = 5;
Expand Down Expand Up @@ -112,7 +114,10 @@ public function handle($name = '')
'U_VIEW_FORUM' => $this->helper->route('phpbbde_pastebin_main_controller'),
));

$this->display_pb();
if ($response = $this->display_pb())
{
return $response;
}

return $this->helper->render('pastebin_body.html', $this->user->lang['PASTEBIN']);
}
Expand Down Expand Up @@ -429,23 +434,20 @@ private function display_pb()
$filename = "filename*=UTF-8''" . rawurlencode($filename);
}

header('Pragma: public');

// Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer.
header('Content-Type: text/plain');
header("Content-Disposition: attachment; $filename");
// Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer.
$response = new Response($snippet_text, Response::HTTP_OK);
$response->headers->set('Pragma', 'public');
$response->headers->set('Content-Type', 'text/plain');
$response->headers->set('Content-Disposition', "attachment; $filename");

if ($size = @strlen($snippet_text))
{
header("Content-Length: $size");
$response->headers->set('Content-Length', $size);
}

@set_time_limit(0);

echo $snippet_text;

flush();
exit;
return $response;
}
else if ($mode == 'moderate')
{
Expand Down