| 
<?php
/*
 Bluetrait 2.0 Common
 Michael Dale 2008
 */
 if (version_compare(PHP_VERSION, '5.2.0', '<')) {
 die('Bluetrait requires PHP 5.2.0 or higher to run. You\'re running ' . PHP_VERSION . '.');
 }
 if (!class_exists('PDO')) die('Unable to find the PHP PDO database class. This is required for Bluetrait to run.');
 //Bluetrait Root Path
 define('BT_ROOT', dirname(__FILE__));
 //Bluetrait Relative Path
 if (!defined('BT_REL_ROOT')) define('BT_REL_ROOT', './');
 define('BT_INCLUDE', '/bt-include');
 //Used for any "internal/core plugins"
 define('BT_PLUGIN_NAME', 'Bluetrait Core');
 
 //stop php from complaining
 date_default_timezone_set(date_default_timezone_get());
 
 include(BT_ROOT . BT_INCLUDE . '/functions.php');
 include(BT_ROOT . BT_INCLUDE . '/db-specific.functions.php');
 bt_start_timer();
 include(BT_ROOT . BT_INCLUDE . '/version.php');
 include(BT_ROOT . BT_INCLUDE . '/tables.class.php');
 include(BT_ROOT . BT_INCLUDE . '/db.php');
 
 if (file_exists(BT_ROOT . '/bt-settings.php')) {
 include(BT_ROOT . '/bt-settings.php');
 }
 include(BT_ROOT . '/bt-default-settings.php');
 
 if (!file_exists(BT_ROOT . '/bt-config.php')) {
 bt_die('The config file "bt-config.php" could not be found, please run the <a href="' . BT_REL_ROOT . 'bt-install/index.html">installer</a>.');
 }
 include(BT_ROOT . '/bt-config.php');
 
 //start database connection here
 $bt_db = new bt_db($bt_db_host, $bt_db_name, $bt_db_user, $bt_db_pass, $bt_db_type, $bt_db_charset);
 $bt_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 $bt_db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
 
 //register_globals off
 bt_unregister_globals();
 
 $bt_tb = new tables($bt_tb_prefix);
 
 if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
 $_POST = bt_remove_magic_quotes($_POST);
 $_GET = bt_remove_magic_quotes($_GET);
 $_COOKIE = bt_remove_magic_quotes($_COOKIE);
 $_SERVER = bt_remove_magic_quotes($_SERVER);
 }
 
 if (!bt_is_installed()) {
 bt_die('Not Installed. Please run the <a href="' . BT_REL_ROOT . 'bt-install/index.html">installer</a>.');
 }
 
 bt_load_config();
 bt_gzip();
 
 /*
 Session Support
 */
 include(BT_ROOT . BT_INCLUDE . '/sessions.class.php');
 
 //don't need the cron task creating random sessions
 //if (!defined('BT_RUNNING_CRON')) {
 $bt_session = new bt_sessions($bt_db, $bt_tb->sessions);
 //}
 
 set_error_handler('bt_trigger_error');
 
 bt_load_user_data();
 
 include(BT_ROOT . BT_INCLUDE . '/plugins.functions.php');
 
 //load plugins here
 if (BT_LOAD_PLUGINS) {
 bt_load_plugins();
 bt_run_section('plugins_loaded');
 }
 
 include(BT_ROOT . BT_INCLUDE . '/pluggable.functions.php');
 
 register_shutdown_function('bt_shutdown_function');
 
 /*
 Nested Set Model Details
 */
 include(BT_ROOT . BT_INCLUDE . '/categories.class.php');
 
 /*
 
 */
 include(BT_ROOT . BT_INCLUDE . '/common-content.class.php');
 include(BT_ROOT . BT_INCLUDE . '/posts.class.php');
 include(BT_ROOT . BT_INCLUDE . '/comments.class.php');
 include(BT_ROOT . BT_INCLUDE . '/mailer.class.php');
 include(BT_ROOT . BT_INCLUDE . '/spam.class.php');
 include(BT_ROOT . BT_INCLUDE . '/akismet.class.php');
 
 include(BT_ROOT . BT_INCLUDE . '/posts-template.functions.php');
 include(BT_ROOT . BT_INCLUDE . '/content-template.functions.php');
 include(BT_ROOT . BT_INCLUDE . '/general-template.functions.php');
 include(BT_ROOT . BT_INCLUDE . '/comments-template.functions.php');
 include(BT_ROOT . BT_INCLUDE . '/themes.functions.php');
 
 include(BT_ROOT . BT_INCLUDE . '/default-filters.php');
 include(BT_ROOT . BT_INCLUDE . '/default-tasks.php');
 
 include(BT_ROOT . BT_INCLUDE . '/permissions.functions.php');
 include(BT_ROOT . BT_INCLUDE . '/users.class.php');
 
 $bt_mailer = new bt_mailer();
 
 bt_run_section('common_loaded');
 ?>
 |