2023-03-25 23:03:44 +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
|
|
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\httpPassword;
|
|
|
|
|
|
|
|
use dcCore;
|
|
|
|
|
2023-05-08 08:37:35 +00:00
|
|
|
/**
|
|
|
|
* This module definitions.
|
|
|
|
*/
|
2023-03-25 23:03:44 +00:00
|
|
|
class My
|
|
|
|
{
|
2023-05-08 08:37:35 +00:00
|
|
|
/** @var string This plugin permissions */
|
2023-03-25 23:03:44 +00:00
|
|
|
public const PERMISSION = 'httpPassword';
|
|
|
|
|
2023-05-08 08:37:35 +00:00
|
|
|
/** @var string Passwords file name */
|
2023-03-25 23:03:44 +00:00
|
|
|
public const FILE_PASSWORD = '.htpasswd';
|
|
|
|
|
|
|
|
/**
|
2023-05-08 08:37:35 +00:00
|
|
|
* This module id.
|
2023-03-25 23:03:44 +00:00
|
|
|
*/
|
|
|
|
public static function id(): string
|
|
|
|
{
|
|
|
|
return basename(dirname(__DIR__));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-08 08:37:35 +00:00
|
|
|
* This module name.
|
2023-03-25 23:03:44 +00:00
|
|
|
*/
|
|
|
|
public static function name(): string
|
|
|
|
{
|
2023-05-08 08:37:35 +00:00
|
|
|
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
|
|
|
|
|
|
|
return __(is_string($name) ? $name : self::id());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This module path.
|
|
|
|
*/
|
|
|
|
public static function path(): string
|
|
|
|
{
|
|
|
|
return dirname(__DIR__);
|
|
|
|
}
|
|
|
|
|
2023-03-25 23:03:44 +00:00
|
|
|
/**
|
2023-05-08 08:37:35 +00:00
|
|
|
* Encryption methods combo.
|
|
|
|
*
|
|
|
|
* @return array<string,string>
|
2023-03-25 23:03:44 +00:00
|
|
|
*/
|
|
|
|
public static function cryptCombo(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
__('No encryption') => 'plaintext',
|
|
|
|
__('Crypt DES standard') => 'crypt_std_des',
|
|
|
|
__('Crypt DES étendu') => 'crypt_ext_des',
|
|
|
|
__('Crypt MD5') => 'crypt_md5',
|
|
|
|
__('Crypt Blowfish') => 'crypt_blowfish',
|
|
|
|
__('Crypt SHA256') => 'crypt_sha256',
|
|
|
|
__('Crypt SHA512') => 'crypt_sha512',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-08 08:37:35 +00:00
|
|
|
* Admin section menu.
|
|
|
|
*
|
|
|
|
* @return array<string,string>
|
2023-03-25 23:03:44 +00:00
|
|
|
*/
|
|
|
|
public static function sectionCombo(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
__('Settings') => 'settings',
|
|
|
|
__('Logins history') => 'logins',
|
|
|
|
__('Authorized users') => 'passwords',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|