Ignore:
Timestamp:
Jun 18, 2014, 9:51:42 PM (10 years ago)
Author:
rvelices
Message:

since number of accepted args not required for add_event_handler, simplify calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_comment.inc.php

    r28587 r28714  
    2525 * @package functions\comment
    2626 */
    27  
    28 
    29 add_event_handler('user_comment_check', 'user_comment_check',
    30   EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     27
     28
     29add_event_handler('user_comment_check', 'user_comment_check');
    3130
    3231/**
     
    144143    $_POST['cr'][] = 'key'; // rvelices: I use this outside to see how spam robots work
    145144  }
    146  
     145
    147146  // website
    148147  if (!empty($comm['website_url']))
     
    159158    }
    160159  }
    161  
     160
    162161  // email
    163162  if (empty($comm['email']))
     
    178177    $comment_action='reject';
    179178  }
    180  
     179
    181180  // anonymous id = ip address
    182181  $ip_components = explode('.', $comm['ip']);
     
    284283    $user_where_clause = '   AND author_id = \''.$GLOBALS['user']['id'].'\'';
    285284  }
    286  
     285
    287286  if (is_array($comment_id))
    288287    $where_clause = 'id IN('.implode(',', $comment_id).')';
    289288  else
    290289    $where_clause = 'id = '.$comment_id;
    291    
     290
    292291  $query = '
    293292DELETE FROM '.COMMENTS_TABLE.'
     
    295294$user_where_clause.'
    296295;';
    297  
     296
    298297  if ( pwg_db_changes(pwg_query($query)) )
    299298  {
    300299    invalidate_user_cache_nb_comments();
    301300
    302     email_admin('delete', 
     301    email_admin('delete',
    303302                array('author' => $GLOBALS['user']['username'],
    304303                      'comment_id' => $comment_id
     
    384383;';
    385384    $result = pwg_query($query);
    386    
     385
    387386    // mail admin and ask to validate the comment
    388     if ($result and $conf['email_admin_on_comment_validation'] and 'moderate' == $comment_action) 
     387    if ($result and $conf['email_admin_on_comment_validation'] and 'moderate' == $comment_action)
    389388    {
    390389      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     
    412411    }
    413412  }
    414  
     413
    415414  return $comment_action;
    416415}
     
    483482    }
    484483  }
    485  
     484
    486485  list($author_id) = pwg_db_fetch_row($result);
    487486
     
    500499  else
    501500    $where_clause = 'id = '.$comment_id;
    502    
     501
    503502  $query = '
    504503UPDATE '.COMMENTS_TABLE.'
     
    508507;';
    509508  pwg_query($query);
    510  
     509
    511510  invalidate_user_cache_nb_comments();
    512511  trigger_notify('user_comment_validation', $comment_id);
Note: See TracChangeset for help on using the changeset viewer.