Changeset 2511:798af8190003
- Timestamp:
- 11/03/13 18:11:26 (10 years ago)
- Branch:
- 2.6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/pages/page.php
r2390 r2511 73 73 $params['post_type'] = 'page'; 74 74 $params['post_id'] = $_REQUEST['id']; 75 75 76 76 $post = $core->blog->getPosts($params); 77 77 78 78 if ($post->isEmpty()) 79 79 { … … 100 100 $post_open_tb = (boolean) $post->post_open_tb; 101 101 $post_selected = (boolean) $post->post_selected; 102 102 103 103 $page_title = __('Edit page'); 104 104 105 105 $can_edit_page = $post->isEditable(); 106 106 $can_delete= $post->isDeletable(); 107 107 108 108 $next_rs = $core->blog->getNextPost($post,1); 109 109 $prev_rs = $core->blog->getNextPost($post,-1); 110 110 111 111 if ($next_rs !== null) { 112 112 $next_link = sprintf($post_link,$next_rs->post_id, … … 115 115 html::escapeHTML($next_rs->post_title),$next_rs->post_id); 116 116 } 117 117 118 118 if ($prev_rs !== null) { 119 119 $prev_link = sprintf($post_link,$prev_rs->post_id, … … 122 122 html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 123 123 } 124 124 125 125 try { 126 126 $core->media = new dcMedia($core); … … 138 138 $post_excerpt = $_POST['post_excerpt']; 139 139 $post_content = $_POST['post_content']; 140 140 141 141 $post_title = $_POST['post_title']; 142 142 143 143 if (isset($_POST['post_status'])) { 144 144 $post_status = (integer) $_POST['post_status']; 145 145 } 146 146 147 147 if (empty($_POST['post_dt'])) { 148 148 $post_dt = ''; … … 162 162 } 163 163 } 164 164 165 165 $post_open_comment = !empty($_POST['post_open_comment']); 166 166 $post_open_tb = !empty($_POST['post_open_tb']); … … 169 169 $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 170 170 $post_position = (integer) $_POST['post_position']; 171 171 172 172 $post_notes = $_POST['post_notes']; 173 173 … … 175 175 $post_url = $_POST['post_url']; 176 176 } 177 177 178 178 $core->blog->setPostContent( 179 179 $post_id,$post_format,$post_lang, … … 199 199 { 200 200 $cur = $core->con->openCursor($core->prefix.'post'); 201 201 202 202 # Magic tweak :) 203 203 $core->blog->settings->system->post_url_format = $page_url_format; 204 204 205 205 $cur->post_type = 'page'; 206 206 $cur->post_title = $post_title; … … 220 220 $cur->post_open_tb = (integer) $post_open_tb; 221 221 $cur->post_selected = (integer) $post_selected; 222 222 223 223 if (isset($_POST['post_url'])) { 224 224 $cur->post_url = $post_url; 225 225 } 226 226 227 227 # Update post 228 228 if ($post_id) … … 232 232 # --BEHAVIOR-- adminBeforePageUpdate 233 233 $core->callBehavior('adminBeforePageUpdate',$cur,$post_id); 234 234 235 235 $core->blog->updPost($post_id,$cur); 236 236 237 237 # --BEHAVIOR-- adminAfterPageUpdate 238 238 $core->callBehavior('adminAfterPageUpdate',$cur,$post_id); 239 239 240 240 http::redirect($redir_url.'&id='.$post_id.'&upd=1'); 241 241 } … … 248 248 { 249 249 $cur->user_id = $core->auth->userID(); 250 250 251 251 try 252 252 { 253 253 # --BEHAVIOR-- adminBeforePageCreate 254 254 $core->callBehavior('adminBeforePageCreate',$cur); 255 255 256 256 $return_id = $core->blog->addPost($cur); 257 257 258 258 # --BEHAVIOR-- adminAfterPageCreate 259 259 $core->callBehavior('adminAfterPageCreate',$cur,$return_id); 260 260 261 261 http::redirect($redir_url.'&id='.$return_id.'&crea=1'); 262 262 } … … 351 351 $post_content = $post_content_xhtml; 352 352 $post_format = 'xhtml'; 353 353 354 354 dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 355 355 } … … 367 367 if ($next_link && $prev_link) { echo ' | '; } 368 368 if ($next_link) { echo $next_link; } 369 370 # --BEHAVIOR-- adminPageNavLinks 369 370 # --BEHAVIOR-- adminPageNavLinks 371 371 $core->callBehavior('adminPageNavLinks',isset($post) ? $post : null); 372 372 373 373 echo '</p>'; 374 374 } … … 389 389 'title' => __('Status'), 390 390 'items' => array( 391 'post_status' => 391 'post_status' => 392 392 '<p><label for="post_status">'.__('Page status').'</label> '. 393 393 form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 394 394 '</p>', 395 'post_dt' => 395 'post_dt' => 396 396 '<p><label for="post_dt">'.__('Publication date and hour').'</label>'. 397 397 form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). … … 407 407 '</p>'. 408 408 '<p class="format_control control_wiki">'. 409 '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="post.php?id='.$post_id.'&xconv=1">'. 409 '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : ''). 410 '" href="'.html::escapeURL($redir_url).'&id='.$post_id.'&xconv=1">'. 410 411 __('Convert to XHTML').'</a></p></div>')), 411 412 'metas-box' => array( 412 413 'title' => __('Filing'), 413 414 'items' => array( 414 'post_position' => 415 'post_position' => 415 416 '<p><label for="post_position" class="classic">'.__('Page position').'</label> '. 416 417 form::field('post_position',3,3,(string) $post_position). … … 425 426 form::checkbox('post_open_comment',1,$post_open_comment).' '. 426 427 __('Accept comments').'</label></p>'. 427 ($core->blog->settings->system->allow_comments ? 428 (isContributionAllowed($post_id,strtotime($post_dt),true) ? 428 ($core->blog->settings->system->allow_comments ? 429 (isContributionAllowed($post_id,strtotime($post_dt),true) ? 429 430 '' : 430 431 '<p class="form-note warn">'. 431 __('Warning: Comments are not more accepted for this entry.').'</p>') : 432 __('Warning: Comments are not more accepted for this entry.').'</p>') : 432 433 '<p class="form-note warn">'. 433 434 __('Comments are not accepted on this blog so far.').'</p>'). … … 435 436 form::checkbox('post_open_tb',1,$post_open_tb).' '. 436 437 __('Accept trackbacks').'</label></p>'. 437 ($core->blog->settings->system->allow_trackbacks ? 438 (isContributionAllowed($post_id,strtotime($post_dt),false) ? 438 ($core->blog->settings->system->allow_trackbacks ? 439 (isContributionAllowed($post_id,strtotime($post_dt),false) ? 439 440 '' : 440 441 '<p class="form-note warn">'. 441 __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 442 __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 442 443 '<p class="form-note warn">'.__('Trackbacks are not accepted on this blog so far.').'</p>'). 443 444 '</div>', 444 'post_hide' => 445 'post_hide' => 445 446 '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 446 447 __('Hide in widget Pages').'</label>'. … … 465 466 form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 466 467 '</p>', 467 468 468 469 "post_excerpt" => 469 470 '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">'.__('Excerpt:').' <span class="form-note">'. … … 471 472 form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 472 473 '</p>', 473 474 474 475 "post_content" => 475 476 '<p class="area" id="content-area"><label class="required bold" '. … … 477 478 form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 478 479 '</p>', 479 480 480 481 "post_notes" => 481 482 '<p class="area" id="notes-area"><label for="post_notes" class="bold">'.__('Personal notes:').' <span class="form-note">'. … … 495 496 echo '<div id="entry-content"><div class="constrained">'; 496 497 echo '<h3 class="out-of-screen-if-js">'.__('Edit page').'</h3>'; 497 498 498 499 499 500 foreach ($main_items as $id => $item) { 500 501 echo $item; … … 503 504 # --BEHAVIOR-- adminPageForm 504 505 $core->callBehavior('adminPageForm',isset($post) ? $post : null); 505 506 506 507 echo 507 508 '<p class="border-top">'. … … 526 527 $core->formNonce(). 527 528 '</p>'; 528 529 529 530 echo '</div></div>'; // End #entry-content 530 531 echo '</div>'; // End #entry-wrapper 531 532 532 533 echo '<div id="entry-sidebar">'; 533 534 534 535 foreach ($sidebar_items as $id => $c) { 535 536 echo '<div id="'.$id.'" class="sb-box">'. … … 540 541 echo '</div>'; 541 542 } 542 543 543 544 # --BEHAVIOR-- adminPageFormSidebar 544 545 $core->callBehavior('adminPageFormSidebar',isset($post) ? $post : null); 545 546 546 547 echo '</div>'; // End #entry-sidebar 547 548 548 549 echo '</form>'; 549 echo '</div>'; // End 550 550 echo '</div>'; // End 551 551 552 if ($post_id && !empty($post_media)) 552 553 { … … 566 567 { 567 568 $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 568 569 569 570 $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 570 571 $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1))); 571 572 572 573 # Actions combo box 573 574 $combo_action = array(); … … 579 580 $combo_action[__('Mark as junk')] = 'junk'; 580 581 } 581 582 582 583 if ($can_edit_page && $core->auth->check('delete,contentadmin',$core->blog->id)) 583 584 { 584 585 $combo_action[__('Delete')] = 'delete'; 585 586 } 586 587 587 588 $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 588 589 589 590 echo 590 591 '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 591 592 592 593 echo 593 594 '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; … … 596 597 echo '<form action="comments_actions.php" method="post">'; 597 598 } 598 599 599 600 echo '<h3>'.__('Trackbacks').'</h3>'; 600 601 601 602 if (!$trackbacks->isEmpty()) { 602 603 showComments($trackbacks,$has_action); … … 604 605 echo '<p>'.__('No trackback').'</p>'; 605 606 } 606 607 607 608 echo '<h3>'.__('Comments').'</h3>'; 608 609 if (!$comments->isEmpty()) { … … 611 612 echo '<p>'.__('No comment').'</p>'; 612 613 } 613 614 614 615 if ($has_action) { 615 616 echo 616 617 '<div class="two-cols">'. 617 618 '<p class="col checkboxes-helpers"></p>'. 618 619 619 620 '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 620 621 form::combo('action',$combo_action). … … 631 632 '<div class="fieldset clear">'. 632 633 '<h3>'.__('Add a comment').'</h3>'. 633 634 634 635 '<form action="comment.php" method="post" id="comment-form">'. 635 636 '<div class="constrained">'. … … 637 638 form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 638 639 '</p>'. 639 640 640 641 '<p><label for="comment_email">'.__('Email:').'</label>'. 641 642 form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 642 643 '</p>'. 643 644 644 645 '<p><label for="comment_site">'.__('Web site:').'</label>'. 645 646 form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 646 647 '</p>'. 647 648 648 649 '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 649 650 __('Comment:').'</label> '. 650 651 form::textarea('comment_content',50,8,html::escapeHTML('')). 651 652 '</p>'. 652 653 653 654 '<p>'.form::hidden('post_id',$post_id). 654 655 $core->formNonce(). … … 670 671 } 671 672 if ($com) { 672 if (($core->blog->settings->system->comments_ttl == 0) || 673 if (($core->blog->settings->system->comments_ttl == 0) || 673 674 (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 674 675 return true; 675 676 } 676 677 } else { 677 if (($core->blog->settings->system->trackbacks_ttl == 0) || 678 if (($core->blog->settings->system->trackbacks_ttl == 0) || 678 679 (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 679 680 return true; … … 694 695 '<th>'.__('Edit').'</th>'. 695 696 '</tr>'; 696 697 697 698 while($rs->fetch()) 698 699 { 699 700 $comment_url = 'comment.php?id='.$rs->comment_id; 700 701 701 702 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 702 703 switch ($rs->comment_status) { … … 714 715 break; 715 716 } 716 717 717 718 echo 718 719 '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 719 720 ' id="c'.$rs->comment_id.'">'. 720 721 721 722 '<td class="nowrap">'. 722 723 ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,'','','',0,'title="'.__('Select this comment').'"') : '').'</td>'. … … 727 728 '<td class="nowrap status"><a href="'.$comment_url.'">'. 728 729 '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. 729 730 730 731 '</tr>'; 731 732 } 732 733 733 734 echo '</table>'; 734 735 }
Note: See TracChangeset
for help on using the changeset viewer.