--- a/punbb/include/common.php Wed Jul 11 21:28:39 2007 -0400
+++ b/punbb/include/common.php Thu Jul 12 01:04:01 2007 -0400
@@ -32,31 +32,37 @@
if (!defined('PUN_ROOT'))
exit('The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.');
-
// Load the functions script
require PUN_ROOT.'include/functions.php';
-// Reverse the effect of register_globals
-unregister_globals();
+// Load the compatibility layer between Pun's DBAL and Enano's DBAL
+require PUN_ROOT.'include/enano_dbal.php';
-
-@include PUN_ROOT.'config.php';
+// Reverse the effect of register_globals
+// unregister_globals(); // DISABLED for Enano
// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run <a href="install.php">install.php</a> to install PunBB first.');
+// Record the start time (will be used to calculate the generation time for the page)
-// Record the start time (will be used to calculate the generation time for the page)
-list($usec, $sec) = explode(' ', microtime());
-$pun_start = ((float)$usec + (float)$sec);
+function get_microtime()
+{
+ list($usec, $sec) = explode(' ', microtime());
+ return ((float)$usec + (float)$sec);
+}
+
+$pun_start = get_microtime();
// Make sure PHP reports all errors except E_NOTICE. PunBB supports E_ALL, but a lot of scripts it may interact with, do not.
-error_reporting(E_ALL ^ E_NOTICE);
+error_reporting(E_ALL);
// Turn off magic_quotes_runtime
set_magic_quotes_runtime(0);
+/*
+Disabled for Enano - this is already done by Enano's API
// Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled)
if (get_magic_quotes_gpc())
{
@@ -69,6 +75,7 @@
$_POST = stripslashes_array($_POST);
$_COOKIE = stripslashes_array($_COOKIE);
}
+*/
// Seed the random number generator
mt_srand((double)microtime()*1000000);
@@ -79,17 +86,24 @@
// Define a few commonly used constants
define('PUN_UNVERIFIED', 32000);
-define('PUN_ADMIN', 1);
-define('PUN_MOD', 2);
-define('PUN_GUEST', 3);
-define('PUN_MEMBER', 4);
+define('PUN_ADMIN', USER_LEVEL_ADMIN);
+define('PUN_MOD', USER_LEVEL_MOD);
+define('PUN_GUEST', USER_LEVEL_GUEST);
+define('PUN_MEMBER', USER_LEVEL_MEMBER);
-
+/*
+Skip this - Enano's API will handle it
// Load DB abstraction layer and connect
require PUN_ROOT.'include/dblayer/common_db.php';
// Start a transaction
-$db->start_transaction();
+$pun_db->start_transaction();
+*/
+
+$GLOBALS['pun_db'] = new PunBB_DBAL_Enano();
+$GLOBALS['pun_config'] = array();
+
+$pun_config =& $GLOBALS['pun_config'];
// Load cached config
@include PUN_ROOT.'cache/cache_config.php';
@@ -100,7 +114,6 @@
require PUN_ROOT.'cache/cache_config.php';
}
-
// Enable output buffering
if (!defined('PUN_DISABLE_BUFFERING'))
{
@@ -114,9 +127,9 @@
ob_start();
}
-
// Check/update/set cookie and fetch user info
-$pun_user = array();
+$GLOBALS['pun_user'] = array();
+$pun_user =& $GLOBALS['pun_user'];
check_cookie($pun_user);
// Attempt to load the common language file
@@ -125,11 +138,14 @@
exit('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'))
+if ($pun_config['o_maintenance'] && $pun_user['g_id'] < PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT'))
maintenance_message();
// Load cached bans
+/*
+// // DISABLED IN ENANO // //
+// Enano has its own ban list //
@include PUN_ROOT.'cache/cache_bans.php';
if (!defined('PUN_BANS_LOADED'))
{
@@ -140,7 +156,7 @@
// Check if current user is banned
check_bans();
-
+*/
// Update online list
update_users_online();