Index: index.php =================================================================== RCS file: /cvs/drupal/drupal/index.php,v retrieving revision 1.83 diff -u -F^f -r1.83 index.php --- index.php 24 Apr 2005 16:34:32 -0000 1.83 +++ index.php 4 May 2005 17:05:21 -0000 @@ -9,10 +9,18 @@ * prints the appropriate page. */ -include_once 'includes/bootstrap.inc'; +include_once 'includes/init.inc'; +include_once 'includes/module.inc'; +drupal_bootstrap('session'); drupal_page_header(); -include_once 'includes/common.inc'; - +drupal_bootstrap('common'); +include_once 'includes/theme.inc'; +include_once 'includes/pager.inc'; +include_once 'includes/menu.inc'; +include_once 'includes/tablesort.inc'; +include_once 'includes/file.inc'; +include_once 'includes/xmlrpc.inc'; +include_once 'includes/image.inc'; fix_gpc_magic(); $return = menu_execute_active_handler(); Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.46 diff -u -F^f -r1.46 bootstrap.inc --- includes/bootstrap.inc 12 Apr 2005 16:55:11 -0000 1.46 +++ includes/bootstrap.inc 4 May 2005 17:05:21 -0000 @@ -17,57 +17,6 @@ define('WATCHDOG_WARNING', 1); define('WATCHDOG_ERROR', 2); - -/** - * Locate the appropriate configuration file. - * - * Try finding a matching configuration directory by stripping the - * website's hostname from left to right and pathname from right to - * left. The first configuration file found will be used, the - * remaining will ignored. If no configuration file is found, - * return a default value '$confdir/default'. - * - * Example for a fictitious site installed at - * http://www.drupal.org/mysite/test/ the 'settings.php' is - * searched in the following directories: - * - * 1. $confdir/www.drupal.org.mysite.test - * 2. $confdir/drupal.org.mysite.test - * 3. $confdir/org.mysite.test - * - * 4. $confdir/www.drupal.org.mysite - * 5. $confdir/drupal.org.mysite - * 6. $confdir/org.mysite - * - * 7. $confdir/www.drupal.org - * 8. $confdir/drupal.org - * 9. $confdir/org - * - * 10. $confdir/default - */ -function conf_init() { - static $conf = ''; - - if ($conf) { - return $conf; - } - - $confdir = 'sites'; - $uri = explode('/', $_SERVER['PHP_SELF']); - $server = explode('.', rtrim($_SERVER['HTTP_HOST'], '.')); - for ($i = count($uri) - 1; $i > 0; $i--) { - for ($j = count($server); $j > 0; $j--) { - $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); - if (file_exists("$confdir/$dir/settings.php")) { - $conf = "$confdir/$dir"; - return $conf; - } - } - } - $conf = "$confdir/default"; - return $conf; -} - /** * Returns and optionally sets the filename for a system item (module, * theme, etc.). The filename, whether provided, cached, or retrieved @@ -690,15 +639,4 @@ function drupal_get_messages() { return $messages; } -unset($conf); -$config = conf_init(); - -include_once "$config/settings.php"; -include_once 'includes/database.inc'; -include_once 'includes/session.inc'; -include_once 'includes/module.inc'; - -// Initialize configuration variables, using values from conf.php if available. -$conf = variable_init(isset($conf) ? $conf : array()); - ?> Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.438 diff -u -F^f -r1.438 common.inc --- includes/common.inc 28 Apr 2005 19:23:19 -0000 1.438 +++ includes/common.inc 4 May 2005 17:05:22 -0000 @@ -1860,55 +1860,7 @@ function drupal_get_path($type, $name) { return dirname(drupal_get_filename($type, $name)); } -/** - * Provide a substitute clone() function for PHP4. - */ -if (version_compare(phpversion(), '5.0') < 0) { - eval(' - function clone($object) { - return $object; - } - '); +function drupal_clone($object) { + return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object); } - -// Set the Drupal custom error handler. -set_error_handler('error_handler'); - -include_once 'includes/theme.inc'; -include_once 'includes/pager.inc'; -include_once 'includes/menu.inc'; -include_once 'includes/tablesort.inc'; -include_once 'includes/file.inc'; -include_once 'includes/xmlrpc.inc'; -include_once 'includes/image.inc'; - -// Emit the correct charset HTTP header. -drupal_set_header('Content-Type: text/html; charset=utf-8'); - -// Initialize $_GET['q'] prior to loading modules and invoking hook_init(). -if (!empty($_GET['q'])) { - $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/')); -} -else { - $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); -} - -// Initialize all enabled modules. -module_init(); - -if (!user_access('bypass input data check')) { - // We can't use $_REQUEST because it consists of the contents of $_POST, - // $_GET and $_COOKIE: if any of the input arrays share a key, only one - // value will be verified. - if (!valid_input_data($_GET) - || !valid_input_data($_POST) - || !valid_input_data($_COOKIE) - || !valid_input_data($_FILES)) { - die('Terminated request because of suspicious input data.'); - } -} - -// Initialize the localization system. -$locale = locale_initialize(); - ?> Index: includes/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.inc,v retrieving revision 1.40 diff -u -F^f -r1.40 database.inc --- includes/database.inc 8 Apr 2005 14:24:03 -0000 1.40 +++ includes/database.inc 4 May 2005 17:05:22 -0000 @@ -279,7 +279,4 @@ function db_rewrite_sql($query, $primary * @} End of "defgroup database". */ -// Initialize the default database. -db_set_active(); - ?> Index: includes/session.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/session.inc,v retrieving revision 1.15 diff -u -F^f -r1.15 session.inc --- includes/session.inc 11 Apr 2005 19:05:52 -0000 1.15 +++ includes/session.inc 4 May 2005 17:05:22 -0000 @@ -6,9 +6,6 @@ * User session handling functions. */ -session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); -session_start(); - /*** Session functions *****************************************************/ function sess_open($save_path, $session_name) { Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.231 diff -u -F^f -r1.231 theme.inc --- includes/theme.inc 30 Apr 2005 17:47:57 -0000 1.231 +++ includes/theme.inc 4 May 2005 17:05:22 -0000 @@ -34,6 +34,7 @@ function init_theme() { global $user, $custom_theme, $theme_engine, $theme_key; + drupal_bootstrap('database'); $themes = list_themes(); // Only select the user selected theme if it is available in the