b2evolution PHP Cross Reference Blogging Systems

Source: /skins/_messages.disp.php - 95 lines - 2735 bytes - Text - Print

Description: This is the template that displays a thread messages and message form

   1  <?php
   2  /**

   3   * This is the template that displays a thread messages and message form

   4   *

   5   * This file is not meant to be called directly.

   6   * It is meant to be called by an include in the main.page.php template.

   7   *

   8   * b2evolution - {@link http://b2evolution.net/}

   9   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

  10   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}

  11   *

  12   * @package evoskins

  13   *

  14   */
  15  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  16  
  17  // Load classes

  18  load_class( 'messaging/model/_thread.class.php', 'Thread' );
  19  load_class( 'messaging/model/_message.class.php', 'Message' );
  20  
  21  // init variables

  22  global $inc_path;
  23  global $Messages;
  24  global $DB;
  25  global $Skin;
  26  global $thrd_ID;
  27  
  28  if( !empty( $Skin ) ) {
  29      $display_params = array_merge( $Skin->get_template( 'Results' ), $Skin->get_template( 'messages' ) );
  30  } else {
  31      $display_params = NULL;
  32  }
  33  
  34  if( !is_logged_in() )
  35  {
  36      debug_die( 'User must be logged in to see this page.' );
  37  }
  38  
  39  // Check minimum permission:

  40  $current_User->check_perm( 'perm_messaging', 'reply', true );
  41  
  42  if( !empty($thrd_ID) )
  43  {// Load thread from cache:
  44      $ThreadCache = & get_ThreadCache();
  45      if( ($edited_Thread = & $ThreadCache->get_by_ID( $thrd_ID, false )) === false )
  46      {    // Thread doesn't exists with this ID
  47          unset( $edited_Thread );
  48          forget_param( 'thrd_ID' );
  49          $Messages->add( T_('The requested thread does not exist any longer.'), 'error' );
  50      }
  51      else if( ! $edited_Thread->check_thread_recipient( $current_User->ID ) )
  52      {    // Current user is not recipient of this thread
  53          unset( $edited_Thread );
  54          forget_param( 'thrd_ID' );
  55          $Messages->add( T_('You are not allowed to view this thread.'), 'error' );
  56      }
  57  }
  58  
  59  if( ( empty( $thrd_ID ) ) || ( empty( $edited_Thread ) ) )
  60  {
  61      $Messages->add( T_('Can\'t show messages without thread!'), 'error' );
  62      $Messages->display();
  63  }
  64  else
  65  {    // Preload users to show theirs avatars
  66      load_messaging_thread_recipients( $thrd_ID );
  67  }
  68  
  69  // init params

  70  if( !isset( $params ) )
  71  {
  72      $params = array();
  73  }
  74  $params = array_merge( array(
  75      'form_class' => 'bComment',
  76      'form_action' => $samedomain_htsrv_url.'action.php?mname=messaging',
  77      'form_name' => '',
  78      'form_layout' => NULL,
  79      'cols' => 35,
  80      'display_navigation' => true,
  81      'display_title' => true,
  82      'messages_list_start' => '<div class="messages_list">',
  83      'messages_list_end' => '</div>',
  84      'messages_list_title' => T_('Previous messages in this conversation'),
  85      ), $params );
  86  
  87  // Display messages list:

  88  if( isset( $edited_Thread ) )
  89  {
  90      global $action;
  91      $action = 'create';
  92      require $inc_path.'messaging/views/_message_list.view.php';
  93  }
  94  
  95  ?>

title

Description

title

Description

title

Description

title

title

Body