Dotclear

Changeset 3044:f2f9dfea9272 for inc


Ignore:
Timestamp:
07/05/15 12:39:27 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add IP and antispam filter columns when displaying spams, closes #1816

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.pager.php

    r2858 r3044  
    374374class adminCommentList extends adminGenericList 
    375375{ 
    376      public function display($page,$nb_per_page,$enclose_block='',$filter=false) 
     376     public function display($page,$nb_per_page,$enclose_block='',$filter=false,$spam=false) 
    377377     { 
    378378          if ($this->rs->isEmpty()) 
     
    386386          else 
    387387          { 
     388               // Get antispam filters' name 
     389               $filters = array(); 
     390               if ($spam) { 
     391                    if (class_exists(dcAntispam)) { 
     392                         dcAntispam::initFilters(); 
     393                         $fs = dcAntispam::$filters->getFilters(); 
     394                         foreach ($fs as $fid => $f) 
     395                         { 
     396                              $filters[$fid] = $f->name; 
     397                         } 
     398                    } 
     399               } 
     400 
    388401               $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); 
    389402 
     
    413426               '<th scope="col">'.__('Author').'</th>'. 
    414427               '<th scope="col">'.__('Date').'</th>'. 
    415                '<th scope="col" class="txt-center">'.__('Status').'</th>'. 
     428               '<th scope="col" class="txt-center">'.__('Status').'</th>'; 
     429               if ($spam) { 
     430                    $html_block .= 
     431                    '<th scope="col">'.__('IP').'</th>'. 
     432                    '<th scope="col">'.__('Spam filter').'</th>'; 
     433               } 
     434               $html_block .= 
    416435               '<th scope="col" abbr="entry">'.__('Entry').'</th>'. 
    417436               '</tr>%s</table></div>'; 
     
    429448               while ($this->rs->fetch()) 
    430449               { 
    431                     echo $this->commentLine(isset($comments[$this->rs->comment_id])); 
     450                    echo $this->commentLine(isset($comments[$this->rs->comment_id]),$spam,$filters); 
    432451               } 
    433452 
     
    438457     } 
    439458 
    440      private function commentLine($checked=false) 
    441      { 
    442           global $author, $status, $sortby, $order, $nb_per_page; 
     459     private function commentLine($checked=false,$spam=false,$filters=array()) 
     460     { 
     461          global $core, $author, $status, $sortby, $order, $nb_per_page; 
    443462 
    444463          $author_url = 
     
    495514          '<td class="nowrap maximal"><a href="'.$author_url.'">'.html::escapeHTML($this->rs->comment_author).'</a></td>'. 
    496515          '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).'</td>'. 
    497           '<td class="nowrap status txt-center">'.$img_status.'</td>'. 
     516          '<td class="nowrap status txt-center">'.$img_status.'</td>'; 
     517          if ($spam) { 
     518               $filter_name = ''; 
     519               if ($this->rs->comment_spam_filter) { 
     520                    if (isset($filters[$this->rs->comment_spam_filter])) { 
     521                         $filter_name = $filters[$this->rs->comment_spam_filter]; 
     522                    } else { 
     523                         $filter_name = $this->rs->comment_spam_filter; 
     524                    } 
     525               } 
     526               $res .= 
     527               '<td class="nowrap"><a href="'.$core->adminurl->get("admin.comments",array('ip' => $this->rs->comment_ip)).'">'.$this->rs->comment_ip.'</a></td>'. 
     528               '<td class="nowrap">'.$filter_name.'</td>'; 
     529          } 
     530          $res .= 
    498531          '<td class="nowrap discrete"><a href="'.$post_url.'">'. 
    499532          $post_title.'</a>'. 
Note: See TracChangeset for help on using the changeset viewer.

Sites map