Compare commits
No commits in common. "master" and "v1.7" have entirely different histories.
18
CHANGELOG.md
18
CHANGELOG.md
@ -1,21 +1,3 @@
|
||||
dcLog 1.7.3 - 2023.11.04
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
* Require PHP 8.1
|
||||
* Cosmetic code doc
|
||||
|
||||
dcLog 1.7.2 - 2023.10.13
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
* Require PHP 8.1
|
||||
* Upgrade to last minute change to Dotclear 2.28
|
||||
|
||||
dcLog 1.7.1 - 2023.10.11
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
* Require PHP 8.1
|
||||
* Code review
|
||||
|
||||
dcLog 1.7 - 2023.10.07
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
|
@ -1,7 +1,7 @@
|
||||
# README
|
||||
|
||||
[![Release](https://img.shields.io/badge/release-1.7.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/dcLog/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.11.04-c44d58.svg)
|
||||
[![Release](https://img.shields.io/badge/release-1.7-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/dcLog/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/dcLog)
|
||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/dcLog/src/branch/master/LICENSE)
|
||||
@ -16,7 +16,7 @@ _dcLog_ is a plugin for the open-source web publishing software called [Dotclear
|
||||
|
||||
* PHP 8.1+
|
||||
* Dotclear 2.28
|
||||
* Dotclear super admin permission
|
||||
* super admin permission
|
||||
|
||||
## USAGE
|
||||
|
||||
@ -36,6 +36,6 @@ Once it's done you can manage your logs from menu
|
||||
## CONTRIBUTORS
|
||||
|
||||
* Tomtom (author)
|
||||
* Jean-Christian Denis (latest)
|
||||
* Jean-Christian Denis
|
||||
|
||||
You are welcome to contribute to this code.
|
||||
|
25
_define.php
25
_define.php
@ -1,26 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* @brief The plugin dcLog definition
|
||||
* @ingroup dcLog
|
||||
* @brief dcLog, a plugin for Dotclear 2
|
||||
*
|
||||
* @defgroup dcLog Plugin dcLog.
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* Displays Dotclear logs.
|
||||
* @author Tomtom and Contributors
|
||||
*
|
||||
* @author Tomtom (author)
|
||||
* @author Jean-Christian Denis (latest)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->registerModule(
|
||||
"Dotclear's logs",
|
||||
'Displays Dotclear logs',
|
||||
'Tomtom and Contributors',
|
||||
'1.7.3',
|
||||
'1.7',
|
||||
[
|
||||
'requires' => [['core', '2.28']],
|
||||
'requires' => [
|
||||
['php', '8.1'],
|
||||
['core', '2.28'],
|
||||
],
|
||||
'permissions' => null,
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||
|
@ -2,10 +2,10 @@
|
||||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="dcLog">
|
||||
<name>Dotclear's logs</name>
|
||||
<version>1.7.3</version>
|
||||
<version>1.7</version>
|
||||
<author>Tomtom and Contributors</author>
|
||||
<desc>Displays Dotclear logs</desc>
|
||||
<file>https://git.dotclear.watch/JcDenis/dcLog/releases/download/v1.7.3/plugin-dcLog.zip</file>
|
||||
<file>https://git.dotclear.watch/JcDenis/dcLog/releases/download/v1.7/plugin-dcLog.zip</file>
|
||||
<da:dcmin>2.28</da:dcmin>
|
||||
<da:details>https://git.dotclear.watch/JcDenis/dcLog/src/branch/master/README.md</da:details>
|
||||
<da:support>https://git.dotclear.watch/JcDenis/dcLog/issues</da:support>
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief dcLog, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Tomtom 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\dcLog;
|
||||
@ -8,15 +18,8 @@ use ArrayObject;
|
||||
use Dotclear\App;
|
||||
use Dotclear\Core\Process;
|
||||
use Dotclear\Core\Backend\Favorites;
|
||||
use Dotclear\Core\Backend\Menus;
|
||||
|
||||
/**
|
||||
* @brief dcLog backend class.
|
||||
* @ingroup dcLog
|
||||
*
|
||||
* @author Tomtom (author)
|
||||
* @author Jean-Christian Denis (latest)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
class Backend extends Process
|
||||
{
|
||||
public static function init(): bool
|
||||
@ -30,7 +33,7 @@ class Backend extends Process
|
||||
return false;
|
||||
}
|
||||
|
||||
My::addBackendMenuItem(App::backend()->menus()::MENU_SYSTEM);
|
||||
My::addBackendMenuItem(Menus::MENU_SYSTEM);
|
||||
|
||||
App::behavior()->addBehaviors([
|
||||
// backend user preference for logs list columns
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief dcLog, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Tomtom 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\dcLog;
|
||||
@ -20,12 +30,7 @@ use Dotclear\Helper\Html\Form\{
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief dcLog logs list class.
|
||||
* @ingroup dcLog
|
||||
*
|
||||
* @author Tomtom (author)
|
||||
* @author Jean-Christian Denis (latest)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Backend logs list helper.
|
||||
*/
|
||||
class BackendList extends Listing
|
||||
{
|
||||
@ -48,7 +53,7 @@ class BackendList extends Listing
|
||||
return;
|
||||
}
|
||||
|
||||
$pager = new Pager($page, (int) $this->rs_count, $nb_per_page, 10);
|
||||
$pager = new Pager($page, $this->rs_count, $nb_per_page, 10);
|
||||
|
||||
$cols = new ArrayObject([
|
||||
'date' => (new Text('th', __('Date')))
|
||||
@ -69,7 +74,7 @@ class BackendList extends Listing
|
||||
|
||||
$lines = [];
|
||||
while ($this->rs->fetch()) {
|
||||
$lines[] = $this->line(isset($_POST['entries']) && in_array($this->rs->f('log_id'), $_POST['entries']));
|
||||
$lines[] = $this->line(isset($_POST['entries']) && in_array($this->rs->log_id, $_POST['entries']));
|
||||
}
|
||||
|
||||
echo
|
||||
@ -110,25 +115,25 @@ class BackendList extends Listing
|
||||
->class('nowrap minimal')
|
||||
->items([
|
||||
(new Checkbox(['entries[]'], $checked))
|
||||
->value($this->rs->f('log_id')),
|
||||
->value($this->rs->log_id),
|
||||
]),
|
||||
'date' => (new Text('td', Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->f('log_dt')))))
|
||||
'date' => (new Text('td', Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->log_dt))))
|
||||
->class('nowrap minimal'),
|
||||
'msg' => (new Text('td', nl2br(Html::escapeHTML($this->rs->f('log_msg')))))
|
||||
'msg' => (new Text('td', nl2br(Html::escapeHTML($this->rs->log_msg))))
|
||||
->class('maximal'),
|
||||
'blog' => (new Text('td', Html::escapeHTML($this->rs->f('blog_id'))))
|
||||
'blog' => (new Text('td', Html::escapeHTML($this->rs->blog_id)))
|
||||
->class('nowrap minimal'),
|
||||
'table' => (new Text('td', Html::escapeHTML($this->rs->f('log_table'))))
|
||||
'table' => (new Text('td', Html::escapeHTML($this->rs->log_table)))
|
||||
->class('nowrap minimal'),
|
||||
'user' => (new Text('td', Html::escapeHTML($this->rs->getUserCN())))
|
||||
->class('nowrap minimal'),
|
||||
'ip' => (new Text('td', Html::escapeHTML($this->rs->f('log_ip'))))
|
||||
'ip' => (new Text('td', Html::escapeHTML($this->rs->log_ip)))
|
||||
->class('nowrap minimal'),
|
||||
]);
|
||||
$this->userColumns(My::BACKEND_LIST_ID, $cols);
|
||||
|
||||
return
|
||||
(new Para('p' . $this->rs->f('log_id'), 'tr'))
|
||||
(new Para('p' . $this->rs->log_id, 'tr'))
|
||||
->class('line')
|
||||
->items(iterator_to_array($cols));
|
||||
}
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief dcLog, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Tomtom 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\dcLog;
|
||||
@ -21,12 +31,7 @@ use Dotclear\Helper\Html\Form\{
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @brief dcLog manage class.
|
||||
* @ingroup dcLog
|
||||
*
|
||||
* @author Tomtom (author)
|
||||
* @author Jean-Christian Denis (latest)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Manage logs list
|
||||
*/
|
||||
class Manage extends Process
|
||||
{
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief dcLog, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Tomtom 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\dcLog;
|
||||
@ -13,62 +23,29 @@ use Dotclear\Database\MetaRecord;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @brief dcLog properties helper.
|
||||
* @ingroup dcLog
|
||||
*
|
||||
* @author Tomtom (author)
|
||||
* @author Jean-Christian Denis (latest)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Backend logs manage page vars container.
|
||||
*/
|
||||
class ManageVars
|
||||
{
|
||||
/**
|
||||
* ManageVars instance.
|
||||
*
|
||||
* @var ManageVars $container
|
||||
*/
|
||||
/** @var ManageVars $container self instance */
|
||||
private static $container;
|
||||
|
||||
/**
|
||||
* The filter instance.
|
||||
*
|
||||
* @var Filters $filter
|
||||
*/
|
||||
/** @var Filters $filter The filter instance */
|
||||
public readonly Filters $filter;
|
||||
|
||||
/**
|
||||
* The current records.
|
||||
*
|
||||
* @var null|MetaRecord $logs
|
||||
*/
|
||||
/** @var null|MetaRecord $logs The current records */
|
||||
public readonly ?MetaRecord $logs;
|
||||
|
||||
/**
|
||||
* The records list form instance.
|
||||
*
|
||||
* @var null|BackendList $list
|
||||
*/
|
||||
/** @var null|BackendList $list The records list form instance */
|
||||
public readonly ?BackendList $list;
|
||||
|
||||
/**
|
||||
* The post form selected entries.
|
||||
*
|
||||
* @var array<int,string> $entries
|
||||
*/
|
||||
/** @var array<int,string> $entries The post form selected entries */
|
||||
public readonly array $entries;
|
||||
|
||||
/**
|
||||
* The post form action.
|
||||
*
|
||||
* @var bool $selected_logs
|
||||
*/
|
||||
/** @var bool $selected_logs The post form action */
|
||||
public readonly bool $selected_logs;
|
||||
|
||||
/**
|
||||
* The post form action.
|
||||
*
|
||||
* @var bool $all_logs
|
||||
*/
|
||||
/** @var bool $all_logs The post form action */
|
||||
public readonly bool $all_logs;
|
||||
|
||||
/**
|
||||
|
32
src/My.php
32
src/My.php
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief dcLog, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Tomtom 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\dcLog;
|
||||
@ -7,29 +17,13 @@ namespace Dotclear\Plugin\dcLog;
|
||||
use Dotclear\App;
|
||||
use Dotclear\Module\MyPlugin;
|
||||
|
||||
/**
|
||||
* @brief dcLog My helper.
|
||||
* @ingroup dcLog
|
||||
*
|
||||
* @author Tomtom (author)
|
||||
* @author Jean-Christian Denis (latest)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
class My extends MyPlugin
|
||||
{
|
||||
/**
|
||||
* Admin list ID.
|
||||
*
|
||||
* @var string BACKEND_LIST_ID
|
||||
*/
|
||||
/** @var string Admin list ID */
|
||||
public const BACKEND_LIST_ID = 'dcloglist';
|
||||
|
||||
public static function checkCustomContext(int $context): ?bool
|
||||
{
|
||||
return match ($context) {
|
||||
// Limit to super admin
|
||||
self::MODULE => App::auth()->isSuperAdmin(),
|
||||
default => null,
|
||||
};
|
||||
return App::auth()->isSuperAdmin();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user