b2evolution PHP Cross Reference Blogging Systems

Source: /skins_email/comment_new.txt.php - 138 lines - 6492 bytes - Text - Print

Description: This is sent to ((Users)) and/or ((Moderators)) to notify them that a new comment has been posted.

   1  <?php
   2  /**
   3   * This is sent to ((Users)) and/or ((Moderators)) to notify them that a new comment has been posted.
   4   *
   5   * For more info about email skins, see: http://b2evolution.net/man/themes-templates-skins/email-skins/
   6   *
   7   * b2evolution - {@link http://b2evolution.net/}
   8   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
   9   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
  10   *
  11   * @version $Id: comment_new.txt.php 6136 2014-03-08 07:59:48Z manuel $
  12   */
  13  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  14  
  15  // ---------------------------- EMAIL HEADER INCLUDED HERE ----------------------------
  16  emailskin_include( '_email_header.inc.txt.php', $params );
  17  // ------------------------------- END OF EMAIL HEADER --------------------------------
  18  
  19  global $htsrv_url, $admin_url;
  20  
  21  // Default params:
  22  $params = array_merge( array(
  23          'notify_full' => false,
  24          'Comment'     => NULL,
  25          'Blog'        => NULL,
  26          'Item'        => NULL,
  27          'author_ID'   => NULL,
  28          'author_name' => '',
  29          'notify_type' => '',
  30      ), $params );
  31  
  32  
  33  $Comment = $params['Comment'];
  34  $Blog = $params['Blog'];
  35  $Item = $params['Item'];
  36  
  37  if( $params['notify_full'] )
  38  {    // Long format notification:
  39      $notify_message = T_('New comment').': '
  40          .$Comment->get_permanent_url( '&' )."\n"
  41          // TODO: fp> We MAY want to force a short URL and avoid it to wrap on a new line in the mail which may prevent people from clicking
  42          .T_('Blog').': '.$Blog->get('shortname')."\n"
  43          // Mail bloat: .' ( '.str_replace('&amp;', '&', $Blog->gen_blogurl())." )\n"
  44          .T_('Post').': '.$Item->get('title')."\n";
  45          // Mail bloat: .' ( '.str_replace('&amp;', '&', $Item->get_permanent_url())." )\n";
  46          // TODO: fp> We MAY want to force short URL and avoid it to wrap on a new line in the mail which may prevent people from clicking
  47  
  48      switch( $Comment->type )
  49      {
  50          case 'trackback':
  51              $user_domain = gethostbyaddr($Comment->author_IP);
  52              $notify_message .= T_('Website').": $Comment->author (IP: $Comment->author_IP, $user_domain)\n";
  53              $notify_message .= T_('Url').": $Comment->author_url\n";
  54              break;
  55  
  56          default:
  57              if( $Comment->get_author_User() )
  58              { // Comment from a registered user:
  59                  $notify_message .= T_('Author').': '.$Comment->author_User->get('preferredname').' ('.$Comment->author_User->get('login').")\n";
  60              }
  61              else
  62              { // Comment from visitor:
  63                  $user_domain = gethostbyaddr($Comment->author_IP);
  64                  $notify_message .= T_('Author').": $Comment->author (IP: $Comment->author_IP, $user_domain)\n";
  65                  $notify_message .= T_('Email').": $Comment->author_email\n";
  66                  $notify_message .= T_('Url').": $Comment->author_url\n";
  67              }
  68      }
  69  
  70      if( !empty( $Comment->rating ) )
  71      {
  72          $notify_message .= T_('Rating').": $Comment->rating\n";
  73      }
  74  
  75      if( $params['notify_type'] == 'moderator' )
  76      {
  77          $notify_message .= T_('Status').': '.$Comment->get( 't_status' )."\n";
  78      }
  79  
  80      $notify_message .= $Comment->get('content')."\n";
  81  }
  82  else
  83  {    // Shot format notification:
  84      $notify_message = sprintf( T_( '%s posted a new comment on %s in %s.' ), $params['author_name'], '"'.$Item->get('title').'"', '"'.$Blog->get('shortname').'"' )."\n\n";
  85      $notify_message .= T_( 'To read the full content of the comment click here:' ).' '
  86                      .$Comment->get_permanent_url( '&' )."\n";
  87                      // TODO: fp> We MAY want to force a short URL and avoid it to wrap on a new line in the mail which may prevent people from clicking
  88      if( $params['notify_type'] == 'moderator' )
  89      {
  90          $notify_message .= "\n"
  91                          .T_('Status').': '.$Comment->get( 't_status' )."\n"
  92                          .T_( 'This is a short form moderation message. To make these emails more useful for quick moderation, ask the administrator to send you long form moderation messages instead.' )
  93                          ."\n";
  94      }
  95  }
  96  
  97  $notify_message .= "\n\n";
  98  
  99  // add unsubscribe and edit links
 100  $params['unsubscribe_text'] = '';
 101  if( $params['notify_type'] == 'moderator' )
 102  { // moderation email
 103      if( ( $Blog->get_setting( 'comment_quick_moderation' ) != 'never' ) && ( !empty( $Comment->secret ) ) )
 104      { // quick moderation is permitted, and comment secret was set
 105          $notify_message .= T_('Quick moderation').': '.'$secret_content_start$'.$htsrv_url.'comment_review.php?cmt_ID='.$Comment->ID.'&secret='.$Comment->secret.'$secret_content_end$'."\n\n";
 106      }
 107      $notify_message .= T_('Edit comment').': '.$admin_url.'?ctrl=comments&action=edit&comment_ID='.$Comment->ID."\n\n";
 108      $params['unsubscribe_text'] = T_( 'You are a moderator in this blog, and you are receiving notifications when a comments may need moderation.' )."\n";
 109      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications about comment moderation, click here' ).': '
 110                          .$htsrv_url.'quick_unsubscribe.php?type=comment_moderator&user_ID=$user_ID$&key=$unsubscribe_key$';
 111  }
 112  else if( $params['notify_type'] == 'blog_subscription' )
 113  { // blog subscription
 114      $params['unsubscribe_text'] = T_( 'You are receiving notifications when anyone comments on any post.' )."\n";
 115      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications on this blog, click here' ).': '
 116                          .$htsrv_url.'quick_unsubscribe.php?type=coll_comment&coll_ID='.$Blog->ID.'&user_ID=$user_ID$&key=$unsubscribe_key$';
 117      // subscribers are not allowed to see comment author email
 118  }
 119  else if( $params['notify_type'] == 'item_subscription' )
 120  { // item subscription
 121      $params['unsubscribe_text'] = T_( 'You are receiving notifications when anyone comments on this post.' )."\n";
 122      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications on this post, click here' ).': '
 123                          .$htsrv_url.'quick_unsubscribe.php?type=post&post_ID='.$Item->ID.'&user_ID=$user_ID$&key=$unsubscribe_key$';
 124      // subscribers are not allowed to see comment author email
 125  }
 126  else if( $params['notify_type'] == 'creator' )
 127  { // user is the creator of the post
 128      $params['unsubscribe_text'] = T_( 'This is your post. You are receiving notifications when anyone comments on your posts.' )."\n";
 129      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications on your posts, click here' ).': '
 130                          .$htsrv_url.'quick_unsubscribe.php?type=creator&user_ID=$user_ID$&key=$unsubscribe_key$';
 131  }
 132  
 133  echo $notify_message;
 134  
 135  // ---------------------------- EMAIL FOOTER INCLUDED HERE ----------------------------
 136  emailskin_include( '_email_footer.inc.txt.php', $params );
 137  // ------------------------------- END OF EMAIL FOOTER --------------------------------
 138  ?>

title

Description

title

Description

title

Description

title

title

Body