Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Provides a pastebin including syntax highlighting",
"homepage": "https://www.phpbb.de/community/",
"version": "2.0.7",
"time": "2022-05-18",
"time": "2023-10-03",
"license": "GPL-2.0-only",
"authors": [
{
Expand All @@ -21,7 +21,7 @@
}
],
"require": {
"php": ">=5.4.7, <=7.4",
"php": ">=7.2, <=8.2",
"easybook/geshi": ">=1.0.8.4"
},
"require-dev": {
Expand Down
13 changes: 7 additions & 6 deletions controller/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private function display_pb()
{
$data = [
'snippet_id' => $snippet_id,
'snippet_text' => $this->request->variable('edit_snippet', '', true),
'snippet_text' => $this->request->raw_variable('edit_snippet', ''),
];

$snippet->load_from_array($data);
Expand All @@ -257,7 +257,8 @@ private function display_pb()
meta_refresh(3, $redirect_url);
trigger_error($message);
}
break;

break;

case 'post':
// process submitted data from the posting form
Expand All @@ -274,7 +275,7 @@ private function display_pb()
$data = array(
'snippet_title' => str_replace("\n", '', $this->request->variable('snippet_title', '', true)),
'snippet_desc' => str_replace("\n", '', $this->request->variable('snippet_desc', '', true)),
'snippet_text' => $this->request->variable('snippet_text', '', true),
'snippet_text' => $this->request->raw_variable('snippet_text', ''),
'snippet_prunable' => 1,
'snippet_highlight' => $this->request->variable('snippet_highlight', ''),
'snippet_prune_on' => max(1, min(6, $this->request->variable('pruning_months', 0))),
Expand Down Expand Up @@ -419,7 +420,7 @@ private function display_pb()
$highlight = 'php';
}

$code = htmlspecialchars_decode($snippet_text);
$code = $snippet_text;

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

// Thanks download.php
$snippet_text = htmlspecialchars_decode(utf8_decode($data['snippet_text']));
$snippet_text = $data['snippet_text'];

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

$user_agent = $this->request->server('HTTP_USER_AGENT', '');
if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)
Expand Down
2 changes: 1 addition & 1 deletion cron/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function run()
{
$now = time();
$sql = 'DELETE FROM ' . $this->pastebin_table . '
WHERE snippet_prunable = 1 and snippet_prune_on < ' . $now;
WHERE snippet_prunable = 1 and snippet_prune_on < ' . (int) $now;
$this->db->sql_query($sql);
$this->config->set('phpbbde_pastebin_prune_last_run', $now, true);
}
Expand Down
2 changes: 1 addition & 1 deletion migrations/cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class cron extends \phpbb\db\migration\migration
{
static public function depends_on()
public static function depends_on()
{
return array('\phpbbde\pastebin\migrations\pastebin');
}
Expand Down
2 changes: 1 addition & 1 deletion migrations/pastebin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function effectively_installed()
return !empty($this->config['pastebin_version']) && version_compare($this->config['pastebin_version'], '0.2.2', '>=');
}

static public function depends_on()
public static function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\v324',
Expand Down
2 changes: 1 addition & 1 deletion migrations/v204.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class v204 extends \phpbb\db\migration\migration
{
static public function depends_on()
public static function depends_on()
{
return array(
'\phpbbde\pastebin\migrations\v_0_0_1',
Expand Down
2 changes: 1 addition & 1 deletion migrations/v205.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class v205 extends \phpbb\db\migration\migration
{
static public function depends_on()
public static function depends_on()
{
return array(
'\phpbbde\pastebin\migrations\v204',
Expand Down
2 changes: 1 addition & 1 deletion migrations/v206.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class v206 extends \phpbb\db\migration\migration
{
static public function depends_on()
public static function depends_on()
{
return array(
'\phpbbde\pastebin\migrations\v205',
Expand Down
2 changes: 1 addition & 1 deletion migrations/v_0_0_1.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class v_0_0_1 extends \phpbb\db\migration\migration
{
static public function depends_on()
public static function depends_on()
{
return array(
'\phpbbde\pastebin\migrations\pastebin',
Expand Down
4 changes: 2 additions & 2 deletions vendor/easybook/geshi/contrib/cssgen.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
************************************************************************************/

set_magic_quotes_runtime(0);
//set_magic_quotes_runtime(0);
Copy link
Member

@Crizz0 Crizz0 Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entfernen oder drin lassen, aber nicht auskommentieren.

Zudem sind Änderungen im vendor/ Ordner nicht so günstig, jedes composer.phar update überschreibt das wieder. Gibt es keine andere Möglichkeit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wird als Provisorium akzeptiert.

//
// Functions
//
Expand Down Expand Up @@ -237,7 +237,7 @@ function get_var ( $var_name )
}
else
{
echo '<input type="hidden" name="geshi-path" value="' . htmlspecialchars($geshi_path) . '" />';
echo '<input type="hidden" name="geshi-path" value="' . htmlspecialchars($geshi_path, ENT_COMPAT) . '" />';
}
if ( $no_lang_dir_error )
{
Expand Down
6 changes: 3 additions & 3 deletions vendor/easybook/geshi/contrib/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

$fill_source = false;
if (isset($_POST['submit'])) {
if (get_magic_quotes_gpc()) {
/*if (get_magic_quotes_gpc()) {
$_POST['source'] = stripslashes($_POST['source']);
}
}*/
if (!strlen(trim($_POST['source']))) {
$_POST['language'] = preg_replace('#[^a-zA-Z0-9\-_]#', '', $_POST['language']);
$_POST['source'] = implode('', @file($path . 'geshi/' . $_POST['language'] . '.php'));
Expand Down Expand Up @@ -172,7 +172,7 @@
<form action="<?php echo basename($_SERVER['PHP_SELF']); ?>" method="post">
<h3>Source to highlight</h3>
<p>
<textarea rows="10" cols="60" name="source" id="source"><?php echo $fill_source ? htmlspecialchars($_POST['source']) : '' ?></textarea>
<textarea rows="10" cols="60" name="source" id="source"><?php echo $fill_source ? htmlspecialchars($_POST['source'], ENT_COMPAT) : '' ?></textarea>
</p>
<h3>Choose a language</h3>
<p>
Expand Down
6 changes: 3 additions & 3 deletions vendor/easybook/geshi/contrib/langwiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
error_reporting(E_ALL);
$time_start = explode(' ', microtime());

//Handle crappy PHP magic:
/*//Handle crappy PHP magic:
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ?
Expand All @@ -30,10 +30,10 @@ function stripslashes_deep($value) {
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
}*/

function htmlspecialchars_deep($value) {
return is_array($value) ? array_map('htmlspecialchars_deep', $value) : htmlspecialchars($value);
return is_array($value) ? array_map('htmlspecialchars_deep', $value) : htmlspecialchars($value, ENT_COMPAT);
}

define ('TYPE_NOTICE', 0);
Expand Down