Structure datadirectory dossier racine

This commit is contained in:
fredtempez 2021-05-03 16:32:36 +02:00
parent 01da51ac9b
commit 524bf2223a
5 changed files with 37 additions and 35 deletions

View File

@ -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',

View File

@ -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']);
}
}
}

View File

@ -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' : '',
]]);

View File

@ -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;}

View File

@ -0,0 +1 @@
.keywordColor {background:rgba(1, 41, 229, 1);}