Skip to content

Commit fb44b07

Browse files
committed
Merge branch '3.2.x'
2 parents a2389bd + a856293 commit fb44b07

26 files changed

Lines changed: 1678 additions & 84 deletions

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "phpbb-extension",
44
"description": "Provides a pastebin including syntax highlighting",
55
"homepage": "https://www.phpbb.de/community/",
6-
"version": "2.0.6",
7-
"time": "2020-10-04",
6+
"version": "2.0.7",
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": {

composer.lock

Lines changed: 51 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.phar

-17.9 KB
Binary file not shown.

controller/main.php

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private function display_pb()
156156
$snippet_id = $this->request->variable('s', 0);
157157
$submit = $this->request->is_set_post('submit');
158158

159-
if (in_array($mode, array('view', 'download', 'moderate')))
159+
if (in_array($mode, array('view', 'download', 'moderate', 'edit_snippet')))
160160
{
161161
// for all of these we have to check if the entry exists
162162

@@ -232,6 +232,34 @@ private function display_pb()
232232
// Now let's decide what to do
233233
switch ($mode)
234234
{
235+
case 'edit_snippet':
236+
if (!check_form_key('pastebinform'))
237+
{
238+
trigger_error('PASTEBIN_FORM_INVALID');
239+
}
240+
else
241+
{
242+
$data = [
243+
'snippet_id' => $snippet_id,
244+
'snippet_text' => $this->request->raw_variable('edit_snippet', ''),
245+
];
246+
247+
$snippet->load_from_array($data);
248+
$snippet->submit();
249+
250+
$redirect_append = array("mode"=>"view","s"=>$snippet_id);
251+
$redirect_url = $this->helper->route('phpbbde_pastebin_main_controller', $redirect_append);
252+
253+
$message = $this->language->lang('PASTEBIN_SNIPPET_MODERATED');
254+
$message .= '<br /><br />';
255+
$message .= $this->language->lang('PASTEBIN_RETURN_SNIPPET', '<a href="' . $redirect_url . '">', '</a>');
256+
257+
meta_refresh(3, $redirect_url);
258+
trigger_error($message);
259+
}
260+
261+
break;
262+
235263
case 'post':
236264
// process submitted data from the posting form
237265
if (!$this->auth->acl_get('u_pastebin_post'))
@@ -247,7 +275,7 @@ private function display_pb()
247275
$data = array(
248276
'snippet_title' => str_replace("\n", '', $this->request->variable('snippet_title', '', true)),
249277
'snippet_desc' => str_replace("\n", '', $this->request->variable('snippet_desc', '', true)),
250-
'snippet_text' => $this->request->variable('snippet_text', '', true),
278+
'snippet_text' => $this->request->raw_variable('snippet_text', ''),
251279
'snippet_prunable' => 1,
252280
'snippet_highlight' => $this->request->variable('snippet_highlight', ''),
253281
'snippet_prune_on' => max(1, min(6, $this->request->variable('pruning_months', 0))),
@@ -392,7 +420,7 @@ private function display_pb()
392420
$highlight = 'php';
393421
}
394422

395-
$code = htmlspecialchars_decode($snippet_text);
423+
$code = $snippet_text;
396424

397425
$geshi = new \GeSHi($code, $highlight, $this->util->geshi_dir);
398426
$geshi->set_header_type(GESHI_HEADER_NONE);
@@ -442,9 +470,9 @@ private function display_pb()
442470
}
443471

444472
// Thanks download.php
445-
$snippet_text = htmlspecialchars_decode(utf8_decode($data['snippet_text']));
473+
$snippet_text = $data['snippet_text'];
446474

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

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

0 commit comments

Comments
 (0)