[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
[0] | 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 | |
---|
| 17 | if ($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; |
---|
[2566] | 27 | |
---|
[2720] | 28 | $action = $core->adminurl->get("admin.blog.pref"); |
---|
| 29 | $redir = $core->adminurl->get("admin.blog.pref"); |
---|
[0] | 30 | } |
---|
| 31 | else |
---|
| 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']); |
---|
[2566] | 40 | |
---|
[0] | 41 | if (!$rs) { |
---|
| 42 | throw new Exception(__('No such blog.')); |
---|
| 43 | } |
---|
[2566] | 44 | |
---|
[0] | 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); |
---|
[2566] | 50 | $blog_url = $rs->blog_url ; |
---|
[0] | 51 | } |
---|
| 52 | catch (Exception $e) |
---|
| 53 | { |
---|
| 54 | $core->error->add($e->getMessage()); |
---|
| 55 | } |
---|
[2566] | 56 | |
---|
[2720] | 57 | $action = $core->adminurl->get("admin.blog"); |
---|
[2858] | 58 | $redir = $core->adminurl->get("admin.blog",array('id' => "%s"),'&',true); |
---|
[0] | 59 | } |
---|
| 60 | |
---|
| 61 | # Language codes |
---|
[1719] | 62 | $lang_combo = dcAdminCombos::getAdminLangsCombo(); |
---|
[0] | 63 | |
---|
| 64 | # Status combo |
---|
[1719] | 65 | $status_combo = dcAdminCombos::getBlogStatusescombo(); |
---|
[0] | 66 | |
---|
[2019] | 67 | # Date format combo |
---|
| 68 | $now = time(); |
---|
[3159] | 69 | $date_formats = $blog_settings->system->date_formats; |
---|
| 70 | $time_formats = $blog_settings->system->time_formats; |
---|
[2019] | 71 | $date_formats_combo = array('' => ''); |
---|
| 72 | foreach ($date_formats as $format) { |
---|
| 73 | $date_formats_combo[dt::str($format, $now)] = $format; |
---|
| 74 | } |
---|
| 75 | $time_formats_combo = array('' => ''); |
---|
| 76 | foreach ($time_formats as $format) { |
---|
| 77 | $time_formats_combo[dt::str($format, $now)] = $format; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
[0] | 81 | # URL scan modes |
---|
| 82 | $url_scan_combo = array( |
---|
| 83 | 'PATH_INFO' => 'path_info', |
---|
| 84 | 'QUERY_STRING' => 'query_string' |
---|
| 85 | ); |
---|
| 86 | |
---|
| 87 | # Post URL combo |
---|
| 88 | $post_url_combo = array( |
---|
| 89 | __('year/month/day/title') => '{y}/{m}/{d}/{t}', |
---|
| 90 | __('year/month/title') => '{y}/{m}/{t}', |
---|
| 91 | __('year/title') => '{y}/{t}', |
---|
[924] | 92 | __('title') => '{t}', |
---|
| 93 | __('post id/title') => '{id}/{t}', |
---|
| 94 | __('post id') => '{id}' |
---|
[0] | 95 | ); |
---|
| 96 | if (!in_array($blog_settings->system->post_url_format,$post_url_combo)) { |
---|
| 97 | $post_url_combo[html::escapeHTML($blog_settings->system->post_url_format)] = html::escapeHTML($blog_settings->system->post_url_format); |
---|
| 98 | } |
---|
| 99 | |
---|
[970] | 100 | # Note title tag combo |
---|
| 101 | $note_title_tag_combo = array( |
---|
| 102 | __('H4') => 0, |
---|
| 103 | __('H3') => 1, |
---|
| 104 | __('P') => 2 |
---|
| 105 | ); |
---|
| 106 | |
---|
[0] | 107 | # Image title combo |
---|
| 108 | $img_title_combo = array( |
---|
[976] | 109 | __('(none)') => '', |
---|
[0] | 110 | __('Title') => 'Title ;; separator(, )', |
---|
| 111 | __('Title, Date') => 'Title ;; Date(%b %Y) ;; separator(, )', |
---|
| 112 | __('Title, Country, Date') => 'Title ;; Country ;; Date(%b %Y) ;; separator(, )', |
---|
| 113 | __('Title, City, Country, Date') => 'Title ;; City ;; Country ;; Date(%b %Y) ;; separator(, )', |
---|
| 114 | ); |
---|
| 115 | if (!in_array($blog_settings->system->media_img_title_pattern,$img_title_combo)) { |
---|
| 116 | $img_title_combo[html::escapeHTML($blog_settings->system->media_img_title_pattern)] = html::escapeHTML($blog_settings->system->media_img_title_pattern); |
---|
| 117 | } |
---|
| 118 | |
---|
[887] | 119 | # Image default size combo |
---|
| 120 | $img_default_size_combo = array(); |
---|
[1537] | 121 | try { |
---|
| 122 | $media = new dcMedia($core); |
---|
| 123 | $img_default_size_combo[__('original')] = 'o'; |
---|
| 124 | foreach ($media->thumb_sizes as $code => $size) { |
---|
| 125 | $img_default_size_combo[__($size[2])] = $code; |
---|
| 126 | } |
---|
| 127 | } catch (Exception $e) { |
---|
| 128 | $core->error->add($e->getMessage()); |
---|
[887] | 129 | } |
---|
| 130 | |
---|
| 131 | # Image default alignment combo |
---|
| 132 | $img_default_alignment_combo = array( |
---|
| 133 | __('None') => 'none', |
---|
| 134 | __('Left') => 'left', |
---|
| 135 | __('Right') => 'right', |
---|
| 136 | __('Center') => 'center' |
---|
| 137 | ); |
---|
| 138 | |
---|
[3446] | 139 | # Image default legend and title combo |
---|
| 140 | $img_default_legend_combo = array( |
---|
| 141 | __('Legend and title') => 'legend', |
---|
| 142 | __('Title') => 'title', |
---|
| 143 | __('None') => 'none' |
---|
| 144 | ); |
---|
| 145 | |
---|
[0] | 146 | # Robots policy options |
---|
| 147 | $robots_policy_options = array( |
---|
| 148 | 'INDEX,FOLLOW' => __("I would like search engines and archivers to index and archive my blog's content."), |
---|
| 149 | 'INDEX,FOLLOW,NOARCHIVE' => __("I would like search engines and archivers to index but not archive my blog's content."), |
---|
| 150 | 'NOINDEX,NOFOLLOW,NOARCHIVE' => __("I would like to prevent search engines and archivers from indexing or archiving my blog's content."), |
---|
| 151 | ); |
---|
| 152 | |
---|
[2800] | 153 | # jQuery available versions |
---|
| 154 | $jquery_root = dirname(__FILE__).'/../inc/js/jquery'; |
---|
| 155 | $jquery_versions_combo = array(__('Default').' ('.DC_DEFAULT_JQUERY.')' => DC_DEFAULT_JQUERY); |
---|
| 156 | if (is_dir($jquery_root) && is_readable($jquery_root)) { |
---|
| 157 | if (($d = @dir($jquery_root)) !== false) { |
---|
| 158 | while (($entry = $d->read()) !== false) { |
---|
| 159 | if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_dir($jquery_root.'/'.$entry)) { |
---|
| 160 | if ($entry != DC_DEFAULT_JQUERY) { |
---|
| 161 | $jquery_versions_combo[$entry] = $entry; |
---|
| 162 | } |
---|
| 163 | } |
---|
| 164 | } |
---|
| 165 | } |
---|
| 166 | } |
---|
| 167 | |
---|
[0] | 168 | # Update a blog |
---|
| 169 | if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id)) |
---|
| 170 | { |
---|
| 171 | $cur = $core->con->openCursor($core->prefix.'blog'); |
---|
[2969] | 172 | $cur->blog_id = $_POST['blog_id']; |
---|
| 173 | $cur->blog_url = preg_replace('/\?+$/','?', $_POST['blog_url']); |
---|
[0] | 174 | $cur->blog_name = $_POST['blog_name']; |
---|
| 175 | $cur->blog_desc = $_POST['blog_desc']; |
---|
[2566] | 176 | |
---|
[2969] | 177 | if ($core->auth->isSuperAdmin() && in_array($_POST['blog_status'], $status_combo)) { |
---|
| 178 | $cur->blog_status = (int) $_POST['blog_status']; |
---|
| 179 | } |
---|
| 180 | |
---|
[0] | 181 | $media_img_t_size = abs((integer) $_POST['media_img_t_size']); |
---|
| 182 | if ($media_img_t_size < 0) { $media_img_t_size = 100; } |
---|
[2566] | 183 | |
---|
[0] | 184 | $media_img_s_size = abs((integer) $_POST['media_img_s_size']); |
---|
| 185 | if ($media_img_s_size < 0) { $media_img_s_size = 240; } |
---|
[2566] | 186 | |
---|
[0] | 187 | $media_img_m_size = abs((integer) $_POST['media_img_m_size']); |
---|
| 188 | if ($media_img_m_size < 0) { $media_img_m_size = 448; } |
---|
[2566] | 189 | |
---|
[3112] | 190 | $media_video_width = abs((integer) $_POST['media_video_width']); |
---|
| 191 | if ($media_video_width < 0) { $media_video_width = 400; } |
---|
[3115] | 192 | |
---|
[3112] | 193 | $media_video_height = abs((integer) $_POST['media_video_height']); |
---|
| 194 | if ($media_video_height < 0) { $media_video_height = 300; } |
---|
| 195 | |
---|
[2577] | 196 | $nb_post_for_home = abs((integer) $_POST['nb_post_for_home']); |
---|
| 197 | if ($nb_post_for_home <= 1) { $nb_post_for_home = 1; } |
---|
| 198 | |
---|
[0] | 199 | $nb_post_per_page = abs((integer) $_POST['nb_post_per_page']); |
---|
| 200 | if ($nb_post_per_page <= 1) { $nb_post_per_page = 1; } |
---|
[2566] | 201 | |
---|
[0] | 202 | $nb_post_per_feed = abs((integer) $_POST['nb_post_per_feed']); |
---|
| 203 | if ($nb_post_per_feed <= 1) { $nb_post_per_feed = 1; } |
---|
[2566] | 204 | |
---|
[0] | 205 | $nb_comment_per_feed = abs((integer) $_POST['nb_comment_per_feed']); |
---|
| 206 | if ($nb_comment_per_feed <= 1) { $nb_comment_per_feed = 1; } |
---|
[2566] | 207 | |
---|
[0] | 208 | try |
---|
| 209 | { |
---|
| 210 | if ($cur->blog_id != null && $cur->blog_id != $blog_id) { |
---|
| 211 | $rs = $core->getBlog($cur->blog_id); |
---|
[2566] | 212 | |
---|
[0] | 213 | if ($rs) { |
---|
[1615] | 214 | throw new Exception(__('This blog ID is already used.')); |
---|
[0] | 215 | } |
---|
| 216 | } |
---|
[2566] | 217 | |
---|
[0] | 218 | # --BEHAVIOR-- adminBeforeBlogUpdate |
---|
| 219 | $core->callBehavior('adminBeforeBlogUpdate',$cur,$blog_id); |
---|
[2566] | 220 | |
---|
[0] | 221 | if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_POST['lang'])) { |
---|
| 222 | throw new Exception(__('Invalid language code')); |
---|
| 223 | } |
---|
[2566] | 224 | |
---|
[0] | 225 | $core->updBlog($blog_id,$cur); |
---|
[2566] | 226 | |
---|
[0] | 227 | # --BEHAVIOR-- adminAfterBlogUpdate |
---|
| 228 | $core->callBehavior('adminAfterBlogUpdate',$cur,$blog_id); |
---|
[2566] | 229 | |
---|
[0] | 230 | if ($cur->blog_id != null && $cur->blog_id != $blog_id) { |
---|
| 231 | if ($blog_id == $core->blog->id) { |
---|
| 232 | $core->setBlog($cur->blog_id); |
---|
| 233 | $_SESSION['sess_blog_id'] = $cur->blog_id; |
---|
| 234 | $blog_settings = $core->blog->settings; |
---|
| 235 | } else { |
---|
| 236 | $blog_settings = new dcSettings($core,$cur->blog_id); |
---|
| 237 | } |
---|
[2566] | 238 | |
---|
[0] | 239 | $blog_id = $cur->blog_id; |
---|
| 240 | } |
---|
[2566] | 241 | |
---|
| 242 | |
---|
[0] | 243 | $blog_settings->addNameSpace('system'); |
---|
[2566] | 244 | |
---|
[0] | 245 | $blog_settings->system->put('editor',$_POST['editor']); |
---|
| 246 | $blog_settings->system->put('copyright_notice',$_POST['copyright_notice']); |
---|
| 247 | $blog_settings->system->put('post_url_format',$_POST['post_url_format']); |
---|
| 248 | $blog_settings->system->put('lang',$_POST['lang']); |
---|
| 249 | $blog_settings->system->put('blog_timezone',$_POST['blog_timezone']); |
---|
| 250 | $blog_settings->system->put('date_format',$_POST['date_format']); |
---|
| 251 | $blog_settings->system->put('time_format',$_POST['time_format']); |
---|
| 252 | $blog_settings->system->put('comments_ttl',abs((integer) $_POST['comments_ttl'])); |
---|
| 253 | $blog_settings->system->put('trackbacks_ttl',abs((integer) $_POST['trackbacks_ttl'])); |
---|
| 254 | $blog_settings->system->put('allow_comments',!empty($_POST['allow_comments'])); |
---|
| 255 | $blog_settings->system->put('allow_trackbacks',!empty($_POST['allow_trackbacks'])); |
---|
| 256 | $blog_settings->system->put('comments_pub',empty($_POST['comments_pub'])); |
---|
| 257 | $blog_settings->system->put('trackbacks_pub',empty($_POST['trackbacks_pub'])); |
---|
| 258 | $blog_settings->system->put('comments_nofollow',!empty($_POST['comments_nofollow'])); |
---|
| 259 | $blog_settings->system->put('wiki_comments',!empty($_POST['wiki_comments'])); |
---|
[2776] | 260 | $blog_settings->system->put('comment_preview_optional',!empty($_POST['comment_preview_optional'])); |
---|
[0] | 261 | $blog_settings->system->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc'])); |
---|
[970] | 262 | $blog_settings->system->put('note_title_tag',$_POST['note_title_tag']); |
---|
[2577] | 263 | $blog_settings->system->put('nb_post_for_home',$nb_post_for_home); |
---|
[0] | 264 | $blog_settings->system->put('nb_post_per_page',$nb_post_per_page); |
---|
| 265 | $blog_settings->system->put('use_smilies',!empty($_POST['use_smilies'])); |
---|
[3030] | 266 | $blog_settings->system->put('no_search',!empty($_POST['no_search'])); |
---|
[2198] | 267 | $blog_settings->system->put('inc_subcats',!empty($_POST['inc_subcats'])); |
---|
[0] | 268 | $blog_settings->system->put('media_img_t_size',$media_img_t_size); |
---|
| 269 | $blog_settings->system->put('media_img_s_size',$media_img_s_size); |
---|
| 270 | $blog_settings->system->put('media_img_m_size',$media_img_m_size); |
---|
[3112] | 271 | $blog_settings->system->put('media_video_width',$media_video_width); |
---|
| 272 | $blog_settings->system->put('media_video_height',$media_video_height); |
---|
[3138] | 273 | $blog_settings->system->put('media_flash_fallback',!empty($_POST['media_flash_fallback'])); |
---|
[0] | 274 | $blog_settings->system->put('media_img_title_pattern',$_POST['media_img_title_pattern']); |
---|
[1073] | 275 | $blog_settings->system->put('media_img_use_dto_first',!empty($_POST['media_img_use_dto_first'])); |
---|
[2799] | 276 | $blog_settings->system->put('media_img_no_date_alone',!empty($_POST['media_img_no_date_alone'])); |
---|
[887] | 277 | $blog_settings->system->put('media_img_default_size',$_POST['media_img_default_size']); |
---|
| 278 | $blog_settings->system->put('media_img_default_alignment',$_POST['media_img_default_alignment']); |
---|
| 279 | $blog_settings->system->put('media_img_default_link',!empty($_POST['media_img_default_link'])); |
---|
[3446] | 280 | $blog_settings->system->put('media_img_default_legend',$_POST['media_img_default_legend']); |
---|
[0] | 281 | $blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed); |
---|
| 282 | $blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed); |
---|
| 283 | $blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items'])); |
---|
| 284 | if (isset($_POST['robots_policy'])) { |
---|
| 285 | $blog_settings->system->put('robots_policy',$_POST['robots_policy']); |
---|
| 286 | } |
---|
[2800] | 287 | $blog_settings->system->put('jquery_version',$_POST['jquery_version']); |
---|
[2797] | 288 | $blog_settings->system->put('prevents_clickjacking',!empty($_POST['prevents_clickjacking'])); |
---|
[2566] | 289 | |
---|
[0] | 290 | # --BEHAVIOR-- adminBeforeBlogSettingsUpdate |
---|
| 291 | $core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings); |
---|
[2566] | 292 | |
---|
[0] | 293 | if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) { |
---|
| 294 | $blog_settings->system->put('url_scan',$_POST['url_scan']); |
---|
| 295 | } |
---|
[2189] | 296 | dcPage::addSuccessNotice(__('Blog has been successfully updated.')); |
---|
| 297 | |
---|
[0] | 298 | http::redirect(sprintf($redir,$blog_id)); |
---|
| 299 | } |
---|
| 300 | catch (Exception $e) |
---|
| 301 | { |
---|
| 302 | $core->error->add($e->getMessage()); |
---|
| 303 | } |
---|
| 304 | } |
---|
| 305 | |
---|
[3444] | 306 | // Display |
---|
| 307 | |
---|
[1358] | 308 | if ($standalone) { |
---|
| 309 | $breadcrumb = dcPage::breadcrumb( |
---|
| 310 | array( |
---|
| 311 | html::escapeHTML($blog_name) => '', |
---|
[2166] | 312 | __('Blog settings') => '' |
---|
| 313 | ) |
---|
| 314 | ); |
---|
[1358] | 315 | } else { |
---|
| 316 | $breadcrumb = dcPage::breadcrumb( |
---|
| 317 | array( |
---|
| 318 | __('System') => '', |
---|
[2720] | 319 | __('Blogs') => $core->adminurl->get("admin.blogs"), |
---|
[2166] | 320 | __('Blog settings').' : '.html::escapeHTML($blog_name) => '' |
---|
[1358] | 321 | )); |
---|
| 322 | } |
---|
| 323 | |
---|
[3227] | 324 | $desc_editor = $core->auth->getOption('editor'); |
---|
[3330] | 325 | $rte_flag = true; |
---|
| 326 | $rte_flags = @$core->auth->user_prefs->interface->rte_flags; |
---|
| 327 | if (is_array($rte_flags) && in_array('blog_descr',$rte_flags)) { |
---|
| 328 | $rte_flag = $rte_flags['blog_descr']; |
---|
| 329 | } |
---|
[3227] | 330 | |
---|
[0] | 331 | dcPage::open(__('Blog settings'), |
---|
| 332 | '<script type="text/javascript">'."\n". |
---|
| 333 | dcPage::jsVar('dotclear.msg.warning_path_info', |
---|
| 334 | __('Warning: except for special configurations, it is generally advised to have a trailing "/" in your blog URL in PATH_INFO mode.'))."\n". |
---|
| 335 | dcPage::jsVar('dotclear.msg.warning_query_string', |
---|
[38] | 336 | __('Warning: except for special configurations, it is generally advised to have a trailing "?" in your blog URL in QUERY_STRING mode.'))."\n". |
---|
[0] | 337 | "</script>". |
---|
| 338 | dcPage::jsConfirmClose('blog-form'). |
---|
[3330] | 339 | ($rte_flag ? $core->callBehavior('adminPostEditor',$desc_editor['xhtml'],'blog_desc',array('#blog_desc'),'xhtml') : ''). |
---|
[0] | 340 | dcPage::jsLoad('js/_blog_pref.js'). |
---|
[2566] | 341 | |
---|
[0] | 342 | # --BEHAVIOR-- adminBlogPreferencesHeaders |
---|
| 343 | $core->callBehavior('adminBlogPreferencesHeaders'). |
---|
[2566] | 344 | |
---|
[1358] | 345 | dcPage::jsPageTabs(), |
---|
| 346 | $breadcrumb |
---|
[0] | 347 | ); |
---|
| 348 | |
---|
| 349 | if ($blog_id) |
---|
| 350 | { |
---|
| 351 | if (!empty($_GET['add'])) { |
---|
[1553] | 352 | dcPage::success(__('Blog has been successfully created.')); |
---|
[0] | 353 | } |
---|
[2566] | 354 | |
---|
[0] | 355 | if (!empty($_GET['upd'])) { |
---|
[1553] | 356 | dcPage::success(__('Blog has been successfully updated.')); |
---|
[0] | 357 | } |
---|
[2566] | 358 | |
---|
[0] | 359 | echo |
---|
| 360 | '<div class="multi-part" id="params" title="'.__('Parameters').'">'. |
---|
[1979] | 361 | '<h3 class="out-of-screen-if-js">'.__('Parameters').'</h3>'. |
---|
[0] | 362 | '<form action="'.$action.'" method="post" id="blog-form">'; |
---|
[2566] | 363 | |
---|
[0] | 364 | echo |
---|
[1499] | 365 | '<div class="fieldset"><h4>'.__('Blog details').'</h4>'. |
---|
[0] | 366 | $core->formNonce(); |
---|
[2566] | 367 | |
---|
[3444] | 368 | echo |
---|
| 369 | '<p><label for="blog_name" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label>'. |
---|
[3639] | 370 | form::field('blog_name',30,255,html::escapeHTML($blog_name),'','',false,'required placeholder="'.__('Blog name').'"').'</p>'; |
---|
[3444] | 371 | |
---|
| 372 | echo |
---|
| 373 | '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label>'. |
---|
| 374 | form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'; |
---|
| 375 | |
---|
[0] | 376 | if ($core->auth->isSuperAdmin()) |
---|
| 377 | { |
---|
| 378 | echo |
---|
[3444] | 379 | '<p><label for="blog_status">'.__('Blog status:').'</label>'. |
---|
| 380 | form::combo('blog_status',$status_combo,$blog_status).'</p>'; |
---|
| 381 | |
---|
[2969] | 382 | } else { |
---|
| 383 | /* |
---|
| 384 | Only super admins can change the blog ID and URL, but we need to pass |
---|
| 385 | their values to the POST request via hidden html input values so as |
---|
| 386 | to allow admins to update other settings. |
---|
| 387 | Otherwise dcCore::getBlogCursor() throws an exception. |
---|
| 388 | */ |
---|
| 389 | echo form::field('blog_id', 30, 32, html::escapeHTML($blog_id), '', '', false, 'hidden="hidden"'); |
---|
| 390 | echo form::field('blog_url', 50, 255, html::escapeHTML($blog_url), '', '', false, 'hidden="hidden"'); |
---|
[0] | 391 | } |
---|
[2566] | 392 | |
---|
[3444] | 393 | echo '</div>'; |
---|
[2566] | 394 | |
---|
[0] | 395 | echo |
---|
[1499] | 396 | '<div class="fieldset"><h4>'.__('Blog configuration').'</h4>'. |
---|
[3444] | 397 | |
---|
[1399] | 398 | '<p><label for="editor">'.__('Blog editor name:').'</label>'. |
---|
[0] | 399 | form::field('editor',30,255,html::escapeHTML($blog_settings->system->editor)). |
---|
[1399] | 400 | '</p>'. |
---|
[2566] | 401 | |
---|
[1399] | 402 | '<p><label for="lang">'.__('Default language:').'</label>'. |
---|
[0] | 403 | form::combo('lang',$lang_combo,$blog_settings->system->lang,'l10n'). |
---|
[1399] | 404 | '</p>'. |
---|
[2566] | 405 | |
---|
[1399] | 406 | '<p><label for="blog_timezone">'.__('Blog timezone:').'</label>'. |
---|
[0] | 407 | form::combo('blog_timezone',dt::getZones(true,true),html::escapeHTML($blog_settings->system->blog_timezone)). |
---|
[1399] | 408 | '</p>'. |
---|
[970] | 409 | |
---|
[1399] | 410 | '<p><label for="copyright_notice">'.__('Copyright notice:').'</label>'. |
---|
[970] | 411 | form::field('copyright_notice',30,255,html::escapeHTML($blog_settings->system->copyright_notice)). |
---|
[1399] | 412 | '</p>'. |
---|
[2566] | 413 | |
---|
[1499] | 414 | '</div>'; |
---|
[2566] | 415 | |
---|
[0] | 416 | echo |
---|
[1499] | 417 | '<div class="fieldset"><h4>'.__('Comments and trackbacks').'</h4>'. |
---|
| 418 | |
---|
[0] | 419 | '<div class="two-cols">'. |
---|
[1499] | 420 | |
---|
[0] | 421 | '<div class="col">'. |
---|
[38] | 422 | '<p><label for="allow_comments" class="classic">'. |
---|
[0] | 423 | form::checkbox('allow_comments','1',$blog_settings->system->allow_comments). |
---|
[2566] | 424 | __('Accept comments').'</label></p>'. |
---|
[38] | 425 | '<p><label for="comments_pub" class="classic">'. |
---|
[0] | 426 | form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub). |
---|
[2566] | 427 | __('Moderate comments').'</label></p>'. |
---|
[1971] | 428 | '<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days').'.', |
---|
[0] | 429 | form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)). |
---|
| 430 | '</label></p>'. |
---|
[2566] | 431 | '<p class="form-note">'.__('No limit: leave blank.').'</p>'. |
---|
[38] | 432 | '<p><label for="wiki_comments" class="classic">'. |
---|
[0] | 433 | form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments). |
---|
| 434 | __('Wiki syntax for comments').'</label></p>'. |
---|
[2776] | 435 | '<p><label for="comment_preview_optional" class="classic">'. |
---|
| 436 | form::checkbox('comment_preview_optional','1',$blog_settings->system->comment_preview_optional). |
---|
| 437 | __('Preview of comment before submit is not mandatory').'</label></p>'. |
---|
[0] | 438 | '</div>'. |
---|
[2566] | 439 | |
---|
[0] | 440 | '<div class="col">'. |
---|
[38] | 441 | '<p><label for="allow_trackbacks" class="classic">'. |
---|
[0] | 442 | form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks). |
---|
[2566] | 443 | __('Accept trackbacks').'</label></p>'. |
---|
[38] | 444 | '<p><label for="trackbacks_pub" class="classic">'. |
---|
[0] | 445 | form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub). |
---|
[2566] | 446 | __('Moderate trackbacks').'</label></p>'. |
---|
[1971] | 447 | '<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days').'.', |
---|
[0] | 448 | form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'. |
---|
[2566] | 449 | '<p class="form-note">'.__('No limit: leave blank.').'</p>'. |
---|
[38] | 450 | '<p><label for="comments_nofollow" class="classic">'. |
---|
[0] | 451 | form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow). |
---|
| 452 | __('Add "nofollow" relation on comments and trackbacks links').'</label></p>'. |
---|
| 453 | '</div>'. |
---|
[3560] | 454 | '<br class="clear" />'. //Opera sucks |
---|
[1499] | 455 | |
---|
[0] | 456 | '</div>'. |
---|
[3560] | 457 | '<br class="clear" />'. //Opera sucks |
---|
[1499] | 458 | '</div>'; |
---|
[2566] | 459 | |
---|
[0] | 460 | echo |
---|
[1499] | 461 | '<div class="fieldset"><h4>'.__('Blog presentation').'</h4>'. |
---|
[0] | 462 | '<div class="two-cols">'. |
---|
| 463 | '<div class="col">'. |
---|
[2025] | 464 | '<p><label for="date_format">'.__('Date format:').'</label> '. |
---|
[0] | 465 | form::field('date_format',30,255,html::escapeHTML($blog_settings->system->date_format)). |
---|
[2025] | 466 | form::combo('date_format_select',$date_formats_combo,'','','',false,'title="'.__('Pattern of date').'"'). |
---|
[1399] | 467 | '</p>'. |
---|
[2028] | 468 | '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->date_format)).'</p>'. |
---|
[2019] | 469 | |
---|
[1399] | 470 | '<p><label for="time_format">'.__('Time format:').'</label>'. |
---|
[0] | 471 | form::field('time_format',30,255,html::escapeHTML($blog_settings->system->time_format)). |
---|
[2025] | 472 | form::combo('time_format_select',$time_formats_combo,'','','',false,'title="'.__('Pattern of time').'"'). |
---|
[1399] | 473 | '</p>'. |
---|
[2028] | 474 | '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->time_format)).'</p>'. |
---|
[2566] | 475 | |
---|
[38] | 476 | '<p><label for="use_smilies" class="classic">'. |
---|
[0] | 477 | form::checkbox('use_smilies','1',$blog_settings->system->use_smilies). |
---|
| 478 | __('Display smilies on entries and comments').'</label></p>'. |
---|
[3030] | 479 | |
---|
| 480 | '<p><label for="no_search" class="classic">'. |
---|
| 481 | form::checkbox('no_search','1',$blog_settings->system->no_search). |
---|
| 482 | __('Disable internal search system').'</label></p>'. |
---|
[0] | 483 | '</div>'. |
---|
[2566] | 484 | |
---|
[0] | 485 | '<div class="col">'. |
---|
[2577] | 486 | '<p><label for="nb_post_for_home" class="classic">'.sprintf(__('Display %s entries on home page'), |
---|
| 487 | form::field('nb_post_for_home',2,3,$blog_settings->system->nb_post_for_home)). |
---|
| 488 | '</label></p>'. |
---|
| 489 | |
---|
[38] | 490 | '<p><label for="nb_post_per_page" class="classic">'.sprintf(__('Display %s entries per page'), |
---|
[0] | 491 | form::field('nb_post_per_page',2,3,$blog_settings->system->nb_post_per_page)). |
---|
| 492 | '</label></p>'. |
---|
[2566] | 493 | |
---|
[38] | 494 | '<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'), |
---|
[0] | 495 | form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)). |
---|
| 496 | '</label></p>'. |
---|
[2566] | 497 | |
---|
[38] | 498 | '<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'), |
---|
[0] | 499 | form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)). |
---|
| 500 | '</label></p>'. |
---|
[2566] | 501 | |
---|
[38] | 502 | '<p><label for="short_feed_items" class="classic">'. |
---|
[0] | 503 | form::checkbox('short_feed_items','1',$blog_settings->system->short_feed_items). |
---|
| 504 | __('Truncate feeds').'</label></p>'. |
---|
[2566] | 505 | |
---|
[2198] | 506 | '<p><label for="inc_subcats" class="classic">'. |
---|
| 507 | form::checkbox('inc_subcats','1',$blog_settings->system->inc_subcats). |
---|
| 508 | __('Include sub-categories in category page and category posts feed').'</label></p>'. |
---|
[0] | 509 | '</div>'. |
---|
| 510 | '</div>'. |
---|
[3560] | 511 | '<br class="clear" />'. //Opera sucks |
---|
[1499] | 512 | '</div>'; |
---|
[2566] | 513 | |
---|
[0] | 514 | echo |
---|
[1979] | 515 | '<div class="fieldset"><h4 id="medias-settings">'.__('Media and images').'</h4>'. |
---|
| 516 | '<p class="form-note warning">'. |
---|
| 517 | __('Please note that if you change current settings bellow, they will now apply to all new images in the media manager.'). |
---|
| 518 | ' '.__('Be carefull if you share it with other blogs in your installation.').'</p>'. |
---|
| 519 | |
---|
[0] | 520 | '<div class="two-cols">'. |
---|
| 521 | '<div class="col">'. |
---|
[3394] | 522 | '<h5>'.__('Generated image sizes (max dimension in pixels)').'</h5>'. |
---|
[3091] | 523 | '<p class="field"><label for="media_img_t_size">'.__('Thumbnail').'</label> '. |
---|
[1846] | 524 | form::field('media_img_t_size',3,3,$blog_settings->system->media_img_t_size).'</p>'. |
---|
[2566] | 525 | |
---|
[3091] | 526 | '<p class="field"><label for="media_img_s_size">'.__('Small').'</label> '. |
---|
[1846] | 527 | form::field('media_img_s_size',3,3,$blog_settings->system->media_img_s_size).'</p>'. |
---|
[2566] | 528 | |
---|
[3091] | 529 | '<p class="field"><label for="media_img_m_size">'.__('Medium').'</label> '. |
---|
[1846] | 530 | form::field('media_img_m_size',3,3,$blog_settings->system->media_img_m_size).'</p>'. |
---|
[3112] | 531 | |
---|
| 532 | '<h5>'.__('Default size of the inserted video (in pixels)').'</h5>'. |
---|
| 533 | '<p class="field"><label for="media_video_width">'.__('Width').'</label> '. |
---|
| 534 | form::field('media_video_width',3,3,$blog_settings->system->media_video_width).'</p>'. |
---|
| 535 | |
---|
| 536 | '<p class="field"><label for="media_video_height">'.__('Height').'</label> '. |
---|
| 537 | form::field('media_video_height',3,3,$blog_settings->system->media_video_height).'</p>'. |
---|
[3138] | 538 | |
---|
| 539 | '<h5>'.__('Flash player').'</h5>'. |
---|
| 540 | '<p><label for="media_flash_fallback">'. |
---|
| 541 | form::checkbox('media_flash_fallback','1',$blog_settings->system->media_flash_fallback). |
---|
| 542 | __('Insert Flash player fallback for video (mp4 or m4v) and audio (mp3) media').'</label></p>'. |
---|
| 543 | '<p class="form-note info">'.__('For flv video, the Flash player will be anyway inserted.').'</p>'. |
---|
[0] | 544 | '</div>'. |
---|
[2566] | 545 | |
---|
[0] | 546 | '<div class="col">'. |
---|
[1846] | 547 | '<h5>'.__('Default image insertion attributes').'</h5>'. |
---|
[1848] | 548 | '<p class="vertical-separator"><label for="media_img_title_pattern">'.__('Inserted image title').'</label>'. |
---|
[2799] | 549 | form::combo('media_img_title_pattern',$img_title_combo,html::escapeHTML($blog_settings->system->media_img_title_pattern)).'</p>'. |
---|
| 550 | '<p><label for="media_img_use_dto_first" class="classic">'. |
---|
[1073] | 551 | form::checkbox('media_img_use_dto_first','1',$blog_settings->system->media_img_use_dto_first). |
---|
| 552 | __('Use original media date if possible').'</label></p>'. |
---|
[2799] | 553 | '<p><label for="media_img_no_date_alone" class="classic">'. |
---|
| 554 | form::checkbox('media_img_no_date_alone','1',$blog_settings->system->media_img_no_date_alone). |
---|
| 555 | __('Do not display date if alone in title').'</label></p>'. |
---|
[1848] | 556 | '<p class="form-note info">'.__('It is retrieved from the picture\'s metadata.').'</p>'. |
---|
[887] | 557 | |
---|
[1848] | 558 | '<p class="field vertical-separator"><label for="media_img_default_size">'.__('Size of inserted image:').'</label>'. |
---|
[887] | 559 | form::combo('media_img_default_size',$img_default_size_combo, |
---|
| 560 | (html::escapeHTML($blog_settings->system->media_img_default_size) != '' ? html::escapeHTML($blog_settings->system->media_img_default_size) : 'm')). |
---|
[1399] | 561 | '</p>'. |
---|
[1846] | 562 | '<p class="field"><label for="media_img_default_alignment">'.__('Image alignment:').'</label>'. |
---|
[887] | 563 | form::combo('media_img_default_alignment',$img_default_alignment_combo,html::escapeHTML($blog_settings->system->media_img_default_alignment)). |
---|
[1399] | 564 | '</p>'. |
---|
[1846] | 565 | '<p><label for="media_img_default_link">'. |
---|
[887] | 566 | form::checkbox('media_img_default_link','1',$blog_settings->system->media_img_default_link). |
---|
[1846] | 567 | __('Insert a link to the original image').'</label></p>'. |
---|
[3446] | 568 | '<p class="field"><label for="media_img_default_legend">'.__('Image legend and title:').'</label>'. |
---|
| 569 | form::combo('media_img_default_legend',$img_default_legend_combo,html::escapeHTML($blog_settings->system->media_img_default_legend)). |
---|
| 570 | '</p>'. |
---|
[0] | 571 | '</div>'. |
---|
[887] | 572 | '</div>'. |
---|
[3560] | 573 | '<br class="clear" />'. //Opera sucks |
---|
[887] | 574 | |
---|
[1499] | 575 | '</div>'; |
---|
[2566] | 576 | |
---|
[3444] | 577 | echo '<div id="advanced-pref"><h3>'.__('Advanced parameters').'</h3>'; |
---|
| 578 | |
---|
| 579 | if ($core->auth->isSuperAdmin()) |
---|
| 580 | { |
---|
| 581 | echo '<div class="fieldset"><h4>'.__('Blog details').'</h4>'; |
---|
| 582 | echo |
---|
| 583 | '<p><label for="blog_id" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:').'</label>'. |
---|
[3639] | 584 | form::field('blog_id',30,32,html::escapeHTML($blog_id),'','',false,'required placeholder="'.__('Blog ID').'"').'</p>'. |
---|
[3444] | 585 | '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '. |
---|
| 586 | '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>'; |
---|
| 587 | |
---|
| 588 | echo |
---|
| 589 | '<p><label for="blog_url" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label>'. |
---|
[3639] | 590 | form::field('blog_url',50,255,html::escapeHTML($blog_url),'','',false,'required placeholder="'.__('Blog URL').'"').'</p>'. |
---|
[3444] | 591 | |
---|
| 592 | '<p><label for="url_scan">'.__('URL scan method:').'</label>'. |
---|
| 593 | form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</p>'; |
---|
| 594 | |
---|
| 595 | try |
---|
| 596 | { |
---|
| 597 | # Test URL of blog by testing it's ATOM feed |
---|
| 598 | $file = $blog_url.$core->url->getURLFor('feed','atom'); |
---|
| 599 | $path = ''; |
---|
| 600 | $status = '404'; |
---|
| 601 | $content = ''; |
---|
| 602 | |
---|
| 603 | $client = netHttp::initClient($file,$path); |
---|
| 604 | if ($client !== false) { |
---|
| 605 | $client->setTimeout(4); |
---|
| 606 | $client->setUserAgent($_SERVER['HTTP_USER_AGENT']); |
---|
| 607 | $client->get($path); |
---|
| 608 | $status = $client->getStatus(); |
---|
| 609 | $content = $client->getContent(); |
---|
| 610 | } |
---|
| 611 | if ($status != '200') { |
---|
| 612 | // Might be 404 (URL not found), 670 (blog not online), ... |
---|
| 613 | echo |
---|
| 614 | '<p class="form-note warn">'. |
---|
| 615 | sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> return a <strong>%s</strong> status).'), |
---|
[3547] | 616 | html::escapeHTML($file),$status). |
---|
[3444] | 617 | '</p>'; |
---|
| 618 | } else { |
---|
| 619 | if (substr($content,0,6) != '<?xml ') { |
---|
| 620 | // Not well formed XML feed |
---|
| 621 | echo |
---|
| 622 | '<p class="form-note warn">'. |
---|
| 623 | sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> does not return an ATOM feed).'), |
---|
[3547] | 624 | html::escapeHTML($file)). |
---|
[3444] | 625 | '</p>'; |
---|
| 626 | } |
---|
| 627 | } |
---|
| 628 | } |
---|
| 629 | catch (Exception $e) |
---|
| 630 | { |
---|
| 631 | $core->error->add($e->getMessage()); |
---|
| 632 | } |
---|
| 633 | echo '</div>'; |
---|
| 634 | } |
---|
| 635 | |
---|
[0] | 636 | echo |
---|
[3444] | 637 | '<div class="fieldset"><h4>'.__('Blog configuration').'</h4>'. |
---|
| 638 | |
---|
| 639 | '<p><label for="post_url_format">'.__('New post URL format:').'</label>'. |
---|
| 640 | form::combo('post_url_format',$post_url_combo,html::escapeHTML($blog_settings->system->post_url_format)). |
---|
| 641 | '</p>'. |
---|
| 642 | '<p class="chosen form-note">'.__('Sample:').' '.$core->blog->getPostURL('',date('Y-m-d H:i:00',$now),__('Dotclear'),42).'</p>'. |
---|
| 643 | '</p>'. |
---|
| 644 | |
---|
| 645 | '<p><label for="note_title_tag">'.__('HTML tag for the title of the notes on the blog:').'</label>'. |
---|
| 646 | form::combo('note_title_tag',$note_title_tag_combo,$blog_settings->system->note_title_tag). |
---|
| 647 | '</p>'. |
---|
| 648 | |
---|
| 649 | '<p><label for="enable_xmlrpc" class="classic">'. |
---|
| 650 | form::checkbox('enable_xmlrpc','1',$blog_settings->system->enable_xmlrpc). |
---|
| 651 | __('Enable XML/RPC interface').'</label>'.'</p>'. |
---|
| 652 | '<p class="form-note info">'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>'; |
---|
| 653 | |
---|
| 654 | if ($blog_settings->system->enable_xmlrpc) { |
---|
| 655 | echo |
---|
| 656 | '<p>'.__('XML/RPC interface is active. You should set the following parameters on your XML/RPC client:').'</p>'. |
---|
| 657 | '<ul>'. |
---|
| 658 | '<li>'.__('Server URL:').' <strong><code>'. |
---|
| 659 | sprintf(DC_XMLRPC_URL,$core->blog->url,$core->blog->id). |
---|
| 660 | '</code></strong></li>'. |
---|
| 661 | '<li>'.__('Blogging system:').' <strong><code>Movable Type</code></strong></li>'. |
---|
| 662 | '<li>'.__('User name:').' <strong><code>'.$core->auth->userID().'</code></strong></li>'. |
---|
| 663 | '<li>'.__('Password:').' <strong><code><'.__('your password').'></code></strong></li>'. |
---|
| 664 | '<li>'.__('Blog ID:').' <strong><code>1</code></strong></li>'. |
---|
| 665 | '</ul>'; |
---|
| 666 | } |
---|
| 667 | |
---|
| 668 | echo |
---|
| 669 | '</div>'; |
---|
| 670 | |
---|
| 671 | // Search engines policies |
---|
| 672 | echo '<div class="fieldset"><h4>'.__('Search engines robots policy').'</h4>'; |
---|
[2566] | 673 | |
---|
[122] | 674 | $i = 0; |
---|
[0] | 675 | foreach ($robots_policy_options as $k => $v) |
---|
| 676 | { |
---|
[122] | 677 | echo '<p><label for="robots_policy-'.$i.'" class="classic">'. |
---|
| 678 | form::radio(array('robots_policy','robots_policy-'.$i),$k,$blog_settings->system->robots_policy == $k).' '.$v.'</label></p>'; |
---|
| 679 | $i++; |
---|
[0] | 680 | } |
---|
[2566] | 681 | |
---|
[1499] | 682 | echo '</div>'; |
---|
[2566] | 683 | |
---|
[3444] | 684 | echo '<div class="fieldset"><h4>'.__('jQuery javascript library').'</h4>'. |
---|
| 685 | |
---|
[2800] | 686 | '<p><label for="jquery_version" class="classic">'.__('jQuery version to be loaded for this blog:').'</label>'.' '. |
---|
| 687 | form::combo('jquery_version',$jquery_versions_combo,$blog_settings->system->jquery_version). |
---|
| 688 | '</p>'. |
---|
[3560] | 689 | '<br class="clear" />'. //Opera sucks |
---|
[3444] | 690 | |
---|
[2800] | 691 | '</div>'; |
---|
| 692 | |
---|
[3444] | 693 | echo '<div class="fieldset"><h4>'.__('Blog security').'</h4>'. |
---|
| 694 | |
---|
[2797] | 695 | '<p><label for="prevents_clickjacking" class="classic">'. |
---|
| 696 | form::checkbox('prevents_clickjacking','1',$blog_settings->system->prevents_clickjacking). |
---|
| 697 | __('Protect the blog from Clickjacking (see <a href="https://en.wikipedia.org/wiki/Clickjacking">Wikipedia</a>)').'</label></p>'. |
---|
[3560] | 698 | '<br class="clear" />'. //Opera sucks |
---|
[3444] | 699 | |
---|
[2797] | 700 | '</div>'; |
---|
[2566] | 701 | |
---|
[3444] | 702 | echo '</div>'; // End advanced |
---|
| 703 | |
---|
| 704 | echo '<div id="plugins-pref"><h3>'.__('Plugins parameters').'</h3>'; |
---|
| 705 | |
---|
[0] | 706 | # --BEHAVIOR-- adminBlogPreferencesForm |
---|
| 707 | $core->callBehavior('adminBlogPreferencesForm',$core,$blog_settings); |
---|
[2566] | 708 | |
---|
[3444] | 709 | echo '</div>'; // End 3rd party, aka plugins |
---|
| 710 | |
---|
[0] | 711 | echo |
---|
[217] | 712 | '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'. |
---|
[0] | 713 | (!$standalone ? form::hidden('id',$blog_id) : ''). |
---|
| 714 | '</p>'. |
---|
| 715 | '</form>'; |
---|
[2566] | 716 | |
---|
[0] | 717 | if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id) |
---|
| 718 | { |
---|
| 719 | echo |
---|
[2720] | 720 | '<form action="'.$core->adminurl->get("admin.blog.del").'" method="post">'. |
---|
[3] | 721 | '<p><input type="submit" class="delete" value="'.__('Delete this blog').'" />'. |
---|
[0] | 722 | form::hidden(array('blog_id'),$blog_id). |
---|
| 723 | $core->formNonce().'</p>'. |
---|
| 724 | '</form>'; |
---|
[953] | 725 | } else { |
---|
| 726 | if ($blog_id == $core->blog->id) { |
---|
[1474] | 727 | echo '<p class="message">'.__('The current blog cannot be deleted.').'</p>'; |
---|
[953] | 728 | } else { |
---|
[1474] | 729 | echo '<p class="message">'.__('Only superadmin can delete a blog.').'</p>'; |
---|
[953] | 730 | } |
---|
[0] | 731 | } |
---|
[2566] | 732 | |
---|
[0] | 733 | echo '</div>'; |
---|
[2566] | 734 | |
---|
[0] | 735 | # |
---|
| 736 | # Users on the blog (with permissions) |
---|
[2566] | 737 | |
---|
[0] | 738 | $blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin()); |
---|
| 739 | $perm_types = $core->auth->getPermissionsTypes(); |
---|
[2566] | 740 | |
---|
[0] | 741 | echo |
---|
| 742 | '<div class="multi-part" id="users" title="'.__('Users').'">'. |
---|
[1979] | 743 | '<h3 class="out-of-screen-if-js">'.__('Users on this blog').'</h3>'; |
---|
[2566] | 744 | |
---|
[0] | 745 | if (empty($blog_users)) |
---|
| 746 | { |
---|
| 747 | echo '<p>'.__('No users').'</p>'; |
---|
| 748 | } |
---|
| 749 | else |
---|
| 750 | { |
---|
| 751 | if ($core->auth->isSuperAdmin()) { |
---|
[2921] | 752 | $user_url_p = '<a href="'.$core->adminurl->get("admin.user",array('id' => '%1$s'),'&',true).'">%1$s</a>'; |
---|
[0] | 753 | } else { |
---|
| 754 | $user_url_p = '%1$s'; |
---|
| 755 | } |
---|
[1696] | 756 | |
---|
| 757 | # Sort users list on user_id key |
---|
[3107] | 758 | dcUtils::lexicalKeySort($blog_users); |
---|
[1696] | 759 | |
---|
[1694] | 760 | $post_type = $core->getPostTypes(); |
---|
| 761 | $current_blog_id = $core->blog->id; |
---|
| 762 | if ($blog_id != $core->blog->id) { |
---|
| 763 | $core->setBlog($blog_id); |
---|
| 764 | } |
---|
| 765 | |
---|
[3444] | 766 | echo '<div>'; |
---|
[0] | 767 | foreach ($blog_users as $k => $v) |
---|
| 768 | { |
---|
| 769 | if (count($v['p']) > 0) |
---|
| 770 | { |
---|
| 771 | echo |
---|
[3444] | 772 | '<div class="user-perm'.($v['super'] ? ' user_super' : '').'">'. |
---|
[0] | 773 | '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). |
---|
| 774 | ' ('.html::escapeHTML(dcUtils::getUserCN( |
---|
| 775 | $k, $v['name'], $v['firstname'], $v['displayname'] |
---|
[1698] | 776 | )).')</h4>'; |
---|
| 777 | |
---|
| 778 | if ($core->auth->isSuperAdmin()) { |
---|
[2566] | 779 | echo |
---|
[1698] | 780 | '<p>'.__('Email:').' '. |
---|
| 781 | ($v['email'] != '' ? '<a href="mailto:'.$v['email'].'">'.$v['email'].'</a>' : __('(none)')). |
---|
| 782 | '</p>'; |
---|
| 783 | } |
---|
| 784 | |
---|
| 785 | echo |
---|
| 786 | '<h5>'.__('Publications on this blog:').'</h5>'. |
---|
| 787 | '<ul>'; |
---|
| 788 | foreach ($post_type as $type => $pt_info) { |
---|
| 789 | $params = array( |
---|
| 790 | 'post_type' => $type, |
---|
| 791 | 'user_id' => $k |
---|
| 792 | ); |
---|
| 793 | echo '<li>'.sprintf(__('%1$s: %2$s'),__($pt_info['label']),$core->blog->getPosts($params,true)->f(0)).'</li>'; |
---|
| 794 | } |
---|
| 795 | echo |
---|
| 796 | '</ul>'; |
---|
| 797 | |
---|
| 798 | echo |
---|
[1682] | 799 | '<h5>'.__('Permissions:').'</h5>'. |
---|
| 800 | '<ul>'; |
---|
[0] | 801 | if ($v['super']) { |
---|
[1979] | 802 | echo '<li class="user_super">'.__('Super administrator').'<br />'. |
---|
| 803 | '<span class="form-note">'.__('All rights on all blogs.').'</span></li>'; |
---|
[0] | 804 | } else { |
---|
| 805 | foreach ($v['p'] as $p => $V) { |
---|
[2223] | 806 | if (isset($perm_types[$p])) { |
---|
| 807 | echo '<li '.($p == 'admin' ? 'class="user_admin"' : '').'>'.__($perm_types[$p]); |
---|
| 808 | } else { |
---|
| 809 | echo '<li>'.sprintf(__('[%s] (unreferenced permission)'),$p); |
---|
| 810 | } |
---|
[1979] | 811 | |
---|
| 812 | if($p == 'admin') { |
---|
| 813 | echo '<br /><span class="form-note">'.__('All rights on this blog.').'</span>'; |
---|
| 814 | } |
---|
| 815 | echo '</li>'; |
---|
[0] | 816 | } |
---|
| 817 | } |
---|
[2566] | 818 | echo |
---|
[1682] | 819 | '</ul>'; |
---|
[2566] | 820 | |
---|
[860] | 821 | if (!$v['super'] && $core->auth->isSuperAdmin()) { |
---|
[2566] | 822 | echo |
---|
[2817] | 823 | '<form action="'.$core->adminurl->get('admin.user.actions').'" method="post">'. |
---|
[1682] | 824 | '<p class="change-user-perm"><input type="submit" class="reset" value="'.__('Change permissions').'" />'. |
---|
[2852] | 825 | form::hidden(array('redir'),$core->adminurl->get("admin.blog.pref",array('id' => $k),'&')). |
---|
[860] | 826 | form::hidden(array('action'),'perms'). |
---|
| 827 | form::hidden(array('users[]'),$k). |
---|
| 828 | form::hidden(array('blogs[]'),$blog_id). |
---|
| 829 | $core->formNonce(). |
---|
| 830 | '</p>'. |
---|
| 831 | '</form>'; |
---|
| 832 | } |
---|
[1682] | 833 | echo '</div>'; |
---|
[0] | 834 | } |
---|
| 835 | } |
---|
[3444] | 836 | echo '</div>'; |
---|
[1694] | 837 | if ($current_blog_id != $core->blog->id) { |
---|
| 838 | $core->setBlog($current_blog_id); |
---|
| 839 | } |
---|
[0] | 840 | } |
---|
[2566] | 841 | |
---|
[0] | 842 | echo '</div>'; |
---|
| 843 | } |
---|
| 844 | |
---|
| 845 | dcPage::helpBlock('core_blog_pref'); |
---|
| 846 | dcPage::close(); |
---|