summaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2022-02-18 05:38:40 +0100
committerpolo <ordipolo@gmx.fr>2022-02-18 05:38:40 +0100
commit9a1fb624fd1089087bd363551ba64f5862d9919f (patch)
tree87f33f1b1bede404efa2cfd8f4285d32e149d986 /controller
parentf2c1f219dcd6e25b812d4dbed46f4c0c30541d83 (diff)
downloadmelaine-9a1fb624fd1089087bd363551ba64f5862d9919f.zip
miniatures GD
Diffstat (limited to 'controller')
-rw-r--r--controller/admin.php8
-rw-r--r--controller/ckeditor.php22
-rw-r--r--controller/installation.php9
-rw-r--r--controller/visitor.php10
4 files changed, 30 insertions, 19 deletions
diff --git a/controller/admin.php b/controller/admin.php
index 7f22711..370426b 100644
--- a/controller/admin.php
+++ b/controller/admin.php
@@ -81,11 +81,13 @@ function discoEdit($fileCode, $suppression)
81 // modèle 81 // modèle
82 $Albums = new Album($page_actuelle); 82 $Albums = new Album($page_actuelle);
83 $Albums->makeFileList(); 83 $Albums->makeFileList();
84 //var_dump($Albums); 84
85 // contenu: JSON, HTML, noms et chemins des fichiers 85 // contenu: JSON, HTML, noms et chemins des fichiers
86 $Albums->readAll(); 86 $Albums->readAll();
87 $Albums->fileList = array_reverse($Albums->fileList); 87 if(!empty($Albums->fileList))
88 //var_dump($Albums); 88 {
89 $Albums->fileList = array_reverse($Albums->fileList);
90 }
89 //var_dump($Albums->fileList); 91 //var_dump($Albums->fileList);
90 92
91 // nouvel album 93 // nouvel album
diff --git a/controller/ckeditor.php b/controller/ckeditor.php
index 7102f33..5313c3b 100644
--- a/controller/ckeditor.php
+++ b/controller/ckeditor.php
@@ -89,13 +89,24 @@ function submitCKeditor()
89 89
90 $nouveauTitre = Security::secureString($_POST['titre']); 90 $nouveauTitre = Security::secureString($_POST['titre']);
91 $nouvelleAnnee = Security::secureString($_POST['annee']); 91 $nouvelleAnnee = Security::secureString($_POST['annee']);
92 $nouvellePochette = $_FILES['upload']['name']; 92 if(!empty($_FILES['upload']['name']))
93 {
94 $nouvellePochette = $_FILES['upload']['name'];
95 $nouvellePochetteMini = pathinfo($_FILES['upload']['name'], PATHINFO_FILENAME) . '-mini.' . pathinfo($_FILES['upload']['name'], PATHINFO_EXTENSION);
96 }
97 else
98 {
99 $nouvellePochette = '';
100 $nouvellePochetteMini = '';
101 }
102
103 //var_dump($nouvellePochetteMini); die();
93 104
94 // enregistrement nouvel album 105 // enregistrement nouvel album
95 if(!isset($_SESSION['target']) || $_SESSION['target'] == '') 106 if(!isset($_SESSION['target']) || $_SESSION['target'] == '')
96 { 107 {
97 // page disco 108 // page disco
98 $Album->createVignette($nouveauTitre, $nouvelleAnnee, $nouvellePochette); 109 $Album->createVignette($nouveauTitre, $nouvelleAnnee, $nouvellePochette, $nouvellePochetteMini);
99 110
100 // page de l'album 111 // page de l'album
101 if(!empty($_POST['contenu'])) 112 if(!empty($_POST['contenu']))
@@ -114,12 +125,13 @@ function submitCKeditor()
114 125
115 // garder l'image si aucune n'est sélectionnée 126 // garder l'image si aucune n'est sélectionnée
116 // (on ne peut pas préremplir un <input type="file">) 127 // (on ne peut pas préremplir un <input type="file">)
117 if($nouvellePochette == '' && $Album->oneAlbum['pochette'] != '') 128 /*if($nouvellePochette == '' && $Album->oneAlbum['pochette'] != '')
118 { 129 {
119 $nouvellePochette = $Album->oneAlbum['pochette']; 130 $nouvellePochette = $Album->oneAlbum['pochette'];
120 } 131 $nouvellePochetteMini = $Album->oneAlbum['pochetteMini'];
132 }*/
121 133
122 $Album->updateVignetteJSON($nouveauTitre, $nouvelleAnnee, $nouvellePochette); 134 $Album->updateVignetteJSON($nouveauTitre, $nouvelleAnnee, $nouvellePochette, $nouvellePochetteMini);
123 135
124 // page de l'album 136 // page de l'album
125 if(isset($_POST['contenu'])) 137 if(isset($_POST['contenu']))
diff --git a/controller/installation.php b/controller/installation.php
index 91521e2..9d612dd 100644
--- a/controller/installation.php
+++ b/controller/installation.php
@@ -24,7 +24,7 @@ function installation()
24 // créer le .htaccess 24 // créer le .htaccess
25 if(!file_exists(".htaccess")) 25 if(!file_exists(".htaccess"))
26 { 26 {
27 echo('<p style="color: red;" >Le .htaccess semble absent ce qui rend le site vulnérable aux attaques, veuillez contacter l\'administrateur.</p>'); 27 echo('<p style="color: red;" >Le .htaccess semble absent ce qui rend le site vulnérable, veuillez contacter l\'administrateur.</p>');
28 //$contenu = "# redirection en cas d'erreur 404\nErrorDocument 404 http://" . $_SERVER['SERVER_NAME'] . "/" . $nomDuSite . "/erreur404.php\n# Interdire exploration du répertoire\nOptions All -Indexes"; 28 //$contenu = "# redirection en cas d'erreur 404\nErrorDocument 404 http://" . $_SERVER['SERVER_NAME'] . "/" . $nomDuSite . "/erreur404.php\n# Interdire exploration du répertoire\nOptions All -Indexes";
29 // $fichier = fopen('.htaccess', 'w'); 29 // $fichier = fopen('.htaccess', 'w');
30 // fputs($fichier, $contenu); 30 // fputs($fichier, $contenu);
@@ -75,12 +75,17 @@ function installation()
75 // chmod('data/' . $page . '/multimedia', 0777); 75 // chmod('data/' . $page . '/multimedia', 0777);
76 // } 76 // }
77 } 77 }
78 // dossier supplémentaire dans discographie 78 // dossiers supplémentaires dans discographie
79 if(!file_exists('data/discographie/json')) 79 if(!file_exists('data/discographie/json'))
80 { 80 {
81 mkdir('data/discographie/json'); 81 mkdir('data/discographie/json');
82 chmod('data/discographie/json', $droitsDossiers); 82 chmod('data/discographie/json', $droitsDossiers);
83 } 83 }
84 if(!file_exists('data/discographie/images-mini'))
85 {
86 mkdir('data/discographie/images-mini');
87 chmod('data/discographie/images-mini', $droitsDossiers);
88 }
84 // fichier password.txt 89 // fichier password.txt
85 if(!file_exists('data/password.txt')) 90 if(!file_exists('data/password.txt'))
86 { 91 {
diff --git a/controller/visitor.php b/controller/visitor.php
index fccc287..2656798 100644
--- a/controller/visitor.php
+++ b/controller/visitor.php
@@ -70,7 +70,6 @@ function discoVisitor()
70 //var_dump($Albums->fileList); die(); 70 //var_dump($Albums->fileList); die();
71 71
72 72
73
74 // tri des albums avec l'année dans le .json 73 // tri des albums avec l'année dans le .json
75 74
76 // noms des fichiers JSON 75 // noms des fichiers JSON
@@ -78,20 +77,13 @@ function discoVisitor()
78 77
79 //$annees = []; 78 //$annees = [];
80 for($i = 0; $i < $Albums->fileListCount; $i++) 79 for($i = 0; $i < $Albums->fileListCount; $i++)
81 { 80 {}
82 // une case supplémentaire contient le "fileCode"
83 //$albumsJSON[$i][3] = pathinfo($albumNamesJSON[$i])['filename'];
84 //$albumsJSON[$i][3] = pathinfo($Albums->fileList[$i]['fileCode'])['filename'];
85
86 //$annees[$i] = $albumsJSON[$i][1];
87 }
88 //var_dump($annee); die(); 81 //var_dump($annee); die();
89 82
90 // tri d'un tableau multidimensionnel 83 // tri d'un tableau multidimensionnel
91 //array_multisort($annees, $albumsJSON); 84 //array_multisort($annees, $albumsJSON);
92 85
93 86
94
95 // lien vers le HTML ou ancre? 87 // lien vers le HTML ou ancre?
96 /*$lienAlbum = []; 88 /*$lienAlbum = [];
97 $avecLien = []; 89 $avecLien = [];