From 06960464461611928dbfc9b29405edccc2ca9357 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 27 May 2019 19:45:00 +0200 Subject: [PATCH 1/3] [9.1.08] petite modification --- core/module/page/view/edit/edit.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index 26a910c3..33050056 100755 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -1,8 +1,8 @@ pages2Json(); -?> - +// Début du formulaire +echo template::formOpen('pageEditForm'); ?>
getUrl(2); ?> @@ -177,7 +177,7 @@ $this->pages2Json();
-

Options d'emplacement avancées

+

Options d'emplacement avancées

Date: Mon, 27 May 2019 20:35:04 +0200 Subject: [PATCH 2/3] [9.1.08] Placer des constantes pour les dossiers dir file tmp et backup --- core/layout/blank.php | 4 +-- core/layout/light.php | 4 +-- core/layout/main.php | 4 +-- core/module/config/config.php | 12 +++---- core/module/config/view/index/index.php | 2 +- core/module/install/install.php | 30 ++++++++-------- core/module/install/ressource/defaultdata.php | 4 +-- core/module/theme/theme.php | 34 +++++++++---------- core/module/theme/view/advanced/advanced.php | 2 +- core/module/theme/view/body/body.php | 2 +- core/module/theme/view/header/header.php | 2 +- module/blog/view/article/article.php | 4 +-- module/blog/view/index/index.php | 2 +- module/form/form.php | 6 ++-- module/gallery/gallery.php | 2 +- 15 files changed, 57 insertions(+), 57 deletions(-) diff --git a/core/layout/blank.php b/core/layout/blank.php index 5cda91ce..60544b37 100755 --- a/core/layout/blank.php +++ b/core/layout/blank.php @@ -12,8 +12,8 @@ showVendor(); ?> - - + + showStyle(); ?> showContent(); ?> diff --git a/core/layout/light.php b/core/layout/light.php index ad4776f8..5dde1966 100755 --- a/core/layout/light.php +++ b/core/layout/light.php @@ -12,8 +12,8 @@ showVendor(); ?> - - + + showStyle(); ?> diff --git a/core/layout/main.php b/core/layout/main.php index 4d9d7a8f..2ac89899 100755 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -12,8 +12,8 @@ showVendor(); ?> showAnalytics(); ?> - - + + showStyle(); ?> diff --git a/core/module/config/config.php b/core/module/config/config.php index 17608d03..a976c4ec 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -203,7 +203,7 @@ class config extends common { // Creation du ZIP $fileName = date('Y-m-d-h-i-s', time()) . '.zip'; $zip = new ZipArchive(); - if($zip->open('site/tmp/' . $fileName, ZipArchive::CREATE) === TRUE){ + if($zip->open(self::TEMP_DIR . $fileName, ZipArchive::CREATE) === TRUE){ foreach(configHelper::scanDir('site/') as $file) { $zip->addFile($file); } @@ -212,13 +212,13 @@ class config extends common { // Téléchargement du ZIP header('Content-Transfer-Encoding: binary'); header('Content-Disposition: attachment; filename="' . $fileName . '"'); - header('Content-Length: ' . filesize('site/tmp/' . $fileName)); - readfile('site/tmp/' . $fileName); + header('Content-Length: ' . filesize(self::TEMP_DIR . $fileName)); + readfile(self::TEMP_DIR . $fileName); // Valeurs en sortie $this->addOutput([ 'display' => self::DISPLAY_RAW ]); - unlink('site/tmp/' . $fileName); + unlink(self::TEMP_DIR . $fileName); } /** @@ -237,7 +237,7 @@ class config extends common { $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( 'site/file/source/screenshot.png',$data); + file_put_contents( self::FILE_DIR.'source/screenshot.png',$data); // Valeurs en sortie $this->addOutput([ @@ -323,7 +323,7 @@ class config extends common { ]); } // Initialisation du screen - if (!file_exists('site/file/source/screenshot.png')) { + if (!file_exists(self::FILE_DIR.'source/screenshot.png')) { $this->configMetaImage(); } // Valeurs en sortie diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index c2099a89..a15b4f19 100755 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -63,7 +63,7 @@

Copie d'écran OpenGraph

- ' /> + ' />
diff --git a/core/module/install/install.php b/core/module/install/install.php index c4933652..1199e5f6 100755 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -62,9 +62,9 @@ class install extends common { // Ajouter ici la liste des pages privées qui ne sont pas vues lors de l'installation. $this->deleteData(['page', 'privee']); // Effacer les fichiers par défaut - if (is_dir('site/file/source/galerie')) { - $this->removeAll('site/file/source/galerie'); - $this->removeAll('site/file/thumb/galerie'); + if (is_dir(self::FILE_DIR.'source/galerie')) { + $this->removeAll(self::FILE_DIR.'source/galerie'); + $this->removeAll(self::FILE_DIR.'thumb/galerie'); } } else { $this->setData(['module', 'blog', 'mon-premier-article', 'userId', $userId]); @@ -123,14 +123,14 @@ class install extends common { case 1: $success = true; // Copie du fichier de données - copy('site/data/core.json', 'site/backup/' . date('Y-m-d', time()) . '-core-update.json'); - copy('site/data/theme.json', 'site/backup/' . date('Y-m-d', time()) . '-theme-update.json'); + copy(self::DATA_DIR.'core.json', self::BACKUP_DIR . date('Y-m-d', time()) . '-core-update.json'); + copy(self::DATA_DIR.'theme.json', self::BACKUP_DIR . date('Y-m-d', time()) . '-theme-update.json'); // Nettoyage des fichiers temporaires - if(file_exists('site/tmp/update.tar.gz')) { - $success = unlink('site/tmp/update.tar.gz'); + if(file_exists(self::TEMP_DIR.'update.tar.gz')) { + $success = unlink(self::TEMP_DIR.'update.tar.gz'); } - if(file_exists('site/tmp/update.tar')) { - $success = unlink('site/tmp/update.tar'); + if(file_exists(self::TEMP_DIR.'update.tar')) { + $success = unlink(self::TEMP_DIR.'update.tar'); } // Valeurs en sortie $this->addOutput([ @@ -144,7 +144,7 @@ class install extends common { // Téléchargement case 2: // Téléchargement depuis le serveur de Zwii - $success = (file_put_contents('site/tmp/update.tar.gz', file_get_contents('https://zwiicms.com/update/update.tar.gz')) !== false); + $success = (file_put_contents(self::TEMP_DIR.'update.tar.gz', file_get_contents('https://zwiicms.com/update/update.tar.gz')) !== false); // Valeurs en sortie $this->addOutput([ 'display' => self::DISPLAY_JSON, @@ -162,7 +162,7 @@ class install extends common { // Décompression et installation try { // Décompression dans le dossier de fichier temporaires - $pharData = new PharData('site/tmp/update.tar.gz'); + $pharData = new PharData(self::TEMP_DIR.'update.tar.gz'); $pharData->decompress(); // Installation $pharData->extractTo(__DIR__ . '/../../../', null, true); @@ -170,11 +170,11 @@ class install extends common { $success = $e->getMessage(); } // Netooyage du dossier - if(file_exists('site/tmp/update.tar.gz')) { - unlink('site/tmp/update.tar.gz'); + if(file_exists(self::TEMP_DIR.'update.tar.gz')) { + unlink(self::TEMP_DIR.'update.tar.gz'); } - if(file_exists('site/tmp/update.tar')) { - unlink('site/tmp/update.tar'); + if(file_exists(self::TEMP_DIR.'update.tar')) { + unlink(self::TEMP_DIR.'update.tar'); } // Valeurs en sortie $this->addOutput([ diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index aa1c5ac0..c93fb094 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -356,7 +356,7 @@ class install extends common { 'beaux-paysages' => [ 'config' => [ 'name' => 'Beaux paysages', - 'directory' => 'site/file/source/galerie/landscape' + 'directory' => self::FILE_DIR.'source/galerie/landscape' ], 'legend' => [ 'desert.jpg' => 'Un désert', @@ -367,7 +367,7 @@ class install extends common { 'espace' => [ 'config' => [ 'name' => 'Espace', - 'directory' => 'site/file/source/galerie/space' + 'directory' => self::FILE_DIR.'source/galerie/space' ], 'legend' => [ 'earth.jpg' => 'La Terre et la Lune', diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index d68f689b..9d524052 100755 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -216,7 +216,7 @@ class theme extends common { // Soumission du formulaire if($this->isPost()) { // Enregistre le CSS - file_put_contents('site/data/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', @@ -432,7 +432,7 @@ class theme extends common { */ public function reset() { // Supprime le fichier de personnalisation avancée - unlink('site/data/custom.css'); + unlink(self::DATA_DIR.'custom.css'); // Valeurs en sortie $this->addOutput([ 'notification' => 'Personnalisation avancée réinitialisée', @@ -492,7 +492,7 @@ class theme extends common { $zipFilename = $this->getInput('themeManageImport', helper::FILTER_STRING_SHORT, true); $zip = new ZipArchive(); - if ($zip->open('site/file/source/'.$zipFilename) === TRUE) { + if ($zip->open(self::FILE_DIR.'source/'.$zipFilename) === TRUE) { $zip->extractTo('.'); $zip->close(); // Valeurs en sortie @@ -527,10 +527,10 @@ class theme extends common { header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: binary'); header('Content-Disposition: attachment; filename="' . $zipFilename . '"'); - header('Content-Length: ' . filesize('site/tmp/' . $zipFilename)); - readfile('site/tmp/' . $zipFilename); + header('Content-Length: ' . filesize(self::TEMP_DIR . $zipFilename)); + readfile(self::TEMP_DIR . $zipFilename); // Nettoyage du dossier - unlink ('site/tmp/' . $zipFilename); + unlink (self::TEMP_DIR . $zipFilename); die(); } @@ -541,10 +541,10 @@ class theme extends common { // Make zip $zipFilename = $this->makezip(); // Téléchargement du ZIP - mkdir('site/file/source/theme'); - copy ('site/tmp/' . $zipFilename , 'site/file/source/theme/' . $zipFilename); + mkdir(self::FILE_DIR.'source/theme'); + copy (self::TEMP_DIR . $zipFilename , self::FILE_DIR.'source/theme/' . $zipFilename); // Nettoyage du dossier - unlink ('site/tmp/' . $zipFilename); + unlink (self::TEMP_DIR . $zipFilename); // Valeurs en sortie $this->addOutput([ 'notification' => 'Archive '.$zipFilename.' sauvegardée dans fichiers', @@ -561,18 +561,18 @@ class theme extends common { // $zipFilename = 'theme-'.date('dmY').'-'.date('hm').'-'.rand(10,99).'.zip'; $zipFilename = 'theme '.date('d m Y').' '.date('H i s ').'.zip'; $zip = new ZipArchive(); - if ($zip->open('site/tmp/' . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) === TRUE) { - $zip->addFile('site/data/theme.json','site/data/theme.json'); - $zip->addFile('site/data/theme.json','site/data/theme.css'); - $zip->addFile('site/data/theme.json','site/data/custom.css'); + if ($zip->open(self::TEMP_DIR . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) === TRUE) { + $zip->addFile(self::DATA_DIR.'theme.json',self::DATA_DIR.'theme.json'); + $zip->addFile(self::DATA_DIR.'theme.json',self::DATA_DIR.'theme.css'); + $zip->addFile(self::DATA_DIR.'theme.json',self::DATA_DIR.'custom.css'); if ($this->getData(['theme','body','image']) !== '' ) { - $zip->addFile('site/file/source/'.$this->getData(['theme','body','image']), - 'site/file/source/'.$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','header','image']) !== '' ) { - $zip->addFile('site/file/source/'.$this->getData(['theme','header','image']), - 'site/file/source/'.$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']) ); } $ret = $zip->close(); diff --git a/core/module/theme/view/advanced/advanced.php b/core/module/theme/view/advanced/advanced.php index bec93378..613164cb 100755 --- a/core/module/theme/view/advanced/advanced.php +++ b/core/module/theme/view/advanced/advanced.php @@ -23,7 +23,7 @@
file_get_contents('site/data/custom.css'), + 'value' => file_get_contents(self::DATA_DIR.'custom.css'), 'class' => 'editorCss' ]); ?>
diff --git a/core/module/theme/view/body/body.php b/core/module/theme/view/body/body.php index 16695055..47ada5e1 100755 --- a/core/module/theme/view/body/body.php +++ b/core/module/theme/view/body/body.php @@ -28,7 +28,7 @@

