1 | <?php |
---|
2 | /***************************************\ |
---|
3 | | PHP OPTIMISATEUR | |
---|
4 | | Version 1.1 | |
---|
5 | \***************************************/ |
---|
6 | |
---|
7 | include('files/functions.php'); |
---|
8 | |
---|
9 | ### Création de nouveau fichier de configuration ### |
---|
10 | if (isset($_POST['DIRsource'])) { |
---|
11 | // Quelques traitements avant d'enregistrer |
---|
12 | $_POST['copyCOLOR'] = implode(' ', $_POST['copyCOLOR']); |
---|
13 | $_POST['copyPOS'] = implode('-', $_POST['copyPOS']); |
---|
14 | if(!isset($_POST['PluginsBefore'])) $_POST['PluginsBefore'] = null; |
---|
15 | if(!isset($_POST['PluginsProcess'])) $_POST['PluginsProcess'] = null; |
---|
16 | if(!isset($_POST['PluginsAfter'])) $_POST['PluginsAfter'] = null; |
---|
17 | |
---|
18 | // Contenu du fichier |
---|
19 | $content = '<?xml version="1.0" encoding="UTF-8"?>'."\r\n".'<config>'."\r\n"; |
---|
20 | $content .= XMLcreate($_POST, 0); |
---|
21 | $content .= '</config>'; |
---|
22 | file_put_contents('config.xml', $content); |
---|
23 | |
---|
24 | header('Location:index.php'); |
---|
25 | } |
---|
26 | |
---|
27 | |
---|
28 | include('files/header.php'); |
---|
29 | |
---|
30 | |
---|
31 | // Fichier de configuration |
---|
32 | if (!file_exists('config.xml')) { |
---|
33 | die('<div class="error">Erreur fatale : Fichier de configuration introuvable. <a href="index.php">Retour</a></div>'); |
---|
34 | } |
---|
35 | |
---|
36 | // Configuration |
---|
37 | $config = simplexml_load_file('config.xml'); |
---|
38 | $config = XMLParse($config); |
---|
39 | $config = array_settype($config); |
---|
40 | extract($config); |
---|
41 | |
---|
42 | $copyCOLOR = explode(' ', $copyCOLOR); |
---|
43 | $copyPOS = explode('-', $copyPOS); |
---|
44 | |
---|
45 | |
---|
46 | ### Gestion des nouveaux plugins ### |
---|
47 | // Ajoute la configuration des plugins non-installés aux tableaux, il faut valider le formulaire pour les installer |
---|
48 | $Plugins = glob('plugins/*.xml'); |
---|
49 | $NewPlugins = array(); |
---|
50 | |
---|
51 | foreach ($Plugins as $plugin) { |
---|
52 | // nom du plugin |
---|
53 | preg_match('#plugins/(.*).xml#', $plugin, $matches); |
---|
54 | $plugin_name = $matches[1]; |
---|
55 | // configuration du plugin |
---|
56 | $plugin = XMLparse(simplexml_load_file($plugin)); |
---|
57 | // mode du plugin (effacage pour pas l'inscrire dans la config) |
---|
58 | $plugin_mode = $plugin['mode']; |
---|
59 | unset($plugin['mode']); |
---|
60 | |
---|
61 | if (!array_key_exists($plugin_name, ${$plugin_mode})) { |
---|
62 | ${$plugin_mode}[$plugin_name] = $plugin; |
---|
63 | $NewPlugins[$plugin_name] = true; |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | |
---|
68 | ### Formulaire ### |
---|
69 | echo ' |
---|
70 | <script type="text/javascript"> |
---|
71 | function suivant(enCours, suivant, limite) { |
---|
72 | if (enCours.value.length == limite) { |
---|
73 | enCours.form.elements[suivant].select(); |
---|
74 | } |
---|
75 | } |
---|
76 | </script> |
---|
77 | |
---|
78 | <form action="setup.php" method="post"> |
---|
79 | <div class="config"> |
---|
80 | <h2>Configuration</h2> |
---|
81 | <ul> |
---|
82 | <li> |
---|
83 | <span class="title">Répertoires</span> |
---|
84 | <table> |
---|
85 | <tr> |
---|
86 | <td><b>Répertoire source :</b></td> |
---|
87 | <td><input type="text" name="DIRsource" value="'.$DIRsource.'"/></td> |
---|
88 | </tr> |
---|
89 | <tr> |
---|
90 | <td><b>Répertoire de sortie :</b></td> |
---|
91 | <td><input type="text" name="DIRsortie" value="'.$DIRsortie.'"/></td> |
---|
92 | </tr> |
---|
93 | </table> |
---|
94 | </li> |
---|
95 | <li> |
---|
96 | <span class="title">Options</span> |
---|
97 | <table> |
---|
98 | <tr> |
---|
99 | <td><b>Mode silencieux :</b></td> |
---|
100 | <td><input type="radio" name="silentORNOT" value="true" '.(($silentORNOT)?'checked':'').'/> oui <input type="radio" name="silentORNOT" value="false" '.((!$silentORNOT)?'checked':'').'/> non</td> |
---|
101 | </tr> |
---|
102 | <tr> |
---|
103 | <td><b>Créer le dossier haute définition :</b></td> |
---|
104 | <td><input type="radio" name="DIRhighORNOT" value="true" '.(($DIRhighORNOT)?'checked':'').'/> oui <input type="radio" name="DIRhighORNOT" value="false" '.((!$DIRhighORNOT)?'checked':'').'/> non</td> |
---|
105 | </tr> |
---|
106 | <tr> |
---|
107 | <td><b>Redimensionner les images HD :</b></td> |
---|
108 | <td><input type="radio" name="DIMhdORNOT" value="true" '.(($DIMhdORNOT)?'checked':'').'/> oui <input type="radio" name="DIMhdORNOT" value="false" '.((!$DIMhdORNOT)?'checked':'').'/> non</td> |
---|
109 | </tr> |
---|
110 | <tr> |
---|
111 | <td><b>Renommer les fichiers :</b></td> |
---|
112 | <td><input type="radio" name="renameORNOT" value="true" '.(($renameORNOT)?'checked':'').'/> oui <input type="radio" name="renameORNOT" value="false" '.((!$renameORNOT)?'checked':'').'/> non</td> |
---|
113 | </tr> |
---|
114 | <tr> |
---|
115 | <td><b>Ajouter les fichiers index.php :</b></td> |
---|
116 | <td><input type="radio" name="indexORNOT" value="true" '.(($indexORNOT)?'checked':'').'/> oui <input type="radio" name="indexORNOT" value="false" '.((!$indexORNOT)?'checked':'').'/> non</td> |
---|
117 | </tr> |
---|
118 | <tr> |
---|
119 | <td><b>Préfixe des miniatures :</b></td> |
---|
120 | <td><input type="text" name="prefixe_mini" value="'.$prefixe_mini.'" size="8"/></td> |
---|
121 | </tr> |
---|
122 | </table> |
---|
123 | </li> |
---|
124 | <li> |
---|
125 | <span class="title">Tailles et qualité</span> |
---|
126 | <table> |
---|
127 | <tr> |
---|
128 | <td><b>Taille maximale des images HD :</b></td> |
---|
129 | <td><input type="text" name="DIMhd" value="'.$DIMhd.'" size="4"/></td> |
---|
130 | </tr> |
---|
131 | <tr> |
---|
132 | <td><b>Taille des images normales :</b></td> |
---|
133 | <td><input type="text" name="DIMnormal" value="'.$DIMnormal.'" size="3"/></td> |
---|
134 | </tr> |
---|
135 | <tr> |
---|
136 | <td><b>Taille des miniatures :</b></td> |
---|
137 | <td><input type="text" name="DIMthumbnail" value="'.$DIMthumbnail.'" size="3"/></td> |
---|
138 | </tr> |
---|
139 | <tr> |
---|
140 | <td><b>Qualité des images HD :</b></td> |
---|
141 | <td><input type="text" name="Qhd" value="'.$Qhd.'" size="3"/></td> |
---|
142 | </tr> |
---|
143 | <tr> |
---|
144 | <td><b>Qualité des images normales :</b></td> |
---|
145 | <td><input type="text" name="Qnormal" value="'.$Qnormal.'" size="3"/></td> |
---|
146 | </tr> |
---|
147 | <tr> |
---|
148 | <td><b>Qualité des miniatures :</b></td> |
---|
149 | <td><input type="text" name="Qthumbnail" value="'.$Qthumbnail.'" size="3"/></td> |
---|
150 | </tr> |
---|
151 | <tr> |
---|
152 | <td><b>Résolution des images HD :</b></td> |
---|
153 | <td><input type="text" name="DPI" value="'.$DPI.'" size="3"/></td> |
---|
154 | </tr> |
---|
155 | </table> |
---|
156 | </li> |
---|
157 | <li> |
---|
158 | <span class="title">Copyright</span> |
---|
159 | <table> |
---|
160 | <tr> |
---|
161 | <td><b>Texte :</b></td> |
---|
162 | <td><input type="text" name="copyright" value="'.$copyright.'"/></td> |
---|
163 | </tr> |
---|
164 | <tr> |
---|
165 | <td><b>Sur les images HD :</b></td> |
---|
166 | <td><input type="radio" name="copyONhd" value="true" '.(($copyONhd)?'checked':'').'/> oui <input type="radio" name="copyONhd" value="false" '.((!$copyONhd)?'checked':'').'/> non</td> |
---|
167 | </tr> |
---|
168 | <tr> |
---|
169 | <td><b>Sur les images normales :</b></td> |
---|
170 | <td><input type="radio" name="copyONnormal" value="true" '.(($copyONnormal)?'checked':'').'/> oui <input type="radio" name="copyONnormal" value="false" '.((!$copyONnormal)?'checked':'').'/> non</td> |
---|
171 | </tr> |
---|
172 | <tr> |
---|
173 | <td><b>Position verticale :</b></td> |
---|
174 | <td><input type="radio" name="copyPOS[0]" value="top" '.(($copyPOS[0]=='top')?'checked':'').'/> haut <input type="radio" name="copyPOS[0]" value="center" '.(($copyPOS[0]=='center')?'checked':'').'/> milieu <input type="radio" name="copyPOS[0]" value="bottom" '.(($copyPOS[0]=='bottom')?'checked':'').'/> bas</td> |
---|
175 | </tr> |
---|
176 | <tr> |
---|
177 | <td><b>Position horizontale :</b></td> |
---|
178 | <td><input type="radio" name="copyPOS[1]" value="left" '.(($copyPOS[1]=='left')?'checked':'').'/> gauche <input type="radio" name="copyPOS[1]" value="center" '.(($copyPOS[1]=='center')?'checked':'').'/> milieu <input type="radio" name="copyPOS[1]" value="right" '.(($copyPOS[1]=='right')?'checked':'').'/> droite</td> |
---|
179 | </tr> |
---|
180 | <tr> |
---|
181 | <td><b>Taille (ratio image/texte) :</b></td> |
---|
182 | <td><input type="text" name="copySIZE" value="'.$copySIZE.'" size="5"/></td> |
---|
183 | </tr> |
---|
184 | <tr> |
---|
185 | <td><b>Couleur :</b></td> |
---|
186 | <td> |
---|
187 | <input type="text" name="copyCOLOR[0]" value="'.$copyCOLOR[0].'" size="3" onFocus="this.select();" onKeyUp="suivant(this,\'copyCOLOR[1]\', 3)"/> |
---|
188 | <input type="text" name="copyCOLOR[1]" value="'.$copyCOLOR[1].'" size="3" onFocus="this.select();" onKeyUp="suivant(this,\'copyCOLOR[2]\', 3)"/> |
---|
189 | <input type="text" name="copyCOLOR[2]" value="'.$copyCOLOR[2].'" size="3" onFocus="this.select();" /> |
---|
190 | </td> |
---|
191 | </tr> |
---|
192 | <tr> |
---|
193 | <td><b>Police :</b></td> |
---|
194 | <td><input type="text" name="copyFONT" value="'.$copyFONT.'"/></td> |
---|
195 | </tr> |
---|
196 | </table> |
---|
197 | </li> |
---|
198 | </ul> |
---|
199 | </div> |
---|
200 | |
---|
201 | <div class="config"> |
---|
202 | <h2>Plugins</h2> |
---|
203 | <ul> |
---|
204 | <li> |
---|
205 | <span class="title">Plugins pré-processing</span> |
---|
206 | <ul>'; |
---|
207 | foreach ($PluginsBefore as $name => $config) { |
---|
208 | echo '<li> |
---|
209 | <b class="'.((isset($NewPlugins[$name]))?'new':'').'">'.$name.' :</b> |
---|
210 | <table>'; |
---|
211 | foreach ($config as $key => $value) { |
---|
212 | echo '<tr> |
---|
213 | <td>'.$key.' :</td> |
---|
214 | <td><input type="text" name="PluginsBefore['.$name.']['.$key.']" value="'.bool_to_string($value,1).'" size="7"/></td> |
---|
215 | </tr>'; |
---|
216 | } |
---|
217 | echo '</table> |
---|
218 | </li>'; |
---|
219 | } |
---|
220 | echo '</ul> |
---|
221 | </li> |
---|
222 | <li> |
---|
223 | <span class="title">Plugins processing</span> |
---|
224 | <ul>'; |
---|
225 | foreach ($PluginsProcess as $name => $config) { |
---|
226 | echo '<li> |
---|
227 | <b class="'.((isset($NewPlugins[$name]))?'new':'').'">'.$name.' :</b> |
---|
228 | <table>'; |
---|
229 | foreach ($config as $key => $value) { |
---|
230 | echo '<tr> |
---|
231 | <td>'.$key.' :</td> |
---|
232 | <td><input type="text" name="PluginsProcess['.$name.']['.$key.']" value="'.bool_to_string($value,1).'" size="7"/></td> |
---|
233 | </tr>'; |
---|
234 | } |
---|
235 | echo '</table> |
---|
236 | </li>'; |
---|
237 | } |
---|
238 | echo '</ul> |
---|
239 | </li> |
---|
240 | <li> |
---|
241 | <span class="title">Plugins post-processing</span> |
---|
242 | <ul>'; |
---|
243 | foreach ($PluginsAfter as $name => $config) { |
---|
244 | echo '<li> |
---|
245 | <b class="'.((isset($NewPlugins[$name]))?'new':'').'">'.$name.' :</b> |
---|
246 | <table>'; |
---|
247 | foreach ($config as $key => $value) { |
---|
248 | echo '<tr> |
---|
249 | <td>'.$key.' :</td> |
---|
250 | <td><input type="text" name="PluginsAfter['.$name.']['.$key.']" value="'.bool_to_string($value,1).'" size="7"/></td> |
---|
251 | </tr>'; |
---|
252 | } |
---|
253 | echo '</table> |
---|
254 | </li>'; |
---|
255 | } |
---|
256 | echo '</ul> |
---|
257 | </li> |
---|
258 | </ul> |
---|
259 | </div> |
---|
260 | |
---|
261 | <div class="finish"> |
---|
262 | <input type="submit"/> <input type="reset"/> <a href="index.php">Retour</a> |
---|
263 | </div> |
---|
264 | </form>'; |
---|
265 | ?> |
---|