release 1.5 (see changelog)

main
Jean-Christian Paul Denis 2022-12-31 19:07:05 +01:00
parent c5d581f5e8
commit f3457039cb
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
13 changed files with 398 additions and 405 deletions

View File

@ -1,3 +1,11 @@
1.5 - 2022.12.31
* update to dotclear 2.24
* use json intead of serialize
* use short settings names
* use anonymous functions
* use abstract plugin id
* fix phpstan and php-cs-fixer errors
v1.4 - 20-12-2022 - Pierre Van Glebeke v1.4 - 20-12-2022 - Pierre Van Glebeke
* màj partielle dc2.24 * màj partielle dc2.24

View File

@ -1,2 +1,45 @@
# construction # README
Cette extension permet de placer son blog en maintenance. Il est possible également de renseigner plusieurs IP autorisées.
[![Release](https://img.shields.io/github/v/release/JcDenis/construction)](https://github.com/JcDenis/construction/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/construction)](https://github.com/JcDenis/construction/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/construction)](https://github.com/JcDenis/construction/issues)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/construction)
[![License](https://img.shields.io/github/license/JcDenis/construction)](https://github.com/JcDenis/construction/blob/master/LICENSE)
## WHAT IS DISCLAIMER ?
_construction_ is a plugin for the open-source
web publishing software called Dotclear.
Put your blog on construction mode with a custom message on frontend.
Blog can be accessible to defined IP addresses.
## REQUIREMENTS
_construction_ requires:
* admin permissions on blog
* Dotclear 2.24
## USAGE
First install _construction_, manualy from a zip package or from
Dotaddict repository. (See Dotclear's documentation to know how do this)
You can activate and setup _construction_ from sidebar menu "Construction".
## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [GitHub Page](https://github.com/JcDenis/construction)
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/construction)
* Help & discuss : [Dotclear forum](http://forum.dotclear.org/viewtopic.php?id=42875)
## CONTRIBUTORS
* Osku (author)
* Pierre Van Glabeke
* Jean-Christian Denis
You are welcome to contribute to this code.

View File

@ -1,47 +1,41 @@
<?php <?php
# -- BEGIN LICENSE BLOCK ---------------------------------- /**
# * @brief construction, a plugin for Dotclear 2
# This file is part of construction, a plugin for Dotclear 2. *
# * @package Dotclear
# Copyright (c) 2010 Osku and contributors * @subpackage Plugin
# *
# Licensed under the GPL version 2.0 license. * @author Osku and contributors
# A copy of this license is available in LICENSE file or at *
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * @copyright Jean-Christian Denis
# * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ */
if (!defined('DC_CONTEXT_ADMIN')) { return; } if (!defined('DC_CONTEXT_ADMIN')) {
return null;
dcCore::app()->blog->settings->addNamespace('construction');
$menu_class = '';
if (dcCore::app()->blog->settings->construction->construction_flag)
{
dcCore::app()->addBehavior('adminPageHTMLHead','constructionadminPageHTMLHead');
$menu_class = 'construction-blog';
} }
$_menu['Blog']->addItem(__('Construction'), dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
'plugin.php?p=construction','index.php?pf=construction/icon.png', __('Construction'),
preg_match('/plugin.php\?p=construction(&.*)?$/',$_SERVER['REQUEST_URI']), dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
dcCore::app()->auth->check('admin',dcCore::app()->blog->id), urldecode(dcPage::getPF(basename(__DIR__) . '/icon.png')),
$menu_class preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]), dcCore::app()->blog->id),
dcCore::app()->blog->settings->get(basename(__DIR__))->get('flag') ? 'construction-blog' : ''
); );
function constructionadminPageHTMLHead() dcCore::app()->addBehaviors([
{ 'adminPageHTMLHead' => function () {
echo '<style type="text/css">'."\n".'@import "index.php?pf=construction/css/admin.css";'."\n".'</style>'."\n"; if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('flag')) {
echo dcPage::cssModuleLoad(basename(__DIR__) . '/css/admin.css');
} }
},
dcCore::app()->addBehavior('adminDashboardFavorites','constructionDashboardFavorites'); 'adminDashboardFavoritesV2' => function (dcFavorites $favs) {
$favs->register(basename(__DIR__), [
function constructionDashboardFavorites($core,$favs)
{
$favs->register('construction', array(
'title' => __('Construction'), 'title' => __('Construction'),
'url' => 'plugin.php?p=construction', 'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
'small-icon' => 'index.php?pf=construction/icon.png', 'small-icon' => urldecode(dcPage::getPF(basename(__DIR__) . '/icon.png')),
'large-icon' => 'index.php?pf=construction/icon-big.png', 'large-icon' => urldecode(dcPage::getPF(basename(__DIR__) . '/icon-big.png')),
'permissions' => 'usage,contentadmin' 'permissions' => dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]),
)); ]);
} },
]);

