cosmetics

This commit is contained in:
Jean-Christian Denis 2021-10-23 21:39:47 +02:00
parent 8f8c9f3a6a
commit ecf10b742e
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -17,8 +17,6 @@ if (!defined('DC_CONTEXT_ADMIN')) {
dcPage::check('contentadmin');
$core->blog->settings->addNamespace('enhancePostContent');
$s = $core->blog->settings->enhancePostContent;
# -- Prepare queries and object --
@ -43,7 +41,8 @@ if (!empty($action)) {
try {
# Update filter settings
if ($action == 'savefiltersetting'
&& isset($filters_id[$default_part])) {
&& isset($filters_id[$default_part])
) {
# Parse filters options
$name = $filters_id[$default_part];
$f = [
@ -56,7 +55,8 @@ try {
'pubPages' => (array) $_POST['filter_pubPages']
];
$s->put('enhancePostContent_' . $name, serialize($f));
$core->blog->settings->addNamespace('enhancePostContent');
$core->blog->settings->enhancePostContent->put('enhancePostContent_' . $name, serialize($f));
$core->blog->triggerBlog();
@ -75,12 +75,13 @@ try {
if ($action == 'savenewrecord'
&& isset($filters_id[$default_part])
&& !empty($_POST['new_key'])
&& !empty($_POST['new_value'])) {
&& !empty($_POST['new_value'])
) {
$cur = $records->openCursor();
$cur->epc_filter = $filters_id[$default_part];
$cur->epc_key = html::escapeHTML($_POST['new_key']);
$cur->epc_value = html::escapeHTML($_POST['new_value']);
if ($records->isRecord($cur->epc_filter, $cur->epc_key)) {
dcPage::addErrorNotice(__('Key already exists for this filter'));
} else {
@ -103,21 +104,24 @@ try {
$error = false;
if ($action == 'saveupdaterecords'
&& isset($filters_id[$default_part])
&& $_filters[$filters_id[$default_part]]['has_list']) {
&& $_filters[$filters_id[$default_part]]['has_list']
) {
foreach($_POST['epc_id'] as $k => $id) {
$k = abs((integer) $k);
$id = abs((integer) $id);
if (empty($_POST['epc_key'][$k])
|| empty($_POST['epc_value'][$k])) {
|| empty($_POST['epc_value'][$k])
) {
$records->delRecord($id);
} elseif ($_POST['epc_key'][$k] != $_POST['epc_old_key'][$k]
|| $_POST['epc_value'][$k] != $_POST['epc_old_value'][$k]) {
|| $_POST['epc_value'][$k] != $_POST['epc_old_value'][$k]
) {
$cur = $records->openCursor();
$cur->epc_filter = $filters_id[$default_part];
$cur->epc_key = html::escapeHTML($_POST['epc_key'][$k]);
$cur->epc_value = html::escapeHTML($_POST['epc_value'][$k]);
if ($records->isRecord($cur->epc_filter, $cur->epc_key, $id)) {
dcPage::addErrorNotice(__('Key already exists for this filter'));
$error = true;
@ -186,7 +190,6 @@ $core->formNonce() .
# Filter content
if (isset($filters_id[$default_part])) {
$name = $filters_id[$default_part];
$filter = $_filters[$name];