$value) $_FILES[$key]['tmp_name'] = str_replace('\\', '\\\\', $value['tmp_name']); $_FILES = stripslashes_array($_FILES); } } // If a cookie name is not specified in config.php, we use the default (pun_cookie) if (empty($cookie_name)) $cookie_name = 'pun_cookie'; // If the cache directory is not specified, we use the default setting if (!defined('FORUM_CACHE_DIR')) define('FORUM_CACHE_DIR', PUN_ROOT.'cache/'); // Define a few commonly used constants define('PUN_UNVERIFIED', 0); define('PUN_ADMIN', 1); define('PUN_MOD', 2); define('PUN_GUEST', 3); define('PUN_MEMBER', 4); // Load DB abstraction layer and connect require PUN_ROOT.'include/dblayer/common_db.php'; // Start a transaction $db->start_transaction(); // Load cached config if (file_exists(FORUM_CACHE_DIR.'cache_config.php')) include FORUM_CACHE_DIR.'cache_config.php'; if (!defined('PUN_CONFIG_LOADED')) { if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) require PUN_ROOT.'include/cache.php'; generate_config_cache(); require FORUM_CACHE_DIR.'cache_config.php'; } // Verify that we are running the proper database schema revision if (!isset($pun_config['o_database_revision']) || $pun_config['o_database_revision'] < FORUM_DB_REVISION || !isset($pun_config['o_searchindex_revision']) || $pun_config['o_searchindex_revision'] < FORUM_SI_REVISION || !isset($pun_config['o_parser_revision']) || $pun_config['o_parser_revision'] < FORUM_PARSER_REVISION || version_compare($pun_config['o_cur_version'], FORUM_VERSION, '<')) { header('Location: db_update.php'); exit; } // Enable output buffering if (!defined('PUN_DISABLE_BUFFERING')) { // Should we use gzip output compression? if ($pun_config['o_gzip'] && extension_loaded('zlib')) ob_start('ob_gzhandler'); else ob_start(); } // Define standard date/time formats $forum_time_formats = array($pun_config['o_time_format'], 'H:i:s', 'H:i', 'g:i:s a', 'g:i a'); $forum_date_formats = array($pun_config['o_date_format'], 'Y-m-d', 'Y-d-m', 'd-m-Y', 'm-d-Y', 'M j Y', 'jS M Y'); // Check/update/set cookie and fetch user info $pun_user = array(); check_cookie($pun_user); // Attempt to load the common language file if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/common.php')) include PUN_ROOT.'lang/'.$pun_user['language'].'/common.php'; else error('There is no valid language pack \''.pun_htmlspecialchars($pun_user['language']).'\' installed. Please reinstall a language of that name'); // Check if we are to display a maintenance message if ($pun_config['o_maintenance'] && $pun_user['g_id'] > PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT')) maintenance_message(); // Load cached bans if (file_exists(FORUM_CACHE_DIR.'cache_bans.php')) include FORUM_CACHE_DIR.'cache_bans.php'; if (!defined('PUN_BANS_LOADED')) { if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) require PUN_ROOT.'include/cache.php'; generate_bans_cache(); require FORUM_CACHE_DIR.'cache_bans.php'; } // Check if current user is banned check_bans(); // Update online list update_users_online(); // Check to see if we logged in without a cookie being set if ($pun_user['is_guest'] && isset($_GET['login'])) message($lang_common['No cookie']); // The maximum size of a post, in bytes, since the field is now MEDIUMTEXT this allows ~16MB but lets cap at 1MB... if (!defined('PUN_MAX_POSTSIZE')) define('PUN_MAX_POSTSIZE', 1048576); if (!defined('PUN_SEARCH_MIN_WORD')) define('PUN_SEARCH_MIN_WORD', 3); if (!defined('PUN_SEARCH_MAX_WORD')) define('PUN_SEARCH_MAX_WORD', 20); if (!defined('FORUM_MAX_COOKIE_SIZE')) define('FORUM_MAX_COOKIE_SIZE', 4048);