View File

@ -1,29 +1,33 @@
<?php <?php
# -- BEGIN LICENSE BLOCK ---------------------------------- /**
# * @brief construction, a plugin for Dotclear 2
# This file is part of construction, a plugin for Dotclear 2. *
# * @package Dotclear
# Copyright (c) 2010 Osku and contributors * @subpackage Plugin
# *
# Licensed under the GPL version 2.0 license. * @author Osku and contributors
# A copy of this license is available in LICENSE file or at *
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * @copyright Jean-Christian Denis
# * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ */
if (!defined('DC_RC_PATH')) { return; } if (!defined('DC_RC_PATH')) {
return;
}
$this->registerModule( $this->registerModule(
/* Name */ "Construction", 'Construction',
/* Description*/ "Place your blog maintenance", 'Place your blog maintenance',
/* Author */ "Osku and contributors", 'Osku and contributors',
/* Version */ '1.4', '1.5',
/* Properties */ [
array( 'requires' => [['core', '2.24']],
'permissions' => 'admin', 'permissions' => dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_ADMIN,
]),
'priority' => 2000, 'priority' => 2000,
'type' => 'plugin', 'type' => 'plugin',
'dc_min' => '2.24',
'support' => 'http://forum.dotclear.org/viewtopic.php?id=42875', 'support' => 'http://forum.dotclear.org/viewtopic.php?id=42875',
'details' => 'http://plugins.dotaddict.org/dc2/details/construction' 'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
) 'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
]
); );

View File

@ -1,67 +1,78 @@
<?php <?php
# -- BEGIN LICENSE BLOCK ---------------------------------- /**
# * @brief construction, a plugin for Dotclear 2
# This file is part of construction, a plugin for Dotclear 2. *
# * @package Dotclear
# Copyright (c) 2010 Osku and contributors * @subpackage Plugin
# *
# Licensed under the GPL version 2.0 license. * @author Osku and contributors
# A copy of this license is available in LICENSE file or at *
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * @copyright Jean-Christian Denis
# * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ */
if (!defined('DC_CONTEXT_ADMIN')) { exit; } if (!defined('DC_CONTEXT_ADMIN')) {
return null;
$new_version = dcCore::app()->plugins->moduleInfo('construction','version');
$current_version = dcCore::app()->getVersion('construction');
if (version_compare($current_version,$new_version,'>=')) {
return;
} }
dcCore::app()->blog->settings->addNamespace('construction'); try {
$s =& dcCore::app()->blog->settings->construction; // Version
if (!dcCore::app()->newVersion(
basename(__DIR__),
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
)) {
return null;
}
$s->put('construction_flag', $s = dcCore::app()->blog->settings->get(basename(__DIR__));
$s->put(
'flag',
false, false,
'boolean', 'boolean',
'Construction blog flag', 'Construction blog flag',
true, false,
true true
); );
$s->put('construction_allowed_ip', $s->put(
serialize(array('127.0.0.1')), 'allowed_ip',
json_encode(['127.0.0.1']),
'string', 'string',
'Construction blog allowed ip', 'Construction blog allowed ip',
true, false,
true true
); );
$s->put('construction_title', $s->put(
'title',
__('Work in progress'), __('Work in progress'),
'string', 'string',
'Construction blog title', 'Construction blog title',
true, false,
true true
); );
$s->put('construction_message', $s->put(
'message',
__('<p>The blog is currently under construction.</p>'), __('<p>The blog is currently under construction.</p>'),
'string', 'string',
'Construction blog message', 'Construction blog message',
true, false,
true true
); );
$s->put('construction_extra_urls', $s->put(
serialize(array()), 'extra_urls',
json_encode([]),
'string', 'string',
'Construction blog message', 'Construction blog message',
true, false,
true true
); );
dcCore::app()->setVersion('construction',$new_version);
return true; return true;
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
}
return false;

