fix config: cleanup, license

This commit is contained in:
Jean-Christian Paul Denis 2021-09-07 15:20:04 +02:00
parent 956d48b4f4
commit e510c444d7

View File

@ -1,26 +1,23 @@
<?php <?php
# -- BEGIN LICENSE BLOCK ---------------------------------- /**
# * @brief cinecturlink2, a plugin for Dotclear 2
# This file is part of cinecturlink2, a plugin for Dotclear 2. *
# * @package Dotclear
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors * @subpackage Plugin
# contact@jcdenis.fr http://jcd.lv *
# * @author Jean-Christian Denis and Contributors
# Licensed under the GPL version 2.0 license. *
# A copy of this license is available in LICENSE file or at * @copyright Jean-Christian Denis
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# */
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_MODULE')) { if (!defined('DC_CONTEXT_MODULE')) {
return null; return null;
} }
$redir = empty($_REQUEST['redir']) ? $redir = empty($_REQUEST['redir']) ?
$list->getURL().'#plugins' : $_REQUEST['redir']; $list->getURL().'#plugins' : $_REQUEST['redir'];
# -- Get settings --
$core->blog->settings->addNamespace('cinecturlink2'); $core->blog->settings->addNamespace('cinecturlink2');
$s = $core->blog->settings->cinecturlink2; $s = $core->blog->settings->cinecturlink2;
$cinecturlink2_active = (boolean) $s->cinecturlink2_active; $cinecturlink2_active = (boolean) $s->cinecturlink2_active;
@ -35,9 +32,7 @@ if ($cinecturlink2_public_nbrpp < 1) {
$cinecturlink2_public_nbrpp = 10; $cinecturlink2_public_nbrpp = 10;
} }
# -- Set settings --
if (!empty($_POST['save'])) { if (!empty($_POST['save'])) {
try { try {
$cinecturlink2_active = !empty($_POST['cinecturlink2_active']); $cinecturlink2_active = !empty($_POST['cinecturlink2_active']);
$cinecturlink2_widthmax = abs((integer) $_POST['cinecturlink2_widthmax']); $cinecturlink2_widthmax = abs((integer) $_POST['cinecturlink2_widthmax']);
@ -50,7 +45,6 @@ if (!empty($_POST['save'])) {
if ($cinecturlink2_public_nbrpp < 1) { if ($cinecturlink2_public_nbrpp < 1) {
$cinecturlink2_public_nbrpp = 10; $cinecturlink2_public_nbrpp = 10;
} }
if (empty($cinecturlink2_folder)) { if (empty($cinecturlink2_folder)) {
throw new Exception(__('You must provide a specific folder for images.')); throw new Exception(__('You must provide a specific folder for images.'));
} }
@ -59,7 +53,6 @@ if (!empty($_POST['save'])) {
$cinecturlink2_folder, $cinecturlink2_folder,
true true
); );
$s->put('cinecturlink2_active', $cinecturlink2_active); $s->put('cinecturlink2_active', $cinecturlink2_active);
$s->put('cinecturlink2_public_active', $cinecturlink2_public_active); $s->put('cinecturlink2_public_active', $cinecturlink2_public_active);
$s->put('cinecturlink2_public_title', $cinecturlink2_public_title); $s->put('cinecturlink2_public_title', $cinecturlink2_public_title);
@ -72,19 +65,16 @@ if (!empty($_POST['save'])) {
dcPage::addSuccessNotice( dcPage::addSuccessNotice(
__('Configuration has been successfully updated.') __('Configuration has been successfully updated.')
); );
http::redirect( $core->adminurl->redirect(
$list->getURL('module=cinecturlink2&conf=1&redir='. 'admin.plugins',
$list->getRedir()) ['module' => 'cinecturlink2', 'conf' => 1, 'redir' => $list->getRedir()]
); );
} } catch (Exception $e) {
catch (Exception $e) {
$core->error->add($e->getMessage()); $core->error->add($e->getMessage());
} }
} }
# -- Display form --
echo ' echo '
<div class="fieldset"> <div class="fieldset">
<h4>' . __('General') . '</h4> <h4>' . __('General') . '</h4>