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