1 | <?php |
---|
2 | // Quelques traitements |
---|
3 | $_POST['copyPOS'] = implode('-', $_POST['copyPOS']); |
---|
4 | $_POST['copyCOLOR'] = str_replace('#','', $_POST['copyCOLOR']); |
---|
5 | $_POST['prefixe_mini'] = delete_special_car($_POST['prefixe_mini']); |
---|
6 | if (!preg_match('#(.*)/$#', $_POST['DIRsource'])) $_POST['DIRsource'] .= '/'; |
---|
7 | if (!preg_match('#(.*)/$#', $_POST['DIRsortie'])) $_POST['DIRsortie'] .= '/'; |
---|
8 | |
---|
9 | // Vérifications |
---|
10 | if (!is_decimal($_POST['Qhd']) OR $_POST['Qhd'] > 100) { |
---|
11 | $_POST['Qhd'] = 100; |
---|
12 | $Errors['ErrorConfig'] = 'notice'; |
---|
13 | } |
---|
14 | if (!is_decimal($_POST['Qnormal']) OR $_POST['Qnormal'] > 100) { |
---|
15 | $_POST['Qnormal'] = 100; |
---|
16 | $Errors['ErrorConfig'] = 'notice'; |
---|
17 | } |
---|
18 | if (!is_decimal($_POST['Qthumbnail']) OR $_POST['Qthumbnail'] > 100) { |
---|
19 | $_POST['Qthumbnail'] = 100; |
---|
20 | $Errors['ErrorConfig'] = 'notice'; |
---|
21 | } |
---|
22 | if (!is_decimal($_POST['DIMhd'])) { |
---|
23 | $_POST['DIMhd'] = 2560; |
---|
24 | $Errors['ErrorConfig'] = 'notice'; |
---|
25 | } |
---|
26 | if (!is_decimal($_POST['DIMnormal']) OR $_POST['DIMnormal'] > $_POST['DIMhd']) { |
---|
27 | $_POST['DIMnormal'] = 800; |
---|
28 | $Errors['ErrorConfig'] = 'notice'; |
---|
29 | } |
---|
30 | if (!is_decimal($_POST['DIMthumbnail']) OR $_POST['DIMthumbnail'] > $_POST['DIMnormal']) { |
---|
31 | $_POST['DIMthumbnail'] = 120; |
---|
32 | $Errors['ErrorConfig'] = 'notice'; |
---|
33 | } |
---|
34 | if (!is_decimal($_POST['DPI'])) { |
---|
35 | $_POST['DPI'] = 72; |
---|
36 | $Errors['ErrorConfig'] = 'notice'; |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | // Plugins : supprime les plugins manquants & charge les actions de configuration |
---|
41 | $PLUGIN_ACTION = 'save_config'; |
---|
42 | |
---|
43 | foreach ($_POST['Plugins'] as $plugin_id => $plugin_config) { |
---|
44 | if (isset($plugin_config['delete'])) { |
---|
45 | unset($_POST['Plugins'][$plugin_id]); |
---|
46 | } else if (file_exists('plugins/'.$plugin_id.'/setup.php')) { |
---|
47 | include('plugins/'.$plugin_id.'/setup.php'); |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | // Contenu du fichier |
---|
52 | $content = '<?xml version="1.0" encoding="UTF-8"?>'."\r\n".'<config>'."\r\n"; |
---|
53 | $content .= XMLcreate($_POST); |
---|
54 | $content .= '</config>'; |
---|
55 | file_put_contents('config.xml', $content); |
---|
56 | |
---|
57 | if (isset($Errors['ErrorConfig'])) { |
---|
58 | header('Location:index.php?page=setup&ErrorConfig='.$Errors['ErrorConfig']); |
---|
59 | } else { |
---|
60 | header('Location:index.php'); |
---|
61 | } |
---|
62 | ?> |
---|