source: extensions/PHP_Optimisateur/include/save_config.php @ 10337

Last change on this file since 10337 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
RevLine 
[9201]1<?php
2// Quelques traitements
3$_POST['copyPOS'] = implode('-', $_POST['copyPOS']);
[10337]4$_POST['copyCOLOR'] = str_replace('#', null, $_POST['copyCOLOR']);
[9201]5$_POST['prefixe_mini'] = delete_special_car($_POST['prefixe_mini']);
[10337]6$_POST['DIRsource'] = rtrim($_POST['DIRsource'], '/') . '/';
7$_POST['DIRsortie'] = rtrim($_POST['DIRsortie'], '/') . '/';
[9201]8
9// Vérifications
10if (!is_decimal($_POST['Qhd']) OR $_POST['Qhd'] > 100) {
11        $_POST['Qhd'] = 100;
[10337]12        $ERRORS['conf'][] = array(l10n('Qhd'), 'must_be_integer_100');
[9201]13}
14if (!is_decimal($_POST['Qnormal']) OR $_POST['Qnormal'] > 100) {
15        $_POST['Qnormal'] = 100;
[10337]16        $ERRORS['conf'][] = array(l10n('Qnormal'), 'must_be_integer_100');
[9201]17}
18if (!is_decimal($_POST['Qthumbnail']) OR $_POST['Qthumbnail'] > 100) {
19        $_POST['Qthumbnail'] = 100;
[10337]20        $ERRORS['conf'][] = array(l10n('Qthumbnail'), 'must_be_integer_100');
[9201]21}
22if (!is_decimal($_POST['DIMhd'])) {
23        $_POST['DIMhd'] = 2560;
[10337]24        $ERRORS['conf'][] = array(l10n('DIMhd'), 'must_be_integer');
[9201]25}
26if (!is_decimal($_POST['DIMnormal']) OR $_POST['DIMnormal'] > $_POST['DIMhd']) {
27        $_POST['DIMnormal'] = 800;
[10337]28        $ERRORS['conf'][] = array(l10n('DIMnormal'), 'must_be_integer');
[9201]29}
30if (!is_decimal($_POST['DIMthumbnail']) OR $_POST['DIMthumbnail'] > $_POST['DIMnormal']) {
31        $_POST['DIMthumbnail'] = 120;
[10337]32        $ERRORS['conf'][] = array(l10n('DIMthumbnail'), 'must_be_integer');
[9201]33}
34if (!is_decimal($_POST['DPI'])) {
35        $_POST['DPI'] = 72;
[10337]36        $ERRORS['conf'][] = array(l10n('DPI'), 'must_be_integer');
[9201]37}
[10337]38if (!is_decimal($_POST['copySIZE'])) {
39        $_POST['copySIZE'] = 0.05;
40        $ERRORS['conf'][] = array(l10n('copySIZE'), 'must_be_decimal');
41}
[9201]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
[10337]55
56// écrase la configuration
57unset($_POST['submit']);
58$CONF = array_merge($CONF, array_settype($_POST));
59
[9201]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
[10337]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>';
[9201]70}
[10337]71
72?>
Note: See TracBrowser for help on using the repository browser.