Ignore:
Timestamp:
Jun 24, 2012, 3:12:33 PM (12 years ago)
Author:
mistic100
Message:

move some code to BBCode Bar and Smilies Support

File:
1 edited

Legend:

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

    r15995 r15999  
    22/* This is a copy of include/functions_comment.inc.php but adapted for Comments On Albums */
    33
    4 //returns string action to perform on a new comment: validate, moderate, reject
    5 function user_comment_check_albums($action, $comment)
    6 {
    7   global $conf,$user;
    8 
    9   if ($action=='reject')
    10   return $action;
    11 
    12   $my_action = $conf['comment_spam_reject'] ? 'reject':'moderate';
    13 
    14   if ($action==$my_action)
    15   return $action;
    16 
    17   // we do here only BASIC spam check (plugins can do more)
    18   if ( !is_a_guest() )
    19   return $action;
    20 
    21   $link_count = preg_match_all( '/https?:\/\//',
    22   $comment['content'], $matches);
    23 
    24   if ( strpos($comment['author'], 'http://')!==false )
    25   {
    26   $link_count++;
    27   }
    28 
    29   if ( $link_count>$conf['comment_spam_max_links'] )
    30   return $my_action;
    31 
    32   return $action;
    33 }
    34 
    35 add_event_handler('user_comment_check_albums', 'user_comment_check_albums',
     4include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
     5add_event_handler('user_comment_check_albums', 'user_comment_check',
    366  EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    377
     
    323293}
    324294
    325 if (!function_exists('email_admin'))
    326 {
    327   function email_admin($action, $comment)
    328   {
    329     global $conf;
    330 
    331     if (!in_array($action, array('edit', 'delete'))
    332       or (($action=='edit') and !$conf['email_admin_on_comment_edition'])
    333       or (($action=='delete') and !$conf['email_admin_on_comment_deletion']))
    334     {
    335     return;
    336     }
    337 
    338     include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    339 
    340     $keyargs_content = array();
    341     $keyargs_content[] = get_l10n_args('Author: %s', $comment['author']);
    342     if ($action=='delete')
    343     {
    344     $keyargs_content[] = get_l10n_args('This author removed the comment with id %d',
    345                $comment['comment_id']
    346                );
    347     }
    348     else
    349     {
    350     $keyargs_content[] = get_l10n_args('This author modified following comment:', '');
    351     $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']);
    352     }
    353 
    354     pwg_mail_notification_admins(get_l10n_args('Comment by %s',
    355                $comment['author']),
    356              $keyargs_content
    357              );
    358   }
    359 }
    360 
    361295function get_comment_author_id_albums($comment_id, $die_on_error=true)
    362296{
Note: See TracChangeset for help on using the changeset viewer.