Skip to content

Commit 54337bf

Browse files
committed
Merge pull request #8 from gn36/master
Rename some variables, add some output in download, correct version conflict
2 parents 4055914 + 2112c2a commit 54337bf

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: php
2+
sudo: required
23

34
matrix:
45
include:

controller/main.php

Lines changed: 8 additions & 7 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,13 +474,13 @@ 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
{
480481
$sql = 'DELETE FROM ' . $this->table('pastebin') . '
481482
WHERE snippet_id = ' . $snippet_id;
482-
$redirect_append = '';
483+
$redirect_append = array();
483484
}
484485
}
485486
else
@@ -489,7 +490,7 @@ private function display_pb()
489490
'snippet_highlight' => $highlight,
490491
'snippet_prune_on' => $row['snippet_time'] + ($pruning_months * $this::SECONDS_MONTH),
491492
)) . ' WHERE snippet_id = ' . $snippet_id;
492-
$redirect_append = "mode=view&s=$snippet_id";
493+
$redirect_append = array("mode"=>"view","s"=>$snippet_id);
493494
}
494495
$db->sql_query($sql);
495496

0 commit comments

Comments
 (0)