1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2015 Olivier Meunier & Association Dotclear |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
12 | |
---|
13 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
14 | |
---|
15 | $dcckeditor_was_actived = $dcckeditor_active; |
---|
16 | |
---|
17 | if (!empty($_POST['saveconfig'])) { |
---|
18 | try { |
---|
19 | $dcckeditor_active = (empty($_POST['dcckeditor_active']))?false:true; |
---|
20 | $core->blog->settings->dcckeditor->put('active', $dcckeditor_active, 'boolean'); |
---|
21 | |
---|
22 | // change other settings only if they were in html page |
---|
23 | if ($dcckeditor_was_actived) { |
---|
24 | $dcckeditor_alignement_buttons = (empty($_POST['dcckeditor_alignment_buttons']))?false:true; |
---|
25 | $core->blog->settings->dcckeditor->put('alignment_buttons', $dcckeditor_alignement_buttons, 'boolean'); |
---|
26 | |
---|
27 | $dcckeditor_list_buttons = (empty($_POST['dcckeditor_list_buttons']))?false:true; |
---|
28 | $core->blog->settings->dcckeditor->put('list_buttons', $dcckeditor_list_buttons, 'boolean'); |
---|
29 | |
---|
30 | $dcckeditor_textcolor_button = (empty($_POST['dcckeditor_textcolor_button']))?false:true; |
---|
31 | $core->blog->settings->dcckeditor->put('textcolor_button', $dcckeditor_textcolor_button, 'boolean'); |
---|
32 | |
---|
33 | $dcckeditor_cancollapse_button = (empty($_POST['dcckeditor_cancollapse_button']))?false:true; |
---|
34 | $core->blog->settings->dcckeditor->put('cancollapse_button', $dcckeditor_cancollapse_button, 'boolean'); |
---|
35 | |
---|
36 | $dcckeditor_format_select = (empty($_POST['dcckeditor_format_select']))?false:true; |
---|
37 | $core->blog->settings->dcckeditor->put('format_select', $dcckeditor_format_select, 'boolean'); |
---|
38 | |
---|
39 | // default tags : p;h1;h2;h3;h4;h5;h6;pre;address |
---|
40 | $allowed_tags = array('p','h1','h2','h3','h4','h5','h6','pre','address'); |
---|
41 | if (!empty($_POST['dcckeditor_format_tags'])) { |
---|
42 | $tags = explode(';', $_POST['dcckeditor_format_tags']); |
---|
43 | $new_tags = true; |
---|
44 | foreach ($tags as $tag) { |
---|
45 | if (!in_array($tag, $allowed_tags)) { |
---|
46 | $new_tags = false; |
---|
47 | break; |
---|
48 | } |
---|
49 | } |
---|
50 | if ($new_tags) { |
---|
51 | $dcckeditor_format_tags = $_POST['dcckeditor_format_tags']; |
---|
52 | } |
---|
53 | } else { |
---|
54 | $dcckeditor_format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address'; |
---|
55 | } |
---|
56 | $core->blog->settings->dcckeditor->put('format_tags', $dcckeditor_format_tags, 'string'); |
---|
57 | |
---|
58 | |
---|
59 | $dcckeditor_table_button = (empty($_POST['dcckeditor_table_button']))?false:true; |
---|
60 | $core->blog->settings->dcckeditor->put('table_button', $dcckeditor_table_button, 'boolean'); |
---|
61 | |
---|
62 | $dcckeditor_clipboard_buttons = (empty($_POST['dcckeditor_clipboard_buttons']))?false:true; |
---|
63 | $core->blog->settings->dcckeditor->put('clipboard_buttons', $dcckeditor_clipboard_buttons, 'boolean'); |
---|
64 | |
---|
65 | $dcckeditor_disable_native_spellchecker = (empty($_POST['dcckeditor_disable_native_spellchecker']))?false:true; |
---|
66 | $core->blog->settings->dcckeditor->put('disable_native_spellchecker', $dcckeditor_disable_native_spellchecker, 'boolean'); |
---|
67 | } |
---|
68 | |
---|
69 | dcPage::addSuccessNotice(__('The configuration has been updated.')); |
---|
70 | http::redirect($p_url); |
---|
71 | } catch(Exception $e) { |
---|
72 | $core->error->add($e->getMessage()); |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | include dirname(__FILE__).'/../tpl/index.tpl'; |
---|