Beehive PHP Cross Reference Discussion Forums

Source: /index.php - 252 lines - 7878 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 . 'browser.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'cache.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'folder.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'format.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'forum.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'header.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  36  require_once  BH_INCLUDE_PATH . 'light.inc.php';
  37  require_once  BH_INCLUDE_PATH . 'messages.inc.php';
  38  require_once  BH_INCLUDE_PATH . 'pm.inc.php';
  39  require_once  BH_INCLUDE_PATH . 'server.inc.php';
  40  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  41  require_once  BH_INCLUDE_PATH . 'threads.inc.php';
  42  require_once  BH_INCLUDE_PATH . 'user.inc.php';
  43  // End Required includes
  44  
  45  // Don't cache this page
  46  cache_disable();
  47  
  48  if (isset($_GET['view']) && ($_GET['view'] == 'full')) {
  49  
  50      html_set_cookie('view', 'full');
  51      header_redirect('index.php');
  52  
  53  } else if (isset($_GET['view']) && ($_GET['view'] == 'mobile')) {
  54  
  55      html_set_cookie('view', 'mobile');
  56      header_redirect('index.php');
  57  }
  58  
  59  $top_html = html_get_top_page();
  60  
  61  $hide_navigation = false;
  62  
  63  if (!browser_mobile() && !session::is_search_engine()) {
  64  
  65      if (!user_guest_enabled() && (!isset($_SESSION['UID']) || $_SESSION['UID'] == 0)) {
  66          $hide_navigation = true;
  67      }
  68  
  69      if (isset($_GET['final_uri']) && strlen(trim($_GET['final_uri'])) > 0) {
  70  
  71          $available_files_preg = implode("|^", array_map('preg_quote_callback', get_available_files()));
  72  
  73          $available_admin_files_preg = implode("|^", array_map('preg_quote_callback', get_available_admin_files()));
  74  
  75          $my_controls_preg = implode("|^", array_map('preg_quote_callback', get_available_user_files()));
  76  
  77          if (preg_match("/^$available_files_preg/u", trim($_GET['final_uri'])) > 0) {
  78  
  79              $final_uri = href_cleanup_query_keys($_GET['final_uri']);
  80  
  81              if (preg_match("/^logon.php/u", $final_uri) > 0) {
  82  
  83                  $hide_navigation = true;
  84  
  85              } else if (preg_match("/^$available_admin_files_preg/u", $final_uri) > 0) {
  86  
  87                  $final_uri = rawurlencode($final_uri);
  88                  $final_uri = "admin.php?webtag=$webtag&amp;page=$final_uri";
  89  
  90              } else if (preg_match("/^$my_controls_preg/u", $final_uri) > 0) {
  91  
  92                  $final_uri = rawurlencode(href_cleanup_query_keys($final_uri));
  93                  $final_uri = "user.php?webtag=$webtag&amp;page=$final_uri";
  94              }
  95          }
  96      }
  97  
  98      html_draw_top('frame_set_html', 'pm_popup_disabled', 'robots=index,follow');
  99  
 100      if (isset($_SESSION['FONT_SIZE']) && is_numeric($_SESSION['FONT_SIZE'])) {
 101          $navsize = max(max(min($_SESSION['FONT_SIZE'], 15), 5) * 2, 22);
 102      } else {
 103          $navsize = 22;
 104      }
 105  
 106      if (!isset($final_uri)) {
 107  
 108          if (isset($_GET['msg']) && validate_msg($_GET['msg'])) {
 109  
 110              $final_uri = "discussion.php?webtag=$webtag&amp;msg={$_GET['msg']}";
 111  
 112          } else if (isset($_GET['folder']) && is_numeric($_GET['folder'])) {
 113  
 114              $final_uri = "discussion.php?webtag=$webtag&amp;folder={$_GET['folder']}";
 115  
 116          } else if (isset($_GET['pmid']) && is_numeric($_GET['pmid'])) {
 117  
 118              $final_uri = "pm.php?webtag=$webtag&amp;mid={$_GET['pmid']}";
 119  
 120          } else {
 121  
 122              if (isset($_SESSION['START_PAGE']) && is_numeric($_SESSION['START_PAGE'])) {
 123  
 124                  if ($_SESSION['START_PAGE'] == START_PAGE_MESSAGES) {
 125                      $final_uri = "discussion.php?webtag=$webtag";
 126                  } else if ($_SESSION['START_PAGE'] == START_PAGE_INBOX) {
 127                      $final_uri = "pm.php?webtag=$webtag";
 128                  } else {
 129                      $final_uri = "start.php?webtag=$webtag";
 130                  }
 131  
 132              } else {
 133  
 134                  $final_uri = "start.php?webtag=$webtag";
 135              }
 136          }
 137      }
 138  
 139      if ($hide_navigation) {
 140  
 141          $frameset = new html_frameset_rows('index', "60,*");
 142          $frameset->html_frame($top_html, html_get_frame_name('ftop'), 0, 'no', 'noresize');
 143          $frameset->html_frame($final_uri, html_get_frame_name('main'));
 144          $frameset->output_html(false);
 145  
 146      } else {
 147  
 148          $frameset = new html_frameset_rows('index', "60,$navsize,*");
 149          $frameset->html_frame($top_html, html_get_frame_name('ftop'), 0, 'no', 'noresize');
 150          $frameset->html_frame("nav.php?webtag=$webtag", html_get_frame_name('fnav'), 0, 'no', 'noresize');
 151          $frameset->html_frame($final_uri, html_get_frame_name('main'));
 152          $frameset->output_html(false);
 153      }
 154  
 155      echo "<noframes>\n";
 156      echo "<body>\n";
 157  
 158  } else {
 159  
 160      light_html_draw_top('js/thread_list.js');
 161  }
 162  
 163  if (forum_check_webtag_available($webtag)) {
 164  
 165      if (isset($_GET['msg']) && validate_msg($_GET['msg'])) {
 166  
 167          list($tid, $pid) = explode('.', $_GET['msg']);
 168  
 169          light_draw_messages($tid, $pid);
 170  
 171      } else if (isset($_GET['pmid']) && is_numeric($_GET['pmid'])) {
 172  
 173          if (!session::logged_in()) {
 174              light_html_guest_error();
 175          }
 176  
 177          light_pm_enabled();
 178  
 179          pm_user_prune_folders($_SESSION['UID']);
 180  
 181          light_draw_pm_inbox();
 182  
 183      } else {
 184  
 185          if (!($available_folders = folder_get_available_array())) {
 186              $available_folders = array();
 187          }
 188  
 189          if (isset($_REQUEST['folder']) && in_array($_REQUEST['folder'], $available_folders)) {
 190              $folder = $_REQUEST['folder'];
 191          } else {
 192              $folder = false;
 193          }
 194  
 195          if (isset($_REQUEST['start_from']) && is_numeric($_REQUEST['start_from'])) {
 196              $start_from = $_REQUEST['start_from'];
 197          } else {
 198              $start_from = 0;
 199          }
 200  
 201          if (isset($_REQUEST['mode']) && is_numeric($_REQUEST['mode'])) {
 202              $mode = $_REQUEST['mode'];
 203          }
 204  
 205          if (!session::logged_in()) {
 206  
 207              if (!isset($mode) || ($mode != ALL_DISCUSSIONS && $mode != TODAYS_DISCUSSIONS && $mode != TWO_DAYS_BACK && $mode != SEVEN_DAYS_BACK)) {
 208                  $mode = ALL_DISCUSSIONS;
 209              }
 210  
 211          } else {
 212  
 213              $threads_any_unread = threads_any_unread();
 214  
 215              if (isset($mode) && is_numeric($mode)) {
 216  
 217                  $_SESSION['THREAD_MODE'] = $mode;
 218  
 219              } else {
 220  
 221                  if (isset($_SESSION['THREAD_MODE']) && is_numeric($_SESSION['THREAD_MODE'])) {
 222                      $mode = $_SESSION['THREAD_MODE'];
 223                  } else {
 224                      $mode = UNREAD_DISCUSSIONS;
 225                  }
 226  
 227                  if ($mode == UNREAD_DISCUSSIONS && !$threads_any_unread) {
 228                      $mode = ALL_DISCUSSIONS;
 229                  }
 230              }
 231          }
 232  
 233          light_draw_thread_list($mode, $folder, $start_from);
 234      }
 235  
 236  } else {
 237  
 238      light_draw_my_forums();
 239  }
 240  
 241  if (!browser_mobile() && !session::is_search_engine()) {
 242  
 243      echo "</body>\n";
 244      echo "</noframes>\n";
 245      echo "</frameset>\n";
 246  
 247      html_draw_bottom(true);
 248  
 249  } else {
 250  
 251      light_html_draw_bottom();
 252  }

title

Description

title

Description

title

Description

title

title

Body