1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of zoneclearFeedServer, a plugin for Dotclear 2. |
---|
4 | # |
---|
5 | # Copyright (c) 2009-2011 JC Denis, BG 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 | $active = (boolean) $s->zoneclearFeedServer_active; |
---|
16 | $pub_active = (boolean) $s->zoneclearFeedServer_pub_active; |
---|
17 | $post_status_new = (boolean) $s->zoneclearFeedServer_post_status_new; |
---|
18 | $bhv_pub_upd = (integer) $s->zoneclearFeedServer_bhv_pub_upd; |
---|
19 | $update_limit = (integer) $s->zoneclearFeedServer_update_limit; |
---|
20 | if ($update_limit < 1) $update_limit = 10; |
---|
21 | $post_full_tpl = @unserialize($s->zoneclearFeedServer_post_full_tpl); |
---|
22 | if (!is_array($post_full_tpl)) $post_full_tpl = array(); |
---|
23 | $post_title_redir = @unserialize($s->zoneclearFeedServer_post_title_redir); |
---|
24 | if (!is_array($post_title_redir)) $post_title_redir = array(); |
---|
25 | $feeduser = (string) $s->zoneclearFeedServer_user; |
---|
26 | |
---|
27 | $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : ''; |
---|
28 | |
---|
29 | |
---|
30 | # --BEHAVIOR-- zonclearFeedServerSettingPrepend |
---|
31 | $core->callBehavior('zonclearFeedServerSettingPrepend',$core); |
---|
32 | |
---|
33 | |
---|
34 | if ($default_part == 'setting' && $action == 'savesetting') |
---|
35 | { |
---|
36 | try |
---|
37 | { |
---|
38 | $limit = abs((integer) $_POST['update_limit']); |
---|
39 | if ($limit < 1) $limit = 10; |
---|
40 | |
---|
41 | $s->put('zoneclearFeedServer_active',!empty($_POST['active'])); |
---|
42 | $s->put('zoneclearFeedServer_pub_active',!empty($_POST['pub_active'])); |
---|
43 | $s->put('zoneclearFeedServer_post_status_new',!empty($_POST['post_status_new'])); |
---|
44 | $s->put('zoneclearFeedServer_bhv_pub_upd',(integer) $_POST['bhv_pub_upd']); |
---|
45 | $s->put('zoneclearFeedServer_update_limit',$limit); |
---|
46 | $s->put('zoneclearFeedServer_post_full_tpl',serialize($_POST['post_full_tpl'])); |
---|
47 | $s->put('zoneclearFeedServer_post_title_redir',serialize($_POST['post_title_redir'])); |
---|
48 | $s->put('zoneclearFeedServer_user',(string) $_POST['feeduser']); |
---|
49 | |
---|
50 | $core->blog->triggerBlog(); |
---|
51 | |
---|
52 | http::redirect($p_url.'&part=setting&msg='.$action.'§ion='.$section); |
---|
53 | } |
---|
54 | catch (Exception $e) |
---|
55 | { |
---|
56 | $core->error->add($e->getMessage()); |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | $combo_admins = $zc->getAllBlogAdmins(); |
---|
61 | $combo_pubupd = array( |
---|
62 | __('disable') => 0, |
---|
63 | __('before display') => 1, |
---|
64 | __('after display') => 2, |
---|
65 | __('through Ajax') => 3 |
---|
66 | ); |
---|
67 | $combo_status = array( |
---|
68 | __('unpublished') => 0, |
---|
69 | __('published') => 1 |
---|
70 | ); |
---|
71 | |
---|
72 | $pub_page_url = $core->blog->url.$core->url->getBase('zoneclearFeedsPage'); |
---|
73 | |
---|
74 | echo ' |
---|
75 | <html> |
---|
76 | <head><title>'.__('Feeds server').'</title>'.$header. |
---|
77 | dcPage::jsColorPicker(). |
---|
78 | dcPage::jsLoad('index.php?pf=zoneclearFeedServer/js/setting.js'). |
---|
79 | "<script type=\"text/javascript\">\n//<![CDATA[\n". |
---|
80 | dcPage::jsVar('jcToolsBox.prototype.section',$section). |
---|
81 | "\n//]]>\n</script>\n"; |
---|
82 | |
---|
83 | |
---|
84 | # --BEHAVIOR-- zoneclearFeedServerSettingHead |
---|
85 | $core->callBehavior('zoneclearFeedServerSettingHead',$core); |
---|
86 | |
---|
87 | |
---|
88 | echo |
---|
89 | '</head> |
---|
90 | <body> |
---|
91 | <h2>'.html::escapeHTML($core->blog->name). |
---|
92 | ' › <a href="'.$p_url.'&part=feeds">'.__('Feeds').'</a>'. |
---|
93 | ' › '.__('Settings'). |
---|
94 | ' - <a class="button" href="'.$p_url.'&part=feed">'.__('New feed').'</a>'. |
---|
95 | '</h2>'.$msg.' |
---|
96 | <form id="setting-form" method="post" action="'.$p_url.'"> |
---|
97 | |
---|
98 | <fieldset id="setting-plugin"><legend>'. __('Plugin activation').'</legend> |
---|
99 | <p class="field"><label>'. |
---|
100 | form::checkbox(array('active'),'1',$active). |
---|
101 | __('Enable plugin').'</label></p> |
---|
102 | </fieldset> |
---|
103 | |
---|
104 | <fieldset id="setting-option"><legend>'. __('General rules').'</legend> |
---|
105 | <div class="two-cols"><div class="col"> |
---|
106 | <p class="field"><label>'. |
---|
107 | __('Status of new posts:').'<br />'. |
---|
108 | form::combo(array('post_status_new'),$combo_status,$post_status_new).'</label></p> |
---|
109 | <p class="field"><label>'. |
---|
110 | __('Owner of entries created by zoneclearFeedServer:').'<br />'. |
---|
111 | form::combo(array('feeduser'),$combo_admins,$feeduser).'</label></p> |
---|
112 | <p class="field"><label>'. |
---|
113 | __('Update feeds on public side:').'<br />'. |
---|
114 | form::combo(array('bhv_pub_upd'),$combo_pubupd,$bhv_pub_upd).'</label></p> |
---|
115 | <p class="field"><label>'. |
---|
116 | __('Number of feeds to update at one time:').'<br />'. |
---|
117 | form::field('update_limit',6,4,$update_limit).'</label></p> |
---|
118 | <p class="field"><label>'. |
---|
119 | form::checkbox(array('pub_active'),'1',$pub_active). |
---|
120 | __('Enable public page').'</label></p>'; |
---|
121 | if (!is_writable(DC_TPL_CACHE)) { |
---|
122 | echo '<p class="error">'.__('Dotclear cache is not writable or not well configured!').'</p>'; |
---|
123 | } |
---|
124 | echo ' |
---|
125 | </div><div class="col"> |
---|
126 | <h3>'.__('Information').'</h3> |
---|
127 | <ul> |
---|
128 | <li>'.__('A writable cache folder is required to use this extension.').'</li> |
---|
129 | <li>'.__('If you set a large number of feeds to update at one time, this may cause a timeout error. We recommand to keep it to one.').'</li> |
---|
130 | <li>'.__('If you use cron script, you can disable public update.').'</li> |
---|
131 | <li>'.sprintf(__('If active, a public list of feeds are available at "%s".'),'<a href="'.$pub_page_url.'">'.$pub_page_url.'</a>').'</li> |
---|
132 | <li>'.__('In order to do update through Ajax, your theme must have behavior publicHeadContent.').'</li> |
---|
133 | </ul> |
---|
134 | </div></div> |
---|
135 | </fieldset>'; |
---|
136 | |
---|
137 | # --BEHAVIOR-- zonclearFeedServerAdminForm |
---|
138 | $core->callBehavior('zonclearFeedServerAdminForm',$core); |
---|
139 | |
---|
140 | echo ' |
---|
141 | <fieldset id="setting-display"><legend>'. __('Display').'</legend> |
---|
142 | <div class="two-cols"><div class="col"> |
---|
143 | <h3>'.__('Entries').'</h3> |
---|
144 | <p>'.__('Show full content on:').'</p>'; |
---|
145 | |
---|
146 | foreach($zc->getPublicUrlTypes($core) as $k => $v) |
---|
147 | { |
---|
148 | echo |
---|
149 | '<p class="field"><label>'. |
---|
150 | form::checkbox(array('post_full_tpl[]'),$v,in_array($v,$post_full_tpl)). |
---|
151 | __($k).'</label></p>'; |
---|
152 | } |
---|
153 | echo ' |
---|
154 | </div><div class="col"> |
---|
155 | <h3>'.__('Entries title').'</h3> |
---|
156 | <p>'.__('Redirect to original post on:').'</p>'; |
---|
157 | |
---|
158 | foreach($zc->getPublicUrlTypes($core) as $k => $v) |
---|
159 | { |
---|
160 | echo |
---|
161 | '<p class="field"><label>'. |
---|
162 | form::checkbox(array('post_title_redir[]'),$v,in_array($v,$post_title_redir)). |
---|
163 | __($k).'</label></p>'; |
---|
164 | } |
---|
165 | echo ' |
---|
166 | </div></div> |
---|
167 | </fieldset> |
---|
168 | |
---|
169 | <div class="clear"> |
---|
170 | <p><input type="submit" name="save" value="'.__('save').'" />'. |
---|
171 | $core->formNonce(). |
---|
172 | form::hidden(array('p'),'zoneclearFeedServer'). |
---|
173 | form::hidden(array('part'),'setting'). |
---|
174 | form::hidden(array('action'),'savesetting').' |
---|
175 | </p></div> |
---|
176 | </form>'; |
---|
177 | |
---|
178 | dcPage::helpBlock('zoneclearFeedServer'); |
---|
179 | echo $footer.'</body></html>'; |
---|
180 | ?> |
---|