1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of periodical, a plugin for Dotclear 2. |
---|
4 | # |
---|
5 | # Copyright (c) 2009-2010 JC Denis and contributors |
---|
6 | # jcdenis@gdwd.com |
---|
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 | $sortby_combo = array( |
---|
16 | __('Create date') => 'post_creadt', |
---|
17 | __('Date') => 'post_dt', |
---|
18 | __('ID') => 'post_id' |
---|
19 | ); |
---|
20 | $order_combo = array( |
---|
21 | __('Descending') => 'desc', |
---|
22 | __('Ascending') => 'asc' |
---|
23 | ); |
---|
24 | |
---|
25 | $s_active = (boolean) $s->periodical_active; |
---|
26 | $s_upddate = (boolean) $s->periodical_upddate; |
---|
27 | $s_updurl = (boolean) $s->periodical_updurl; |
---|
28 | $e_order = (string) $s->periodical_pub_order; |
---|
29 | $e_order = explode(' ',$e_order); |
---|
30 | $s_sortby = in_array($e_order[0],$sortby_combo) ? |
---|
31 | $e_order : 'post_dt'; |
---|
32 | $s_order = isset($e_order[1]) && strtolower($e_order[1]) == 'desc' ? |
---|
33 | 'desc' : 'asc'; |
---|
34 | |
---|
35 | if ($default_tab == 'setting' && $action == 'savesetting') |
---|
36 | { |
---|
37 | try { |
---|
38 | $s->setNameSpace('periodical'); |
---|
39 | $s->put('periodical_active',!empty($_POST['s_active'])); |
---|
40 | $s->put('periodical_upddate',!empty($_POST['s_upddate'])); |
---|
41 | $s->put('periodical_updurl',!empty($_POST['s_updurl'])); |
---|
42 | $s->put('periodical_pub_order',$_POST['s_sortby'].' '.$_POST['s_order']); |
---|
43 | $s->setNameSpace('system'); |
---|
44 | $core->blog->triggerBlog(); |
---|
45 | |
---|
46 | http::redirect('plugin.php?p=periodical&part=setting&msg='.$action); |
---|
47 | } |
---|
48 | catch (Exception $e) { |
---|
49 | $core->error->add($e->getMessage()); |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | echo ' |
---|
54 | <html><head><title>'.__('Periodical').'</title></head> |
---|
55 | <body> |
---|
56 | <h2>'. |
---|
57 | html::escapeHTML($core->blog->name). |
---|
58 | ' › <a href="'.$p_url.'&part=periods">'.__('Periodical').'</a>'. |
---|
59 | ' › '.__('Settings'). |
---|
60 | ' - <a class="button" href="'.$p_url.'&part=addperiod">'.__('New period').'</a>'. |
---|
61 | '</h2>'.$msg.' |
---|
62 | |
---|
63 | <form method="post" action="plugin.php"> |
---|
64 | <fieldset><legend>'.__('Extension').'</legend> |
---|
65 | <p class="field"><label>'. |
---|
66 | form::checkbox(array('s_active'),'1',$s_active).' '. |
---|
67 | __('Enable extension').'</label></p> |
---|
68 | </fieldset> |
---|
69 | <fieldset><legend>'.__('Dates of published entries').'</legend> |
---|
70 | <p class="field"><label>'. |
---|
71 | form::checkbox(array('s_upddate'),'1',$s_upddate).' '. |
---|
72 | __('Update post date').'</label></p> |
---|
73 | <p class="field"><label>'. |
---|
74 | form::checkbox(array('s_updurl'),'1',$s_updurl).' '. |
---|
75 | __('Update post url').'</label></p> |
---|
76 | </fieldset> |
---|
77 | <fieldset><legend>'.__('Order of publication of entries').'</legend> |
---|
78 | <p class="field"><label>'.__('Order by:'). |
---|
79 | form::combo('s_sortby',$sortby_combo,$s_sortby).'</label></p> |
---|
80 | <p class="field"><label>'.__('Sort:'). |
---|
81 | form::combo('s_order',$order_combo,$s_order).'</label></p> |
---|
82 | </fieldset> |
---|
83 | <div class="clear"> |
---|
84 | <p><input type="submit" name="save" value="'.__('save').'" />'. |
---|
85 | $core->formNonce(). |
---|
86 | form::hidden(array('p'),'periodical'). |
---|
87 | form::hidden(array('part'),'setting'). |
---|
88 | form::hidden(array('action'),'savesetting').' |
---|
89 | </p></div> |
---|
90 | </form>'; |
---|
91 | ?> |
---|