1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2013 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 | $standalone = !isset($edit_blog_mode); |
---|
14 | |
---|
15 | $blog_id = false; |
---|
16 | |
---|
17 | if ($standalone) |
---|
18 | { |
---|
19 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
---|
20 | dcPage::check('admin'); |
---|
21 | $blog_id = $core->blog->id; |
---|
22 | $blog_status = $core->blog->status; |
---|
23 | $blog_name = $core->blog->name; |
---|
24 | $blog_desc = $core->blog->desc; |
---|
25 | $blog_settings = $core->blog->settings; |
---|
26 | $blog_url = $core->blog->url; |
---|
27 | |
---|
28 | $action = 'blog_pref.php'; |
---|
29 | $redir = 'blog_pref.php?upd=1'; |
---|
30 | } |
---|
31 | else |
---|
32 | { |
---|
33 | dcPage::checkSuper(); |
---|
34 | try |
---|
35 | { |
---|
36 | if (empty($_REQUEST['id'])) { |
---|
37 | throw new Exception(__('No given blog id.')); |
---|
38 | } |
---|
39 | $rs = $core->getBlog($_REQUEST['id']); |
---|
40 | |
---|
41 | if (!$rs) { |
---|
42 | throw new Exception(__('No such blog.')); |
---|
43 | } |
---|
44 | |
---|
45 | $blog_id = $rs->blog_id; |
---|
46 | $blog_status = $rs->blog_status; |
---|
47 | $blog_name = $rs->blog_name; |
---|
48 | $blog_desc = $rs->blog_desc; |
---|
49 | $blog_settings = new dcSettings($core,$blog_id); |
---|
50 | $blog_url = $rs->blog_url ; |
---|
51 | } |
---|
52 | catch (Exception $e) |
---|
53 | { |
---|
54 | $core->error->add($e->getMessage()); |
---|
55 | } |
---|
56 | |
---|
57 | $action = 'blog.php'; |
---|
58 | $redir = 'blog.php?id=%s&upd=1'; |
---|
59 | } |
---|
60 | |
---|
61 | # Language codes |
---|
62 | $langs = l10n::getISOcodes(1,1); |
---|
63 | foreach ($langs as $k => $v) { |
---|
64 | $lang_avail = $v == 'en' || is_dir(DC_L10N_ROOT.'/'.$v); |
---|
65 | $lang_combo[] = new formSelectOption($k,$v,$lang_avail ? 'avail10n' : ''); |
---|
66 | } |
---|
67 | |
---|
68 | # Status combo |
---|
69 | foreach ($core->getAllBlogStatus() as $k => $v) { |
---|
70 | $status_combo[$v] = (string) $k; |
---|
71 | } |
---|
72 | |
---|
73 | # URL scan modes |
---|
74 | $url_scan_combo = array( |
---|
75 | 'PATH_INFO' => 'path_info', |
---|
76 | 'QUERY_STRING' => 'query_string' |
---|
77 | ); |
---|
78 | |
---|
79 | # Post URL combo |
---|
80 | $post_url_combo = array( |
---|
81 | __('year/month/day/title') => '{y}/{m}/{d}/{t}', |
---|
82 | __('year/month/title') => '{y}/{m}/{t}', |
---|
83 | __('year/title') => '{y}/{t}', |
---|
84 | __('title') => '{t}', |
---|
85 | __('post id/title') => '{id}/{t}', |
---|
86 | __('post id') => '{id}' |
---|
87 | ); |
---|
88 | if (!in_array($blog_settings->system->post_url_format,$post_url_combo)) { |
---|
89 | $post_url_combo[html::escapeHTML($blog_settings->system->post_url_format)] = html::escapeHTML($blog_settings->system->post_url_format); |
---|
90 | } |
---|
91 | |
---|
92 | # Note title tag combo |
---|
93 | $note_title_tag_combo = array( |
---|
94 | __('H4') => 0, |
---|
95 | __('H3') => 1, |
---|
96 | __('P') => 2 |
---|
97 | ); |
---|
98 | |
---|
99 | # Image title combo |
---|
100 | $img_title_combo = array( |
---|
101 | __('(none)') => '', |
---|
102 | __('Title') => 'Title ;; separator(, )', |
---|
103 | __('Title, Date') => 'Title ;; Date(%b %Y) ;; separator(, )', |
---|
104 | __('Title, Country, Date') => 'Title ;; Country ;; Date(%b %Y) ;; separator(, )', |
---|
105 | __('Title, City, Country, Date') => 'Title ;; City ;; Country ;; Date(%b %Y) ;; separator(, )', |
---|
106 | ); |
---|
107 | if (!in_array($blog_settings->system->media_img_title_pattern,$img_title_combo)) { |
---|
108 | $img_title_combo[html::escapeHTML($blog_settings->system->media_img_title_pattern)] = html::escapeHTML($blog_settings->system->media_img_title_pattern); |
---|
109 | } |
---|
110 | |
---|
111 | # Image default size combo |
---|
112 | $img_default_size_combo = array(); |
---|
113 | try { |
---|
114 | $media = new dcMedia($core); |
---|
115 | $img_default_size_combo[__('original')] = 'o'; |
---|
116 | foreach ($media->thumb_sizes as $code => $size) { |
---|
117 | $img_default_size_combo[__($size[2])] = $code; |
---|
118 | } |
---|
119 | } catch (Exception $e) { |
---|
120 | $core->error->add($e->getMessage()); |
---|
121 | } |
---|
122 | |
---|
123 | # Image default alignment combo |
---|
124 | $img_default_alignment_combo = array( |
---|
125 | __('None') => 'none', |
---|
126 | __('Left') => 'left', |
---|
127 | __('Right') => 'right', |
---|
128 | __('Center') => 'center' |
---|
129 | ); |
---|
130 | |
---|
131 | # Robots policy options |
---|
132 | $robots_policy_options = array( |
---|
133 | 'INDEX,FOLLOW' => __("I would like search engines and archivers to index and archive my blog's content."), |
---|
134 | 'INDEX,FOLLOW,NOARCHIVE' => __("I would like search engines and archivers to index but not archive my blog's content."), |
---|
135 | 'NOINDEX,NOFOLLOW,NOARCHIVE' => __("I would like to prevent search engines and archivers from indexing or archiving my blog's content."), |
---|
136 | ); |
---|
137 | |
---|
138 | # Update a blog |
---|
139 | if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id)) |
---|
140 | { |
---|
141 | $cur = $core->con->openCursor($core->prefix.'blog'); |
---|
142 | if ($core->auth->isSuperAdmin()) { |
---|
143 | $cur->blog_id = $_POST['blog_id']; |
---|
144 | $cur->blog_url = preg_replace('/\?+$/','?',$_POST['blog_url']); |
---|
145 | if (in_array($_POST['blog_status'],$status_combo)) { |
---|
146 | $cur->blog_status = (integer) $_POST['blog_status']; |
---|
147 | } |
---|
148 | } |
---|
149 | $cur->blog_name = $_POST['blog_name']; |
---|
150 | $cur->blog_desc = $_POST['blog_desc']; |
---|
151 | |
---|
152 | $media_img_t_size = abs((integer) $_POST['media_img_t_size']); |
---|
153 | if ($media_img_t_size < 0) { $media_img_t_size = 100; } |
---|
154 | |
---|
155 | $media_img_s_size = abs((integer) $_POST['media_img_s_size']); |
---|
156 | if ($media_img_s_size < 0) { $media_img_s_size = 240; } |
---|
157 | |
---|
158 | $media_img_m_size = abs((integer) $_POST['media_img_m_size']); |
---|
159 | if ($media_img_m_size < 0) { $media_img_m_size = 448; } |
---|
160 | |
---|
161 | $nb_post_per_page = abs((integer) $_POST['nb_post_per_page']); |
---|
162 | if ($nb_post_per_page <= 1) { $nb_post_per_page = 1; } |
---|
163 | |
---|
164 | $nb_post_per_feed = abs((integer) $_POST['nb_post_per_feed']); |
---|
165 | if ($nb_post_per_feed <= 1) { $nb_post_per_feed = 1; } |
---|
166 | |
---|
167 | $nb_comment_per_feed = abs((integer) $_POST['nb_comment_per_feed']); |
---|
168 | if ($nb_comment_per_feed <= 1) { $nb_comment_per_feed = 1; } |
---|
169 | |
---|
170 | try |
---|
171 | { |
---|
172 | if ($cur->blog_id != null && $cur->blog_id != $blog_id) { |
---|
173 | $rs = $core->getBlog($cur->blog_id); |
---|
174 | |
---|
175 | if ($rs) { |
---|
176 | throw new Exception(__('This blog ID is already used.')); |
---|
177 | } |
---|
178 | } |
---|
179 | |
---|
180 | # --BEHAVIOR-- adminBeforeBlogUpdate |
---|
181 | $core->callBehavior('adminBeforeBlogUpdate',$cur,$blog_id); |
---|
182 | |
---|
183 | if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_POST['lang'])) { |
---|
184 | throw new Exception(__('Invalid language code')); |
---|
185 | } |
---|
186 | |
---|
187 | $core->updBlog($blog_id,$cur); |
---|
188 | |
---|
189 | # --BEHAVIOR-- adminAfterBlogUpdate |
---|
190 | $core->callBehavior('adminAfterBlogUpdate',$cur,$blog_id); |
---|
191 | |
---|
192 | if ($cur->blog_id != null && $cur->blog_id != $blog_id) { |
---|
193 | if ($blog_id == $core->blog->id) { |
---|
194 | $core->setBlog($cur->blog_id); |
---|
195 | $_SESSION['sess_blog_id'] = $cur->blog_id; |
---|
196 | $blog_settings = $core->blog->settings; |
---|
197 | } else { |
---|
198 | $blog_settings = new dcSettings($core,$cur->blog_id); |
---|
199 | } |
---|
200 | |
---|
201 | $blog_id = $cur->blog_id; |
---|
202 | } |
---|
203 | |
---|
204 | |
---|
205 | $blog_settings->addNameSpace('system'); |
---|
206 | |
---|
207 | $blog_settings->system->put('editor',$_POST['editor']); |
---|
208 | $blog_settings->system->put('copyright_notice',$_POST['copyright_notice']); |
---|
209 | $blog_settings->system->put('post_url_format',$_POST['post_url_format']); |
---|
210 | $blog_settings->system->put('lang',$_POST['lang']); |
---|
211 | $blog_settings->system->put('blog_timezone',$_POST['blog_timezone']); |
---|
212 | $blog_settings->system->put('date_format',$_POST['date_format']); |
---|
213 | $blog_settings->system->put('time_format',$_POST['time_format']); |
---|
214 | $blog_settings->system->put('comments_ttl',abs((integer) $_POST['comments_ttl'])); |
---|
215 | $blog_settings->system->put('trackbacks_ttl',abs((integer) $_POST['trackbacks_ttl'])); |
---|
216 | $blog_settings->system->put('allow_comments',!empty($_POST['allow_comments'])); |
---|
217 | $blog_settings->system->put('allow_trackbacks',!empty($_POST['allow_trackbacks'])); |
---|
218 | $blog_settings->system->put('comments_pub',empty($_POST['comments_pub'])); |
---|
219 | $blog_settings->system->put('trackbacks_pub',empty($_POST['trackbacks_pub'])); |
---|
220 | $blog_settings->system->put('comments_nofollow',!empty($_POST['comments_nofollow'])); |
---|
221 | $blog_settings->system->put('wiki_comments',!empty($_POST['wiki_comments'])); |
---|
222 | $blog_settings->system->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc'])); |
---|
223 | $blog_settings->system->put('note_title_tag',$_POST['note_title_tag']); |
---|
224 | |
---|
225 | $blog_settings->system->put('nb_post_per_page',$nb_post_per_page); |
---|
226 | $blog_settings->system->put('use_smilies',!empty($_POST['use_smilies'])); |
---|
227 | $blog_settings->system->put('media_img_t_size',$media_img_t_size); |
---|
228 | $blog_settings->system->put('media_img_s_size',$media_img_s_size); |
---|
229 | $blog_settings->system->put('media_img_m_size',$media_img_m_size); |
---|
230 | $blog_settings->system->put('media_img_title_pattern',$_POST['media_img_title_pattern']); |
---|
231 | $blog_settings->system->put('media_img_use_dto_first',!empty($_POST['media_img_use_dto_first'])); |
---|
232 | $blog_settings->system->put('media_img_default_size',$_POST['media_img_default_size']); |
---|
233 | $blog_settings->system->put('media_img_default_alignment',$_POST['media_img_default_alignment']); |
---|
234 | $blog_settings->system->put('media_img_default_link',!empty($_POST['media_img_default_link'])); |
---|
235 | $blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed); |
---|
236 | $blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed); |
---|
237 | $blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items'])); |
---|
238 | |
---|
239 | if (isset($_POST['robots_policy'])) { |
---|
240 | $blog_settings->system->put('robots_policy',$_POST['robots_policy']); |
---|
241 | } |
---|
242 | |
---|
243 | # --BEHAVIOR-- adminBeforeBlogSettingsUpdate |
---|
244 | $core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings); |
---|
245 | |
---|
246 | if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) { |
---|
247 | $blog_settings->system->put('url_scan',$_POST['url_scan']); |
---|
248 | } |
---|
249 | |
---|
250 | http::redirect(sprintf($redir,$blog_id)); |
---|
251 | } |
---|
252 | catch (Exception $e) |
---|
253 | { |
---|
254 | $core->error->add($e->getMessage()); |
---|
255 | } |
---|
256 | } |
---|
257 | |
---|
258 | if ($standalone) { |
---|
259 | $breadcrumb = dcPage::breadcrumb( |
---|
260 | array( |
---|
261 | html::escapeHTML($blog_name) => '', |
---|
262 | '<span class="page-title">'.__('Blog settings').'</span>' => '' |
---|
263 | )); |
---|
264 | } else { |
---|
265 | $breadcrumb = dcPage::breadcrumb( |
---|
266 | array( |
---|
267 | __('System') => '', |
---|
268 | __('Blogs') => 'blogs.php', |
---|
269 | '<span class="page-title">'.__('Blog settings').' : '.html::escapeHTML($blog_name).'</span>' => '' |
---|
270 | )); |
---|
271 | } |
---|
272 | |
---|
273 | dcPage::open(__('Blog settings'), |
---|
274 | '<script type="text/javascript">'."\n". |
---|
275 | "//<![CDATA["."\n". |
---|
276 | dcPage::jsVar('dotclear.msg.warning_path_info', |
---|
277 | __('Warning: except for special configurations, it is generally advised to have a trailing "/" in your blog URL in PATH_INFO mode.'))."\n". |
---|
278 | dcPage::jsVar('dotclear.msg.warning_query_string', |
---|
279 | __('Warning: except for special configurations, it is generally advised to have a trailing "?" in your blog URL in QUERY_STRING mode.'))."\n". |
---|
280 | "//]]>". |
---|
281 | "</script>". |
---|
282 | dcPage::jsConfirmClose('blog-form'). |
---|
283 | dcPage::jsLoad('js/_blog_pref.js'). |
---|
284 | |
---|
285 | |
---|
286 | # --BEHAVIOR-- adminBlogPreferencesHeaders |
---|
287 | $core->callBehavior('adminBlogPreferencesHeaders'). |
---|
288 | |
---|
289 | dcPage::jsPageTabs(), |
---|
290 | $breadcrumb |
---|
291 | ); |
---|
292 | |
---|
293 | if ($blog_id) |
---|
294 | { |
---|
295 | if (!empty($_GET['add'])) { |
---|
296 | dcPage::success(__('Blog has been successfully created.')); |
---|
297 | } |
---|
298 | |
---|
299 | if (!empty($_GET['upd'])) { |
---|
300 | dcPage::success(__('Blog has been successfully updated.')); |
---|
301 | } |
---|
302 | |
---|
303 | echo |
---|
304 | '<div class="multi-part" id="params" title="'.__('Parameters').'">'. |
---|
305 | '<h3>'.__('Parameters').'</h3>'. |
---|
306 | '<form action="'.$action.'" method="post" id="blog-form">'; |
---|
307 | |
---|
308 | echo |
---|
309 | '<div class="fieldset"><h4>'.__('Blog details').'</h4>'. |
---|
310 | $core->formNonce(); |
---|
311 | |
---|
312 | if ($core->auth->isSuperAdmin()) |
---|
313 | { |
---|
314 | echo |
---|
315 | '<p><label for="blog_id" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:').'</label>'. |
---|
316 | form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</p>'. |
---|
317 | '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '. |
---|
318 | '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>'; |
---|
319 | } |
---|
320 | |
---|
321 | echo |
---|
322 | '<p><label for="blog_name" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label>'. |
---|
323 | form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>'; |
---|
324 | |
---|
325 | if ($core->auth->isSuperAdmin()) |
---|
326 | { |
---|
327 | echo |
---|
328 | '<p><label for="blog_url" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label>'. |
---|
329 | form::field('blog_url',30,255,html::escapeHTML($blog_url)).'</p>'. |
---|
330 | |
---|
331 | '<p><label for="url_scan">'.__('URL scan method:').'</label>'. |
---|
332 | form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</p>'. |
---|
333 | |
---|
334 | '<p><label for="blog_status">'.__('Blog status:').'</label>'. |
---|
335 | form::combo('blog_status',$status_combo,$blog_status).'</p>'; |
---|
336 | } |
---|
337 | |
---|
338 | echo |
---|
339 | '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label>'. |
---|
340 | form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'. |
---|
341 | '</div>'; |
---|
342 | |
---|
343 | |
---|
344 | echo |
---|
345 | '<div class="fieldset"><h4>'.__('Blog configuration').'</h4>'. |
---|
346 | '<div class="two-cols">'. |
---|
347 | '<div class="col">'. |
---|
348 | '<p><label for="editor">'.__('Blog editor name:').'</label>'. |
---|
349 | form::field('editor',30,255,html::escapeHTML($blog_settings->system->editor)). |
---|
350 | '</p>'. |
---|
351 | |
---|
352 | '<p><label for="lang">'.__('Default language:').'</label>'. |
---|
353 | form::combo('lang',$lang_combo,$blog_settings->system->lang,'l10n'). |
---|
354 | '</p>'. |
---|
355 | |
---|
356 | '<p><label for="blog_timezone">'.__('Blog timezone:').'</label>'. |
---|
357 | form::combo('blog_timezone',dt::getZones(true,true),html::escapeHTML($blog_settings->system->blog_timezone)). |
---|
358 | '</p>'. |
---|
359 | |
---|
360 | '<p><label for="copyright_notice">'.__('Copyright notice:').'</label>'. |
---|
361 | form::field('copyright_notice',30,255,html::escapeHTML($blog_settings->system->copyright_notice)). |
---|
362 | '</p>'. |
---|
363 | '</div>'. |
---|
364 | |
---|
365 | '<div class="col">'. |
---|
366 | '<p><label for="post_url_format">'.__('New post URL format:').'</label>'. |
---|
367 | form::combo('post_url_format',$post_url_combo,html::escapeHTML($blog_settings->system->post_url_format)). |
---|
368 | '</p>'. |
---|
369 | |
---|
370 | '<p><label for="note_title_tag">'.__('Note title HTML tag:').'</label>'. |
---|
371 | form::combo('note_title_tag',$note_title_tag_combo,$blog_settings->system->note_title_tag). |
---|
372 | '</p>'. |
---|
373 | |
---|
374 | '<p><label for="enable_xmlrpc" class="classic">'.'</label>'. |
---|
375 | form::checkbox('enable_xmlrpc','1',$blog_settings->system->enable_xmlrpc). |
---|
376 | __('Enable XML/RPC interface').'</p>'; |
---|
377 | |
---|
378 | echo |
---|
379 | '<p class="form-note">'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>'; |
---|
380 | |
---|
381 | if ($blog_settings->system->enable_xmlrpc) { |
---|
382 | echo |
---|
383 | '<p>'.__('XML/RPC interface is active. You should set the following parameters on your XML/RPC client:').'</p>'. |
---|
384 | '<ul>'. |
---|
385 | '<li>'.__('Server URL:').' <strong><code>'. |
---|
386 | sprintf(DC_XMLRPC_URL,$core->blog->url,$core->blog->id). |
---|
387 | '</code></strong></li>'. |
---|
388 | '<li>'.__('Blogging system:').' <strong><code>Movable Type</code></strong></li>'. |
---|
389 | '<li>'.__('User name:').' <strong><code>'.$core->auth->userID().'</code></strong></li>'. |
---|
390 | '<li>'.__('Password:').' <strong><code><'.__('your password').'></code></strong></li>'. |
---|
391 | '<li>'.__('Blog ID:').' <strong><code>1</code></strong></li>'. |
---|
392 | '</ul>'; |
---|
393 | } |
---|
394 | |
---|
395 | echo |
---|
396 | '</div>'. |
---|
397 | '</div>'. |
---|
398 | '<br class="clear" />'. //Opera sucks |
---|
399 | '</div>'; |
---|
400 | |
---|
401 | echo |
---|
402 | '<div class="fieldset"><h4>'.__('Comments and trackbacks').'</h4>'. |
---|
403 | |
---|
404 | '<div class="two-cols">'. |
---|
405 | |
---|
406 | '<div class="col">'. |
---|
407 | '<p><label for="allow_comments" class="classic">'. |
---|
408 | form::checkbox('allow_comments','1',$blog_settings->system->allow_comments). |
---|
409 | __('Accept comments').'</label></p>'. |
---|
410 | '<p><label for="comments_pub" class="classic">'. |
---|
411 | form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub). |
---|
412 | __('Moderate comments').'</label></p>'. |
---|
413 | '<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days'), |
---|
414 | form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)). |
---|
415 | '</label></p>'. |
---|
416 | '<p class="form-note">'.__('Leave blank to disable this feature.').'</p>'. |
---|
417 | '<p><label for="wiki_comments" class="classic">'. |
---|
418 | form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments). |
---|
419 | __('Wiki syntax for comments').'</label></p>'. |
---|
420 | '</div>'. |
---|
421 | |
---|
422 | '<div class="col">'. |
---|
423 | '<p><label for="allow_trackbacks" class="classic">'. |
---|
424 | form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks). |
---|
425 | __('Accept trackbacks').'</label></p>'. |
---|
426 | '<p><label for="trackbacks_pub" class="classic">'. |
---|
427 | form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub). |
---|
428 | __('Moderate trackbacks').'</label></p>'. |
---|
429 | '<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days'), |
---|
430 | form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'. |
---|
431 | '<p class="form-note">'.__('Leave blank to disable this feature.').'</p>'. |
---|
432 | '<p><label for="comments_nofollow" class="classic">'. |
---|
433 | form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow). |
---|
434 | __('Add "nofollow" relation on comments and trackbacks links').'</label></p>'. |
---|
435 | '</div>'. |
---|
436 | '<br class="clear" />'. //Opera sucks |
---|
437 | |
---|
438 | '</div>'. |
---|
439 | '<br class="clear" />'. //Opera sucks |
---|
440 | '</div>'; |
---|
441 | |
---|
442 | echo |
---|
443 | '<div class="fieldset"><h4>'.__('Blog presentation').'</h4>'. |
---|
444 | '<div class="two-cols">'. |
---|
445 | '<div class="col">'. |
---|
446 | '<p><label for="date_format">'.__('Date format:').'</label>'. |
---|
447 | form::field('date_format',30,255,html::escapeHTML($blog_settings->system->date_format)). |
---|
448 | '</p>'. |
---|
449 | |
---|
450 | '<p><label for="time_format">'.__('Time format:').'</label>'. |
---|
451 | form::field('time_format',30,255,html::escapeHTML($blog_settings->system->time_format)). |
---|
452 | '</p>'. |
---|
453 | |
---|
454 | '<p><label for="use_smilies" class="classic">'. |
---|
455 | form::checkbox('use_smilies','1',$blog_settings->system->use_smilies). |
---|
456 | __('Display smilies on entries and comments').'</label></p>'. |
---|
457 | '</div>'. |
---|
458 | |
---|
459 | '<div class="col">'. |
---|
460 | '<p><label for="nb_post_per_page" class="classic">'.sprintf(__('Display %s entries per page'), |
---|
461 | form::field('nb_post_per_page',2,3,$blog_settings->system->nb_post_per_page)). |
---|
462 | '</label></p>'. |
---|
463 | |
---|
464 | '<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'), |
---|
465 | form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)). |
---|
466 | '</label></p>'. |
---|
467 | |
---|
468 | '<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'), |
---|
469 | form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)). |
---|
470 | '</label></p>'. |
---|
471 | |
---|
472 | '<p><label for="short_feed_items" class="classic">'. |
---|
473 | form::checkbox('short_feed_items','1',$blog_settings->system->short_feed_items). |
---|
474 | __('Truncate feeds').'</label></p>'. |
---|
475 | '</div>'. |
---|
476 | '</div>'. |
---|
477 | '<br class="clear" />'. //Opera sucks |
---|
478 | '</div>'; |
---|
479 | |
---|
480 | echo |
---|
481 | '<div class="fieldset"><h4>'.__('Media and images').'</h4>'. |
---|
482 | '<div class="two-cols">'. |
---|
483 | '<div class="col">'. |
---|
484 | '<h5>'.__('Generated image sizes (in pixels)').'</h5>'. |
---|
485 | '<p class="field"><label for="media_img_t_size">'.__('Thumbnails:').' '. |
---|
486 | form::field('media_img_t_size',3,3,$blog_settings->system->media_img_t_size).'</label></p>'. |
---|
487 | |
---|
488 | '<p class="field"><label for="media_img_s_size">'.__('Small:').' '. |
---|
489 | form::field('media_img_s_size',3,3,$blog_settings->system->media_img_s_size).'</label></p>'. |
---|
490 | |
---|
491 | '<p class="field"><label for="media_img_m_size">'.__('Medium:').' '. |
---|
492 | form::field('media_img_m_size',3,3,$blog_settings->system->media_img_m_size).'</label></p>'. |
---|
493 | '</div>'. |
---|
494 | |
---|
495 | '<div class="col">'. |
---|
496 | '<h5><label for="media_img_title_pattern">'.__('Inserted image title').'</label></h5>'. |
---|
497 | '<p>'.__('This defines image tag title when you insert it in a post from the media manager. It is retrieved from the picture\'s metadata.').'</p>'. |
---|
498 | '<p>'.form::combo('media_img_title_pattern',$img_title_combo,html::escapeHTML($blog_settings->system->media_img_title_pattern)).'</p>'. |
---|
499 | '<p><label for="media_img_use_dto_first" class="classic">'. |
---|
500 | form::checkbox('media_img_use_dto_first','1',$blog_settings->system->media_img_use_dto_first). |
---|
501 | __('Use original media date if possible').'</label></p>'. |
---|
502 | |
---|
503 | '<h5>'.__('Default image insertion attributes').'</h5>'. |
---|
504 | '<p><label for="media_img_default_size">'.__('Image size:').'</label>'. |
---|
505 | form::combo('media_img_default_size',$img_default_size_combo, |
---|
506 | (html::escapeHTML($blog_settings->system->media_img_default_size) != '' ? html::escapeHTML($blog_settings->system->media_img_default_size) : 'm')). |
---|
507 | '</p>'. |
---|
508 | '<p><label for="media_img_default_alignment">'.__('Image alignment:').'</label>'. |
---|
509 | form::combo('media_img_default_alignment',$img_default_alignment_combo,html::escapeHTML($blog_settings->system->media_img_default_alignment)). |
---|
510 | '</p>'. |
---|
511 | '<p><label for="media_img_default_link" class="classic">'. |
---|
512 | form::checkbox('media_img_default_link','1',$blog_settings->system->media_img_default_link). |
---|
513 | __('As a link to original image').'</label></p>'. |
---|
514 | '</div>'. |
---|
515 | '</div>'. |
---|
516 | '<br class="clear" />'. //Opera sucks |
---|
517 | |
---|
518 | '</div>'; |
---|
519 | |
---|
520 | echo |
---|
521 | '<div class="fieldset"><h4>'.__('Search engines robots policy').'</h4>'; |
---|
522 | |
---|
523 | $i = 0; |
---|
524 | foreach ($robots_policy_options as $k => $v) |
---|
525 | { |
---|
526 | echo '<p><label for="robots_policy-'.$i.'" class="classic">'. |
---|
527 | form::radio(array('robots_policy','robots_policy-'.$i),$k,$blog_settings->system->robots_policy == $k).' '.$v.'</label></p>'; |
---|
528 | $i++; |
---|
529 | } |
---|
530 | |
---|
531 | echo '</div>'; |
---|
532 | |
---|
533 | |
---|
534 | # --BEHAVIOR-- adminBlogPreferencesForm |
---|
535 | $core->callBehavior('adminBlogPreferencesForm',$core,$blog_settings); |
---|
536 | |
---|
537 | echo |
---|
538 | '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'. |
---|
539 | (!$standalone ? form::hidden('id',$blog_id) : ''). |
---|
540 | '</p>'. |
---|
541 | '</form>'; |
---|
542 | |
---|
543 | if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id) |
---|
544 | { |
---|
545 | echo |
---|
546 | '<form action="blog_del.php" method="post">'. |
---|
547 | '<p><input type="submit" class="delete" value="'.__('Delete this blog').'" />'. |
---|
548 | form::hidden(array('blog_id'),$blog_id). |
---|
549 | $core->formNonce().'</p>'. |
---|
550 | '</form>'; |
---|
551 | } else { |
---|
552 | if ($blog_id == $core->blog->id) { |
---|
553 | echo '<p class="message">'.__('The current blog cannot be deleted.').'</p>'; |
---|
554 | } else { |
---|
555 | echo '<p class="message">'.__('Only superadmin can delete a blog.').'</p>'; |
---|
556 | } |
---|
557 | } |
---|
558 | |
---|
559 | echo '</div>'; |
---|
560 | |
---|
561 | # |
---|
562 | # Users on the blog (with permissions) |
---|
563 | |
---|
564 | $blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin()); |
---|
565 | $perm_types = $core->auth->getPermissionsTypes(); |
---|
566 | |
---|
567 | echo |
---|
568 | '<div class="multi-part" id="users" title="'.__('Users').'">'. |
---|
569 | '<h3>'.__('Users on this blog').'</h3>'; |
---|
570 | |
---|
571 | if (empty($blog_users)) |
---|
572 | { |
---|
573 | echo '<p>'.__('No users').'</p>'; |
---|
574 | } |
---|
575 | else |
---|
576 | { |
---|
577 | if ($core->auth->isSuperAdmin()) { |
---|
578 | $user_url_p = '<a href="user.php?id=%1$s">%1$s</a>'; |
---|
579 | } else { |
---|
580 | $user_url_p = '%1$s'; |
---|
581 | } |
---|
582 | |
---|
583 | foreach ($blog_users as $k => $v) |
---|
584 | { |
---|
585 | if (count($v['p']) > 0) |
---|
586 | { |
---|
587 | echo |
---|
588 | '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). |
---|
589 | ' ('.html::escapeHTML(dcUtils::getUserCN( |
---|
590 | $k, $v['name'], $v['firstname'], $v['displayname'] |
---|
591 | )).')</h4>'; |
---|
592 | |
---|
593 | echo '<ul class="nice">'; |
---|
594 | if ($v['super']) { |
---|
595 | echo '<li>'.__('Super administrator').'</li>'; |
---|
596 | } else { |
---|
597 | foreach ($v['p'] as $p => $V) { |
---|
598 | echo '<li>'.__($perm_types[$p]).'</li>'; |
---|
599 | } |
---|
600 | } |
---|
601 | echo '</ul>'; |
---|
602 | |
---|
603 | if (!$v['super'] && $core->auth->isSuperAdmin()) { |
---|
604 | echo |
---|
605 | '<form action="users_actions.php" method="post">'. |
---|
606 | '<p><input type="submit" value="'.__('Change permissions').'" />'. |
---|
607 | form::hidden(array('redir'),'blog_pref.php?id='.$k). |
---|
608 | form::hidden(array('action'),'perms'). |
---|
609 | form::hidden(array('users[]'),$k). |
---|
610 | form::hidden(array('blogs[]'),$blog_id). |
---|
611 | $core->formNonce(). |
---|
612 | '</p>'. |
---|
613 | '</form>'; |
---|
614 | } |
---|
615 | } |
---|
616 | } |
---|
617 | } |
---|
618 | |
---|
619 | echo '</div>'; |
---|
620 | } |
---|
621 | |
---|
622 | dcPage::helpBlock('core_blog_pref'); |
---|
623 | dcPage::close(); |
---|
624 | ?> |
---|