2001-02-24 00:31:58 +00:00
< ? php
2005-04-09 12:26:45 +00:00
/**
*
* @ package phpBB3
* @ version $Id $
* @ copyright ( c ) 2005 phpBB Group
* @ license http :// opensource . org / licenses / gpl - license . php GNU Public License
*
*/
/**
*/
2001-08-30 22:20:23 +00:00
2004-11-30 11:05:23 +00:00
// Remove the following line to enable this software, be sure you note what it
// says before continuing
die ( 'This software is unsupported in any and all respects. By removing this notice (found in common.php) you are noting your acceptance of this. Do not ask support questions of any kind for this release at either area51.phpbb.com or www.phpbb.com. Support for this version will appear when the beta cycle begins' );
2003-01-21 14:33:07 +00:00
if ( ! defined ( 'IN_PHPBB' ))
2002-03-18 23:45:24 +00:00
{
2004-09-01 15:47:46 +00:00
exit ;
2002-03-18 23:45:24 +00:00
}
2003-08-27 16:32:44 +00:00
$starttime = explode ( ' ' , microtime ());
$starttime = $starttime [ 1 ] + $starttime [ 0 ];
2002-10-17 02:50:50 +00:00
error_reporting ( E_ERROR | E_WARNING | E_PARSE ); // This will NOT report uninitialized variables
//error_reporting(E_ALL);
2002-10-04 13:09:10 +00:00
set_magic_quotes_runtime ( 0 );
2001-08-09 22:21:55 +00:00
2003-08-23 21:51:31 +00:00
// Be paranoid with passed vars
if ( @ ini_get ( 'register_globals' ))
{
foreach ( $_REQUEST as $var_name => $void )
{
unset ( ${$var_name} );
}
}
2002-07-14 14:45:26 +00:00
require ( $phpbb_root_path . 'config.' . $phpEx );
2001-08-09 22:21:55 +00:00
2003-01-21 14:33:07 +00:00
if ( ! defined ( 'PHPBB_INSTALLED' ))
2002-04-20 00:22:29 +00:00
{
2002-07-14 14:45:26 +00:00
header ( 'Location: install/install.' . $phpEx );
exit ;
2001-08-09 22:21:55 +00:00
}
2004-09-16 18:33:22 +00:00
if ( defined ( 'DEBUG_EXTRA' ))
{
$base_memory_usage = 0 ;
if ( function_exists ( 'memory_get_usage' ))
{
$base_memory_usage = memory_get_usage ();
}
}
2003-02-25 16:49:45 +00:00
// Load Extensions
2003-02-25 18:20:33 +00:00
if ( ! empty ( $load_extensions ))
2003-02-25 16:49:45 +00:00
{
$load_extensions = explode ( ',' , $load_extensions );
2003-02-25 18:20:33 +00:00
foreach ( $load_extensions as $extension )
2003-02-25 16:49:45 +00:00
{
2003-02-25 18:20:33 +00:00
@ dl ( trim ( $extension ));
2003-02-25 16:49:45 +00:00
}
}
2002-10-26 12:36:38 +00:00
// Include files
2003-03-19 01:44:44 +00:00
require ( $phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx );
2003-03-17 10:54:45 +00:00
require ( $phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx );
2002-10-26 12:36:38 +00:00
require ( $phpbb_root_path . 'includes/template.' . $phpEx );
require ( $phpbb_root_path . 'includes/session.' . $phpEx );
require ( $phpbb_root_path . 'includes/functions.' . $phpEx );
2002-04-20 00:22:29 +00:00
// User related
2003-02-25 18:20:33 +00:00
define ( 'ANONYMOUS' , 1 );
2002-10-20 19:19:07 +00:00
2002-04-20 00:22:29 +00:00
define ( 'USER_ACTIVATION_NONE' , 0 );
define ( 'USER_ACTIVATION_SELF' , 1 );
define ( 'USER_ACTIVATION_ADMIN' , 2 );
2002-07-28 19:41:21 +00:00
define ( 'USER_ACTIVATION_DISABLE' , 3 );
2002-04-20 00:22:29 +00:00
2003-05-26 23:53:34 +00:00
define ( 'AVATAR_UPLOAD' , 1 );
define ( 'AVATAR_REMOTE' , 2 );
define ( 'AVATAR_GALLERY' , 3 );
2002-04-20 00:22:29 +00:00
2003-10-15 17:43:07 +00:00
define ( 'USER_NORMAL' , 0 );
define ( 'USER_INACTIVE' , 1 );
define ( 'USER_IGNORE' , 2 );
define ( 'USER_FOUNDER' , 3 );
2002-08-13 16:34:17 +00:00
// ACL
2003-04-12 20:01:10 +00:00
define ( 'ACL_NO' , 0 );
define ( 'ACL_YES' , 1 );
2003-04-15 17:34:03 +00:00
define ( 'ACL_UNSET' , - 1 );
2002-08-13 16:34:17 +00:00
2002-04-20 00:22:29 +00:00
// Group settings
define ( 'GROUP_OPEN' , 0 );
define ( 'GROUP_CLOSED' , 1 );
define ( 'GROUP_HIDDEN' , 2 );
2002-11-09 00:45:34 +00:00
define ( 'GROUP_SPECIAL' , 3 );
2003-01-31 15:39:54 +00:00
define ( 'GROUP_FREE' , 4 );
2002-04-20 00:22:29 +00:00
2002-08-13 16:34:17 +00:00
// Forum/Topic states
2003-05-02 15:50:11 +00:00
define ( 'FORUM_CAT' , 0 );
define ( 'FORUM_POST' , 1 );
define ( 'FORUM_LINK' , 2 );
2002-08-13 16:34:17 +00:00
define ( 'ITEM_UNLOCKED' , 0 );
define ( 'ITEM_LOCKED' , 1 );
define ( 'ITEM_MOVED' , 2 );
2002-04-20 00:22:29 +00:00
// Topic types
define ( 'POST_NORMAL' , 0 );
define ( 'POST_STICKY' , 1 );
define ( 'POST_ANNOUNCE' , 2 );
2003-06-23 14:00:57 +00:00
define ( 'POST_GLOBAL' , 3 );
2002-04-20 00:22:29 +00:00
2002-11-27 13:24:46 +00:00
// Lastread types
2004-11-06 14:24:34 +00:00
define ( 'TRACK_NORMAL' , 0 );
2003-04-26 01:17:40 +00:00
define ( 'TRACK_POSTED' , 1 );
2002-11-27 13:24:46 +00:00
2003-10-12 11:59:23 +00:00
// Notify methods
define ( 'NOTIFY_EMAIL' , 0 );
define ( 'NOTIFY_IM' , 1 );
define ( 'NOTIFY_BOTH' , 2 );
2004-02-01 21:45:40 +00:00
// Email Priority Settings
define ( 'MAIL_LOW_PRIORITY' , 4 );
define ( 'MAIL_NORMAL_PRIORITY' , 3 );
define ( 'MAIL_HIGH_PRIORITY' , 2 );
2003-07-06 18:48:33 +00:00
// Log types
define ( 'LOG_ADMIN' , 0 );
define ( 'LOG_MOD' , 1 );
define ( 'LOG_CRITICAL' , 2 );
2004-02-11 18:28:24 +00:00
define ( 'LOG_USERS' , 3 );
2003-07-06 18:48:33 +00:00
2004-05-02 13:06:57 +00:00
// Private messaging - Do NOT change these values
define ( 'PRIVMSGS_HOLD_BOX' , - 4 );
define ( 'PRIVMSGS_NO_BOX' , - 3 );
define ( 'PRIVMSGS_OUTBOX' , - 2 );
define ( 'PRIVMSGS_SENTBOX' , - 1 );
define ( 'PRIVMSGS_INBOX' , 0 );
2002-04-20 00:22:29 +00:00
2004-05-31 18:00:10 +00:00
// Full Folder Actions
define ( 'FULL_FOLDER_NONE' , - 3 );
define ( 'FULL_FOLDER_DELETE' , - 2 );
define ( 'FULL_FOLDER_HOLD' , - 1 );
2003-04-11 19:51:38 +00:00
// Download Modes - Attachments
define ( 'INLINE_LINK' , 1 );
define ( 'PHYSICAL_LINK' , 2 );
// Categories - Attachments
2004-09-16 18:33:22 +00:00
define ( 'ATTACHMENT_CATEGORY_NONE' , 0 );
define ( 'ATTACHMENT_CATEGORY_IMAGE' , 1 ); // Inline Images
define ( 'ATTACHMENT_CATEGORY_WM' , 2 ); // Windows Media Files - Streaming
define ( 'ATTACHMENT_CATEGORY_RM' , 3 ); // Real Media Files - Streaming
define ( 'ATTACHMENT_CATEGORY_THUMB' , 4 ); // Not used within the database, only while displaying posts
2004-05-02 13:06:57 +00:00
//define('SWF_CAT', 5); // Replaced by [flash]? or an additional possibility?
2003-04-11 19:51:38 +00:00
2003-04-11 00:02:54 +00:00
// BBCode UID length
define ( 'BBCODE_UID_LEN' , 5 );
2004-02-08 18:02:17 +00:00
// Number of core BBCodes
define ( 'NUM_CORE_BBCODES' , 12 );
// Profile Field Types
2004-01-10 12:23:24 +00:00
define ( 'FIELD_INT' , 1 );
define ( 'FIELD_STRING' , 2 );
define ( 'FIELD_TEXT' , 3 );
define ( 'FIELD_BOOL' , 4 );
define ( 'FIELD_DROPDOWN' , 5 );
define ( 'FIELD_DATE' , 6 );
2002-04-20 00:22:29 +00:00
// Table names
2002-07-14 14:45:26 +00:00
define ( 'ACL_GROUPS_TABLE' , $table_prefix . 'auth_groups' );
define ( 'ACL_OPTIONS_TABLE' , $table_prefix . 'auth_options' );
2003-04-12 20:01:10 +00:00
define ( 'ACL_DEPS_TABLE' , $table_prefix . 'auth_deps' );
2003-01-11 01:37:34 +00:00
define ( 'ACL_PRESETS_TABLE' , $table_prefix . 'auth_presets' );
2002-07-14 14:45:26 +00:00
define ( 'ACL_USERS_TABLE' , $table_prefix . 'auth_users' );
2003-03-22 15:48:46 +00:00
define ( 'ATTACHMENTS_TABLE' , $table_prefix . 'attachments' );
2002-04-20 00:22:29 +00:00
define ( 'BANLIST_TABLE' , $table_prefix . 'banlist' );
2003-08-23 21:51:31 +00:00
define ( 'BBCODES_TABLE' , $table_prefix . 'bbcodes' );
2004-06-06 21:44:49 +00:00
define ( 'BOOKMARKS_TABLE' , $table_prefix . 'bookmarks' );
2003-10-15 17:43:07 +00:00
define ( 'BOTS_TABLE' , $table_prefix . 'bots' );
2003-08-10 19:46:03 +00:00
define ( 'CACHE_TABLE' , $table_prefix . 'cache' );
2002-04-20 00:22:29 +00:00
define ( 'CONFIG_TABLE' , $table_prefix . 'config' );
2003-01-21 15:01:39 +00:00
define ( 'CONFIRM_TABLE' , $table_prefix . 'confirm' );
2004-05-31 18:00:10 +00:00
define ( 'PROFILE_FIELDS_TABLE' , $table_prefix . 'profile_fields' );
define ( 'PROFILE_LANG_TABLE' , $table_prefix . 'profile_lang' );
define ( 'PROFILE_DATA_TABLE' , $table_prefix . 'profile_fields_data' );
define ( 'PROFILE_FIELDS_LANG_TABLE' , $table_prefix . 'profile_fields_lang' );
2002-07-14 14:45:26 +00:00
define ( 'DISALLOW_TABLE' , $table_prefix . 'disallow' ); //
2003-09-04 18:30:20 +00:00
define ( 'DRAFTS_TABLE' , $table_prefix . 'drafts' );
2003-03-22 15:48:46 +00:00
define ( 'EXTENSIONS_TABLE' , $table_prefix . 'extensions' );
define ( 'EXTENSION_GROUPS_TABLE' , $table_prefix . 'extension_groups' );
2002-04-20 00:22:29 +00:00
define ( 'FORUMS_TABLE' , $table_prefix . 'forums' );
2003-09-07 13:46:51 +00:00
define ( 'FORUMS_ACCESS_TABLE' , $table_prefix . 'forum_access' );
2003-04-26 01:17:40 +00:00
define ( 'FORUMS_TRACK_TABLE' , $table_prefix . 'forums_marking' );
2002-04-20 22:56:09 +00:00
define ( 'FORUMS_WATCH_TABLE' , $table_prefix . 'forums_watch' );
2002-04-20 00:22:29 +00:00
define ( 'GROUPS_TABLE' , $table_prefix . 'groups' );
2003-01-31 15:39:54 +00:00
define ( 'GROUPS_MODERATOR_TABLE' , $table_prefix . 'groups_moderator' );
2002-07-14 14:45:26 +00:00
define ( 'ICONS_TABLE' , $table_prefix . 'icons' );
2003-05-08 01:14:14 +00:00
define ( 'LANG_TABLE' , $table_prefix . 'lang' );
2003-07-06 18:48:33 +00:00
define ( 'LOG_TABLE' , $table_prefix . 'log' );
2002-11-18 18:56:27 +00:00
define ( 'MODERATOR_TABLE' , $table_prefix . 'moderator_cache' );
2003-10-01 17:24:53 +00:00
define ( 'MODULES_TABLE' , $table_prefix . 'modules' );
2002-04-20 00:22:29 +00:00
define ( 'POSTS_TABLE' , $table_prefix . 'posts' );
define ( 'PRIVMSGS_TABLE' , $table_prefix . 'privmsgs' );
2004-05-02 13:06:57 +00:00
define ( 'PRIVMSGS_TO_TABLE' , $table_prefix . 'privmsgs_to' );
define ( 'PRIVMSGS_FOLDER_TABLE' , $table_prefix . 'privmsgs_folder' );
define ( 'PRIVMSGS_RULES_TABLE' , $table_prefix . 'privmsgs_rules' );
2002-04-20 00:22:29 +00:00
define ( 'RANKS_TABLE' , $table_prefix . 'ranks' );
2003-01-21 15:01:39 +00:00
define ( 'RATINGS_TABLE' , $table_prefix . 'ratings' );
2003-03-06 01:13:44 +00:00
define ( 'REPORTS_TABLE' , $table_prefix . 'reports' );
define ( 'REASONS_TABLE' , $table_prefix . 'reports_reasons' );
2002-04-20 00:22:29 +00:00
define ( 'SEARCH_TABLE' , $table_prefix . 'search_results' );
define ( 'SEARCH_WORD_TABLE' , $table_prefix . 'search_wordlist' );
define ( 'SEARCH_MATCH_TABLE' , $table_prefix . 'search_wordmatch' );
define ( 'SESSIONS_TABLE' , $table_prefix . 'sessions' );
2003-11-23 22:25:46 +00:00
define ( 'SITELIST_TABLE' , $table_prefix . 'sitelist' );
2002-04-20 00:22:29 +00:00
define ( 'SMILIES_TABLE' , $table_prefix . 'smilies' );
2002-07-14 14:45:26 +00:00
define ( 'STYLES_TABLE' , $table_prefix . 'styles' );
define ( 'STYLES_TPL_TABLE' , $table_prefix . 'styles_template' );
2003-08-06 18:29:22 +00:00
define ( 'STYLES_TPLDATA_TABLE' , $table_prefix . 'styles_template_data' );
2002-07-14 14:45:26 +00:00
define ( 'STYLES_CSS_TABLE' , $table_prefix . 'styles_theme' );
define ( 'STYLES_IMAGE_TABLE' , $table_prefix . 'styles_imageset' );
2002-04-20 00:22:29 +00:00
define ( 'TOPICS_TABLE' , $table_prefix . 'topics' );
2003-04-26 01:17:40 +00:00
define ( 'TOPICS_TRACK_TABLE' , $table_prefix . 'topics_marking' );
2002-04-20 00:22:29 +00:00
define ( 'TOPICS_WATCH_TABLE' , $table_prefix . 'topics_watch' );
define ( 'USER_GROUP_TABLE' , $table_prefix . 'user_group' );
define ( 'USERS_TABLE' , $table_prefix . 'users' );
2003-11-05 18:51:31 +00:00
define ( 'USERS_NOTES_TABLE' , $table_prefix . 'users_notes' );
2002-04-20 00:22:29 +00:00
define ( 'WORDS_TABLE' , $table_prefix . 'words' );
2002-10-30 00:57:27 +00:00
define ( 'POLL_OPTIONS_TABLE' , $table_prefix . 'poll_results' );
define ( 'POLL_VOTES_TABLE' , $table_prefix . 'poll_voters' );
2003-10-01 17:24:53 +00:00
define ( 'ZEBRA_TABLE' , $table_prefix . 'zebra' );
2002-04-20 00:22:29 +00:00
2003-11-05 18:51:31 +00:00
define ( 'STRIP' , ( get_magic_quotes_gpc ()) ? true : false );
2003-10-12 11:59:23 +00:00
2002-10-26 12:36:38 +00:00
// Set PHP error handler to ours
set_error_handler ( 'msg_handler' );
2002-07-14 14:45:26 +00:00
2003-01-21 14:33:07 +00:00
// Instantiate some basic classes
2003-06-21 15:14:47 +00:00
$user = new user ();
$auth = new auth ();
2003-08-06 18:33:03 +00:00
$template = new template ();
2003-08-11 21:45:50 +00:00
$cache = new acm ();
2003-06-21 15:14:47 +00:00
$db = new sql_db ();
// Connect to DB
2003-06-13 16:45:07 +00:00
$db -> sql_connect ( $dbhost , $dbuser , $dbpasswd , $dbname , $dbport , false );
2001-11-26 12:09:37 +00:00
2005-03-21 22:43:07 +00:00
// We do not need this any longer, unset for safety purposes
unset ( $dbpasswd );
2003-01-21 14:33:07 +00:00
// Grab global variables, re-cache if necessary
2003-01-22 20:44:37 +00:00
if ( $config = $cache -> get ( 'config' ))
{
2004-11-06 14:24:34 +00:00
$sql = ' SELECT config_name , config_value
2003-01-22 20:44:37 +00:00
FROM ' . CONFIG_TABLE . '
WHERE is_dynamic = 1 ' ;
$result = $db -> sql_query ( $sql );
while ( $row = $db -> sql_fetchrow ( $result ))
{
$config [ $row [ 'config_name' ]] = $row [ 'config_value' ];
}
2005-01-15 18:49:54 +00:00
$db -> sql_freeresult ( $result );
2003-01-22 20:44:37 +00:00
}
else
2003-01-11 22:56:49 +00:00
{
2003-04-23 21:48:41 +00:00
$config = $cached_config = array ();
2003-01-11 22:56:49 +00:00
2004-11-06 14:24:34 +00:00
$sql = ' SELECT config_name , config_value , is_dynamic
2003-01-21 14:33:07 +00:00
FROM ' . CONFIG_TABLE ;
2003-01-11 22:56:49 +00:00
$result = $db -> sql_query ( $sql );
while ( $row = $db -> sql_fetchrow ( $result ))
{
2003-04-23 21:48:41 +00:00
if ( ! $row [ 'is_dynamic' ])
{
$cached_config [ $row [ 'config_name' ]] = $row [ 'config_value' ];
}
2003-01-11 22:56:49 +00:00
$config [ $row [ 'config_name' ]] = $row [ 'config_value' ];
}
2003-01-21 14:33:07 +00:00
$db -> sql_freeresult ( $result );
2003-01-11 22:56:49 +00:00
2003-04-23 21:48:41 +00:00
$cache -> put ( 'config' , $cached_config );
unset ( $cached_config );
2003-01-20 05:12:38 +00:00
}
2003-11-26 23:54:19 +00:00
// Tidy the cache
if ( method_exists ( $cache , 'tidy' ) && time () - $config [ 'cache_gc' ] > $config [ 'cache_last_gc' ])
2003-01-11 22:56:49 +00:00
{
2003-11-26 23:54:19 +00:00
$cache -> tidy ();
set_config ( 'cache_last_gc' , time (), TRUE );
2003-01-11 22:56:49 +00:00
}
2002-10-26 12:36:38 +00:00
2003-10-12 23:34:09 +00:00
// Handle email/cron queue.
if ( time () - $config [ 'queue_interval' ] >= $config [ 'last_queue_run' ] && ! defined ( 'IN_ADMIN' ))
2003-06-21 15:14:47 +00:00
{
2003-10-12 23:34:09 +00:00
if ( file_exists ( $phpbb_root_path . 'cache/queue.' . $phpEx ))
{
include_once ( $phpbb_root_path . 'includes/functions_messenger.' . $phpEx );
$queue = new queue ();
$queue -> process ();
}
2003-06-21 15:14:47 +00:00
}
2004-05-02 13:06:57 +00:00
// Warn about install/ directory
if ( file_exists ( 'install' ))
{
// trigger_error('REMOVE_INSTALL');
}
2003-01-21 14:33:07 +00:00
?>