From 730f4c080a39ce65a30281d646e773e1012edf0c Mon Sep 17 00:00:00 2001 From: onli Date: Tue, 25 May 2021 23:13:51 +0200 Subject: [PATCH] php 8 compat fixes for receiving trackbacks --- comment.php | 1 - include/functions_comments.inc.php | 5 ++++- include/functions_smarty.inc.php | 3 +-- include/functions_trackbacks.inc.php | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/comment.php b/comment.php index 6ec972c8..1c044ad1 100644 --- a/comment.php +++ b/comment.php @@ -83,7 +83,6 @@ if (!($type = @$_REQUEST['type'])) { if ($type == 'trackback') { if ($tb_logging) { - # PHP 4.2.2 way of doing things ob_start(); print_r($_REQUEST); $tmp = ob_get_contents(); diff --git a/include/functions_comments.inc.php b/include/functions_comments.inc.php index 7c00b4c2..ffbd256d 100644 --- a/include/functions_comments.inc.php +++ b/include/functions_comments.inc.php @@ -705,6 +705,9 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate = if (! is_array($counter_tb)) { $counter_tb = ['counter' => 0]; } + if (! is_array($counter_comments)) { + $counter_comments = ['counter' => 0]; + } $query = "UPDATE {$serendipity['dbPrefix']}entries SET comments = " . (int)$counter_comments['counter'] . ", @@ -1008,7 +1011,7 @@ function serendipity_saveComment($id, $commentInfo, $type = 'NORMAL', $source = $commentInfo['source'] = $source; // Secure email addresses, only one [first] allowed to not mail to multiple recipients - $mailparts = explode(',', $commentInfo['email']); + $mailparts = explode(',', $commentInfo['email'] ?? ''); $commentInfo['email'] = trim($mailparts[0]); serendipity_plugin_api::hook_event('frontend_saveComment', $ca, $commentInfo); diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php index 69f1fdd7..b9d6ba9d 100644 --- a/include/functions_smarty.inc.php +++ b/include/functions_smarty.inc.php @@ -1039,7 +1039,7 @@ function serendipity_smarty_init($vars = array()) { if (defined('IN_serendipity_admin') && array_key_exists('wysiwyg', $serendipity) && $serendipity['wysiwyg']) { - // backwards compatibility with removed force-settings + // backwards compatibility with removed force-settings if (strpos($serendipity['wysiwygToolbar'], 'NOCC-') !== false) { $serendipity['wysiwygToolbar'] = substr($serendipity['wysiwygToolbar'], 5); } @@ -1050,7 +1050,6 @@ function serendipity_smarty_init($vars = array()) { // check ckeditor custom config file $ccc = serendipity_getTemplateFile('admin/ckeditor_custom_config.js', 'serendipityHTTPPath', true); $wysiwyg_customConfig = (!empty($ccc)) ? $ccc : $serendipity['serendipityHTTPPath'] . 'htmlarea/ckeditor_s9y_config.js'; - } if (array_key_exists('enableBackendPopupGranular', $serendipity)) { diff --git a/include/functions_trackbacks.inc.php b/include/functions_trackbacks.inc.php index 6d06a593..05c57a8a 100644 --- a/include/functions_trackbacks.inc.php +++ b/include/functions_trackbacks.inc.php @@ -351,7 +351,7 @@ function add_trackback($id, $title, $url, $name, $excerpt) { // Decode HTML Entities $excerpt = trackback_body_strip($excerpt); - if ($tb_logging) { + if ($GLOBALS['tb_logging']) { $fp = fopen('trackback2.log', 'a'); fwrite($fp, '[' . date('d.m.Y H:i') . '] Trackback body:' . $excerpt . "\n"); fclose($fp);