2021-09-10 19:06:49 +00:00
|
|
|
<?php
|
2021-09-10 19:18:51 +00:00
|
|
|
/**
|
|
|
|
* @brief postWidgetText, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Jean-Christian Denis and Contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2021-09-10 19:06:49 +00:00
|
|
|
|
|
|
|
if (!defined('DC_CONTEXT_MODULE')) {
|
2021-09-10 19:18:51 +00:00
|
|
|
return null;
|
2021-09-10 19:06:49 +00:00
|
|
|
}
|
2021-10-29 22:40:10 +00:00
|
|
|
dcPage::check('admin');
|
2021-09-10 19:06:49 +00:00
|
|
|
|
|
|
|
$redir = empty($_REQUEST['redir']) ?
|
2021-09-10 19:18:51 +00:00
|
|
|
$list->getURL().'#plugins' : $_REQUEST['redir'];
|
2021-09-10 19:06:49 +00:00
|
|
|
|
|
|
|
# -- Get settings --
|
|
|
|
$core->blog->settings->addNamespace('postwidgettext');
|
|
|
|
$s = $core->blog->settings->postwidgettext;
|
|
|
|
|
|
|
|
$active = (boolean) $s->postwidgettext_active;
|
|
|
|
$importexport_active = (boolean) $s->postwidgettext_importexport_active;
|
|
|
|
|
|
|
|
# -- Set settings --
|
|
|
|
if (!empty($_POST['save'])) {
|
|
|
|
|
2021-09-10 19:18:51 +00:00
|
|
|
try {
|
|
|
|
$active = !empty($_POST['active']);
|
|
|
|
$importexport_active = !empty($_POST['importexport_active']);
|
2021-09-10 19:06:49 +00:00
|
|
|
|
2021-09-10 19:18:51 +00:00
|
|
|
$s->put('postwidgettext_active', $active);
|
|
|
|
$s->put('postwidgettext_importexport_active', $importexport_active);
|
2021-09-10 19:06:49 +00:00
|
|
|
|
2021-09-10 19:18:51 +00:00
|
|
|
$core->blog->triggerBlog();
|
2021-09-10 19:06:49 +00:00
|
|
|
|
2021-09-10 19:18:51 +00:00
|
|
|
dcPage::addSuccessNotice(
|
2021-10-29 22:40:10 +00:00
|
|
|
__('Configuration successfully updated')
|
2021-09-10 19:18:51 +00:00
|
|
|
);
|
|
|
|
http::redirect(
|
|
|
|
$list->getURL('module=postWidgetText&conf=1&redir='.
|
|
|
|
$list->getRedir())
|
|
|
|
);
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
$core->error->add($e->getMessage());
|
|
|
|
}
|
2021-09-10 19:06:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# -- Display form --
|
|
|
|
echo '
|
|
|
|
|
|
|
|
<div class="fieldset">
|
|
|
|
<h4>'.__('Activation').'</h4>
|
|
|
|
|
|
|
|
<p><label for="active">'.
|
|
|
|
form::checkbox('active', 1, $active).
|
|
|
|
__('Enable plugin').'</label></p>
|
|
|
|
|
|
|
|
<p><label for="importexport_active">'.
|
|
|
|
form::checkbox('importexport_active', 1, $importexport_active).
|
|
|
|
__('Enable import/export behaviors').'</label></p>
|
|
|
|
|
|
|
|
</div>';
|