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

Last change on this file since 32022 was 12819, checked in by mistic100, 12 years ago

fix detection regex and watermark position

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