1 | <?php |
---|
2 | ### Gestion des nouveaux plugins ### |
---|
3 | // Ajoute la configuration des plugins non-installés au tableau général, il faut valider le formulaire pour les installer |
---|
4 | $Available_Plugins = glob('plugins/*'); |
---|
5 | $PLUGIN_ACTION = 'install'; |
---|
6 | |
---|
7 | foreach ($Available_Plugins as $plugin) { |
---|
8 | $plugin_id = str_replace('plugins/', '', $plugin); // id du plugin |
---|
9 | if (!array_key_exists($plugin_id, $CONF['Plugins'])) { |
---|
10 | $CONF['Plugins'][$plugin_id] = load_config('plugins/'.$plugin_id.'/config.xml'); // configuration du plugin |
---|
11 | $CONF['Plugins'][$plugin_id]['active'] = false; |
---|
12 | $NewPlugins[$plugin_id] = true; |
---|
13 | } |
---|
14 | } |
---|
15 | |
---|
16 | |
---|
17 | ### Gestion des plugins manquants ### |
---|
18 | foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { |
---|
19 | if (!file_exists('plugins/'.$plugin_id)) { |
---|
20 | $MissingPlugins[$plugin_id] = true; |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | |
---|
25 | ### Formulaire ### |
---|
26 | $CONF['copyPOS'] = explode('-', $CONF['copyPOS']); |
---|
27 | $CONF['copyCOLOR'] = nice_hex_color($CONF['copyCOLOR']); |
---|
28 | |
---|
29 | $PAGE_CONTENT[0] .= '<form action="index.php?page=setup" method="post"> |
---|
30 | <div class="generic config"> |
---|
31 | <h2>'.l10n('Configuration').'</h2> |
---|
32 | <ul> |
---|
33 | <li> |
---|
34 | <span class="title">'.l10n('Folders').'</span> |
---|
35 | <table> |
---|
36 | <tr> |
---|
37 | <td>'.l10n('FolderIn').' :</td> |
---|
38 | <td><input type="text" name="DIRsource" value="'.$CONF['DIRsource'].'"/></td> |
---|
39 | </tr> |
---|
40 | <tr> |
---|
41 | <td>'.l10n('FolderOut').' :</td> |
---|
42 | <td><input type="text" name="DIRsortie" value="'.$CONF['DIRsortie'].'"/></td> |
---|
43 | </tr> |
---|
44 | </table> |
---|
45 | </li> |
---|
46 | <li> |
---|
47 | <span class="title">'.l10n('Options').'</span> |
---|
48 | <table> |
---|
49 | <tr> |
---|
50 | <td>'.l10n('silentORNOT').' :</td> |
---|
51 | <td> |
---|
52 | <label><input type="radio" name="silentORNOT" value="erase" '.(($CONF['silentORNOT']=='erase')?'checked="checked"':'').'/> '.l10n('erase').'</label> |
---|
53 | <label><input type="radio" name="silentORNOT" value="block" '.(($CONF['silentORNOT']=='block')?'checked="checked"':'').'/> '.l10n('block').'</label> |
---|
54 | <label><input type="radio" name="silentORNOT" value="pass" '.(($CONF['silentORNOT']=='pass')?'checked="checked"':'').'/> '.l10n('pass').'</label> |
---|
55 | </td> |
---|
56 | </tr> |
---|
57 | <tr> |
---|
58 | <td>'.l10n('DIRhighORNOT').' :</td> |
---|
59 | <td> |
---|
60 | <label><input type="radio" name="DIRhighORNOT" value="true" '.(($CONF['DIRhighORNOT'])?'checked="checked"':'').'/> '.l10n('yes').'</label> |
---|
61 | <label><input type="radio" name="DIRhighORNOT" value="false" '.((!$CONF['DIRhighORNOT'])?'checked="checked"':'').'/> '.l10n('no').'</label> |
---|
62 | </td> |
---|
63 | </tr> |
---|
64 | <tr> |
---|
65 | <td>'.l10n('DIMhdORNOT').' :</td> |
---|
66 | <td> |
---|
67 | <label><input type="radio" name="DIMhdORNOT" value="true" '.(($CONF['DIMhdORNOT'])?'checked="checked"':'').'/> '.l10n('yes').'</label> |
---|
68 | <label><input type="radio" name="DIMhdORNOT" value="false" '.((!$CONF['DIMhdORNOT'])?'checked="checked"':'').'/> '.l10n('no').'</label> |
---|
69 | </td> |
---|
70 | </tr> |
---|
71 | <tr> |
---|
72 | <td>'.l10n('renameORNOT').' :</td> |
---|
73 | <td> |
---|
74 | <label><input type="radio" name="renameORNOT" value="true" '.(($CONF['renameORNOT'])?'checked="checked"':'').'/> '.l10n('yes').'</label> |
---|
75 | <label><input type="radio" name="renameORNOT" value="false" '.((!$CONF['renameORNOT'])?'checked="checked"':'').'/> '.l10n('no').'</label> |
---|
76 | </td> |
---|
77 | </tr> |
---|
78 | <tr> |
---|
79 | <td>'.l10n('indexORNOT').' :</td> |
---|
80 | <td> |
---|
81 | <label><input type="radio" name="indexORNOT" value="true" '.(($CONF['indexORNOT'])?'checked="checked"':'').'/> '.l10n('yes').'</label> |
---|
82 | <label><input type="radio" name="indexORNOT" value="false" '.((!$CONF['indexORNOT'])?'checked="checked"':'').'/> '.l10n('no').'</label> |
---|
83 | </td> |
---|
84 | </tr> |
---|
85 | <tr> |
---|
86 | <td>'.l10n('prefixe_mini').' :</td> |
---|
87 | <td><input type="text" name="prefixe_mini" value="'.$CONF['prefixe_mini'].'" size="8"/></td> |
---|
88 | </tr> |
---|
89 | </table> |
---|
90 | </li> |
---|
91 | <li> |
---|
92 | <span class="title">'.l10n('Sizes and quality').'</span> |
---|
93 | <table> |
---|
94 | <tr> |
---|
95 | <td>'.l10n('DIMhd').' :</td> |
---|
96 | <td><input type="text" name="DIMhd" value="'.$CONF['DIMhd'].'" size="4"/>px</td> |
---|
97 | </tr> |
---|
98 | <tr> |
---|
99 | <td>'.l10n('DIMnormal').' :</td> |
---|
100 | <td><input type="text" name="DIMnormal" value="'.$CONF['DIMnormal'].'" size="3"/>px</td> |
---|
101 | </tr> |
---|
102 | <tr> |
---|
103 | <td>'.l10n('DIMthumbnail').' :</td> |
---|
104 | <td><input type="text" name="DIMthumbnail" value="'.$CONF['DIMthumbnail'].'" size="3"/>px</td> |
---|
105 | </tr> |
---|
106 | <tr> |
---|
107 | <td>'.l10n('Qhd').' :</td> |
---|
108 | <td><input type="text" name="Qhd" value="'.$CONF['Qhd'].'" size="3"/>%</td> |
---|
109 | </tr> |
---|
110 | <tr> |
---|
111 | <td>'.l10n('Qnormal').' :</td> |
---|
112 | <td><input type="text" name="Qnormal" value="'.$CONF['Qnormal'].'" size="3"/>%</td> |
---|
113 | </tr> |
---|
114 | <tr> |
---|
115 | <td>'.l10n('Qthumbnail').' :</td> |
---|
116 | <td><input type="text" name="Qthumbnail" value="'.$CONF['Qthumbnail'].'" size="3"/>%</td> |
---|
117 | </tr> |
---|
118 | <tr> |
---|
119 | <td>'.l10n('DPI').' :</td> |
---|
120 | <td><input type="text" name="DPI" value="'.$CONF['DPI'].'" size="3"/>dpi</td> |
---|
121 | </tr> |
---|
122 | </table> |
---|
123 | </li> |
---|
124 | <li> |
---|
125 | <span class="title">'.l10n('Copyright').'</span> |
---|
126 | <table> |
---|
127 | <tr> |
---|
128 | <td>'.l10n('Content').' :</td> |
---|
129 | <td><input type="text" name="copyright" value="'.$CONF['copyright'].'"/></td> |
---|
130 | </tr> |
---|
131 | <tr> |
---|
132 | <td>'.l10n('copyONhd').' :</td> |
---|
133 | <td> |
---|
134 | <label><input type="radio" name="copyONhd" value="true" '.(($CONF['copyONhd'])?'checked="checked"':'').'/> '.l10n('yes').'</label> |
---|
135 | <label><input type="radio" name="copyONhd" value="false" '.((!$CONF['copyONhd'])?'checked="checked"':'').'/> '.l10n('no').'</label> |
---|
136 | </td> |
---|
137 | </tr> |
---|
138 | <tr> |
---|
139 | <td>'.l10n('copyONnormal').' :</td> |
---|
140 | <td> |
---|
141 | <label><input type="radio" name="copyONnormal" value="true" '.(($CONF['copyONnormal'])?'checked="checked"':'').'/> '.l10n('yes').'</label> |
---|
142 | <label><input type="radio" name="copyONnormal" value="false" '.((!$CONF['copyONnormal'])?'checked="checked"':'').'/> '.l10n('no').'</label> |
---|
143 | </td> |
---|
144 | </tr> |
---|
145 | <tr> |
---|
146 | <td>'.l10n('copyPOS%s', l10n('copyPOSv')).' :</td> |
---|
147 | <td> |
---|
148 | <label><input type="radio" name="copyPOS[0]" value="top" '.(($CONF['copyPOS'][0]=='top')?'checked="checked"':'').'/> '.l10n('top').'</label> |
---|
149 | <label><input type="radio" name="copyPOS[0]" value="center" '.(($CONF['copyPOS'][0]=='center')?'checked="checked"':'').'/> '.l10n('center').'</label> |
---|
150 | <label><input type="radio" name="copyPOS[0]" value="bottom" '.(($CONF['copyPOS'][0]=='bottom')?'checked="checked"':'').'/> '.l10n('bottom').'</label> |
---|
151 | </td> |
---|
152 | </tr> |
---|
153 | <tr> |
---|
154 | <td>'.l10n('copyPOS%s', l10n('copyPOSh')).' :</td> |
---|
155 | <td> |
---|
156 | <label><input type="radio" name="copyPOS[1]" value="left" '.(($CONF['copyPOS'][1]=='left')?'checked="checked"':'').'/> '.l10n('left').'</label> |
---|
157 | <label><input type="radio" name="copyPOS[1]" value="center" '.(($CONF['copyPOS'][1]=='center')?'checked="checked"':'').'/> '.l10n('center').'</label> |
---|
158 | <label><input type="radio" name="copyPOS[1]" value="right" '.(($CONF['copyPOS'][1]=='right')?'checked="checked"':'').'/> '.l10n('right').'</label> |
---|
159 | </td> |
---|
160 | </tr> |
---|
161 | <tr> |
---|
162 | <td>'.l10n('copySIZE').' :</td> |
---|
163 | <td><input type="text" name="copySIZE" value="'.$CONF['copySIZE'].'" size="5"/></td> |
---|
164 | </tr> |
---|
165 | <tr> |
---|
166 | <td>'.l10n('copyCOLOR').' :</td> |
---|
167 | <td><input type="text" name="copyCOLOR" value="'.$CONF['copyCOLOR'].'" size="6" id="colorpicker"/></td> |
---|
168 | <script type="text/javascript"> |
---|
169 | $("#colorpicker").ColorPicker({ |
---|
170 | onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); }, |
---|
171 | onChange: function(hsb, hex, rgb, el) { $("#colorpicker").val(hex); }, |
---|
172 | onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } |
---|
173 | }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); |
---|
174 | </script> |
---|
175 | </tr> |
---|
176 | <tr> |
---|
177 | <td>'.l10n('copyFONT').' :</td> |
---|
178 | <td><input type="text" name="copyFONT" value="'.$CONF['copyFONT'].'"/></td> |
---|
179 | </tr> |
---|
180 | </table> |
---|
181 | </li> |
---|
182 | </ul> |
---|
183 | </div> |
---|
184 | |
---|
185 | <div class="generic config"> |
---|
186 | <h2>'.l10n('Plugins').'</h2> |
---|
187 | <ul>'; |
---|
188 | |
---|
189 | // Affichage des plugins |
---|
190 | $PLUGIN_ACTION = 'edit_config'; |
---|
191 | |
---|
192 | foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) { |
---|
193 | $PAGE_CONTENT[0] .= '<li> |
---|
194 | <div class="plugin-title"> |
---|
195 | <span class="title">'.$plugin_config['name'].' :</span> |
---|
196 | <input type="hidden" name="Plugins['.$plugin_id.'][name]" value="'.$plugin_config['name'].'"/> |
---|
197 | <input type="hidden" name="Plugins['.$plugin_id.'][mode]" value="'.$plugin_config['mode'].'"/>'; |
---|
198 | |
---|
199 | // Cas spéciaux dans le titre (nouveau, manquant) |
---|
200 | if (isset($NewPlugins[$plugin_id])) { |
---|
201 | $PAGE_CONTENT[0] .= ' <b class="new">'.l10n('New !').'</b>'; |
---|
202 | } else if (isset($MissingPlugins[$plugin_id])) { |
---|
203 | $PAGE_CONTENT[0] .= ' <b class="miss">'.l10n('Missing !').'</b>'; |
---|
204 | } |
---|
205 | |
---|
206 | // Si il est manquant on ne met que la checkbox de suppression, sinon boutons d'activation |
---|
207 | $PAGE_CONTENT[0] .= '<span class="plugin-active">'; |
---|
208 | if (isset($MissingPlugins[$plugin_id])) { |
---|
209 | $PAGE_CONTENT[0] .= '<label><input type="checkbox" name="Plugins['.$plugin_id.'][delete]" value="true" checked="checked"/> '.l10n('erase').'</label>'; |
---|
210 | } else { |
---|
211 | $PAGE_CONTENT[0] .= '<label><input type="radio" name="Plugins['.$plugin_id.'][active]" value="true" '.(($plugin_config['active'])?'checked="checked"':'').'/> '.l10n('Active').'</label> |
---|
212 | <label><input type="radio" name="Plugins['.$plugin_id.'][active]" value="false" '.((!$plugin_config['active'])?'checked="checked"':'').'/> '.l10n('Inactive').'</label>'; |
---|
213 | } |
---|
214 | $PAGE_CONTENT[0] .= '</span> |
---|
215 | |
---|
216 | </div>'; |
---|
217 | |
---|
218 | |
---|
219 | // On affiche sa configuration |
---|
220 | if (!isset($MissingPlugins[$plugin_id]) AND file_exists('plugins/'.$plugin_id.'/setup.php')) { |
---|
221 | include('plugins/'.$plugin_id.'/setup.php'); |
---|
222 | } |
---|
223 | $PAGE_CONTENT[0] .= '</li>'; |
---|
224 | } |
---|
225 | |
---|
226 | $PAGE_CONTENT[0] .= '</ul> |
---|
227 | </div>'; |
---|
228 | |
---|
229 | |
---|
230 | $PAGE_CONTENT[2] .= '<div class="generic link"> |
---|
231 | <input type="submit" value="'.l10n('Valid').'"/> |
---|
232 | <input type="reset" value="'.l10n('Reset').'"/> |
---|
233 | <input type="reset" onclick="location.href=\'index.php\'" value="'.l10n('Back').'"/> |
---|
234 | </div> |
---|
235 | </form>'; |
---|
236 | ?> |
---|