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