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