Changeset 15995


Ignore:
Timestamp:
06/24/12 13:49:50 (7 years ago)
Author:
mistic100
Message:

improve anti-spam system (Piwigo 2.5 feature)

Location:
extensions/Comments_on_Albums
Files:
7 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/Comments_on_Albums/include/functions_comment.inc.php

    r15640 r15995  
    104104    $_POST['cr'][] = 'key'; 
    105105  } 
     106   
     107  // anonymous id = ip address 
     108  $ip_components = explode('.', $comm['ip']); 
     109  if (count($ip_components) > 3) 
     110  { 
     111    array_pop($ip_components); 
     112  } 
     113  $comm['anonymous_id'] = implode('.', $ip_components); 
    106114 
    107115  if ($comment_action!='reject' and $conf['anti-flood_time']>0 and !is_admin()) 
     
    113121  WHERE date > '.$reference_date.' 
    114122    AND author_id = '.$comm['author_id']; 
     123    if (!is_classic_user()) 
     124    { 
     125      $query.= ' 
     126      AND anonymous_id = "'.$comm['anonymous_id'].'"'; 
     127    } 
     128    $query.= ' 
     129;'; 
     130 
    115131    list($counter) = pwg_db_fetch_row(pwg_query($query)); 
    116132    if ( $counter > 0 ) 
  • extensions/Comments_on_Albums/main.inc.php

    r15640 r15995  
    88Author URI: http://www.strangeplanet.fr 
    99*/ 
    10  
    11 ## TODO ## 
    12 // compatibility with Simple when updated to 2.4 
    13 // compatibility with Gally when updated to 2.4 
    1410 
    1511if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
  • extensions/Comments_on_Albums/maintain.inc.php

    r14528 r15995  
    1313  `author` varchar(255) DEFAULT NULL, 
    1414  `author_id` smallint(5) DEFAULT NULL, 
     15  `anonymous_id` varchar(45) NOT NULL, 
    1516  `content` longtext, 
    1617  `validated` enum('true','false') NOT NULL DEFAULT 'false', 
     
    2324function plugin_activate() 
    2425{ 
    25   global $conf; 
     26  global $conf, $prefixeTable; 
    2627   
    2728  if (isset($conf['comments_on_albums'])) 
    2829  { 
    2930    pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="comments_on_albums" LIMIT 1;'); 
     31  } 
     32   
     33  $query = 'SHOW COLUMNS FROM `' . $prefixeTable . 'comments_categories`;'; 
     34  $columns = hash_from_query($query, 'Field'); 
     35  if (!isset($columns['anonymous_id'])) 
     36  { 
     37    pwg_query('ALTER TABLE `' . $prefixeTable . 'comments_categories` ADD `anonymous_id` VARCHAR( 45 ) DEFAULT NULL;'); 
    3038  } 
    3139} 
  • extensions/Comments_on_Albums/template/admin_comments.tpl

    r14528 r15995  
    1616 
    1717  jQuery(".checkComment").click(function(event) { 
     18    var checkbox = jQuery(this).children("input[type=checkbox]"); 
    1819    if (event.target.type !== 'checkbox') { 
    19       var checkbox = jQuery(this).children("input[type=checkbox]"); 
    2020      jQuery(checkbox).attr('checked', !jQuery(checkbox).is(':checked')); 
    21       highlighComments(); 
    2221    } 
     22    highlighComments(); 
    2323  }); 
    2424 
     
    8383 
    8484</form> 
     85{else} 
     86{'No pending comment'|@translate} 
    8587{/if} 
Note: See TracChangeset for help on using the changeset viewer.