Dotclear

Changeset 2542:602b5c046fef


Ignore:
Timestamp:
11/13/13 20:09:24 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Message:

Send full post URL, fixes #1865

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r2486 r2542  
    7777{ 
    7878     $page_title = __('Edit entry'); 
    79       
     79 
    8080     $params['post_id'] = $_REQUEST['id']; 
    81       
     81 
    8282     $post = $core->blog->getPosts($params); 
    83       
     83 
    8484     if ($post->isEmpty()) 
    8585     { 
     
    106106          $post_open_comment = (boolean) $post->post_open_comment; 
    107107          $post_open_tb = (boolean) $post->post_open_tb; 
    108            
     108 
    109109          $can_edit_post = $post->isEditable(); 
    110110          $can_delete= $post->isDeletable(); 
    111            
     111 
    112112          $next_rs = $core->blog->getNextPost($post,1); 
    113113          $prev_rs = $core->blog->getNextPost($post,-1); 
    114            
     114 
    115115          if ($next_rs !== null) { 
    116116               $next_link = sprintf($post_link,$next_rs->post_id, 
     
    119119                    html::escapeHTML($next_rs->post_title),$next_rs->post_id); 
    120120          } 
    121            
     121 
    122122          if ($prev_rs !== null) { 
    123123               $prev_link = sprintf($post_link,$prev_rs->post_id, 
     
    126126                    html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 
    127127          } 
    128            
     128 
    129129          try { 
    130130               $core->media = new dcMedia($core); 
     
    134134 
    135135          # Sanitize trackbacks excerpt 
    136           $tb_excerpt = empty($_POST['tb_excerpt']) ?  
     136          $tb_excerpt = empty($_POST['tb_excerpt']) ? 
    137137               $post_excerpt_xhtml.' '.$post_content_xhtml : 
    138138               $_POST['tb_excerpt']; 
     
    146146} else { 
    147147     $anchor = 'comments'; 
    148 }     
     148} 
    149149 
    150150$comments_actions_page = new dcCommentsActionsPage($core,'post.php',array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor)); 
     
    162162          $tb_urls = str_replace("\r", '', $tb_urls); 
    163163          $tb_post_title = html::escapeHTML(trim(html::clean($post_title))); 
    164            
     164          $tb_post_url = $post->getURL(); 
     165 
    165166          foreach (explode("\n", $tb_urls) as $tb_url) 
    166167          { 
    167168               try { 
    168                     $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $post_url); 
     169                    $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $tb_post_url); 
    169170               } catch (Exception $e) { 
    170171                    $core->error->add($e->getMessage()); 
    171172               } 
    172173          } 
    173            
     174 
    174175          if (!$core->error->flag()) { 
    175176               dcPage::addSuccessNotice(__('All pings sent.')); 
     
    185186     $post_excerpt = $_POST['post_excerpt']; 
    186187     $post_content = $_POST['post_content']; 
    187       
     188 
    188189     $post_title = $_POST['post_title']; 
    189       
     190 
    190191     $cat_id = (integer) $_POST['cat_id']; 
    191       
     192 
    192193     if (isset($_POST['post_status'])) { 
    193194          $post_status = (integer) $_POST['post_status']; 
    194195     } 
    195       
     196 
    196197     if (empty($_POST['post_dt'])) { 
    197198          $post_dt = ''; 
     
    211212          } 
    212213     } 
    213       
     214 
    214215     $post_open_comment = !empty($_POST['post_open_comment']); 
    215216     $post_open_tb = !empty($_POST['post_open_tb']); 
     
    217218     $post_lang = $_POST['post_lang']; 
    218219     $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    219       
     220 
    220221     $post_notes = $_POST['post_notes']; 
    221       
     222 
    222223     if (isset($_POST['post_url'])) { 
    223224          $post_url = $_POST['post_url']; 
    224225     } 
    225       
     226 
    226227     $core->blog->setPostContent( 
    227228          $post_id,$post_format,$post_lang, 
     
    248249     # Create category 
    249250     if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { 
    250       
     251 
    251252          $cur_cat = $core->con->openCursor($core->prefix.'category'); 
    252253          $cur_cat->cat_title = $_POST['new_cat_title']; 
    253254          $cur_cat->cat_url = ''; 
    254            
     255 
    255256          $parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : ''; 
    256            
     257 
    257258          # --BEHAVIOR-- adminBeforeCategoryCreate 
    258259          $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); 
    259            
     260 
    260261          $cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat); 
    261            
     262 
    262263          # --BEHAVIOR-- adminAfterCategoryCreate 
    263264          $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $cat_id); 
    264265     } 
    265       
     266 
    266267     $cur = $core->con->openCursor($core->prefix.'post'); 
    267       
     268 
    268269     $cur->post_title = $post_title; 
    269270     $cur->cat_id = ($cat_id ? $cat_id : null); 
     
    282283     $cur->post_open_comment = (integer) $post_open_comment; 
    283284     $cur->post_open_tb = (integer) $post_open_tb; 
    284       
     285 
    285286     if (isset($_POST['post_url'])) { 
    286287          $cur->post_url = $post_url; 
    287288     } 
    288       
     289 
    289290     # Update post 
    290291     if ($post_id) 
     
    294295               # --BEHAVIOR-- adminBeforePostUpdate 
    295296               $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 
    296                 
     297 
    297298               $core->blog->updPost($post_id,$cur); 
    298                 
     299 
    299300               # --BEHAVIOR-- adminAfterPostUpdate 
    300301               $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 
     
    310311     { 
    311312          $cur->user_id = $core->auth->userID(); 
    312            
     313 
    313314          try 
    314315          { 
    315316               # --BEHAVIOR-- adminBeforePostCreate 
    316317               $core->callBehavior('adminBeforePostCreate',$cur); 
    317                 
     318 
    318319               $return_id = $core->blog->addPost($cur); 
    319                 
     320 
    320321               # --BEHAVIOR-- adminAfterPostCreate 
    321322               $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 
     
    417418     $post_content = $post_content_xhtml; 
    418419     $post_format = 'xhtml'; 
    419       
     420 
    420421     dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 
    421422} 
     
    430431     if ($next_link && $prev_link) { echo ' | '; } 
    431432     if ($next_link) { echo $next_link; } 
    432       
     433 
    433434     # --BEHAVIOR-- adminPostNavLinks 
    434435     $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); 
    435       
     436 
    436437     echo '</p>'; 
    437438} 
     
    451452               'title' => __('Status'), 
    452453               'items' => array( 
    453                     'post_status' =>  
     454                    'post_status' => 
    454455                         '<p class="entry-status"><label for="post_status">'.__('Entry status').' '.$img_status.'</label>'. 
    455456                         form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). 
    456457                         '</p>', 
    457                     'post_dt' =>  
     458                    'post_dt' => 
    458459                         '<p><label for="post_dt">'.__('Publication date and hour').'</label>'. 
    459460                         form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
     
    474475               'title' => __('Filing'), 
    475476               'items' => array( 
    476                     'post_selected' =>  
     477                    'post_selected' => 
    477478                         '<p><label for="post_selected" class="classic">'. 
    478479                         form::checkbox('post_selected',1,$post_selected).' '. 
     
    504505                         form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    505506                         __('Accept comments').'</label></p>'. 
    506                          ($core->blog->settings->system->allow_comments ?  
    507                               (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
     507                         ($core->blog->settings->system->allow_comments ? 
     508                              (isContributionAllowed($post_id,strtotime($post_dt),true) ? 
    508509                                   '' : 
    509510                                   '<p class="form-note warn">'. 
    510                                    __('Warning: Comments are not more accepted for this entry.').'</p>') :  
     511                                   __('Warning: Comments are not more accepted for this entry.').'</p>') : 
    511512                              '<p class="form-note warn">'. 
    512513                              __('Comments are not accepted on this blog so far.').'</p>'). 
     
    514515                         form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    515516                         __('Accept trackbacks').'</label></p>'. 
    516                          ($core->blog->settings->system->allow_trackbacks ?  
    517                               (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
     517                         ($core->blog->settings->system->allow_trackbacks ? 
     518                              (isContributionAllowed($post_id,strtotime($post_dt),false) ? 
    518519                                   '' : 
    519520                                   '<p class="form-note warn">'. 
    520                                    __('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
     521                                   __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 
    521522                              '<p class="form-note warn">'.__('Trackbacks are not accepted on this blog so far.').'</p>'). 
    522523                         '</div>', 
     
    541542               form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
    542543               '</p>', 
    543            
     544 
    544545          "post_excerpt" => 
    545546               '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">'.__('Excerpt:').' <span class="form-note">'. 
     
    547548               form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    548549               '</p>', 
    549            
     550 
    550551          "post_content" => 
    551552               '<p class="area" id="content-area"><label class="required bold" '. 
     
    553554               form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
    554555               '</p>', 
    555            
     556 
    556557          "post_notes" => 
    557558               '<p class="area" id="notes-area"><label for="post_notes" class="bold">'.__('Personal notes:').' <span class="form-note">'. 
     
    561562          ) 
    562563     ); 
    563       
     564 
    564565     # --BEHAVIOR-- adminPostFormItems 
    565566     $core->callBehavior('adminPostFormItems',$main_items,$sidebar_items, isset($post) ? $post : null); 
     
    571572 
    572573     echo '<h3 class="out-of-screen-if-js">'.__('Edit post').'</h3>'; 
    573       
     574 
    574575     foreach ($main_items as $id => $item) { 
    575576          echo $item; 
     
    578579     # --BEHAVIOR-- adminPostForm (may be deprecated) 
    579580     $core->callBehavior('adminPostForm',isset($post) ? $post : null); 
    580       
     581 
    581582     echo 
    582583     '<p class="border-top">'. 
     
    599600     $core->formNonce(). 
    600601     '</p>'; 
    601       
     602 
    602603     echo '</div></div>';          // End #entry-content 
    603604     echo '</div>';      // End #entry-wrapper 
    604605 
    605606     echo '<div id="entry-sidebar">'; 
    606       
     607 
    607608     foreach ($sidebar_items as $id => $c) { 
    608609          echo '<div id="'.$id.'" class="sb-box">'. 
     
    613614          echo '</div>'; 
    614615     } 
    615       
    616       
     616 
     617 
    617618     # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) 
    618619     $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 
     
    620621 
    621622     echo '</form>'; 
    622       
     623 
    623624     # --BEHAVIOR-- adminPostForm 
    624625     $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); 
    625       
     626 
    626627     echo '</div>'; 
    627628} 
     
    633634 
    634635     $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    635       
     636 
    636637     $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 
    637            
     638 
    638639     echo 
    639640     '<div id="comments" class="clear multi-part" title="'.__('Comments').'">'; 
    640      $combo_action = $comments_actions_page->getCombo();     
     641     $combo_action = $comments_actions_page->getCombo(); 
    641642     $has_action = !empty($combo_action) && !$comments->isEmpty(); 
    642      echo  
     643     echo 
    643644     '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; 
    644       
     645 
    645646     if ($has_action) { 
    646647          echo '<form action="post.php" id="form-comments" method="post">'; 
    647648     } 
    648       
     649 
    649650     echo '<h3>'.__('Comments').'</h3>'; 
    650651     if (!$comments->isEmpty()) { 
     
    653654          echo '<p>'.__('No comment').'</p>'; 
    654655     } 
    655       
     656 
    656657     if ($has_action) { 
    657658          echo 
    658659          '<div class="two-cols">'. 
    659660          '<p class="col checkboxes-helpers"></p>'. 
    660            
     661 
    661662          '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    662663          form::combo('action',$combo_action). 
     
    674675     '<div class="fieldset clear">'. 
    675676     '<h3>'.__('Add a comment').'</h3>'. 
    676       
     677 
    677678     '<form action="comment.php" method="post" id="comment-form">'. 
    678679     '<div class="constrained">'. 
     
    680681     form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    681682     '</p>'. 
    682       
     683 
    683684     '<p><label for="comment_email">'.__('Email:').'</label>'. 
    684685     form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    685686     '</p>'. 
    686       
     687 
    687688     '<p><label for="comment_site">'.__('Web site:').'</label>'. 
    688689     form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    689690     '</p>'. 
    690       
     691 
    691692     '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
    692693     __('Comment:').'</label> '. 
    693694     form::textarea('comment_content',50,8,html::escapeHTML('')). 
    694695     '</p>'. 
    695       
     696 
    696697     '<p>'. 
    697698     form::hidden('post_id',$post_id). 
     
    712713     $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    713714     $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); 
    714       
     715 
    715716     # Actions combo box 
    716      $combo_action = $comments_actions_page->getCombo();     
     717     $combo_action = $comments_actions_page->getCombo(); 
    717718     $has_action = !empty($combo_action) && !$trackbacks->isEmpty(); 
    718       
     719 
    719720     if (!empty($_GET['tb_auto'])) { 
    720721          $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml.' '.$post_content_xhtml)); 
    721722     } 
    722       
     723 
    723724     # Display tab 
    724725     echo 
    725726     '<div id="trackbacks" class="clear multi-part" title="'.__('Trackbacks').'">'; 
    726       
     727 
    727728     # tracbacks actions 
    728729     if ($has_action) { 
    729730          echo '<form action="post.php" id="form-trackbacks" method="post">'; 
    730731     } 
    731       
     732 
    732733     echo '<h3>'.__('Trackbacks received').'</h3>'; 
    733       
     734 
    734735     if (!$trackbacks->isEmpty()) { 
    735736          showComments($trackbacks, $has_action, true); 
     
    737738          echo '<p>'.__('No trackback').'</p>'; 
    738739     } 
    739       
     740 
    740741     if ($has_action) { 
    741742          echo 
    742743          '<div class="two-cols">'. 
    743744          '<p class="col checkboxes-helpers"></p>'. 
    744            
     745 
    745746          '<p class="col right"><label for="action" class="classic">'.__('Selected trackbacks action:').'</label> '. 
    746747          form::combo('action', $combo_action). 
     
    752753          '</form>'; 
    753754     } 
    754       
     755 
    755756     /* Add trackbacks 
    756757     -------------------------------------------------------- */ 
     
    772773          $core->formNonce(). 
    773774          '<input type="submit" name="ping" value="'.__('Ping blogs').'" />'. 
    774           (empty($_GET['tb_auto']) ?  
     775          (empty($_GET['tb_auto']) ? 
    775776               '&nbsp;&nbsp;<a class="button" href="'. 
    776777               'post.php?id='.$post_id.'&amp;tb_auto=1&amp;tb=1'. 
     
    785786          { 
    786787               echo '<h3>'.__('Previously sent pings').'</h3>'; 
    787                 
     788 
    788789               echo '<ul class="nice">'; 
    789790               while ($pings->fetch()) { 
     
    810811     } 
    811812     if ($com) { 
    812           if (($core->blog->settings->system->comments_ttl == 0) ||  
     813          if (($core->blog->settings->system->comments_ttl == 0) || 
    813814               (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 
    814815               return true; 
    815816          } 
    816817     } else { 
    817           if (($core->blog->settings->system->trackbacks_ttl == 0) ||  
     818          if (($core->blog->settings->system->trackbacks_ttl == 0) || 
    818819               (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 
    819820               return true; 
     
    840841               $comments[(integer)$v]=true; 
    841842          } 
    842      }               
    843       
     843     } 
     844 
    844845     while($rs->fetch()) 
    845846     { 
    846847          $comment_url = 'comment.php?id='.$rs->comment_id; 
    847            
     848 
    848849          $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    849850          switch ($rs->comment_status) { 
     
    861862                    break; 
    862863          } 
    863            
     864 
    864865          echo 
    865866          '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 
    866867          ' id="c'.$rs->comment_id.'">'. 
    867            
     868 
    868869          '<td class="nowrap">'. 
    869870          ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,isset($comments[$rs->comment_id]),'','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. 
     
    874875          '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    875876          '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. 
    876            
     877 
    877878          '</tr>'; 
    878879     } 
    879       
     880 
    880881     echo '</table></div>'; 
    881882} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map