Dotclear

source: admin/blog_pref.php @ 2799:b62c278ef730

Revision 2799:b62c278ef730, 27.2 KB checked in by franck <carnet.franck.paul@…>, 11 years ago (diff)

Add an option to not leave date alone in media title

Line 
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
17if ($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 = $core->adminurl->get("admin.blog.pref");
29     $redir = $core->adminurl->get("admin.blog.pref");
30}
31else
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 = $core->adminurl->get("admin.blog");
58     $redir = $core->adminurl->get("admin.blog",array('id' => "%s"));
59}
60
61# Language codes
62$lang_combo = dcAdminCombos::getAdminLangsCombo();
63
64# Status combo
65$status_combo = dcAdminCombos::getBlogStatusescombo();
66
67# Date format combo
68$now = time();
69$date_formats = unserialize($blog_settings->system->date_formats);
70$time_formats = unserialize($blog_settings->system->time_formats);
71$date_formats_combo = array('' => '');
72foreach ($date_formats as $format) {
73    $date_formats_combo[dt::str($format, $now)] = $format;
74}
75$time_formats_combo = array('' => '');
76foreach ($time_formats as $format) {
77    $time_formats_combo[dt::str($format, $now)] = $format;
78}
79
80
81# URL scan modes
82$url_scan_combo = array(
83     'PATH_INFO' => 'path_info',
84     'QUERY_STRING' => 'query_string'
85);
86
87# Post URL combo
88$post_url_combo = array(
89     __('year/month/day/title') => '{y}/{m}/{d}/{t}',
90     __('year/month/title') => '{y}/{m}/{t}',
91     __('year/title') => '{y}/{t}',
92     __('title') => '{t}',
93     __('post id/title') => '{id}/{t}',
94     __('post id') => '{id}'
95);
96if (!in_array($blog_settings->system->post_url_format,$post_url_combo)) {
97     $post_url_combo[html::escapeHTML($blog_settings->system->post_url_format)] = html::escapeHTML($blog_settings->system->post_url_format);
98}
99
100# Note title tag combo
101$note_title_tag_combo = array(
102     __('H4') => 0,
103     __('H3') => 1,
104     __('P') => 2
105);
106
107# Image title combo
108$img_title_combo = array(
109     __('(none)') => '',
110     __('Title') => 'Title ;; separator(, )',
111     __('Title, Date') => 'Title ;; Date(%b %Y) ;; separator(, )',
112     __('Title, Country, Date') => 'Title ;; Country ;; Date(%b %Y) ;; separator(, )',
113     __('Title, City, Country, Date') => 'Title ;; City ;; Country ;; Date(%b %Y) ;; separator(, )',
114);
115if (!in_array($blog_settings->system->media_img_title_pattern,$img_title_combo)) {
116     $img_title_combo[html::escapeHTML($blog_settings->system->media_img_title_pattern)] = html::escapeHTML($blog_settings->system->media_img_title_pattern);
117}
118
119# Image default size combo
120$img_default_size_combo = array();
121try {
122     $media = new dcMedia($core);
123     $img_default_size_combo[__('original')] = 'o';
124     foreach ($media->thumb_sizes as $code => $size) {
125          $img_default_size_combo[__($size[2])] = $code;
126     }
127} catch (Exception $e) {
128     $core->error->add($e->getMessage());
129}
130
131# Image default alignment combo
132$img_default_alignment_combo = array(
133     __('None') => 'none',
134     __('Left') => 'left',
135     __('Right') => 'right',
136     __('Center') => 'center'
137);
138
139# Robots policy options
140$robots_policy_options = array(
141     'INDEX,FOLLOW' => __("I would like search engines and archivers to index and archive my blog's content."),
142     'INDEX,FOLLOW,NOARCHIVE' => __("I would like search engines and archivers to index but not archive my blog's content."),
143     'NOINDEX,NOFOLLOW,NOARCHIVE' => __("I would like to prevent search engines and archivers from indexing or archiving my blog's content."),
144);
145
146# Update a blog
147if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id))
148{
149     $cur = $core->con->openCursor($core->prefix.'blog');
150     if ($core->auth->isSuperAdmin()) {
151          $cur->blog_id = $_POST['blog_id'];
152          $cur->blog_url = preg_replace('/\?+$/','?',$_POST['blog_url']);
153          if (in_array($_POST['blog_status'],$status_combo)) {
154               $cur->blog_status = (integer) $_POST['blog_status'];
155          }
156     }
157     $cur->blog_name = $_POST['blog_name'];
158     $cur->blog_desc = $_POST['blog_desc'];
159
160     $media_img_t_size = abs((integer) $_POST['media_img_t_size']);
161     if ($media_img_t_size < 0) { $media_img_t_size = 100; }
162
163     $media_img_s_size = abs((integer) $_POST['media_img_s_size']);
164     if ($media_img_s_size < 0) { $media_img_s_size = 240; }
165
166     $media_img_m_size = abs((integer) $_POST['media_img_m_size']);
167     if ($media_img_m_size < 0) { $media_img_m_size = 448; }
168
169     $nb_post_for_home = abs((integer) $_POST['nb_post_for_home']);
170     if ($nb_post_for_home <= 1) { $nb_post_for_home = 1; }
171
172     $nb_post_per_page = abs((integer) $_POST['nb_post_per_page']);
173     if ($nb_post_per_page <= 1) { $nb_post_per_page = 1; }
174
175     $nb_post_per_feed = abs((integer) $_POST['nb_post_per_feed']);
176     if ($nb_post_per_feed <= 1) { $nb_post_per_feed = 1; }
177
178     $nb_comment_per_feed = abs((integer) $_POST['nb_comment_per_feed']);
179     if ($nb_comment_per_feed <= 1) { $nb_comment_per_feed = 1; }
180
181     try
182     {
183          if ($cur->blog_id != null && $cur->blog_id != $blog_id) {
184               $rs = $core->getBlog($cur->blog_id);
185
186               if ($rs) {
187                    throw new Exception(__('This blog ID is already used.'));
188               }
189          }
190
191          # --BEHAVIOR-- adminBeforeBlogUpdate
192          $core->callBehavior('adminBeforeBlogUpdate',$cur,$blog_id);
193
194          if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_POST['lang'])) {
195               throw new Exception(__('Invalid language code'));
196          }
197
198          $core->updBlog($blog_id,$cur);
199
200          # --BEHAVIOR-- adminAfterBlogUpdate
201          $core->callBehavior('adminAfterBlogUpdate',$cur,$blog_id);
202
203          if ($cur->blog_id != null && $cur->blog_id != $blog_id) {
204               if ($blog_id == $core->blog->id) {
205                    $core->setBlog($cur->blog_id);
206                    $_SESSION['sess_blog_id'] = $cur->blog_id;
207                    $blog_settings = $core->blog->settings;
208               } else {
209                    $blog_settings = new dcSettings($core,$cur->blog_id);
210               }
211
212               $blog_id = $cur->blog_id;
213          }
214
215
216          $blog_settings->addNameSpace('system');
217
218          $blog_settings->system->put('editor',$_POST['editor']);
219          $blog_settings->system->put('copyright_notice',$_POST['copyright_notice']);
220          $blog_settings->system->put('post_url_format',$_POST['post_url_format']);
221          $blog_settings->system->put('lang',$_POST['lang']);
222          $blog_settings->system->put('blog_timezone',$_POST['blog_timezone']);
223          $blog_settings->system->put('date_format',$_POST['date_format']);
224          $blog_settings->system->put('time_format',$_POST['time_format']);
225          $blog_settings->system->put('comments_ttl',abs((integer) $_POST['comments_ttl']));
226          $blog_settings->system->put('trackbacks_ttl',abs((integer) $_POST['trackbacks_ttl']));
227          $blog_settings->system->put('allow_comments',!empty($_POST['allow_comments']));
228          $blog_settings->system->put('allow_trackbacks',!empty($_POST['allow_trackbacks']));
229          $blog_settings->system->put('comments_pub',empty($_POST['comments_pub']));
230          $blog_settings->system->put('trackbacks_pub',empty($_POST['trackbacks_pub']));
231          $blog_settings->system->put('comments_nofollow',!empty($_POST['comments_nofollow']));
232          $blog_settings->system->put('wiki_comments',!empty($_POST['wiki_comments']));
233          $blog_settings->system->put('comment_preview_optional',!empty($_POST['comment_preview_optional']));
234          $blog_settings->system->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc']));
235          $blog_settings->system->put('note_title_tag',$_POST['note_title_tag']);
236          $blog_settings->system->put('nb_post_for_home',$nb_post_for_home);
237          $blog_settings->system->put('nb_post_per_page',$nb_post_per_page);
238          $blog_settings->system->put('use_smilies',!empty($_POST['use_smilies']));
239          $blog_settings->system->put('inc_subcats',!empty($_POST['inc_subcats']));
240          $blog_settings->system->put('media_img_t_size',$media_img_t_size);
241          $blog_settings->system->put('media_img_s_size',$media_img_s_size);
242          $blog_settings->system->put('media_img_m_size',$media_img_m_size);
243          $blog_settings->system->put('media_img_title_pattern',$_POST['media_img_title_pattern']);
244          $blog_settings->system->put('media_img_use_dto_first',!empty($_POST['media_img_use_dto_first']));
245          $blog_settings->system->put('media_img_no_date_alone',!empty($_POST['media_img_no_date_alone']));
246          $blog_settings->system->put('media_img_default_size',$_POST['media_img_default_size']);
247          $blog_settings->system->put('media_img_default_alignment',$_POST['media_img_default_alignment']);
248          $blog_settings->system->put('media_img_default_link',!empty($_POST['media_img_default_link']));
249          $blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed);
250          $blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed);
251          $blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items']));
252          if (isset($_POST['robots_policy'])) {
253               $blog_settings->system->put('robots_policy',$_POST['robots_policy']);
254          }
255          $blog_settings->system->put('prevents_clickjacking',!empty($_POST['prevents_clickjacking']));
256
257          # --BEHAVIOR-- adminBeforeBlogSettingsUpdate
258          $core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings);
259
260          if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) {
261               $blog_settings->system->put('url_scan',$_POST['url_scan']);
262          }
263          dcPage::addSuccessNotice(__('Blog has been successfully updated.'));
264
265          http::redirect(sprintf($redir,$blog_id));
266     }
267     catch (Exception $e)
268     {
269          $core->error->add($e->getMessage());
270     }
271}
272
273if ($standalone) {
274     $breadcrumb = dcPage::breadcrumb(
275          array(
276               html::escapeHTML($blog_name) => '',
277               __('Blog settings') => ''
278          )
279     );
280} else {
281     $breadcrumb = dcPage::breadcrumb(
282          array(
283               __('System') => '',
284               __('Blogs') => $core->adminurl->get("admin.blogs"),
285               __('Blog settings').' : '.html::escapeHTML($blog_name) => ''
286          ));
287}
288
289dcPage::open(__('Blog settings'),
290     '<script type="text/javascript">'."\n".
291     "//<![CDATA["."\n".
292     dcPage::jsVar('dotclear.msg.warning_path_info',
293          __('Warning: except for special configurations, it is generally advised to have a trailing "/" in your blog URL in PATH_INFO mode.'))."\n".
294     dcPage::jsVar('dotclear.msg.warning_query_string',
295          __('Warning: except for special configurations, it is generally advised to have a trailing "?" in your blog URL in QUERY_STRING mode.'))."\n".
296     "//]]>".
297     "</script>".
298     dcPage::jsConfirmClose('blog-form').
299     $core->callBehavior('adminPostEditor').
300     dcPage::jsLoad('js/_blog_pref.js').
301
302
303     # --BEHAVIOR-- adminBlogPreferencesHeaders
304     $core->callBehavior('adminBlogPreferencesHeaders').
305
306     dcPage::jsPageTabs(),
307     $breadcrumb
308);
309
310if ($blog_id)
311{
312     if (!empty($_GET['add'])) {
313          dcPage::success(__('Blog has been successfully created.'));
314     }
315
316     if (!empty($_GET['upd'])) {
317          dcPage::success(__('Blog has been successfully updated.'));
318     }
319
320     echo
321     '<div class="multi-part" id="params" title="'.__('Parameters').'">'.
322     '<h3 class="out-of-screen-if-js">'.__('Parameters').'</h3>'.
323     '<form action="'.$action.'" method="post" id="blog-form">';
324
325     echo
326     '<div class="fieldset"><h4>'.__('Blog details').'</h4>'.
327     $core->formNonce();
328
329     if ($core->auth->isSuperAdmin())
330     {
331          echo
332          '<p><label for="blog_id" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:').'</label>'.
333          form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</p>'.
334          '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '.
335          '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>';
336     }
337
338     echo
339     '<p><label for="blog_name" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label>'.
340     form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>';
341
342     if ($core->auth->isSuperAdmin())
343     {
344          echo
345          '<p><label for="blog_url" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label>'.
346          form::field('blog_url',50,255,html::escapeHTML($blog_url)).'</p>'.
347
348          '<p><label for="url_scan">'.__('URL scan method:').'</label>'.
349          form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</p>';
350
351          try
352          {
353               # Test URL of blog by testing it's ATOM feed
354               $file = $blog_url.$core->url->getURLFor('feed','atom');
355               $path = '';
356               $status = '404';
357               $content = '';
358
359               $client = netHttp::initClient($file,$path);
360               if ($client !== false) {
361                    $client->setTimeout(4);
362                    $client->setUserAgent($_SERVER['HTTP_USER_AGENT']);
363                    $client->get($path);
364                    $status = $client->getStatus();
365                    $content = $client->getContent();
366               }
367               if ($status != '200') {
368                    // Might be 404 (URL not found), 670 (blog not online), ...
369                    echo
370                    '<p class="form-note warn">'.
371                    sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> return a <strong>%s</strong> status).'),
372                              $file,$status).
373                    '</p>';
374               } else {
375                    if (substr($content,0,6) != '<?xml ') {
376                         // Not well formed XML feed
377                         echo
378                         '<p class="form-note warn">'.
379                         sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> does not return an ATOM feed).'),
380                                   $file).
381                         '</p>';
382                    }
383               }
384          }
385          catch (Exception $e)
386          {
387               $core->error->add($e->getMessage());
388          }
389          echo
390          '<p><label for="blog_status">'.__('Blog status:').'</label>'.
391          form::combo('blog_status',$status_combo,$blog_status).'</p>';
392     }
393
394     echo
395     '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label>'.
396     form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'.
397     '</div>';
398
399
400     echo
401     '<div class="fieldset"><h4>'.__('Blog configuration').'</h4>'.
402     '<div class="two-cols">'.
403     '<div class="col">'.
404     '<p><label for="editor">'.__('Blog editor name:').'</label>'.
405     form::field('editor',30,255,html::escapeHTML($blog_settings->system->editor)).
406     '</p>'.
407
408     '<p><label for="lang">'.__('Default language:').'</label>'.
409     form::combo('lang',$lang_combo,$blog_settings->system->lang,'l10n').
410     '</p>'.
411
412     '<p><label for="blog_timezone">'.__('Blog timezone:').'</label>'.
413     form::combo('blog_timezone',dt::getZones(true,true),html::escapeHTML($blog_settings->system->blog_timezone)).
414     '</p>'.
415
416     '<p><label for="copyright_notice">'.__('Copyright notice:').'</label>'.
417     form::field('copyright_notice',30,255,html::escapeHTML($blog_settings->system->copyright_notice)).
418     '</p>'.
419     '</div>'.
420
421     '<div class="col">'.
422     '<p><label for="post_url_format">'.__('New post URL format:').'</label>'.
423     form::combo('post_url_format',$post_url_combo,html::escapeHTML($blog_settings->system->post_url_format)).
424     '</p>'.
425
426     '<p><label for="note_title_tag">'.__('HTML tag for the title of the notes on the blog:').'</label>'.
427     form::combo('note_title_tag',$note_title_tag_combo,$blog_settings->system->note_title_tag).
428     '</p>'.
429
430     '<p><label for="enable_xmlrpc" class="classic">'.'</label>'.
431     form::checkbox('enable_xmlrpc','1',$blog_settings->system->enable_xmlrpc).
432     __('Enable XML/RPC interface').'</p>';
433
434     echo
435          '<p class="form-note info">'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>';
436
437     if ($blog_settings->system->enable_xmlrpc) {
438          echo
439          '<p>'.__('XML/RPC interface is active. You should set the following parameters on your XML/RPC client:').'</p>'.
440          '<ul>'.
441          '<li>'.__('Server URL:').' <strong><code>'.
442          sprintf(DC_XMLRPC_URL,$core->blog->url,$core->blog->id).
443          '</code></strong></li>'.
444          '<li>'.__('Blogging system:').' <strong><code>Movable Type</code></strong></li>'.
445          '<li>'.__('User name:').' <strong><code>'.$core->auth->userID().'</code></strong></li>'.
446          '<li>'.__('Password:').' <strong><code>&lt;'.__('your password').'&gt;</code></strong></li>'.
447          '<li>'.__('Blog ID:').' <strong><code>1</code></strong></li>'.
448          '</ul>';
449     }
450
451     echo
452     '</div>'.
453     '</div>'.
454     '<br class="clear" />'. //Opera sucks
455     '</div>';
456
457     echo
458     '<div class="fieldset"><h4>'.__('Comments and trackbacks').'</h4>'.
459
460     '<div class="two-cols">'.
461
462     '<div class="col">'.
463     '<p><label for="allow_comments" class="classic">'.
464     form::checkbox('allow_comments','1',$blog_settings->system->allow_comments).
465     __('Accept comments').'</label></p>'.
466     '<p><label for="comments_pub" class="classic">'.
467     form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub).
468     __('Moderate comments').'</label></p>'.
469     '<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days').'.',
470     form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)).
471     '</label></p>'.
472     '<p class="form-note">'.__('No limit: leave blank.').'</p>'.
473     '<p><label for="wiki_comments" class="classic">'.
474     form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments).
475     __('Wiki syntax for comments').'</label></p>'.
476     '<p><label for="comment_preview_optional" class="classic">'.
477     form::checkbox('comment_preview_optional','1',$blog_settings->system->comment_preview_optional).
478     __('Preview of comment before submit is not mandatory').'</label></p>'.
479     '</div>'.
480
481     '<div class="col">'.
482     '<p><label for="allow_trackbacks" class="classic">'.
483     form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks).
484     __('Accept trackbacks').'</label></p>'.
485     '<p><label for="trackbacks_pub" class="classic">'.
486     form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub).
487     __('Moderate trackbacks').'</label></p>'.
488     '<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days').'.',
489     form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'.
490     '<p class="form-note">'.__('No limit: leave blank.').'</p>'.
491     '<p><label for="comments_nofollow" class="classic">'.
492     form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow).
493     __('Add "nofollow" relation on comments and trackbacks links').'</label></p>'.
494     '</div>'.
495     '<br class="clear" />'. //Opera sucks
496
497     '</div>'.
498     '<br class="clear" />'. //Opera sucks
499     '</div>';
500
501     echo
502     '<div class="fieldset"><h4>'.__('Blog presentation').'</h4>'.
503     '<div class="two-cols">'.
504     '<div class="col">'.
505     '<p><label for="date_format">'.__('Date format:').'</label> '.
506     form::field('date_format',30,255,html::escapeHTML($blog_settings->system->date_format)).
507     form::combo('date_format_select',$date_formats_combo,'','','',false,'title="'.__('Pattern of date').'"').
508     '</p>'.
509     '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->date_format)).'</p>'.
510
511     '<p><label for="time_format">'.__('Time format:').'</label>'.
512     form::field('time_format',30,255,html::escapeHTML($blog_settings->system->time_format)).
513     form::combo('time_format_select',$time_formats_combo,'','','',false,'title="'.__('Pattern of time').'"').
514     '</p>'.
515     '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->time_format)).'</p>'.
516
517     '<p><label for="use_smilies" class="classic">'.
518     form::checkbox('use_smilies','1',$blog_settings->system->use_smilies).
519     __('Display smilies on entries and comments').'</label></p>'.
520     '</div>'.
521
522     '<div class="col">'.
523     '<p><label for="nb_post_for_home" class="classic">'.sprintf(__('Display %s entries on home page'),
524     form::field('nb_post_for_home',2,3,$blog_settings->system->nb_post_for_home)).
525     '</label></p>'.
526
527     '<p><label for="nb_post_per_page" class="classic">'.sprintf(__('Display %s entries per page'),
528     form::field('nb_post_per_page',2,3,$blog_settings->system->nb_post_per_page)).
529     '</label></p>'.
530
531     '<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'),
532     form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)).
533     '</label></p>'.
534
535     '<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'),
536     form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)).
537     '</label></p>'.
538
539     '<p><label for="short_feed_items" class="classic">'.
540     form::checkbox('short_feed_items','1',$blog_settings->system->short_feed_items).
541     __('Truncate feeds').'</label></p>'.
542
543     '<p><label for="inc_subcats" class="classic">'.
544     form::checkbox('inc_subcats','1',$blog_settings->system->inc_subcats).
545     __('Include sub-categories in category page and category posts feed').'</label></p>'.
546     '</div>'.
547    '</div>'.
548     '<br class="clear" />'. //Opera sucks
549     '</div>';
550
551     echo
552     '<div class="fieldset"><h4 id="medias-settings">'.__('Media and images').'</h4>'.
553          '<p class="form-note warning">'.
554     __('Please note that if you change current settings bellow, they will now apply to all new images in the media manager.').
555     ' '.__('Be carefull if you share it with other blogs in your installation.').'</p>'.
556
557     '<div class="two-cols">'.
558     '<div class="col">'.
559     '<h5>'.__('Generated image sizes (in pixels)').'</h5>'.
560     '<p class="field"><label for="media_img_t_size">Thumbnail</label> '.
561     form::field('media_img_t_size',3,3,$blog_settings->system->media_img_t_size).'</p>'.
562
563     '<p class="field"><label for="media_img_s_size">Small</label> '.
564     form::field('media_img_s_size',3,3,$blog_settings->system->media_img_s_size).'</p>'.
565
566     '<p class="field"><label for="media_img_m_size">Medium</label> '.
567     form::field('media_img_m_size',3,3,$blog_settings->system->media_img_m_size).'</p>'.
568     '</div>'.
569
570     '<div class="col">'.
571     '<h5>'.__('Default image insertion attributes').'</h5>'.
572     '<p class="vertical-separator"><label for="media_img_title_pattern">'.__('Inserted image title').'</label>'.
573     form::combo('media_img_title_pattern',$img_title_combo,html::escapeHTML($blog_settings->system->media_img_title_pattern)).'</p>'.
574     '<p><label for="media_img_use_dto_first" class="classic">'.
575     form::checkbox('media_img_use_dto_first','1',$blog_settings->system->media_img_use_dto_first).
576     __('Use original media date if possible').'</label></p>'.
577     '<p><label for="media_img_no_date_alone" class="classic">'.
578     form::checkbox('media_img_no_date_alone','1',$blog_settings->system->media_img_no_date_alone).
579     __('Do not display date if alone in title').'</label></p>'.
580     '<p class="form-note info">'.__('It is retrieved from the picture\'s metadata.').'</p>'.
581
582     '<p class="field vertical-separator"><label for="media_img_default_size">'.__('Size of inserted image:').'</label>'.
583     form::combo('media_img_default_size',$img_default_size_combo,
584          (html::escapeHTML($blog_settings->system->media_img_default_size) != '' ? html::escapeHTML($blog_settings->system->media_img_default_size) : 'm')).
585     '</p>'.
586     '<p class="field"><label for="media_img_default_alignment">'.__('Image alignment:').'</label>'.
587     form::combo('media_img_default_alignment',$img_default_alignment_combo,html::escapeHTML($blog_settings->system->media_img_default_alignment)).
588     '</p>'.
589     '<p><label for="media_img_default_link">'.
590     form::checkbox('media_img_default_link','1',$blog_settings->system->media_img_default_link).
591     __('Insert a link to the original image').'</label></p>'.
592     '</div>'.
593     '</div>'.
594     '<br class="clear" />'. //Opera sucks
595
596     '</div>';
597
598     echo
599     '<div class="fieldset"><h4>'.__('Search engines robots policy').'</h4>';
600
601     $i = 0;
602     foreach ($robots_policy_options as $k => $v)
603     {
604          echo '<p><label for="robots_policy-'.$i.'" class="classic">'.
605          form::radio(array('robots_policy','robots_policy-'.$i),$k,$blog_settings->system->robots_policy == $k).' '.$v.'</label></p>';
606          $i++;
607     }
608
609     echo '</div>';
610
611     echo
612     '<div class="fieldset"><h4>'.__('Blog security').'</h4>'.
613     '<p><label for="prevents_clickjacking" class="classic">'.
614     form::checkbox('prevents_clickjacking','1',$blog_settings->system->prevents_clickjacking).
615     __('Protect the blog from Clickjacking (see <a href="https://en.wikipedia.org/wiki/Clickjacking">Wikipedia</a>)').'</label></p>'.
616     '<br class="clear" />'. //Opera sucks
617     '</div>';
618
619     # --BEHAVIOR-- adminBlogPreferencesForm
620     $core->callBehavior('adminBlogPreferencesForm',$core,$blog_settings);
621
622     echo
623     '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'.
624     (!$standalone ? form::hidden('id',$blog_id) : '').
625     '</p>'.
626     '</form>';
627
628     if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id)
629     {
630          echo
631          '<form action="'.$core->adminurl->get("admin.blog.del").'" method="post">'.
632          '<p><input type="submit" class="delete" value="'.__('Delete this blog').'" />'.
633          form::hidden(array('blog_id'),$blog_id).
634          $core->formNonce().'</p>'.
635          '</form>';
636     } else {
637          if ($blog_id == $core->blog->id) {
638               echo '<p class="message">'.__('The current blog cannot be deleted.').'</p>';
639          } else {
640               echo '<p class="message">'.__('Only superadmin can delete a blog.').'</p>';
641          }
642     }
643
644     echo '</div>';
645
646     #
647     # Users on the blog (with permissions)
648
649     $blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin());
650     $perm_types = $core->auth->getPermissionsTypes();
651
652     echo
653     '<div class="multi-part" id="users" title="'.__('Users').'">'.
654     '<h3 class="out-of-screen-if-js">'.__('Users on this blog').'</h3>';
655
656     if (empty($blog_users))
657     {
658          echo '<p>'.__('No users').'</p>';
659     }
660     else
661     {
662          if ($core->auth->isSuperAdmin()) {
663               $user_url_p = '<a href="'.$core->adminurl->get("admin.user",array('id' => '%1$s')).'">%1$s</a>';
664          } else {
665               $user_url_p = '%1$s';
666          }
667
668          # Sort users list on user_id key
669          ksort($blog_users);
670
671          $post_type = $core->getPostTypes();
672          $current_blog_id = $core->blog->id;
673          if ($blog_id != $core->blog->id) {
674               $core->setBlog($blog_id);
675          }
676
677          foreach ($blog_users as $k => $v)
678          {
679               if (count($v['p']) > 0)
680               {
681                    echo
682                    '<div class="user-perm">'.
683                    '<h4>'.sprintf($user_url_p,html::escapeHTML($k)).
684                    ' ('.html::escapeHTML(dcUtils::getUserCN(
685                         $k, $v['name'], $v['firstname'], $v['displayname']
686                    )).')</h4>';
687
688                    if ($core->auth->isSuperAdmin()) {
689                         echo
690                         '<p>'.__('Email:').' '.
691                         ($v['email'] != '' ? '<a href="mailto:'.$v['email'].'">'.$v['email'].'</a>' : __('(none)')).
692                         '</p>';
693                    }
694
695                    echo
696                    '<h5>'.__('Publications on this blog:').'</h5>'.
697                    '<ul>';
698                    foreach ($post_type as $type => $pt_info) {
699                         $params = array(
700                              'post_type' => $type,
701                              'user_id' => $k
702                              );
703                         echo '<li>'.sprintf(__('%1$s: %2$s'),__($pt_info['label']),$core->blog->getPosts($params,true)->f(0)).'</li>';
704                    }
705                    echo
706                    '</ul>';
707
708                    echo
709                    '<h5>'.__('Permissions:').'</h5>'.
710                    '<ul>';
711                    if ($v['super']) {
712                         echo '<li class="user_super">'.__('Super administrator').'<br />'.
713                         '<span class="form-note">'.__('All rights on all blogs.').'</span></li>';
714                    } else {
715                         foreach ($v['p'] as $p => $V) {
716                              if (isset($perm_types[$p])) {
717                                   echo '<li '.($p == 'admin' ? 'class="user_admin"' : '').'>'.__($perm_types[$p]);
718                              } else {
719                                   echo '<li>'.sprintf(__('[%s] (unreferenced permission)'),$p);
720                              }
721
722                              if($p == 'admin') {
723                                   echo '<br /><span class="form-note">'.__('All rights on this blog.').'</span>';
724                              }
725                              echo '</li>';
726                         }
727                    }
728                    echo
729                    '</ul>';
730
731                    if (!$v['super'] && $core->auth->isSuperAdmin()) {
732                         echo
733                         '<form action="users_actions.php" method="post">'.
734                         '<p class="change-user-perm"><input type="submit" class="reset" value="'.__('Change permissions').'" />'.
735                         form::hidden(array('redir'),$core->adminurl->get("admin.blog.pref",array('id' => $k))).
736                         form::hidden(array('action'),'perms').
737                         form::hidden(array('users[]'),$k).
738                         form::hidden(array('blogs[]'),$blog_id).
739                         $core->formNonce().
740                         '</p>'.
741                         '</form>';
742                    }
743                    echo '</div>';
744               }
745          }
746          if ($current_blog_id != $core->blog->id) {
747               $core->setBlog($current_blog_id);
748          }
749     }
750
751     echo '</div>';
752}
753
754dcPage::helpBlock('core_blog_pref');
755dcPage::close();
Note: See TracBrowser for help on using the repository browser.

Sites map