View File

@ -1,15 +0,0 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of construction, a plugin for Dotclear 2.
#
# Copyright (c) 2010 Osku and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) { return; }
if (version_compare(DC_VERSION,'2.2-beta','<')) { return; }

View File

@ -1,103 +1,75 @@
<?php <?php
# -- BEGIN LICENSE BLOCK ---------------------------------- /**
# * @brief construction, a plugin for Dotclear 2
# This file is part of construction, a plugin for Dotclear 2. *
# * @package Dotclear
# Copyright (c) 2010 Osku and contributors * @subpackage Plugin
# *
# Licensed under the GPL version 2.0 license. * @author Osku and contributors
# A copy of this license is available in LICENSE file or at *
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * @copyright Jean-Christian Denis
# * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ */
if (!defined('DC_RC_PATH')) { return; } if (!defined('DC_RC_PATH')) {
return null;
if (dcCore::app()->blog->settings->construction->construction_flag)
{
dcCore::app()->addBehavior('publicBeforeDocument',array('publicBehaviorsConstruction','checkVisitor'));
} }
dcCore::app()->tpl->addValue('ConstructionMessage',array('tplConstruction','ConstructionMessage')); dcCore::app()->addBehavior('publicBeforeDocument', function () {
dcCore::app()->tpl->addValue('ConstructionTitle',array('tplConstruction','ConstructionTitle')); if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('flag')) {
return;
}
class publicBehaviorsConstruction $tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset');
{ if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [__DIR__, 'default-templates', $tplset]))) {
public static function checkVisitor($core) dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [__DIR__, 'default-templates', $tplset]));
{
$tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->system->theme,'tplset');
if (!empty($tplset) && is_dir(dirname(__FILE__).'/default-templates/'.$tplset)) {
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), dirname(__FILE__).'/default-templates/'.$tplset);
} else { } else {
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), dirname(__FILE__).'/default-templates/'.DC_DEFAULT_TPLSET); dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [__DIR__, 'default-templates', DC_DEFAULT_TPLSET]));
}
$all_allowed_ip = unserialize(dcCore::app()->blog->settings->construction->construction_allowed_ip);
$extra_urls = unserialize(dcCore::app()->blog->settings->construction->construction_extra_urls);
if (!in_array(http::realIP(),$all_allowed_ip))
{
dcCore::app()->url->registerDefault(array('urlConstruction','constructionHandler'));
dcCore::app()->url->registerError(array('urlConstruction','default503'));
foreach (dcCore::app()->url->getTypes() as $k=>$v)
{
if (($k != 'contactme') && !in_array($k,$extra_urls))
{
dcCore::app()->url->register($k,$v['url'],$v['representation'],array('urlConstruction','p503'));
}
} }
$all_allowed_ip = json_decode(dcCore::app()->blog->settings->get(basename(__DIR__))->get('allowed_ip'), true);
if (!is_array($all_allowed_ip)) {
$all_allowed_ip = [];
} }
} $extra_urls = json_decode(dcCore::app()->blog->settings->get(basename(__DIR__))->get('extra_urls'), true);
} if (!in_array(http::realIP(), $all_allowed_ip)) {
dcCore::app()->url->registerDefault(function ($args) {
class urlConstruction extends dcUrlHandlers dcCore::app()->url->type = 'default';
{
public static function p503()
{
throw new Exception ("Blog under construction",503);
}
public static function default503($args,$type,$e)
{
//if ($e->getCode() == 503) {
$_ctx =& $GLOBALS['_ctx'];
$core =& $GLOBALS['core'];
throw new Exception('Blog under construction', 503);
});
dcCore::app()->url->registerError(function ($args, $type, $e) {
header('Content-Type: text/html; charset=UTF-8'); header('Content-Type: text/html; charset=UTF-8');
http::head(503, 'Service Unavailable'); http::head(503, 'Service Unavailable');
dcCore::app()->url->type = '503'; dcCore::app()->url->type = '503';
$_ctx->current_tpl = '503.html'; dcCore::app()->ctx->__set('current_tpl', '503.html');
$_ctx->content_type = 'text/html'; dcCore::app()->ctx->__set('content_type', 'text/html');
echo dcCore::app()->tpl->getData($_ctx->current_tpl); echo dcCore::app()->tpl->getData(dcCore::app()->ctx->__get('current_tpl'));
# --BEHAVIOR-- publicAfterDocument # --BEHAVIOR-- publicAfterDocument
dcCore::app()->callBehavior('publicAfterDocument',$core); dcCore::app()->callBehavior('publicAfterDocumentV2');
exit; exit;
//} });
}
public static function constructionHandler($args) foreach (dcCore::app()->url->getTypes() as $k => $v) {
{ if (($k != 'contactme') && !in_array($k, $extra_urls)) {
$core =& $GLOBALS['core']; dcCore::app()->url->register($k, $v['url'], $v['representation'], function () {
dcCore::app()->url->type = 'default'; throw new Exception('Blog under construction', 503);
self::p503(); });
return;
} }
} }
}
});
class tplConstruction dcCore::app()->tpl->addValue('ConstructionMessage', function ($attr) {
{ return '<?php echo ' . sprintf(
public static function ConstructionMessage($attr) dcCore::app()->tpl->getFilters($attr),
{ 'dcCore::app()->blog->settings->get("' . basename(__DIR__) . '")->get("message")'
$core =& $GLOBALS['core']; ) . '; ?>';
$f = dcCore::app()->tpl->getFilters($attr); });
return '<?php echo '.sprintf($f, 'dcCore::app()->blog->settings->construction->construction_message').'; ?>'; dcCore::app()->tpl->addValue('ConstructionTitle', function ($attr) {
} return '<?php echo ' . sprintf(
dcCore::app()->tpl->getFilters($attr),
public static function ConstructionTitle($attr) 'dcCore::app()->blog->settings->get("' . basename(__DIR__) . '")->get("title")'
{ ) . '; ?>';
$core =& $GLOBALS['core']; });
$f = dcCore::app()->tpl->getFilters($attr);
return '<?php echo '.sprintf($f, 'dcCore::app()->blog->settings->construction->construction_title').'; ?>';
}
}

