source: extensions/PHP_Optimisateur/include/setup.php @ 10472

Last change on this file since 10472 was 10337, checked in by mistic100, 13 years ago

new version 1.4, new plugin for Charlies Content, NConvert updated

File size: 11.1 KB
Line 
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
7foreach ($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 ###
18foreach ($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'] .= '<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                                                        <input type="radio" id="silentORNOT1" name="silentORNOT" value="erase" '.(($CONF['silentORNOT']=='erase')?'checked="checked"':'').'/>
53                                                        <label for="silentORNOT1">'.l10n('erase').'</label>
54                                                        <input type="radio" id="silentORNOT2" name="silentORNOT" value="block" '.(($CONF['silentORNOT']=='block')?'checked="checked"':'').'/>
55                                                        <label for="silentORNOT2">'.l10n('block').'</label>
56                                                        <input type="radio" id="silentORNOT3" name="silentORNOT" value="pass" '.(($CONF['silentORNOT']=='pass')?'checked="checked"':'').'/>
57                                                        <label for="silentORNOT3">'.l10n('pass').'</label>
58                                                </td>
59                                        </tr>
60                                        <tr>
61                                                <td>'.l10n('DIRhighORNOT').' :</td>
62                                                <td>
63                                                        <input type="radio" id="DIRhighORNOT1" name="DIRhighORNOT" value="true" '.(($CONF['DIRhighORNOT'])?'checked="checked"':'').'/>
64                                                        <label for="DIRhighORNOT1">'.l10n('yes').'</label>
65                                                        <input type="radio" id="DIRhighORNOT2" name="DIRhighORNOT" value="false" '.((!$CONF['DIRhighORNOT'])?'checked="checked"':'').'/>
66                                                        <label for="DIRhighORNOT2">'.l10n('no').'</label>
67                                                </td>
68                                        </tr>
69                                        <tr>
70                                                <td>'.l10n('DIMhdORNOT').' :</td>
71                                                <td>
72                                                        <input type="radio" id="DIMhdORNOT1" name="DIMhdORNOT" value="true" '.(($CONF['DIMhdORNOT'])?'checked="checked"':'').'/>
73                                                        <label for="DIMhdORNOT1">'.l10n('yes').'</label>
74                                                        <input type="radio" id="DIMhdORNOT" name="DIMhdORNOT" value="false" '.((!$CONF['DIMhdORNOT'])?'checked="checked"':'').'/>
75                                                        <label for="DIMhdORNOT2">'.l10n('no').'</label>
76                                                </td>
77                                        </tr>
78                                        <tr>
79                                                <td>'.l10n('renameORNOT').' :</td>
80                                                <td>
81                                                        <input type="radio" id="renameORNOT1" name="renameORNOT" value="true" '.(($CONF['renameORNOT'])?'checked="checked"':'').'/>
82                                                        <label for="renameORNOT1">'.l10n('yes').'</label>
83                                                        <input type="radio" id="renameORNOT2" name="renameORNOT" value="false" '.((!$CONF['renameORNOT'])?'checked="checked"':'').'/>
84                                                        <label for="renameORNOT2">'.l10n('no').'</label>
85                                                </td>
86                                        </tr>
87                                        <tr>
88                                                <td>'.l10n('indexORNOT').' :</td>
89                                                <td>
90                                                        <input type="radio" id="indexORNOT1" name="indexORNOT" value="true" '.(($CONF['indexORNOT'])?'checked="checked"':'').'/>
91                                                        <label for="indexORNOT1">'.l10n('yes').'</label>
92                                                        <input type="radio" id="indexORNOT2" name="indexORNOT" value="false" '.((!$CONF['indexORNOT'])?'checked="checked"':'').'/>
93                                                        <label for="indexORNOT2">'.l10n('no').'</label>
94                                                </td>
95                                        </tr>
96                                        <tr>
97                                                <td>'.l10n('prefixe_mini').' :</td>
98                                                <td><input type="text" name="prefixe_mini" value="'.$CONF['prefixe_mini'].'" size="8"/></td>
99                                        </tr>
100                                </table>
101                        </li>
102                        <li>
103                                <span class="title">'.l10n('Sizes and quality').'</span>
104                                <table>
105                                        <tr>
106                                                <td>'.l10n('DIMhd').' :</td>
107                                                <td><input type="text" name="DIMhd" value="'.$CONF['DIMhd'].'" size="4"/>px</td>
108                                        </tr>
109                                        <tr>
110                                                <td>'.l10n('DIMnormal').' :</td>
111                                                <td><input type="text" name="DIMnormal" value="'.$CONF['DIMnormal'].'" size="3"/>px</td>
112                                        </tr>
113                                        <tr>
114                                                <td>'.l10n('DIMthumbnail').' :</td>
115                                                <td><input type="text" name="DIMthumbnail" value="'.$CONF['DIMthumbnail'].'" size="3"/>px</td>
116                                        </tr>
117                                        <tr>
118                                                <td>'.l10n('Qhd').' :</td>
119                                                <td><input type="text" name="Qhd" value="'.$CONF['Qhd'].'" size="3"/>%</td>
120                                        </tr>
121                                        <tr>
122                                                <td>'.l10n('Qnormal').' :</td>
123                                                <td><input type="text" name="Qnormal" value="'.$CONF['Qnormal'].'" size="3"/>%</td>
124                                        </tr>
125                                        <tr>
126                                                <td>'.l10n('Qthumbnail').' :</td>
127                                                <td><input type="text" name="Qthumbnail" value="'.$CONF['Qthumbnail'].'" size="3"/>%</td>
128                                        </tr>
129                                        <tr>
130                                                <td>'.l10n('DPI').' :</td>
131                                                <td><input type="text" name="DPI" value="'.$CONF['DPI'].'" size="3"/>dpi</td>
132                                        </tr>
133                                </table>
134                        </li>
135                        <li>
136                                <span class="title">'.l10n('Copyright').'</span>
137                                <table>
138                                        <tr>
139                                                <td>'.l10n('Content').' :</td>
140                                                <td><input type="text" name="copyright" value="'.$CONF['copyright'].'"/></td>
141                                        </tr>
142                                        <tr>
143                                                <td>'.l10n('copyONhd').' :</td>
144                                                <td>
145                                                        <input type="radio" id="copyONhd1" name="copyONhd" value="true" '.(($CONF['copyONhd'])?'checked="checked"':'').'/>
146                                                        <label for="copyONhd1">'.l10n('yes').'</label>
147                                                        <input type="radio" id="copyONhd2" name="copyONhd" value="false" '.((!$CONF['copyONhd'])?'checked="checked"':'').'/>
148                                                        <label for="copyONhd2">'.l10n('no').'</label>
149                                                </td>
150                                        </tr>
151                                        <tr>
152                                                <td>'.l10n('copyONnormal').' :</td>
153                                                <td>
154                                                        <input type="radio" id="copyONnormal1" name="copyONnormal" value="true" '.(($CONF['copyONnormal'])?'checked="checked"':'').'/>
155                                                        <label for="copyONnormal1">'.l10n('yes').'</label>
156                                                        <input type="radio" id="copyONnormal2" name="copyONnormal" value="false" '.((!$CONF['copyONnormal'])?'checked="checked"':'').'/>
157                                                        <label for="copyONnormal2">'.l10n('no').'</label>
158                                                </td>
159                                        </tr>
160                                        <tr>
161                                                <td>'.l10n('copyPOS%s', l10n('copyPOSv')).' :</td>
162                                                <td>
163                                                        <input type="radio" id="copyPOS01" name="copyPOS[0]" value="top" '.(($CONF['copyPOS'][0]=='top')?'checked="checked"':'').'/>
164                                                        <label for="copyPOS01">'.l10n('top').'</label>
165                                                        <input type="radio" id="copyPOS02" name="copyPOS[0]" value="center" '.(($CONF['copyPOS'][0]=='center')?'checked="checked"':'').'/>
166                                                        <label for="copyPOS02">'.l10n('center').'</label>
167                                                        <input type="radio" id="copyPOS03" name="copyPOS[0]" value="bottom" '.(($CONF['copyPOS'][0]=='bottom')?'checked="checked"':'').'/>
168                                                        <label for="copyPOS03">'.l10n('bottom').'</label>
169                                                </td>
170                                        </tr>
171                                        <tr>
172                                                <td>'.l10n('copyPOS%s', l10n('copyPOSh')).' :</td>
173                                                <td>
174                                                        <input type="radio" id="copyPOS11" name="copyPOS[1]" value="left" '.(($CONF['copyPOS'][1]=='left')?'checked="checked"':'').'/>
175                                                        <label for="copyPOS11">'.l10n('left').'</label>
176                                                        <input type="radio" id="copyPOS12" name="copyPOS[1]" value="center" '.(($CONF['copyPOS'][1]=='center')?'checked="checked"':'').'/>
177                                                        <label for="copyPOS12">'.l10n('center').'</label>
178                                                        <input type="radio" id="copyPOS13" name="copyPOS[1]" value="right" '.(($CONF['copyPOS'][1]=='right')?'checked="checked"':'').'/>
179                                                        <label for="copyPOS13">'.l10n('right').'</label>
180                                                </td>
181                                        </tr>
182                                        <tr>
183                                                <td>'.l10n('copySIZE').' :</td>
184                                                <td><input type="text" name="copySIZE" value="'.$CONF['copySIZE'].'" size="5"/></td>
185                                        </tr>
186                                        <tr>
187                                                <td>'.l10n('copyCOLOR').' :</td>
188                                                <td><input type="text" id="colorpicker" name="copyCOLOR" value="'.$CONF['copyCOLOR'].'" size="6"/></td>
189                                                <script type="text/javascript">
190                                                        $("#colorpicker").ColorPicker({
191                                                                onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); },
192                                                                onChange: function(hsb, hex, rgb, el) { $("#colorpicker").val(hex); },
193                                                                onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); }
194                                                        }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); });
195                                                </script>
196                                        </tr>
197                                        <tr>
198                                                <td>'.l10n('copyFONT').' :</td>
199                                                <td><input type="text" name="copyFONT" value="'.$CONF['copyFONT'].'"/></td>
200                                        </tr>
201                                </table>
202                        </li>
203                </ul>
204        </div>
205
206        <div class="generic config">
207                <h2>'.l10n('Plugins').'</h2>
208                <ul>';
209                       
210                        // Affichage des plugins
211                        $PLUGIN_ACTION = 'edit_config';
212                       
213                        foreach ($CONF['Plugins'] as $plugin_id => $plugin_config) {
214                                $PAGE['content'] .= '<li>
215                                        <div class="plugin-title">
216                                                <span class="title">'.$plugin_config['name'].' :</span>
217                                                <input type="hidden" name="Plugins['.$plugin_id.'][name]" value="'.$plugin_config['name'].'"/>
218                                                <input type="hidden" name="Plugins['.$plugin_id.'][mode]" value="'.$plugin_config['mode'].'"/>';
219                                               
220                                                // Cas spéciaux dans le titre (nouveau, manquant)
221                                                if (isset($NewPlugins[$plugin_id])) {
222                                                        $PAGE['content'] .= ' <b class="new">'.l10n('New !').'</b>';
223                                                } else if (isset($MissingPlugins[$plugin_id])) {
224                                                        $PAGE['content'] .= ' <b class="miss">'.l10n('Missing !').'</b>';
225                                                }
226                                               
227                                                // Si il est manquant on ne met que la checkbox de suppression, sinon boutons d'activation
228                                                $PAGE['content'] .= '<span class="plugin-active">';
229                                                        if (isset($MissingPlugins[$plugin_id])) {
230                                                                $PAGE['content'] .= '<label><input type="checkbox" name="Plugins['.$plugin_id.'][delete]" value="true" checked="checked"/> '.l10n('erase').'</label>';
231                                                        } else {
232                                                                $PAGE['content'] .= '<input type="radio" id="" id="active-'.$plugin_id.'" name="Plugins['.$plugin_id.'][active]" value="true" '.(($plugin_config['active'])?'checked="checked"':'').'/>
233                                                                <label for="active-'.$plugin_id.'">'.l10n('Active').'</label>
234                                                                <input type="radio" id="" id="inactive-'.$plugin_id.'"name="Plugins['.$plugin_id.'][active]" value="false" '.((!$plugin_config['active'])?'checked="checked"':'').'/>
235                                                                <label for="inactive-'.$plugin_id.'">'.l10n('Inactive').'</label>';
236                                                        }
237                                                $PAGE['content'] .= '</span>
238                                               
239                                        </div>';
240                                       
241                                       
242                                        // On affiche sa configuration
243                                        if (!isset($MissingPlugins[$plugin_id]) AND file_exists('plugins/'.$plugin_id.'/setup.php')) {
244                                                include('plugins/'.$plugin_id.'/setup.php');
245                                        }
246                                $PAGE['content'] .= '</li>';
247                        }
248                       
249                $PAGE['content'] .= '</ul>
250        </div>';
251       
252
253        $PAGE['end'] .= '<div class="generic link">
254                <input type="submit" name="submit" value="'.l10n('Valid').'"/>
255                <input type="reset" onclick="location.href=\'index.php\'" value="'.l10n('Back').'"/>
256        </div>
257</form>';
258?>
Note: See TracBrowser for help on using the repository browser.