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