Dotclear

source: admin/blog_pref.php @ 970:047d7b4a6ffd

Revision 970:047d7b4a6ffd, 21.2 KB checked in by franck <carnet.franck.paul@…>, 11 years ago (diff)

Notes' title can be now enclosed in h4 (default), h3 or p HTML tag. Fixes #1246

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

Sites map