Dotclear

source: admin/blog_pref.php @ 887:c8f4fe2ab8a1

Revision 887:c8f4fe2ab8a1, 20.7 KB checked in by franck <carnet.franck.paul@…>, 11 years ago (diff)

Add default attributes settings for image insertion

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

Sites map