[ Index ]
 

Code source de Dotclear 2.0-beta6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/admin/ -> comments_actions.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2005 Olivier Meunier and contributors. All rights
   5  # reserved.
   6  #
   7  # DotClear is free software; you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation; either version 2 of the License, or
  10  # (at your option) any later version.
  11  # 
  12  # DotClear is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  # 
  17  # You should have received a copy of the GNU General Public License
  18  # along with DotClear; if not, write to the Free Software
  19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  #
  21  # ***** END LICENSE BLOCK *****
  22  
  23  require dirname(__FILE__).'/../inc/admin/prepend.php';
  24  
  25  dcPage::check('usage,contentadmin');
  26  
  27  $params = array();
  28  $redir = 'comments.php';
  29  
  30  if (!empty($_POST['action']) && !empty($_POST['comments']))
  31  {
  32      $comments = $_POST['comments'];
  33      $action = $_POST['action'];
  34      
  35      if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false)
  36      {
  37          $redir = $_POST['redir'];
  38      }
  39      else
  40      {
  41          $redir =
  42          'comments.php?type='.$_POST['type'].
  43          '&author='.$_POST['author'].
  44          '&status='.$_POST['status'].
  45          '&sortby='.$_POST['sortby'].
  46          '&ip='.$_POST['ip'].
  47          '&order='.$_POST['order'].
  48          '&page='.$_POST['page'].
  49          '&nb='.(integer) $_POST['nb'];
  50      }
  51      
  52      foreach ($comments as $k => $v) {
  53          $comments[$k] = (integer) $v;
  54      }
  55      
  56      $params['sql'] = 'AND C.comment_id IN('.implode(',',$comments).') ';
  57      $params['no_content'] = true;
  58      
  59      $co = $core->blog->getComments($params);
  60      
  61      if (preg_match('/^(publish|unpublish|pending|junk)$/',$action))
  62      {
  63          switch ($action) {
  64              case 'unpublish' : $status = 0; break;
  65              case 'pending' : $status = -1; break;
  66              case 'junk' : $status = -2; break;
  67              default : $status = 1; break;
  68          }
  69          
  70          while ($co->fetch())
  71          {
  72              try {
  73                  $core->blog->updCommentStatus($co->comment_id,$status);
  74              } catch (Exception $e) {
  75                  $core->error->add($e->getMessage());
  76              }
  77          }
  78          
  79          if (!$core->error->flag()) {
  80              http::redirect($redir);
  81          }
  82      }
  83      elseif ($action == 'delete')
  84      {
  85          while ($co->fetch())
  86          {
  87              try {
  88                  $core->blog->delComment($co->comment_id);
  89              } catch (Exception $e) {
  90                  $core->error->add($e->getMessage());
  91              }
  92          }
  93          
  94          if (!$core->error->flag()) {
  95              http::redirect($redir);
  96          }
  97      }
  98  }
  99  
 100  /* DISPLAY
 101  -------------------------------------------------------- */
 102  dcPage::open(__('Comments'));
 103  
 104  echo '<p><a href="'.str_replace('&','&amp;',$redir).'">'.__('back').'</a></p>';
 105  
 106  dcPage::close();
 107  ?>


Généré le : Fri Feb 23 22:16:06 2007 par Balluche grâce à PHPXref 0.7