Image

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', [ 'label' => 'Fond', 'type' => 1, diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 1ae91233..2c6ecd6b 100755 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -40,7 +40,7 @@

Image

getData(['theme', 'header', 'image'])) ? $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' => 'Fond', 'type' => 1, diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index cd4f7344..c6f03501 100644 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -5,8 +5,8 @@
getData(['module', $this->getUrl(0), $this->getUrl(1), 'hidePicture']) == false) { - // echo '
'; - echo '
'; + // echo '
'; + echo '
'; } ?> getData(['module', $this->getUrl(0), $this->getUrl(1), 'content']); ?> diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index b8b55e03..9670adb2 100644 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -5,7 +5,7 @@
diff --git a/module/form/form.php b/module/form/form.php index 659aec56..8713116d 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -178,10 +178,10 @@ class form extends common { $data = $this->getData(['module', $this->getUrl(0), 'data']); if ($data !== []) { $csvfilename = 'data-'.date('dmY').'-'.date('hm').'-'.rand(10,99).'.csv'; - if (!file_exists('site/file/source/data')) { - mkdir('site/file/source/data'); + if (!file_exists(self::FILE_DIR.'source/data')) { + mkdir(self::FILE_DIR.'source/data'); } - $fp = fopen('site/file/source/data/'.$csvfilename, 'w'); + $fp = fopen(self::FILE_DIR.'source/data/'.$csvfilename, 'w'); fputcsv($fp, array_keys($data[1]), ';','"'); foreach ($data as $fields) { fputcsv($fp, $fields, ';','"'); diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index e5956541..c36c5844 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -130,7 +130,7 @@ class gallery extends common { // Valeurs en sortie $this->addOutput([ 'display' => self::DISPLAY_JSON, - 'content' => galleriesHelper::scanDir('site/file/source') + 'content' => galleriesHelper::scanDir(self::FILE_DIR.'source') ]); } From f3865f5a5038ac9823264edd860af321d8d4ccc9 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Tue, 28 May 2019 09:04:10 +0200 Subject: [PATCH 3/3] [9.1.08] le core manquant --- core/core.php | 81 +++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/core/core.php b/core/core.php index 544986a7..2dc816a0 100644 --- a/core/core.php +++ b/core/core.php @@ -26,6 +26,10 @@ class common { const GROUP_MEMBER = 1; const GROUP_MODERATOR = 2; const GROUP_ADMIN = 3; + const BACKUP_DIR = 'site/backup/'; + const DATA_DIR = 'site/data/'; + const FILE_DIR = 'site/file/'; + const TEMP_DIR = 'site/tmp/'; // Numéro de version const ZWII_VERSION = '9.1.08'; @@ -130,13 +134,13 @@ class common { $this->importData(); // 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 - if(file_exists('site/data/core.json') === false OR - file_exists('site/data/theme.json') === false) { + if(file_exists(self::DATA_DIR.'core.json') === false OR + file_exists(self::DATA_DIR.'theme.json') === false) { include_once('core/module/install/ressource/defaultdata.php'); $this->setData([install::$defaultData]); $this->saveData(); - chmod('site/data/core.json', 0755); - chmod('site/data/theme.json', 0755); + chmod(self::DATA_DIR.'core.json', 0755); + chmod(self::DATA_DIR.'theme.json', 0755); } // Import des données d'un fichier data.json déjà présent @@ -223,7 +227,7 @@ class common { public function readData() { // Trois tentatives for($i = 0; $i < 3; $i++) { - $this->setData([json_decode(file_get_contents('site/data/core.json'), true) + json_decode(file_get_contents('site/data/theme.json'), true)]); + $this->setData([json_decode(file_get_contents(self::DATA_DIR.'core.json'), true) + json_decode(file_get_contents(self::DATA_DIR.'theme.json'), true)]); if($this->data) { break; } @@ -240,26 +244,26 @@ class common { * Converti un fichier de données data.json puis le renomme */ public function importData() { - if(file_exists('site/data/data.json')) { + if(file_exists(self::DATA_DIR.'data.json')) { // Trois tentatives for($i = 0; $i < 3; $i++) { - $tempData = [json_decode(file_get_contents('site/data/data.json'), true)]; + $tempData = [json_decode(file_get_contents(self::DATA_DIR.'data.json'), true)]; if($tempData) { for($i = 0; $i < 3; $i++) { - if(file_put_contents('site/data/core.json', json_encode(array_slice($tempData[0],0,5)), LOCK_EX) !== false) { + if(file_put_contents(self::DATA_DIR.'core.json', json_encode(array_slice($tempData[0],0,5)), LOCK_EX) !== false) { break; } // Pause de 10 millisecondes usleep(10000); } for($i = 0; $i < 3; $i++) { - if(file_put_contents('site/data/theme.json', json_encode(array_slice($tempData[0],5)), LOCK_EX) !== false) { + if(file_put_contents(self::DATA_DIR.'theme.json', json_encode(array_slice($tempData[0],5)), LOCK_EX) !== false) { break; } // Pause de 10 millisecondes usleep(10000); } - rename ('site/data/data.json','site/data/imported_data.json'); + rename (self::DATA_DIR.'data.json',self::DATA_DIR.'imported_data.json'); break; } elseif($i === 2) { @@ -342,7 +346,7 @@ class common { * En local, copie du site décran de ZwiiCMS */ public function makeImageTag () { - if (!file_exists('site/file/source/screenshot.png')) + if (!file_exists(self::FILE_DIR.'source/screenshot.png')) { if ( strpos(helper::baseUrl(false),'localhost') == 0 AND strpos(helper::baseUrl(false),'127.0.0.1') == 0) { $googlePagespeedData = file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. helper::baseUrl(false) .'&screenshot=true'); @@ -351,7 +355,7 @@ class common { $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( 'site/file/source/screenshot.png',$data); + file_put_contents( self::FILE_DIR.'source/screenshot.png',$data); } } } @@ -521,7 +525,7 @@ class common { // 5 premières clés principales // Trois tentatives for($i = 0; $i < 3; $i++) { - if(file_put_contents('site/data/core.json', json_encode(array_slice($this->getData(),0,5)) , LOCK_EX) !== false) { + if(file_put_contents(self::DATA_DIR.'core.json', json_encode(array_slice($this->getData(),0,5)) , LOCK_EX) !== false) { break; } // Pause de 10 millisecondes @@ -531,7 +535,7 @@ class common { // dernière clé principale // Trois tentatives for($i = 0; $i < 3; $i++) { - if(file_put_contents('site/data/theme.json', json_encode(array_slice($this->getData(),5)), LOCK_EX) !== false) { + if(file_put_contents(self::DATA_DIR.'theme.json', json_encode(array_slice($this->getData(),5)), LOCK_EX) !== false) { break; } // Pause de 10 millisecondes @@ -904,7 +908,7 @@ class core extends common { // Supprime les fichiers temporaires $lastClearTmp = mktime(0, 0, 0); if($lastClearTmp > $this->getData(['core', 'lastClearTmp']) + 86400) { - $iterator = new DirectoryIterator('site/tmp/'); + $iterator = new DirectoryIterator(self::TEMP_DIR); foreach($iterator as $fileInfos) { if($fileInfos->isFile() AND $fileInfos->getBasename() !== '.gitkeep') { @unlink($fileInfos->getPathname()); @@ -923,13 +927,13 @@ class core extends common { AND $this->getData(['user']) // Pas de backup pendant l'installation ) { // Copie du fichier de données - copy('site/data/core.json', 'site/backup/' . date('Y-m-d', $lastBackup) . '.json'); + copy(self::DATA_DIR.'core.json', self::BACKUP_DIR . date('Y-m-d', $lastBackup) . '.json'); // Date du dernier backup $this->setData(['core', 'lastBackup', $lastBackup]); // Enregistre les données $this->saveData(); // Supprime les backups de plus de 30 jours - $iterator = new DirectoryIterator('site/backup/'); + $iterator = new DirectoryIterator(self::BACKUP_DIR); foreach($iterator as $fileInfos) { if( $fileInfos->isFile() @@ -941,17 +945,17 @@ class core extends common { } } // Crée le fichier de personnalisation avancée - if(file_exists('site/data/custom.css') === false) { - file_put_contents('site/data/custom.css', file_get_contents('core/module/theme/resource/custom.css')); - chmod('site/data/custom.css', 0755); + if(file_exists(self::DATA_DIR.'custom.css') === false) { + file_put_contents(self::DATA_DIR.'custom.css', file_get_contents('core/module/theme/resource/custom.css')); + chmod(self::DATA_DIR.'custom.css', 0755); } // Crée le fichier de personnalisation - if(file_exists('site/data/theme.css') === false) { - file_put_contents('site/data/theme.css', ''); - chmod('site/data/theme.css', 0755); + if(file_exists(self::DATA_DIR.'theme.css') === false) { + file_put_contents(self::DATA_DIR.'theme.css', ''); + chmod(self::DATA_DIR.'theme.css', 0755); } // Check la version - $cssVersion = preg_split('/\*+/', file_get_contents('site/data/theme.css')); + $cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR.'theme.css')); if(empty($cssVersion[1]) OR $cssVersion[1] !== md5(json_encode($this->getData(['theme'])))) { // Version $css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/'; @@ -999,11 +1003,11 @@ class core extends common { if ($this->getData(['theme', 'header', 'height']) === 'none') { // Controle de l'existence du fichier - if (file_exists('site/file/source/' . $this->getData(['theme','header','image'])) && + if (file_exists(self::FILE_DIR.'source/' . $this->getData(['theme','header','image'])) && $this->getData(['theme', 'header', 'image']) ) { // On établie la hauteur du div en proportion de l'image // (hauteur / largeur) . 100 - $sizes = getimagesize('site/file/source/'.$this->getData(['theme','header','image'])); + $sizes = getimagesize(self::FILE_DIR.'source/'.$this->getData(['theme','header','image'])); $css .= ';height: 0; padding-top:'; $css .= ( $sizes[1] / $sizes[0] )* 100; $css .= '%'; @@ -1051,7 +1055,7 @@ class core extends common { $css .= '#footerText{text-align:' . $this->getData(['theme', 'footer', 'textAlign']) . '}'; $css .= '#footerCopyright{text-align:' . $this->getData(['theme', 'footer', 'copyrightAlign']) . '}'; // Enregistre la personnalisation - file_put_contents('site/data/theme.css', $css); + file_put_contents(self::DATA_DIR.'theme.css', $css); } } /** @@ -1930,9 +1934,9 @@ class layout extends common { public function showFavicon() { $favicon = $this->getData(['config', 'favicon']); if($favicon && - file_exists('site/file/source/' . $favicon) + file_exists(self::FILE_DIR.'source/' . $favicon) ) { - echo ''; + echo ''; } else { echo ''; } @@ -1982,14 +1986,14 @@ class layout extends common { break; case 'icon' : if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; + $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; } else { $items .= $this->getData(['page', $parentPageId, 'title']); } break; case 'icontitle' : if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $items .= ''.$this->getData(['page', $parentPageId, 'title']).'getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" data-tippy-content="'; $items .= $this->getData(['page', $parentPageId, 'title']).'"/>'; } else { $items .= $this->getData(['page', $parentPageId, 'title']); @@ -2042,14 +2046,14 @@ class layout extends common { break; case 'icon' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; + $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; } else { $items .= $this->getData(['page', $parentPageId, 'title']); } break; case 'icontitle' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $items .= ''.$this->getData(['page', $parentPageId, 'title']).'getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" data-tippy-content="'; $items .= $this->getData(['page', $childKey, 'title']).'"/>'; } else { $items .= $this->getData(['page', $childKey, 'title']); @@ -2057,7 +2061,7 @@ class layout extends common { break; case 'icontext' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; + $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; $items .= $this->getData(['page', $childKey, 'title']); } else { $items .= $this->getData(['page', $childKey, 'title']); @@ -2220,7 +2224,7 @@ class layout extends common { * Affiche la meta image (site screenshot) */ public function showMetaImage() { - echo ''; + echo ''; } @@ -2320,7 +2324,7 @@ class layout extends common { $rightItems = ''; if($this->getUser('group') >= self::GROUP_MODERATOR) { - $rightItems .= '
  • ' . template::ico('folder') . '
  • '; + $rightItems .= '
  • ' . template::ico('folder') . '
  • '; } if($this->getUser('group') >= self::GROUP_ADMIN) { $rightItems .= '
  • ' . template::ico('users') . '
  • '; @@ -2412,7 +2416,7 @@ class layout extends common { $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') AND $this->getUser('group') >= self::GROUP_MODERATOR ) { - $vars .= 'var privateKey = ' . json_encode(md5_file('site/data/core.json')) . ';'; + $vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR.'core.json')) . ';'; } echo ''; // Librairies @@ -2700,7 +2704,8 @@ class template { '?relative_url=1' . '&field_id=' . $attributes['id'] . '&type=' . $attributes['type'] . - '&akey=' . md5_file('site/data/core.json') . + //'&akey=' . md5_file('site/data/'.'core.json') . + '&akey=' . md5_file(core::DATA_DIR.'core.json') . ($attributes['extensions'] ? '&extensions=' . $attributes['extensions'] : '') . '" class="inputFile %s %s"