| 1 | <?php | 
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- | 
|---|
| 3 | # | 
|---|
| 4 | # This file is part of Dotclear 2. | 
|---|
| 5 | # | 
|---|
| 6 | # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear | 
|---|
| 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 | 
|---|
| 62 | $langs = l10n::getISOcodes(1,1); | 
|---|
| 63 | foreach ($langs as $k => $v) { | 
|---|
| 64 |      $lang_avail = $v == 'en' || is_dir(DC_L10N_ROOT.'/'.$v); | 
|---|
| 65 |      $lang_combo[] = new formSelectOption($k,$v,$lang_avail ? 'avail10n' : ''); | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | # Status combo | 
|---|
| 69 | foreach ($core->getAllBlogStatus() as $k => $v) { | 
|---|
| 70 |      $status_combo[$v] = (string) $k; | 
|---|
| 71 | } | 
|---|
| 72 |  | 
|---|
| 73 | # URL scan modes | 
|---|
| 74 | $url_scan_combo = array( | 
|---|
| 75 |      'PATH_INFO' => 'path_info', | 
|---|
| 76 |      'QUERY_STRING' => 'query_string' | 
|---|
| 77 | ); | 
|---|
| 78 |  | 
|---|
| 79 | # Post URL combo | 
|---|
| 80 | $post_url_combo = array( | 
|---|
| 81 |      __('year/month/day/title') => '{y}/{m}/{d}/{t}', | 
|---|
| 82 |      __('year/month/title') => '{y}/{m}/{t}', | 
|---|
| 83 |      __('year/title') => '{y}/{t}', | 
|---|
| 84 |      __('title') => '{t}' | 
|---|
| 85 | ); | 
|---|
| 86 | if (!in_array($blog_settings->system->post_url_format,$post_url_combo)) { | 
|---|
| 87 |      $post_url_combo[html::escapeHTML($blog_settings->system->post_url_format)] = html::escapeHTML($blog_settings->system->post_url_format); | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 | # Image title combo | 
|---|
| 91 | $img_title_combo = array( | 
|---|
| 92 |      __('Title') => 'Title ;; separator(, )', | 
|---|
| 93 |      __('Title, Date') => 'Title ;; Date(%b %Y) ;; separator(, )', | 
|---|
| 94 |      __('Title, Country, Date') => 'Title ;; Country ;; Date(%b %Y) ;; separator(, )', | 
|---|
| 95 |      __('Title, City, Country, Date') => 'Title ;; City ;; Country ;; Date(%b %Y) ;; separator(, )', | 
|---|
| 96 | ); | 
|---|
| 97 | if (!in_array($blog_settings->system->media_img_title_pattern,$img_title_combo)) { | 
|---|
| 98 |      $img_title_combo[html::escapeHTML($blog_settings->system->media_img_title_pattern)] = html::escapeHTML($blog_settings->system->media_img_title_pattern); | 
|---|
| 99 | } | 
|---|
| 100 |  | 
|---|
| 101 | # Robots policy options | 
|---|
| 102 | $robots_policy_options = array( | 
|---|
| 103 |      'INDEX,FOLLOW' => __("I would like search engines and archivers to index and archive my blog's content."), | 
|---|
| 104 |      'INDEX,FOLLOW,NOARCHIVE' => __("I would like search engines and archivers to index but not archive my blog's content."), | 
|---|
| 105 |      'NOINDEX,NOFOLLOW,NOARCHIVE' => __("I would like to prevent search engines and archivers from indexing or archiving my blog's content."), | 
|---|
| 106 | ); | 
|---|
| 107 |  | 
|---|
| 108 | # Update a blog | 
|---|
| 109 | if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id)) | 
|---|
| 110 | { | 
|---|
| 111 |      $cur = $core->con->openCursor($core->prefix.'blog'); | 
|---|
| 112 |      if ($core->auth->isSuperAdmin()) { | 
|---|
| 113 |           $cur->blog_id = $_POST['blog_id']; | 
|---|
| 114 |           $cur->blog_url = preg_replace('/\?+$/','?',$_POST['blog_url']);  | 
|---|
| 115 |           if (in_array($_POST['blog_status'],$status_combo)) { | 
|---|
| 116 |                $cur->blog_status = (integer) $_POST['blog_status']; | 
|---|
| 117 |           } | 
|---|
| 118 |      } | 
|---|
| 119 |      $cur->blog_name = $_POST['blog_name']; | 
|---|
| 120 |      $cur->blog_desc = $_POST['blog_desc']; | 
|---|
| 121 |       | 
|---|
| 122 |      $media_img_t_size = abs((integer) $_POST['media_img_t_size']); | 
|---|
| 123 |      if ($media_img_t_size < 0) { $media_img_t_size = 100; } | 
|---|
| 124 |       | 
|---|
| 125 |      $media_img_s_size = abs((integer) $_POST['media_img_s_size']); | 
|---|
| 126 |      if ($media_img_s_size < 0) { $media_img_s_size = 240; } | 
|---|
| 127 |       | 
|---|
| 128 |      $media_img_m_size = abs((integer) $_POST['media_img_m_size']); | 
|---|
| 129 |      if ($media_img_m_size < 0) { $media_img_m_size = 448; } | 
|---|
| 130 |       | 
|---|
| 131 |      $nb_post_per_page = abs((integer) $_POST['nb_post_per_page']); | 
|---|
| 132 |      if ($nb_post_per_page <= 1) { $nb_post_per_page = 1; } | 
|---|
| 133 |       | 
|---|
| 134 |      $nb_post_per_feed = abs((integer) $_POST['nb_post_per_feed']); | 
|---|
| 135 |      if ($nb_post_per_feed <= 1) { $nb_post_per_feed = 1; } | 
|---|
| 136 |       | 
|---|
| 137 |      $nb_comment_per_feed = abs((integer) $_POST['nb_comment_per_feed']); | 
|---|
| 138 |      if ($nb_comment_per_feed <= 1) { $nb_comment_per_feed = 1; } | 
|---|
| 139 |       | 
|---|
| 140 |      try | 
|---|
| 141 |      { | 
|---|
| 142 |           if ($cur->blog_id != null && $cur->blog_id != $blog_id) { | 
|---|
| 143 |                $rs = $core->getBlog($cur->blog_id); | 
|---|
| 144 |                 | 
|---|
| 145 |                if ($rs) { | 
|---|
| 146 |                     throw new Exception(__('That blog Id is already in use.')); | 
|---|
| 147 |                } | 
|---|
| 148 |           } | 
|---|
| 149 |            | 
|---|
| 150 |           # --BEHAVIOR-- adminBeforeBlogUpdate | 
|---|
| 151 |           $core->callBehavior('adminBeforeBlogUpdate',$cur,$blog_id); | 
|---|
| 152 |            | 
|---|
| 153 |           if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_POST['lang'])) { | 
|---|
| 154 |                throw new Exception(__('Invalid language code')); | 
|---|
| 155 |           } | 
|---|
| 156 |            | 
|---|
| 157 |           $core->updBlog($blog_id,$cur); | 
|---|
| 158 |            | 
|---|
| 159 |           # --BEHAVIOR-- adminAfterBlogUpdate | 
|---|
| 160 |           $core->callBehavior('adminAfterBlogUpdate',$cur,$blog_id); | 
|---|
| 161 |            | 
|---|
| 162 |           if ($cur->blog_id != null && $cur->blog_id != $blog_id) { | 
|---|
| 163 |                if ($blog_id == $core->blog->id) { | 
|---|
| 164 |                     $core->setBlog($cur->blog_id); | 
|---|
| 165 |                     $_SESSION['sess_blog_id'] = $cur->blog_id; | 
|---|
| 166 |                     $blog_settings = $core->blog->settings; | 
|---|
| 167 |                } else { | 
|---|
| 168 |                     $blog_settings = new dcSettings($core,$cur->blog_id); | 
|---|
| 169 |                } | 
|---|
| 170 |                 | 
|---|
| 171 |                $blog_id = $cur->blog_id; | 
|---|
| 172 |           } | 
|---|
| 173 |            | 
|---|
| 174 |            | 
|---|
| 175 |           $blog_settings->addNameSpace('system'); | 
|---|
| 176 |            | 
|---|
| 177 |           $blog_settings->system->put('editor',$_POST['editor']); | 
|---|
| 178 |           $blog_settings->system->put('copyright_notice',$_POST['copyright_notice']); | 
|---|
| 179 |           $blog_settings->system->put('post_url_format',$_POST['post_url_format']); | 
|---|
| 180 |           $blog_settings->system->put('lang',$_POST['lang']); | 
|---|
| 181 |           $blog_settings->system->put('blog_timezone',$_POST['blog_timezone']); | 
|---|
| 182 |           $blog_settings->system->put('date_format',$_POST['date_format']); | 
|---|
| 183 |           $blog_settings->system->put('time_format',$_POST['time_format']); | 
|---|
| 184 |           $blog_settings->system->put('comments_ttl',abs((integer) $_POST['comments_ttl'])); | 
|---|
| 185 |           $blog_settings->system->put('trackbacks_ttl',abs((integer) $_POST['trackbacks_ttl'])); | 
|---|
| 186 |           $blog_settings->system->put('allow_comments',!empty($_POST['allow_comments'])); | 
|---|
| 187 |           $blog_settings->system->put('allow_trackbacks',!empty($_POST['allow_trackbacks'])); | 
|---|
| 188 |           $blog_settings->system->put('comments_pub',empty($_POST['comments_pub'])); | 
|---|
| 189 |           $blog_settings->system->put('trackbacks_pub',empty($_POST['trackbacks_pub'])); | 
|---|
| 190 |           $blog_settings->system->put('comments_nofollow',!empty($_POST['comments_nofollow'])); | 
|---|
| 191 |           $blog_settings->system->put('wiki_comments',!empty($_POST['wiki_comments'])); | 
|---|
| 192 |           $blog_settings->system->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc'])); | 
|---|
| 193 |            | 
|---|
| 194 |           $blog_settings->system->put('nb_post_per_page',$nb_post_per_page); | 
|---|
| 195 |           $blog_settings->system->put('use_smilies',!empty($_POST['use_smilies'])); | 
|---|
| 196 |           $blog_settings->system->put('media_img_t_size',$media_img_t_size); | 
|---|
| 197 |           $blog_settings->system->put('media_img_s_size',$media_img_s_size); | 
|---|
| 198 |           $blog_settings->system->put('media_img_m_size',$media_img_m_size); | 
|---|
| 199 |           $blog_settings->system->put('media_img_title_pattern',$_POST['media_img_title_pattern']); | 
|---|
| 200 |           $blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed); | 
|---|
| 201 |           $blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed); | 
|---|
| 202 |           $blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items'])); | 
|---|
| 203 |            | 
|---|
| 204 |           if (isset($_POST['robots_policy'])) { | 
|---|
| 205 |                $blog_settings->system->put('robots_policy',$_POST['robots_policy']); | 
|---|
| 206 |           } | 
|---|
| 207 |            | 
|---|
| 208 |           # --BEHAVIOR-- adminBeforeBlogSettingsUpdate | 
|---|
| 209 |           $core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings); | 
|---|
| 210 |            | 
|---|
| 211 |           if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) { | 
|---|
| 212 |                $blog_settings->system->put('url_scan',$_POST['url_scan']); | 
|---|
| 213 |           } | 
|---|
| 214 |            | 
|---|
| 215 |           http::redirect(sprintf($redir,$blog_id)); | 
|---|
| 216 |      } | 
|---|
| 217 |      catch (Exception $e) | 
|---|
| 218 |      { | 
|---|
| 219 |           $core->error->add($e->getMessage()); | 
|---|
| 220 |      } | 
|---|
| 221 | } | 
|---|
| 222 |  | 
|---|
| 223 | dcPage::open(__('Blog settings'), | 
|---|
| 224 |      '<script type="text/javascript">'."\n". | 
|---|
| 225 |      "//<![CDATA["."\n". | 
|---|
| 226 |      dcPage::jsVar('dotclear.msg.warning_path_info', | 
|---|
| 227 |           __('Warning: except for special configurations, it is generally advised to have a trailing "/" in your blog URL in PATH_INFO mode.'))."\n". | 
|---|
| 228 |      dcPage::jsVar('dotclear.msg.warning_query_string', | 
|---|
| 229 |           __('Warning: except for special configurations, it is generally advised to have a trailing "?" in your blog URL in QUERY_STRING mode.'))."\n". | 
|---|
| 230 |      "//]]>". | 
|---|
| 231 |      "</script>". | 
|---|
| 232 |      dcPage::jsConfirmClose('blog-form'). | 
|---|
| 233 |      dcPage::jsLoad('js/_blog_pref.js'). | 
|---|
| 234 |       | 
|---|
| 235 |       | 
|---|
| 236 |      # --BEHAVIOR-- adminBlogPreferencesHeaders | 
|---|
| 237 |      $core->callBehavior('adminBlogPreferencesHeaders'). | 
|---|
| 238 |       | 
|---|
| 239 |      dcPage::jsPageTabs() | 
|---|
| 240 | ); | 
|---|
| 241 |  | 
|---|
| 242 | if ($blog_id) | 
|---|
| 243 | { | 
|---|
| 244 |      echo '<h2>'.(!$standalone ? '<a href="blogs.php">'.__('Blogs').'</a> › ' : ''). | 
|---|
| 245 |      html::escapeHTML($blog_name).' › '. | 
|---|
| 246 |      __('Blog settings').'</h2>'; | 
|---|
| 247 |       | 
|---|
| 248 |      if (!empty($_GET['add'])) { | 
|---|
| 249 |           echo '<p class="message">'.__('Blog has been successfully created.').'</p>'; | 
|---|
| 250 |      } | 
|---|
| 251 |       | 
|---|
| 252 |      if (!empty($_GET['upd'])) { | 
|---|
| 253 |           echo '<p class="message">'.__('Blog has been successfully updated.').'</p>'; | 
|---|
| 254 |      } | 
|---|
| 255 |       | 
|---|
| 256 |      echo | 
|---|
| 257 |      '<div class="multi-part" id="params" title="'.__('Parameters').'">'. | 
|---|
| 258 |      '<h3>'.__('Parameters').'</h3>'. | 
|---|
| 259 |      '<form action="'.$action.'" method="post" id="blog-form">'; | 
|---|
| 260 |       | 
|---|
| 261 |      echo | 
|---|
| 262 |      '<fieldset><legend>'.__('Blog details').'</legend>'. | 
|---|
| 263 |      $core->formNonce(); | 
|---|
| 264 |       | 
|---|
| 265 |      if ($core->auth->isSuperAdmin()) | 
|---|
| 266 |      { | 
|---|
| 267 |           echo | 
|---|
| 268 |           '<p><label for="blog_id" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:'). | 
|---|
| 269 |           form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</label></p>'. | 
|---|
| 270 |           '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '. | 
|---|
| 271 |           '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>'; | 
|---|
| 272 |      } | 
|---|
| 273 |       | 
|---|
| 274 |      echo | 
|---|
| 275 |      '<p><label for="blog_name" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:'). | 
|---|
| 276 |      form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</label></p>'; | 
|---|
| 277 |       | 
|---|
| 278 |      if ($core->auth->isSuperAdmin()) | 
|---|
| 279 |      { | 
|---|
| 280 |           echo | 
|---|
| 281 |           '<p><label for="blog_url" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:'). | 
|---|
| 282 |           form::field('blog_url',30,255,html::escapeHTML($blog_url)).'</label></p>'. | 
|---|
| 283 |            | 
|---|
| 284 |           '<p><label for="url_scan">'.__('URL scan method:'). | 
|---|
| 285 |           form::combo('url_scan',$url_scan_combo,$blog_settings->system->url_scan).'</label></p>'. | 
|---|
| 286 |            | 
|---|
| 287 |           '<p><label for="blog_status">'.__('Blog status:'). | 
|---|
| 288 |           form::combo('blog_status',$status_combo,$blog_status).'</label></p>'; | 
|---|
| 289 |      } | 
|---|
| 290 |       | 
|---|
| 291 |      echo | 
|---|
| 292 |      '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label>'. | 
|---|
| 293 |      form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'. | 
|---|
| 294 |      '</fieldset>'; | 
|---|
| 295 |       | 
|---|
| 296 |       | 
|---|
| 297 |      echo | 
|---|
| 298 |      '<fieldset><legend>'.__('Blog configuration').'</legend>'. | 
|---|
| 299 |      '<div class="two-cols">'. | 
|---|
| 300 |      '<div class="col">'. | 
|---|
| 301 |      '<p><label for="editor">'.__('Blog editor name:'). | 
|---|
| 302 |      form::field('editor',30,255,html::escapeHTML($blog_settings->system->editor)). | 
|---|
| 303 |      '</label></p>'. | 
|---|
| 304 |       | 
|---|
| 305 |      '<p><label for="lang">'.__('Default language:'). | 
|---|
| 306 |      form::combo('lang',$lang_combo,$blog_settings->system->lang,'l10n'). | 
|---|
| 307 |      '</label></p>'. | 
|---|
| 308 |       | 
|---|
| 309 |      '<p><label for="blog_timezone">'.__('Blog timezone:'). | 
|---|
| 310 |      form::combo('blog_timezone',dt::getZones(true,true),html::escapeHTML($blog_settings->system->blog_timezone)). | 
|---|
| 311 |      '</label></p>'. | 
|---|
| 312 |      '</div>'. | 
|---|
| 313 |       | 
|---|
| 314 |      '<div class="col">'. | 
|---|
| 315 |      '<p><label for="copyright_notice">'.__('Copyright notice:'). | 
|---|
| 316 |      form::field('copyright_notice',30,255,html::escapeHTML($blog_settings->system->copyright_notice)). | 
|---|
| 317 |      '</label></p>'. | 
|---|
| 318 |       | 
|---|
| 319 |      '<p><label for="post_url_format">'.__('New post URL format:'). | 
|---|
| 320 |      form::combo('post_url_format',$post_url_combo,html::escapeHTML($blog_settings->system->post_url_format)). | 
|---|
| 321 |      '</label></p>'. | 
|---|
| 322 |       | 
|---|
| 323 |      '<p><label for="enable_xmlrpc" class="classic">'. | 
|---|
| 324 |      form::checkbox('enable_xmlrpc','1',$blog_settings->system->enable_xmlrpc). | 
|---|
| 325 |      __('Enable XML/RPC interface').'</label>'. | 
|---|
| 326 |      ' - <a href="#xmlrpc">'.__('more information').'</a></p>'. | 
|---|
| 327 |      '</div>'. | 
|---|
| 328 |      '</div>'. | 
|---|
| 329 |      '<br class="clear" />'. //Opera sucks | 
|---|
| 330 |      '</fieldset>'; | 
|---|
| 331 |       | 
|---|
| 332 |      echo | 
|---|
| 333 |      '<fieldset><legend>'.__('Comments and trackbacks').'</legend>'. | 
|---|
| 334 |      '<div class="two-cols">'. | 
|---|
| 335 |      '<div class="col">'. | 
|---|
| 336 |      '<p><label for="allow_comments" class="classic">'. | 
|---|
| 337 |      form::checkbox('allow_comments','1',$blog_settings->system->allow_comments). | 
|---|
| 338 |      __('Accept comments').'</label></p>'. | 
|---|
| 339 |       | 
|---|
| 340 |      '<p><label for="comments_pub" class="classic">'. | 
|---|
| 341 |      form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub). | 
|---|
| 342 |      __('Moderate comments').'</label></p>'. | 
|---|
| 343 |       | 
|---|
| 344 |      '<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days'), | 
|---|
| 345 |      form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)). | 
|---|
| 346 |      '</label></p>'. | 
|---|
| 347 |      '<p class="form-note">'.__('Leave blank to disable this feature.').'</p>'. | 
|---|
| 348 |       | 
|---|
| 349 |      '<p><label for="wiki_comments" class="classic">'. | 
|---|
| 350 |      form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments). | 
|---|
| 351 |      __('Wiki syntax for comments').'</label></p>'. | 
|---|
| 352 |      '</div>'. | 
|---|
| 353 |       | 
|---|
| 354 |      '<div class="col">'. | 
|---|
| 355 |      '<p><label for="allow_trackbacks" class="classic">'. | 
|---|
| 356 |      form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks). | 
|---|
| 357 |      __('Accept trackbacks').'</label></p>'. | 
|---|
| 358 |       | 
|---|
| 359 |      '<p><label for="trackbacks_pub" class="classic">'. | 
|---|
| 360 |      form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub). | 
|---|
| 361 |      __('Moderate trackbacks').'</label></p>'. | 
|---|
| 362 |       | 
|---|
| 363 |      '<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days'), | 
|---|
| 364 |      form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'. | 
|---|
| 365 |      '<p class="form-note">'.__('Leave blank to disable this feature.').'</p>'. | 
|---|
| 366 |       | 
|---|
| 367 |      '<p><label for="comments_nofollow" class="classic">'. | 
|---|
| 368 |      form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow). | 
|---|
| 369 |      __('Add "nofollow" relation on comments and trackbacks links').'</label></p>'. | 
|---|
| 370 |      '</div>'. | 
|---|
| 371 |      '</div>'. | 
|---|
| 372 |      '<br class="clear" />'. //Opera sucks | 
|---|
| 373 |      '</fieldset>'; | 
|---|
| 374 |       | 
|---|
| 375 |      echo | 
|---|
| 376 |      '<fieldset><legend>'.__('Blog presentation').'</legend>'. | 
|---|
| 377 |      '<div class="two-cols">'. | 
|---|
| 378 |      '<div class="col">'. | 
|---|
| 379 |      '<p><label for="date_format">'.__('Date format:'). | 
|---|
| 380 |      form::field('date_format',30,255,html::escapeHTML($blog_settings->system->date_format)). | 
|---|
| 381 |      '</label></p>'. | 
|---|
| 382 |       | 
|---|
| 383 |      '<p><label for="time_format">'.__('Time format:'). | 
|---|
| 384 |      form::field('time_format',30,255,html::escapeHTML($blog_settings->system->time_format)). | 
|---|
| 385 |      '</label></p>'. | 
|---|
| 386 |       | 
|---|
| 387 |      '<p><label for="use_smilies" class="classic">'. | 
|---|
| 388 |      form::checkbox('use_smilies','1',$blog_settings->system->use_smilies). | 
|---|
| 389 |      __('Display smilies on entries and comments').'</label></p>'. | 
|---|
| 390 |      '</div>'. | 
|---|
| 391 |       | 
|---|
| 392 |      '<div class="col">'. | 
|---|
| 393 |      '<p><label for="nb_post_per_page" class="classic">'.sprintf(__('Display %s entries per page'), | 
|---|
| 394 |      form::field('nb_post_per_page',2,3,$blog_settings->system->nb_post_per_page)). | 
|---|
| 395 |      '</label></p>'. | 
|---|
| 396 |       | 
|---|
| 397 |      '<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'), | 
|---|
| 398 |      form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)). | 
|---|
| 399 |      '</label></p>'. | 
|---|
| 400 |       | 
|---|
| 401 |      '<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'), | 
|---|
| 402 |      form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)). | 
|---|
| 403 |      '</label></p>'. | 
|---|
| 404 |       | 
|---|
| 405 |      '<p><label for="short_feed_items" class="classic">'. | 
|---|
| 406 |      form::checkbox('short_feed_items','1',$blog_settings->system->short_feed_items). | 
|---|
| 407 |      __('Truncate feeds').'</label></p>'. | 
|---|
| 408 |      '</div>'. | 
|---|
| 409 |     '</div>'. | 
|---|
| 410 |      '<br class="clear" />'. //Opera sucks | 
|---|
| 411 |      '</fieldset>'; | 
|---|
| 412 |       | 
|---|
| 413 |      echo | 
|---|
| 414 |      '<fieldset><legend>'.__('Media and images').'</legend>'. | 
|---|
| 415 |      '<div class="two-cols">'. | 
|---|
| 416 |      '<div class="col">'. | 
|---|
| 417 |      '<h4>'.__('Generated image sizes (in pixels)').'</h4>'. | 
|---|
| 418 |      '<p class="field"><label for="media_img_t_size">'.__('Thumbnails:').' '. | 
|---|
| 419 |      form::field('media_img_t_size',3,3,$blog_settings->system->media_img_t_size).'</label></p>'. | 
|---|
| 420 |       | 
|---|
| 421 |      '<p class="field"><label for="media_img_s_size">'.__('Small:').' '. | 
|---|
| 422 |      form::field('media_img_s_size',3,3,$blog_settings->system->media_img_s_size).'</label></p>'. | 
|---|
| 423 |       | 
|---|
| 424 |      '<p class="field"><label for="media_img_m_size">'.__('Medium:').' '. | 
|---|
| 425 |      form::field('media_img_m_size',3,3,$blog_settings->system->media_img_m_size).'</label></p>'. | 
|---|
| 426 |      '</div>'. | 
|---|
| 427 |       | 
|---|
| 428 |      '<div class="col">'. | 
|---|
| 429 |      '<h4><label for="media_img_title_pattern">'.__('Inserted image title').'</label></h4>'. | 
|---|
| 430 |      '<p>'.__('This defines image tag title when you insert it in a post from the media manager. It is retrieved from the picture\'s metadata.').'</p>'. | 
|---|
| 431 |      '<p>'.form::combo('media_img_title_pattern',$img_title_combo,html::escapeHTML($blog_settings->system->media_img_title_pattern)).'</p>'. | 
|---|
| 432 |      '</div>'. | 
|---|
| 433 |      '</div>'. | 
|---|
| 434 |      '</fieldset>'; | 
|---|
| 435 |       | 
|---|
| 436 |      echo | 
|---|
| 437 |      '<fieldset><legend>'.__('Search engines robots policy').'</legend>'; | 
|---|
| 438 |       | 
|---|
| 439 |      $i = 0; | 
|---|
| 440 |      foreach ($robots_policy_options as $k => $v) | 
|---|
| 441 |      { | 
|---|
| 442 |           echo '<p><label for="robots_policy-'.$i.'" class="classic">'. | 
|---|
| 443 |           form::radio(array('robots_policy','robots_policy-'.$i),$k,$blog_settings->system->robots_policy == $k).' '.$v.'</label></p>'; | 
|---|
| 444 |           $i++; | 
|---|
| 445 |      } | 
|---|
| 446 |       | 
|---|
| 447 |      echo '</fieldset>'; | 
|---|
| 448 |       | 
|---|
| 449 |       | 
|---|
| 450 |      # --BEHAVIOR-- adminBlogPreferencesForm | 
|---|
| 451 |      $core->callBehavior('adminBlogPreferencesForm',$core,$blog_settings); | 
|---|
| 452 |       | 
|---|
| 453 |      echo | 
|---|
| 454 |      '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'. | 
|---|
| 455 |      (!$standalone ? form::hidden('id',$blog_id) : ''). | 
|---|
| 456 |      '</p>'. | 
|---|
| 457 |      '</form>'; | 
|---|
| 458 |       | 
|---|
| 459 |      if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id) | 
|---|
| 460 |      { | 
|---|
| 461 |           echo | 
|---|
| 462 |           '<form action="blog_del.php" method="post">'. | 
|---|
| 463 |           '<p><input type="submit" class="delete" value="'.__('Delete this blog').'" />'. | 
|---|
| 464 |           form::hidden(array('blog_id'),$blog_id). | 
|---|
| 465 |           $core->formNonce().'</p>'. | 
|---|
| 466 |           '</form>'; | 
|---|
| 467 |      } | 
|---|
| 468 |       | 
|---|
| 469 |      # XML/RPC information | 
|---|
| 470 |      echo '<h3 id="xmlrpc">'.__('XML/RPC interface').'</h3>'; | 
|---|
| 471 |       | 
|---|
| 472 |      echo '<p>'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>'; | 
|---|
| 473 |       | 
|---|
| 474 |      if (!$blog_settings->system->enable_xmlrpc) | 
|---|
| 475 |      { | 
|---|
| 476 |           echo '<p>'.__('XML/RPC interface is not active. Change settings to enable it.').'</p>'; | 
|---|
| 477 |      } | 
|---|
| 478 |      else | 
|---|
| 479 |      { | 
|---|
| 480 |           echo | 
|---|
| 481 |           '<p>'.__('XML/RPC interface is active. You should set the following parameters on your XML/RPC client:').'</p>'. | 
|---|
| 482 |           '<ul>'. | 
|---|
| 483 |           '<li>'.__('Server URL:').' <strong>'. | 
|---|
| 484 |           sprintf(DC_XMLRPC_URL,$core->blog->url,$core->blog->id). | 
|---|
| 485 |           '</strong></li>'. | 
|---|
| 486 |           '<li>'.__('Blogging system:').' <strong>Movable Type</strong></li>'. | 
|---|
| 487 |           '<li>'.__('User name:').' <strong>'.$core->auth->userID().'</strong></li>'. | 
|---|
| 488 |           '<li>'.__('Password:').' <strong>'.__('your password').'</strong></li>'. | 
|---|
| 489 |           '<li>'.__('Blog ID:').' <strong>1</strong></li>'. | 
|---|
| 490 |           '</ul>'; | 
|---|
| 491 |      } | 
|---|
| 492 |       | 
|---|
| 493 |      echo '</div>'; | 
|---|
| 494 |       | 
|---|
| 495 |      # | 
|---|
| 496 |      # Users on the blog (with permissions) | 
|---|
| 497 |       | 
|---|
| 498 |      $blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin()); | 
|---|
| 499 |      $perm_types = $core->auth->getPermissionsTypes(); | 
|---|
| 500 |       | 
|---|
| 501 |      echo | 
|---|
| 502 |      '<div class="multi-part" id="users" title="'.__('Users').'">'. | 
|---|
| 503 |      '<h3>'.__('Users on this blog').'</h3>'; | 
|---|
| 504 |       | 
|---|
| 505 |      if (empty($blog_users)) | 
|---|
| 506 |      { | 
|---|
| 507 |           echo '<p>'.__('No users').'</p>'; | 
|---|
| 508 |      } | 
|---|
| 509 |      else | 
|---|
| 510 |      { | 
|---|
| 511 |           if ($core->auth->isSuperAdmin()) { | 
|---|
| 512 |                $user_url_p = '<a href="user.php?id=%1$s">%1$s</a>'; | 
|---|
| 513 |           } else { | 
|---|
| 514 |                $user_url_p = '%1$s'; | 
|---|
| 515 |           } | 
|---|
| 516 |            | 
|---|
| 517 |           foreach ($blog_users as $k => $v) | 
|---|
| 518 |           { | 
|---|
| 519 |                if (count($v['p']) > 0) | 
|---|
| 520 |                { | 
|---|
| 521 |                     echo | 
|---|
| 522 |                     '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). | 
|---|
| 523 |                     ' ('.html::escapeHTML(dcUtils::getUserCN( | 
|---|
| 524 |                          $k, $v['name'], $v['firstname'], $v['displayname'] | 
|---|
| 525 |                     )).')'; | 
|---|
| 526 |                      | 
|---|
| 527 |                     if (!$v['super'] && $core->auth->isSuperAdmin()) { | 
|---|
| 528 |                          echo | 
|---|
| 529 |                          ' - <a href="permissions.php?blog_id[]='.$blog_id.'&user_id[]='.$k.'">' | 
|---|
| 530 |                          .__('change permissions').'</a>'; | 
|---|
| 531 |                     } | 
|---|
| 532 |                      | 
|---|
| 533 |                     echo '</h4>'; | 
|---|
| 534 |                      | 
|---|
| 535 |                     echo '<ul>'; | 
|---|
| 536 |                     if ($v['super']) { | 
|---|
| 537 |                          echo '<li>'.__('Super administrator').'</li>'; | 
|---|
| 538 |                     } else { | 
|---|
| 539 |                          foreach ($v['p'] as $p => $V) { | 
|---|
| 540 |                               echo '<li>'.__($perm_types[$p]).'</li>'; | 
|---|
| 541 |                          } | 
|---|
| 542 |                     } | 
|---|
| 543 |                     echo '</ul>'; | 
|---|
| 544 |                } | 
|---|
| 545 |           } | 
|---|
| 546 |      } | 
|---|
| 547 |       | 
|---|
| 548 |      echo '</div>'; | 
|---|
| 549 | } | 
|---|
| 550 |  | 
|---|
| 551 | dcPage::helpBlock('core_blog_pref'); | 
|---|
| 552 | dcPage::close(); | 
|---|
| 553 | ?> | 
|---|