Skip to content

Commit 15eb89a

Browse files
committed
Rename some variables, add some output in download, correct version conflict.
- RESPONSE::HTTP_OK doesn't exist in Symfony 2.3, but 2.3 is used in phpBB 3.1 - $row -> $data - $response->setContent is needed when we actually want content inside the file :)
1 parent 4055914 commit 15eb89a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

controller/main.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ private function display_pb()
420420
}
421421

422422
// Thanks download.php
423-
$snippet_text = htmlspecialchars_decode(utf8_decode($row['snippet_text']));
423+
$snippet_text = htmlspecialchars_decode(utf8_decode($data['snippet_text']));
424424

425-
$filename = htmlspecialchars_decode($row['snippet_title']) . '.txt';
425+
$filename = htmlspecialchars_decode($data['snippet_title']) . '.txt';
426426

427427
$user_agent = $this->request->server('HTTP_USER_AGENT', '');
428428
if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)
@@ -435,10 +435,11 @@ private function display_pb()
435435
}
436436

437437
// Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer.
438-
$response = new Response($snippet_text, Response::HTTP_OK);
438+
$response = new Response($snippet_text, 200);
439439
$response->headers->set('Pragma', 'public');
440440
$response->headers->set('Content-Type', 'text/plain');
441441
$response->headers->set('Content-Disposition', "attachment; $filename");
442+
$response->setContent($snippet_text);
442443

443444
if ($size = @strlen($snippet_text))
444445
{
@@ -464,7 +465,7 @@ private function display_pb()
464465
if (isset($_POST['cancel']))
465466
{
466467
//redirect(append_sid("{$root_path}support/pastebin.$phpEx", "mode=view&s=$snippet_id"));
467-
redirect($this->helper->route('phpbbde_pastebin_main_controller', "mode=view&s=$snippet_id"));
468+
redirect($this->helper->route('phpbbde_pastebin_main_controller', array("mode"=>"view","s"=>$snippet_id)));
468469
}
469470

470471
if ($delete)
@@ -473,7 +474,7 @@ private function display_pb()
473474
if (!confirm_box(true))
474475
{
475476
$hidden = build_hidden_fields(array('mode' => 'moderate', 's' => $snippet_id, 'delete_snippet' => 1));
476-
confirm_box(false, sprintf($user->lang['DELETE_SNIPPET_CONFIRM'], $row['snippet_title']), $hidden);
477+
confirm_box(false, sprintf($user->lang['DELETE_SNIPPET_CONFIRM'], $data['snippet_title']), $hidden);
477478
}
478479
else
479480
{

0 commit comments

Comments
 (0)