Dotclear

Changeset 848:ad18a33a3cef for admin


Ignore:
Timestamp:
07/31/12 13:18:23 (13 years ago)
Author:
Dsls <dsls@…>
Branch:
sexy
Message:

sexy step 1 : no more comments ...

Location:
admin
Files:
3 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • admin/blog_pref.php

    r557 r848  
    135135     if ($nb_post_per_feed <= 1) { $nb_post_per_feed = 1; } 
    136136      
    137      $nb_comment_per_feed = abs((integer) $_POST['nb_comment_per_feed']); 
    138      if ($nb_comment_per_feed <= 1) { $nb_comment_per_feed = 1; } 
    139       
    140137     try 
    141138     { 
     
    182179          $blog_settings->system->put('date_format',$_POST['date_format']); 
    183180          $blog_settings->system->put('time_format',$_POST['time_format']); 
    184           $blog_settings->system->put('comments_ttl',abs((integer) $_POST['comments_ttl'])); 
    185           $blog_settings->system->put('trackbacks_ttl',abs((integer) $_POST['trackbacks_ttl'])); 
    186           $blog_settings->system->put('allow_comments',!empty($_POST['allow_comments'])); 
    187           $blog_settings->system->put('allow_trackbacks',!empty($_POST['allow_trackbacks'])); 
    188           $blog_settings->system->put('comments_pub',empty($_POST['comments_pub'])); 
    189           $blog_settings->system->put('trackbacks_pub',empty($_POST['trackbacks_pub'])); 
    190           $blog_settings->system->put('comments_nofollow',!empty($_POST['comments_nofollow'])); 
    191           $blog_settings->system->put('wiki_comments',!empty($_POST['wiki_comments'])); 
    192181          $blog_settings->system->put('enable_xmlrpc',!empty($_POST['enable_xmlrpc'])); 
    193182           
     
    199188          $blog_settings->system->put('media_img_title_pattern',$_POST['media_img_title_pattern']); 
    200189          $blog_settings->system->put('nb_post_per_feed',$nb_post_per_feed); 
    201           $blog_settings->system->put('nb_comment_per_feed',$nb_comment_per_feed); 
    202190          $blog_settings->system->put('short_feed_items',!empty($_POST['short_feed_items'])); 
    203191           
     
    331319      
    332320     echo 
    333      '<fieldset><legend>'.__('Comments and trackbacks').'</legend>'. 
    334      '<div class="two-cols">'. 
    335      '<div class="col">'. 
    336      '<p><label for="allow_comments" class="classic">'. 
    337      form::checkbox('allow_comments','1',$blog_settings->system->allow_comments). 
    338      __('Accept comments').'</label></p>'. 
    339       
    340      '<p><label for="comments_pub" class="classic">'. 
    341      form::checkbox('comments_pub','1',!$blog_settings->system->comments_pub). 
    342      __('Moderate comments').'</label></p>'. 
    343       
    344      '<p><label for="comments_ttl" class="classic">'.sprintf(__('Leave comments open for %s days'), 
    345      form::field('comments_ttl',2,3,$blog_settings->system->comments_ttl)). 
    346      '</label></p>'. 
    347      '<p class="form-note">'.__('Leave blank to disable this feature.').'</p>'. 
    348       
    349      '<p><label for="wiki_comments" class="classic">'. 
    350      form::checkbox('wiki_comments','1',$blog_settings->system->wiki_comments). 
    351      __('Wiki syntax for comments').'</label></p>'. 
    352      '</div>'. 
    353       
    354      '<div class="col">'. 
    355      '<p><label for="allow_trackbacks" class="classic">'. 
    356      form::checkbox('allow_trackbacks','1',$blog_settings->system->allow_trackbacks). 
    357      __('Accept trackbacks').'</label></p>'. 
    358       
    359      '<p><label for="trackbacks_pub" class="classic">'. 
    360      form::checkbox('trackbacks_pub','1',!$blog_settings->system->trackbacks_pub). 
    361      __('Moderate trackbacks').'</label></p>'. 
    362       
    363      '<p><label for="trackbacks_ttl" class="classic">'.sprintf(__('Leave trackbacks open for %s days'), 
    364      form::field('trackbacks_ttl',2,3,$blog_settings->system->trackbacks_ttl)).'</label></p>'. 
    365      '<p class="form-note">'.__('Leave blank to disable this feature.').'</p>'. 
    366       
    367      '<p><label for="comments_nofollow" class="classic">'. 
    368      form::checkbox('comments_nofollow','1',$blog_settings->system->comments_nofollow). 
    369      __('Add "nofollow" relation on comments and trackbacks links').'</label></p>'. 
    370      '</div>'. 
    371      '</div>'. 
    372      '<br class="clear" />'. //Opera sucks 
    373      '</fieldset>'; 
    374       
    375      echo 
    376321     '<fieldset><legend>'.__('Blog presentation').'</legend>'. 
    377322     '<div class="two-cols">'. 
     
    397342     '<p><label for="nb_post_per_feed" class="classic">'.sprintf(__('Display %s entries per feed'), 
    398343     form::field('nb_post_per_feed',2,3,$blog_settings->system->nb_post_per_feed)). 
    399      '</label></p>'. 
    400       
    401      '<p><label for="nb_comment_per_feed" class="classic">'.sprintf(__('Display %s comments per feed'), 
    402      form::field('nb_comment_per_feed',2,3,$blog_settings->system->nb_comment_per_feed)). 
    403344     '</label></p>'. 
    404345      
  • admin/index.php

    r691 r848  
    7171$str_entries = ($post_count > 1) ? __('%d entries') : __('%d entry'); 
    7272 
    73 $comment_count = $core->blog->getComments(array(),true)->f(0); 
    74 $str_comments = ($comment_count > 1) ? __('%d comments') : __('%d comment'); 
    75  
    7673$ws = $core->auth->user_prefs->addWorkspace('favorites'); 
    7774$count = 0; 
     
    8380               $count++; 
    8481               $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) :  
    85                     ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 
     82                    $fav['title']); 
    8683               $__dashboard_icons[$fav['name']] = new ArrayObject(array(__($title),$fav['url'],$fav['large-icon'])); 
    8784 
     
    9895               $count++; 
    9996               $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) :  
    100                     ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 
     97                    $fav['title']); 
    10198               $__dashboard_icons[$fav['name']] = new ArrayObject(array(__($title),$fav['url'],$fav['large-icon'])); 
    10299 
  • admin/install/index.php

    r557 r848  
    166166          $cur->post_content_xhtml = $cur->post_content; 
    167167          $cur->post_status = 1; 
    168           $cur->post_open_comment = 1; 
    169           $cur->post_open_tb = 0; 
    170168          $post_id = $core->blog->addPost($cur); 
    171            
    172           # Add a comment to it 
    173           $cur = $core->con->openCursor($core->prefix.'comment'); 
    174           $cur->post_id = $post_id; 
    175           $cur->comment_tz = $default_tz; 
    176           $cur->comment_author = __('Dotclear Team'); 
    177           $cur->comment_email = 'contact@dotclear.net'; 
    178           $cur->comment_site = 'http://www.dotclear.org/'; 
    179           $cur->comment_content = __("<p>This is a comment.</p>\n<p>To delete it, log in and ". 
    180                "view your blog's comments. Then you might remove or edit it.</p>"); 
    181           $core->blog->addComment($cur); 
    182169           
    183170          #  Plugins initialization 
     
    210197          $init_fav['posts'] = array('posts','Entries','posts.php', 
    211198               'images/menu/entries.png','images/menu/entries-b.png', 
    212                'usage,contentadmin',null,null); 
    213           $init_fav['comments'] = array('comments','Comments','comments.php', 
    214                'images/menu/comments.png','images/menu/comments-b.png', 
    215199               'usage,contentadmin',null,null); 
    216200          $init_fav['prefs'] = array('prefs','My preferences','preferences.php', 
  • admin/post.php

    r776 r848  
    3030$post_status = $core->auth->getInfo('user_post_status'); 
    3131$post_selected = false; 
    32 $post_open_comment = $core->blog->settings->system->allow_comments; 
    33 $post_open_tb = $core->blog->settings->system->allow_trackbacks; 
    3432 
    3533$page_title = __('New entry'); 
     
    117115          $post_status = $post->post_status; 
    118116          $post_selected = (boolean) $post->post_selected; 
    119           $post_open_comment = (boolean) $post->post_open_comment; 
    120           $post_open_tb = (boolean) $post->post_open_tb; 
    121117           
    122118          $page_title = __('Edit entry'); 
     
    170166     } 
    171167      
    172      $post_open_comment = !empty($_POST['post_open_comment']); 
    173      $post_open_tb = !empty($_POST['post_open_tb']); 
    174168     $post_selected = !empty($_POST['post_selected']); 
    175169     $post_lang = $_POST['post_lang']; 
     
    207201     $cur->post_status = $post_status; 
    208202     $cur->post_selected = (integer) $post_selected; 
    209      $cur->post_open_comment = (integer) $post_open_comment; 
    210      $cur->post_open_tb = (integer) $post_open_tb; 
    211203      
    212204     if (isset($_POST['post_url'])) { 
     
    275267     $default_tab = ''; 
    276268} 
    277 if (!empty($_GET['co'])) { 
    278      $default_tab = 'comments'; 
    279 } 
    280269 
    281270dcPage::open($page_title.' - '.__('Entries'), 
     
    285274     dcPage::jsMetaEditor(). 
    286275     dcPage::jsLoad('js/_post.js'). 
    287      dcPage::jsConfirmClose('entry-form','comment-form'). 
     276     dcPage::jsConfirmClose('entry-form'). 
    288277     # --BEHAVIOR-- adminPostHeaders 
    289278     $core->callBehavior('adminPostHeaders'). 
     
    305294} 
    306295 
    307 if (!empty($_GET['creaco'])) { 
    308           echo '<p class="message">'.__('Comment has been successfully created.').'</p>'; 
    309      } 
    310296 
    311297# XHTML conversion 
     
    421407     '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button" href="post.php?id='.$post_id.'&amp;xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 
    422408      
    423      '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    424      __('Accept comments').'</label></p>'. 
    425      '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    426      __('Accept trackbacks').'</label></p>'. 
    427409     '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 
    428410     __('Selected entry').'</label></p>'. 
     
    457439     echo '</div>'; 
    458440      
    459      if ($post_id && $post->post_status == 1) { 
    460           echo '<p><a href="trackbacks.php?id='.$post_id.'" class="multi-part">'. 
    461           __('Ping blogs').'</a></p>'; 
    462      } 
    463       
    464 } 
    465  
    466  
    467 /* Comments and trackbacks 
    468 -------------------------------------------------------- */ 
    469 if ($post_id) 
    470 { 
    471      $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    472       
    473      $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 
    474      $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1))); 
    475       
    476      # Actions combo box 
    477      $combo_action = array(); 
    478      if ($can_edit_post && $core->auth->check('publish,contentadmin',$core->blog->id)) 
    479      { 
    480           $combo_action[__('publish')] = 'publish'; 
    481           $combo_action[__('unpublish')] = 'unpublish'; 
    482           $combo_action[__('mark as pending')] = 'pending'; 
    483           $combo_action[__('mark as junk')] = 'junk'; 
    484      } 
    485       
    486      if ($can_edit_post && $core->auth->check('delete,contentadmin',$core->blog->id)) 
    487      { 
    488           $combo_action[__('Delete')] = 'delete'; 
    489      } 
    490       
    491      # --BEHAVIOR-- adminCommentsActionsCombo 
    492      $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 
    493       
    494      $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 
    495       
    496      echo 
    497      '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 
    498       
    499      if ($has_action) { 
    500           echo '<form action="comments_actions.php" id="form-comments" method="post">'; 
    501      } 
    502       
    503      echo '<h3>'.__('Trackbacks').'</h3>'; 
    504       
    505      if (!$trackbacks->isEmpty()) { 
    506           showComments($trackbacks,$has_action,true); 
    507      } else { 
    508           echo '<p>'.__('No trackback').'</p>'; 
    509      } 
    510       
    511      echo '<h3>'.__('Comments').'</h3>'; 
    512      if (!$comments->isEmpty()) { 
    513           showComments($comments,$has_action); 
    514      } else { 
    515           echo '<p>'.__('No comment').'</p>'; 
    516      } 
    517       
    518      if ($has_action) { 
    519           echo 
    520           '<div class="two-cols">'. 
    521           '<p class="col checkboxes-helpers"></p>'. 
    522            
    523           '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    524           form::combo('action',$combo_action). 
    525           form::hidden('redir','post.php?id='.$post_id.'&amp;co=1'). 
    526           $core->formNonce(). 
    527           '<input type="submit" value="'.__('ok').'" /></p>'. 
    528           '</div>'. 
    529           '</form>'; 
    530      } 
    531       
    532      echo '</div>'; 
    533 } 
    534  
    535 /* Add a comment 
    536 -------------------------------------------------------- */ 
    537 if ($post_id) 
    538 { 
    539      echo 
    540      '<div class="multi-part" id="add-comment" title="'.__('Add a comment').'">'. 
    541      '<h3>'.__('Add a comment').'</h3>'. 
    542       
    543      '<form action="comment.php" method="post" id="comment-form">'. 
    544      '<div class="constrained">'. 
    545      '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:'). 
    546      form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    547      '</label></p>'. 
    548       
    549      '<p><label for="comment_email">'.__('Email:'). 
    550      form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    551      '</label></p>'. 
    552       
    553      '<p><label for="comment_site">'.__('Web site:'). 
    554      form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    555      '</label></p>'. 
    556       
    557      '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
    558      __('Comment:').'</label> '. 
    559      form::textarea('comment_content',50,8,html::escapeHTML('')). 
    560      '</p>'. 
    561       
    562      '<p>'.form::hidden('post_id',$post_id). 
    563      $core->formNonce(). 
    564      '<input type="submit" name="add" value="'.__('Save').'" /></p>'. 
    565      '</div>'. 
    566      '</form>'. 
    567      '</div>'; 
    568 } 
    569  
    570  
    571 # Show comments or trackbacks 
    572 function showComments($rs,$has_action,$tb=false) 
    573 { 
    574      echo 
    575      '<table class="comments-list"><tr>'. 
    576      '<th colspan="2">'.__('Author').'</th>'. 
    577      '<th>'.__('Date').'</th>'. 
    578      '<th class="nowrap">'.__('IP address').'</th>'. 
    579      '<th>'.__('Status').'</th>'. 
    580      '<th>&nbsp;</th>'. 
    581      '</tr>'; 
    582       
    583      while($rs->fetch()) 
    584      { 
    585           $comment_url = 'comment.php?id='.$rs->comment_id; 
    586            
    587           $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    588           switch ($rs->comment_status) { 
    589                case 1: 
    590                     $img_status = sprintf($img,__('published'),'check-on.png'); 
    591                     break; 
    592                case 0: 
    593                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
    594                     break; 
    595                case -1: 
    596                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
    597                     break; 
    598                case -2: 
    599                     $img_status = sprintf($img,__('junk'),'junk.png'); 
    600                     break; 
    601           } 
    602            
    603           echo 
    604           '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 
    605           ' id="c'.$rs->comment_id.'">'. 
    606            
    607           '<td class="nowrap">'. 
    608           ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,'','','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. 
    609           '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. 
    610           '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. 
    611           '<td class="nowrap"><a href="comments.php?ip='.$rs->comment_ip.'">'.$rs->comment_ip.'</a></td>'. 
    612           '<td class="nowrap status">'.$img_status.'</td>'. 
    613           '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    614           '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /></a></td>'. 
    615            
    616           '</tr>'; 
    617      } 
    618       
    619      echo '</table>'; 
    620441} 
    621442 
  • admin/search.php

    r747 r848  
    4949          } 
    5050     } 
    51      # Get comments 
    52      elseif ($qtype == 'c') 
    53      { 
    54           $starting_scripts .= dcPage::jsLoad('js/_comments.js'); 
    55            
    56           $params['search'] = $q; 
    57           $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); 
    58           $params['no_content'] = true; 
    59           $params['order'] = 'comment_dt DESC'; 
    60            
    61           try { 
    62                $comments = $core->blog->getComments($params); 
    63                $counter = $core->blog->getComments($params,true); 
    64                $comment_list = new adminCommentList($core,$comments,$counter->f(0)); 
    65           } catch (Exception $e) { 
    66                $core->error->add($e->getMessage()); 
    67           } 
    68      } 
    6951} 
    7052 
     
    7860'<p><label for="q">'.__('Query:').' </label>'.form::field('q',30,255,html::escapeHTML($q)).'</p>'. 
    7961'<p><label for="qtype1" class="classic">'.form::radio(array('qtype','qtype1'),'p',$qtype == 'p').' '.__('Search entries').'</label> '. 
    80 '<label for="qtype2" class="classic">'.form::radio(array('qtype','qtype2'),'c',$qtype == 'c').' '.__('Search comments').'</label></p>'. 
     62'</p>'. 
    8163'</p><input type="submit" value="'.__('Search').'" /></p>'. 
    8264'</div>'. 
     
    134116          ); 
    135117     } 
    136      # Show posts 
    137      elseif ($qtype == 'c') 
    138      { 
    139           # Actions combo box 
    140           $combo_action = array(); 
    141           if ($core->auth->check('publish,contentadmin',$core->blog->id)) 
    142           { 
    143                $combo_action[__('publish')] = 'publish'; 
    144                $combo_action[__('unpublish')] = 'unpublish'; 
    145                $combo_action[__('mark as pending')] = 'pending'; 
    146                $combo_action[__('mark as junk')] = 'junk'; 
    147           } 
    148           if ($core->auth->check('delete,contentadmin',$core->blog->id)) 
    149           { 
    150                $combo_action[__('Delete')] = 'delete'; 
    151           } 
    152            
    153           if ($counter->f(0) > 0) { 
    154                printf('<h3>'. 
    155                ($counter->f(0) == 1 ? __('%d comment found') : __('%d comments found')). 
    156                '</h3>',$counter->f(0)); 
    157           } 
    158            
    159           $comment_list->display($page,$nb_per_page, 
    160           '<form action="comments_actions.php" method="post" id="form-comments">'. 
    161            
    162           '%s'. 
    163            
    164           '<div class="two-cols">'. 
    165           '<p class="col checkboxes-helpers"></p>'. 
    166            
    167           '<p class="col right"><label for="action2" class="classic">'.__('Selected comments action:').'</label> '. 
    168           form::combo(array('action','action2'),$combo_action). 
    169           '<input type="submit" value="'.__('ok').'" /></p>'. 
    170           form::hidden('redir',preg_replace('/%/','%%',$redir)). 
    171           $core->formNonce(). 
    172           '</div>'. 
    173           '</form>' 
    174           ); 
    175      } 
    176118} 
    177119 
  • admin/services.php

    r323 r848  
    1818 
    1919$core->rest->addFunction('getPostById',array('dcRestMethods','getPostById')); 
    20 $core->rest->addFunction('getCommentById',array('dcRestMethods','getCommentById')); 
    2120$core->rest->addFunction('quickPost',array('dcRestMethods','quickPost')); 
    2221$core->rest->addFunction('validatePostMarkup',array('dcRestMethods','validatePostMarkup')); 
     
    7069          $rsp->post_status($rs->post_status); 
    7170          $rsp->post_selected($rs->post_selected); 
    72           $rsp->post_open_comment($rs->post_open_comment); 
    73           $rsp->post_open_tb($rs->post_open_tb); 
    74           $rsp->nb_comment($rs->nb_comment); 
    75           $rsp->nb_trackback($rs->nb_trackback); 
    7671          $rsp->user_name($rs->user_name); 
    7772          $rsp->user_firstname($rs->user_firstname); 
     
    10095     } 
    10196      
    102      public static function getCommentById($core,$get) 
    103      { 
    104           if (empty($get['id'])) { 
    105                throw new Exception('No comment ID'); 
    106           } 
    107            
    108           $rs = $core->blog->getComments(array('comment_id' => (integer) $get['id'])); 
    109            
    110           if ($rs->isEmpty()) { 
    111                throw new Exception('No comment for this ID'); 
    112           } 
    113            
    114           $rsp = new xmlTag('post'); 
    115           $rsp->id = $rs->comment_id; 
    116            
    117           $rsp->comment_dt($rs->comment_dt); 
    118           $rsp->comment_upddt($rs->comment_upddt); 
    119           $rsp->comment_author($rs->comment_author); 
    120           $rsp->comment_site($rs->comment_site); 
    121           $rsp->comment_content($rs->comment_content); 
    122           $rsp->comment_trackback($rs->comment_trackback); 
    123           $rsp->comment_status($rs->comment_status); 
    124           $rsp->post_title($rs->post_title); 
    125           $rsp->post_url($rs->post_url); 
    126           $rsp->post_id($rs->post_id); 
    127           $rsp->post_dt($rs->post_dt); 
    128           $rsp->user_id($rs->user_id); 
    129            
    130           $rsp->comment_display_content($rs->getContent(true)); 
    131            
    132           if ($core->auth->userID()) { 
    133                $rsp->comment_ip($rs->comment_ip); 
    134                $rsp->comment_email($rs->comment_email); 
    135                $rsp->comment_spam_disp(dcAntispam::statusMessage($rs)); 
    136           } 
    137            
    138           return $rsp; 
    139      } 
    14097      
    14198     public static function quickPost($core,$get,$post) 
     
    150107          $cur->post_lang = !empty($post['post_lang']) ? $post['post_lang'] : ''; 
    151108          $cur->post_status = !empty($post['post_status']) ? (integer) $post['post_status'] : 0; 
    152           $cur->post_open_comment = (integer) $core->blog->settings->system->allow_comments; 
    153           $cur->post_open_tb = (integer) $core->blog->settings->system->allow_trackbacks; 
    154109           
    155110          # --BEHAVIOR-- adminBeforePostCreate 
Note: See TracChangeset for help on using the changeset viewer.

Sites map