summaryrefslogtreecommitdiff
path: root/controller/installation.php
diff options
context:
space:
mode:
Diffstat (limited to 'controller/installation.php')
-rw-r--r--controller/installation.php38
1 files changed, 21 insertions, 17 deletions
diff --git a/controller/installation.php b/controller/installation.php
index e8b1af8..0bd56c2 100644
--- a/controller/installation.php
+++ b/controller/installation.php
@@ -68,10 +68,19 @@ function installation()
68 require('view/backup.php'); 68 require('view/backup.php');
69 exit(); 69 exit();
70 } 70 }
71 if(!file_exists('data/index.html')) 71
72 function createIndexPHP($path, $droitsFichiers)
73 {
74 $content = "<?php\nheader('Location: ../index.php');\nexit();";
75 $file = fopen($path, 'w');
76 fputs($file, $content);
77 fclose($file);
78 chmod($path, $droitsFichiers);
79 }
80
81 if(!file_exists('data/index.php'))
72 { 82 {
73 touch('data/index.html'); 83 createIndexPHP('data/index.php', $droitsFichiers);
74 chmod('data/index.html', $droitsFichiers);
75 } 84 }
76 85
77 $listePages = array('melaine', 'discographie', 'concerts', 'presse', 'ateliers', 'liens', 'peinture', 'archives'); 86 $listePages = array('melaine', 'discographie', 'concerts', 'presse', 'ateliers', 'liens', 'peinture', 'archives');
@@ -82,30 +91,27 @@ function installation()
82 mkdir('data/' . $page); 91 mkdir('data/' . $page);
83 chmod('data/' . $page, $droitsDossiers); 92 chmod('data/' . $page, $droitsDossiers);
84 } 93 }
85 if(!file_exists('data/' . $page . 'index.html')) 94 if(!file_exists('data/' . $page . '/index.php'))
86 { 95 {
87 touch('data/' . $page . '/index.html'); 96 createIndexPHP('data/' . $page . '/index.php', $droitsFichiers);
88 chmod('data/' . $page . '/index.html', $droitsFichiers);
89 } 97 }
90 if(!file_exists('data/' . $page . '/html')) 98 if(!file_exists('data/' . $page . '/html'))
91 { 99 {
92 mkdir('data/' . $page . '/html'); 100 mkdir('data/' . $page . '/html');
93 chmod('data/' . $page . '/html', $droitsDossiers); 101 chmod('data/' . $page . '/html', $droitsDossiers);
94 } 102 }
95 if(!file_exists('data/' . $page . '/html/index.html')) 103 if(!file_exists('data/' . $page . '/html/index.php'))
96 { 104 {
97 touch('data/' . $page . '/html/index.html'); 105 createIndexPHP('data/' . $page . '/html/index.php', $droitsFichiers);
98 chmod('data/' . $page . '/html/index.html', $droitsFichiers);
99 } 106 }
100 if(!file_exists('data/' . $page . '/images')) 107 if(!file_exists('data/' . $page . '/images'))
101 { 108 {
102 mkdir('data/' . $page . '/images'); 109 mkdir('data/' . $page . '/images');
103 chmod('data/' . $page . '/images', $droitsDossiers); 110 chmod('data/' . $page . '/images', $droitsDossiers);
104 } 111 }
105 if(!file_exists('data/' . $page . '/images/index.html')) 112 if(!file_exists('data/' . $page . '/images/index.php'))
106 { 113 {
107 touch('data/' . $page . '/images/index.html'); 114 createIndexPHP('data/' . $page . '/images/index.php', $droitsFichiers);
108 chmod('data/' . $page . '/images/index.html', $droitsFichiers);
109 } 115 }
110 // if(!file_exists('data/' . $page . '/multimedia')) 116 // if(!file_exists('data/' . $page . '/multimedia'))
111 // { 117 // {
@@ -119,10 +125,9 @@ function installation()
119 mkdir('data/discographie/json'); 125 mkdir('data/discographie/json');
120 chmod('data/discographie/json', $droitsDossiers); 126 chmod('data/discographie/json', $droitsDossiers);
121 } 127 }
122 if(!file_exists('data/discographie/json/index.html')) 128 if(!file_exists('data/discographie/json/index.php'))
123 { 129 {
124 touch('data/discographie/json/index.html'); 130 createIndexPHP('data/discographie/json/index.php', $droitsFichiers);
125 chmod('data/discographie/json/index.html', $droitsFichiers);
126 } 131 }
127 if(!file_exists('data/discographie/images-mini')) 132 if(!file_exists('data/discographie/images-mini'))
128 { 133 {
@@ -131,8 +136,7 @@ function installation()
131 } 136 }
132 if(!file_exists('data/discographie/images-mini/index.html')) 137 if(!file_exists('data/discographie/images-mini/index.html'))
133 { 138 {
134 touch('data/discographie/images-mini/index.html'); 139 createIndexPHP('data/discographie/images-mini/index.php', $droitsFichiers);
135 chmod('data/discographie/images-mini/index.html', $droitsFichiers);
136 } 140 }
137 // le modèle donnera les droits 0666 (octal) aux nouveaux fichiers à l'intérieur des dossiers 141 // le modèle donnera les droits 0666 (octal) aux nouveaux fichiers à l'intérieur des dossiers
138 142