Dotclear


Ignore:
Timestamp:
09/16/13 13:28:17 (12 years ago)
Author:
Dsls
Branch:
actionsreloaded
Children:
1999:a0ed28c2da5a, 2037:cdcd97549428
Message:

RIP admin/comments_actions.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/comments_actions.php

    r1474 r1905  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212 
     13/* ### THIS FILE IS DEPRECATED                         ### */ 
     14/* ### IT IS ONLY USED FOR PLUGINS COMPATIBILITY ### */ 
     15 
    1316require dirname(__FILE__).'/../inc/admin/prepend.php'; 
    1417 
    1518dcPage::check('usage,contentadmin'); 
    1619 
    17 $params = array(); 
    18 $redir = 'comments.php'; 
     20$comments_actions_page = new dcCommentsActionsPage($core,'posts.php'); 
    1921 
    20 if (!empty($_POST['action']) && !empty($_POST['comments'])) 
    21 { 
    22      $comments = $_POST['comments']; 
    23      $action = $_POST['action']; 
    24       
    25      if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false) 
    26      { 
    27           $redir = $_POST['redir']; 
    28      } 
    29      else 
    30      { 
    31           $redir = 
    32           'comments.php?type='.$_POST['type']. 
    33           '&author='.$_POST['author']. 
    34           '&status='.$_POST['status']. 
    35           '&sortby='.$_POST['sortby']. 
    36           '&ip='.$_POST['ip']. 
    37           '&order='.$_POST['order']. 
    38           '&page='.$_POST['page']. 
    39           '&nb='.(integer) $_POST['nb']; 
    40      } 
    41       
    42      foreach ($comments as $k => $v) { 
    43           $comments[$k] = (integer) $v; 
    44      } 
    45       
    46      $params['sql'] = 'AND C.comment_id IN('.implode(',',$comments).') '; 
    47       
    48      if (!isset($_POST['full_content']) || empty($_POST['full_content'])) { 
    49           $params['no_content'] = true; 
    50      } 
    51       
    52      $co = $core->blog->getComments($params); 
    53       
    54      $co_ids = array(); 
    55      while ($co->fetch())     { 
    56           $co_ids[] = $co->comment_id; 
    57      } 
    58       
    59      # --BEHAVIOR-- adminCommentsActions 
    60      $core->callBehavior('adminCommentsActions',$core,$co,$action,$redir); 
    61       
    62      if (preg_match('/^(publish|unpublish|pending|junk)$/',$action)) 
    63      { 
    64           switch ($action) { 
    65                case 'unpublish' : $status = 0; break; 
    66                case 'pending' : $status = -1; break; 
    67                case 'junk' : $status = -2; break; 
    68                default : $status = 1; break; 
    69           } 
    70            
    71           try { 
    72                $core->blog->updCommentsStatus($co_ids,$status); 
    73           } catch (Exception $e) { 
    74                $core->error->add($e->getMessage()); 
    75           } 
    76            
    77           if (!$core->error->flag()) { 
    78                http::redirect($redir); 
    79           } 
    80      } 
    81      elseif ($action == 'delete') 
    82      { 
    83           try { 
    84                // Backward compatibility 
    85                foreach($co_ids as $comment_id) 
    86                { 
    87                     # --BEHAVIOR-- adminBeforeCommentDelete 
    88                     $core->callBehavior('adminBeforeCommentDelete',$comment_id);                     
    89                } 
    90                 
    91                # --BEHAVIOR-- adminBeforeCommentsDelete 
    92                $core->callBehavior('adminBeforeCommentsDelete',$co_ids); 
    93                 
    94                $core->blog->delComments($co_ids); 
    95           } catch (Exception $e) { 
    96                $core->error->add($e->getMessage()); 
    97           } 
    98            
    99           if (!$core->error->flag()) { 
    100                http::redirect($redir); 
    101           } 
    102      } 
    103 } 
     22$comments_actions_page->process(); 
    10423 
    105 /* DISPLAY 
    106 -------------------------------------------------------- */ 
    107 dcPage::open(__('Comments')); 
    108  
    109 if (!isset($action)) { 
    110      dcPage::close(); 
    111      exit; 
    112 } 
    113  
    114 $hidden_fields = ''; 
    115 while ($co->fetch()) { 
    116      $hidden_fields .= form::hidden(array('comments[]'),$co->comment_id); 
    117 }  
    118  
    119 if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false) 
    120 { 
    121      $hidden_fields .= form::hidden(array('redir'),html::escapeURL($_POST['redir'])); 
    122 } 
    123 else 
    124 { 
    125      $hidden_fields .= 
    126      form::hidden(array('type'),$_POST['type']). 
    127      form::hidden(array('author'),$_POST['author']). 
    128      form::hidden(array('status'),$_POST['status']). 
    129      form::hidden(array('sortby'),$_POST['sortby']). 
    130      form::hidden(array('ip'),$_POST['ip']). 
    131      form::hidden(array('order'),$_POST['order']). 
    132      form::hidden(array('page'),$_POST['page']). 
    133      form::hidden(array('nb'),$_POST['nb']); 
    134 } 
    135  
    136 # --BEHAVIOR-- adminCommentsActionsContent 
    137 $core->callBehavior('adminCommentsActionsContent',$core,$action,$hidden_fields); 
    138  
    139 echo '<p><a class="back" href="'.str_replace('&','&amp;',$redir).'">'.__('Back to comments list').'</a></p>'; 
    140  
    141 dcPage::close(); 
    14224?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map