upgrade to Dotclear 2.28
This commit is contained in:
parent
5e68594f22
commit
5d464edb28
@ -1,3 +1,9 @@
|
|||||||
|
httpPassword 1.5 - 2023.10.17
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
httpPassword 1.4 - 2023.08.12
|
httpPassword 1.4 - 2023.08.12
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
28
README.md
28
README.md
@ -1,24 +1,21 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-1.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/httpPassword/releases)
|
[![Release](https://img.shields.io/badge/release-1.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/httpPassword/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.12-c44d58.svg)](https://git.dotclear.watch/JcDenis/httpPassword/releases)
|
![Date](https://img.shields.io/badge/date-2023.08.12-c44d58.svg)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/httpPassword)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/httpPassword)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/httpPassword)](https://git.dotclear.watch/JcDenis/httpPassword/blob/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/httpPassword/src/branch/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS HTTPPASSWORD ?
|
## ABOUT
|
||||||
|
|
||||||
_httpPassword_ is a plugin for the open-source
|
_httpPassword_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||||
web publishing software called Dotclear.
|
|
||||||
|
|
||||||
Its helps to manage .httppassword files to make a blog private.
|
> Help to manage .httppassword files to make a blog private.
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_httpPassword_ requires:
|
* Dotclear 2.28
|
||||||
|
* PHP 8.1+
|
||||||
* Dotclear 2.27
|
|
||||||
* PHP 7.4+
|
|
||||||
* Write permissions on blogs directories
|
* Write permissions on blogs directories
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
@ -30,14 +27,15 @@ Manage settings, last logins, authorized users from sidebar menu _Http password_
|
|||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* [License](https://git.dotclear.watch/JcDenis/httpPassword/src/branch/master/LICENSE)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/httpPassword) or [GitHub Page](https://github.com/JcDenis/httpPassword)
|
* [Packages & details](https://git.dotclear.watch/JcDenis/httpPassword/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/httpPassword))
|
||||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/httpPassword/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/httpPassword)
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/httpPassword) (or on [GitHub](https://github.com/JcDenis/httpPassword))
|
||||||
* Discussion & Help: [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?pid=331158)
|
* [Issues & security](https://git.dotclear.watch/JcDenis/httpPassword/issues) (or on [GitHub](https://github.com/JcDenis/httpPassword/issues))
|
||||||
|
* [Discuss & Help](http://forum.dotclear.org/viewtopic.php?pid=331158)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Frederic PLE (author)
|
* Frederic PLE (author)
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (latest)
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
24
_define.php
24
_define.php
@ -1,29 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief httpPassword, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin httpPassword definition
|
||||||
|
* @ingroup httpPassword
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup httpPassword Plugin httpPassword.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Frederic PLE and contributors
|
* Manage .htpasswd file to make the blog private.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {
|
declare(strict_types=1);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Http password',
|
'Http password',
|
||||||
'Manage .htpasswd file to make the blog private',
|
'Manage .htpasswd file to make the blog private',
|
||||||
'Frederic PLE and contributors',
|
'Frederic PLE and contributors',
|
||||||
'1.4',
|
'1.5',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.27']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => 'My',
|
||||||
dcCore::app()->auth::PERMISSION_ADMIN,
|
|
||||||
]),
|
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
|
21
_init.php
21
_init.php
@ -1,21 +0,0 @@
|
|||||||
<?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
|
|
||||||
*/
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
class initHttpPassword
|
|
||||||
{
|
|
||||||
public const PERMISSION = 'httpPassword';
|
|
||||||
public const FILE_PASSWORD = '.htpasswd';
|
|
||||||
}
|
|
@ -2,11 +2,11 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="httpPassword">
|
<module id="httpPassword">
|
||||||
<name>Http password</name>
|
<name>Http password</name>
|
||||||
<version>1.4</version>
|
<version>1.5</version>
|
||||||
<author>Frederic PLE and contributors</author>
|
<author>Frederic PLE and contributors</author>
|
||||||
<desc>Manage .htpasswd file to make the blog private</desc>
|
<desc>Manage .htpasswd file to make the blog private</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/httpPassword/releases/download/v1.4/plugin-httpPassword.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/httpPassword/releases/download/v1.5/plugin-httpPassword.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/httpPassword/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/httpPassword/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/httpPassword/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/httpPassword/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\httpPassword;
|
namespace Dotclear\Plugin\httpPassword;
|
||||||
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief httpPassword backend class.
|
||||||
|
* @ingroup httpPassword
|
||||||
|
*
|
||||||
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Backend extends Process
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\httpPassword;
|
namespace Dotclear\Plugin\httpPassword;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcLog;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief httpPassword frontend class.
|
||||||
|
* @ingroup httpPassword
|
||||||
|
*
|
||||||
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Frontend extends Process
|
class Frontend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -32,9 +29,8 @@ class Frontend extends Process
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check password on frontend
|
// check password on frontend
|
||||||
dcCore::app()->addBehavior('publicPrependV2', function (): void {
|
App::behavior()->addBehavior('publicPrependV2', function (): void {
|
||||||
// nullsafe
|
if (!App::blog()->isDefined()) {
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$PHP_AUTH_USER = $PHP_AUTH_PW = '';
|
$PHP_AUTH_USER = $PHP_AUTH_PW = '';
|
||||||
@ -44,19 +40,19 @@ class Frontend extends Process
|
|||||||
$PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];
|
$PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];
|
||||||
} elseif (isset($_ENV['REMOTE_USER'])) {
|
} elseif (isset($_ENV['REMOTE_USER'])) {
|
||||||
[$PHP_AUTH_PW, $PHP_AUTH_USER] = explode(' ', $_ENV['REMOTE_USER'], 2);
|
[$PHP_AUTH_PW, $PHP_AUTH_USER] = explode(' ', $_ENV['REMOTE_USER'], 2);
|
||||||
[$PHP_AUTH_USER, $PHP_AUTH_PW] = explode(':', base64_decode($PHP_AUTH_USER));
|
[$PHP_AUTH_USER, $PHP_AUTH_PW] = explode(':', base64_decode((string) $PHP_AUTH_USER));
|
||||||
}
|
}
|
||||||
if ($PHP_AUTH_PW === '' or $PHP_AUTH_USER === '') {
|
if ($PHP_AUTH_PW === '' or $PHP_AUTH_USER === '') {
|
||||||
Utils::sendHttp401();
|
Utils::sendHttp401();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_file(dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . My::FILE_PASSWORD)) {
|
if (!is_file(App::blog()->publicPath() . DIRECTORY_SEPARATOR . My::FILE_PASSWORD)) {
|
||||||
header('HTTP/1.0 500 Internal Server Error');
|
header('HTTP/1.0 500 Internal Server Error');
|
||||||
echo 'httpPassword plugin is not well configured.';
|
echo 'httpPassword plugin is not well configured.';
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$htpasswd = file(dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . My::FILE_PASSWORD, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
$htpasswd = file(App::blog()->publicPath() . DIRECTORY_SEPARATOR . My::FILE_PASSWORD, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
$authenticated = false;
|
$authenticated = false;
|
||||||
if ($htpasswd !== false) {
|
if ($htpasswd !== false) {
|
||||||
foreach ($htpasswd as $ligne) {
|
foreach ($htpasswd as $ligne) {
|
||||||
@ -73,18 +69,18 @@ class Frontend extends Process
|
|||||||
if (!$authenticated) {
|
if (!$authenticated) {
|
||||||
Utils::sendHttp401();
|
Utils::sendHttp401();
|
||||||
} else {
|
} else {
|
||||||
$logs = dcCore::app()->log->getLogs(['log_table' => My::id(), 'log_msg' => $PHP_AUTH_USER]);
|
$logs = App::log()->getLogs(['log_table' => My::id(), 'log_msg' => $PHP_AUTH_USER]);
|
||||||
if (!$logs->isEmpty()) {
|
if (!$logs->isEmpty()) {
|
||||||
$ids = [];
|
$ids = [];
|
||||||
while ($logs->fetch()) {
|
while ($logs->fetch()) {
|
||||||
$ids[] = is_numeric($logs->f('log_id')) ? (int) $logs->f('log_id') : 0;
|
$ids[] = is_numeric($logs->f('log_id')) ? (int) $logs->f('log_id') : 0;
|
||||||
}
|
}
|
||||||
$logs = dcCore::app()->log->delLogs($ids);
|
$logs = App::log()->delLogs($ids);
|
||||||
}
|
}
|
||||||
$cursor = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME);
|
$cursor = App::log()->openLogCursor();
|
||||||
$cursor->setField('log_table', My::id());
|
$cursor->setField('log_table', My::id());
|
||||||
$cursor->setField('log_msg', $PHP_AUTH_USER);
|
$cursor->setField('log_msg', $PHP_AUTH_USER);
|
||||||
dcCore::app()->log->addLog($cursor);
|
App::log()->addLog($cursor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\httpPassword;
|
namespace Dotclear\Plugin\httpPassword;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief httpPassword install class.
|
||||||
|
* @ingroup httpPassword
|
||||||
|
*
|
||||||
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Install extends Process
|
class Install extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -40,7 +38,7 @@ class Install extends Process
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\httpPassword;
|
namespace Dotclear\Plugin\httpPassword;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
Page
|
Page
|
||||||
@ -37,7 +27,12 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage contributions list
|
* @brief httpPassword manage class.
|
||||||
|
* @ingroup httpPassword
|
||||||
|
*
|
||||||
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class Manage extends Process
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
@ -48,7 +43,7 @@ class Manage extends Process
|
|||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || is_null(dcCore::app()->blog)) {
|
if (!self::status() || !App::blog()->isDefined()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +66,7 @@ class Manage extends Process
|
|||||||
$s->put('crypt', in_array((string) $_POST['crypt'], My::cryptCombo()) ? $_POST['crypt'] : 'paintext');
|
$s->put('crypt', in_array((string) $_POST['crypt'], My::cryptCombo()) ? $_POST['crypt'] : 'paintext');
|
||||||
$s->put('message', (string) $_POST['message']);
|
$s->put('message', (string) $_POST['message']);
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Settings successfully updated.')
|
__('Settings successfully updated.')
|
||||||
@ -82,13 +77,13 @@ class Manage extends Process
|
|||||||
|
|
||||||
// delete users logins
|
// delete users logins
|
||||||
if ('savelogins' == $action) {
|
if ('savelogins' == $action) {
|
||||||
$logs = dcCore::app()->log->getLogs(['log_table' => My::id()]);
|
$logs = App::log()->getLogs(['log_table' => My::id()]);
|
||||||
if (!$logs->isEmpty()) {
|
if (!$logs->isEmpty()) {
|
||||||
$ids = [];
|
$ids = [];
|
||||||
while ($logs->fetch()) {
|
while ($logs->fetch()) {
|
||||||
$ids[] = $logs->__get('log_id');
|
$ids[] = $logs->__get('log_id');
|
||||||
}
|
}
|
||||||
$logs = dcCore::app()->log->delLogs($ids);
|
$logs = App::log()->delLogs($ids);
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Logs successfully cleared.')
|
__('Logs successfully cleared.')
|
||||||
@ -130,7 +125,7 @@ class Manage extends Process
|
|||||||
}
|
}
|
||||||
file_put_contents(Utils::passwordFile(), $contents);
|
file_put_contents(Utils::passwordFile(), $contents);
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Logins successfully updated.')
|
__('Logins successfully updated.')
|
||||||
@ -144,7 +139,7 @@ class Manage extends Process
|
|||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!self::status() || is_null(dcCore::app()->blog)) {
|
if (!self::status() || !App::blog()->isDefined()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +202,7 @@ class Manage extends Process
|
|||||||
|
|
||||||
// delete logins form
|
// delete logins form
|
||||||
if ('logins' == $part) {
|
if ('logins' == $part) {
|
||||||
$logs = dcCore::app()->log->getLogs(['log_table' => My::id()]);
|
$logs = App::log()->getLogs(['log_table' => My::id()]);
|
||||||
if ($logs->isEmpty()) {
|
if ($logs->isEmpty()) {
|
||||||
echo
|
echo
|
||||||
'<p>' . __('Logins history is empty.') . '</p>';
|
'<p>' . __('Logins history is empty.') . '</p>';
|
||||||
|
25
src/My.php
25
src/My.php
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\httpPassword;
|
namespace Dotclear\Plugin\httpPassword;
|
||||||
@ -17,11 +7,20 @@ namespace Dotclear\Plugin\httpPassword;
|
|||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* @brief httpPassword My helper.
|
||||||
|
* @ingroup httpPassword
|
||||||
|
*
|
||||||
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
/** @var string Passwords file name */
|
/**
|
||||||
|
* Passwords file name.
|
||||||
|
*
|
||||||
|
* @var string FILE_PASSWORD
|
||||||
|
*/
|
||||||
public const FILE_PASSWORD = '.htpasswd';
|
public const FILE_PASSWORD = '.htpasswd';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\httpPassword;
|
namespace Dotclear\Plugin\httpPassword;
|
||||||
|
|
||||||
use dcCore;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief httpPassword uninstall class.
|
||||||
|
* @ingroup httpPassword
|
||||||
|
*
|
||||||
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Uninstall extends Process
|
class Uninstall extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -27,7 +24,7 @@ class Uninstall extends Process
|
|||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\httpPassword;
|
namespace Dotclear\Plugin\httpPassword;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief httpPassword utils.
|
||||||
|
* @ingroup httpPassword
|
||||||
|
*
|
||||||
|
* @author Frederic PLE (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Utils
|
class Utils
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -71,7 +69,7 @@ class Utils
|
|||||||
|
|
||||||
if ($saltlen > 0) {
|
if ($saltlen > 0) {
|
||||||
$salt .= substr(
|
$salt .= substr(
|
||||||
sha1(dcCore::app()->getNonce() . date('U')),
|
sha1(App::nonce()->getNonce() . date('U')),
|
||||||
2,
|
2,
|
||||||
$saltlen - strlen($salt)
|
$saltlen - strlen($salt)
|
||||||
);
|
);
|
||||||
@ -118,7 +116,7 @@ class Utils
|
|||||||
*/
|
*/
|
||||||
public static function passwordFile(): string
|
public static function passwordFile(): string
|
||||||
{
|
{
|
||||||
return is_null(dcCore::app()->blog) ? '' : dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . My::FILE_PASSWORD;
|
return App::blog()->isDefined() ? App::blog()->publicPath() . DIRECTORY_SEPARATOR . My::FILE_PASSWORD : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user