From ef27f70b3d2315df6c59638f02e168824b79639b Mon Sep 17 00:00:00 2001 From: onli Date: Sun, 2 May 2021 13:22:06 +0200 Subject: [PATCH] PHP8 compat fixes for plugin configuration (spamblock) --- include/functions_plugins_admin.inc.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/functions_plugins_admin.inc.php b/include/functions_plugins_admin.inc.php index 0fbcd459..5e18b7b8 100644 --- a/include/functions_plugins_admin.inc.php +++ b/include/functions_plugins_admin.inc.php @@ -248,6 +248,8 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam if ($showSubmit && $postKey != 'plugin') { $data['showSubmit_head'] = true; + } else { + $data['showSubmit_head'] = false; } if ($showTable) { @@ -286,12 +288,12 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam } } - if (isset($_POST['serendipity'][$postkey][$config_item])) { - if (is_array($_POST['serendipity'][$postkey][$config_item])) { - $hvalue = $_POST['serendipity'][$postkey][$config_item]; + if (isset($_POST['serendipity'][$postKey][$config_item])) { + if (is_array($_POST['serendipity'][$postKey][$config_item])) { + $hvalue = $_POST['serendipity'][$postKey][$config_item]; array_walk($hvalue, 'serendipity_specialchars'); } else { - $hvalue = serendipity_specialchars($_POST['serendipity'][$postkey][$config_item]); + $hvalue = serendipity_specialchars($_POST['serendipity'][$postKey][$config_item]); } } else { $hvalue = serendipity_specialchars($value); @@ -311,12 +313,15 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam $data['postKey'] = $postKey; $data['config_item'] = $config_item; + if (! isset($data['backend_wysiwyg'])) { $data['backend_wysiwyg'] = null; } + $assign_plugin_config = function($data) use (&$plugin_options, $tfile, $config_item) { $plugin_options[$config_item] = array( 'config' => serendipity_smarty_show($tfile, $data), 'ctype' => $data['ctype'] ); }; + switch ($ctype) { @@ -660,5 +665,9 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam $data['ev'] = $ev; } + # php 8 compat section + if (! isset($data['showExample'])) { $data['showExample'] = null; } + if (! isset($data['spawnNuggets'])) { $data['spawnNuggets'] = null; } + return serendipity_smarty_show('admin/plugin_config.tpl', $data); }