Changeset 1155:49ba58cbf593
- Timestamp:
- 04/09/13 09:15:41 (13 years ago)
- Branch:
- twig
- Parents:
- 1154:e85c1417b8a4 (diff), 1143:fbf575ae9bda (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r1139 r1155 15 15 dcPage::check('usage,contentadmin'); 16 16 17 $post_id = ''; 18 $cat_id = ''; 19 $post_dt = ''; 20 $post_format = $core->auth->getOption('post_format'); 21 $post_password = ''; 22 $post_url = ''; 23 $post_lang = $core->auth->getInfo('user_lang'); 24 $post_title = ''; 25 $post_excerpt = ''; 26 $post_excerpt_xhtml = ''; 27 $post_content = ''; 28 $post_content_xhtml = ''; 29 $post_notes = ''; 30 $post_status = $core->auth->getInfo('user_post_status'); 31 $post_selected = false; 32 $post_open_comment = $core->blog->settings->system->allow_comments; 33 $post_open_tb = $core->blog->settings->system->allow_trackbacks; 17 function savePost($form) { 18 global $_ctx; 19 $_ctx->setAlert('save'); 20 21 } 22 23 function deletePost($form) { 24 print_r($form); exit; 25 } 34 26 35 27 $page_title = __('New entry'); … … 47 39 # If user can't publish 48 40 if (!$can_publish) { 49 $ post_status = -2;41 $form->post_status = -2; 50 42 } 51 43 … … 55 47 $categories = $core->blog->getCategories(array('post_type'=>'post')); 56 48 while ($categories->fetch()) { 57 $categories_combo[ ] = new formSelectOption(58 str_repeat(' ',$categories->level-1). ($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title),59 $categories->cat_id60 );49 $categories_combo[$categories->cat_id] = 50 str_repeat(' ',$categories->level-1). 51 ($categories->level-1 == 0 ? '' : '• '). 52 html::escapeHTML($categories->cat_title); 61 53 } 62 54 } catch (Exception $e) { } … … 64 56 # Status combo 65 57 foreach ($core->blog->getAllPostStatus() as $k => $v) { 66 $status_combo[$ v] = (string) $k;58 $status_combo[$k] = $v; 67 59 } 68 $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />';69 60 70 61 # Formaters combo … … 88 79 unset($rs); 89 80 90 # Validation flag 91 $bad_dt = false; 92 81 $form = new dcForm($core,'post','post.php'); 82 $form 83 ->addField( 84 new dcFieldText('post_title','', array( 85 'size' => 20, 86 'required' => true, 87 'label' => __('Title')))) 88 ->addField( 89 new dcFieldTextArea('post_excerpt','', array( 90 'cols' => 50, 91 'rows' => 5, 92 'label' => __("Excerpt:")))) 93 ->addField( 94 new dcFieldTextArea('post_content','', array( 95 'required' => true, 96 'label' => __("Content:")))) 97 ->addField( 98 new dcFieldTextArea('post_notes','', array( 99 'label' => __("Notes")))) 100 ->addField( 101 new dcFieldSubmit('save',__('Save'),array( 102 'action' => 'savePost'))) 103 ->addField( 104 new dcFieldSubmit('delete',__('Delete'),array( 105 'action' => 'deletePost'))) 106 ->addField( 107 new dcFieldCombo('post_status',$core->auth->getInfo('user_post_status'),$status_combo,array( 108 'disabled' => !$can_publish, 109 'label' => __('Entry status:')))) 110 ->addField( 111 new dcFieldCombo('cat_id','',$categories_combo,array( 112 "label" => __('Category:')))) 113 ->addField( 114 new dcFieldText('post_dt','',array( 115 "label" => __('Published on:')))) 116 ->addField( 117 new dcFieldCombo('post_format',$core->auth->getOption('post_format'),$formaters_combo,array( 118 "label" => __('Text formating:')))) 119 ->addField( 120 new dcFieldCheckbox ('post_open_comment',$core->blog->settings->system->allow_comments,array( 121 "label" => __('Accept comments')))) 122 ->addField( 123 new dcFieldCheckbox ('post_open_tb',$core->blog->settings->system->allow_trackbacks,array( 124 "label" => __('Accept trackbacks')))) 125 ->addField( 126 new dcFieldCheckbox ('post_selected',false,array( 127 "label" => __('Selected entry')))) 128 ->addField( 129 new dcFieldCombo ('post_lang',$core->auth->getInfo('user_lang'),$lang_combo, array( 130 "label" => __('Entry lang:')))) 131 ->addField( 132 new dcFieldHidden ('id','')) 133 ; 93 134 # Get entry informations 94 135 if (!empty($_REQUEST['id'])) … … 105 146 else 106 147 { 107 $post_id = $post->post_id; 108 $cat_id = $post->cat_id; 109 $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 110 $post_format = $post->post_format; 111 $post_password = $post->post_password; 112 $post_url = $post->post_url; 113 $post_lang = $post->post_lang; 114 $post_title = $post->post_title; 115 $post_excerpt = $post->post_excerpt; 116 $post_excerpt_xhtml = $post->post_excerpt_xhtml; 117 $post_content = $post->post_content; 118 $post_content_xhtml = $post->post_content_xhtml; 119 $post_notes = $post->post_notes; 120 $post_status = $post->post_status; 121 $post_selected = (boolean) $post->post_selected; 122 $post_open_comment = (boolean) $post->post_open_comment; 123 $post_open_tb = (boolean) $post->post_open_tb; 148 $form->id = $post->post_id; 149 $form->cat_id = $post->cat_id; 150 $form->post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 151 $form->post_format = $post->post_format; 152 $form->post_password = $post->post_password; 153 $form->post_url = $post->post_url; 154 $form->post_lang = $post->post_lang; 155 $form->post_title = $post->post_title; 156 $form->post_excerpt = $post->post_excerpt; 157 $form->post_excerpt_xhtml = $post->post_excerpt_xhtml; 158 $form->post_content = $post->post_content; 159 $form->post_content_xhtml = $post->post_content_xhtml; 160 $form->post_notes = $post->post_notes; 161 $form->post_status = $post->post_status; 162 $form->post_selected = (boolean) $post->post_selected; 163 $form->post_open_comment = (boolean) $post->post_open_comment; 164 $form->post_open_tb = (boolean) $post->post_open_tb; 165 $form->can_edit_post = $post->isEditable(); 166 $form->can_delete= $post->isDeletable(); 124 167 125 $page_title = __('Edit entry');126 127 $can_edit_post = $post->isEditable();128 $can_delete= $post->isDeletable();129 130 $next_rs = $core->blog->getNextPost($post,1);131 $prev_rs = $core->blog->getNextPost($post,-1);132 133 if ($next_rs !== null) {134 $next_link = sprintf($post_link,$next_rs->post_id,135 html::escapeHTML($next_rs->post_title),__('next entry').' »');136 $next_headlink = sprintf($post_headlink,'next',137 html::escapeHTML($next_rs->post_title),$next_rs->post_id);138 }139 140 if ($prev_rs !== null) {141 $prev_link = sprintf($post_link,$prev_rs->post_id,142 html::escapeHTML($prev_rs->post_title),'« '.__('previous entry'));143 $prev_headlink = sprintf($post_headlink,'previous',144 html::escapeHTML($prev_rs->post_title),$prev_rs->post_id);145 }146 147 try {148 $core->media = new dcMedia($core);149 } catch (Exception $e) {}150 168 } 151 169 } 152 170 153 # Format excerpt and content 154 if (!empty($_POST) && $can_edit_post) 155 { 156 $post_format = $_POST['post_format']; 157 $post_excerpt = $_POST['post_excerpt']; 158 $post_content = $_POST['post_content']; 159 160 $post_title = $_POST['post_title']; 161 162 $cat_id = (integer) $_POST['cat_id']; 163 164 if (isset($_POST['post_status'])) { 165 $post_status = (integer) $_POST['post_status']; 166 } 167 168 if (empty($_POST['post_dt'])) { 169 $post_dt = ''; 170 } else { 171 try 172 { 173 $post_dt = strtotime($_POST['post_dt']); 174 if ($post_dt == false || $post_dt == -1) { 175 $bad_dt = true; 176 throw new Exception(__('Invalid publication date')); 177 } 178 $post_dt = date('Y-m-d H:i',$post_dt); 179 } 180 catch (Exception $e) 181 { 182 $core->error->add($e->getMessage()); 183 } 184 } 185 186 $post_open_comment = !empty($_POST['post_open_comment']); 187 $post_open_tb = !empty($_POST['post_open_tb']); 188 $post_selected = !empty($_POST['post_selected']); 189 $post_lang = $_POST['post_lang']; 190 $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 191 192 $post_notes = $_POST['post_notes']; 193 194 if (isset($_POST['post_url'])) { 195 $post_url = $_POST['post_url']; 196 } 197 198 $core->blog->setPostContent( 199 $post_id,$post_format,$post_lang, 200 $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml 201 ); 202 } 203 204 # Delete post 205 if (!empty($_POST['delete']) && $can_delete) 206 { 207 try { 208 # --BEHAVIOR-- adminBeforePostDelete 209 $core->callBehavior('adminBeforePostDelete',$post_id); 210 $core->blog->delPost($post_id); 211 http::redirect('posts.php'); 212 } catch (Exception $e) { 213 $core->error->add($e->getMessage()); 214 } 215 } 216 217 # Create or update post 218 if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 219 { 220 $cur = $core->con->openCursor($core->prefix.'post'); 221 222 $cur->post_title = $post_title; 223 $cur->cat_id = ($cat_id ? $cat_id : null); 224 $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 225 $cur->post_format = $post_format; 226 $cur->post_password = $post_password; 227 $cur->post_lang = $post_lang; 228 $cur->post_title = $post_title; 229 $cur->post_excerpt = $post_excerpt; 230 $cur->post_excerpt_xhtml = $post_excerpt_xhtml; 231 $cur->post_content = $post_content; 232 $cur->post_content_xhtml = $post_content_xhtml; 233 $cur->post_notes = $post_notes; 234 $cur->post_status = $post_status; 235 $cur->post_selected = (integer) $post_selected; 236 $cur->post_open_comment = (integer) $post_open_comment; 237 $cur->post_open_tb = (integer) $post_open_tb; 238 239 if (isset($_POST['post_url'])) { 240 $cur->post_url = $post_url; 241 } 242 243 # Update post 244 if ($post_id) 245 { 246 try 247 { 248 # --BEHAVIOR-- adminBeforePostUpdate 249 $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 250 251 $core->blog->updPost($post_id,$cur); 252 253 # --BEHAVIOR-- adminAfterPostUpdate 254 $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 255 256 http::redirect('post.php?id='.$post_id.'&upd=1'); 257 } 258 catch (Exception $e) 259 { 260 $core->error->add($e->getMessage()); 261 } 262 } 263 else 264 { 265 $cur->user_id = $core->auth->userID(); 266 267 try 268 { 269 # --BEHAVIOR-- adminBeforePostCreate 270 $core->callBehavior('adminBeforePostCreate',$cur); 271 272 $return_id = $core->blog->addPost($cur); 273 274 # --BEHAVIOR-- adminAfterPostCreate 275 $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 276 277 http::redirect('post.php?id='.$return_id.'&crea=1'); 278 } 279 catch (Exception $e) 280 { 281 $core->error->add($e->getMessage()); 282 } 283 } 284 } 171 $form->setup(); 285 172 286 173 /* DISPLAY … … 294 181 } 295 182 296 dcPage::open($page_title.' - '.__('Entries'), 297 dcPage::jsDatePicker(). 298 dcPage::jsToolBar(). 299 dcPage::jsModal(). 300 dcPage::jsMetaEditor(). 301 dcPage::jsLoad('js/_post.js'). 302 dcPage::jsConfirmClose('entry-form','comment-form'). 303 # --BEHAVIOR-- adminPostHeaders 304 $core->callBehavior('adminPostHeaders'). 305 dcPage::jsPageTabs($default_tab). 306 $next_headlink."\n".$prev_headlink 307 ); 183 $_ctx 184 ->fillPageTitle(__('Entries'),'posts.php') 185 ->fillPageTitle($page_title) 186 ->default_tab = $default_tab; 308 187 309 if (!empty($_GET['upd'])) { 310 dcPage::message(__('Entry has been successfully updated.')); 311 } 312 elseif (!empty($_GET['crea'])) { 313 dcPage::message(__('Entry has been successfully created.')); 314 } 315 elseif (!empty($_GET['attached'])) { 316 dcPage::message(__('File has been successfully attached.')); 317 } 318 elseif (!empty($_GET['rmattach'])) { 319 dcPage::message(__('Attachment has been successfully removed.')); 320 } 321 322 if (!empty($_GET['creaco'])) { 323 dcPage::message(__('Comment has been successfully created.')); 324 } 325 326 # XHTML conversion 327 if (!empty($_GET['xconv'])) 328 { 329 $post_excerpt = $post_excerpt_xhtml; 330 $post_content = $post_content_xhtml; 331 $post_format = 'xhtml'; 332 333 dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 334 } 335 336 echo '<h2>'.html::escapeHTML($core->blog->name).' › '.'<a href="posts.php">'.__('Entries').'</a> › <span class="page-title">'.$page_title; 337 if ($post_id) { 338 switch ($post_status) { 339 case 1: 340 $img_status = sprintf($img_status_pattern,__('published'),'check-on.png'); 341 break; 342 case 0: 343 $img_status = sprintf($img_status_pattern,__('unpublished'),'check-off.png'); 344 break; 345 case -1: 346 $img_status = sprintf($img_status_pattern,__('scheduled'),'scheduled.png'); 347 break; 348 case -2: 349 $img_status = sprintf($img_status_pattern,__('pending'),'check-wrn.png'); 350 break; 351 default: 352 $img_status = ''; 353 } 354 echo ' “'.$post_title.'”'.' '.$img_status; 355 } 356 echo '</span></h2>'; 357 358 if ($post_id && $post->post_status == 1) { 359 echo '<p><a href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; 360 } 361 if ($post_id) 362 { 363 echo '<p>'; 364 if ($prev_link) { echo $prev_link; } 365 if ($next_link && $prev_link) { echo ' - '; } 366 if ($next_link) { echo $next_link; } 367 368 # --BEHAVIOR-- adminPostNavLinks 369 $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); 370 371 echo '</p>'; 372 } 373 374 # Exit if we cannot view page 375 if (!$can_view_page) { 376 dcPage::helpBlock('core_post'); 377 dcPage::close(); 378 exit; 379 } 380 381 /* Post form if we can edit post 382 -------------------------------------------------------- */ 383 if ($can_edit_post) 384 { 385 echo '<div class="multi-part" title="'.__('Edit entry').'" id="edit-entry">'; 386 echo '<form action="post.php" method="post" id="entry-form">'; 387 echo '<div id="entry-wrapper">'; 388 echo '<div id="entry-content"><div class="constrained">'; 389 390 echo 391 '<p class="col"><label class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:'). 392 form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 393 '</label></p>'. 394 395 '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'</label> '. 396 form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 397 '</p>'. 398 399 '<p class="area"><label class="required" '. 400 'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 401 form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 402 '</p>'. 403 404 '<p class="area" id="notes-area"><label for="post_notes">'.__('Notes:').'</label>'. 405 form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 406 '</p>'; 407 408 # --BEHAVIOR-- adminPostForm 409 $core->callBehavior('adminPostForm',isset($post) ? $post : null); 410 411 echo 412 '<p>'. 413 ($post_id ? form::hidden('id',$post_id) : ''). 414 '<input type="submit" value="'.__('Save').' (s)" '. 415 'accesskey="s" name="save" /> '; 416 if ($post_id) { 417 $preview_url = 418 $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. 419 http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). 420 '/'.$post->post_url); 421 echo '<a id="post-preview" href="'.$preview_url.'" class="button" accesskey="p">'.__('Preview').' (p)'.'</a> '; 422 } 423 echo 424 ($can_delete ? '<input type="submit" class="delete" value="'.__('Delete').'" name="delete" />' : ''). 425 $core->formNonce(). 426 '</p>'; 427 428 echo '</div></div>'; // End #entry-content 429 echo '</div>'; // End #entry-wrapper 430 431 echo '<div id="entry-sidebar">'; 432 433 echo 434 '<p><label for="cat_id">'.__('Category:'). 435 form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 436 '</label></p>'. 437 438 '<p><label for="post_status">'.__('Entry status:'). 439 form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 440 '</label></p>'. 441 442 '<p><label for="post_dt">'.__('Published on:'). 443 form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 444 '</label></p>'. 445 446 '<p><label for="post_format">'.__('Text formating:'). 447 form::combo('post_format',$formaters_combo,$post_format). 448 '</label>'. 449 '</p>'. 450 '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button" href="post.php?id='.$post_id.'&xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 451 452 '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 453 __('Accept comments').'</label></p>'. 454 ($core->blog->settings->system->allow_comments ? 455 (isContributionAllowed($post_id,strtotime($post_dt),true) ? 456 '' : 457 '<p class="form-note warn">'.__('Warning: Comments are not more accepted for this entry.').'</p>') : 458 '<p class="form-note warn">'.__('Warning: Comments are not accepted on this blog.').'</p>'). 459 460 '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 461 __('Accept trackbacks').'</label></p>'. 462 ($core->blog->settings->system->allow_trackbacks ? 463 (isContributionAllowed($post_id,strtotime($post_dt),false) ? 464 '' : 465 '<p class="form-note warn">'.__('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 466 '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'). 467 468 '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 469 __('Selected entry').'</label></p>'. 470 471 '<p><label for="post_lang">'.__('Entry lang:'). 472 form::combo('post_lang',$lang_combo,$post_lang). 473 '</label></p>'. 474 475 '<p><label for="post_password">'.__('Entry password:'). 476 form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 477 '</label></p>'. 478 479 '<div class="lockable">'. 480 '<p><label for="post_url">'.__('Basename:'). 481 form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 482 '</label></p>'. 483 '<p class="form-note warn">'. 484 __('Warning: If you set the URL manually, it may conflict with another entry.'). 485 '</p>'. 486 '</div>'; 487 488 # --BEHAVIOR-- adminPostFormSidebar 489 $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 490 491 echo '</div>'; // End #entry-sidebar 492 493 echo '</form>'; 494 495 # --BEHAVIOR-- adminPostForm 496 $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); 497 498 echo '</div>'; 499 500 if ($post_id && $post->post_status == 1) { 501 echo '<p><a href="trackbacks.php?id='.$post_id.'" class="multi-part">'. 502 __('Ping blogs').'</a></p>'; 503 } 504 505 } 506 507 508 /* Comments and trackbacks 509 -------------------------------------------------------- */ 510 if ($post_id) 511 { 512 $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 513 514 $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 515 $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1))); 516 517 # Actions combo box 518 $combo_action = array(); 519 if ($can_edit_post && $core->auth->check('publish,contentadmin',$core->blog->id)) 520 { 521 $combo_action[__('publish')] = 'publish'; 522 $combo_action[__('unpublish')] = 'unpublish'; 523 $combo_action[__('mark as pending')] = 'pending'; 524 $combo_action[__('mark as junk')] = 'junk'; 525 } 526 527 if ($can_edit_post && $core->auth->check('delete,contentadmin',$core->blog->id)) 528 { 529 $combo_action[__('Delete')] = 'delete'; 530 } 531 532 # --BEHAVIOR-- adminCommentsActionsCombo 533 $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 534 535 $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 536 537 echo 538 '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 539 540 if ($has_action) { 541 echo '<form action="comments_actions.php" id="form-comments" method="post">'; 542 } 543 544 echo '<h3>'.__('Trackbacks').'</h3>'; 545 546 if (!$trackbacks->isEmpty()) { 547 showComments($trackbacks,$has_action,true); 548 } else { 549 echo '<p>'.__('No trackback').'</p>'; 550 } 551 552 echo '<h3>'.__('Comments').'</h3>'; 553 if (!$comments->isEmpty()) { 554 showComments($comments,$has_action); 555 } else { 556 echo '<p>'.__('No comment').'</p>'; 557 } 558 559 if ($has_action) { 560 echo 561 '<div class="two-cols">'. 562 '<p class="col checkboxes-helpers"></p>'. 563 564 '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 565 form::combo('action',$combo_action). 566 form::hidden('redir','post.php?id='.$post_id.'&co=1'). 567 $core->formNonce(). 568 '<input type="submit" value="'.__('ok').'" /></p>'. 569 '</div>'. 570 '</form>'; 571 } 572 573 echo '</div>'; 574 } 575 576 /* Add a comment 577 -------------------------------------------------------- */ 578 if ($post_id) 579 { 580 echo 581 '<div class="multi-part" id="add-comment" title="'.__('Add a comment').'">'. 582 '<h3>'.__('Add a comment').'</h3>'. 583 584 '<form action="comment.php" method="post" id="comment-form">'. 585 '<div class="constrained">'. 586 '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:'). 587 form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 588 '</label></p>'. 589 590 '<p><label for="comment_email">'.__('Email:'). 591 form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 592 '</label></p>'. 593 594 '<p><label for="comment_site">'.__('Web site:'). 595 form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 596 '</label></p>'. 597 598 '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 599 __('Comment:').'</label> '. 600 form::textarea('comment_content',50,8,html::escapeHTML('')). 601 '</p>'. 602 603 '<p>'.form::hidden('post_id',$post_id). 604 $core->formNonce(). 605 '<input type="submit" name="add" value="'.__('Save').'" /></p>'. 606 '</div>'. 607 '</form>'. 608 '</div>'; 609 } 610 611 # Controls comments or trakbacks capabilities 612 function isContributionAllowed($id,$dt,$com=true) 613 { 614 global $core; 615 616 if (!$id) { 617 return true; 618 } 619 if ($com) { 620 if (($core->blog->settings->system->comments_ttl == 0) || 621 (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 622 return true; 623 } 624 } else { 625 if (($core->blog->settings->system->trackbacks_ttl == 0) || 626 (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 627 return true; 628 } 629 } 630 return false; 631 } 632 633 # Show comments or trackbacks 634 function showComments($rs,$has_action,$tb=false) 635 { 636 echo 637 '<table class="comments-list"><tr>'. 638 '<th colspan="2">'.__('Author').'</th>'. 639 '<th>'.__('Date').'</th>'. 640 '<th class="nowrap">'.__('IP address').'</th>'. 641 '<th>'.__('Status').'</th>'. 642 '<th> </th>'. 643 '</tr>'; 644 645 while($rs->fetch()) 646 { 647 $comment_url = 'comment.php?id='.$rs->comment_id; 648 649 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 650 switch ($rs->comment_status) { 651 case 1: 652 $img_status = sprintf($img,__('published'),'check-on.png'); 653 break; 654 case 0: 655 $img_status = sprintf($img,__('unpublished'),'check-off.png'); 656 break; 657 case -1: 658 $img_status = sprintf($img,__('pending'),'check-wrn.png'); 659 break; 660 case -2: 661 $img_status = sprintf($img,__('junk'),'junk.png'); 662 break; 663 } 664 665 echo 666 '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 667 ' id="c'.$rs->comment_id.'">'. 668 669 '<td class="nowrap">'. 670 ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,'','','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. 671 '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. 672 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. 673 '<td class="nowrap"><a href="comments.php?ip='.$rs->comment_ip.'">'.$rs->comment_ip.'</a></td>'. 674 '<td class="nowrap status">'.$img_status.'</td>'. 675 '<td class="nowrap status"><a href="'.$comment_url.'">'. 676 '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /></a></td>'. 677 678 '</tr>'; 679 } 680 681 echo '</table>'; 682 } 683 684 dcPage::helpBlock('core_post','core_wiki'); 685 dcPage::close(); 188 $core->tpl->display('post.html.twig'); 686 189 ?> -
admin/style/default.css
r1140 r1155 40 40 margin-bottom: 0.6em; 41 41 } 42 42 43 h2 { 43 44 color: #666; … … 52 53 font-size: 1.2em; 53 54 } 55 54 56 p, div.p { 55 57 margin: 0 0 1em 0; 56 58 } 59 57 60 hr { 58 61 height: 1px; … … 61 64 border-style: solid; 62 65 } 66 63 67 pre, code { 64 68 font: 100% "Andale Mono","Courier New",monospace; … … 77 81 cursor: help; 78 82 } 83 79 84 80 85 /* LAYOUT … … 431 436 color: #666; 432 437 } 438 433 439 #dashboard-items { 434 440 float: left; … … 536 542 height: 500px; 537 543 } 544 538 545 #add-file-f { 539 546 position: relative; … … 619 626 display: inline; 620 627 } 628 621 629 #default-favs h3 { 622 630 margin-top: 2em; 623 631 margin-bottom: 1em; 624 632 } 633 625 634 .fav-list { 626 635 list-style-type: none; … … 915 924 vertical-align: middle; 916 925 } 926 917 927 /* Si quelque chose a besoin d'être caché sauf pour les revues d'écran */ 918 928 .hidden { … … 949 959 overflow: auto; 950 960 } 961 951 962 .grid { 952 963 background: transparent repeat url('grid.png') 0 0; 953 964 } 965 954 966 .line p { 955 967 margin: 0; … … 958 970 color: #666; 959 971 } 972 960 973 ul.nice { 961 974 margin: 1em 0; … … 1006 1019 margin-bottom: .5em; 1007 1020 } 1008 1009 1021 th, td { 1010 1022 border-width: 0 0 1px 0; … … 1021 1033 border-width: 0; 1022 1034 } 1035 1023 1036 table .maximal, table.maximal { 1024 1037 width: 100%; … … 1027 1040 width: 1px; 1028 1041 } 1042 1029 1043 table .nowrap { 1030 1044 white-space: nowrap; … … 1117 1131 font-weight: normal; 1118 1132 } 1133 1119 1134 input, textarea, select { 1120 1135 background: #f9f9f9; … … 1149 1164 background: transparent; 1150 1165 } 1166 1151 1167 label { 1152 1168 display: block; … … 1194 1210 resize: vertical; 1195 1211 } 1212 1196 1213 label.required { 1197 1214 font-weight: bold; … … 1218 1235 top: 0; 1219 1236 } 1237 1220 1238 label .maximal, textarea.maximal, input.maximal { 1221 1239 width: 100%; … … 1232 1250 padding-left: 20px; 1233 1251 } 1252 1253 a#toggle-filters { 1254 font-weight: bold; 1255 background: url(../images/plus.png) no-repeat 0 0; 1256 padding-left: 20px; 1257 } 1258 1259 a#toggle-filters.opened { 1260 background: url(../images/minus.png) no-repeat 0 0; 1261 } 1262 1234 1263 .constrained { 1235 1264 margin: 0; … … 1351 1380 background-color: #2373A8; 1352 1381 } 1353 1354 1382 /* jQuery Autocomplete plugin */ 1355 1383 .ac_results { … … 1384 1412 color: white; 1385 1413 } 1414 1415 form#filters {font-size: 100%; background: #f0f0f0; padding: 1em; border-radius: .5em; border: 1px solid #ddd;} 1416 form#filters .margintop {padding-top: 1.33em;} 1417 form#filters ul, form#filters p {list-style-type:none;margin: 0; padding: 0 0 .5em 0; margin-left: 1em;} 1418 form#filters .col30 {border-left: 1px solid #999;} 1419 form#filters .col30 h3 {margin-left: 1em;} 1420 1421 p.line, li.line { position: relative; padding: 3px 0 0 28px; margin: 0 0 1em 0;} 1422 li.line input[type=submit] {position: absolute; left:0;top:0; padding: 0 .1em; margin: 0;} 1423 li.line input[type=checkbox], li.line input[type=checkbox] {position: absolute; left: 0; top: .2em; padding: 0 .1em; margin: 0;} 1424 li.line select { margin-right: 2em;} 1425 li.line label { display: block; width: 8em; float: left;} 1426 li.line label img {margin-right: 8px;} 1427 li.line span.or { 1428 text-align: right; 1429 margin-left: 5em; 1430 font-weight: bold; 1431 } 1432 p.line label.or + select {margin-left: 2em;} 1433 li.line { padding: 0 0 0 20px; height: 1em;} 1434 li.line label {width: auto;} 1435 1436 #available_filters input[type=submit] {padding: 0 .1em; margin-left: .5em;} 1437 1438 div.pagination span, div.pagination a { 1439 margin-right: 1em; 1440 } -
admin/style/default.css
r1147 r1155 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 */ 13 14 /* ------------------------------------------------------------------ html */ 13 15 body { 14 16 font: 75%/1.5em Helvetica,Arial,sans-serif; … … 151 153 height: 2em; 152 154 } 155 #info-box1 p { 156 margin: 0; 157 display: inline; 158 } 153 159 #info-box1 select { 154 160 width: 15em; … … 193 199 } 194 200 #content { 195 margin: 1.5em 1.5em 4em 13em;201 margin: 1.5em 1.5em .5em 13em; 196 202 padding: 1em; 197 203 background: #fff; 198 -webkit-border-radius: .5em;199 -moz-border-radius: .5em;200 204 border-radius: .5em; 201 205 border: 1px solid #ddd; … … 255 259 background: #dfdfdf; 256 260 text-decoration: none; 257 -webkit-border-top-left-radius: .3em;258 -webkit-border-top-right-radius: .3em;259 -moz-border-radius-topleft: .3em;260 -moz-border-radius-topright: .3em;261 261 border-top-left-radius: .3em; 262 262 border-top-right-radius: .3em; … … 282 282 float: left; 283 283 margin-top: 1.2em; 284 margin-bottom: 1em;284 margin-bottom: .5em; 285 285 } 286 286 #main-menu h3 { … … 302 302 padding: .2em 0 0 32px; 303 303 background-repeat: no-repeat; 304 background-position: 12px . 2em;304 background-position: 12px .4em; 305 305 } 306 306 #main-menu a { … … 340 340 #footer { 341 341 clear: both; 342 padding: .75em 2em; 343 margin: 6em 15px .5em 15px; 344 -webkit-border-radius: .3em; 345 -moz-border-radius: .3em; 346 border-radius: .3em; 347 background: #575859 url(dc_logo_small.png) no-repeat right bottom; 348 color: #fff; 342 padding: .75em .75em 0 0; 343 text-align: right; 349 344 } 350 345 #footer p { … … 355 350 } 356 351 #footer a { 357 color: #f5f5f5;358 352 } 359 353 #footer p span.credit { … … 378 372 border: 1px solid #999; 379 373 padding: 1em 1em 0 1em; 380 -moz-border-radius: 4px;381 -webkit-border-radius: 4px;382 374 border-radius: 4px; 383 375 } … … 513 505 border: 1px solid #ccc; 514 506 border-left: 1em solid #E5E3DA; 515 -moz-border-radius: .3em;516 -webkit-border-radius: .3em;517 507 border-radius: .3em; 518 508 } … … 668 658 border: 1px solid #ddd; 669 659 padding: .2em; 670 -moz-border-radius: .5em;671 -webkit-border-radius: .5em;672 660 border-radius: .5em; 673 661 } … … 764 752 border: 1px solid #f3f3f3; 765 753 cursor: pointer; 766 -moz-border-radius: 4px;767 -webkit-border-radius: 4px;768 754 border-radius: 4px; 769 755 } … … 804 790 } 805 791 #help-button { 806 position: absolute;807 top: 6.2em;792 position: fixed; 793 top: 3.2em; 808 794 right: 0px; 809 795 cursor: pointer; … … 815 801 text-transform: capitalize; 816 802 padding: .33em .75em .33em 1em; 817 -moz-border-radius: 1em 0 0 1em; 818 -webkit-border-top-left-radius: 1em; 819 -webkit-border-bottom-left-radius: 1em; 803 border-radius: 1em 0 0 1em; 820 804 color: #444; 821 805 } … … 879 863 div.message, p.message, 880 864 div.static-msg, p.static-msg { 881 padding: 0.5em 0.5em 0.5em 4 0px;865 padding: 0.5em 0.5em 0.5em 48px; 882 866 margin-bottom: 1em; 883 -moz-border-radius: 8px;884 -webkit-border-radius: 8px;885 867 border-radius: 8px; 886 868 } … … 890 872 } 891 873 div.error, p.error { 892 background: # e5bfbf url(msg-error.png) no-repeat 5px 5px;893 color: # 600;874 background: #ffdec8 url(msg-error.png) no-repeat .7em .7em; 875 color: #000; 894 876 } 895 877 div.message, p.message, 896 878 div.static-msg, p.static-msg { 897 background: #666 url(msg-std.png) no-repeat 5px 5px;879 background: #666 url(msg-std.png) no-repeat .7em .7em; 898 880 color: #fff; 899 881 } … … 1015 997 right: 0; 1016 998 } 999 .distrib img { 1000 display: block; 1001 float: right; 1002 margin-top: -1em; 1003 } 1017 1004 /* TABLES 1018 1005 -------------------------------------------------------- */ … … 1041 1028 th { 1042 1029 text-align: left; 1030 border-bottom-color: #666; 1043 1031 } 1044 1032 .noborder td, td.noborder, .noborder th, th.noborder { … … 1056 1044 white-space: nowrap; 1057 1045 vertical-align: top; 1046 } 1047 table.settings, table.prefs { 1048 width: 80%; 1049 } 1050 table.settings th:first-child, table.prefs th:first-child { 1051 width: 20%; 1052 } 1053 table.settings th + th, table.prefs th + th { 1054 width: 30%; 1055 } 1056 table.settings th + th + th, table.prefs th + th + th { 1057 width: 10%; 1058 } 1059 table.settings th:last-child, table.prefs th:last-child { 1060 width: 40%; 1058 1061 } 1059 1062 … … 1136 1139 border-color: #000 #ccc #ccc #000; 1137 1140 } 1141 input.invalid, textarea.invalid, select.invalid { 1142 border: 1px solid red; 1143 background: #fff; 1144 color: red; 1145 box-shadow: 0 0 0 1px rgba(218, 62, 90, 0.3) 1146 } 1138 1147 input, textarea, select, option { 1139 1148 font: 1em "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif; … … 1167 1176 color: #666; 1168 1177 } 1178 span.form-note { 1179 font-style:italic; 1180 font-weight: normal; 1181 color: #666; 1182 } 1169 1183 p.form-note.warn, p.form-note.info, p.warning { 1170 1184 font-style: normal; … … 1172 1186 } 1173 1187 p.form-note.warn, p.warning { 1174 background: #ffd url(warning.png) no-repeat . 2em .2em;1188 background: #ffd url(warning.png) no-repeat .3em .3em; 1175 1189 border: 1px solid #f0c020; 1176 1190 } 1177 1191 p.form-note.info { 1178 background: #eef url(info.png) no-repeat . 2em .2em;1192 background: #eef url(info.png) no-repeat .3em .2em; 1179 1193 border: 1px solid #99f; 1180 1194 } … … 1209 1223 p.field { 1210 1224 position: relative; 1211 1225 1212 1226 } 1213 1227 p.field label { … … 1275 1289 padding: .1em .5em 0 .5em; 1276 1290 text-shadow: 0 1px 1px rgba(0,0,0,.3); 1277 -webkit-border-radius: .2em;1278 -moz-border-radius: .2em;1279 1291 border-radius: .2em; 1280 1292 margin-bottom: .1em; … … 1358 1370 } 1359 1371 a.button.add { 1360 -webkit-border-radius: .5em;1361 -moz-border-radius: .5em;1362 1372 border-radius: .5em; 1363 1373 margin-bottom: .1em; 1364 background: #2C8FD1 url( add.png) no-repeat 6px center;1374 background: #2C8FD1 url(../images/add.png) no-repeat 6px center; 1365 1375 color: #fff; 1366 1376 padding: .2em 16px .2em 30px; … … 1369 1379 a.button.add:hover, a.button.add:focus { 1370 1380 background-color: #2373A8; 1381 } 1382 /* jQuery Autocomplete plugin */ 1383 .ac_results { 1384 padding: 0px; 1385 border: 1px dotted #f90; 1386 background-color: white; 1387 overflow: hidden; 1388 z-index: 99999; 1389 } 1390 .ac_results ul { 1391 width: 100%; 1392 list-style-position: outside; 1393 list-style: none; 1394 padding: 0; 1395 margin: 0; 1396 } 1397 .ac_results li { 1398 margin: 0px; 1399 padding: 2px 5px; 1400 cursor: default; 1401 display: block; 1402 font: menu; 1403 font-size: 1em; 1404 line-height: 16px; 1405 overflow: hidden; 1406 } 1407 .ac_loading { 1408 background: transparent url('loader.gif') right center no-repeat; 1409 } 1410 .ac_over { 1411 background-color: #06c; 1412 color: white; 1371 1413 } 1372 1414 -
inc/admin/lib.dc.page.php
r1142 r1155 49 49 50 50 # Top of admin page 51 public static function open($title='', $head='') 52 { 53 global $core; 54 55 # List of user's blogs 56 if ($core->auth->blog_count == 1 || $core->auth->blog_count > 20) 57 { 58 $blog_box = 59 '<p>'.__('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'. 60 html::escapeHTML($core->blog->name).'</strong>'; 61 62 if ($core->auth->blog_count > 20) { 63 $blog_box .= ' - <a href="blogs.php">'.__('Change blog').'</a>'; 64 } 65 $blog_box .= '</p>'; 66 } 67 else 68 { 69 $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); 70 $blogs = array(); 71 while ($rs_blogs->fetch()) { 72 $blogs[html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id; 73 } 74 $blog_box = 75 '<p><label for="switchblog" class="classic">'. 76 __('Blogs:').' '. 77 $core->formNonce(). 78 form::combo('switchblog',$blogs,$core->blog->id). 79 '</label></p>'. 80 '<noscript><p><input type="submit" value="'.__('ok').'" /></p></noscript>'; 81 } 82 83 $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode']; 84 85 # Display 86 header('Content-Type: text/html; charset=UTF-8'); 87 echo 88 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 89 ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 90 '<html xmlns="http://www.w3.org/1999/xhtml" '. 91 'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 92 'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 93 "<head>\n". 94 ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 95 ' <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 96 97 ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 98 ' <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 99 100 self::jsLoadIE7(). 101 ' <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; 102 if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { 103 echo 104 ' <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; 105 } 106 107 $core->auth->user_prefs->addWorkspace('interface'); 108 $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; 109 if (!$user_ui_hide_std_favicon) { 110 echo '<link rel="icon" type="image/png" href="images/favicon.png" />'; 111 } 112 113 echo 114 self::jsCommon(). 115 $head; 116 117 # --BEHAVIOR-- adminPageHTMLHead 118 $core->callBehavior('adminPageHTMLHead'); 119 120 echo 121 "</head>\n". 122 '<body id="dotclear-admin'. 123 ($safe_mode ? ' safe-mode' : ''). 124 '">'."\n". 125 126 '<div id="header">'. 127 '<ul id="prelude"><li><a href="#content">'.__('Go to the content').'</a></li><li><a href="#main-menu">'.__('Go to the menu').'</a></li></ul>'."\n". 128 '<div id="top"><h1><a href="index.php">'.DC_VENDOR_NAME.'</a></h1></div>'."\n"; 129 130 echo 131 '<div id="info-boxes">'. 132 '<div id="info-box1">'. 133 '<form action="index.php" method="post">'. 134 $blog_box. 135 '<p><a href="'.$core->blog->url.'" onclick="window.open(this.href);return false;" title="'.__('Go to site').' ('.__('new window').')'.'">'.__('Go to site').' <img src="images/outgoing.png" alt="" /></a>'. 136 '</p></form>'. 137 '</div>'. 138 '<div id="info-box2">'. 139 '<a'.(preg_match('/index.php$/',$_SERVER['REQUEST_URI']) ? ' class="active"' : '').' href="index.php">'.__('My dashboard').'</a>'. 140 '<span> | </span><a'.(preg_match('/preferences.php(\?.*)?$/',$_SERVER['REQUEST_URI']) ? ' class="active"' : '').' href="preferences.php">'.__('My preferences').'</a>'. 141 '<span> | </span><a href="index.php?logout=1" class="logout">'.sprintf(__('Logout %s'),$core->auth->userID()).' <img src="images/logout.png" alt="" /></a>'. 142 '</div>'. 143 '</div>'. 144 '</div>'; 145 146 echo 147 '<div id="wrapper">'."\n". 148 '<div id="main">'."\n". 149 '<div id="content">'."\n"; 150 151 # Safe mode 152 if ($safe_mode) 153 { 154 echo 155 '<div class="error"><h3>'.__('Safe mode').'</h3>'. 156 '<p>'.__('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities').'</p>'. 157 '</div>'; 158 } 51 public static function open($title='',$head='',$popup=false) 52 { 53 global $core, $_ctx; 54 55 $_ctx->popup = (boolean) $popup; 56 $_ctx->page_header = $head; 57 $_ctx->fillPageTitle($title); 58 59 ob_start(); 60 } 61 62 public static function close() 63 { 64 $res = ob_get_contents(); 65 ob_end_clean(); 66 67 global $core, $_ctx; 159 68 160 69 if ($core->error->flag()) { 161 echo 162 '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</p></strong>'. 163 $core->error->toHTML(). 164 '</div>'; 165 } 166 } 167 168 public static function close() 169 { 170 global $core; 171 172 $menu =& $GLOBALS['_menu']; 173 174 echo 175 "</div>\n". // End of #content 176 "</div>\n". // End of #main 177 178 '<div id="main-menu">'."\n"; 179 180 foreach ($menu as $k => $v) { 181 echo $menu[$k]->draw(); 182 } 183 184 $text = sprintf(__('Thank you for using %s.'),'Dotclear '.DC_VERSION); 185 186 # --BEHAVIOR-- adminPageFooter 187 $textAlt = $core->callBehavior('adminPageFooter',$core,$text); 188 if ($textAlt != '') { 189 $text = $textAlt; 190 } 191 $text = html::escapeHTML($text); 192 193 echo 194 '</div>'."\n". // End of #main-menu 195 '<div id="footer"><a href="http://dotclear.org/" title="'.$text.'"><img src="style/dc_logo_footer.png" alt="'.$text.'" /></a></div>'."\n". 196 "</div>\n"; // End of #wrapper 197 198 if (defined('DC_DEV') && DC_DEV === true) { 199 echo self::debugInfo(); 200 } 201 202 echo 203 '</body></html>'; 204 } 205 206 public static function openPopup($title='', $head='') 207 { 208 global $core; 209 210 # Display 211 header('Content-Type: text/html; charset=UTF-8'); 212 echo 213 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 214 ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 215 '<html xmlns="http://www.w3.org/1999/xhtml" '. 216 'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 217 'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 218 "<head>\n". 219 ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 220 ' <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 221 222 ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 223 ' <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 224 225 self::jsLoadIE7(). 226 ' <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; 227 if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { 228 echo 229 ' <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; 230 } 231 232 echo 233 self::jsCommon(). 234 $head; 235 236 # --BEHAVIOR-- adminPageHTMLHead 237 $core->callBehavior('adminPageHTMLHead'); 238 239 echo 240 "</head>\n". 241 '<body id="dotclear-admin" class="popup">'."\n". 242 243 '<div id="top"><h1>'.DC_VENDOR_NAME.'</h1></div>'."\n"; 244 245 echo 246 '<div id="wrapper">'."\n". 247 '<div id="main">'."\n". 248 '<div id="content">'."\n"; 249 250 if ($core->error->flag()) { 251 echo 252 '<div class="error"><strong>'.__('Errors:').'</strong>'. 253 $core->error->toHTML(). 254 '</div>'; 255 } 70 foreach($core->error->getErrors() as $e) { 71 $_ctx->addError($e); 72 } 73 } 74 $_ctx->page_content = $res; 75 $core->tpl->display('page_layout.html.twig'); 76 } 77 78 public static function openPopup($title='',$head='') 79 { 80 self::open($title,$head,true); 256 81 } 257 82 258 83 public static function closePopup() 259 84 { 260 echo 261 "</div>\n". // End of #content 262 "</div>\n". // End of #main 263 '<div id="footer"><p> </p></div>'."\n". 264 "</div>\n". // End of #wrapper 265 '</body></html>'; 85 self::close(); 266 86 } 267 87 … … 279 99 } 280 100 } 281 return $res;282 }283 284 private static function debugInfo()285 {286 $global_vars = implode(', ',array_keys($GLOBALS));287 288 $res =289 '<div id="debug"><div>'.290 '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>';291 292 if (function_exists('xdebug_get_profiler_filename'))293 {294 $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>';295 296 $prof_file = xdebug_get_profiler_filename();297 if ($prof_file) {298 $res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>';299 } else {300 $prof_url = http::getSelfURI();301 $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&';302 $prof_url .= 'XDEBUG_PROFILE';303 $res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>';304 }305 306 /* xdebug configuration:307 zend_extension = /.../xdebug.so308 xdebug.auto_trace = On309 xdebug.trace_format = 0310 xdebug.trace_options = 1311 xdebug.show_mem_delta = On312 xdebug.profiler_enable = 0313 xdebug.profiler_enable_trigger = 1314 xdebug.profiler_output_dir = /tmp315 xdebug.profiler_append = 0316 xdebug.profiler_output_name = timestamp317 */318 }319 320 $res .=321 '<p>Global vars: '.$global_vars.'</p>'.322 '</div></div>';323 324 101 return $res; 325 102 } -
inc/admin/lib.dc.page.php
r1089 r1155 173 173 self::jsLoad('js/jquery/jquery.biscuit.js'). 174 174 self::jsLoad('js/jquery/jquery.bgFade.js'). 175 self::jsLoad('js/jquery/jquery.constantfooter.js').176 175 self::jsLoad('js/common.js'). 177 176 self::jsLoad('js/prelude.js'). -
inc/core/class.dc.blog.php
r1111 r1155 805 805 806 806 if (!empty($params['user_id'])) { 807 $strReq .= "AND U.user_id = '".$this->con->escape($params['user_id'])."'";807 $strReq .= "AND U.user_id ".$this->con->in($params['user_id'])." "; 808 808 } 809 809 … … 889 889 $strReq .= 'ORDER BY post_dt DESC '; 890 890 } 891 } 892 893 if (!$count_only && !empty($params['limit'])) { 894 $strReq .= $this->con->limit($params['limit']); 891 if (!empty($params['limit'])) { 892 $strReq .= $this->con->limit($params['limit']); 893 } 895 894 } 896 895 -
inc/core/class.dc.blog.php
r1154 r1155 228 228 'SELECT post_id, COUNT(post_id) AS nb_comment,comment_trackback '. 229 229 'FROM '.$this->prefix.'comment '. 230 'WHERE post_id'.$this->con->in($a_ids).231 'AND comment_status = 1 ';230 'WHERE comment_status = 1 '. 231 (count($a_ids) > 0 ? 'AND post_id'.$this->con->in($a_ids) : ' '); 232 232 233 233 if ($del) { -
inc/prepend.php
r1119 r1155 12 12 13 13 /* ------------------------------------------------------------------------------------------- */ 14 # ClearBricks, DotClear classes auto-loader14 # ClearBricks, Twig, DotClear classes auto-loader 15 15 if (@is_dir('/usr/lib/clearbricks')) { 16 16 define('CLEARBRICKS_PATH','/usr/lib/clearbricks'); … … 46 46 $__autoload['dcWorkspace'] = dirname(__FILE__).'/core/class.dc.workspace.php'; 47 47 $__autoload['dcPrefs'] = dirname(__FILE__).'/core/class.dc.prefs.php'; 48 $__autoload['dcTwigPage'] = dirname(__FILE__).'/core/class.dc.twig.page.php'; 48 49 49 50 $__autoload['rsExtPost'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; … … 52 53 $__autoload['rsExtUser'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 53 54 55 $__autoload['dcAdminContext'] = dirname(__FILE__).'/admin/class.dc.admincontext.php'; 54 56 $__autoload['dcMenu'] = dirname(__FILE__).'/admin/class.dc.menu.php'; 55 57 $__autoload['dcPage'] = dirname(__FILE__).'/admin/lib.dc.page.php'; … … 63 65 $__autoload['context'] = dirname(__FILE__).'/public/lib.tpl.context.php'; 64 66 $__autoload['dcUrlHandlers'] = dirname(__FILE__).'/public/lib.urlhandlers.php'; 67 $__autoload['dcForm'] = dirname(__FILE__).'/admin/class.dc.form.php'; 68 $__autoload['dcFormExtension'] = dirname(__FILE__).'/admin/class.dc.form.php'; 69 $__autoload['dcTabExtension'] = dirname(__FILE__).'/admin/class.dc.tab.php'; 70 $__autoload['dcItemList'] = dirname(__FILE__).'/admin/class.dc.list.php'; 71 $__autoload['dcListFetcher'] = dirname(__FILE__).'/admin/class.dc.list.php'; 72 73 foreach (array('dcFilterSet', 'dcFilter','dcFilterCombo','dcFilterText','dcFilterBoolean') as $c) { 74 $__autoload[$c] = dirname(__FILE__).'/admin/class.dc.filter.php'; 75 } 65 76 66 77 # Clearbricks extensions 67 78 html::$absolute_regs[] = '/(<param\s+name="movie"\s+value=")(.*?)(")/msu'; 68 79 html::$absolute_regs[] = '/(<param\s+name="FlashVars"\s+value=".*?(?:mp3|flv)=)(.*?)(&|")/msu'; 80 81 if (@is_dir('/usr/lib/twig')) { 82 define('TWIG_PATH','/usr/lib/Twig'); 83 } elseif (is_dir(dirname(__FILE__).'/libs/Twig')) { 84 define('TWIG_PATH',dirname(__FILE__).'/libs/Twig'); 85 } elseif (isset($_SERVER['TWIG_PATH']) && is_dir($_SERVER['TWIG_PATH'])) { 86 define('TWIG_PATH',$_SERVER['TWIG_PATH']); 87 } 88 89 if (!defined('TWIG_PATH') || !is_dir(TWIG_PATH)) { 90 exit('No Twig path defined'); 91 } 92 require TWIG_PATH.'/Autoloader.php'; 93 Twig_Autoloader::register(); 94 69 95 /* ------------------------------------------------------------------------------------------- */ 70 96 … … 123 149 # Constants 124 150 define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 125 define('DC_VERSION','2. 5.1-dev');151 define('DC_VERSION','2.99-dev'); 126 152 define('DC_DIGESTS',dirname(__FILE__).'/digests'); 127 153 define('DC_L10N_ROOT',dirname(__FILE__).'/../locales'); -
inc/prepend.php
r1154 r1155 149 149 # Constants 150 150 define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 151 define('DC_VERSION','2. 5-dev');151 define('DC_VERSION','2.99-dev'); 152 152 define('DC_DIGESTS',dirname(__FILE__).'/digests'); 153 153 define('DC_L10N_ROOT',dirname(__FILE__).'/../locales'); -
plugins/aboutConfig/index.php
r1109 r1155 12 12 if (!defined('DC_CONTEXT_ADMIN')) { return; } 13 13 14 # Local navigation 15 if (!empty($_POST['gs_nav'])) { 16 http::redirect($p_url.$_POST['gs_nav']); 17 exit; 18 } 19 if (!empty($_POST['ls_nav'])) { 20 http::redirect($p_url.$_POST['ls_nav']); 21 exit; 22 } 23 24 # Local settings update 25 if (!empty($_POST['s']) && is_array($_POST['s'])) 14 class adminPageAboutConfig 26 15 { 27 try 16 public static $p_url = 'plugin.php?p=aboutConfig'; 17 18 # Update local settings 19 public static function updLocal($form) 28 20 { 29 foreach ($_POST['s'] as $ns => $s) 30 { 31 $core->blog->settings->addNamespace($ns); 21 self::updSettings($form); 22 } 23 24 # Update global settings 25 public static function updGlobal($form) 26 { 27 self::updSettings($form,true); 28 } 29 30 # Update settings 31 protected static function updSettings($form,$global=false) 32 { 33 global $core,$_ctx; 34 35 $part = $global ? 'global' : 'local'; 36 $prefix = $part.'_'; 37 38 try { 39 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) { 40 $core->blog->settings->addNamespace($ns); 41 $ns_settings = $global ? 42 $namespace->dumpGlobalSettings() : $namespace->dumpSettings(); 43 44 foreach ($ns_settings as $k => $v) { 45 // need to cast type 46 $f = (string) $form->{$prefix.$ns.'_'.$k}; 47 settype($f,$v['type']); 48 49 $core->blog->settings->$ns->put($k,$f,null,null,true,$global); 50 $form->{$prefix.$ns.'_'.$k} = $f; 51 } 52 } 53 $core->blog->triggerBlog(); 32 54 33 foreach ($s as $k => $v) { 34 $core->blog->settings->$ns->put($k,$v); 35 } 36 37 $core->blog->triggerBlog(); 55 http::redirect(self::$p_url.'&upd=1&part='.$part); 56 } 57 catch (Exception $e) { 58 $_ctx->addError($e->getMessage()); 59 } 60 } 61 62 # Set nav and settings forms 63 public static function setForms($global=false) 64 { 65 global $core, $_ctx; 66 67 $prefix = $global ? 'global_' : 'local_'; 68 $action = $global ? 'updGlobal' : 'updLocal'; 69 70 if (!empty($_POST[$prefix.'nav'])) { 71 http::redirect(self::$p_url.$_POST[$prefix.'nav']); 72 exit; 38 73 } 39 74 40 http::redirect($p_url.'&upd=1'); 41 } 42 catch (Exception $e) 43 { 44 $core->error->add($e->getMessage()); 75 $nav_form = new dcForm($core,$prefix.'nav_form','plugin.php'); 76 $settings_form = new dcForm($core,$prefix.'settings_form','plugin.php'); 77 78 $settings = $combo = array(); 79 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) { 80 $ns_settings = $global ? 81 $namespace->dumpGlobalSettings() : $namespace->dumpSettings(); 82 83 foreach ($ns_settings as $k => $v) { 84 $settings[$ns][$k] = $v; 85 } 86 } 87 88 ksort($settings); 89 foreach ($settings as $ns => $s) { 90 $combo['#'.$prefix.$ns] = $ns; 91 ksort($s); 92 foreach ($s as $k => $v) { 93 if ($v['type'] == 'boolean') { 94 $settings_form->addField( 95 new dcFieldCombo($prefix.$ns.'_'.$k, 96 '',array(1 => __('yes'),0 => __('no')))); 97 } 98 else { 99 $settings_form->addField( 100 new dcFieldText($prefix.$ns.'_'.$k,'')); 101 } 102 $settings_form->{$prefix.$ns.'_'.$k} = $v['value']; 103 } 104 } 105 106 $nav_form 107 ->addField( 108 new dcFieldCombo($prefix.'nav','',$combo,array( 109 "label" => __('Goto:')))) 110 ->addField( 111 new dcFieldSubmit($prefix.'nav_submit',__('OK'))) 112 ->addField( 113 new dcFieldHidden ('p','aboutConfig')) 114 ; 115 116 $settings_form 117 ->addField( 118 new dcFieldSubmit($prefix.'submit',__('Save'),array( 119 'action' => array('adminPageAboutConfig',$action)))) 120 ->addField( 121 new dcFieldHidden ('p','aboutConfig')) 122 ; 123 124 $_ctx->{$prefix.'settings'} = $settings; 125 126 $nav_form->setup(); 127 $settings_form->setup(); 45 128 } 46 129 } 47 130 48 # Global settings update 49 if (!empty($_POST['gs']) && is_array($_POST['gs'])) 50 { 51 try 52 { 53 foreach ($_POST['gs'] as $ns => $s) 54 { 55 $core->blog->settings->addNamespace($ns); 56 57 foreach ($s as $k => $v) { 58 $core->blog->settings->$ns->put($k,$v,null,null,true,true); 59 } 60 61 $core->blog->triggerBlog(); 62 } 63 64 http::redirect($p_url.'&upd=1&part=global'); 65 } 66 catch (Exception $e) 67 { 68 $core->error->add($e->getMessage()); 69 } 131 # Local settings forms 132 adminPageAboutConfig::setForms(); 133 134 # Global settings forms 135 adminPageAboutConfig::setForms(true); 136 137 # Commons 138 if (!empty($_GET['upd'])) { 139 $_ctx->setAlert(__('Configuration successfully updated')); 70 140 } 71 72 $part = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local'; 73 74 function settingLine($id,$s,$ns,$field_name,$strong_label) 75 { 76 if ($s['type'] == 'boolean') { 77 $field = form::combo(array($field_name.'['.$ns.']['.$id.']',$field_name.'_'.$id), 78 array(__('yes') => 1, __('no') => 0),$s['value'] ? 1 : 0); 79 } else { 80 $field = form::field(array($field_name.'['.$ns.']['.$id.']',$field_name.'_'.$id),40,null, 81 html::escapeHTML($s['value'])); 82 } 83 84 $slabel = $strong_label ? '<strong>%s</strong>' : '%s'; 85 86 return 87 '<tr>'. 88 '<td scope="raw"><label for="s_'.$id.'">'.sprintf($slabel,html::escapeHTML($id)).'</label></td>'. 89 '<td>'.$field.'</td>'. 90 '<td>'.$s['type'].'</td>'. 91 '<td>'.html::escapeHTML($s['label']).'</td>'. 92 '</tr>'; 141 if (!empty($_GET['upda'])) { 142 $_ctx->setAlert(__('Settings definition successfully updated')); 93 143 } 144 $_ctx->default_tab = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local'; 145 $_ctx->fillPageTitle('about:config'); 146 $core->tpl->display('@aboutConfig/index.html.twig'); 94 147 ?> 95 <html>96 <head>97 <title>about:config</title>98 <?php echo dcPage::jsPageTabs($part); ?>99 <style type="text/css">100 table.settings { border: 1px solid #999; margin-bottom: 2em; }101 table.settings th { background: #f5f5f5; color: #444; padding-top: 0.3em; padding-bottom: 0.3em; }102 p.anchor-nav {float: right; }103 </style>104 <script type="text/javascript">105 //<![CDATA[106 $(function() {107 $("#gs_submit").hide();108 $("#ls_submit").hide();109 $("#gs_nav").change(function() {110 window.location = $("#gs_nav option:selected").val();111 })112 $("#ls_nav").change(function() {113 window.location = $("#ls_nav option:selected").val();114 })115 });116 //]]>117 </script>118 </head>119 120 <body>121 <?php122 if (!empty($_GET['upd'])) {123 dcPage::message(__('Configuration successfully updated'));124 }125 126 if (!empty($_GET['upda'])) {127 dcPage::message(__('Settings definition successfully updated'));128 }129 ?>130 <h2><?php echo html::escapeHTML($core->blog->name); ?> › <span class="page-title">about:config</span></h2>131 132 <div id="local" class="multi-part" title="<?php echo __('blog settings'); ?>">133 134 <?php135 $table_header = '<table class="settings" id="%s"><caption>%s</caption>'.136 '<thead>'.137 '<tr>'."\n".138 ' <th class="nowrap">Setting ID</th>'."\n".139 ' <th>'.__('Value').'</th>'."\n".140 ' <th>'.__('Type').'</th>'."\n".141 ' <th class="maximalx">'.__('Description').'</th>'."\n".142 '</tr>'."\n".143 '</thead>'."\n".144 '<tbody>';145 $table_footer = '</tbody></table>';146 147 $settings = array();148 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) {149 foreach ($namespace->dumpSettings() as $k => $v) {150 $settings[$ns][$k] = $v;151 }152 }153 ksort($settings);154 if (count($settings) > 0) {155 $ns_combo = array();156 foreach ($settings as $ns => $s) {157 $ns_combo[$ns] = '#l_'.$ns;158 }159 echo160 '<form action="plugin.php" method="post">'.161 '<p class="anchor-nav">'.162 '<label for="ls_nav" class="classic">'.__('Goto:').'</label> '.form::combo('ls_nav',$ns_combo).163 ' <input type="submit" value="'.__('Ok').'" id="ls_submit" />'.164 '<input type="hidden" name="p" value="aboutConfig" />'.165 $core->formNonce().'</p></form>';166 }167 ?>168 169 <form action="plugin.php" method="post">170 171 <?php172 foreach ($settings as $ns => $s)173 {174 ksort($s);175 echo sprintf($table_header,'l_'.$ns,$ns);176 foreach ($s as $k => $v)177 {178 echo settingLine($k,$v,$ns,'s',!$v['global']);179 }180 echo $table_footer;181 }182 ?>183 184 <p><input type="submit" value="<?php echo __('Save'); ?>" />185 <input type="hidden" name="p" value="aboutConfig" />186 <?php echo $core->formNonce(); ?></p>187 </form>188 </div>189 190 <div id="global" class="multi-part" title="<?php echo __('global settings'); ?>">191 192 <?php193 $settings = array();194 195 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) {196 foreach ($namespace->dumpGlobalSettings() as $k => $v) {197 $settings[$ns][$k] = $v;198 }199 }200 201 ksort($settings);202 203 if (count($settings) > 0) {204 $ns_combo = array();205 foreach ($settings as $ns => $s) {206 $ns_combo[$ns] = '#g_'.$ns;207 }208 echo209 '<form action="plugin.php" method="post">'.210 '<p class="anchor-nav">'.211 '<label for="gs_nav" class="classic">'.__('Goto:').'</label> '.form::combo('gs_nav',$ns_combo).212 ' <input type="submit" value="'.__('Ok').'" id="gs_submit" />'.213 '<input type="hidden" name="p" value="aboutConfig" />'.214 $core->formNonce().'</p></form>';215 }216 ?>217 218 <form action="plugin.php" method="post">219 220 <?php221 foreach ($settings as $ns => $s)222 {223 ksort($s);224 echo sprintf($table_header,'g_'.$ns,$ns);225 foreach ($s as $k => $v)226 {227 echo settingLine($k,$v,$ns,'gs',false);228 }229 echo $table_footer;230 }231 ?>232 233 <p><input type="submit" value="<?php echo __('Save'); ?>" />234 <input type="hidden" name="p" value="aboutConfig" />235 <?php echo $core->formNonce(); ?></p>236 </form>237 </div>238 239 </body>240 </html>
Note: See TracChangeset
for help on using the changeset viewer.