Dotclear

source: admin/blog_pref.php @ 2028:4b22d1da6527

Revision 2028:4b22d1da6527, 25.4 KB checked in by Anne Kozlika <kozlika@…>, 12 years ago (diff)

Je me repents et prie Nikrou de bien vouloir me pardonner mes interventions à-peu-près-istes

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

Sites map