forked from ZwiiCMS-Team/ZwiiCMS
Normalisation + bugs de variables
This commit is contained in:
parent
32b4f3b7de
commit
469581e37f
@ -1,13 +1,15 @@
|
||||
<?php
|
||||
|
||||
class template {
|
||||
class template
|
||||
{
|
||||
|
||||
/**
|
||||
* retourne un texte traduit
|
||||
*/
|
||||
public static function topic($text) {
|
||||
public static function topic($text)
|
||||
{
|
||||
$text = helper::translate($text);
|
||||
return $text ;
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -16,7 +18,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function button($nameId, array $attributes = []) {
|
||||
public static function button($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'class' => '',
|
||||
@ -40,7 +43,7 @@ class template {
|
||||
$attributes['disabled'] ? 'disabled' : '',
|
||||
$attributes['class'],
|
||||
$attributes['uniqueSubmission'] ? 'uniqueSubmission' : '',
|
||||
$attributes['help'] ? ' title="' . $attributes['help'] . '" ': '',
|
||||
$attributes['help'] ? ' title="' . $attributes['help'] . '" ' : '',
|
||||
($attributes['ico'] ? template::ico($attributes['ico'], ['margin' => 'right']) : '') . $attributes['value']
|
||||
);
|
||||
}
|
||||
@ -51,7 +54,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function captcha($nameId, array $attributes = []) {
|
||||
public static function captcha($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'class' => '',
|
||||
@ -61,21 +65,21 @@ class template {
|
||||
'name' => $nameId,
|
||||
'value' => '',
|
||||
'limit' => false, // captcha simple
|
||||
'type'=> 'alpha' // num(érique) ou alpha(bétique)
|
||||
'type' => 'alpha' // num(érique) ou alpha(bétique)
|
||||
], $attributes);
|
||||
// Traduction de l'aide et de l'étiquette
|
||||
// $attributes['value'] = helper::translate($attributes['value']);
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
// Captcha quatre opérations
|
||||
// Limite addition et soustraction selon le type de captcha
|
||||
$numbers = [0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20];
|
||||
$letters = ['u','t','s','r','q','p','o','n','m','l','k','j','i','h','g','f','e','d','c','b','a'];
|
||||
$limit = $attributes['limit'] ? count($letters)-1 : 10;
|
||||
$numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20];
|
||||
$letters = ['u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'];
|
||||
$limit = $attributes['limit'] ? count($letters) - 1 : 10;
|
||||
|
||||
// Tirage de l'opération
|
||||
mt_srand((float) microtime()*1000000);
|
||||
mt_srand((float) microtime() * 1000000);
|
||||
// Captcha simple limité à l'addition
|
||||
$operator = $attributes['limit'] ? mt_rand (1, 4) : 1;
|
||||
$operator = $attributes['limit'] ? mt_rand(1, 4) : 1;
|
||||
|
||||
// Limite si multiplication ou division
|
||||
if ($operator > 2) {
|
||||
@ -83,10 +87,10 @@ class template {
|
||||
}
|
||||
|
||||
// Tirage des nombres
|
||||
mt_srand((float) microtime()*1000000);
|
||||
$firstNumber = mt_rand (1, $limit);
|
||||
mt_srand((float) microtime()*1000000);
|
||||
$secondNumber = mt_rand (1, $limit);
|
||||
mt_srand((float) microtime() * 1000000);
|
||||
$firstNumber = mt_rand(1, $limit);
|
||||
mt_srand((float) microtime() * 1000000);
|
||||
$secondNumber = mt_rand(1, $limit);
|
||||
|
||||
// Permutation si addition ou soustraction
|
||||
if (($operator < 3) and ($firstNumber < $secondNumber)) {
|
||||
@ -113,9 +117,9 @@ class template {
|
||||
$operator = template::ico('divide');
|
||||
$limit2 = [10, 10, 6, 5, 4, 3, 2, 2, 2, 2];
|
||||
for ($i = 1; $i <= $firstNumber; $i++) {
|
||||
$limit = $limit2[$i-1];
|
||||
$limit = $limit2[$i - 1];
|
||||
}
|
||||
mt_srand((float) microtime()*1000000);
|
||||
mt_srand((float) microtime() * 1000000);
|
||||
$secondNumber = mt_rand(1, $limit);
|
||||
$firstNumber = $firstNumber * $secondNumber;
|
||||
$result = $firstNumber / $secondNumber;
|
||||
@ -130,21 +134,24 @@ class template {
|
||||
$secondLetter = uniqid();
|
||||
|
||||
// Masquage image source pour éviter un décodage
|
||||
copy ('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$firstNumber] . '.png', 'site/tmp/' . $firstLetter . '.png');
|
||||
copy ('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$secondNumber] . '.png', 'site/tmp/' . $secondLetter . '.png');
|
||||
copy('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$firstNumber] . '.png', 'site/tmp/' . $firstLetter . '.png');
|
||||
copy('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$secondNumber] . '.png', 'site/tmp/' . $secondLetter . '.png');
|
||||
|
||||
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="captcha inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
$html .= self::label($attributes['id'],
|
||||
'<img class="captcha' . ucFirst($attributes['type']) . '" src="' . helper::baseUrl(false) . 'site/tmp/' . $firstLetter . '.png" /> <strong>' . $operator . '</strong> <img class="captcha' . ucFirst($attributes['type']) . '" src="' . helper::baseUrl(false) . 'site/tmp/' . $secondLetter . '.png" /> en chiffres ?', [
|
||||
$html .= self::label(
|
||||
$attributes['id'],
|
||||
'<img class="captcha' . ucFirst($attributes['type']) . '" src="' . helper::baseUrl(false) . 'site/tmp/' . $firstLetter . '.png" /> <strong>' . $operator . '</strong> <img class="captcha' . ucFirst($attributes['type']) . '" src="' . helper::baseUrl(false) . 'site/tmp/' . $secondLetter . '.png" /> en chiffres ?',
|
||||
[
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
@ -177,7 +184,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function checkbox($nameId, $value, $label, array $attributes = []) {
|
||||
public static function checkbox($nameId, $value, $label, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
@ -193,14 +201,14 @@ class template {
|
||||
$label = helper::translate($label);
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['checked'] = (bool) common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
@ -227,7 +235,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function date($nameId, array $attributes = []) {
|
||||
public static function date($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'autocomplete' => 'on',
|
||||
@ -249,23 +258,22 @@ class template {
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
//$attributes['placeholder'] = helper::translate($attributes['placeholder']);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['value'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$attributes['value'] = ($attributes['value'] ? helper::filter($attributes['value'], helper::FILTER_TIMESTAMP) : '');
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
if ($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
@ -295,7 +303,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function file($nameId, array $attributes = []) {
|
||||
public static function file($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
@ -316,20 +325,20 @@ class template {
|
||||
$attributes['value'] = helper::translate($attributes['value']);
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['value'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
$html .= self::notice($attributes['id'], $notice);
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
if ($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
@ -350,7 +359,7 @@ class template {
|
||||
'?relative_url=1' .
|
||||
'&field_id=' . $attributes['id'] .
|
||||
'&type=' . $attributes['type'] .
|
||||
'&akey=' . md5_file(core::DATA_DIR.'core.json') .
|
||||
'&akey=' . md5_file(core::DATA_DIR . 'core.json') .
|
||||
($attributes['extensions'] ? '&extensions=' . $attributes['extensions'] : '')
|
||||
. '"
|
||||
class="inputFile %s %s"
|
||||
@ -380,7 +389,8 @@ class template {
|
||||
* Ferme un formulaire
|
||||
* @return string
|
||||
*/
|
||||
public static function formClose() {
|
||||
public static function formClose()
|
||||
{
|
||||
return '</form>';
|
||||
}
|
||||
|
||||
@ -389,7 +399,8 @@ class template {
|
||||
* @param string $id Id du formulaire
|
||||
* @return string
|
||||
*/
|
||||
public static function formOpen($id) {
|
||||
public static function formOpen($id)
|
||||
{
|
||||
// Ouverture formulaire
|
||||
$html = '<form id="' . $id . '" method="post">';
|
||||
// Stock le token CSRF
|
||||
@ -407,7 +418,8 @@ class template {
|
||||
* @param string $text Texte de l'aide
|
||||
* @return string
|
||||
*/
|
||||
public static function help($text) {
|
||||
public static function help($text)
|
||||
{
|
||||
return '<span class="helpButton" data-tippy-content="' . $text . '">' . self::ico('help') . '<!----></span>';
|
||||
}
|
||||
|
||||
@ -417,7 +429,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function hidden($nameId, array $attributes = []) {
|
||||
public static function hidden($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
@ -429,7 +442,7 @@ class template {
|
||||
'value' => ''
|
||||
], $attributes);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['value'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Texte
|
||||
@ -451,7 +464,8 @@ class template {
|
||||
* @return string
|
||||
*/
|
||||
// public static function ico($ico, $margin = '', $animate = false, $fontSize = '1em') {
|
||||
public static function ico($ico, array $attributes = []) {
|
||||
public static function ico($ico, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'margin' => '',
|
||||
@ -465,7 +479,7 @@ class template {
|
||||
// Traduction de l'aide
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
// Contenu de l'icône
|
||||
$item = $attributes['href'] ? '<a id="' . $attributes['id']. '" data-tippy-content="' . $attributes['help'] . '" href="' . $attributes['href'] . '" ' . $attributes['attr']. ' >' : '';
|
||||
$item = $attributes['href'] ? '<a id="' . $attributes['id'] . '" data-tippy-content="' . $attributes['help'] . '" href="' . $attributes['href'] . '" ' . $attributes['attr'] . ' >' : '';
|
||||
$item .= '<span class="zwiico-' . $ico . ($attributes['margin'] ? ' zwiico-margin-' . $attributes['margin'] : '') . ($attributes['animate'] ? ' animate-spin' : '') . '" style="font-size:' . $attributes['fontSize'] . '"><!----></span>';
|
||||
$item .= ($attributes['href']) ? '</a>' : '';
|
||||
return $item;
|
||||
@ -477,26 +491,26 @@ class template {
|
||||
* @param string size en pixels ou en rem
|
||||
* @return string
|
||||
*/
|
||||
public static function flag($langId, $size = 'auto') {
|
||||
public static function flag($langId, $size = 'auto')
|
||||
{
|
||||
switch ($langId) {
|
||||
case '':
|
||||
$lang = 'fr_FR';
|
||||
break;
|
||||
case in_array($langId,core::$languages):
|
||||
case in_array($langId, core::$languages):
|
||||
$lang = $langId;
|
||||
break;
|
||||
case 'selected':
|
||||
if ( isset($_COOKIE['ZWII_I18N_SITE'])
|
||||
) {
|
||||
if (isset($_COOKIE['ZWII_I18N_SITE'])) {
|
||||
$lang = $_COOKIE['ZWII_I18N_SITE'];
|
||||
} else {
|
||||
$lang = 'fr_FR';
|
||||
}
|
||||
}
|
||||
return '<img class="flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $langId . '.png"
|
||||
width="' . $size .'"
|
||||
height="' . $size .'"
|
||||
title="' . $langId .'"
|
||||
width="' . $size . '"
|
||||
height="' . $size . '"
|
||||
title="' . $langId . '"
|
||||
alt="(' . $langId . ')"/>';
|
||||
}
|
||||
|
||||
@ -507,7 +521,8 @@ class template {
|
||||
* @param string $text Texte du label
|
||||
* @return string
|
||||
*/
|
||||
public static function label($for, $text, array $attributes = []) {
|
||||
public static function label($for, $text, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'class' => '',
|
||||
@ -515,12 +530,13 @@ class template {
|
||||
'help' => ''
|
||||
], $attributes);
|
||||
// Traduction de l'étiquette si déjà appelée par une fonction de template
|
||||
; if (
|
||||
;
|
||||
if (
|
||||
get_called_class() !== 'template'
|
||||
) {
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
}
|
||||
if($attributes['help'] !== '') {
|
||||
if ($attributes['help'] !== '') {
|
||||
$text = $text . self::help($attributes['help']);
|
||||
}
|
||||
// Retourne le html
|
||||
@ -537,7 +553,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function mail($nameId, array $attributes = []) {
|
||||
public static function mail($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'autocomplete' => 'on',
|
||||
@ -560,20 +577,20 @@ class template {
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
//$attributes['placeholder'] = helper::translate($attributes['placeholder']);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['value'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
if ($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
@ -595,7 +612,8 @@ class template {
|
||||
* @param string $notice Notice
|
||||
* @return string
|
||||
*/
|
||||
public static function notice($id, $notice) {
|
||||
public static function notice($id, $notice)
|
||||
{
|
||||
return ' <span id="' . $id . 'Notice" class="notice ' . ($notice ? '' : 'displayNone') . '">' . $notice . '</span>';
|
||||
}
|
||||
|
||||
@ -605,7 +623,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function password($nameId, array $attributes = []) {
|
||||
public static function password($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'autocomplete' => 'on',
|
||||
@ -628,14 +647,14 @@ class template {
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
if ($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
@ -658,7 +677,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function select($nameId, array $options, array $attributes = []) {
|
||||
public static function select($nameId, array $options, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
@ -682,29 +702,30 @@ class template {
|
||||
$attributes['fonts'] = [];
|
||||
}
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['selected'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
if ($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
$html .= self::notice($attributes['id'], $notice);
|
||||
// Début sélection
|
||||
$html .= sprintf('<select %s>',
|
||||
$html .= sprintf(
|
||||
'<select %s>',
|
||||
helper::sprintAttributes($attributes)
|
||||
);
|
||||
foreach($options as $value => $text) {
|
||||
foreach ($options as $value => $text) {
|
||||
// Select des liste de fontes
|
||||
$html .= isset($fonts) ? sprintf(
|
||||
'<option value="%s"%s style="font-family: %s;">%s</option>',
|
||||
@ -733,8 +754,9 @@ class template {
|
||||
* @param string $text Texte de la bulle
|
||||
* @return string
|
||||
*/
|
||||
public static function speech($text) {
|
||||
return '<div class="speech"><div class="speechBubble">' . $text . '</div>' . template::ico('mimi speechMimi', ['fontSize'=> '7em']) . '</div>';
|
||||
public static function speech($text)
|
||||
{
|
||||
return '<div class="speech"><div class="speechBubble">' . $text . '</div>' . template::ico('mimi speechMimi', ['fontSize' => '7em']) . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -743,7 +765,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function submit($nameId, array $attributes = []) {
|
||||
public static function submit($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'class' => '',
|
||||
@ -775,7 +798,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function table(array $cols = [], array $body = [], array $head = [], array $attributes = [], array $rowsId = []) {
|
||||
public static function table(array $cols = [], array $body = [], array $head = [], array $attributes = [], array $rowsId = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'class' => '',
|
||||
@ -783,20 +807,20 @@ class template {
|
||||
'id' => ''
|
||||
], $attributes);
|
||||
// Traduction de l'aide et de l'étiquette
|
||||
foreach($head as $value) {
|
||||
$head[array_search($value,$head)] = helper::translate($value);
|
||||
foreach ($head as $value) {
|
||||
$head[array_search($value, $head)] = helper::translate($value);
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="tableWrapper ' . $attributes['classWrapper']. '">';
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="tableWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Début tableau
|
||||
$html .= '<table id="' . $attributes['id'] . '" class="table ' . $attributes['class']. '">';
|
||||
$html .= '<table id="' . $attributes['id'] . '" class="table ' . $attributes['class'] . '">';
|
||||
// Entêtes
|
||||
if($head) {
|
||||
if ($head) {
|
||||
// Début des entêtes
|
||||
$html .= '<thead>';
|
||||
$html .= '<tr class="nodrag">';
|
||||
$i = 0;
|
||||
foreach($head as $th) {
|
||||
foreach ($head as $th) {
|
||||
$html .= '<th class="col' . $cols[$i++] . '">' . $th . '</th>';
|
||||
}
|
||||
// Fin des entêtes
|
||||
@ -805,15 +829,15 @@ class template {
|
||||
}
|
||||
// Pas de tableau d'Id transmis, générer une numérotation
|
||||
if (empty($rowsId)) {
|
||||
$rowsId = range(0,count($body));
|
||||
$rowsId = range(0, count($body));
|
||||
}
|
||||
// Début contenu
|
||||
$j = 0;
|
||||
foreach($body as $tr) {
|
||||
foreach ($body as $tr) {
|
||||
// Id de ligne pour les tableaux drag and drop
|
||||
$html .= '<tr id="' . $rowsId[$j++] . '">';
|
||||
$i = 0;
|
||||
foreach($tr as $td) {
|
||||
foreach ($tr as $td) {
|
||||
$html .= '<td class="col' . $cols[$i++] . '">' . $td . '</td>';
|
||||
}
|
||||
$html .= '</tr>';
|
||||
@ -834,7 +858,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function text($nameId, array $attributes = []) {
|
||||
public static function text($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'autocomplete' => 'on',
|
||||
@ -857,20 +882,20 @@ class template {
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
//$attributes['placeholder'] = helper::translate($attributes['placeholder']);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['value'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
if ($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
@ -892,7 +917,8 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function textarea($nameId, array $attributes = []) {
|
||||
public static function textarea($nameId, array $attributes = [])
|
||||
{
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
@ -912,20 +938,20 @@ class template {
|
||||
$attributes['label'] = helper::translate($attributes['label']);
|
||||
$attributes['help'] = helper::translate($attributes['help']);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
if ($attributes['before'] and array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['value'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
if ($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
if (array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
|
1448
core/core.php
1448
core/core.php
File diff suppressed because it is too large
Load Diff
@ -1,53 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Mises à jour suivant les versions de Zwii
|
||||
*/
|
||||
if($this->getData(['core', 'dataVersion']) < 9227) {
|
||||
*/
|
||||
if ($this->getData(['core', 'dataVersion']) < 9227) {
|
||||
// Arrêt du script
|
||||
exit('ZwiiCMS version 12 est incompatible avec la base de données installée. L\'installation d\'une version intermédiaire 10 ou 11 est nécessaire.');
|
||||
}
|
||||
|
||||
// Version 10.0.00
|
||||
if($this->getData(['core', 'dataVersion']) < 10000) {
|
||||
$this->setData(['config', 'faviconDark','faviconDark.ico']);
|
||||
if ($this->getData(['core', 'dataVersion']) < 10000) {
|
||||
$this->setData(['config', 'faviconDark', 'faviconDark.ico']);
|
||||
|
||||
//----------------------------------------
|
||||
// Mettre à jour les données des galeries
|
||||
$pageList = array();
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
// Mise à jour des données pour la galerie v2
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
//La page a une galerie
|
||||
if ($this->getData(['page',$parent,'moduleId']) === 'gallery' ) {
|
||||
if ($this->getData(['page', $parent, 'moduleId']) === 'gallery') {
|
||||
// Parcourir les dossiers de la galerie
|
||||
$tempData = $this->getData(['module', $parent]);
|
||||
$i = 1;
|
||||
foreach ($tempData as $galleryKey => $galleryItem) {
|
||||
// Ordre de tri des galeries
|
||||
if ( $this->getdata(['module',$parent,$galleryKey,'config','sort']) === NULL) {
|
||||
$this->setdata(['module',$parent,$galleryKey,'config','sort','SORT_ASC']);
|
||||
if ($this->getdata(['module', $parent, $galleryKey, 'config', 'sort']) === NULL) {
|
||||
$this->setdata(['module', $parent, $galleryKey, 'config', 'sort', 'SORT_ASC']);
|
||||
}
|
||||
// Position de la galerie, tri manuel
|
||||
if ( $this->getdata(['module',$parent,$galleryKey,'config','position']) === NULL) {
|
||||
$this->setdata(['module',$parent,$galleryKey,'config','position',$i++]);
|
||||
if ($this->getdata(['module', $parent, $galleryKey, 'config', 'position']) === NULL) {
|
||||
$this->setdata(['module', $parent, $galleryKey, 'config', 'position', $i++]);
|
||||
}
|
||||
// Positions des images, tri manuel
|
||||
if ( $this->getdata(['module',$parent,$galleryKey,'positions']) === NULL) {
|
||||
$c = count($this->getdata(['module',$parent,$galleryKey,'legend']));
|
||||
$this->setdata(['module',$parent,$galleryKey,'positions', range(0,$c-1) ]);
|
||||
if ($this->getdata(['module', $parent, $galleryKey, 'positions']) === NULL) {
|
||||
$c = count($this->getdata(['module', $parent, $galleryKey, 'legend']));
|
||||
$this->setdata(['module', $parent, $galleryKey, 'positions', range(0, $c - 1)]);
|
||||
}
|
||||
// Image de couverture
|
||||
if ( $this->getdata(['module',$parent,$galleryKey,'config','homePicture']) === NULL) {
|
||||
if (is_dir($this->getdata(['module',$parent,$galleryKey,'config','directory']))) {
|
||||
$iterator = new DirectoryIterator($this->getdata(['module',$parent,$galleryKey,'config','directory']));
|
||||
foreach($iterator as $fileInfos) {
|
||||
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
|
||||
$this->setdata(['module',$parent,$galleryKey,'config','homePicture',$fileInfos->getFilename()]);
|
||||
if ($this->getdata(['module', $parent, $galleryKey, 'config', 'homePicture']) === NULL) {
|
||||
if (is_dir($this->getdata(['module', $parent, $galleryKey, 'config', 'directory']))) {
|
||||
$iterator = new DirectoryIterator($this->getdata(['module', $parent, $galleryKey, 'config', 'directory']));
|
||||
foreach ($iterator as $fileInfos) {
|
||||
if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) {
|
||||
$this->setdata(['module', $parent, $galleryKey, 'config', 'homePicture', $fileInfos->getFilename()]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -58,7 +59,7 @@ if($this->getData(['core', 'dataVersion']) < 10000) {
|
||||
}
|
||||
// Contrôle des options php.ini pour la mise à jour auto
|
||||
if (helper::getUrlContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/version') === false) {
|
||||
$this->setData(['config','autoUpdate',false]);
|
||||
$this->setData(['config', 'autoUpdate', false]);
|
||||
}
|
||||
|
||||
$this->setData(['core', 'dataVersion', 10000]);
|
||||
@ -70,72 +71,74 @@ if ($this->getData(['core', 'dataVersion']) < 10092) {
|
||||
$dir = getcwd();
|
||||
chdir('core/vendor/fullpage');
|
||||
$files = glob('*');
|
||||
foreach($files as $file) unlink($file);
|
||||
foreach ($files as $file) unlink($file);
|
||||
chdir($dir);
|
||||
rmdir ('core/vendor/fullpage/');
|
||||
rmdir('core/vendor/fullpage/');
|
||||
}
|
||||
if (file_exists('core/vendor/tinymce/templates/fullPageSections.html')) {
|
||||
unlink ('core/vendor/tinymce/templates/fullPageSections.html'); }
|
||||
unlink('core/vendor/tinymce/templates/fullPageSections.html');
|
||||
}
|
||||
if (file_exists('core/vendor/tinymce/templates/fullPageSlides.html')) {
|
||||
unlink ('core/vendor/tinymce/templates/fullPageSlides.html'); }
|
||||
unlink('core/vendor/tinymce/templates/fullPageSlides.html');
|
||||
}
|
||||
$this->setData(['core', 'dataVersion', 10092]);
|
||||
}
|
||||
// Version 10.0.93
|
||||
if ($this->getData(['core', 'dataVersion']) < 10093) {
|
||||
// Déplacement du fichier admin.css dans data
|
||||
if (file_exists('core/layout/admin.css')) {
|
||||
copy('core/layout/admin.css',self::DATA_DIR.'admin.css');
|
||||
copy('core/layout/admin.css', self::DATA_DIR . 'admin.css');
|
||||
unlink('core/layout/admin.css');
|
||||
}
|
||||
//Déplacement d'un fichier de ressources
|
||||
if (file_exists('core/module/config/ressource/.htaccess')) {
|
||||
unlink('core/module/config/ressource/.htaccess');
|
||||
rmdir ('core/module/config/ressource');
|
||||
rmdir('core/module/config/ressource');
|
||||
}
|
||||
$this->setData(['core', 'dataVersion', 10093]);
|
||||
// Réorganisation du thème
|
||||
$this->setData(['theme','text','linkTextColor',$this->getData(['theme','link', 'textColor'])]);
|
||||
$this->setData(['theme', 'text', 'linkTextColor', $this->getData(['theme', 'link', 'textColor'])]);
|
||||
}
|
||||
// Version 10.1.04
|
||||
if ($this->getData(['core', 'dataVersion']) < 10104) {
|
||||
$this->setData(['theme','text','linkColor','rgba(74, 105, 189, 1)']);
|
||||
$this->deleteData(['theme','text','linkTextColor']);
|
||||
$this->setdata(['theme','block','backgroundColor','rgba(236, 239, 241, 1)']);
|
||||
$this->setdata(['theme','block','borderColor','rgba(236, 239, 241, 1)']);
|
||||
$this->setdata(['theme','menu','radius','0px']);
|
||||
$this->setData(['theme', 'text', 'linkColor', 'rgba(74, 105, 189, 1)']);
|
||||
$this->deleteData(['theme', 'text', 'linkTextColor']);
|
||||
$this->setdata(['theme', 'block', 'backgroundColor', 'rgba(236, 239, 241, 1)']);
|
||||
$this->setdata(['theme', 'block', 'borderColor', 'rgba(236, 239, 241, 1)']);
|
||||
$this->setdata(['theme', 'menu', 'radius', '0px']);
|
||||
$this->setData(['core', 'dataVersion', 10104]);
|
||||
}
|
||||
// Version 10.2.00
|
||||
if ($this->getData(['core', 'dataVersion']) < 10200) {
|
||||
// Paramètres du compte connecté
|
||||
if ($this->getUser('id')) {
|
||||
$this->setData(['user', $this->getUser('id'), 'connectFail',0]);
|
||||
$this->setData(['user', $this->getUser('id'), 'connectTimeout',0]);
|
||||
$this->setData(['user', $this->getUser('id'), 'accessTimer',0]);
|
||||
$this->setData(['user', $this->getUser('id'), 'accessUrl','']);
|
||||
$this->setData(['user', $this->getUser('id'), 'accessCsrf',$_SESSION['csrf']]);
|
||||
$this->setData(['user', $this->getUser('id'), 'connectFail', 0]);
|
||||
$this->setData(['user', $this->getUser('id'), 'connectTimeout', 0]);
|
||||
$this->setData(['user', $this->getUser('id'), 'accessTimer', 0]);
|
||||
$this->setData(['user', $this->getUser('id'), 'accessUrl', '']);
|
||||
$this->setData(['user', $this->getUser('id'), 'accessCsrf', $_SESSION['csrf']]);
|
||||
}
|
||||
// Paramètres de sécurité
|
||||
$this->setData(['config', 'connect', 'attempt',999]);
|
||||
$this->setData(['config', 'connect', 'timeout',0]);
|
||||
$this->setData(['config', 'connect', 'log',false]);
|
||||
$this->setData(['config', 'connect', 'attempt', 999]);
|
||||
$this->setData(['config', 'connect', 'timeout', 0]);
|
||||
$this->setData(['config', 'connect', 'log', false]);
|
||||
// Thème
|
||||
$this->deleteData(['admin','colorButtonText']);
|
||||
$this->deleteData(['admin', 'colorButtonText']);
|
||||
// Remettre à zéro le thème pour la génération du CSS du blog
|
||||
if (file_exists(self::DATA_DIR . 'theme.css')) {
|
||||
unlink(self::DATA_DIR . 'theme.css');
|
||||
}
|
||||
// Créer les en-têtes du journal
|
||||
$d = 'Date;Heure;IP;Id;Action' . PHP_EOL;
|
||||
file_put_contents(self::DATA_DIR . 'journal.log',$d);
|
||||
file_put_contents(self::DATA_DIR . 'journal.log', $d);
|
||||
// Init préservation htaccess
|
||||
$this->setData(['config','autoUpdateHtaccess',false]);
|
||||
$this->setData(['config', 'autoUpdateHtaccess', false]);
|
||||
// Options de barre de membre simple
|
||||
$this->setData(['theme','menu','memberBar',true]);
|
||||
$this->setData(['theme', 'menu', 'memberBar', true]);
|
||||
|
||||
// Thème Menu : couleur de page active non définie
|
||||
if (!$this->getData(['theme','menu','activeTextColor']) ) {
|
||||
$this->setData(['theme','menu','activeTextColor', $this->getData(['theme','menu','textColor']) ]);
|
||||
if (!$this->getData(['theme', 'menu', 'activeTextColor'])) {
|
||||
$this->setData(['theme', 'menu', 'activeTextColor', $this->getData(['theme', 'menu', 'textColor'])]);
|
||||
}
|
||||
$this->setData(['core', 'updateAvailable', false]);
|
||||
$this->setData(['core', 'dataVersion', 10200]);
|
||||
@ -143,52 +146,52 @@ if ($this->getData(['core', 'dataVersion']) < 10200) {
|
||||
// Version 10.2.01
|
||||
if ($this->getData(['core', 'dataVersion']) < 10201) {
|
||||
// Options de barre de membre simple
|
||||
$this->setData(['theme','footer','displayMemberBar',false]);
|
||||
$this->deleteData(['theme','footer','displayMemberAccount']);
|
||||
$this->deleteData(['theme','footer','displayMemberLogout']);
|
||||
$this->setData(['theme', 'footer', 'displayMemberBar', false]);
|
||||
$this->deleteData(['theme', 'footer', 'displayMemberAccount']);
|
||||
$this->deleteData(['theme', 'footer', 'displayMemberLogout']);
|
||||
$this->setData(['core', 'dataVersion', 10201]);
|
||||
}
|
||||
// Version 10.3.00
|
||||
if ($this->getData(['core', 'dataVersion']) < 10300) {
|
||||
// Options de barre de membre simple
|
||||
$this->setData(['config','page404','none']);
|
||||
$this->setData(['config','page403','none']);
|
||||
$this->setData(['config','page302','none']);
|
||||
$this->setData(['config', 'page404', 'none']);
|
||||
$this->setData(['config', 'page403', 'none']);
|
||||
$this->setData(['config', 'page302', 'none']);
|
||||
// Module de recherche
|
||||
// Suppression du dossier search
|
||||
if (is_dir('core/module/search')) {
|
||||
$dir = getcwd();
|
||||
chdir('core/module/search');
|
||||
$files = glob('*');
|
||||
foreach($files as $file) unlink($file);
|
||||
foreach ($files as $file) unlink($file);
|
||||
chdir($dir);
|
||||
rmdir ('core/module/search/');
|
||||
rmdir('core/module/search/');
|
||||
}
|
||||
// Désactivation de l'option dans le pied de page
|
||||
$this->setData(['theme','footer','displaySearch',false]);
|
||||
$this->setData(['theme', 'footer', 'displaySearch', false]);
|
||||
// Inscription des nouvelles variables
|
||||
$this->setData(['config','searchPageId','']);
|
||||
$this->setData(['config', 'searchPageId', '']);
|
||||
|
||||
// Mettre à jour les données des galeries
|
||||
$pageList = array();
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
// Mise à jour des données de thème de la galerie
|
||||
// Les données de thème sont communes au site
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
//La page a une galerie
|
||||
if ($this->getData(['page',$parent,'moduleId']) === 'gallery' ) {
|
||||
foreach ( $this->getData(['module', $parent]) as $galleryKey => $galleryItem) {
|
||||
if ($this->getData(['page', $parent, 'moduleId']) === 'gallery') {
|
||||
foreach ($this->getData(['module', $parent]) as $galleryKey => $galleryItem) {
|
||||
// Transfert du theme dans une structure unique
|
||||
if ( is_array($this->getdata(['theme',$parent])) ) {
|
||||
$this->setdata(['theme','gallery',$this->getdata(['theme',$parent])]);
|
||||
if (is_array($this->getdata(['theme', $parent]))) {
|
||||
$this->setdata(['theme', 'gallery', $this->getdata(['theme', $parent])]);
|
||||
}
|
||||
}
|
||||
$this->deleteData(['theme',$parent]);
|
||||
$this->deleteData(['theme', $parent]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,18 +201,18 @@ if ($this->getData(['core', 'dataVersion']) < 10300) {
|
||||
// Version 10.3.01
|
||||
if ($this->getData(['core', 'dataVersion']) < 10301) {
|
||||
// Inscription des nouvelles variables
|
||||
if ($this->getData(['config','searchPageId']) === '') {
|
||||
$this->setData(['config','searchPageId','none']);
|
||||
if ($this->getData(['config', 'searchPageId']) === '') {
|
||||
$this->setData(['config', 'searchPageId', 'none']);
|
||||
}
|
||||
if ($this->getData(['config','legalPageId']) === '') {
|
||||
$this->setData(['config','legalPageId','none']);
|
||||
if ($this->getData(['config', 'legalPageId']) === '') {
|
||||
$this->setData(['config', 'legalPageId', 'none']);
|
||||
}
|
||||
$this->setData(['core', 'dataVersion', 10301]);
|
||||
}
|
||||
// Version 10.3.02
|
||||
if ($this->getData(['core', 'dataVersion']) < 10302) {
|
||||
// Activation par défaut du captcha à la connexion
|
||||
$this->setData(['config', 'connect','captcha', true]);
|
||||
$this->setData(['config', 'connect', 'captcha', true]);
|
||||
$this->setData(['core', 'dataVersion', 10302]);
|
||||
}
|
||||
// Version 10.3.03
|
||||
@ -221,10 +224,10 @@ if ($this->getData(['core', 'dataVersion']) < 10303) {
|
||||
// Version 10.3.04
|
||||
if ($this->getData(['core', 'dataVersion']) < 10304) {
|
||||
// Couleur des sous menus
|
||||
$this->setData(['theme', 'menu', 'backgroundColorSub', $this->getData(['theme', 'menu', 'backgroundColor']) ]);
|
||||
$this->setData(['theme', 'menu', 'backgroundColorSub', $this->getData(['theme', 'menu', 'backgroundColor'])]);
|
||||
// Nettoyage du fichier de thème pour forcer une régénération
|
||||
if (file_exists(self::DATA_DIR . '/theme.css')) { // On ne sait jamais
|
||||
unlink (self::DATA_DIR . '/theme.css');
|
||||
unlink(self::DATA_DIR . '/theme.css');
|
||||
}
|
||||
$this->setData(['core', 'dataVersion', 10304]);
|
||||
}
|
||||
@ -232,35 +235,39 @@ if ($this->getData(['core', 'dataVersion']) < 10304) {
|
||||
if ($this->getData(['core', 'dataVersion']) < 10306) {
|
||||
// Liste des pages
|
||||
$pageList = array();
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
// Mettre à jour les données des blogs les articles sont dans posts
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
//La page a un blog
|
||||
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
|
||||
if ($this->getData(['page', $parent, 'moduleId']) === 'blog') {
|
||||
if (is_array($this->getData(['module', $parent]))) {
|
||||
foreach ( $this->getData(['module', $parent]) as $blogKey => $blogItem) {
|
||||
if ($blogKey === 'posts' OR $blogKey === 'config') {continue;}
|
||||
$data = $this->getdata(['module',$parent,$blogKey]);
|
||||
$this->deleteData(['module',$parent, $blogKey]);
|
||||
$this->setData([ 'module', $parent, 'posts', $blogKey, $data ]);
|
||||
foreach ($this->getData(['module', $parent]) as $blogKey => $blogItem) {
|
||||
if ($blogKey === 'posts' or $blogKey === 'config') {
|
||||
continue;
|
||||
}
|
||||
$data = $this->getdata(['module', $parent, $blogKey]);
|
||||
$this->deleteData(['module', $parent, $blogKey]);
|
||||
$this->setData(['module', $parent, 'posts', $blogKey, $data]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
//La page a une news
|
||||
if ($this->getData(['page',$parent,'moduleId']) === 'news' ) {
|
||||
if ($this->getData(['page', $parent, 'moduleId']) === 'news') {
|
||||
if (is_array($this->getData(['module', $parent]))) {
|
||||
foreach ( $this->getData(['module', $parent]) as $newsKey => $newsItem) {
|
||||
if ($blogKey === 'posts' OR $blogKey === 'config') {continue;}
|
||||
$data = $this->getdata(['module',$parent,$newsKey]);
|
||||
$this->deleteData(['module',$parent, $newsKey]);
|
||||
$this->setData([ 'module', $parent, 'posts', $newsKey, $data ]);
|
||||
foreach ($this->getData(['module', $parent]) as $newsKey => $newsItem) {
|
||||
if ($blogKey === 'posts' or $blogKey === 'config') {
|
||||
continue;
|
||||
}
|
||||
$data = $this->getdata(['module', $parent, $newsKey]);
|
||||
$this->deleteData(['module', $parent, $newsKey]);
|
||||
$this->setData(['module', $parent, 'posts', $newsKey, $data]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -271,103 +278,101 @@ if ($this->getData(['core', 'dataVersion']) < 10306) {
|
||||
// Version 10.3.08
|
||||
if ($this->getData(['core', 'dataVersion']) < 10308) {
|
||||
// RAZ la mise à jour auto bug 10.3.07
|
||||
$this->setData(['core','updateAvailable', false]);
|
||||
$this->setData(['core', 'dataVersion', 10308]);
|
||||
$this->setData(['core', 'updateAvailable', false]);
|
||||
$this->setData(['core', 'dataVersion', 10308]);
|
||||
}
|
||||
|
||||
// Version 10.4.00
|
||||
if ($this->getData(['core', 'dataVersion']) < 10400) {
|
||||
// Ajouter le prénom comme pseudo et le pseudo comme signature
|
||||
foreach($this->getData(['user']) as $userId => $userIds){
|
||||
$this->setData(['user',$userId,'pseudo',$this->getData(['user',$userId,'firstname'])]);
|
||||
$this->setData(['user',$userId,'signature',2]);
|
||||
foreach ($this->getData(['user']) as $userId => $userIds) {
|
||||
$this->setData(['user', $userId, 'pseudo', $this->getData(['user', $userId, 'firstname'])]);
|
||||
$this->setData(['user', $userId, 'signature', 2]);
|
||||
}
|
||||
|
||||
// Ajouter les champs de blog v3
|
||||
// Liste des pages dans pageList
|
||||
$pageList = array();
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
// Parcourir pageList et rechercher les modules de blog
|
||||
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
//La page est un blog
|
||||
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
|
||||
if ($this->getData(['page', $parent, 'moduleId']) === 'blog') {
|
||||
$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]);
|
||||
$this->setData(['module', $parent, 'posts', $article, 'editConsent', 3]);
|
||||
// Limite de taille 500
|
||||
$this->setData(['module', $parent, 'posts', $article,'commentMaxlength', '500']);
|
||||
$this->setData(['module', $parent, 'posts', $article, 'commentMaxlength', '500']);
|
||||
// Pas d'approbation des commentaires
|
||||
$this->setData(['module', $parent, 'posts', $article,'commentApproved', false ]);
|
||||
$this->setData(['module', $parent, 'posts', $article, 'commentApproved', false]);
|
||||
// pas de notification
|
||||
$this->setData(['module', $parent, 'posts', $article,'commentNotification', false ]);
|
||||
$this->setData(['module', $parent, 'posts', $article, 'commentNotification', false]);
|
||||
// groupe de notification
|
||||
$this->setData(['module', $parent, 'posts', $article,'commentGroupNotification', 3 ]);
|
||||
$this->setData(['module', $parent, 'posts', $article, 'commentGroupNotification', 3]);
|
||||
}
|
||||
|
||||
// Traitement des commentaires
|
||||
if ( is_array($this->getData(['module', $parent, 'posts', $article,'comment'])) ) {
|
||||
foreach($this->getData(['module', $parent, 'posts', $article,'comment']) as $commentId => $comment) {
|
||||
if (is_array($this->getData(['module', $parent, 'posts', $article, 'comment']))) {
|
||||
foreach ($this->getData(['module', $parent, 'posts', $article, 'comment']) as $commentId => $comment) {
|
||||
// Approbation
|
||||
$this->setData(['module', $parent, 'posts', $article,'comment', $commentId, 'approval', true ]);
|
||||
$this->setData(['module', $parent, 'posts', $article, 'comment', $commentId, 'approval', true]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Création du fichier locale.json
|
||||
$this->setData(['locale','homePageId',$this->getData(['config','homePageId'])]);
|
||||
$this->setData(['locale','page404',$this->getData(['config','page404'])]);
|
||||
$this->setData(['locale','page403',$this->getData(['config','page403'])]);
|
||||
$this->setData(['locale','page302',$this->getData(['config','page302'])]);
|
||||
$this->setData(['locale','legalPageId',$this->getData(['config','legalPageId'])]);
|
||||
$this->setData(['locale','searchPageId',$this->getData(['config','searchPageId'])]);
|
||||
$this->setData(['locale','metaDescription',$this->getData(['config','metaDescription'])]);
|
||||
$this->setData(['locale','title',$this->getData(['config','title'])]);
|
||||
$this->setData(['locale', 'homePageId', $this->getData(['config', 'homePageId'])]);
|
||||
$this->setData(['locale', 'page404', $this->getData(['config', 'page404'])]);
|
||||
$this->setData(['locale', 'page403', $this->getData(['config', 'page403'])]);
|
||||
$this->setData(['locale', 'page302', $this->getData(['config', 'page302'])]);
|
||||
$this->setData(['locale', 'legalPageId', $this->getData(['config', 'legalPageId'])]);
|
||||
$this->setData(['locale', 'searchPageId', $this->getData(['config', 'searchPageId'])]);
|
||||
$this->setData(['locale', 'metaDescription', $this->getData(['config', 'metaDescription'])]);
|
||||
$this->setData(['locale', 'title', $this->getData(['config', 'title'])]);
|
||||
|
||||
// Renommer les fichier de backup
|
||||
if ($this->getInput('configAdvancedFileBackup', helper::FILTER_BOOLEAN) === false) {
|
||||
$path = realpath('site/data');
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
|
||||
{
|
||||
if (strpos($filename,'back.json')) {
|
||||
rename($filename, str_replace('back.json','backup.json',$filename));
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) {
|
||||
if (strpos($filename, 'back.json')) {
|
||||
rename($filename, str_replace('back.json', 'backup.json', $filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer les fichiers CSS devenus inutiles du module search
|
||||
if (file_exists('module/search/ressource/theme.css') )
|
||||
if (file_exists('module/search/ressource/theme.css'))
|
||||
unlink('module/search/ressource/theme.css');
|
||||
if (file_exists('module/search/ressource/vartheme.css') )
|
||||
if (file_exists('module/search/ressource/vartheme.css'))
|
||||
unlink('module/search/ressource/vartheme.css');
|
||||
$this->deleteData(['theme','search','keywordColor']);
|
||||
$this->deleteData(['theme', 'search', 'keywordColor']);
|
||||
|
||||
// Nettoyer les modules avec des données null
|
||||
|
||||
$modules = $this->getData(['module']);
|
||||
foreach($modules as $key => $value) {
|
||||
if (is_null($value) ) {
|
||||
foreach ($modules as $key => $value) {
|
||||
if (is_null($value)) {
|
||||
unset($modules[$key]);
|
||||
}
|
||||
}
|
||||
$this->setData (['module',$modules]);
|
||||
$this->setData(['module', $modules]);
|
||||
|
||||
$this->setData(['core', 'dataVersion', 10400]);
|
||||
|
||||
}
|
||||
|
||||
// Version 10.5.02
|
||||
if ($this->getData(['core', 'dataVersion']) < 10502) {
|
||||
// Forcer la régénération du thème
|
||||
if (file_exists(self::DATA_DIR.'theme.css')) {
|
||||
unlink (self::DATA_DIR.'theme.css');
|
||||
if (file_exists(self::DATA_DIR . 'theme.css')) {
|
||||
unlink(self::DATA_DIR . 'theme.css');
|
||||
}
|
||||
$this->setData(['core', 'dataVersion', 10502]);
|
||||
}
|
||||
@ -379,57 +384,56 @@ if ($this->getData(['core', 'dataVersion']) < 10600) {
|
||||
|
||||
// Liste des pages dans pageList
|
||||
$pageList = array();
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
// Parcourir pageList et rechercher les modules au CSS autonomes
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
if (
|
||||
$this->getData(['page',$parent,'moduleId']) === 'search'
|
||||
|| $this->getData(['page',$parent,'moduleId']) === 'gallery'
|
||||
|| $this->getData(['page',$parent,'moduleId']) === 'news'
|
||||
){
|
||||
if(class_exists($parent)) {
|
||||
$this->getData(['page', $parent, 'moduleId']) === 'search'
|
||||
|| $this->getData(['page', $parent, 'moduleId']) === 'gallery'
|
||||
|| $this->getData(['page', $parent, 'moduleId']) === 'news'
|
||||
) {
|
||||
if (class_exists($parent)) {
|
||||
$module = new $moduleId;
|
||||
$module->update($parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Suppression de l'option d'objets par page gérées par les modules
|
||||
$this->deleteData(['config','itemsperPage']);
|
||||
// Suppression de l'option d'objets par page gérées par les modules
|
||||
$this->deleteData(['config', 'itemsperPage']);
|
||||
|
||||
$this->setData(['core', 'dataVersion', 10600]);
|
||||
$this->setData(['core', 'dataVersion', 10600]);
|
||||
}
|
||||
|
||||
// Version 11.0.00
|
||||
if ($this->getData(['core', 'dataVersion']) < 11000) {
|
||||
|
||||
// Option de déconnexion auto activée
|
||||
$this->setData(['config','autoDisconnect',true]);
|
||||
$this->setData(['config', 'autoDisconnect', true]);
|
||||
|
||||
// Mettre à jour les données de langue
|
||||
$this->setData(['config', 'i18n', 'enable', true ]);
|
||||
$this->setData(['config', 'i18n','scriptGoogle', false ]);
|
||||
$this->setData(['config', 'i18n','showCredits', false ]);
|
||||
$this->setData(['config', 'i18n','autoDetect', false ]);
|
||||
$this->setData(['config', 'i18n','admin', false ]);
|
||||
$this->setData(['config', 'i18n','fr', 'none' ]);
|
||||
$this->setData(['config', 'i18n','de', 'none' ]);
|
||||
$this->setData(['config', 'i18n','en', 'none' ]);
|
||||
$this->setData(['config', 'i18n','es', 'none' ]);
|
||||
$this->setData(['config', 'i18n','it', 'none' ]);
|
||||
$this->setData(['config', 'i18n','nl', 'none' ]);
|
||||
$this->setData(['config', 'i18n','pt', 'none' ]);
|
||||
$this->setData(['config', 'i18n', 'enable', true]);
|
||||
$this->setData(['config', 'i18n', 'scriptGoogle', false]);
|
||||
$this->setData(['config', 'i18n', 'showCredits', false]);
|
||||
$this->setData(['config', 'i18n', 'autoDetect', false]);
|
||||
$this->setData(['config', 'i18n', 'admin', false]);
|
||||
$this->setData(['config', 'i18n', 'fr', 'none']);
|
||||
$this->setData(['config', 'i18n', 'de', 'none']);
|
||||
$this->setData(['config', 'i18n', 'en', 'none']);
|
||||
$this->setData(['config', 'i18n', 'es', 'none']);
|
||||
$this->setData(['config', 'i18n', 'it', 'none']);
|
||||
$this->setData(['config', 'i18n', 'nl', 'none']);
|
||||
$this->setData(['config', 'i18n', 'pt', 'none']);
|
||||
|
||||
// Supprimer les fichiers de backup
|
||||
if (file_exists('site/data/.backup')) unlink('site/data/.backup');
|
||||
$path = realpath('site/data');
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
|
||||
{
|
||||
if (strpos($filename,'backup.json')) {
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) {
|
||||
if (strpos($filename, 'backup.json')) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
@ -441,10 +445,10 @@ if ($this->getData(['core', 'dataVersion']) < 11000) {
|
||||
if (!is_dir(self::DATA_DIR . self::$i18nContent . '/content')) {
|
||||
mkdir(self::DATA_DIR . self::$i18nContent . '/content', 0755);
|
||||
}
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
@ -455,7 +459,7 @@ if ($this->getData(['core', 'dataVersion']) < 11000) {
|
||||
}
|
||||
|
||||
// Référencement
|
||||
$this->setData(['config','seo','robots',true]);
|
||||
$this->setData(['config', 'seo', 'robots', true]);
|
||||
|
||||
$this->setData(['core', 'dataVersion', 11000]);
|
||||
}
|
||||
@ -466,7 +470,7 @@ if ($this->getData(['core', 'dataVersion']) < 11010) {
|
||||
// Renommer une variable
|
||||
$data = $this->getData(['config', 'i18n', 'active']);
|
||||
$this->deleteData(['config', 'i18n', 'active']);
|
||||
$this->setData(['config', 'i18n', 'enable', $data ]);
|
||||
$this->setData(['config', 'i18n', 'enable', $data]);
|
||||
|
||||
$this->setData(['core', 'dataVersion', 11010]);
|
||||
}
|
||||
@ -475,7 +479,7 @@ if ($this->getData(['core', 'dataVersion']) < 11010) {
|
||||
if ($this->getData(['core', 'dataVersion']) < 11100) {
|
||||
|
||||
// Anonymat des adresses iP de la journalisation
|
||||
$this->setData(['config', 'connect', 'anonymousIp', 2 ]);
|
||||
$this->setData(['config', 'connect', 'anonymousIp', 2]);
|
||||
|
||||
// Nouvelles options de contenu pour les écrans réduits
|
||||
if ($this->getData(['theme', 'menu', 'burgerTitle'])) {
|
||||
@ -499,14 +503,14 @@ if ($this->getData(['core', 'dataVersion']) < 11200) {
|
||||
$this->setData(['config', 'connect', 'captchaType', 'alpha']);
|
||||
|
||||
// Ajout de la variable shortTitle basée sur Title
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
$this->setData(['page', $parent, 'shortTitle', $this->getData(['page', $parent, 'title']) ]);
|
||||
$this->setData(['page', $parent, 'shortTitle', $this->getData(['page', $parent, 'title'])]);
|
||||
}
|
||||
|
||||
// Incorporer les nouveaux champs du header et du menu
|
||||
@ -524,7 +528,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) {
|
||||
$this->setData(['locale', 'cookies', 'cookiesButtonText', 'J\'ai compris']);
|
||||
|
||||
// Supppression de l'option de traduction en mode connecté
|
||||
$this->setData(['config','i18n', 'admin', false]);
|
||||
$this->setData(['config', 'i18n', 'admin', false]);
|
||||
|
||||
// Option de dévoilement du mdp
|
||||
$this->setData(['config', 'connect', 'showPassword', true]);
|
||||
@ -537,12 +541,12 @@ if ($this->getData(['core', 'dataVersion']) < 11200) {
|
||||
if ($this->getData(['core', 'dataVersion']) < 11202) {
|
||||
|
||||
// Renommer les champs
|
||||
$this->setData(['locale', 'cookies', 'mainLabel', $this->getData(['locale', 'cookies', 'cookiesZwiiText']) ]);
|
||||
$this->setData(['locale', 'cookies', 'gaLabel', $this->getData(['locale', 'cookies', 'cookiesGaText']) ]);
|
||||
$this->setData(['locale', 'cookies', 'titleLabel', $this->getData(['locale', 'cookies', 'cookiesTitleText']) ]);
|
||||
$this->setData(['locale', 'cookies', 'linkLegalLabel', $this->getData(['locale', 'cookies', 'cookiesLinkMlText']) ]);
|
||||
$this->setData(['locale', 'cookies', 'checkboxGaLabel', $this->getData(['locale', 'cookies', 'cookiesCheckboxGaText']) ]);
|
||||
$this->setData(['locale', 'cookies', 'buttonValidLabel',$this->getData(['locale', 'cookies', 'cookiesButtonText']) ]);
|
||||
$this->setData(['locale', 'cookies', 'mainLabel', $this->getData(['locale', 'cookies', 'cookiesZwiiText'])]);
|
||||
$this->setData(['locale', 'cookies', 'gaLabel', $this->getData(['locale', 'cookies', 'cookiesGaText'])]);
|
||||
$this->setData(['locale', 'cookies', 'titleLabel', $this->getData(['locale', 'cookies', 'cookiesTitleText'])]);
|
||||
$this->setData(['locale', 'cookies', 'linkLegalLabel', $this->getData(['locale', 'cookies', 'cookiesLinkMlText'])]);
|
||||
$this->setData(['locale', 'cookies', 'checkboxGaLabel', $this->getData(['locale', 'cookies', 'cookiesCheckboxGaText'])]);
|
||||
$this->setData(['locale', 'cookies', 'buttonValidLabel', $this->getData(['locale', 'cookies', 'cookiesButtonText'])]);
|
||||
// Effacer les anciens champs
|
||||
$this->deleteData(['locale', 'cookies', 'cookiesZwiiText']);
|
||||
$this->deleteData(['locale', 'cookies', 'cookiesGaText']);
|
||||
@ -558,28 +562,28 @@ if ($this->getData(['core', 'dataVersion']) < 11202) {
|
||||
// Version 11.2.03
|
||||
if ($this->getData(['core', 'dataVersion']) < 11203) {
|
||||
// Supprimer l'information de redirection
|
||||
$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
$old = str_replace('?', '', $this->getData(['core', 'baseUrl']));
|
||||
$new = '';
|
||||
$c3 = 0;
|
||||
$success = false ;
|
||||
$success = false;
|
||||
// Boucler sur les pages
|
||||
foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) {
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentId => $childIds) {
|
||||
$content = $this->getPage($parentId, self::$i18nContent);
|
||||
$titre = $this->getData(['page', $parentId, 'title']);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
$content = $titre . ' ' . $content;
|
||||
$replace = str_replace('href="' . $old, 'href="' . $new, stripslashes($content), $c1);
|
||||
$replace = str_replace('src="' . $old, 'src="' . $new, stripslashes($replace), $c2);
|
||||
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
$this->setPage($parentId, $replace, self::$i18nContent);
|
||||
$c3 += $c1 + $c2;
|
||||
}
|
||||
foreach($childIds as $childId) {
|
||||
foreach ($childIds as $childId) {
|
||||
$content = $this->getPage($childId, self::$i18nContent);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
$content = $titre . ' ' . $content;
|
||||
$replace = str_replace('href="' . $old, 'href="' . $new, stripslashes($content), $c1);
|
||||
$replace = str_replace('src="' . $old, 'src="' . $new, stripslashes($replace), $c2);
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
$this->setPage($childId, $replace, self::$i18nContent);
|
||||
@ -589,10 +593,10 @@ if ($this->getData(['core', 'dataVersion']) < 11203) {
|
||||
}
|
||||
// Traiter les modules dont la redirection
|
||||
$content = $this->getdata(['module']);
|
||||
$replace = $this->recursive_array_replace('href="' . $old , 'href="'. $new, $content, $c1);
|
||||
$replace = $this->recursive_array_replace('src="' . $old , 'src="'. $new, $replace, $c2);
|
||||
$replace = $this->recursive_array_replace('href="' . $old, 'href="' . $new, $content, $c1);
|
||||
$replace = $this->recursive_array_replace('src="' . $old, 'src="' . $new, $replace, $c2);
|
||||
if ($content !== $replace) {
|
||||
$this->setdata(['module',$replace]);
|
||||
$this->setdata(['module', $replace]);
|
||||
$c3 += $c1 + $c2;
|
||||
$success = true;
|
||||
}
|
||||
@ -619,19 +623,19 @@ if ($this->getData(['core', 'dataVersion']) < 11300) {
|
||||
'Droid+Serif' => 'droid-serif-2',
|
||||
'Fira+Sans' => 'fira-sans',
|
||||
'Inconsolata' => 'inconsolata-2',
|
||||
'Indie+Flower' =>'indie-flower',
|
||||
'Indie+Flower' => 'indie-flower',
|
||||
'Josefin+Slab' => 'josefin-sans-std',
|
||||
'Lobster' => 'lobster-2',
|
||||
'Lora' => 'lora',
|
||||
'Lato' =>'lato',
|
||||
'Lato' => 'lato',
|
||||
'Marvel' => 'montserrat-ace',
|
||||
'Old+Standard+TT' => 'old-standard-tt-3',
|
||||
'Open+Sans' =>'open-sans',
|
||||
'Open+Sans' => 'open-sans',
|
||||
// Corriger l'erreur de nom de police installée par défaut, il manquait un O en majuscule
|
||||
'open+Sans' =>'open-sans',
|
||||
'Oswald' =>'oswald-4',
|
||||
'open+Sans' => 'open-sans',
|
||||
'Oswald' => 'oswald-4',
|
||||
'PT+Mono' => 'pt-mono',
|
||||
'PT+Serif' =>'pt-serif',
|
||||
'PT+Serif' => 'pt-serif',
|
||||
'Raleway' => 'raleway-5',
|
||||
'Rancho' => 'rancho',
|
||||
'Roboto' => 'Roboto',
|
||||
@ -640,13 +644,13 @@ if ($this->getData(['core', 'dataVersion']) < 11300) {
|
||||
'Vollkorn' => 'vollkorn'
|
||||
];
|
||||
|
||||
$this->setData(['theme', 'footer', 'font', $fonts[$this->getData (['theme', 'footer', 'font']) ] ]);
|
||||
$this->setData(['theme', 'header', 'font', $fonts[$this->getData (['theme', 'header', 'font' ]) ] ]);
|
||||
$this->setData(['theme', 'menu', 'font', $fonts[$this->getData (['theme', 'menu', 'font' ]) ] ]);
|
||||
$this->setData(['theme', 'text', 'font', $fonts[$this->getData (['theme', 'text', 'font' ]) ] ]);
|
||||
$this->setData(['theme', 'title', 'font', $fonts[ $this->getData (['theme', 'title', 'font' ]) ] ]);
|
||||
$this->setData(['admin', 'fontTitle', $fonts[ $this->getData (['admin', 'fontTitle' ]) ] ]);
|
||||
$this->setData(['admin', 'fontText', $fonts[$this->getData (['admin','fontText' ]) ] ]);
|
||||
$this->setData(['theme', 'footer', 'font', $fonts[$this->getData(['theme', 'footer', 'font'])]]);
|
||||
$this->setData(['theme', 'header', 'font', $fonts[$this->getData(['theme', 'header', 'font'])]]);
|
||||
$this->setData(['theme', 'menu', 'font', $fonts[$this->getData(['theme', 'menu', 'font'])]]);
|
||||
$this->setData(['theme', 'text', 'font', $fonts[$this->getData(['theme', 'text', 'font'])]]);
|
||||
$this->setData(['theme', 'title', 'font', $fonts[$this->getData(['theme', 'title', 'font'])]]);
|
||||
$this->setData(['admin', 'fontTitle', $fonts[$this->getData(['admin', 'fontTitle'])]]);
|
||||
$this->setData(['admin', 'fontText', $fonts[$this->getData(['admin', 'fontText'])]]);
|
||||
|
||||
unlink(self::DATA_DIR . 'admin.css');
|
||||
unlink(self::DATA_DIR . 'theme.css');
|
||||
@ -659,10 +663,10 @@ if ($this->getData(['core', 'dataVersion']) < 11300) {
|
||||
if ($this->getData(['core', 'dataVersion']) < 11303) {
|
||||
|
||||
// Ajout de la variable shortTitle basée sur Title
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($this->getHierarchy(null, null, null) as $parentKey => $parentValue) {
|
||||
$pageList[] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
$pageList [] = $childKey;
|
||||
$pageList[] = $childKey;
|
||||
}
|
||||
}
|
||||
foreach ($pageList as $parentKey => $parent) {
|
||||
@ -674,13 +678,13 @@ if ($this->getData(['core', 'dataVersion']) < 11303) {
|
||||
}
|
||||
|
||||
|
||||
// Version 11.3.06
|
||||
// Version 11.3.06
|
||||
if ($this->getData(['core', 'dataVersion']) < 11306) {
|
||||
|
||||
// Supprime les fontes déclarées en double par la version précédentes
|
||||
$files = $this->getData(['fonts', 'files']);
|
||||
foreach ($files as $fontId => $fontFile) {
|
||||
if ( !is_null($this->getData(['fonts', 'imported', $fontId])) ) {
|
||||
if (!is_null($this->getData(['fonts', 'imported', $fontId]))) {
|
||||
$this->deleteData(['fonts', 'imported', $fontId]);
|
||||
}
|
||||
}
|
||||
@ -692,13 +696,13 @@ if ($this->getData(['core', 'dataVersion']) < 11306) {
|
||||
if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
|
||||
// Effacer le dossier
|
||||
if (is_dir('core/module/addon') ) {
|
||||
if (is_dir('core/module/addon')) {
|
||||
$this->removeDir('core/module/addon');
|
||||
}
|
||||
|
||||
|
||||
$fonts = [
|
||||
'arimo'=> [
|
||||
'arimo' => [
|
||||
'name' => 'Arimo',
|
||||
'font-family' => 'Arimo, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/arimo'
|
||||
@ -708,17 +712,17 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
'font-family' => '\'Dancing Script\', sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/dancing-script'
|
||||
],
|
||||
'droid-sans-2'=> [
|
||||
'droid-sans-2' => [
|
||||
'name' => 'Droid Sans',
|
||||
'font-family' => '\'Droid Sans\', sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/droid-sans-2'
|
||||
],
|
||||
'droid-serif-2'=> [
|
||||
'droid-serif-2' => [
|
||||
'name' => 'Droid Serif',
|
||||
'font-family' => '\'Droid Serif\', serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/droid-serif-2'
|
||||
],
|
||||
'indie-flower'=> [
|
||||
'indie-flower' => [
|
||||
'name' => 'Indie Flower',
|
||||
'font-family' => '\'Indie Flower\', sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/indie-flower'
|
||||
@ -728,27 +732,27 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
'font-family' => '\'Fira Sans\', sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/fira-sans'
|
||||
],
|
||||
'liberation-sans'=> [
|
||||
'liberation-sans' => [
|
||||
'name' => 'Liberation Sans',
|
||||
'font-family' => '\'Liberation Sans\', sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/liberation-sans'
|
||||
],
|
||||
'liberation-serif'=> [
|
||||
'liberation-serif' => [
|
||||
'name' => 'Liberation Serif',
|
||||
'font-family' => '\'Liberation Serif\', serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/liberation-serif'
|
||||
],
|
||||
'lobster-2'=> [
|
||||
'lobster-2' => [
|
||||
'name' => 'Lobster',
|
||||
'font-family' => 'Lobster, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/lobster-2'
|
||||
],
|
||||
'lato'=> [
|
||||
'lato' => [
|
||||
'name' => 'lato',
|
||||
'font-family' => 'Lato, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/lato'
|
||||
],
|
||||
'old-standard-tt-3'=> [
|
||||
'old-standard-tt-3' => [
|
||||
'name' => 'Old Standard TT',
|
||||
'font-family' => '\'Old Standard TT\', serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/old-standard-tt-3'
|
||||
@ -758,32 +762,32 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
'font-family' => '\'Open Sans\', sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/open-sans'
|
||||
],
|
||||
'oswald-4'=> [
|
||||
'oswald-4' => [
|
||||
'name' => 'Oswald',
|
||||
'font-family' => 'Oswald, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/oswald-4'
|
||||
],
|
||||
'pt-mono'=> [
|
||||
'pt-mono' => [
|
||||
'name' => 'PT Mono',
|
||||
'font-family' => '\'PT Mono\', monospace',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/pt-mono'
|
||||
],
|
||||
'pt-serif'=> [
|
||||
'pt-serif' => [
|
||||
'name' => 'PR Serif',
|
||||
'font-family' => '\'PT Serif\', serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/pt-serif'
|
||||
],
|
||||
'rancho'=> [
|
||||
'rancho' => [
|
||||
'name' => 'Rancho',
|
||||
'font-family' => 'Rancho, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/rancho'
|
||||
],
|
||||
'ubuntu'=> [
|
||||
'ubuntu' => [
|
||||
'name' => 'Ubuntu',
|
||||
'font-family' => 'Ubuntu, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/ubuntu'
|
||||
],
|
||||
'vollkorn'=> [
|
||||
'vollkorn' => [
|
||||
'name' => 'Vollkorn',
|
||||
'font-family' => 'Vollkorn, serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/vollkorn'
|
||||
@ -794,11 +798,13 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
$files = $this->getData(['fonts', 'files']);
|
||||
if (is_array($files)) {
|
||||
foreach ($files as $fontId => $fontName) {
|
||||
if ( gettype($fontName) === 'string'
|
||||
&& file_exists(self::DATA_DIR . 'fonts/' . $fontName)) {
|
||||
if (
|
||||
gettype($fontName) === 'string'
|
||||
&& file_exists(self::DATA_DIR . 'fonts/' . $fontName)
|
||||
) {
|
||||
$this->setData(['fonts', 'files', $fontId, [
|
||||
'name' => ucfirst($fontId),
|
||||
'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif',
|
||||
'font-family' => '\'' . ucfirst($fontId) . '\', sans-serif',
|
||||
'resource' => $fontName
|
||||
]]);
|
||||
}
|
||||
@ -809,10 +815,10 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
$imported = $this->getData(['fonts', 'imported']);
|
||||
if (is_array($imported)) {
|
||||
foreach ($imported as $fontId => $fontUrl) {
|
||||
if ( gettype($fontUrl) === 'string' ) {
|
||||
if (gettype($fontUrl) === 'string') {
|
||||
$this->setData(['fonts', 'imported', $fontId, [
|
||||
'name' => ucfirst($fontId),
|
||||
'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif',
|
||||
'font-family' => '\'' . ucfirst($fontId) . '\', sans-serif',
|
||||
'resource' => 'https:\\fonts.cdnfonts.com\css' . $fontUrl
|
||||
]]);
|
||||
}
|
||||
@ -860,7 +866,7 @@ if ($this->getData(['core', 'dataVersion']) < 11600) {
|
||||
'pt' => 'pt_PT'
|
||||
];
|
||||
// COnvertit les dossiers vers la nouvelle structure
|
||||
foreach($languages as $key => $value) {
|
||||
foreach ($languages as $key => $value) {
|
||||
if (is_dir(self::DATA_DIR . $key)) {
|
||||
$this->copyDir(self::DATA_DIR . $key, self::DATA_DIR . $value);
|
||||
$this->removeDir(self::DATA_DIR . $key);
|
||||
@ -874,8 +880,8 @@ if ($this->getData(['core', 'dataVersion']) < 11600) {
|
||||
$this->deleteData(['core', 'baseUrl']);
|
||||
|
||||
// Suppression de GA
|
||||
$this->deleteData(['config', 'seo' ,'analyticsId']);
|
||||
$this->deleteData(['config','analyticsId']);
|
||||
$this->deleteData(['config', 'seo', 'analyticsId']);
|
||||
$this->deleteData(['config', 'analyticsId']);
|
||||
$this->deleteData(['locale', 'cookies', 'gaLabel']);
|
||||
$this->deleteData(['locale', 'cookies', 'checkboxGaLabel']);
|
||||
|
||||
|
@ -14,12 +14,13 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class config extends common {
|
||||
class config extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'backup' => self::GROUP_ADMIN,
|
||||
'copyBackups'=> self::GROUP_ADMIN,
|
||||
'delBackups'=> self::GROUP_ADMIN,
|
||||
'copyBackups' => self::GROUP_ADMIN,
|
||||
'delBackups' => self::GROUP_ADMIN,
|
||||
'configMetaImage' => self::GROUP_ADMIN,
|
||||
'siteMap' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
@ -27,7 +28,7 @@ class config extends common {
|
||||
'updateBaseUrl' => self::GROUP_ADMIN,
|
||||
'script' => self::GROUP_ADMIN,
|
||||
'logReset' => self::GROUP_ADMIN,
|
||||
'logDownload'=> self::GROUP_ADMIN,
|
||||
'logDownload' => self::GROUP_ADMIN,
|
||||
'blacklistReset' => self::GROUP_ADMIN,
|
||||
'blacklistDownload' => self::GROUP_ADMIN
|
||||
];
|
||||
@ -201,7 +202,8 @@ class config extends common {
|
||||
* Sitemap compressé et non compressé
|
||||
* Robots.txt
|
||||
*/
|
||||
public function siteMap() {
|
||||
public function siteMap()
|
||||
{
|
||||
|
||||
// Mettre à jour le site map
|
||||
$successSitemap = $this->createSitemap();
|
||||
@ -218,18 +220,19 @@ class config extends common {
|
||||
/**
|
||||
* Sauvegarde des données
|
||||
*/
|
||||
public function backup() {
|
||||
public function backup()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Creation du ZIP
|
||||
$filter = $this->getInput('configBackupOption',helper::FILTER_BOOLEAN) === true ? ['backup','tmp'] : ['backup','tmp','file'];
|
||||
$fileName = helper::autoBackup(self::TEMP_DIR,$filter);
|
||||
$filter = $this->getInput('configBackupOption', helper::FILTER_BOOLEAN) === true ? ['backup', 'tmp'] : ['backup', 'tmp', 'file'];
|
||||
$fileName = helper::autoBackup(self::TEMP_DIR, $filter);
|
||||
// Créer le répertoire manquant
|
||||
if (!is_dir(self::FILE_DIR.'source/backup')) {
|
||||
mkdir(self::FILE_DIR.'source/backup', 0755);
|
||||
if (!is_dir(self::FILE_DIR . 'source/backup')) {
|
||||
mkdir(self::FILE_DIR . 'source/backup', 0755);
|
||||
}
|
||||
// Copie dans les fichiers
|
||||
$success = copy (self::TEMP_DIR . $fileName , self::FILE_DIR.'source/backup/' . $fileName);
|
||||
$success = copy(self::TEMP_DIR . $fileName, self::FILE_DIR . 'source/backup/' . $fileName);
|
||||
// Détruire le temporaire
|
||||
unlink(self::TEMP_DIR . $fileName);
|
||||
// Valeurs en sortie
|
||||
@ -249,9 +252,10 @@ class config extends common {
|
||||
/**
|
||||
* Réalise une copie d'écran du site
|
||||
*/
|
||||
public function configMetaImage() {
|
||||
public function configMetaImage()
|
||||
{
|
||||
// fonction désactivée pour un site local
|
||||
if ( strpos(helper::baseUrl(false),'localhost') > 0 OR strpos(helper::baseUrl(false),'127.0.0.1') > 0) {
|
||||
if (strpos(helper::baseUrl(false), 'localhost') > 0 or strpos(helper::baseUrl(false), '127.0.0.1') > 0) {
|
||||
$site = 'https://zwiicms.fr/';
|
||||
} else {
|
||||
$site = helper::baseUrl(false);
|
||||
@ -265,9 +269,9 @@ class config extends common {
|
||||
$data = false;
|
||||
|
||||
// lire l'API si le token est fourni
|
||||
if (!empty($token) ) {
|
||||
if (!empty($token)) {
|
||||
// Tente de connecter 5 fois l'API
|
||||
for ($i=0; $i < 5 ; $i++) {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$data = helper::getUrlContents('https://shot.screenshotapi.net/screenshot?token=' . $token . '&url=' . $site . '&width=1200&height=627&output=json&file_type=jpeg&no_cookie_banners=true&wait_for_event=load');
|
||||
if ($data !== false) {
|
||||
break;
|
||||
@ -278,17 +282,17 @@ class config extends common {
|
||||
|
||||
|
||||
// Traitement des données reçues valides.
|
||||
if ( !empty($token) && $data !== false) {
|
||||
if (!empty($token) && $data !== false) {
|
||||
$data = json_decode($data, true);
|
||||
$img = $data['screenshot'];
|
||||
// Effacer l'image et la miniature png
|
||||
if (file_exists(self::FILE_DIR .'thumb/screenshot.jpg')) {
|
||||
unlink (self::FILE_DIR .'thumb/screenshot.jpg');
|
||||
if (file_exists(self::FILE_DIR . 'thumb/screenshot.jpg')) {
|
||||
unlink(self::FILE_DIR . 'thumb/screenshot.jpg');
|
||||
}
|
||||
if (file_exists(self::FILE_DIR .'source/screenshot.jpg')) {
|
||||
unlink (self::FILE_DIR .'source/screenshot.jpg');
|
||||
if (file_exists(self::FILE_DIR . 'source/screenshot.jpg')) {
|
||||
unlink(self::FILE_DIR . 'source/screenshot.jpg');
|
||||
}
|
||||
$success = copy ($img, self::FILE_DIR .'source/screenshot.jpg');
|
||||
$success = copy($img, self::FILE_DIR . 'source/screenshot.jpg');
|
||||
}
|
||||
|
||||
$notification = empty($token)
|
||||
@ -299,20 +303,21 @@ class config extends common {
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'config',
|
||||
'notification' => $notification,
|
||||
'state' => ($success === false OR empty($token)) ? false : true
|
||||
'state' => ($success === false or empty($token)) ? false : true
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Procédure d'importation
|
||||
*/
|
||||
public function restore() {
|
||||
public function restore()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost() ) {
|
||||
if ($this->isPost()) {
|
||||
|
||||
$success = false;
|
||||
|
||||
if ($this->getInput('configRestoreImportFile', null, true) ) {
|
||||
if ($this->getInput('configRestoreImportFile', null, true)) {
|
||||
|
||||
$fileZip = $this->getInput('configRestoreImportFile');
|
||||
$file_parts = pathinfo($fileZip);
|
||||
@ -338,20 +343,20 @@ class config extends common {
|
||||
]);
|
||||
}
|
||||
// Lire le contenu de l'archive dans le tableau files
|
||||
for( $i = 0; $i < $zip->numFiles; $i++ ){
|
||||
$stat = $zip->statIndex( $i );
|
||||
$files [] = ( basename( $stat['name'] ));
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$stat = $zip->statIndex($i);
|
||||
$files[] = (basename($stat['name']));
|
||||
}
|
||||
|
||||
// Lire la dataversion
|
||||
$tmpDir = uniqid(4);
|
||||
$success = $zip->extractTo( self::TEMP_DIR . $tmpDir );
|
||||
$data = file_get_contents( self::TEMP_DIR . $tmpDir . '/data/core.json');
|
||||
$success = $zip->extractTo(self::TEMP_DIR . $tmpDir);
|
||||
$data = file_get_contents(self::TEMP_DIR . $tmpDir . '/data/core.json');
|
||||
$obj = json_decode($data);
|
||||
$dataVersion = strval ($obj->core->dataVersion);
|
||||
$dataVersion = strval($obj->core->dataVersion);
|
||||
switch (strlen($dataVersion)) {
|
||||
case 4:
|
||||
if (substr($dataVersion,0,1) === '9' ) {
|
||||
if (substr($dataVersion, 0, 1) === '9') {
|
||||
// Valeurs en sortie erreur
|
||||
$this->addOutput([
|
||||
'title' => 'Restaurer',
|
||||
@ -364,17 +369,17 @@ class config extends common {
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
$version = substr($dataVersion,0,2);
|
||||
$version = substr($dataVersion, 0, 2);
|
||||
break;
|
||||
default:
|
||||
$version = 0;
|
||||
break;
|
||||
}
|
||||
$this->removeDir(self::TEMP_DIR . $tmpDir );
|
||||
$this->removeDir(self::TEMP_DIR . $tmpDir);
|
||||
|
||||
if ($version >= 10 ) {
|
||||
if ($version >= 10) {
|
||||
// Option active, les users sont stockées
|
||||
if ($this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true ) {
|
||||
if ($this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true) {
|
||||
$users = $this->getData(['user']);
|
||||
}
|
||||
} elseif ($version === 0) { // Version invalide
|
||||
@ -388,25 +393,29 @@ class config extends common {
|
||||
}
|
||||
// Extraire le zip ou 'site/'
|
||||
$this->removeDir(self::DATA_DIR);
|
||||
$success = $zip->extractTo( 'site/' );
|
||||
$success = $zip->extractTo('site/');
|
||||
// Fermer l'archive
|
||||
$zip->close();
|
||||
|
||||
// Restaurer les users originaux d'une v10 si option cochée
|
||||
if (!empty($users) &&
|
||||
if (
|
||||
!empty($users) &&
|
||||
$version >= 10 &&
|
||||
$this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true) {
|
||||
$this->setData(['user',$users]);
|
||||
$this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true
|
||||
) {
|
||||
$this->setData(['user', $users]);
|
||||
}
|
||||
}
|
||||
|
||||
// Conversion vers des Url relatives
|
||||
/*
|
||||
if ($this->getData(['core', 'baseUrl'])) {
|
||||
$url = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
// Suppresion de la base Url
|
||||
$url = str_replace('?', '', $this->getData(['core', 'baseUrl']));
|
||||
// Suppression de la base Url
|
||||
$this->updateBaseUrl($url);
|
||||
// Effacer la baseUrl
|
||||
$this->deleteData(['core', 'baseUrl']);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Message de notification
|
||||
$notification = $success === true ? 'Restaurer effectuée avec succès' : 'Erreur inconnue';
|
||||
@ -432,14 +441,17 @@ class config extends common {
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
|
||||
// Basculement en mise à jour auto, remise à 0 du compteur
|
||||
if ($this->getData(['config','autoUpdate']) === false &&
|
||||
$this->getInput('configAutoUpdate', helper::FILTER_BOOLEAN) === true) {
|
||||
$this->setData(['core','lastAutoUpdate',0]);
|
||||
if (
|
||||
$this->getData(['config', 'autoUpdate']) === false &&
|
||||
$this->getInput('configAutoUpdate', helper::FILTER_BOOLEAN) === true
|
||||
) {
|
||||
$this->setData(['core', 'lastAutoUpdate', 0]);
|
||||
}
|
||||
|
||||
|
||||
@ -457,7 +469,7 @@ class config extends common {
|
||||
'cookieConsent' => $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN),
|
||||
'proxyType' => $this->getInput('configProxyType'),
|
||||
'proxyUrl' => $this->getInput('configProxyUrl'),
|
||||
'proxyPort' => $this->getInput('configProxyPort',helper::FILTER_INT),
|
||||
'proxyPort' => $this->getInput('configProxyPort', helper::FILTER_INT),
|
||||
'social' => [
|
||||
'facebookId' => $this->getInput('socialFacebookId'),
|
||||
'linkedinId' => $this->getInput('socialLinkedinId'),
|
||||
@ -469,30 +481,30 @@ class config extends common {
|
||||
'githubId' => $this->getInput('socialGithubId')
|
||||
],
|
||||
'smtp' => [
|
||||
'enable' => $this->getInput('smtpEnable',helper::FILTER_BOOLEAN),
|
||||
'host' => $this->getInput('smtpHost',helper::FILTER_STRING_SHORT,$this->getInput('smtpEnable',helper::FILTER_BOOLEAN)),
|
||||
'port' => $this->getInput('smtpPort',helper::FILTER_INT,$this->getInput('smtpEnable',helper::FILTER_BOOLEAN)),
|
||||
'auth' => $this->getInput('smtpAuth',helper::FILTER_BOOLEAN),
|
||||
'secure' => $this->getInput('smtpSecure',helper::FILTER_BOOLEAN),
|
||||
'username' => $this->getInput('smtpUsername',helper::FILTER_STRING_SHORT,$this->getInput('smtpAuth',helper::FILTER_BOOLEAN)),
|
||||
'password' =>helper::encrypt($this->getData(['config','smtp','username']),$this->getInput('smtpPassword',null,$this->getInput('smtpAuth',helper::FILTER_BOOLEAN))),
|
||||
'sender' => $this->getInput('smtpSender',helper::FILTER_MAIL)
|
||||
'enable' => $this->getInput('smtpEnable', helper::FILTER_BOOLEAN),
|
||||
'host' => $this->getInput('smtpHost', helper::FILTER_STRING_SHORT, $this->getInput('smtpEnable', helper::FILTER_BOOLEAN)),
|
||||
'port' => $this->getInput('smtpPort', helper::FILTER_INT, $this->getInput('smtpEnable', helper::FILTER_BOOLEAN)),
|
||||
'auth' => $this->getInput('smtpAuth', helper::FILTER_BOOLEAN),
|
||||
'secure' => $this->getInput('smtpSecure', helper::FILTER_BOOLEAN),
|
||||
'username' => $this->getInput('smtpUsername', helper::FILTER_STRING_SHORT, $this->getInput('smtpAuth', helper::FILTER_BOOLEAN)),
|
||||
'password' => helper::encrypt($this->getData(['config', 'smtp', 'username']), $this->getInput('smtpPassword', null, $this->getInput('smtpAuth', helper::FILTER_BOOLEAN))),
|
||||
'sender' => $this->getInput('smtpSender', helper::FILTER_MAIL)
|
||||
],
|
||||
'seo' => [
|
||||
'robots' => $this->getInput('seoRobots',helper::FILTER_BOOLEAN),
|
||||
'keyApi' => $this->getInput('seoKeyApi',helper::FILTER_STRING_SHORT),
|
||||
'robots' => $this->getInput('seoRobots', helper::FILTER_BOOLEAN),
|
||||
'keyApi' => $this->getInput('seoKeyApi', helper::FILTER_STRING_SHORT),
|
||||
],
|
||||
'connect' => [
|
||||
'attempt' => $this->getInput('connectAttempt',helper::FILTER_INT),
|
||||
'timeout' => $this->getInput('connectTimeout',helper::FILTER_INT),
|
||||
'log' => $this->getInput('connectLog',helper::FILTER_BOOLEAN),
|
||||
'anonymousIp' => $this->getInput('connectAnonymousIp',helper::FILTER_INT),
|
||||
'captcha' => $this->getInput('connectCaptcha',helper::FILTER_BOOLEAN),
|
||||
'captchaStrong' => $this->getInput('connectCaptchaStrong',helper::FILTER_BOOLEAN),
|
||||
'autoDisconnect' => $this->getInput('connectAutoDisconnect',helper::FILTER_BOOLEAN),
|
||||
'attempt' => $this->getInput('connectAttempt', helper::FILTER_INT),
|
||||
'timeout' => $this->getInput('connectTimeout', helper::FILTER_INT),
|
||||
'log' => $this->getInput('connectLog', helper::FILTER_BOOLEAN),
|
||||
'anonymousIp' => $this->getInput('connectAnonymousIp', helper::FILTER_INT),
|
||||
'captcha' => $this->getInput('connectCaptcha', helper::FILTER_BOOLEAN),
|
||||
'captchaStrong' => $this->getInput('connectCaptchaStrong', helper::FILTER_BOOLEAN),
|
||||
'autoDisconnect' => $this->getInput('connectAutoDisconnect', helper::FILTER_BOOLEAN),
|
||||
'captchaType' => $this->getInput('connectCaptchaType'),
|
||||
'showPassword' => $this->getInput('connectShowPassword',helper::FILTER_BOOLEAN),
|
||||
'redirectLogin' => $this->getInput('connectRedirectLogin',helper::FILTER_BOOLEAN)
|
||||
'showPassword' => $this->getInput('connectShowPassword', helper::FILTER_BOOLEAN),
|
||||
'redirectLogin' => $this->getInput('connectRedirectLogin', helper::FILTER_BOOLEAN)
|
||||
]
|
||||
]
|
||||
]);
|
||||
@ -500,9 +512,8 @@ class config extends common {
|
||||
// Efface les fichiers de backup lorsque l'option est désactivée
|
||||
if ($this->getInput('configFileBackup', helper::FILTER_BOOLEAN) === false) {
|
||||
$path = realpath('site/data');
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
|
||||
{
|
||||
if (strpos($filename,'backup.json')) {
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) {
|
||||
if (strpos($filename, 'backup.json')) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
@ -511,12 +522,12 @@ class config extends common {
|
||||
touch('site/data/.backup');
|
||||
}
|
||||
// Notice
|
||||
if(self::$inputNotices === []) {
|
||||
if (self::$inputNotices === []) {
|
||||
// Active la réécriture d'URL
|
||||
$rewrite = $this->getInput('configRewrite', helper::FILTER_BOOLEAN);
|
||||
if(
|
||||
if (
|
||||
$rewrite
|
||||
AND helper::checkRewrite() === false
|
||||
and helper::checkRewrite() === false
|
||||
) {
|
||||
// Ajout des lignes dans le .htaccess
|
||||
$fileContent = file_get_contents('.htaccess');
|
||||
@ -528,8 +539,8 @@ class config extends common {
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-f" . PHP_EOL .
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-d" . PHP_EOL .
|
||||
"\tRewriteRule ^(.*)$ index.php?$1 [L]" . PHP_EOL .
|
||||
'</IfModule>'. PHP_EOL .
|
||||
'# URL rewriting' . PHP_EOL ;
|
||||
'</IfModule>' . PHP_EOL .
|
||||
'# URL rewriting' . PHP_EOL;
|
||||
$fileContent = str_replace('# URL rewriting', $rewriteData, $fileContent);
|
||||
file_put_contents(
|
||||
'.htaccess',
|
||||
@ -539,9 +550,9 @@ class config extends common {
|
||||
helper::$rewriteStatus = true;
|
||||
}
|
||||
// Désactive la réécriture d'URL
|
||||
elseif(
|
||||
elseif (
|
||||
$rewrite === false
|
||||
AND helper::checkRewrite()
|
||||
and helper::checkRewrite()
|
||||
) {
|
||||
// Suppression des lignes dans le .htaccess
|
||||
$fileContent = file_get_contents('.htaccess');
|
||||
@ -561,7 +572,7 @@ class config extends common {
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Modifications enregistrées ' ,
|
||||
'notification' => 'Modifications enregistrées ',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
@ -569,7 +580,7 @@ class config extends common {
|
||||
// Variable de version
|
||||
self::$onlineVersion = helper::getUrlContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/version');
|
||||
if (self::$onlineVersion > common::ZWII_VERSION) {
|
||||
self::$updateButtonText = "Mettre à jour" ;
|
||||
self::$updateButtonText = "Mettre à jour";
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
@ -580,19 +591,20 @@ class config extends common {
|
||||
}
|
||||
|
||||
|
||||
public function script() {
|
||||
public function script()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Ecrire les fichiers de script
|
||||
if ($this->geturl(2) === 'head') {
|
||||
file_put_contents(self::DATA_DIR . 'head.inc.html',$this->getInput('configScriptHead',null));
|
||||
file_put_contents(self::DATA_DIR . 'head.inc.html', $this->getInput('configScriptHead', null));
|
||||
}
|
||||
if ($this->geturl(2) === 'body') {
|
||||
file_put_contents(self::DATA_DIR . 'body.inc.html',$this->getInput('configScriptBody',null));
|
||||
file_put_contents(self::DATA_DIR . 'body.inc.html', $this->getInput('configScriptBody', null));
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Éditeur de script dans ' . ucfirst($this->geturl(2)) ,
|
||||
'title' => 'Éditeur de script dans ' . ucfirst($this->geturl(2)),
|
||||
'vendor' => [
|
||||
'codemirror'
|
||||
],
|
||||
@ -602,7 +614,7 @@ class config extends common {
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Éditeur de script dans ' . ucfirst($this->geturl(2)) ,
|
||||
'title' => 'Éditeur de script dans ' . ucfirst($this->geturl(2)),
|
||||
'vendor' => [
|
||||
'codemirror'
|
||||
],
|
||||
@ -615,12 +627,13 @@ class config extends common {
|
||||
* Vider le fichier de log
|
||||
*/
|
||||
|
||||
public function logReset() {
|
||||
if ( file_exists(self::DATA_DIR . 'journal.log') ) {
|
||||
public function logReset()
|
||||
{
|
||||
if (file_exists(self::DATA_DIR . 'journal.log')) {
|
||||
unlink(self::DATA_DIR . 'journal.log');
|
||||
// Créer les en-têtes des journaux
|
||||
$d = 'Date;Heure;IP;Id;Action' . PHP_EOL;
|
||||
file_put_contents(self::DATA_DIR . 'journal.log',$d);
|
||||
file_put_contents(self::DATA_DIR . 'journal.log', $d);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
@ -637,7 +650,6 @@ class config extends common {
|
||||
'state' => false
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -645,7 +657,8 @@ class config extends common {
|
||||
/**
|
||||
* Télécharger le fichier de log
|
||||
*/
|
||||
public function logDownload() {
|
||||
public function logDownload()
|
||||
{
|
||||
$fileName = self::DATA_DIR . 'journal.log';
|
||||
if (file_exists($fileName)) {
|
||||
ob_start();
|
||||
@ -654,7 +667,7 @@ class config extends common {
|
||||
header('Content-Length: ' . filesize($fileName));
|
||||
ob_clean();
|
||||
ob_end_flush();
|
||||
readfile( $fileName);
|
||||
readfile($fileName);
|
||||
exit();
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
@ -670,27 +683,28 @@ class config extends common {
|
||||
/**
|
||||
* Tableau des IP blacklistés
|
||||
*/
|
||||
public function blacklistDownload () {
|
||||
public function blacklistDownload()
|
||||
{
|
||||
ob_start();
|
||||
$fileName = self::TEMP_DIR . 'blacklist.log';
|
||||
$d = 'Date dernière tentative;Heure dernière tentative;Id;Adresse IP;Nombre d\'échecs' . PHP_EOL;
|
||||
file_put_contents($fileName,$d);
|
||||
if ( file_exists($fileName) ) {
|
||||
file_put_contents($fileName, $d);
|
||||
if (file_exists($fileName)) {
|
||||
$d = $this->getData(['blacklist']);
|
||||
$data = '';
|
||||
foreach ($d as $key => $item) {
|
||||
$data .= mb_detect_encoding(strftime('%d/%m/%y',$item['lastFail']), 'UTF-8', true)
|
||||
? strftime('%d/%m/%y',$item['lastFail']) . ';' . utf8_encode(strftime('%R',$item['lastFail'])) . ';'
|
||||
: utf8_encode(strftime('%d/%m/%y',$item['lastFail'])) . ';' . utf8_encode(strftime('%R',$item['lastFail'])) . ';' ;
|
||||
$data .= mb_detect_encoding(strftime('%d/%m/%y', $item['lastFail']), 'UTF-8', true)
|
||||
? strftime('%d/%m/%y', $item['lastFail']) . ';' . utf8_encode(strftime('%R', $item['lastFail'])) . ';'
|
||||
: utf8_encode(strftime('%d/%m/%y', $item['lastFail'])) . ';' . utf8_encode(strftime('%R', $item['lastFail'])) . ';';
|
||||
$data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL;
|
||||
}
|
||||
file_put_contents($fileName,$data,FILE_APPEND);
|
||||
file_put_contents($fileName, $data, FILE_APPEND);
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||
header('Content-Length: ' . filesize($fileName));
|
||||
ob_clean();
|
||||
ob_end_flush();
|
||||
readfile( $fileName);
|
||||
readfile($fileName);
|
||||
unlink(self::TEMP_DIR . 'blacklist.log');
|
||||
exit();
|
||||
} else {
|
||||
@ -708,9 +722,10 @@ class config extends common {
|
||||
* Réinitialiser les ip blacklistées
|
||||
*/
|
||||
|
||||
public function blacklistReset() {
|
||||
if ( file_exists(self::DATA_DIR . 'blacklist.json') ) {
|
||||
$this->setData(['blacklist',[]]);
|
||||
public function blacklistReset()
|
||||
{
|
||||
if (file_exists(self::DATA_DIR . 'blacklist.json')) {
|
||||
$this->setData(['blacklist', []]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
@ -732,9 +747,10 @@ class config extends common {
|
||||
/**
|
||||
* Récupération des backups auto dans le gestionnaire de fichiers
|
||||
*/
|
||||
public function copyBackups() {
|
||||
public function copyBackups()
|
||||
{
|
||||
|
||||
$success = $this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup' );
|
||||
$success = $this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup');
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -748,15 +764,15 @@ class config extends common {
|
||||
/**
|
||||
* Vider le dosser des sauvegardes automatisées
|
||||
*/
|
||||
public function delBackups() {
|
||||
public function delBackups()
|
||||
{
|
||||
$path = realpath(self::BACKUP_DIR);
|
||||
$success = $fail = 0;
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
|
||||
{
|
||||
if (strpos($filename,'.zip')) {
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) {
|
||||
if (strpos($filename, '.zip')) {
|
||||
|
||||
$r = unlink($filename);
|
||||
$success = $r === true ? $succes + 1 : $success;
|
||||
$success = $r === true ? $success + 1 : $success;
|
||||
$fail = $r === false ? $fail + 1 : $fail;
|
||||
}
|
||||
}
|
||||
@ -768,7 +784,4 @@ class config extends common {
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
$( document).ready(function() {
|
||||
$("#configBackupForm").submit( function(e){
|
||||
$(document).ready(function () {
|
||||
$("#configBackupForm").submit(function (e) {
|
||||
//$("#configBackupSubmit").addClass("disabled").prop("disabled", true);
|
||||
e.preventDefault();
|
||||
var url = "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/backup";
|
||||
@ -22,15 +22,15 @@ $( document).ready(function() {
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: $("form").serialize(),
|
||||
success: function(data){
|
||||
success: function (data) {
|
||||
$('body, .button').css('cursor', 'default');
|
||||
core.alert(message_success);
|
||||
},
|
||||
error: function(data){
|
||||
error: function (data) {
|
||||
$('body, .button').css('cursor', 'default');
|
||||
core.alert(message_error);
|
||||
},
|
||||
complete: function(){
|
||||
complete: function () {
|
||||
$("#configBackupSubmit").removeClass("disabled").prop("disabled", false);
|
||||
$("#configBackupSubmit").removeClass("uniqueSubmission").prop("uniqueSubmission", false);
|
||||
$("#configBackupSubmit span").removeClass("zwiico-spin animate-spin");
|
||||
@ -43,10 +43,10 @@ $( document).ready(function() {
|
||||
/**
|
||||
* Confirmation de sauvegarde complète
|
||||
*/
|
||||
$("#configBackupSubmit").on("click", function() {
|
||||
$("#configBackupSubmit").on("click", function () {
|
||||
if ($("input[name=configBackupOption]").is(':checked')) {
|
||||
var message_warning = "<?php echo template::topic('La sauvegarde des fichiers peut prendre du temps. Continuer ?'); ?>";
|
||||
return core.confirm(message_warning, function() {
|
||||
return core.confirm(message_warning, function () {
|
||||
//$(location).attr("href", _this.attr("href"));
|
||||
$('body, .button').css('cursor', 'wait');
|
||||
$('form#configBackupForm').submit();
|
||||
|
@ -8,7 +8,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('configBackupSubmit',[
|
||||
<?php echo template::submit('configBackupSubmit', [
|
||||
'value' => 'Sauvegarder',
|
||||
'uniqueSubmission' => true
|
||||
]); ?>
|
||||
@ -28,7 +28,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<em>L'archive est générée dans <a href="<?php echo helper::baseUrl(false); ?>core/vendor/filemanager/dialog.php?fldr=backup&type=0&akey=<?php echo md5_file(self::DATA_DIR.'core.json'); ?>" data-lity>le dossier Backup</a> du gestionnaire de fichiers.</em>
|
||||
<em>L'archive est générée dans <a href="<?php echo helper::baseUrl(false); ?>core/vendor/filemanager/dialog.php?fldr=backup&type=0&akey=<?php echo md5_file(self::DATA_DIR . 'core.json'); ?>" data-lity>le dossier Backup</a> du gestionnaire de fichiers.</em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,10 +2,10 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo template::topic('Sécurité de la connexion');?>
|
||||
<h4><?php echo template::topic('Sécurité de la connexion'); ?>
|
||||
<span id="specialeHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/connexion" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -32,13 +32,13 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('connectAttempt', $module::$connectAttempt , [
|
||||
<?php echo template::select('connectAttempt', $module::$connectAttempt, [
|
||||
'label' => 'Limitation des tentatives',
|
||||
'selected' => $this->getData(['config', 'connect', 'attempt'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('connectTimeout', $module::$connectTimeout , [
|
||||
<?php echo template::select('connectTimeout', $module::$connectTimeout, [
|
||||
'label' => 'Blocage après échecs',
|
||||
'selected' => $this->getData(['config', 'connect', 'timeout'])
|
||||
]); ?>
|
||||
@ -47,7 +47,8 @@
|
||||
<label id="helpBlacklist">Liste noire :
|
||||
<?php echo template::help(
|
||||
'La liste noire énumère les tentatives de connexion à partir de comptes inexistants. Sont stockés : la date, l\'heure, le nom du compte et l\'IP.
|
||||
Après le nombre de tentatives autorisées, l\'IP et le compte sont bloqués.');
|
||||
Après le nombre de tentatives autorisées, l\'IP et le compte sont bloqués.'
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<?php echo template::button('ConnectBlackListDownload', [
|
||||
@ -68,7 +69,7 @@
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('connectCaptcha', true, 'Captcha à la connexion', [
|
||||
'checked' => $this->getData(['config', 'connect','captcha'])
|
||||
'checked' => $this->getData(['config', 'connect', 'captcha'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
@ -78,7 +79,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('connectCaptchaType', $module::$captchaTypes , [
|
||||
<?php echo template::select('connectCaptchaType', $module::$captchaTypes, [
|
||||
'label' => 'Type de captcha',
|
||||
'selected' => $this->getData(['config', 'connect', 'captchaType'])
|
||||
]); ?>
|
||||
@ -90,10 +91,10 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo template::topic('Journalisation');?>
|
||||
<h4><?php echo template::topic('Journalisation'); ?>
|
||||
<span id="specialeHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/journalisation" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
|
@ -34,7 +34,7 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tab ~ .tabContent {
|
||||
.tab~.tabContent {
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php echo template::formOpen('configForm');?>
|
||||
<?php echo template::formOpen('configForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('configBack', [
|
||||
@ -14,7 +14,7 @@
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
]); */?>
|
||||
]); */ ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('Submit'); ?>
|
||||
@ -42,8 +42,8 @@
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
<?php include ('core/module/config/view/setup/setup.php') ?>
|
||||
<?php include ('core/module/config/view/social/social.php') ?>
|
||||
<?php include ('core/module/config/view/connect/connect.php') ?>
|
||||
<?php include ('core/module/config/view/network/network.php') ?>
|
||||
<?php include('core/module/config/view/setup/setup.php') ?>
|
||||
<?php include('core/module/config/view/social/social.php') ?>
|
||||
<?php include('core/module/config/view/connect/connect.php') ?>
|
||||
<?php include('core/module/config/view/network/network.php') ?>
|
||||
<?php echo template::formClose(); ?>
|
@ -2,10 +2,10 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo template::topic('Paramètres');?>
|
||||
<h4><?php echo template::topic('Paramètres'); ?>
|
||||
<span id="specialeHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/reseau" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -37,17 +37,17 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo template::topic('SMTP');?>
|
||||
<h4><?php echo template::topic('SMTP'); ?>
|
||||
<span id="specialeHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/smtp" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('smtpEnable', true, 'Activer SMTP', [
|
||||
'checked' => $this->getData(['config', 'smtp','enable']),
|
||||
'checked' => $this->getData(['config', 'smtp', 'enable']),
|
||||
'help' => 'Paramètres à utiliser lorsque votre hébergeur ne propose pas la fonctionnalité d\'envoi de mail.'
|
||||
]); ?>
|
||||
</div>
|
||||
@ -58,20 +58,20 @@
|
||||
<?php echo template::text('smtpHost', [
|
||||
'label' => 'Adresse SMTP',
|
||||
'placeholder' => 'smtp.fr',
|
||||
'value' => $this->getData(['config', 'smtp','host'])
|
||||
'value' => $this->getData(['config', 'smtp', 'host'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::text('smtpPort', [
|
||||
'label' => 'Port SMTP',
|
||||
'placeholder' => '589',
|
||||
'value' => $this->getData(['config', 'smtp','port'])
|
||||
'value' => $this->getData(['config', 'smtp', 'port'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::select('smtpAuth', $module::$SMTPauth, [
|
||||
'label' => 'Authentification',
|
||||
'selected' => $this->getData(['config', 'smtp','auth'])
|
||||
'selected' => $this->getData(['config', 'smtp', 'auth'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -80,20 +80,20 @@
|
||||
<div class="col5">
|
||||
<?php echo template::text('smtpUsername', [
|
||||
'label' => 'Nom utilisateur',
|
||||
'value' => $this->getData(['config', 'smtp','username' ])
|
||||
'value' => $this->getData(['config', 'smtp', 'username'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col5">
|
||||
<?php echo template::password('smtpPassword', [
|
||||
'label' => 'Mot de passe',
|
||||
'autocomplete' => 'off',
|
||||
'value' => $this->getData(['config', 'smtp','username' ]) ? helper::decrypt ($this->getData(['config', 'smtp','username' ]),$this->getData(['config','smtp','password'])) : ''
|
||||
'value' => $this->getData(['config', 'smtp', 'username']) ? helper::decrypt($this->getData(['config', 'smtp', 'username']), $this->getData(['config', 'smtp', 'password'])) : ''
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::select('smtpSecure', $module::$SMTPEnc , [
|
||||
<?php echo template::select('smtpSecure', $module::$SMTPEnc, [
|
||||
'label' => 'Sécurité',
|
||||
'selected' => $this->getData(['config', 'smtp','secure'])
|
||||
'selected' => $this->getData(['config', 'smtp', 'secure'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configRestoreSubmit',[
|
||||
<?php echo template::submit('configRestoreSubmit', [
|
||||
'value' => 'Restaurer',
|
||||
'uniqueSubmission' => true,
|
||||
]); ?>
|
||||
@ -19,7 +19,7 @@
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Archive à restaurer');?>
|
||||
<?php echo template::topic('Archive à restaurer'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col10 offset1">
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('configScript'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configManageBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -9,30 +9,30 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configManageSubmit',[
|
||||
<?php echo template::submit('configManageSubmit', [
|
||||
'value' => 'Valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->geturl(2) === 'head'): ?>
|
||||
</div>
|
||||
<?php if ($this->geturl(2) === 'head') : ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('configScriptHead', [
|
||||
'value' => file_exists( self::DATA_DIR . 'head.inc.html') ? file_get_contents (self::DATA_DIR . 'head.inc.html') : '' ,
|
||||
'value' => file_exists(self::DATA_DIR . 'head.inc.html') ? file_get_contents(self::DATA_DIR . 'head.inc.html') : '',
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if ($this->geturl(2) === 'body'): ?>
|
||||
<?php endif ?>
|
||||
<?php if ($this->geturl(2) === 'body') : ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('configScriptBody', [
|
||||
'value' => file_exists( self::DATA_DIR . 'body.inc.html') ? file_get_contents (self::DATA_DIR . 'body.inc.html') : '' ,
|
||||
'value' => file_exists(self::DATA_DIR . 'body.inc.html') ? file_get_contents(self::DATA_DIR . 'body.inc.html') : '',
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php echo template::formClose(); ?>
|
@ -2,10 +2,10 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo template::topic('Paramétres');?>
|
||||
<h4><?php echo template::topic('Paramétres'); ?>
|
||||
<span id="setupHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/parametres" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -56,10 +56,10 @@
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Mise à jour automatisée');?>
|
||||
<?php echo template::topic('Mise à jour automatisée'); ?>
|
||||
<span id="updateHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/mise-a-jour" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -81,8 +81,8 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo '<pre>Version installée : <strong>' . common::ZWII_VERSION . '</strong></pre>' ; ?>
|
||||
<?php echo $module::$onlineVersion ? '<pre>Version en ligne : <strong>' . $module::$onlineVersion . '</strong></pre>' : '' ;?>
|
||||
<?php echo '<pre>Version installée : <strong>' . common::ZWII_VERSION . '</strong></pre>'; ?>
|
||||
<?php echo $module::$onlineVersion ? '<pre>Version en ligne : <strong>' . $module::$onlineVersion . '</strong></pre>' : ''; ?>
|
||||
</div>
|
||||
<div class="col4 verticalAlignBottom">
|
||||
<?php echo template::button('configUpdateForced', [
|
||||
@ -103,7 +103,7 @@
|
||||
<h4>Maintenance
|
||||
<span id="maintenanceHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/mode-maintenance" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -162,7 +162,7 @@
|
||||
<h4>Scripts externes
|
||||
<span id="specialeHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/scripts-externes" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
|
@ -3,10 +3,10 @@
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Capture d\'écran Open Graph');?>
|
||||
<?php echo template::topic('Capture d\'écran Open Graph'); ?>
|
||||
<span id="specialeHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/referencement" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -31,13 +31,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6 offset1">
|
||||
<?php if (file_exists(self::FILE_DIR.'source/screenshot.jpg')): ?>
|
||||
<?php if (file_exists(self::FILE_DIR . 'source/screenshot.jpg')) : ?>
|
||||
<div class="row">
|
||||
<div class="col8 offset2 textAlignCenter">
|
||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR.'source/screenshot.jpg';?>" data-tippy-content="Cette capture d'écran est nécessaire aux partages sur les réseaux sociaux. Elle est régénérée lorsque le fichier 'screenshot.jpg' est effacé du gestionnaire de fichiers." />
|
||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'source/screenshot.jpg'; ?>" data-tippy-content="Cette capture d'écran est nécessaire aux partages sur les réseaux sociaux. Elle est régénérée lorsque le fichier 'screenshot.jpg' est effacé du gestionnaire de fichiers." />
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -47,7 +47,7 @@
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Référencement');?>
|
||||
<?php echo template::topic('Référencement'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col4 offset1">
|
||||
@ -58,7 +58,7 @@
|
||||
</div>
|
||||
<div class="col4 offset1">
|
||||
<?php echo template::checkbox('seoRobots', true, 'Autoriser les robots à référencer le site', [
|
||||
'checked' => $this->getData(['config', 'seo','robots'])
|
||||
'checked' => $this->getData(['config', 'seo', 'robots'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -69,10 +69,10 @@
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Réseaux sociaux');?>
|
||||
<?php echo template::topic('Réseaux sociaux'); ?>
|
||||
<span id="specialeHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/reseaux-sociaux" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
|
@ -14,7 +14,8 @@
|
||||
*/
|
||||
|
||||
|
||||
class install extends common {
|
||||
class install extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR,
|
||||
@ -41,9 +42,10 @@ class install extends common {
|
||||
/**
|
||||
* Pré-installation - choix de la langue
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// Accès refusé
|
||||
if($this->getData(['user']) !== []) {
|
||||
if ($this->getData(['user']) !== []) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
@ -52,7 +54,7 @@ class install extends common {
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
self::$i18nUI = $this->getInput('installLanguage');
|
||||
$this->setData(['config', 'i18n', 'interface', self::$i18nUI]);
|
||||
// Valeurs en sortie
|
||||
@ -68,7 +70,7 @@ class install extends common {
|
||||
chdir(self::I18N_DIR);
|
||||
$files = glob('*.json');
|
||||
// Ajouter une clé au tableau avec le code de langue
|
||||
foreach( $files as $file) {
|
||||
foreach ($files as $file) {
|
||||
// La langue est-elle référencée ?
|
||||
if (array_key_exists(basename($file, '.json'), self::$languages)) {
|
||||
self::$i18nFiles[basename($file, '.json')] = self::$languages[basename($file, '.json')];
|
||||
@ -87,9 +89,10 @@ class install extends common {
|
||||
/**
|
||||
* post Installation
|
||||
*/
|
||||
public function postInstall() {
|
||||
public function postInstall()
|
||||
{
|
||||
// Accès refusé
|
||||
if($this->getData(['user']) !== []) {
|
||||
if ($this->getData(['user']) !== []) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
@ -98,10 +101,10 @@ class install extends common {
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
$success = true;
|
||||
// Double vérification pour le mot de passe
|
||||
if($this->getInput('installPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('installConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
if ($this->getInput('installPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('installConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
self::$inputNotices['installConfirmPassword'] = 'Incorrect';
|
||||
$success = false;
|
||||
}
|
||||
@ -152,24 +155,25 @@ class install extends common {
|
||||
|
||||
// Effacer le dossier de contenu fr créé par défaut si la langue est différente.
|
||||
|
||||
if (self::$i18nContent !== 'fr_FR'
|
||||
if (
|
||||
self::$i18nContent !== 'fr_FR'
|
||||
&& is_dir('site/data/fr')
|
||||
) {
|
||||
$this->removeDir('site/data/fr');
|
||||
}
|
||||
|
||||
// Installation du site de test
|
||||
if ($this->getInput('installDefaultData',helper::FILTER_BOOLEAN) === FALSE) {
|
||||
if ($this->getInput('installDefaultData', helper::FILTER_BOOLEAN) === FALSE) {
|
||||
$this->initData('page', self::$i18nContent, true);
|
||||
$this->initData('module',self::$i18nContent, true);
|
||||
$this->initData('module', self::$i18nContent, true);
|
||||
$this->setData(['module', 'blog', 'posts', 'mon-premier-article', 'userId', $userId]);
|
||||
$this->setData(['module', 'blog', 'posts', 'mon-deuxieme-article', 'userId', $userId]);
|
||||
$this->setData(['module', 'blog', 'posts', 'mon-troisieme-article', 'userId', $userId]);
|
||||
}
|
||||
|
||||
// Sauvegarder la configuration du Proxy
|
||||
$this->setData(['config', 'proxyType', $this->getInput('installProxyType') ]);
|
||||
$this->setData(['config', 'proxyUrl', $this->getInput('installProxyUrl') ]);
|
||||
$this->setData(['config', 'proxyType', $this->getInput('installProxyType')]);
|
||||
$this->setData(['config', 'proxyUrl', $this->getInput('installProxyUrl')]);
|
||||
$this->setData(['config', 'proxyPort', $this->getInput('installProxyPort', helper::FILTER_INT)]);
|
||||
|
||||
// Images exemples livrées dans tous les cas
|
||||
@ -199,14 +203,14 @@ class install extends common {
|
||||
// Installation du thème sélectionné
|
||||
$dataThemes = file_get_contents('core/module/install/ressource/themes/themes.json');
|
||||
$dataThemes = json_decode($dataThemes, true);
|
||||
$themeId = $dataThemes [$this->getInput('installTheme', helper::FILTER_STRING_SHORT)]['filename'];
|
||||
if ($themeId !== 'default' ) {
|
||||
$themeId = $dataThemes[$this->getInput('installTheme', helper::FILTER_STRING_SHORT)]['filename'];
|
||||
if ($themeId !== 'default') {
|
||||
$theme = new theme;
|
||||
$theme->import('core/module/install/ressource/themes/' . $themeId);
|
||||
}
|
||||
|
||||
// Copie des thèmes dans les fichiers
|
||||
if (!is_dir(self::FILE_DIR . 'source/theme' )) {
|
||||
if (!is_dir(self::FILE_DIR . 'source/theme')) {
|
||||
mkdir(self::FILE_DIR . 'source/theme');
|
||||
}
|
||||
$this->copyDir('core/module/install/ressource/themes', self::FILE_DIR . 'source/theme');
|
||||
@ -245,25 +249,26 @@ class install extends common {
|
||||
/**
|
||||
* Étapes de mise à jour
|
||||
*/
|
||||
public function steps() {
|
||||
switch($this->getInput('step', helper::FILTER_INT)) {
|
||||
public function steps()
|
||||
{
|
||||
switch ($this->getInput('step', helper::FILTER_INT)) {
|
||||
// Préparation
|
||||
case 1:
|
||||
$success = true;
|
||||
// RAZ la mise à jour auto
|
||||
$this->setData(['core','updateAvailable', false]);
|
||||
$this->setData(['core', 'updateAvailable', false]);
|
||||
// Backup du dossier Data
|
||||
helper::autoBackup(self::BACKUP_DIR,['backup','tmp','file']);
|
||||
helper::autoBackup(self::BACKUP_DIR, ['backup', 'tmp', 'file']);
|
||||
// Sauvegarde htaccess
|
||||
if ($this->getData(['config','autoUpdateHtaccess'])) {
|
||||
if ($this->getData(['config', 'autoUpdateHtaccess'])) {
|
||||
$success = copy('.htaccess', '.htaccess' . '.bak');
|
||||
}
|
||||
// Nettoyage des fichiers d'installation précédents
|
||||
if(file_exists(self::TEMP_DIR.'update.tar.gz') && $success) {
|
||||
$success = unlink(self::TEMP_DIR.'update.tar.gz');
|
||||
if (file_exists(self::TEMP_DIR . 'update.tar.gz') && $success) {
|
||||
$success = unlink(self::TEMP_DIR . 'update.tar.gz');
|
||||
}
|
||||
if(file_exists(self::TEMP_DIR.'update.tar') && $success) {
|
||||
$success = unlink(self::TEMP_DIR.'update.tar');
|
||||
if (file_exists(self::TEMP_DIR . 'update.tar') && $success) {
|
||||
$success = unlink(self::TEMP_DIR . 'update.tar');
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -276,10 +281,10 @@ class install extends common {
|
||||
break;
|
||||
// Téléchargement
|
||||
case 2:
|
||||
file_put_contents(self::TEMP_DIR.'update.tar.gz', helper::getUrlContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/update.tar.gz'));
|
||||
file_put_contents(self::TEMP_DIR . 'update.tar.gz', helper::getUrlContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/update.tar.gz'));
|
||||
$md5origin = helper::getUrlContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/update.md5');
|
||||
$md5origin = (explode(' ',$md5origin));
|
||||
$md5target = md5_file(self::TEMP_DIR.'update.tar.gz');
|
||||
$md5origin = (explode(' ', $md5origin));
|
||||
$md5target = md5_file(self::TEMP_DIR . 'update.tar.gz');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
@ -297,7 +302,7 @@ class install extends common {
|
||||
// Décompression et installation
|
||||
try {
|
||||
// Décompression dans le dossier de fichier temporaires
|
||||
$pharData = new PharData(self::TEMP_DIR.'update.tar.gz');
|
||||
$pharData = new PharData(self::TEMP_DIR . 'update.tar.gz');
|
||||
$pharData->decompress();
|
||||
// Installation
|
||||
$pharData->extractTo(__DIR__ . '/../../../', null, true);
|
||||
@ -305,11 +310,11 @@ class install extends common {
|
||||
$success = $e->getMessage();
|
||||
}
|
||||
// Nettoyage du dossier
|
||||
if(file_exists(self::TEMP_DIR.'update.tar.gz')) {
|
||||
unlink(self::TEMP_DIR.'update.tar.gz');
|
||||
if (file_exists(self::TEMP_DIR . 'update.tar.gz')) {
|
||||
unlink(self::TEMP_DIR . 'update.tar.gz');
|
||||
}
|
||||
if(file_exists(self::TEMP_DIR.'update.tar')) {
|
||||
unlink(self::TEMP_DIR.'update.tar');
|
||||
if (file_exists(self::TEMP_DIR . 'update.tar')) {
|
||||
unlink(self::TEMP_DIR . 'update.tar');
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -335,8 +340,8 @@ class install extends common {
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-f" . PHP_EOL .
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-d" . PHP_EOL .
|
||||
"\tRewriteRule ^(.*)$ index.php?$1 [L]" . PHP_EOL .
|
||||
'</IfModule>'. PHP_EOL .
|
||||
'# URL rewriting' . PHP_EOL ;
|
||||
'</IfModule>' . PHP_EOL .
|
||||
'# URL rewriting' . PHP_EOL;
|
||||
$fileContent = str_replace('# URL rewriting', $rewriteData, $fileContent);
|
||||
file_put_contents(
|
||||
'.htaccess',
|
||||
@ -344,11 +349,12 @@ class install extends common {
|
||||
);
|
||||
}
|
||||
// Recopie htaccess
|
||||
if ($this->getData(['config','autoUpdateHtaccess']) &&
|
||||
$success && file_exists( '.htaccess.bak')
|
||||
if (
|
||||
$this->getData(['config', 'autoUpdateHtaccess']) &&
|
||||
$success && file_exists('.htaccess.bak')
|
||||
) {
|
||||
// L'écraser avec le backup
|
||||
$success = copy( '.htaccess.bak' ,'.htaccess' );
|
||||
$success = copy('.htaccess.bak', '.htaccess');
|
||||
// Effacer le backup
|
||||
unlink('.htaccess.bak');
|
||||
}
|
||||
@ -367,7 +373,8 @@ class install extends common {
|
||||
/**
|
||||
* Mise à jour
|
||||
*/
|
||||
public function update() {
|
||||
public function update()
|
||||
{
|
||||
// Nouvelle version
|
||||
self::$newVersion = helper::getUrlContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/version');
|
||||
// Valeurs en sortie
|
||||
@ -377,6 +384,4 @@ class install extends common {
|
||||
'view' => 'update'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -13,7 +13,8 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class maintenance extends common {
|
||||
class maintenance extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR
|
||||
@ -22,22 +23,25 @@ class maintenance extends common {
|
||||
/**
|
||||
* Maintenance
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// Redirection vers l'accueil après rafraîchissement et que la maintenance est terminée.
|
||||
if($this->getData(['config', 'maintenance']) == False){
|
||||
if ($this->getData(['config', 'maintenance']) == False) {
|
||||
header('Location:' . helper::baseUrl());
|
||||
exit();
|
||||
}
|
||||
// Page perso définie et existante
|
||||
if ($this->getData(['locale','page302']) !== 'none'
|
||||
AND $this->getData(['page',$this->getData(['locale','page302'])]) ) {
|
||||
if (
|
||||
$this->getData(['locale', 'page302']) !== 'none'
|
||||
and $this->getData(['page', $this->getData(['locale', 'page302'])])
|
||||
) {
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => $this->getData(['page',$this->getData(['locale','page302']),'hideTitle'])
|
||||
'title' => $this->getData(['page', $this->getData(['locale', 'page302']), 'hideTitle'])
|
||||
? ''
|
||||
: $this->getData(['page',$this->getData(['locale','page302']),'title']),
|
||||
: $this->getData(['page', $this->getData(['locale', 'page302']), 'title']),
|
||||
//'content' => $this->getdata(['page',$this->getData(['locale','page302']),'content']),
|
||||
'content' => $this->getPage($this->getData(['locale','page302']), self::$i18nContent),
|
||||
'content' => $this->getPage($this->getData(['locale', 'page302']), self::$i18nContent),
|
||||
'view' => 'index'
|
||||
]);
|
||||
} else {
|
||||
@ -49,5 +53,4 @@ class maintenance extends common {
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,8 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class page extends common {
|
||||
class page extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'add' => self::GROUP_MODERATOR,
|
||||
@ -68,24 +69,24 @@ class page extends common {
|
||||
/**
|
||||
* Duplication
|
||||
*/
|
||||
public function duplicate() {
|
||||
public function duplicate()
|
||||
{
|
||||
// Adresse sans le token
|
||||
$url = explode('&',$this->getUrl(2));
|
||||
$url = explode('&', $this->getUrl(2));
|
||||
// La page n'existe pas
|
||||
if($this->getData(['page', $url[0]]) === null) {
|
||||
if ($this->getData(['page', $url[0]]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
} // Jeton incorrect
|
||||
elseif(!isset($_GET['csrf'])) {
|
||||
elseif (!isset($_GET['csrf'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
|
||||
'notification' => 'Jeton invalide'
|
||||
]);
|
||||
}
|
||||
elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
|
||||
} elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
|
||||
@ -93,7 +94,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Duplication de la page
|
||||
$pageTitle = $this->getData(['page',$url[0],'title']);
|
||||
$pageTitle = $this->getData(['page', $url[0], 'title']);
|
||||
$pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
|
||||
$pageId = helper::increment($pageId, self::$coreModuleIds);
|
||||
$pageId = helper::increment($pageId, self::$moduleIds);
|
||||
@ -102,16 +103,16 @@ class page extends common {
|
||||
$url[0]
|
||||
]);
|
||||
// Ecriture
|
||||
$this->setData (['page',$pageId,$data]);
|
||||
$this->setData(['page', $pageId, $data]);
|
||||
$notification = 'La page a été dupliquée';
|
||||
// Duplication du module présent
|
||||
if ($this->getData(['page',$url[0],'moduleId'])) {
|
||||
if ($this->getData(['page', $url[0], 'moduleId'])) {
|
||||
$data = $this->getData([
|
||||
'module',
|
||||
$url[0]
|
||||
]);
|
||||
// Ecriture
|
||||
$this->setData (['module',$pageId,$data]);
|
||||
$this->setData(['module', $pageId, $data]);
|
||||
$notification = 'La page et son module ont été dupliqués';
|
||||
}
|
||||
// Valeurs en sortie
|
||||
@ -126,7 +127,8 @@ class page extends common {
|
||||
/**
|
||||
* Création
|
||||
*/
|
||||
public function add() {
|
||||
public function add()
|
||||
{
|
||||
$pageTitle = 'Nouvelle page';
|
||||
$pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
|
||||
$this->setData([
|
||||
@ -181,24 +183,24 @@ class page extends common {
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
public function delete() {
|
||||
public function delete()
|
||||
{
|
||||
// $url prend l'adresse sans le token
|
||||
$url = explode('&',$this->getUrl(2));
|
||||
$url = explode('&', $this->getUrl(2));
|
||||
// La page n'existe pas
|
||||
if($this->getData(['page', $url[0]]) === null) {
|
||||
if ($this->getData(['page', $url[0]]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
} // Jeton incorrect
|
||||
elseif(!isset($_GET['csrf'])) {
|
||||
elseif (!isset($_GET['csrf'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
|
||||
'notification' => 'Jeton invalide'
|
||||
]);
|
||||
}
|
||||
elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
|
||||
} elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
|
||||
@ -206,7 +208,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer la page d'accueil
|
||||
elseif($url[0] === $this->getData(['locale', 'homePageId'])) {
|
||||
elseif ($url[0] === $this->getData(['locale', 'homePageId'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'config',
|
||||
@ -214,7 +216,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer la page de recherche affectée
|
||||
elseif($url[0] === $this->getData(['locale', 'searchPageId'])) {
|
||||
elseif ($url[0] === $this->getData(['locale', 'searchPageId'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'config',
|
||||
@ -222,7 +224,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer la page des mentions légales affectée
|
||||
elseif($url[0] === $this->getData(['locale', 'legalPageId'])) {
|
||||
elseif ($url[0] === $this->getData(['locale', 'legalPageId'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'config',
|
||||
@ -230,7 +232,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer la page des mentions légales affectée
|
||||
elseif($url[0] === $this->getData(['locale', 'page404'])) {
|
||||
elseif ($url[0] === $this->getData(['locale', 'page404'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'config',
|
||||
@ -238,7 +240,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer la page des mentions légales affectée
|
||||
elseif($url[0] === $this->getData(['locale', 'page403'])) {
|
||||
elseif ($url[0] === $this->getData(['locale', 'page403'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'config',
|
||||
@ -246,7 +248,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer la page des mentions légales affectée
|
||||
elseif($url[0] === $this->getData(['locale', 'page302'])) {
|
||||
elseif ($url[0] === $this->getData(['locale', 'page302'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'config',
|
||||
@ -254,14 +256,13 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
elseif(!isset($_GET['csrf'])) {
|
||||
elseif (!isset($_GET['csrf'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
|
||||
'notification' => 'Jeton invalide'
|
||||
]);
|
||||
}
|
||||
elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
|
||||
} elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
|
||||
@ -269,7 +270,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer une page contenant des enfants
|
||||
elseif($this->getHierarchy($url[0],null)) {
|
||||
elseif ($this->getHierarchy($url[0], null)) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
|
||||
@ -280,12 +281,13 @@ class page extends common {
|
||||
else {
|
||||
|
||||
// Effacer le dossier du module
|
||||
$moduleId = $this->getData(['page',$url[0],'moduleId']);
|
||||
$moduleId = $this->getData(['page', $url[0], 'moduleId']);
|
||||
$modulesData = helper::getModules();
|
||||
if ( array_key_exists($moduleId, $modulesData)
|
||||
if (
|
||||
array_key_exists($moduleId, $modulesData)
|
||||
&& is_dir($modulesData[$moduleId]['dataDirectory'] . $url[0])
|
||||
) {
|
||||
$this->removeDir( $modulesData[$moduleId]['dataDirectory']. $url[0] );
|
||||
$this->removeDir($modulesData[$moduleId]['dataDirectory'] . $url[0]);
|
||||
}
|
||||
// Effacer la page
|
||||
$this->deleteData(['page', $url[0]]);
|
||||
@ -310,9 +312,10 @@ class page extends common {
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function edit() {
|
||||
public function edit()
|
||||
{
|
||||
// La page n'existe pas
|
||||
if($this->getData(['page', $this->getUrl(2)]) === null) {
|
||||
if ($this->getData(['page', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
@ -321,11 +324,11 @@ class page extends common {
|
||||
// La page existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Si le Title n'est pas vide, premier test pour positionner la notification du champ obligatoire
|
||||
if( $this->getInput('pageEditTitle', helper::FILTER_ID, true) !== null && $this->getInput('pageEditTitle') !== '' ){
|
||||
if ($this->getInput('pageEditTitle', helper::FILTER_ID, true) !== null && $this->getInput('pageEditTitle') !== '') {
|
||||
// Génére l'ID si le titre de la page a changé
|
||||
if ( $this->getInput('pageEditTitle') !== $this->getData(['page',$this->getUrl(2),'title']) ) {
|
||||
if ($this->getInput('pageEditTitle') !== $this->getData(['page', $this->getUrl(2), 'title'])) {
|
||||
$pageId = $this->getInput('pageEditTitle', helper::FILTER_ID, true);
|
||||
} else {
|
||||
$pageId = $this->getUrl(2);
|
||||
@ -341,72 +344,72 @@ class page extends common {
|
||||
$pageId = helper::increment($pageId, self::$coreModuleIds);
|
||||
$pageId = helper::increment($pageId, self::$moduleIds);
|
||||
// Met à jour les enfants
|
||||
foreach($this->getHierarchy($this->getUrl(2),null) as $childrenPageId) {
|
||||
foreach ($this->getHierarchy($this->getUrl(2), null) as $childrenPageId) {
|
||||
$this->setData(['page', $childrenPageId, 'parentPageId', $pageId]);
|
||||
}
|
||||
// Change l'id de page dans les données des modules
|
||||
if ($this->getData(['module', $this->getUrl(2)]) !== null ) {
|
||||
if ($this->getData(['module', $this->getUrl(2)]) !== null) {
|
||||
$this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]);
|
||||
$this->deleteData(['module', $this->getUrl(2)]);
|
||||
// Renommer le dossier du module
|
||||
$moduleId = $this->getData(['page',$this->getUrl(2),'moduleId']);
|
||||
$moduleId = $this->getData(['page', $this->getUrl(2), 'moduleId']);
|
||||
$modulesData = helper::getModules();
|
||||
if (is_dir($modulesData[$moduleId]['dataDirectory']. $this->getUrl(2))) {
|
||||
if (is_dir($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2))) {
|
||||
// Placer la feuille de style dans un dossier au nom de la nouvelle instance
|
||||
mkdir( $modulesData[$moduleId]['dataDirectory']. $pageId, 0755 );
|
||||
copy( $modulesData[$moduleId]['dataDirectory']. $this->getUrl(2), $modulesData[$moduleId]['dataDirectory']. $pageId);
|
||||
$this->removeDir($modulesData[$moduleId]['dataDirectory']. $this->getUrl(2));
|
||||
mkdir($modulesData[$moduleId]['dataDirectory'] . $pageId, 0755);
|
||||
copy($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2), $modulesData[$moduleId]['dataDirectory'] . $pageId);
|
||||
$this->removeDir($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2));
|
||||
// Mettre à jour le nom de la feuille de style
|
||||
$this->setData(['module',$pageId,'theme','style', $modulesData[$moduleId]['dataDirectory']. $pageId]);
|
||||
$this->setData(['module', $pageId, 'theme', 'style', $modulesData[$moduleId]['dataDirectory'] . $pageId]);
|
||||
}
|
||||
}
|
||||
// Si la page correspond à la page d'accueil, change l'id dans la configuration du site
|
||||
if($this->getData(['locale', 'homePageId']) === $this->getUrl(2)) {
|
||||
if ($this->getData(['locale', 'homePageId']) === $this->getUrl(2)) {
|
||||
$this->setData(['locale', 'homePageId', $pageId]);
|
||||
}
|
||||
}
|
||||
// Supprime les données du module en cas de changement de module
|
||||
if($this->getInput('pageEditModuleId') !== $this->getData(['page', $this->getUrl(2), 'moduleId'])) {
|
||||
if ($this->getInput('pageEditModuleId') !== $this->getData(['page', $this->getUrl(2), 'moduleId'])) {
|
||||
$this->deleteData(['module', $pageId]);
|
||||
}
|
||||
// Supprime l'ancienne page si l'id a changée
|
||||
if($pageId !== $this->getUrl(2)) {
|
||||
if ($pageId !== $this->getUrl(2)) {
|
||||
$this->deleteData(['page', $this->getUrl(2)]);
|
||||
if (file_exists(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getUrl(2) . '.html')) {
|
||||
unlink (self::DATA_DIR . self::$i18nContent . '/content/' . $this->getUrl(2) . '.html');
|
||||
unlink(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getUrl(2) . '.html');
|
||||
}
|
||||
}
|
||||
// Traitement des pages spéciales affectées dans la config :
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'legalPageId']) ) {
|
||||
$this->setData(['locale','legalPageId', $pageId]);
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'legalPageId'])) {
|
||||
$this->setData(['locale', 'legalPageId', $pageId]);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'searchPageId']) ) {
|
||||
$this->setData(['locale','searchPageId', $pageId]);
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'searchPageId'])) {
|
||||
$this->setData(['locale', 'searchPageId', $pageId]);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'page404']) ) {
|
||||
$this->setData(['locale','page404', $pageId]);
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'page404'])) {
|
||||
$this->setData(['locale', 'page404', $pageId]);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'page403']) ) {
|
||||
$this->setData(['locale','page403', $pageId]);
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'page403'])) {
|
||||
$this->setData(['locale', 'page403', $pageId]);
|
||||
}
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'page302']) ) {
|
||||
$this->setData(['locale','page302', $pageId]);
|
||||
if ($this->getUrl(2) === $this->getData(['locale', 'page302'])) {
|
||||
$this->setData(['locale', 'page302', $pageId]);
|
||||
}
|
||||
// Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
|
||||
$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) {
|
||||
foreach ($hierarchy as $hierarchyPageId) {
|
||||
|
||||
// Ne traite que les pages du menu sélectionné
|
||||
if ($this->getData(['page', $hierarchyPageId, 'extraPosition']) === $extraPosition ) {
|
||||
if ($this->getData(['page', $hierarchyPageId, 'extraPosition']) === $extraPosition) {
|
||||
// Ignore la page en cours de modification
|
||||
if($hierarchyPageId === $this->getUrl(2) ) {
|
||||
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) {
|
||||
if ($lastPosition === $position) {
|
||||
$lastPosition++;
|
||||
}
|
||||
// Change la position
|
||||
@ -414,13 +417,11 @@ class page extends common {
|
||||
// Incrémente pour la prochaine position
|
||||
$lastPosition++;
|
||||
}
|
||||
|
||||
}
|
||||
if ($this->getinput('pageEditBlock') !== 'bar') {
|
||||
$barLeft = $this->getinput('pageEditBarLeft');
|
||||
$barRight = $this->getinput('pageEditBarRight');
|
||||
$hideTitle = $this->getInput('pageEditHideTitle', helper::FILTER_BOOLEAN);
|
||||
|
||||
} else {
|
||||
// Une barre ne peut pas avoir de barres
|
||||
$barLeft = "";
|
||||
@ -435,28 +436,28 @@ class page extends common {
|
||||
$position !== $this->getData(['page', $this->getUrl(2), 'position']) &&
|
||||
$this->getinput('pageEditBlock') !== 'bar'
|
||||
) {
|
||||
foreach ($this->getHierarchy($pageId) as $parentId=>$childId) {
|
||||
if ($this->getData(['page',$childId,'parentPageId']) === $pageId) {
|
||||
$this->setData(['page',$childId,'position', 0]);
|
||||
foreach ($this->getHierarchy($pageId) as $parentId => $childId) {
|
||||
if ($this->getData(['page', $childId, 'parentPageId']) === $pageId) {
|
||||
$this->setData(['page', $childId, 'position', 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// La page est une barre latérale qui a été renommée : changer le nom de la barre dans les pages qui l'utilisent
|
||||
if ($this->getinput('pageEditBlock') === 'bar') {
|
||||
foreach ($this->getHierarchy() as $eachPageId=>$parentId) {
|
||||
if ($this->getData(['page',$eachPageId,'barRight']) === $this->getUrl(2)) {
|
||||
$this->setData(['page',$eachPageId,'barRight',$pageId]);
|
||||
foreach ($this->getHierarchy() as $eachPageId => $parentId) {
|
||||
if ($this->getData(['page', $eachPageId, 'barRight']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $eachPageId, 'barRight', $pageId]);
|
||||
}
|
||||
if ($this->getData(['page',$eachPageId,'barLeft']) === $this->getUrl(2)) {
|
||||
$this->setData(['page',$eachPageId,'barLeft',$pageId]);
|
||||
if ($this->getData(['page', $eachPageId, 'barLeft']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $eachPageId, 'barLeft', $pageId]);
|
||||
}
|
||||
foreach ($parentId as $childId) {
|
||||
if ($this->getData(['page',$childId,'barRight']) === $this->getUrl(2)) {
|
||||
$this->setData(['page',$childId,'barRight',$pageId]);
|
||||
if ($this->getData(['page', $childId, 'barRight']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $childId, 'barRight', $pageId]);
|
||||
}
|
||||
if ($this->getData(['page',$childId,'barLeft']) === $this->getUrl(2)) {
|
||||
$this->setData(['page',$childId,'barLeft',$pageId]);
|
||||
if ($this->getData(['page', $childId, 'barLeft']) === $this->getUrl(2)) {
|
||||
$this->setData(['page', $childId, 'barLeft', $pageId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -468,7 +469,7 @@ class page extends common {
|
||||
[
|
||||
'typeMenu' => $this->getinput('pageTypeMenu'),
|
||||
'iconUrl' => $this->getinput('pageIconUrl'),
|
||||
'disable'=> $this->getinput('pageEditDisable', helper::FILTER_BOOLEAN),
|
||||
'disable' => $this->getinput('pageEditDisable', helper::FILTER_BOOLEAN),
|
||||
'content' => $pageId . '.html',
|
||||
'hideTitle' => $hideTitle,
|
||||
'breadCrumb' => $this->getInput('pageEditbreadCrumb', helper::FILTER_BOOLEAN),
|
||||
@ -500,7 +501,7 @@ class page extends common {
|
||||
mkdir(self::DATA_DIR . self::$i18nContent . '/content', 0755);
|
||||
}
|
||||
$content = empty($this->getInput('pageEditContent', null)) ? '<p></p>' : str_replace('<p></p>', '<p> </p>', $this->getInput('pageEditContent', null));
|
||||
$this->setPage($pageId , $content, self::$i18nContent);
|
||||
$this->setPage($pageId, $content, self::$i18nContent);
|
||||
|
||||
// Met à jour le site map
|
||||
$this->createSitemap('all');
|
||||
@ -508,7 +509,7 @@ class page extends common {
|
||||
$this->listPages();
|
||||
|
||||
// Redirection vers la configuration
|
||||
if(
|
||||
if (
|
||||
$this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
@ -527,16 +528,18 @@ class page extends common {
|
||||
}
|
||||
}
|
||||
}
|
||||
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::$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']);
|
||||
}
|
||||
}
|
||||
// Pages barre latérales
|
||||
foreach($this->getHierarchy(null,false,true) as $parentPageId => $childrenPageIds) {
|
||||
if($parentPageId !== $this->getUrl(2) &&
|
||||
$this->getData(['page', $parentPageId, 'block']) === 'bar') {
|
||||
foreach ($this->getHierarchy(null, false, true) as $parentPageId => $childrenPageIds) {
|
||||
if (
|
||||
$parentPageId !== $this->getUrl(2) &&
|
||||
$this->getData(['page', $parentPageId, 'block']) === 'bar'
|
||||
) {
|
||||
self::$pagesBarId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
|
||||
}
|
||||
}
|
||||
@ -554,11 +557,13 @@ class page extends common {
|
||||
/**
|
||||
* Éditeur de feuille de style
|
||||
*/
|
||||
public function cssEditor() {
|
||||
public function cssEditor()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Enregistre le CSS
|
||||
$this->setData(['page', $this->getUrl(2), 'css',
|
||||
$this->setData([
|
||||
'page', $this->getUrl(2), 'css',
|
||||
$this->getInput('pageCssEditorContent', null)
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
@ -581,11 +586,13 @@ class page extends common {
|
||||
/**
|
||||
* Éditeur de feuille de style
|
||||
*/
|
||||
public function jsEditor() {
|
||||
public function jsEditor()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Enregistre le JS
|
||||
$this->setData(['page', $this->getUrl(2), 'js',
|
||||
$this->setData([
|
||||
'page', $this->getUrl(2), 'js',
|
||||
$this->getInput('pageJsEditorContent', null)
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
@ -604,5 +611,4 @@ class page extends common {
|
||||
'view' => 'jsEditor'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('pageCssEditorForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('pageCssEditorBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -10,13 +10,13 @@
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('pageCssEditorSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('pageCssEditorContent', [
|
||||
'value' => empty($this->getData(['page', $this->getUrl(2), 'css' ])) ? '' : $this->getData(['page', $this->getUrl(2), 'css' ]),
|
||||
'value' => empty($this->getData(['page', $this->getUrl(2), 'css'])) ? '' : $this->getData(['page', $this->getUrl(2), 'css']),
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -1,8 +1,8 @@
|
||||
<?php echo template::formOpen('pageEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php $href = helper::baseUrl() . $this->getUrl(2); ?>
|
||||
<?php if ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?>
|
||||
<?php if ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code') $href = helper::baseUrl(); ?>
|
||||
<?php echo template::button('pageEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => $href,
|
||||
@ -16,7 +16,7 @@
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp',
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
]); */?>
|
||||
]); */ ?>
|
||||
</div>
|
||||
<div class="col1 offset6">
|
||||
<?php echo template::button('pageEditDelete', [
|
||||
@ -38,9 +38,9 @@
|
||||
'uniqueSubmission' => true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab">
|
||||
<div class="tab">
|
||||
<?php echo template::button('pageEditContentButton', [
|
||||
'value' => 'Contenu',
|
||||
'class' => 'buttonTab'
|
||||
@ -61,16 +61,16 @@
|
||||
'value' => 'Permission',
|
||||
'class' => 'buttonTab'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="pageEditContentContainer" class="tabContent">
|
||||
<div id="pageEditContentContainer" class="tabContent">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Titres
|
||||
<span id="infoHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/informations-generales" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -113,16 +113,16 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="pageEditPositionContainer" class="tabContent">
|
||||
<div id="pageEditPositionContainer" class="tabContent">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Emplacement dans le menu
|
||||
<span id="positionHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/emplacement-dans-le-menu" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -135,11 +135,11 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php if($this->getHierarchy($this->getUrl(2), false)): ?>
|
||||
<?php if ($this->getHierarchy($this->getUrl(2), false)) : ?>
|
||||
<?php echo template::hidden('pageEditParentPageId', [
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'parentPageId'])
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::select('pageEditParentPageId', $module::$pagesNoParentId, [
|
||||
'label' => 'Page parent',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'parentPageId'])
|
||||
@ -177,14 +177,14 @@
|
||||
<h4>Options avancées
|
||||
<span id="advancedHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/options-d-emplacement-avancee" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="blockContainer">
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('pageTypeMenu', $module::$typeMenu,[
|
||||
<?php echo template::select('pageTypeMenu', $module::$typeMenu, [
|
||||
'label' => 'Apparence',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'typeMenu'])
|
||||
]); ?>
|
||||
@ -204,7 +204,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('pageEditHideMenuSide', true, 'Masquer la page et les pages enfants dans le menu d\'une barre latérale' , [
|
||||
<?php echo template::checkbox('pageEditHideMenuSide', true, 'Masquer la page et les pages enfants dans le menu d\'une barre latérale', [
|
||||
'checked' => $this->getData(['page', $this->getUrl(2), 'hideMenuSide']),
|
||||
'help' => 'La page est affichée dans un menu horizontal mais pas dans le menu vertical d\'une barre latérale.'
|
||||
]); ?>
|
||||
@ -214,9 +214,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="pageEditExtensionContainer" class="tabContent">
|
||||
<div id="pageEditExtensionContainer" class="tabContent">
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
@ -229,9 +229,9 @@
|
||||
'label' => 'Module',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'moduleId'])
|
||||
]); ?>
|
||||
<?php echo template::hidden('pageEditModuleIdOld',['value' => $this->getData(['page', $this->getUrl(2), 'moduleId'])]); ?>
|
||||
<?php echo template::hidden('pageEditModuleIdOldText',[
|
||||
'value' => array_key_exists($this->getData(['page', $this->getUrl(2), 'moduleId']),$module::$moduleIds)? $module::$moduleIds[$this->getData(['page', $this->getUrl(2), 'moduleId'])] : ucfirst($this->getData(['page', $this->getUrl(2), 'moduleId']))
|
||||
<?php echo template::hidden('pageEditModuleIdOld', ['value' => $this->getData(['page', $this->getUrl(2), 'moduleId'])]); ?>
|
||||
<?php echo template::hidden('pageEditModuleIdOldText', [
|
||||
'value' => array_key_exists($this->getData(['page', $this->getUrl(2), 'moduleId']), $module::$moduleIds) ? $module::$moduleIds[$this->getData(['page', $this->getUrl(2), 'moduleId'])] : ucfirst($this->getData(['page', $this->getUrl(2), 'moduleId']))
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 verticalAlignBottom">
|
||||
@ -244,7 +244,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::select('pageModulePosition', $module::$modulePosition,[
|
||||
<?php echo template::select('pageModulePosition', $module::$modulePosition, [
|
||||
'help' => 'En position libre ajoutez le module en plaçant [MODULE] à l\'endroit voulu dans votre page.',
|
||||
'label' => 'Position du module',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'modulePosition'])
|
||||
@ -278,16 +278,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="pageEditLayoutContainer" class="tabContent">
|
||||
<div id="pageEditLayoutContainer" class="tabContent">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Mise en page
|
||||
<span id="layoutHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/mise-en-page-2" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -299,28 +299,28 @@
|
||||
<?php echo template::select('pageEditBlock', $module::$pageBlocks, [
|
||||
'label' => 'Gabarits de page / Barre latérale',
|
||||
'help' => 'Pour définir la page comme barre latérale, choisissez l\'option dans la liste.',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2) , 'block'])
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'block'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<!-- Sélection des barres latérales -->
|
||||
<?php if($this->getHierarchy($this->getUrl(2),false,true)): ?>
|
||||
<?php if ($this->getHierarchy($this->getUrl(2), false, true)) : ?>
|
||||
<?php echo template::hidden('pageEditBarLeft', [
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'barLeft'])
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::select('pageEditBarLeft', $module::$pagesBarId, [
|
||||
'label' => 'Barre latérale gauche :',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'barLeft'])
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
<?php if($this->getHierarchy($this->getUrl(2),false,true)): ?>
|
||||
<?php if ($this->getHierarchy($this->getUrl(2), false, true)) : ?>
|
||||
<?php echo template::hidden('pageEditBarRight', [
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'barRight'])
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::select('pageEditBarRight', $module::$pagesBarId, [
|
||||
'label' => 'Barre latérale droite :',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'barRight'])
|
||||
@ -337,16 +337,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="pageEditPermissionContainer" class="tabContent">
|
||||
<div id="pageEditPermissionContainer" class="tabContent">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Permission et référencement
|
||||
<span id="seoHelpButton" class="helpDisplayButton">
|
||||
<a href="https://doc.zwiicms.fr/permission-et-referencement" target="_blank" title="Cliquer pour consulter l'aide en ligne">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -374,6 +374,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo template::formClose(); ?>
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('pageJsEditorForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('pageJsEditorBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -10,13 +10,13 @@
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('pageJsEditorSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('pageJsEditorContent', [
|
||||
'value' => empty($this->getData(['page', $this->getUrl(2), 'js' ])) ? '': $this->getData(['page', $this->getUrl(2), 'js' ]),
|
||||
'value' => empty($this->getData(['page', $this->getUrl(2), 'js'])) ? '' : $this->getData(['page', $this->getUrl(2), 'js']),
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -14,7 +14,8 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class plugin extends common {
|
||||
class plugin extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_ADMIN,
|
||||
@ -26,7 +27,7 @@ class plugin extends common {
|
||||
'store' => self::GROUP_ADMIN,
|
||||
'item' => self::GROUP_ADMIN, // détail d'un objet
|
||||
'upload' => self::GROUP_ADMIN, // Téléverser catalogue
|
||||
'uploadItem'=> self::GROUP_ADMIN // Téléverser par archive
|
||||
'uploadItem' => self::GROUP_ADMIN // Téléverser par archive
|
||||
];
|
||||
|
||||
// URL des modules
|
||||
@ -52,7 +53,8 @@ class plugin extends common {
|
||||
/*
|
||||
* Effacement d'un module installé et non utilisé
|
||||
*/
|
||||
public function delete() {
|
||||
public function delete()
|
||||
{
|
||||
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
@ -62,25 +64,23 @@ class plugin extends common {
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
// Suppression des dossiers
|
||||
$infoModules = helper::getModules();
|
||||
$module = $this->getUrl(2);
|
||||
//Liste des dossiers associés au module non effacés
|
||||
if( $this->removeDir('./module/'.$module ) === true ){
|
||||
if ($this->removeDir('./module/' . $module) === true) {
|
||||
$success = true;
|
||||
$notification = 'Module '. $module .' désinstallé';
|
||||
if(($infoModules[$this->getUrl(2)]['dataDirectory']) ) {
|
||||
$notification = 'Module ' . $module . ' désinstallé';
|
||||
if (($infoModules[$this->getUrl(2)]['dataDirectory'])) {
|
||||
if (
|
||||
is_dir($infoModules[$this->getUrl(2)]['dataDirectory'])
|
||||
&& !$this->removeDir($infoModules[$this->getUrl(2)]['dataDirectory'])
|
||||
){
|
||||
$notification = 'Module '.$module .' désinstallé, il reste des données dans ' . $infoModules[$this->getUrl(2)]['dataDirectory'];
|
||||
) {
|
||||
$notification = 'Module ' . $module . ' désinstallé, il reste des données dans ' . $infoModules[$this->getUrl(2)]['dataDirectory'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$success = false;
|
||||
$notification = 'La suppression a échouée';
|
||||
}
|
||||
@ -98,7 +98,8 @@ class plugin extends common {
|
||||
* Installation d'un module
|
||||
* Fonction utilisée par upload et storeUpload
|
||||
*/
|
||||
private function install($moduleFileName, $checkValid){
|
||||
private function install($moduleFileName, $checkValid)
|
||||
{
|
||||
|
||||
// Dossier temporaire
|
||||
$tempFolder = uniqid() . '/';
|
||||
@ -112,10 +113,10 @@ class plugin extends common {
|
||||
|
||||
|
||||
//Création du dossier temporaire et extraction
|
||||
if (!is_dir (self::TEMP_DIR . $tempFolder) ) {
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
if (!is_dir(self::TEMP_DIR . $tempFolder)) {
|
||||
mkdir(self::TEMP_DIR . $tempFolder, 0755);
|
||||
}
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder);
|
||||
|
||||
/**
|
||||
* Lecture du descripteur de ressource
|
||||
@ -127,16 +128,15 @@ class plugin extends common {
|
||||
* 'download" => 'module/download'
|
||||
*/
|
||||
|
||||
if (file_exists(self::TEMP_DIR . $tempFolder . 'desc.json')
|
||||
) {
|
||||
if (file_exists(self::TEMP_DIR . $tempFolder . 'desc.json')) {
|
||||
$module = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . 'desc.json'), true);
|
||||
} else {
|
||||
// Message de retour
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
return([
|
||||
return ([
|
||||
'success' => false,
|
||||
'notification'=> 'Archive invalide, le descripteur est absent.'
|
||||
'notification' => 'Archive invalide, le descripteur est absent.'
|
||||
]);
|
||||
}
|
||||
|
||||
@ -145,23 +145,23 @@ class plugin extends common {
|
||||
*/
|
||||
foreach ($module['dirs'] as $src => $dest) {
|
||||
// Vérification de la présence des dossier décrits
|
||||
if ( !is_dir (self::TEMP_DIR . $tempFolder . $src )) {
|
||||
if (!is_dir(self::TEMP_DIR . $tempFolder . $src)) {
|
||||
// Message de retour
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
return([
|
||||
return ([
|
||||
'success' => false,
|
||||
'notification'=> 'Archive invalide, les dossiers ne correspondent pas au descripteur.'
|
||||
'notification' => 'Archive invalide, les dossiers ne correspondent pas au descripteur.'
|
||||
]);
|
||||
}
|
||||
// Interdire l'écriture dans le dossier core
|
||||
if ( strstr($dest, 'core') !== false ) {
|
||||
if (strstr($dest, 'core') !== false) {
|
||||
// Message de retour
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
return([
|
||||
return ([
|
||||
'success' => false,
|
||||
'notification'=> 'Archive invalide, l\'écriture dans le dossier core est interdite'
|
||||
'notification' => 'Archive invalide, l\'écriture dans le dossier core est interdite'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -169,13 +169,13 @@ class plugin extends common {
|
||||
/**
|
||||
* Validation de la présence du fichier de base du module
|
||||
*/
|
||||
if ( !file_exists(self::TEMP_DIR . $tempFolder . $module['name'] . '/' . $module['name'] . '.php')) {
|
||||
if (!file_exists(self::TEMP_DIR . $tempFolder . $module['name'] . '/' . $module['name'] . '.php')) {
|
||||
// Message de retour
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
return([
|
||||
return ([
|
||||
'success' => false,
|
||||
'notification'=> 'Cette archive est invalide, le fichier de classe est absent.'
|
||||
'notification' => 'Cette archive est invalide, le fichier de classe est absent.'
|
||||
]);
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ class plugin extends common {
|
||||
* Le module est-il déjà installé ?
|
||||
* Si oui lire le numéro de version et le stocker dans $versionInstalled
|
||||
*/
|
||||
if (is_file( self::MODULE_DIR . $module['name'] . '/' . $module['name'] . '.php') ) {
|
||||
if (is_file(self::MODULE_DIR . $module['name'] . '/' . $module['name'] . '.php')) {
|
||||
$c = helper::getModules();
|
||||
if (array_key_exists($module['name'], $c)) {
|
||||
$versionInstalled = $c[$module['name']]['version'];
|
||||
@ -193,12 +193,12 @@ class plugin extends common {
|
||||
|
||||
// Le module est installé, contrôle de la version
|
||||
$installOk = false;
|
||||
if ( isset($versionInstalled) === false ) {
|
||||
if (isset($versionInstalled) === false) {
|
||||
$installOk = true;
|
||||
} elseif ( version_compare($module['version'], $versionInstalled) >= 0 ) {
|
||||
} elseif (version_compare($module['version'], $versionInstalled) >= 0) {
|
||||
$installOk = true;
|
||||
} else {
|
||||
if (version_compare($module['version'], $versionInstalled) === -1 ) {
|
||||
if (version_compare($module['version'], $versionInstalled) === -1) {
|
||||
// Contrôle du forçage
|
||||
if ($this->getInput('configModulesCheck', helper::FILTER_BOOLEAN) === true) {
|
||||
$installOk = true;
|
||||
@ -206,9 +206,9 @@ class plugin extends common {
|
||||
// Message de retour
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
return([
|
||||
return ([
|
||||
'success' => false,
|
||||
'notification'=> 'La version installée est plus récente.'
|
||||
'notification' => 'La version installée est plus récente.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -218,23 +218,24 @@ class plugin extends common {
|
||||
if ($installOk) {
|
||||
// Copie récursive des dossiers
|
||||
foreach ($module['dirs'] as $src => $dest) {
|
||||
if (!is_dir (self::TEMP_DIR . $tempFolder . $src)) {
|
||||
if (!is_dir(self::TEMP_DIR . $tempFolder . $src)) {
|
||||
mkdir(self::TEMP_DIR . $tempFolder . $src);
|
||||
}
|
||||
$success = $this->copyDir( self::TEMP_DIR . $tempFolder . $src, $dest );
|
||||
$success = $this->copyDir(self::TEMP_DIR . $tempFolder . $src, $dest);
|
||||
}
|
||||
// Message de retour
|
||||
$t = isset($versionInstalled) ? ' actualisé' : 'installé';
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
return(['success' => $success,
|
||||
'notification'=> $success ? 'Le module '.$module['name'].' a été ' . $t
|
||||
return ([
|
||||
'success' => $success,
|
||||
'notification' => $success ? 'Le module ' . $module['name'] . ' a été ' . $t
|
||||
: 'Erreur inconnue, le module n\'est pas installé'
|
||||
]);
|
||||
} else {
|
||||
return([
|
||||
return ([
|
||||
'success' => false,
|
||||
'notification'=> 'Une erreur inconnue s\est produite !'
|
||||
'notification' => 'Une erreur inconnue s\est produite !'
|
||||
]);
|
||||
// Supprimer le dossier temporaire
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
@ -242,28 +243,29 @@ class plugin extends common {
|
||||
}
|
||||
} else {
|
||||
// Message de retour
|
||||
return(['success' => $success,
|
||||
'notification'=> 'Impossible d\'ouvrir l\'archive'
|
||||
return ([
|
||||
'success' => false,
|
||||
'notification' => 'Impossible d\'ouvrir l\'archive'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* Installation d'un module à partir du gestionnaire de fichier
|
||||
*/
|
||||
public function upload() {
|
||||
public function upload()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Installation d'un module
|
||||
$checkValidMaj = $this->getInput('configModulesCheck', helper::FILTER_BOOLEAN);
|
||||
$zipFilename = $this->getInput('configModulesInstallation', helper::FILTER_STRING_SHORT);
|
||||
if( $zipFilename !== ''){
|
||||
if ($zipFilename !== '') {
|
||||
$success = [
|
||||
'success' => false,
|
||||
'notification'=> ''
|
||||
'notification' => ''
|
||||
];
|
||||
$state = $this->install(self::FILE_DIR.'source/'.$zipFilename, $checkValidMaj);
|
||||
$state = $this->install(self::FILE_DIR . 'source/' . $zipFilename, $checkValidMaj);
|
||||
}
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
@ -281,7 +283,8 @@ class plugin extends common {
|
||||
/***
|
||||
* Installation d'un module depuis le catalogue
|
||||
*/
|
||||
public function uploadItem() {
|
||||
public function uploadItem()
|
||||
{
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
@ -300,17 +303,17 @@ class plugin extends common {
|
||||
// Télécharger le fichier
|
||||
$moduleData = helper::getUrlContents(self::BASEURL_STORE . self::FILE_DIR . 'source/' . $moduleFilePath);
|
||||
// Extraire de l'arborescence
|
||||
$d = explode('/',$moduleFilePath);
|
||||
$moduleFile = $d[count($d)-1];
|
||||
$d = explode('/', $moduleFilePath);
|
||||
$moduleFile = $d[count($d) - 1];
|
||||
// Créer le dossier modules
|
||||
if (!is_dir(self::FILE_DIR . 'source/modules')) {
|
||||
mkdir (self::FILE_DIR . 'source/modules', 0755);
|
||||
mkdir(self::FILE_DIR . 'source/modules', 0755);
|
||||
}
|
||||
// Sauver les données du fichiers
|
||||
file_put_contents(self::FILE_DIR . 'source/modules/' . $moduleFile, $moduleData);
|
||||
|
||||
// Installation directe
|
||||
if ( file_exists(self::FILE_DIR . 'source/modules/' . $moduleFile) ) {
|
||||
if (file_exists(self::FILE_DIR . 'source/modules/' . $moduleFile)) {
|
||||
$r = $this->install(self::FILE_DIR . 'source/modules/' . $moduleFile, false);
|
||||
} else {
|
||||
$r['notification'] = 'Un problème est survenu, le module n\'est pas installé';
|
||||
@ -333,45 +336,46 @@ class plugin extends common {
|
||||
/**
|
||||
* Catalogue des modules sur le site ZwiiCMS.fr
|
||||
*/
|
||||
public function store() {
|
||||
public function store()
|
||||
{
|
||||
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
if ($store) {
|
||||
// Modules installés
|
||||
$infoModules = helper::getModules();
|
||||
// Clés moduleIds dans les pages
|
||||
$inPages = helper::arrayColumn($this->getData(['page']),'moduleId', 'SORT_DESC');
|
||||
foreach( $inPages as $key=>$value){
|
||||
$pagesInfos[ $this->getData(['page', $key, 'title' ]) ] = $value;
|
||||
$inPages = helper::arrayColumn($this->getData(['page']), 'moduleId', 'SORT_DESC');
|
||||
foreach ($inPages as $key => $value) {
|
||||
$pagesInfos[$this->getData(['page', $key, 'title'])] = $value;
|
||||
}
|
||||
// Parcourir les données des modules
|
||||
foreach ($store as $key=>$value) {
|
||||
foreach ($store as $key => $value) {
|
||||
// Module non installé
|
||||
$ico = template::ico('download');
|
||||
$class = '';
|
||||
$help = 'Télécharger le module dans le gestionnaire de fichiers';
|
||||
// Le module est installé
|
||||
if (array_key_exists($key,$infoModules) === true) {
|
||||
if (array_key_exists($key, $infoModules) === true) {
|
||||
$class = 'buttonGreen';
|
||||
$ico = template::ico('update');
|
||||
$help = 'Mettre à jour le module orphelin';
|
||||
}
|
||||
// Le module est installé et utilisé
|
||||
if (in_array($key,$inPages) === true) {
|
||||
if (in_array($key, $inPages) === true) {
|
||||
$class = 'buttonRed';
|
||||
$ico = template::ico('update');
|
||||
$help = 'Mettre à jour le module attaché, une sauvegarde des données de module est recommandée !';
|
||||
}
|
||||
self::$storeList [] = [
|
||||
self::$storeList[] = [
|
||||
$store[$key]['category'],
|
||||
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >'.$store[$key]['title'].'</a>',
|
||||
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >' . $store[$key]['title'] . '</a>',
|
||||
$store[$key]['version'],
|
||||
mb_detect_encoding(strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $store[$key]['versionDate'])
|
||||
: utf8_encode(strftime('%d %B %Y', $store[$key]['versionDate'])),
|
||||
implode(', ', array_keys($pagesInfos,$key)),
|
||||
implode(', ', array_keys($pagesInfos, $key)),
|
||||
template::button('moduleExport' . $key, [
|
||||
'class' => $class,
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/uploadItem/' . $key.'/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/uploadItem/' . $key . '/' . $_SESSION['csrf'], // appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => $ico,
|
||||
'help' => $help
|
||||
])
|
||||
@ -389,15 +393,16 @@ class plugin extends common {
|
||||
/**
|
||||
* Détail d'un objet du catalogue
|
||||
*/
|
||||
public function item() {
|
||||
public function item()
|
||||
{
|
||||
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
self::$storeItem = $store [$this->getUrl(2)] ;
|
||||
self::$storeItem ['fileDate'] = mb_detect_encoding(strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', self::$storeItem ['fileDate'])
|
||||
: utf8_encode(strftime('%d %B %Y', self::$storeItem ['fileDate']));
|
||||
self::$storeItem = $store[$this->getUrl(2)];
|
||||
self::$storeItem['fileDate'] = mb_detect_encoding(strftime('%d %B %Y', self::$storeItem['fileDate']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', self::$storeItem['fileDate'])
|
||||
: utf8_encode(strftime('%d %B %Y', self::$storeItem['fileDate']));
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' =>'Module ' . self::$storeItem['title'],
|
||||
'title' => 'Module ' . self::$storeItem['title'],
|
||||
'view' => 'item'
|
||||
]);
|
||||
}
|
||||
@ -405,12 +410,15 @@ class plugin extends common {
|
||||
/**
|
||||
* Gestion des modules
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
|
||||
// Tableau des langues rédigées
|
||||
foreach (self::$languages as $key => $value) {
|
||||
if ($this->getData(['config','i18n', $key]) === 'site' ||
|
||||
$key === 'fr_FR') {
|
||||
if (
|
||||
$this->getData(['config', 'i18n', $key]) === 'site' ||
|
||||
$key === 'fr_FR'
|
||||
) {
|
||||
$i18nSites[$key] = $value;
|
||||
}
|
||||
}
|
||||
@ -418,35 +426,34 @@ class plugin extends common {
|
||||
$infoModules = helper::getModules();
|
||||
|
||||
// Parcourir les langues du site traduit et recherche les modules affectés à des pages
|
||||
foreach ($i18nSites as $keyi18n=>$valuei18n) {
|
||||
foreach ($i18nSites as $keyi18n => $valuei18n) {
|
||||
|
||||
// Clés moduleIds dans les pages de la langue
|
||||
$pages = json_decode(file_get_contents(self::DATA_DIR . $keyi18n . '/' . 'page.json'), true);
|
||||
|
||||
// Extraire les clés des modules
|
||||
$pagesModules [$keyi18n] = array_filter(helper::arrayColumn($pages['page'],'moduleId', 'SORT_DESC'), 'strlen');
|
||||
$pagesModules[$keyi18n] = array_filter(helper::arrayColumn($pages['page'], 'moduleId', 'SORT_DESC'), 'strlen');
|
||||
|
||||
// Générer ls liste des pages avec module pour la sauvegarde ou le backup
|
||||
foreach( $pagesModules [$keyi18n] as $key=>$value ) {
|
||||
foreach ($pagesModules[$keyi18n] as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
$pagesInfos [$keyi18n] [$key] ['pageId'] = $key ;
|
||||
$pagesInfos [$keyi18n] [$key] ['title'] = $this->getData(['page', $key, 'title' ]) ;
|
||||
$pagesInfos [$keyi18n] [$key] ['moduleId'] = $value;
|
||||
$pagesInfos[$keyi18n][$key]['pageId'] = $key;
|
||||
$pagesInfos[$keyi18n][$key]['title'] = $this->getData(['page', $key, 'title']);
|
||||
$pagesInfos[$keyi18n][$key]['moduleId'] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Recherche des modules orphelins dans toutes les langues
|
||||
$orphans = $installed = array_flip(array_keys ($infoModules));
|
||||
foreach ($i18nSites as $keyi18n=>$valuei18n) {
|
||||
$orphans = $installed = array_flip(array_keys($infoModules));
|
||||
foreach ($i18nSites as $keyi18n => $valuei18n) {
|
||||
// Générer la liste des modules orphelins
|
||||
foreach ($infoModules as $key=>$value) {
|
||||
foreach ($infoModules as $key => $value) {
|
||||
// Supprimer les éléments affectés
|
||||
if (array_search($key, $pagesModules[$keyi18n]) ) {
|
||||
unset($orphans [$key]);
|
||||
if (array_search($key, $pagesModules[$keyi18n])) {
|
||||
unset($orphans[$key]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$orphans = array_flip($orphans);
|
||||
@ -455,15 +462,15 @@ class plugin extends common {
|
||||
if (isset($orphans)) {
|
||||
foreach ($orphans as $key) {
|
||||
// Construire le tableau de sortie
|
||||
self::$modulesOrphan [] = [
|
||||
$infoModules [$key] ['realName'],
|
||||
self::$modulesOrphan[] = [
|
||||
$infoModules[$key]['realName'],
|
||||
$key,
|
||||
$infoModules [$key] ['version'],
|
||||
$infoModules[$key]['version'],
|
||||
'',
|
||||
$infoModules[$key] ['delete'] === true
|
||||
$infoModules[$key]['delete'] === true
|
||||
? template::button('moduleDelete' . $key, [
|
||||
'class' => 'moduleDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' .$key . '/' . $_SESSION['csrf'],
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('trash'),
|
||||
'help' => 'Supprimer le module'
|
||||
])
|
||||
@ -478,18 +485,18 @@ class plugin extends common {
|
||||
if (isset($installed)) {
|
||||
foreach (array_flip($installed) as $key) {
|
||||
// Construire le tableau de sortie
|
||||
self::$modulesInstalled [] = [
|
||||
$infoModules [$key] ['realName'],
|
||||
self::$modulesInstalled[] = [
|
||||
$infoModules[$key]['realName'],
|
||||
$key,
|
||||
$infoModules [$key] ['version'],
|
||||
$infoModules[$key]['version'],
|
||||
'',
|
||||
template::button('moduleSave' . $key, [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/save/filemanager/' .$key . '/' . $_SESSION['csrf'],
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/save/filemanager/' . $key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('download-cloud'),
|
||||
'help' => 'Sauvegarder le module dans le gestionnaire de fichiers'
|
||||
]),
|
||||
template::button('moduleDownload' . $key, [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/save/download/' .$key . '/' . $_SESSION['csrf'],
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/save/download/' . $key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('download'),
|
||||
'help' => 'Sauvegarder et télécharger le module'
|
||||
])
|
||||
@ -503,26 +510,26 @@ class plugin extends common {
|
||||
// Avec les commandes de sauvegarde et de restauration
|
||||
|
||||
$keyi18n = self::$i18nContent;
|
||||
if (isset($pagesInfos) &&
|
||||
is_array($pagesInfos[self::$i18nContent]) )
|
||||
{
|
||||
foreach ($pagesInfos[self::$i18nContent] as $keyPage=>$value) {
|
||||
if (isset($infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']]))
|
||||
{
|
||||
if (
|
||||
isset($pagesInfos) &&
|
||||
is_array($pagesInfos[self::$i18nContent])
|
||||
) {
|
||||
foreach ($pagesInfos[self::$i18nContent] as $keyPage => $value) {
|
||||
if (isset($infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']])) {
|
||||
// Co[nstruire le tableau de sortie
|
||||
self::$modulesData[] = [
|
||||
$infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']] ['realName'],
|
||||
$infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']]['realName'],
|
||||
$pagesInfos[$keyi18n][$keyPage]['moduleId'],
|
||||
$infoModules[$pagesInfos [$keyi18n][$keyPage]['moduleId']] ['version'],
|
||||
$infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']]['version'],
|
||||
//template::flag($keyi18n, '20px'),
|
||||
'<a href ="' . helper::baseUrl() . $keyPage . '" target="_blank">' . $pagesInfos [$keyi18n][$keyPage]['title'] . ' (' .$keyPage . ')</a>',
|
||||
'<a href ="' . helper::baseUrl() . $keyPage . '" target="_blank">' . $pagesInfos[$keyi18n][$keyPage]['title'] . ' (' . $keyPage . ')</a>',
|
||||
template::button('dataExport' . $keyPage, [
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/dataExport/' . $keyi18n . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/' . $keyi18n . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage . '/' . $_SESSION['csrf'], // appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => template::ico('download'),
|
||||
'help' => 'Exporter les données du module'
|
||||
]),
|
||||
template::button('dataDelete' . $keyPage, [
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/dataDelete/' . $keyi18n . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataDelete/' . $keyi18n . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage . '/' . $_SESSION['csrf'], // appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => template::ico('trash'),
|
||||
'class' => 'buttonRed dataDelete',
|
||||
'help' => 'Détacher le module de la page',
|
||||
@ -548,7 +555,8 @@ class plugin extends common {
|
||||
* Sauvegarde un module sans les données
|
||||
*/
|
||||
|
||||
public function save() {
|
||||
public function save()
|
||||
{
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
@ -567,14 +575,14 @@ class plugin extends common {
|
||||
|
||||
//Nom de l'archive
|
||||
$fileName = $this->getUrl(3) . '.zip';
|
||||
$this->makeZip ($tmpFolder . '/' . $fileName, self::MODULE_DIR . $this->getUrl(3));
|
||||
$this->makeZip($tmpFolder . '/' . $fileName, self::MODULE_DIR . $this->getUrl(3));
|
||||
|
||||
switch ($this->getUrl(2)) {
|
||||
case 'filemanager':
|
||||
if (!file_exists(self::FILE_DIR . 'source/modules')) {
|
||||
mkdir(self::FILE_DIR . 'source/modules');
|
||||
}
|
||||
$success = copy($tmpFolder . '/' . $fileName , self::FILE_DIR . 'source/modules/' . $this->getUrl(3) . '.zip' );
|
||||
$success = copy($tmpFolder . '/' . $fileName, self::FILE_DIR . 'source/modules/' . $this->getUrl(3) . '.zip');
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -590,7 +598,7 @@ class plugin extends common {
|
||||
header('Content-Length: ' . filesize($tmpFolder . '/' . $fileName));
|
||||
ob_clean();
|
||||
ob_end_flush();
|
||||
readfile( $tmpFolder . '/' .$fileName);
|
||||
readfile($tmpFolder . '/' . $fileName);
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
@ -608,7 +616,8 @@ class plugin extends common {
|
||||
* 4 : pageId
|
||||
* 5 : CSRF
|
||||
*/
|
||||
public function dataDelete() {
|
||||
public function dataDelete()
|
||||
{
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(5) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
@ -623,12 +632,10 @@ class plugin extends common {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'notification' => 'Le module ' . $this->getUrl(3) . ' de la page '. $this->getUrl(4) . ' a été supprimé.',
|
||||
'notification' => 'Le module ' . $this->getUrl(3) . ' de la page ' . $this->getUrl(4) . ' a été supprimé.',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -640,7 +647,8 @@ class plugin extends common {
|
||||
* 4 : pageId
|
||||
* 5 : CSRF
|
||||
*/
|
||||
public function dataExport() {
|
||||
public function dataExport()
|
||||
{
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(5) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
@ -659,26 +667,25 @@ class plugin extends common {
|
||||
|
||||
|
||||
// Copie des infos sur le module
|
||||
$modulesData = json_decode(file_get_contents(self::DATA_DIR . $this->getUrl(2) . '/module.json' ), true);
|
||||
$moduleData = $modulesData['module'] [$this->getUrl(4)];
|
||||
$success = file_put_contents ($tmpFolder . '/module.json', json_encode($moduleData));
|
||||
$modulesData = json_decode(file_get_contents(self::DATA_DIR . $this->getUrl(2) . '/module.json'), true);
|
||||
$moduleData = $modulesData['module'][$this->getUrl(4)];
|
||||
$success = file_put_contents($tmpFolder . '/module.json', json_encode($moduleData));
|
||||
|
||||
// Le dossier du module s'il existe
|
||||
if (is_dir(self::DATA_DIR . $this->getUrl(3) . '/' . $this->getUrl(4) ) ) {
|
||||
if (is_dir(self::DATA_DIR . $this->getUrl(3) . '/' . $this->getUrl(4))) {
|
||||
// Copier le dossier des données
|
||||
$success .= $this->copyDir(self::DATA_DIR . $this->getUrl(3) . '/' . $this->getUrl(4), $tmpFolder);
|
||||
}
|
||||
|
||||
// Descripteur de l'archive
|
||||
$infoModule = helper::getModules();
|
||||
$success .= file_put_contents ($tmpFolder . '/descripteur.json', json_encode( [$this->getUrl(3) => $infoModule [$this->getUrl(3)]] ));
|
||||
$success .= file_put_contents($tmpFolder . '/descripteur.json', json_encode([$this->getUrl(3) => $infoModule[$this->getUrl(3)]]));
|
||||
|
||||
|
||||
// création du zip
|
||||
if ($success)
|
||||
{
|
||||
if ($success) {
|
||||
$fileName = $this->getUrl(2) . '-' . $this->getUrl(3) . '-' . $this->getUrl(4) . '.zip';
|
||||
$this->makeZip ($fileName, $tmpFolder);
|
||||
$this->makeZip($fileName, $tmpFolder);
|
||||
if (file_exists($fileName)) {
|
||||
ob_start();
|
||||
header('Content-Type: application/octet-stream');
|
||||
@ -686,7 +693,7 @@ class plugin extends common {
|
||||
header('Content-Length: ' . filesize($fileName));
|
||||
ob_clean();
|
||||
ob_end_flush();
|
||||
readfile( $fileName);
|
||||
readfile($fileName);
|
||||
unlink($fileName);
|
||||
$this->removeDir($tmpFolder);
|
||||
exit();
|
||||
@ -705,31 +712,32 @@ class plugin extends common {
|
||||
/*
|
||||
* Importer des données d'un module externes ou interne à module.json
|
||||
*/
|
||||
public function dataImport(){
|
||||
public function dataImport()
|
||||
{
|
||||
|
||||
// Soumission du formulaire d'importation du module dans une page libre
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Récupérer le fichier et le décompacter
|
||||
$zipFilename = $this->getInput('pluginImportFile', helper::FILTER_STRING_SHORT, true);
|
||||
$targetPage = $this->getInput('pluginImportPage', helper::FILTER_STRING_SHORT, true);
|
||||
$tempFolder = uniqid();
|
||||
|
||||
// Extraction dans un dossier temporaire
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
mkdir(self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open(self::FILE_DIR . 'source/' . $zipFilename) === TRUE) {
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder);
|
||||
}
|
||||
|
||||
// Lire le descripteur
|
||||
$descripteur = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . '/descripteur.json'), true);
|
||||
|
||||
// Lecture des données du module
|
||||
$moduleData = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . '/module.json'), true );
|
||||
$moduleData = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . '/module.json'), true);
|
||||
// Chargement des données du module importé
|
||||
$this->setData(['module', $targetPage, $moduleData ]);
|
||||
$this->setData(['module', $targetPage, $moduleData]);
|
||||
// Intégration des données du module importé dans la page
|
||||
$this->setData(['page', $targetPage ,'moduleId', array_key_first($descripteur) ]);
|
||||
$this->setData(['page', $targetPage, 'moduleId', array_key_first($descripteur)]);
|
||||
|
||||
// Supprimer le dossier temporaire
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
@ -745,7 +753,7 @@ class plugin extends common {
|
||||
]);
|
||||
}
|
||||
// Bouton d'importation des données d'un module spécifique
|
||||
if (count(explode('/',$this->getUrl())) === 6) {
|
||||
if (count(explode('/', $this->getUrl())) === 6) {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
@ -772,10 +780,11 @@ class plugin extends common {
|
||||
* et ne sont pas des barres latérales
|
||||
*/
|
||||
self::$pagesList = $this->getHierarchy(null, null, null);
|
||||
foreach(self::$pagesList as $page => $pageId) {
|
||||
if ($this->getData(['page',$page,'block']) === 'bar' ||
|
||||
foreach (self::$pagesList as $page => $pageId) {
|
||||
if (
|
||||
$this->getData(['page', $page, 'block']) === 'bar' ||
|
||||
//$this->getData(['page',$page,'disable']) === true ||
|
||||
$this->getData(['page',$page,'moduleId']) !== ''
|
||||
$this->getData(['page', $page, 'moduleId']) !== ''
|
||||
) {
|
||||
unset(self::$pagesList[$page]);
|
||||
}
|
||||
@ -788,7 +797,4 @@ class plugin extends common {
|
||||
'view' => 'dataImport'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -41,44 +41,44 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="tabContent" id="moduleContainer">
|
||||
<?php if($module::$modulesInstalled): ?>
|
||||
<?php if ($module::$modulesInstalled) : ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Sauvegarde'); ?>
|
||||
</h4>
|
||||
<?php echo template::table([2, 2, 1, 5, 1, 1], $module::$modulesInstalled, [ 'Module', 'Identifiant', 'Version', '', '', '']); ?>
|
||||
<?php echo template::table([2, 2, 1, 5, 1, 1], $module::$modulesInstalled, ['Module', 'Identifiant', 'Version', '', '', '']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::speech('Aucun module installé.'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if($module::$modulesOrphan): ?>
|
||||
<?php if ($module::$modulesOrphan) : ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Modules orphelins'); ?>
|
||||
</h4>
|
||||
<?php echo template::table([2, 2, 1, 6, 1], $module::$modulesOrphan, [ 'Module', 'Identifiant', 'Version', '', '']); ?>
|
||||
<?php echo template::table([2, 2, 1, 6, 1], $module::$modulesOrphan, ['Module', 'Identifiant', 'Version', '', '']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::speech('Aucun module orphelin.'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="tabContent displayNone" id="dataContainer">
|
||||
<?php if($module::$modulesData): ?>
|
||||
<?php if ($module::$modulesData) : ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Modules configurés'); ?>
|
||||
|
||||
<?php echo template::flag( self::$i18nContent, '20px'); ?>
|
||||
<?php echo template::flag(self::$i18nContent, '20px'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col1 offset11">
|
||||
@ -91,13 +91,13 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::table([2, 2, 1, 5, 1, 1], $module::$modulesData, [ 'Module', 'Identifiant', 'Version', 'Page', '', '']); ?>
|
||||
<?php echo template::table([2, 2, 1, 5, 1, 1], $module::$modulesData, ['Module', 'Identifiant', 'Version', 'Page', '', '']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::speech('Aucune donnée de module.'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
@ -7,8 +7,8 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$storeList): ?>
|
||||
<?php if ($module::$storeList) : ?>
|
||||
<?php echo template::table([2, 2, 1, 2, 2, 1], $module::$storeList, ['Catégorie', 'Module', 'Version', 'Date', 'Page', '']); ?>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::speech('Le catalogue est vide.'); ?>
|
||||
<?php endif; ?>
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('configModulesUpload'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('configModulesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -17,13 +17,13 @@
|
||||
]);*/ ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configModulesSubmit',[
|
||||
<?php echo template::submit('configModulesSubmit', [
|
||||
'value' => 'Valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -47,5 +47,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -31,18 +31,20 @@ class sitemap extends common
|
||||
$items .= ' <li>';
|
||||
if ($this->getData(['page', $parentId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
|
||||
$pageUrl = ($parentId !== $this->getData(['locale', 'homePageId'])) ? helper::baseUrl() . $parentId : helper::baseUrl(false);
|
||||
$items .= '<a href="' . $pageUrl .'">' .$this->getData(['page', $parentId, 'title']) . '</a>';
|
||||
$items .= '<a href="' . $pageUrl . '">' . $this->getData(['page', $parentId, 'title']) . '</a>';
|
||||
} else {
|
||||
// page désactivée
|
||||
$items .= $this->getData(['page', $parentId, 'title']);
|
||||
}
|
||||
// ou articles d'un blog
|
||||
|
||||
if ($this->getData(['page', $parentId, 'moduleId']) === 'blog' &&
|
||||
!empty($this->getData(['module',$parentId, 'posts' ]))) {
|
||||
if (
|
||||
$this->getData(['page', $parentId, 'moduleId']) === 'blog' &&
|
||||
!empty($this->getData(['module', $parentId, 'posts']))
|
||||
) {
|
||||
$items .= '<ul>';
|
||||
// Ids des articles par ordre de publication
|
||||
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $parentId,'posts']), 'publishedOn', '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) {
|
||||
@ -51,9 +53,9 @@ class sitemap extends common
|
||||
}
|
||||
}
|
||||
foreach ($articleIds as $articleId => $article) {
|
||||
if ($this->getData(['module',$parentId,'posts',$article,'state']) === true) {
|
||||
if ($this->getData(['module', $parentId, 'posts', $article, 'state']) === true) {
|
||||
$items .= ' <li>';
|
||||
$items .= '<a href="' . helper::baseUrl() . $parentId. '/' . $article . '">' . $this->getData(['module',$parentId,'posts',$article,'title']) . '</a>';
|
||||
$items .= '<a href="' . helper::baseUrl() . $parentId . '/' . $article . '">' . $this->getData(['module', $parentId, 'posts', $article, 'title']) . '</a>';
|
||||
$items .= '</li>';
|
||||
}
|
||||
}
|
||||
@ -65,7 +67,7 @@ class sitemap extends common
|
||||
// Sous-page
|
||||
$items .= ' <li>';
|
||||
if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
|
||||
$pageUrl = ($childId !== $this->getData(['locale', 'homePageId'])) ? helper::baseUrl() . $childId : helper::baseUrl(false) ;
|
||||
$pageUrl = ($childId !== $this->getData(['locale', 'homePageId'])) ? helper::baseUrl() . $childId : helper::baseUrl(false);
|
||||
$items .= '<a href="' . $pageUrl . '">' . $this->getData(['page', $childId, 'title']) . '</a>';
|
||||
} else {
|
||||
// page désactivée
|
||||
@ -74,11 +76,13 @@ class sitemap extends common
|
||||
$items .= '</li>';
|
||||
|
||||
// Articles d'une sous-page blog
|
||||
if ($this->getData(['page', $childId, 'moduleId']) === 'blog' &&
|
||||
!empty($this->getData(['module', $childId, 'posts' ]))) {
|
||||
if (
|
||||
$this->getData(['page', $childId, 'moduleId']) === 'blog' &&
|
||||
!empty($this->getData(['module', $childId, 'posts']))
|
||||
) {
|
||||
$items .= '<ul>';
|
||||
// Ids des articles par ordre de publication
|
||||
$articleIdsPublishedOns = helper::arrayColumn($this->getData(['module', $childId,'posts']), 'publishedOn', '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) {
|
||||
@ -87,9 +91,9 @@ class sitemap extends common
|
||||
}
|
||||
}
|
||||
foreach ($articleIds as $articleId => $article) {
|
||||
if ($this->getData(['module',$childId,'posts',$article,'state']) === true) {
|
||||
if ($this->getData(['module', $childId, 'posts', $article, 'state']) === true) {
|
||||
$items .= ' <li>';
|
||||
$items .= '<a href="' . helper::baseUrl() . $childId . '/' . $article . '">' . $this->getData(['module',$childId,'posts',$article,'title']) . '</a>';
|
||||
$items .= '<a href="' . helper::baseUrl() . $childId . '/' . $article . '">' . $this->getData(['module', $childId, 'posts', $article, 'title']) . '</a>';
|
||||
$items .= '</li>';
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
echo "<div id='siteMap'>";
|
||||
echo $module::$siteMap;
|
||||
echo "</div>";
|
||||
echo "<div id='siteMap'>";
|
||||
echo $module::$siteMap;
|
||||
echo "</div>";
|
||||
|
@ -14,7 +14,8 @@
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
*/
|
||||
|
||||
class theme extends common {
|
||||
class theme extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'advanced' => self::GROUP_ADMIN,
|
||||
@ -51,21 +52,25 @@ class theme extends common {
|
||||
public static $footerblocks = [
|
||||
1 => [
|
||||
'hide' => 'Masqué',
|
||||
'center' => 'Affiché' ],
|
||||
'center' => 'Affiché'
|
||||
],
|
||||
2 => [
|
||||
'hide' => 'Masqué',
|
||||
'left' => 'À gauche',
|
||||
'right' => 'À droite' ],
|
||||
'right' => 'À droite'
|
||||
],
|
||||
3 => [
|
||||
'hide' => 'Masqué',
|
||||
'left' => 'À gauche',
|
||||
'center' => 'Au centre',
|
||||
'right' => 'À droite' ],
|
||||
'right' => 'À droite'
|
||||
],
|
||||
4 => [
|
||||
'hide' => 'Masqué',
|
||||
'left' => 'En haut',
|
||||
'center' => 'Au milieu',
|
||||
'right' => 'En bas' ]
|
||||
'right' => 'En bas'
|
||||
]
|
||||
];
|
||||
|
||||
public static $fontWeights = [
|
||||
@ -232,7 +237,7 @@ class theme extends common {
|
||||
// Variable pour construire la liste des pages du site
|
||||
public static $pagesList = [];
|
||||
// Variable pour construire la liste des fontes installées
|
||||
public static $fontsNames= [];
|
||||
public static $fontsNames = [];
|
||||
public static $fonts = [];
|
||||
// Variable pour détailler les fontes installées
|
||||
public static $fontsDetail = [];
|
||||
@ -240,9 +245,10 @@ class theme extends common {
|
||||
/**
|
||||
* Thème des écrans d'administration
|
||||
*/
|
||||
public function admin() {
|
||||
public function admin()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
$this->setData(['admin', [
|
||||
'backgroundColor' => $this->getInput('adminBackgroundColor'),
|
||||
'colorTitle' => $this->getInput('adminColorTitle'),
|
||||
@ -251,8 +257,8 @@ class theme extends common {
|
||||
'backgroundColorButton' => $this->getInput('adminColorButton'),
|
||||
'backgroundColorButtonGrey' => $this->getInput('adminColorGrey'),
|
||||
'backgroundColorButtonRed' => $this->getInput('adminColorRed'),
|
||||
'backgroundColorButtonGreen'=> $this->getInput('adminColorGreen'),
|
||||
'backgroundColorButtonHelp'=> $this->getInput('adminColorHelp'),
|
||||
'backgroundColorButtonGreen' => $this->getInput('adminColorGreen'),
|
||||
'backgroundColorButtonHelp' => $this->getInput('adminColorHelp'),
|
||||
'fontText' => $this->getInput('adminFontText'),
|
||||
'fontSize' => $this->getInput('adminFontTextSize'),
|
||||
'fontTitle' => $this->getInput('adminFontTitle'),
|
||||
@ -283,11 +289,12 @@ class theme extends common {
|
||||
/**
|
||||
* Mode avancé
|
||||
*/
|
||||
public function advanced() {
|
||||
public function advanced()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Enregistre le CSS
|
||||
file_put_contents(self::DATA_DIR.'custom.css', $this->getInput('themeAdvancedCss', null));
|
||||
file_put_contents(self::DATA_DIR . 'custom.css', $this->getInput('themeAdvancedCss', null));
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
@ -308,9 +315,10 @@ class theme extends common {
|
||||
/**
|
||||
* Options de l'arrière plan
|
||||
*/
|
||||
public function body() {
|
||||
public function body()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
$this->setData(['theme', 'body', [
|
||||
'backgroundColor' => $this->getInput('themeBodyBackgroundColor'),
|
||||
'image' => $this->getInput('themeBodyImage'),
|
||||
@ -341,12 +349,15 @@ class theme extends common {
|
||||
/**
|
||||
* Options du pied de page
|
||||
*/
|
||||
public function footer() {
|
||||
public function footer()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ( $this->getInput('themeFooterCopyrightPosition') === 'hide' &&
|
||||
if ($this->isPost()) {
|
||||
if (
|
||||
$this->getInput('themeFooterCopyrightPosition') === 'hide' &&
|
||||
$this->getInput('themeFooterSocialsPosition') === 'hide' &&
|
||||
$this->getInput('themeFooterTextPosition') === 'hide' ) {
|
||||
$this->getInput('themeFooterTextPosition') === 'hide'
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Sélectionnez au moins un contenu à afficher',
|
||||
@ -379,13 +390,13 @@ class theme extends common {
|
||||
'displayCookie' => $this->getInput('themefooterDisplayCookie', helper::FILTER_BOOLEAN),
|
||||
'displayLegal' => $this->getInput('themeFooterDisplayLegal', helper::FILTER_BOOLEAN),
|
||||
'displaySearch' => $this->getInput('themeFooterDisplaySearch', helper::FILTER_BOOLEAN),
|
||||
'memberBar'=> $this->getInput('themeFooterMemberBar', helper::FILTER_BOOLEAN),
|
||||
'memberBar' => $this->getInput('themeFooterMemberBar', helper::FILTER_BOOLEAN),
|
||||
'template' => $this->getInput('themeFooterTemplate')
|
||||
]]);
|
||||
|
||||
// Sauvegarder la configuration localisée
|
||||
$this->setData(['locale','legalPageId', $this->getInput('configLegalPageId')]);
|
||||
$this->setData(['locale','searchPageId', $this->getInput('configSearchPageId')]);
|
||||
$this->setData(['locale', 'legalPageId', $this->getInput('configLegalPageId')]);
|
||||
$this->setData(['locale', 'searchPageId', $this->getInput('configSearchPageId')]);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -398,9 +409,11 @@ class theme extends common {
|
||||
|
||||
// Liste des pages
|
||||
self::$pagesList = $this->getData(['page']);
|
||||
foreach(self::$pagesList as $page => $pageId) {
|
||||
if ($this->getData(['page',$page,'block']) === 'bar' ||
|
||||
$this->getData(['page',$page,'disable']) === true) {
|
||||
foreach (self::$pagesList as $page => $pageId) {
|
||||
if (
|
||||
$this->getData(['page', $page, 'block']) === 'bar' ||
|
||||
$this->getData(['page', $page, 'disable']) === true
|
||||
) {
|
||||
unset(self::$pagesList[$page]);
|
||||
}
|
||||
}
|
||||
@ -422,21 +435,22 @@ class theme extends common {
|
||||
/**
|
||||
* Options de la bannière
|
||||
*/
|
||||
public function header() {
|
||||
public function header()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Modification des URL des images dans la bannière perso
|
||||
$featureContent = $this->getInput('themeHeaderText', null);
|
||||
/**
|
||||
* Stocker les images incluses dans la bannière perso dans un tableau
|
||||
*/
|
||||
$files = [];
|
||||
preg_match_all('/<img[^>]+>/i',$featureContent, $results);
|
||||
foreach($results[0] as $value) {
|
||||
preg_match_all('/<img[^>]+>/i', $featureContent, $results);
|
||||
foreach ($results[0] as $value) {
|
||||
// Lire le contenu XML
|
||||
$sx = simplexml_load_string($value);
|
||||
// Élément à remplacer
|
||||
$files [] = str_replace('./site/file/source/','',(string) $sx[0]['src']);
|
||||
$files[] = str_replace('./site/file/source/', '', (string) $sx[0]['src']);
|
||||
}
|
||||
|
||||
// Sauvegarder
|
||||
@ -456,7 +470,7 @@ class theme extends common {
|
||||
'textColor' => $this->getInput('themeHeaderTextColor'),
|
||||
'textHide' => $this->getInput('themeHeaderTextHide', helper::FILTER_BOOLEAN),
|
||||
'textTransform' => $this->getInput('themeHeaderTextTransform'),
|
||||
'linkHomePage' => $this->getInput('themeHeaderlinkHomePage',helper::FILTER_BOOLEAN),
|
||||
'linkHomePage' => $this->getInput('themeHeaderlinkHomePage', helper::FILTER_BOOLEAN),
|
||||
'imageContainer' => $this->getInput('themeHeaderImageContainer'),
|
||||
'tinyHidden' => $this->getInput('themeHeaderTinyHidden', helper::FILTER_BOOLEAN),
|
||||
'feature' => $this->getInput('themeHeaderFeature'),
|
||||
@ -464,19 +478,18 @@ class theme extends common {
|
||||
'featureFiles' => $files
|
||||
]]);
|
||||
// Modification de la position du menu selon la position de la bannière
|
||||
if ( $this->getData(['theme','header','position']) == 'site' )
|
||||
{
|
||||
$this->setData(['theme', 'menu', 'position',str_replace ('body-','site-',$this->getData(['theme','menu','position']))]);
|
||||
if ($this->getData(['theme', 'header', 'position']) == 'site') {
|
||||
$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']))]);
|
||||
if ($this->getData(['theme', 'header', 'position']) == 'body') {
|
||||
$this->setData(['theme', 'menu', 'position', str_replace('site-', 'body-', $this->getData(['theme', 'menu', 'position']))]);
|
||||
}
|
||||
// Menu accroché à la bannière qui devient cachée
|
||||
if ( $this->getData(['theme','header','position']) == 'hide' &&
|
||||
in_array( $this->getData(['theme','menu','position']) , ['body-first', 'site-first', 'body-first' , 'site-second'])
|
||||
if (
|
||||
$this->getData(['theme', 'header', 'position']) == 'hide' &&
|
||||
in_array($this->getData(['theme', 'menu', 'position']), ['body-first', 'site-first', 'body-first', 'site-second'])
|
||||
) {
|
||||
$this->setData(['theme', 'menu', 'position','site']);
|
||||
$this->setData(['theme', 'menu', 'position', 'site']);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -503,7 +516,8 @@ class theme extends common {
|
||||
/**
|
||||
* Accueil de la personnalisation
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
|
||||
// Restaurer les fontes utilisateurs
|
||||
$this->setFonts('user');
|
||||
@ -518,9 +532,10 @@ class theme extends common {
|
||||
/**
|
||||
* Options du menu
|
||||
*/
|
||||
public function menu() {
|
||||
public function menu()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
$this->setData(['theme', 'menu', [
|
||||
'backgroundColor' => $this->getInput('themeMenuBackgroundColor'),
|
||||
'backgroundColorSub' => $this->getInput('themeMenuBackgroundColorSub'),
|
||||
@ -569,27 +584,28 @@ class theme extends common {
|
||||
/**
|
||||
* Options des fontes
|
||||
*/
|
||||
public function fonts() {
|
||||
public function fonts()
|
||||
{
|
||||
|
||||
// Toutes les fontes installées sont chargées
|
||||
$this->setFonts('all');
|
||||
|
||||
// Polices liées au thème
|
||||
$used = [
|
||||
'Bannière' => $this->getData (['theme', 'header', 'font']),
|
||||
'Menu' => $this->getData (['theme', 'menu', 'font']),
|
||||
'Titre ' => $this->getData (['theme', 'title', 'font']),
|
||||
'Texte' => $this->getData (['theme', 'text', 'font']),
|
||||
'Pied de page' => $this->getData (['theme', 'footer', 'font']),
|
||||
'Titre (admin)' => $this->getData (['admin', 'fontTitle' ]),
|
||||
'Admin (texte)' => $this->getData (['admin', 'fontText' ])
|
||||
'Bannière' => $this->getData(['theme', 'header', 'font']),
|
||||
'Menu' => $this->getData(['theme', 'menu', 'font']),
|
||||
'Titre ' => $this->getData(['theme', 'title', 'font']),
|
||||
'Texte' => $this->getData(['theme', 'text', 'font']),
|
||||
'Pied de page' => $this->getData(['theme', 'footer', 'font']),
|
||||
'Titre (admin)' => $this->getData(['admin', 'fontTitle']),
|
||||
'Admin (texte)' => $this->getData(['admin', 'fontText'])
|
||||
];
|
||||
|
||||
// Récupérer le détail des fontes installées
|
||||
//$f = $this->getFonts();
|
||||
$f ['files'] = $this->getData(['fonts', 'files']);
|
||||
$f ['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$f ['websafe'] = self::$fontsWebSafe;
|
||||
$f['files'] = $this->getData(['fonts', 'files']);
|
||||
$f['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$f['websafe'] = self::$fontsWebSafe;
|
||||
|
||||
// Parcourir les fontes disponibles et construire le tableau pour le formulaire
|
||||
foreach ($f as $type => $typeValue) {
|
||||
@ -598,13 +614,13 @@ class theme extends common {
|
||||
// Fontes utilisées par les thèmes
|
||||
$fontUsed[$fontId] = '';
|
||||
foreach ($used as $key => $value) {
|
||||
if ( $value === $fontId) {
|
||||
if ($value === $fontId) {
|
||||
$fontUsed[$fontId] .= $key . '<br/>';
|
||||
}
|
||||
}
|
||||
self::$fontsDetail [] = [
|
||||
self::$fontsDetail[] = [
|
||||
$fontId,
|
||||
'<span style="font-family:' . $f[$type][$fontId]['font-family'] . '">' . $f[$type][$fontId]['name'] . '</span>' ,
|
||||
'<span style="font-family:' . $f[$type][$fontId]['font-family'] . '">' . $f[$type][$fontId]['name'] . '</span>',
|
||||
$f[$type][$fontId]['font-family'],
|
||||
$fontUsed[$fontId],
|
||||
$type,
|
||||
@ -637,14 +653,15 @@ class theme extends common {
|
||||
/**
|
||||
* Ajouter une fonte
|
||||
*/
|
||||
public function fontAdd() {
|
||||
public function fontAdd()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
// Type d'import en ligne ou local
|
||||
$type = $this->getInput('fontAddFontImported', helper::FILTER_BOOLEAN) ? 'imported' : 'files';
|
||||
$typeFlip = $type === 'files' ? 'imported' : 'files';
|
||||
$ressource = $type === 'imported' ? $this->getInput('fontAddUrl', null) : $this->getInput('fontAddFile', null);
|
||||
if (!empty($ressource) ) {
|
||||
if (!empty($ressource)) {
|
||||
$fontId = $this->getInput('fontAddFontId', null, true);
|
||||
$fontName = $this->getInput('fontAddFontName', null, true);
|
||||
$fontFamilyName = $this->getInput('fontAddFontFamilyName', null, true);
|
||||
@ -653,24 +670,27 @@ class theme extends common {
|
||||
$fontFamilyName = str_replace('"', '\'', $fontFamilyName);
|
||||
|
||||
// Supprime la fonte si elle existe dans le type inverse
|
||||
if (is_array($this->getData(['fonts', $typeFlip, $fontId])) ) {
|
||||
$this->deleteData(['fonts', $typeFlip, $fontId ]);
|
||||
if (is_array($this->getData(['fonts', $typeFlip, $fontId]))) {
|
||||
$this->deleteData(['fonts', $typeFlip, $fontId]);
|
||||
}
|
||||
// Stocker la fonte
|
||||
$this->setData(['fonts',
|
||||
$this->setData([
|
||||
'fonts',
|
||||
$type,
|
||||
$fontId, [
|
||||
'name' => $fontName,
|
||||
'font-family' => $fontFamilyName,
|
||||
'resource' => $ressource
|
||||
]]);
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
// Copier la fonte si le nom du fichier est fourni
|
||||
if ( $type === 'files' &&
|
||||
if (
|
||||
$type === 'files' &&
|
||||
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
||||
) {
|
||||
copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource );
|
||||
copy(self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource);
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
@ -699,7 +719,8 @@ class theme extends common {
|
||||
/**
|
||||
* Ajouter une fonte
|
||||
*/
|
||||
public function fontEdit() {
|
||||
public function fontEdit()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
// Type d'import en ligne ou local
|
||||
@ -707,29 +728,32 @@ class theme extends common {
|
||||
$typeFlip = $type === 'files' ? 'imported' : 'files';
|
||||
$ressource = $type === 'imported' ? $this->getInput('fontEditUrl', null) : $this->getInput('fontEditFile', null);
|
||||
$fontId = $this->getInput('fontEditFontId', null, true);
|
||||
$fontName = $this->getInput('fontEditFontName', null , true);
|
||||
$fontName = $this->getInput('fontEditFontName', null, true);
|
||||
$fontFamilyName = $this->getInput('fontEditFontFamilyName', null, true);
|
||||
|
||||
// Remplace les doubles quotes par des simples quotes
|
||||
$fontFamilyName = str_replace('"', '\'', $fontFamilyName);
|
||||
|
||||
// Supprime la fonte si elle existe dans le type inverse
|
||||
if (is_array($this->getData(['fonts', $typeFlip, $fontId])) ) {
|
||||
$this->deleteData(['fonts', $typeFlip, $fontId ]);
|
||||
if (is_array($this->getData(['fonts', $typeFlip, $fontId]))) {
|
||||
$this->deleteData(['fonts', $typeFlip, $fontId]);
|
||||
}
|
||||
// Stocker les fontes
|
||||
$this->setData(['fonts',
|
||||
$this->setData([
|
||||
'fonts',
|
||||
$type,
|
||||
$fontId, [
|
||||
'name' => $fontName,
|
||||
'font-family' => $fontFamilyName,
|
||||
'resource' => $ressource
|
||||
]]);
|
||||
]
|
||||
]);
|
||||
// Copier la fonte si le nom du fichier est fourni
|
||||
if ( $type === 'files' &&
|
||||
if (
|
||||
$type === 'files' &&
|
||||
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
||||
) {
|
||||
copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource );
|
||||
copy(self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource);
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
@ -749,7 +773,8 @@ class theme extends common {
|
||||
/**
|
||||
* Effacer une fonte
|
||||
*/
|
||||
public function fontDelete() {
|
||||
public function fontDelete()
|
||||
{
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
@ -765,8 +790,10 @@ class theme extends common {
|
||||
$this->deleteData(['fonts', $this->getUrl(2), $this->getUrl(3)]);
|
||||
|
||||
// Effacer le fichier existant
|
||||
if ( $this->getUrl(2) === 'file' &&
|
||||
file_exists(self::DATA_DIR . $this->getUrl(2)) ) {
|
||||
if (
|
||||
$this->getUrl(2) === 'file' &&
|
||||
file_exists(self::DATA_DIR . $this->getUrl(2))
|
||||
) {
|
||||
unlink(self::DATA_DIR . $this->getUrl(2));
|
||||
}
|
||||
|
||||
@ -783,15 +810,17 @@ class theme extends common {
|
||||
/**
|
||||
* Réinitialisation de la personnalisation avancée
|
||||
*/
|
||||
public function reset() {
|
||||
public function reset()
|
||||
{
|
||||
// $url prend l'adresse sans le token
|
||||
$url = explode('&',$this->getUrl(2));
|
||||
$url = explode('&', $this->getUrl(2));
|
||||
|
||||
if ( isset($_GET['csrf'])
|
||||
AND $_GET['csrf'] === $_SESSION['csrf']
|
||||
if (
|
||||
isset($_GET['csrf'])
|
||||
and $_GET['csrf'] === $_SESSION['csrf']
|
||||
) {
|
||||
// Réinitialisation
|
||||
$redirect ='';
|
||||
$redirect = '';
|
||||
switch ($url[0]) {
|
||||
case 'admin':
|
||||
$this->initData('admin', self::$i18nUI);
|
||||
@ -802,10 +831,10 @@ class theme extends common {
|
||||
$redirect = helper::baseUrl() . 'theme/manage';
|
||||
break;
|
||||
case 'custom':
|
||||
unlink(self::DATA_DIR.'custom.css');
|
||||
unlink(self::DATA_DIR . 'custom.css');
|
||||
$redirect = helper::baseUrl() . 'theme/advanced';
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
$redirect = helper::baseUrl() . 'theme';
|
||||
}
|
||||
|
||||
@ -827,9 +856,10 @@ class theme extends common {
|
||||
/**
|
||||
* Options du site
|
||||
*/
|
||||
public function site() {
|
||||
public function site()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
$this->setData(['theme', 'title', [
|
||||
'font' => $this->getInput('themeTitleFont'),
|
||||
'textColor' => $this->getInput('themeTitleTextColor'),
|
||||
@ -840,14 +870,14 @@ class theme extends common {
|
||||
'font' => $this->getInput('themeTextFont'),
|
||||
'fontSize' => $this->getInput('themeTextFontSize'),
|
||||
'textColor' => $this->getInput('themeTextTextColor'),
|
||||
'linkColor'=> $this->getInput('themeTextLinkColor')
|
||||
'linkColor' => $this->getInput('themeTextLinkColor')
|
||||
]]);
|
||||
$this->setData(['theme', 'site', [
|
||||
'backgroundColor' => $this->getInput('themeSiteBackgroundColor'),
|
||||
'radius' => $this->getInput('themeSiteRadius'),
|
||||
'shadow' => $this->getInput('themeSiteShadow'),
|
||||
'width' => $this->getInput('themeSiteWidth'),
|
||||
'margin' => $this->getInput('themeSiteMargin',helper::FILTER_BOOLEAN)
|
||||
'margin' => $this->getInput('themeSiteMargin', helper::FILTER_BOOLEAN)
|
||||
]]);
|
||||
$this->setData(['theme', 'button', [
|
||||
'backgroundColor' => $this->getInput('themeButtonBackgroundColor')
|
||||
@ -881,11 +911,12 @@ class theme extends common {
|
||||
/**
|
||||
* Import du thème
|
||||
*/
|
||||
public function manage() {
|
||||
if($this->isPost() ) {
|
||||
public function manage()
|
||||
{
|
||||
if ($this->isPost()) {
|
||||
|
||||
$zipFilename = $this->getInput('themeManageImport', helper::FILTER_STRING_SHORT, true);
|
||||
$data = $this->import(self::FILE_DIR.'source/' . $zipFilename);
|
||||
$data = $this->import(self::FILE_DIR . 'source/' . $zipFilename);
|
||||
if ($data['success']) {
|
||||
header("Refresh:0");
|
||||
} else {
|
||||
@ -911,10 +942,13 @@ class theme extends common {
|
||||
* @param @return array contenant $success = true ou false ; $ notification string message à afficher
|
||||
*/
|
||||
|
||||
public function import($zipName = '') {
|
||||
public function import($zipName = '')
|
||||
{
|
||||
|
||||
if ($zipName !== '' &&
|
||||
file_exists($zipName)) {
|
||||
if (
|
||||
$zipName !== '' &&
|
||||
file_exists($zipName)
|
||||
) {
|
||||
// Init variables de retour
|
||||
$success = false;
|
||||
$notification = '';
|
||||
@ -923,26 +957,24 @@ class theme extends common {
|
||||
// Ouvrir le zip
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($zipName) === TRUE) {
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
mkdir(self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder);
|
||||
$modele = '';
|
||||
// Archive de thème ?
|
||||
if (
|
||||
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')
|
||||
and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.css')
|
||||
and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.json')
|
||||
) {
|
||||
$modele = 'theme';
|
||||
}
|
||||
if(
|
||||
if (
|
||||
file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.json')
|
||||
AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.css')
|
||||
and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.css')
|
||||
) {
|
||||
$modele = 'admin';
|
||||
|
||||
}
|
||||
if (!empty($modele)
|
||||
) {
|
||||
if (!empty($modele)) {
|
||||
// traiter l'archive
|
||||
$success = $zip->extractTo('.');
|
||||
|
||||
@ -950,8 +982,9 @@ class theme extends common {
|
||||
if ($modele = 'theme') {
|
||||
$c = $this->subFonts(self::DATA_DIR . 'theme.json');
|
||||
// Un remplacement nécessite la régénération de la feuille de style
|
||||
if ($c > 0
|
||||
AND file_exists(self::DATA_DIR . 'theme.css')
|
||||
if (
|
||||
$c > 0
|
||||
and file_exists(self::DATA_DIR . 'theme.css')
|
||||
) {
|
||||
unlink(self::DATA_DIR . 'theme.css');
|
||||
}
|
||||
@ -959,8 +992,9 @@ class theme extends common {
|
||||
if ($modele = 'admin') {
|
||||
$c = $this->subFonts(self::DATA_DIR . 'admin.json');
|
||||
// Un remplacement nécessite la régénération de la feuille de style
|
||||
if ($c > 0
|
||||
AND file_exists(self::DATA_DIR . 'admin.css')
|
||||
if (
|
||||
$c > 0
|
||||
and file_exists(self::DATA_DIR . 'admin.css')
|
||||
) {
|
||||
unlink(self::DATA_DIR . 'admin.css');
|
||||
}
|
||||
@ -968,8 +1002,6 @@ class theme extends common {
|
||||
|
||||
// traitement d'erreur
|
||||
$notification = $success ? 'Le thème a été importé' : 'Erreur lors de l\'extraction, vérifiez les permissions.';
|
||||
|
||||
|
||||
} else {
|
||||
// pas une archive de thème
|
||||
$success = false;
|
||||
@ -994,7 +1026,8 @@ class theme extends common {
|
||||
/**
|
||||
* Export du thème
|
||||
*/
|
||||
public function export() {
|
||||
public function export()
|
||||
{
|
||||
// Make zip
|
||||
$zipFilename = $this->zipTheme($this->getUrl(2));
|
||||
// Téléchargement du ZIP
|
||||
@ -1005,26 +1038,27 @@ class theme extends common {
|
||||
header('Content-Length: ' . filesize(self::TEMP_DIR . $zipFilename));
|
||||
readfile(self::TEMP_DIR . $zipFilename);
|
||||
// Nettoyage du dossier
|
||||
unlink (self::TEMP_DIR . $zipFilename);
|
||||
unlink(self::TEMP_DIR . $zipFilename);
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Export du thème
|
||||
*/
|
||||
public function save() {
|
||||
public function save()
|
||||
{
|
||||
// Make zip
|
||||
$zipFilename = $this->zipTheme($this->getUrl(2));
|
||||
// Téléchargement du ZIP
|
||||
if (!is_dir(self::FILE_DIR.'source/theme')) {
|
||||
mkdir(self::FILE_DIR.'source/theme', 0755);
|
||||
if (!is_dir(self::FILE_DIR . 'source/theme')) {
|
||||
mkdir(self::FILE_DIR . 'source/theme', 0755);
|
||||
}
|
||||
copy (self::TEMP_DIR . $zipFilename , self::FILE_DIR.'source/theme/' . $zipFilename);
|
||||
copy(self::TEMP_DIR . $zipFilename, self::FILE_DIR . 'source/theme/' . $zipFilename);
|
||||
// Nettoyage du dossier
|
||||
unlink (self::TEMP_DIR . $zipFilename);
|
||||
unlink(self::TEMP_DIR . $zipFilename);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Archive <b>'.$zipFilename.'</b> sauvegardée avec succès',
|
||||
'notification' => 'Archive <b>' . $zipFilename . '</b> sauvegardée avec succès',
|
||||
'redirect' => helper::baseUrl() . 'theme/manage',
|
||||
'state' => true
|
||||
]);
|
||||
@ -1034,58 +1068,63 @@ class theme extends common {
|
||||
* construction du zip Fonction appelée par export() et save()
|
||||
* @param string $modele theme ou admin
|
||||
*/
|
||||
private function zipTheme($modele) {
|
||||
private function zipTheme($modele)
|
||||
{
|
||||
// Creation du dossier
|
||||
$zipFilename = $modele . date('Y-m-d-H-i-s', time()) . '.zip';
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open(self::TEMP_DIR . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) === TRUE) {
|
||||
if ($zip->open(self::TEMP_DIR . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
|
||||
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');
|
||||
$zip->addFile(self::DATA_DIR . 'admin.json', self::DATA_DIR . 'admin.json');
|
||||
$zip->addFile(self::DATA_DIR . 'admin.css', self::DATA_DIR . 'admin.css');
|
||||
// Ajoute les fontes
|
||||
$zip->addEmptyDir(self::DATA_DIR .'fonts');
|
||||
$zip->addEmptyDir(self::DATA_DIR . 'fonts');
|
||||
$fonts = $this->getData(['fonts', 'files']);
|
||||
foreach ($fonts as $fontId => $fontName) {
|
||||
$zip->addFile(self::DATA_DIR .'fonts/' . $fontName, self::DATA_DIR.'fonts/' . $fontName);
|
||||
$zip->addFile(self::DATA_DIR . 'fonts/' . $fontName, self::DATA_DIR . 'fonts/' . $fontName);
|
||||
}
|
||||
if (file_exists(self::DATA_DIR .'fonts/fonts.html')) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/fonts.html')) {
|
||||
|
||||
$zip->addFile(self::DATA_DIR .'fonts/fonts.html', self::DATA_DIR .'fonts/fonts.html');
|
||||
$zip->addFile(self::DATA_DIR . 'fonts/fonts.html', self::DATA_DIR . 'fonts/fonts.html');
|
||||
}
|
||||
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');
|
||||
$zip->addFile(self::DATA_DIR.'custom.css',self::DATA_DIR.'custom.css');
|
||||
$zip->addFile(self::DATA_DIR . 'theme.json', self::DATA_DIR . 'theme.json');
|
||||
$zip->addFile(self::DATA_DIR . 'theme.css', self::DATA_DIR . 'theme.css');
|
||||
$zip->addFile(self::DATA_DIR . 'custom.css', self::DATA_DIR . 'custom.css');
|
||||
// Traite l'image dans le body
|
||||
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'])
|
||||
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'])
|
||||
);
|
||||
}
|
||||
// Traite l'image dans le header
|
||||
if ($this->getData(['theme','header','image']) !== '' ) {
|
||||
$zip->addFile(self::FILE_DIR.'source/'.$this->getData(['theme','header','image']),
|
||||
self::FILE_DIR.'source/'.$this->getData(['theme','header','image'])
|
||||
if ($this->getData(['theme', 'header', 'image']) !== '') {
|
||||
$zip->addFile(
|
||||
self::FILE_DIR . 'source/' . $this->getData(['theme', 'header', 'image']),
|
||||
self::FILE_DIR . 'source/' . $this->getData(['theme', 'header', 'image'])
|
||||
);
|
||||
}
|
||||
// Traite les images du header perso
|
||||
if (!empty($this->getData(['theme','header','featureFiles'])) ) {
|
||||
foreach($this->getData(['theme','header','featureFiles']) as $value) {
|
||||
$zip->addFile(self::FILE_DIR . 'source/' . $value,
|
||||
self::FILE_DIR . 'source/' . $value );
|
||||
if (!empty($this->getData(['theme', 'header', 'featureFiles']))) {
|
||||
foreach ($this->getData(['theme', 'header', 'featureFiles']) as $value) {
|
||||
$zip->addFile(
|
||||
self::FILE_DIR . 'source/' . $value,
|
||||
self::FILE_DIR . 'source/' . $value
|
||||
);
|
||||
}
|
||||
}
|
||||
// Ajoute les fontes
|
||||
$zip->addEmptyDir(self::DATA_DIR .'fonts');
|
||||
$zip->addEmptyDir(self::DATA_DIR . 'fonts');
|
||||
$fonts = $this->getData(['fonts', 'files']);
|
||||
foreach ($fonts as $fontId => $fontName) {
|
||||
$zip->addFile(self::DATA_DIR .'fonts/' . $fontName, self::DATA_DIR.'fonts/' . $fontName);
|
||||
$zip->addFile(self::DATA_DIR . 'fonts/' . $fontName, self::DATA_DIR . 'fonts/' . $fontName);
|
||||
}
|
||||
if (file_exists(self::DATA_DIR .'fonts/fonts.html')) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/fonts.html')) {
|
||||
|
||||
$zip->addFile(self::DATA_DIR .'fonts/fonts.html', self::DATA_DIR .'fonts/fonts.html');
|
||||
$zip->addFile(self::DATA_DIR . 'fonts/fonts.html', self::DATA_DIR . 'fonts/fonts.html');
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1100,7 +1139,8 @@ class theme extends common {
|
||||
* @param string $file, nom du fichier json à convertir
|
||||
* @return int nombre de substitution effectuées
|
||||
*/
|
||||
private function subFonts($file) {
|
||||
private function subFonts($file)
|
||||
{
|
||||
// Tableau de substitution des fontes
|
||||
$fonts = [
|
||||
'Abril+Fatface' => 'abril-fatface',
|
||||
@ -1113,19 +1153,19 @@ class theme extends common {
|
||||
'Droid+Serif' => 'droid-serif-2',
|
||||
'Fira+Sans' => 'fira-sans',
|
||||
'Inconsolata' => 'inconsolata-2',
|
||||
'Indie+Flower' =>'indie-flower',
|
||||
'Indie+Flower' => 'indie-flower',
|
||||
'Josefin+Slab' => 'josefin-sans-std',
|
||||
'Lobster' => 'lobster-2',
|
||||
'Lora' => 'lora',
|
||||
'Lato' =>'lato',
|
||||
'Lato' => 'lato',
|
||||
'Marvel' => 'montserrat-ace',
|
||||
'Old+Standard+TT' => 'old-standard-tt-3',
|
||||
'Open+Sans' =>'open-sans',
|
||||
'Open+Sans' => 'open-sans',
|
||||
// Corriger l'erreur de nom de police installée par défaut, il manquait un O en majuscule
|
||||
'open+Sans' =>'open-sans',
|
||||
'Oswald' =>'oswald-4',
|
||||
'open+Sans' => 'open-sans',
|
||||
'Oswald' => 'oswald-4',
|
||||
'PT+Mono' => 'pt-mono',
|
||||
'PT+Serif' =>'pt-serif',
|
||||
'PT+Serif' => 'pt-serif',
|
||||
'Raleway' => 'raleway-5',
|
||||
'Rancho' => 'rancho',
|
||||
'Roboto' => 'Roboto',
|
||||
@ -1136,7 +1176,7 @@ class theme extends common {
|
||||
|
||||
$data = file_get_contents($file);
|
||||
$count = 0;
|
||||
foreach ($fonts as $oldId => $newId){
|
||||
foreach ($fonts as $oldId => $newId) {
|
||||
$data = str_replace($oldId, $newId, $data, $c);
|
||||
$count = $count + (int) $c;
|
||||
}
|
||||
@ -1151,19 +1191,20 @@ class theme extends common {
|
||||
|
||||
// Retourne un tableau simple des fonts installées idfont avec le nom
|
||||
// Cette fonction est utile aux sélecteurs de fonts dans les formulaires.
|
||||
public function enumFonts() {
|
||||
public function enumFonts()
|
||||
{
|
||||
/**
|
||||
* Récupère la liste des fontes installées et construit deux tableaux
|
||||
* id - nom
|
||||
* id - font-family - resource
|
||||
*/
|
||||
$f ['files'] = $this->getData(['fonts', 'files']);
|
||||
$f ['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$f ['websafe'] = self::$fontsWebSafe;
|
||||
$f['files'] = $this->getData(['fonts', 'files']);
|
||||
$f['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$f['websafe'] = self::$fontsWebSafe;
|
||||
// Construit un tableau avec leur ID et leur famille
|
||||
foreach(['websafe', 'imported', 'files'] as $type) {
|
||||
foreach (['websafe', 'imported', 'files'] as $type) {
|
||||
if (is_array($f[$type])) {
|
||||
foreach ($f[$type] as $fontId => $fontValue ) {
|
||||
foreach ($f[$type] as $fontId => $fontValue) {
|
||||
self::$fonts['name'][$fontId] = $fontValue['name'];
|
||||
self::$fonts['family'][$fontId] = $fontValue['font-family'];
|
||||
}
|
||||
@ -1178,10 +1219,12 @@ class theme extends common {
|
||||
* Création d'un fichier de liens d'appel des fontes
|
||||
* @param string $scope vaut all pour toutes les fontes ; 'user' pour les fontes utilisateurs
|
||||
*/
|
||||
private function setFonts($scope = 'all') {
|
||||
private function setFonts($scope = 'all')
|
||||
{
|
||||
|
||||
// Filtrage par fontes installées
|
||||
$fontsInstalled = [ $this->getData(['theme', 'text', 'font']),
|
||||
$fontsInstalled = [
|
||||
$this->getData(['theme', 'text', 'font']),
|
||||
$this->getData(['theme', 'title', 'font']),
|
||||
$this->getData(['theme', 'header', 'font']),
|
||||
$this->getData(['theme', 'menu', 'font']),
|
||||
@ -1198,15 +1241,15 @@ class theme extends common {
|
||||
*/
|
||||
$gf = false;
|
||||
$fileContent = '<!-- Fontes personnalisées -->';
|
||||
if ( !empty($this->getData(['fonts', 'imported'])) ) {
|
||||
if (!empty($this->getData(['fonts', 'imported']))) {
|
||||
foreach ($this->getData(['fonts', 'imported']) as $fontId => $fontValue) {
|
||||
if (
|
||||
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
||||
($scope === 'user' && in_array($fontId, $fontsInstalled))
|
||||
|| $scope === 'all'
|
||||
) {
|
||||
//Pré chargement à revoir
|
||||
//$fileContent .= '<link rel="preload" href="' . $fontValue['resource'] . '" crossorigin="anonymous" as="style">';
|
||||
$fileContent .= '<link href="' . $fontValue['resource'] .'" rel="stylesheet">';
|
||||
$fileContent .= '<link href="' . $fontValue['resource'] . '" rel="stylesheet">';
|
||||
// Pré connect pour api.google
|
||||
$gf = strpos($fontValue['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true;
|
||||
}
|
||||
@ -1223,20 +1266,20 @@ class theme extends common {
|
||||
* Fontes installées localement
|
||||
*/
|
||||
$fileContentCss = '';
|
||||
if ( !empty($this->getData(['fonts', 'files'])) ) {
|
||||
if (!empty($this->getData(['fonts', 'files']))) {
|
||||
foreach ($this->getData(['fonts', 'files']) as $fontId => $fontValue) {
|
||||
if (
|
||||
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
||||
($scope === 'user' && in_array($fontId, $fontsInstalled))
|
||||
|| $scope === 'all'
|
||||
) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource'])) {
|
||||
// Extension
|
||||
$path_parts = pathinfo(helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource']);
|
||||
// Chargement de la police
|
||||
$fileContentCss .= '@font-face {' ;
|
||||
$fileContentCss .= '@font-face {';
|
||||
$fileContentCss .= 'font-family:"' . $fontValue['name'] . '";';
|
||||
$fileContentCss .= 'src: url("' . $fontValue['resource'] . '") format("' . $path_parts['extension'] . '");';
|
||||
$fileContentCss .= '}' ;
|
||||
$fileContentCss .= '}';
|
||||
// Préchargement
|
||||
//$fileContent = '<link rel="preload" href="' . self::DATA_DIR . 'fonts/' . $fontValue['resource'] . '" type="font/woff" crossorigin="anonymous" as="font">' . $fileContent;
|
||||
}
|
||||
@ -1245,10 +1288,8 @@ class theme extends common {
|
||||
}
|
||||
|
||||
// Enregistre la personnalisation
|
||||
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fileContent);
|
||||
file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fileContent);
|
||||
// Enregistre la personnalisation
|
||||
file_put_contents(self::DATA_DIR.'fonts/fonts.css', $fileContentCss);
|
||||
|
||||
file_put_contents(self::DATA_DIR . 'fonts/fonts.css', $fileContentCss);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,10 +10,10 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function () {
|
||||
|
||||
var titleFont = $("#adminFontTitle").val();
|
||||
var textFont = $("#adminFontText").val();
|
||||
@ -51,9 +51,9 @@ $("input, select").on("change", function() {
|
||||
/**
|
||||
* Confirmation de réinitialisation
|
||||
*/
|
||||
$("#configAdminReset").on("click", function() {
|
||||
$("#configAdminReset").on("click", function () {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine le thème de l\'administration ?", function() {
|
||||
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine le thème de l\'administration ?", function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('configAdminForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('configAdminBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -23,13 +23,13 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('configAdminSubmit',[
|
||||
<?php echo template::submit('configAdminSubmit', [
|
||||
'value' => 'Valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -123,8 +123,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -154,6 +154,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -14,7 +14,7 @@
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("#themeAdvancedCss").on("change keydown keyup", function() {
|
||||
$("#themeAdvancedCss").on("change keydown keyup", function () {
|
||||
// Ajout du css au DOM
|
||||
$("#themePreview").remove();
|
||||
$("<style>")
|
||||
@ -27,9 +27,9 @@ $("#themeAdvancedCss").on("change keydown keyup", function() {
|
||||
/**
|
||||
* Confirmation de réinitialisation
|
||||
*/
|
||||
$("#themeAdvancedReset").on("click", function() {
|
||||
$("#themeAdvancedReset").on("click", function () {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine la personnalisation avancée ?", function() {
|
||||
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine la personnalisation avancée ?", function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('themeAdvancedForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeAdvancedBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -19,13 +19,13 @@
|
||||
<div class="col2">
|
||||
<?php echo template::submit('themeAdvancedSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('themeAdvancedCss', [
|
||||
'value' => file_get_contents(self::DATA_DIR.'custom.css'),
|
||||
'value' => file_get_contents(self::DATA_DIR . 'custom.css'),
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -14,20 +14,20 @@
|
||||
/**
|
||||
* Affichage de l'icone de remontée et permettre l'aperçu.
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
$("#backToTop").css("display","show");
|
||||
$(document).ready(function () {
|
||||
$("#backToTop").css("display", "show");
|
||||
});
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
$("input, select").on("change", function () {
|
||||
|
||||
// Option fixe pour contain et cover
|
||||
var themeBodyImageSize = $("#themeBodyImageSize").val();
|
||||
|
||||
if(themeBodyImageSize === "cover" ||
|
||||
themeBodyImageSize === "contain" ) {
|
||||
if (themeBodyImageSize === "cover" ||
|
||||
themeBodyImageSize === "contain") {
|
||||
$("#themeBodyImageAttachment").val("fixed");
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ $("input, select").on("change", function() {
|
||||
var css = "html{background-color:" + $("#themeBodyBackgroundColor").val() + "}";
|
||||
// Image du fond
|
||||
var themeBodyImage = $("#themeBodyImage").val();
|
||||
if(themeBodyImage) {
|
||||
if (themeBodyImage) {
|
||||
css += "html{background-image:url('<?php echo helper::baseUrl(false); ?>site/file/source/" + themeBodyImage + "');background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "}";
|
||||
css += "html{background-color:rgba(0,0,0,0);}";
|
||||
}
|
||||
@ -53,8 +53,8 @@ $("input, select").on("change", function() {
|
||||
.appendTo("head");
|
||||
});
|
||||
// Affiche / Cache les options de l'image du fond
|
||||
$("#themeBodyImage").on("change", function() {
|
||||
if($(this).val()) {
|
||||
$("#themeBodyImage").on("change", function () {
|
||||
if ($(this).val()) {
|
||||
$("#themeBodyImageOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
|
@ -63,7 +63,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php
|
||||
$imageFile = file_exists(self::FILE_DIR.'source/'.$this->getData(['theme', 'body', 'image'])) ? $this->getData(['theme', 'body', 'image']) : "";
|
||||
$imageFile = file_exists(self::FILE_DIR . 'source/' . $this->getData(['theme', 'body', 'image'])) ? $this->getData(['theme', 'body', 'image']) : "";
|
||||
echo template::file('themeBodyImage', [
|
||||
'help' => 'Sélectionner une image',
|
||||
'label' => 'Arrière-plan',
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('fontAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('fontAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -21,8 +21,8 @@
|
||||
'uniqueSubmission' => true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -35,7 +35,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('fontAddFontFile', true,'Fonte installée', []); ?>
|
||||
<?php echo template::checkbox('fontAddFontFile', true, 'Fonte installée', []); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -81,5 +81,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -13,8 +13,8 @@
|
||||
/**
|
||||
* Option par défaut du sélecteur de mode
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
if( $('input[name=fontEditFontImported]').is(':checked') ){
|
||||
$(document).ready(function () {
|
||||
if ($('input[name=fontEditFontImported]').is(':checked')) {
|
||||
$('#containerfontEditFile').hide();
|
||||
$('#containerfontEditUrl').show();
|
||||
$('#fontEditFontFileWrapper').hide();
|
||||
@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
|
||||
if( $('input[name=fontEditFontFile]').is(':checked') ){
|
||||
if ($('input[name=fontEditFontFile]').is(':checked')) {
|
||||
$('#containerfontEditFile').show();
|
||||
$('#containerfontEditUrl').hide();
|
||||
$('#fontEditFontImportedWrapper').hide();
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('fontEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('fontEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -21,8 +21,8 @@
|
||||
'uniqueSubmission' => true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -36,7 +36,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('fontEditFontFile', true,'Fonte installée', [
|
||||
<?php echo template::checkbox('fontEditFontFile', true, 'Fonte installée', [
|
||||
'checked' => $this->getUrl(2) === 'files' ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
@ -84,5 +84,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -13,9 +13,9 @@
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".themeFontDelete").on("click", function() {
|
||||
$(".themeFontDelete").on("click", function () {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cette fonte ?", function() {
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cette fonte ?", function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
@ -23,8 +23,8 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$fontsDetail): ?>
|
||||
<?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 else : ?>
|
||||
<?php echo template::speech('Aucune fonte !'); ?>
|
||||
<?php endif; ?>
|
@ -15,7 +15,7 @@
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
$("input, select").on("change", function () {
|
||||
// Import des polices de caractères
|
||||
var footerFont = $("#themeFooterFont :selected").val();
|
||||
var footerFontText = $("#themeFooterFont :selected").text();
|
||||
@ -38,7 +38,7 @@ $("input, select").on("change", function() {
|
||||
// Taille, couleur, épaisseur et capitalisation du titre de la bannière
|
||||
css += "footer span, #footerText > p {color:" + $("#themeFooterTextColor").val() + ";font-family:'" + footerFontText + "',sans-serif;font-weight:" + $("#themeFooterFontWeight").val() + ";font-size:" + $("#themeFooterFontSize").val() + ";text-transform:" + $("#themeFooterTextTransform").val() + "}";
|
||||
// Marge
|
||||
if($("#themeFooterMargin").is(":checked")) {
|
||||
if ($("#themeFooterMargin").is(":checked")) {
|
||||
css += 'footer{padding: 0 20px;}';
|
||||
}
|
||||
else {
|
||||
@ -52,7 +52,7 @@ $("input, select").on("change", function() {
|
||||
.text(css)
|
||||
.appendTo("footer");
|
||||
// Position du pied de page
|
||||
switch($("#themeFooterPosition").val()) {
|
||||
switch ($("#themeFooterPosition").val()) {
|
||||
case 'hide':
|
||||
$("footer").hide();
|
||||
break;
|
||||
@ -68,47 +68,47 @@ $("input, select").on("change", function() {
|
||||
break;
|
||||
}
|
||||
// Réduire la marge du paragraphe de la zone de texte enrichie
|
||||
$("#footerText > p").css("margin-top","0");
|
||||
$("#footerText > p").css("margin-bottom","0");
|
||||
$("#footerText > p").css("margin-top", "0");
|
||||
$("#footerText > p").css("margin-bottom", "0");
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Position dans les blocs
|
||||
// Bloc texte personnalisé
|
||||
$(".themeFooterContent").on("change",function() {
|
||||
$(".themeFooterContent").on("change", function () {
|
||||
// Position site ou body
|
||||
var footerPosition = $("#themeFooterPosition").val();
|
||||
switch($("#themeFooterTextPosition").val()) {
|
||||
switch ($("#themeFooterTextPosition").val()) {
|
||||
case "hide":
|
||||
$("#footerText").hide();
|
||||
break;
|
||||
default:
|
||||
// Choix de la position du bloc
|
||||
textPosition = $("#themeFooterTextPosition").val();
|
||||
textPosition = textPosition.substr(0,1).toUpperCase()+textPosition.substr(1);
|
||||
textPosition = textPosition.substr(0, 1).toUpperCase() + textPosition.substr(1);
|
||||
$("#footerText").show().appendTo("#footer" + footerPosition + textPosition);
|
||||
break;
|
||||
}
|
||||
switch($("#themeFooterSocialsPosition").val()) {
|
||||
switch ($("#themeFooterSocialsPosition").val()) {
|
||||
case 'hide':
|
||||
$("#footerSocials").hide();
|
||||
break;
|
||||
default:
|
||||
// Choix de la position du bloc
|
||||
socialsPosition = $("#themeFooterSocialsPosition").val();
|
||||
socialsPosition = socialsPosition.substr(0,1).toUpperCase()+socialsPosition.substr(1);
|
||||
socialsPosition = socialsPosition.substr(0, 1).toUpperCase() + socialsPosition.substr(1);
|
||||
$("#footerSocials").show().appendTo("#footer" + footerPosition + socialsPosition);
|
||||
break;
|
||||
}
|
||||
switch($("#themeFooterCopyrightPosition").val()) {
|
||||
switch ($("#themeFooterCopyrightPosition").val()) {
|
||||
case 'hide':
|
||||
$("#footerCopyright").hide();
|
||||
break;
|
||||
default:
|
||||
// Choix de la position du bloc
|
||||
copyrightPosition = $("#themeFooterCopyrightPosition").val();
|
||||
copyrightPosition = copyrightPosition.substr(0,1).toUpperCase()+copyrightPosition.substr(1);
|
||||
copyrightPosition = copyrightPosition.substr(0, 1).toUpperCase() + copyrightPosition.substr(1);
|
||||
$("#footerCopyright").show().appendTo("#footer" + footerPosition + copyrightPosition);
|
||||
break;
|
||||
}
|
||||
@ -119,18 +119,18 @@ $(".themeFooterContent").on("change",function() {
|
||||
// Fin Position dans les blocs
|
||||
|
||||
// Modification dynamique de la mise en page
|
||||
$("#themeFooterTemplate").on("change",function() {
|
||||
$("#themeFooterTemplate").on("change", function () {
|
||||
// Nettoyage des sélecteurs des contenus
|
||||
var newOptions = {
|
||||
4: {'hide' : 'Masqué', 'left' : 'En haut', 'center' : 'Au milieu', 'right' : 'En bas'} ,
|
||||
3: {'hide': 'Masqué', 'left': 'A gauche', 'center': 'Au centre', 'right': 'A droite'} ,
|
||||
2: {'hide': 'Masqué', 'left': 'A gauche', 'right': 'A droite'} ,
|
||||
1: {'hide': 'Masqué', 'center': 'Affiché'}
|
||||
4: { 'hide': 'Masqué', 'left': 'En haut', 'center': 'Au milieu', 'right': 'En bas' },
|
||||
3: { 'hide': 'Masqué', 'left': 'A gauche', 'center': 'Au centre', 'right': 'A droite' },
|
||||
2: { 'hide': 'Masqué', 'left': 'A gauche', 'right': 'A droite' },
|
||||
1: { 'hide': 'Masqué', 'center': 'Affiché' }
|
||||
};
|
||||
var $el = $(".themeFooterContent");
|
||||
$el.empty();
|
||||
// Eléments des position de contenus
|
||||
$.each(newOptions[$("#themeFooterTemplate").val()], function(key,value) {
|
||||
$.each(newOptions[$("#themeFooterTemplate").val()], function (key, value) {
|
||||
$el.append($("<option></option>")
|
||||
.attr("value", key).text(value));
|
||||
});
|
||||
@ -140,26 +140,26 @@ $("#themeFooterTemplate").on("change",function() {
|
||||
$("#footerText").hide();
|
||||
$("#footerSocials").hide();
|
||||
// Dimension des blocs
|
||||
switch($("#themeFooterTemplate").val()) {
|
||||
switch ($("#themeFooterTemplate").val()) {
|
||||
case "1":
|
||||
$("#footer" + position + "Left").css("display","none");
|
||||
$("#footer" + position + "Center").removeAttr('class').addClass("col12").css("display","");
|
||||
$("#footer" + position + "Right").css("display","none");
|
||||
$("#footer" + position + "Left").css("display", "none");
|
||||
$("#footer" + position + "Center").removeAttr('class').addClass("col12").css("display", "");
|
||||
$("#footer" + position + "Right").css("display", "none");
|
||||
break;
|
||||
case "2":
|
||||
$("#footer" + position + "Left").removeAttr('class').addClass('col6').css("display","");
|
||||
$("#footer" + position + "Center").css("display","none").removeAttr('class');
|
||||
$("#footer" + position + "Right").removeAttr('class').addClass('col6').css("display","");
|
||||
$("#footer" + position + "Left").removeAttr('class').addClass('col6').css("display", "");
|
||||
$("#footer" + position + "Center").css("display", "none").removeAttr('class');
|
||||
$("#footer" + position + "Right").removeAttr('class').addClass('col6').css("display", "");
|
||||
break;
|
||||
case "3":
|
||||
$("#footer" + position + "Left").removeAttr('class').addClass('col4').css("display","");
|
||||
$("#footer" + position + "Center").removeAttr('class').addClass('col4').css("display","");
|
||||
$("#footer" + position + "Right").removeAttr('class').addClass('col4').css("display","");
|
||||
$("#footer" + position + "Left").removeAttr('class').addClass('col4').css("display", "");
|
||||
$("#footer" + position + "Center").removeAttr('class').addClass('col4').css("display", "");
|
||||
$("#footer" + position + "Right").removeAttr('class').addClass('col4').css("display", "");
|
||||
break;
|
||||
case "4":
|
||||
$("#footer" + position + "Left").removeAttr('class').addClass('col12').css("display","");
|
||||
$("#footer" + position + "Center").removeAttr('class').addClass('col12').css("display","");
|
||||
$("#footer" + position + "Right").removeAttr('class').addClass('col12').css("display","");
|
||||
$("#footer" + position + "Left").removeAttr('class').addClass('col12').css("display", "");
|
||||
$("#footer" + position + "Center").removeAttr('class').addClass('col12').css("display", "");
|
||||
$("#footer" + position + "Right").removeAttr('class').addClass('col12').css("display", "");
|
||||
break;
|
||||
|
||||
}
|
||||
@ -167,58 +167,58 @@ $("#themeFooterTemplate").on("change",function() {
|
||||
|
||||
|
||||
// Désactivation des sélections multiples
|
||||
$("#themeFooterSocialsPosition").on("change", function() {
|
||||
if ($(this).prop('selectedIndex') >= 1 ) {
|
||||
if ( $("#themeFooterTextPosition").prop('selectedIndex') === $(this).prop('selectedIndex') ) {
|
||||
$("#themeFooterTextPosition").prop('selectedIndex',0);
|
||||
$("#themeFooterSocialsPosition").on("change", function () {
|
||||
if ($(this).prop('selectedIndex') >= 1) {
|
||||
if ($("#themeFooterTextPosition").prop('selectedIndex') === $(this).prop('selectedIndex')) {
|
||||
$("#themeFooterTextPosition").prop('selectedIndex', 0);
|
||||
$("#footerText").hide();
|
||||
}
|
||||
if ( $("#themeFooterCopyrightPosition").prop('selectedIndex') === $(this).prop('selectedIndex') ) {
|
||||
$("#themeFooterCopyrightPosition").prop('selectedIndex',0);
|
||||
if ($("#themeFooterCopyrightPosition").prop('selectedIndex') === $(this).prop('selectedIndex')) {
|
||||
$("#themeFooterCopyrightPosition").prop('selectedIndex', 0);
|
||||
$("#footerCopyright").hide();
|
||||
}
|
||||
}
|
||||
}).trigger("change");
|
||||
$("#themeFooterTextPosition").on("change", function() {
|
||||
if ($(this).prop('selectedIndex') >= 1 ) {
|
||||
if ( $("#themeFooterSocialsPosition").prop('selectedIndex') === $(this).prop('selectedIndex') ) {
|
||||
$("#themeFooterSocialsPosition").prop('selectedIndex',0);
|
||||
$("#themeFooterTextPosition").on("change", function () {
|
||||
if ($(this).prop('selectedIndex') >= 1) {
|
||||
if ($("#themeFooterSocialsPosition").prop('selectedIndex') === $(this).prop('selectedIndex')) {
|
||||
$("#themeFooterSocialsPosition").prop('selectedIndex', 0);
|
||||
$("#footerSocials").hide();
|
||||
}
|
||||
if ( $("#themeFooterCopyrightPosition").prop('selectedIndex') === $(this).prop('selectedIndex') ) {
|
||||
$("#themeFooterCopyrightPosition").prop('selectedIndex',0);
|
||||
if ($("#themeFooterCopyrightPosition").prop('selectedIndex') === $(this).prop('selectedIndex')) {
|
||||
$("#themeFooterCopyrightPosition").prop('selectedIndex', 0);
|
||||
$("#footerCopyright").hide();
|
||||
}
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
$("#themeFooterCopyrightPosition").on("change", function() {
|
||||
if ($(this).prop('selectedIndex') >= 1 ) {
|
||||
if ( $("#themeFooterTextPosition").prop('selectedIndex') === $(this).prop('selectedIndex') ) {
|
||||
$("#themeFooterTextPosition").prop('selectedIndex',0);
|
||||
$("#themeFooterCopyrightPosition").on("change", function () {
|
||||
if ($(this).prop('selectedIndex') >= 1) {
|
||||
if ($("#themeFooterTextPosition").prop('selectedIndex') === $(this).prop('selectedIndex')) {
|
||||
$("#themeFooterTextPosition").prop('selectedIndex', 0);
|
||||
$("#footerText").hide();
|
||||
}
|
||||
if ( $("#themeFooterSocialsPosition").prop('selectedIndex') === $(this).prop('selectedIndex') ) {
|
||||
$("#themeFooterSocialsPosition").prop('selectedIndex',0);
|
||||
if ($("#themeFooterSocialsPosition").prop('selectedIndex') === $(this).prop('selectedIndex')) {
|
||||
$("#themeFooterSocialsPosition").prop('selectedIndex', 0);
|
||||
$("#footerSocials").hide();
|
||||
}
|
||||
}
|
||||
}).trigger("change");
|
||||
// Affiche / Cache les options du footer fixe
|
||||
$("#themeFooterPosition").on("change", function() {
|
||||
if($(this).val() === 'body') {
|
||||
$("#themeFooterPosition").on("change", function () {
|
||||
if ($(this).val() === 'body') {
|
||||
$("#themeFooterPositionFixed").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#themeFooterPositionFixed").slideUp(function() {
|
||||
$("#themeFooterPositionFixed").slideUp(function () {
|
||||
$("#themeFooterFixed").prop("checked", false).trigger("change");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
// Lien de connexion
|
||||
$("#themeFooterLoginLink").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#themeFooterLoginLink").on("change", function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#footerLoginLink").show();
|
||||
}
|
||||
else {
|
||||
@ -227,8 +227,8 @@ $("#themeFooterLoginLink").on("change", function() {
|
||||
}).trigger("change");
|
||||
|
||||
// Numéro de version
|
||||
$("#themefooterDisplayVersion").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#themefooterDisplayVersion").on("change", function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#footerDisplayVersion").show();
|
||||
}
|
||||
else {
|
||||
@ -237,8 +237,8 @@ $("#themefooterDisplayVersion").on("change", function() {
|
||||
}).trigger("change");
|
||||
|
||||
// Numéro de version
|
||||
$("#themefooterDisplayCopyright").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#themefooterDisplayCopyright").on("change", function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#footerDisplayCopyright").show();
|
||||
}
|
||||
else {
|
||||
@ -247,8 +247,8 @@ $("#themefooterDisplayCopyright").on("change", function() {
|
||||
}).trigger("change");
|
||||
|
||||
// Site Map
|
||||
$("#themefooterDisplaySiteMap").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#themefooterDisplaySiteMap").on("change", function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#footerDisplaySiteMap").show();
|
||||
}
|
||||
else {
|
||||
@ -257,8 +257,8 @@ $("#themefooterDisplaySiteMap").on("change", function() {
|
||||
}).trigger("change");
|
||||
|
||||
// Rechercher
|
||||
$("#themeFooterDisplaySearch").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#themeFooterDisplaySearch").on("change", function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#footerDisplaySearch").show();
|
||||
}
|
||||
else {
|
||||
@ -267,8 +267,8 @@ $("#themeFooterDisplaySearch").on("change", function() {
|
||||
}).trigger("change");
|
||||
|
||||
// Mentions légales
|
||||
$("#themeFooterDisplayLegal").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#themeFooterDisplayLegal").on("change", function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#footerDisplayLegal").show();
|
||||
}
|
||||
else {
|
||||
@ -278,22 +278,22 @@ $("#themeFooterDisplayLegal").on("change", function() {
|
||||
|
||||
|
||||
// Pages spéciales : activation si une page est sélectionnée
|
||||
$("#configLegalPageId").on("change", function() {
|
||||
if ( $("#configLegalPageId option:selected").text() === 'Aucune') {
|
||||
$("#configLegalPageId").on("change", function () {
|
||||
if ($("#configLegalPageId option:selected").text() === 'Aucune') {
|
||||
$("#themeFooterDisplayLegal").prop('checked', false);
|
||||
$("#themeFooterDisplayLegal").prop( "disabled", true );
|
||||
$("#themeFooterDisplayLegal").prop("disabled", true);
|
||||
$("#footerDisplayLegal").hide();
|
||||
} else {
|
||||
$("#themeFooterDisplayLegal").prop( "disabled", false );
|
||||
$("#themeFooterDisplayLegal").prop("disabled", false);
|
||||
}
|
||||
}).trigger("change");
|
||||
$("#configSearchPageId").on("change", function() {
|
||||
if ( $("#configSearchPageId option:selected").text() === 'Aucune') {
|
||||
$("#configSearchPageId").on("change", function () {
|
||||
if ($("#configSearchPageId option:selected").text() === 'Aucune') {
|
||||
$("#themeFooterDisplaySearch").prop('checked', false);
|
||||
$("#themeFooterDisplaySearch").prop( "disabled", true );
|
||||
$("#themeFooterDisplaySearch").prop("disabled", true);
|
||||
$("#footerDisplaySearch").hide();
|
||||
} else {
|
||||
$("#themeFooterDisplaySearch").prop( "disabled", false );
|
||||
$("#themeFooterDisplaySearch").prop("disabled", false);
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
|
@ -87,13 +87,13 @@
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('themefooterDisplayCopyright', true, 'Motorisé par', [
|
||||
'checked' => $this->getData(['theme', 'footer','displayCopyright']),
|
||||
'checked' => $this->getData(['theme', 'footer', 'displayCopyright']),
|
||||
'help' => 'Affiche cette mention devant ZwiiCMS'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('themefooterDisplayVersion', true, 'Version', [
|
||||
'checked' => $this->getData(['theme', 'footer','displayVersion']),
|
||||
'checked' => $this->getData(['theme', 'footer', 'displayVersion']),
|
||||
'help' => 'Affiche le numéro de version après ZwiiCMS'
|
||||
]); ?>
|
||||
</div>
|
||||
@ -133,7 +133,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('configLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($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('selected', '20px'),
|
||||
'selected' => $this->getData(['locale', 'legalPageId'])
|
||||
]); ?>
|
||||
@ -147,7 +147,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('configSearchPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($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('selected', '20px'),
|
||||
'selected' => $this->getData(['locale', 'searchPageId'])
|
||||
]); ?>
|
||||
@ -159,7 +159,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('themeFooterText', [
|
||||
'label' => '<div class="titleWysiwygContent">' . template::topic('Contenu personnalisé') .'</div>',
|
||||
'label' => '<div class="titleWysiwygContent">' . template::topic('Contenu personnalisé') . '</div>',
|
||||
'value' => $this->getData(['theme', 'footer', 'text']),
|
||||
'class' => 'editorWysiwyg'
|
||||
]); ?>
|
||||
@ -210,7 +210,7 @@
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php $footerBlockPosition = is_null($this->getData(['theme', 'footer', 'template'])) ? $module::$footerblocks[3] : $module::$footerblocks [$this->getData(['theme', 'footer', 'template'])] ;?>
|
||||
<?php $footerBlockPosition = is_null($this->getData(['theme', 'footer', 'template'])) ? $module::$footerblocks[3] : $module::$footerblocks[$this->getData(['theme', 'footer', 'template'])]; ?>
|
||||
<?php echo template::select('themeFooterTemplate', $module::$footerTemplate, [
|
||||
'label' => 'Répartition',
|
||||
'selected' => is_null($this->getData(['theme', 'footer', 'template'])) ? 4 : $this->getData(['theme', 'footer', 'template'])
|
||||
|
@ -159,7 +159,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php
|
||||
$imageFile = file_exists(self::FILE_DIR.'source/'.$this->getData(['theme', 'header', 'image'])) ?
|
||||
$imageFile = file_exists(self::FILE_DIR . 'source/' . $this->getData(['theme', 'header', 'image'])) ?
|
||||
$this->getData(['theme', 'header', 'image']) : "";
|
||||
echo template::file('themeHeaderImage', [
|
||||
'label' => 'Image',
|
||||
@ -213,7 +213,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('themeHeaderText', [
|
||||
'label' => '<div class="titleWysiwygContent">' . template::topic('Contenu personnalisé') .'</div>',
|
||||
'label' => '<div class="titleWysiwygContent">' . template::topic('Contenu personnalisé') . '</div>',
|
||||
'class' => 'editorWysiwyg',
|
||||
'value' => $this->getData(['theme', 'header', 'featureContent'])
|
||||
]); ?>
|
||||
@ -222,6 +222,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="featureContent" class="displayNone">
|
||||
<?php echo $this->getData(['theme','header','featureContent']);?>
|
||||
<?php echo $this->getData(['theme', 'header', 'featureContent']); ?>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -60,7 +60,7 @@ $("<a>")
|
||||
/**
|
||||
* Affiche les zones cachées
|
||||
*/
|
||||
$("#themeShowAll").on("click", function() {
|
||||
$("#themeShowAll").on("click", function () {
|
||||
$("header.displayNone, nav.displayNone, footer.displayNone").slideToggle();
|
||||
});
|
||||
|
||||
@ -68,9 +68,9 @@ $("#themeShowAll").on("click", function() {
|
||||
* Simule un survole du site lors du survole de la section
|
||||
*/
|
||||
$("section")
|
||||
.on("mouseover", function() {
|
||||
.on("mouseover", function () {
|
||||
$("#themeOverlaySite:not(.themeOverlayTriggerHover)").addClass("themeOverlayTriggerHover");
|
||||
})
|
||||
.on("mouseleave", function() {
|
||||
.on("mouseleave", function () {
|
||||
$("#themeOverlaySite.themeOverlayTriggerHover").removeClass("themeOverlayTriggerHover");
|
||||
});
|
@ -1,8 +1,8 @@
|
||||
<?php if(
|
||||
<?php if (
|
||||
$this->getData(['theme', 'header', 'position']) === 'hide'
|
||||
OR $this->getData(['theme', 'menu', 'position']) === 'hide'
|
||||
OR $this->getData(['theme', 'footer', 'position']) === 'hide'
|
||||
): ?>
|
||||
or $this->getData(['theme', 'menu', 'position']) === 'hide'
|
||||
or $this->getData(['theme', 'footer', 'position']) === 'hide'
|
||||
) : ?>
|
||||
<?php echo template::speech('Cliquez sur une zone afin d\'accéder à ses options de personnalisation. Vous pouvez également afficher les zones cachées à l\'aide du bouton ci-dessous.'); ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset3">
|
||||
@ -60,7 +60,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::speech('Cliquez sur une zone afin d\'accéder à ses options de personnalisation.'); ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset4">
|
||||
|
@ -14,9 +14,9 @@
|
||||
/**
|
||||
* Confirmation de réinitialisation
|
||||
*/
|
||||
$("#configManageReset").on("click", function() {
|
||||
$("#configManageReset").on("click", function () {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine le thème du site ?", function() {
|
||||
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine le thème du site ?", function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('themeManageForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeManageBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -20,8 +20,8 @@
|
||||
'value' => 'Appliquer'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -37,13 +37,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo template::topic('Sauvegarde du thème dans le'); ?>
|
||||
<a href="<?php echo helper::baseUrl(false); ?>core/vendor/filemanager/dialog.php?fldr=theme&type=0&akey=<?php echo md5_file(self::DATA_DIR.'core.json'); ?>" data-lity>
|
||||
<a href="<?php echo helper::baseUrl(false); ?>core/vendor/filemanager/dialog.php?fldr=theme&type=0&akey=<?php echo md5_file(self::DATA_DIR . 'core.json'); ?>" data-lity>
|
||||
<?php echo template::topic('gestionnaire de fichiers'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
@ -89,5 +89,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -28,16 +28,17 @@
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php
|
||||
if ( $this->getData(['theme', 'header', 'position']) == "site")
|
||||
{ echo template::select('themeMenuPosition', $module::$menuPositionsSite, [
|
||||
if ($this->getData(['theme', 'header', 'position']) == "site") {
|
||||
echo template::select('themeMenuPosition', $module::$menuPositionsSite, [
|
||||
'label' => 'Position',
|
||||
'selected' => $this->getData(['theme', 'menu', 'position'])
|
||||
]);
|
||||
}else{
|
||||
} else {
|
||||
echo template::select('themeMenuPosition', $module::$menuPositionsBody, [
|
||||
'label' => 'Position',
|
||||
'selected' => $this->getData(['theme', 'menu', 'position'])
|
||||
]); }
|
||||
]);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
@ -108,9 +109,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="themeMenuBurgerLogoId" class="col6 offset6 <?php if( $this->getData(['theme', 'menu', 'burgerContent']) !== 'logo') echo 'displayNone';?>">
|
||||
<div id="themeMenuBurgerLogoId" class="col6 offset6 <?php if ($this->getData(['theme', 'menu', 'burgerContent']) !== 'logo') echo 'displayNone'; ?>">
|
||||
<?php
|
||||
$imageFile = file_exists(self::FILE_DIR.'source/'.$this->getData(['theme', 'menu', 'burgerLogo'])) ?
|
||||
$imageFile = file_exists(self::FILE_DIR . 'source/' . $this->getData(['theme', 'menu', 'burgerLogo'])) ?
|
||||
$this->getData(['theme', 'menu', 'burgerLogo']) : "";
|
||||
echo template::file('themeMenuBurgerLogo', [
|
||||
'help' => 'Sélectionner une image de dimensions adaptées',
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('themeSiteForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeSiteBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -18,8 +18,8 @@
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('themeSiteSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -47,15 +47,15 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('themeSiteMargin',true, 'Pas de marge au-dessus et en-dessous du site', [
|
||||
<?php echo template::checkbox('themeSiteMargin', true, 'Pas de marge au-dessus et en-dessous du site', [
|
||||
'checked' => $this->getData(['theme', 'site', 'margin'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -156,8 +156,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -189,7 +189,7 @@
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeTitleFont', $module::$fonts['name'] , [
|
||||
<?php echo template::select('themeTitleFont', $module::$fonts['name'], [
|
||||
'label' => 'Fonte',
|
||||
'selected' => $this->getData(['theme', 'title', 'font']),
|
||||
'fonts' => $module::$fonts['family']
|
||||
@ -210,5 +210,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -13,7 +13,8 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class translate extends common {
|
||||
class translate extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_ADMIN,
|
||||
@ -45,7 +46,8 @@ class translate extends common {
|
||||
/**
|
||||
* Configuration avancée des langues
|
||||
*/
|
||||
public function copy() {
|
||||
public function copy()
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
@ -55,20 +57,20 @@ class translate extends common {
|
||||
$toCreate = $this->getInput('translateFormCopyTarget');
|
||||
if ($copyFrom !== $toCreate) {
|
||||
// Création du dossier
|
||||
if (is_dir(self::DATA_DIR . $toCreate) === false ) { // Si le dossier est déjà créé
|
||||
$success = mkdir (self::DATA_DIR . $toCreate, 0755);
|
||||
$success = mkdir (self::DATA_DIR . $toCreate.'/content', 0755);
|
||||
if (is_dir(self::DATA_DIR . $toCreate) === false) { // Si le dossier est déjà créé
|
||||
$success = mkdir(self::DATA_DIR . $toCreate, 0755);
|
||||
$success = mkdir(self::DATA_DIR . $toCreate . '/content', 0755);
|
||||
} else {
|
||||
$success = true;
|
||||
}
|
||||
// Copier les données par défaut avec gestion des erreurs
|
||||
$success = (copy (self::DATA_DIR . $copyFrom . '/locale.json', self::DATA_DIR . $toCreate . '/locale.json') === true && $success === true) ? true : false;
|
||||
$success = (copy (self::DATA_DIR . $copyFrom . '/module.json', self::DATA_DIR . $toCreate . '/module.json') === true && $success === true) ? true : false;
|
||||
$success = (copy (self::DATA_DIR . $copyFrom . '/page.json', self::DATA_DIR . $toCreate . '/page.json') === true && $success === true) ? true : false;
|
||||
$success = ($this->copyDir (self::DATA_DIR . $copyFrom . '/content', self::DATA_DIR . $toCreate . '/content') === true && $success === true) ? true : false;
|
||||
$success = (copy(self::DATA_DIR . $copyFrom . '/locale.json', self::DATA_DIR . $toCreate . '/locale.json') === true && $success === true) ? true : false;
|
||||
$success = (copy(self::DATA_DIR . $copyFrom . '/module.json', self::DATA_DIR . $toCreate . '/module.json') === true && $success === true) ? true : false;
|
||||
$success = (copy(self::DATA_DIR . $copyFrom . '/page.json', self::DATA_DIR . $toCreate . '/page.json') === true && $success === true) ? true : false;
|
||||
$success = ($this->copyDir(self::DATA_DIR . $copyFrom . '/content', self::DATA_DIR . $toCreate . '/content') === true && $success === true) ? true : false;
|
||||
// Enregistrer la langue
|
||||
if ($success) {
|
||||
$this->setData(['config', 'i18n', $toCreate, 'site' ]);
|
||||
$this->setData(['config', 'i18n', $toCreate, 'site']);
|
||||
$notification = 'Données ' . self::$languages[$copyFrom] . ' copiées vers ' . self::$languages[$toCreate];
|
||||
} else {
|
||||
$notification = "Quelque chose n\'a pas fonctionné, vérifiez les permissions.";
|
||||
@ -87,7 +89,7 @@ class translate extends common {
|
||||
}
|
||||
// Tableau des langues installées
|
||||
foreach (self::$languages as $key => $value) {
|
||||
if ($this->getData(['config','i18n', $key]) === 'site') {
|
||||
if ($this->getData(['config', 'i18n', $key]) === 'site') {
|
||||
self::$languagesTarget[$key] = $value;
|
||||
}
|
||||
}
|
||||
@ -104,13 +106,14 @@ class translate extends common {
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
|
||||
// Sauvegarder les langues de contenu
|
||||
$this->setData(['config', 'i18n','interface', $this->getInput('translateUI')]);
|
||||
$this->setData(['config', 'i18n', 'interface', $this->getInput('translateUI')]);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -126,26 +129,25 @@ class translate extends common {
|
||||
// Onglet des langues de contenu
|
||||
foreach (self::$languages as $keyi18n => $value) {
|
||||
// tableau des langues installées
|
||||
if (is_dir(self::DATA_DIR . $keyi18n) ) {
|
||||
self::$languagesInstalled [] = [
|
||||
template::flag($keyi18n, '50%') ,
|
||||
$value . ' (' . $keyi18n . ')' ,
|
||||
if (is_dir(self::DATA_DIR . $keyi18n)) {
|
||||
self::$languagesInstalled[] = [
|
||||
template::flag($keyi18n, '50%'),
|
||||
$value . ' (' . $keyi18n . ')',
|
||||
self::$i18nUI === $keyi18n ? '(langue de l\'interface)' : '',
|
||||
'',
|
||||
template::button('translateContentLanguageEdit' . $keyi18n, [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $keyi18n. '/' . $_SESSION['csrf'],
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $keyi18n . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('flag'),
|
||||
'help' => 'Editer les locales'
|
||||
]),
|
||||
template::button('translateContentLanguageDelete' .$keyi18n, [
|
||||
'class' => 'translateDelete buttonRed' . (self::$i18nUI === $keyi18n ? ' disabled' : '') ,
|
||||
template::button('translateContentLanguageDelete' . $keyi18n, [
|
||||
'class' => 'translateDelete buttonRed' . (self::$i18nUI === $keyi18n ? ' disabled' : ''),
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $keyi18n . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('trash'),
|
||||
'help' => 'Supprimer cette langue'
|
||||
])
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
// Activation du bouton de copie
|
||||
self::$siteCopy = count(self::$languagesInstalled) > 1 ? false : true;
|
||||
@ -156,7 +158,7 @@ class translate extends common {
|
||||
chdir(self::I18N_DIR);
|
||||
$files = glob('*.json');
|
||||
// Ajouter une clé au tableau avec le code de langue
|
||||
foreach( $files as $file) {
|
||||
foreach ($files as $file) {
|
||||
// La langue est-elle référencée ?
|
||||
if (array_key_exists(basename($file, '.json'), self::$languages)) {
|
||||
self::$i18nFiles[basename($file, '.json')] = self::$languages[basename($file, '.json')];
|
||||
@ -177,10 +179,11 @@ class translate extends common {
|
||||
* Ajouter une langue de contenu
|
||||
*/
|
||||
|
||||
public function add() {
|
||||
public function add()
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
|
||||
// Création du contenu
|
||||
$lang = $this->getInput('translateAddContent');
|
||||
@ -193,7 +196,7 @@ class translate extends common {
|
||||
|
||||
// Sus-dossier localisé
|
||||
if (!file_exists(self::DATA_DIR . $lang)) {
|
||||
mkdir (self::DATA_DIR . $lang, 0755);
|
||||
mkdir(self::DATA_DIR . $lang, 0755);
|
||||
}
|
||||
|
||||
// Initialiser la classe
|
||||
@ -204,9 +207,8 @@ class translate extends common {
|
||||
]);;
|
||||
|
||||
// Capturer et sauver
|
||||
$db->set($key,init::$defaultData[$key]);
|
||||
$db->set($key, init::$defaultData[$key]);
|
||||
$db->save;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -224,8 +226,8 @@ class translate extends common {
|
||||
|
||||
// Tableau des langues non installées
|
||||
foreach (self::$languages as $key => $value) {
|
||||
if (!is_dir( self::DATA_DIR . $key))
|
||||
self::$i18nFiles [$key] = $value;
|
||||
if (!is_dir(self::DATA_DIR . $key))
|
||||
self::$i18nFiles[$key] = $value;
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
@ -233,13 +235,14 @@ class translate extends common {
|
||||
'title' => 'Ajouter',
|
||||
'view' => 'add'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
public function edit()
|
||||
{
|
||||
|
||||
// Jeton incorrect ou URl avec le code langue incorrecte
|
||||
if ( $this->getUrl(3) !== $_SESSION['csrf']
|
||||
if (
|
||||
$this->getUrl(3) !== $_SESSION['csrf']
|
||||
|| !array_key_exists($this->getUrl(2), self::$languages)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
@ -251,10 +254,11 @@ class translate extends common {
|
||||
}
|
||||
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
|
||||
// Sauvegarder les locales
|
||||
$data = ['locale' => [
|
||||
$data = [
|
||||
'locale' => [
|
||||
'homePageId' => $this->getInput('localeHomePageId', helper::FILTER_ID, true),
|
||||
'page404' => $this->getInput('localePage404'),
|
||||
'page403' => $this->getInput('localePage403'),
|
||||
@ -272,18 +276,18 @@ class translate extends common {
|
||||
'titleLabel' => $this->getInput('localeCookiesTitleText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN)),
|
||||
'linkLegalLabel' => $this->getInput('localeCookiesLinkMlText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN)),
|
||||
'cookiesFooterText' => $this->getInput('localeCookiesFooterText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN)),
|
||||
'buttonValidLabel' =>$this->getInput('localeCookiesButtonText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN))
|
||||
'buttonValidLabel' => $this->getInput('localeCookiesButtonText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN))
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Sauvegarde hors méthodes si la langue n'est pas celle de l'UI
|
||||
if ( $this->getUrl(2) === self::$i18nUI ) {
|
||||
if ($this->getUrl(2) === self::$i18nUI) {
|
||||
// Enregistrer les données par lecture directe du formulaire
|
||||
$this->setData(['locale', $data['locale'] ]);
|
||||
$this->setData(['locale', $data['locale']]);
|
||||
} else {
|
||||
// Sauver sur le disque
|
||||
file_put_contents (self::DATA_DIR . $this->getUrl(2) . '/locale.json', json_encode($data, JSON_UNESCAPED_UNICODE), LOCK_EX);
|
||||
file_put_contents(self::DATA_DIR . $this->getUrl(2) . '/locale.json', json_encode($data, JSON_UNESCAPED_UNICODE), LOCK_EX);
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
@ -300,7 +304,7 @@ class translate extends common {
|
||||
// Récupération des locales de la langue sélectionnée
|
||||
|
||||
// Vérifier la conformité de l'URL
|
||||
if ( !array_key_exists($this->getUrl(2), self::$languages)) {
|
||||
if (!array_key_exists($this->getUrl(2), self::$languages)) {
|
||||
// Bidouillage de l'URL, on sort
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -311,27 +315,31 @@ class translate extends common {
|
||||
}
|
||||
//Lecture des données pour transmission au formulaire
|
||||
// La locale est-elle celle de la langue de l'UI ?
|
||||
if ( $this->getUrl(2) === self::$i18nUI) {
|
||||
self::$locales [$this->getUrl(2)]['locale'] = $this->getData(['locale']);
|
||||
if ($this->getUrl(2) === self::$i18nUI) {
|
||||
self::$locales[$this->getUrl(2)]['locale'] = $this->getData(['locale']);
|
||||
} else {
|
||||
// Lire les locales sans passer par les méthodes
|
||||
self::$locales [$this->getUrl(2)] = json_decode(file_get_contents(self::DATA_DIR . $this->getUrl(2) . '/locale.json'), true);
|
||||
self::$locales[$this->getUrl(2)] = json_decode(file_get_contents(self::DATA_DIR . $this->getUrl(2) . '/locale.json'), true);
|
||||
}
|
||||
|
||||
// Générer la liste des pages disponibles
|
||||
self::$pagesList = $this->getData(['page']);
|
||||
foreach(self::$pagesList as $page => $pageId) {
|
||||
if ($this->getData(['page',$page,'block']) === 'bar' ||
|
||||
$this->getData(['page',$page,'disable']) === true) {
|
||||
foreach (self::$pagesList as $page => $pageId) {
|
||||
if (
|
||||
$this->getData(['page', $page, 'block']) === 'bar' ||
|
||||
$this->getData(['page', $page, 'disable']) === true
|
||||
) {
|
||||
unset(self::$pagesList[$page]);
|
||||
}
|
||||
}
|
||||
|
||||
self::$orphansList = $this->getData(['page']);
|
||||
foreach(self::$orphansList as $page => $pageId) {
|
||||
if ($this->getData(['page',$page,'block']) === 'bar' ||
|
||||
$this->getData(['page',$page,'disable']) === true ||
|
||||
$this->getdata(['page',$page, 'position']) !== 0) {
|
||||
foreach (self::$orphansList as $page => $pageId) {
|
||||
if (
|
||||
$this->getData(['page', $page, 'block']) === 'bar' ||
|
||||
$this->getData(['page', $page, 'disable']) === true ||
|
||||
$this->getdata(['page', $page, 'position']) !== 0
|
||||
) {
|
||||
unset(self::$orphansList[$page]);
|
||||
}
|
||||
}
|
||||
@ -346,10 +354,13 @@ class translate extends common {
|
||||
/***
|
||||
* Effacer une langue de contenu
|
||||
*/
|
||||
public function delete() {
|
||||
public function delete()
|
||||
{
|
||||
// Jeton incorrect ou URl avec le code langue incorrecte
|
||||
if ( $this->getUrl(3) !== $_SESSION['csrf']
|
||||
|| !array_key_exists($this->getUrl(2), self::$languages) ) {
|
||||
if (
|
||||
$this->getUrl(3) !== $_SESSION['csrf']
|
||||
|| !array_key_exists($this->getUrl(2), self::$languages)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'translate',
|
||||
@ -359,8 +370,8 @@ class translate extends common {
|
||||
}
|
||||
|
||||
// Effacement d'une langue installée
|
||||
if ( is_dir( self::DATA_DIR . $this->getUrl(2) ) === true ) {
|
||||
$success = $this->removeDir( self::DATA_DIR . $this->getUrl(2));
|
||||
if (is_dir(self::DATA_DIR . $this->getUrl(2)) === true) {
|
||||
$success = $this->removeDir(self::DATA_DIR . $this->getUrl(2));
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -374,21 +385,22 @@ class translate extends common {
|
||||
* Traitement du changement de langue
|
||||
* Fonction utilisée par le noyau
|
||||
*/
|
||||
public function i18n() {
|
||||
public function i18n()
|
||||
{
|
||||
|
||||
// Activation du drapeau
|
||||
if ( $this->getInput('ZWII_I18N_' . strtoupper($this->getUrl(3))) !== $this->getUrl(2) ) {
|
||||
if ($this->getInput('ZWII_I18N_' . strtoupper($this->getUrl(3))) !== $this->getUrl(2)) {
|
||||
// Nettoyer et stocker le choix de l'utilisateur
|
||||
helper::deleteCookie('ZWII_I18N_SITE');
|
||||
// Sélectionner
|
||||
setcookie('ZWII_I18N_' . strtoupper($this->getUrl(3)) , $this->getUrl(2), time() + 3600, helper::baseUrl(false, false) , '', helper::isHttps(), true);
|
||||
setcookie('ZWII_I18N_' . strtoupper($this->getUrl(3)), $this->getUrl(2), time() + 3600, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||
// Désactivation du drapeau, langue FR par défaut
|
||||
} else {
|
||||
setcookie('ZWII_I18N_SITE' , 'fr', time() + 3600, helper::baseUrl(false, false) , '', helper::isHttps(), true);
|
||||
setcookie('ZWII_I18N_SITE', 'fr', time() + 3600, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getData(['locale', $this->getUrl(2), 'homePageId' ])
|
||||
'redirect' => helper::baseUrl() . $this->getData(['locale', $this->getUrl(2), 'homePageId'])
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
|
||||
<?php echo template::formOpen('translateAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('translateFormBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -11,8 +10,8 @@
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('translateFormSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -27,5 +26,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -1,7 +1,6 @@
|
||||
|
||||
<?php echo template::formOpen('translateLocaleForm'); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('translateFormBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -12,21 +11,21 @@
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('translateFormSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Identité du site
|
||||
<span id="localeHelpButton" class="helpDisplayButton" title="Cliquer pour consulter l'aide en ligne">
|
||||
<a href="https://doc.zwiicms.fr/localisation-et-identite" target="_blank">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('localeTitle', [
|
||||
'label' => 'Titre du site' ,
|
||||
'label' => 'Titre du site',
|
||||
'value' => $module::$locales[$this->getUrl(2)]['locale']['title'],
|
||||
'help' => 'Il apparaît dans la barre de titre et les partages sur les réseaux sociaux.'
|
||||
]); ?>
|
||||
@ -43,14 +42,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Assignation des pages spéciales
|
||||
<span id="localeHelpButton" class="helpDisplayButton" title="Cliquer pour consulter l'aide en ligne">
|
||||
<a href="https://doc.zwiicms.fr/localisation-et-identite" target="_blank">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -58,35 +57,35 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('localeHomePageId', helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC'), [
|
||||
'label' => 'Accueil du site',
|
||||
'selected' =>$module::$locales[$this->getUrl(2)]['locale'][ 'homePageId'],
|
||||
'selected' => $module::$locales[$this->getUrl(2)]['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::arrayColumn($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' =>$module::$locales[$this->getUrl(2)]['locale']['page403'],
|
||||
'selected' => $module::$locales[$this->getUrl(2)]['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::arrayColumn($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' =>$module::$locales[$this->getUrl(2)]['locale']['page404'],
|
||||
'selected' => $module::$locales[$this->getUrl(2)]['locale']['page404'],
|
||||
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('localeLegalPageId', array_merge(['none' => 'Aucune'] , helper::arrayColumn($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' => $module::$locales[$this->getUrl(2)]['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::arrayColumn($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' => $module::$locales[$this->getUrl(2)]['locale']['searchPageId'],
|
||||
'help' => 'Sélectionnez une page contenant le module \'Recherche\'. Une option du pied de page ajoute un lien discret vers cette page.'
|
||||
@ -94,23 +93,23 @@
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php
|
||||
echo template::select('localePage302', array_merge(['none' => 'Page par défaut'],helper::arrayColumn($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' =>$module::$locales[$this->getUrl(2)]['locale']['page302'],
|
||||
'selected' => $module::$locales[$this->getUrl(2)]['locale']['page302'],
|
||||
'help' => 'Cette page ne doit pas apparaître dans l\'arborescence du menu. Créez une page orpheline.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Etiquettes des pages spéciales
|
||||
<span id="labelHelpButton" class="helpDisplayButton" title="Cliquer pour consulter l'aide en ligne">
|
||||
<a href="https://doc.zwiicms.fr/etiquettes-des-pages-speciales" target="_blank">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -148,14 +147,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Message d'acceptation des Cookies
|
||||
<span id="specialeHelpButton" class="helpDisplayButton" title="Cliquer pour consulter l'aide en ligne">
|
||||
<a href="https://doc.zwiicms.fr/cookies" target="_blank">
|
||||
<?php echo template::ico('help', ['margin' => 'left']);?>
|
||||
<?php echo template::ico('help', ['margin' => 'left']); ?>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
@ -197,5 +196,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('translateForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('translateFormBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -35,9 +35,9 @@
|
||||
<div class="col2">
|
||||
<?php echo template::submit('translateFormSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab">
|
||||
<div class="tab">
|
||||
<?php echo template::button('translateUiButton', [
|
||||
'value' => 'Langue de l\'interface',
|
||||
'class' => 'buttonTab'
|
||||
@ -47,9 +47,9 @@
|
||||
'class' => 'buttonTab'
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="uiContainer" class="tabContent">
|
||||
<div id="uiContainer" class="tabContent">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
@ -60,22 +60,22 @@
|
||||
<div class="col4 offset4">
|
||||
<?php echo template::select('translateUI', $module::$i18nFiles, [
|
||||
'label' => 'Traductions installées',
|
||||
'selected' => $this->getData(['config', 'i18n' , 'interface']),
|
||||
'selected' => $this->getData(['config', 'i18n', 'interface']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="contentContainer" class="tabContent">
|
||||
</div>
|
||||
<div id="contentContainer" class="tabContent">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php if($module::$languagesInstalled): ?>
|
||||
<?php if ($module::$languagesInstalled) : ?>
|
||||
<?php echo template::table([1, 3, 2, 4, 1, 1], $module::$languagesInstalled, ['Langue', '', '', '', '', '']); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo template::formClose(); ?>
|
@ -13,7 +13,8 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class user extends common {
|
||||
class user extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'add' => self::GROUP_ADMIN,
|
||||
@ -50,18 +51,19 @@ class user extends common {
|
||||
/**
|
||||
* Ajout
|
||||
*/
|
||||
public function add() {
|
||||
public function add()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$check=true;
|
||||
if ($this->isPost()) {
|
||||
$check = true;
|
||||
// L'identifiant d'utilisateur est indisponible
|
||||
$userId = $this->getInput('userAddId', helper::FILTER_ID, true);
|
||||
if($this->getData(['user', $userId])) {
|
||||
if ($this->getData(['user', $userId])) {
|
||||
self::$inputNotices['userAddId'] = 'Identifiant déjà utilisé';
|
||||
$check=false;
|
||||
$check = false;
|
||||
}
|
||||
// Double vérification pour le mot de passe
|
||||
if($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
if ($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
self::$inputNotices['userAddConfirmPassword'] = 'Incorrect';
|
||||
$check = false;
|
||||
}
|
||||
@ -94,7 +96,7 @@ class user extends common {
|
||||
|
||||
// Envoie le mail
|
||||
$sent = true;
|
||||
if($this->getInput('userAddSendMail', helper::FILTER_BOOLEAN) && $check === true) {
|
||||
if ($this->getInput('userAddSendMail', helper::FILTER_BOOLEAN) && $check === true) {
|
||||
$sent = $this->sendMail(
|
||||
$userMail,
|
||||
'Compte créé sur ' . $this->getData(['locale', 'title']),
|
||||
@ -122,13 +124,14 @@ class user extends common {
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
public function delete() {
|
||||
public function delete()
|
||||
{
|
||||
// Accès refusé
|
||||
if(
|
||||
if (
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Groupe insuffisant
|
||||
AND ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
and ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -144,7 +147,7 @@ class user extends common {
|
||||
]);
|
||||
}
|
||||
// Bloque la suppression de son propre compte
|
||||
elseif($this->getUser('id') === $this->getUrl(2)) {
|
||||
elseif ($this->getUser('id') === $this->getUrl(2)) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'user',
|
||||
@ -166,9 +169,12 @@ class user extends common {
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function edit() {
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf'] &&
|
||||
$this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
public function edit()
|
||||
{
|
||||
if (
|
||||
$this->getUrl(3) !== $_SESSION['csrf'] &&
|
||||
$this->getUrl(4) !== $_SESSION['csrf']
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'user',
|
||||
@ -176,18 +182,17 @@ class user extends common {
|
||||
]);
|
||||
}
|
||||
// Accès refusé
|
||||
if(
|
||||
if (
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Droit d'édition
|
||||
AND (
|
||||
and (
|
||||
// Impossible de s'auto-éditer
|
||||
(
|
||||
$this->getUser('id') === $this->getUrl(2)
|
||||
AND $this->getUrl('group') <= self::GROUP_VISITOR
|
||||
($this->getUser('id') === $this->getUrl(2)
|
||||
and $this->getUrl('group') <= self::GROUP_VISITOR
|
||||
)
|
||||
// Impossible d'éditer un autre utilisateur
|
||||
OR ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
or ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
@ -198,45 +203,41 @@ class user extends common {
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Double vérification pour le mot de passe
|
||||
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
||||
if($this->getInput('userEditNewPassword')) {
|
||||
if ($this->getInput('userEditNewPassword')) {
|
||||
// L'ancien mot de passe est correct
|
||||
if(password_verify($this->getInput('userEditOldPassword'), $this->getData(['user', $this->getUrl(2), 'password']))) {
|
||||
if (password_verify($this->getInput('userEditOldPassword'), $this->getData(['user', $this->getUrl(2), 'password']))) {
|
||||
// La confirmation correspond au mot de passe
|
||||
if($this->getInput('userEditNewPassword') === $this->getInput('userEditConfirmPassword')) {
|
||||
if ($this->getInput('userEditNewPassword') === $this->getInput('userEditConfirmPassword')) {
|
||||
$newPassword = $this->getInput('userEditNewPassword', helper::FILTER_PASSWORD, true);
|
||||
// Déconnexion de l'utilisateur si il change le mot de passe de son propre compte
|
||||
if($this->getUser('id') === $this->getUrl(2)) {
|
||||
if ($this->getUser('id') === $this->getUrl(2)) {
|
||||
helper::deleteCookie('ZWII_USER_ID');
|
||||
helper::deleteCookie('ZWII_USER_PASSWORD');
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self::$inputNotices['userEditConfirmPassword'] = 'Incorrect';
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self::$inputNotices['userEditOldPassword'] = 'Incorrect';
|
||||
}
|
||||
}
|
||||
// Modification du groupe
|
||||
if(
|
||||
if (
|
||||
$this->getUser('group') === self::GROUP_ADMIN
|
||||
AND $this->getUrl(2) !== $this->getUser('id')
|
||||
and $this->getUrl(2) !== $this->getUser('id')
|
||||
) {
|
||||
$newGroup = $this->getInput('userEditGroup', helper::FILTER_INT, true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$newGroup = $this->getData(['user', $this->getUrl(2), 'group']);
|
||||
}
|
||||
// Modification de nom Prénom
|
||||
if($this->getUser('group') === self::GROUP_ADMIN){
|
||||
if ($this->getUser('group') === self::GROUP_ADMIN) {
|
||||
$newfirstname = $this->getInput('userEditFirstname', helper::FILTER_STRING_SHORT, true);
|
||||
$newlastname = $this->getInput('userEditLastname', helper::FILTER_STRING_SHORT, true);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$newfirstname = $this->getData(['user', $this->getUrl(2), 'firstname']);
|
||||
$newlastname = $this->getData(['user', $this->getUrl(2), 'lastname']);
|
||||
}
|
||||
@ -253,20 +254,20 @@ class user extends common {
|
||||
'signature' => $this->getInput('userEditSignature', helper::FILTER_INT, true),
|
||||
'mail' => $this->getInput('userEditMail', helper::FILTER_MAIL, true),
|
||||
'password' => $newPassword,
|
||||
'connectFail' => $this->getData(['user',$this->getUrl(2),'connectFail']),
|
||||
'connectTimeout' => $this->getData(['user',$this->getUrl(2),'connectTimeout']),
|
||||
'accessUrl' => $this->getData(['user',$this->getUrl(2),'accessUrl']),
|
||||
'accessTimer' => $this->getData(['user',$this->getUrl(2),'accessTimer']),
|
||||
'accessCsrf' => $this->getData(['user',$this->getUrl(2),'accessCsrf']),
|
||||
'connectFail' => $this->getData(['user', $this->getUrl(2), 'connectFail']),
|
||||
'connectTimeout' => $this->getData(['user', $this->getUrl(2), 'connectTimeout']),
|
||||
'accessUrl' => $this->getData(['user', $this->getUrl(2), 'accessUrl']),
|
||||
'accessTimer' => $this->getData(['user', $this->getUrl(2), 'accessTimer']),
|
||||
'accessCsrf' => $this->getData(['user', $this->getUrl(2), 'accessCsrf']),
|
||||
'files' => $this->getInput('userEditFiles', helper::FILTER_BOOLEAN)
|
||||
]
|
||||
]);
|
||||
// Redirection spécifique si l'utilisateur change son mot de passe
|
||||
if($this->getUser('id') === $this->getUrl(2) AND $this->getInput('userEditNewPassword')) {
|
||||
if ($this->getUser('id') === $this->getUrl(2) and $this->getInput('userEditNewPassword')) {
|
||||
$redirect = helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl());
|
||||
}
|
||||
// Redirection si retour en arrière possible
|
||||
elseif($this->getUser('group') === 3) {
|
||||
elseif ($this->getUser('group') === 3) {
|
||||
$redirect = helper::baseUrl() . 'user';
|
||||
}
|
||||
// Redirection normale
|
||||
@ -291,11 +292,12 @@ class user extends common {
|
||||
/**
|
||||
* Mot de passe perdu
|
||||
*/
|
||||
public function forgot() {
|
||||
public function forgot()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
$userId = $this->getInput('userForgotId', helper::FILTER_ID, true);
|
||||
if($this->getData(['user', $userId])) {
|
||||
if ($this->getData(['user', $userId])) {
|
||||
// Enregistre la date de la demande dans le compte utilisateur
|
||||
$this->setData(['user', $userId, 'forgot', time()]);
|
||||
// Crée un id unique pour la réinitialisation
|
||||
@ -335,23 +337,24 @@ class user extends common {
|
||||
/**
|
||||
* Liste des utilisateurs
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname');
|
||||
ksort($userIdsFirstnames);
|
||||
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
||||
foreach ($userIdsFirstnames as $userId => $userFirstname) {
|
||||
if ($this->getData(['user', $userId, 'group'])) {
|
||||
self::$users[] = [
|
||||
$userId,
|
||||
$userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||
self::$groups[$this->getData(['user', $userId, 'group'])],
|
||||
template::button('userEdit' . $userId, [
|
||||
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back/'. $_SESSION['csrf'],
|
||||
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Editer'
|
||||
]),
|
||||
template::button('userDelete' . $userId, [
|
||||
'class' => 'userDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'user/delete/' . $userId. '/' . $_SESSION['csrf'],
|
||||
'href' => helper::baseUrl() . 'user/delete/' . $userId . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('trash'),
|
||||
'help' => 'Supprimer'
|
||||
])
|
||||
@ -368,17 +371,18 @@ class user extends common {
|
||||
/**
|
||||
* Connexion
|
||||
*/
|
||||
public function login() {
|
||||
public function login()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
$logStatus = '';
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Lire Id du compte
|
||||
$userId = $this->getInput('userLoginId', helper::FILTER_ID, true);
|
||||
// Check le captcha
|
||||
if(
|
||||
$this->getData(['config','connect','captcha'])
|
||||
AND password_verify($this->getInput('userLoginCaptcha', helper::FILTER_INT), $this->getInput('userLoginCaptchaResult') ) === false )
|
||||
{
|
||||
if (
|
||||
$this->getData(['config', 'connect', 'captcha'])
|
||||
and password_verify($this->getInput('userLoginCaptcha', helper::FILTER_INT), $this->getInput('userLoginCaptchaResult')) === false
|
||||
) {
|
||||
$captcha = false;
|
||||
} else {
|
||||
$captcha = true;
|
||||
@ -386,22 +390,24 @@ class user extends common {
|
||||
/**
|
||||
* Aucun compte existant
|
||||
*/
|
||||
if ( !$this->getData(['user', $userId])) {
|
||||
if (!$this->getData(['user', $userId])) {
|
||||
$logStatus = 'Compte inconnu';
|
||||
//Stockage de l'IP
|
||||
$this->setData([
|
||||
'blacklist',
|
||||
$userId,
|
||||
[
|
||||
'connectFail' => $this->getData(['blacklist',$userId,'connectFail']) + 1,
|
||||
'connectFail' => $this->getData(['blacklist', $userId, 'connectFail']) + 1,
|
||||
'lastFail' => time(),
|
||||
'ip' => helper::getIp()
|
||||
]
|
||||
]);
|
||||
// Verrouillage des 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) ) {
|
||||
if (
|
||||
$this->getData(['blacklist', $userId, 'connectFail']) >= $this->getData(['config', 'connect', 'attempt'])
|
||||
and in_array($this->getData(['blacklist', $userId, 'ip']), $ipBlackList)
|
||||
) {
|
||||
$logStatus = 'Compte inconnu verrouillé';
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -420,33 +426,35 @@ class user extends common {
|
||||
*/
|
||||
} else {
|
||||
// Cas 4 : le délai de blocage est dépassé et le compte est au max - Réinitialiser
|
||||
if ($this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time()
|
||||
AND $this->getData(['user',$userId,'connectFail']) === $this->getData(['config', 'connect', 'attempt']) ) {
|
||||
$this->setData(['user',$userId,'connectFail',0 ]);
|
||||
$this->setData(['user',$userId,'connectTimeout',0 ]);
|
||||
if (
|
||||
$this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time()
|
||||
and $this->getData(['user', $userId, 'connectFail']) === $this->getData(['config', 'connect', 'attempt'])
|
||||
) {
|
||||
$this->setData(['user', $userId, 'connectFail', 0]);
|
||||
$this->setData(['user', $userId, 'connectTimeout', 0]);
|
||||
}
|
||||
// Check la présence des variables et contrôle du blocage du compte si valeurs dépassées
|
||||
// Vérification du mot de passe et du groupe
|
||||
if (
|
||||
( $this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) ) < time()
|
||||
AND $this->getData(['user',$userId,'connectFail']) < $this->getData(['config', 'connect', 'attempt'])
|
||||
AND password_verify($this->getInput('userLoginPassword', helper::FILTER_STRING_SHORT, true), $this->getData(['user', $userId, 'password']))
|
||||
AND $this->getData(['user', $userId, 'group']) >= self::GROUP_MEMBER
|
||||
AND $captcha === true
|
||||
($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout'])) < time()
|
||||
and $this->getData(['user', $userId, 'connectFail']) < $this->getData(['config', 'connect', 'attempt'])
|
||||
and password_verify($this->getInput('userLoginPassword', helper::FILTER_STRING_SHORT, true), $this->getData(['user', $userId, 'password']))
|
||||
and $this->getData(['user', $userId, 'group']) >= self::GROUP_MEMBER
|
||||
and $captcha === true
|
||||
) {
|
||||
// RAZ
|
||||
$this->setData(['user',$userId,'connectFail',0 ]);
|
||||
$this->setData(['user',$userId,'connectTimeout',0 ]);
|
||||
$this->setData(['user', $userId, 'connectFail', 0]);
|
||||
$this->setData(['user', $userId, 'connectTimeout', 0]);
|
||||
// Expiration
|
||||
$expire = $this->getInput('userLoginLongTime', helper::FILTER_BOOLEAN ) === true ? strtotime("+1 year") : 0 ;
|
||||
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false) , '', helper::isHttps(), true);
|
||||
$expire = $this->getInput('userLoginLongTime', helper::FILTER_BOOLEAN) === true ? strtotime("+1 year") : 0;
|
||||
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||
setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||
// Accès multiples avec le même compte
|
||||
$this->setData(['user',$userId,'accessCsrf',$_SESSION['csrf']]);
|
||||
$this->setData(['user', $userId, 'accessCsrf', $_SESSION['csrf']]);
|
||||
// Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur
|
||||
if(
|
||||
if (
|
||||
$this->getData(['config', 'maintenance'])
|
||||
AND $this->getData(['user', $userId, 'group']) < self::GROUP_ADMIN
|
||||
and $this->getData(['user', $userId, 'group']) < self::GROUP_ADMIN
|
||||
) {
|
||||
$this->addOutput([
|
||||
'notification' => 'Seul un administrateur peut se connecter lors d\'une maintenance',
|
||||
@ -457,7 +465,7 @@ class user extends common {
|
||||
$logStatus = 'Connexion réussie';
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Bienvenue ' . $this->getData(['user',$userId,'firstname']) . ' ' . $this->getData(['user',$userId,'lastname']) ,
|
||||
'notification' => 'Bienvenue ' . $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||
'redirect' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))),
|
||||
'state' => true
|
||||
]);
|
||||
@ -467,15 +475,15 @@ class user extends common {
|
||||
$notification = 'Captcha, identifiant ou mot de passe incorrects';
|
||||
$logStatus = $captcha === true ? 'Erreur de mot de passe' : 'Erreur de captcha';
|
||||
// Cas 1 le nombre de connexions est inférieur aux tentatives autorisées : incrément compteur d'échec
|
||||
if ($this->getData(['user',$userId,'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) {
|
||||
$this->setData(['user',$userId,'connectFail',$this->getdata(['user',$userId,'connectFail']) + 1 ]);
|
||||
if ($this->getData(['user', $userId, 'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) {
|
||||
$this->setData(['user', $userId, 'connectFail', $this->getdata(['user', $userId, 'connectFail']) + 1]);
|
||||
}
|
||||
// Cas 2 la limite du nombre de connexion est atteinte : placer le timer
|
||||
if ( $this->getdata(['user',$userId,'connectFail']) == $this->getData(['config', 'connect', 'attempt']) ) {
|
||||
$this->setData(['user',$userId,'connectTimeout', time()]);
|
||||
if ($this->getdata(['user', $userId, 'connectFail']) == $this->getData(['config', 'connect', 'attempt'])) {
|
||||
$this->setData(['user', $userId, 'connectTimeout', time()]);
|
||||
}
|
||||
// Cas 3 le délai de bloquage court
|
||||
if ($this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time() ) {
|
||||
if ($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time()) {
|
||||
$notification = 'Accès bloqué ' . ($this->getData(['config', 'connect', 'timeout']) / 60) . ' minutes.';
|
||||
}
|
||||
|
||||
@ -487,15 +495,15 @@ class user extends common {
|
||||
}
|
||||
}
|
||||
// Journalisation
|
||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
||||
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
||||
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';' ;
|
||||
$dataLog .= $this->getUrl() .';' ;
|
||||
$dataLog .= $logStatus ;
|
||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y', time()), 'UTF-8', true)
|
||||
? strftime('%d/%m/%y', time()) . ';' . strftime('%R', time()) . ';'
|
||||
: utf8_encode(strftime('%d/%m/%y', time())) . ';' . utf8_encode(strftime('%R', time())) . ';';
|
||||
$dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';';
|
||||
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';';
|
||||
$dataLog .= $this->getUrl() . ';';
|
||||
$dataLog .= $logStatus;
|
||||
$dataLog .= PHP_EOL;
|
||||
if ($this->getData(['config','connect','log'])) {
|
||||
if ($this->getData(['config', 'connect', 'log'])) {
|
||||
file_put_contents(self::DATA_DIR . 'journal.log', $dataLog, FILE_APPEND);
|
||||
}
|
||||
// Stockage des cookies
|
||||
@ -513,7 +521,8 @@ class user extends common {
|
||||
/**
|
||||
* Déconnexion
|
||||
*/
|
||||
public function logout() {
|
||||
public function logout()
|
||||
{
|
||||
helper::deleteCookie('ZWII_USER_ID');
|
||||
helper::deleteCookie('ZWII_USER_PASSWORD');
|
||||
session_destroy();
|
||||
@ -528,15 +537,16 @@ class user extends common {
|
||||
/**
|
||||
* Réinitialisation du mot de passe
|
||||
*/
|
||||
public function reset() {
|
||||
public function reset()
|
||||
{
|
||||
// Accès refusé
|
||||
if(
|
||||
if (
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Lien de réinitialisation trop vieux
|
||||
OR $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
||||
or $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
||||
// Id unique incorrecte
|
||||
OR $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
|
||||
or $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -546,15 +556,14 @@ class user extends common {
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Double vérification pour le mot de passe
|
||||
if($this->getInput('userResetNewPassword')) {
|
||||
if ($this->getInput('userResetNewPassword')) {
|
||||
// La confirmation ne correspond pas au mot de passe
|
||||
if($this->getInput('userResetNewPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userResetConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
if ($this->getInput('userResetNewPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userResetConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
||||
self::$inputNotices['userResetConfirmPassword'] = 'Incorrect';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$newPassword = $this->getInput('userResetNewPassword', helper::FILTER_PASSWORD, true);
|
||||
}
|
||||
// Modifie le mot de passe
|
||||
@ -562,8 +571,8 @@ class user extends common {
|
||||
// Réinitialise la date de la demande
|
||||
$this->setData(['user', $this->getUrl(2), 'forgot', 0]);
|
||||
// Réinitialise le blocage
|
||||
$this->setData(['user', $this->getUrl(2),'connectFail',0 ]);
|
||||
$this->setData(['user', $this->getUrl(2),'connectTimeout',0 ]);
|
||||
$this->setData(['user', $this->getUrl(2), 'connectFail', 0]);
|
||||
$this->setData(['user', $this->getUrl(2), 'connectTimeout', 0]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Nouveau mot de passe enregistré',
|
||||
@ -585,66 +594,69 @@ class user extends common {
|
||||
/**
|
||||
* Importation CSV d'utilisateurs
|
||||
*/
|
||||
public function import() {
|
||||
public function import()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
$notification = '';
|
||||
$success = true;
|
||||
if($this->isPost()) {
|
||||
if ($this->isPost()) {
|
||||
// Lecture du CSV et construction du tableau
|
||||
$file = $this->getInput('userImportCSVFile',helper::FILTER_STRING_SHORT, true);
|
||||
$file = $this->getInput('userImportCSVFile', helper::FILTER_STRING_SHORT, true);
|
||||
$filePath = self::FILE_DIR . 'source/' . $file;
|
||||
if ($file AND file_exists($filePath)) {
|
||||
if ($file and file_exists($filePath)) {
|
||||
// Analyse et extraction du CSV
|
||||
$rows = array_map(function($row) { return str_getcsv($row, $this->getInput('userImportSeparator') ); }, file($filePath));
|
||||
$rows = array_map(function ($row) {
|
||||
return str_getcsv($row, $this->getInput('userImportSeparator'));
|
||||
}, file($filePath));
|
||||
$header = array_shift($rows);
|
||||
$csv = array();
|
||||
foreach($rows as $row) {
|
||||
foreach ($rows as $row) {
|
||||
$csv[] = array_combine($header, $row);
|
||||
}
|
||||
// Traitement des données
|
||||
foreach($csv as $item ) {
|
||||
foreach ($csv as $item) {
|
||||
// Données valides
|
||||
if( array_key_exists('id', $item)
|
||||
AND array_key_exists('prenom',$item)
|
||||
AND array_key_exists('nom',$item)
|
||||
AND array_key_exists('groupe',$item)
|
||||
AND array_key_exists('email',$item)
|
||||
AND $item['nom']
|
||||
AND $item['prenom']
|
||||
AND $item['id']
|
||||
AND $item['email']
|
||||
AND $item['groupe']
|
||||
if (
|
||||
array_key_exists('id', $item)
|
||||
and array_key_exists('prenom', $item)
|
||||
and array_key_exists('nom', $item)
|
||||
and array_key_exists('groupe', $item)
|
||||
and array_key_exists('email', $item)
|
||||
and $item['nom']
|
||||
and $item['prenom']
|
||||
and $item['id']
|
||||
and $item['email']
|
||||
and $item['groupe']
|
||||
) {
|
||||
// Validation du groupe
|
||||
$item['groupe'] = (int) $item['groupe'];
|
||||
$item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN )
|
||||
$item['groupe'] = ($item['groupe'] >= self::GROUP_BANNED and $item['groupe'] <= self::GROUP_ADMIN)
|
||||
? $item['groupe'] : 1;
|
||||
// L'utilisateur existe
|
||||
if ( $this->getData(['user',helper::filter($item['id'] , helper::FILTER_ID)]))
|
||||
{
|
||||
if ($this->getData(['user', helper::filter($item['id'], helper::FILTER_ID)])) {
|
||||
// Notification du doublon
|
||||
$item['notification'] = template::ico('cancel');
|
||||
// Création du tableau de confirmation
|
||||
self::$users[] = [
|
||||
helper::filter($item['id'] , helper::FILTER_ID),
|
||||
helper::filter($item['id'], helper::FILTER_ID),
|
||||
$item['nom'],
|
||||
$item['prenom'],
|
||||
self::$groups[$item['groupe']],
|
||||
$item['prenom'],
|
||||
helper::filter($item['email'] , helper::FILTER_MAIL),
|
||||
helper::filter($item['email'], helper::FILTER_MAIL),
|
||||
$item['notification']
|
||||
];
|
||||
// L'utilisateur n'existe pas
|
||||
} else {
|
||||
// Nettoyage de l'identifiant
|
||||
$userId = helper::filter($item['id'] , helper::FILTER_ID);
|
||||
$userId = helper::filter($item['id'], helper::FILTER_ID);
|
||||
// Enregistre le user
|
||||
$create = $this->setData([
|
||||
'user',
|
||||
$userId, [
|
||||
'firstname' => $item['prenom'],
|
||||
'forgot' => 0,
|
||||
'group' => $item['groupe'] ,
|
||||
'group' => $item['groupe'],
|
||||
'lastname' => $item['nom'],
|
||||
'mail' => $item['email'],
|
||||
'pseudo' => $item['prenom'],
|
||||
@ -655,12 +667,15 @@ class user extends common {
|
||||
"accessUrl" => null,
|
||||
"accessTimer" => null,
|
||||
"accessCsrf" => null
|
||||
]]);
|
||||
]
|
||||
]);
|
||||
// Icône de notification
|
||||
$item['notification'] = $create ? template::ico('check') : template::ico('cancel');
|
||||
// Envoi du mail
|
||||
if ($create
|
||||
AND $this->getInput('userImportNotification',helper::FILTER_BOOLEAN) === true) {
|
||||
if (
|
||||
$create
|
||||
and $this->getInput('userImportNotification', helper::FILTER_BOOLEAN) === true
|
||||
) {
|
||||
$sent = $this->sendMail(
|
||||
$item['email'],
|
||||
'Compte créé sur ' . $this->getData(['locale', 'title']),
|
||||
@ -671,7 +686,7 @@ class user extends common {
|
||||
);
|
||||
if ($sent === true) {
|
||||
// Mail envoyé changement de l'icône
|
||||
$item['notification'] = template::ico('mail') ;
|
||||
$item['notification'] = template::ico('mail');
|
||||
}
|
||||
}
|
||||
// Création du tableau de confirmation
|
||||
@ -688,10 +703,10 @@ class user extends common {
|
||||
}
|
||||
}
|
||||
if (empty(self::$users)) {
|
||||
$notification = 'Rien à importer, erreur de format ou fichier incorrect' ;
|
||||
$notification = 'Rien à importer, erreur de format ou fichier incorrect';
|
||||
$success = false;
|
||||
} else {
|
||||
$notification = 'Importation effectuée' ;
|
||||
$notification = 'Importation effectuée';
|
||||
$success = true;
|
||||
}
|
||||
} else {
|
||||
@ -707,5 +722,4 @@ class user extends common {
|
||||
'state' => $success
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('userAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('userAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
@ -10,8 +10,8 @@
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('userAddSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -86,10 +86,13 @@
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
<?php echo template::checkbox('userAddSendMail', true,
|
||||
'Prévenir l\'utilisateur par mail');
|
||||
<?php echo template::checkbox(
|
||||
'userAddSendMail',
|
||||
true,
|
||||
'Prévenir l\'utilisateur par mail'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -1,13 +1,13 @@
|
||||
<?php echo template::formOpen('userEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||
<?php if ($this->getUser('group') === self::GROUP_ADMIN) : ?>
|
||||
<?php echo template::button('userEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'user',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php else : ?>
|
||||
<?php echo template::button('userEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
@ -18,8 +18,8 @@
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('userEditSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>
|
||||
@ -57,7 +57,7 @@
|
||||
'label' => 'Adresse mail',
|
||||
'value' => $this->getData(['user', $this->getUrl(2), 'mail'])
|
||||
]); ?>
|
||||
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||
<?php if ($this->getUser('group') === self::GROUP_ADMIN) : ?>
|
||||
<?php echo template::select('userEditGroup', self::$groupEdits, [
|
||||
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
|
||||
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
|
||||
@ -113,5 +113,5 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -1,8 +1,8 @@
|
||||
<?php echo template::formOpen('userForgotForm'); ?>
|
||||
<?php echo template::text('userForgotId', [
|
||||
<?php echo template::text('userForgotId', [
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col1 offset9">
|
||||
<?php echo template::button('userForgotBack', [
|
||||
'href' => helper::baseUrl() . 'user/login/' . $this->getUrl(2),
|
||||
@ -14,5 +14,5 @@
|
||||
'value' => 'Valider'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -51,11 +51,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php if ($module::$users): ?>
|
||||
<?php if ($module::$users) : ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php echo template::table([1, 3, 3, 1, 1, 2, 1], $module::$users, ['Id', 'Nom', 'Prénom','Groupe', 'Pseudo', 'eMail', '']); ?>
|
||||
<?php echo template::ico('check');?> Compte créé | <?php echo template::ico('mail');?> Compte créé et notifié | <?php echo template::ico('cancel');?> Erreur dans le fichier, compte non créé.
|
||||
<?php echo template::table([1, 3, 3, 1, 1, 2, 1], $module::$users, ['Id', 'Nom', 'Prénom', 'Groupe', 'Pseudo', 'eMail', '']); ?>
|
||||
<?php echo template::ico('check'); ?> Compte créé | <?php echo template::ico('mail'); ?> Compte créé et notifié | <?php echo template::ico('cancel'); ?> Erreur dans le fichier, compte non créé.
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php endif; ?>
|
@ -18,7 +18,7 @@
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('userImport', [
|
||||
'href' => helper::baseUrl() . 'user/import',
|
||||
'value' => template::ico('upload') ,
|
||||
'value' => template::ico('upload'),
|
||||
'help' => 'Importer des utilisateurs en masse'
|
||||
]); ?>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('userLoginForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('userLoginId', [
|
||||
'label' => 'Identifiant',
|
||||
@ -8,7 +8,7 @@
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php if ($this->getData(['config', 'connect', 'showPassword']) === true) {
|
||||
$passwordLabel = '<span id="passwordLabel">Mot de passe</span><span id="passwordIcon">'. template::ico('eye') . '</span>';
|
||||
$passwordLabel = '<span id="passwordLabel">Mot de passe</span><span id="passwordIcon">' . template::ico('eye') . '</span>';
|
||||
} else {
|
||||
$passwordLabel = 'Mot de passe';
|
||||
}
|
||||
@ -17,18 +17,18 @@
|
||||
'label' => $passwordLabel
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->getData(['config', 'connect','captcha'])): ?>
|
||||
</div>
|
||||
<?php if ($this->getData(['config', 'connect', 'captcha'])) : ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php echo template::captcha('userLoginCaptcha', [
|
||||
'limit' => $this->getData(['config','connect', 'captchaStrong']),
|
||||
'type' => $this->getData(['config','connect', 'captchaType'])
|
||||
'limit' => $this->getData(['config', 'connect', 'captchaStrong']),
|
||||
'type' => $this->getData(['config', 'connect', 'captchaType'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class="row">
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('userLoginLongTime', true, 'Rester connecté sur ce navigateur', [
|
||||
'checked' => $module::$userLongtime
|
||||
@ -37,8 +37,8 @@
|
||||
<div class="col6 textAlignRight">
|
||||
<a href="<?php echo helper::baseUrl(); ?>user/forgot/<?php echo $this->getUrl(2); ?>">Mot de passe perdu ?</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userLoginBack', [
|
||||
'href' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))),
|
||||
@ -50,5 +50,5 @@
|
||||
'value' => 'Connexion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -1,5 +1,5 @@
|
||||
<?php echo template::formOpen('userResetForm'); ?>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::password('userResetNewPassword', [
|
||||
'label' => 'Nouveau mot de passe'
|
||||
@ -10,12 +10,12 @@
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col2 offset10">
|
||||
<?php echo template::submit('userResetSubmit', [
|
||||
'value' => 'Valider'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
Loading…
Reference in New Issue
Block a user