[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; |
---|
| 27 | |
---|
| 28 | $action = 'blog_pref.php'; |
---|
[2189] | 29 | $redir = 'blog_pref.php'; |
---|
[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']); |
---|
| 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'; |
---|
[2189] | 58 | $redir = 'blog.php?id=%s'; |
---|
[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(); |
---|
[2295] | 69 | $date_formats = unserialize($blog_settings->system->date_formats); |
---|
| 70 | $time_formats = unserialize($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 | |
---|
[0] | 139 | # Robots policy options |
---|
| 140 | $robots_policy_options = array( |
---|
| 141 | 'INDEX,FOLLOW' => __("I would like search engines and archivers to index and archive my blog's content."), |
---|
| 142 | 'INDEX,FOLLOW,NOARCHIVE' => __("I would like search engines and archivers to index but not archive my blog's content."), |
---|
| 143 | 'NOINDEX,NOFOLLOW,NOARCHIVE' => __("I would like to prevent search engines and archivers from indexing or archiving my blog's content."), |
---|
| 144 | ); |
---|
| 145 | |
---|
| 146 | # Update a blog |
---|
| 147 | if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id)) |
---|
| 148 | { |
---|
| 149 | $cur = $core->con->openCursor($core->prefix.'blog'); |
---|
| 150 | if ($core->auth->isSuperAdmin()) { |
---|
| 151 | $cur->blog_id = $_POST['blog_id']; |
---|
| 152 | $cur->blog_url = preg_replace('/\?+$/','?',$_POST['blog_url']); |
---|
| 153 | if (in_array($_POST['blog_status'],$status_combo)) { |
---|
| 154 | $cur->blog_status = (integer) $_POST['blog_status']; |
---|
| 155 | } |
---|
| 156 | } |
---|
| 157 | $cur->blog_name = $_POST['blog_name']; |
---|
| 158 | $cur->blog_desc = $_POST['blog_desc']; |
---|
| 159 | |
---|
| 160 | $media_img_t_size = abs((integer) $_POST['media_img_t_size']); |
---|
| 161 | if ($media_img_t_size < 0) { $media_img_t_size = 100; } |
---|
| 162 | |
---|
| 163 | $media_img_s_size = abs((integer) $_POST['media_img_s_size']); |
---|
| 164 | if ($media_img_s_size < 0) { $media_img_s_size = 240; } |
---|
| 165 | |
---|
| 166 | $media_img_m_size = abs((integer) $_POST['media_img_m_size']); |
---|
| 167 | if ($media_img_m_size < 0) { $media_img_m_size = 448; } |
---|
| 168 | |
---|
| 169 | $nb_post_per_page = abs((integer) $_POST['nb_post_per_page']); |
---|
| 170 | if ($nb_post_per_page <= 1) { $nb_post_per_page = 1; } |
---|
| 171 | |
---|
| 172 | $nb_post_per_feed = abs((integer) $_POST['nb_post_per_feed']); |
---|
| 173 | if ($nb_post_per_feed <= 1) { $nb_post_per_feed = 1; } |
---|
| 174 | |
---|
| 175 | $nb_comment_per_feed = abs((integer) $_POST['nb_comment_per_feed']); |
---|
| 176 | if ($nb_comment_per_feed <= 1) { $nb_comment_per_feed = 1; } |
---|
| 177 | |
---|
| 178 | try |
---|
| 179 | { |
---|
| 180 | if ($cur->blog_id != null && $cur->blog_id != $blog_id) { |
---|
| 181 | $rs = $core->getBlog($cur->blog_id); |
---|
| 182 | |
---|
| 183 | if ($rs) { |
---|
[1615] | 184 | throw new Exception(__('This blog ID is already used.')); |
---|
[0] | 185 | } |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | # --BEHAVIOR-- adminBeforeBlogUpdate |
---|
| 189 | $core->callBehavior('adminBeforeBlogUpdate',$cur,$blog_id); |
---|
| 190 | |
---|
| 191 | if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_POST['lang'])) { |
---|
| 192 | throw new Exception(__('Invalid language code')); |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | $core->updBlog($blog_id,$cur); |
---|
| 196 | |
---|
| 197 | # --BEHAVIOR-- adminAfterBlogUpdate |
---|
| 198 | $core->callBehavior('adminAfterBlogUpdate',$cur,$blog_id); |
---|
| 199 | |
---|
| 200 | if ($cur->blog_id != null && $cur->blog_id != $blog_id) { |
---|
| 201 | if ($blog_id == $core->blog->id) { |
---|
| 202 | $core->setBlog($cur->blog_id); |
---|
| 203 | $_SESSION['sess_blog_id'] = $cur->blog_id; |
---|
| 204 | $blog_settings = $core->blog->settings; |
---|
| 205 | } else { |
---|
| 206 | $blog_settings = new dcSettings($core,$cur->blog_id); |
---|
| 207 | } |
---|
| 208 | |
---|
| 209 | $blog_id = $cur->blog_id; |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | |
---|
| 213 | $blog_settings->addNameSpace('system'); |
---|
| 214 | |
---|
| 215 | $blog_settings->system->put('editor',$_POST['editor']); |
---|
| 216 | $blog_settings->system->put('copyright_notice',$_POST['copyright_notice']); |
---|
| 217 | $blog_settings->system->put('post_url_format',$_POST['post_url_format']); |
---|
| 218 | $blog_settings->system->put('lang',$_POST['lang']); |
---|
| 219 | $blog_settings->system->put('blog_timezone',$_POST['blog_timezone']); |
---|
| 220 | $blog_settings->system->put('date_format',$_POST['date_format']); |
---|
| 221 | $blog_settings->system->put('time_format',$_POST['time_format']); |
---|
| 222 | $blog_settings->system->put('comments_ttl',abs((integer) $_POST['comments_ttl'])); |
---|
| 223 | $blog_settings->system->put('trackbacks_ttl',abs((integer) $_POST['trackbacks_ttl'])); |
---|
| 224 | $blog_settings->system->put('allow_comments',!empty($_POST['allow_comments'])); |
---|
| 225 | $blog_settings->system->put('allow_trackbacks',!empty($_POST['allow_trackbacks'])); |
---|
| 226 | $blog_settings->system->put('comments_pub',empty($_POST['comments_pub'])); |
---|
| 227 | $blog_settings->system->put('trackbacks_pub',empty($_POST['trackbacks_pub'])); |
---|
| 228 | $blog_settings->system->put('comments_nofollow',!empty($_POST['comments_nofollow'])); |
---|
| 229 | $blog_settings->system->put('wiki_comments',!empty($_POST['wiki_comments'])); |
---|
| 230 | $blog_settings->system->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc'])); |
---|
[970] | 231 | $blog_settings->system->put('note_title_tag',$_POST['note_title_tag']); |
---|
[0] | 232 | |
---|
| 233 | $blog_settings->system->put('nb_post_per_page',$nb_post_per_page); |
---|
| 234 | $blog_settings->system->put('use_smilies',!empty($_POST['use_smilies'])); |
---|
[2198] | 235 | $blog_settings->system->put('inc_subcats',!empty($_POST['inc_subcats'])); |
---|
[0] | 236 | $blog_settings->system->put('media_img_t_size',$media_img_t_size); |
---|
| 237 | $blog_settings->system->put('media_img_s_size',$media_img_s_size); |
---|
| 238 | $blog_settings->system->put('media_img_m_size',$media_img_m_size); |
---|
| 239 | $blog_settings->system->put('media_img_title_pattern',$_POST['media_img_title_pattern']); |
---|
[1073] | 240 | $blog_settings->system->put('media_img_use_dto_first',!empty($_POST['media_img_use_dto_first'])); |
---|
[887] | 241 | $blog_settings->system->put('media_img_default_size',$_POST['media_img_default_size']); |
---|
| 242 | $blog_settings->system->put('media_img_default_alignment',$_POST['media_img_default_alignment']); |
---|
| 243 | $blog_settings->system->put('media_img_default_link',!empty($_POST['media_img_default_link'])); |
---|
[0] | 244 | $blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed); |
---|
| 245 | $blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed); |
---|
| 246 | $blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items'])); |
---|
| 247 | |
---|
| 248 | if (isset($_POST['robots_policy'])) { |
---|
| 249 | $blog_settings->system->put('robots_policy',$_POST['robots_policy']); |
---|
| 250 | } |
---|
| 251 | |
---|
| 252 | # --BEHAVIOR-- adminBeforeBlogSettingsUpdate |
---|
| 253 | $core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings); |
---|
| 254 | |
---|
| 255 | if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) { |
---|
| 256 | $blog_settings->system->put('url_scan',$_POST['url_scan']); |
---|
| 257 | } |
---|
[2189] | 258 | dcPage::addSuccessNotice(__('Blog has been successfully updated.')); |
---|
| 259 | |
---|
[0] | 260 | http::redirect(sprintf($redir,$blog_id)); |
---|
| 261 | } |
---|
| 262 | catch (Exception $e) |
---|
| 263 | { |
---|
| 264 | $core->error->add($e->getMessage()); |
---|
| 265 | } |
---|
| 266 | } |
---|
| 267 | |
---|
[1358] | 268 | if ($standalone) { |
---|
| 269 | $breadcrumb = dcPage::breadcrumb( |
---|
| 270 | array( |
---|
| 271 | html::escapeHTML($blog_name) => '', |
---|
[2166] | 272 | __('Blog settings') => '' |
---|
| 273 | ) |
---|
| 274 | ); |
---|
[1358] | 275 | } else { |
---|
| 276 | $breadcrumb = dcPage::breadcrumb( |
---|
| 277 | array( |
---|
| 278 | __('System') => '', |
---|
| 279 | __('Blogs') => 'blogs.php', |
---|
[2166] | 280 | __('Blog settings').' : '.html::escapeHTML($blog_name) => '' |
---|
[1358] | 281 | )); |
---|
| 282 | } |
---|
| 283 | |
---|
[0] | 284 | dcPage::open(__('Blog settings'), |
---|
| 285 | '<script type="text/javascript">'."\n". |
---|
| 286 | "//<![CDATA["."\n". |
---|
| 287 | dcPage::jsVar('dotclear.msg.warning_path_info', |
---|
| 288 | __('Warning: except for special configurations, it is generally advised to have a trailing "/" in your blog URL in PATH_INFO mode.'))."\n". |
---|
| 289 | dcPage::jsVar('dotclear.msg.warning_query_string', |
---|
[38] | 290 | __('Warning: except for special configurations, it is generally advised to have a trailing "?" in your blog URL in QUERY_STRING mode.'))."\n". |
---|
[0] | 291 | "//]]>". |
---|
| 292 | "</script>". |
---|
| 293 | dcPage::jsConfirmClose('blog-form'). |
---|
| 294 | dcPage::jsLoad('js/_blog_pref.js'). |
---|
| 295 | |
---|
| 296 | |
---|
| 297 | # --BEHAVIOR-- adminBlogPreferencesHeaders |
---|
| 298 | $core->callBehavior('adminBlogPreferencesHeaders'). |
---|
| 299 | |
---|
[1358] | 300 | dcPage::jsPageTabs(), |
---|
| 301 | $breadcrumb |
---|
[0] | 302 | ); |
---|
| 303 | |
---|
| 304 | if ($blog_id) |
---|
| 305 | { |
---|
| 306 | if (!empty($_GET['add'])) { |
---|
[1553] | 307 | dcPage::success(__('Blog has been successfully created.')); |
---|
[0] | 308 | } |
---|
| 309 | |
---|
| 310 | if (!empty($_GET['upd'])) { |
---|
[1553] | 311 | dcPage::success(__('Blog has been successfully updated.')); |
---|
[0] | 312 | } |
---|
| 313 | |
---|
| 314 | echo |
---|
| 315 | '<div class="multi-part" id="params" title="'.__('Parameters').'">'. |
---|
[1979] | 316 | '<h3 class="out-of-screen-if-js">'.__('Parameters').'</h3>'. |
---|
[0] | 317 | '<form action="'.$action.'" method="post" id="blog-form">'; |
---|
| 318 | |
---|
| 319 | echo |
---|
[1499] | 320 | '<div class="fieldset"><h4>'.__('Blog details').'</h4>'. |
---|
[0] | 321 | $core->formNonce(); |
---|
| 322 | |
---|
| 323 | if ($core->auth->isSuperAdmin()) |
---|
| 324 | { |
---|
| 325 | echo |
---|
[1399] | 326 | '<p><label for="blog_id" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:').'</label>'. |
---|
| 327 | form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</p>'. |
---|
[133] | 328 | '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '. |
---|
| 329 | '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>'; |
---|
[0] | 330 | } |
---|
| 331 | |
---|
| 332 | echo |
---|
[1399] | 333 | '<p><label for="blog_name" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label>'. |
---|
| 334 | form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>'; |
---|
[0] | 335 | |
---|
| 336 | if ($core->auth->isSuperAdmin()) |
---|
| 337 | { |
---|
| 338 | echo |
---|
[1399] | 339 | '<p><label for="blog_url" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label>'. |
---|
[1745] | 340 | form::field('blog_url',50,255,html::escapeHTML($blog_url)).'</p>'. |
---|
[0] | 341 | |
---|
[1399] | 342 | '<p><label for="url_scan">'.__('URL scan method:').'</label>'. |
---|
[1745] | 343 | form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</p>'; |
---|
[0] | 344 | |
---|
[2014] | 345 | try |
---|
| 346 | { |
---|
| 347 | # Test URL of blog by testing it's ATOM feed |
---|
| 348 | $file = $blog_url.$core->url->getURLFor('feed','atom'); |
---|
| 349 | $path = ''; |
---|
| 350 | $status = '404'; |
---|
| 351 | $content = ''; |
---|
| 352 | |
---|
| 353 | $client = netHttp::initClient($file,$path); |
---|
| 354 | if ($client !== false) { |
---|
| 355 | $client->setTimeout(4); |
---|
| 356 | $client->setUserAgent($_SERVER['HTTP_USER_AGENT']); |
---|
| 357 | $client->get($path); |
---|
| 358 | $status = $client->getStatus(); |
---|
| 359 | $content = $client->getContent(); |
---|
| 360 | } |
---|
| 361 | if ($status != '200') { |
---|
| 362 | // Might be 404 (URL not found), 670 (blog not online), ... |
---|
[1745] | 363 | echo |
---|
| 364 | '<p class="form-note warn">'. |
---|
[2014] | 365 | sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> return a <strong>%s</strong> status).'), |
---|
| 366 | $file,$status). |
---|
[1745] | 367 | '</p>'; |
---|
[2014] | 368 | } else { |
---|
| 369 | if (substr($content,0,6) != '<?xml ') { |
---|
| 370 | // Not well formed XML feed |
---|
| 371 | echo |
---|
| 372 | '<p class="form-note warn">'. |
---|
| 373 | sprintf(__('The URL of blog or the URL scan method might not be well set (<code>%s</code> does not return an ATOM feed).'), |
---|
| 374 | $file). |
---|
| 375 | '</p>'; |
---|
| 376 | } |
---|
[1745] | 377 | } |
---|
| 378 | } |
---|
[2014] | 379 | catch (Exception $e) |
---|
| 380 | { |
---|
| 381 | $core->error->add($e->getMessage()); |
---|
| 382 | } |
---|
[1745] | 383 | echo |
---|
[1399] | 384 | '<p><label for="blog_status">'.__('Blog status:').'</label>'. |
---|
| 385 | form::combo('blog_status',$status_combo,$blog_status).'</p>'; |
---|
[0] | 386 | } |
---|
| 387 | |
---|
| 388 | echo |
---|
| 389 | '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label>'. |
---|
| 390 | form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'. |
---|
[1499] | 391 | '</div>'; |
---|
[0] | 392 | |
---|
| 393 | |
---|
| 394 | echo |
---|
[1499] | 395 | '<div class="fieldset"><h4>'.__('Blog configuration').'</h4>'. |
---|
[0] | 396 | '<div class="two-cols">'. |
---|
| 397 | '<div class="col">'. |
---|
[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>'. |
---|
[0] | 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>'. |
---|
[0] | 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>'. |
---|
[0] | 413 | '</div>'. |
---|
| 414 | |
---|
| 415 | '<div class="col">'. |
---|
[1399] | 416 | '<p><label for="post_url_format">'.__('New post URL format:').'</label>'. |
---|
[0] | 417 | form::combo('post_url_format',$post_url_combo,html::escapeHTML($blog_settings->system->post_url_format)). |
---|
[1399] | 418 | '</p>'. |
---|
[970] | 419 | |
---|
[1848] | 420 | '<p><label for="note_title_tag">'.__('HTML tag for the title of the notes on the blog:').'</label>'. |
---|
[970] | 421 | form::combo('note_title_tag',$note_title_tag_combo,$blog_settings->system->note_title_tag). |
---|
[1399] | 422 | '</p>'. |
---|
[970] | 423 | |
---|
[1399] | 424 | '<p><label for="enable_xmlrpc" class="classic">'.'</label>'. |
---|
[0] | 425 | form::checkbox('enable_xmlrpc','1',$blog_settings->system->enable_xmlrpc). |
---|
[1399] | 426 | __('Enable XML/RPC interface').'</p>'; |
---|
[908] | 427 | |
---|
| 428 | echo |
---|
[1848] | 429 | '<p class="form-note info">'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>'; |
---|
[908] | 430 | |
---|
| 431 | if ($blog_settings->system->enable_xmlrpc) { |
---|
| 432 | echo |
---|
| 433 | '<p>'.__('XML/RPC interface is active. You should set the following parameters on your XML/RPC client:').'</p>'. |
---|
| 434 | '<ul>'. |
---|
| 435 | '<li>'.__('Server URL:').' <strong><code>'. |
---|
| 436 | sprintf(DC_XMLRPC_URL,$core->blog->url,$core->blog->id). |
---|
| 437 | '</code></strong></li>'. |
---|
| 438 | '<li>'.__('Blogging system:').' <strong><code>Movable Type</code></strong></li>'. |
---|
| 439 | '<li>'.__('User name:').' <strong><code>'.$core->auth->userID().'</code></strong></li>'. |
---|
| 440 | '<li>'.__('Password:').' <strong><code><'.__('your password').'></code></strong></li>'. |
---|
| 441 | '<li>'.__('Blog ID:').' <strong><code>1</code></strong></li>'. |
---|
| 442 | '</ul>'; |
---|
| 443 | } |
---|
| 444 | |
---|
| 445 | echo |
---|
[0] | 446 | '</div>'. |
---|
| 447 | '</div>'. |
---|
| 448 | '<br class="clear" />'. //Opera sucks |
---|
[1499] | 449 | '</div>'; |
---|
[0] | 450 | |
---|
| 451 | echo |
---|
[1499] | 452 | '<div class="fieldset"><h4>'.__('Comments and trackbacks').'</h4>'. |
---|
| 453 | |
---|
[0] | 454 | '<div class="two-cols">'. |
---|
[1499] | 455 | |
---|
[0] | 456 | '<div class="col">'. |
---|
[38] | 457 | '<p><label for="allow_comments" class="classic">'. |
---|
[0] | 458 | form::checkbox('allow_comments','1',$blog_settings->system->allow_comments). |
---|
[1499] | 459 | __('Accept comments').'</label></p>'. |
---|
[38] | 460 | '<p><label for="comments_pub" class="classic">'. |
---|
[0] | 461 | form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub). |
---|
[1499] | 462 | __('Moderate comments').'</label></p>'. |
---|
[1971] | 463 | '<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days').'.', |
---|
[0] | 464 | form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)). |
---|
| 465 | '</label></p>'. |
---|
[1979] | 466 | '<p class="form-note">'.__('No limit: leave blank.').'</p>'. |
---|
[38] | 467 | '<p><label for="wiki_comments" class="classic">'. |
---|
[0] | 468 | form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments). |
---|
| 469 | __('Wiki syntax for comments').'</label></p>'. |
---|
| 470 | '</div>'. |
---|
| 471 | |
---|
| 472 | '<div class="col">'. |
---|
[38] | 473 | '<p><label for="allow_trackbacks" class="classic">'. |
---|
[0] | 474 | form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks). |
---|
[1499] | 475 | __('Accept trackbacks').'</label></p>'. |
---|
[38] | 476 | '<p><label for="trackbacks_pub" class="classic">'. |
---|
[0] | 477 | form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub). |
---|
[1499] | 478 | __('Moderate trackbacks').'</label></p>'. |
---|
[1971] | 479 | '<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days').'.', |
---|
[0] | 480 | form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'. |
---|
[1979] | 481 | '<p class="form-note">'.__('No limit: leave blank.').'</p>'. |
---|
[38] | 482 | '<p><label for="comments_nofollow" class="classic">'. |
---|
[0] | 483 | form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow). |
---|
| 484 | __('Add "nofollow" relation on comments and trackbacks links').'</label></p>'. |
---|
| 485 | '</div>'. |
---|
[1499] | 486 | '<br class="clear" />'. //Opera sucks |
---|
| 487 | |
---|
[0] | 488 | '</div>'. |
---|
| 489 | '<br class="clear" />'. //Opera sucks |
---|
[1499] | 490 | '</div>'; |
---|
[0] | 491 | |
---|
| 492 | echo |
---|
[1499] | 493 | '<div class="fieldset"><h4>'.__('Blog presentation').'</h4>'. |
---|
[0] | 494 | '<div class="two-cols">'. |
---|
| 495 | '<div class="col">'. |
---|
[2025] | 496 | '<p><label for="date_format">'.__('Date format:').'</label> '. |
---|
[0] | 497 | form::field('date_format',30,255,html::escapeHTML($blog_settings->system->date_format)). |
---|
[2025] | 498 | form::combo('date_format_select',$date_formats_combo,'','','',false,'title="'.__('Pattern of date').'"'). |
---|
[1399] | 499 | '</p>'. |
---|
[2028] | 500 | '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->date_format)).'</p>'. |
---|
[2019] | 501 | |
---|
[1399] | 502 | '<p><label for="time_format">'.__('Time format:').'</label>'. |
---|
[0] | 503 | form::field('time_format',30,255,html::escapeHTML($blog_settings->system->time_format)). |
---|
[2025] | 504 | form::combo('time_format_select',$time_formats_combo,'','','',false,'title="'.__('Pattern of time').'"'). |
---|
[1399] | 505 | '</p>'. |
---|
[2028] | 506 | '<p class="chosen form-note">'.__('Sample:').' '.dt::str(html::escapeHTML($blog_settings->system->time_format)).'</p>'. |
---|
[0] | 507 | |
---|
[38] | 508 | '<p><label for="use_smilies" class="classic">'. |
---|
[0] | 509 | form::checkbox('use_smilies','1',$blog_settings->system->use_smilies). |
---|
| 510 | __('Display smilies on entries and comments').'</label></p>'. |
---|
| 511 | '</div>'. |
---|
| 512 | |
---|
| 513 | '<div class="col">'. |
---|
[38] | 514 | '<p><label for="nb_post_per_page" class="classic">'.sprintf(__('Display %s entries per page'), |
---|
[0] | 515 | form::field('nb_post_per_page',2,3,$blog_settings->system->nb_post_per_page)). |
---|
| 516 | '</label></p>'. |
---|
| 517 | |
---|
[38] | 518 | '<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'), |
---|
[0] | 519 | form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)). |
---|
| 520 | '</label></p>'. |
---|
| 521 | |
---|
[38] | 522 | '<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'), |
---|
[0] | 523 | form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)). |
---|
| 524 | '</label></p>'. |
---|
| 525 | |
---|
[38] | 526 | '<p><label for="short_feed_items" class="classic">'. |
---|
[0] | 527 | form::checkbox('short_feed_items','1',$blog_settings->system->short_feed_items). |
---|
| 528 | __('Truncate feeds').'</label></p>'. |
---|
[2198] | 529 | |
---|
| 530 | '<p><label for="inc_subcats" class="classic">'. |
---|
| 531 | form::checkbox('inc_subcats','1',$blog_settings->system->inc_subcats). |
---|
| 532 | __('Include sub-categories in category page and category posts feed').'</label></p>'. |
---|
[0] | 533 | '</div>'. |
---|
| 534 | '</div>'. |
---|
| 535 | '<br class="clear" />'. //Opera sucks |
---|
[1499] | 536 | '</div>'; |
---|
[0] | 537 | |
---|
| 538 | echo |
---|
[1979] | 539 | '<div class="fieldset"><h4 id="medias-settings">'.__('Media and images').'</h4>'. |
---|
| 540 | '<p class="form-note warning">'. |
---|
| 541 | __('Please note that if you change current settings bellow, they will now apply to all new images in the media manager.'). |
---|
| 542 | ' '.__('Be carefull if you share it with other blogs in your installation.').'</p>'. |
---|
| 543 | |
---|
[0] | 544 | '<div class="two-cols">'. |
---|
| 545 | '<div class="col">'. |
---|
[1499] | 546 | '<h5>'.__('Generated image sizes (in pixels)').'</h5>'. |
---|
[1848] | 547 | '<p class="field"><label for="media_img_t_size">Thumbnail</label> '. |
---|
[1846] | 548 | form::field('media_img_t_size',3,3,$blog_settings->system->media_img_t_size).'</p>'. |
---|
[0] | 549 | |
---|
[1848] | 550 | '<p class="field"><label for="media_img_s_size">Small</label> '. |
---|
[1846] | 551 | form::field('media_img_s_size',3,3,$blog_settings->system->media_img_s_size).'</p>'. |
---|
[0] | 552 | |
---|
[1848] | 553 | '<p class="field"><label for="media_img_m_size">Medium</label> '. |
---|
[1846] | 554 | form::field('media_img_m_size',3,3,$blog_settings->system->media_img_m_size).'</p>'. |
---|
[0] | 555 | '</div>'. |
---|
| 556 | |
---|
| 557 | '<div class="col">'. |
---|
[1846] | 558 | '<h5>'.__('Default image insertion attributes').'</h5>'. |
---|
[1848] | 559 | '<p class="vertical-separator"><label for="media_img_title_pattern">'.__('Inserted image title').'</label>'. |
---|
| 560 | form::combo('media_img_title_pattern',$img_title_combo,html::escapeHTML($blog_settings->system->media_img_title_pattern)).' '. |
---|
| 561 | '<label for="media_img_use_dto_first" class="classic">'. |
---|
[1073] | 562 | form::checkbox('media_img_use_dto_first','1',$blog_settings->system->media_img_use_dto_first). |
---|
| 563 | __('Use original media date if possible').'</label></p>'. |
---|
[1848] | 564 | '<p class="form-note info">'.__('It is retrieved from the picture\'s metadata.').'</p>'. |
---|
[887] | 565 | |
---|
[1848] | 566 | '<p class="field vertical-separator"><label for="media_img_default_size">'.__('Size of inserted image:').'</label>'. |
---|
[887] | 567 | form::combo('media_img_default_size',$img_default_size_combo, |
---|
| 568 | (html::escapeHTML($blog_settings->system->media_img_default_size) != '' ? html::escapeHTML($blog_settings->system->media_img_default_size) : 'm')). |
---|
[1399] | 569 | '</p>'. |
---|
[1846] | 570 | '<p class="field"><label for="media_img_default_alignment">'.__('Image alignment:').'</label>'. |
---|
[887] | 571 | form::combo('media_img_default_alignment',$img_default_alignment_combo,html::escapeHTML($blog_settings->system->media_img_default_alignment)). |
---|
[1399] | 572 | '</p>'. |
---|
[1846] | 573 | '<p><label for="media_img_default_link">'. |
---|
[887] | 574 | form::checkbox('media_img_default_link','1',$blog_settings->system->media_img_default_link). |
---|
[1846] | 575 | __('Insert a link to the original image').'</label></p>'. |
---|
[0] | 576 | '</div>'. |
---|
[887] | 577 | '</div>'. |
---|
[1499] | 578 | '<br class="clear" />'. //Opera sucks |
---|
[887] | 579 | |
---|
[1499] | 580 | '</div>'; |
---|
[0] | 581 | |
---|
| 582 | echo |
---|
[1499] | 583 | '<div class="fieldset"><h4>'.__('Search engines robots policy').'</h4>'; |
---|
[0] | 584 | |
---|
[122] | 585 | $i = 0; |
---|
[0] | 586 | foreach ($robots_policy_options as $k => $v) |
---|
| 587 | { |
---|
[122] | 588 | echo '<p><label for="robots_policy-'.$i.'" class="classic">'. |
---|
| 589 | form::radio(array('robots_policy','robots_policy-'.$i),$k,$blog_settings->system->robots_policy == $k).' '.$v.'</label></p>'; |
---|
| 590 | $i++; |
---|
[0] | 591 | } |
---|
| 592 | |
---|
[1499] | 593 | echo '</div>'; |
---|
[0] | 594 | |
---|
| 595 | |
---|
| 596 | # --BEHAVIOR-- adminBlogPreferencesForm |
---|
| 597 | $core->callBehavior('adminBlogPreferencesForm',$core,$blog_settings); |
---|
| 598 | |
---|
| 599 | echo |
---|
[217] | 600 | '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'. |
---|
[0] | 601 | (!$standalone ? form::hidden('id',$blog_id) : ''). |
---|
| 602 | '</p>'. |
---|
| 603 | '</form>'; |
---|
| 604 | |
---|
| 605 | if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id) |
---|
| 606 | { |
---|
| 607 | echo |
---|
| 608 | '<form action="blog_del.php" method="post">'. |
---|
[3] | 609 | '<p><input type="submit" class="delete" value="'.__('Delete this blog').'" />'. |
---|
[0] | 610 | form::hidden(array('blog_id'),$blog_id). |
---|
| 611 | $core->formNonce().'</p>'. |
---|
| 612 | '</form>'; |
---|
[953] | 613 | } else { |
---|
| 614 | if ($blog_id == $core->blog->id) { |
---|
[1474] | 615 | echo '<p class="message">'.__('The current blog cannot be deleted.').'</p>'; |
---|
[953] | 616 | } else { |
---|
[1474] | 617 | echo '<p class="message">'.__('Only superadmin can delete a blog.').'</p>'; |
---|
[953] | 618 | } |
---|
[0] | 619 | } |
---|
| 620 | |
---|
| 621 | echo '</div>'; |
---|
| 622 | |
---|
| 623 | # |
---|
| 624 | # Users on the blog (with permissions) |
---|
| 625 | |
---|
| 626 | $blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin()); |
---|
| 627 | $perm_types = $core->auth->getPermissionsTypes(); |
---|
| 628 | |
---|
| 629 | echo |
---|
| 630 | '<div class="multi-part" id="users" title="'.__('Users').'">'. |
---|
[1979] | 631 | '<h3 class="out-of-screen-if-js">'.__('Users on this blog').'</h3>'; |
---|
[0] | 632 | |
---|
| 633 | if (empty($blog_users)) |
---|
| 634 | { |
---|
| 635 | echo '<p>'.__('No users').'</p>'; |
---|
| 636 | } |
---|
| 637 | else |
---|
| 638 | { |
---|
| 639 | if ($core->auth->isSuperAdmin()) { |
---|
| 640 | $user_url_p = '<a href="user.php?id=%1$s">%1$s</a>'; |
---|
| 641 | } else { |
---|
| 642 | $user_url_p = '%1$s'; |
---|
| 643 | } |
---|
[1696] | 644 | |
---|
| 645 | # Sort users list on user_id key |
---|
| 646 | ksort($blog_users); |
---|
| 647 | |
---|
[1694] | 648 | $post_type = $core->getPostTypes(); |
---|
| 649 | $current_blog_id = $core->blog->id; |
---|
| 650 | if ($blog_id != $core->blog->id) { |
---|
| 651 | $core->setBlog($blog_id); |
---|
| 652 | } |
---|
| 653 | |
---|
[0] | 654 | foreach ($blog_users as $k => $v) |
---|
| 655 | { |
---|
| 656 | if (count($v['p']) > 0) |
---|
| 657 | { |
---|
| 658 | echo |
---|
[1682] | 659 | '<div class="user-perm">'. |
---|
[0] | 660 | '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). |
---|
| 661 | ' ('.html::escapeHTML(dcUtils::getUserCN( |
---|
| 662 | $k, $v['name'], $v['firstname'], $v['displayname'] |
---|
[1698] | 663 | )).')</h4>'; |
---|
| 664 | |
---|
| 665 | if ($core->auth->isSuperAdmin()) { |
---|
| 666 | echo |
---|
| 667 | '<p>'.__('Email:').' '. |
---|
| 668 | ($v['email'] != '' ? '<a href="mailto:'.$v['email'].'">'.$v['email'].'</a>' : __('(none)')). |
---|
| 669 | '</p>'; |
---|
| 670 | } |
---|
| 671 | |
---|
| 672 | echo |
---|
| 673 | '<h5>'.__('Publications on this blog:').'</h5>'. |
---|
| 674 | '<ul>'; |
---|
| 675 | foreach ($post_type as $type => $pt_info) { |
---|
| 676 | $params = array( |
---|
| 677 | 'post_type' => $type, |
---|
| 678 | 'user_id' => $k |
---|
| 679 | ); |
---|
| 680 | echo '<li>'.sprintf(__('%1$s: %2$s'),__($pt_info['label']),$core->blog->getPosts($params,true)->f(0)).'</li>'; |
---|
| 681 | } |
---|
| 682 | echo |
---|
| 683 | '</ul>'; |
---|
| 684 | |
---|
| 685 | echo |
---|
[1682] | 686 | '<h5>'.__('Permissions:').'</h5>'. |
---|
| 687 | '<ul>'; |
---|
[0] | 688 | if ($v['super']) { |
---|
[1979] | 689 | echo '<li class="user_super">'.__('Super administrator').'<br />'. |
---|
| 690 | '<span class="form-note">'.__('All rights on all blogs.').'</span></li>'; |
---|
[0] | 691 | } else { |
---|
| 692 | foreach ($v['p'] as $p => $V) { |
---|
[2223] | 693 | if (isset($perm_types[$p])) { |
---|
| 694 | echo '<li '.($p == 'admin' ? 'class="user_admin"' : '').'>'.__($perm_types[$p]); |
---|
| 695 | } else { |
---|
| 696 | echo '<li>'.sprintf(__('[%s] (unreferenced permission)'),$p); |
---|
| 697 | } |
---|
[1979] | 698 | |
---|
| 699 | if($p == 'admin') { |
---|
| 700 | echo '<br /><span class="form-note">'.__('All rights on this blog.').'</span>'; |
---|
| 701 | } |
---|
| 702 | echo '</li>'; |
---|
[0] | 703 | } |
---|
| 704 | } |
---|
[1682] | 705 | echo |
---|
| 706 | '</ul>'; |
---|
[860] | 707 | |
---|
| 708 | if (!$v['super'] && $core->auth->isSuperAdmin()) { |
---|
| 709 | echo |
---|
| 710 | '<form action="users_actions.php" method="post">'. |
---|
[1682] | 711 | '<p class="change-user-perm"><input type="submit" class="reset" value="'.__('Change permissions').'" />'. |
---|
[860] | 712 | form::hidden(array('redir'),'blog_pref.php?id='.$k). |
---|
| 713 | form::hidden(array('action'),'perms'). |
---|
| 714 | form::hidden(array('users[]'),$k). |
---|
| 715 | form::hidden(array('blogs[]'),$blog_id). |
---|
| 716 | $core->formNonce(). |
---|
| 717 | '</p>'. |
---|
| 718 | '</form>'; |
---|
| 719 | } |
---|
[1682] | 720 | echo '</div>'; |
---|
[0] | 721 | } |
---|
| 722 | } |
---|
[1694] | 723 | if ($current_blog_id != $core->blog->id) { |
---|
| 724 | $core->setBlog($current_blog_id); |
---|
| 725 | } |
---|
[0] | 726 | } |
---|
| 727 | |
---|
| 728 | echo '</div>'; |
---|
| 729 | } |
---|
| 730 | |
---|
| 731 | dcPage::helpBlock('core_blog_pref'); |
---|
| 732 | dcPage::close(); |
---|
| 733 | ?> |
---|