Dotclear

source: admin/blog_pref.php @ 2198:e9f1e3b6a3ad

Revision 2198:e9f1e3b6a3ad, 25.7 KB checked in by Dsls, 12 years ago (diff)

includesubcats suddenly swallowed by core

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';
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';
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('inc_subcats',!empty($_POST['inc_subcats']));
238          $blog_settings->system->put('media_img_t_size',$media_img_t_size);
239          $blog_settings->system->put('media_img_s_size',$media_img_s_size);
240          $blog_settings->system->put('media_img_m_size',$media_img_m_size);
241          $blog_settings->system->put('media_img_title_pattern',$_POST['media_img_title_pattern']);
242          $blog_settings->system->put('media_img_use_dto_first',!empty($_POST['media_img_use_dto_first']));
243          $blog_settings->system->put('media_img_default_size',$_POST['media_img_default_size']);
244          $blog_settings->system->put('media_img_default_alignment',$_POST['media_img_default_alignment']);
245          $blog_settings->system->put('media_img_default_link',!empty($_POST['media_img_default_link']));
246          $blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed);
247          $blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed);
248          $blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items']));
249         
250          if (isset($_POST['robots_policy'])) {
251               $blog_settings->system->put('robots_policy',$_POST['robots_policy']);
252          }
253         
254          # --BEHAVIOR-- adminBeforeBlogSettingsUpdate
255          $core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings);
256         
257          if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) {
258               $blog_settings->system->put('url_scan',$_POST['url_scan']);
259          }
260          dcPage::addSuccessNotice(__('Blog has been successfully updated.'));
261
262          http::redirect(sprintf($redir,$blog_id));
263     }
264     catch (Exception $e)
265     {
266          $core->error->add($e->getMessage());
267     }
268}
269
270if ($standalone) {
271     $breadcrumb = dcPage::breadcrumb(
272          array(
273               html::escapeHTML($blog_name) => '',
274               __('Blog settings') => ''
275          )
276     );
277} else {
278     $breadcrumb = dcPage::breadcrumb(
279          array(
280               __('System') => '',
281               __('Blogs') => 'blogs.php',
282               __('Blog settings').' : '.html::escapeHTML($blog_name) => ''
283          ));
284}
285
286dcPage::open(__('Blog settings'),
287     '<script type="text/javascript">'."\n".
288     "//<![CDATA["."\n".
289     dcPage::jsVar('dotclear.msg.warning_path_info',
290          __('Warning: except for special configurations, it is generally advised to have a trailing "/" in your blog URL in PATH_INFO mode.'))."\n".
291     dcPage::jsVar('dotclear.msg.warning_query_string',
292          __('Warning: except for special configurations, it is generally advised to have a trailing "?" in your blog URL in QUERY_STRING mode.'))."\n".
293     "//]]>".
294     "</script>".
295     dcPage::jsConfirmClose('blog-form').
296     dcPage::jsLoad('js/_blog_pref.js').
297     
298     
299     # --BEHAVIOR-- adminBlogPreferencesHeaders
300     $core->callBehavior('adminBlogPreferencesHeaders').
301     
302     dcPage::jsPageTabs(),
303     $breadcrumb
304);
305
306if ($blog_id)
307{
308     if (!empty($_GET['add'])) {
309          dcPage::success(__('Blog has been successfully created.'));
310     }
311     
312     if (!empty($_GET['upd'])) {
313          dcPage::success(__('Blog has been successfully updated.'));
314     }
315     
316     echo
317     '<div class="multi-part" id="params" title="'.__('Parameters').'">'.
318     '<h3 class="out-of-screen-if-js">'.__('Parameters').'</h3>'.
319     '<form action="'.$action.'" method="post" id="blog-form">';
320     
321     echo
322     '<div class="fieldset"><h4>'.__('Blog details').'</h4>'.
323     $core->formNonce();
324     
325     if ($core->auth->isSuperAdmin())
326     {
327          echo
328          '<p><label for="blog_id" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:').'</label>'.
329          form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</p>'.
330          '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '.
331          '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>';
332     }
333     
334     echo
335     '<p><label for="blog_name" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label>'.
336     form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>';
337     
338     if ($core->auth->isSuperAdmin())
339     {
340          echo
341          '<p><label for="blog_url" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label>'.
342          form::field('blog_url',50,255,html::escapeHTML($blog_url)).'</p>'.
343         
344          '<p><label for="url_scan">'.__('URL scan method:').'</label>'.
345          form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</p>';
346         
347          try
348          {
349               # Test URL of blog by testing it's ATOM feed
350               $file = $blog_url.$core->url->getURLFor('feed','atom');
351               $path = '';
352               $status = '404';
353               $content = '';
354
355               $client = netHttp::initClient($file,$path);
356               if ($client !== false) {
357                    $client->setTimeout(4);
358                    $client->setUserAgent($_SERVER['HTTP_USER_AGENT']);
359                    $client->get($path);
360                    $status = $client->getStatus();
361                    $content = $client->getContent();
362               }
363               if ($status != '200') {
364                    // Might be 404 (URL not found), 670 (blog not online), ...
365                    echo
366                    '<p class="form-note warn">'.
367                    sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> return a <strong>%s</strong> status).'),
368                              $file,$status).
369                    '</p>';
370               } else {
371                    if (substr($content,0,6) != '<?xml ') {
372                         // Not well formed XML feed
373                         echo
374                         '<p class="form-note warn">'.
375                         sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> does not return an ATOM feed).'),
376                                   $file).
377                         '</p>';
378                    }
379               }
380          }
381          catch (Exception $e)
382          {
383               $core->error->add($e->getMessage());
384          }
385          echo
386          '<p><label for="blog_status">'.__('Blog status:').'</label>'.
387          form::combo('blog_status',$status_combo,$blog_status).'</p>';
388     }
389     
390     echo
391     '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label>'.
392     form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'.
393     '</div>';
394     
395     
396     echo
397     '<div class="fieldset"><h4>'.__('Blog configuration').'</h4>'.
398     '<div class="two-cols">'.
399     '<div class="col">'.
400     '<p><label for="editor">'.__('Blog editor name:').'</label>'.
401     form::field('editor',30,255,html::escapeHTML($blog_settings->system->editor)).
402     '</p>'.
403     
404     '<p><label for="lang">'.__('Default language:').'</label>'.
405     form::combo('lang',$lang_combo,$blog_settings->system->lang,'l10n').
406     '</p>'.
407     
408     '<p><label for="blog_timezone">'.__('Blog timezone:').'</label>'.
409     form::combo('blog_timezone',dt::getZones(true,true),html::escapeHTML($blog_settings->system->blog_timezone)).
410     '</p>'.
411
412     '<p><label for="copyright_notice">'.__('Copyright notice:').'</label>'.
413     form::field('copyright_notice',30,255,html::escapeHTML($blog_settings->system->copyright_notice)).
414     '</p>'.
415     '</div>'.
416     
417     '<div class="col">'.
418     '<p><label for="post_url_format">'.__('New post URL format:').'</label>'.
419     form::combo('post_url_format',$post_url_combo,html::escapeHTML($blog_settings->system->post_url_format)).
420     '</p>'.
421
422     '<p><label for="note_title_tag">'.__('HTML tag for the title of the notes on the blog:').'</label>'.
423     form::combo('note_title_tag',$note_title_tag_combo,$blog_settings->system->note_title_tag).
424     '</p>'.
425         
426     '<p><label for="enable_xmlrpc" class="classic">'.'</label>'.
427     form::checkbox('enable_xmlrpc','1',$blog_settings->system->enable_xmlrpc).
428     __('Enable XML/RPC interface').'</p>';
429
430     echo
431          '<p class="form-note info">'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>'; 
432
433     if ($blog_settings->system->enable_xmlrpc) {
434          echo
435          '<p>'.__('XML/RPC interface is active. You should set the following parameters on your XML/RPC client:').'</p>'.
436          '<ul>'.
437          '<li>'.__('Server URL:').' <strong><code>'.
438          sprintf(DC_XMLRPC_URL,$core->blog->url,$core->blog->id).
439          '</code></strong></li>'.
440          '<li>'.__('Blogging system:').' <strong><code>Movable Type</code></strong></li>'.
441          '<li>'.__('User name:').' <strong><code>'.$core->auth->userID().'</code></strong></li>'.
442          '<li>'.__('Password:').' <strong><code>&lt;'.__('your password').'&gt;</code></strong></li>'.
443          '<li>'.__('Blog ID:').' <strong><code>1</code></strong></li>'.
444          '</ul>';
445     }
446
447     echo
448     '</div>'.
449     '</div>'.
450     '<br class="clear" />'. //Opera sucks
451     '</div>';
452     
453     echo
454     '<div class="fieldset"><h4>'.__('Comments and trackbacks').'</h4>'.
455
456     '<div class="two-cols">'.
457
458     '<div class="col">'.
459     '<p><label for="allow_comments" class="classic">'.
460     form::checkbox('allow_comments','1',$blog_settings->system->allow_comments).
461     __('Accept comments').'</label></p>'.   
462     '<p><label for="comments_pub" class="classic">'.
463     form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub).
464     __('Moderate comments').'</label></p>'. 
465     '<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days').'.',
466     form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)).
467     '</label></p>'.
468     '<p class="form-note">'.__('No limit: leave blank.').'</p>'.     
469     '<p><label for="wiki_comments" class="classic">'.
470     form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments).
471     __('Wiki syntax for comments').'</label></p>'.
472     '</div>'.
473     
474     '<div class="col">'.
475     '<p><label for="allow_trackbacks" class="classic">'.
476     form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks).
477     __('Accept trackbacks').'</label></p>'. 
478     '<p><label for="trackbacks_pub" class="classic">'.
479     form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub).
480     __('Moderate trackbacks').'</label></p>'.   
481     '<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days').'.',
482     form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'.
483     '<p class="form-note">'.__('No limit: leave blank.').'</p>'.     
484     '<p><label for="comments_nofollow" class="classic">'.
485     form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow).
486     __('Add "nofollow" relation on comments and trackbacks links').'</label></p>'.
487     '</div>'.
488     '<br class="clear" />'. //Opera sucks
489
490     '</div>'.
491     '<br class="clear" />'. //Opera sucks
492     '</div>';
493     
494     echo
495     '<div class="fieldset"><h4>'.__('Blog presentation').'</h4>'.
496     '<div class="two-cols">'.
497     '<div class="col">'.
498     '<p><label for="date_format">'.__('Date format:').'</label> '.
499     form::field('date_format',30,255,html::escapeHTML($blog_settings->system->date_format)).
500     form::combo('date_format_select',$date_formats_combo,'','','',false,'title="'.__('Pattern of date').'"').
501     '</p>'.
502     '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->date_format)).'</p>'.
503
504     '<p><label for="time_format">'.__('Time format:').'</label>'.
505     form::field('time_format',30,255,html::escapeHTML($blog_settings->system->time_format)).
506     form::combo('time_format_select',$time_formats_combo,'','','',false,'title="'.__('Pattern of time').'"').
507     '</p>'.
508     '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->time_format)).'</p>'.
509     
510     '<p><label for="use_smilies" class="classic">'.
511     form::checkbox('use_smilies','1',$blog_settings->system->use_smilies).
512     __('Display smilies on entries and comments').'</label></p>'.
513     '</div>'.
514     
515     '<div class="col">'.
516     '<p><label for="nb_post_per_page" class="classic">'.sprintf(__('Display %s entries per page'),
517     form::field('nb_post_per_page',2,3,$blog_settings->system->nb_post_per_page)).
518     '</label></p>'.
519     
520     '<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'),
521     form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)).
522     '</label></p>'.
523     
524     '<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'),
525     form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)).
526     '</label></p>'.
527     
528     '<p><label for="short_feed_items" class="classic">'.
529     form::checkbox('short_feed_items','1',$blog_settings->system->short_feed_items).
530     __('Truncate feeds').'</label></p>'.
531     
532     '<p><label for="inc_subcats" class="classic">'.
533     form::checkbox('inc_subcats','1',$blog_settings->system->inc_subcats).
534     __('Include sub-categories in category page and category posts feed').'</label></p>'.
535     '</div>'.
536    '</div>'.
537     '<br class="clear" />'. //Opera sucks
538     '</div>';
539     
540     echo
541     '<div class="fieldset"><h4 id="medias-settings">'.__('Media and images').'</h4>'.
542          '<p class="form-note warning">'.
543     __('Please note that if you change current settings bellow, they will now apply to all new images in the media manager.').
544     ' '.__('Be carefull if you share it with other blogs in your installation.').'</p>'.
545
546     '<div class="two-cols">'.
547     '<div class="col">'.
548     '<h5>'.__('Generated image sizes (in pixels)').'</h5>'.
549     '<p class="field"><label for="media_img_t_size">Thumbnail</label> '.
550     form::field('media_img_t_size',3,3,$blog_settings->system->media_img_t_size).'</p>'.
551     
552     '<p class="field"><label for="media_img_s_size">Small</label> '.
553     form::field('media_img_s_size',3,3,$blog_settings->system->media_img_s_size).'</p>'.
554     
555     '<p class="field"><label for="media_img_m_size">Medium</label> '.
556     form::field('media_img_m_size',3,3,$blog_settings->system->media_img_m_size).'</p>'.
557     '</div>'.
558     
559     '<div class="col">'.
560     '<h5>'.__('Default image insertion attributes').'</h5>'.
561     '<p class="vertical-separator"><label for="media_img_title_pattern">'.__('Inserted image title').'</label>'.
562     form::combo('media_img_title_pattern',$img_title_combo,html::escapeHTML($blog_settings->system->media_img_title_pattern)).' '.
563     '<label for="media_img_use_dto_first" class="classic">'.
564     form::checkbox('media_img_use_dto_first','1',$blog_settings->system->media_img_use_dto_first).
565     __('Use original media date if possible').'</label></p>'.
566     '<p class="form-note info">'.__('It is retrieved from the picture\'s metadata.').'</p>'.
567
568     '<p class="field vertical-separator"><label for="media_img_default_size">'.__('Size of inserted image:').'</label>'.
569     form::combo('media_img_default_size',$img_default_size_combo,
570          (html::escapeHTML($blog_settings->system->media_img_default_size) != '' ? html::escapeHTML($blog_settings->system->media_img_default_size) : 'm')).
571     '</p>'.
572     '<p class="field"><label for="media_img_default_alignment">'.__('Image alignment:').'</label>'.
573     form::combo('media_img_default_alignment',$img_default_alignment_combo,html::escapeHTML($blog_settings->system->media_img_default_alignment)).
574     '</p>'.
575     '<p><label for="media_img_default_link">'.
576     form::checkbox('media_img_default_link','1',$blog_settings->system->media_img_default_link).
577     __('Insert a link to the original image').'</label></p>'.
578     '</div>'.
579     '</div>'.
580     '<br class="clear" />'. //Opera sucks
581
582     '</div>';
583     
584     echo
585     '<div class="fieldset"><h4>'.__('Search engines robots policy').'</h4>';
586     
587     $i = 0;
588     foreach ($robots_policy_options as $k => $v)
589     {
590          echo '<p><label for="robots_policy-'.$i.'" class="classic">'.
591          form::radio(array('robots_policy','robots_policy-'.$i),$k,$blog_settings->system->robots_policy == $k).' '.$v.'</label></p>';
592          $i++;
593     }
594     
595     echo '</div>';
596     
597     
598     # --BEHAVIOR-- adminBlogPreferencesForm
599     $core->callBehavior('adminBlogPreferencesForm',$core,$blog_settings);
600     
601     echo
602     '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'.
603     (!$standalone ? form::hidden('id',$blog_id) : '').
604     '</p>'.
605     '</form>';
606     
607     if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id)
608     {
609          echo
610          '<form action="blog_del.php" method="post">'.
611          '<p><input type="submit" class="delete" value="'.__('Delete this blog').'" />'.
612          form::hidden(array('blog_id'),$blog_id).
613          $core->formNonce().'</p>'.
614          '</form>';
615     } else {
616          if ($blog_id == $core->blog->id) {
617               echo '<p class="message">'.__('The current blog cannot be deleted.').'</p>';
618          } else {
619               echo '<p class="message">'.__('Only superadmin can delete a blog.').'</p>';
620          }
621     }
622     
623     echo '</div>';
624     
625     #
626     # Users on the blog (with permissions)
627     
628     $blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin());
629     $perm_types = $core->auth->getPermissionsTypes();
630     
631     echo
632     '<div class="multi-part" id="users" title="'.__('Users').'">'.
633     '<h3 class="out-of-screen-if-js">'.__('Users on this blog').'</h3>';
634     
635     if (empty($blog_users))
636     {
637          echo '<p>'.__('No users').'</p>';
638     }
639     else
640     {
641          if ($core->auth->isSuperAdmin()) {
642               $user_url_p = '<a href="user.php?id=%1$s">%1$s</a>';
643          } else {
644               $user_url_p = '%1$s';
645          }
646
647          # Sort users list on user_id key
648          ksort($blog_users);
649
650          $post_type = $core->getPostTypes();
651          $current_blog_id = $core->blog->id;
652          if ($blog_id != $core->blog->id) {
653               $core->setBlog($blog_id);
654          }
655
656          foreach ($blog_users as $k => $v)
657          {
658               if (count($v['p']) > 0)
659               {
660                    echo
661                    '<div class="user-perm">'.
662                    '<h4>'.sprintf($user_url_p,html::escapeHTML($k)).
663                    ' ('.html::escapeHTML(dcUtils::getUserCN(
664                         $k, $v['name'], $v['firstname'], $v['displayname']
665                    )).')</h4>';
666
667                    if ($core->auth->isSuperAdmin()) {
668                         echo 
669                         '<p>'.__('Email:').' '.
670                         ($v['email'] != '' ? '<a href="mailto:'.$v['email'].'">'.$v['email'].'</a>' : __('(none)')).
671                         '</p>';
672                    }
673
674                    echo
675                    '<h5>'.__('Publications on this blog:').'</h5>'.
676                    '<ul>';
677                    foreach ($post_type as $type => $pt_info) {
678                         $params = array(
679                              'post_type' => $type,
680                              'user_id' => $k
681                              );
682                         echo '<li>'.sprintf(__('%1$s: %2$s'),__($pt_info['label']),$core->blog->getPosts($params,true)->f(0)).'</li>';
683                    }
684                    echo
685                    '</ul>';
686
687                    echo
688                    '<h5>'.__('Permissions:').'</h5>'.
689                    '<ul>';
690                    if ($v['super']) {
691                         echo '<li class="user_super">'.__('Super administrator').'<br />'.
692                         '<span class="form-note">'.__('All rights on all blogs.').'</span></li>';
693                    } else {
694                         foreach ($v['p'] as $p => $V) {
695                              echo '<li '.($p == 'admin' ? 'class="user_admin"' : '').'>'.__($perm_types[$p]);
696
697                              if($p == 'admin') {
698                                   echo '<br /><span class="form-note">'.__('All rights on this blog.').'</span>';
699                              }
700                              echo '</li>';
701                         }
702                    }
703                    echo 
704                    '</ul>';
705                   
706                    if (!$v['super'] && $core->auth->isSuperAdmin()) {
707                         echo 
708                         '<form action="users_actions.php" method="post">'.
709                         '<p class="change-user-perm"><input type="submit" class="reset" value="'.__('Change permissions').'" />'.
710                         form::hidden(array('redir'),'blog_pref.php?id='.$k).
711                         form::hidden(array('action'),'perms').
712                         form::hidden(array('users[]'),$k).
713                         form::hidden(array('blogs[]'),$blog_id).
714                         $core->formNonce().
715                         '</p>'.
716                         '</form>';
717                    }
718                    echo '</div>';
719               }
720          }
721          if ($current_blog_id != $core->blog->id) {
722               $core->setBlog($current_blog_id);
723          }
724     }
725     
726     echo '</div>';
727}
728
729dcPage::helpBlock('core_blog_pref');
730dcPage::close();
731?>
Note: See TracBrowser for help on using the repository browser.

Sites map