From 524bf2223af7c737dc99e2f657dfe87768940014 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 3 May 2021 16:32:36 +0200 Subject: [PATCH] Structure datadirectory dossier racine --- module/gallery/gallery.php | 22 ++++++++++---------- module/news/news.php | 24 +++++++++++----------- module/search/search.php | 24 +++++++++++----------- site/data/news/pages/accueil/theme.css | 1 + site/data/search/pages/recherche/theme.css | 1 + 5 files changed, 37 insertions(+), 35 deletions(-) create mode 100644 site/data/news/pages/accueil/theme.css create mode 100644 site/data/search/pages/recherche/theme.css diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 687bf911..ab4032bc 100755 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -21,7 +21,7 @@ class gallery extends common { const REALNAME = 'Galerie'; const DELETE = true; const UPDATE = '0.0'; - const DATADIRECTORY = self::DATA_DIR . 'gallery/pages/'; + const DATADIRECTORY = self::DATA_DIR . 'gallery/'; const SORT_ASC = 'SORT_ASC'; const SORT_DSC = 'SORT_DSC'; @@ -171,7 +171,7 @@ class gallery extends common { $this->deleteData(['theme','gallery']); $this->setData(['module', $this->getUrl(0), 'theme', $data]); // Nom de la feuille de style - $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css']); } // Nouvelle version $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.0']); @@ -186,7 +186,7 @@ class gallery extends common { */ private function init() { // Variable commune - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; + $fileCSS = self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' ; // Check la présence du thème if ( $this->getData(['module', $this->getUrl(0), 'theme']) === null ) { require_once('module/gallery/ressource/defaultdata.php'); @@ -195,10 +195,10 @@ class gallery extends common { $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); } // Check la présence de la feuille de style - if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { + if ( !file_exists(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css')) { // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { - mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); + if (!is_dir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . 'pages/' . $this->getUrl(0), 0777, true); } // Générer la feuille de CSS $content = file_get_contents('module/gallery/ressource/vartheme.css'); @@ -220,7 +220,7 @@ class gallery extends common { $content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendTextColor']),$content ); $content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendBgColor']),$content ); // Ecriture de la feuille de style - file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $content . $themeCss); + file_put_contents(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' , $content . $themeCss); // Nom de la feuille de style $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); } @@ -728,8 +728,8 @@ class gallery extends common { // Soumission du formulaire if($this->isPost()) { // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { - mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); + if (!is_dir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . 'pages/' . $this->getUrl(0), 0777, true); } $this->setData(['module', $this->getUrl(0), 'theme', [ 'thumbAlign' => $this->getinput('galleryThemeThumbAlign', helper::FILTER_STRING_SHORT), @@ -746,7 +746,7 @@ class gallery extends common { 'legendAlign' => $this->getinput('galleryThemeLegendAlign', helper::FILTER_STRING_SHORT), 'legendTextColor' => $this->getinput('galleryThemeLegendTextColor', helper::FILTER_STRING_SHORT), 'legendBgColor' => $this->getinput('galleryThemeLegendBgColor', helper::FILTER_STRING_SHORT), - 'style' => self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' + 'style' => self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' ]]); // Création des fichiers CSS $content = file_get_contents('module/gallery/ressource/vartheme.css'); @@ -766,7 +766,7 @@ class gallery extends common { $content = str_replace('#legendHeight#',$this->getinput('galleryThemeLegendHeight'),$content ); $content = str_replace('#legendTextColor#',$this->getinput('galleryThemeLegendTextColor'),$content ); $content = str_replace('#legendBgColor#',$this->getinput('galleryThemeLegendBgColor'),$content ); - $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $content . $themeCss); + $success = file_put_contents(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css', $content . $themeCss); // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl() . '/theme', diff --git a/module/news/news.php b/module/news/news.php index 3eb8ffb9..cc8d3189 100755 --- a/module/news/news.php +++ b/module/news/news.php @@ -19,7 +19,7 @@ class news extends common { const REALNAME = 'Actualités'; const DELETE = true; const UPDATE = '0.0'; - const DATADIRECTORY = self::DATA_DIR . 'news/pages/'; + const DATADIRECTORY = self::DATA_DIR . 'news/'; public static $actions = [ 'add' => self::GROUP_MODERATOR, @@ -188,16 +188,16 @@ class news extends common { $style .= ' background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;}'; // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) { - mkdir (self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', 0777, true); + if (!is_dir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0))) { + mkdir (self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css', 0777, true); } - $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $style ); + $success = file_put_contents(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css', $style ); // Fin feuille de style $this->setData(['module', $this->getUrl(0), 'theme',[ - 'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '', + 'style' => $success ? self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' : '', 'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT), 'itemsBlur' => $this->getInput('newsConfigItemsBlur',helper::FILTER_STRING_SHORT) ]]); @@ -458,7 +458,7 @@ class news extends common { */ private function init() { - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css'; + $fileCSS = self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css'; // Données du module if ($this->getData(['module', $this->getUrl(0) ]) === null) { @@ -466,24 +466,24 @@ class news extends common { $this->setData(['module', $this->getUrl(0), 'config', init::$defaultData]); // Données de thème $this->setData(['module', $this->getUrl(0), 'theme', init::$defaultTheme]); - $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ]); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' ]); } // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { - mkdir (self::DATADIRECTORY . $this->getUrl(0) , 0777, true); + if (!is_dir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . 'pages/' . $this->getUrl(0) , 0777, true); } // Check la présence de la feuille de style - if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { + if ( !file_exists(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css')) { // Générer la feuille de CSS $style = '.newsContent {height: ' . $this->getData([ 'module', $this->getUrl(0), 'theme', 'itemsHeight' ]) .';}'; $style .= '.newsBlur {background: linear-gradient(#333 ' . $this->getData([ 'module', $this->getUrl(0), 'theme', 'itemsBlur' ]) . ',#FFF );'; $style .= ' background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;}'; // Sauver la feuille de style - file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $style ); + file_put_contents(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' , $style ); // Stocker le nom de la feuille de style - $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css']); } } } diff --git a/module/search/search.php b/module/search/search.php index 69b5c1d5..0fcf2b29 100755 --- a/module/search/search.php +++ b/module/search/search.php @@ -23,7 +23,7 @@ class search extends common { const REALNAME = 'Recherche'; const DELETE = true; const UPDATE = '0.0'; - const DATADIRECTORY = self::DATA_DIR . 'search/pages/'; + const DATADIRECTORY = self::DATA_DIR . 'search/'; public static $actions = [ 'index' => self::GROUP_VISITOR, @@ -56,7 +56,7 @@ class search extends common { if ($this->getData(['module', $this->getUrl(0), 'previewLength']) ) { $data = $this->getData(['module', $this->getUrl(0)]); // Feuille de style - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; + $fileCSS = self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' ; $this->setData(['module', $this->getUrl(0), 'config', [ 'submitText' => $this->getData(['module', $this->getUrl(0), 'submitText']), 'placeHolder' => $this->getData(['module', $this->getUrl(0), 'placeHolder']), @@ -70,8 +70,8 @@ class search extends common { ]]); // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { - mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); + if (!is_dir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . 'pages/' . $this->getUrl(0), 0777, true); } // Générer la feuille de CSS $style = '.keywordColor {background: ' . $this->getData(['module', $this->getUrl(0), 'theme', 'keywordColor']) . ';}'; @@ -94,7 +94,7 @@ class search extends common { private function init(){ - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; + $fileCSS = self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' ; if ($this->getData(['module', $this->getUrl(0)]) === null) { // Données du module @@ -102,20 +102,20 @@ class search extends common { $this->setData(['module', $this->getUrl(0), 'config',init::$defaultConfig ]); // Données de thème $this->setData(['module', $this->getUrl(0), 'theme',init::$defaultTheme ]); - $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ]); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' ]); } // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) { - mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); + if (!is_dir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0))) { + mkdir (self::DATADIRECTORY . 'pages/' . $this->getUrl(0), 0777, true); } // Check la présence de la feuille de style - if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { + if ( !file_exists(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css')) { // Générer la feuille de CSS $style = '.keywordColor {background: ' . $this->getData([ 'module', $this->getUrl(0), 'theme', 'keywordColor' ]) . ';}'; // Sauver la feuille de style - file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $style ); + file_put_contents(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css', $style ); // Stocker le nom de la feuille de style $this->setData(['module', $this->getUrl(0) , 'theme', 'style', $fileCSS]); } @@ -137,7 +137,7 @@ class search extends common { // Générer la feuille de CSS $style = '.keywordColor {background:' . $this->getInput('searchKeywordColor') . ';}'; - $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $style ); + $success = file_put_contents(self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' , $style ); // Fin feuille de style // Soumission du formulaire @@ -150,7 +150,7 @@ class search extends common { ]]); $this->setData(['module', $this->getUrl(0), 'theme',[ 'keywordColor' => $this->getInput('searchKeywordColor'), - 'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '', + 'style' => $success ? self::DATADIRECTORY . 'pages/' . $this->getUrl(0) . '/theme.css' : '', ]]); diff --git a/site/data/news/pages/accueil/theme.css b/site/data/news/pages/accueil/theme.css new file mode 100644 index 00000000..bb8e5fb5 --- /dev/null +++ b/site/data/news/pages/accueil/theme.css @@ -0,0 +1 @@ +.newsContent {height:200px;}.newsBlur {background: linear-gradient(#333 90%,rgba(255,255,255,0) ); background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;} \ No newline at end of file diff --git a/site/data/search/pages/recherche/theme.css b/site/data/search/pages/recherche/theme.css new file mode 100644 index 00000000..06f458a6 --- /dev/null +++ b/site/data/search/pages/recherche/theme.css @@ -0,0 +1 @@ +.keywordColor {background:rgba(1, 41, 229, 1);} \ No newline at end of file