2018-04-02 08:29:19 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of Zwii.
|
|
|
|
*
|
|
|
|
* For full copyright and license information, please see the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* @author Rémi Jean <remi.jean@outlook.com>
|
|
|
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
|
|
|
* @license GNU General Public License, version 3
|
2019-01-22 21:56:38 +01:00
|
|
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
|
|
|
* @copyright Copyright (C) 2018-2019, Frédéric Tempez
|
2018-04-02 08:29:19 +02:00
|
|
|
* @link http://zwiicms.com/
|
|
|
|
*/
|
|
|
|
|
|
|
|
class common {
|
|
|
|
|
|
|
|
const DISPLAY_RAW = 0;
|
|
|
|
const DISPLAY_JSON = 1;
|
|
|
|
const DISPLAY_LAYOUT_BLANK = 2;
|
|
|
|
const DISPLAY_LAYOUT_MAIN = 3;
|
|
|
|
const DISPLAY_LAYOUT_LIGHT = 4;
|
|
|
|
const GROUP_BANNED = -1;
|
|
|
|
const GROUP_VISITOR = 0;
|
|
|
|
const GROUP_MEMBER = 1;
|
|
|
|
const GROUP_MODERATOR = 2;
|
|
|
|
const GROUP_ADMIN = 3;
|
2019-05-28 09:04:10 +02:00
|
|
|
const BACKUP_DIR = 'site/backup/';
|
|
|
|
const DATA_DIR = 'site/data/';
|
|
|
|
const FILE_DIR = 'site/file/';
|
|
|
|
const TEMP_DIR = 'site/tmp/';
|
2019-03-22 19:04:51 +01:00
|
|
|
|
2019-05-02 13:21:48 +02:00
|
|
|
// Numéro de version
|
2019-07-12 09:19:14 +02:00
|
|
|
const ZWII_VERSION = '9.2.00';
|
2018-04-02 08:29:19 +02:00
|
|
|
|
|
|
|
public static $actions = [];
|
|
|
|
public static $coreModuleIds = [
|
|
|
|
'config',
|
|
|
|
'install',
|
|
|
|
'maintenance',
|
|
|
|
'page',
|
2019-07-04 12:38:23 +02:00
|
|
|
'search',
|
2018-04-02 08:29:19 +02:00
|
|
|
'sitemap',
|
|
|
|
'theme',
|
2019-07-04 12:38:23 +02:00
|
|
|
'user'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
private $data = [];
|
|
|
|
private $hierarchy = [
|
|
|
|
'all' => [],
|
2019-01-30 19:38:17 +01:00
|
|
|
'visible' => [],
|
|
|
|
'bar' => []
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
private $input = [
|
|
|
|
'_COOKIE' => [],
|
|
|
|
'_POST' => []
|
|
|
|
];
|
|
|
|
public static $inputBefore = [];
|
|
|
|
public static $inputNotices = [];
|
|
|
|
public $output = [
|
|
|
|
'access' => true,
|
|
|
|
'content' => '',
|
2019-05-02 13:21:48 +02:00
|
|
|
'contentLeft' => '',
|
|
|
|
'contentRight' => '',
|
2018-04-02 08:29:19 +02:00
|
|
|
'display' => self::DISPLAY_LAYOUT_MAIN,
|
|
|
|
'metaDescription' => '',
|
|
|
|
'metaTitle' => '',
|
|
|
|
'notification' => '',
|
|
|
|
'redirect' => '',
|
|
|
|
'script' => '',
|
|
|
|
'showBarEditButton' => false,
|
|
|
|
'showPageContent' => false,
|
|
|
|
'state' => false,
|
|
|
|
'style' => '',
|
|
|
|
'title' => null, // Null car un titre peut être vide
|
|
|
|
// Trié par ordre d'exécution
|
|
|
|
'vendor' => [
|
|
|
|
'jquery',
|
|
|
|
'normalize',
|
|
|
|
'lity',
|
|
|
|
'filemanager',
|
2018-11-28 14:12:33 +01:00
|
|
|
'flatpickr',
|
2018-04-02 08:29:19 +02:00
|
|
|
// 'tinycolorpicker', Désactivé par défaut
|
|
|
|
// 'tinymce', Désactivé par défaut
|
|
|
|
// 'codemirror', // Désactivé par défaut
|
|
|
|
'tippy',
|
2019-03-11 11:36:23 +01:00
|
|
|
'zwiico',
|
2019-03-21 11:18:45 +01:00
|
|
|
'imagemap',
|
2019-05-02 13:21:48 +02:00
|
|
|
'simplelightbox',
|
|
|
|
'swiper'
|
2018-04-02 08:29:19 +02:00
|
|
|
],
|
|
|
|
'view' => ''
|
|
|
|
];
|
|
|
|
public static $groups = [
|
|
|
|
self::GROUP_BANNED => 'Banni',
|
|
|
|
self::GROUP_VISITOR => 'Visiteur',
|
|
|
|
self::GROUP_MEMBER => 'Membre',
|
2019-01-11 19:42:35 +01:00
|
|
|
self::GROUP_MODERATOR => 'Éditeur',
|
2018-04-02 08:29:19 +02:00
|
|
|
self::GROUP_ADMIN => 'Administrateur'
|
|
|
|
];
|
|
|
|
public static $groupEdits = [
|
|
|
|
self::GROUP_BANNED => 'Banni',
|
|
|
|
self::GROUP_MEMBER => 'Membre',
|
2019-01-11 19:42:35 +01:00
|
|
|
self::GROUP_MODERATOR => 'Éditeur',
|
2018-04-02 08:29:19 +02:00
|
|
|
self::GROUP_ADMIN => 'Administrateur'
|
|
|
|
];
|
|
|
|
public static $groupNews = [
|
|
|
|
self::GROUP_MEMBER => 'Membre',
|
2019-01-11 19:42:35 +01:00
|
|
|
self::GROUP_MODERATOR => 'Éditeur',
|
2018-04-02 08:29:19 +02:00
|
|
|
self::GROUP_ADMIN => 'Administrateur'
|
|
|
|
];
|
|
|
|
public static $groupPublics = [
|
|
|
|
self::GROUP_VISITOR => 'Visiteur',
|
|
|
|
self::GROUP_MEMBER => 'Membre',
|
2019-01-11 19:42:35 +01:00
|
|
|
self::GROUP_MODERATOR => 'Éditeur',
|
2018-04-02 08:29:19 +02:00
|
|
|
self::GROUP_ADMIN => 'Administrateur'
|
|
|
|
];
|
|
|
|
public static $timezone;
|
|
|
|
private $url = '';
|
|
|
|
private $user = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructeur commun
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
|
|
|
// Extraction des données http
|
|
|
|
if(isset($_POST)) {
|
|
|
|
$this->input['_POST'] = $_POST;
|
|
|
|
}
|
|
|
|
if(isset($_COOKIE)) {
|
|
|
|
$this->input['_COOKIE'] = $_COOKIE;
|
|
|
|
}
|
2019-01-24 20:44:53 +01:00
|
|
|
|
2019-01-26 22:55:16 +01:00
|
|
|
// Import des données d'une version 8
|
|
|
|
$this->importData();
|
2019-01-24 21:25:12 +01:00
|
|
|
|
2018-12-24 19:48:14 +01:00
|
|
|
// Génère le fichier de données lorque les deux fichiers sont absents ou seulement le thème est - installation fraîche par défaut
|
2019-05-28 09:04:10 +02:00
|
|
|
if(file_exists(self::DATA_DIR.'core.json') === false OR
|
|
|
|
file_exists(self::DATA_DIR.'theme.json') === false) {
|
2019-03-22 19:04:51 +01:00
|
|
|
include_once('core/module/install/ressource/defaultdata.php');
|
|
|
|
$this->setData([install::$defaultData]);
|
2018-04-02 08:29:19 +02:00
|
|
|
$this->saveData();
|
2019-05-28 09:04:10 +02:00
|
|
|
chmod(self::DATA_DIR.'core.json', 0755);
|
|
|
|
chmod(self::DATA_DIR.'theme.json', 0755);
|
2018-12-24 19:48:14 +01:00
|
|
|
}
|
|
|
|
|
2019-01-26 22:55:16 +01:00
|
|
|
// Import des données d'un fichier data.json déjà présent
|
2019-01-26 22:45:04 +01:00
|
|
|
if($this->data === []) {
|
|
|
|
$this->readData();
|
|
|
|
}
|
|
|
|
|
2019-02-12 15:42:31 +01:00
|
|
|
// Mise à jour des données core
|
2019-03-20 07:45:16 +01:00
|
|
|
$this->update();
|
2019-02-12 15:42:31 +01:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
// Utilisateur connecté
|
|
|
|
if($this->user === []) {
|
|
|
|
$this->user = $this->getData(['user', $this->getInput('ZWII_USER_ID')]);
|
|
|
|
}
|
|
|
|
// Construit la liste des pages parents/enfants
|
|
|
|
if($this->hierarchy['all'] === []) {
|
|
|
|
$pages = helper::arrayCollumn($this->getData(['page']), 'position', 'SORT_ASC');
|
|
|
|
// Parents
|
|
|
|
foreach($pages as $pageId => $pagePosition) {
|
|
|
|
if(
|
|
|
|
// Page parent
|
|
|
|
$this->getData(['page', $pageId, 'parentPageId']) === ""
|
|
|
|
// Ignore les pages dont l'utilisateur n'a pas accès
|
|
|
|
AND (
|
|
|
|
$this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
|
|
|
|
OR (
|
|
|
|
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
|
|
|
AND $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) {
|
|
|
|
if($pagePosition !== 0) {
|
|
|
|
$this->hierarchy['visible'][$pageId] = [];
|
|
|
|
}
|
2019-01-30 19:38:17 +01:00
|
|
|
if($this->getData(['page', $pageId, 'block']) === 'bar') {
|
|
|
|
$this->hierarchy['bar'][$pageId] = [];
|
|
|
|
}
|
2018-04-02 08:29:19 +02:00
|
|
|
$this->hierarchy['all'][$pageId] = [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Enfants
|
|
|
|
foreach($pages as $pageId => $pagePosition) {
|
|
|
|
if(
|
|
|
|
// Page parent
|
|
|
|
$parentId = $this->getData(['page', $pageId, 'parentPageId'])
|
|
|
|
// Ignore les pages dont l'utilisateur n'a pas accès
|
|
|
|
AND (
|
|
|
|
(
|
|
|
|
$this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
|
|
|
|
AND $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR
|
|
|
|
)
|
|
|
|
OR (
|
|
|
|
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
|
|
|
AND $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])
|
|
|
|
AND $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) {
|
|
|
|
if($pagePosition !== 0) {
|
|
|
|
$this->hierarchy['visible'][$parentId][] = $pageId;
|
|
|
|
}
|
2019-01-30 19:38:17 +01:00
|
|
|
if($this->getData(['page', $pageId, 'block']) === 'bar') {
|
|
|
|
$this->hierarchy['bar'][$pageId] = [];
|
|
|
|
}
|
2018-04-02 08:29:19 +02:00
|
|
|
$this->hierarchy['all'][$parentId][] = $pageId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Construit l'url
|
|
|
|
if($this->url === '') {
|
|
|
|
if($url = $_SERVER['QUERY_STRING']) {
|
|
|
|
$this->url = $url;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->url = $this->getData(['config', 'homePageId']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-23 03:34:11 +01:00
|
|
|
/**
|
|
|
|
* Lecture des fichiers de données
|
|
|
|
*
|
|
|
|
*/
|
2018-12-29 17:49:48 +01:00
|
|
|
public function readData() {
|
2018-12-30 18:33:37 +01:00
|
|
|
// Trois tentatives
|
|
|
|
for($i = 0; $i < 3; $i++) {
|
2019-05-28 09:04:10 +02:00
|
|
|
$this->setData([json_decode(file_get_contents(self::DATA_DIR.'core.json'), true) + json_decode(file_get_contents(self::DATA_DIR.'theme.json'), true)]);
|
2018-12-30 18:33:37 +01:00
|
|
|
if($this->data) {
|
|
|
|
break;
|
2018-12-29 17:49:48 +01:00
|
|
|
}
|
2018-12-30 18:33:37 +01:00
|
|
|
elseif($i === 2) {
|
|
|
|
exit('Unable to read data file.');
|
|
|
|
}
|
|
|
|
// Pause de 10 millisecondes
|
|
|
|
usleep(10000);
|
2018-12-29 17:49:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-24 19:48:14 +01:00
|
|
|
/**
|
2019-01-23 03:34:11 +01:00
|
|
|
* Import des données de la version 8
|
2018-12-24 22:25:28 +01:00
|
|
|
* Converti un fichier de données data.json puis le renomme
|
2018-12-24 19:48:14 +01:00
|
|
|
*/
|
|
|
|
public function importData() {
|
2019-05-28 09:04:10 +02:00
|
|
|
if(file_exists(self::DATA_DIR.'data.json')) {
|
2018-12-24 19:48:14 +01:00
|
|
|
// Trois tentatives
|
|
|
|
for($i = 0; $i < 3; $i++) {
|
2019-05-28 09:04:10 +02:00
|
|
|
$tempData = [json_decode(file_get_contents(self::DATA_DIR.'data.json'), true)];
|
2018-12-24 19:48:14 +01:00
|
|
|
if($tempData) {
|
|
|
|
for($i = 0; $i < 3; $i++) {
|
2019-05-28 09:04:10 +02:00
|
|
|
if(file_put_contents(self::DATA_DIR.'core.json', json_encode(array_slice($tempData[0],0,5)), LOCK_EX) !== false) {
|
2018-12-24 19:48:14 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Pause de 10 millisecondes
|
|
|
|
usleep(10000);
|
|
|
|
}
|
2018-12-24 22:25:28 +01:00
|
|
|
for($i = 0; $i < 3; $i++) {
|
2019-05-28 09:04:10 +02:00
|
|
|
if(file_put_contents(self::DATA_DIR.'theme.json', json_encode(array_slice($tempData[0],5)), LOCK_EX) !== false) {
|
2018-12-24 22:25:28 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Pause de 10 millisecondes
|
|
|
|
usleep(10000);
|
|
|
|
}
|
2019-05-28 09:04:10 +02:00
|
|
|
rename (self::DATA_DIR.'data.json',self::DATA_DIR.'imported_data.json');
|
2018-12-24 19:48:14 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
elseif($i === 2) {
|
|
|
|
exit('Unable to read data file.');
|
|
|
|
}
|
|
|
|
// Pause de 10 millisecondes
|
|
|
|
usleep(10000);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Ajoute les valeurs en sortie
|
|
|
|
* @param array $output Valeurs en sortie
|
|
|
|
*/
|
|
|
|
public function addOutput($output) {
|
|
|
|
$this->output = array_merge($this->output, $output);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ajoute une notice de champ obligatoire
|
|
|
|
* @param string $key Clef du champ
|
|
|
|
*/
|
|
|
|
public function addRequiredInputNotices($key) {
|
|
|
|
// La clef est un tableau
|
|
|
|
if(preg_match('#\[(.*)\]#', $key, $secondKey)) {
|
|
|
|
$firstKey = explode('[', $key)[0];
|
|
|
|
$secondKey = $secondKey[1];
|
|
|
|
if(empty($this->input['_POST'][$firstKey][$secondKey])) {
|
|
|
|
common::$inputNotices[$firstKey . '_' . $secondKey] = 'Obligatoire';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// La clef est une chaine
|
|
|
|
elseif(empty($this->input['_POST'][$key])) {
|
|
|
|
common::$inputNotices[$key] = 'Obligatoire';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check du token CSRF (true = bo
|
|
|
|
*/
|
|
|
|
public function checkCSRF() {
|
|
|
|
return ((empty($_POST['csrf']) OR hash_equals($_SESSION['csrf'], $_POST['csrf']) === false) === false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Supprime des données
|
|
|
|
* @param array $keys Clé(s) des données
|
|
|
|
*/
|
|
|
|
public function deleteData($keys) {
|
|
|
|
switch(count($keys)) {
|
|
|
|
case 1 :
|
|
|
|
unset($this->data[$keys[0]]);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
unset($this->data[$keys[0]][$keys[1]]);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
unset($this->data[$keys[0]][$keys[1]][$keys[2]]);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
unset($this->data[$keys[0]][$keys[1]][$keys[2]][$keys[3]]);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
unset($this->data[$keys[0]][$keys[1]][$keys[2]][$keys[3]][$keys[4]]);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
unset($this->data[$keys[0]][$keys[1]][$keys[2]][$keys[3]][$keys[4]][$keys[5]]);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
unset($this->data[$keys[0]][$keys[1]][$keys[2]][$keys[3]][$keys[4]][$keys[5]][$keys[6]]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-19 10:46:38 +01:00
|
|
|
|
2018-10-24 22:48:10 +02:00
|
|
|
/**
|
2018-11-13 13:27:37 +01:00
|
|
|
* Récupérer une copie d'écran du site Web pour le tag image si le fichier n'existe pas
|
2018-10-24 22:48:10 +02:00
|
|
|
* En local, copie du site décran de ZwiiCMS
|
2018-11-19 10:46:38 +01:00
|
|
|
*/
|
2018-10-24 22:48:10 +02:00
|
|
|
public function makeImageTag () {
|
2019-05-28 09:04:10 +02:00
|
|
|
if (!file_exists(self::FILE_DIR.'source/screenshot.png'))
|
2018-11-19 10:46:38 +01:00
|
|
|
{
|
|
|
|
if ( strpos(helper::baseUrl(false),'localhost') == 0 AND strpos(helper::baseUrl(false),'127.0.0.1') == 0) {
|
2019-06-18 10:13:09 +02:00
|
|
|
$googlePagespeedData = @file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. helper::baseUrl(false) .'&screenshot=true');
|
|
|
|
if ($googlePagespeedData !== false) {
|
|
|
|
$googlePagespeedData = json_decode($googlePagespeedData, true);
|
|
|
|
$screenshot = $googlePagespeedData['screenshot']['data'];
|
|
|
|
$screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
|
|
|
|
$data = 'data:image/jpeg;base64,'.$screenshot;
|
|
|
|
$data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
|
|
|
|
file_put_contents( self::FILE_DIR.'source/screenshot.png',$data);
|
|
|
|
}
|
2018-11-19 10:46:38 +01:00
|
|
|
}
|
2018-10-24 22:48:10 +02:00
|
|
|
}
|
|
|
|
}
|
2018-11-19 10:50:18 +01:00
|
|
|
|
2018-10-24 22:48:10 +02:00
|
|
|
|
2018-11-19 10:46:38 +01:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Accède aux données
|
|
|
|
* @param array $keys Clé(s) des données
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getData($keys = null) {
|
|
|
|
// Retourne l'ensemble des données
|
|
|
|
if($keys === null) {
|
|
|
|
return $this->data;
|
|
|
|
}
|
|
|
|
// Décent dans les niveaux de la variable $data
|
|
|
|
$data = $this->data;
|
|
|
|
foreach($keys as $key) {
|
|
|
|
// Si aucune donnée n'existe retourne null
|
|
|
|
if(isset($data[$key]) === false) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// Sinon décent dans les niveaux
|
|
|
|
else {
|
|
|
|
$data = $data[$key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Retourne les données
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-10 13:07:43 +01:00
|
|
|
* Accède à la liste des pages parents et de leurs enfants
|
2018-04-02 08:29:19 +02:00
|
|
|
* @param int $parentId Id de la page parent
|
|
|
|
* @param bool $onlyVisible Affiche seulement les pages visibles
|
2019-02-10 13:07:43 +01:00
|
|
|
* @param bool $onlyBlock Affiche seulement les pages de type barre
|
2018-04-02 08:29:19 +02:00
|
|
|
* @return array
|
|
|
|
*/
|
2019-01-30 19:38:17 +01:00
|
|
|
public function getHierarchy($parentId = null, $onlyVisible = true, $onlyBlock = false) {
|
2018-04-02 08:29:19 +02:00
|
|
|
$hierarchy = $onlyVisible ? $this->hierarchy['visible'] : $this->hierarchy['all'];
|
2019-01-30 19:38:17 +01:00
|
|
|
$hierarchy = $onlyBlock ? $this->hierarchy['bar'] : $hierarchy;
|
2018-04-02 08:29:19 +02:00
|
|
|
// Enfants d'un parent
|
|
|
|
if($parentId) {
|
|
|
|
if(array_key_exists($parentId, $hierarchy)) {
|
|
|
|
return $hierarchy[$parentId];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Parents et leurs enfants
|
|
|
|
else {
|
|
|
|
return $hierarchy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accède à une valeur des variables http (ordre de recherche en l'absence de type : _COOKIE, _POST)
|
|
|
|
* @param string $key Clé de la valeur
|
|
|
|
* @param int $filter Filtre à appliquer à la valeur
|
|
|
|
* @param bool $required Champ requis
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getInput($key, $filter = helper::FILTER_STRING_SHORT, $required = false) {
|
|
|
|
// La clef est un tableau
|
|
|
|
if(preg_match('#\[(.*)\]#', $key, $secondKey)) {
|
|
|
|
$firstKey = explode('[', $key)[0];
|
|
|
|
$secondKey = $secondKey[1];
|
|
|
|
foreach($this->input as $type => $values) {
|
|
|
|
// Champ obligatoire
|
|
|
|
if($required) {
|
|
|
|
$this->addRequiredInputNotices($key);
|
|
|
|
}
|
|
|
|
// Check de l'existence
|
|
|
|
// Également utile pour les checkboxs qui ne retournent rien lorsqu'elles ne sont pas cochées
|
|
|
|
if(
|
|
|
|
array_key_exists($firstKey, $values)
|
|
|
|
AND array_key_exists($secondKey, $values[$firstKey])
|
|
|
|
) {
|
|
|
|
// Retourne la valeur filtrée
|
|
|
|
if($filter) {
|
|
|
|
return helper::filter($this->input[$type][$firstKey][$secondKey], $filter);
|
|
|
|
}
|
|
|
|
// Retourne la valeur
|
|
|
|
else {
|
|
|
|
return $this->input[$type][$firstKey][$secondKey];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// La clef est une chaine
|
|
|
|
else {
|
|
|
|
foreach($this->input as $type => $values) {
|
|
|
|
// Champ obligatoire
|
|
|
|
if($required) {
|
|
|
|
$this->addRequiredInputNotices($key);
|
|
|
|
}
|
|
|
|
// Check de l'existence
|
|
|
|
// Également utile pour les checkboxs qui ne retournent rien lorsqu'elles ne sont pas cochées
|
|
|
|
if(array_key_exists($key, $values)) {
|
|
|
|
// Retourne la valeur filtrée
|
|
|
|
if($filter) {
|
|
|
|
return helper::filter($this->input[$type][$key], $filter);
|
|
|
|
}
|
|
|
|
// Retourne la valeur
|
|
|
|
else {
|
|
|
|
return $this->input[$type][$key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Sinon retourne null
|
|
|
|
return helper::filter(null, $filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accède à une partie l'url ou à l'url complète
|
|
|
|
* @param int $key Clé de l'url
|
|
|
|
* @return string|null
|
|
|
|
*/
|
|
|
|
public function getUrl($key = null) {
|
|
|
|
// Url complète
|
|
|
|
if($key === null) {
|
|
|
|
return $this->url;
|
|
|
|
}
|
|
|
|
// Une partie de l'url
|
|
|
|
else {
|
|
|
|
$url = explode('/', $this->url);
|
|
|
|
return array_key_exists($key, $url) ? $url[$key] : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accède à l'utilisateur connecté
|
|
|
|
* @param int $key Clé de la valeur
|
|
|
|
* @return string|null
|
|
|
|
*/
|
|
|
|
public function getUser($key) {
|
|
|
|
if(is_array($this->user) === false) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
elseif($key === 'id') {
|
|
|
|
return $this->getInput('ZWII_USER_ID');
|
|
|
|
}
|
|
|
|
elseif(array_key_exists($key, $this->user)) {
|
|
|
|
return $this->user[$key];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check qu'une valeur est transmise par la méthode _POST
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isPost() {
|
|
|
|
return ($this->checkCSRF() AND $this->input['_POST'] !== []);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-01-23 03:34:11 +01:00
|
|
|
* Enregistre les données dans deux fichiers séparés
|
2018-04-02 08:29:19 +02:00
|
|
|
*/
|
|
|
|
public function saveData() {
|
2018-12-23 23:37:17 +01:00
|
|
|
// Save config core page module et user
|
|
|
|
// 5 premières clés principales
|
2018-04-02 08:29:19 +02:00
|
|
|
// Trois tentatives
|
|
|
|
for($i = 0; $i < 3; $i++) {
|
2019-05-28 09:04:10 +02:00
|
|
|
if(file_put_contents(self::DATA_DIR.'core.json', json_encode(array_slice($this->getData(),0,5)) , LOCK_EX) !== false) {
|
2018-12-23 23:37:17 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Pause de 10 millisecondes
|
|
|
|
usleep(10000);
|
|
|
|
}
|
|
|
|
// Save theme
|
|
|
|
// dernière clé principale
|
|
|
|
// Trois tentatives
|
|
|
|
for($i = 0; $i < 3; $i++) {
|
2019-05-28 09:04:10 +02:00
|
|
|
if(file_put_contents(self::DATA_DIR.'theme.json', json_encode(array_slice($this->getData(),5)), LOCK_EX) !== false) {
|
2018-04-02 08:29:19 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Pause de 10 millisecondes
|
|
|
|
usleep(10000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-13 17:11:04 +01:00
|
|
|
/**
|
2019-05-02 13:21:48 +02:00
|
|
|
* Génére un fichier json avec la liste des pages
|
|
|
|
*
|
2019-07-04 19:54:51 +02:00
|
|
|
*/
|
|
|
|
public function pages2Json() {
|
|
|
|
// Sauve la liste des pages pour TinyMCE
|
2019-03-14 19:04:03 +01:00
|
|
|
$parents = [];
|
2019-07-04 19:54:51 +02:00
|
|
|
$rewrite = (helper::checkRewrite()) ? '' : '?';
|
|
|
|
// Boucle de recherche des pages actives
|
2019-03-14 19:04:03 +01:00
|
|
|
foreach($this->getHierarchy(null,false,false) as $parentId => $childIds) {
|
|
|
|
$children = [];
|
|
|
|
// Exclure les barres
|
|
|
|
if ($this->getData(['page', $parentId, 'block']) !== 'bar' ) {
|
2019-04-23 19:24:03 +02:00
|
|
|
// Boucler sur les enfants et récupérer le tableau children avec la liste des enfants
|
|
|
|
foreach($childIds as $childId) {
|
|
|
|
$children [] = [ 'title' => ' » '. $this->getData(['page', $childId, 'title']) ,
|
2019-03-14 19:04:03 +01:00
|
|
|
'value'=> $rewrite.$childId
|
2019-04-23 19:24:03 +02:00
|
|
|
];
|
2019-03-13 17:11:04 +01:00
|
|
|
}
|
2019-04-23 19:24:03 +02:00
|
|
|
// Traitement
|
|
|
|
if (empty($childIds)) {
|
|
|
|
// Pas d'enfant, uniuement l'entrée du parent
|
|
|
|
$parents [] = ['title' => $this->getData(['page', $parentId, 'title']) ,
|
|
|
|
'value'=> $rewrite.$parentId
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
// Des enfants, on ajoute la page parent en premier
|
|
|
|
array_unshift ($children , ['title' => $this->getData(['page', $parentId, 'title']) ,
|
|
|
|
'value'=> $rewrite.$parentId
|
|
|
|
]);
|
|
|
|
// puis on ajoute les enfants au parent
|
|
|
|
$parents [] = ['title' => $this->getData(['page', $parentId, 'title']) ,
|
|
|
|
'value'=> $rewrite.$parentId ,
|
|
|
|
'menu' => $children
|
|
|
|
];
|
|
|
|
}
|
2019-03-14 19:04:03 +01:00
|
|
|
}
|
|
|
|
}
|
2019-07-04 23:52:21 +02:00
|
|
|
// Sitemap et Search
|
|
|
|
$children = [];
|
|
|
|
$children [] = ['title'=>'Rechercher dans le site',
|
|
|
|
'value'=>$rewrite.'search'
|
|
|
|
];
|
|
|
|
$children [] = ['title'=>'Plan du site',
|
|
|
|
'value'=>$rewrite.'sitemap'
|
|
|
|
];
|
|
|
|
$parents [] = ['title' => 'Pages spéciales',
|
|
|
|
'value' => '#',
|
|
|
|
'menu' => $children
|
|
|
|
];
|
2019-03-14 19:04:03 +01:00
|
|
|
|
2019-07-04 23:52:21 +02:00
|
|
|
// Enregistrement : 3 tentatives
|
2019-03-14 19:04:03 +01:00
|
|
|
for($i = 0; $i < 3; $i++) {
|
|
|
|
if (file_put_contents ('core/vendor/tinymce/link_list.json', json_encode($parents), LOCK_EX) !== false) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Pause de 10 millisecondes
|
|
|
|
usleep(10000);
|
|
|
|
}
|
2019-03-13 17:11:04 +01:00
|
|
|
}
|
|
|
|
|
2019-05-02 13:21:48 +02:00
|
|
|
/**
|
|
|
|
* Génére un fichier robots.txt à l'installation
|
|
|
|
* Si le fichier exite déjà les commandes sont ajoutées
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function createRobots() {
|
|
|
|
|
|
|
|
$robotValue =
|
|
|
|
PHP_EOL .
|
|
|
|
'# ZWII CONFIG ---------' . PHP_EOL .
|
|
|
|
'User-agent: *' . PHP_EOL .
|
|
|
|
'Disallow: /core/' . PHP_EOL .
|
|
|
|
'Disallow: /module/' .PHP_EOL .
|
|
|
|
'Disallow: /site/data' .PHP_EOL .
|
|
|
|
'Disallow: /site/tmp' .PHP_EOL .
|
|
|
|
'Disallow: /site/backup' .PHP_EOL .
|
|
|
|
'Allow: /site/file/' .PHP_EOL .
|
2019-06-15 18:27:00 +02:00
|
|
|
'Sitemap: ' . helper::baseUrl(false) . 'sitemap.xml' . PHP_EOL .
|
|
|
|
'Sitemap: ' . helper::baseUrl(false) . 'sitemap.xml.gz' . PHP_EOL .
|
2019-05-02 13:21:48 +02:00
|
|
|
'# ZWII CONFIG ---------' . PHP_EOL ;
|
|
|
|
|
|
|
|
|
|
|
|
if (file_exists('robots.txt')) {
|
|
|
|
return(file_put_contents(
|
|
|
|
'robots.txt',
|
|
|
|
$robotValue,
|
|
|
|
FILE_APPEND
|
|
|
|
));
|
|
|
|
} else {
|
|
|
|
// Sinon on crée un fichier
|
|
|
|
return(file_put_contents(
|
|
|
|
'robots.txt',
|
|
|
|
$robotValue
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Génére un fichier un fchier sitemap.xml
|
|
|
|
* https://github.com/icamys/php-sitemap-generator
|
|
|
|
* $command valeurs possible
|
|
|
|
* all : génére un site map complet
|
|
|
|
* Sinon contient id de la page à créer
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function createSitemap($command = "all") {
|
|
|
|
|
|
|
|
require_once "core/vendor/sitemap/SitemapGenerator.php";
|
|
|
|
|
2019-06-13 14:01:43 +02:00
|
|
|
$timezone = $this->getData(['config','timezone']);
|
|
|
|
|
2019-05-02 13:21:48 +02:00
|
|
|
$sitemap = new \Icamys\SitemapGenerator\SitemapGenerator(helper::baseurl());
|
|
|
|
|
|
|
|
// will create also compressed (gzipped) sitemap
|
|
|
|
$sitemap->createGZipFile = true;
|
|
|
|
|
|
|
|
// determine how many urls should be put into one file
|
|
|
|
// according to standard protocol 50000 is maximum value (see http://www.sitemaps.org/protocol.html)
|
|
|
|
$sitemap->maxURLsPerSitemap = 50000;
|
|
|
|
|
|
|
|
// sitemap file name
|
|
|
|
$sitemap->sitemapFileName = "sitemap.xml";
|
|
|
|
|
|
|
|
$datetime = new DateTime(date('c'));
|
|
|
|
$datetime->format(DateTime::ATOM); // Updated ISO8601
|
|
|
|
// sitemap index file name
|
|
|
|
$sitemap->sitemapIndexFileName = "sitemap-index.xml";
|
2019-06-10 15:48:43 +02:00
|
|
|
foreach($this->getHierarchy(null, null, null) as $parentPageId => $childrenPageIds) {
|
2019-06-08 21:30:12 +02:00
|
|
|
// Exclure les barres et les pages non publiques et les pages masquées
|
2019-06-13 14:01:43 +02:00
|
|
|
if ($this->getData(['page',$parentPageId,'group']) !== 0 ||
|
|
|
|
$this->getData(['page', $parentPageId, 'block']) === 'bar' ) {
|
2019-05-07 18:36:05 +02:00
|
|
|
continue;
|
|
|
|
}
|
2019-06-18 16:25:39 +02:00
|
|
|
// Page désactivée, traiter les sous-pages sans prendre en compte la page parente.
|
|
|
|
if ($this->getData(['page', $parentPageId, 'disable']) !== true ) {
|
|
|
|
$sitemap->addUrl ($parentPageId,$datetime);
|
|
|
|
}
|
2019-06-09 15:24:43 +02:00
|
|
|
// Sous-pages
|
2019-05-02 13:21:48 +02:00
|
|
|
foreach($childrenPageIds as $childKey) {
|
2019-06-08 21:30:12 +02:00
|
|
|
if ($this->getData(['page',$childKey,'group']) !== 0 || $this->getData(['page', $childKey, 'disable']) === true) {
|
|
|
|
continue;
|
|
|
|
}
|
2019-05-02 13:21:48 +02:00
|
|
|
$sitemap->addUrl($childKey,$datetime);
|
2019-06-09 15:24:43 +02:00
|
|
|
|
|
|
|
// La sous-page est un blog
|
2019-06-20 20:26:08 +02:00
|
|
|
if ($this->getData(['page', $childKey, 'moduleId']) === 'blog' &&
|
|
|
|
!empty($this->getData(['module',$childKey])) ) {
|
2019-06-10 16:21:41 +02:00
|
|
|
foreach($this->getData(['module',$childKey]) as $articleId => $article) {
|
|
|
|
if($this->getData(['module',$childKey,$articleId,'state']) === true) {
|
2019-06-13 14:01:43 +02:00
|
|
|
$date = $this->getData(['module',$childKey,$articleId,'publishedOn']);
|
2019-06-16 17:54:41 +02:00
|
|
|
$sitemap->addUrl( $childKey . '/' . $articleId , new DateTime("@{$date}",new DateTimeZone($timezone)));
|
2019-06-10 16:21:41 +02:00
|
|
|
}
|
2019-06-09 18:36:57 +02:00
|
|
|
}
|
|
|
|
}
|
2019-06-09 15:24:43 +02:00
|
|
|
}
|
|
|
|
// Articles du blog
|
2019-06-20 20:26:08 +02:00
|
|
|
if ($this->getData(['page', $parentPageId, 'moduleId']) === 'blog' &&
|
|
|
|
!empty($this->getData(['module',$parentPageId])) ) {
|
2019-06-10 16:21:41 +02:00
|
|
|
foreach($this->getData(['module',$parentPageId]) as $articleId => $article) {
|
2019-06-13 14:01:43 +02:00
|
|
|
if($this->getData(['module',$parentPageId,$articleId,'state']) === true) {
|
|
|
|
$date = $this->getData(['module',$parentPageId,$articleId,'publishedOn']);
|
|
|
|
$sitemap->addUrl( $parentPageId . '/' . $articleId , new DateTime("@{$date}",new DateTimeZone($timezone)));
|
2019-06-10 16:21:41 +02:00
|
|
|
}
|
2019-06-09 15:24:43 +02:00
|
|
|
}
|
2019-05-02 13:21:48 +02:00
|
|
|
}
|
2019-06-13 14:01:43 +02:00
|
|
|
}
|
|
|
|
|
2019-05-02 13:21:48 +02:00
|
|
|
// generating internally a sitemap
|
|
|
|
$sitemap->createSitemap();
|
|
|
|
|
|
|
|
// writing early generated sitemap to file
|
|
|
|
$sitemap->writeSitemap();
|
|
|
|
|
|
|
|
return(file_exists('sitemap.xml'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-23 23:37:17 +01:00
|
|
|
|
2019-02-28 12:46:38 +01:00
|
|
|
/**
|
2018-04-02 08:29:19 +02:00
|
|
|
* Envoi un mail
|
|
|
|
* @param string|array $to Destinataire
|
|
|
|
* @param string $subject Sujet
|
|
|
|
* @param string $content Contenu
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function sendMail($to, $subject, $content) {
|
2019-02-28 12:46:38 +01:00
|
|
|
// Utilisation de PHPMailer version 6.0.6
|
|
|
|
require "core/vendor/phpmailer/phpmailer.php";
|
|
|
|
require "core/vendor/phpmailer/exception.php";
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
// Layout
|
|
|
|
ob_start();
|
|
|
|
include 'core/layout/mail.php';
|
|
|
|
$layout = ob_get_clean();
|
|
|
|
// Mail
|
2019-02-28 12:46:38 +01:00
|
|
|
try{
|
|
|
|
$mail = new PHPMailer\PHPMailer\PHPMailer;
|
|
|
|
$mail->CharSet = 'UTF-8';
|
|
|
|
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
|
|
|
$mail->setFrom('no-reply@' . $host, $this->getData(['config', 'title']));
|
|
|
|
$mail->addReplyTo('no-reply@' . $host, $this->getData(['config', 'title']));
|
|
|
|
if(is_array($to)) {
|
|
|
|
foreach($to as $userMail) {
|
2019-03-05 09:58:52 +01:00
|
|
|
$mail->addAddress($userMail);
|
2019-02-28 12:46:38 +01:00
|
|
|
}
|
2018-04-02 08:29:19 +02:00
|
|
|
}
|
2019-02-28 12:46:38 +01:00
|
|
|
else {
|
2019-03-05 09:38:09 +01:00
|
|
|
$mail->addAddress($to);
|
2019-02-28 12:46:38 +01:00
|
|
|
}
|
|
|
|
$mail->isHTML(true);
|
|
|
|
$mail->Subject = $subject;
|
|
|
|
$mail->Body = $layout;
|
|
|
|
$mail->AltBody = strip_tags($content);
|
|
|
|
if($mail->send()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return $mail->ErrorInfo;
|
|
|
|
}
|
|
|
|
} catch (phpmailerException $e) {
|
|
|
|
return $e->errorMessage();
|
|
|
|
} catch (Exception $e) {
|
|
|
|
return $e->getMessage();
|
2018-04-02 08:29:19 +02:00
|
|
|
}
|
2019-02-28 12:46:38 +01:00
|
|
|
}
|
2018-04-02 08:29:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert des données
|
|
|
|
* @param array $keys Clé(s) des données
|
|
|
|
*/
|
|
|
|
public function setData($keys) {
|
|
|
|
switch(count($keys)) {
|
|
|
|
case 1:
|
|
|
|
$this->data = $keys[0];
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$this->data[$keys[0]] = $keys[1];
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$this->data[$keys[0]][$keys[1]] = $keys[2];
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
$this->data[$keys[0]][$keys[1]][$keys[2]] = $keys[3];
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
$this->data[$keys[0]][$keys[1]][$keys[2]][$keys[3]] = $keys[4];
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
$this->data[$keys[0]][$keys[1]][$keys[2]][$keys[3]][$keys[4]] = $keys[5];
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
$this->data[$keys[0]][$keys[1]][$keys[2]][$keys[3]][$keys[4]][$keys[5]] = $keys[6];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mises à jour
|
|
|
|
*/
|
|
|
|
private function update() {
|
|
|
|
// Version 8.1.0
|
|
|
|
if($this->getData(['core', 'dataVersion']) < 810) {
|
|
|
|
$this->setData(['config', 'timezone', 'Europe/Paris']);
|
|
|
|
$this->setData(['core', 'dataVersion', 810]);
|
|
|
|
$this->saveData();
|
|
|
|
}
|
|
|
|
// Version 8.2.0
|
|
|
|
if($this->getData(['core', 'dataVersion']) < 820) {
|
|
|
|
$this->setData(['theme', 'body', 'backgroundColor', 'rgba(236, 239, 241, 1)']);
|
|
|
|
$this->setData(['theme', 'site', 'backgroundColor', 'rgba(255, 255, 255, 1)']);
|
2019-06-03 13:08:48 +02:00
|
|
|
$this->setData(['theme', 'text', 'fontSize', '13px']);
|
2018-04-02 08:29:19 +02:00
|
|
|
$this->setData(['theme', 'text', 'textColor', 'rgba(33, 34, 35, 1)']);
|
|
|
|
$this->setData(['theme', 'menu', 'fontSize', '1em']);
|
|
|
|
$this->setData(['theme', 'menu', 'textColor', 'rgba(255, 255, 255, 1)']);
|
|
|
|
$this->setData(['theme', 'header', 'fontSize', '2em']);
|
|
|
|
$this->setData(['theme', 'footer', 'textColor', 'rgba(33, 34, 35, 1)']);
|
|
|
|
$this->setData(['core', 'dataVersion', 820]);
|
|
|
|
$this->saveData();
|
|
|
|
}
|
|
|
|
// Version 8.2.2
|
|
|
|
if($this->getData(['core', 'dataVersion']) < 822) {
|
|
|
|
$this->setData(['config', 'maintenance', false]);
|
|
|
|
$this->setData(['core', 'dataVersion', 822]);
|
2018-11-14 20:18:29 +01:00
|
|
|
$this->saveData();
|
2018-04-02 08:29:19 +02:00
|
|
|
}
|
|
|
|
// Version 8.2.6
|
|
|
|
if($this->getData(['core', 'dataVersion']) < 826) {
|
2019-05-04 12:39:08 +02:00
|
|
|
$this->setData(['theme','header','linkHome',true]);
|
2018-11-14 20:18:29 +01:00
|
|
|
$this->setData(['core', 'dataVersion', 826]);
|
2018-04-02 08:29:19 +02:00
|
|
|
$this->SaveData();
|
|
|
|
}
|
2018-11-20 23:11:02 +01:00
|
|
|
// Version 8.3.1
|
|
|
|
if($this->getData(['core', 'dataVersion']) < 831) {
|
2018-09-09 11:47:24 +02:00
|
|
|
$this->setData(['theme','header','imageContainer','auto']);
|
2018-11-20 23:11:02 +01:00
|
|
|
$this->setData(['core', 'dataVersion', 831]);
|
2018-09-09 11:47:24 +02:00
|
|
|
$this->SaveData();
|
|
|
|
}
|
2019-01-24 21:25:12 +01:00
|
|
|
|
2018-11-13 13:27:37 +01:00
|
|
|
// Version 8.4.0
|
|
|
|
if($this->getData(['core', 'dataVersion']) < 840) {
|
2018-12-09 00:52:05 +01:00
|
|
|
$this->setData(['config','itemsperPage',10]);
|
2018-11-13 13:27:37 +01:00
|
|
|
$this->setData(['core', 'dataVersion', 840]);
|
2018-09-09 21:28:05 +02:00
|
|
|
$this->SaveData();
|
|
|
|
}
|
2018-11-15 11:32:59 +01:00
|
|
|
// Version 8.4.4
|
2019-03-23 08:07:46 +01:00
|
|
|
if($this->getData(['core', 'dataVersion']) < 844) {
|
2018-11-15 11:32:59 +01:00
|
|
|
$this->setData(['core', 'dataVersion', 844]);
|
|
|
|
$this->SaveData();
|
2018-12-09 00:52:05 +01:00
|
|
|
}
|
2018-11-19 18:06:03 +01:00
|
|
|
// Version 8.4.6
|
2019-03-23 08:07:46 +01:00
|
|
|
if($this->getData(['core', 'dataVersion']) < 846) {
|
2018-12-10 22:14:05 +01:00
|
|
|
$this->setData(['config','itemsperPage',10]);
|
2018-11-19 18:06:03 +01:00
|
|
|
$this->setData(['core', 'dataVersion', 846]);
|
|
|
|
$this->SaveData();
|
2018-11-15 11:32:59 +01:00
|
|
|
}
|
2018-12-09 00:52:05 +01:00
|
|
|
// Version 8.5.0
|
|
|
|
if($this->getData(['core', 'dataVersion']) < 850) {
|
2018-12-09 01:05:35 +01:00
|
|
|
$this->setData(['theme','menu','font','Open+Sans']);
|
2018-12-09 00:52:05 +01:00
|
|
|
$this->setData(['core', 'dataVersion', 850]);
|
|
|
|
$this->SaveData();
|
|
|
|
}
|
|