b2evolution PHP Cross Reference Blogging Systems

Source: /skins_email/post_new.txt.php - 98 lines - 4230 bytes - Text - Print

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

   1  <?php
   2  /**
   3   * This is sent to ((Users)) and/or ((Moderators)) to notify them that a new post 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: post_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 $admin_url, $baseurl, $htsrv_url;
  20  
  21  // Default params:
  22  $params = array_merge( array(
  23          'notify_full'    => false,
  24          'Item'           => NULL,
  25          'recipient_User' => NULL,
  26          'notify_type'    => '',
  27      ), $params );
  28  
  29  
  30  $recipient_User = $params['recipient_User'];
  31  $Item = $params['Item'];
  32  $Blog = & $Item->get_Blog();
  33  
  34  if( $params['notify_full'] )
  35  {    /* Full notification */
  36      // Calculate length for str_pad to align labels:
  37      $pad_len = max( evo_strlen( T_('Blog') ), evo_strlen( T_('Author') ), evo_strlen( T_('Title') ), evo_strlen( T_('Url') ), evo_strlen( T_('Content') ) );
  38  
  39      echo str_pad( T_('Blog'), $pad_len ).': '.$Blog->get('shortname').' ( '.str_replace( '&amp;', '&', $Blog->gen_blogurl() ).' )'."\n";
  40  
  41      echo str_pad( T_('Author'), $pad_len ).': '.$Item->creator_User->get('preferredname').' ('.$Item->creator_User->get('login').")\n";
  42  
  43      echo str_pad( T_('Title'), $pad_len ).': '.$Item->get('title')."\n";
  44  
  45      // linked URL or "-" if empty:
  46      echo str_pad( T_('Url'), $pad_len ).': '.( empty( $Item->url ) ? '-' : str_replace( '&amp;', '&', $Item->get('url') ) )."\n";
  47  
  48      if( $params['notify_type'] == 'moderator' )
  49      {
  50          echo T_('Status').': '.$Item->get( 't_status' )."\n";
  51      }
  52  
  53      echo str_pad( T_('Content'), $pad_len ).': ';
  54      // TODO: 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
  55      // TODO: might get moved onto a single line, at the end of the content..
  56      echo $Item->get_permanent_url( '', '', '&' )."\n\n";
  57  
  58      echo $Item->get('content')."\n";
  59  
  60      if( $recipient_User->check_perm( 'item_post!CURSTATUS', 'edit', false, $Item ) )
  61      { // User has permission to edit this post
  62          echo T_('Edit/Delete').': '.$admin_url.'?ctrl=items&blog='.$Item->get_blog_ID().'&p='.$Item->ID."\n";
  63      }
  64  }
  65  else
  66  {    /* Short notification */
  67      echo sprintf( T_( '%s created a new post on %s with title %s.' ), $Item->creator_User->get( 'login' ), '"'.$Blog->get('shortname').'"', '"'.$Item->get('title').'"' );
  68      echo "\n\n";
  69      echo T_( 'To read the full content of the post click here:' ).' ';
  70      echo $Item->get_permanent_url( '', '', '&' );
  71      echo "\n";
  72  
  73      if( $params['notify_type'] == 'moderator' )
  74      {
  75          echo "\n"
  76              .T_('Status').': '.$Item->get( 't_status' )."\n"
  77              .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.' )
  78              ."\n";
  79      }
  80  }
  81  
  82  // Footer vars:
  83  if( $params['notify_type'] == 'moderator' )
  84  { // moderation email
  85      $params['unsubscribe_text'] = T_( 'You are a moderator in this blog, and you are receiving notifications when a post may need moderation.' )."\n";
  86      $params['unsubscribe_text'] .= T_( 'If you don\'t want to receive any more notifications about post moderation, click here' ).': '
  87              .$htsrv_url.'quick_unsubscribe.php?type=post_moderator&user_ID=$user_ID$&key=$unsubscribe_key$';
  88  }
  89  else
  90  { // subscription email
  91      $params['unsubscribe_text'] = T_( 'If you don\'t want to receive any more notifications about new posts on this blog, click here:' ).' '.
  92              $htsrv_url.'quick_unsubscribe.php?type=coll_post&user_ID=$user_ID$&coll_ID='.$Blog->ID.'&key=$unsubscribe_key$';
  93  }
  94  
  95  // ---------------------------- EMAIL FOOTER INCLUDED HERE ----------------------------
  96  emailskin_include( '_email_footer.inc.txt.php', $params );
  97  // ------------------------------- END OF EMAIL FOOTER --------------------------------
  98  ?>

title

Description

title

Description

title

Description

title

title

Body