Dotclear

source: admin/blog_pref.php @ 924:acf8a0a59710

Revision 924:acf8a0a59710, 20.6 KB checked in by franck <carnet.franck.paul@…>, 11 years ago (diff)

Add two more schemes to URL scheme list in blog prefs, fixes #1088

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

Sites map