[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/antispam/views/ -> _antispam_ban.form.php (source)

   1  <?php
   2  /**

   3   * This file implements the UI controller for the antispam management.

   4   *

   5   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}.

   9   *

  10   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)

  11   *

  12   * {@internal Open Source relicensing agreement:

  13   * }}

  14   *

  15   * @package admin

  16   *

  17   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  18   *

  19   * @todo Allow applying / re-checking of the known data, not just after an update!

  20   *

  21   * @version $Id: _antispam_ban.form.php,v 1.1 2007/09/04 14:56:19 fplanque Exp $

  22   */
  23  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  24  
  25  global $keyword, $report_abuse;
  26  
  27  $Form = & new Form( NULL, 'antispam_ban' );
  28  
  29  $Form->global_icon( T_('Cancel!'), 'close', regenerate_url( 'action' ) );
  30  
  31  $Form->begin_form( 'fform',  T_('Confirm ban & delete') );
  32  
  33      $Form->hidden_ctrl();
  34      $Form->hiddens_by_key( get_memorized() );
  35      $Form->hidden( 'confirm', 'confirm' );
  36  
  37      // Check for junk:

  38      // Check for potentially affected logged hits:

  39      $sql = 'SELECT hit_ID, UNIX_TIMESTAMP(hit_datetime) as hit_datetime, hit_uri, hit_referer, dom_name,
  40                                      hit_blog_ID, hit_remote_addr, blog_shortname
  41                       FROM T_hitlog INNER JOIN T_basedomains ON hit_referer_dom_ID = dom_ID
  42                                   LEFT JOIN T_blogs ON hit_blog_ID = blog_ID
  43                      WHERE hit_referer LIKE '.$DB->quote('%'.$keyword.'%').'
  44                      ORDER BY dom_name ASC
  45                      LIMIT 500';
  46      $res_affected_hits = $DB->get_results( $sql, ARRAY_A );
  47      if( $DB->num_rows == 0 )
  48      { // No matching hits.
  49          printf( '<p><strong>'.T_('No log-hits match the keyword [%s].').'</strong></p>', htmlspecialchars($keyword) );
  50      }
  51      else
  52      {
  53      ?>
  54          <p>
  55              <input type="checkbox" name="delhits" id="delhits_cb" value="1" checked="checked" />
  56              <label for="delhits_cb">
  57              <strong><?php printf ( T_('Delete the following %s referer hits:'), $DB->num_rows == 500 ? '500+' : $DB->num_rows ) ?></strong>
  58              </label>
  59          </p>
  60          <table class="grouped" cellspacing="0">
  61              <thead>
  62              <tr>
  63                  <th><?php echo T_('Date') ?></th>
  64                  <th><?php echo T_('Referer') ?></th>
  65                  <th><?php echo T_('Ref. IP') ?></th>
  66                  <th><?php echo T_('Target Blog') ?></th>
  67                  <th><?php echo T_('Target URL') ?></th>
  68              </tr>
  69              </thead>
  70              <tbody>
  71              <?php
  72              $count = 0;
  73              foreach( $res_affected_hits as $row_stats )
  74              {
  75                  ?>
  76                  <tr <?php if($count%2 == 1) echo 'class="odd"' ?>>
  77                      <td class="firstcol"><?php stats_time() ?></td>
  78                      <td><a href="<?php stats_referer() ?>"><?php stats_basedomain() ?></a></td>
  79                      <td><?php stats_hit_remote_addr() ?></td>
  80                      <td><?php echo format_to_output( $row_stats['blog_shortname'], 'htmlbody' ); ?></td>
  81                      <td><a href="<?php stats_req_URI() ?>"><?php stats_req_URI() ?></a></td>
  82                  </tr>
  83                  <?php
  84                  $count++;
  85              } ?>
  86              </tbody>
  87          </table>
  88      <?php
  89      }
  90  
  91      // Check for potentially affected comments:

  92      $sql = 'SELECT comment_ID, comment_date, comment_author, comment_author_url,
  93                                      comment_author_IP, comment_content
  94                          FROM T_comments
  95                       WHERE comment_author LIKE '.$DB->quote('%'.$keyword.'%').'
  96                                   OR comment_author_email LIKE '.$DB->quote('%'.$keyword.'%').'
  97                                    OR comment_author_url LIKE '.$DB->quote('%'.$keyword.'%').'
  98                              OR comment_content LIKE '.$DB->quote('%'.$keyword.'%').'
  99                       ORDER BY comment_date ASC
 100                       LIMIT 500';
 101      $res_affected_comments = $DB->get_results( $sql, ARRAY_A, 'Find matching comments' );
 102      if( $DB->num_rows == 0 )
 103      { // No matching hits.
 104          printf( '<p><strong>'.T_('No comments match the keyword [%s].').'</strong></p>', htmlspecialchars($keyword) );
 105      }
 106      else
 107      {
 108      ?>
 109          <p>
 110              <input type="checkbox" name="delcomments" id="delcomments_cb" value="1" checked="checked" />
 111              <label for="delcomments_cb">
 112              <strong><?php printf ( T_('Delete the following %s comments:'), $DB->num_rows == 500 ? '500+' : $DB->num_rows ) ?></strong>
 113              </label>
 114          </p>
 115          <table class="grouped" cellspacing="0">
 116              <thead>
 117              <tr>
 118                  <th><?php echo T_('Date') ?></th>
 119                  <th><?php echo T_('Author') ?></th>
 120                  <th><?php echo T_('Auth. URL') ?></th>
 121                  <th><?php echo T_('Auth. IP') ?></th>
 122                  <th><?php echo T_('Content starts with...') ?></th>
 123              </tr>
 124              </thead>
 125              <tbody>
 126              <?php
 127              $count = 0;
 128              foreach( $res_affected_comments as $row_stats )
 129              { // TODO: new Comment( $row_stats )
 130                  ?>
 131                  <tr <?php if($count%2 == 1) echo 'class="odd"' ?>>
 132                  <td class="firstcol"><?php echo mysql2date(locale_datefmt().' '.locale_timefmt(), $row_stats['comment_date'] ); ?></td>
 133                  <td><?php echo $row_stats['comment_author'] ?></a></td>
 134                  <td><?php echo $row_stats['comment_author_url'] ?></td>
 135                  <td><?php echo $row_stats['comment_author_IP'] ?></td>
 136                  <td><?php
 137                  $comment_content = strip_tags( $row_stats['comment_content'] );
 138                  if ( strlen($comment_content) > 70 )
 139                  {
 140                      // Trail off (truncate and add '...') after 70 chars

 141                      echo substr($comment_content, 0, 70) . "...";
 142                  }
 143                  else
 144                  {
 145                      echo $comment_content;
 146                  }
 147                  ?></td>
 148                  </tr>
 149                  <?php
 150              $count++;
 151              } ?>
 152              </tbody>
 153          </table>
 154      <?php
 155      }
 156  
 157      // Check if the string is already in the blacklist:

 158      if( antispam_check($keyword) )
 159      { // Already there:
 160          printf( '<p><strong>'.T_('The keyword [%s] is already handled by the blacklist.').'</strong></p>', htmlspecialchars($keyword) );
 161      }
 162      else
 163      { // Not in blacklist
 164          ?>
 165          <p>
 166          <input type="checkbox" name="blacklist_locally" id="blacklist_locally_cb" value="1" checked="checked" />
 167          <label for="blacklist_locally_cb">
 168              <strong><?php printf ( T_('Blacklist the keyword [%s] locally.'), htmlspecialchars($keyword) ) ?></strong>
 169          </label>
 170          </p>
 171  
 172          <?php
 173          if( $report_abuse )
 174          {
 175              ?>
 176              <p>
 177              <input type="checkbox" name="report" id="report_cb" value="1" checked="checked" />
 178              <label for="report_cb">
 179                  <strong><?php printf ( T_('Report the keyword [%s] as abuse to b2evolution.net.'), htmlspecialchars($keyword) ) ?></strong>
 180              </label>
 181              [<a href="http://b2evolution.net/about/terms.html"><?php echo T_('Terms of service') ?></a>]
 182              </p>
 183              <?php
 184          }
 185      }
 186  
 187      $Form->buttons( array(
 188          array( '', 'actionArray[ban]', T_('Perform selected operations'), 'DeleteButton' ),
 189      ) );
 190  
 191  $Form->end_form();
 192  
 193  /*

 194   * $Log: _antispam_ban.form.php,v $

 195   * Revision 1.1  2007/09/04 14:56:19  fplanque

 196   * antispam cleanup

 197   *

 198   */
 199  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics