Compare commits
10 Commits
8315eede38
...
fd582fa42c
Author | SHA1 | Date |
---|---|---|
Jean-Christian Paul Denis | fd582fa42c | |
Jean-Christian Paul Denis | 5b53934df4 | |
Jean-Christian Paul Denis | 40218754cc | |
Jean-Christian Paul Denis | 5934b35b2f | |
Jean-Christian Paul Denis | f6e457f977 | |
Jean-Christian Paul Denis | 75afbcda1c | |
Jean-Christian Paul Denis | 4994f376ca | |
Jean-Christian Paul Denis | 22f9028b71 | |
Jean-Christian Paul Denis | 9c18513b32 | |
Jean-Christian Paul Denis | 966366a92f |
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -1,3 +1,20 @@
|
||||||
|
1.5 - 2023.07.28
|
||||||
|
- require dotclear 2.27
|
||||||
|
- require PHP 8.1+
|
||||||
|
- update to dotclear 2.27-dev
|
||||||
|
|
||||||
|
1.4 - 2023.05.13
|
||||||
|
- require dotclear 2.26
|
||||||
|
- require PHP 8.1+
|
||||||
|
- use define php_min
|
||||||
|
|
||||||
|
1.3.1 - 2023.04.29
|
||||||
|
- require dotclear 2.26
|
||||||
|
- require PHP 8.1+
|
||||||
|
- use Html Form Component everywhere
|
||||||
|
- fix submit contidions (js)
|
||||||
|
- fix phpstan level9 warnings
|
||||||
|
|
||||||
1.3 - 2023.04.23
|
1.3 - 2023.04.23
|
||||||
- require dotclear 2.26
|
- require dotclear 2.26
|
||||||
- require PHP 8.1+
|
- require PHP 8.1+
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[![Release](https://img.shields.io/github/v/release/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/releases)
|
[![Release](https://img.shields.io/github/v/release/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/releases)
|
||||||
[![Date](https://img.shields.io/github/release-date/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/releases)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/releases)
|
||||||
[![Issues](https://img.shields.io/github/issues/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/issues)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/issues)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/dcLog)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/dcLog)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/dcLog)](https://github.com/JcDenis/dcLog/blob/master/LICENSE)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ Display dotclear's logs.
|
||||||
_dcLog_ requires:
|
_dcLog_ requires:
|
||||||
|
|
||||||
* PHP 8.1+
|
* PHP 8.1+
|
||||||
* Dotclear 2.26
|
* Dotclear 2.27
|
||||||
* super admin permission
|
* super admin permission
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
|
@ -18,9 +18,12 @@ $this->registerModule(
|
||||||
"Dotclear's logs",
|
"Dotclear's logs",
|
||||||
'Displays Dotclear logs',
|
'Displays Dotclear logs',
|
||||||
'Tomtom and Contributors',
|
'Tomtom and Contributors',
|
||||||
'1.3',
|
'1.5',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.26']],
|
'requires' => [
|
||||||
|
['php', '8.1'],
|
||||||
|
['core', '2.27'],
|
||||||
|
],
|
||||||
'permissions' => null,
|
'permissions' => null,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="dcLog">
|
<module id="dcLog">
|
||||||
<name>Dotclear's logs</name>
|
<name>Dotclear's logs</name>
|
||||||
<version>1.3</version>
|
<version>1.5</version>
|
||||||
<author>Tomtom and Contributors</author>
|
<author>Tomtom and Contributors</author>
|
||||||
<desc>Displays Dotclear logs</desc>
|
<desc>Displays Dotclear logs</desc>
|
||||||
<file>https://github.com/JcDenis/dcLog/releases/download/v1.3/plugin-dcLog.zip</file>
|
<file>https://github.com/JcDenis/dcLog/releases/download/v1.5/plugin-dcLog.zip</file>
|
||||||
<da:dcmin>2.26</da:dcmin>
|
<da:dcmin>2.27</da:dcmin>
|
||||||
<da:details>https://plugins.dotaddict.org/dc2/details/dcLog</da:details>
|
<da:details>https://plugins.dotaddict.org/dc2/details/dcLog</da:details>
|
||||||
<da:support>https://github.com/JcDenis/dcLog</da:support>
|
<da:support>https://github.com/JcDenis/dcLog</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
|
10
icon.svg
10
icon.svg
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
|
<svg width="800px" height="800px" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
<rect width="48" height="48" fill="white" fill-opacity="0.01"/>
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
<rect x="4" y="4" width="40" height="40" rx="2" stroke="#b2b2b2" stroke-width="3" stroke-linejoin="round"/>
|
||||||
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
|
<path d="M12 18L19 24L12 30" stroke="#C44D58" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
<g><g transform="translate(0.000000,511.000000) scale(0.100000,-0.100000)"><path d="M680,4167.7c-238.6-74.9-411.6-226.9-519.2-458.4L100,3580.6V107.4v-3473.3l60.8-131c86.5-184.8,210.5-311.1,390.6-400l156.7-77.2H5000h4291.9l131,60.8c184.8,86.5,311.1,210.5,400,390.6l77.2,156.7V107.4v3473.3l-77.2,156.7c-88.9,180.1-215.2,304.1-400,390.6l-131,60.8l-4256.8,4.7C1561.8,4195.8,759.6,4191.1,680,4167.7z M1526.7,3524.5c208.2-121.6,259.6-421,100.6-601.1c-95.9-107.6-180.1-149.7-311.1-149.7c-222.2,0-409.3,184.8-409.3,404.6c0,91.2,70.2,247.9,135.7,304.1C1166.5,3594.7,1379.4,3611,1526.7,3524.5z M2663.4,3566.6c184.8-63.1,287.7-222.2,273.6-421c-16.4-240.9-187.1-385.9-430.4-367.2c-219.9,18.7-360.2,170.7-360.2,392.9c0,135.7,35.1,217.5,133.3,306.4C2392.1,3583,2523.1,3613.4,2663.4,3566.6z M3982.6,3524.5c208.2-121.6,259.6-421,100.6-601.1c-93.6-105.2-180.1-149.7-297-149.7c-233.9,0-423.3,182.4-423.3,402.3c0,93.6,70.2,247.9,135.6,306.4C3622.4,3594.7,3835.2,3611,3982.6,3524.5z M9322.3-559.2l-7-2701.4l-65.5-63.2l-63.2-65.5H5000H813.4l-63.2,65.5l-65.5,63.2l-7,2701.4L673,2142.2h4327h4327L9322.3-559.2z"/><path d="M2941.8,1225.4c-114.6-77.2-177.8-233.9-142.7-357.8c14-51.5,39.8-109.9,56.1-128.6c14-21,301.7-257.3,636.2-523.9c334.5-269,615.1-493.5,626.8-502.9c9.4-9.3-259.6-236.2-596.4-505.2c-336.8-271.3-631.5-512.2-654.9-535.6c-166-177.7-51.4-498.2,194.1-547.3c44.4-9.4,109.9-14.1,145-9.4C3280.9-1876,4913.5-587.3,4981.3-482c56.1,84.2,56.1,276,0,360.2c-21.1,32.7-411.7,357.8-867.7,722.7l-825.6,661.9l-133.3,9.4C3047,1279.2,3009.6,1272.1,2941.8,1225.4z"/><path d="M4871.4-1866.7c-95.9-42.1-194.1-161.4-212.8-259.6c-32.7-180.1,109.9-369.5,299.4-397.6c56.1-7,533.3-11.7,1064.2-7c1094.6,7,1043.1-2.4,1148.4,210.5c65.5,131,53.8,243.2-37.4,350.8c-114.6,135.7-121.6,135.7-1202.2,135.7C5161.4-1836.2,4925.2-1843.3,4871.4-1866.7z"/></g></g>
|
<path d="M23 32H36" stroke="#C44D58" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
</svg>
|
</svg>
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 534 B |
|
@ -1,16 +1,17 @@
|
||||||
/*global $, dotclear */
|
/*global $, dotclear */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Object.assign(dotclear.msg, dotclear.getData('dclog_list'));
|
Object.assign(dotclear.msg, dotclear.getData('dcLog_msg'));
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$('.checkboxes-helpers').each(function(){
|
$('.checkboxes-helpers').each(function(){
|
||||||
dotclear.checkboxesHelpers(this)
|
dotclear.checkboxesHelpers(this)
|
||||||
});
|
});
|
||||||
$('input[name="del_logs"]').click(function(){
|
$('input[name="selected_logs"]').click(function(){
|
||||||
return window.confirm(dotclear.msg.confirm_delete_selected_log)
|
return window.confirm(dotclear.msg.confirm_delete_selected_log)
|
||||||
});
|
});
|
||||||
$('input[name="del_all_logs"]').click(function(){
|
$('input[name="all_logs"]').click(function(){
|
||||||
return window.confirm(dotclear.msg.confirm_delete_all_log)
|
return window.confirm(dotclear.msg.confirm_delete_all_log)
|
||||||
})
|
})
|
||||||
|
dotclear.condSubmit('#dcLog_form td input[type=checkbox]', '#dcLog_form #selected_logs');
|
||||||
})
|
})
|
|
@ -15,44 +15,26 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcAdmin;
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcFavorites;
|
use Dotclear\Core\Process;
|
||||||
use dcMenu;
|
use Dotclear\Core\Backend\Favorites;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Backend\Menus;
|
||||||
use dcPage;
|
|
||||||
|
|
||||||
class Backend extends dcNsProcess
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::BACKEND));
|
||||||
&& My::phpCompliant()
|
;
|
||||||
&& !is_null(dcCore::app()->auth)
|
|
||||||
&& dcCore::app()->auth->isSuperAdmin();
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// backend sidebar menu icon
|
My::addBackendMenuItem(Menus::MENU_SYSTEM);
|
||||||
if (!is_null(dcCore::app()->auth)
|
|
||||||
&& !is_null(dcCore::app()->adminurl)
|
|
||||||
&& (dcCore::app()->menu[dcAdmin::MENU_SYSTEM] instanceof dcMenu)
|
|
||||||
) {
|
|
||||||
dcCore::app()->menu[dcAdmin::MENU_SYSTEM]->addItem(
|
|
||||||
My::name(),
|
|
||||||
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
|
||||||
dcPage::getPF(My::id() . '/icon.svg'),
|
|
||||||
preg_match('/' . preg_quote((string) dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
|
||||||
dcCore::app()->auth->isSuperAdmin()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
dcCore::app()->addBehaviors([
|
||||||
// backend user preference for logs list columns
|
// backend user preference for logs list columns
|
||||||
|
@ -87,12 +69,12 @@ class Backend extends dcNsProcess
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
// backend user preference for dashboard icon
|
// backend user preference for dashboard icon
|
||||||
'adminDashboardFavoritesV2' => function (dcFavorites $favs): void {
|
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
|
||||||
$favs->register(My::BACKEND_LIST_ID, [
|
$favs->register(My::BACKEND_LIST_ID, [
|
||||||
'title' => My::name(),
|
'title' => My::name(),
|
||||||
'url' => dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
|
'url' => My::manageUrl(),
|
||||||
'small-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
'small-icon' => My::icons(),
|
||||||
'large-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
'large-icon' => My::icons(),
|
||||||
//'permissions' => null,
|
//'permissions' => null,
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,8 +15,10 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use adminGenericListV2;
|
use Dotclear\Core\Backend\Listing\{
|
||||||
use dcPager;
|
Listing,
|
||||||
|
Pager
|
||||||
|
};
|
||||||
use Dotclear\Helper\Date;
|
use Dotclear\Helper\Date;
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
|
@ -30,7 +32,7 @@ use Dotclear\Helper\Html\Form\{
|
||||||
/**
|
/**
|
||||||
* Backend logs list helper.
|
* Backend logs list helper.
|
||||||
*/
|
*/
|
||||||
class BackendList extends adminGenericListV2
|
class BackendList extends Listing
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Display logs record.
|
* Display logs record.
|
||||||
|
@ -47,10 +49,13 @@ class BackendList extends adminGenericListV2
|
||||||
(new Text('p', $filter ? __('No log matches the filter') : __('No log')))
|
(new Text('p', $filter ? __('No log matches the filter') : __('No log')))
|
||||||
->class('info')
|
->class('info')
|
||||||
->render();
|
->render();
|
||||||
} else {
|
|
||||||
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
|
|
||||||
|
|
||||||
$cols = [
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pager = new Pager($page, $this->rs_count, $nb_per_page, 10);
|
||||||
|
|
||||||
|
$cols = new ArrayObject([
|
||||||
'date' => (new Text('th', __('Date')))
|
'date' => (new Text('th', __('Date')))
|
||||||
->class('first')
|
->class('first')
|
||||||
->extra('colspan="2"'),
|
->extra('colspan="2"'),
|
||||||
|
@ -64,8 +69,7 @@ class BackendList extends adminGenericListV2
|
||||||
->extra('scope="col"'),
|
->extra('scope="col"'),
|
||||||
'ip' => (new Text('th', __('IP')))
|
'ip' => (new Text('th', __('IP')))
|
||||||
->extra('scope="col"'),
|
->extra('scope="col"'),
|
||||||
];
|
]);
|
||||||
$cols = new ArrayObject($cols);
|
|
||||||
$this->userColumns(My::BACKEND_LIST_ID, $cols);
|
$this->userColumns(My::BACKEND_LIST_ID, $cols);
|
||||||
|
|
||||||
$lines = [];
|
$lines = [];
|
||||||
|
@ -98,7 +102,6 @@ class BackendList extends adminGenericListV2
|
||||||
) .
|
) .
|
||||||
$pager->getLinks();
|
$pager->getLinks();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a records line.
|
* Get a records line.
|
||||||
|
@ -107,7 +110,7 @@ class BackendList extends adminGenericListV2
|
||||||
*/
|
*/
|
||||||
private function line(bool $checked): Component
|
private function line(bool $checked): Component
|
||||||
{
|
{
|
||||||
$cols = [
|
$cols = new ArrayObject([
|
||||||
'check' => (new Para(null, 'td'))
|
'check' => (new Para(null, 'td'))
|
||||||
->class('nowrap minimal')
|
->class('nowrap minimal')
|
||||||
->items([
|
->items([
|
||||||
|
@ -126,12 +129,12 @@ class BackendList extends adminGenericListV2
|
||||||
->class('nowrap minimal'),
|
->class('nowrap minimal'),
|
||||||
'ip' => (new Text('td', Html::escapeHTML($this->rs->log_ip)))
|
'ip' => (new Text('td', Html::escapeHTML($this->rs->log_ip)))
|
||||||
->class('nowrap minimal'),
|
->class('nowrap minimal'),
|
||||||
];
|
]);
|
||||||
$cols = new ArrayObject($cols);
|
|
||||||
$this->userColumns(My::BACKEND_LIST_ID, $cols);
|
$this->userColumns(My::BACKEND_LIST_ID, $cols);
|
||||||
|
|
||||||
return
|
return
|
||||||
(new Para('p' . $this->rs->log_id, 'tr'))
|
(new Para('p' . $this->rs->log_id, 'tr'))
|
||||||
|
->class('line')
|
||||||
->items(iterator_to_array($cols));
|
->items(iterator_to_array($cols));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,11 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
use dcPage;
|
use Dotclear\Core\Backend\{
|
||||||
|
Notices,
|
||||||
|
Page
|
||||||
|
};
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Div,
|
Div,
|
||||||
Form,
|
Form,
|
||||||
|
@ -30,21 +33,16 @@ use Exception;
|
||||||
/**
|
/**
|
||||||
* Manage logs list
|
* Manage logs list
|
||||||
*/
|
*/
|
||||||
class Manage extends dcNsProcess
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::MANAGE));
|
||||||
&& My::phpCompliant()
|
|
||||||
&& !is_null(dcCore::app()->auth)
|
|
||||||
&& dcCore::app()->auth->isSuperAdmin();
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +52,12 @@ class Manage extends dcNsProcess
|
||||||
if ($current->selected_logs && !empty($current->entries) || $current->all_logs) {
|
if ($current->selected_logs && !empty($current->entries) || $current->all_logs) {
|
||||||
try {
|
try {
|
||||||
dcCore::app()->log->delLogs($current->entries, $current->all_logs);
|
dcCore::app()->log->delLogs($current->entries, $current->all_logs);
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
$current->all_logs ?
|
$current->all_logs ?
|
||||||
__('All logs have been successfully deleted') :
|
__('All logs have been successfully deleted') :
|
||||||
__('Selected logs have been successfully deleted')
|
__('Selected logs have been successfully deleted')
|
||||||
);
|
);
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id());
|
My::redirect();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -70,30 +68,30 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$current = ManageVars::init();
|
$current = ManageVars::init();
|
||||||
|
|
||||||
dcPage::openModule(
|
Page::openModule(
|
||||||
__('Pings'),
|
My::name(),
|
||||||
dcPage::jsJson('dclog_list', [
|
Page::jsJson('dcLog_msg', [
|
||||||
'confirm_delete_selected_log' => __('Are you sure you want to delete selected logs?'),
|
'confirm_delete_selected_log' => __('Are you sure you want to delete selected logs?'),
|
||||||
'confirm_delete_all_log' => __('Are you sure you want to delete all logs?'),
|
'confirm_delete_all_log' => __('Are you sure you want to delete all logs?'),
|
||||||
]) .
|
]) .
|
||||||
$current->filter->js((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) .
|
$current->filter->js((string) My::manageUrl()) .
|
||||||
dcPage::jsLoad(dcPage::getPF(My::id() . '/js/backend.js'))
|
My::jsLoad('backend')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
dcPage::breadcrumb(
|
Page::breadcrumb(
|
||||||
[
|
[
|
||||||
__('System') => '',
|
__('System') => '',
|
||||||
My::name() => dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
|
My::name() => My::manageUrl(),
|
||||||
]
|
]
|
||||||
) .
|
) .
|
||||||
dcPage::notices();
|
Notices::getNotices();
|
||||||
|
|
||||||
if ($current->logs !== null && $current->list != null) {
|
if ($current->logs !== null && $current->list != null) {
|
||||||
if ($current->logs->isEmpty() && !$current->filter->show()) {
|
if ($current->logs->isEmpty() && !$current->filter->show()) {
|
||||||
|
@ -110,7 +108,7 @@ class Manage extends dcNsProcess
|
||||||
is_numeric($current->filter->__get('page')) ? (int) $current->filter->__get('page') : 1,
|
is_numeric($current->filter->__get('page')) ? (int) $current->filter->__get('page') : 1,
|
||||||
is_numeric($current->filter->__get('nb')) ? (int) $current->filter->__get('nb') : 10,
|
is_numeric($current->filter->__get('nb')) ? (int) $current->filter->__get('nb') : 10,
|
||||||
(new Form('dcLog_form'))
|
(new Form('dcLog_form'))
|
||||||
->action(dcCore::app()->adminurl?->get('admin.plugin.' . My::id()))
|
->action(My::manageUrl())
|
||||||
->method('post')
|
->method('post')
|
||||||
->fields([
|
->fields([
|
||||||
(new Text('', '%s')),
|
(new Text('', '%s')),
|
||||||
|
@ -132,7 +130,7 @@ class Manage extends dcNsProcess
|
||||||
]),
|
]),
|
||||||
(new Text(
|
(new Text(
|
||||||
'',
|
'',
|
||||||
dcCore::app()->adminurl?->getHiddenFormFields('admin.plugin.' . My::id(), $current->filter->values()) .
|
dcCore::app()->admin->url->getHiddenFormFields('admin.plugin.' . My::id(), $current->filter->values()) .
|
||||||
dcCore::app()->formNonce()
|
dcCore::app()->formNonce()
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
|
@ -142,6 +140,6 @@ class Manage extends dcNsProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::closeModule();
|
Page::closeModule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,11 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
|
||||||
use adminGenericFilterV2;
|
|
||||||
use dcAdminFilters;
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
use Dotclear\Core\Backend\Filter\{
|
||||||
|
Filters,
|
||||||
|
FiltersLibrary
|
||||||
|
};
|
||||||
use Dotclear\Database\MetaRecord;
|
use Dotclear\Database\MetaRecord;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
@ -28,8 +30,8 @@ class ManageVars
|
||||||
/** @var ManageVars $container self instance */
|
/** @var ManageVars $container self instance */
|
||||||
private static $container;
|
private static $container;
|
||||||
|
|
||||||
/** @var adminGenericFilterV2 $filter The filter instance */
|
/** @var Filters $filter The filter instance */
|
||||||
public readonly adminGenericFilterV2 $filter;
|
public readonly Filters $filter;
|
||||||
|
|
||||||
/** @var null|MetaRecord $logs The current records */
|
/** @var null|MetaRecord $logs The current records */
|
||||||
public readonly ?MetaRecord $logs;
|
public readonly ?MetaRecord $logs;
|
||||||
|
@ -55,12 +57,12 @@ class ManageVars
|
||||||
$this->all_logs = isset($_POST['all_logs']);
|
$this->all_logs = isset($_POST['all_logs']);
|
||||||
$this->selected_logs = isset($_POST['selected_logs']);
|
$this->selected_logs = isset($_POST['selected_logs']);
|
||||||
|
|
||||||
$this->filter = new adminGenericFilterV2('dcloglist');
|
$this->filter = new Filters('dcloglist');
|
||||||
$this->filter->add(dcAdminFilters::getPageFilter());
|
$this->filter->add(FiltersLibrary::getPageFilter());
|
||||||
$this->filter->add(dcAdminFilters::getInputFilter('blog_id', __('Blog:')));
|
$this->filter->add(FiltersLibrary::getInputFilter('blog_id', __('Blog:')));
|
||||||
$this->filter->add(dcAdminFilters::getInputFilter('user_id', __('User:')));
|
$this->filter->add(FiltersLibrary::getInputFilter('user_id', __('User:')));
|
||||||
$this->filter->add(dcAdminFilters::getInputFilter('log_table', __('Component:')));
|
$this->filter->add(FiltersLibrary::getInputFilter('log_table', __('Component:')));
|
||||||
$this->filter->add(dcAdminFilters::getInputFilter('log_ip', __('IP:')));
|
$this->filter->add(FiltersLibrary::getInputFilter('log_ip', __('IP:')));
|
||||||
$params = $this->filter->params();
|
$params = $this->filter->params();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
46
src/My.php
46
src/My.php
|
@ -15,51 +15,15 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
class My extends MyPlugin
|
||||||
* Module definition shortcut.
|
|
||||||
*/
|
|
||||||
class My
|
|
||||||
{
|
{
|
||||||
/**
|
/** @var string Admin list ID */
|
||||||
* @var string PHP min version
|
|
||||||
*/
|
|
||||||
public const PHP_MIN = '8.1';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string Admin list ID
|
|
||||||
*/
|
|
||||||
public const BACKEND_LIST_ID = 'dcloglist';
|
public const BACKEND_LIST_ID = 'dcloglist';
|
||||||
|
|
||||||
/**
|
public static function checkCustomContext(int $context): ?bool
|
||||||
* This module id.
|
|
||||||
*
|
|
||||||
* @return string The module id
|
|
||||||
*/
|
|
||||||
public static function id(): string
|
|
||||||
{
|
{
|
||||||
return basename(dirname(__DIR__));
|
return dcCore::app()->auth->isSuperAdmin();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This module name.
|
|
||||||
*
|
|
||||||
* @return string The module translated name
|
|
||||||
*/
|
|
||||||
public static function name(): string
|
|
||||||
{
|
|
||||||
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
|
||||||
|
|
||||||
return __(is_string($name) ? $name : 'Undefined');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check php version.
|
|
||||||
*
|
|
||||||
* @return bool True on supported PHP version
|
|
||||||
*/
|
|
||||||
public static function phpCompliant(): bool
|
|
||||||
{
|
|
||||||
return version_compare(phpversion(), self::PHP_MIN, '>=');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue