Changeset 15999


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

move some code to BBCode Bar and Smilies Support

Location:
extensions/Comments_on_Albums
Files:
2 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{
  • extensions/Comments_on_Albums/main.inc.php

    r15995 r15999  
    3434  if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return;
    3535 
    36   add_event_handler('loc_begin_page_header', 'COA_albums');
     36  add_event_handler('loc_after_page_header', 'COA_albums');
    3737  add_event_handler('loc_after_page_header', 'COA_comments_page');
    3838  add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
     
    5151 
    5252  if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' )
    53   {
    54     if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit']))
    55     {
    56       set_bbcode_bar();
    57       $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter');
    58       if (isset($pwg_loaded_plugins['SmiliesSupport']))
    59       {
    60         $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
    61       }
    62     }
    63     else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit']))
    64     {
    65       set_smiliessupport();
    66       $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
    67     }
    68    
     53  {   
    6954    trigger_action('loc_begin_coa');
    7055    include(COA_PATH . 'include/coa_albums.php');
Note: See TracChangeset for help on using the changeset viewer.