b2evolution PHP Cross Reference Blogging Systems

Source: /skins_email/comment_new.html.php - 144 lines - 6395 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.html.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.html.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  $author_name = empty( $params['author_ID'] ) ? $params['author_name'] : get_user_colored_login( $params['author_name'] );
  38  $notify_message = '<p>'.sprintf( T_( '%s posted a new comment on %s in %s.' ), '<b>'.$author_name.'</b>', '<b>'.get_link_tag( $Item->get_permanent_url(), $Item->get('title') ).'</b>', '<b>'.$Blog->get('shortname').'</b>' ).'</p>';
  39  
  40  if( $params['notify_full'] )
  41  {    // Long format notification:
  42  
  43      switch( $Comment->type )
  44      {
  45          case 'trackback':
  46              $user_domain = gethostbyaddr($Comment->author_IP);
  47              $notify_message .= '<p>'.T_('Trackback IP').': '.$Comment->author_IP.', '.$user_domain."</p>\n";
  48              $notify_message .= '<p>'.T_('Url').': '.get_link_tag( $Comment->author_url )."</p>\n";
  49              break;
  50  
  51          default:
  52              if( ! $Comment->get_author_User() )
  53              { // Comment from visitor:
  54                  $user_domain = gethostbyaddr($Comment->author_IP);
  55                  $notify_message .= '<p>'.T_('Commenter IP').': '.$Comment->author_IP.', '.$user_domain."</p>\n";
  56                  $notify_message .= '<p>'.T_('Email').': '.$Comment->author_email."</p>\n";
  57                  $notify_message .= '<p>'.T_('Url').': '.get_link_tag( $Comment->author_url )."</p>\n";
  58              }
  59      }
  60  
  61      if( !empty( $Comment->rating ) )
  62      {
  63          $notify_message .= '<p>'.T_('Rating').': '.$Comment->rating."</p>\n";
  64      }
  65  
  66      if( $params['notify_type'] == 'moderator' )
  67      {
  68          $notify_message .= '<p>'.T_('Status').': '.$Comment->get( 't_status' )."</p>\n";
  69      }
  70  
  71      // Content:
  72      $notify_message .= '<div class="email_ugc">'."\n";
  73      $notify_message .= '<p>'.nl2br( $Comment->get('content') ).'</p>';
  74      $notify_message .= "</div>\n";
  75  }
  76  else
  77  {    // Short format notification:
  78      if( $params['notify_type'] == 'moderator' )
  79      {
  80          $notify_message .= '<p>'.T_('Status').': <b>'.$Comment->get( 't_status' )."</b></p>\n";
  81  
  82          $notify_message .= '<div class="email_ugc">'."\n";
  83          $notify_message .= '<p><i class="note">'.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.' ).'</i></p>';
  84          $notify_message .= "</div>\n";
  85      }
  86  }
  87  
  88  echo $notify_message;
  89  
  90  // Buttons:
  91  
  92  echo '<div class="buttons">'."\n";
  93  
  94  echo get_link_tag( $Comment->get_permanent_url(), T_( 'Read full comment' ), 'button_green' )."\n";
  95  
  96  if( $params['notify_type'] == 'moderator' )
  97  { // moderation email
  98      if( ( $Blog->get_setting( 'comment_quick_moderation' ) != 'never' ) && ( !empty( $Comment->secret ) ) )
  99      { // quick moderation is permitted, and comment secret was set
 100          echo get_link_tag( '$secret_content_start$'.$htsrv_url.'comment_review.php?cmt_ID='.$Comment->ID.'&secret='.$Comment->secret.'$secret_content_end$', T_('Quick moderation'), 'button_yellow' )."\n";
 101      }
 102      echo get_link_tag( $admin_url.'?ctrl=comments&action=edit&comment_ID='.$Comment->ID, T_('Edit comment'), 'button_gray' )."\n";
 103  }
 104  
 105  echo "</div>\n";
 106  
 107  
 108  // add unsubscribe and edit links
 109  $params['unsubscribe_text'] = '';
 110  if( $params['notify_type'] == 'moderator' )
 111  { // moderation email
 112      $params['unsubscribe_text'] = T_( 'You are a moderator in this blog, and you are receiving notifications when a comments may need moderation.' ).'<br />';
 113      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications about comment moderation, click here:' )
 114              .' <a href="'.$htsrv_url.'quick_unsubscribe.php?type=comment_moderator&user_ID=$user_ID$&key=$unsubscribe_key$">'
 115              .T_('instant unsubscribe').'</a>.';
 116  }
 117  else if( $params['notify_type'] == 'blog_subscription' )
 118  { // blog subscription
 119      $params['unsubscribe_text'] = T_( 'You are receiving notifications when anyone comments on any post.' ).'<br />';
 120      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications on this blog, click here:' )
 121              .' <a href="'.$htsrv_url.'quick_unsubscribe.php?type=coll_comment&coll_ID='.$Blog->ID.'&user_ID=$user_ID$&key=$unsubscribe_key$">'
 122              .T_('instant unsubscribe').'</a>.';
 123      // subscribers are not allowed to see comment author email
 124  }
 125  else if( $params['notify_type'] == 'item_subscription' )
 126  { // item subscription
 127      $params['unsubscribe_text'] = T_( 'You are receiving notifications when anyone comments on this post.' ).'<br />';
 128      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications on this post, click here:' )
 129              .' <a href="'.$htsrv_url.'quick_unsubscribe.php?type=post&post_ID='.$Item->ID.'&user_ID=$user_ID$&key=$unsubscribe_key$">'
 130              .T_('instant unsubscribe').'</a>.';
 131      // subscribers are not allowed to see comment author email
 132  }
 133  else if( $params['notify_type'] == 'creator' )
 134  { // user is the creator of the post
 135      $params['unsubscribe_text'] = T_( 'This is your post. You are receiving notifications when anyone comments on your posts.' ).'<br />';
 136      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications on your posts, click here:' )
 137              .' <a href="'.$htsrv_url.'quick_unsubscribe.php?type=creator&user_ID=$user_ID$&key=$unsubscribe_key$">'
 138              .T_('instant unsubscribe').'</a>.';
 139  }
 140  
 141  // ---------------------------- EMAIL FOOTER INCLUDED HERE ----------------------------
 142  emailskin_include( '_email_footer.inc.html.php', $params );
 143  // ------------------------------- END OF EMAIL FOOTER --------------------------------
 144  ?>

title

Description

title

Description

title

Description

title

title

Body