b2evolution PHP Cross Reference Blogging Systems

Source: /skins/threads.main.php - 115 lines - 4041 bytes - Text - Print

Description: This file is the template that includes required css files to display threads

   1  <?php
   2  /**

   3   * This file is the template that includes required css files to display threads

   4   *

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

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

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

   8   *

   9   * @package evoskins

  10   *

  11   * @version $Id: threads.main.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  global $htsrv_url, $Messages, $current_User;
  16  
  17  if( !is_logged_in() )
  18  { // Redirect to the login page for anonymous users
  19      $Messages->add( T_( 'You must log in to read your messages.' ) );
  20      header_redirect( get_login_url('cannot see messages'), 302 );
  21      // will have exited

  22  }
  23  
  24  if( !$current_User->check_status( 'can_view_threads' ) )
  25  { // user status does not allow to view threads
  26      if( $current_User->check_status( 'can_be_validated' ) )
  27      { // user is logged in but his/her account is not activate yet
  28          $Messages->add( T_( 'You must activate your account before you can read & send messages. <b>See below:</b>' ) );
  29          header_redirect( get_activate_info_url(), 302 );
  30          // will have exited

  31      }
  32  
  33      $Messages->add( 'You are not allowed to view Messages!' );
  34      header_redirect( $Blog->gen_blogurl(), 302 );
  35      // will have exited

  36  }
  37  
  38  if( !$current_User->check_perm( 'perm_messaging', 'reply' ) )
  39  { // Redirect to the blog url for users without messaging permission
  40      $Messages->add( 'You are not allowed to view Messages!' );
  41      header_redirect( $Blog->gen_blogurl(), 302 );
  42      // will have exited

  43  }
  44  
  45  $action = param( 'action', 'string', 'view' );
  46  if( ( $action == 'new' ) && ( check_create_thread_limit( true ) ) )
  47  { // don't allow to create new thread, because the new thread limit was already reached
  48      set_param( 'action', 'view' );
  49  }
  50  
  51  // var bgxy_expand is used by toggle_filter_area() and toggle_clickopen()

  52  // var htsrv_url is used for AJAX callbacks

  53  add_js_headline( "// Paths used by JS functions:
  54          var bgxy_expand = '".get_icon( 'expand', 'xy' )."';
  55          var bgxy_collapse = '".get_icon( 'collapse', 'xy' )."';" );
  56  
  57  // Require results.css to display thread query results in a table

  58  require_css( 'results.css' ); // Results/tables styles

  59  
  60  // Load classes

  61  load_class( 'messaging/model/_thread.class.php', 'Thread' );
  62  load_class( 'messaging/model/_message.class.php', 'Message' );
  63  
  64  // Get action parameter from request:

  65  $action = param_action( 'view' );
  66  
  67  switch( $action )
  68  {
  69      case 'new':
  70          // Check permission:

  71          $current_User->check_perm( 'perm_messaging', 'reply', true );
  72  
  73          $edited_Thread = new Thread();
  74          $edited_Message = new Message();
  75          $edited_Message->Thread = & $edited_Thread;
  76  
  77          modules_call_method( 'update_new_thread', array( 'Thread' => & $edited_Thread ) );
  78  
  79          if( ( $unsaved_message_params = get_message_params_from_session() ) !== NULL )
  80          { // set Message and Thread saved params from Session
  81              $edited_Message->text = $unsaved_message_params[ 'message' ];
  82              $edited_Thread->title = $unsaved_message_params[ 'subject' ];
  83              $edited_Thread->recipients = $unsaved_message_params[ 'thrd_recipients' ];
  84              $thrd_recipients_array = $unsaved_message_params[ 'thrd_recipients_array' ];
  85              $thrdtype = $unsaved_message_params[ 'thrdtype' ];
  86          }
  87          else
  88          {
  89              if( empty( $edited_Thread->recipients ) )
  90              {
  91                  $edited_Thread->recipients = param( 'thrd_recipients', 'string', '' );
  92              }
  93              if( empty( $edited_Thread->title ) )
  94              {
  95                  $edited_Thread->title = param( 'subject', 'string', '' );
  96              }
  97          }
  98  
  99          init_tokeninput_js( 'blog' );
 100          break;
 101  
 102      default:
 103          // Check permission:

 104          $current_User->check_perm( 'perm_messaging', 'reply', true );
 105          break;
 106  }
 107  
 108  // Require functions.js to show/hide a panel with filters

 109  require_js( 'functions.js', 'blog' );
 110  // Include this file to expand/collapse the filters panel when JavaScript is disabled

 111  require_once $inc_path.'_filters.inc.php';
 112  
 113  require $ads_current_skin_path.'index.main.php';
 114  
 115  ?>

title

Description

title

Description

title

Description

title

title

Body