2018-04-02 08:29:19 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 <remi.jean@outlook.com>
|
|
|
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
|
|
|
* @license GNU General Public License, version 3
|
2020-09-01 20:48:40 +02:00
|
|
|
* @link http://zwiicms.fr/
|
2019-01-22 14:36:13 +01:00
|
|
|
* @copyright : Frédéric Tempez <frederic.tempez@outlook.com>
|
2021-12-18 10:25:33 +01:00
|
|
|
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
2018-04-02 08:29:19 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
class theme extends common {
|
|
|
|
|
|
|
|
public static $actions = [
|
|
|
|
'advanced' => self::GROUP_ADMIN,
|
|
|
|
'body' => self::GROUP_ADMIN,
|
|
|
|
'footer' => self::GROUP_ADMIN,
|
|
|
|
'header' => self::GROUP_ADMIN,
|
|
|
|
'index' => self::GROUP_ADMIN,
|
|
|
|
'menu' => self::GROUP_ADMIN,
|
|
|
|
'reset' => self::GROUP_ADMIN,
|
2018-12-25 16:24:20 +01:00
|
|
|
'site' => self::GROUP_ADMIN,
|
2020-06-02 12:03:45 +02:00
|
|
|
'admin' => self::GROUP_ADMIN,
|
2018-12-25 16:24:20 +01:00
|
|
|
'manage' => self::GROUP_ADMIN,
|
2018-12-25 18:38:17 +01:00
|
|
|
'export' => self::GROUP_ADMIN,
|
2021-10-19 19:14:52 +02:00
|
|
|
'import' => self::GROUP_ADMIN,
|
2022-02-08 13:23:34 +01:00
|
|
|
'save' => self::GROUP_ADMIN,
|
2022-02-08 17:00:08 +01:00
|
|
|
'fonts' => self::GROUP_ADMIN,
|
|
|
|
'fontAdd' => self::GROUP_ADMIN,
|
|
|
|
'fontDelete' => self::GROUP_ADMIN
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $aligns = [
|
|
|
|
'left' => 'À gauche',
|
|
|
|
'center' => 'Au centre',
|
|
|
|
'right' => 'À droite'
|
|
|
|
];
|
|
|
|
public static $attachments = [
|
2019-03-21 19:55:51 +01:00
|
|
|
'scroll' => 'Standard',
|
2018-04-02 08:29:19 +02:00
|
|
|
'fixed' => 'Fixe'
|
|
|
|
];
|
2021-11-15 09:01:08 +01:00
|
|
|
public static $containerWides = [
|
2021-11-12 11:44:40 +01:00
|
|
|
'container' => 'Limitée au site',
|
|
|
|
'none' => 'Etendue sur la page'
|
2021-11-07 15:50:24 +01:00
|
|
|
];
|
2018-09-09 21:28:05 +02:00
|
|
|
public static $footerblocks = [
|
2019-06-19 09:35:19 +02:00
|
|
|
1 => [
|
|
|
|
'hide' => 'Masqué',
|
2020-06-02 12:03:45 +02:00
|
|
|
'center' => 'Affiché' ],
|
2019-06-22 19:44:13 +02:00
|
|
|
2 => [
|
2019-06-19 09:35:19 +02:00
|
|
|
'hide' => 'Masqué',
|
2020-04-17 17:39:16 +02:00
|
|
|
'left' => 'À gauche',
|
|
|
|
'right' => 'À droite' ],
|
2019-06-22 19:44:13 +02:00
|
|
|
3 => [
|
2019-06-19 09:35:19 +02:00
|
|
|
'hide' => 'Masqué',
|
2020-04-17 17:39:16 +02:00
|
|
|
'left' => 'À gauche',
|
2019-06-27 16:21:43 +02:00
|
|
|
'center' => 'Au centre',
|
2020-04-17 17:39:16 +02:00
|
|
|
'right' => 'À droite' ],
|
2019-06-22 19:44:13 +02:00
|
|
|
4 => [
|
|
|
|
'hide' => 'Masqué',
|
2019-06-23 23:37:12 +02:00
|
|
|
'left' => 'En haut',
|
|
|
|
'center' => 'Au milieu',
|
|
|
|
'right' => 'En bas' ]
|
2018-09-09 21:28:05 +02:00
|
|
|
];
|
2019-06-19 09:35:19 +02:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
public static $fontWeights = [
|
2019-03-22 09:53:28 +01:00
|
|
|
'normal' => 'Maigre',
|
2018-04-02 08:29:19 +02:00
|
|
|
'bold' => 'Gras'
|
|
|
|
];
|
|
|
|
public static $footerHeights = [
|
2019-11-12 18:57:41 +01:00
|
|
|
'0px' => 'Nulles (0px)',
|
2019-11-12 18:52:16 +01:00
|
|
|
'5px' => 'Très petites (5px)',
|
|
|
|
'10px' => 'Petites (10px)',
|
|
|
|
'15px' => 'Moyennes (15px)',
|
|
|
|
'20px' => 'Grandes (20px)'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $footerPositions = [
|
2019-05-02 13:21:48 +02:00
|
|
|
'hide' => 'Caché',
|
2018-04-02 08:29:19 +02:00
|
|
|
'site' => 'Dans le site',
|
|
|
|
'body' => 'En dessous du site'
|
|
|
|
];
|
2019-03-19 06:59:28 +01:00
|
|
|
public static $footerFontSizes = [
|
2019-03-20 18:25:17 +01:00
|
|
|
'.8em' => 'Très petite (80%)',
|
|
|
|
'.9em' => 'Petite (90%)',
|
2019-03-21 19:55:51 +01:00
|
|
|
'1em' => 'Standard (100%)',
|
2019-12-06 17:03:23 +01:00
|
|
|
'1.1em' => 'Moyenne (110%)',
|
|
|
|
'1.2em' => 'Grande (120%)',
|
|
|
|
'1.3em' => 'Très grande (130%)'
|
2020-06-02 12:03:45 +02:00
|
|
|
];
|
2018-04-02 08:29:19 +02:00
|
|
|
public static $headerFontSizes = [
|
2019-03-20 18:25:17 +01:00
|
|
|
'1.6em' => 'Très petite (160%)',
|
|
|
|
'1.8em' => 'Petite (180%)',
|
|
|
|
'2em' => 'Moyenne (200%)',
|
|
|
|
'2.2em' => 'Grande (220%)',
|
|
|
|
'2.4vmax' => 'Très grande (240%)'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $headerHeights = [
|
2021-11-15 09:01:08 +01:00
|
|
|
'unset' => 'Libre', // texte dynamique cf header.js.php
|
2019-05-02 13:21:48 +02:00
|
|
|
'100px' => 'Très petite (100px) ',
|
|
|
|
'150px' => 'Petite (150px)',
|
|
|
|
'200px' => 'Moyenne (200px)',
|
|
|
|
'300px' => 'Grande (300px)',
|
2021-11-12 11:44:40 +01:00
|
|
|
'400px' => 'Très grande (400px)',
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $headerPositions = [
|
2019-03-12 09:30:22 +01:00
|
|
|
'body' => 'Au dessus du site',
|
2018-04-02 08:29:19 +02:00
|
|
|
'site' => 'Dans le site',
|
2019-03-12 09:30:22 +01:00
|
|
|
'hide' => 'Cachée'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
2021-11-07 15:50:24 +01:00
|
|
|
public static $headerFeatures = [
|
|
|
|
'wallpaper' => 'Couleur unie ou papier-peint',
|
2021-11-09 18:38:37 +01:00
|
|
|
'feature' => 'Contenu personnalisé'
|
2021-11-07 15:50:24 +01:00
|
|
|
];
|
2018-04-02 08:29:19 +02:00
|
|
|
public static $imagePositions = [
|
|
|
|
'top left' => 'En haut à gauche',
|
|
|
|
'top center' => 'En haut au centre',
|
|
|
|
'top right' => 'En haut à droite',
|
|
|
|
'center left' => 'Au milieu à gauche',
|
|
|
|
'center center' => 'Au milieu au centre',
|
|
|
|
'center right' => 'Au milieu à droite',
|
|
|
|
'bottom left' => 'En bas à gauche',
|
|
|
|
'bottom center' => 'En bas au centre',
|
|
|
|
'bottom right' => 'En bas à droite'
|
|
|
|
];
|
|
|
|
public static $menuFontSizes = [
|
2019-03-20 18:25:17 +01:00
|
|
|
'.8em' => 'Très petite (80%)',
|
|
|
|
'.9em' => 'Petite (90%)',
|
2019-03-21 19:55:51 +01:00
|
|
|
'1em' => 'Standard (100%)',
|
2019-03-20 18:25:17 +01:00
|
|
|
'1.1em' => 'Moyenne (110%)',
|
|
|
|
'1.2em' => 'Grande (120%)',
|
|
|
|
'1.3em' => 'Très grande (130%)'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $menuHeights = [
|
2019-03-24 14:50:28 +01:00
|
|
|
'5px 10px' => 'Très petite',
|
|
|
|
'10px' => 'Petite',
|
|
|
|
'15px 10px' => 'Moyenne',
|
|
|
|
'20px 15px' => 'Grande',
|
|
|
|
'25px 15px' => 'Très grande'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
2019-02-07 17:26:39 +01:00
|
|
|
public static $menuPositionsSite = [
|
2020-06-02 12:03:45 +02:00
|
|
|
'top' => 'En-dehors du site',
|
2019-03-12 09:30:22 +01:00
|
|
|
'site-first' => 'Avant la bannière',
|
|
|
|
'site-second' => 'Après la bannière',
|
2018-08-31 22:35:39 +02:00
|
|
|
'hide' => 'Caché'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
2018-08-31 22:35:39 +02:00
|
|
|
public static $menuPositionsBody = [
|
2019-03-12 09:30:22 +01:00
|
|
|
'top' => 'En-dehors du site',
|
|
|
|
'body-first' => 'Avant la bannière',
|
|
|
|
'body-second' => 'Après la bannière',
|
2019-03-12 09:18:31 +01:00
|
|
|
'site' => 'Dans le site',
|
2018-08-31 22:35:39 +02:00
|
|
|
'hide' => 'Caché'
|
2020-06-02 12:03:45 +02:00
|
|
|
];
|
2019-11-29 16:09:28 +01:00
|
|
|
public static $menuRadius = [
|
|
|
|
'0px' => 'Aucun',
|
|
|
|
'3px 3px 0px 0px' => 'Très léger',
|
|
|
|
'6px 6px 0px 0px' => 'Léger',
|
|
|
|
'9px 9px 0px 0px' => 'Moyen',
|
|
|
|
'12px 12px 0px 0px' => 'Important',
|
|
|
|
'15px 15px 0px 0px' => 'Très important'
|
|
|
|
];
|
2018-04-02 08:29:19 +02:00
|
|
|
public static $radius = [
|
2019-06-01 13:07:38 +02:00
|
|
|
'0px' => 'Aucun',
|
2018-04-02 08:29:19 +02:00
|
|
|
'5px' => 'Très léger',
|
|
|
|
'10px' => 'Léger',
|
|
|
|
'15px' => 'Moyen',
|
|
|
|
'25px' => 'Important',
|
|
|
|
'50px' => 'Très important'
|
|
|
|
];
|
|
|
|
public static $repeats = [
|
|
|
|
'no-repeat' => 'Ne pas répéter',
|
|
|
|
'repeat-x' => 'Sur l\'axe horizontal',
|
|
|
|
'repeat-y' => 'Sur l\'axe vertical',
|
|
|
|
'repeat' => 'Sur les deux axes'
|
|
|
|
];
|
|
|
|
public static $shadows = [
|
2019-06-01 13:07:38 +02:00
|
|
|
'0px' => 'Aucune',
|
2018-04-02 08:29:19 +02:00
|
|
|
'1px 1px 5px' => 'Très légère',
|
|
|
|
'1px 1px 10px' => 'Légère',
|
|
|
|
'1px 1px 15px' => 'Moyenne',
|
|
|
|
'1px 1px 25px' => 'Importante',
|
|
|
|
'1px 1px 50px' => 'Très importante'
|
|
|
|
];
|
|
|
|
public static $siteFontSizes = [
|
2019-03-20 18:25:17 +01:00
|
|
|
'12px' => '12 pixels',
|
|
|
|
'13px' => '13 pixels',
|
|
|
|
'14px' => '14 pixels',
|
|
|
|
'15px' => '15 pixels',
|
|
|
|
'16px' => '16 pixels'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
2020-01-31 11:24:00 +01:00
|
|
|
public static $bodySizes = [
|
2020-06-02 12:03:45 +02:00
|
|
|
'auto' => 'Automatique',
|
2020-01-31 11:24:00 +01:00
|
|
|
'100% 100%' => 'Image étirée (100% 100%)',
|
|
|
|
'cover' => 'Responsive (cover)',
|
|
|
|
'contain' => 'Responsive (contain)'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $textTransforms = [
|
2019-03-20 20:05:03 +01:00
|
|
|
'none' => 'Standard',
|
|
|
|
'lowercase' => 'Minuscules',
|
|
|
|
'uppercase' => 'Majuscules',
|
2020-06-02 12:03:45 +02:00
|
|
|
'capitalize' => 'Majuscule à chaque mot'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
2021-11-15 08:12:43 +01:00
|
|
|
public static $siteWidths = [
|
2018-04-02 08:29:19 +02:00
|
|
|
'750px' => 'Petite (750 pixels)',
|
|
|
|
'960px' => 'Moyenne (960 pixels)',
|
|
|
|
'1170px' => 'Grande (1170 pixels)',
|
|
|
|
'100%' => 'Fluide (100%)'
|
|
|
|
];
|
2020-06-02 12:03:45 +02:00
|
|
|
public static $headerWide = [
|
|
|
|
'auto auto' => 'Automatique',
|
2019-11-10 20:12:41 +01:00
|
|
|
'100% 100%' => 'Image étirée (100% 100%)',
|
2019-11-11 19:12:19 +01:00
|
|
|
'cover' => 'Responsive (cover)',
|
2019-11-10 20:12:41 +01:00
|
|
|
'contain' => 'Responsive (contain)'
|
2019-01-02 23:55:43 +01:00
|
|
|
];
|
2020-06-02 12:03:45 +02:00
|
|
|
public static $footerTemplate = [
|
2019-06-26 15:36:06 +02:00
|
|
|
'1' => 'Une seule colonne',
|
|
|
|
'2' => 'Deux colonnes : 1/2 - 1/2',
|
|
|
|
'3' => 'Trois colonnes : 1/3 - 1/3 - 1/3',
|
|
|
|
'4' => 'Trois lignes superposées'
|
2019-06-18 20:08:04 +02:00
|
|
|
];
|
2021-10-25 09:11:58 +02:00
|
|
|
public static $burgerContent = [
|
2021-10-25 12:52:12 +02:00
|
|
|
'none' => 'Aucun',
|
|
|
|
'title' => 'Titre du site',
|
|
|
|
'logo' => 'Logo du site'
|
2021-10-25 09:11:58 +02:00
|
|
|
];
|
2019-01-02 23:55:43 +01:00
|
|
|
|
2021-10-06 18:00:59 +02:00
|
|
|
// Variable pour construire la liste des pages du site
|
2021-10-06 18:18:41 +02:00
|
|
|
public static $pagesList = [];
|
2022-02-08 13:23:34 +01:00
|
|
|
// Variable pour construire la liste des fontes installées
|
|
|
|
public static $fontsList = [];
|
2021-10-03 17:26:05 +02:00
|
|
|
|
2020-05-16 22:15:16 +02:00
|
|
|
/**
|
|
|
|
* Thème des écrans d'administration
|
|
|
|
*/
|
|
|
|
public function admin() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['admin', [
|
2020-05-17 07:41:44 +02:00
|
|
|
'backgroundColor' => $this->getInput('adminBackgroundColor'),
|
|
|
|
'colorTitle' => $this->getInput('adminColorTitle'),
|
|
|
|
'colorText' => $this->getInput('adminColorText'),
|
|
|
|
'colorButtonText' => $this->getInput('adminColorButtonText'),
|
|
|
|
'backgroundColorButton' => $this->getInput('adminColorButton'),
|
|
|
|
'backgroundColorButtonGrey' => $this->getInput('adminColorGrey'),
|
|
|
|
'backgroundColorButtonRed' => $this->getInput('adminColorRed'),
|
|
|
|
'backgroundColorButtonGreen'=> $this->getInput('adminColorGreen'),
|
2021-05-09 10:41:19 +02:00
|
|
|
'backgroundColorButtonHelp'=> $this->getInput('adminColorHelp'),
|
2020-05-17 07:41:44 +02:00
|
|
|
'fontText' => $this->getInput('adminFontText'),
|
|
|
|
'fontSize' => $this->getInput('adminFontTextSize'),
|
|
|
|
'fontTitle' => $this->getInput('adminFontTitle'),
|
|
|
|
'backgroundBlockColor' => $this->getInput('adminBackGroundBlockColor'),
|
|
|
|
'borderBlockColor' => $this->getInput('adminBorderBlockColor'),
|
2020-05-16 22:15:16 +02:00
|
|
|
]]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/admin',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Administration',
|
|
|
|
'view' => 'admin',
|
|
|
|
'vendor' => [
|
|
|
|
'tinycolorpicker'
|
|
|
|
],
|
2020-06-02 12:03:45 +02:00
|
|
|
]);
|
2020-05-16 22:15:16 +02:00
|
|
|
}
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Mode avancé
|
|
|
|
*/
|
|
|
|
public function advanced() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
// Enregistre le CSS
|
2019-05-27 20:35:04 +02:00
|
|
|
file_put_contents(self::DATA_DIR.'custom.css', $this->getInput('themeAdvancedCss', null));
|
2018-04-02 08:29:19 +02:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/advanced',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
2019-01-22 14:36:13 +01:00
|
|
|
'title' => 'Éditeur CSS',
|
2018-04-02 08:29:19 +02:00
|
|
|
'vendor' => [
|
|
|
|
'codemirror'
|
|
|
|
],
|
|
|
|
'view' => 'advanced'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options de l'arrière plan
|
|
|
|
*/
|
|
|
|
public function body() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['theme', 'body', [
|
|
|
|
'backgroundColor' => $this->getInput('themeBodyBackgroundColor'),
|
|
|
|
'image' => $this->getInput('themeBodyImage'),
|
|
|
|
'imageAttachment' => $this->getInput('themeBodyImageAttachment'),
|
|
|
|
'imagePosition' => $this->getInput('themeBodyImagePosition'),
|
|
|
|
'imageRepeat' => $this->getInput('themeBodyImageRepeat'),
|
2020-02-13 10:48:56 +01:00
|
|
|
'imageSize' => $this->getInput('themeBodyImageSize'),
|
|
|
|
'toTopbackgroundColor' => $this->getInput('themeBodyToTopBackground'),
|
|
|
|
'toTopColor' => $this->getInput('themeBodyToTopColor')
|
2018-04-02 08:29:19 +02:00
|
|
|
]]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation de l\'arrière plan',
|
|
|
|
'vendor' => [
|
|
|
|
'tinycolorpicker'
|
|
|
|
],
|
|
|
|
'view' => 'body'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options du pied de page
|
|
|
|
*/
|
|
|
|
public function footer() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
2020-06-02 12:03:45 +02:00
|
|
|
if ( $this->getInput('themeFooterCopyrightPosition') === 'hide' &&
|
2019-06-22 08:23:09 +02:00
|
|
|
$this->getInput('themeFooterSocialsPosition') === 'hide' &&
|
|
|
|
$this->getInput('themeFooterTextPosition') === 'hide' ) {
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
2019-06-27 11:35:33 +02:00
|
|
|
'notification' => 'Sélectionnez au moins un contenu à afficher',
|
2019-06-22 08:23:09 +02:00
|
|
|
'redirect' => helper::baseUrl() . 'theme/footer',
|
|
|
|
'state' => false
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$this->setData(['theme', 'footer', [
|
|
|
|
'backgroundColor' => $this->getInput('themeFooterBackgroundColor'),
|
|
|
|
'copyrightAlign' => $this->getInput('themeFooterCopyrightAlign'),
|
|
|
|
'height' => $this->getInput('themeFooterHeight'),
|
|
|
|
'loginLink' => $this->getInput('themeFooterLoginLink'),
|
|
|
|
'margin' => $this->getInput('themeFooterMargin', helper::FILTER_BOOLEAN),
|
|
|
|
'position' => $this->getInput('themeFooterPosition'),
|
2020-02-02 19:14:57 +01:00
|
|
|
'fixed' => $this->getInput('themeFooterFixed', helper::FILTER_BOOLEAN),
|
2019-06-22 08:23:09 +02:00
|
|
|
'socialsAlign' => $this->getInput('themeFooterSocialsAlign'),
|
|
|
|
'text' => $this->getInput('themeFooterText', null),
|
|
|
|
'textAlign' => $this->getInput('themeFooterTextAlign'),
|
|
|
|
'textColor' => $this->getInput('themeFooterTextColor'),
|
|
|
|
'copyrightPosition' => $this->getInput('themeFooterCopyrightPosition'),
|
|
|
|
'textPosition' => $this->getInput('themeFooterTextPosition'),
|
|
|
|
'socialsPosition' => $this->getInput('themeFooterSocialsPosition'),
|
2020-06-02 12:03:45 +02:00
|
|
|
'textTransform' => $this->getInput('themeFooterTextTransform'),
|
2019-06-22 08:23:09 +02:00
|
|
|
'font' => $this->getInput('themeFooterFont'),
|
|
|
|
'fontSize' => $this->getInput('themeFooterFontSize'),
|
|
|
|
'fontWeight' => $this->getInput('themeFooterFontWeight'),
|
|
|
|
'displayVersion' => $this->getInput('themefooterDisplayVersion', helper::FILTER_BOOLEAN),
|
|
|
|
'displaySiteMap' => $this->getInput('themefooterDisplaySiteMap', helper::FILTER_BOOLEAN),
|
|
|
|
'displayCopyright' => $this->getInput('themefooterDisplayCopyright', helper::FILTER_BOOLEAN),
|
2021-11-27 16:20:25 +01:00
|
|
|
'displayCookie' => $this->getInput('themefooterDisplayCookie', helper::FILTER_BOOLEAN),
|
2019-06-24 21:52:24 +02:00
|
|
|
'displayLegal' => $this->getInput('themeFooterDisplayLegal', helper::FILTER_BOOLEAN),
|
2020-06-18 13:21:47 +02:00
|
|
|
'displaySearch' => $this->getInput('themeFooterDisplaySearch', helper::FILTER_BOOLEAN),
|
|
|
|
'displayMemberBar'=> $this->getInput('themeFooterDisplayMemberBar', helper::FILTER_BOOLEAN),
|
2019-06-24 21:52:24 +02:00
|
|
|
'template' => $this->getInput('themeFooterTemplate')
|
2019-06-22 08:23:09 +02:00
|
|
|
]]);
|
2021-10-02 14:15:27 +02:00
|
|
|
|
|
|
|
// Sauvegarder la configuration localisée
|
|
|
|
$this->setData(['locale','legalPageId', $this->getInput('configLegalPageId')]);
|
|
|
|
$this->setData(['locale','searchPageId', $this->getInput('configSearchPageId')]);
|
|
|
|
|
2019-06-22 08:23:09 +02:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
2018-04-02 08:29:19 +02:00
|
|
|
}
|
2021-10-06 18:00:59 +02:00
|
|
|
|
|
|
|
// Liste des pages
|
2021-10-06 18:18:41 +02:00
|
|
|
self::$pagesList = $this->getData(['page']);
|
|
|
|
foreach(self::$pagesList as $page => $pageId) {
|
2021-10-06 18:00:59 +02:00
|
|
|
if ($this->getData(['page',$page,'block']) === 'bar' ||
|
|
|
|
$this->getData(['page',$page,'disable']) === true) {
|
2021-10-06 18:18:41 +02:00
|
|
|
unset(self::$pagesList[$page]);
|
2021-10-06 18:00:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation du pied de page',
|
|
|
|
'vendor' => [
|
2019-06-18 20:08:04 +02:00
|
|
|
'tinycolorpicker',
|
|
|
|
'tinymce'
|
2018-04-02 08:29:19 +02:00
|
|
|
],
|
|
|
|
'view' => 'footer'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options de la bannière
|
|
|
|
*/
|
|
|
|
public function header() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
2021-12-13 17:07:32 +01:00
|
|
|
// Modification des URL des images dans la bannière perso
|
|
|
|
$featureContent = $this->getInput('themeHeaderText', null);
|
|
|
|
$featureContent = str_replace(helper::baseUrl(false,false), './', $featureContent);
|
2021-12-14 18:26:28 +01:00
|
|
|
|
2022-02-08 13:23:34 +01:00
|
|
|
/**
|
2021-12-15 19:03:52 +01:00
|
|
|
* Stocker les images incluses dans la bannière perso dans un tableau
|
|
|
|
*/
|
2022-02-08 13:23:34 +01:00
|
|
|
preg_match_all('/<img[^>]+>/i',$featureContent, $results);
|
|
|
|
foreach($results[0] as $value) {
|
2021-12-15 19:03:52 +01:00
|
|
|
// Lire le contenu XML
|
|
|
|
$sx = simplexml_load_string($value);
|
2022-02-08 13:23:34 +01:00
|
|
|
// Élément à remplacer
|
2021-12-15 19:03:52 +01:00
|
|
|
$files [] = str_replace('./site/file/source/','',(string) $sx[0]['src']);
|
|
|
|
}
|
2021-12-14 18:26:28 +01:00
|
|
|
|
|
|
|
// Sauvegarder
|
2018-04-02 08:29:19 +02:00
|
|
|
$this->setData(['theme', 'header', [
|
2019-03-04 23:02:24 +01:00
|
|
|
'backgroundColor' => $this->getInput('themeHeaderBackgroundColor'),
|
2018-04-02 08:29:19 +02:00
|
|
|
'font' => $this->getInput('themeHeaderFont'),
|
|
|
|
'fontSize' => $this->getInput('themeHeaderFontSize'),
|
|
|
|
'fontWeight' => $this->getInput('themeHeaderFontWeight'),
|
|
|
|
'height' => $this->getInput('themeHeaderHeight'),
|
2021-11-15 09:01:08 +01:00
|
|
|
'wide' => $this->getInput('themeHeaderWide'),
|
2018-04-02 08:29:19 +02:00
|
|
|
'image' => $this->getInput('themeHeaderImage'),
|
|
|
|
'imagePosition' => $this->getInput('themeHeaderImagePosition'),
|
|
|
|
'imageRepeat' => $this->getInput('themeHeaderImageRepeat'),
|
|
|
|
'margin' => $this->getInput('themeHeaderMargin', helper::FILTER_BOOLEAN),
|
|
|
|
'position' => $this->getInput('themeHeaderPosition'),
|
|
|
|
'textAlign' => $this->getInput('themeHeaderTextAlign'),
|
|
|
|
'textColor' => $this->getInput('themeHeaderTextColor'),
|
2020-06-02 12:03:45 +02:00
|
|
|
'textHide' => $this->getInput('themeHeaderTextHide', helper::FILTER_BOOLEAN),
|
2020-11-03 12:02:59 +01:00
|
|
|
'textTransform' => $this->getInput('themeHeaderTextTransform'),
|
2019-11-09 19:03:03 +01:00
|
|
|
'linkHomePage' => $this->getInput('themeHeaderlinkHomePage',helper::FILTER_BOOLEAN),
|
2021-10-24 09:57:25 +02:00
|
|
|
'imageContainer' => $this->getInput('themeHeaderImageContainer'),
|
2021-11-07 15:50:24 +01:00
|
|
|
'tinyHidden' => $this->getInput('themeHeaderTinyHidden', helper::FILTER_BOOLEAN),
|
|
|
|
'feature' => $this->getInput('themeHeaderFeature'),
|
2021-12-15 19:03:52 +01:00
|
|
|
'featureContent' => $featureContent,
|
|
|
|
'featureFiles' => $files
|
2018-04-02 08:29:19 +02:00
|
|
|
]]);
|
2019-01-22 13:46:35 +01:00
|
|
|
// Modification de la position du menu selon la position de la bannière
|
2021-10-09 21:16:53 +02:00
|
|
|
if ( $this->getData(['theme','header','position']) == 'site' )
|
2021-03-22 11:30:34 +01:00
|
|
|
{
|
2021-10-09 21:16:53 +02:00
|
|
|
$this->setData(['theme', 'menu', 'position',str_replace ('body-','site-',$this->getData(['theme','menu','position']))]);
|
|
|
|
}
|
|
|
|
if ( $this->getData(['theme','header','position']) == 'body')
|
|
|
|
{
|
|
|
|
$this->setData(['theme', 'menu', 'position',str_replace ('site-','body-',$this->getData(['theme','menu','position']))]);
|
|
|
|
}
|
2021-10-10 14:41:13 +02:00
|
|
|
// Menu accroché à la bannière qui devient cachée
|
2021-10-09 21:16:53 +02:00
|
|
|
if ( $this->getData(['theme','header','position']) == 'hide' &&
|
2021-10-10 14:41:13 +02:00
|
|
|
in_array( $this->getData(['theme','menu','position']) , ['body-first', 'site-first', 'body-first' , 'site-second'])
|
|
|
|
) {
|
2021-10-09 21:16:53 +02:00
|
|
|
$this->setData(['theme', 'menu', 'position','site']);
|
2019-01-22 13:46:35 +01:00
|
|
|
}
|
2018-04-02 08:29:19 +02:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation de la bannière',
|
|
|
|
'vendor' => [
|
2021-11-07 15:50:24 +01:00
|
|
|
'tinycolorpicker',
|
|
|
|
'tinymce'
|
2018-04-02 08:29:19 +02:00
|
|
|
],
|
|
|
|
'view' => 'header'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accueil de la personnalisation
|
|
|
|
*/
|
|
|
|
public function index() {
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
2020-06-02 12:03:45 +02:00
|
|
|
'title' => 'Personnalisation des thèmes',
|
2018-04-02 08:29:19 +02:00
|
|
|
'view' => 'index'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options du menu
|
|
|
|
*/
|
|
|
|
public function menu() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['theme', 'menu', [
|
|
|
|
'backgroundColor' => $this->getInput('themeMenuBackgroundColor'),
|
2020-11-01 20:19:02 +01:00
|
|
|
'backgroundColorSub' => $this->getInput('themeMenuBackgroundColorSub'),
|
2020-06-02 12:03:45 +02:00
|
|
|
'font' => $this->getInput('themeMenuFont'),
|
2018-04-02 08:29:19 +02:00
|
|
|
'fontSize' => $this->getInput('themeMenuFontSize'),
|
|
|
|
'fontWeight' => $this->getInput('themeMenuFontWeight'),
|
|
|
|
'height' => $this->getInput('themeMenuHeight'),
|
2021-11-15 09:01:08 +01:00
|
|
|
'wide' => $this->getInput('themeMenuWide'),
|
2019-02-22 22:53:51 +01:00
|
|
|
'loginLink' => $this->getInput('themeMenuLoginLink', helper::FILTER_BOOLEAN),
|
2018-04-02 08:29:19 +02:00
|
|
|
'margin' => $this->getInput('themeMenuMargin', helper::FILTER_BOOLEAN),
|
|
|
|
'position' => $this->getInput('themeMenuPosition'),
|
|
|
|
'textAlign' => $this->getInput('themeMenuTextAlign'),
|
|
|
|
'textColor' => $this->getInput('themeMenuTextColor'),
|
2018-04-07 23:31:15 +02:00
|
|
|
'textTransform' => $this->getInput('themeMenuTextTransform'),
|
2019-11-29 15:31:37 +01:00
|
|
|
'fixed' => $this->getInput('themeMenuFixed', helper::FILTER_BOOLEAN),
|
|
|
|
'activeColorAuto' => $this->getInput('themeMenuActiveColorAuto', helper::FILTER_BOOLEAN),
|
2019-11-29 16:09:28 +01:00
|
|
|
'activeColor' => $this->getInput('themeMenuActiveColor'),
|
2020-05-15 18:31:01 +02:00
|
|
|
'activeTextColor' => $this->getInput('themeMenuActiveTextColor'),
|
2019-12-10 17:36:13 +01:00
|
|
|
'radius' => $this->getInput('themeMenuRadius'),
|
2020-06-18 13:21:47 +02:00
|
|
|
'burgerTitle' => $this->getInput('themeMenuBurgerTitle', helper::FILTER_BOOLEAN),
|
2021-10-25 09:11:58 +02:00
|
|
|
'memberBar' => $this->getInput('themeMenuMemberBar', helper::FILTER_BOOLEAN),
|
2021-10-25 12:52:12 +02:00
|
|
|
'burgerLogo' => $this->getInput('themeMenuBurgerLogo'),
|
2021-10-25 09:11:58 +02:00
|
|
|
'burgerContent' => $this->getInput('themeMenuBurgerContent')
|
2018-04-02 08:29:19 +02:00
|
|
|
]]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation du menu',
|
|
|
|
'vendor' => [
|
|
|
|
'tinycolorpicker'
|
|
|
|
],
|
|
|
|
'view' => 'menu'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2022-02-08 13:23:34 +01:00
|
|
|
/**
|
|
|
|
* Options des fontes
|
|
|
|
*/
|
|
|
|
public function fonts() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
}
|
2022-02-08 17:00:08 +01:00
|
|
|
//Polices trouvées dans la configuration
|
|
|
|
$fonts = $this->getData(['fonts']);
|
2022-02-08 13:23:34 +01:00
|
|
|
// Parcourir les fontes installées et construire le tableau pour le formulaire
|
|
|
|
foreach (self::$fonts as $fontId => $fontName) {
|
2022-02-08 17:00:08 +01:00
|
|
|
self::$fontsList [] = [
|
2022-02-08 13:23:34 +01:00
|
|
|
$fontName,
|
2022-02-08 17:00:08 +01:00
|
|
|
$fontId,
|
|
|
|
array_key_exists($fontId, $fonts['imported']) ? 'Importée' : '',
|
|
|
|
array_key_exists($fontId, $fonts['files']) ? $fonts['files'][$fontId] : 'CDN Fonts',
|
|
|
|
array_key_exists($fontId, $fonts['imported']) || array_key_exists($fontId, $fonts['files'])
|
|
|
|
? template::button('themeFontDelete' . $fontId, [
|
|
|
|
'class' => 'themeFontDelete buttonRed',
|
2022-02-08 19:34:37 +01:00
|
|
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/fontDelete/' . $fontId . '/' . $_SESSION['csrf'],
|
2022-02-08 17:00:08 +01:00
|
|
|
'value' => template::ico('cancel')
|
|
|
|
])
|
|
|
|
: ''
|
2022-02-08 13:23:34 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Gestion des fontes',
|
|
|
|
'view' => 'fonts'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2022-02-08 17:00:08 +01:00
|
|
|
/**
|
|
|
|
* Ajouter une fonte
|
|
|
|
*/
|
|
|
|
public function fontAdd() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if ($this->isPost()) {
|
|
|
|
$fontId = $this->getInput('fontAddFontId', null, true);
|
|
|
|
$fontName = $this->getInput('fontAddFontName', null, true);
|
|
|
|
$file = $this->getInput('fontAddFile', null, true);
|
2022-02-08 19:34:37 +01:00
|
|
|
$e = explode ('/', $file);
|
|
|
|
$file = $e[count($e) - 1 ];
|
2022-02-08 17:00:08 +01:00
|
|
|
|
|
|
|
// Charger les données des fontes
|
|
|
|
$files = $this->getData(['fonts', 'files']);
|
|
|
|
$imported = $this->getData(['fonts', 'imported']);
|
|
|
|
// Concaténation dans les tableaux existants
|
|
|
|
$imported = array_merge([$fontId => $fontName], $imported);
|
|
|
|
$files = array_merge([$fontId => $file], $files);
|
|
|
|
// Mettre à jour le fichier des fontes
|
|
|
|
$this->setData(['fonts', 'imported', $imported ]);
|
|
|
|
$this->setData(['fonts', 'files', $files ]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Fonte importée',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/fonts',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Ajouter une fonte',
|
|
|
|
'view' => 'fontAdd'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Effacer une fonte
|
|
|
|
*/
|
|
|
|
public function fontDelete() {
|
|
|
|
// Jeton incorrect
|
|
|
|
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/fonts',
|
|
|
|
'notification' => 'Action non autorisée'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Suppression
|
|
|
|
else {
|
|
|
|
|
|
|
|
// Charger les données des fontes
|
|
|
|
$files = $this->getData(['fonts', 'files']);
|
|
|
|
$imported = $this->getData(['fonts', 'imported']);
|
|
|
|
|
|
|
|
// Effacer le fichier existant
|
|
|
|
if ( file_exists(self::DATA_DIR . $files[$this->getUrl(2)]) ) {
|
|
|
|
unlink(self::DATA_DIR . $files[$this->getUrl(2)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Supprimer les entrées
|
|
|
|
unset($file[$this->getUrl(2)]);
|
|
|
|
unset($imported[$this->getUrl(2)]);
|
|
|
|
|
|
|
|
// Mettre à jour le fichier des fontes
|
|
|
|
$this->setData(['fonts', 'files', $files ]);
|
|
|
|
$this->setData(['fonts', 'imported', $imported ]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/fonts',
|
|
|
|
'notification' => 'Fonte supprimée',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Réinitialisation de la personnalisation avancée
|
|
|
|
*/
|
|
|
|
public function reset() {
|
2021-02-06 20:01:10 +01:00
|
|
|
// $url prend l'adresse sans le token
|
|
|
|
$url = explode('&',$this->getUrl(2));
|
2018-04-02 08:29:19 +02:00
|
|
|
|
2021-02-06 20:01:10 +01:00
|
|
|
if ( isset($_GET['csrf'])
|
|
|
|
AND $_GET['csrf'] === $_SESSION['csrf']
|
|
|
|
) {
|
|
|
|
// Réinitialisation
|
|
|
|
$redirect ='';
|
|
|
|
switch ($url[0]) {
|
|
|
|
case 'admin':
|
|
|
|
$this->initData('admin');
|
|
|
|
$redirect = helper::baseUrl() . 'theme/admin';
|
|
|
|
break;
|
|
|
|
case 'manage':
|
|
|
|
$this->initData('theme');
|
|
|
|
$redirect = helper::baseUrl() . 'theme/manage';
|
|
|
|
break;
|
|
|
|
case 'custom':
|
|
|
|
unlink(self::DATA_DIR.'custom.css');
|
|
|
|
$redirect = helper::baseUrl() . 'theme/advanced';
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
$redirect = helper::baseUrl() . 'theme';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Réinitialisation effectuée',
|
|
|
|
'redirect' => $redirect,
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Jeton incorrect'
|
|
|
|
]);
|
|
|
|
}
|
2020-05-16 22:15:16 +02:00
|
|
|
}
|
|
|
|
|
2020-11-07 17:48:10 +01:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Options du site
|
|
|
|
*/
|
|
|
|
public function site() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['theme', 'title', [
|
|
|
|
'font' => $this->getInput('themeTitleFont'),
|
|
|
|
'textColor' => $this->getInput('themeTitleTextColor'),
|
|
|
|
'fontWeight' => $this->getInput('themeTitleFontWeight'),
|
|
|
|
'textTransform' => $this->getInput('themeTitleTextTransform')
|
|
|
|
]]);
|
|
|
|
$this->setData(['theme', 'text', [
|
|
|
|
'font' => $this->getInput('themeTextFont'),
|
|
|
|
'fontSize' => $this->getInput('themeTextFontSize'),
|
|
|
|
'textColor' => $this->getInput('themeTextTextColor'),
|
2020-05-18 10:50:43 +02:00
|
|
|
'linkColor'=> $this->getInput('themeTextLinkColor')
|
2018-04-02 08:29:19 +02:00
|
|
|
]]);
|
|
|
|
$this->setData(['theme', 'site', [
|
|
|
|
'backgroundColor' => $this->getInput('themeSiteBackgroundColor'),
|
|
|
|
'radius' => $this->getInput('themeSiteRadius'),
|
|
|
|
'shadow' => $this->getInput('themeSiteShadow'),
|
2020-05-08 21:14:29 +02:00
|
|
|
'width' => $this->getInput('themeSiteWidth'),
|
2020-05-18 10:50:43 +02:00
|
|
|
'margin' => $this->getInput('themeSiteMargin',helper::FILTER_BOOLEAN)
|
2019-01-03 15:07:11 +01:00
|
|
|
]]);
|
2020-06-02 12:03:45 +02:00
|
|
|
$this->setData(['theme', 'button', [
|
2020-05-18 10:50:43 +02:00
|
|
|
'backgroundColor' => $this->getInput('themeButtonBackgroundColor')
|
|
|
|
]]);
|
2020-06-02 12:03:45 +02:00
|
|
|
$this->setData(['theme', 'block', [
|
2020-05-18 10:50:43 +02:00
|
|
|
'backgroundColor' => $this->getInput('themeBlockBackgroundColor'),
|
|
|
|
'borderColor' => $this->getInput('themeBlockBorderColor')
|
|
|
|
]]);
|
2018-04-02 08:29:19 +02:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation du site',
|
|
|
|
'vendor' => [
|
2019-01-02 23:55:43 +01:00
|
|
|
'tinycolorpicker',
|
|
|
|
'tinymce'
|
2018-04-02 08:29:19 +02:00
|
|
|
],
|
|
|
|
'view' => 'site'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2018-12-25 16:24:20 +01:00
|
|
|
/**
|
|
|
|
* Import du thème
|
|
|
|
*/
|
|
|
|
public function manage() {
|
2018-12-27 20:06:03 +01:00
|
|
|
if($this->isPost() ) {
|
2021-10-19 19:14:52 +02:00
|
|
|
|
2018-12-28 17:13:26 +01:00
|
|
|
$zipFilename = $this->getInput('themeManageImport', helper::FILTER_STRING_SHORT, true);
|
2021-10-19 19:14:52 +02:00
|
|
|
$data = $this->import(self::FILE_DIR.'source/' . $zipFilename);
|
2021-11-22 08:43:52 +01:00
|
|
|
if ($data['success']) {
|
|
|
|
header("Refresh:0");
|
2021-11-22 09:48:54 +01:00
|
|
|
} else {
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => $data['notification'],
|
|
|
|
'state' => $data['success'],
|
|
|
|
'title' => 'Gestion des thèmes',
|
|
|
|
'view' => 'manage'
|
|
|
|
]);;
|
2021-11-22 08:43:52 +01:00
|
|
|
}
|
2021-10-19 19:14:52 +02:00
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Gestion des thèmes',
|
|
|
|
'view' => 'manage'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Importe un thème
|
|
|
|
* @param string Url du thème à télécharger
|
|
|
|
* @param @return array contenant $success = true ou false ; $ notification string message à afficher
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function import($zipName = '') {
|
|
|
|
|
|
|
|
if ($zipName !== '' &&
|
|
|
|
file_exists($zipName)) {
|
|
|
|
// Init variables de retour
|
|
|
|
$success = false;
|
|
|
|
$notification = '';
|
|
|
|
// Dossier temporaire
|
2020-09-26 18:27:46 +02:00
|
|
|
$tempFolder = uniqid();
|
2021-10-19 19:14:52 +02:00
|
|
|
// Ouvrir le zip
|
2018-12-28 17:13:26 +01:00
|
|
|
$zip = new ZipArchive();
|
2021-10-19 19:14:52 +02:00
|
|
|
if ($zip->open($zipName) === TRUE) {
|
2021-09-29 14:50:25 +02:00
|
|
|
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
2020-09-26 18:27:46 +02:00
|
|
|
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
2020-11-03 15:34:57 +01:00
|
|
|
$modele = '';
|
2020-09-26 18:27:46 +02:00
|
|
|
// Archive de thème ?
|
2020-11-03 15:34:57 +01:00
|
|
|
if (
|
2021-10-19 19:14:52 +02:00
|
|
|
file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css')
|
|
|
|
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.css')
|
|
|
|
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.json')
|
2020-11-03 15:34:57 +01:00
|
|
|
) {
|
|
|
|
$modele = 'theme';
|
|
|
|
}
|
|
|
|
if(
|
|
|
|
file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.json')
|
|
|
|
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.css')
|
|
|
|
) {
|
2020-11-05 07:34:12 +01:00
|
|
|
$modele = 'admin';
|
2020-11-03 15:34:57 +01:00
|
|
|
}
|
2020-11-07 17:48:10 +01:00
|
|
|
if (!empty($modele)
|
2020-10-25 22:49:28 +01:00
|
|
|
) {
|
2020-09-26 18:27:46 +02:00
|
|
|
// traiter l'archive
|
|
|
|
$success = $zip->extractTo('.');
|
|
|
|
// traitement de l'erreur
|
2020-11-03 15:34:57 +01:00
|
|
|
$notification = $success ? 'Le thème a été importé' : 'Erreur lors de l\'extraction, vérifiez les permissions.';
|
2021-10-22 18:27:16 +02:00
|
|
|
|
2021-11-22 08:43:52 +01:00
|
|
|
|
2020-09-26 18:27:46 +02:00
|
|
|
} else {
|
|
|
|
// pas une archive de thème
|
|
|
|
$success = false;
|
|
|
|
$notification = 'Ce n\'est pas l\'archive d\'un thème !';
|
|
|
|
}
|
2020-11-05 07:34:12 +01:00
|
|
|
// Supprimer le dossier temporaire même si le thème est invalide
|
|
|
|
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
2018-12-28 17:13:26 +01:00
|
|
|
$zip->close();
|
2018-12-29 17:49:48 +01:00
|
|
|
} else {
|
2020-09-26 18:27:46 +02:00
|
|
|
// erreur à l'ouverture
|
|
|
|
$success = false;
|
|
|
|
$notification = 'Impossible d\'ouvrir l\'archive';
|
2018-12-29 17:49:48 +01:00
|
|
|
}
|
2021-10-19 19:14:52 +02:00
|
|
|
return (['success' => $success, 'notification' => $notification]);
|
2018-12-27 20:06:03 +01:00
|
|
|
}
|
2021-10-19 19:14:52 +02:00
|
|
|
|
|
|
|
return (['success' => false, 'notification' => 'Archive non spécifiée ou introuvable']);
|
2018-12-25 18:38:17 +01:00
|
|
|
}
|
2020-06-02 12:03:45 +02:00
|
|
|
|
2018-12-25 16:24:20 +01:00
|
|
|
|
2020-09-26 18:27:46 +02:00
|
|
|
|
2018-12-25 16:24:20 +01:00
|
|
|
/**
|
|
|
|
* Export du thème
|
|
|
|
*/
|
2018-12-25 18:38:17 +01:00
|
|
|
public function export() {
|
2019-01-17 17:48:58 +01:00
|
|
|
// Make zip
|
2021-02-18 18:34:53 +01:00
|
|
|
$zipFilename = $this->zipTheme($this->getUrl(2));
|
2018-12-28 16:52:58 +01:00
|
|
|
// Téléchargement du ZIP
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
header('Content-Type: application/octet-stream');
|
|
|
|
header('Content-Transfer-Encoding: binary');
|
|
|
|
header('Content-Disposition: attachment; filename="' . $zipFilename . '"');
|
2019-05-27 20:35:04 +02:00
|
|
|
header('Content-Length: ' . filesize(self::TEMP_DIR . $zipFilename));
|
|
|
|
readfile(self::TEMP_DIR . $zipFilename);
|
2018-12-28 16:52:58 +01:00
|
|
|
// Nettoyage du dossier
|
2019-05-27 20:35:04 +02:00
|
|
|
unlink (self::TEMP_DIR . $zipFilename);
|
2020-09-26 18:27:46 +02:00
|
|
|
exit();
|
2018-12-28 16:52:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Export du thème
|
|
|
|
*/
|
|
|
|
public function save() {
|
2019-01-17 17:48:58 +01:00
|
|
|
// Make zip
|
2021-02-18 18:34:53 +01:00
|
|
|
$zipFilename = $this->zipTheme($this->getUrl(2));
|
2019-01-17 17:48:58 +01:00
|
|
|
// Téléchargement du ZIP
|
2020-05-22 16:13:38 +02:00
|
|
|
if (!is_dir(self::FILE_DIR.'source/theme')) {
|
2021-09-29 14:50:25 +02:00
|
|
|
mkdir(self::FILE_DIR.'source/theme', 0755);
|
2020-05-22 16:13:38 +02:00
|
|
|
}
|
2019-05-27 20:35:04 +02:00
|
|
|
copy (self::TEMP_DIR . $zipFilename , self::FILE_DIR.'source/theme/' . $zipFilename);
|
2019-01-17 17:48:58 +01:00
|
|
|
// Nettoyage du dossier
|
2019-05-27 20:35:04 +02:00
|
|
|
unlink (self::TEMP_DIR . $zipFilename);
|
2019-01-17 17:48:58 +01:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
2020-08-08 17:06:06 +02:00
|
|
|
'notification' => 'Archive <b>'.$zipFilename.'</b> sauvegardée avec succès',
|
2019-01-17 17:48:58 +01:00
|
|
|
'redirect' => helper::baseUrl() . 'theme/manage',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-12-15 19:03:52 +01:00
|
|
|
* construction du zip Fonction appelée par export() et save()
|
2020-05-18 18:26:21 +02:00
|
|
|
* @param string $modele theme ou admin
|
2019-01-17 17:48:58 +01:00
|
|
|
*/
|
2021-02-18 18:34:53 +01:00
|
|
|
private function zipTheme($modele) {
|
2018-12-26 12:00:30 +01:00
|
|
|
// Creation du dossier
|
2021-03-21 18:12:25 +01:00
|
|
|
$zipFilename = $modele . date('Y-m-d-H-i-s', time()) . '.zip';
|
2018-12-26 20:20:43 +01:00
|
|
|
$zip = new ZipArchive();
|
2019-05-27 20:35:04 +02:00
|
|
|
if ($zip->open(self::TEMP_DIR . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) === TRUE) {
|
2020-05-18 18:26:21 +02:00
|
|
|
switch ($modele) {
|
|
|
|
case 'admin':
|
|
|
|
$zip->addFile(self::DATA_DIR.'admin.json',self::DATA_DIR.'admin.json');
|
|
|
|
$zip->addFile(self::DATA_DIR.'admin.css',self::DATA_DIR.'admin.css');
|
|
|
|
break;
|
|
|
|
case 'theme':
|
|
|
|
$zip->addFile(self::DATA_DIR.'theme.json',self::DATA_DIR.'theme.json');
|
|
|
|
$zip->addFile(self::DATA_DIR.'theme.css',self::DATA_DIR.'theme.css');
|
2020-06-02 12:03:45 +02:00
|
|
|
$zip->addFile(self::DATA_DIR.'custom.css',self::DATA_DIR.'custom.css');
|
2021-12-15 19:03:52 +01:00
|
|
|
// Traite l'image dans le body
|
2020-05-18 18:26:21 +02:00
|
|
|
if ($this->getData(['theme','body','image']) !== '' ) {
|
|
|
|
$zip->addFile(self::FILE_DIR.'source/'.$this->getData(['theme','body','image']),
|
|
|
|
self::FILE_DIR.'source/'.$this->getData(['theme','body','image'])
|
|
|
|
);
|
|
|
|
}
|
2021-12-15 19:03:52 +01:00
|
|
|
// Traite l'image dans le header
|
2020-06-02 12:03:45 +02:00
|
|
|
if ($this->getData(['theme','header','image']) !== '' ) {
|
2020-05-18 18:26:21 +02:00
|
|
|
$zip->addFile(self::FILE_DIR.'source/'.$this->getData(['theme','header','image']),
|
|
|
|
self::FILE_DIR.'source/'.$this->getData(['theme','header','image'])
|
|
|
|
);
|
|
|
|
}
|
2021-12-15 19:03:52 +01:00
|
|
|
// Traite les images du header perso
|
|
|
|
if (!empty($this->getData(['theme','header','featureFiles'])) ) {
|
|
|
|
foreach($this->getData(['theme','header','featureFiles']) as $value) {
|
2022-02-08 13:23:34 +01:00
|
|
|
$zip->addFile(self::FILE_DIR . 'source/' . $value,
|
2021-12-15 19:03:52 +01:00
|
|
|
self::FILE_DIR . 'source/' . $value );
|
|
|
|
}
|
2022-02-08 13:23:34 +01:00
|
|
|
}
|
2020-05-18 18:26:21 +02:00
|
|
|
break;
|
2018-12-26 20:20:43 +01:00
|
|
|
}
|
2018-12-28 15:03:23 +01:00
|
|
|
$ret = $zip->close();
|
2018-12-26 20:20:43 +01:00
|
|
|
}
|
2019-01-17 17:48:58 +01:00
|
|
|
return ($zipFilename);
|
|
|
|
}
|
2020-09-26 18:27:46 +02:00
|
|
|
|
2019-05-02 13:21:48 +02:00
|
|
|
}
|