13
dcstore.xml 100644
View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<modules xmlns:da="http://dotaddict.org/da/">
<module id="construction">
<name>Construction</name>
<version>1.5</version>
<author>Osku and contributors</author>
<desc>Place your blog maintenance</desc>
<file>https://github.com/JcDenis/construction/releases/download/v1.5/plugin-construction.zip</file>
<da:dcmin>2.24</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/construction</da:details>
<da:support>http://forum.dotclear.org/viewtopic.php?id=42875</da:support>
</module>
</modules>

162
index.php
View File

@ -1,125 +1,115 @@
<?php <?php
# -- BEGIN LICENSE BLOCK ---------------------------------- /**
# * @brief construction, a plugin for Dotclear 2
# This file is part of construction, a plugin for Dotclear 2. *
# * @package Dotclear
# Copyright (c) 2010 Osku and contributors * @subpackage Plugin
# *
# Licensed under the GPL version 2.0 license. * @author Osku and contributors
# A copy of this license is available in LICENSE file or at *
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * @copyright Jean-Christian Denis
# * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------ */
if (!defined('DC_CONTEXT_ADMIN')) { return; } if (!defined('DC_CONTEXT_ADMIN')) {
return null;
$p_url = 'plugin.php?p=' . basename(dirname(__FILE__));
$page_title = __('Construction');
dcCore::app()->blog->settings->addNamespace('construction');
$s =& dcCore::app()->blog->settings->construction;
$flag = $s->construction_flag;
$allowed_ip = array();
$myip = http::realIP();
// editeur pour le message
$post_format = dcCore::app()->auth->getOption('post_format');
$post_editor = dcCore::app()->auth->getOption('editor');
$admin_post_behavior = '';
if ($post_editor && !empty($post_editor[$post_format])) {
$admin_post_behavior = dcCore::app()->callBehavior('adminPostEditor', $post_editor[$post_format],
'user_desc', array('#user_desc')
);
} }
if (!empty($_POST['saveconfig']))
{
try
{
$flag = (empty($_POST['construction_flag']))?false:true;
$s->put('construction_flag',$flag,'boolean','Construction blog flag'); dcPage::check(dcCore::app()->auth->makePermissions([
$all_ip = explode("\n",$_POST['construction_allowed_ip']); dcAuth::PERMISSION_ADMIN,
foreach ($all_ip as $ip) { ]));
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
if (!empty($_POST['saveconfig'])) {
try {
$allowed_ip = [];
foreach (explode("\n", $_POST['construction_allowed_ip']) as $ip) {
$allowed_ip[] = trim($ip); $allowed_ip[] = trim($ip);
} }
$urls = explode(",",$_POST['construction_extra_urls']); $extra_urls = [];
foreach ($urls as $url) { foreach (explode(',', $_POST['construction_extra_urls']) as $url) {
$extra_urls[] = trim($url); $extra_urls[] = trim($url);
} }
$s->put('construction_allowed_ip',serialize($allowed_ip),'string','Construction blog allowed ip');
$s->put('construction_title',$_POST['construction_title'],'string','Construction blog title'); $s->put('flag', empty($_POST['construction_flag']) ? false : true);
$s->put('construction_message',$_POST['construction_message'],'string','Construction blog message'); $s->put('allowed_ip', json_encode($allowed_ip));
$s->put('construction_extra_urls',serialize($extra_urls),'string','Construction extra allowed URLs'); $s->put('title', $_POST['construction_title']);
$s->put('message', $_POST['construction_message']);
$s->put('extra_urls', json_encode($extra_urls));
dcCore::app()->blog->triggerBlog(); dcCore::app()->blog->triggerBlog();
http::redirect($p_url.'&saved=1');
} dcAdminNotices::addSuccessNotice(
catch (Exception $e) __('Settings successfully updated.')
{ );
dcCore::app()->adminurl->redirect(
'admin.plugin.' . basename(__DIR__)
);
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage()); dcCore::app()->error->add($e->getMessage());
} }
} }
$nb_rows = count(unserialize($s->construction_allowed_ip)); $nb_rows = count(json_decode($s->get('allowed_ip'), true));
if ($nb_rows < 2) { if ($nb_rows < 2) {
$nb_rows = 2; $nb_rows = 2;
} elseif ($nb_rows > 10) { } elseif ($nb_rows > 10) {
$nb_rows = 10; $nb_rows = 10;
} }
?>
<html> $editor = dcCore::app()->auth->getOption('editor');
<head>
<title><?php echo $page_title; ?></title> echo '
<?php echo dcPage::jsToolBar(). <html><head><title>' . __('Construction') . '</title>' .
$admin_post_behavior.
dcPage::jsConfirmClose('opts-forms') . dcPage::jsConfirmClose('opts-forms') .
dcPage::jsLoad('index.php?pf=construction/js/config.js'); ?> dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'construction', ['#construction_message'], 'xhtml') .
</head> dcPage::jsModuleLoad(basename(__DIR__) . '/js/index.js') . '
<body> </head><body>' .
<?php
echo dcPage::breadcrumb(
array(
html::escapeHTML(dcCore::app()->blog->name) => '',
'<span class="page-title">'.$page_title.'</span>' => ''
));
if (!empty($msg)) { dcPage::breadcrumb([
dcPage::message($msg);} __('Plugins') => '',
if (!empty($_GET['saved'])) { __('Construction') => '',
dcPage::success(__('Configuration successfully updated.')); ]) .
} dcPage::notices() . '
echo '<div id="construction_options"> <div id="construction_options">
<form method="post" action="'.$p_url.'"> <form method="post" action="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)) . '">
<div class="fieldset"> <div class="fieldset">
<h4>' . __('Configuration') . '</h4> <h4>' . __('Configuration') . '</h4>
<p class="field">' . <p class="field">' .
form::checkbox('construction_flag', 1, $s->construction_flag). form::checkbox('construction_flag', 1, $s->get('flag')) . '
'<label class="classic" for="construction_flag">'.__('Plugin activation').'</label> <label class="classic" for="construction_flag">' . __('Plugin activation') . '</label>
</p> </p>
<p><label for="construction_allowed_ip">'.__('Allowed IP:').'&nbsp;</label>'.
form::textarea('construction_allowed_ip',20,$nb_rows,html::escapeHTML(implode("\n",unserialize($s->construction_allowed_ip)))). <p><label for="construction_allowed_ip">' . __('Allowed IP:') . '</label> ' .
form::textarea('construction_allowed_ip', 20, $nb_rows, html::escapeHTML(implode("\n", json_decode($s->get('allowed_ip'), true)))) .
'</p> '</p>
<p class="info">'.sprintf(__('Your IP is <strong>%s</strong> - the allowed IP can view the blog normally.'),$myip).'</p> <p class="form-note">' . sprintf(__('Your IP is <strong>%s</strong> - the allowed IP can view the blog normally.'), (string) http::realIP()) . '</p>
<p class="area"><label for="construction_extra_urls">' . __('Extra allowed URL types:') . '</label>' . <p class="area"><label for="construction_extra_urls">' . __('Extra allowed URL types:') . '</label>' .
form::field('construction_extra_urls',20,255,html::escapeHTML(implode(',',unserialize($s->construction_extra_urls))),'maximal'). form::field('construction_extra_urls', 20, 255, html::escapeHTML(implode(',', json_decode($s->get('extra_urls'), true))), 'maximal') .
'</p> '</p>
</div> </div>
<div class="fieldset"> <div class="fieldset">
<h4>' . __('Presentation') . '</h4> <h4>' . __('Presentation') . '</h4>
<p class="area"><label for="construction_title">' . __('Title:') . '</label>' . <p class="area"><label for="construction_title">' . __('Title:') . '</label>' .
form::field('construction_title',20,255,html::escapeHTML($s->construction_title),'maximal'). form::field('construction_title', 20, 255, html::escapeHTML($s->get('title')), 'maximal') .
'</p> '</p>
<p class="area"><label for="construction_message">' . __('Message:') . '</label>' . <p class="area"><label for="construction_message">' . __('Message:') . '</label>' .
form::textarea('construction_message',40,10,html::escapeHTML($s->construction_message)). form::textarea('construction_message', 40, 10, html::escapeHTML($s->get('message'))) .
'</p> '</p>
</div> </div>
<p>'.form::hidden(array('p'),'construction'). <p>' .
dcCore::app()->formNonce(). form::hidden(['p'], 'construction') .
'<input type="submit" name="saveconfig" value="'.__('Save').'" /> dcCore::app()->formNonce() . '
<input type="submit" name="saveconfig" value="' . __('Save') . '" />
</p> </p>
</form> </form>
</div>'; </div>
?>
</body> </body>
</html> </html>';

