2021-09-01 23:35:23 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @brief improve, a plugin for Dotclear 2
|
2021-11-01 21:17:44 +00:00
|
|
|
*
|
2021-09-01 23:35:23 +00:00
|
|
|
* @package Dotclear
|
2021-09-06 21:36:50 +00:00
|
|
|
* @subpackage Plugin
|
2021-11-01 21:17:44 +00:00
|
|
|
*
|
2021-09-01 23:35:23 +00:00
|
|
|
* @author Jean-Christian Denis and contributors
|
2021-11-01 21:17:44 +00:00
|
|
|
*
|
2021-09-01 23:35:23 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2021-11-13 21:57:51 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
namespace Dotclear\Plugin\improve;
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
/* dotclear */
|
|
|
|
use dcCore;
|
|
|
|
use dcPage;
|
2022-11-12 21:58:44 +00:00
|
|
|
use dcAdminNotices;
|
2021-11-13 21:57:51 +00:00
|
|
|
use dcThemes;
|
|
|
|
use dcUtils;
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
/* clearbricks */
|
|
|
|
use html;
|
|
|
|
use form;
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
/* php */
|
|
|
|
use Exception;
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
/**
|
|
|
|
* Improve page class
|
|
|
|
*
|
|
|
|
* Display page and configure modules
|
|
|
|
* and launch action.
|
|
|
|
*/
|
2022-12-21 14:41:27 +00:00
|
|
|
class Manage
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
2022-12-21 14:51:43 +00:00
|
|
|
/** @var Core $improve improve core instance */
|
2022-12-21 14:41:27 +00:00
|
|
|
private static $improve = null;
|
2021-11-13 21:57:51 +00:00
|
|
|
/** @var string $type Current module(s) type */
|
2022-12-21 14:41:27 +00:00
|
|
|
private static $type = 'plugin';
|
2021-11-13 21:57:51 +00:00
|
|
|
/** @var string $module Current module id */
|
2022-12-21 14:41:27 +00:00
|
|
|
private static $module = '-';
|
2022-12-21 14:51:43 +00:00
|
|
|
/** @var Action|null $action Current action module */
|
2022-12-21 14:41:27 +00:00
|
|
|
private static $action = null;
|
2021-11-13 21:57:51 +00:00
|
|
|
|
2022-12-21 14:51:43 +00:00
|
|
|
private static $init = false;
|
2021-11-13 21:57:51 +00:00
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
public static function init(): bool
|
|
|
|
{
|
|
|
|
if (defined('DC_CONTEXT_ADMIN')) {
|
|
|
|
dcPage::checkSuper();
|
|
|
|
|
|
|
|
self::$improve = new Core();
|
|
|
|
self::$type = self::getType();
|
|
|
|
self::$module = self::getModule();
|
|
|
|
self::$action = self::getAction();
|
2022-12-21 14:51:43 +00:00
|
|
|
self::$init = true;
|
2022-12-21 14:41:27 +00:00
|
|
|
}
|
2021-11-13 21:57:51 +00:00
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
return self::$init;
|
2021-09-01 23:35:23 +00:00
|
|
|
}
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
private static function getType(): string
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
|
|
|
return $_REQUEST['type'] ?? 'plugin';
|
|
|
|
}
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
private static function getModule(): string
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
|
|
|
$module = $_REQUEST['module'] ?? '';
|
2022-12-21 14:41:27 +00:00
|
|
|
if (!in_array($module, self::comboModules())) {
|
2021-11-13 21:57:51 +00:00
|
|
|
$module = '-';
|
|
|
|
}
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
return $module;
|
2021-09-01 23:35:23 +00:00
|
|
|
}
|
2021-11-01 23:33:08 +00:00
|
|
|
|
2022-12-21 14:51:43 +00:00
|
|
|
private static function getAction(): ?Action
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
2022-12-21 14:41:27 +00:00
|
|
|
return empty($_REQUEST['config']) ? null : self::$improve->module($_REQUEST['config']);
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2023-01-03 22:45:39 +00:00
|
|
|
private static function getPreference(bool $all = false): array
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
2021-09-01 23:35:23 +00:00
|
|
|
try {
|
2022-12-21 14:41:27 +00:00
|
|
|
if (!empty(self::$type)) {
|
|
|
|
$preferences = dcCore::app()->blog->settings->get(Core::id())->get('preferences');
|
2021-11-15 21:29:13 +00:00
|
|
|
if (is_string($preferences)) {
|
|
|
|
$preferences = unserialize($preferences);
|
|
|
|
if (is_array($preferences)) {
|
2023-01-03 22:45:39 +00:00
|
|
|
return $all ? $preferences : (array_key_exists(self::$type, $preferences) ? $preferences[self::$type] : []);
|
2021-11-15 21:29:13 +00:00
|
|
|
}
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
2021-09-15 21:48:58 +00:00
|
|
|
}
|
2021-09-01 23:35:23 +00:00
|
|
|
} catch (Exception $e) {
|
|
|
|
}
|
2021-11-13 21:57:51 +00:00
|
|
|
|
|
|
|
return [];
|
2021-09-01 23:35:23 +00:00
|
|
|
}
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
private static function setPreferences(): bool
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
|
|
|
if (!empty($_POST['save_preferences'])) {
|
2023-01-03 22:45:39 +00:00
|
|
|
$preferences = self::getPreference(true);
|
2022-12-21 14:41:27 +00:00
|
|
|
$preferences[self::$type] = [];
|
2021-11-13 21:57:51 +00:00
|
|
|
if (!empty($_POST['actions'])) {
|
2022-12-21 14:41:27 +00:00
|
|
|
foreach (self::$improve->modules() as $action) {
|
|
|
|
if (in_array(self::$type, $action->types()) && in_array($action->id(), $_POST['actions'])) {
|
|
|
|
$preferences[self::$type][] = $action->id();
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-21 14:41:27 +00:00
|
|
|
dcCore::app()->blog->settings->get(Core::id())->put('preferences', serialize($preferences), 'string', null, true, true);
|
2022-11-12 21:58:44 +00:00
|
|
|
dcAdminNotices::addSuccessNotice(__('Configuration successfully updated'));
|
2021-11-15 21:29:13 +00:00
|
|
|
|
|
|
|
return true;
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
2021-11-15 21:29:13 +00:00
|
|
|
|
|
|
|
return false;
|
2021-11-06 00:40:29 +00:00
|
|
|
}
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
private static function comboModules(): array
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
2022-12-21 14:41:27 +00:00
|
|
|
$allow_distrib = (bool) dcCore::app()->blog->settings->get(Core::id())->get('allow_distrib');
|
2021-11-13 21:57:51 +00:00
|
|
|
$official = [
|
|
|
|
'plugin' => explode(',', DC_DISTRIB_PLUGINS),
|
|
|
|
'theme' => explode(',', DC_DISTRIB_THEMES),
|
|
|
|
];
|
2021-11-01 22:35:13 +00:00
|
|
|
|
2022-12-01 10:08:51 +00:00
|
|
|
if (!(dcCore::app()->themes instanceof dcThemes)) {
|
2022-11-12 21:58:44 +00:00
|
|
|
dcCore::app()->themes = new dcThemes();
|
|
|
|
dcCore::app()->themes->loadModules(dcCore::app()->blog->themes_path, null);
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$combo_modules = [];
|
2022-12-21 14:41:27 +00:00
|
|
|
$modules = self::getModules(self::$type == 'plugin' ? 'plugins' : 'themes');
|
2021-11-13 21:57:51 +00:00
|
|
|
foreach ($modules as $id => $m) {
|
2022-12-21 14:41:27 +00:00
|
|
|
if (!$m['root_writable'] || !$allow_distrib && in_array($id, $official[self::$type])) {
|
2021-09-01 23:35:23 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-12-21 13:03:29 +00:00
|
|
|
$combo_modules[sprintf(__('%s (%s)'), __($m['name']), $id)] = $id;
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
|
|
|
dcUtils::lexicalKeySort($combo_modules);
|
|
|
|
|
|
|
|
return array_merge([__('Select a module') => '-'], $combo_modules);
|
|
|
|
}
|
|
|
|
|
2022-12-03 20:45:56 +00:00
|
|
|
public static function getModules(string $type, ?string $id = null): ?array
|
|
|
|
{
|
|
|
|
$type = $type == 'themes' ? 'themes' : 'plugins';
|
|
|
|
|
|
|
|
$modules = array_merge(dcCore::app()->{$type}->getDisabledModules(), dcCore::app()->{$type}->getModules());
|
|
|
|
|
|
|
|
if (empty($id)) {
|
|
|
|
return $modules;
|
|
|
|
} elseif (array_key_exists($id, $modules)) {
|
|
|
|
return $modules[$id];
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
public static function process(): void
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
2022-12-21 14:41:27 +00:00
|
|
|
if (!self::$init) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-15 21:32:03 +00:00
|
|
|
$log_id = '';
|
2022-12-21 14:41:27 +00:00
|
|
|
$done = self::setPreferences();
|
2021-11-15 21:29:13 +00:00
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
if (!empty($_POST['fix'])) {
|
|
|
|
if (empty($_POST['actions'])) {
|
2022-11-12 21:58:44 +00:00
|
|
|
dcAdminNotices::addWarningNotice(__('No action selected'));
|
2022-12-21 14:41:27 +00:00
|
|
|
} elseif (self::$module == '-') {
|
2022-11-12 21:58:44 +00:00
|
|
|
dcAdminNotices::addWarningNotice(__('No module selected'));
|
2021-11-13 21:57:51 +00:00
|
|
|
} else {
|
|
|
|
try {
|
2022-12-21 14:41:27 +00:00
|
|
|
$time = self::$improve->fixModule(
|
|
|
|
self::$type,
|
|
|
|
self::$module,
|
|
|
|
self::getModules(self::$type == 'plugin' ? 'plugins' : 'themes', self::$module),
|
2021-11-13 21:57:51 +00:00
|
|
|
$_POST['actions']
|
|
|
|
);
|
2022-12-21 14:41:27 +00:00
|
|
|
$log_id = self::$improve->writeLogs();
|
2022-11-12 21:58:44 +00:00
|
|
|
dcCore::app()->blog->triggerBlog();
|
2021-11-13 21:57:51 +00:00
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
if (self::$improve->hasLog('error')) {
|
2022-11-12 21:58:44 +00:00
|
|
|
$notice = ['type' => dcAdminNotices::NOTICE_ERROR, 'msg' => __('Fix of "%s" complete in %s secondes with errors')];
|
2022-12-21 14:41:27 +00:00
|
|
|
} elseif (self::$improve->hasLog('warning')) {
|
2022-11-12 21:58:44 +00:00
|
|
|
$notice = ['type' => dcAdminNotices::NOTICE_WARNING, 'msg' => __('Fix of "%s" complete in %s secondes with warnings')];
|
2022-12-21 14:41:27 +00:00
|
|
|
} elseif (self::$improve->hasLog('success')) {
|
2022-11-12 21:58:44 +00:00
|
|
|
$notice = ['type' => dcAdminNotices::NOTICE_SUCCESS, 'msg' => __('Fix of "%s" complete in %s secondes')];
|
2021-11-13 21:57:51 +00:00
|
|
|
} else {
|
2022-11-12 21:58:44 +00:00
|
|
|
$notice = ['type' => dcAdminNotices::NOTICE_SUCCESS, 'msg' => __('Fix of "%s" complete in %s secondes without messages')];
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
2022-12-21 14:41:27 +00:00
|
|
|
dcAdminNotices::addNotice($notice['type'], sprintf($notice['msg'], self::$module, $time));
|
2021-11-13 21:57:51 +00:00
|
|
|
|
2021-11-15 21:29:13 +00:00
|
|
|
$done = true;
|
2021-11-13 21:57:51 +00:00
|
|
|
} catch (Exception $e) {
|
2022-11-12 21:58:44 +00:00
|
|
|
dcCore::app()->error->add($e->getMessage());
|
2021-11-15 21:29:13 +00:00
|
|
|
$done = false;
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-01 23:35:23 +00:00
|
|
|
}
|
2021-11-15 21:29:13 +00:00
|
|
|
|
|
|
|
if ($done) {
|
2022-12-21 14:41:27 +00:00
|
|
|
dcCore::app()->adminurl->redirect('admin.plugin.' . Core::id(), ['type' => self::$type, 'module' => self::$module, 'upd' => $log_id]);
|
2021-11-15 21:29:13 +00:00
|
|
|
}
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
public static function render(): void
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
2022-12-21 14:41:27 +00:00
|
|
|
if (!self::$init) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
$bc = empty($_REQUEST['config']) ?
|
2022-12-21 14:41:27 +00:00
|
|
|
(self::$type == 'theme' ? __('Themes actions') : __('Plugins actions')) :
|
2021-11-13 21:57:51 +00:00
|
|
|
__('Configure module');
|
|
|
|
|
|
|
|
echo '<html><head><title>' . __('improve') . '</title>' .
|
2022-12-21 14:41:27 +00:00
|
|
|
dcPage::jsModuleLoad(Core::id() . '/js/index.js') .
|
|
|
|
(self::$action === null ? '' : self::$action->header()) .
|
2021-11-13 21:57:51 +00:00
|
|
|
'</head><body>' .
|
|
|
|
dcPage::notices() .
|
|
|
|
dcPage::breadcrumb([
|
|
|
|
__('Plugins') => '',
|
|
|
|
__('improve') => '',
|
|
|
|
$bc => '',
|
|
|
|
]);
|
|
|
|
|
|
|
|
if (empty($_REQUEST['config'])) {
|
2022-12-21 14:41:27 +00:00
|
|
|
self::displayActions();
|
2021-11-13 21:57:51 +00:00
|
|
|
} else {
|
2022-12-21 14:41:27 +00:00
|
|
|
self::displayConfigurator();
|
2021-11-13 21:57:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '</body></html>';
|
|
|
|
}
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
private static function displayConfigurator(): void
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
2022-12-21 14:41:27 +00:00
|
|
|
$back_url = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.' . Core::id(), ['type' => self::$type]);
|
2021-11-13 21:57:51 +00:00
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
if (null === self::$action) {
|
2021-11-13 21:57:51 +00:00
|
|
|
echo '
|
|
|
|
<p class="warning">' . __('Unknow module') . '</p>
|
|
|
|
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>';
|
|
|
|
} else {
|
2022-12-21 14:41:27 +00:00
|
|
|
$redir = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.' . Core::id(), ['type' => self::$type, 'config' => self::$action->id()]);
|
|
|
|
$res = self::$action->configure($redir);
|
2021-11-13 21:57:51 +00:00
|
|
|
|
|
|
|
echo '
|
2022-12-21 14:41:27 +00:00
|
|
|
<h3>' . sprintf(__('Configure module "%s"'), self::$action->name()) . '</h3>
|
2021-11-13 21:57:51 +00:00
|
|
|
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>
|
2022-12-21 14:41:27 +00:00
|
|
|
<p class="info">' . html::escapeHTML(self::$action->description()) . '</p>
|
|
|
|
<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" method="post" id="form-actions">' .
|
2021-11-13 21:57:51 +00:00
|
|
|
(empty($res) ? '<p class="message">' . __('Nothing to configure') . '</p>' : $res) . '
|
|
|
|
<p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' .
|
2022-12-21 14:41:27 +00:00
|
|
|
form::hidden('type', self::$type) .
|
|
|
|
form::hidden('config', self::$action->id()) .
|
2021-11-13 21:57:51 +00:00
|
|
|
form::hidden('redir', $redir) .
|
2022-11-12 21:58:44 +00:00
|
|
|
dcCore::app()->formNonce() . '</p>' .
|
2021-11-13 21:57:51 +00:00
|
|
|
'</form>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
private static function displayActions(): void
|
2021-11-13 21:57:51 +00:00
|
|
|
{
|
|
|
|
echo
|
2022-12-21 14:41:27 +00:00
|
|
|
'<form method="get" action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" id="improve_menu">' .
|
2021-11-13 21:57:51 +00:00
|
|
|
'<p class="anchor-nav"><label for="type" class="classic">' . __('Goto:') . ' </label>' .
|
2022-12-21 14:41:27 +00:00
|
|
|
form::combo('type', [__('Plugins') => 'plugin', __('Themes') => 'theme'], self::$type) . ' ' .
|
2021-11-13 21:57:51 +00:00
|
|
|
'<input type="submit" value="' . __('Ok') . '" />' .
|
|
|
|
form::hidden('p', 'improve') . '</p>' .
|
|
|
|
'</form>';
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
$combo_modules = self::comboModules();
|
2021-11-13 21:57:51 +00:00
|
|
|
if (count($combo_modules) == 1) {
|
|
|
|
echo '<p class="message">' . __('No module to manage') . '</p>';
|
|
|
|
} else {
|
2022-12-21 14:41:27 +00:00
|
|
|
echo '<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" method="post" id="form-actions">' .
|
2021-11-13 21:57:51 +00:00
|
|
|
'<table><caption class="hidden">' . __('Actions') . '</caption><thead><tr>' .
|
|
|
|
'<th colspan="2" class="first">' . __('Action') . '</td>' .
|
|
|
|
'<th scope="col">' . __('Description') . '</td>' .
|
|
|
|
'<th scope="col">' . __('Configuration') . '</td>' .
|
|
|
|
(DC_DEBUG ? '<th scope="col">' . __('Priority') . '</td>' : '') . /* @phpstan-ignore-line */
|
|
|
|
'</tr></thead><tbody>';
|
2022-12-21 14:41:27 +00:00
|
|
|
foreach (self::$improve->modules() as $action) {
|
|
|
|
if (!in_array(self::$type, $action->types())) {
|
2021-11-13 21:57:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
echo
|
|
|
|
'<tr class="line' . ($action->isConfigured() ? '' : ' offline') . '">' .
|
|
|
|
'<td class="minimal">' . form::checkbox(
|
|
|
|
['actions[]',
|
|
|
|
'action_' . $action->id(), ],
|
|
|
|
$action->id(),
|
2022-12-21 14:41:27 +00:00
|
|
|
in_array($action->id(), self::getPreference()) && $action->isConfigured(),
|
2021-11-13 21:57:51 +00:00
|
|
|
'',
|
|
|
|
'',
|
|
|
|
!$action->isConfigured()
|
|
|
|
) . '</td>' .
|
|
|
|
'<td class="minimal nowrap">' .
|
|
|
|
'<label for="action_' . $action->id() . '" class="classic">' . html::escapeHTML($action->name()) . '</label>' .
|
|
|
|
'</td>' .
|
|
|
|
'<td class="maximal">' . $action->description() . '</td>' .
|
|
|
|
'<td class="minimal nowrap modules">' . (
|
|
|
|
false === $action->configurator() ? '' :
|
2022-12-21 14:41:27 +00:00
|
|
|
'<a class="module-config" href="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id(), ['type' => self::$type, 'config' => $action->id()]) .
|
2021-11-13 21:57:51 +00:00
|
|
|
'" title="' . sprintf(__("Configure action '%s'"), $action->name()) . '">' . __('Configure') . '</a>'
|
|
|
|
) . '</td>' .
|
|
|
|
(DC_DEBUG ? '<td class="minimal"><span class="debug">' . $action->priority() . '</span></td>' : '') . /* @phpstan-ignore-line */
|
|
|
|
'</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</tbody></table>
|
|
|
|
<div class="two-cols">
|
|
|
|
<p class="col left"><label for="save_preferences" class="classic">' .
|
|
|
|
form::checkbox('save_preferences', 1, !empty($_POST['save_preferences'])) .
|
|
|
|
__('Save fields selection as preference') . '</label></p>
|
|
|
|
<p class="col right"><label for="module" class="classic">' . __('Select a module:') . ' </label>' .
|
2022-12-21 14:41:27 +00:00
|
|
|
form::combo('module', $combo_modules, self::$module) .
|
2021-11-13 21:57:51 +00:00
|
|
|
' <input type="submit" name="fix" value="' . __('Fix it') . '" />' .
|
2022-12-21 14:41:27 +00:00
|
|
|
form::hidden(['type'], self::$type) .
|
2022-11-12 21:58:44 +00:00
|
|
|
dcCore::app()->formNonce() . '
|
2021-11-13 21:57:51 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<br class="clear" />
|
|
|
|
</form>';
|
|
|
|
|
2022-12-21 14:41:27 +00:00
|
|
|
if (!empty($_REQUEST['upd']) && !dcCore::app()->blog->settings->get(Core::id())->get('nodetails')) {
|
|
|
|
$logs = self::$improve->parseLogs((int) $_REQUEST['upd']);
|
2021-09-01 23:35:23 +00:00
|
|
|
|
2021-11-13 21:57:51 +00:00
|
|
|
if (!empty($logs)) {
|
|
|
|
echo '<div class="fieldset"><h4>' . __('Details') . '</h4>';
|
|
|
|
foreach ($logs as $path => $types) {
|
|
|
|
echo '<h5>' . $path . '</h5>';
|
|
|
|
foreach ($types as $type => $tools) {
|
|
|
|
echo '<div class="' . $type . '"><ul>';
|
|
|
|
foreach ($tools as $tool => $msgs) {
|
2022-12-21 14:41:27 +00:00
|
|
|
$a = self::$improve->module($tool);
|
2021-11-13 21:57:51 +00:00
|
|
|
if (null !== $a) {
|
|
|
|
echo '<li>' . $a->name() . '<ul>';
|
|
|
|
foreach ($msgs as $msg) {
|
|
|
|
echo '<li>' . $msg . '</li>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '</ul></li>';
|
2021-09-15 21:48:58 +00:00
|
|
|
}
|
2021-11-13 21:57:51 +00:00
|
|
|
echo '</ul></div>';
|
2021-09-15 21:48:58 +00:00
|
|
|
}
|
2021-11-13 21:57:51 +00:00
|
|
|
echo '';
|
2021-09-15 21:48:58 +00:00
|
|
|
}
|
2021-11-13 21:57:51 +00:00
|
|
|
echo '</div>';
|
2021-09-15 21:48:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-01 23:35:23 +00:00
|
|
|
}
|
|
|
|
}
|