[ Index ] |
|
Code source de Dotclear 2.0-beta6 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2005 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 $standalone = !isset($edit_blog_mode); 24 25 $blog_id = false; 26 27 if ($standalone) 28 { 29 require dirname(__FILE__).'/../inc/admin/prepend.php'; 30 dcPage::check('admin'); 31 $blog_id = $core->blog->id; 32 $blog_url = $core->blog->url; 33 $blog_status = $core->blog->status; 34 $blog_name = $core->blog->name; 35 $blog_desc = $core->blog->desc; 36 $blog_settings = $core->blog->settings; 37 38 $action = 'blog_pref.php'; 39 $redir = 'blog_pref.php?upd=1'; 40 } 41 else 42 { 43 dcPage::checkSuper(); 44 try 45 { 46 if (empty($_REQUEST['id'])) { 47 throw new Exception(__('No given blog id.')); 48 } 49 $rs = $core->getBlog($_REQUEST['id']); 50 51 if (!$rs) { 52 throw new Exception(__('No such blog.')); 53 } 54 55 $blog_id = $rs->blog_id; 56 $blog_url = $rs->blog_url; 57 $blog_status = $rs->blog_status; 58 $blog_name = $rs->blog_name; 59 $blog_desc = $rs->blog_desc; 60 $blog_settings = new dcSettings($core,$blog_id); 61 } 62 catch (Exception $e) 63 { 64 $core->error->add($e->getMessage()); 65 } 66 67 $action = 'blog.php'; 68 $redir = 'blog.php?id=%s&upd=1'; 69 } 70 71 # Language codes 72 foreach (l10n::getISOcodes(1) as $k => $v) { 73 $lang_combo[] = new formSelectOption($k,$v,$v == 'en' || is_dir(DC_L10N_ROOT.'/'.$v) ? 'avail10n' : ''); 74 } 75 76 # Status combo 77 foreach ($core->getAllBlogStatus() as $k => $v) { 78 $status_combo[$v] = (string) $k; 79 } 80 81 # URL scan modes 82 $url_scan_combo = array( 83 'PATH_INFO' => 'path_info', 84 'QUERY_STRING' => 'query_string' 85 ); 86 87 # Update a blog 88 if ($blog_id && !empty($_POST) && $core->auth->check('admin',$blog_id)) 89 { 90 $cur = $core->con->openCursor($core->prefix.'blog'); 91 if ($core->auth->isSuperAdmin()) { 92 $cur->blog_id = $_POST['blog_id']; 93 $cur->blog_url = $_POST['blog_url']; 94 if (in_array($_POST['blog_status'],$status_combo)) { 95 $cur->blog_status = (integer) $_POST['blog_status']; 96 } 97 } 98 $cur->blog_name = $_POST['blog_name']; 99 $cur->blog_desc = $_POST['blog_desc']; 100 101 $nb_post_per_page = abs((integer) $_POST['nb_post_per_page']); 102 if ($nb_post_per_page <= 1) { $nb_post_per_page = 1; } 103 104 try 105 { 106 # --BEHAVIOR-- adminBeforeBlogUpdate 107 $core->callBehavior('adminBeforeBlogUpdate',$cur,$blog_id); 108 109 $core->updBlog($blog_id,$cur); 110 111 # --BEHAVIOR-- adminAfterBlogUpdate 112 $core->callBehavior('adminAfterBlogUpdate',$cur,$blog_id); 113 114 if ($blog_id == $core->blog->id && $cur->blog_id != null && $cur->blog_id != $blog_id) { 115 $blog_id = $cur->blog_id; 116 $core->setBlog($cur->blog_id); 117 $_SESSION['sess_blog_id'] = $cur->blog_id; 118 $blog_settings = $core->blog->settings; 119 } 120 121 122 $blog_settings->setNameSpace('system'); 123 124 $blog_settings->put('editor',$_POST['editor']); 125 $blog_settings->put('copyright_notice',$_POST['copyright_notice']); 126 $blog_settings->put('lang',$_POST['lang']); 127 $blog_settings->put('blog_timezone',$_POST['blog_timezone']); 128 $blog_settings->put('date_format',$_POST['date_format']); 129 $blog_settings->put('time_format',$_POST['time_format']); 130 $blog_settings->put('nb_post_per_page',$nb_post_per_page); 131 $blog_settings->put('comments_ttl',abs((integer) $_POST['comments_ttl'])); 132 $blog_settings->put('use_smilies',!empty($_POST['use_smilies'])); 133 $blog_settings->put('allow_comments',!empty($_POST['allow_comments'])); 134 $blog_settings->put('allow_trackbacks',!empty($_POST['allow_trackbacks'])); 135 $blog_settings->put('comments_pub',empty($_POST['comments_pub'])); 136 $blog_settings->put('comments_nofollow',!empty($_POST['comments_nofollow'])); 137 $blog_settings->put('wiki_comments',!empty($_POST['wiki_comments'])); 138 $blog_settings->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc'])); 139 140 # --BEHAVIOR-- adminBeforeBlogSettingsUpdate 141 $core->callBehavior('adminBeforeBlogSettingsUpdate',$blog_settings); 142 143 if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'],$url_scan_combo)) { 144 $blog_settings->put('url_scan',$_POST['url_scan']); 145 } 146 147 http::redirect(sprintf($redir,$blog_id)); 148 } 149 catch (Exception $e) 150 { 151 $core->error->add($e->getMessage()); 152 } 153 } 154 155 dcPage::open(__('Blog settings'), 156 dcPage::jsConfirmClose('blog-form'). 157 158 # --BEHAVIOR-- adminBlogPreferencesHeaders 159 $core->callBehavior('adminBlogPreferencesHeaders'). 160 161 dcPage::jsPageTabs() 162 ); 163 164 if ($blog_id) 165 { 166 echo '<h2>'.(!$standalone ? '<a href="blogs.php">'.__('Blogs').'</a> > ' : ''). 167 html::escapeHTML($blog_name).' > '. 168 __('Blog settings').'</h2>'; 169 170 if (!empty($_GET['add'])) { 171 echo '<p class="message">'.__('Blog has been successfully created.').'</p>'; 172 } 173 174 if (!empty($_GET['upd'])) { 175 echo '<p class="message">'.__('Blog has been successfully updated.').'</p>'; 176 } 177 178 echo 179 '<div class="multi-part" id="params" title="'.__('Parameters').'">'. 180 '<h3>'.__('Parameters').'</h3>'. 181 '<form action="'.$action.'" method="post" id="blog-form">'; 182 183 echo 184 '<fieldset><legend>'.__('Blog details').'</legend>'; 185 186 if ($core->auth->isSuperAdmin()) 187 { 188 echo 189 '<p><label class="required" title="'.__('Required field').'">'.__('Blog ID:'). 190 dcPage::help('blog_pref','p_blogid'). 191 form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</label></p>'. 192 '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p>'; 193 } 194 195 echo 196 '<p><label class="required" title="'.__('Required field').'">'.__('Blog name:'). 197 dcPage::help('blog_pref','p_name'). 198 form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</label></p>'; 199 200 if ($core->auth->isSuperAdmin()) 201 { 202 echo 203 '<p><label class="required" title="'.__('Required field').'">'.__('Blog URL:'). 204 dcPage::help('blog_pref','p_url'). 205 form::field('blog_url',30,255,html::escapeHTML($blog_url)).'</label></p>'. 206 207 '<p><label>'.__('URL scan method:'). 208 dcPage::help('blog_pref','p_url_scan'). 209 form::combo('url_scan',$url_scan_combo,$blog_settings->url_scan).'</label></p>'. 210 211 '<p><label>'.__('Blog status:'). 212 dcPage::help('blog_pref','p_status'). 213 form::combo('blog_status',$status_combo,$blog_status).'</label></p>'; 214 } 215 216 echo 217 '<p class="area"><label for="blog_desc">'.__('Blog description:'). 218 dcPage::help('blog_pref','p_desc').'</label>'. 219 form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'. 220 '</fieldset>'; 221 222 223 echo 224 '<fieldset><legend>'.__('Blog configuration').'</legend>'. 225 '<div class="two-cols">'. 226 '<div class="col">'. 227 '<p><label>'.__('Blog editor name:'). 228 dcPage::help('blog_pref','p_editor'). 229 form::field('editor',30,255,html::escapeHTML($blog_settings->editor)). 230 '</label></p>'. 231 232 '<p><label>'.__('Copyright notice:'). 233 dcPage::help('blog_pref','p_copyright'). 234 form::field('copyright_notice',30,255,html::escapeHTML($blog_settings->copyright_notice)). 235 '</label></p>'. 236 237 '<p><label>'.__('Default language:'). 238 dcPage::help('blog_pref','p_lang'). 239 form::combo('lang',$lang_combo,$blog_settings->lang,'l10n'). 240 '</label></p>'. 241 242 '<p><label>'.__('Blog timezone:'). 243 dcPage::help('blog_pref','p_tz'). 244 form::combo('blog_timezone',dt::getZones(true,true),html::escapeHTML($blog_settings->blog_timezone)). 245 '</label></p>'. 246 247 '<p><label>'.__('Date format:'). 248 dcPage::help('blog_pref','p_dateformat'). 249 form::field('date_format',30,255,html::escapeHTML($blog_settings->date_format)). 250 '</label></p>'. 251 252 '<p><label>'.__('Time format:'). 253 dcPage::help('blog_pref','p_timeformat'). 254 form::field('time_format',30,255,html::escapeHTML($blog_settings->time_format)). 255 '</label></p>'. 256 '</div>'. 257 258 '<div class="col">'. 259 '<p><label class="classic">'.sprintf(__('Display %s entries per page'), 260 form::field('nb_post_per_page',2,3,$blog_settings->nb_post_per_page)). 261 dcPage::help('blog_pref','p_nbperpage'). 262 '</label></p>'. 263 264 '<p><label class="classic">'.sprintf(__('Leave comments open during %s days'), 265 form::field('comments_ttl',2,3,$blog_settings->comments_ttl)). 266 dcPage::help('blog_pref','p_comment_ttl'). 267 '</label></p>'. 268 '<p class="form-note">'.__('Leave empty to cancel this feature.').'</p>'. 269 270 '<p><label class="classic">'. 271 form::checkbox('use_smilies','1',$blog_settings->use_smilies). 272 __('Display smilies on entries and comments'). 273 dcPage::help('blog_pref','p_smilies').'</label></p>'. 274 275 '<p><label class="classic">'. 276 form::checkbox('allow_comments','1',$blog_settings->allow_comments). 277 __('Accept comments').dcPage::help('blog_pref','p_comments').'</label></p>'. 278 279 '<p><label class="classic">'. 280 form::checkbox('allow_trackbacks','1',$blog_settings->allow_trackbacks). 281 __('Accept trackbacks'). 282 dcPage::help('blog_pref','p_trackbacks').'</label></p>'. 283 284 '<p><label class="classic">'. 285 form::checkbox('comments_pub','1',!$blog_settings->comments_pub). 286 __('Moderate comments and trackbacks'). 287 dcPage::help('blog_pref','p_comments_pub').'</label></p>'. 288 289 '<p><label class="classic">'. 290 form::checkbox('comments_nofollow','1',$blog_settings->comments_nofollow). 291 __('Add "nofollow" relation on comments and trackbacks links'). 292 dcPage::help('blog_pref','p_nofollow').'</label></p>'. 293 294 '<p><label class="classic">'. 295 form::checkbox('wiki_comments','1',$blog_settings->wiki_comments). 296 __('Wiki syntax for comments'). 297 dcPage::help('blog_pref','p_wiki_comments').'</label></p>'. 298 299 '<p><label class="classic">'. 300 form::checkbox('enable_xmlrpc','1',$blog_settings->enable_xmlrpc). 301 __('Enable XML/RPC interface').'</label>'. 302 ' - <a href="#xmlrpc">'.__('more information').'</a></p>'. 303 '</div>'. 304 '</div>'. 305 '<br class="clear" />'. //Opera sucks 306 '</fieldset>'; 307 308 # --BEHAVIOR-- adminBlogPreferencesForm 309 $core->callBehavior('adminBlogPreferencesForm',$core); 310 311 echo 312 '<p><input type="submit" accesskey="s" value="'.__('save').'" />'. 313 (!$standalone ? form::hidden('id',$blog_id) : ''). 314 '</p>'. 315 '</form>'; 316 317 if ($core->auth->isSuperAdmin() && $blog_id != $core->blog->id) 318 { 319 echo 320 '<form action="blog_del.php" method="post">'. 321 '<p><input type="submit" value="'.__('Delete this blog').'" />'. 322 form::hidden(array('blog_id'),$blog_id).'</p>'. 323 '</form>'; 324 } 325 326 # XML/RPC information 327 echo '<h3 id="xmlrpc">'.__('XML/RPC interface').'</h3>'; 328 329 echo '<p>'.__('XML/RPC interface allows you to edit your blog with an external client.').'</p>'; 330 331 if (!$blog_settings->enable_xmlrpc) 332 { 333 echo '<p>'.__('XML/RPC interface is not active. Change settings to enable it.').'</p>'; 334 } 335 else 336 { 337 echo 338 '<p>'.__('XML/RPC inteface is active. You should set the following parameters on your XML/RPC client:').'</p>'. 339 '<ul>'. 340 '<li>'.__('Server URL:').' <strong>'. 341 http::concatURL(dirname(http::getSelfURI()).'/','xmlrpc.php').'?b='.rawurlencode($blog_id).'</strong></li>'. 342 '<li>'.__('Blogging system:').' <strong>Movable Type</strong></li>'. 343 '<li>'.__('User name:').' <strong>'.$core->auth->userID().'</strong></li>'. 344 '<li>'.__('Password:').' <strong>'.__('your password').'</strong></li>'. 345 '<li>'.__('Blog ID:').' <strong>1</strong></li>'. 346 '</ul>'; 347 } 348 349 echo '</div>'; 350 351 # 352 # Users on the blog (with permissions) 353 354 $blog_users = $core->getBlogPermissions($blog_id,$core->auth->isSuperAdmin()); 355 $perm_types = $core->auth->getPermissionsTypes(); 356 357 echo 358 '<div class="multi-part" id="users" title="'.__('Users').'">'. 359 '<h3>'.__('Users on this blog').'</h3>'; 360 361 if (empty($blog_users)) 362 { 363 echo '<p>'.__('No users').'</p>'; 364 } 365 else 366 { 367 if ($core->auth->isSuperAdmin()) { 368 $user_url_p = '<a href="user.php?id=%1$s">%1$s</a>'; 369 } else { 370 $user_url_p = '%1$s'; 371 } 372 373 foreach ($blog_users as $k => $v) 374 { 375 if (count($v['p']) > 0) 376 { 377 echo 378 '<h4>'.sprintf($user_url_p,html::escapeHTML($k)). 379 ' ('.html::escapeHTML(dcUtils::getUserCN( 380 $k, $v['name'], $v['firstname'], $v['displayname'] 381 )).')'; 382 383 if (!$v['super'] && $core->auth->isSuperAdmin()) { 384 echo 385 ' - <a href="permissions.php?blog_id[]='.$blog_id.'&user_id[]='.$k.'">' 386 .__('change permissions').'</a>'; 387 } 388 389 echo '</h4>'; 390 391 echo '<ul>'; 392 if ($v['super']) { 393 echo '<li>'.__('Super administrator').'</li>'; 394 } else { 395 foreach ($v['p'] as $p => $V) { 396 echo '<li>'.__($perm_types[$p]).'</li>'; 397 } 398 } 399 echo '</ul>'; 400 } 401 } 402 } 403 404 echo '</div>'; 405 406 407 } 408 409 dcPage::close(); 410 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 22:16:06 2007 | par Balluche grâce à PHPXref 0.7 |