View File

@ -1,6 +0,0 @@
$(function() {
if ($.isFunction(jsToolBar)) {
var tbUser = new jsToolBar(document.getElementById('construction_message'));
tbUser.draw('xhtml');
}
});

12
js/index.js 100644
View File

@ -0,0 +1,12 @@
/*global $, dotclear, jsToolBar */
'use strict';
$(() => {
if (typeof jsToolBar === 'function') {
$('#disclaimer_text').each(function () {
const tbWidgetTextDisclaimer = new jsToolBar(this);
tbWidgetTextDisclaimer.context = 'disclaimer_text';
tbWidgetTextDisclaimer.draw('xhtml');
});
}
});

View File

@ -1,39 +1,22 @@
<?php <?php
// Language: Français /**
// Module: construction - 1.3.1 * @package Dotclear
// Date: 2018-02-18 16:09:52 *
// Translated with dcTranslater - 2018.02.14 * @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
#_admin.php:24 */
#_admin.php:41 #
#index.php:15 # DOT NOT MODIFY THIS FILE !
$GLOBALS['__l10n']['Construction'] = 'Construction'; #
#_install.php:43
$GLOBALS['__l10n']['Work in progress'] = 'Travaux en cours';
#_install.php:51
$GLOBALS['__l10n']['<p>The blog is currently under construction.</p>'] = '<p>Le blog est actuellement en construction.</p>';
#index.php:94
$GLOBALS['__l10n']['Configuration'] = 'Configuration';
#index.php:99
$GLOBALS['__l10n']['Allowed IP:'] = 'IP autorisées :';
#index.php:102
$GLOBALS['__l10n']['Your IP is <strong>%s</strong> - the allowed IP can view the blog normally.'] = 'Votre IP est <strong>%s</strong> - les IP autorisées peuvent visualiser le blog normalement.';
#index.php:103
$GLOBALS['__l10n']['Extra allowed URL types:'] = 'Autres types d\'URL autorisées :';
#index.php:108
$GLOBALS['__l10n']['Presentation'] = 'Présentation';
#index.php:112
$GLOBALS['__l10n']['Message:'] = 'Message :';
$GLOBALS['__l10n']['Place your blog maintenance'] = 'Mettez votre blog en maintenance';
$GLOBALS['__l10n']['construction'] = 'construction';
l10n::$locales['Construction'] = 'Construction';
l10n::$locales['Work in progress'] = 'Travaux en cours';
l10n::$locales['<p>The blog is currently under construction.</p>'] = '<p>Le blog est actuellement en construction.</p>';
l10n::$locales['Settings successfully updated.'] = 'Paramètres mis à jour.';
l10n::$locales['Configuration'] = 'Configuration';
l10n::$locales['Allowed IP:'] = 'IP autorisées :';
l10n::$locales['Your IP is <strong>%s</strong> - the allowed IP can view the blog normally.'] = 'Votre IP est <strong>%s</strong> - les IP autorisées peuvent visualiser le blog normalement.';
l10n::$locales['Extra allowed URL types:'] = 'Autres types d\'URL autorisées :';
l10n::$locales['Presentation'] = 'Présentation';
l10n::$locales['Message:'] = 'Message :';
l10n::$locales['Place your blog maintenance'] = 'Mettez votre blog en maintenance';

