Ignore:
Timestamp:
Mar 12, 2011, 10:56:58 PM (14 years ago)
Author:
mistic100
Message:

[plugins] Comments on Albums

  • corrections
  • public list available
File:
1 edited

Legend:

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

    r9624 r9634  
    33
    44//returns string action to perform on a new comment: validate, moderate, reject
    5 function user_comment_check($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;
     5if (!function_exists('user_comment_check')) {
     6        function user_comment_check($action, $comment)
     7        {
     8          global $conf,$user;
     9
     10          if ($action=='reject')
     11                return $action;
     12
     13          $my_action = $conf['comment_spam_reject'] ? 'reject':'moderate';
     14
     15          if ($action==$my_action)
     16                return $action;
     17
     18          // we do here only BASIC spam check (plugins can do more)
     19          if ( !is_a_guest() )
     20                return $action;
     21
     22          $link_count = preg_match_all( '/https?:\/\//',
     23                $comment['content'], $matches);
     24
     25          if ( strpos($comment['author'], 'http://')!==false )
     26          {
     27                $link_count++;
     28          }
     29
     30          if ( $link_count>$conf['comment_spam_max_links'] )
     31                return $my_action;
     32
     33          return $action;
     34        }
    3335}
    3436
     
    4446 * @param array infos out array of messages
    4547 */
    46 function insert_user_comment( &$comm, $key, &$infos )
     48function insert_user_comment_albums( &$comm, $key, &$infos )
    4749{
    4850  global $conf, $user;
     
    185187 * @param comment_id
    186188 */
    187 function delete_user_comment($comment_id) {
     189function delete_user_comment_albums($comment_id) {
    188190  $user_where_clause = '';
    189191  if (!is_admin())
     
    216218 */
    217219
    218 function update_user_comment($comment, $post_key)
     220function update_user_comment_albums($comment, $post_key)
    219221{
    220222  global $conf;
     
    259261}
    260262
    261 function email_admin($action, $comment)
    262 {
    263   global $conf;
    264 
    265   if (!in_array($action, array('edit', 'delete'))
    266       or (($action=='edit') and !$conf['email_admin_on_comment_edition'])
    267       or (($action=='delete') and !$conf['email_admin_on_comment_deletion']))
    268   {
    269     return;
    270   }
    271 
    272   include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    273 
    274   $keyargs_content = array();
    275   $keyargs_content[] = get_l10n_args('Author: %s', $comment['author']);
    276   if ($action=='delete')
    277   {
    278     $keyargs_content[] = get_l10n_args('This author removed the comment with id %d',
    279                                        $comment['comment_id']
    280                                        );
    281   }
    282   else
    283   {
    284     $keyargs_content[] = get_l10n_args('This author modified following comment:', '');
    285     $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']);
    286   }
    287 
    288   pwg_mail_notification_admins(get_l10n_args('Comment by %s',
    289                                              $comment['author']),
    290                                $keyargs_content
    291                                );
    292 }
    293 
    294 function get_comment_author_id($comment_id, $die_on_error=true)
     263if (!function_exists('email_admin')) {
     264        function email_admin($action, $comment)
     265        {
     266          global $conf;
     267
     268          if (!in_array($action, array('edit', 'delete'))
     269                  or (($action=='edit') and !$conf['email_admin_on_comment_edition'])
     270                  or (($action=='delete') and !$conf['email_admin_on_comment_deletion']))
     271          {
     272                return;
     273          }
     274
     275          include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     276
     277          $keyargs_content = array();
     278          $keyargs_content[] = get_l10n_args('Author: %s', $comment['author']);
     279          if ($action=='delete')
     280          {
     281                $keyargs_content[] = get_l10n_args('This author removed the comment with id %d',
     282                                                   $comment['comment_id']
     283                                                   );
     284          }
     285          else
     286          {
     287                $keyargs_content[] = get_l10n_args('This author modified following comment:', '');
     288                $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']);
     289          }
     290
     291          pwg_mail_notification_admins(get_l10n_args('Comment by %s',
     292                                                         $comment['author']),
     293                                           $keyargs_content
     294                                           );
     295        }
     296}
     297
     298function get_comment_author_id_albums($comment_id, $die_on_error=true)
    295299{
    296300  $query = '
     
    318322}
    319323
    320 function validate_user_comment($comment_id)
     324function validate_user_comment_albums($comment_id)
    321325{
    322326  $query = '
Note: See TracChangeset for help on using the changeset viewer.