2021-09-07 06:48:58 +00:00
|
|
|
<?php
|
2021-09-07 08:31:22 +00:00
|
|
|
/**
|
|
|
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
2021-11-06 15:19:49 +00:00
|
|
|
*
|
2021-09-07 08:31:22 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2021-11-06 15:19:49 +00:00
|
|
|
*
|
2021-09-07 08:31:22 +00:00
|
|
|
* @author Jean-Christian Denis and Contributors
|
2021-11-06 15:19:49 +00:00
|
|
|
*
|
2021-09-07 08:31:22 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2021-09-07 06:48:58 +00:00
|
|
|
if (!defined('DC_CONTEXT_MODULE')) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-10-28 21:07:17 +00:00
|
|
|
|
2022-11-15 10:34:45 +00:00
|
|
|
if (!dcCore::app()->auth->isSuperAdmin()) {
|
2021-09-07 06:48:58 +00:00
|
|
|
return null;
|
|
|
|
}
|
2021-10-28 21:07:17 +00:00
|
|
|
|
2021-09-07 06:48:58 +00:00
|
|
|
if (!empty($_POST['save'])) {
|
|
|
|
try {
|
2022-12-10 17:02:56 +00:00
|
|
|
dcCore::app()->blog->settings->__get(basename(__DIR__))->dropEvery(
|
2021-09-07 06:48:58 +00:00
|
|
|
'dcAdvancedCleaner_behavior_active'
|
|
|
|
);
|
2022-12-10 17:02:56 +00:00
|
|
|
dcCore::app()->blog->settings->__get(basename(__DIR__))->put(
|
2021-11-06 15:19:49 +00:00
|
|
|
'dcAdvancedCleaner_behavior_active',
|
|
|
|
!empty($_POST['behavior_active']),
|
2021-09-07 06:48:58 +00:00
|
|
|
'boolean',
|
|
|
|
null,
|
|
|
|
true,
|
|
|
|
true
|
|
|
|
);
|
2022-12-10 17:02:56 +00:00
|
|
|
dcCore::app()->blog->settings->__get(basename(__DIR__))->dropEvery(
|
2021-09-07 06:48:58 +00:00
|
|
|
'dcAdvancedCleaner_dcproperty_hide'
|
|
|
|
);
|
2022-12-10 17:02:56 +00:00
|
|
|
dcCore::app()->blog->settings->__get(basename(__DIR__))->put(
|
2021-11-06 15:19:49 +00:00
|
|
|
'dcAdvancedCleaner_dcproperty_hide',
|
|
|
|
!empty($_POST['dcproperty_hide']),
|
2021-09-07 06:48:58 +00:00
|
|
|
'boolean',
|
|
|
|
null,
|
|
|
|
true,
|
|
|
|
true
|
|
|
|
);
|
2022-11-15 10:34:45 +00:00
|
|
|
dcAdminNotices::addSuccessNotice(
|
2021-09-07 06:48:58 +00:00
|
|
|
__('Configuration successfully updated.')
|
|
|
|
);
|
2022-11-15 10:34:45 +00:00
|
|
|
dcCore::app()->adminurl->redirect(
|
2021-11-06 15:19:49 +00:00
|
|
|
'admin.plugins',
|
2021-09-07 06:48:58 +00:00
|
|
|
[
|
2022-12-10 17:02:56 +00:00
|
|
|
'module' => basename(__DIR__),
|
2021-11-06 15:19:49 +00:00
|
|
|
'conf' => 1,
|
2022-11-15 10:34:45 +00:00
|
|
|
'redir' => empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'],
|
2021-09-07 06:48:58 +00:00
|
|
|
]
|
|
|
|
);
|
2021-11-06 15:19:49 +00:00
|
|
|
} catch (Exception $e) {
|
2022-11-15 10:34:45 +00:00
|
|
|
dcCore::app()->error->add($e->getMessage());
|
2021-09-07 06:48:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '
|
|
|
|
<p><label class="classic" for="behavior_active">' .
|
|
|
|
form::checkbox(
|
2021-11-06 15:19:49 +00:00
|
|
|
'behavior_active',
|
|
|
|
1,
|
2022-12-10 17:02:56 +00:00
|
|
|
dcCore::app()->blog->settings->__get(basename(__DIR__))->dcAdvancedCleaner_behavior_active
|
2021-09-07 06:48:58 +00:00
|
|
|
) . ' ' . __('Activate behaviors') . '</label></p>
|
|
|
|
<p class="form-note">' . __('Enable actions set in _uninstall.php files.') . '</p>
|
|
|
|
<p><label class="classic" for="dcproperty_hide">' .
|
|
|
|
form::checkbox(
|
2021-11-06 15:19:49 +00:00
|
|
|
'dcproperty_hide',
|
|
|
|
1,
|
2022-12-10 17:02:56 +00:00
|
|
|
dcCore::app()->blog->settings->__get(basename(__DIR__))->dcAdvancedCleaner_dcproperty_hide
|
2021-09-07 06:48:58 +00:00
|
|
|
) . ' ' . __('Hide Dotclear default properties in actions tabs') . '</label></p>
|
2021-11-06 15:19:49 +00:00
|
|
|
<p class="form-note">' .
|
|
|
|
__('Prevent from deleting Dotclear important properties.') . '</p>';
|