View File

@ -1,61 +1,45 @@
# Language: Français
# Module: construction - 1.3.1
# Date: 2018-02-18 16:09:52
# Translated with translater 2018.02.14
msgid "" msgid ""
msgstr "" msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: construction 1.3.1\n" "Project-Id-Version: construction 1.5\n"
"POT-Creation-Date: \n" "POT-Creation-Date: \n"
"PO-Revision-Date: 2018-02-18T16:09:52+00:00\n" "PO-Revision-Date: 2022-12-31T18:01:51+00:00\n"
"Last-Translator: brol\n" "Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: _admin.php:24
#: _admin.php:41
#: index.php:15
msgid "Construction" msgid "Construction"
msgstr "Construction" msgstr "Construction"
#: _install.php:43
msgid "Work in progress" msgid "Work in progress"
msgstr "Travaux en cours" msgstr "Travaux en cours"
#: _install.php:51
msgid "<p>The blog is currently under construction.</p>" msgid "<p>The blog is currently under construction.</p>"
msgstr "<p>Le blog est actuellement en construction.</p>" msgstr "<p>Le blog est actuellement en construction.</p>"
#: index.php:94 msgid "Settings successfully updated."
msgstr "Paramètres mis à jour."
msgid "Configuration" msgid "Configuration"
msgstr "Configuration" msgstr "Configuration"
#: index.php:99
msgid "Allowed IP:" msgid "Allowed IP:"
msgstr "IP autorisées :" msgstr "IP autorisées :"
#: index.php:102
msgid "Your IP is <strong>%s</strong> - the allowed IP can view the blog normally." msgid "Your IP is <strong>%s</strong> - the allowed IP can view the blog normally."
msgstr "Votre IP est <strong>%s</strong> - les IP autorisées peuvent visualiser le blog normalement." msgstr "Votre IP est <strong>%s</strong> - les IP autorisées peuvent visualiser le blog normalement."
#: index.php:103
msgid "Extra allowed URL types:" msgid "Extra allowed URL types:"
msgstr "Autres types d'URL autorisées :" msgstr "Autres types d'URL autorisées :"
#: index.php:108
msgid "Presentation" msgid "Presentation"
msgstr "Présentation" msgstr "Présentation"
#: index.php:112
msgid "Message:" msgid "Message:"
msgstr "Message :" msgstr "Message :"
msgid "Place your blog maintenance" msgid "Place your blog maintenance"
msgstr "Mettez votre blog en maintenance" msgstr "Mettez votre blog en maintenance"
msgid "construction"
msgstr "construction"