Skip to content

Commit be83b46

Browse files
committed
Fix encoding and PHP version problems
1 parent be5edf1 commit be83b46

14 files changed

Lines changed: 24 additions & 25 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Provides a pastebin including syntax highlighting",
55
"homepage": "https://www.phpbb.de/community/",
66
"version": "2.0.6",
7-
"time": "2020-10-04",
7+
"time": "2023-10-03",
88
"license": "GPL-2.0-only",
99
"authors": [
1010
{
@@ -21,7 +21,7 @@
2121
}
2222
],
2323
"require": {
24-
"php": ">=5.4.7, <=7.4",
24+
"php": ">=7.2, <=8.2",
2525
"easybook/geshi": ">=1.0.8.4"
2626
},
2727
"require-dev": {

controller/main.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private function display_pb()
241241
{
242242
$data = [
243243
'snippet_id' => $snippet_id,
244-
'snippet_text' => $this->request->variable('edit_snippet', '', true),
244+
'snippet_text' => $this->request->raw_variable('edit_snippet', ''),
245245
];
246246

247247
$snippet->load_from_array($data);
@@ -258,7 +258,6 @@ private function display_pb()
258258
trigger_error($message);
259259
}
260260

261-
262261
break;
263262

264263
case 'post':
@@ -276,7 +275,7 @@ private function display_pb()
276275
$data = array(
277276
'snippet_title' => str_replace("\n", '', $this->request->variable('snippet_title', '', true)),
278277
'snippet_desc' => str_replace("\n", '', $this->request->variable('snippet_desc', '', true)),
279-
'snippet_text' => $this->request->variable('snippet_text', '', true),
278+
'snippet_text' => $this->request->raw_variable('snippet_text', ''),
280279
'snippet_prunable' => 1,
281280
'snippet_highlight' => $this->request->variable('snippet_highlight', ''),
282281
'snippet_prune_on' => max(1, min(6, $this->request->variable('pruning_months', 0))),
@@ -421,7 +420,7 @@ private function display_pb()
421420
$highlight = 'php';
422421
}
423422

424-
$code = htmlspecialchars_decode($snippet_text);
423+
$code = $snippet_text;
425424

426425
$geshi = new \GeSHi($code, $highlight, $this->util->geshi_dir);
427426
$geshi->set_header_type(GESHI_HEADER_NONE);
@@ -471,9 +470,9 @@ private function display_pb()
471470
}
472471

473472
// Thanks download.php
474-
$snippet_text = htmlspecialchars_decode(utf8_decode($data['snippet_text']));
473+
$snippet_text = $data['snippet_text'];
475474

476-
$filename = htmlspecialchars_decode($data['snippet_title']) . '.' . $this->pastebin->file_ext();
475+
$filename = $data['snippet_title'] . '.' . $this->pastebin->file_ext();
477476

478477
$user_agent = $this->request->server('HTTP_USER_AGENT', '');
479478
if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)

cron/main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function run()
4141
{
4242
$now = time();
4343
$sql = 'DELETE FROM ' . $this->pastebin_table . '
44-
WHERE snippet_prunable = 1 and snippet_prune_on < ' . $now;
44+
WHERE snippet_prunable = 1 and snippet_prune_on < ' . (int) $now;
4545
$this->db->sql_query($sql);
4646
$this->config->set('phpbbde_pastebin_prune_last_run', $now, true);
4747
}

event/acp_events.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
class acp_events implements EventSubscriberInterface
2121
{
22-
static public function getSubscribedEvents()
22+
public static function getSubscribedEvents()
2323
{
2424
return array(
2525
'core.permissions' => 'add_permissions',

event/base_events.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
class base_events implements EventSubscriberInterface
2121
{
22-
static public function getSubscribedEvents()
22+
public static function getSubscribedEvents()
2323
{
2424
return array(
2525
'core.page_header_after' => 'page_header_after',

migrations/cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class cron extends \phpbb\db\migration\migration
1414
{
15-
static public function depends_on()
15+
public static function depends_on()
1616
{
1717
return array('\phpbbde\pastebin\migrations\pastebin');
1818
}

migrations/pastebin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function effectively_installed()
1717
return !empty($this->config['pastebin_version']) && version_compare($this->config['pastebin_version'], '0.2.2', '>=');
1818
}
1919

20-
static public function depends_on()
20+
public static function depends_on()
2121
{
2222
return array(
2323
'\phpbb\db\migration\data\v32x\v324',

migrations/v204.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class v204 extends \phpbb\db\migration\migration
1414
{
15-
static public function depends_on()
15+
public static function depends_on()
1616
{
1717
return array(
1818
'\phpbbde\pastebin\migrations\v_0_0_1',

migrations/v205.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class v205 extends \phpbb\db\migration\migration
1414
{
15-
static public function depends_on()
15+
public static function depends_on()
1616
{
1717
return array(
1818
'\phpbbde\pastebin\migrations\v204',

migrations/v206.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class v206 extends \phpbb\db\migration\migration
1414
{
15-
static public function depends_on()
15+
public static function depends_on()
1616
{
1717
return array(
1818
'\phpbbde\pastebin\migrations\v205',

0 commit comments

Comments
 (0)