initialisation

This commit is contained in:
Fred Tempez 2020-09-12 09:52:30 +02:00
parent 9c5642b9b0
commit 44d5866d3d
7 changed files with 57 additions and 12 deletions

View File

@ -1713,7 +1713,7 @@ class core extends common {
// Déconnexion // Déconnexion
$user = new user; $user = new user;
$user->logout(); $user->logout();
// Rédirection // Redirection
http_response_code(302); http_response_code(302);
header('Location:' . helper::baseUrl() . 'maintenance'); header('Location:' . helper::baseUrl() . 'maintenance');
exit(); exit();

View File

@ -442,6 +442,7 @@ class config extends common {
'homePageId' => $this->getInput('configHomePageId', helper::FILTER_ID, true), 'homePageId' => $this->getInput('configHomePageId', helper::FILTER_ID, true),
'page404' => $this->getInput('configPage404'), 'page404' => $this->getInput('configPage404'),
'page403' => $this->getInput('configPage403'), 'page403' => $this->getInput('configPage403'),
'page302' => $this->getInput('configPage302'),
'analyticsId' => $this->getInput('configAnalyticsId'), 'analyticsId' => $this->getInput('configAnalyticsId'),
'autoBackup' => $this->getInput('configAutoBackup', helper::FILTER_BOOLEAN), 'autoBackup' => $this->getInput('configAutoBackup', helper::FILTER_BOOLEAN),
'maintenance' => $this->getInput('configMaintenance', helper::FILTER_BOOLEAN), 'maintenance' => $this->getInput('configMaintenance', helper::FILTER_BOOLEAN),

View File

@ -176,7 +176,7 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col4 offset2"> <div class="col4">
<?php <?php
echo template::select('configPage403', array_merge(['none' => 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [ echo template::select('configPage403', array_merge(['none' => 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [
'label' => 'Accès interdit, erreur 403', 'label' => 'Accès interdit, erreur 403',
@ -187,11 +187,19 @@
<div class="col4"> <div class="col4">
<?php <?php
echo template::select('configPage404', array_merge(['none' => 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [ echo template::select('configPage404', array_merge(['none' => 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [
'label' => 'Page inexistante, erreur 404 ', 'label' => 'Page inexistante, erreur 404',
'selected' =>$this->getData(['config', 'page404']), 'selected' =>$this->getData(['config', 'page404']),
'help' => 'Une page 404 ne doit pas apparaître dans l\'arborescence du menu. Créez et éditez une page orpheline.' 'help' => 'Une page 404 ne doit pas apparaître dans l\'arborescence du menu. Créez et éditez une page orpheline.'
]); ?> ]); ?>
</div> </div>
<div class="col4">
<?php
echo template::select('configPage302', array_merge(['none' => 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [
'label' => 'Site en maintenance',
'selected' =>$this->getData(['config', 'page302']),
'help' => 'Page de maintenance personnalisable'
]); ?>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -10,8 +10,9 @@ class init extends common {
'favicon' => 'favicon.ico', 'favicon' => 'favicon.ico',
'faviconDark' => 'faviconDark.ico', 'faviconDark' => 'faviconDark.ico',
'homePageId' => 'accueil', 'homePageId' => 'accueil',
'page302' => 'erreur302',
'page403' => 'erreur403',
'page404' => 'erreur404', 'page404' => 'erreur404',
'page403' => 'erreur403',
'maintenance' => false, 'maintenance' => false,
'social' => [ 'social' => [
'facebookId' => 'facebook', 'facebookId' => 'facebook',
@ -544,6 +545,29 @@ class init extends common {
'hideMenuHead' => false, 'hideMenuHead' => false,
'hideMenuChildren' => false 'hideMenuChildren' => false
], ],
'erreur302' => [
'typeMenu' => 'text',
'iconUrl' => '',
'disable' => false,
'content' => '<h1 id=\"sectionTitle\">Maintenance en cours...<\/h1>\r\n<p>Notre site est actuellement en maintenance. Nous sommes d&eacute;sol&eacute;s pour la g&ecirc;ne occasionn&eacute;e et faisons notre possible pour &ecirc;tre rapidement de retour.<\/p>\r\n<div class=\"row\">\r\n<div class=\"col4 offset8 textAlignCenter\"><a href=\"\/10.300\/user\/login\" id=\"maintenanceLogin\" name=\"maintenanceLogin\" class=\"button \"><span class=\"zwiico-lock zwiico-margin-right\" style=\"font-size: 1em;\"><\/span>Administration<\/a><\/div>\r\n<\/div>\r\n<p><\/p>',
'hideTitle' => false,
'breadCrumb' => false,
'metaDescription' => '',
'metaTitle' => '',
'moduleId' => '',
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Erreur 302',
'block' => '12',
'barLeft' => '',
'barRight' => '',
'displayMenu' => 'none',
'hideMenuSide' => false,
'hideMenuChildren' =>false
],
'erreur403' => [ 'erreur403' => [
'typeMenu' => 'text', 'typeMenu' => 'text',
'iconUrl' => '', 'iconUrl' => '',

View File

@ -22,12 +22,23 @@ class maintenance extends common {
* Maintenance * Maintenance
*/ */
public function index() { public function index() {
// Valeurs en sortie // Page perso définie et existante
$this->addOutput([ if ($this->getData(['config','page302']) !== 'none'
'display' => self::DISPLAY_LAYOUT_LIGHT, AND $this->getData(['page',$this->getData(['config','page302'])]) ) {
'title' => 'Maintenance en cours...', $this->addOutput([
'view' => 'index' 'display' => self::DISPLAY_LAYOUT_LIGHT,
]); 'title' => $this->getData(['page',$this->getData(['config','page302']),'title']),
'content' => $this->getdata(['page',$this->getData(['config','page302']),'content']) . '<div class="col4 offset8 textAlignCenter"><a href="http://localhost/ZwiiCMS/?user/login" id="maintenanceLogin" name="maintenanceLogin" class="button"><span class="zwiico-lock zwiico-margin-right" style="font-size:1em"><!----></span>Connexion</a></div>',
'view' => 'index'
]);
} else {
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_LAYOUT_LIGHT,
'title' => 'Maintenance en cours...',
'view' => 'index'
]);
}
} }
} }

View File

@ -2,7 +2,7 @@
<div class="row"> <div class="row">
<div class="col4 offset8 textAlignCenter"> <div class="col4 offset8 textAlignCenter">
<?php echo template::button('maintenanceLogin', [ <?php echo template::button('maintenanceLogin', [
'value' => 'Administration', 'value' => 'Connexion',
'href' => helper::baseUrl() . 'user/login', 'href' => helper::baseUrl() . 'user/login',
'ico' => 'lock' 'ico' => 'lock'
]); ?> ]); ?>

View File

@ -468,7 +468,8 @@ class user extends common {
*/ */
public function logout() { public function logout() {
// Ne pas effacer l'identifiant mais seulement le mot de passe // Ne pas effacer l'identifiant mais seulement le mot de passe
if ($_COOKIE['ZWII_USER_LONGTIME'] !== 'true' ) { if (array_key_exists('ZWII_USER_LONGTIME',$_COOKIE)
AND $_COOKIE['ZWII_USER_LONGTIME'] !== 'true' ) {
helper::deleteCookie('ZWII_USER_ID'); helper::deleteCookie('ZWII_USER_ID');
helper::deleteCookie('ZWII_USER_LONGTIME'); helper::deleteCookie('ZWII_USER_LONGTIME');
} }