Dotclear

source: admin/blog_pref.php @ 1334:bbbe0735f18b

Revision 1334:bbbe0735f18b, 21.6 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

New dcPage::breadcrumb function, better way to use it, to be continued by me…

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

Sites map