Beehive PHP Cross Reference Discussion Forums

Source: /boot.php - 150 lines - 4286 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  // We shouldn't be accessing this file directly.
  25  if (basename($_SERVER['SCRIPT_NAME']) == basename(__FILE__)) {
  26      header("Request-URI: ../index.php");
  27      header("Content-Location: ../index.php");
  28      header("Location: ../index.php");
  29      exit;
  30  }
  31  
  32  // Constant to define where the include files are
  33  if (!defined('BH_INCLUDE_PATH')) {
  34      define('BH_INCLUDE_PATH', __DIR__ . '/include/');
  35  }
  36  
  37  // Set the default timezone
  38  date_default_timezone_set('UTC');
  39  
  40  // Set default character set
  41  header('Content-type: text/html; charset=UTF-8');
  42  
  43  // Constants
  44  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  45  
  46  // Enable the error handler
  47  require_once  BH_INCLUDE_PATH . 'errorhandler.inc.php';
  48  
  49  // Set the error reporting level to report all errors
  50  error_reporting(E_ALL | E_STRICT);
  51  
  52  // Enable the error handler
  53  set_error_handler('bh_error_handler');
  54  
  55  // Attempt to handle fatal errors
  56  register_shutdown_function('bh_fatal_error_handler');
  57  
  58  // Enable the exception handler
  59  set_exception_handler('bh_exception_handler');
  60  
  61  // Don't output errors to the browser
  62  @ini_set('display_errors', '0');
  63  
  64  // Fix problems with PHP and APC session storage
  65  register_shutdown_function('session_write_close');
  66  
  67  // Forum functionality
  68  require_once  BH_INCLUDE_PATH . 'forum.inc.php';
  69  
  70  // Forum maintenance functionality
  71  register_shutdown_function('forum_check_maintenance');
  72  
  73  // Server checking functions
  74  require_once  BH_INCLUDE_PATH . 'server.inc.php';
  75  
  76  // Caching functions
  77  require_once  BH_INCLUDE_PATH . 'cache.inc.php';
  78  
  79  // Installation checking functions
  80  require_once  BH_INCLUDE_PATH . 'install.inc.php';
  81  
  82  // Wordfilter
  83  require_once  BH_INCLUDE_PATH . 'word_filter.inc.php';
  84  
  85  // Disable PHP's register_globals
  86  unregister_globals();
  87  
  88  // Disable PHP's magic quotes
  89  disable_magic_quotes();
  90  
  91  // Correctly set server protocol
  92  set_server_protocol();
  93  
  94  // Disable caching if on AOL
  95  cache_disable_aol();
  96  
  97  // Disable caching if proxy server detected.
  98  cache_disable_proxy();
  99  
 100  // Check that Beehive is installed correctly
 101  install_check();
 102  
 103  // Required includes
 104  require_once  BH_INCLUDE_PATH . 'banned.inc.php';
 105  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
 106  require_once  BH_INCLUDE_PATH . 'format.inc.php';
 107  require_once  BH_INCLUDE_PATH . 'header.inc.php';
 108  require_once  BH_INCLUDE_PATH . 'html.inc.php';
 109  require_once  BH_INCLUDE_PATH . 'lang.inc.php';
 110  require_once  BH_INCLUDE_PATH . 'session.inc.php';
 111  // End Required includes
 112  
 113  // Initialise the session
 114  session::init();
 115  
 116  // Initialise gettext
 117  lang_init();
 118  
 119  // Enable the word filter ob filter
 120  ob_start('word_filter_ob_callback');
 121  
 122  // Perform ban check
 123  ban_check($_SESSION);
 124  
 125  // Check to see if user account has been banned.
 126  if (session::user_banned()) {
 127      html_user_banned();
 128      exit;
 129  }
 130  
 131  // Check to see if the user has been approved.
 132  if (!session::user_approved()) {
 133      html_user_require_approval();
 134      exit;
 135  }
 136  
 137  // Get the webtag for the current forum
 138  $webtag = get_webtag();
 139  
 140  // Check we have a webtag and have access to the specified forum
 141  if (!forum_check_webtag_available($webtag) || !forum_check_access_level()) {
 142      $request_uri = rawurlencode(get_request_uri(false));
 143      header_redirect("forums.php?webtag_error=$webtag&final_uri=$request_uri");
 144  }
 145  
 146  // Check guest access is available.
 147  if (!forum_check_guest_access_allowed()) {
 148      $request_uri = rawurlencode(get_request_uri());
 149      header_redirect("logon.php?webtag=$webtag&final_uri=$request_uri");
 150  }

title

Description

title

Description

title

Description

title

title

Body