Merge branch 'dev' into 12-dev

This commit is contained in:
Fred Tempez 2022-03-13 10:20:05 +01:00
commit 3532288fcf
27 changed files with 1819 additions and 1275 deletions

View File

@ -86,7 +86,7 @@ class helper {
* @param string $sort Type de tri à appliquer au tableau (SORT_ASC, SORT_DESC, ou null)
* @return array
*/
public static function arrayCollumn($array, $column, $sort = null) {
public static function arrayColumn($array, $column, $sort = null) {
$newArray = [];
if(empty($array) === false) {
$newArray = array_map(function($element) use($column) {

View File

@ -620,13 +620,6 @@ class template {
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
$attributes['selected'] = common::$inputBefore[$attributes['id']];
}
// Liste des polices à intégrer
//var_dump(core::$fonts);
if ($attributes['fonts'] === true) {
foreach (core::$fonts as $fontId => $font) {
echo "<link href='https://fonts.cdnfonts.com/css/" . $fontId . "' rel='stylesheet' type='text/css'>\n";
}
}
// Début du wrapper
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
// Label

View File

@ -179,22 +179,18 @@ class common {
];
// Fontes
public static $fonts = [
];
public static $fontsWebSafe = [
'arial' => 'Arial, Helvetica, sans-serif;',
'arial-black' => 'Arial Black, Gadget, sans-serif;',
'courrier' => 'Courier, Liberation Mono, monospace;',
'courrier-new' => 'Courier New, Courier, monospace',
'arial-black' => '"Arial Black", Gadget, sans-serif;',
'courrier' => 'Courier, "Liberation Mono", monospace;',
'courrier-new' => '"Courier New", Courier, monospace',
'garamond' => 'Garamond, serif',
'georgia' => 'Georgia, serif;',
'impact' => 'Impact, Charcoal, sans-serif;',
'lucida' => 'Lucida Sans Unicode, Lucida Grande, sans-serif',
'lucida' => '"Lucida Sans Unicode", "Lucida Grande", sans-serif',
'tahoma' => 'Tahoma, Geneva, sans-serif;',
'times-new-roman' => 'Times New Roman, Liberation Serif, serif;',
'trebuchet' => 'Trebuchet MS, Arial, Helvetica, sans-serif;',
'times-new-roman' => '"Times New Roman", "Liberation Serif", serif;',
'trebuchet' => '"Trebuchet MS", Arial, Helvetica, sans-serif;',
'tahoma' => 'Tahoma, Geneva, sans-serif;',
'verdana' => 'Verdana, Geneva, sans-serif;',
];
@ -294,7 +290,7 @@ class common {
// Construit la liste des pages parents/enfants
if($this->hierarchy['all'] === []) {
$pages = helper::arrayCollumn($this->getData(['page']), 'position', 'SORT_ASC');
$pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC');
// Parents
foreach($pages as $pageId => $pagePosition) {
if(
@ -407,6 +403,48 @@ class common {
}
}
/**
* Construit la liste des fontes dans un tableau
* @return array @fonts
*
*/
public function getFonts() {
// Fusionne la liste des fontes avec les webSafe
foreach (self::$fontsWebSafe as $fontId => $fontValue) {
$fontName = explode (',', $fontValue);
$f ['websafe'] [$fontId] = [
'name' => str_replace('"', '', $fontName[0]),
'font-family'=> $fontValue
];
}
// Ajoute les polices importées
$fontsImported = $this->getData(['fonts', 'imported']);
if (is_array($fontsImported)
) {
foreach ($fontsImported as $fontId => $fontValue) {
$f ['imported'] [$fontId] = [
'name' => $fontValue ['name'],
'font-family'=> $fontValue ['font-family'],
'ressource' => $fontValue ['ressource']
];
}
}
// Ajoute les polices locales
$fontsFiles = $this->getData(['fonts', 'files']);
if (is_array($fontsFiles)
) {
foreach ($fontsFiles as $fontId => $fontValue) {
$f ['files'] [$fontId] = [
'name' => $fontValue ['name'],
'font-family'=> $fontValue ['font-family'],
'ressource' => $fontValue ['ressource']
];
}
}
return $f;
}
/**
* Check du token CSRF (true = bo
*/
@ -2232,27 +2270,6 @@ class core extends common {
}
}
/**
* Traitement des polices de caractères
*/
// Fusionne la liste des fontes avec les webSafe
foreach (self::$fontsWebSafe as $fontId => $fontValue) {
$fontName = explode (',', $fontValue);
self::$fonts [$fontId] = $fontName[0];
}
// Importe les polices personnalisées
$fontsImported = $this->getData(['fonts', 'imported']);
if (is_array($fontsImported) &&
!empty ($fontsImported)
) {
// Fusionner avec les fontes installées
self::$fonts = array_merge(self::$fonts, $fontsImported);
}
// Tri Alphabétique
asort(self::$fonts);
// Crée le fichier de personnalisation avancée
if(file_exists(self::DATA_DIR.'custom.css') === false) {
file_put_contents(self::DATA_DIR.'custom.css', file_get_contents('core/module/theme/resource/custom.css'));
@ -2268,18 +2285,24 @@ class core extends common {
file_put_contents(self::DATA_DIR.'admin.css', '');
chmod(self::DATA_DIR.'admin.css', 0755);
}
// Check la version rafraichissement du theme
$cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR.'theme.css'));
if(empty($cssVersion[1]) OR $cssVersion[1] !== md5(json_encode($this->getData(['theme'])))) {
// Version
$css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/';
/**
* Import des polices de caractères
* A partir du CDN
* ou dans le dossier site/file/source/fonts
* ou pas du tout si fonte webSafe
*/
// Fonts disponibles
$fontsAvailable = $this->getFonts();
// Fontes installées
$fonts = [ $this->getData(['theme', 'text', 'font']),
$this->getData(['theme', 'title', 'font']),
$this->getData(['theme', 'header', 'font']),
@ -2290,51 +2313,50 @@ class core extends common {
$fonts = array_unique($fonts);
/**
* Fontes Web Safe, ne sont pas chargées.
* Charge les fontes websafe
*/
$fontFile = '';
foreach ($fonts as $fontId) {
if (array_key_exists($fontId, self::$fontsWebSafe) ) {
unset($fonts[$fontId]);
if ( isset($fontsAvailable['websafe'][$fontId])) {
$fonts [$fontId] = $fontsAvailable['websafe'][$fontId]['font-family'];
}
}
/**
* Chargement des polices en ligne dans un fichier séparé
* Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php
*/
// Lire le fichier des fontes locales
$localFonts = $this->getData(['fonts', 'files']);
$fontFile = '';
foreach ($fonts as $fontId) {
if (!array_key_exists($fontId, $localFonts) ) {
$fontFile .= '<link href="https://fonts.cdnfonts.com/css/' . $fontId .'" rel="stylesheet">';
// Supprimer l'élément des fontes chargées en ligne
unset($fonts[$fontId]);
if ( isset($fontsAvailable['imported'][$fontId])) {
$fontFile .= '<link href="' . $fontsAvailable['imported'][$fontId]['ressource'] .'" rel="stylesheet">';
// Tableau pour la construction de la feuille de style
$fonts [$fontId] = $fontsAvailable['imported'][$fontId]['font-family'];
}
}
// Enregistre la personnalisation
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fontFile);
/**
* Fontes installées localement
*/
// Validité du format
if ( !empty($localFonts)
) {
foreach ($localFonts as $fontId => $fontName) {
// Validité du tableau :
if ( array_key_exists($fontId, self::$fonts) &&
file_exists(self::DATA_DIR . 'fonts/' . $fontName) ) {
// Chargement de la police
//$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName);
$css .= '@font-face {font-family:"' . self::$fonts[$fontId] . '";';
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontName . '");}';
}
foreach ($fonts as $fontId) {
// Validité du tableau :
if ( isset($fontsAvailable['files'][$fontId]) &&
file_exists(self::DATA_DIR . 'fonts/' . $f) ) {
// Chargement de la police
//$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName);
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' .$fontsAvailable['files'][$fontId]['ressource'] . '");}';
// Tableau pour la construction de la feuille de style
$fonts [$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
}
}
// Fond du body
$colors = helper::colorVariants($this->getData(['theme', 'body', 'backgroundColor']));
// Body
$css .= 'body{font-family:"' . self::$fonts[$this->getData(['theme', 'text', 'font'])] . '",sans-serif}';
$css .= 'body{font-family:' . $fonts[$this->getData(['theme', 'text', 'font'])] . ';}';
if($themeBodyImage = $this->getData(['theme', 'body', 'image'])) {
// Image dans html pour éviter les déformations.
$css .= 'html {background-image:url("../file/source/' . $themeBodyImage . '");background-position:' . $this->getData(['theme', 'body', 'imagePosition']) . ';background-attachment:' . $this->getData(['theme', 'body', 'imageAttachment']) . ';background-size:' . $this->getData(['theme', 'body', 'imageSize']) . ';background-repeat:' . $this->getData(['theme', 'body', 'imageRepeat']) . '}';
@ -2352,7 +2374,7 @@ class core extends common {
$colors = helper::colorVariants($this->getData(['theme', 'text', 'linkColor']));
$css .= 'a{color:' . $colors['normal'] . '}';
// Couleurs de site dans TinyMCe
$css .= 'div.mce-edit-area {font-family:"' . self::$fonts[$this->getData(['theme', 'text', 'font'])] . '",sans-serif}';
$css .= 'div.mce-edit-area {font-family:' . $fonts[$this->getData(['theme', 'text', 'font'])] . ';}';
// Site dans TinyMCE
$css .= '.editorWysiwyg {background-color:' . $this->getData(['theme', 'site', 'backgroundColor']) . ';}';
$css .= 'span.mce-text{background-color: unset !important;}';
@ -2393,7 +2415,7 @@ class core extends common {
$css .= '.helpButton span:hover{color:' . $colors['darken'] . '}';
$css .= '.button:active,button[type=\'submit\']:active,.pagination a:active{background-color:' . $colors['veryDarken'] . '}';
$colors = helper::colorVariants($this->getData(['theme', 'title', 'textColor']));
$css .= 'h1,h2,h3,h4,h5,h6,h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color:' . $colors['normal'] . ';font-family:"' . self::$fonts[$this->getData(['theme', 'title', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'title', 'fontWeight']) . ';text-transform:' . $this->getData(['theme', 'title', 'textTransform']) . '}';
$css .= 'h1,h2,h3,h4,h5,h6,h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color:' . $colors['normal'] . ';font-family:' . $fonts[$this->getData(['theme', 'title', 'font'])] . ';font-weight:' . $this->getData(['theme', 'title', 'fontWeight']) . ';text-transform:' . $this->getData(['theme', 'title', 'textTransform']) . '}';
$css .= 'h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{color:' . $colors['darken'] . '}';
// Les blocs
$colors = helper::colorVariants($this->getData(['theme', 'block', 'backgroundColor']));
@ -2427,7 +2449,7 @@ class core extends common {
$css .= 'header{background-image:url("../file/source/' . $themeHeaderImage . '");background-position:' . $this->getData(['theme', 'header', 'imagePosition']) . ';background-repeat:' . $this->getData(['theme', 'header', 'imageRepeat']) . '}';
}
$colors = helper::colorVariants($this->getData(['theme', 'header', 'textColor']));
$css .= 'header span{color:' . $colors['normal'] . ';font-family:"' . self::$fonts[$this->getData(['theme', 'header', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'header', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'header', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'header', 'textTransform']) . '}';
$css .= 'header span{color:' . $colors['normal'] . ';font-family:' . $fonts[$this->getData(['theme', 'header', 'font'])] . ';font-weight:' . $this->getData(['theme', 'header', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'header', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'header', 'textTransform']) . '}';
}
// Bannière au contenu personnalisé
@ -2476,7 +2498,7 @@ class core extends common {
$css .= 'nav{padding:0 10px;}';
}
$css .= '#toggle span,#menu a{padding:' . $this->getData(['theme', 'menu', 'height']) .';font-family:"' . self::$fonts[$this->getData(['theme', 'menu', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'menu', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'menu', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'menu', 'textTransform']) . '}';
$css .= '#toggle span,#menu a{padding:' . $this->getData(['theme', 'menu', 'height']) .';font-family:' . $fonts[$this->getData(['theme', 'menu', 'font'])] . ';font-weight:' . $this->getData(['theme', 'menu', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'menu', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'menu', 'textTransform']) . '}';
// Pied de page
$colors = helper::colorVariants($this->getData(['theme', 'footer', 'backgroundColor']));
@ -2486,7 +2508,7 @@ class core extends common {
$css .= 'footer{padding:0}';
}
$css .= 'footer span, #footerText > p {color:' . $this->getData(['theme', 'footer', 'textColor']) . ';font-family:"' . self::$fonts[$this->getData(['theme', 'footer', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'footer', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'footer', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'footer', 'textTransform']) . '}';
$css .= 'footer span, #footerText > p {color:' . $this->getData(['theme', 'footer', 'textColor']) . ';font-family:' . $fonts[$this->getData(['theme', 'footer', 'font'])] . ';font-weight:' . $this->getData(['theme', 'footer', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'footer', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'footer', 'textTransform']) . '}';
$css .= 'footer {background-color:' . $colors['normal'] . ';color:' . $this->getData(['theme', 'footer', 'textColor']) . '}';
$css .= 'footer a{color:' . $this->getData(['theme', 'footer', 'textColor']) . '}';
$css .= 'footer #footersite > div {margin:' . $this->getData(['theme', 'footer', 'height']) . ' 0}';
@ -2497,10 +2519,8 @@ class core extends common {
$css .= '#footerText > p {text-align:' . $this->getData(['theme', 'footer', 'textAlign']) . '}';
$css .= '#footerCopyright{text-align:' . $this->getData(['theme', 'footer', 'copyrightAlign']) . '}';
// Enregistre la personnalisation
file_put_contents(self::DATA_DIR.'theme.css', $css);
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fontFile);
// Effacer le cache pour tenir compte de la couleur de fond TinyMCE
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@ -2527,52 +2547,51 @@ class core extends common {
$fonts = array_unique($fonts);
/**
* Fontes Web Safe, ne sont pas chargées.
* Charge les fontes websafe
*/
$fontFile = '';
foreach ($fonts as $fontId) {
if (array_key_exists($fontId, self::$fontsWebSafe) ) {
unset($fonts[$fontId]);
if ( isset($fontsAvailable['websafe'][$fontId])) {
$fonts [$fontId] = $fontsAvailable['websafe'][$fontId]['font-family'];
}
}
// Lire le fichier des fontes locales
$localFonts = $this->getData(['fonts', 'files']);
/**
* Chargement des polices en ligne
* Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php
*/
$fontFile = '';
foreach ($fonts as $fontId) {
if (!array_key_exists($fontId, $localFonts) ) {
$css .= '@import url("http://fonts.cdnfonts.com/css/' . $fontId . '");';
// Supprimer l'élément des fontes chargées en ligne
unset($fonts[$fontId]);
if ( isset($fontsAvailable['imported'][$fontId])) {
$fontFile .= '<link href="' . $fontsAvailable['imported'][$fontId]['ressource'] .'" rel="stylesheet">';
// Tableau pour la construction de la feuille de style
$fonts [$fontId] = $fontsAvailable['imported'][$fontId]['font-family'];
}
}
// Enregistre la personnalisation
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fontFile);
/**
* Fontes installées localement
*/
// Validité du format
if ( !empty($localFonts)
) {
foreach ($localFonts as $fontId => $fontName) {
// Validité du tableau :
if ( array_key_exists($fontId, self::$fonts) &&
file_exists(self::DATA_DIR . 'fonts/' . $fontName) ) {
// Chargement de la police
//$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName);
$css .= '@font-face {font-family:"' . self::$fonts[$fontId] . '";';
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontName . '");}';
}
foreach ($fonts as $fontId) {
// Validité du tableau :
if ( isset($fontsAvailable['files'][$fontId]) &&
file_exists(self::DATA_DIR . 'fonts/' . $f) ) {
// Chargement de la police
//$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName);
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' .$fontsAvailable['files'][$fontId]['ressource'] . '");}';
// Tableau pour la construction de la feuille de style
$fonts [$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
}
}
// Thème Administration
$colors = helper::colorVariants($this->getData(['admin','backgroundColor']));
$css .= '#site{background-color:' . $colors['normal']. ';}';
$css .= '.row > div {font:' . $this->getData(['admin','fontSize']) . ' "' . self::$fonts[$this->getData(['admin','fontText'])] . '", sans-serif;}';
$css .= 'body h1, h2, h3, h4 a, h5, h6 {font-family:"' . self::$fonts[$this->getData(['admin','fontTitle'])] . '", sans-serif;color:' . $this->getData(['admin','colorTitle' ]) . ';}';
$css .= '.row > div {font:' . $fonts[$this->getData(['admin','fontText'])] . ';font-size:' . $this->getData(['admin','fontSize']) .'}';
$css .= 'body h1, h2, h3, h4 a, h5, h6 {font-family:' . $fonts[$this->getData(['admin','fontTitle'])] . ';color:' . $this->getData(['admin','colorTitle' ]) . ';}';
// TinyMCE
$css .= 'body:not(.editorWysiwyg),span .zwiico-help {color:' . $this->getData(['admin','colorText']) . ';}';

View File

@ -481,7 +481,7 @@ if ($this->getData(['core', 'dataVersion']) < 10400) {
foreach ($pageList as $parentKey => $parent) {
//La page est un blog
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $parent, 'posts']), 'publishedOn', 'SORT_DESC'));
$articleIds = array_keys(helper::arrayColumn($this->getData(['module', $parent, 'posts']), 'publishedOn', 'SORT_DESC'));
foreach ($articleIds as $key => $article) {
// Droits les deux groupes
$this->setData(['module', $parent, 'posts', $article,'editConsent', 3]);
@ -874,26 +874,106 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
// Version 12.0.00
if ($this->getData(['core', 'dataVersion']) < 12000) {
$fonts = [
'arimo' => 'Arimo',
'arvo' => 'Arvo',
'dancing-script' => 'Dancing Script',
'droid-sans-2' => 'Droid Sans',
'droid-serif-2' => 'Droid Serif',
'indie-flower' => 'Indie Flower',
'liberation-sans' => 'Liberation Sans',
'liberation-serif' => 'Liberation Serif',
'lobster-2' => 'Lobster',
'lora' => 'Lora',
'lato' => 'Lato',
'old-standard-tt-3' => 'Old Standard TT',
'open-sans' => 'Open Sans',
'oswald-4' => 'Oswald',
'pt-mono' => 'PT Mono',
'pt-serif' => 'PT Serif',
'rancho' => 'Rancho',
'roboto' => 'Roboto',
'ubuntu' => 'Ubuntu',
'vollkorn' => 'Vollkorn'
'arimo'=> [
'name' => 'Arimo',
'font-family' => 'Arimo, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/arimo'
],
'arvo'=> [
'name' => 'Arvo',
'font-family' => 'Arvo, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/arvo'
],
'dancing-script' => [
'name' => 'Dancing Script',
'font-family' => '"Dancing Script", sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/dancing-script'
],
'droid-sans-2'=> [
'name' => 'Droid Sans',
'font-family' => '"Droid Sans", sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/droid-sans-2'
],
'droid-serif-2'=> [
'name' => 'Droid Serif',
'font-family' => '"Droid Serif", serif',
'url' => 'https://fonts.cdnfonts.com/css/droid-serif-2'
],
'indie-flower'=> [
'name' => 'Indie Flower',
'font-family' => '"Indie Flower", sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/indie-flower'
],
'liberation-sans'=> [
'name' => 'Liberation Sans',
'font-family' => '"Liberation Sans", sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/liberation-sans'
],
'liberation-serif'=> [
'name' => 'Liberation Serif',
'font-family' => '"Liberation Serif", serif',
'url' => 'https://fonts.cdnfonts.com/css/liberation-serif'
],
'lobster-2'=> [
'name' => 'Lobster',
'font-family' => 'Lobster, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/lobster-2'
],
'lato'=> [
'name' => 'lato',
'font-family' => 'Lato, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/lato'
],
'lora'=> [
'name' => 'Lora',
'font-family' => 'Lora, serif',
'url' => 'https://fonts.cdnfonts.com/css/lora'
],
'old-standard-tt-3'=> [
'name' => 'Old Standard TT',
'font-family' => '"Old Standard TT", serif',
'url' => 'https://fonts.cdnfonts.com/css/old-standard-tt-3'
],
'open-sans' => [
'name' => 'Open Sans',
'font-family' => '"Open Sans", sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/open-sans'
],
'oswald-4'=> [
'name' => 'Oswald',
'font-family' => 'Oswald, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/oswald-4'
],
'pt-mono'=> [
'name' => 'PT Mono',
'font-family' => '"PT Mono", monospace',
'url' => 'https://fonts.cdnfonts.com/css/pt-mono'
],
'pt-serif'=> [
'name' => "PR Serif",
'font-family' => '"PT Serif", serif',
'url' => 'https://fonts.cdnfonts.com/css/pt-serif'
],
'rancho'=> [
'name' => 'Rancho',
'font-family' => 'Rancho, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/rancho'
],
'roboto'=> [
'name' => 'Roboto',
'font-family' => 'Roboto, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/roboto'
],
'ubuntu'=> [
'name' => 'Ubuntu',
'font-family' => 'Ubuntu, sans-serif',
'url' => 'https://fonts.cdnfonts.com/css/ubuntu'
],
'vollkorn'=> [
'name' => 'Vollkorn',
'font-family' => 'Vollkorn, serif',
'url' => 'https://fonts.cdnfonts.com/css/vollkorn'
]
];
$this->setData(['fonts', 'imported', $fonts]);

View File

@ -9,27 +9,15 @@
</a>
</span>
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('connectCaptcha', true, 'Captcha à la connexion', [
'checked' => $this->getData(['config', 'connect','captcha'])
]); ?>
<?php echo template::checkbox('connectCaptchaStrong', true, 'Captcha complexe', [
'checked' => $this->getData(['config', 'connect', '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.'
]); ?>
</div>
<div class="col3">
<?php echo template::select('connectCaptchaType', $module::$captchaTypes , [
'label' => 'Type de captcha',
'selected' => $this->getData(['config', 'connect', 'captchaType'])
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('connectAutoDisconnect', true, 'Déconnexion automatique', [
'checked' => $this->getData(['config', 'connect', 'autoDisconnect']),
'help' => 'Déconnecte les sessions ouvertes précédemment sur d\'autres navigateurs ou terminaux. Activation recommandée.'
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('connectShowPassword', true, 'Dévoiler le mot de passe', [
'checked' => $this->getData(['config', 'connect', 'showPassword']),
'help' => 'Dans l\'écran de connexion, active une icône dont le survol affiche temporairement le mot de passe.'
@ -39,7 +27,7 @@
<div class="row">
<div class="col3">
<?php echo template::select('connectAttempt', $module::$connectAttempt , [
'label' => 'Connexions successives',
'label' => 'Limitation des tentatives',
'selected' => $this->getData(['config', 'connect', 'attempt'])
]); ?>
</div>
@ -71,6 +59,25 @@
]); ?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::checkbox('connectCaptcha', true, 'Captcha à la connexion', [
'checked' => $this->getData(['config', 'connect','captcha'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('connectCaptchaStrong', true, 'Captcha complexe', [
'checked' => $this->getData(['config', 'connect', '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.'
]); ?>
</div>
<div class="col3">
<?php echo template::select('connectCaptchaType', $module::$captchaTypes , [
'label' => 'Type de captcha',
'selected' => $this->getData(['config', 'connect', 'captchaType'])
]); ?>
</div>
</div>
</div>
</div>
</div>

View File

@ -57,21 +57,21 @@
</h4>
<div class="row">
<div class="col4">
<?php echo template::select('localeHomePageId', helper::arrayCollumn($module::$pagesList, 'title', 'SORT_ASC'), [
<?php echo template::select('localeHomePageId', helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC'), [
'label' => 'Accueil du site',
'selected' =>$this->getData(['locale', 'homePageId']),
'help' => 'La première page que vos visiteurs verront.'
]); ?>
</div>
<div class="col4">
<?php echo template::select('localePage403', array_merge(['none' => 'Page par défaut'],helper::arrayCollumn($module::$orphansList, 'title', 'SORT_ASC')), [
<?php echo template::select('localePage403', array_merge(['none' => 'Page par défaut'],helper::arrayColumn($module::$orphansList, 'title', 'SORT_ASC')), [
'label' => 'Accès interdit, erreur 403',
'selected' =>$this->getData(['locale', 'page403']),
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'
]); ?>
</div>
<div class="col4">
<?php echo template::select('localePage404', array_merge(['none' => 'Page par défaut'],helper::arrayCollumn($module::$orphansList, 'title', 'SORT_ASC')), [
<?php echo template::select('localePage404', array_merge(['none' => 'Page par défaut'],helper::arrayColumn($module::$orphansList, 'title', 'SORT_ASC')), [
'label' => 'Page inexistante, erreur 404',
'selected' =>$this->getData(['locale', 'page404']),
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'
@ -80,14 +80,14 @@
</div>
<div class="row">
<div class="col4">
<?php echo template::select('localeLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayCollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
<?php echo template::select('localeLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Mentions légales',
'selected' => $this->getData(['locale', 'legalPageId']),
'help' => 'Les mentions légales sont obligatoires en France. Une option du pied de page ajoute un lien discret vers cette page.'
]); ?>
</div>
<div class="col4">
<?php echo template::select('localeSearchPageId', array_merge(['none' => 'Aucune'] , helper::arrayCollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
<?php echo template::select('localeSearchPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Recherche dans le site',
'selected' => $this->getData(['locale', 'searchPageId']),
'help' => 'Sélectionnez une page contenant le module \'Recherche\'. Une option du pied de page ajoute un lien discret vers cette page.'
@ -95,7 +95,7 @@
</div>
<div class="col4">
<?php
echo template::select('localePage302', array_merge(['none' => 'Page par défaut'],helper::arrayCollumn($module::$orphansList, 'title', 'SORT_ASC')), [
echo template::select('localePage302', array_merge(['none' => 'Page par défaut'],helper::arrayColumn($module::$orphansList, 'title', 'SORT_ASC')), [
'label' => 'Site en maintenance',
'selected' =>$this->getData(['locale', 'page302']),
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'

View File

@ -153,7 +153,7 @@ class install extends common {
// Récupération de la liste des thèmes
$dataThemes = file_get_contents('core/module/install/ressource/themes/themes.json');
$dataThemes = json_decode($dataThemes, true);
self::$themes = helper::arrayCollumn($dataThemes, 'name');
self::$themes = helper::arrayColumn($dataThemes, 'name');
// Valeurs en sortie
$this->addOutput([

View File

@ -88,26 +88,106 @@ class init extends common {
'fonts' => [
'files' => [],
'imported'=> [
'arimo'=> 'Arimo',
'arvo'=> 'Arvo',
'dancing-script' => 'Dancing Script',
'droid-sans-2'=> 'Droid Sans',
'droid-serif-2'=> 'Droid Serif',
'indie-flower'=> 'Indie Flower',
'liberation-sans'=> 'Liberation Sans',
'liberation-serif'=> 'Liberation Serif',
'lobster-2'=> 'Lobster',
'lora'=> 'Lora',
'lato'=> 'Lato',
'old-standard-tt-3'=> 'Old Standard TT',
'open-sans'=> 'Open Sans',
'oswald-4'=> 'Oswald',
'pt-mono'=> 'PT Mono',
'pt-serif'=> 'PT Serif',
'rancho'=> 'Rancho',
'roboto'=> 'Roboto',
'ubuntu'=> 'Ubuntu',
'vollkorn'=> 'Vollkorn'
'arimo'=> [
'name' => 'Arimo',
'font-family' => 'Arimo, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/arimo'
],
'arvo'=> [
'name' => 'Arvo',
'font-family' => 'Arvo, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/arvo'
],
'dancing-script' => [
'name' => 'Dancing Script',
'font-family' => '"Dancing Script", sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/dancing-script'
],
'droid-sans-2'=> [
'name' => 'Droid Sans',
'font-family' => '"Droid Sans", sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/droid-sans-2'
],
'droid-serif-2'=> [
'name' => 'Droid Serif',
'font-family' => '"Droid Serif", serif',
'ressource' => 'https://fonts.cdnfonts.com/css/droid-serif-2'
],
'indie-flower'=> [
'name' => 'Indie Flower',
'font-family' => '"Indie Flower", sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/indie-flower'
],
'liberation-sans'=> [
'name' => 'Liberation Sans',
'font-family' => '"Liberation Sans", sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/liberation-sans'
],
'liberation-serif'=> [
'name' => 'Liberation Serif',
'font-family' => '"Liberation Serif", serif',
'ressource' => 'https://fonts.cdnfonts.com/css/liberation-serif'
],
'lobster-2'=> [
'name' => 'Lobster',
'font-family' => 'Lobster, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/lobster-2'
],
'lato'=> [
'name' => 'lato',
'font-family' => 'Lato, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/lato'
],
'lora'=> [
'name' => 'Lora',
'font-family' => 'Lora, serif',
'ressource' => 'https://fonts.cdnfonts.com/css/lora'
],
'old-standard-tt-3'=> [
'name' => 'Old Standard TT',
'font-family' => '"Old Standard TT", serif',
'ressource' => 'https://fonts.cdnfonts.com/css/old-standard-tt-3'
],
'open-sans' => [
'name' => 'Open Sans',
'font-family' => '"Open Sans", sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/open-sans'
],
'oswald-4'=> [
'name' => 'Oswald',
'font-family' => 'Oswald, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/oswald-4'
],
'pt-mono'=> [
'name' => 'PT Mono',
'font-family' => '"PT Mono", monospace',
'ressource' => 'https://fonts.cdnfonts.com/css/pt-mono'
],
'pt-serif'=> [
'name' => "PR Serif",
'font-family' => '"PT Serif", serif',
'ressource' => 'https://fonts.cdnfonts.com/css/pt-serif'
],
'rancho'=> [
'name' => 'Rancho',
'font-family' => 'Rancho, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/rancho'
],
'roboto'=> [
'name' => 'Roboto',
'font-family' => 'Roboto, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/roboto'
],
'ubuntu'=> [
'name' => 'Ubuntu',
'font-family' => 'Ubuntu, sans-serif',
'ressource' => 'https://fonts.cdnfonts.com/css/ubuntu'
],
'vollkorn'=> [
'name' => 'Vollkorn',
'font-family' => 'Vollkorn, serif',
'ressource' => 'https://fonts.cdnfonts.com/css/vollkorn'
]
]
],
'page' => [
@ -153,7 +233,7 @@ class init extends common {
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'open-sans',
'font' => 'georgia',
'fontSize' => '.8em',
'fontWeight' => 'normal',
'height' => '5px',
@ -180,7 +260,7 @@ class init extends common {
],
'header' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'oswald-4',
'font' => 'arial',
'fontSize' => '2em',
'fontWeight' => 'normal',
'height' => '150px',
@ -203,7 +283,7 @@ class init extends common {
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'backgroundColorSub' => 'rgba(32, 59, 82, 1)',
'font' => 'open-sans',
'font' => 'georgia',
'fontSize' => '1em',
'fontWeight' => 'normal',
'height' => '15px 10px',
@ -234,13 +314,13 @@ class init extends common {
'borderColor' => 'rgba(236, 239, 241, 1)'
],
'text' => [
'font' => 'open-sans',
'font' => 'georgia',
'fontSize' => '13px',
'textColor' => 'rgba(33, 34, 35, 1)',
'linkColor' => 'rgba(74, 105, 189, 1)'
],
'title' => [
'font' => 'oswald-4',
'font' => 'arial',
'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
@ -252,9 +332,9 @@ class init extends common {
],
'admin' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'fontText' => 'open-sans',
'fontText' => 'georgia',
'fontSize' => '13px',
'fontTitle' => 'oswald-4',
'fontTitle' => 'arial',
'colorText' => 'rgba(33, 34, 35, 1)',
'colorTitle' => 'rgba(74, 105, 189, 1)',
'backgroundColorButton' => 'rgba(63, 125, 250, 1)',

View File

@ -392,19 +392,25 @@ class page extends common {
$lastPosition = 1;
$hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
$position = $this->getInput('pageEditPosition', helper::FILTER_INT);
$extraPosition = $this->getinput('pageEditExtraPosition', helper::FILTER_BOOLEAN);
foreach($hierarchy as $hierarchyPageId) {
// Ignore la page en cours de modification
if($hierarchyPageId === $this->getUrl(2)) {
continue;
}
// Incrémente de +1 pour laisser la place à la position de la page en cours de modification
if($lastPosition === $position) {
// Ne traite que les pages du menu sélectionné
if ($this->getData(['page', $hierarchyPageId, 'extraPosition']) === $extraPosition ) {
// Ignore la page en cours de modification
if($hierarchyPageId === $this->getUrl(2) ) {
continue;
}
// Incrémente de +1 pour laisser la place à la position de la page en cours de modification
if($lastPosition === $position) {
$lastPosition++;
}
// Change la position
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
// Incrémente pour la prochaine position
$lastPosition++;
}
// Change la position
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
// Incrémente pour la prochaine position
$lastPosition++;
}
if ($this->getinput('pageEditBlock') !== 'bar') {
$barLeft = $this->getinput('pageEditBarLeft');
@ -516,7 +522,7 @@ class page extends common {
}
}
}
self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arrayCollumn(helper::getModules(),'realName','SORT_ASC')); // Pages sans parent
self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arrayColumn(helper::getModules(),'realName','SORT_ASC')); // Pages sans parent
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
if($parentPageId !== $this->getUrl(2)) {
self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);

View File

@ -42,8 +42,8 @@ class sitemap extends common
!empty($this->getData(['module',$parentId, 'posts' ]))) {
$items .= '<ul>';
// Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $parentId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $parentId, 'posts']), 'state', 'SORT_DESC');
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $parentId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $parentId, 'posts']), 'state', 'SORT_DESC');
$articleIds = [];
foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) {
@ -78,8 +78,8 @@ class sitemap extends common
!empty($this->getData(['module', $childId, 'posts' ]))) {
$items .= '<ul>';
// Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $childId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $childId, 'posts']), 'state', 'SORT_DESC');
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $childId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $childId, 'posts']), 'state', 'SORT_DESC');
$articleIds = [];
foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) {

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,8 @@
*/
$(document).ready(function(){
$('input[name=fontAddFontImported]').prop('checked', true);
$('#fontAddFileWrapper').hide();
$('input[name=fontAddFontUrl]').prop('checked', false);
$('#containerFontAddFile').hide();
});
@ -28,7 +29,8 @@ $("input[name=fontAddFontImported]").on("click", function() {
} else {
$('input[name=fontAddFontFile]').prop('checked', true);
}
$('#fontAddFileWrapper').hide();
$('#containerFontAddFile').hide();
$('#containerFontAddUrl').show();
});
$("input[name=fontAddFontFile]").on("click", function() {
@ -37,5 +39,6 @@ $("input[name=fontAddFontFile]").on("click", function() {
} else {
$('input[name=fontAddFontImported]').prop('checked', true);
}
$('#fontAddFileWrapper').show();
$('#containerFontAddFile').show();
$('#containerFontAddUrl').hide();
});

View File

@ -9,7 +9,7 @@
]); ?>
</div>
<div class="col2">
<?php echo template::button('pageEditHelp', [
<?php echo template::button('fontAddHelp', [
'href' => 'https://doc.zwiicms.fr/fontes#add',
'target' => '_blank',
'ico' => 'help',
@ -30,14 +30,10 @@
<h4>Identité de la fonte</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('fontAddFontImported', true, 'Fonte téléchargée sur cdnFonts', [
'help' => 'Police utilisée en ligne, se connecter sur cdnFonts pour récupérer les informations nécessaires.'
]); ?>
<?php echo template::checkbox('fontAddFontImported', true, 'Fonte en ligne', []); ?>
</div>
<div class="col6">
<?php echo template::checkbox('fontAddFontFile', true,'Fonte installée', [
'help' => '<br/>Sélectionnez un fichier de fonte au format WOFF.'
]); ?>
<?php echo template::checkbox('fontAddFontFile', true,'Fonte installée', []); ?>
</div>
</div>
<div class="row">
@ -45,23 +41,39 @@
<?php echo template::text('fontAddFontId', [
'autocomplete' => 'off',
'label' => 'Identifiant (sans espace ni majuscule)',
'placeholder' => 'perry-gothic'
'placeholder' => 'big-marker-extrude'
]); ?>
</div>
<div class="col6">
<?php echo template::text('fontAddFontName', [
'autocomplete' => 'off',
'label' => 'Nom (Font Family)',
'placeholder' => 'PerryGothic'
'label' => 'Nom',
'placeholder' => 'Big Marker Extrude'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::text('fontAddFontFamilyName', [
'autocomplete' => 'off',
'label' => 'Famille',
'placeholder' => "'Big Marker Extrude', sans-serif"
]); ?>
</div>
</div>
<div class="row" id="containerFontAddFile">
<div class="col12">
<?php echo template::file('fontAddFile', [
'label' => 'Fichier de police (Format WOFF)',
'placeholder' => 'https://fonts.cdnfonts.com/s/7896/PERRYGOT.woff'
'label' => 'Fichier de fonte (Format WOFF)'
]); ?>
</div>
</div>
<div class="row" id="containerFontAddUrl">
<div class="col12">
<?php echo template::text('fontAddUrl', [
'label' => 'Url du fichier de fonte',
'placeholder' => 'https://fonts.cdnfonts.com/css/big-marker-extrude'
]); ?>
</div>
</div>

View File

@ -0,0 +1,18 @@
/**
* 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
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,44 @@
/**
* 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 Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/**
* Option par défaut du sélecteur de mode
*/
$(document).ready(function(){
$('input[name=fontEditFontImported]').prop('checked', true);
$('input[name=fontEditFontUrl]').prop('checked', false);
$('#containerfontEditFile').hide();
});
/**
* Mode téléchargement en ligne de la fonte ou installation locale
*/
$("input[name=fontEditFontImported]").on("click", function() {
if( $('input[name=fontEditFontImported]').is(':checked') ){
$('input[name=fontEditFontFile]').prop('checked', false);
} else {
$('input[name=fontEditFontFile]').prop('checked', true);
}
$('#containerfontEditFile').hide();
$('#containerfontEditUrl').show();
});
$("input[name=fontEditFontFile]").on("click", function() {
if( $('input[name=fontEditFontFile]').is(':checked') ){
$('input[name=fontEditFontImported]').prop('checked', false);
} else {
$('input[name=fontEditFontImported]').prop('checked', true);
}
$('#containerfontEditFile').show();
$('#containerfontEditUrl').hide();
});

View File

@ -0,0 +1,87 @@
<?php echo template::formOpen('fontEditForm'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('fontEditBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme/fonts',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2">
<?php echo template::button('fontEditHelp', [
'href' => 'https://doc.zwiicms.fr/fontes#add',
'target' => '_blank',
'ico' => 'help',
'value' => 'Aide',
'class' => 'buttonHelp'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::submit('fontEditPublish', [
'value' => 'Valider',
'uniqueSubmission' => true
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Identité de la fonte</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('fontEditFontImported', true, 'Fonte en ligne', [
'checked' => $this->getUrl(2) === 'imported' ? true : false
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('fontEditFontFile', true,'Fonte installée', [
'checked' => $this->getUrl(2) === 'file' ? true : false
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::text('fontEditFontId', [
'autocomplete' => 'off',
'label' => 'Identifiant (sans espace ni majuscule)',
'value' => $this->getUrl(3)
]); ?>
</div>
<div class="col6">
<?php echo template::text('fontEditFontName', [
'autocomplete' => 'off',
'label' => 'Nom',
'value' => $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'name'])
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::text('fontEditFontFamilyName', [
'autocomplete' => 'off',
'label' => 'Famille',
'value' => $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'font-family'])
]); ?>
</div>
</div>
<div class="row" id="containerfontEditFile">
<div class="col12">
<?php echo template::file('fontEditFile', [
'label' => 'Fichier de fonte (Format WOFF)',
'value' => $this->getUrl(2) === 'file' ? $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'ressource']) : ''
]); ?>
</div>
</div>
<div class="row" id="containerfontEditUrl">
<div class="col12">
<?php echo template::text('fontEditUrl', [
'label' => 'Url du fichier de fonte',
'value' => $this->getUrl(2) === 'imported' ? $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'ressource']) : ''
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -23,8 +23,8 @@
]); ?>
</div>
</div>
<?php if($module::$fontsList): ?>
<?php echo template::table([3, 3, 3, 3, 1], $module::$fontsList, ['Family Name', 'Font Id', 'Affectation', 'Ressource', 'Effacer']); ?>
<?php if($module::$fontsDetail): ?>
<?php echo template::table([2, 2, 3, 2, 1, 1, 1], $module::$fontsDetail, ['FontId', 'Nom', 'Famille', 'Affectation', 'Origine', '', '']); ?>
<?php else: ?>
<?php echo template::speech('Aucune fonte !'); ?>
<?php endif; ?>

View File

@ -133,7 +133,7 @@
]); ?>
</div>
<div class="col3">
<?php echo template::select('configLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayCollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
<?php echo template::select('configLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Page "Mentions légales" ' . template::flag('site', '20px'),
'selected' => $this->getData(['locale', 'legalPageId'])
]); ?>
@ -147,7 +147,7 @@
]); ?>
</div>
<div class="col3">
<?php echo template::select('configSearchPageId', array_merge(['none' => 'Aucune'] , helper::arrayCollumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
<?php echo template::select('configSearchPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC') ) , [
'label' => 'Page "Rechercher" ' . template::flag('site', '20px'),
'selected' => $this->getData(['locale', 'searchPageId'])
]); ?>
@ -171,7 +171,7 @@
<h4>Mise en forme du texte</h4>
<div class="row">
<div class="col3">
<?php echo template::select('themeFooterFont', self::$fonts, [
<?php echo template::select('themeFooterFont', $module::$fontsList, [
'label' => 'Police',
'selected' => $this->getData(['theme', 'footer', 'font']),
'fonts' => true

View File

@ -106,7 +106,7 @@
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeHeaderFont', self::$fonts, [
<?php echo template::select('themeHeaderFont', $module::$fontsList, [
'label' => 'Police',
'selected' => $this->getData(['theme', 'header', 'font']),
'fonts' => true

View File

@ -183,7 +183,7 @@
<h4>Mise en forme du texte</h4>
<div class="row">
<div class="col6">
<?php echo template::select('themeMenuFont', self::$fonts, [
<?php echo template::select('themeMenuFont', $module::$fontsList, [
'label' => 'Police',
'selected' => $this->getData(['theme', 'menu', 'font']),
'fonts' => true

View File

@ -158,7 +158,7 @@
<h4>Mise en forme du texte</h4>
<div class="row">
<div class="col6">
<?php echo template::select('themeTextFont', self::$fonts, [
<?php echo template::select('themeTextFont', $module::$fontsList, [
'label' => 'Police',
'selected' => $this->getData(['theme', 'text', 'font']),
'fonts' => true
@ -179,7 +179,7 @@
<h4>Mise en forme des titres</h4>
<div class="row">
<div class="col4">
<?php echo template::select('themeTitleFont', self::$fonts, [
<?php echo template::select('themeTitleFont', $module::$fontsList, [
'label' => 'Police',
'selected' => $this->getData(['theme', 'title', 'font']),
'fonts' => true

View File

@ -336,7 +336,7 @@ class user extends common {
* Liste des utilisateurs
*/
public function index() {
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames);
foreach($userIdsFirstnames as $userId => $userFirstname) {
if ($this->getData(['user', $userId, 'group'])) {
@ -399,7 +399,7 @@ class user extends common {
]
]);
// Verrouillage des IP
$ipBlackList = helper::arrayCollumn($this->getData(['blacklist']), 'ip');
$ipBlackList = helper::arrayColumn($this->getData(['blacklist']), 'ip');
if ( $this->getData(['blacklist',$userId,'connectFail']) >= $this->getData(['config', 'connect', 'attempt'])
AND in_array($this->getData(['blacklist',$userId,'ip']),$ipBlackList) ) {
$logStatus = 'Compte inconnu verrouillé';

View File

@ -144,8 +144,8 @@ class blog extends common {
$feeds->setDate(date('r',time()));
$feeds->addGenerator();
// Corps des articles
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC');
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC');
foreach( $articleIdsPublishedOns as $articleId => $articlePublishedOn ) {
if( $articlePublishedOn <= time() AND $articleIdsStates[$articleId] ) {
// Miniature
@ -234,7 +234,7 @@ class blog extends common {
]);
}
// Liste des utilisateurs
self::$users = helper::arrayCollumn($this->getData(['user']), 'firstname');
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname');
ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
@ -263,7 +263,7 @@ class blog extends common {
'value' => 'Tout effacer'
]);
// Ids des commentaires par ordre de création
$commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC'));
$commentIds = array_keys(helper::arrayColumn($comments, 'createdOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
// Liste des pages
@ -503,6 +503,78 @@ class blog extends common {
'state' => true
]);
} else {
// Ids des articles par ordre de publication
$articleIds = array_keys(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Gestion des droits d'accès
$filterData=[];
foreach ($articleIds as $key => $value) {
if (
( // Propriétaire
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
OR $this->getUser('group') === self::GROUP_ADMIN )
)
OR (
// Groupe
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
)
OR (
// Tout le monde
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
)
) {
$filterData[] = $value;
}
}
$articleIds = $filterData;
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Nombre de commentaires à approuver et approuvés
$approvals = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
if ( is_array($approvals) ) {
$a = array_values($approvals);
$toApprove = count(array_keys($a,false));
$approved = count(array_keys($a,true));
} else {
$toApprove = 0;
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
}
// Met en forme le tableau
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
self::$articles[] = [
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'</a>',
$date .' à '. $heure,
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [
'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' ,
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i] : '',
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved
]),
template::button('blogConfigEdit' . $articleIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('pencil')
]),
template::button('blogConfigDelete' . $articleIds[$i], [
'class' => 'blogConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel')
])
];
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Options de configuration',
@ -612,7 +684,7 @@ class blog extends common {
]);
}
// Liste des utilisateurs
self::$users = helper::arrayCollumn($this->getData(['user']), 'firstname');
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname');
ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) {
// Les membres ne sont pas éditeurs, les exclure de la liste
@ -726,7 +798,7 @@ class blog extends common {
// Ligne suivante si affichage du nombre total de commentaires approuvés sous l'article
self::$nbCommentsApproved = count($commentsApproved);
}
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
$commentIds = array_keys(helper::arrayColumn($commentsApproved, 'createdOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment');
// Liste des pages
@ -766,8 +838,8 @@ class blog extends common {
// Liste des articles
else {
// Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$articleIds = [];
foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {

View File

@ -106,6 +106,13 @@ class form extends common {
* Configuration
*/
public function config() {
// Liste des utilisateurs
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames);
self::$listUsers [] = '';
foreach($userIdsFirstnames as $userId => $userFirstname) {
self::$listUsers [] = $userId;
}
// Soumission du formulaire
if($this->isPost()) {
// Génération des données vides

View File

@ -78,7 +78,7 @@ function position() {
var inputUid = 0;
var inputs = <?php echo json_encode($this->getData(['module', $this->getUrl(0), 'input'])); ?>;
if(inputs) {
var inputsPerPosition = <?php echo json_encode(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'input']), 'position', 'SORT_ASC')); ?>;
var inputsPerPosition = <?php echo json_encode(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'input']), 'position', 'SORT_ASC')); ?>;
$.each(inputsPerPosition, function(id) {
add(inputUid, inputs[id]);
inputUid++;

View File

@ -320,7 +320,7 @@ class gallery extends common {
//Affichage de la galerie triée
$g = $this->getData(['module', $this->getUrl(0), 'content']);
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
$p = helper::arrayColumn(helper::arrayColumn($g,'config'),'position');
asort($p,SORT_NUMERIC);
$galleries = [];
foreach ($p as $positionId => $item) {
@ -678,7 +678,7 @@ class gallery extends common {
else {
// Tri des galeries suivant l'ordre défini
$g = $this->getData(['module', $this->getUrl(0), 'content']);
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
$p = helper::arrayColumn(helper::arrayColumn($g,'config'),'position');
asort($p,SORT_NUMERIC);
$galleries = [];
foreach ($p as $positionId => $item) {

View File

@ -114,8 +114,8 @@ class news extends common {
$feeds->setDate(date('r',time()));
$feeds->addGenerator();
// Corps des articles
$newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$newsIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$newsIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) {
$newsArticle = $feeds->createNewItem();
@ -166,7 +166,7 @@ class news extends common {
]);
}
// Liste des utilisateurs
self::$users = helper::arrayCollumn($this->getData(['user']), 'firstname');
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname');
ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
@ -290,6 +290,49 @@ class news extends common {
'state' => true
]);
} else {
// Ids des news par ordre de publication
$newsIds = array_keys(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
// Liste des pages
self::$pages = $pagination['pages'];
// News en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau
$dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
$dateOn .= ' à ';
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
$dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
$dateOff .= ' à ';
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
} else {
$dateOff = 'Permanent';
}
self::$news[] = [
$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
$dateOn,
$dateOff,
self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
template::button('newsConfigEdit' . $newsIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
'value' => template::ico('pencil')
]),
template::button('newsConfigDelete' . $newsIds[$i], [
'class' => 'newsConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel')
])
];
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Options de configuration',
@ -381,7 +424,7 @@ class news extends common {
]);
}
// Liste des utilisateurs
self::$users = helper::arrayCollumn($this->getData(['user']), 'firstname');
self::$users = helper::arrayColumn($this->getData(['user']), 'firstname');
ksort(self::$users);
foreach(self::$users as $userId => &$userFirstname) {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
@ -434,8 +477,8 @@ class news extends common {
} else {
// Affichage index
// Ids des news par ordre de publication
$newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$newsIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$newsIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$newsIds = [];
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
$newsIdsPublishedOff = $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'publishedOff']);