1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2010 Gaetan Guillard and contributors |
---|
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 | $dsm_flag = $core->blog->settings->dcsitemap->dsm_flag; |
---|
14 | $dsm_title = $core->blog->settings->dcsitemap->dsm_title; |
---|
15 | |
---|
16 | if ($dsm_title === null) { |
---|
17 | $dsm_title = __('Site map'); |
---|
18 | } |
---|
19 | |
---|
20 | if (isset($_POST['dsm_flag'])) |
---|
21 | { |
---|
22 | try |
---|
23 | { |
---|
24 | $dsm_flag = $_POST['dsm_flag']; |
---|
25 | $dsm_title = $_POST['dsm_title']; |
---|
26 | |
---|
27 | if (empty($_POST['dsm_title'])) { |
---|
28 | throw new Exception(__('No page title.')); |
---|
29 | } |
---|
30 | |
---|
31 | # Everything's fine, save options |
---|
32 | $core->blog->settings->addNamespace('dcsitemap'); |
---|
33 | $core->blog->settings->dcsitemap->put('dsm_flag',$dsm_flag,'boolean','dcSiteMap plugin status'); |
---|
34 | $core->blog->settings->dcsitemap->put('dsm_title',$dsm_title,'string','dcSiteMap page title'); |
---|
35 | |
---|
36 | $core->blog->triggerBlog(); |
---|
37 | http::redirect($p_url.'&upd=1'); |
---|
38 | } |
---|
39 | catch (Exception $e) |
---|
40 | { |
---|
41 | $core->error->add($e->getMessage()); |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | ?> |
---|
46 | <html> |
---|
47 | <head> |
---|
48 | <title><?php echo __('Site map'); ?></title> |
---|
49 | </head> |
---|
50 | |
---|
51 | <body> |
---|
52 | <?php |
---|
53 | echo '<h2>'.html::escapeHTML($core->blog->name).' › '.__('Site map').'</h2>'; |
---|
54 | |
---|
55 | if (!empty($_GET['upd'])) { |
---|
56 | echo '<p class="message">'.__('Setting have been successfully updated.').'</p>'; |
---|
57 | } |
---|
58 | |
---|
59 | echo |
---|
60 | '<form action="'.$p_url.'" method="post">'. |
---|
61 | '<fieldset><legend>'.__('Plugin activation').'</legend>'. |
---|
62 | '<p><label class="classic">'.form::checkbox('dsm_flag',1,(boolean) $dsm_flag). |
---|
63 | ' '.__('Enable dcSiteMap').'</label></p>'. |
---|
64 | '</fieldset>'. |
---|
65 | '<fieldset><legend>'.__('Presentation options').'</legend>'. |
---|
66 | '<p><label class="required" title="'.__('Required field').'">'.__('Page title:').' '. |
---|
67 | form::field('dsm_title',30,256,html::escapeHTML($dsm_title)). |
---|
68 | '</label></p>'. |
---|
69 | '</fieldset>'. |
---|
70 | '<p>'.$core->formNonce().'<input type="submit" value="'.__('save').'" /></p>'. |
---|
71 | '</form>'; |
---|
72 | |
---|
73 | dcPage::helpBlock('dcSiteMap'); |
---|
74 | ?> |
---|
75 | </body> |
---|
76 | </html> |
---|