1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of multiToc, a plugin for Dotclear. |
---|
4 | # |
---|
5 | # Copyright (c) 2009-2010 Tomtom and contributors |
---|
6 | # http://blog.zenstyle.fr/ |
---|
7 | # |
---|
8 | # Licensed under the GPL version 2.0 license. |
---|
9 | # A copy of this license is available in LICENSE file or at |
---|
10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
11 | # -- END LICENSE BLOCK ------------------------------------ |
---|
12 | |
---|
13 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
14 | |
---|
15 | $p_url = 'plugin.php?p=multiToc'; |
---|
16 | $settings = unserialize($core->blog->settings->multiToc->multitoc_settings); |
---|
17 | |
---|
18 | if (!empty($_POST['save'])) |
---|
19 | { |
---|
20 | $types = array('cat','tag','alpha','post'); |
---|
21 | |
---|
22 | foreach ($types as $type) { |
---|
23 | foreach ($settings[$type] as $k => $v) { |
---|
24 | $settings[$type][$k] = ''; |
---|
25 | } |
---|
26 | } |
---|
27 | |
---|
28 | foreach ($_POST as $k => $v) { |
---|
29 | if (preg_match('#^('.implode('|',$types).')_(.*)$#',$k,$match)) { |
---|
30 | $settings[$match[1]][$match[2]] = $v; |
---|
31 | } |
---|
32 | } |
---|
33 | |
---|
34 | $core->blog->settings->multiToc->put('multitoc_settings',serialize($settings)); |
---|
35 | http::redirect($p_url.'&upd=1'); |
---|
36 | } |
---|
37 | |
---|
38 | function getSetting($type,$value) |
---|
39 | { |
---|
40 | global $settings; |
---|
41 | |
---|
42 | return isset($settings[$type][$value]) ? $settings[$type][$value] : ''; |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | echo |
---|
47 | '<html>'. |
---|
48 | '<head>'. |
---|
49 | '<title>'.__('Tables of content').'</title>'. |
---|
50 | '</head>'. |
---|
51 | '<body>'. |
---|
52 | '<h2>'.html::escapeHTML($core->blog->name).' › '.__('Tables of content').'</h2>'; |
---|
53 | |
---|
54 | # Information message |
---|
55 | if (!empty($_GET['upd'])) { |
---|
56 | echo |
---|
57 | '<p class="message">'. |
---|
58 | __('Configuration has been saved successfully'). |
---|
59 | '</p>'; |
---|
60 | } |
---|
61 | |
---|
62 | echo |
---|
63 | '<form method="post" action="'.$p_url.'">'. |
---|
64 | multiTocUi::form('post'). |
---|
65 | multiTocUi::form('cat'). |
---|
66 | multiTocUi::form('tag'). |
---|
67 | multiTocUi::form('alpha'). |
---|
68 | $core->formNonce(). |
---|
69 | '<p><input name="save" value="'.__('Save').'" type="submit" /></p>'. |
---|
70 | '</form>'. |
---|
71 | '</body>'. |
---|
72 | '</html>'; |
---|
73 | |
---|
74 | ?> |
---|