| 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_background_textcolor_button = (empty($_POST['dcckeditor_background_textcolor_button']))?false:true; |
|---|
| 34 | $core->blog->settings->dcckeditor->put('background_textcolor_button', $dcckeditor_background_textcolor_button, 'boolean'); |
|---|
| 35 | |
|---|
| 36 | $dcckeditor_cancollapse_button = (empty($_POST['dcckeditor_cancollapse_button']))?false:true; |
|---|
| 37 | $core->blog->settings->dcckeditor->put('cancollapse_button', $dcckeditor_cancollapse_button, 'boolean'); |
|---|
| 38 | |
|---|
| 39 | $dcckeditor_format_select = (empty($_POST['dcckeditor_format_select']))?false:true; |
|---|
| 40 | $core->blog->settings->dcckeditor->put('format_select', $dcckeditor_format_select, 'boolean'); |
|---|
| 41 | |
|---|
| 42 | // default tags : p;h1;h2;h3;h4;h5;h6;pre;address |
|---|
| 43 | $allowed_tags = array('p','h1','h2','h3','h4','h5','h6','pre','address'); |
|---|
| 44 | if (!empty($_POST['dcckeditor_format_tags'])) { |
|---|
| 45 | $tags = explode(';', $_POST['dcckeditor_format_tags']); |
|---|
| 46 | $new_tags = true; |
|---|
| 47 | foreach ($tags as $tag) { |
|---|
| 48 | if (!in_array($tag, $allowed_tags)) { |
|---|
| 49 | $new_tags = false; |
|---|
| 50 | break; |
|---|
| 51 | } |
|---|
| 52 | } |
|---|
| 53 | if ($new_tags) { |
|---|
| 54 | $dcckeditor_format_tags = $_POST['dcckeditor_format_tags']; |
|---|
| 55 | } |
|---|
| 56 | } else { |
|---|
| 57 | $dcckeditor_format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address'; |
|---|
| 58 | } |
|---|
| 59 | $core->blog->settings->dcckeditor->put('format_tags', $dcckeditor_format_tags, 'string'); |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | $dcckeditor_table_button = (empty($_POST['dcckeditor_table_button']))?false:true; |
|---|
| 63 | $core->blog->settings->dcckeditor->put('table_button', $dcckeditor_table_button, 'boolean'); |
|---|
| 64 | |
|---|
| 65 | $dcckeditor_clipboard_buttons = (empty($_POST['dcckeditor_clipboard_buttons']))?false:true; |
|---|
| 66 | $core->blog->settings->dcckeditor->put('clipboard_buttons', $dcckeditor_clipboard_buttons, 'boolean'); |
|---|
| 67 | |
|---|
| 68 | $dcckeditor_disable_native_spellchecker = (empty($_POST['dcckeditor_disable_native_spellchecker']))?false:true; |
|---|
| 69 | $core->blog->settings->dcckeditor->put('disable_native_spellchecker', $dcckeditor_disable_native_spellchecker, 'boolean'); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | dcPage::addSuccessNotice(__('The configuration has been updated.')); |
|---|
| 73 | http::redirect($p_url); |
|---|
| 74 | } catch(Exception $e) { |
|---|
| 75 | $core->error->add($e->getMessage()); |
|---|
| 76 | } |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | include dirname(__FILE__).'/../tpl/index.tpl'; |
|---|