1 | <?php |
---|
2 | // Quelques traitements |
---|
3 | if ($_POST['copyPOS'][0] == 'center' and $_POST['copyPOS'][1] == 'center') { |
---|
4 | $_POST['copyPOS'] = 'center'; |
---|
5 | } else { |
---|
6 | $_POST['copyPOS'] = implode('-', $_POST['copyPOS']); |
---|
7 | } |
---|
8 | $_POST['copyCOLOR'] = str_replace('#', null, $_POST['copyCOLOR']); |
---|
9 | $_POST['prefixe_mini'] = delete_special_car($_POST['prefixe_mini']); |
---|
10 | $_POST['DIRsource'] = rtrim($_POST['DIRsource'], '/') . '/'; |
---|
11 | $_POST['DIRsortie'] = rtrim($_POST['DIRsortie'], '/') . '/'; |
---|
12 | |
---|
13 | // Vérifications |
---|
14 | if (!is_decimal($_POST['Qhd']) OR $_POST['Qhd'] > 100) { |
---|
15 | $_POST['Qhd'] = 100; |
---|
16 | $ERRORS['conf'][] = array(l10n('Qhd'), 'must_be_integer_100'); |
---|
17 | } |
---|
18 | if (!is_decimal($_POST['Qnormal']) OR $_POST['Qnormal'] > 100) { |
---|
19 | $_POST['Qnormal'] = 100; |
---|
20 | $ERRORS['conf'][] = array(l10n('Qnormal'), 'must_be_integer_100'); |
---|
21 | } |
---|
22 | if (!is_decimal($_POST['Qthumbnail']) OR $_POST['Qthumbnail'] > 100) { |
---|
23 | $_POST['Qthumbnail'] = 100; |
---|
24 | $ERRORS['conf'][] = array(l10n('Qthumbnail'), 'must_be_integer_100'); |
---|
25 | } |
---|
26 | if (!is_decimal($_POST['DIMhd'])) { |
---|
27 | $_POST['DIMhd'] = 2560; |
---|
28 | $ERRORS['conf'][] = array(l10n('DIMhd'), 'must_be_integer'); |
---|
29 | } |
---|
30 | if (!is_decimal($_POST['DIMnormal']) OR $_POST['DIMnormal'] > $_POST['DIMhd']) { |
---|
31 | $_POST['DIMnormal'] = 800; |
---|
32 | $ERRORS['conf'][] = array(l10n('DIMnormal'), 'must_be_integer'); |
---|
33 | } |
---|
34 | if (!is_decimal($_POST['DIMthumbnail']) OR $_POST['DIMthumbnail'] > $_POST['DIMnormal']) { |
---|
35 | $_POST['DIMthumbnail'] = 120; |
---|
36 | $ERRORS['conf'][] = array(l10n('DIMthumbnail'), 'must_be_integer'); |
---|
37 | } |
---|
38 | if (!is_decimal($_POST['DPI'])) { |
---|
39 | $_POST['DPI'] = 72; |
---|
40 | $ERRORS['conf'][] = array(l10n('DPI'), 'must_be_integer'); |
---|
41 | } |
---|
42 | if (!is_decimal($_POST['copySIZE'])) { |
---|
43 | $_POST['copySIZE'] = 0.05; |
---|
44 | $ERRORS['conf'][] = array(l10n('copySIZE'), 'must_be_decimal'); |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | // Plugins : supprime les plugins manquants & charge les actions de configuration |
---|
49 | $PLUGIN_ACTION = 'save_config'; |
---|
50 | |
---|
51 | foreach ($_POST['Plugins'] as $plugin_id => $plugin_config) { |
---|
52 | if (isset($plugin_config['delete'])) { |
---|
53 | unset($_POST['Plugins'][$plugin_id]); |
---|
54 | } else if (file_exists('plugins/'.$plugin_id.'/setup.php')) { |
---|
55 | include('plugins/'.$plugin_id.'/setup.php'); |
---|
56 | } |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | // écrase la configuration |
---|
61 | unset($_POST['submit']); |
---|
62 | $CONF = array_merge($CONF, array_settype($_POST)); |
---|
63 | |
---|
64 | // Contenu du fichier |
---|
65 | $content = '<?xml version="1.0" encoding="UTF-8"?>'."\r\n".'<config>'."\r\n"; |
---|
66 | $content .= XMLcreate($_POST); |
---|
67 | $content .= '</config>'; |
---|
68 | file_put_contents('config.xml', $content); |
---|
69 | |
---|
70 | if (!isset($ERRORS['conf'])) { |
---|
71 | // header('Location:index.php'); |
---|
72 | $PAGE['header'] .= '<meta http-equiv="refresh" content="2;url=index.php">'; |
---|
73 | $PAGE['end'] .= '<div class="generic finish">'.l10n('Saved').'</div>'; |
---|
74 | } |
---|
75 | |
---|
76 | ?> |
---|