Beehive PHP Cross Reference Discussion Forums

Source: /discussion.php - 199 lines - 6614 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*======================================================================
   4  Copyright Project Beehive Forum 2002
   5  
   6  This file is part of Beehive Forum.
   7  
   8  Beehive Forum is free software; you can redistribute it and/or modify
   9  it under the terms of the GNU General Public License as published by
  10  the Free Software Foundation; either version 3 of the License, or
  11  (at your option) any later version.
  12  
  13  Beehive Forum is distributed in the hope that it will be useful,
  14  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  GNU General Public License for more details.
  17  
  18  You should have received a copy of the GNU General Public License
  19  along with Beehive; if not, write to the Free Software
  20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  21  USA
  22  ======================================================================*/
  23  
  24  // Bootstrap
  25  require_once  'boot.php';
  26  
  27  // Required includes
  28  require_once  BH_INCLUDE_PATH . 'cache.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'folder.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'messages.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'search.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'threads.inc.php';
  36  // End Required includes
  37  
  38  // Message pane caching
  39  cache_check_messages();
  40  
  41  // Get the user's saved left frame width.
  42  if (isset($_SESSION['LEFT_FRAME_WIDTH']) && is_numeric($_SESSION['LEFT_FRAME_WIDTH'])) {
  43      $left_frame_width = max(100, $_SESSION['LEFT_FRAME_WIDTH']);
  44  } else {
  45      $left_frame_width = 280;
  46  }
  47  
  48  // Prevent the frame width from being less than 100px
  49  $left_frame_width = max(100, $left_frame_width);
  50  
  51  if (!$folder_info = threads_get_folders()) {
  52      html_draw_error(gettext("There are no folders available."));
  53  }
  54  
  55  if (isset($_GET['post_success']) && validate_msg($_GET['post_success'])) {
  56      $post_success = "&amp;post_success={$_GET['post_success']}";
  57  } else {
  58      $post_success = "";
  59  }
  60  
  61  if (isset($_GET['edit_success']) && validate_msg($_GET['edit_success'])) {
  62      $edit_success = "&amp;edit_success={$_GET['edit_success']}";
  63  } else {
  64      $edit_success = "";
  65  }
  66  
  67  if (isset($_GET['delete_success']) && validate_msg($_GET['delete_success'])) {
  68      $delete_success = "&amp;delete_success={$_GET['delete_success']}";
  69  } else {
  70      $delete_success = "";
  71  }
  72  
  73  if (isset($_GET['folder']) && is_numeric($_GET['folder']) && folder_is_accessible($_GET['folder'])) {
  74  
  75      $fid = $_GET['folder'];
  76  
  77      if (($msg = messages_get_most_recent($_SESSION['UID'], $fid)) !== false) {
  78  
  79          html_draw_top('frame_set_html', 'pm_popup_disabled');
  80  
  81          $frameset = new html_frameset_cols('discussion', "$left_frame_width,*");
  82  
  83          $frameset->html_frame("thread_list.php?webtag=$webtag&amp;mode=0&amp;folder=$fid", html_get_frame_name('left'));
  84          $frameset->html_frame("messages.php?webtag=$webtag&amp;msg=$msg$post_success$edit_success$delete_success", html_get_frame_name('right'));
  85  
  86          $frameset->output_html();
  87  
  88          html_draw_bottom(true);
  89  
  90      } else {
  91  
  92          html_draw_error(gettext("No Messages"));
  93      }
  94  
  95  } else if (isset($_GET['msg']) && validate_msg($_GET['msg'])) {
  96  
  97      html_draw_top('frame_set_html', 'pm_popup_disabled');
  98  
  99      $frameset = new html_frameset_cols('discussion', "$left_frame_width,*");
 100  
 101      $frameset->html_frame("thread_list.php?webtag=$webtag&amp;msg={$_GET['msg']}", html_get_frame_name('left'));
 102      $frameset->html_frame("messages.php?webtag=$webtag&amp;msg={$_GET['msg']}$post_success$edit_success$delete_success", html_get_frame_name('right'));
 103  
 104      $frameset->output_html();
 105  
 106      html_draw_bottom(true);
 107  
 108  } else if (isset($_GET['right']) && $_GET['right'] == 'search') {
 109  
 110      // Guests can't use this
 111      if (!session::logged_in()) {
 112  
 113          html_guest_error();
 114          exit;
 115      }
 116  
 117      if (isset($_GET['search_error']) && is_numeric($_GET['search_error'])) {
 118  
 119          html_draw_top('frame_set_html', 'pm_popup_disabled');
 120  
 121          $frameset = new html_frameset_cols('discussion', "$left_frame_width,*");
 122  
 123          $frameset->html_frame("thread_list.php?webtag=$webtag", html_get_frame_name('left'));
 124          $frameset->html_frame("search.php?webtag=$webtag&amp;search_error={$_GET['search_error']}", html_get_frame_name('right'));
 125  
 126          $frameset->output_html();
 127  
 128          html_draw_bottom(true);
 129  
 130      } else {
 131  
 132          html_draw_top('frame_set_html', 'pm_popup_disabled');
 133  
 134          $frameset = new html_frameset_cols('discussion', "$left_frame_width,*");
 135  
 136          $frameset->html_frame("thread_list.php?webtag=$webtag", html_get_frame_name('left'));
 137          $frameset->html_frame("search.php?webtag=$webtag", html_get_frame_name('right'));
 138  
 139          $frameset->output_html();
 140  
 141          html_draw_bottom(true);
 142      }
 143  
 144  } else if (isset($_GET['left']) && $_GET['left'] == 'search_results') {
 145  
 146      // Guests can't use this
 147      if (!session::logged_in()) {
 148  
 149          html_guest_error();
 150          exit;
 151      }
 152  
 153      if (($search_msg = search_get_first_result_msg()) !== false) {
 154  
 155          html_draw_top('frame_set_html', 'pm_popup_disabled');
 156  
 157          $frameset = new html_frameset_cols('discussion', "$left_frame_width,*");
 158  
 159          $frameset->html_frame("search.php?webtag=$webtag&amp;page=1", html_get_frame_name('left'));
 160          $frameset->html_frame("messages.php?webtag=$webtag&amp;msg=$search_msg&amp;highlight=yes$post_success$edit_success$delete_success", html_get_frame_name('right'));
 161  
 162          $frameset->output_html();
 163  
 164          html_draw_bottom(true);
 165  
 166      } else {
 167  
 168          html_draw_top('frame_set_html', 'pm_popup_disabled');
 169  
 170          $frameset = new html_frameset_cols('discussion', "$left_frame_width,*");
 171  
 172          $frameset->html_frame("search.php?webtag=$webtag&amp;page=1", html_get_frame_name('left'));
 173          $frameset->html_frame("search.php?webtag=$webtag", html_get_frame_name('right'));
 174  
 175          $frameset->output_html();
 176  
 177          html_draw_bottom(true);
 178      }
 179  
 180  } else {
 181  
 182      if (($msg = messages_get_most_recent($_SESSION['UID'])) !== false) {
 183  
 184          html_draw_top('frame_set_html', 'pm_popup_disabled');
 185  
 186          $frameset = new html_frameset_cols('discussion', "$left_frame_width,*");
 187  
 188          $frameset->html_frame("thread_list.php?webtag=$webtag&amp;msg=$msg", html_get_frame_name('left'));
 189          $frameset->html_frame("messages.php?webtag=$webtag&amp;msg=$msg$post_success$edit_success$delete_success", html_get_frame_name('right'));
 190  
 191          $frameset->output_html();
 192  
 193          html_draw_bottom(true);
 194  
 195      } else {
 196  
 197          html_draw_error(gettext("No Messages"));
 198      }
 199  }

title

Description

title

Description

title

Description

title

title

Body