PHP8 compat fixes for plugin configuration (spamblock)

This commit is contained in:
onli 2021-05-02 13:22:06 +02:00
parent a6162b6e04
commit ef27f70b3d

@ -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);
}