Skip to content

Commit a856293

Browse files
authored
Merge pull request #64 from Mike-on-Tour/3.2.x
Fix encoding and PHP version problems
2 parents e599ff5 + b60085c commit a856293

12 files changed

Lines changed: 24 additions & 23 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.7",
7-
"time": "2022-05-18",
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: 7 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);
@@ -257,7 +257,8 @@ private function display_pb()
257257
meta_refresh(3, $redirect_url);
258258
trigger_error($message);
259259
}
260-
break;
260+
261+
break;
261262

262263
case 'post':
263264
// process submitted data from the posting form
@@ -274,7 +275,7 @@ private function display_pb()
274275
$data = array(
275276
'snippet_title' => str_replace("\n", '', $this->request->variable('snippet_title', '', true)),
276277
'snippet_desc' => str_replace("\n", '', $this->request->variable('snippet_desc', '', true)),
277-
'snippet_text' => $this->request->variable('snippet_text', '', true),
278+
'snippet_text' => $this->request->raw_variable('snippet_text', ''),
278279
'snippet_prunable' => 1,
279280
'snippet_highlight' => $this->request->variable('snippet_highlight', ''),
280281
'snippet_prune_on' => max(1, min(6, $this->request->variable('pruning_months', 0))),
@@ -419,7 +420,7 @@ private function display_pb()
419420
$highlight = 'php';
420421
}
421422

422-
$code = htmlspecialchars_decode($snippet_text);
423+
$code = $snippet_text;
423424

424425
$geshi = new \GeSHi($code, $highlight, $this->util->geshi_dir);
425426
$geshi->set_header_type(GESHI_HEADER_NONE);
@@ -469,9 +470,9 @@ private function display_pb()
469470
}
470471

471472
// Thanks download.php
472-
$snippet_text = htmlspecialchars_decode(utf8_decode($data['snippet_text']));
473+
$snippet_text = $data['snippet_text'];
473474

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

476477
$user_agent = $this->request->server('HTTP_USER_AGENT', '');
477478
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
}

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',

migrations/v_0_0_1.php

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

1313
class v_0_0_1 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\pastebin',

vendor/easybook/geshi/contrib/cssgen.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
************************************************************************************/
3232

33-
set_magic_quotes_runtime(0);
33+
//set_magic_quotes_runtime(0);
3434
//
3535
// Functions
3636
//
@@ -237,7 +237,7 @@ function get_var ( $var_name )
237237
}
238238
else
239239
{
240-
echo '<input type="hidden" name="geshi-path" value="' . htmlspecialchars($geshi_path) . '" />';
240+
echo '<input type="hidden" name="geshi-path" value="' . htmlspecialchars($geshi_path, ENT_COMPAT) . '" />';
241241
}
242242
if ( $no_lang_dir_error )
243243
{

0 commit comments

Comments
 (0)