2022-12-31 00:48:40 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @brief httpPassword, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Frederic PLE and contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2023-03-25 23:03:44 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\httpPassword;
|
|
|
|
|
|
|
|
use dcCore;
|
|
|
|
use dcNsProcess;
|
|
|
|
use Exception;
|
|
|
|
|
|
|
|
class Install extends dcNsProcess
|
|
|
|
{
|
|
|
|
public static function init(): bool
|
|
|
|
{
|
|
|
|
self::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
2022-12-31 00:48:40 +00:00
|
|
|
|
2023-03-25 23:03:44 +00:00
|
|
|
return self::$init;
|
2022-12-31 00:48:40 +00:00
|
|
|
}
|
|
|
|
|
2023-03-25 23:03:44 +00:00
|
|
|
public static function process(): bool
|
|
|
|
{
|
|
|
|
if (!self::$init) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-12-31 00:48:40 +00:00
|
|
|
|
2023-03-25 23:03:44 +00:00
|
|
|
try {
|
|
|
|
// Set settings
|
|
|
|
$s = dcCore::app()->blog->settings->get(My::id());
|
|
|
|
$s->put('active', false, 'boolean', 'Enable plugin', false, false);
|
|
|
|
$s->put('crypt', 'crypt_md5', 'string', 'Crypt algorithm', false, false);
|
|
|
|
$s->put('message', 'Private space', 'String', 'Personalized message on Authentication popup', false, false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} catch (Exception $e) {
|
|
|
|
dcCore::app()->error->add($e->getMessage());
|
|
|
|
}
|
2022-12-31 00:48:40 +00:00
|
|
|
|
2023-03-25 23:03:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|