diff --git a/CHANGES.md b/CHANGES.md index e698931e..ee86978d 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,16 @@ # Changelog +## version 10.3.00 +- Corrections : + - Bloquage de l'incrémentation de l'id de page lorsque deux pages ont le même nom. + - Login : l'option "Se souvenir de moi" est fonctionnelle. + - Menu : déplacement de la classe "active". +- Modifications : + - Configuration du site : + - Pages 403 (accès interdit) et 404 (page introuvable) personnalisables + - Sauvegarde du site dans une archive : animation d'attente avec message de confirmation ou d'erreur. ; le nom de l'archive prend le nom du sous-domaine s'il existe. + - Captcha : addition présentée en lettres sous la forme d'images, réponse en chiffres ; correction du nom de la fonction (capcha en captcha). + ## version 10.2.06 - Corrections : - Anticipation de la dépréciation de l'option de cookie samesite=none. diff --git a/README.md b/README.md index f427f44d..fd806728 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://img.shields.io/github/last-commit/fredtempez/ZwiiCMS/master) ![](https://img.shields.io/github/release-date/fredtempez/ZwiiCMS) -# ZwiiCMS 10.2.06 +# ZwiiCMS 10.2.07 Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation. diff --git a/core/class/helper.class.php b/core/class/helper.class.php index ffe6c1ad..86649506 100755 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -98,7 +98,9 @@ class helper { public static function autoBackup($folder, $filter = ['backup','tmp'] ) { // Creation du ZIP - $fileName = 'ZwiiCMS-backup'. date('Y-m-d-h-i-s', time()) . '.zip'; + $baseName = str_replace('/','',helper::baseUrl(false,false)); + $baseName = empty($baseName) ? 'ZwiiCMS' : $baseName; + $fileName = $baseName . '-backup-' . date('Y-m-d-h-i-s', time()) . '.zip'; $zip = new ZipArchive(); $zip->open($folder . $fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); $directory = 'site/'; diff --git a/core/class/template.class.php b/core/class/template.class.php index d3cc78bf..82554bf5 100755 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -33,12 +33,12 @@ class template { } /** - * Crée un champ capcha + * Crée un champ captcha * @param string $nameId Nom et id du champ * @param array $attributes Attributs ($key => $value) * @return string */ - public static function capcha($nameId, array $attributes = []) { + public static function captcha($nameId, array $attributes = []) { // Attributs par défaut $attributes = array_merge([ 'class' => '', @@ -48,15 +48,18 @@ class template { 'name' => $nameId, 'value' => '' ], $attributes); - // Génère deux nombres pour le capcha - $firstNumber = mt_rand(1, 15); - $secondNumber = mt_rand(1, 15); + // Génère deux nombres pour le captcha + $numbers = array(0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20); + $letters = array('u','t','s','r','q','p','o','n','m','l','k','j','i','h','g','f','e','d','c','b','a'); + $firstNumber = rand ( 0 , count($letters)-1 ); + $secondNumber = rand ( 0 , count($letters)-1 ); // Début du wrapper $html = '
'; // Label - $html .= self::label($attributes['id'], $firstNumber . ' + ' . $secondNumber . ' = ?', [ - 'help' => $attributes['help'] - ]); + $html .= self::label($attributes['id'], + ' + = en chiffres ?', [ + 'help' => $attributes['help'] + ]); // Notice $notice = ''; if(array_key_exists($attributes['id'], common::$inputNotices)) { @@ -64,7 +67,7 @@ class template { $attributes['class'] .= ' notice'; } $html .= self::notice($attributes['id'], $notice); - // Capcha + // captcha $html .= sprintf( '', helper::sprintAttributes($attributes) @@ -241,7 +244,7 @@ class template { 'value' => $attributes['value'] ]); // Champ d'upload - $html .= '
'; + $html .= '
'; $html .= sprintf( 'getData(['core', 'dataVersion']) < 10201) { // Options de barre de membre simple $this->setData(['theme','footer','displayMemberBar',false]); - $this->setData(['theme','menu','memberBar',true]); $this->deleteData(['theme','footer','displayMemberAccount']); $this->deleteData(['theme','footer','displayMemberLogout']); $this->setData(['core', 'dataVersion', 10201]); } + // Version 10.3.00 + if ($this->getData(['core', 'dataVersion']) < 10300) { + // Options de barre de membre simple + $this->setData(['config','page404','none']); + $this->setData(['config','page403','none']); + $this->setData(['core', 'dataVersion', 10300]); + } } } @@ -1946,18 +1952,26 @@ class core extends common { 'content' => template::speech('La page ' . $accessInfo['pageId'] . ' est ouverte par l\'utilisateur ' . $accessInfo['userName'] . '') ]); } else { - $this->addOutput([ - 'title' => 'Erreur 403', - 'content' => template::speech('Vous n\'êtes pas autorisé à accéder à cette page...') - ]); + if ( $this->getData(['config','page403']) === 'none') { + $this->addOutput([ + 'title' => 'Erreur 403', + 'content' => template::speech('Vous n\'êtes pas autorisé à accéder à cette page...') + ]); + } else { + header('Location:' . helper::baseUrl() . $this->getData(['config','page403'])); + } } } elseif($this->output['content'] === '') { http_response_code(404); - $this->addOutput([ - 'title' => 'Erreur 404', - 'content' => template::speech('Oups ! La page demandée est introuvable...') - ]); + if ( $this->getData(['config','page404']) === 'none') { + $this->addOutput([ + 'title' => 'Erreur 404', + 'content' => template::speech('Oups ! La page demandée est introuvable...') + ]); + } else { + header('Location:' . helper::baseUrl() . $this->getData(['config','page404'])); + } } // Mise en forme des métas if($this->output['metaTitle'] === '') { @@ -2258,7 +2272,7 @@ class layout extends common { foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) { // Passer les entrées masquées // Propriétés de l'item - $active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? ' class="active"' : ''; + $active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : ''; $targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : ''; // Mise en page de l'item $items .= '
  • '; @@ -2268,7 +2282,7 @@ class layout extends common { {$items .= ''; } else { - $items .= ''; + $items .= ''; } switch ($this->getData(['page', $parentPageId, 'typeMenu'])) { @@ -2314,7 +2328,7 @@ class layout extends common { $items .= '
  • 'Valider', - 'ico' => 'check' - ]); ?> + 'value' => 'Sauvegarder' + ]); ?>
    +
    diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index f7939075..0fb94b39 100755 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -11,15 +11,13 @@
    helper::baseUrl() . 'config/backup', - 'value' => 'Sauvegarder', - 'ico' => 'download' + 'value' => 'Sauvegarder' ]); ?>
    helper::baseUrl() . 'config/manage', - 'value' => 'Restaurer', - 'ico' => 'upload' + 'value' => 'Restaurer' ]); ?>
    @@ -31,21 +29,7 @@

    Informations générales

    -
    - getData(['page']); - foreach($pages as $page => $pageId) { - if ($this->getData(['page',$page,'block']) === 'bar' || - $this->getData(['page',$page,'disable']) === true) { - unset($pages[$page]); - } - } - echo template::select('configHomePageId', helper::arrayCollumn($pages, 'title', 'SORT_ASC'), [ - 'label' => 'Page d\'accueil', - 'selected' =>$this->getData(['config', 'homePageId']) - ]); ?> -
    -
    +
    'Titre du site', 'value' => $this->getData(['config', 'title']), @@ -58,13 +42,62 @@ 'Description du site', 'value' => $this->getData(['config', 'metaDescription']), - 'help' => 'Elle apparaît dans les partages sur les réseaux sociaux.' + 'help' => 'La description participe au référence, n\'oubliez pas de personnaliser la description de chaque page sans copié collé.' ]); ?>
    +
    +
    +
    +

    Pages spéciales

    +
    +
    + getData(['page']); + foreach($pages as $page => $pageId) { + if ($this->getData(['page',$page,'block']) === 'bar' || + $this->getData(['page',$page,'disable']) === true) { + unset($pages[$page]); + } + } + echo template::select('configHomePageId', helper::arrayCollumn($pages, 'title', 'SORT_ASC'), [ + 'label' => 'Accueil du site', + 'selected' =>$this->getData(['config', 'homePageId']), + 'help' => 'La page par défaut, c\'est la première page vue par vos visiteurs' + ]); ?> +
    +
    + 'Sélectionner'] , helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC') ) , [ + 'label' => 'Mentions légales', + 'selected' => $this->getData(['config', 'legalPageId']), + 'help' => 'Les mentions légales sont obligatoires en France. Une option du thèmz - pied de page ajoute un lien discret vers cette page.' + ]); ?> +
    +
    +
    +
    + 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [ + 'label' => 'Accès interdit, erreur 403', + 'selected' =>$this->getData(['config', 'page403']), + 'help' => 'Une page 403 ne doit pas apparaître dans l\'arborescence du menu. Créez puis sélectionnez une page orpheline.' + ]); ?> +
    +
    + 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [ + 'label' => 'Page inexistante, erreur 404 ', + 'selected' =>$this->getData(['config', 'page404']), + 'help' => 'Une page 404 ne doit pas apparaître dans l\'arborescence du menu. Créez puis sélectionnez une page orpheline.' + ]); ?> +
    +
    +
    +
    +
    @@ -103,16 +136,7 @@ 'help' => 'Le fuseau horaire est utile au bon référencement' ]); ?>
    -
    - 'Sélectionner'] , helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC') ); - ?> - 'Mentions légales', - 'selected' => $this->getData(['config', 'legalPageId']), - 'help' => 'Les mentions légales sont obligatoires en France' - ]); ?> -
    -
    +
    $this->getData(['config', 'cookieConsent']) ]); ?> diff --git a/core/module/config/view/manage/manage.php b/core/module/config/view/manage/manage.php index cd951922..bc5a8c2e 100755 --- a/core/module/config/view/manage/manage.php +++ b/core/module/config/view/manage/manage.php @@ -10,8 +10,7 @@
    'Valider', - 'ico' => 'check' + 'value' => 'Restaurer' ]); ?>
    diff --git a/core/module/config/view/restore/restore.css b/core/module/config/view/restore/restore.css deleted file mode 100755 index 6faa3a6a..00000000 --- a/core/module/config/view/restore/restore.css +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file is part of Zwii. - * - * For full copyright and license information, please see the LICENSE - * file that was distributed with this source code. - * - * @author Rémi Jean - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2020, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.com/ - */ - -@import url("site/data/admin.css"); \ No newline at end of file diff --git a/core/module/config/view/restore/restore.php b/core/module/config/view/restore/restore.php deleted file mode 100755 index 8c4fc4ff..00000000 --- a/core/module/config/view/restore/restore.php +++ /dev/null @@ -1,85 +0,0 @@ - -
    -
    - 'buttonGrey', - 'href' => helper::baseUrl() . 'config', - 'ico' => 'left', - 'value' => 'Retour' - ]); ?> -
    -
    - 'Restaurer', - 'ico' => 'upload' - ]); ?> -
    -
    -
    -
    -
    -

    Restauration ou transfert d'un site

    -
    -
    - 'Sélectionnez une sauvegarde au format ZIP', - 'type' => 2, - 'help' => 'L\'archive a été déposée dans le gestionnaire de fichiers. Les archives inférieures à la version 9 ne sont pas acceptées.' - ]); ?> -
    -
    -
    -
    - true, - 'help' => 'Les données des utilisateurs installés ne sont pas écrasés par la restauration quand l\'option est active.' - ]); ?> -
    -
    -
    -
    -
    -
    -
    -
    -

    Conversion des URL après transfert de site

    -
    -
    - getData(['core', 'baseUrl'])) ) { - $baseUrlValue = 'Pas de donnée dans la sauvegarde'; - $buttonClass = 'disabled'; - } elseif ($this->getData(['core', 'baseUrl']) === '') { - $baseUrlValue = '/'; - $buttonClass = (helper::baseUrl(true,false) !== $this->getData(['core', 'baseUrl']) ) ? '' : 'disabled'; - } else { - $baseUrlValue = $this->getData(['core', 'baseUrl']); - $buttonClass = (helper::baseUrl(true,false) !== $this->getData(['core', 'baseUrl']) ) ? '' : 'disabled'; - } - echo template::text('configRestoreBaseURLToConvert', [ - 'label' => 'Dossier d\'installation de l\'archive' , - 'value' => $baseUrlValue, - 'readonly' => true, - 'help' => 'Lors de la restauration d\'un backup d\'une version 9.2.10 ou supérieure, l\'URL de base est stockée dans la configuration sinon cette donnée est vide.' - ]); ?> -
    -
    - 'Dossier du site actuel', - 'value' => helper::baseUrl(true,false), - 'readonly' => true, - 'help' => 'Dossier du site installé.' - ]); ?> -
    -
    - helper::baseUrl() . 'config/updateBaseUrl', - 'class' => $buttonClass, - 'value' => 'convertir' - ]); ?> -
    -
    -
    -
    -
    - diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 4a9cf666..7942a8f4 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -5,10 +5,13 @@ class init extends common { 'analyticsId' => '', 'autoBackup' => true, 'autoUpdate' => true, + 'autoUpdateHtaccess' => false, 'cookieConsent' => true, 'favicon' => 'favicon.ico', 'faviconDark' => 'faviconDark.ico', 'homePageId' => 'accueil', + 'page404' => 'erreur404', + 'page403' => 'erreur403', 'maintenance' => false, 'social' => [ 'facebookId' => 'facebook', @@ -24,20 +27,20 @@ class init extends common { 'legalPageId' => 'mentions-legales', 'metaDescription' => 'Zwii est un CMS sans base de données qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.', 'title' => 'Votre site en quelques clics !', - 'proxyUrl' => "", - 'proxyPort' => "", - 'proxyType' => "tcp://", + 'proxyUrl' => '', + 'proxyPort' => '', + 'proxyType' => 'tcp://', 'smtp' => [ 'enable' => false, ], - "connect" => [ - "timeout" => 600, - "attempt" => 3, + 'connect' => [ + 'timeout' => 600, + 'attempt' => 3, 'log' => false ] ], 'core' => [ - 'dataVersion' => 10000, + 'dataVersion' => 10300, 'lastBackup' => 0, 'lastClearTmp' => 0, 'lastAutoUpdate' => 0, @@ -109,10 +112,11 @@ class init extends common { 'displayCopyright' => false, 'displayLegal' => false, 'displaySearch' => false, + 'displayMemberBar' => false, 'template' => '3' ], 'header' => [ - 'backgroundColor' => 'rgba(255, 255, 255, 1)', + 'backgroundColor' => 'rgba(32, 59, 82, 1)', 'font' => 'Oswald', 'fontSize' => '2em', 'fontWeight' => 'normal', @@ -123,7 +127,7 @@ class init extends common { 'margin' => false, 'position' => 'site', 'textAlign' => 'center', - 'textColor' => 'rgba(0, 17, 157, 1)', + 'textColor' => 'rgba(255, 255, 255, 1)', 'textHide' => false, 'textTransform' => 'none', 'linkHomePage' => true, @@ -146,7 +150,8 @@ class init extends common { 'activeColorAuto' => true, 'activeColor' => 'rgba(255, 255, 255, 1)', 'activeTextColor' => 'rgba(255, 255, 255, 1)', - 'radius' => '0px' + 'radius' => '0px', + 'memberBar' => true ], 'site' => [ 'backgroundColor' => 'rgba(255, 255, 255, 1)', @@ -537,7 +542,53 @@ class init extends common { 'hideMenuSide' => false, 'hideMenuHead' => false, 'hideMenuChildren' => false - ] + ], + 'erreur403' => [ + 'typeMenu' => 'text', + 'iconUrl' => '', + 'disable' => false, + 'content' => '

    Vous n\'êtes pas autorisé à accéder à cette page...

    Personnalisez cette page à votre convenance sans qu\'elle apparaisse dans les menus.

    ', + 'hideTitle' => false, + 'breadCrumb' => false, + 'metaDescription' => '', + 'metaTitle' => '', + 'moduleId' => '', + 'modulePosition' => 'bottom', + 'parentPageId' => '', + 'position' => 0, + 'group' => self::GROUP_VISITOR, + 'targetBlank' => false, + 'title' => 'Erreur 403', + 'block' => '12', + 'barLeft' => '', + 'barRight' => '', + 'displayMenu' => 'none', + 'hideMenuSide' => false, + 'hideMenuChildren' =>false + ], + 'erreur404' => [ + 'typeMenu' => 'text', + 'iconUrl' => '', + 'disable' => false, + 'content' => '

    Oups ! La page demandée est introuvable...

    Personnalisez cette page à votre convenance sans qu\'elle apparaisse dans les menus.

    ', + 'hideTitle' => false, + 'breadCrumb' => false, + 'metaDescription' => '', + 'metaTitle' => '', + 'moduleId' => '', + 'modulePosition' => 'bottom', + 'parentPageId' => '', + 'position' => 0, + 'group' => self::GROUP_VISITOR, + 'targetBlank' => false, + 'title' => 'Erreur 404', + 'block' => '12', + 'barLeft' => '', + 'barRight' => '', + 'displayMenu' => 'none', + 'hideMenuSide' => false, + 'hideMenuChildren' =>false + ], ], 'module' => [ 'blog' => [ @@ -632,7 +683,7 @@ class init extends common { 'contact' => [ 'config' => [ 'button' => '', - 'capcha' => true, + 'captcha' => true, 'group' => self::GROUP_ADMIN, 'pageId' => '', 'subject' => '' @@ -665,3 +716,4 @@ class init extends common { ] ]; } + diff --git a/core/module/install/view/index/index.css b/core/module/install/view/index/index.css old mode 100755 new mode 100644 index ba396f2e..d7c543b0 --- a/core/module/install/view/index/index.css +++ b/core/module/install/view/index/index.css @@ -1,17 +1 @@ -/** - * This file is part of Zwii. - * - * For full copyright and license information, please see the LICENSE - * file that was distributed with this source code. - * - * @author Rémi Jean - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2020, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.com/ - */ - - - -@import url("site/data/admin.css"); \ No newline at end of file +/* Vide */ \ No newline at end of file diff --git a/core/module/install/view/index/index.php b/core/module/install/view/index/index.php index 74677c5a..6debdbf3 100755 --- a/core/module/install/view/index/index.php +++ b/core/module/install/view/index/index.php @@ -20,7 +20,7 @@

    'off', - 'label' => 'Adresse mail' + 'label' => 'Adresse mail' ]); ?>
    @@ -41,7 +41,7 @@ true ]); - ?> + ?>
    diff --git a/core/module/page/page.php b/core/module/page/page.php index 52c91f84..ea04e665 100755 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -185,7 +185,12 @@ class page extends common { else { // Soumission du formulaire if($this->isPost()) { - $pageId = $this->getInput('pageEditTitle', helper::FILTER_ID, true); + // Génére l'ID si le titre de la page a changé + if ( $this->getInput('pageEditTitle') !== $this->getData(['page',$this->getUrl(2),'title']) ) { + $pageId = $this->getInput('pageEditTitle', helper::FILTER_ID, true); + } else { + $pageId = $this->getUrl(2); + } // un dossier existe du même nom (erreur en cas de redirection) if (file_exists($pageId)) { $pageId = uniqid($pageId); diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 498960e5..529d6900 100755 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -669,7 +669,7 @@ class theme extends common { unlink (self::TEMP_DIR . $zipFilename); // Valeurs en sortie $this->addOutput([ - 'notification' => 'Archive '.$zipFilename.' sauvegardée dans fichiers', + 'notification' => 'Archive '.$zipFilename.' sauvegardée avec succès', 'redirect' => helper::baseUrl() . 'theme/manage', 'state' => true ]); diff --git a/core/module/theme/view/body/body.php b/core/module/theme/view/body/body.php index 04746e48..b65db690 100755 --- a/core/module/theme/view/body/body.php +++ b/core/module/theme/view/body/body.php @@ -41,21 +41,26 @@ 'help' => 'Le curseur horizontal règle le niveau de transparence.', 'label' => 'Icône haut de page', 'value' => $this->getData(['theme', 'body', 'toTopColor']) - ]); ?> + ]); ?>
    -
    +

    Image

    - getData(['theme', 'body', 'image'])) ? $this->getData(['theme', 'body', 'image']) : ""; - echo template::file('themeBodyImage', [ - 'label' => 'Fond', - 'type' => 1, - 'value' => $imageFile - ]); ?> +
    +
    + getData(['theme', 'body', 'image'])) ? $this->getData(['theme', 'body', 'image']) : ""; + echo template::file('themeBodyImage', [ + 'help' => 'Sélectionner une image', + 'label' => 'Fond', + 'type' => 1, + 'value' => $imageFile + ]); ?> +
    +
    diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 8d3b41cf..34b54e91 100755 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -20,7 +20,7 @@
    'colorPicker', - 'help' => 'Le curseur horizontal règle le niveau de transparence.', + 'help' => 'Le curseur horizontal règle le niveau de transparence.', 'label' => 'Fond', 'value' => $this->getData(['theme', 'header', 'backgroundColor']) ]); ?> @@ -30,7 +30,7 @@
    'colorPicker', - 'help' => 'Le curseur horizontal règle le niveau de transparence.', + 'help' => 'Le curseur horizontal règle le niveau de transparence.', 'label' => 'Texte', 'value' => $this->getData(['theme', 'header', 'textColor']) ]); ?> @@ -47,6 +47,7 @@ $imageFile = file_exists(self::FILE_DIR.'source/'.$this->getData(['theme', 'header', 'image'])) ? $this->getData(['theme', 'header', 'image']) : ""; echo template::file('themeHeaderImage', [ + 'help' => 'Sélectionner une image aux dimensions recommandées ci-dessous :', 'label' => 'Fond', 'type' => 1, 'value' => $imageFile @@ -77,15 +78,15 @@
    $this->getData(['theme', 'header', 'linkHomePage']) - ]); ?> -
    + ]); ?> +
    Dimensions de l'image : largeur - hauteur - ratio -
    +
    @@ -110,7 +111,7 @@ Cover pour une image plus grande que la bannière, Contain pour une image plus petite. Les modes Auto et Etiré ne provoquent pas de modification de la hauteur de la bannière.' ]); ?> -
    +
    'Hauteur maximale', diff --git a/core/module/theme/view/manage/manage.php b/core/module/theme/view/manage/manage.php index ad86da93..ff7a28ba 100755 --- a/core/module/theme/view/manage/manage.php +++ b/core/module/theme/view/manage/manage.php @@ -26,7 +26,7 @@ 'Appliquer' ]); ?> -
    + @@ -49,6 +49,11 @@ ]); ?> +
    +
    + Le fichier de sauvegarde est généré dans le dossier Thème du gestionnaire de fichiers. +
    +

    Télécharger le thème

    @@ -59,16 +64,16 @@ 'ico' => 'download', 'value' => 'Thème site' ]); ?> -
    +
    helper::baseUrl() . 'theme/export/admin', 'ico' => 'download', 'value' => 'Thème administration' ]); ?> -
    + - + diff --git a/core/module/user/user.php b/core/module/user/user.php index 4ab38f8f..b9e8a124 100755 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -24,8 +24,13 @@ class user extends common { 'logout' => self::GROUP_MEMBER, 'reset' => self::GROUP_VISITOR ]; + public static $users = []; + public static $userId = ''; + + public static $userLongtime = false; + /** * Ajout */ @@ -373,7 +378,7 @@ class user extends common { */ } else { // Cas 4 : le délai de blocage est dépassé et le compte est au max - Réinitialiser - if ($this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time() + if ($this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time() AND $this->getData(['user',$userId,'connectFail']) === $this->getData(['config', 'connect', 'attempt']) ) { $this->setData(['user',$userId,'connectFail',0 ]); $this->setData(['user',$userId,'connectTimeout',0 ]); @@ -388,8 +393,10 @@ class user extends common { ) { // Expiration $expire = $this->getInput('userLoginLongTime') ? strtotime("+1 year") : 0; - setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true); + $c = $this->getInput('userLoginLongTime', helper::FILTER_BOOLEAN) === true ? 'true' : 'false'; + setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false) , '', helper::isHttps(), true); setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false), '', helper::isHttps(), true); + setcookie('ZWII_USER_LONGTIME', $c, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true); // Accès multiples avec le même compte $this->setData(['user',$userId,'accessCsrf',$_SESSION['csrf']]); // Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur @@ -442,6 +449,12 @@ class user extends common { } } } + if (!empty($_COOKIE['ZWII_USER_ID'])) { + self::$userId = $_COOKIE['ZWII_USER_ID']; + } + if (!empty($_COOKIE['ZWII_USER_LONGTIME'])) { + self::$userLongtime = $_COOKIE['ZWII_USER_LONGTIME'] == 'true' ? true : false; + } // Valeurs en sortie $this->addOutput([ 'display' => self::DISPLAY_LAYOUT_LIGHT, @@ -454,7 +467,11 @@ class user extends common { * Déconnexion */ public function logout() { - helper::deleteCookie('ZWII_USER_ID'); + // Ne pas effacer l'identifiant mais seulement le mot de passe + if ($_COOKIE['ZWII_USER_LONGTIME'] !== 'true' ) { + helper::deleteCookie('ZWII_USER_ID'); + helper::deleteCookie('ZWII_USER_LONGTIME'); + } helper::deleteCookie('ZWII_USER_PASSWORD'); session_destroy(); // Valeurs en sortie diff --git a/core/module/user/view/login/login.php b/core/module/user/view/login/login.php index a25c0529..3a1af756 100755 --- a/core/module/user/view/login/login.php +++ b/core/module/user/view/login/login.php @@ -2,7 +2,8 @@
    'Identifiant' + 'label' => 'Identifiant', + 'value' => $module::$userId ]); ?>
    @@ -14,9 +15,8 @@
    'La session est close à la fermeture du navigateur.' - ]); ?> - + 'checked' => $module::$userLongtime + ]); ?>
    Mot de passe perdu ? diff --git a/core/vendor/zwiico/png/a.png b/core/vendor/zwiico/png/a.png new file mode 100644 index 00000000..f4ef6eef Binary files /dev/null and b/core/vendor/zwiico/png/a.png differ diff --git a/core/vendor/zwiico/png/b.png b/core/vendor/zwiico/png/b.png new file mode 100644 index 00000000..e14be925 Binary files /dev/null and b/core/vendor/zwiico/png/b.png differ diff --git a/core/vendor/zwiico/png/c.png b/core/vendor/zwiico/png/c.png new file mode 100644 index 00000000..dcf2125d Binary files /dev/null and b/core/vendor/zwiico/png/c.png differ diff --git a/core/vendor/zwiico/png/d.png b/core/vendor/zwiico/png/d.png new file mode 100644 index 00000000..ca9f562a Binary files /dev/null and b/core/vendor/zwiico/png/d.png differ diff --git a/core/vendor/zwiico/png/e.png b/core/vendor/zwiico/png/e.png new file mode 100644 index 00000000..ea3f028b Binary files /dev/null and b/core/vendor/zwiico/png/e.png differ diff --git a/core/vendor/zwiico/png/f.png b/core/vendor/zwiico/png/f.png new file mode 100644 index 00000000..6bfdd37e Binary files /dev/null and b/core/vendor/zwiico/png/f.png differ diff --git a/core/vendor/zwiico/png/g.png b/core/vendor/zwiico/png/g.png new file mode 100644 index 00000000..a55422c1 Binary files /dev/null and b/core/vendor/zwiico/png/g.png differ diff --git a/core/vendor/zwiico/png/h.png b/core/vendor/zwiico/png/h.png new file mode 100644 index 00000000..5bc5592d Binary files /dev/null and b/core/vendor/zwiico/png/h.png differ diff --git a/core/vendor/zwiico/png/i.png b/core/vendor/zwiico/png/i.png new file mode 100644 index 00000000..2732d8c1 Binary files /dev/null and b/core/vendor/zwiico/png/i.png differ diff --git a/core/vendor/zwiico/png/j.png b/core/vendor/zwiico/png/j.png new file mode 100644 index 00000000..7dbaf189 Binary files /dev/null and b/core/vendor/zwiico/png/j.png differ diff --git a/core/vendor/zwiico/png/k.png b/core/vendor/zwiico/png/k.png new file mode 100644 index 00000000..61c2d295 Binary files /dev/null and b/core/vendor/zwiico/png/k.png differ diff --git a/core/vendor/zwiico/png/l.png b/core/vendor/zwiico/png/l.png new file mode 100644 index 00000000..4a88e131 Binary files /dev/null and b/core/vendor/zwiico/png/l.png differ diff --git a/core/vendor/zwiico/png/m.png b/core/vendor/zwiico/png/m.png new file mode 100644 index 00000000..747bc5c6 Binary files /dev/null and b/core/vendor/zwiico/png/m.png differ diff --git a/core/vendor/zwiico/png/n.png b/core/vendor/zwiico/png/n.png new file mode 100644 index 00000000..2961ad9d Binary files /dev/null and b/core/vendor/zwiico/png/n.png differ diff --git a/core/vendor/zwiico/png/o.png b/core/vendor/zwiico/png/o.png new file mode 100644 index 00000000..dfa61db1 Binary files /dev/null and b/core/vendor/zwiico/png/o.png differ diff --git a/core/vendor/zwiico/png/p.png b/core/vendor/zwiico/png/p.png new file mode 100644 index 00000000..c5d4377e Binary files /dev/null and b/core/vendor/zwiico/png/p.png differ diff --git a/core/vendor/zwiico/png/q.png b/core/vendor/zwiico/png/q.png new file mode 100644 index 00000000..fc4729dc Binary files /dev/null and b/core/vendor/zwiico/png/q.png differ diff --git a/core/vendor/zwiico/png/r.png b/core/vendor/zwiico/png/r.png new file mode 100644 index 00000000..c6d308ce Binary files /dev/null and b/core/vendor/zwiico/png/r.png differ diff --git a/core/vendor/zwiico/png/s.png b/core/vendor/zwiico/png/s.png new file mode 100644 index 00000000..7d93e6ac Binary files /dev/null and b/core/vendor/zwiico/png/s.png differ diff --git a/core/vendor/zwiico/png/t.png b/core/vendor/zwiico/png/t.png new file mode 100644 index 00000000..1d2b985b Binary files /dev/null and b/core/vendor/zwiico/png/t.png differ diff --git a/core/vendor/zwiico/png/u.png b/core/vendor/zwiico/png/u.png new file mode 100644 index 00000000..e2db2904 Binary files /dev/null and b/core/vendor/zwiico/png/u.png differ diff --git a/index.php b/index.php index 19518a72..0a03051a 100755 --- a/index.php +++ b/index.php @@ -28,6 +28,7 @@ setlocale (LC_TIME, 'fra_FRA', 'french'); /** * Initialisation de Zwii */ + session_start(); // Chargement des classes require 'core/class/autoload.php'; diff --git a/module/blog/blog.php b/module/blog/blog.php index 67f3a7e5..0709be0f 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -339,12 +339,12 @@ class blog extends common { else { // Soumission du formulaire if($this->isPost()) { - // Check la capcha + // Check la captcha if( $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') - AND $this->getInput('blogArticleCapcha', helper::FILTER_INT) !== $this->getInput('blogArticleCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticleCapchaSecondNumber', helper::FILTER_INT)) + AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT)) { - self::$inputNotices['blogArticleCapcha'] = 'Incorrect'; + self::$inputNotices['blogArticlecaptcha'] = 'Incorrect'; } // Crée le commentaire $commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment'])); diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index e3386281..848418f6 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -6,7 +6,10 @@ à getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); ?>
    - getUser('group') >= self::GROUP_ADMIN): ?> + getUser('group') >= self::GROUP_ADMIN + AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + ): ?>
    helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], @@ -74,8 +77,8 @@ ]); ?> getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
    -
    - +
    +
    diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index da093b3f..e964ef93 100755 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -36,7 +36,7 @@
    -
    +
    'Taille optimale de l\'image de couverture : ' . ((int) substr($this->getData(['theme', 'site', 'width']), 0, -2) - (20 * 2)) . ' x 350 pixels.', 'label' => 'Image de couverture', @@ -44,13 +44,13 @@ 'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'picture']) ]); ?>
    -
    +
    'Largeur de l\'image', 'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'pictureSize']) ]); ?>
    -
    +
    'Position', 'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'picturePosition']), diff --git a/module/form/form.php b/module/form/form.php index 2784ebdf..3332afc6 100755 --- a/module/form/form.php +++ b/module/form/form.php @@ -71,23 +71,17 @@ class form extends common { // Soumission du formulaire if($this->isPost()) { // Configuration - // Option sélectionnée sans page choisie - $pageId = ''; - if ($this->getInput('formConfigPageId') !== "") { - // Option désactivée, réinitialiser l'id de la page sélectionnée. - $pageId = $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : ''; - } $this->setData([ 'module', $this->getUrl(0), 'config', [ 'button' => $this->getInput('formConfigButton'), - 'capcha' => $this->getInput('formConfigCapcha', helper::FILTER_BOOLEAN), + 'captcha' => $this->getInput('formConfigcaptcha', helper::FILTER_BOOLEAN), 'group' => $this->getInput('formConfigGroup', helper::FILTER_INT), 'user' => self::$listUsers [$this->getInput('formConfigUser', helper::FILTER_INT)], 'mail' => $this->getInput('formConfigMail') , - 'pageId' => $pageId, + 'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '', 'subject' => $this->getInput('formConfigSubject'), 'replyto' => $this->getInput('formConfigMailReplyTo', helper::FILTER_BOOLEAN) ] @@ -285,12 +279,12 @@ class form extends common { public function index() { // Soumission du formulaire if($this->isPost()) { - // Check la capcha + // Check la captcha if( - $this->getData(['module', $this->getUrl(0), 'config', 'capcha']) - AND $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT)) + $this->getData(['module', $this->getUrl(0), 'config', 'captcha']) + AND $this->getInput('formcaptcha', helper::FILTER_INT) !== $this->getInput('formcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('formcaptchaSecondNumber', helper::FILTER_INT)) { - self::$inputNotices['formCapcha'] = 'Incorrect'; + self::$inputNotices['formcaptcha'] = 'Incorrect'; } // Préparation le contenu du mail diff --git a/module/form/view/config/config.php b/module/form/view/config/config.php index 47ada59d..7eae904c 100755 --- a/module/form/view/config/config.php +++ b/module/form/view/config/config.php @@ -142,8 +142,8 @@ ]); ?>
    - $this->getData(['module', $this->getUrl(0), 'config', 'capcha']) + $this->getData(['module', $this->getUrl(0), 'config', 'captcha']) ]); ?>
    diff --git a/module/form/view/index/index.php b/module/form/view/index/index.php index 4fe54a9a..368d534e 100755 --- a/module/form/view/index/index.php +++ b/module/form/view/index/index.php @@ -35,7 +35,7 @@ ]); ?> + ); ?>

    @@ -43,10 +43,10 @@

    - getData(['module', $this->getUrl(0), 'config', 'capcha'])): ?> + getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
    -
    - +
    +