Validations à vérifier

This commit is contained in:
Fred Tempez 2021-10-30 18:12:34 +02:00
parent b41c352bc5
commit 02ff10df39
12 changed files with 114 additions and 46 deletions

View File

@ -1844,6 +1844,7 @@ class common {
$notificationClass = 'notificationSuccess'; $notificationClass = 'notificationSuccess';
} }
if(common::$inputNotices) { if(common::$inputNotices) {
var_dump ( common::$inputNotices );
$notification = 'Impossible de soumettre le formulaire, car il contient des erreurs'; $notification = 'Impossible de soumettre le formulaire, car il contient des erreurs';
$notificationClass = 'notificationError'; $notificationClass = 'notificationError';
} }

View File

@ -674,7 +674,13 @@ if ($this->getData(['core', 'dataVersion']) < 11100) {
// Version 11.2.00 // Version 11.2.00
if ($this->getData(['core', 'dataVersion']) < 11200) { if ($this->getData(['core', 'dataVersion']) < 11200) {
// Déplacer la valeur captcha
// Mise àjour des données de config
$this->setData(['config', 'connect', 'captchaStrong', $this->getData(['config', 'captchaStrong'])]); $this->setData(['config', 'connect', 'captchaStrong', $this->getData(['config', 'captchaStrong'])]);
$this->deleteData(['config', 'captchaStrong']);
$this->setData(['config', 'connect', 'autoDisconnect', $this->getData(['config', 'autoDisconnect'])]);
$this->deleteData(['config', 'autoDisconnect']);
// Mise à jour
$this->setData(['core', 'dataVersion', 11200]); $this->setData(['core', 'dataVersion', 11200]);
} }

View File

@ -443,6 +443,12 @@ class config extends common {
'cookieConsent' => $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN), 'cookieConsent' => $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN),
'favicon' => $this->getInput('configFavicon'), 'favicon' => $this->getInput('configFavicon'),
'faviconDark' => $this->getInput('configFaviconDark'), 'faviconDark' => $this->getInput('configFaviconDark'),
'timezone' => $this->getInput('configTimezone', helper::FILTER_STRING_SHORT),
'autoUpdate' => $this->getInput('configAutoUpdate', helper::FILTER_BOOLEAN),
'autoUpdateHtaccess' => $this->getInput('configAutoUpdateHtaccess', helper::FILTER_BOOLEAN),
'proxyType' => $this->getInput('configProxyType'),
'proxyUrl' => $this->getInput('configProxyUrl'),
'proxyPort' => $this->getInput('configProxyPort',helper::FILTER_INT),
'social' => [ 'social' => [
'facebookId' => $this->getInput('configSocialFacebookId'), 'facebookId' => $this->getInput('configSocialFacebookId'),
'linkedinId' => $this->getInput('configSocialLinkedinId'), 'linkedinId' => $this->getInput('configSocialLinkedinId'),
@ -453,14 +459,6 @@ class config extends common {
'youtubeUserId' => $this->getInput('configSocialYoutubeUserId'), 'youtubeUserId' => $this->getInput('configSocialYoutubeUserId'),
'githubId' => $this->getInput('configSocialGithubId') 'githubId' => $this->getInput('configSocialGithubId')
], ],
'timezone' => $this->getInput('configTimezone', helper::FILTER_STRING_SHORT, true),
'autoUpdate' => $this->getInput('configAutoUpdate', helper::FILTER_BOOLEAN),
'autoUpdateHtaccess' => $this->getInput('configAutoUpdateHtaccess', helper::FILTER_BOOLEAN),
'proxyType' => $this->getInput('configProxyType'),
'proxyUrl' => $this->getInput('configProxyUrl'),
'proxyPort' => $this->getInput('configProxyPort',helper::FILTER_INT),
'captchaStrong' => $this->getInput('configCaptchaStrong',helper::FILTER_BOOLEAN),
'autoDisconnect' => $this->getInput('configAutoDisconnect',helper::FILTER_BOOLEAN),
'smtp' => [ 'smtp' => [
'enable' => $this->getInput('configSmtpEnable',helper::FILTER_BOOLEAN), 'enable' => $this->getInput('configSmtpEnable',helper::FILTER_BOOLEAN),
'host' => $this->getInput('configSmtpHost',helper::FILTER_STRING_SHORT), 'host' => $this->getInput('configSmtpHost',helper::FILTER_STRING_SHORT),
@ -474,12 +472,14 @@ class config extends common {
'seo' => [ 'seo' => [
'robots' => $this->getInput('configSeoRobots',helper::FILTER_BOOLEAN) 'robots' => $this->getInput('configSeoRobots',helper::FILTER_BOOLEAN)
], ],
'connect' => [ 'safety' => [
'attempt' => $this->getInput('configConnectAttempt',helper::FILTER_INT), 'attempt' => $this->getInput('configConnectAttempt',helper::FILTER_INT),
'timeout' => $this->getInput('configConnectTimeout',helper::FILTER_INT), 'timeout' => $this->getInput('configConnectTimeout',helper::FILTER_INT),
'log' => $this->getInput('configConnectLog',helper::FILTER_BOOLEAN), 'log' => $this->getInput('configConnectLog',helper::FILTER_BOOLEAN),
'anonymousIp' => $this->getInput('configConnectAnonymousIp',helper::FILTER_INT), 'anonymousIp' => $this->getInput('configConnectAnonymousIp',helper::FILTER_INT),
'captcha' => $this->getInput('configConnectCaptcha',helper::FILTER_BOOLEAN), 'captcha' => $this->getInput('configConnectCaptcha',helper::FILTER_BOOLEAN),
'captchaStrong' => $this->getInput('configConnectCaptchaStrong',helper::FILTER_BOOLEAN),
'autoDisconnect' => $this->getInput('configConnectAutoDisconnect',helper::FILTER_BOOLEAN),
], ],
'i18n' => [ 'i18n' => [
'enable' => $this->getData(['config', 'i18n', 'enable']) 'enable' => $this->getData(['config', 'i18n', 'enable'])

View File

@ -1,22 +1,22 @@
<div id="safety"> <div id="connectContainer">
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">
<h4>Sécurité de la connexion</h4> <h4>Sécurité de la connexion</h4>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">
<?php echo template::checkbox('ConnectCaptcha', true, 'Captcha à la connexion', [ <?php echo template::checkbox('configConnectCaptcha', true, 'Captcha à la connexion', [
'checked' => $this->getData(['config', 'connect','captcha']) 'checked' => $this->getData(['config', 'connect','captcha'])
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::checkbox('CaptchaStrong', true, 'Captcha complexe', [ <?php echo template::checkbox('configConnectCaptchaStrong', true, 'Captcha complexe', [
'checked' => $this->getData(['config','captchaStrong']), 'checked' => $this->getData(['config','captchaStrong']),
'help' => 'Option recommandée pour sécuriser la connexion. S\'applique à tous les captchas du site. Le captcha simple se limite à une addition de nombres de 0 à 10. Le captcha complexe utilise quatre opérations de nombres de 0 à 20. Activation recommandée.' 'help' => 'Option recommandée pour sécuriser la connexion. S\'applique à tous les captchas du site. Le captcha simple se limite à une addition de nombres de 0 à 10. Le captcha complexe utilise quatre opérations de nombres de 0 à 20. Activation recommandée.'
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::checkbox('AutoDisconnect', true, 'Déconnexion automatique', [ <?php echo template::checkbox('configConnectAutoDisconnect', true, 'Déconnexion automatique', [
'checked' => $this->getData(['config','autoDisconnect']), 'checked' => $this->getData(['config','autoDisconnect']),
'help' => 'Déconnecte les sessions ouvertes précédemment sur d\'autres navigateurs ou terminaux. Activation recommandée.' 'help' => 'Déconnecte les sessions ouvertes précédemment sur d\'autres navigateurs ou terminaux. Activation recommandée.'
]); ?> ]); ?>
@ -24,13 +24,13 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col3"> <div class="col3">
<?php echo template::select('ConnectAttempt', $module::$connectAttempt , [ <?php echo template::select('configConnectAttempt', $module::$connectAttempt , [
'label' => 'Connexions successives', 'label' => 'Connexions successives',
'selected' => $this->getData(['config', 'connect', 'attempt']) 'selected' => $this->getData(['config', 'connect', 'attempt'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
<?php echo template::select('ConnectTimeout', $module::$connectTimeout , [ <?php echo template::select('configConnectTimeout', $module::$connectTimeout , [
'label' => 'Blocage après échecs', 'label' => 'Blocage après échecs',
'selected' => $this->getData(['config', 'connect', 'timeout']) 'selected' => $this->getData(['config', 'connect', 'timeout'])
]); ?> ]); ?>
@ -42,14 +42,14 @@
Après le nombre de tentatives autorisées, l\'IP et le compte sont bloqués.'); Après le nombre de tentatives autorisées, l\'IP et le compte sont bloqués.');
?> ?>
</label> </label>
<?php echo template::button('ConnectblacListDownload', [ <?php echo template::button('ConfigBlackListDownload', [
'href' => helper::baseUrl() . 'config/blacklistDownload', 'href' => helper::baseUrl() . 'config/blacklistDownload',
'value' => 'Télécharger la liste', 'value' => 'Télécharger la liste',
'ico' => 'download' 'ico' => 'download'
]); ?> ]); ?>
</div> </div>
<div class="col3 verticalAlignBottom"> <div class="col3 verticalAlignBottom">
<?php echo template::button('ConnectReset', [ <?php echo template::button('ConfigBlackListReset', [
'class' => 'buttonRed', 'class' => 'buttonRed',
'href' => helper::baseUrl() . 'config/blacklistReset', 'href' => helper::baseUrl() . 'config/blacklistReset',
'value' => 'Réinitialiser la liste', 'value' => 'Réinitialiser la liste',
@ -66,26 +66,26 @@
<h4>Journalisation</h4> <h4>Journalisation</h4>
<div class="row"> <div class="row">
<div class="col3"> <div class="col3">
<?php echo template::checkbox('ConnectLog', true, 'Activer la journalisation', [ <?php echo template::checkbox('ConfigConnectLog', true, 'Activer la journalisation', [
'checked' => $this->getData(['config', 'connect', 'log']) 'checked' => $this->getData(['config', 'connect', 'log'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
<?php echo template::select('ConnectAnonymousIp', $module::$anonIP, [ <?php echo template::select('ConfigConnectAnonymousIp', $module::$anonIP, [
'label' => 'Anonymat des adresses IP', 'label' => 'Anonymat des adresses IP',
'selected' => $this->getData(['config', 'connect', 'anonymousIp']), 'selected' => $this->getData(['config', 'connect', 'anonymousIp']),
'help' => 'La réglementation française impose un anonymat de niveau 2' 'help' => 'La réglementation française impose un anonymat de niveau 2'
]); ?> ]); ?>
</div> </div>
<div class="col3 verticalAlignBottom"> <div class="col3 verticalAlignBottom">
<?php echo template::button('LogDownload', [ <?php echo template::button('ConfigLogDownload', [
'href' => helper::baseUrl() . 'config/logDownload', 'href' => helper::baseUrl() . 'config/logDownload',
'value' => 'Télécharger le journal', 'value' => 'Télécharger le journal',
'ico' => 'download' 'ico' => 'download'
]); ?> ]); ?>
</div> </div>
<div class="col3 verticalAlignBottom"> <div class="col3 verticalAlignBottom">
<?php echo template::button('LogReset', [ <?php echo template::button('ConfigLogReset', [
'class' => 'buttonRed', 'class' => 'buttonRed',
'href' => helper::baseUrl() . 'config/logReset', 'href' => helper::baseUrl() . 'config/logReset',
'value' => 'Réinitialiser le journal', 'value' => 'Réinitialiser le journal',

View File

@ -16,3 +16,11 @@
/** NE PAS EFFACER /** NE PAS EFFACER
* admin.css * admin.css
*/ */
#setupContainer {
display: block;
}
#localeContainer, #socialContainer, #safetyContainer, #networkContainer {
display: none;
}

View File

@ -87,4 +87,59 @@ $( document).ready(function() {
} }
}); });
/**
* Captcha strong si captcha sélectionné
*/
$("input[name=configConnectCaptcha]").on("change", function() {
if ($("input[name=configConnectCaptcha]").is(':checked')) {
$("#configConnectCaptchaStrongWrapper").addClass("disabled");
$("#configConnectCaptchaStrongWrapper").slideDown();
$( "#configConnectCaptchaStrong" ).prop( "checked", false );
} else {
$("#configConnectCaptchaStrongWrapper").removeClass("disabled");
$("#configConnectCaptchaStrongWrapper").slideUp();
}
});
/**
* Sélection de la page de configuration à afficher
*/
$("#configSetupButton").on("click", function() {
$("#localeContainer").slideUp();
$("#socialContainer").slideUp();
$("#connectContainer").slideUp();
$("#networkContainer").slideUp();
$("#setupContainer").slideDown();
});
$("#configLocalButton").on("click", function() {
$("#setupContainer").slideUp();
$("#socialContainer").slideUp();
$("#connectContainer").slideUp();
$("#networkContainer").slideUp();
$("#localeContainer").slideDown();
});
$("#configSocialButton").on("click", function() {
$("#connectContainer").slideUp();
$("#setupContainer").slideUp();
$("#localeContainer").slideUp();
$("#networkContainer").slideUp();
$("#socialContainer").slideDown();
});
$("#configConnectButton").on("click", function() {
$("#setupContainer").slideUp();
$("#localeContainer").slideUp();
$("#socialContainer").slideUp();
$("#networkContainer").slideUp();
$("#connectContainer").slideDown();
});
$("#configNetworkButton").on("click", function() {
$("#setupContainer").slideUp();
$("#localeContainer").slideUp();
$("#socialContainer").slideUp();
$("#connectContainer").slideUp();
$("#networkContainer").slideDown();
});
}); });

View File

@ -23,32 +23,27 @@
<div class="col12"> <div class="col12">
<div class="row textAlignCenter"> <div class="row textAlignCenter">
<div class="col2"> <div class="col2">
<?php echo template::button('Button', [ <?php echo template::button('configSetupButton', [
'href' => helper::baseUrl() . 'config/index',
'value' => 'Paramètres' 'value' => 'Paramètres'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">
<?php echo template::button('Button', [ <?php echo template::button('configLocalButton', [
'href' => helper::baseUrl() . 'config/locale',
'value' => 'Localisation' 'value' => 'Localisation'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">
<?php echo template::button('Button', [ <?php echo template::button('configSocialButton', [
'href' => helper::baseUrl() . 'config/social',
'value' => 'Référencement' 'value' => 'Référencement'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">
<?php echo template::button('Button', [ <?php echo template::button('configConnectButton', [
'href' => helper::baseUrl() . 'config/safety', 'value' => 'Connexion'
'value' => 'Sécurité'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">
<?php echo template::button('Button', [ <?php echo template::button('configNetworkButton', [
'href' => helper::baseUrl() . 'config/network',
'value' => 'Réseau' 'value' => 'Réseau'
]); ?> ]); ?>
</div> </div>
@ -59,6 +54,6 @@
<?php include ('core/module/config/view/setup/setup.php') ?> <?php include ('core/module/config/view/setup/setup.php') ?>
<?php include ('core/module/config/view/locale/locale.php') ?> <?php include ('core/module/config/view/locale/locale.php') ?>
<?php include ('core/module/config/view/social/social.php') ?> <?php include ('core/module/config/view/social/social.php') ?>
<?php include ('core/module/config/view/safety/safety.php') ?> <?php include ('core/module/config/view/connect/connect.php') ?>
<?php include ('core/module/config/view/network/network.php') ?> <?php include ('core/module/config/view/network/network.php') ?>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>

View File

@ -1,4 +1,4 @@
<div id="locale"> <div id="localeContainer">
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">
@ -44,6 +44,9 @@
]); ?> ]); ?>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">

View File

@ -1,4 +1,4 @@
<div id="network"> <div id="networkContainer">
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">

View File

@ -1,4 +1,4 @@
<div id="setup"> <div id="setupContainer">
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">
@ -21,7 +21,7 @@
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::select('Timezone', $module::$timezones, [ <?php echo template::select('configTimezone', $module::$timezones, [
'label' => 'Fuseau horaire', 'label' => 'Fuseau horaire',
'selected' => $this->getData(['config', 'timezone']), 'selected' => $this->getData(['config', 'timezone']),
'help' => 'Le fuseau horaire est utile au bon référencement' 'help' => 'Le fuseau horaire est utile au bon référencement'
@ -30,13 +30,13 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::checkbox('CookieConsent', true, 'Message de consentement aux cookies', [ <?php echo template::checkbox('ConfigCookieConsent', true, 'Message de consentement aux cookies', [
'checked' => $this->getData(['config', 'cookieConsent']), 'checked' => $this->getData(['config', 'cookieConsent']),
'help' => 'Activation obligatoire selon les lois françaises sauf si vous utilisez votre propre système de consentement.' 'help' => 'Activation obligatoire selon les lois françaises sauf si vous utilisez votre propre système de consentement.'
]); ?> ]); ?>
</div> </div>
<div class="col6"> <div class="col6">
<?php echo template::checkbox('rewrite', true, 'URL intelligentes', [ <?php echo template::checkbox('ConfigRewrite', true, 'URL intelligentes', [
'checked' => helper::checkRewrite(), 'checked' => helper::checkRewrite(),
'help' => 'Vérifiez d\'abord que votre serveur autorise l\'URL rewriting (ce qui n\'est pas le cas chez Free).' 'help' => 'Vérifiez d\'abord que votre serveur autorise l\'URL rewriting (ce qui n\'est pas le cas chez Free).'
]); ?> ]); ?>
@ -52,21 +52,21 @@
<?php $updateError = helper::urlGetContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/version');?> <?php $updateError = helper::urlGetContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/version');?>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">
<?php echo template::checkbox('AutoUpdate', true, 'Rechercher une mise à jour en ligne', [ <?php echo template::checkbox('ConfigAutoUpdate', true, 'Rechercher une mise à jour en ligne', [
'checked' => $this->getData(['config', 'autoUpdate']), 'checked' => $this->getData(['config', 'autoUpdate']),
'help' => 'La vérification est quotidienne. Option désactivée si la configuration du serveur ne le permet pas.', 'help' => 'La vérification est quotidienne. Option désactivée si la configuration du serveur ne le permet pas.',
'disabled' => !$updateError 'disabled' => !$updateError
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::checkbox('AutoUpdateHtaccess', true, 'Préserver le fichier htaccess racine', [ <?php echo template::checkbox('ConfigAutoUpdateHtaccess', true, 'Préserver le fichier htaccess racine', [
'checked' => $this->getData(['config', 'autoUpdateHtaccess']), 'checked' => $this->getData(['config', 'autoUpdateHtaccess']),
'help' => 'Lors d\'une mise à jour automatique, conserve le fichier htaccess de la racine du site.', 'help' => 'Lors d\'une mise à jour automatique, conserve le fichier htaccess de la racine du site.',
'disabled' => !$updateError 'disabled' => !$updateError
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::button('UpdateForced', [ <?php echo template::button('ConfigUpdateForced', [
'ico' => 'download-cloud', 'ico' => 'download-cloud',
'href' => helper::baseUrl() . 'install/update', 'href' => helper::baseUrl() . 'install/update',
'value' => 'Mise à jour manuelle', 'value' => 'Mise à jour manuelle',
@ -84,13 +84,13 @@
<h4>Maintenance</h4> <h4>Maintenance</h4>
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::checkbox('AutoBackup', true, 'Sauvegarde automatique quotidienne du site', [ <?php echo template::checkbox('ConfigAutoBackup', true, 'Sauvegarde automatique quotidienne du site', [
'checked' => $this->getData(['config', 'autoBackup']), 'checked' => $this->getData(['config', 'autoBackup']),
'help' => 'Une archive contenant le dossier /site/data est copiée dans le dossier \'site/backup\'. La sauvegarde est conservée pendant 30 jours.</p><p>Les fichiers du site ne sont pas sauvegardés automatiquement. Activation recommandée.' 'help' => 'Une archive contenant le dossier /site/data est copiée dans le dossier \'site/backup\'. La sauvegarde est conservée pendant 30 jours.</p><p>Les fichiers du site ne sont pas sauvegardés automatiquement. Activation recommandée.'
]); ?> ]); ?>
</div> </div>
<div class="col6"> <div class="col6">
<?php echo template::checkbox('Maintenance', true, 'Site en maintenance', [ <?php echo template::checkbox('ConfigMaintenance', true, 'Site en maintenance', [
'checked' => $this->getData(['config', 'maintenance']) 'checked' => $this->getData(['config', 'maintenance'])
]); ?> ]); ?>
</div> </div>

View File

@ -1,4 +1,4 @@
<div id="social"> <div id="socialContainer">
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">